UNPKG

@ickb/utils

Version:

General utilities built on top of CCC

46 lines 2.01 kB
import { ccc } from "@ckb-ccc/core"; import { type ScriptDeps, type ValueComponents } from "./utils.js"; import type { SmartTransaction } from "./transaction.js"; export interface UdtHandler extends ScriptDeps { getInputsUdtBalance(client: ccc.Client, tx: SmartTransaction): Promise<[ccc.FixedPoint, ccc.FixedPoint]>; getOutputsUdtBalance(tx: SmartTransaction): [ccc.FixedPoint, ccc.FixedPoint]; completeUdt(signer: ccc.Signer, tx: SmartTransaction, options?: { shouldAddInputs?: boolean; compressState?: boolean; }): Promise<[number, boolean]>; name: string; symbol: string; decimals: number; } export declare class ErrorTransactionInsufficientCoin extends ccc.ErrorTransactionInsufficientCoin { readonly symbol: string; readonly decimals: number; constructor(amount: ccc.Num, type: ccc.Script, symbol: string, decimals: number); } export declare class UdtManager implements UdtHandler { readonly script: ccc.Script; readonly cellDeps: ccc.CellDep[]; readonly name: string; readonly symbol: string; readonly decimals: number; constructor(script: ccc.Script, cellDeps: ccc.CellDep[], name: string, symbol: string, decimals: number); isUdt(cell: ccc.Cell): boolean; getInputsUdtBalance(client: ccc.Client, tx: SmartTransaction): Promise<[ccc.FixedPoint, ccc.FixedPoint]>; getOutputsUdtBalance(tx: SmartTransaction): [ccc.FixedPoint, ccc.FixedPoint]; completeUdt(signer: ccc.Signer, tx: SmartTransaction, options?: { shouldAddInputs?: boolean; compressState?: boolean; }): Promise<[number, boolean]>; addUdts(tx: SmartTransaction, udts: UdtCell[]): void; findUdts(client: ccc.Client, locks: ccc.Script[], options?: { onChain?: boolean; limit?: number; }): AsyncGenerator<UdtCell>; } export interface UdtCell extends ValueComponents { cell: ccc.Cell; [isUdtSymbol]: true; } declare const isUdtSymbol: unique symbol; export {}; //# sourceMappingURL=udt.d.ts.map