iso-filecoin
Version:
Isomorphic filecoin abstractions for RPC, signatures, address, token and wallet
96 lines • 2.69 kB
TypeScript
/**
* @typedef {import('./types.js').MessageObj} MessageObj
* @typedef {import('./types.js').PartialMessageObj} PartialMessageObj
*/
/**
* Message validation schema
*/
export const MessageSchema: z.ZodObject<{
version: z.ZodDefault<z.ZodLiteral<0>>;
nonce: z.ZodDefault<z.ZodInt>;
gasLimit: z.ZodDefault<z.ZodInt>;
gasFeeCap: z.ZodDefault<z.ZodString>;
gasPremium: z.ZodDefault<z.ZodString>;
method: z.ZodDefault<z.ZodInt>;
to: z.ZodString;
from: z.ZodString;
value: z.ZodString;
params: z.ZodDefault<z.ZodBase64>;
}, z.core.$strip>;
export namespace Schemas {
export { MessageSchema as message };
export { MessageSchemaPartial as messagePartial };
}
/**
* Filecoin Message class
*/
export class Message {
/**
* Create message from Lotus message
*
* @param {import('./types').LotusMessage} json
*/
static fromLotus(json: import("./types").LotusMessage): Message;
/**
*
* @param {PartialMessageObj} msg
*/
constructor(msg: PartialMessageObj);
version: 0;
to: string;
from: string;
nonce: number;
value: string;
gasLimit: number;
gasFeeCap: string;
gasPremium: string;
method: number;
params: string;
/**
* Convert message to Lotus message
*/
toLotus(): {
Version: 0;
To: string;
From: string;
Nonce: number;
Value: string;
GasLimit: number;
GasFeeCap: string;
GasPremium: string;
Method: number;
Params: string;
};
/**
* Prepare message for signing with nonce and gas estimation
*
* @param {import('./rpc.js').RPC} rpc
*/
prepare(rpc: import("./rpc.js").RPC): Promise<this>;
/**
* Serialize message using dag-cbor
*/
serialize(): Uint8Array<ArrayBufferLike>;
/**
* CID bytes of the filecoin message
*/
cidBytes(): Uint8Array<ArrayBufferLike>;
#private;
}
export type MessageObj = import("./types.js").MessageObj;
export type PartialMessageObj = import("./types.js").PartialMessageObj;
import * as z from 'zod';
declare const MessageSchemaPartial: z.ZodObject<{
version: z.ZodOptional<z.ZodDefault<z.ZodLiteral<0>>>;
nonce: z.ZodOptional<z.ZodDefault<z.ZodInt>>;
gasLimit: z.ZodOptional<z.ZodDefault<z.ZodInt>>;
gasFeeCap: z.ZodOptional<z.ZodDefault<z.ZodString>>;
gasPremium: z.ZodOptional<z.ZodDefault<z.ZodString>>;
method: z.ZodOptional<z.ZodDefault<z.ZodInt>>;
to: z.ZodString;
from: z.ZodString;
value: z.ZodString;
params: z.ZodOptional<z.ZodDefault<z.ZodBase64>>;
}, z.core.$strip>;
export {};
//# sourceMappingURL=message.d.ts.map