import { ccc } from "@ckb-ccc/core"; import { ssri } from "@ckb-ccc/ssri"; //#region src/udt/index.d.ts /** * Represents a User Defined Token (UDT) script compliant with the SSRI protocol. * * This class provides a comprehensive implementation for interacting with User Defined Tokens, * supporting various token operations such as querying metadata, checking balances, and performing transfers. * It supports both SSRI-compliant UDTs and legacy sUDT/xUDT standard tokens. * * @public * @category Blockchain * @category Token */ export declare class Udt extends ssri.Trait { readonly script: ccc.Script; /** * Constructs a new UDT (User Defined Token) script instance. * By default it is a SSRI-compliant UDT. * * @param code - The script code cell of the UDT. * @param script - The type script of the UDT. * @param config - Optional configuration for the UDT instance. * @param config.executor - The SSRI executor instance. If provided, enables SSRI-based operations. * @example * ```typescript * const udt = new Udt(code, script, { executor }); * ``` */ constructor(code: ccc.OutPointLike, script: ccc.ScriptLike, config?: { executor?: ssri.Executor | null; } | null); /** * Retrieves the human-readable name of the User Defined Token. * * @param context - Optional SSRI context for script execution. * @returns A promise resolving to the token's name. */ name(context?: ssri.ContextScript): Promise>; /** * Retrieves the symbol of the UDT. * @param context - Optional SSRI context for script execution. * @returns The symbol of the UDT. */ symbol(context?: ssri.ContextScript): Promise>; /** * Retrieves the decimals of the UDT. * @param context - Optional SSRI context for script execution. * @returns The decimals of the UDT. */ decimals(context?: ssri.ContextScript): Promise>; /** * Retrieves the icon of the UDT. * @param context - Optional SSRI context for script execution. * @returns The icon of the UDT. */ icon(context?: ssri.ContextScript): Promise>; /** * Transfers UDT to specified addresses. * @param signer - The signer to use for the transaction. * @param transfers - The array of transfers. * @param transfers.to - The receiver of token. * @param transfers.amount - The amount of token to the receiver. * @param tx - Transfer on the basis of an existing transaction to achieve combined actions. If not provided, a new transaction will be created. * @returns The transaction result. * @tag Mutation - This method represents a mutation of the onchain state and will return a transaction object. * @example * ```typescript * const { script: change } = await signer.getRecommendedAddressObj(); * const { script: to } = await ccc.Address.fromString(receiver, signer.client); * * const udt = new Udt( * { * txHash: "0x4e2e832e0b1e7b5994681b621b00c1e65f577ee4b440ef95fa07db9bb3d50269", * index: 0, * }, * { * codeHash: "0xcc9dc33ef234e14bc788c43a4848556a5fb16401a04662fc55db9bb201987037", * hashType: "type", * args: "0x71fd1985b2971a9903e4d8ed0d59e6710166985217ca0681437883837b86162f" * }, * ); * * const { res: tx } = await udtTrait.transfer( * signer, * [{ to, amount: 100 }], * ); * * const completedTx = udt.completeUdtBy(tx, signer); * await completedTx.completeInputsByCapacity(signer); * await completedTx.completeFeeBy(signer); * const transferTxHash = await signer.sendTransaction(completedTx); * ``` */ transfer(signer: ccc.Signer, transfers: { to: ccc.ScriptLike; amount: ccc.NumLike; }[], tx?: ccc.TransactionLike | null): Promise>; /** * Mints new tokens to specified addresses. See the example in `transfer` as they are similar. * @param signer - The signer to use for the transaction. * @param mints - Array of mints * @param mints.to - receiver of token * @param mints.amount - amount to the receiver * @param tx - Optional existing transaction to build upon * @returns The transaction containing the mint operation * @tag Mutation - This method represents a mutation of the onchain state */ mint(signer: ccc.Signer, mints: { to: ccc.ScriptLike; amount: ccc.NumLike; }[], tx?: ccc.TransactionLike | null): Promise>; /** * Completes a UDT transaction by adding change output to a specific lock script. * @param txLike - The transaction to complete. * @param signer - The signer to use for input selection. * @param change - The lock script for the change output. * @returns The completed transaction. */ completeChangeToLock(txLike: ccc.TransactionLike, signer: ccc.Signer, change: ccc.ScriptLike): Promise; /** * Completes a UDT transaction by adding change output to the signer's address. * @param tx - The transaction to complete. * @param from - The signer to use for input selection and change address. * @returns The completed transaction. */ completeBy(tx: ccc.TransactionLike, from: ccc.Signer): Promise; } //#endregion //#region src/udtPausable/index.d.ts /** * Represents a UDT (User Defined Token) with pausable functionality. * @extends {Udt} This must be a SSRI UDT that does not fallback to xUDT. * @public */ export declare class UdtPausable extends Udt { constructor(code: ccc.OutPointLike, script: ccc.ScriptLike, config: { executor: ssri.Executor; }); /** * Pauses the UDT for the specified lock scripts. Pausing/Unpause without lock scripts should take effect on the global level. Note that this method is only available if the pausable UDT uses external pause list. * @param signer - The signer to use for the transaction. * @param locks - The array of lock scripts to be paused. * @param tx - The transaction to be used. * @param extraLockHashes - Additional lock hashes to be paused. * @returns The transaction result. * @tag Mutation - This method represents a mutation of the onchain state and will return a transaction to be sent. */ pause(signer: ccc.Signer, locks: ccc.ScriptLike[], tx?: ccc.TransactionLike | null, extraLockHashes?: ccc.HexLike[] | null): Promise>; /** * Unpauses the UDT for the specified lock scripts. Note that this method is only available if the pausable UDT uses external pause list. * @param signer - The signer to use for the transaction. * @param locks - The array of lock scripts to be unpaused. * @param tx - The transaction to be used. * @param extraLockHashes - Additional lock hashes to be unpaused. * @returns The transaction result. * @tag Mutation - This method represents a mutation of the onchain state and will return a transaction to be sent. */ unpause(signer: ccc.Signer, locks: ccc.ScriptLike[], tx?: ccc.TransactionLike | null, extraLockHashes?: ccc.HexLike[] | null): Promise>; /** * Checks if the UDT is paused for the specified lock scripts within a transaction. If not using external pause list, it can also be run on Code environment level. * @param locks - The lock scripts to check. * @param extraLockHashes - Additional lock hashes to check. * @returns True if any of the lock scripts are paused, false otherwise. */ isPaused(locks: ccc.ScriptLike[], extraLockHashes?: ccc.HexLike[] | null): Promise>; /** * Enumerates all paused lock hashes in UDTPausableData. * @returns The array of lock hashes. */ enumeratePaused(offset?: ccc.Num, limit?: ccc.Num): Promise>; } declare namespace barrel_d_exports { export { Udt, UdtPausable }; } //#endregion export { barrel_d_exports as t }; //# sourceMappingURL=barrel.d.mts.map