import type { CantonConnector, CantonHolding, CantonInstrument, CantonPrepareExecuteParams } from "../../core/types/canton"; import type { Token } from "../../core/types/tokens"; import type { DamlValueJson } from "./cantonDamlValue"; /** Metadata key used by Splice token-standard transfers to carry our Squid orderhash memo. */ export declare const CANTON_MEMO_KEY = "splice.lfdecentralizedtrust.org/reason"; /** Interface id for the transfer factory contract returned by the token registry. */ export declare const TRANSFER_FACTORY_INTERFACE_ID = "#splice-api-token-transfer-instruction-v1:Splice.Api.Token.TransferInstructionV1:TransferFactory"; export declare function resolveCantonRegistryUrl(instrument: CantonInstrument): string; type ChoiceContextData = { values?: Record; } & Record; interface TransferChoiceArgs { expectedAdmin: string; transfer: { sender: string; receiver: string; amount: string; instrumentId: { admin: string; id: string; }; requestedAt: string; executeBefore: string; /** * The input holdings to transfer. * Cids: Contract IDs */ inputHoldingCids: string[]; meta: { values: Record; }; }; extraArgs: { context: ChoiceContextData; meta: { values: Record; }; }; } /** * Build the plain JSON arguments expected by the registry transfer-factory * endpoint before it adds choice context and disclosed contracts. */ export declare function buildTransferChoiceArgs({ sender, receiver, amount, instrument, inputHoldingCids, memo, nowMs, }: { sender: string; receiver: string; amount: string; instrument: CantonInstrument; inputHoldingCids: string[]; memo: string; nowMs: number; }): TransferChoiceArgs; /** * Canton's Holding contracts follow Bitcoin-style UTXOs model. * * Pick Holding contract ids covering `amount` for the instrument: prefer a * single exact-amount holding, else accumulate largest-first. */ export declare function selectInputHoldingCids(holdings: CantonHolding[], instrument: CantonInstrument, amount: string): string[]; export declare function fetchInputHoldingCids(connector: CantonConnector, party: string, instrument: CantonInstrument, amount: string): Promise; interface TransferFactoryResponse { factoryId: string; transferKind?: string; choiceContext: { choiceContextData?: ChoiceContextData; disclosedContracts?: Array>; }; } /** * Ask the token registry for the transfer factory contract and extra context * required to exercise its transfer choice. */ export declare function fetchTransferFactory(registryUrl: string, choiceArgs: TransferChoiceArgs): Promise; /** * Convert transfer choice args into strict Daml Value JSON for the wallet's * prepareExecute ExerciseCommand. */ export declare function buildPrepareChoiceArgument(choiceArgs: TransferChoiceArgs): DamlValueJson; /** * Build a Splice token-standard transfer of `amount` of `token` from `sender` * to `receiver`, carrying `memo`, ready to hand to a wallet's prepareExecute. * Returns the full prepareExecute params (commandId + commands + actAs + * disclosedContracts). */ export declare function buildCantonTransfer(connector: CantonConnector, { sender, receiver, amount, token, memo, nowMs, }: { sender: string; receiver: string; amount: string; token: Token; memo: string; nowMs: number; }): Promise; export {};