UNPKG

iso-filecoin

Version:

Isomorphic filecoin abstractions for RPC, signatures, address, token and wallet

146 lines 3.96 kB
/** * @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.ZodNumber>; gasLimit: z.ZodDefault<z.ZodNumber>; gasFeeCap: z.ZodDefault<z.ZodString>; gasPremium: z.ZodDefault<z.ZodString>; method: z.ZodDefault<z.ZodNumber>; to: z.ZodString; from: z.ZodString; /** * Value in attoFIL */ value: z.ZodEffects<z.ZodString, string, string>; /** * Params encoded as base64pad */ params: z.ZodDefault<z.ZodString>; }, "strip", z.ZodTypeAny, { value: string; params: string; version: 0; nonce: number; gasLimit: number; gasFeeCap: string; gasPremium: string; method: number; to: string; from: string; }, { value: string; to: string; from: string; params?: string | undefined; version?: 0 | undefined; nonce?: number | undefined; gasLimit?: number | undefined; gasFeeCap?: string | undefined; gasPremium?: string | undefined; method?: number | undefined; }>; 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 { z } from 'zod'; declare const MessageSchemaPartial: z.ZodObject<{ value: z.ZodEffects<z.ZodString, string, string>; params: z.ZodOptional<z.ZodDefault<z.ZodString>>; version: z.ZodOptional<z.ZodDefault<z.ZodLiteral<0>>>; nonce: z.ZodOptional<z.ZodDefault<z.ZodNumber>>; gasLimit: z.ZodOptional<z.ZodDefault<z.ZodNumber>>; gasFeeCap: z.ZodOptional<z.ZodDefault<z.ZodString>>; gasPremium: z.ZodOptional<z.ZodDefault<z.ZodString>>; method: z.ZodOptional<z.ZodDefault<z.ZodNumber>>; to: z.ZodString; from: z.ZodString; }, "strip", z.ZodTypeAny, { value: string; to: string; from: string; params?: string | undefined; version?: 0 | undefined; nonce?: number | undefined; gasLimit?: number | undefined; gasFeeCap?: string | undefined; gasPremium?: string | undefined; method?: number | undefined; }, { value: string; to: string; from: string; params?: string | undefined; version?: 0 | undefined; nonce?: number | undefined; gasLimit?: number | undefined; gasFeeCap?: string | undefined; gasPremium?: string | undefined; method?: number | undefined; }>; export {}; //# sourceMappingURL=message.d.ts.map