PHP WebShell

Текущая директория: /opt/BitGoJS/modules/sdk-coin-sui/dist/src/lib/mystenlab/builder

Просмотр файла: TransactionBlock.d.ts

import { ObjectId, SuiObjectRef } from '../types';
import { Transactions, TransactionArgument, TransactionType } from './Transactions';
import { ObjectCallArg } from './Inputs';
import { TransactionExpiration } from './TransactionDataBlock';
type TransactionResult = TransactionArgument & TransactionArgument[];
declare const TRANSACTION_BRAND: unique symbol;
interface BuildOptions {
    onlyTransactionKind?: boolean;
}
/**
 * Transaction Builder
 */
export declare class TransactionBlock {
    #private;
    /** Returns `true` if the object is an instance of the Transaction builder class. */
    static is(obj: unknown): obj is TransactionBlock;
    /**
     * Converts from a serialize transaction kind (built with `build({ onlyTransactionKind: true })`) to a `Transaction` class.
     * Supports either a byte array, or base64-encoded bytes.
     */
    static fromKind(serialized: string | Uint8Array): TransactionBlock;
    /**
     * Converts from a serialized transaction format to a `Transaction` class.
     * There are two supported serialized formats:
     * - A string returned from `Transaction#serialize`. The serialized format must be compatible, or it will throw an error.
     * - A byte array (or base64-encoded bytes) containing BCS transaction data.
     */
    static from(serialized: string | Uint8Array): TransactionBlock;
    /** A helper to retrieve the Transaction builder `Transactions` */
    static get Transactions(): {
        MoveCall(input: Omit<import("./Transactions").MoveCallTransaction, "kind" | "arguments" | "typeArguments"> & {
            arguments?: TransactionArgument[];
            typeArguments?: string[];
        }): import("./Transactions").MoveCallTransaction;
        TransferObjects(objects: TransactionArgument[], address: TransactionArgument): import("./Transactions").TransferObjectsTransaction;
        SplitCoins(coin: TransactionArgument, amounts: TransactionArgument[]): import("./Transactions").SplitCoinsTransaction;
        MergeCoins(destination: TransactionArgument, sources: TransactionArgument[]): import("./Transactions").MergeCoinsTransaction;
        Publish(modules: number[][], dependencies: ObjectId[]): import("./Transactions").PublishTransaction;
        MakeMoveVec({ type, objects, }: Omit<import("./Transactions").MakeMoveVecTransaction, "kind" | "type"> & {
            type?: string;
        }): import("./Transactions").MakeMoveVecTransaction;
    };
    /** A helper to retrieve the Transaction builder `Inputs` */
    static get Inputs(): {
        Pure(data: unknown, type?: string): import("./Inputs").PureCallArg;
        ObjectRef(ref: SuiObjectRef): ObjectCallArg;
        SharedObjectRef(ref: import("../types").SharedObjectRef): ObjectCallArg;
    };
    setSender(sender: string): void;
    /**
     * Sets the sender only if it has not already been set.
     * This is useful for sponsored transaction flows where the sender may not be the same as the signer address.
     */
    setSenderIfNotSet(sender: string): void;
    setExpiration(expiration?: TransactionExpiration): void;
    setGasPrice(price: number | bigint): void;
    setGasBudget(budget: number | bigint): void;
    setGasOwner(owner: string): void;
    setGasPayment(payments: SuiObjectRef[]): void;
    /** Get a snapshot of the transaction data, in JSON form: */
    get blockData(): {
        version: 1;
        transactions: ({
            arguments: ({
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            })[];
            kind: "MoveCall";
            typeArguments: string[];
            target: `${string}::${string}::${string}`;
        } | {
            objects: ({
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            })[];
            kind: "TransferObjects";
            address: {
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            };
        } | {
            kind: "SplitCoins";
            coin: {
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            };
            amounts: ({
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            })[];
        } | {
            kind: "MergeCoins";
            destination: {
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            };
            sources: ({
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            })[];
        } | {
            objects: ({
                kind: "Input";
                index: number;
                type?: "object" | "pure" | undefined;
                value?: any;
            } | {
                kind: "GasCoin";
            } | {
                kind: "Result";
                index: number;
            } | {
                kind: "NestedResult";
                index: number;
                resultIndex: number;
            })[];
            kind: "MakeMoveVec";
            type?: {
                None: null;
            } | {
                Some: string;
            } | undefined;
        } | {
            kind: "Publish";
            dependencies: string[];
            modules: number[][];
        })[];
        inputs: {
            kind: "Input";
            index: number;
            type?: "object" | "pure" | undefined;
            value?: any;
        }[];
        gasConfig: {
            payment?: {
                objectId: string;
                version: string | number;
                digest: string;
            }[] | undefined;
            owner?: string | undefined;
            price?: string | undefined;
            budget?: string | undefined;
        };
        sender?: string | undefined;
        expiration?: {
            Epoch: number;
        } | {
            None: true | null;
        } | null | undefined;
    };
    get [TRANSACTION_BRAND](): boolean;
    constructor(transaction?: TransactionBlock);
    /** Returns an argument for the gas coin, to be used in a transaction. */
    get gas(): TransactionArgument;
    /**
     * Dynamically create a new input, which is separate from the `input`. This is important
     * for generated clients to be able to define unique inputs that are non-overlapping with the
     * defined inputs.
     *
     * For `Uint8Array` type automatically convert the input into a `Pure` CallArg, since this
     * is the format required for custom serialization.
     *
     */
    input(type: 'object' | 'pure', value?: unknown): {
        kind: "Input";
        index: number;
        type?: "object" | "pure" | undefined;
        value?: any;
    };
    /**
     * Add a new object input to the transaction.
     */
    object(value: ObjectId | ObjectCallArg): {
        kind: "Input";
        index: number;
        type?: "object" | "pure" | undefined;
        value?: any;
    };
    /**
     * Add a new non-object input to the transaction.
     */
    pure(
    /**
     * The pure value that will be used as the input value. If this is a Uint8Array, then the value
     * is assumed to be raw bytes, and will be used directly.
     */
    value: unknown, 
    /**
     * The BCS type to serialize the value into. If not provided, the type will automatically be determined
     * based on how the input is used.
     */
    type?: string): {
        kind: "Input";
        index: number;
        type?: "object" | "pure" | undefined;
        value?: any;
    };
    /** Add a transaction to the transaction block. */
    add(transaction: TransactionType): TransactionResult;
    splitCoins(...args: Parameters<(typeof Transactions)['SplitCoins']>): TransactionResult;
    mergeCoins(...args: Parameters<(typeof Transactions)['MergeCoins']>): TransactionResult;
    publish(...args: Parameters<(typeof Transactions)['Publish']>): TransactionResult;
    moveCall(...args: Parameters<(typeof Transactions)['MoveCall']>): TransactionResult;
    transferObjects(...args: Parameters<(typeof Transactions)['TransferObjects']>): TransactionResult;
    makeMoveVec(...args: Parameters<(typeof Transactions)['MakeMoveVec']>): TransactionResult;
    /**
     * Serialize the transaction to a string so that it can be sent to a separate context.
     * This is different from `build` in that it does not serialize to BCS bytes, and instead
     * uses a separate format that is unique to the transaction builder. This allows
     * us to serialize partially-complete transactions, that can then be completed and
     * built in a separate context.
     *
     * For example, a dapp can construct a transaction, but not provide gas objects
     * or a gas budget. The transaction then can be sent to the wallet, where this
     * information is automatically filled in (e.g. by querying for coin objects
     * and performing a dry run).
     */
    serialize(): string;
    /** Build the transaction to BCS bytes. */
    build({ onlyTransactionKind }?: BuildOptions): Promise<Uint8Array>;
    /** Derive transaction digest */
    getDigest(): Promise<string>;
}
export {};
//# sourceMappingURL=TransactionBlock.d.ts.map

Выполнить команду


Для локальной разработки. Не используйте в интернете!