UNPKG

@ar.io/sdk

Version:

[![codecov](https://codecov.io/gh/ar-io/ar-io-sdk/graph/badge.svg?token=7dXKcT7dJy)](https://codecov.io/gh/ar-io/ar-io-sdk)

79 lines (78 loc) 3.05 kB
import Arweave from 'arweave'; import { Logger } from '../common/index.js'; import { SpawnANTState } from '../types/ant.js'; import { AoClient, AoEpochData, AoEpochDistributed, AoSigner, ContractSigner, ProcessId, SpawnAntProgressEvent, WalletAddress } from '../types/index.js'; export type SpawnANTParams = { signer: AoSigner; module?: string; ao?: AoClient; scheduler?: string; state?: SpawnANTState; stateContractTxId?: string; antRegistryId?: string; logger?: Logger; authority?: string; tags?: { name: string; value: string; }[]; /** * @deprecated Compiled modules are now being used instead of luaCodeTxId */ luaCodeTxId?: string; /** * @deprecated no longer in use due to compiled modules being preferred */ arweave?: Arweave; /** * Callback function to be called when signing progress is made */ onSigningProgress?: (name: keyof SpawnAntProgressEvent, payload: SpawnAntProgressEvent[keyof SpawnAntProgressEvent]) => void; }; export declare function spawnANT({ signer, module, ao, scheduler, state, tags, antRegistryId, logger, authority, onSigningProgress, }: SpawnANTParams): Promise<ProcessId>; export declare function forkANT({ signer, antProcessId, logger, ao, moduleId, antRegistryId, onSigningProgress, }: { signer: AoSigner; antProcessId: string; moduleId?: string; logger?: Logger; ao?: AoClient; antRegistryId?: string; onSigningProgress?: (name: keyof SpawnAntProgressEvent, payload: SpawnAntProgressEvent[keyof SpawnAntProgressEvent]) => void; }): Promise<string>; /** * @deprecated * Direct Evals are not encouraged when dealing with ANTs. * Instead, use spawnANT to fork an ANT to new module source code */ export declare function evolveANT({ signer, processId, luaCodeTxId, ao, logger, arweave, }: { signer: AoSigner; processId: string; luaCodeTxId?: string; ao?: AoClient; logger?: Logger; arweave?: Arweave; }): Promise<string>; export declare function isAoSigner(value: unknown): value is AoSigner; export declare function createAoSigner(signer: ContractSigner): AoSigner; export declare const defaultTargetManifestId = "-k7t8xMoB8hW482609Z9F4bTFMC3MnuW8bTvTyT8pFI"; export declare const defaultANTLogoId = "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A"; export declare function initANTStateForAddress({ owner, targetId, ttlSeconds, keywords, controllers, description, ticker, name, logo, }: Partial<SpawnANTState> & { targetId?: string; ttlSeconds?: number; owner: WalletAddress; }): SpawnANTState; /** * Uses zod schema to parse the epoch data */ export declare function parseAoEpochData(value: unknown): AoEpochData<AoEpochDistributed>; export declare function errorMessageFromOutput(output: { Error?: string; Messages?: { Tags?: { name: string; value: string; }[]; Data?: string; }[]; }): string | undefined; export declare function removeUnicodeFromError(error: string): string;