Implements

Constructors

Properties

defaultSigName: string = 'pkp-sui-sign-tx'
provider: JsonRpcProvider
publicKey: Secp256k1PublicKey

Methods

  • Runs the transaction in dev-inspect mode. Which allows for nearly any transaction (or Move call) with any arguments. Detailed results are provided, including both the transaction effects and any return values.

    Parameters

    • input: Omit<{
          epoch?: string;
          gasPrice?: number | bigint;
          sender: string;
          transactionBlock: string | Uint8Array | TransactionBlock;
      }, "sender">

    Returns Promise<{
        effects: {
            created?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            deleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            dependencies?: string[];
            eventsDigest?: string;
            executedEpoch: string;
            gasObject: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            };
            gasUsed: {
                computationCost: string;
                nonRefundableStorageFee: string;
                storageCost: string;
                storageRebate: string;
            };
            messageVersion: "v1";
            modifiedAtVersions?: {
                objectId: string;
                sequenceNumber: string;
            }[];
            mutated?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            sharedObjects?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            status: {
                error?: string;
                status: "success" | "failure";
            };
            transactionDigest: string;
            unwrapped?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            unwrappedThenDeleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            wrapped?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
        };
        error?: string;
        events: {
            bcs?: string;
            id: {
                eventSeq: string;
                txDigest: string;
            };
            packageId: string;
            parsedJson?: Record<string, any>;
            sender: string;
            timestampMs?: string;
            transactionModule: string;
            type: string;
        }[];
        results?: {
            mutableReferenceOutputs?: [
                | "GasCoin"
                | {
                    Input: number;
                }
                | {
                    Result: number;
                }
                | {
                    NestedResult: [number, number];
                }, number[], string][];
            returnValues?: [number[], string][];
        }[];
    }>

  • Dry run a transaction and return the result.

    Parameters

    • input: {
          transactionBlock: string | Uint8Array | TransactionBlock;
      }
      • transactionBlock: string | Uint8Array | TransactionBlock

    Returns Promise<{
        balanceChanges: {
            amount: string;
            coinType: string;
            owner:
                | "Immutable"
                | {
                    AddressOwner: string;
                }
                | {
                    ObjectOwner: string;
                }
                | {
                    Shared: {
                        initial_shared_version: number;
                    };
                };
        }[];
        effects: {
            created?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            deleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            dependencies?: string[];
            eventsDigest?: string;
            executedEpoch: string;
            gasObject: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            };
            gasUsed: {
                computationCost: string;
                nonRefundableStorageFee: string;
                storageCost: string;
                storageRebate: string;
            };
            messageVersion: "v1";
            modifiedAtVersions?: {
                objectId: string;
                sequenceNumber: string;
            }[];
            mutated?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            sharedObjects?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            status: {
                error?: string;
                status: "success" | "failure";
            };
            transactionDigest: string;
            unwrapped?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            unwrappedThenDeleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            wrapped?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
        };
        events: {
            bcs?: string;
            id: {
                eventSeq: string;
                txDigest: string;
            };
            packageId: string;
            parsedJson?: Record<string, any>;
            sender: string;
            timestampMs?: string;
            transactionModule: string;
            type: string;
        }[];
        input?: {
            gasData: {
                budget: string;
                owner: string;
                payment: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                }[];
                price: string;
            };
            messageVersion: "v1";
            sender: string;
            transaction:
                | {
                    computation_charge: string;
                    epoch: string;
                    epoch_start_timestamp_ms?: string;
                    kind: "ChangeEpoch";
                    storage_charge: string;
                    storage_rebate: string;
                }
                | {
                    commit_timestamp_ms: string;
                    epoch: string;
                    kind: "ConsensusCommitPrologue";
                    round: string;
                }
                | {
                    kind: "Genesis";
                    objects: string[];
                }
                | {
                    inputs: ({
                        type: "pure";
                        value: SuiJsonValue;
                        valueType: string;
                    } | {
                        digest: string;
                        objectId: string;
                        objectType: "immOrOwnedObject";
                        type: "object";
                        version: string;
                    } | {
                        initialSharedVersion: string;
                        mutable: boolean;
                        objectId: string;
                        objectType: "sharedObject";
                        type: "object";
                    })[];
                    kind: "ProgrammableTransaction";
                    transactions: (
                        | {
                            MoveCall: {
                                arguments?: (
                                    | (...)
                                    | (...)
                                    | (...)
                                    | (...))[];
                                function: string;
                                module: string;
                                package: string;
                                type_arguments?: string[];
                            };
                        }
                        | {
                            TransferObjects: [(
                                | (...)
                                | (...)
                                | (...)
                                | (...))[],
                                | "GasCoin"
                                | {
                                    Input: ...;
                                }
                                | {
                                    Result: ...;
                                }
                                | {
                                    NestedResult: ...;
                                }];
                        }
                        | {
                            SplitCoins: [
                                | "GasCoin"
                                | {
                                    Input: ...;
                                }
                                | {
                                    Result: ...;
                                }
                                | {
                                    NestedResult: ...;
                                }, (
                                | (...)
                                | (...)
                                | (...)
                                | (...))[]];
                        }
                        | {
                            MergeCoins: [
                                | "GasCoin"
                                | {
                                    Input: ...;
                                }
                                | {
                                    Result: ...;
                                }
                                | {
                                    NestedResult: ...;
                                }, (
                                | (...)
                                | (...)
                                | (...)
                                | (...))[]];
                        }
                        | {
                            Publish: string[] | [{
                                disassembled: ...;
                            }, (...)[]];
                        }
                        | {
                            Upgrade: [(...)[], string,
                                | (...)
                                | (...)
                                | (...)
                                | (...)] | [{
                                disassembled: ...;
                            }, (...)[], string,
                                | (...)
                                | (...)
                                | (...)
                                | (...)];
                        }
                        | {
                            MakeMoveVec: [string, (
                                | (...)
                                | (...)
                                | (...)
                                | (...))[]];
                        })[];
                };
        };
        objectChanges: (
            | {
                digest: string;
                modules: string[];
                packageId: string;
                type: "published";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                recipient:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                sender: string;
                type: "transferred";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                previousVersion: string;
                sender: string;
                type: "mutated";
                version: string;
            }
            | {
                objectId: string;
                objectType: string;
                sender: string;
                type: "deleted";
                version: string;
            }
            | {
                objectId: string;
                objectType: string;
                sender: string;
                type: "wrapped";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                sender: string;
                type: "created";
                version: string;
            })[];
    }>

  • Returns the estimated gas cost for the transaction

    Parameters

    • Rest...args: [input: {
          transactionBlock: string | Uint8Array | TransactionBlock;
      }]

    Returns Promise<bigint>

    total gas cost estimation

    whens fails to estimate the gas cost

  • Derive transaction digest from

    Parameters

    • tx: Uint8Array | TransactionBlock

      BCS serialized transaction data or a Transaction object

    Returns Promise<string>

    transaction digest

  • Parameters

    • transactionBlock: Uint8Array | TransactionBlock

    Returns Promise<Uint8Array>

  • Request gas tokens from a faucet server and send to the signer address

    Parameters

    • OptionalhttpHeaders: HttpHeaders

      optional request headers

    Returns Promise<{
        error: string;
        transferredGasObjects: {
            amount: number;
            id: string;
            transferTxDigest: string;
        }[];
    }>

  • Runs the specified Lit action with the given parameters.

    Parameters

    • toSign: Uint8Array

      The data to be signed by the Lit action.

    • sigName: string

      The name of the signature to be returned by the Lit action.

    Returns Promise<any>

    • A Promise that resolves with the signature returned by the Lit action.
    • Throws an error if pkpPubKey is not provided, if controllerAuthSig or controllerSessionSigs is not provided, if controllerSessionSigs is not an object, if executeJsArgs does not have either code or ipfsId, or if an error occurs during the execution of the Lit action.
  • Sign the provided data with the PKP private key.

    Parameters

    • toSign: Uint8Array

      The data to be signed.

    Returns Promise<SigResponse>

    • A Promise that resolves with the signature of the provided data.
    • Throws an error if pkpPubKey is not provided, if controllerAuthSig or controllerSessionSigs is not provided, if controllerSessionSigs is not an object, or if an error occurs during the signing process.
  • Sign a transaction block and submit to the Fullnode for execution.

    Parameters

    • input: {
          options?: {
              showBalanceChanges?: boolean;
              showEffects?: boolean;
              showEvents?: boolean;
              showInput?: boolean;
              showObjectChanges?: boolean;
          };
          requestType?: ExecuteTransactionRequestType;
          transactionBlock: Uint8Array | TransactionBlock;
      }
      • Optionaloptions?: {
            showBalanceChanges?: boolean;
            showEffects?: boolean;
            showEvents?: boolean;
            showInput?: boolean;
            showObjectChanges?: boolean;
        }

        specify which fields to return (e.g., transaction, effects, events, etc). By default, only the transaction digest will be returned.

        • OptionalshowBalanceChanges?: boolean
        • OptionalshowEffects?: boolean
        • OptionalshowEvents?: boolean
        • OptionalshowInput?: boolean
        • OptionalshowObjectChanges?: boolean
      • OptionalrequestType?: ExecuteTransactionRequestType

        WaitForEffectsCert or WaitForLocalExecution, see details in ExecuteTransactionRequestType. Defaults to WaitForLocalExecution if options.show_effects or options.show_events is true

      • transactionBlock: Uint8Array | TransactionBlock

    Returns Promise<{
        balanceChanges?: {
            amount: string;
            coinType: string;
            owner:
                | "Immutable"
                | {
                    AddressOwner: string;
                }
                | {
                    ObjectOwner: string;
                }
                | {
                    Shared: {
                        initial_shared_version: number;
                    };
                };
        }[];
        checkpoint?: string;
        confirmedLocalExecution?: boolean;
        digest: string;
        effects?: {
            created?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            deleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            dependencies?: string[];
            eventsDigest?: string;
            executedEpoch: string;
            gasObject: {
                owner:
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    }
                    | "Immutable";
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            };
            gasUsed: {
                computationCost: string;
                nonRefundableStorageFee: string;
                storageCost: string;
                storageRebate: string;
            };
            messageVersion: "v1";
            modifiedAtVersions?: {
                objectId: string;
                sequenceNumber: string;
            }[];
            mutated?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            sharedObjects?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            status: {
                error?: string;
                status: "success" | "failure";
            };
            transactionDigest: string;
            unwrapped?: {
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                reference: {
                    digest: string;
                    objectId: string;
                    version: string | number;
                };
            }[];
            unwrappedThenDeleted?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
            wrapped?: {
                digest: string;
                objectId: string;
                version: string | number;
            }[];
        };
        errors?: string[];
        events?: {
            bcs?: string;
            id: {
                eventSeq: string;
                txDigest: string;
            };
            packageId: string;
            parsedJson?: Record<string, any>;
            sender: string;
            timestampMs?: string;
            transactionModule: string;
            type: string;
        }[];
        objectChanges?: (
            | {
                digest: string;
                modules: string[];
                packageId: string;
                type: "published";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                recipient:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                sender: string;
                type: "transferred";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                previousVersion: string;
                sender: string;
                type: "mutated";
                version: string;
            }
            | {
                objectId: string;
                objectType: string;
                sender: string;
                type: "deleted";
                version: string;
            }
            | {
                objectId: string;
                objectType: string;
                sender: string;
                type: "wrapped";
                version: string;
            }
            | {
                digest: string;
                objectId: string;
                objectType: string;
                owner:
                    | "Immutable"
                    | {
                        AddressOwner: string;
                    }
                    | {
                        ObjectOwner: string;
                    }
                    | {
                        Shared: {
                            initial_shared_version: number;
                        };
                    };
                sender: string;
                type: "created";
                version: string;
            })[];
        timestampMs?: string;
        transaction?: {
            data: {
                gasData: {
                    budget: string;
                    owner: string;
                    payment: {
                        digest: string;
                        objectId: string;
                        version: string | number;
                    }[];
                    price: string;
                };
                messageVersion: "v1";
                sender: string;
                transaction:
                    | {
                        computation_charge: string;
                        epoch: string;
                        epoch_start_timestamp_ms?: string;
                        kind: "ChangeEpoch";
                        storage_charge: string;
                        storage_rebate: string;
                    }
                    | {
                        commit_timestamp_ms: string;
                        epoch: string;
                        kind: "ConsensusCommitPrologue";
                        round: string;
                    }
                    | {
                        kind: "Genesis";
                        objects: string[];
                    }
                    | {
                        inputs: ({
                            type: "pure";
                            value: SuiJsonValue;
                            valueType: string;
                        } | {
                            digest: string;
                            objectId: string;
                            objectType: "immOrOwnedObject";
                            type: "object";
                            version: string;
                        } | {
                            initialSharedVersion: string;
                            mutable: boolean;
                            objectId: string;
                            objectType: "sharedObject";
                            type: "object";
                        })[];
                        kind: "ProgrammableTransaction";
                        transactions: (
                            | {
                                MoveCall: {
                                    arguments?: (...)[];
                                    function: string;
                                    module: string;
                                    package: string;
                                    type_arguments?: (...)[];
                                };
                            }
                            | {
                                TransferObjects: [(...)[],
                                    | (...)
                                    | (...)
                                    | (...)
                                    | (...)];
                            }
                            | {
                                SplitCoins: [
                                    | (...)
                                    | (...)
                                    | (...)
                                    | (...), (...)[]];
                            }
                            | {
                                MergeCoins: [
                                    | (...)
                                    | (...)
                                    | (...)
                                    | (...), (...)[]];
                            }
                            | {
                                Publish: (...)[] | [(...), (...)];
                            }
                            | {
                                Upgrade: [(...), (...), (...)] | [(...), (...), (...), (...)];
                            }
                            | {
                                MakeMoveVec: [string, (...)[]];
                            })[];
                    };
            };
            txSignatures: string[];
        };
    }>

  • Returns the signature for the data and the public key of the signer

    Parameters

    • data: Uint8Array

    Returns Promise<string>

  • Sign a message using the keypair, with the PersonalMessage intent.

    Parameters

    • input: {
          message: Uint8Array;
      }
      • message: Uint8Array

    Returns Promise<SignedMessage>

  • Sign a transaction.

    Parameters

    • input: {
          transactionBlock: Uint8Array | TransactionBlock;
      }
      • transactionBlock: Uint8Array | TransactionBlock

    Returns Promise<SignedTransaction>