import EventEmitter from 'eventemitter3'; declare const NetworkToIndexerAPI: Record; declare const NetworkToIndexerAPIV2: Record; declare const NetworkToNodeAPI: Record; declare const NetworkToFaucetAPI: Record; declare const NetworkToProverAPI: Record; declare enum Network { MAINNET = "mainnet", TESTNET = "testnet", DEVNET = "devnet", LOCAL = "local", CUSTOM = "custom" } declare const NetworkToChainId: Record; declare const NetworkToNetworkName: Record; /** * RESPONSE TYPES FOR INDEXER REST APIS */ interface GetCoinDataResponse { id: string; symbol: string; name: string; project_uri?: string | null; icon_uri?: string | null; decimals: number; supply: string; } interface GetAccountCoinData { balance: string; frozen: boolean; metadata: GetCoinDataResponse; } interface GetAccountCoinsDataResponse { data: GetAccountCoinData[]; page: number; pageSize: number; total: number; } interface GetCreatedCoinDataResponse { data: GetCoinDataResponse[]; page: number; pageSize: number; total: number; } interface GetAccountsCoinBalanceData { address: string; balance: string; frozen: boolean; } type GetAccountsCoinBalanceResponse = GetAccountsCoinBalanceData[]; /** * A generic type that being passed by each function and holds an * array of properties we can sort the query by */ type OrderBy = Array<{ [K in keyof T]?: OrderByValue; }>; type OrderByValue = "asc" | "asc_nulls_first" | "asc_nulls_last" | "desc" | "desc_nulls_first" | "desc_nulls_last"; /** * Refers to the token standard we want to query for */ type TokenStandard = "v1" | "v2"; /** * COIN & NFT API TYPES FROM API.JSON */ interface AccountBalanceItem { coin: string; balance: string; frozen: boolean; } interface AccountBalancesResponse { address: string; balances: AccountBalanceItem[]; } interface CoinBalanceResponse { address: string; balance: string; frozen: boolean; } interface FungibleAssetMetadataResponse { id: string; decimals: number; icon_uri?: string; name: string; project_uri?: string; symbol: string; supply: string; max_supply?: string; holders: string; } interface CoinResponse { metadata: FungibleAssetMetadataResponse; balance: string; frozen: boolean; } interface GetAccountsBalancesRequest { accounts: string[]; coins: string[]; } interface HoldersItem { address: string; balance: string; } interface PageableCoinResponse { total: number; page: number; pageSize: number; data: CoinResponse[]; } interface PageableFungibleAssetMetadataResponse { total: number; page: number; pageSize: number; data: FungibleAssetMetadataResponse[]; } interface PageableHoldersItem { total: number; page: number; pageSize: number; data: HoldersItem[]; } interface Royalty { percent: string; payee_address: string; } interface CollectionResponse { id: string; creator: string; description: string; name: string; uri: string; current_supply: number; total_minted: number; last_transaction_version: number; last_transaction_hash: string; holders: string; created_at: number; transfers: string; max_supply?: number | null; royalty?: Royalty | null; } interface NftHistoryRecordToken { id: string; name: string; index: number; uri: string; } interface NftCollectionHistoryRecord { token: NftHistoryRecordToken; version: number; type: string; timestamp: number; from?: string | null; to?: string | null; } interface NftMetrics { total_collections: string; total_nfts: string; total_transfers: string; total_holders: string; } interface NftOwnedCollectionResponse { collection: CollectionResponse; count: number; } interface SearchResponse { name: string; address: string; type: string; symbol?: string | null; } interface NftTokenHistoryRecord { version: number; type: string; timestamp: number; from?: string | null; to?: string | null; } interface NftTokenResponse { id: string; name: string; index: number; description: string; uri: string; owner: string; properties: { [key: string]: string; }; last_transaction_version: number; last_transaction_hash: string; collection?: CollectionResponse | null; } interface PageableCollectionResponse { total: number; page: number; pageSize: number; data: CollectionResponse[]; } interface PageableNftCollectionHistoryRecord { total: number; page: number; pageSize: number; data: NftCollectionHistoryRecord[]; } interface PageableNftOwnedCollectionResponse { total: number; page: number; pageSize: number; data: NftOwnedCollectionResponse[]; } interface PageableNftTokenHistoryRecord { total: number; page: number; pageSize: number; data: NftTokenHistoryRecord[]; } interface PageableNftTokenResponse { total: number; page: number; pageSize: number; data: NftTokenResponse[]; } interface Status { latest_version: number; tps: string; cache_size: string; synced: boolean; git_hash: string; } interface PageableU64 { total: number; page: number; pageSize: number; data: number[]; } interface DelegationPoolResponse { pool: string; owner: string; rewards: string; delegated: string; } interface PoolRewardResponse { pool: string; rewards: string; } interface DelegatedPoolResponse { pool: string; amount: string; } declare enum MimeType { /** * JSON representation, used for transaction submission and accept type JSON output */ JSON = "application/json", /** * BCS representation, used for accept type BCS output */ BCS = "application/x-bcs", /** * BCS representation, used for transaction submission in BCS input */ BCS_SIGNED_TRANSACTION = "application/x.endless.signed_transaction+bcs", BCS_VIEW_FUNCTION = "application/x.endless.view_function+bcs" } /** * Hex data as input to a function */ type HexInput = string | Uint8Array; /** * TypeTag enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27} */ declare enum TypeTagVariants { Bool = 0, U8 = 1, U64 = 2, U128 = 3, Address = 4, Signer = 5, Vector = 6, Struct = 7, U16 = 8, U32 = 9, U256 = 10, Reference = 254,// This is specifically a placeholder and does not represent a real type Generic = 255 } /** * Script transaction arguments enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11} */ declare enum ScriptTransactionArgumentVariants { U8 = 0, U64 = 1, U128 = 2, Address = 3, U8Vector = 4, Bool = 5, U16 = 6, U32 = 7, U256 = 8 } /** * Transaction payload enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/types/src/transaction/mod.rs#L478} */ declare enum TransactionPayloadVariants { Script = 0, EntryFunction = 2, Multisig = 3, SafeScript = 4, SafeEntryFunction = 5 } /** * Transaction variants enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/types/src/transaction/mod.rs#L440} */ declare enum TransactionVariants { MultiAgentTransaction = 0, FeePayerTransaction = 1 } /** * Transaction Authenticator enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/types/src/transaction/authenticator.rs#L44} */ declare enum TransactionAuthenticatorVariant { Ed25519 = 0, MultiEd25519 = 1, MultiAgent = 2, FeePayer = 3, SingleSender = 4 } /** * Transaction Authenticator enum as they are represented in Rust * {@link https://github.com/endless-labs/endless-core/blob/main/types/src/transaction/authenticator.rs#L414} */ declare enum AccountAuthenticatorVariant { Ed25519 = 0, MultiEd25519 = 1, SingleKey = 2, MultiKey = 3, MultiAuthKey = 4, Bls12381 = 5, Mock = 6 } declare enum AnyPublicKeyVariant { Ed25519 = 0, Secp256k1 = 1, Keyless = 3, Bls12381 = 4 } declare enum AnySignatureVariant { Ed25519 = 0, Secp256k1 = 1, Keyless = 3, Bls12381 = 4 } declare enum EphemeralPublicKeyVariant { Ed25519 = 0 } declare enum EphemeralSignatureVariant { Ed25519 = 0 } declare enum EphemeralCertificateVariant { ZkProof = 0 } /** * BCS types */ type Uint8 = number; type Uint16 = number; type Uint32 = number; type Uint64 = bigint; type Uint128 = bigint; type Uint256 = bigint; type AnyNumber = number | bigint; /** * Set of configuration options that can be provided when initializing the SDK. * The purpose of these options is to configure various aspects of the SDK's * behavior and interaction with the endless network */ type EndlessSettings = { readonly network?: Network; readonly fullnode?: string; readonly indexer?: string; readonly pepper?: string; readonly prover?: string; readonly clientConfig?: ClientConfig; readonly client?: Client; readonly fullnodeConfig?: FullNodeConfig; readonly indexerConfig?: IndexerConfig; readonly miniprogram?: Boolean; }; /** * * Controls the number of results that are returned and the starting position of those results. * @param offset parameter specifies the starting position of the query result within the set of data. Default is 0. * @param limit specifies the maximum number of items or records to return in a query result. Default is 25. */ interface PaginationArgs { offset?: AnyNumber; limit?: number; } interface PaginationArgsOfIndexer { pageSize?: number; page?: number; } interface OrderByArg { orderBy?: OrderBy; } interface WhereArg { where?: T; } /** * QUERY TYPES */ /** * A configuration object we can pass with the request to the server. * * @param API_KEY - api key generated from developer portal {@link https://developers.endlesslabs.com/manage/api-keys}} * @param HEADERS - extra headers we want to send with the request * @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent */ type ClientConfig = ClientHeadersType & { WITH_CREDENTIALS?: boolean; API_KEY?: string; }; /** * A Fullnode only configuration object * * @param HEADERS - extra headers we want to send with the request */ type FullNodeConfig = ClientHeadersType; /** * An Indexer only configuration object * * @param HEADERS - extra headers we want to send with the request */ type IndexerConfig = ClientHeadersType; /** * General type definition for client HEADERS */ type ClientHeadersType = { HEADERS?: Record; }; interface ClientRequest { url: string; method: "GET" | "POST"; originMethod?: string; body?: Req; contentType?: string; params?: any; overrides?: ClientConfig & FullNodeConfig & IndexerConfig; headers?: Record; } interface ClientResponse { status: number; statusText: string; data: Res; config?: any; request?: any; response?: any; headers?: any; } interface Client { provider(requestOptions: ClientRequest): Promise>; } /** * The API request type * * @param url - the url to make the request to, i.e https://fullnode.devnet.endlesslabs.com/v1 * @param method - the request method "GET" | "POST" * @param endpoint (optional) - the endpoint to make the request to, i.e transactions * @param body (optional) - the body of the request * @param contentType (optional) - the content type to set the `content-type` header to, * by default is set to `application/json` * @param params (optional) - query params to add to the request * @param originMethod (optional) - the local method the request came from * @param overrides (optional) - a `ClientConfig` object type to override request data */ type EndlessRequest = { url: string; method: "GET" | "POST"; path?: string; body?: any; contentType?: string; acceptType?: string; params?: Record; originMethod?: string; overrides?: ClientConfig & FullNodeConfig & IndexerConfig; }; /** * Specifies ledger version of transactions. By default latest version will be used */ type LedgerVersionArg = { ledgerVersion?: AnyNumber; }; /** * RESPONSE TYPES */ /** * Type holding the outputs of the estimate gas API */ type GasEstimation = { /** * The deprioritized estimate for the gas unit price */ deprioritized_gas_estimate?: number; /** * The current estimate for the gas unit price */ gas_estimate: number; /** * The prioritized estimate for the gas unit price */ prioritized_gas_estimate?: number; }; type MoveResource = { type: MoveStructId; data: T; }; type AccountData = { sequence_number: string; authentication_key: string[]; num_signatures_required: string; }; type MoveModuleBytecode = { bytecode: string; abi?: MoveModule; }; /** * TRANSACTION TYPES */ declare enum TransactionResponseType { Pending = "pending_transaction", User = "user_transaction", Genesis = "genesis_transaction", BlockMetadata = "block_metadata_transaction", StateCheckpoint = "state_checkpoint_transaction", Validator = "validator_transaction", BlockEpilogue = "block_epilogue_transaction" } type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse; type CommittedTransactionResponse = UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse | StateCheckpointTransactionResponse | ValidatorTransactionResponse | BlockEpilogueTransactionResponse; declare function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse; declare function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse; declare function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse; declare function isBlockMetadataTransactionResponse(response: TransactionResponse): response is BlockMetadataTransactionResponse; declare function isStateCheckpointTransactionResponse(response: TransactionResponse): response is StateCheckpointTransactionResponse; declare function isValidatorTransactionResponse(response: TransactionResponse): response is ValidatorTransactionResponse; declare function isBlockEpilogueTransactionResponse(response: TransactionResponse): response is BlockEpilogueTransactionResponse; type PendingTransactionResponse = { type: TransactionResponseType.Pending; hash: string; sender: string; sequence_number: string; max_gas_amount: string; gas_unit_price: string; expiration_timestamp_secs: string; payload: TransactionPayloadResponse; signature?: TransactionSignature; }; type UserTransactionResponse = { type: TransactionResponseType.User; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; sender: string; sequence_number: string; max_gas_amount: string; gas_unit_price: string; expiration_timestamp_secs: string; payload: TransactionPayloadResponse; signature?: TransactionSignature; /** * Events generated by the transaction */ events: Array; timestamp: string; }; type GenesisTransactionResponse = { type: TransactionResponseType.Genesis; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash?: string; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; payload: GenesisPayload; /** * Events emitted during genesis */ events: Array; }; type BlockMetadataTransactionResponse = { type: TransactionResponseType.BlockMetadata; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; id: string; epoch: string; round: string; /** * The events emitted at the block creation */ events: Array; /** * Previous block votes */ previous_block_votes_bitvec: Array; proposer: string; /** * The indices of the proposers who failed to propose */ failed_proposer_indices: Array; timestamp: string; }; type StateCheckpointTransactionResponse = { type: TransactionResponseType.StateCheckpoint; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; timestamp: string; }; type ValidatorTransactionResponse = { type: TransactionResponseType.Validator; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; /** * The events emitted by the validator transaction */ events: Array; timestamp: string; }; /** * BlockEndInfo describes the gas state of the block */ type BlockEndInfo = { block_gas_limit_reached: boolean; block_output_limit_reached: boolean; block_effective_block_gas_units: number; block_approx_output_size: number; }; /** * BlockEpilogueTransactionResponse is a transaction that is executed at the end of a block keeping track of data from * the whole block */ type BlockEpilogueTransactionResponse = { type: TransactionResponseType.BlockEpilogue; version: string; hash: string; state_change_hash: string; event_root_hash: string; state_checkpoint_hash: string | null; gas_used: string; /** * Whether the transaction was successful */ success: boolean; /** * The VM status of the transaction, can tell useful information in a failure */ vm_status: string; accumulator_root_hash: string; /** * Final state of resources changed by the transaction */ changes: Array; timestamp: string; block_end_info: BlockEndInfo | null; }; /** * WRITESET CHANGE TYPES */ type WriteSetChange = WriteSetChangeDeleteModule | WriteSetChangeDeleteResource | WriteSetChangeDeleteTableItem | WriteSetChangeWriteModule | WriteSetChangeWriteResource | WriteSetChangeWriteTableItem; type WriteSetChangeDeleteModule = { type: string; address: string; /** * State key hash */ state_key_hash: string; module: MoveModuleId; }; type WriteSetChangeDeleteResource = { type: string; address: string; state_key_hash: string; resource: string; }; type WriteSetChangeDeleteTableItem = { type: string; state_key_hash: string; handle: string; key: string; data?: DeletedTableData; }; type WriteSetChangeWriteModule = { type: string; address: string; state_key_hash: string; data: MoveModuleBytecode; }; type WriteSetChangeWriteResource = { type: string; address: string; state_key_hash: string; data: MoveResource; }; type WriteSetChangeWriteTableItem = { type: string; state_key_hash: string; handle: string; key: string; value: string; data?: DecodedTableData; }; type DecodedTableData = { /** * Key of table in JSON */ key: any; /** * Type of key */ key_type: string; /** * Value of table in JSON */ value: any; /** * Type of value */ value_type: string; }; /** * Deleted table data */ type DeletedTableData = { /** * Deleted key */ key: any; /** * Deleted key type */ key_type: string; }; type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse; type EntryFunctionPayloadResponse = { type: string; function: MoveFunctionId; /** * Type arguments of the function */ type_arguments: Array; /** * Arguments of the function */ arguments: Array; }; type ScriptPayloadResponse = { type: string; code: MoveScriptBytecode; /** * Type arguments of the function */ type_arguments: Array; /** * Arguments of the function */ arguments: Array; }; type MultisigPayloadResponse = { type: string; multisig_address: string; transaction_payload?: EntryFunctionPayloadResponse; }; type GenesisPayload = { type: string; write_set: WriteSet; }; /** * Move script bytecode */ type MoveScriptBytecode = { bytecode: string; abi?: MoveFunction; }; /** * These are the JSON representations of transaction signatures returned from the node API. */ type TransactionSignature = TransactionEd25519Signature | TransactionSecp256k1Signature | TransactionMultiEd25519Signature | TransactionMultiAgentSignature | TransactionFeePayerSignature; declare function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature; declare function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature; declare function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature; declare function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature; declare function isMultiEd25519Signature(signature: TransactionSignature): signature is TransactionMultiEd25519Signature; type TransactionEd25519Signature = { type: string; public_key: string; signature: "ed25519_signature"; }; type TransactionSecp256k1Signature = { type: string; public_key: string; signature: "secp256k1_ecdsa_signature"; }; type TransactionMultiEd25519Signature = { type: "multi_ed25519_signature"; /** * The public keys for the Ed25519 signature */ public_keys: Array; /** * Signature associated with the public keys in the same order */ signatures: Array; /** * The number of signatures required for a successful transaction */ threshold: number; bitmap: string; }; type TransactionMultiAgentSignature = { type: "multi_agent_signature"; sender: AccountSignature; /** * The other involved parties' addresses */ secondary_signer_addresses: Array; /** * The associated signatures, in the same order as the secondary addresses */ secondary_signers: Array; }; type TransactionFeePayerSignature = { type: "fee_payer_signature"; sender: AccountSignature; /** * The other involved parties' addresses */ secondary_signer_addresses: Array; /** * The associated signatures, in the same order as the secondary addresses */ secondary_signers: Array; fee_payer_address: string; fee_payer_signer: AccountSignature; }; /** * The union of all single account signatures. */ type AccountSignature = TransactionEd25519Signature | TransactionSecp256k1Signature | TransactionMultiEd25519Signature; type WriteSet = ScriptWriteSet | DirectWriteSet; type ScriptWriteSet = { type: string; execute_as: string; script: ScriptPayloadResponse; }; type DirectWriteSet = { type: string; changes: Array; events: Array; }; type EventGuid = { creation_number: string; account_address: string; }; type Event = { guid: EventGuid; sequence_number: string; type: string; /** * The JSON representation of the event */ data: any; }; /** * Map of Move types to local TypeScript types */ type MoveUint8Type = number; type MoveUint16Type = number; type MoveUint32Type = number; type MoveUint64Type = string; type MoveUint128Type = string; type MoveUint256Type = string; type MoveAddressType = string; type MoveObjectType = string; type MoveOptionType = MoveType | null | undefined; /** * This is the format for a fully qualified struct, resource, or entry function in Move. */ type MoveStructId = `${string}::${string}::${string}`; type MoveFunctionId = MoveStructId; type MoveStructType = {}; type MoveType = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructType | Array; /** * Possible Move values acceptable by move functions (entry, view) * * Map of a Move value to the corresponding TypeScript value * * `Bool -> boolean` * * `u8, u16, u32 -> number` * * `u64, u128, u256 -> string` * * `String -> string` * * `Address -> 0x${string}` * * `Struct - 0x${string}::${string}::${string}` * * `Object -> 0x${string}` * * `Vector -> Array` * * `Option -> MoveValue | null | undefined` */ type MoveValue = boolean | string | MoveUint8Type | MoveUint16Type | MoveUint32Type | MoveUint64Type | MoveUint128Type | MoveUint256Type | MoveAddressType | MoveObjectType | MoveStructId | MoveOptionType | Array; /** * Move module id is a string representation of Move module. * Module name is case-sensitive. */ type MoveModuleId = `${string}::${string}`; /** * Move function visibility */ declare enum MoveFunctionVisibility { PRIVATE = "private", PUBLIC = "public", FRIEND = "friend" } /** * Move function ability */ declare enum MoveAbility { STORE = "store", DROP = "drop", KEY = "key", COPY = "copy" } /** * Move abilities tied to the generic type param and associated with the function that uses it */ type MoveFunctionGenericTypeParam = { constraints: Array; }; /** * Move struct field */ type MoveStructField = { name: string; type: string; }; /** * A Move module */ type MoveModule = { address: string; name: string; /** * Friends of the module */ friends: Array; /** * Public functions of the module */ exposed_functions: Array; /** * Structs of the module */ structs: Array; }; /** * A move struct */ type MoveStruct = { name: string; /** * Whether the struct is a native struct of Move */ is_native: boolean; /** * Abilities associated with the struct */ abilities: Array; /** * Generic types associated with the struct */ generic_type_params: Array; /** * Fields associated with the struct */ fields: Array; }; /** * Move function */ type MoveFunction = { name: string; visibility: MoveFunctionVisibility; /** * Whether the function can be called as an entry function directly in a transaction */ is_entry: boolean; /** * Whether the function is a view function or not */ is_view: boolean; /** * Generic type params associated with the Move function */ generic_type_params: Array; /** * Parameters associated with the move function */ params: Array; /** * Return type of the function */ return: Array; }; declare enum RoleType { VALIDATOR = "validator", FULL_NODE = "full_node" } type LedgerInfo = { /** * Chain ID of the current chain */ chain_id: number; epoch: string; ledger_version: string; oldest_ledger_version: string; ledger_timestamp: string; node_role: RoleType; oldest_block_height: string; block_height: string; /** * Git hash of the build of the API endpoint. Can be used to determine the exact * software version used by the API endpoint. */ git_hash?: string; }; /** * A Block type */ type Block = { block_height: string; block_hash: string; block_timestamp: string; first_version: string; last_version: string; /** * The transactions in the block in sequential order */ transactions?: Array; }; /** * Table Item request for the GetTableItem API */ type TableItemRequest = { key_type: MoveValue; value_type: MoveValue; /** * The value of the table item's key */ key: any; }; /** * A list of Authentication Key schemes that are supported by Endless. * * They are combinations of signing schemes and derive schemes. */ type AuthenticationKeyScheme = SigningScheme | DeriveScheme; declare enum SigningScheme { /** * For Ed25519PublicKey */ Ed25519 = 0, /** * For MultiEd25519PublicKey */ MultiEd25519 = 1, /** * For SingleKey ecdsa */ SingleKey = 2, MultiKey = 3, MultiAuthKey = 4, Bls12381 = 5 } declare enum SigningSchemeInput { /** * For Ed25519PublicKey */ Ed25519 = 0, /** * For Secp256k1Ecdsa */ Secp256k1Ecdsa = 2 } /** * Scheme used for deriving account addresses from other data */ declare enum DeriveScheme { /** * Derives an address using an AUID, used for objects */ DeriveAuid = 251, /** * Derives an address from another object address */ DeriveObjectAddressFromObject = 252, /** * Derives an address from a GUID, used for objects */ DeriveObjectAddressFromGuid = 253, /** * Derives an address from seed bytes, used for named objects */ DeriveObjectAddressFromSeed = 254, /** * Derives an address from seed bytes, used for resource accounts */ DeriveResourceAccountAddress = 255 } /** * Option properties to pass for waitForTransaction() function */ type WaitForTransactionOptions = { timeoutSecs?: number; checkSuccess?: boolean; }; /** * Input type to generate an account using Single Signer * Ed25519 or Legacy Ed25519 */ type GenerateAccountWithEd25519 = { scheme: SigningSchemeInput.Ed25519; legacy: boolean; }; /** * Input type to generate an account using Single Signer * Secp256k1 */ type GenerateAccountWithSingleSignerSecp256k1Key = { scheme: SigningSchemeInput.Secp256k1Ecdsa; legacy?: false; }; type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key; /** * This interface exists to define Deserializable inputs for functions that * deserialize a byte buffer into a type T. * It is not intended to be implemented or extended, because Typescript has no support * for static methods in interfaces. */ interface Deserializable { deserialize(deserializer: Deserializer): T; } declare class Deserializer { private buffer; private offset; constructor(data: Uint8Array); private read; /** * Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first, * and then reads "l" bytes of content. Decodes the byte array into a string. * * BCS layout for "string": string_length | string_content * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content. * * @example * ```ts * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100])); * assert(deserializer.deserializeStr() === "1234abcd"); * ``` */ deserializeStr(): string; /** * Deserializes a an optional string. * * BCS layout for Optional: 0 if none, else 1 | string_length | string_content * @example * ```ts * const deserializer = new Deserializer(new Uint8Array([0x00])); * assert(deserializer.deserializeOptionStr() === undefined); * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100])); * assert(deserializer.deserializeOptionStr() === "1234abcd"); * ``` */ deserializeOptionStr(): string | undefined; /** * Deserializes a an optional deserializable class. * * BCS layout for Optional: 0 if none, else 1 | bcs representation of class * * @example * const deserializer = new Deserializer(new Uint8Array([1, 2, 3])); * const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function * // value is now an instance of MyClass * * const deserializer = new Deserializer(new Uint8Array([0])); * const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function * // value is undefined * * @param cls The BCS-deserializable class to deserialize the buffered bytes into. * * @returns the deserialized value of class type T */ deserializeOption(cls: Deserializable): T | undefined; /** * Deserializes an array of bytes. * * BCS layout for "bytes": bytes_length | bytes * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array. */ deserializeBytes(): Uint8Array; /** * Deserializes an array of bytes. The number of bytes to read is already known. * */ deserializeFixedBytes(len: number): Uint8Array; /** * Deserializes a boolean value. * * BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false. */ deserializeBool(): boolean; /** * Deserializes a uint8 number. * * BCS layout for "uint8": One byte. Binary format in little-endian representation. */ deserializeU8(): Uint8; /** * Deserializes a uint16 number. * * BCS layout for "uint16": Two bytes. Binary format in little-endian representation. * @example * ```ts * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12])); * assert(deserializer.deserializeU16() === 4660); * ``` */ deserializeU16(): Uint16; /** * Deserializes a uint32 number. * * BCS layout for "uint32": Four bytes. Binary format in little-endian representation. * @example * ```ts * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12])); * assert(deserializer.deserializeU32() === 305419896); * ``` */ deserializeU32(): Uint32; /** * Deserializes a uint64 number. * * BCS layout for "uint64": Eight bytes. Binary format in little-endian representation. * @example * ```ts * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12])); * assert(deserializer.deserializeU64() === 1311768467750121216); * ``` */ deserializeU64(): Uint64; /** * Deserializes a uint128 number. * * BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation. */ deserializeU128(): Uint128; /** * Deserializes a uint256 number. * * BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation. */ deserializeU256(): Uint256; /** * Deserializes a uleb128 encoded uint32 number. * * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values */ deserializeUleb128AsU32(): Uint32; /** * Helper function that primarily exists to support alternative syntax for deserialization. * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`. * * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3])); * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function * // value is now an instance of MyClass * // equivalent to `const value = MyClass.deserialize(deserializer)` * @param cls The BCS-deserializable class to deserialize the buffered bytes into. * * @returns the deserialized value of class type T */ deserialize(cls: Deserializable): T; /** * Deserializes an array of BCS Deserializable values given an existing Deserializer * instance with a loaded byte buffer. * * @param cls The BCS-deserializable class to deserialize the buffered bytes into. * @example * // serialize a vector of addresses * const addresses = new Array( * AccountAddress.from("0x1"), * AccountAddress.from("0x2"), * AccountAddress.from("0xa"), * AccountAddress.from("0xb"), * ); * const serializer = new Serializer(); * serializer.serializeVector(addresses); * const serializedBytes = serializer.toUint8Array(); * * // deserialize the bytes into an array of addresses * const deserializer = new Deserializer(serializedBytes); * const deserializedAddresses = deserializer.deserializeVector(AccountAddress); * // deserializedAddresses is now an array of AccountAddress instances * @returns an array of deserialized values of type T */ deserializeVector(cls: Deserializable): Array; } /** * This error is used to explain why parsing failed. */ declare class ParsingError extends Error { /** * This provides a programmatic way to access why parsing failed. Downstream devs * might want to use this to build their own error messages if the default error * messages are not suitable for their use case. This should be an enum. */ invalidReason: T; constructor(message: string, invalidReason: T); } /** * Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function, * this type is returned from "defensive" functions like isValid. */ type ParsingResult = { /** * True if valid, false otherwise. */ valid: boolean; /** * If valid is false, this will be a code explaining why parsing failed. */ invalidReason?: T; /** * If valid is false, this will be a string explaining why parsing failed. */ invalidReasonMessage?: string; }; /** * This enum is used to explain why parsing might have failed. */ declare enum HexInvalidReason { TOO_SHORT = "too_short", INVALID_LENGTH = "invalid_length", INVALID_HEX_CHARS = "invalid_hex_chars" } /** * NOTE: Do not use this class when working with account addresses, use AccountAddress. * * NOTE: When accepting hex data as input to a function, prefer to accept HexInput and * then use the static helper methods of this class to convert it into the desired * format. This enables the greatest flexibility for the developer. * * Hex is a helper class for working with hex data. Hex data, when represented as a * string, generally looks like this, for example: 0xaabbcc, 45cd32, etc. * * You might use this class like this: * * ```ts * getTransactionByHash(txnHash: HexInput): Promise { * const txnHashString = Hex.fromHexInput(txnHash).toString(); * return await getTransactionByHashInner(txnHashString); * } * ``` * * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string * with a leading 0x prefix, regardless of what the input format was. * * These are some other ways to chain the functions together: * - `Hex.fromHexString({ hexInput: "0x1f" }).toUint8Array()` * - `new Hex([1, 3]).toStringWithoutPrefix()` */ declare class Hex { private readonly data; /** * Create a new Hex instance from a Uint8Array. * * @param data Uint8Array */ constructor(data: Uint8Array); /** * Get the inner hex data. The inner data is already a Uint8Array so no conversion * is taking place here, it just returns the inner data. * * @returns Hex data as Uint8Array */ toUint8Array(): Uint8Array; /** * Get the hex data as a string without the 0x prefix. * * @returns Hex string without 0x prefix */ toStringWithoutPrefix(): string; /** * Get the hex data as a string with the 0x prefix. * * @returns Hex string with 0x prefix */ toString(): string; /** * Static method to convert a hex string to Hex * * @param str A hex string, with or without the 0x prefix * * @returns Hex */ static fromHexString(str: string): Hex; /** * Static method to convert an instance of HexInput to Hex * * @param hexInput A HexInput (string or Uint8Array) * * @returns Hex */ static fromHexInput(hexInput: HexInput): Hex; /** * Check if the string is valid hex. * * @param str A hex string representing byte data. * * @returns valid = true if the string is valid, false if not. If the string is not * valid, invalidReason and invalidReasonMessage will be set explaining why it is * invalid. */ static isValid(str: string): ParsingResult; /** * Return whether Hex instances are equal. Hex instances are considered equal if * their underlying byte data is identical. * * @param other The Hex instance to compare to. * @returns true if the Hex instances are equal, false if not. */ equals(other: Hex): boolean; } declare abstract class Serializable { abstract serialize(serializer: Serializer): void; /** * Serializes a `Serializable` value to its BCS representation. * This function is the Typescript SDK equivalent of `bcs::to_bytes` in Move. * @returns the BCS representation of the Serializable instance as a byte buffer */ bcsToBytes(): Uint8Array; /** * Helper function to get a value's BCS-serialized bytes as a Hex instance. * @returns a Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array */ bcsToHex(): Hex; } declare class Serializer { private buffer; private offset; constructor(length?: number); private ensureBufferWillHandleSize; protected appendToBuffer(values: Uint8Array): void; private serializeWithFunction; /** * Serializes a string. UTF8 string is supported. * * The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer. * Then the string content is serialized as UTF8 encoded bytes. * * BCS layout for "string": string_length | string_content * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content. * * @example * ```ts * const serializer = new Serializer(); * serializer.serializeStr("1234abcd"); * assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100])); * ``` */ serializeStr(value: string): void; /** * Serializes an array of bytes. * * BCS layout for "bytes": bytes_length | bytes * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array. */ serializeBytes(value: Uint8Array): void; /** * Serializes an array of bytes with known length. Therefore, length doesn't need to be * serialized to help deserialization. * * When deserializing, the number of bytes to deserialize needs to be passed in. */ serializeFixedBytes(value: Uint8Array): void; /** * Serializes a boolean value. * * BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false. */ serializeBool(value: boolean): void; /** * Serializes a uint8 number. * * BCS layout for "uint8": One byte. Binary format in little-endian representation. */ serializeU8(value: Uint8): void; /** * Serializes a uint16 number. * * BCS layout for "uint16": Two bytes. Binary format in little-endian representation. * @example * ```ts * const serializer = new Serializer(); * serializer.serializeU16(4660); * assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12])); * ``` */ serializeU16(value: Uint16): void; /** * Serializes a uint32 number. * * BCS layout for "uint32": Four bytes. Binary format in little-endian representation. * @example * ```ts * const serializer = new Serializer(); * serializer.serializeU32(305419896); * assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12])); * ``` */ serializeU32(value: Uint32): void; /** * Serializes a uint64 number. * * BCS layout for "uint64": Eight bytes. Binary format in little-endian representation. * @example * ```ts * const serializer = new Serializer(); * serializer.serializeU64(1311768467750121216); * assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12])); * ``` */ serializeU64(value: AnyNumber): void; /** * Serializes a uint128 number. * * BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation. */ serializeU128(value: AnyNumber): void; /** * Serializes a uint256 number. * * BCS layout for "uint256": Sixteen bytes. Binary format in little-endian representation. */ serializeU256(value: AnyNumber): void; /** * Serializes a uint32 number with uleb128. * * BCS uses uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values */ serializeU32AsUleb128(val: Uint32): void; /** * Returns the buffered bytes */ toUint8Array(): Uint8Array; /** * Serializes a `Serializable` value, facilitating composable serialization. * * @param value The Serializable value to serialize * * @example * // Define the MoveStruct class that implements the Serializable interface * class MoveStruct extends Serializable { * constructor( * public creatorAddress: AccountAddress, // where AccountAddress extends Serializable * public collectionName: string, * public tokenName: string * ) {} * * serialize(serializer: Serializer): void { * serializer.serialize(this.creatorAddress); // Composable serialization of another Serializable object * serializer.serializeStr(this.collectionName); * serializer.serializeStr(this.tokenName); * } * } * * // Construct a MoveStruct * const moveStruct = new MoveStruct(new AccountAddress(...), "MyCollection", "TokenA"); * * // Serialize a string, a u64 number, and a MoveStruct instance. * const serializer = new Serializer(); * serializer.serializeStr("ExampleString"); * serializer.serializeU64(12345678); * serializer.serialize(moveStruct); * * // Get the bytes from the Serializer instance * const serializedBytes = serializer.toUint8Array(); * * @returns the serializer instance */ serialize(value: T): void; /** * Serializes an array of BCS Serializable values to a serializer instance. * Note that this does not return anything. The bytes are added to the serializer instance's byte buffer. * * @param values The array of BCS Serializable values * @example * const addresses = new Array( * AccountAddress.from("0x1"), * AccountAddress.from("0x2"), * AccountAddress.from("0xa"), * AccountAddress.from("0xb"), * ); * const serializer = new Serializer(); * serializer.serializeVector(addresses); * const serializedBytes = serializer.toUint8Array(); * // serializedBytes is now the BCS-serialized bytes * // The equivalent value in Move would be: * // `bcs::to_bytes(&vector
[@0x1, @0x2, @0xa, @0xb])`; */ serializeVector(values: Array): void; /** * Serializes a BCS Serializable values into a serializer instance or undefined. * Note that this does not return anything. The bytes are added to the serializer instance's byte buffer. * * @param values The array of BCS Serializable values * * @example * ```ts * const serializer = new Serializer(); * serializer.serializeOption(new AccountAddress(...)); * const serializedBytes = serializer.toUint8Array(); * // serializedBytes is now the BCS-serialized byte representation of AccountAddress * * const serializer = new Serializer(); * serializer.serializeOption(undefined); * assert(serializer.toUint8Array() === new Uint8Array([0x00])); * ``` */ serializeOption(value?: T): void; /** * Serializes an optional string. UTF8 string is supported. * * The existence of the string is encoded first, 0 if undefined and 1 if it exists. * Them the number of bytes in the string content is serialized, as a uleb128-encoded u32 integer. * Then the string content is serialized as UTF8 encoded bytes. * * BCS layout for optional "string": 1 | string_length | string_content * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content. * * BCS layout for undefined: 0 * @example * ```ts * const serializer = new Serializer(); * serializer.serializeOptionStr("1234abcd"); * assert(serializer.toUint8Array() === new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100])); * * const serializer = new Serializer(); * serializer.serializeOptionStr(undefined); * assert(serializer.toUint8Array() === new Uint8Array([0])); * ``` */ serializeOptionStr(value?: string): void; } declare function ensureBoolean(value: unknown): asserts value is boolean; declare const outOfRangeErrorMessage: (value: AnyNumber, min: AnyNumber, max: AnyNumber) => string; declare function validateNumberInRange(value: T, minValue: T, maxValue: T): void; interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument { } interface EntryFunctionArgument { /** * Serialize an argument to BCS-serialized bytes. */ serialize(serializer: Serializer): void; /** * Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains * the number of the following bytes followed by the BCS-serialized bytes for a typed argument. */ serializeForEntryFunction(serializer: Serializer): void; bcsToBytes(): Uint8Array; bcsToHex(): Hex; } interface ScriptFunctionArgument { /** * Serialize an argument to BCS-serialized bytes. */ serialize(serializer: Serializer): void; /** * Serialize an argument to BCS-serialized bytes as a type aware byte sequence. * The byte sequence contains an enum variant index followed by the BCS-serialized * bytes for a typed argument. */ serializeForScriptFunction(serializer: Serializer): void; bcsToBytes(): Uint8Array; bcsToHex(): Hex; } /** * This class exists to represent a contiguous sequence of already serialized BCS-bytes. * * It differs from most other Serializable classes in that its internal byte buffer is serialized to BCS * bytes exactly as-is, without prepending the length of the bytes. * * If you want to write your own serialization function and pass the bytes as a transaction argument, * you should use this class. * * This class is also more generally used to represent type-agnostic BCS bytes as a vector. * * An example of this is the bytes resulting from entry function arguments that have been serialized * for an entry function. * * @example * const yourCustomSerializedBytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]); * const fixedBytes = new FixedBytes(yourCustomSerializedBytes); * const payload = await generateTransactionPayload({ * function: "0xbeefcafe::your_module::your_function_that_requires_custom_serialization", * functionArguments: [yourCustomBytes], * }); * * For example, if you store each of the 32 bytes for an address as a U8 in a MoveVector, when you * serialize that MoveVector, it will be serialized to 33 bytes. If you solely want to pass around * the 32 bytes as a Serializable class that *does not* prepend the length to the BCS-serialized representation, * use this class. * * @params value: HexInput representing a sequence of Uint8 bytes * @returns a Serializable FixedBytes instance, which when serialized, does not prepend the length of the bytes * @see EntryFunctionBytes */ declare class FixedBytes extends Serializable implements TransactionArgument { value: Uint8Array; constructor(value: HexInput); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer, length: number): FixedBytes; } /** * This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because * serializing an entry function appends a prefix that's *only* used for entry function arguments. * * NOTE: Attempting to use this class for a serialized script function will result in erroneous * and unexpected behavior. * * If you wish to convert this class back to a TransactionArgument, you must know the type * of the argument beforehand, and use the appropriate class to deserialize the bytes within * an instance of this class. */ declare class EntryFunctionBytes extends Serializable implements EntryFunctionArgument { readonly value: FixedBytes; private constructor(); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; /** * The only way to create an instance of this class is to use this static method. * * This function should only be used when deserializing a sequence of EntryFunctionPayload arguments. * @param deserializer the deserializer instance with the buffered bytes * @param length the length of the bytes to deserialize * @returns an instance of this class, which will now only be usable as an EntryFunctionArgument */ static deserialize(deserializer: Deserializer, length: number): EntryFunctionBytes; } declare class Bool extends Serializable implements TransactionArgument { readonly value: boolean; constructor(value: boolean); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Bool; } declare class U8 extends Serializable implements TransactionArgument { readonly value: Uint8; constructor(value: Uint8); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U8; } declare class U16 extends Serializable implements TransactionArgument { readonly value: Uint16; constructor(value: Uint16); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U16; } declare class U32 extends Serializable implements TransactionArgument { readonly value: Uint32; constructor(value: Uint32); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U32; } declare class U64 extends Serializable implements TransactionArgument { readonly value: bigint; constructor(value: AnyNumber); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U64; } declare class U128 extends Serializable implements TransactionArgument { readonly value: bigint; constructor(value: AnyNumber); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U128; } declare class U256 extends Serializable implements TransactionArgument { readonly value: bigint; constructor(value: AnyNumber); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): U256; } /** * This class is the Endless Typescript SDK representation of a Move `vector`, * where `T` represents either a primitive type (`bool`, `u8`, `u64`, ...) * or a BCS-serializable struct itself. * * It is a BCS-serializable, array-like type that contains an array of values of type `T`, * where `T` is a class that implements `Serializable`. * * The purpose of this class is to facilitate easy construction of BCS-serializable * Move `vector` types. * * @example * // in Move: `vector [1, 2, 3, 4];` * const vecOfU8s = new MoveVector([new U8(1), new U8(2), new U8(3), new U8(4)]); * // in Move: `std::bcs::to_bytes(vector [1, 2, 3, 4]);` * const bcsBytes = vecOfU8s.toUint8Array(); * * // vector> [ vector [1], vector [1, 2, 3, 4], vector [5, 6, 7, 8] ]; * const vecOfVecs = new MoveVector>([ * new MoveVector([new U8(1)]), * MoveVector.U8([1, 2, 3, 4]), * MoveVector.U8([5, 6, 7, 8]), * ]); * * // vector> [ std::option::some(1), std::option::some(2) ]; * const vecOfOptionU8s = new MoveVector>([ * MoveOption.U8(1), * MoveOption.U8(2), * ]); * * // vector [ std::string::utf8(b"hello"), std::string::utf8(b"world") ]; * const vecOfStrings = new MoveVector([new MoveString("hello"), new MoveString("world")]); * const vecOfStrings2 = MoveVector.MoveString(["hello", "world"]); * * @params * values: an Array of values where T is a class that implements Serializable * @returns a `MoveVector` with the values `values` */ declare class MoveVector extends Serializable implements TransactionArgument { values: Array; constructor(values: Array); serializeForEntryFunction(serializer: Serializer): void; /** * NOTE: This function will only work when the inner values in the `MoveVector` are `U8`s. * @param serializer */ serializeForScriptFunction(serializer: Serializer): void; /** * Factory method to generate a MoveVector of U8s from an array of numbers. * * @example * const v = MoveVector.U8([1, 2, 3, 4]); * @params values: an array of `numbers` to convert to U8s * @returns a `MoveVector` */ static U8(values: Array | HexInput): MoveVector; /** * Factory method to generate a MoveVector of U16s from an array of numbers. * * @example * const v = MoveVector.U16([1, 2, 3, 4]); * @params values: an array of `numbers` to convert to U16s * @returns a `MoveVector` */ static U16(values: Array): MoveVector; /** * Factory method to generate a MoveVector of U32s from an array of numbers. * * @example * const v = MoveVector.U32([1, 2, 3, 4]); * @params values: an array of `numbers` to convert to U32s * @returns a `MoveVector` */ static U32(values: Array): MoveVector; /** * Factory method to generate a MoveVector of U64s from an array of numbers or bigints. * * @example * const v = MoveVector.U64([1, 2, 3, 4]); * @params values: an array of numbers of type `number | bigint` to convert to U64s * @returns a `MoveVector` */ static U64(values: Array): MoveVector; /** * Factory method to generate a MoveVector of U128s from an array of numbers or bigints. * * @example * const v = MoveVector.U128([1, 2, 3, 4]); * @params values: an array of numbers of type `number | bigint` to convert to U128s * @returns a `MoveVector` */ static U128(values: Array): MoveVector; /** * Factory method to generate a MoveVector of U256s from an array of numbers or bigints. * * @example * const v = MoveVector.U256([1, 2, 3, 4]); * @params values: an array of numbers of type `number | bigint` to convert to U256s * @returns a `MoveVector` */ static U256(values: Array): MoveVector; /** * Factory method to generate a MoveVector of Bools from an array of booleans. * * @example * const v = MoveVector.Bool([true, false, true, false]); * @params values: an array of `bools` to convert to Bools * @returns a `MoveVector` */ static Bool(values: Array): MoveVector; /** * Factory method to generate a MoveVector of MoveStrings from an array of strings. * * @example * const v = MoveVector.MoveString(["hello", "world"]); * @params values: an array of `strings` to convert to MoveStrings * @returns a `MoveVector` */ static MoveString(values: Array): MoveVector; serialize(serializer: Serializer): void; /** * Deserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type. * * NOTE: This only works with a depth of one. Generics will not work. * * NOTE: This will not work with types that aren't of the Serializable class. * * If you're looking for a more flexible deserialization function, you can use the deserializeVector function * in the Deserializer class. * * @example * const vec = MoveVector.deserialize(deserializer, U64); * @params deserializer: the Deserializer instance to use, with bytes loaded into it already. * cls: the class to typecast the input values to, must be a Serializable and Deserializable type. * @returns a MoveVector of the corresponding class T * * */ static deserialize(deserializer: Deserializer, cls: Deserializable): MoveVector; } declare class MoveString extends Serializable implements TransactionArgument { value: string; constructor(value: string); serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MoveString; } declare class MoveOption extends Serializable implements EntryFunctionArgument { private vec; readonly value?: T; constructor(value?: T | null); serializeForEntryFunction(serializer: Serializer): void; /** * Retrieves the inner value of the MoveOption. * * This method is inspired by Rust's `Option.unwrap()`. * In Rust, attempting to unwrap a `None` value results in a panic. * * Similarly, this method will throw an error if the value is not present. * * @example * const option = new MoveOption(new Bool(true)); * const value = option.unwrap(); // Returns the Bool instance * * @throws {Error} Throws an error if the MoveOption does not contain a value. * * @returns {T} The contained value if present. */ unwrap(): T; isSome(): boolean; serialize(serializer: Serializer): void; /** * Factory method to generate a MoveOption from a `number` or `undefined`. * * @example * MoveOption.U8(1).isSome() === true; * MoveOption.U8().isSome() === false; * MoveOption.U8(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U8(value?: number | null): MoveOption; /** * Factory method to generate a MoveOption from a `number` or `undefined`. * * @example * MoveOption.U16(1).isSome() === true; * MoveOption.U16().isSome() === false; * MoveOption.U16(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U16(value?: number | null): MoveOption; /** * Factory method to generate a MoveOption from a `number` or `undefined`. * * @example * MoveOption.U32(1).isSome() === true; * MoveOption.U32().isSome() === false; * MoveOption.U32(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U32(value?: number | null): MoveOption; /** * Factory method to generate a MoveOption from a `number` or a `bigint` or `undefined`. * * @example * MoveOption.U64(1).isSome() === true; * MoveOption.U64().isSome() === false; * MoveOption.U64(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U64(value?: AnyNumber | null): MoveOption; /** * Factory method to generate a MoveOption from a `number` or a `bigint` or `undefined`. * * @example * MoveOption.U128(1).isSome() === true; * MoveOption.U128().isSome() === false; * MoveOption.U128(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U128(value?: AnyNumber | null): MoveOption; /** * Factory method to generate a MoveOption from a `number` or a `bigint` or `undefined`. * * @example * MoveOption.U256(1).isSome() === true; * MoveOption.U256().isSome() === false; * MoveOption.U256(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static U256(value?: AnyNumber | null): MoveOption; /** * Factory method to generate a MoveOption from a `boolean` or `undefined`. * * @example * MoveOption.Bool(true).isSome() === true; * MoveOption.Bool().isSome() === false; * MoveOption.Bool(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static Bool(value?: boolean | null): MoveOption; /** * Factory method to generate a MoveOption from a `string` or `undefined`. * * @example * MoveOption.MoveString("hello").isSome() === true; * MoveOption.MoveString("").isSome() === true; * MoveOption.MoveString().isSome() === false; * MoveOption.MoveString(undefined).isSome() === false; * @params value: the value used to fill the MoveOption. If `value` is undefined * the resulting MoveOption's .isSome() method will return false. * @returns a MoveOption with an inner value `value` */ static MoveString(value?: string | null): MoveOption; static deserialize(deserializer: Deserializer, cls: Deserializable): MoveOption; } /** * This enum is used to explain why an address was invalid. */ declare enum AddressInvalidReason { INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes", INVALID_HEX_CHARS = "invalid_hex_chars", TOO_SHORT = "too_short", TOO_LONG = "too_long", LEADING_ZERO_X_REQUIRED = "leading_zero_x_required", LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special", INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES" } type AccountAddressInput = HexInput | AccountAddress; /** * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction * hashes, use the Hex class. * * AccountAddress is used for working with account addresses. Account addresses, when * represented as a string, generally look like these examples: * - 0x1 * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c * * Proper formatting and parsing of account addresses is defined by AIP-40. * To learn more about the standard, read the AIP here: * https://github.com/endless-foundation/AIPs/blob/main/aips/aip-40.md. * * The comments in this class make frequent reference to the LONG and SHORT formats, * as well as "special" addresses. To learn what these refer to see AIP-40. */ declare class AccountAddress extends Serializable implements TransactionArgument { /** * This is the internal representation of an account address. */ readonly data: Uint8Array; /** * The number of bytes that make up an account address. */ static readonly LENGTH: number; /** * The length of an address string in LONG form without a leading 0x. */ static readonly LONG_STRING_LENGTH: number; static ZERO: AccountAddress; static ONE: AccountAddress; static TWO: AccountAddress; static THREE: AccountAddress; static FOUR: AccountAddress; /** * Creates an instance of AccountAddress from a Uint8Array. * * @param args.data A Uint8Array representing an account address. */ constructor(input: Uint8Array); /** * Returns whether an address is special, where special is defined as 0x0 to 0xf * inclusive. In other words, the last byte of the address must be < 0b10000 (16) * and every other byte must be zero. * * For more information on how special addresses are defined see AIP-40: * https://github.com/endless-foundation/AIPs/blob/main/aips/aip-40.md. * * @returns true if the address is special, false if not. */ isSpecial(): boolean; /** * Return the AccountAddress as a string as per AIP-40. * https://github.com/endless-foundation/AIPs/blob/main/aips/aip-40.md. * * In short, it means that special addresses are represented in SHORT form, meaning * 0x0 through to 0xf inclusive, and every other address is represented in LONG form, * meaning 0x + 64 hex characters. * * @returns AccountAddress as a string conforming to AIP-40. */ toString(): `0x${string}`; /** * Converts the current object's data into a Base58 string. * This function takes no parameters. * * @returns {string} Returns the converted Base58 string. */ toBs58String(): string; /** * NOTE: Prefer to use `toString` where possible. * * Return the AccountAddress as a string as per AIP-40 but without the leading 0x. * * Learn more by reading the docstring of `toString`. * * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x. */ toStringWithoutPrefix(): string; /** * NOTE: Prefer to use `toString` where possible. * * Whereas toString will format special addresses (as defined by isSpecial) using the * SHORT form (no leading 0s), this format the address in the LONG format * unconditionally. * * This means it will be 0x + 64 hex characters. * * @returns AccountAddress as a string in LONG form. */ toStringLong(): `0x${string}`; /** * NOTE: Prefer to use `toString` where possible. * * Whereas toString will format special addresses (as defined by isSpecial) using the * SHORT form (no leading 0s), this function will include leading zeroes. The string * will not have a leading zero. * * This means it will be 64 hex characters without a leading 0x. * * @returns AccountAddress as a string in LONG form without a leading 0x. */ toStringLongWithoutPrefix(): string; /** * Get the inner hex data. The inner data is already a Uint8Array so no conversion * is taking place here, it just returns the inner data. * * @returns Hex data as Uint8Array */ toUint8Array(): Uint8Array; /** * Serialize the AccountAddress to a Serializer instance's data buffer. * @param serializer The serializer to serialize the AccountAddress to. * @returns void * @example * const serializer = new Serializer(); * const address = AccountAddress.fromString("0x1"); * address.serialize(serializer); * const bytes = serializer.toUint8Array(); * // `bytes` is now the BCS-serialized address. */ serialize(serializer: Serializer): void; serializeForEntryFunction(serializer: Serializer): void; serializeForScriptFunction(serializer: Serializer): void; /** * Deserialize an AccountAddress from the byte buffer in a Deserializer instance. * @param deserializer The deserializer to deserialize the AccountAddress from. * @returns An instance of AccountAddress. * @example * const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132"); * const deserializer = new Deserializer(bytes); * const address = AccountAddress.deserialize(deserializer); * // `address` is now an instance of AccountAddress. */ static deserialize(deserializer: Deserializer): AccountAddress; /** * NOTE: This function has strict parsing behavior. For relaxed behavior, please use * the `fromString` function. * * Creates an instance of AccountAddress from a hex string. * * This function allows only the strictest formats defined by AIP-40. In short this * means only the following formats are accepted: * * - LONG * - SHORT for special addresses * * Where: * - LONG is defined as 0x + 64 hex characters. * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes. * * This means the following are not accepted: * - SHORT for non-special addresses. * - Any address without a leading 0x. * * Learn more about the different address formats by reading AIP-40: * https://github.com/endless-foundation/AIPs/blob/main/aips/aip-40.md. * * @param input A hex string representing an account address. * * @returns An instance of AccountAddress. */ static fromStringStrict(input: string): AccountAddress; /** * NOTE: This function has relaxed parsing behavior. For strict behavior, please use * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this * function, `fromString` is only provided for backwards compatibility. * * Creates an instance of AccountAddress from a hex string. * * This function allows all formats defined by AIP-40. In short this means the * following formats are accepted: * * - LONG, with or without leading 0x * - SHORT, with or without leading 0x * * Where: * - LONG is 64 hex characters. * - SHORT is 1 to 63 hex characters inclusive. * - Padding zeroes are allowed, e.g. 0x0123 is valid. * * Learn more about the different address formats by reading AIP-40: * https://github.com/endless-foundation/AIPs/blob/main/aips/aip-40.md. * * @param input A hex string representing an account address. * * @returns An instance of AccountAddress. */ static fromString(input: string): AccountAddress; static fromBs58String(input: string): AccountAddress; /** * Convenience method for creating an AccountAddress from all known inputs. * * This handles, Uint8array, string, and AccountAddress itself * @param input */ static from(input: AccountAddressInput): AccountAddress; /** * Convenience method for creating an AccountAddress from all known inputs. * * This handles, Uint8array, string, and AccountAddress itself * @param input */ static fromStrict(input: AccountAddressInput): AccountAddress; /** * Check if the string is a valid AccountAddress. * * @param args.input A hex string representing an account address. * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior. * * @returns valid = true if the string is valid, valid = false if not. If the string * is not valid, invalidReason will be set explaining why it is invalid. */ static isValid(args: { input: AccountAddressInput; strict?: boolean; }): ParsingResult; /** * Return whether AccountAddresses are equal. AccountAddresses are considered equal * if their underlying byte data is identical. * * @param other The AccountAddress to compare to. * @returns true if the AccountAddresses are equal, false if not. */ equals(other: AccountAddress): boolean; } /** * An abstract representation of a crypto signature, * associated to a specific signature scheme e.g. Ed25519 or Secp256k1 * * This is the product of signing a message directly from a PrivateKey * and can be verified against a CryptoPublicKey. */ declare abstract class Signature extends Serializable { /** * Get the raw signature bytes */ abstract toUint8Array(): Uint8Array; /** * Get the signature as a hex string with a 0x prefix e.g. 0x123456... */ toString(): string; } /** * Arguments for verifying a signature */ interface VerifySignatureArgs { message: HexInput; signature: Signature; } /** * An abstract representation of a public key. * * Provides a common interface for verifying any signature. */ declare abstract class PublicKey extends Serializable { /** * Verifies that the private key associated with this public key signed the message with the given signature. * @param args.message The message that was signed * @param args.signature The signature to verify */ abstract verifySignature(args: VerifySignatureArgs): boolean; /** * Get the raw public key bytes */ abstract toUint8Array(): Uint8Array; /** * Get the public key as a hex string with a 0x prefix e.g. 0x123456... */ toString(): string; } /** * An abstract representation of an account public key. * * Provides a common interface for deriving an authentication key. */ declare abstract class AccountPublicKey extends PublicKey { /** * Get the authentication key associated with this public key */ abstract authKey(): AuthenticationKey; } /** * An abstract representation of a private key. * It is associated to a signature scheme and provides signing capabilities. */ interface PrivateKey { /** * Sign the given message with the private key. * @param message in HexInput format */ sign(message: HexInput): Signature; /** * Derive the public key associated with the private key */ publicKey(): PublicKey; /** * Get the private key in bytes (Uint8Array). */ toUint8Array(): Uint8Array; } /** * Represents the public key of an Ed25519 key pair. * * Since [AIP-55](https://github.com/endless-foundation/AIPs/pull/263) Endless supports * `Legacy` and `Unified` authentication keys. * * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also * as `AnyPublicKey` that represents any `Unified authentication key` */ declare class Ed25519PublicKey extends AccountPublicKey { /** * Length of an Ed25519 public key */ static readonly LENGTH: number; /** * Bytes of the public key * @private */ private readonly key; /** * Create a new PublicKey instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Verifies a signed data with a public key * @param args.message a signed message as a Hex string or Uint8Array * @param args.signature the signature of the message */ verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Ed25519PublicKey; /** * @deprecated use `instanceof Ed25519PublicKey` instead. */ static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey; } /** * Represents the private key of an Ed25519 key pair. */ declare class Ed25519PrivateKey extends Serializable implements PrivateKey { /** * Length of an Ed25519 private key */ static readonly LENGTH: number; /** * The Ed25519 key seed to use for BIP-32 compatibility * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md} */ static readonly SLIP_0010_SEED = "ed25519 seed"; /** * The Ed25519 signing key * @private */ private readonly signingKey; /** * Create a new PrivateKey instance from a Uint8Array or String. * * @param hexInput HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Generate a new random private key. * * @returns Ed25519PrivateKey */ static generate(): Ed25519PrivateKey; /** * Derives a private key from a mnemonic seed phrase. * * To derive multiple keys from the same phrase, change the path * * IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism, * so non-hardened derivation cannot work) * * @param path the BIP44 path * @param mnemonics the mnemonic seed phrase */ static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey; /** * A private inner function so we can separate from the main fromDerivationPath() method * to add tests to verify we create the keys correctly. * * @param path the BIP44 path * @param seed the seed phrase created by the mnemonics * @param offset the offset used for key derivation, defaults to 0x80000000 * @returns */ private static fromDerivationPathInner; /** * Derive the Ed25519PublicKey for this private key. * * @returns Ed25519PublicKey */ publicKey(): Ed25519PublicKey; /** * Sign the given message with the private key. * * @param message a message as a string or Uint8Array * @returns Signature */ sign(message: HexInput): Ed25519Signature; /** * Get the private key in bytes (Uint8Array). * * @returns Uint8Array representation of the private key */ toUint8Array(): Uint8Array; /** * Get the private key as a hex string with the 0x prefix. * * @returns string representation of the private key */ toString(): string; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Ed25519PrivateKey; /** * @deprecated use `instanceof Ed25519PrivateKey` instead. */ static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey; } /** * A signature of a message signed using an Ed25519 private key */ declare class Ed25519Signature extends Signature { /** * Length of an Ed25519 signature */ static readonly LENGTH = 64; /** * The signature bytes * @private */ private readonly data; constructor(hexInput: HexInput); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Ed25519Signature; /** * Checks if an ED25519 signature is non-canonical. * * Comes from Endless Core * https://github.com/endless-labs/endless-core/blob/main/crates/endless-crypto/src/ed25519/ed25519_sigs.rs#L47-L85 */ isCanonicalSignature(): boolean; } type DerivedKeys = { key: Uint8Array; chainCode: Uint8Array; }; /** * Endless derive path is 637 */ declare const ENDLESS_HARDENED_REGEX: RegExp; declare const ENDLESS_BIP44_REGEX: RegExp; /** * A list of supported key types and associated seeds */ declare enum KeyType { ED25519 = "ed25519 seed" } declare const HARDENED_OFFSET = 2147483648; /** * Endless derive path is 637 * * Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index} * for Secp256k1 * * Note that for secp256k1, last two components must be non-hardened. * * @param path path string (e.g. `m/44'/637'/0'/0/0`). */ declare function isValidBIP44Path(path: string): boolean; /** * Endless derive path is 637 * * Parse and validate a path that is compliant to SLIP-0010 and BIP-44 * in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'. * See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md} * See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * * Note that for Ed25519, all components must be hardened. * This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism. * Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b. * This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘), * with the hash function breaking the homomorphism. * * @param path path string (e.g. `m/44'/637'/0'/0'/0'`). */ declare function isValidHardenedPath(path: string): boolean; declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys; /** * Derive a child key from the private key * @param key * @param chainCode * @param index * @constructor */ declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys; /** * Splits derive path into segments * @param path */ declare const splitPath: (path: string) => Array; /** * Normalizes the mnemonic by removing extra whitespace and making it lowercase * @param mnemonic the mnemonic seed phrase */ declare const mnemonicToSeed: (mnemonic: string) => Uint8Array; /** * Represents the public key of a K-of-N Ed25519 multi-sig transaction. */ declare class MultiEd25519PublicKey extends AccountPublicKey { /** * Maximum number of public keys supported */ static readonly MAX_KEYS = 32; /** * Minimum number of public keys needed */ static readonly MIN_KEYS = 2; /** * Minimum threshold for the number of valid signatures required */ static readonly MIN_THRESHOLD = 1; /** * List of Ed25519 public keys for this LegacyMultiEd25519PublicKey */ readonly publicKeys: Ed25519PublicKey[]; /** * The minimum number of valid signatures required, for the number of public keys specified */ readonly threshold: number; /** * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a * transaction to be executed, at least K out of the N authorized signers have signed the transaction * and passed the check conducted by the chain. * * @see {@link * https://endless.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction} * * @param args.publicKeys A list of public keys * @param args.threshold At least "threshold" signatures must be valid */ constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number; }); verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; /** * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiEd25519PublicKey; } /** * Represents the signature of a K-of-N Ed25519 multi-sig transaction. */ declare class MultiEd25519Signature extends Signature { /** * Maximum number of Ed25519 signatures supported */ static MAX_SIGNATURES_SUPPORTED: number; /** * Number of bytes in the bitmap representing who signed the transaction (32-bits) */ static BITMAP_LEN: number; /** * The list of underlying Ed25519 signatures */ readonly signatures: Ed25519Signature[]; /** * 32-bit Bitmap representing who signed the transaction * * This is represented where each public key can be masked to determine whether the message was signed by that key. */ readonly bitmap: Uint8Array; /** * Signature for a K-of-N multi-sig transaction. * * @see {@link * https://endless.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction} * * @param args.signatures A list of signatures * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth * signature should be provided in `signatures`. Bits are read from left to right. * Alternatively, you can specify an array of bitmap positions. * Valid position should range between 0 and 31. * @see MultiEd25519Signature.createBitmap */ constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array | number[]; }); /** * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap` */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiEd25519Signature; /** * Helper method to create a bitmap out of the specified bit positions * @param args.bits The bitmap positions that should be set. A position starts at index 0. * Valid position should range between 0 and 31. * @example * Here's an example of valid `bits` * ``` * [0, 2, 31] * ``` * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap. * The result bitmap should be 0b1010000000000000000000000000001 * * @returns bitmap that is 32bit long */ static createBitmap(args: { bits: number[]; }): Uint8Array; } /** * Represents any public key supported by Endless. * * Since [AIP-55](https://github.com/endless-foundation/AIPs/pull/263) Endless supports * `Legacy` and `Unified` authentication keys. * * Any unified authentication key is represented in the SDK as `AnyPublicKey`. */ declare class AnyPublicKey extends AccountPublicKey { /** * Reference to the inner public key */ readonly publicKey: PublicKey; /** * Index of the underlying enum variant */ readonly variant: AnyPublicKeyVariant; constructor(publicKey: PublicKey); verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): AnyPublicKey; /** * @deprecated use `instanceof AnyPublicKey` instead. */ static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey; /** * @deprecated use `publicKey instanceof Ed25519PublicKey` instead. */ isEd25519(): boolean; /** * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead. */ isSecp256k1PublicKey(): boolean; } /** * Instance of signature that uses the SingleKey authentication scheme. * This signature can only be generated by a `SingleKeySigner`, since it uses the * same authentication scheme. */ declare class AnySignature extends Signature { readonly signature: Signature; /** * Index of the underlying enum variant */ private readonly variant; constructor(signature: Signature); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): AnySignature; } /** * Represents the public key of a multi-agent account. * * The public keys of each individual agent can be any type of public key supported by Endless. * Since [AIP-55](https://github.com/endless-foundation/AIPs/pull/263) Endless supports * `Legacy` and `Unified` authentication keys. */ declare class MultiKey extends AccountPublicKey { /** * List of any public keys */ readonly publicKeys: AnyPublicKey[]; /** * The minimum number of valid signatures required, for the number of public keys specified */ readonly signaturesRequired: number; constructor(args: { publicKeys: Array; signaturesRequired: number; }); verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiKey; /** * Create a bitmap that holds the mapping from the original public keys * to the signatures passed in * * @param args.bits array of the index mapping to the matching public keys * @returns Uint8array bit map */ createBitmap(args: { bits: number[]; }): Uint8Array; /** * Get the index of the provided public key. * * @param publicKey array of the index mapping to the matching public keys * @returns the corresponding index of the publicKey, if it exists */ getIndex(publicKey: PublicKey): number; } declare class MultiKeySignature extends Signature { /** * Number of bytes in the bitmap representing who signed the transaction (32-bits) */ static BITMAP_LEN: number; /** * Maximum number of Ed25519 signatures supported */ static MAX_SIGNATURES_SUPPORTED: number; /** * The list of underlying Ed25519 signatures */ readonly signatures: AnySignature[]; /** * 32-bit Bitmap representing who signed the transaction * * This is represented where each public key can be masked to determine whether the message was signed by that key. */ readonly bitmap: Uint8Array; /** * Signature for a K-of-N multi-sig transaction. * * @see {@link * https://endless.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction} * * @param args.signatures A list of signatures * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth * signature should be provided in `signatures`. Bits are read from left to right */ constructor(args: { signatures: Array; bitmap: Uint8Array | number[]; }); /** * Helper method to create a bitmap out of the specified bit positions * @param args.bits The bitmap positions that should be set. A position starts at index 0. * Valid position should range between 0 and 31. * @example * Here's an example of valid `bits` * ``` * [0, 2, 31] * ``` * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap. * The result bitmap should be 0b1010000000000000000000000000001 * * @returns bitmap that is 32bit long */ static createBitmap(args: { bits: number[]; }): Uint8Array; toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiKeySignature; } /** * Represents ephemeral public keys for Endless Keyless accounts. * * These are not public keys used as a public key on an account. They are only used ephemerally on Keyless accounts. */ declare class EphemeralPublicKey extends PublicKey { /** * The public key itself */ readonly publicKey: PublicKey; /** * An enum indicating the scheme of the ephemeral public key */ readonly variant: EphemeralPublicKeyVariant; constructor(publicKey: PublicKey); /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; /** * Verifies a signed data with a the ephemeral public key * * @param args.message message * @param args.signature The signature that was signed by the private key of the ephemeral public key * @returns true if the signature is valid */ verifySignature(args: { message: HexInput; signature: EphemeralSignature; }): boolean; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralPublicKey; static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey; } /** * Represents ephemeral signatures used in Endless Keyless accounts. * * These signatures are used inside of KeylessSignature */ declare class EphemeralSignature extends Signature { /** * The signature signed by the private key of an EphemeralKeyPair */ readonly signature: Signature; constructor(signature: Signature); /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; static fromHex(hexInput: HexInput): EphemeralSignature; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralSignature; } /** * An abstract representation of a crypto proof. * associated to a specific zero knowledge proof schemes e.g. Groth16, PLONK */ declare abstract class Proof extends Serializable { /** * Get the proof as a hex string with a 0x prefix e.g. 0x123456... */ toString(): string; } type Groth16VerificationKeyResponse = { alpha_g1: string; beta_g2: string; delta_g2: string; gamma_abc_g1: [string, string]; gamma_g2: string; }; /** * Type of API endpoint for request routing */ declare enum EndlessApiType { FULLNODE = "Fullnode", INDEXER = "Indexer", FAUCET = "Faucet", INDEXERV2 = "Indexer2", PEPPER = "Pepper", PROVER = "Prover" } /** * The default max gas amount when none is given. * * This is the maximum number of gas units that will be used by a transaction before being rejected. * * Note that max gas amount varies based on the transaction. A larger transaction will go over this * default gas amount, and the value will need to be changed for the specific transaction. */ declare const DEFAULT_MAX_GAS_AMOUNT = 100000; /** * The default transaction expiration seconds from now. * * This time is how long until the blockchain nodes will reject the transaction. * * Note that the transaction expiration time varies based on network connection and network load. It may need to be * increased for the transaction to be processed. */ declare const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20; /** * The default number of seconds to wait for a transaction to be processed. * * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for * the results of the transaction. It may take longer based on network connection and network load. */ declare const DEFAULT_TXN_TIMEOUT_SEC = 20; /** * The default gas currency for the network. */ declare const ENDLESS_COIN = "0x1::endless_coin::EndlessCoin"; declare const ENDLESS_COIN_ID = "ENDLESSsssssssssssssssssssssssssssssssssssss"; declare const RAW_TRANSACTION_SALT = "ENDLESS::RawTransaction"; declare const RAW_TRANSACTION_WITH_DATA_SALT = "ENDLESS::RawTransactionWithData"; /** * This class holds the config information for the SDK client instance. * * @example * * const endlessConfig = new EndlessConfig({network:Network.TESTNET}) */ declare class EndlessConfig { /** * The Network that this SDK is associated with. Defaults to DEVNET */ readonly network: Network; /** * The client instance the SDK uses. Defaults to @endlesslab/endless-client */ readonly client: Client; /** * The optional hardcoded fullnode URL to send requests to instead of using the network */ readonly fullnode?: string; /** * The optional hardcoded prover service URL to send requests to instead of using the network */ readonly prover?: string; /** * The optional hardcoded indexer URL to send requests to instead of using the network */ readonly indexer?: string; readonly indexerV2?: string; /** * Optional client configurations */ readonly clientConfig?: ClientConfig; /** * Optional specific Fullnode configurations */ readonly fullnodeConfig?: FullNodeConfig; /** * Optional specific Indexer configurations */ readonly indexerConfig?: IndexerConfig; readonly maxExpHorizonSecs?: number; constructor(settings?: EndlessSettings); /** * Returns the URL endpoint to send the request to. * If a custom URL was provided in the config, that URL is returned. * If a custom URL was provided but not URL endpoints, an error is thrown. * Otherwise, the URL endpoint is derived from the network. * * @param apiType - The type of Endless API to get the URL for. * * @internal */ getRequestUrl(apiType: EndlessApiType): string; } declare const EPK_HORIZON_SECS = 10000000; declare const MAX_AUD_VAL_BYTES = 120; declare const MAX_UID_KEY_BYTES = 30; declare const MAX_UID_VAL_BYTES = 330; declare const MAX_ISS_VAL_BYTES = 120; declare const MAX_EXTRA_FIELD_BYTES = 350; declare const MAX_JWT_HEADER_B64_BYTES = 300; declare const MAX_COMMITED_EPK_BYTES = 93; /** * Represents the KeylessPublicKey public key * * KeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`. */ declare class KeylessPublicKey extends AccountPublicKey { /** * The number of bytes that `idCommitment` should be */ static readonly ID_COMMITMENT_LENGTH: number; /** * The value of the 'iss' claim on the JWT which identifies the OIDC provider. */ readonly iss: string; /** * A value representing a cryptographic commitment to a user identity. * * It is calculated from the aud, uidKey, uidVal, pepper. */ readonly idCommitment: Uint8Array; constructor(iss: string, idCommitment: HexInput); /** * Get the authentication key for the keyless public key * * @returns AuthenticationKey */ authKey(): AuthenticationKey; /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; /** * Get the public key as a hex string with the 0x prefix. * * @returns string representation of the public key */ toString(): string; /** * Verifies a signed data with a public key * * @param args.message message * @param args.signature The signature * @returns true if the signature is valid */ verifySignature(args: { message: HexInput; signature: KeylessSignature; }): boolean; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): KeylessPublicKey; static load(deserializer: Deserializer): KeylessPublicKey; static isPublicKey(publicKey: PublicKey): publicKey is KeylessPublicKey; /** * Creates a KeylessPublicKey from the JWT components plus pepper * * @param args.iss the iss of the identity * @param args.uidKey the key to use to get the uidVal in the JWT token * @param args.uidVal the value of the uidKey in the JWT token * @param args.aud the client ID of the application * @param args.pepper The pepper used to maintain privacy of the account * @returns KeylessPublicKey */ static create(args: { iss: string; uidKey: string; uidVal: string; aud: string; pepper: HexInput; }): KeylessPublicKey; static fromJwtAndPepper(args: { jwt: string; pepper: HexInput; uidKey?: string; }): KeylessPublicKey; static isInstance(publicKey: PublicKey): boolean; } /** * A signature of a message signed via Keyless Accounnt that uses proofs or the jwt token to authenticate. */ declare class KeylessSignature extends Signature { /** * The inner signature ZeroKnowledgeSigniature or OpenIdSignature */ readonly ephemeralCertificate: EphemeralCertificate; /** * The jwt header in the token used to create the proof/signature. In json string representation. */ readonly jwtHeader: string; /** * The expiry timestamp in seconds of the EphemeralKeyPair used to sign */ readonly expiryDateSecs: number; /** * The ephemeral public key used to verify the signature */ readonly ephemeralPublicKey: EphemeralPublicKey; /** * The signature resulting from signing with the private key of the EphemeralKeyPair */ readonly ephemeralSignature: EphemeralSignature; constructor(args: { jwtHeader: string; ephemeralCertificate: EphemeralCertificate; expiryDateSecs: number; ephemeralPublicKey: EphemeralPublicKey; ephemeralSignature: EphemeralSignature; }); /** * Get the signature in bytes (Uint8Array). * * @returns Uint8Array representation of the signature */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): KeylessSignature; static getSimulationSignature(): KeylessSignature; static isSignature(signature: Signature): signature is KeylessSignature; } /** * A container for a signature that is a ZeroKnowledgeSig. Can be expanded to support OpenIdSignature. */ declare class EphemeralCertificate extends Signature { readonly signature: Signature; /** * Index of the underlying enum variant */ private readonly variant; constructor(signature: Signature, variant: EphemeralCertificateVariant); /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralCertificate; } declare class G1Bytes extends Serializable { data: Uint8Array; constructor(data: HexInput); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): G1Bytes; } declare class G2Bytes extends Serializable { data: Uint8Array; constructor(data: HexInput); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): G2Bytes; } /** * A representation of a Groth16 proof. The points are the compressed serialization of affine reprentation of the proof. */ declare class Groth16Zkp extends Proof { /** * The bytes of G1 proof point a */ a: G1Bytes; /** * The bytes of G2 proof point b */ b: G2Bytes; /** * The bytes of G1 proof point c */ c: G1Bytes; constructor(args: { a: HexInput; b: HexInput; c: HexInput; }); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Groth16Zkp; hash(): Uint8Array; } /** * The signature representation of a proof */ declare class ZeroKnowledgeSig extends Signature { /** * The proof */ readonly proof: Proof; readonly nonMalleabilitySignature: EphemeralSignature; /** * The max lifespan of the proof */ readonly expHorizonSecs: number; /** * A key value pair on the JWT token that can be specified on the signature which would reveal the value on chain. * Can be used to assert identity or other attributes. */ readonly extraField?: string; /** * The 'aud' value of the recovery service which is set when recovering an account. */ readonly overrideAudVal?: string; /** * The training wheels signature */ readonly trainingWheelsSignature?: EphemeralSignature; constructor(args: { proof: Proof; nonMalleabilitySignature: EphemeralSignature; expHorizonSecs: number; extraField?: string; overrideAudVal?: string; trainingWheelsSignature?: EphemeralSignature; }); /** * Get the signature in bytes (Uint8Array). * * @returns Uint8Array representation of the signature */ toUint8Array(): Uint8Array; /** * Return a ZeroKnowledgeSig object from its bcs serialization in bytes. * * @returns ZeroKnowledgeSig */ static fromBytes(bytes: Uint8Array): ZeroKnowledgeSig; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): ZeroKnowledgeSig; } /** * A class which represents the on-chain configuration for how Keyless accounts work */ declare class KeylessConfiguration { /** * The verification key used to verify Groth16 proofs on chain */ readonly verficationKey: Groth16VerificationKey; /** * The maximum lifespan of an ephemeral key pair. This is configured on chain. */ readonly maxExpHorizonSecs: number; constructor(verficationKey: Groth16VerificationKey, maxExpHorizonSecs: number); static create(res: Groth16VerificationKeyResponse, maxExpHorizonSecs: number): KeylessConfiguration; } /** * A representation of the verification key stored on chain used to verify Groth16 proofs */ declare class Groth16VerificationKey { /** * The `alpha * G`, where `G` is the generator of G1 */ readonly alphaG1: G1Bytes; /** * The `alpha * H`, where `H` is the generator of G2 */ readonly betaG2: G2Bytes; /** * The `delta * H`, where `H` is the generator of G2 */ readonly deltaG2: G2Bytes; /** * The `gamma^{-1} * (beta * a_i + alpha * b_i + c_i) * H`, where H is the generator of G1 */ readonly gammaAbcG1: G1Bytes[]; /** * The `gamma * H`, where `H` is the generator of G2 */ readonly gammaG2: G2Bytes; constructor(args: { alphaG1: HexInput; betaG2: HexInput; deltaG2: HexInput; gammaAbcG1: [HexInput, HexInput]; gammaG2: HexInput; }); static fromGroth16VerificationKeyResponse(res: Groth16VerificationKeyResponse): Groth16VerificationKey; } /** * Gets the parameters of how Keyless Accounts are configured on chain including the verifying key and the max expiry horizon * * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * @returns KeylessConfiguration */ declare function getKeylessConfig(args: { endlessConfig: EndlessConfig; options?: LedgerVersionArg; }): Promise; /** * Represents the Secp256k1 ecdsa public key * * Secp256k1 authentication key is represented in the SDK as `AnyPublicKey`. */ declare class Secp256k1PublicKey extends PublicKey { static readonly LENGTH: number; private readonly key; /** * Create a new PublicKey instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Verifies a Secp256k1 signature against the public key * * Note signatures are validated to be canonical as a malleability check */ verifySignature(args: VerifySignatureArgs): boolean; toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Secp256k1PublicKey; /** * @deprecated use `instanceof Secp256k1PublicKey` instead * @param publicKey */ static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey; } /** * A Secp256k1 ecdsa private key */ declare class Secp256k1PrivateKey extends Serializable implements PrivateKey { /** * Length of Secp256k1 ecdsa private key */ static readonly LENGTH: number; /** * The private key bytes * @private */ private readonly key; /** * Create a new PrivateKey instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Generate a new random private key. * * @returns Secp256k1PrivateKey */ static generate(): Secp256k1PrivateKey; /** * Derives a private key from a mnemonic seed phrase. * * @param path the BIP44 path * @param mnemonics the mnemonic seed phrase * * @returns The generated key */ static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey; /** * A private inner function so we can separate from the main fromDerivationPath() method * to add tests to verify we create the keys correctly. * * @param path the BIP44 path * @param seed the seed phrase created by the mnemonics * * @returns The generated key */ private static fromDerivationPathInner; /** * Sign the given message with the private key. * * Note: signatures are canonical, and non-malleable * * @param message a message as a string or Uint8Array * @returns Signature */ sign(message: HexInput): Secp256k1Signature; /** * Derive the Secp256k1PublicKey from this private key. * * @returns Secp256k1PublicKey */ publicKey(): Secp256k1PublicKey; /** * Get the private key in bytes (Uint8Array). * * @returns */ toUint8Array(): Uint8Array; /** * Get the private key as a hex string with the 0x prefix. * * @returns string representation of the private key */ toString(): string; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Secp256k1PrivateKey; /** * @deprecated use `instanceof Secp256k1PrivateKey` instead */ static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey; } /** * A signature of a message signed using a Secp256k1 ecdsa private key */ declare class Secp256k1Signature extends Signature { /** * Secp256k1 ecdsa signatures are 256-bit. */ static readonly LENGTH = 64; /** * The signature bytes * @private */ private readonly data; /** * Create a new Signature instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Secp256k1Signature; } declare class Bls12381PublicKey extends AccountPublicKey { /** * Length of an Bls12381 public key */ static readonly LENGTH: number; /** * Bytes of the public key * @private */ private readonly key; /** * Create a new PublicKey instance from a Uint8Array or String. * * @param hexInput A HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Verifies a signed data with a public key * @param args.message a signed message as a Hex string or Uint8Array * @param args.signature the signature of the message */ verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; /** * Get the public key in bytes (Uint8Array). * * @returns Uint8Array representation of the public key */ toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Bls12381PublicKey; /** * @deprecated use `instanceof Ed25519PublicKey` instead. */ static isPublicKey(publicKey: AccountPublicKey): publicKey is Bls12381PublicKey; } /** * Represents the private key of an Ed25519 key pair. */ declare class Bls12381PrivateKey extends Serializable implements PrivateKey { /** * Length of an Ed25519 private key */ static readonly LENGTH: number; /** * The Ed25519 signing key * @private */ private readonly signingKey; /** * Create a new PrivateKey instance from a Uint8Array or String. * * @param hexInput HexInput (string or Uint8Array) */ constructor(hexInput: HexInput); /** * Generate a new random private key. * * @returns Ed25519PrivateKey */ static generate(): Bls12381PrivateKey; /** * Derive the Ed25519PublicKey for this private key. * * @returns Ed25519PublicKey */ publicKey(): Bls12381PublicKey; /** * Sign the given message with the private key. * * @param message a message as a string or Uint8Array * @returns Signature */ sign(message: HexInput): Bls12381Signature; /** * Get the private key in bytes (Uint8Array). * * @returns Uint8Array representation of the private key */ toUint8Array(): Uint8Array; /** * Get the private key as a hex string with the 0x prefix. * * @returns string representation of the private key */ toString(): string; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Bls12381PrivateKey; /** * @deprecated use `instanceof Ed25519PrivateKey` instead. */ static isPrivateKey(privateKey: PrivateKey): privateKey is Bls12381PrivateKey; } /** * A signature of a message signed using an Ed25519 private key */ declare class Bls12381Signature extends Signature { /** * Length of an Ed25519 signature */ static readonly LENGTH = 96; /** * The signature bytes * @private */ private readonly data; constructor(hexInput: HexInput); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Bls12381Signature; } /** * Represents the public key of a multi-auth-key account. * */ declare class MultiAuthKeyPublicKey extends AccountPublicKey { /** * List of any public keys */ readonly publicKeys: AnyPublicKey[]; constructor(args: { publicKeys: Array; }); verifySignature(args: VerifySignatureArgs): boolean; authKey(): AuthenticationKey; toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiAuthKeyPublicKey; } declare class MultiAuthKeySignature extends Signature { /** * The list of signatures */ readonly signatures: AnySignature[]; constructor(args: { signatures: Array; }); toUint8Array(): Uint8Array; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiAuthKeySignature; } /** * Each account stores an authentication key. Authentication key enables account owners to rotate * their private key(s) associated with the account without changing the address that hosts their account. * @see {@link https://endless.dev/concepts/accounts | Account Basics} * * Account addresses can be derived from AuthenticationKey */ declare class AuthenticationKey extends Serializable { /** * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes. * * The data to hash depends on the underlying public key type and the derivation scheme. */ static readonly LENGTH: number; /** * The raw bytes of the authentication key. */ readonly data: Hex; constructor(args: { data: HexInput; }); serialize(serializer: Serializer): void; /** * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance. * @param deserializer The deserializer to deserialize the AuthenticationKey from. * @returns An instance of AuthenticationKey. */ static deserialize(deserializer: Deserializer): AuthenticationKey; toString(): string; toUint8Array(): Uint8Array; static fromSchemeAndBytes(args: { scheme: AuthenticationKeyScheme; input: HexInput; }): AuthenticationKey; /** * @deprecated Use `fromPublicKey` instead * Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme. * * This facilitates targeting a specific scheme for deriving an authentication key from a public key. * * @param args - the public key and scheme to use for the derivation */ static fromPublicKeyAndScheme(args: { publicKey: AccountPublicKey; scheme: AuthenticationKeyScheme; }): AuthenticationKey; /** * Converts a PublicKey(s) to an AuthenticationKey, using the derivation scheme inferred from the * instance of the PublicKey type passed in. * * @param args.publicKey * @returns AuthenticationKey */ static fromPublicKey(args: { publicKey: AccountPublicKey; }): AuthenticationKey; /** * Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes, * the AuthenticationKey bytes are directly translated to an AccountAddress. * * @returns AccountAddress */ derivedAddress(): AccountAddress; } declare abstract class AccountAuthenticator extends Serializable { abstract serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): AccountAuthenticator; isEd25519(): this is AccountAuthenticatorEd25519; isMultiEd25519(): this is AccountAuthenticatorMultiEd25519; isSingleKey(): this is AccountAuthenticatorSingleKey; isMultiKey(): this is AccountAuthenticatorMultiKey; isMultAuthKey(): this is AccountAuthenticatorMultiAuthKey; } /** * Transaction authenticator Ed25519 for a multi signer transaction * * @param public_key Account's Ed25519 public key. * @param signature Account's Ed25519 signature * */ declare class AccountAuthenticatorEd25519 extends AccountAuthenticator { readonly public_key: Ed25519PublicKey; readonly signature: Ed25519Signature; constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorEd25519; } /** * Transaction authenticator Multi Ed25519 for a multi signers transaction * * @param public_key Account's MultiEd25519 public key. * @param signature Account's MultiEd25519 signature * */ declare class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator { readonly public_key: MultiEd25519PublicKey; readonly signature: MultiEd25519Signature; constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519; } /** * AccountAuthenticatorSingleKey for a single signer * * @param public_key AnyPublicKey * @param signature AnySignature * */ declare class AccountAuthenticatorSingleKey extends AccountAuthenticator { readonly public_key: AnyPublicKey; readonly signature: AnySignature; constructor(public_key: AnyPublicKey, signature: AnySignature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorSingleKey; } /** * AccountAuthenticatorMultiKey for a multi signer * * @param public_keys MultiKey * @param signatures Signature * */ declare class AccountAuthenticatorMultiKey extends AccountAuthenticator { readonly public_keys: MultiKey; readonly signatures: MultiKeySignature; constructor(public_keys: MultiKey, signatures: MultiKeySignature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorMultiKey; } declare class AccountAuthenticatorMultiAuthKey extends AccountAuthenticator { readonly public_key: MultiAuthKeyPublicKey; readonly signature: MultiAuthKeySignature; constructor(public_key: MultiAuthKeyPublicKey, signature: MultiAuthKeySignature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorMultiAuthKey; } declare class AccountAuthenticatorBls12381 extends AccountAuthenticator { readonly public_key: Bls12381PublicKey; readonly signature: Bls12381Signature; constructor(public_key: Bls12381PublicKey, signature: Bls12381Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorBls12381; } declare class AccountAuthenticatorMock extends AccountAuthenticator { readonly authenticator: AccountAddress; constructor(authenticator: AccountAddress); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): AccountAuthenticatorMock; } /** * Representation of a ChainId that can serialized and deserialized */ declare class ChainId extends Serializable { readonly chainId: number; constructor(chainId: number); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): ChainId; } /** * Representation of an Identifier that can serialized and deserialized. * We use Identifier to represent the module "name" in "ModuleId" and * the "function name" in "EntryFunction" */ declare class Identifier extends Serializable { identifier: string; constructor(identifier: string); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Identifier; } /** * Representation of a ModuleId that can serialized and deserialized * ModuleId means the module address (e.g "0x1") and the module name (e.g "coin") */ declare class ModuleId extends Serializable { readonly address: AccountAddress; readonly name: Identifier; /** * Full name of a module. * @param address The account address. e.g "0x1" * @param name The module name under the "address". e.g "coin" */ constructor(address: AccountAddress, name: Identifier); /** * Converts a string literal to a ModuleId * @param moduleId String literal in format "account_address::module_name", e.g. "0x1::coin" * @returns ModuleId */ static fromStr(moduleId: MoveModuleId): ModuleId; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): ModuleId; } declare abstract class TypeTag extends Serializable { abstract serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): TypeTag; abstract toString(): string; isBool(): this is TypeTagBool; isAddress(): this is TypeTagAddress; isGeneric(): this is TypeTagGeneric; isSigner(): this is TypeTagSigner; isVector(): this is TypeTagVector; isStruct(): this is TypeTagStruct; isU8(): this is TypeTagU8; isU16(): this is TypeTagU16; isU32(): this is TypeTagU32; isU64(): this is TypeTagU64; isU128(): this is TypeTagU128; isU256(): this is TypeTagU256; } declare class TypeTagBool extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagBool; } declare class TypeTagU8 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU8; } declare class TypeTagU16 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU16; } declare class TypeTagU32 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU32; } declare class TypeTagU64 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU64; } declare class TypeTagU128 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU128; } declare class TypeTagU256 extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagU256; } declare class TypeTagAddress extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagAddress; } declare class TypeTagSigner extends TypeTag { toString(): string; serialize(serializer: Serializer): void; static load(_deserializer: Deserializer): TypeTagSigner; } declare class TypeTagReference extends TypeTag { readonly value: TypeTag; toString(): `&${string}`; constructor(value: TypeTag); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TypeTagReference; } /** * Generics are used for type parameters in entry functions. However, * they are not actually serialized into a real type, so they cannot be * used as a type directly. */ declare class TypeTagGeneric extends TypeTag { readonly value: number; toString(): `T${number}`; constructor(value: number); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TypeTagGeneric; } declare class TypeTagVector extends TypeTag { readonly value: TypeTag; toString(): `vector<${string}>`; constructor(value: TypeTag); static u8(): TypeTagVector; serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TypeTagVector; } declare class TypeTagStruct extends TypeTag { readonly value: StructTag; toString(): `0x${string}::${string}::${string}`; constructor(value: StructTag); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TypeTagStruct; isTypeTag(address: AccountAddress, moduleName: string, structName: string): boolean; isString(): boolean; isOption(): boolean; isObject(): boolean; } declare class StructTag extends Serializable { readonly address: AccountAddress; readonly moduleName: Identifier; readonly name: Identifier; readonly typeArgs: Array; constructor(address: AccountAddress, module_name: Identifier, name: Identifier, type_args: Array); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): StructTag; } declare function endlessCoinStructTag(): StructTag; declare function stringStructTag(): StructTag; declare function optionStructTag(typeArg: TypeTag): StructTag; declare function objectStructTag(typeArg: TypeTag): StructTag; /** * Deserialize a Script Transaction Argument */ declare function deserializeFromScriptArgument(deserializer: Deserializer): TransactionArgument; /** * Representation of the supported Transaction Payload * that can serialized and deserialized */ declare abstract class TransactionPayload extends Serializable { /** * Serialize a Transaction Payload */ abstract serialize(serializer: Serializer): void; /** * Deserialize a Transaction Payload */ static deserialize(deserializer: Deserializer): TransactionPayload; } /** * Representation of a Transaction Payload Script that can serialized and deserialized */ declare class TransactionPayloadScript extends TransactionPayload { readonly script: Script; paymentChecksum?: Uint8Array; constructor(script: Script); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionPayloadScript; static loadWithChecksum(deserializer: Deserializer): TransactionPayloadScript; } /** * Representation of a Transaction Payload Entry Function that can serialized and deserialized */ declare class TransactionPayloadEntryFunction extends TransactionPayload { readonly entryFunction: EntryFunction; paymentChecksum?: Uint8Array; constructor(entryFunction: EntryFunction); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionPayloadEntryFunction; static loadWithChecksum(deserializer: Deserializer): TransactionPayloadEntryFunction; } /** * Representation of a Transaction Payload Multi-sig that can serialized and deserialized */ declare class TransactionPayloadMultiSig extends TransactionPayload { readonly multiSig: MultiSig; constructor(multiSig: MultiSig); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionPayloadMultiSig; } /** * Representation of a EntryFunction that can serialized and deserialized */ declare class EntryFunction { readonly module_name: ModuleId; readonly function_name: Identifier; readonly type_args: Array; readonly args: Array; /** * Contains the payload to run a function within a module. * @param module_name Fully qualified module name in format "account_address::module_name" e.g. "0x1::coin" * @param function_name The function name. e.g "transfer" * @param type_args Type arguments that move function requires. * * @example * A coin transfer function has one type argument "CoinType". * ``` * public entry fun transfer(from: &signer, to: address, amount: u64) * ``` * @param args arguments to the move function. * * @example * A coin transfer function has three arguments "from", "to" and "amount". * ``` * public entry fun transfer(from: &signer, to: address, amount: u64) * ``` */ constructor(module_name: ModuleId, function_name: Identifier, type_args: Array, args: Array); /** * A helper function to build a EntryFunction payload from raw primitive values * * @param module_id Fully qualified module name in format "AccountAddress::module_id" e.g. "0x1::coin" * @param function_name Function name * @param type_args Type arguments that move function requires. * * @example * A coin transfer function has one type argument "CoinType". * ``` * public(script) fun transfer(from: &signer, to: address, amount: u64,) * ``` * @param args Arguments to the move function. * * @example * A coin transfer function has three arguments "from", "to" and "amount". * ``` * public(script) fun transfer(from: &signer, to: address, amount: u64,) * ``` * @returns EntryFunction */ static build(module_id: MoveModuleId, function_name: string, type_args: Array, args: Array): EntryFunction; serialize(serializer: Serializer): void; /** * Deserializes an entry function payload with the arguments represented as EntryFunctionBytes instances. * @see EntryFunctionBytes * * NOTE: When you deserialize an EntryFunction payload with this method, the entry function * arguments are populated into the deserialized instance as type-agnostic, raw fixed bytes * in the form of the EntryFunctionBytes class. * * In order to correctly deserialize these arguments as their actual type representations, you * must know the types of the arguments beforehand and deserialize them yourself individually. * * One way you could achieve this is by using the ABIs for an entry function and deserializing each * argument as its given, corresponding type. * * @param deserializer * @returns A deserialized EntryFunction payload for a transaction. * */ static deserialize(deserializer: Deserializer): EntryFunction; } /** * Representation of a Script that can serialized and deserialized */ declare class Script { /** * The move module bytecode */ readonly bytecode: Uint8Array; /** * The type arguments that the bytecode function requires. */ readonly type_args: Array; /** * The arguments that the bytecode function requires. */ readonly args: Array; /** * Scripts contain the Move bytecodes payload that can be submitted to Endless chain for execution. * * @param bytecode The move module bytecode * @param type_args The type arguments that the bytecode function requires. * * @example * A coin transfer function has one type argument "CoinType". * ``` * public(script) fun transfer(from: &signer, to: address, amount: u64,) * ``` * @param args The arguments that the bytecode function requires. * * @example * A coin transfer function has three arguments "from", "to" and "amount". * ``` * public(script) fun transfer(from: &signer, to: address, amount: u64,) * ``` */ constructor(bytecode: Uint8Array, type_args: Array, args: Array); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): Script; } /** * Representation of a MultiSig that can serialized and deserialized */ declare class MultiSig { readonly multisig_address: AccountAddress; readonly transaction_payload?: MultiSigTransactionPayload; /** * Contains the payload to run a multi-sig account transaction. * * @param multisig_address The multi-sig account address the transaction will be executed as. * * @param transaction_payload The payload of the multi-sig transaction. This is optional when executing a multi-sig * transaction whose payload is already stored on chain. */ constructor(multisig_address: AccountAddress, transaction_payload?: MultiSigTransactionPayload); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiSig; } /** * Representation of a MultiSig Transaction Payload from `multisig_account.move` * that can be serialized and deserialized * This class exists right now to represent an extensible transaction payload class for * transactions used in `multisig_account.move`. Eventually, this class will be able to * support script payloads when the `multisig_account.move` module supports them. */ declare class MultiSigTransactionPayload extends Serializable { readonly transaction_payload: EntryFunction; /** * Contains the payload to run a multi-sig account transaction. * * @param transaction_payload The payload of the multi-sig transaction. * This can only be EntryFunction for now but, * Script might be supported in the future. */ constructor(transaction_payload: EntryFunction); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiSigTransactionPayload; } /** * Representation of a Raw Transaction that can serialized and deserialized */ declare class RawTransaction extends Serializable { readonly sender: AccountAddress; readonly sequence_number: bigint; readonly payload: TransactionPayload; readonly max_gas_amount: bigint; readonly gas_unit_price: bigint; readonly expiration_timestamp_secs: bigint; readonly chain_id: ChainId; /** * RawTransactions contain the metadata and payloads that can be submitted to Endless chain for execution. * RawTransactions must be signed before Endless chain can execute them. * * @param sender The sender Account Address * @param sequence_number Sequence number of this transaction. This must match the sequence number stored in * the sender's account at the time the transaction executes. * @param payload Instructions for the Endless Blockchain, including publishing a module, * execute an entry function or execute a script payload. * @param max_gas_amount Maximum total gas to spend for this transaction. The account must have more * than this gas or the transaction will be discarded during validation. * @param gas_unit_price Price to be paid per gas unit. * @param expiration_timestamp_secs The blockchain timestamp at which the blockchain would discard this transaction. * @param chain_id The chain ID of the blockchain that this transaction is intended to be run on. */ constructor(sender: AccountAddress, sequence_number: bigint, payload: TransactionPayload, max_gas_amount: bigint, gas_unit_price: bigint, expiration_timestamp_secs: bigint, chain_id: ChainId); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): RawTransaction; } /** * Representation of a Raw Transaction With Data that can serialized and deserialized */ declare abstract class RawTransactionWithData extends Serializable { /** * Serialize a Raw Transaction With Data */ abstract serialize(serializer: Serializer): void; /** * Deserialize a Raw Transaction With Data */ static deserialize(deserializer: Deserializer): RawTransactionWithData; } /** * Representation of a Multi Agent Transaction that can serialized and deserialized */ declare class MultiAgentRawTransaction extends RawTransactionWithData { /** * The raw transaction */ readonly raw_txn: RawTransaction; /** * The secondary signers on this transaction */ readonly secondary_signer_addresses: Array; constructor(raw_txn: RawTransaction, secondary_signer_addresses: Array); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): MultiAgentRawTransaction; } /** * Representation of a Fee Payer Transaction that can serialized and deserialized */ declare class FeePayerRawTransaction extends RawTransactionWithData { /** * The raw transaction */ readonly raw_txn: RawTransaction; /** * The secondary signers on this transaction - optional and can be empty */ readonly secondary_signer_addresses: Array; /** * The fee payer account address */ readonly fee_payer_address: AccountAddress; constructor(raw_txn: RawTransaction, secondary_signer_addresses: Array, fee_payer_address: AccountAddress); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): FeePayerRawTransaction; } /** * Representation of the challenge which is needed to sign by owner of the account * to rotate the authentication key. */ declare class RotationProofChallenge extends Serializable { readonly accountAddress: AccountAddress; readonly moduleName: MoveString; readonly structName: MoveString; readonly originator: AccountAddress; readonly currentAuthKey: AccountAddress; readonly newPublicKey: MoveVector; readonly sequenceNumber: U64; constructor(args: { sequenceNumber: AnyNumber; originator: AccountAddress; currentAuthKey: AccountAddress; newPublicKey: PublicKey; }); serialize(serializer: Serializer): void; } declare abstract class TransactionAuthenticator extends Serializable { abstract serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): TransactionAuthenticator; } /** * Transaction authenticator Ed25519 for a single signer transaction * * @param public_key Client's public key. * @param signature Ed25519 signature of a raw transaction. * @see {@link https://endless.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction} * for details about generating a signature. */ declare class TransactionAuthenticatorEd25519 extends TransactionAuthenticator { readonly public_key: Ed25519PublicKey; readonly signature: Ed25519Signature; constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorEd25519; } /** * Transaction authenticator Ed25519 for a multi signers transaction * * @param public_key Client's public key. * @param signature Multi Ed25519 signature of a raw transaction. * */ declare class TransactionAuthenticatorMultiEd25519 extends TransactionAuthenticator { readonly public_key: MultiEd25519PublicKey; readonly signature: MultiEd25519Signature; constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiEd25519; } /** * Transaction authenticator for a multi-agent transaction * * @param sender Sender account authenticator * @param secondary_signer_addresses Secondary signers address * @param secondary_signers Secondary signers account authenticators * */ declare class TransactionAuthenticatorMultiAgent extends TransactionAuthenticator { readonly sender: AccountAuthenticator; readonly secondary_signer_addresses: Array; readonly secondary_signers: Array; constructor(sender: AccountAuthenticator, secondary_signer_addresses: Array, secondary_signers: Array); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent; } /** * Transaction authenticator for a fee payer transaction * * @param sender Sender account authenticator * @param secondary_signer_addresses Secondary signers address * @param secondary_signers Secondary signers account authenticators * @param fee_payer Object of the fee payer account address and the fee payer authentication * */ declare class TransactionAuthenticatorFeePayer extends TransactionAuthenticator { readonly sender: AccountAuthenticator; readonly secondary_signer_addresses: Array; readonly secondary_signers: Array; readonly fee_payer: { address: AccountAddress; authenticator: AccountAuthenticator; }; constructor(sender: AccountAuthenticator, secondary_signer_addresses: Array, secondary_signers: Array, fee_payer: { address: AccountAddress; authenticator: AccountAuthenticator; }); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent; } /** * Single Sender authenticator for a single signer transaction * * @param sender AccountAuthenticator */ declare class TransactionAuthenticatorSingleSender extends TransactionAuthenticator { readonly sender: AccountAuthenticator; constructor(sender: AccountAuthenticator); serialize(serializer: Serializer): void; static load(deserializer: Deserializer): TransactionAuthenticatorSingleSender; } declare class SignedTransaction extends Serializable { readonly raw_txn: RawTransaction; readonly authenticator: TransactionAuthenticator; /** * A SignedTransaction consists of a raw transaction and an authenticator. The authenticator * contains a client's public key and the signature of the raw transaction. * * @see {@link https://endless.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction} * * @param raw_txn * @param authenticator Contains a client's public key and the signature of the raw transaction. * Authenticator has 3 flavors: single signature, multi-signature and multi-agent. * @see {@link https://github.com/endless-labs/endless-core/blob/main/types/src/transaction/authenticator.rs} for details. */ constructor(raw_txn: RawTransaction, authenticator: TransactionAuthenticator); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): SignedTransaction; } /** * Representation of a SimpleTransaction that can serialized and deserialized */ declare class SimpleTransaction extends Serializable { rawTransaction: RawTransaction; feePayerAddress?: AccountAddress | undefined; readonly secondarySignerAddresses: undefined; /** * SimpleTransaction represents a simple transaction type of a single signer that * can be submitted to Endless chain for execution. * * SimpleTransaction metadata contains the Raw Transaction and an optional * sponsor Account Address to pay the gas fees. * * @param rawTransaction The Raw Tranasaction * @param feePayerAddress The sponsor Account Address */ constructor(rawTransaction: RawTransaction, feePayerAddress?: AccountAddress); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): SimpleTransaction; upgradeToSafe(checksum: Uint8Array): void; } /** * Representation of a Raw Transaction that can serialized and deserialized */ declare class MultiAgentTransaction extends Serializable { rawTransaction: RawTransaction; feePayerAddress?: AccountAddress | undefined; secondarySignerAddresses: AccountAddress[]; /** * SimpleTransaction represents a simple transaction type of a single signer that * can be submitted to Endless chain for execution. * * SimpleTransaction metadata contains the Raw Transaction and an optional * sponsor Account Address to pay the gas fees. * * @param rawTransaction The Raw Tranasaction * @param feePayerAddress The sponsor Account Address */ constructor(rawTransaction: RawTransaction, secondarySignerAddresses: AccountAddress[], feePayerAddress?: AccountAddress); serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): MultiAgentTransaction; upgradeToSafe(checksum: Uint8Array): void; } /** * Entry function arguments to be used when building a raw transaction using remote ABI */ type SimpleEntryFunctionArgumentTypes = boolean | number | bigint | string | null | undefined | Uint8Array | ArrayBuffer | Array; /** * Entry function arguments to be used when building a raw transaction using BCS serialized arguments */ type EntryFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveVector | MoveOption | MoveString | FixedBytes; /** * Script function arguments to be used when building a raw transaction using BCS serialized arguments */ type ScriptFunctionArgumentTypes = Bool | U8 | U16 | U32 | U64 | U128 | U256 | AccountAddress | MoveVector | MoveString | FixedBytes; /** * TypeArgument inputs for Entry functions, view functions, and scripts * * This can be a string version of the type argument such as: * - u8 * - u16 * - u32 * - u64 * - u128 * - u256 * - bool * - address * - signer * - vector * - address::module::struct * - address::module::struct */ type TypeArgument = TypeTag | string; /** * Type that holds all raw transaction instances Endless SDK supports */ type AnyRawTransactionInstance = RawTransaction | MultiAgentRawTransaction | FeePayerRawTransaction; /** * Optional options to set when generating a transaction */ type InputGenerateTransactionOptions = { maxGasAmount?: number; gasUnitPrice?: number; expireTimestamp?: number; accountSequenceNumber?: AnyNumber; }; /** * The generated transaction payload type that was produces from `generateTransactionPayload()` function. */ type AnyTransactionPayloadInstance = TransactionPayloadEntryFunction | TransactionPayloadScript | TransactionPayloadMultiSig; /** * Unified type for the data needed to generate a transaction payload of types: * Entry Function | Script | Multi Sig */ type InputGenerateTransactionPayloadData = InputEntryFunctionData | InputScriptData | InputMultiSigData; type InputGenerateTransactionPayloadDataWithRemoteABI = InputScriptData | InputEntryFunctionDataWithRemoteABI | InputMultiSigDataWithRemoteABI; /** * The data needed to generate an Entry Function payload */ type InputEntryFunctionData = { function: MoveFunctionId; typeArguments?: Array; functionArguments: Array; abi?: EntryFunctionABI; paymentChecksum?: HexInput; }; type InputGenerateTransactionPayloadDataWithABI = InputEntryFunctionDataWithABI | InputMultiSigDataWithABI; type InputEntryFunctionDataWithABI = Omit & { abi: EntryFunctionABI; }; type InputMultiSigDataWithABI = { multisigAddress: AccountAddressInput; } & InputEntryFunctionDataWithABI; type InputEntryFunctionDataWithRemoteABI = InputEntryFunctionData & { endlessConfig: EndlessConfig; }; /** * The data needed to generate a Multi Sig payload */ type InputMultiSigData = { multisigAddress: AccountAddressInput; } & InputEntryFunctionData; /** * The data needed to generate a Multi Sig payload */ type InputMultiSigDataWithRemoteABI = { multisigAddress: AccountAddressInput; } & InputEntryFunctionDataWithRemoteABI; /** * The data needed to generate a Script payload */ type InputScriptData = { bytecode: HexInput; typeArguments?: Array; functionArguments: Array; paymentChecksum?: HexInput; }; /** * The data needed to generate a View Function payload */ type InputViewFunctionData = { function: MoveFunctionId; typeArguments?: Array; functionArguments?: Array; abi?: ViewFunctionABI; }; /** * Data needed to generate a view function payload and fetch the remote ABI */ type InputViewFunctionDataWithRemoteABI = InputViewFunctionData & { endlessConfig: EndlessConfig; }; /** * Data needed to generate a view function, with an already fetched ABI */ type InputViewFunctionDataWithABI = InputViewFunctionData & { abi: ViewFunctionABI; }; /** * Data need for a generic function ABI, both view and entry */ type FunctionABI = { typeParameters: Array; parameters: Array; }; /** * Interface of an Entry function's ABI. * * This is used to provide type checking and simple input conversion on ABI based transaction submission. */ type EntryFunctionABI = FunctionABI & { signers?: number; }; /** * Interface of an View function's ABI. * * This is used to provide type checking and simple input conversion on ABI based transaction submission. */ type ViewFunctionABI = FunctionABI & { returnTypes: Array; }; /** * Interface of the arguments to generate a single signer transaction. * Used to provide to `generateTransaction()` method in the transaction builder flow */ interface InputGenerateSingleSignerRawTransactionArgs { endlessConfig: EndlessConfig; sender: AccountAddressInput; payload: AnyTransactionPayloadInstance; options?: InputGenerateTransactionOptions; feePayerAddress?: AccountAddressInput; } /** * Interface of the arguments to generate a multi-agent transaction. * Used to provide to `generateTransaction()` method in the transaction builder flow */ interface InputGenerateMultiAgentRawTransactionArgs { endlessConfig: EndlessConfig; sender: AccountAddressInput; payload: AnyTransactionPayloadInstance; secondarySignerAddresses: AccountAddressInput[]; options?: InputGenerateTransactionOptions; feePayerAddress?: AccountAddressInput; } /** * Unified type that holds all the interfaces to generate different transaction types */ type InputGenerateRawTransactionArgs = InputGenerateSingleSignerRawTransactionArgs | InputGenerateMultiAgentRawTransactionArgs; /** * Unified type that holds all the return interfaces when generating different transaction types */ type AnyRawTransaction = SimpleTransaction | MultiAgentTransaction; type InputSimulateTransactionData = { /** * The transaction to simulate, probably generated by `generateTransaction()` */ transaction: AnyRawTransaction; /** * For a single signer transaction */ signerPublicKey: PublicKey; /** * For a fee payer or multi-agent transaction that requires additional signers in */ secondarySignersPublicKeys?: Array; /** * For a fee payer transaction (aka Sponsored Transaction) */ feePayerPublicKey?: PublicKey; options?: InputSimulateTransactionOptions; }; type InputSimulateTransactionDataMock = { /** * The transaction to simulate, probably generated by `generateTransaction()` */ transaction: AnyRawTransaction; options?: InputSimulateTransactionOptions; }; type InputSimulateTransactionOptions = { estimateGasUnitPrice?: boolean; estimateMaxGasAmount?: boolean; estimatePrioritizedGasUnitPrice?: boolean; }; /** * Interface that holds the user data input when generating a single signer transaction */ interface InputGenerateSingleSignerRawTransactionData { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; secondarySignerAddresses?: undefined; } /** * Interface that holds the user data input when generating a multi-agent transaction */ interface InputGenerateMultiAgentRawTransactionData { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; secondarySignerAddresses: AccountAddressInput[]; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; } /** * Unified type that holds all the user data input interfaces when generating different transaction types */ type InputGenerateTransactionData = InputGenerateSingleSignerRawTransactionData | InputGenerateMultiAgentRawTransactionData; /** * Interface that holds the user data input when submitting a transaction */ interface InputSubmitTransactionData { transaction: AnyRawTransaction; senderAuthenticator: AccountAuthenticator; feePayerAuthenticator?: AccountAuthenticator; additionalSignersAuthenticators?: Array; } interface SingleKeySignerConstructorArgs { privateKey: PrivateKey; address?: AccountAddressInput; } interface SingleKeySignerGenerateArgs { scheme?: SigningSchemeInput; } type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & { path: string; mnemonic: string; }; interface VerifySingleKeySignatureArgs { message: HexInput; signature: AnySignature; } /** * Signer implementation for the SingleKey authentication scheme. * This extends a SingleKeyAccount by adding signing capabilities through a valid private key. * Currently, the only supported signature schemes are Ed25519 and Secp256k1. * * Note: Generating a signer instance does not create the account on-chain. */ declare class SingleKeyAccount implements Account$1 { /** * Private key associated with the account */ readonly privateKey: PrivateKey; readonly publicKey: AnyPublicKey; readonly accountAddress: AccountAddress; readonly signingScheme = SigningScheme.SingleKey; constructor(args: SingleKeySignerConstructorArgs); /** * Derives an account from a randomly generated private key. * Default generation is using an Ed25519 key * @returns Account with the given signature scheme */ static generate(args?: SingleKeySignerGenerateArgs): SingleKeyAccount; /** * Derives an account with bip44 path and mnemonics, * Default to using an Ed25519 signature scheme. * * @param args.scheme The signature scheme to derive the private key with * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519, * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1 * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * @param args.mnemonic the mnemonic seed phrase of the account */ static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs): SingleKeyAccount; /** * Verify the given message and signature with the public key. * * @param args.message raw message data in HexInput format * @param args.signature signed message Signature * @returns */ verifySignature(args: VerifySingleKeySignatureArgs): boolean; /** * Sign a message using the account's private key. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey; /** * Sign a transaction using the account's private key. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey; /** * Sign the given message using the account's private key. * @param message in HexInput format * @returns Signature */ sign(message: HexInput): AnySignature; /** * Sign the given transaction using the account's private key. * @param transaction the transaction to be signed * @returns Signature */ signTransaction(transaction: AnyRawTransaction): AnySignature; } /** * Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`. * This is the default input type when passing an `Ed25519PrivateKey`. * In order to use the SingleKey authentication scheme, `legacy` needs to be explicitly set to false. */ interface CreateEd25519AccountFromPrivateKeyArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; legacy?: true; } /** * Arguments for creating an `SingleKeyAccount` from an `Ed25519PrivateKey`. * The `legacy` argument needs to be explicitly set to false in order to * use the `SingleKey` authentication scheme. */ interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; legacy: false; } /** * Arguments for creating an `SingleKeyAccount` from any supported private key * that is not an `Ed25519PrivateKey`. * The `legacy` argument defaults to false and cannot be explicitly set to true. */ interface CreateSingleKeyAccountFromPrivateKeyArgs { privateKey: Exclude; address?: AccountAddressInput; legacy?: false; } /** * Arguments for creating an opaque `Account` from any supported private key. * This is used when the private key type is not known at compilation time. */ interface CreateAccountFromPrivateKeyArgs { privateKey: PrivateKey; address?: AccountAddressInput; legacy?: boolean; } /** * Arguments for generating an `Ed25519Account`. * This is the input type used by default. */ interface GenerateEd25519AccountArgs { scheme?: SigningSchemeInput.Ed25519; legacy?: true; } /** * Arguments for generating an `SingleKeyAccount` with ah underlying `Ed25519PrivateKey`. * The `legacy` argument needs to be explicitly set to false, * otherwise an `Ed25519Account` will be returned instead. */ interface GenerateEd25519SingleKeyAccountArgs { scheme?: SigningSchemeInput.Ed25519; legacy: false; } /** * Arguments for generating an `SingleKeyAccount` with any supported private key * that is not an `Ed25519PrivateKey`. * The `legacy` argument defaults to false and cannot be explicitly set to true. */ interface GenerateSingleKeyAccountArgs { scheme: Exclude; legacy?: false; } /** * Arguments for generating an opaque `Account`. * This is used when the input signature scheme is not known at compilation time. */ interface GenerateAccountArgs { scheme?: SigningSchemeInput; legacy?: boolean; } /** * Arguments for deriving a private key from a mnemonic phrase and a BIP44 path. */ interface PrivateKeyFromDerivationPathArgs { path: string; mnemonic: string; } /** * Interface for a generic Endless account. * * The interface is defined as abstract class to provide a single entrypoint for account generation, * either through `Account.generate()` or `Account.fromDerivationPath`. * Despite this being an abstract class, it should be treated as an interface and enforced using * the `implements` keyword. * * Note: Generating an account instance does not create the account on-chain. */ declare abstract class Account$1 { /** * Public key associated with the account */ abstract readonly publicKey: AccountPublicKey; /** * Account address associated with the account */ abstract readonly accountAddress: AccountAddress; /** * Signing scheme used to sign transactions */ abstract signingScheme: SigningScheme; /** * Derives an account from a randomly generated private key. * @param args.scheme The signature scheme to use, to generate the private key * @param args.legacy Whether to use a legacy authentication scheme, when applicable * @returns An account compatible with the provided signature scheme */ static generate(args?: GenerateEd25519AccountArgs): Ed25519Account; static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount; static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount; static generate(args: GenerateAccountArgs): Account$1; /** * Creates an account from the provided private key. * * @param args.privateKey a valid private key * @param args.address the account's address. If not provided, it will be derived from the public key. * @param args.legacy Whether to use a legacy authentication scheme, when applicable */ static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account; static fromPrivateKey(args: CreateEd25519SingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount; static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount; static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): Account$1; /** * @deprecated use `fromPrivateKey` instead. * Instantiates an account given a private key and a specified account address. * This is primarily used to instantiate an `Account` that has had its authentication key rotated. * * @param args.privateKey PrivateKey - the underlying private key for the account * @param args.address AccountAddress - The account address the `Account` will sign for * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults * to generating a Legacy Ed25519 keypair * * @returns Account */ static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs): Account$1; /** * Derives an account with bip44 path and mnemonics * * @param args.scheme The signature scheme to derive the private key with * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519, * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1 * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * @param args.mnemonic the mnemonic seed phrase of the account */ static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account; static fromDerivationPath(args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount; static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount; static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account$1; /** * @deprecated use `publicKey.authKey()` instead. * This key enables account owners to rotate their private key(s) * associated with the account without changing the address that hosts their account. * See here for more info: {@link https://endless.dev/concepts/accounts#single-signer-authentication} * * @param args.publicKey PublicKey - public key of the account * @returns The authentication key for the associated account */ static authKey(args: { publicKey: AccountPublicKey; }): AuthenticationKey | AuthenticationKey[]; /** * Sign a message using the available signing capabilities. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ abstract signWithAuthenticator(message: HexInput): AccountAuthenticator; /** * Sign a transaction using the available signing capabilities. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ abstract signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticator; /** * Sign the given message using the available signing capabilities. * @param message in HexInput format * @returns Signature */ abstract sign(message: HexInput): Signature; /** * Sign the given transaction using the available signing capabilities. * @param transaction the transaction to be signed * @returns Signature */ abstract signTransaction(transaction: AnyRawTransaction): Signature; /** * Verify the given message and signature with the public key. * @param args.message raw message data in HexInput format * @param args.signature signed message Signature * @returns */ verifySignature(args: VerifySignatureArgs): boolean; } interface Ed25519SignerConstructorArgs { privateKey: Ed25519PrivateKey; address?: AccountAddressInput; } interface Ed25519SignerFromDerivationPathArgs { path: string; mnemonic: string; } interface VerifyEd25519SignatureArgs { message: HexInput; signature: Ed25519Signature; } /** * Signer implementation for the Ed25519 authentication scheme. * This extends an {@link Ed25519Account} by adding signing capabilities through an {@link Ed25519PrivateKey}. * * Note: Generating a signer instance does not create the account on-chain. */ declare class Ed25519Account implements Account$1 { /** * Private key associated with the account */ readonly privateKey: Ed25519PrivateKey; readonly publicKey: Ed25519PublicKey; readonly accountAddress: AccountAddress; readonly signingScheme = SigningScheme.Ed25519; constructor(args: Ed25519SignerConstructorArgs); /** * Derives a signer from a randomly generated private key */ static generate(): Ed25519Account; /** * Derives an account with bip44 path and mnemonics * * @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0' * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki} * @param args.mnemonic the mnemonic seed phrase of the account */ static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs): Ed25519Account; /** * Verify the given message and signature with the public key. * * @param args.message raw message data in HexInput format * @param args.signature signed message Signature * @returns */ verifySignature(args: VerifyEd25519SignatureArgs): boolean; /** * Sign a message using the account's Ed25519 private key. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519; /** * Sign a transaction using the account's Ed25519 private key. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorEd25519; /** * Sign the given message using the account's Ed25519 private key. * @param message in HexInput format * @returns Signature */ sign(message: HexInput): Ed25519Signature; /** * Sign the given transaction using the available signing capabilities. * @param transaction the transaction to be signed * @returns Signature */ signTransaction(transaction: AnyRawTransaction): Ed25519Signature; } /** * A class which contains a key pair that is used in signing transactions via the Keyless authentication scheme. This key pair * is ephemeral and has an expiration time. For more details on how this class is used - * https://endless.dev/guides/keyless-accounts/#1-present-the-user-with-a-sign-in-with-idp-button-on-the-ui */ declare class EphemeralKeyPair extends Serializable { static readonly BLINDER_LENGTH: number; /** * A byte array of length BLINDER_LENGTH used to obfuscate the public key from the IdP. * Used in calculating the nonce passed to the IdP and as a secret witness in proof generation. */ readonly blinder: Uint8Array; /** * A timestamp in seconds indicating when the ephemeral key pair is expired. After expiry, a new * EphemeralKeyPair must be generated and a new JWT needs to be created. */ readonly expiryDateSecs: number; /** * The value passed to the IdP when the user authenticates. It comprises of a hash of the * ephermeral public key, expiry date, and blinder. */ readonly nonce: string; /** * A private key used to sign transactions. This private key is not tied to any account on the chain as it * is ephemeral (not permanent) in nature. */ private privateKey; /** * A public key used to verify transactions. This public key is not tied to any account on the chain as it * is ephemeral (not permanent) in nature. */ private publicKey; constructor(args: { privateKey: PrivateKey; expiryDateSecs?: number; blinder?: HexInput; }); /** * Returns the public key of the key pair. * @return EphemeralPublicKey */ getPublicKey(): EphemeralPublicKey; /** * Returns the public key of the key pair. * @return boolean */ isExpired(): boolean; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): EphemeralKeyPair; static fromBytes(bytes: Uint8Array): EphemeralKeyPair; /** * Returns the public key of the key pair. * @param scheme the type of keypair to use for the EphemeralKeyPair. Only Ed25519 supported for now. * @param expiryDateSecs the date of expiry. * @return boolean */ static generate(args?: { scheme?: EphemeralPublicKeyVariant; expiryDateSecs?: number; }): EphemeralKeyPair; /** * Sign the given message with the private key. * @param data in HexInput format * @returns EphemeralSignature */ sign(data: HexInput): EphemeralSignature; } /** * Account implementation for the Keyless authentication scheme. * * Used to represent a Keyless based account and sign transactions with it. * * Use KeylessAccount.fromJWTAndProof to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair. * * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, * EphemeralKeyPair, and corresponding proof. */ declare class KeylessAccount extends Serializable implements Account$1 { static readonly PEPPER_LENGTH: number; /** * The KeylessPublicKey associated with the account */ readonly publicKey: KeylessPublicKey; /** * The EphemeralKeyPair used to generate sign. */ readonly ephemeralKeyPair: EphemeralKeyPair; /** * The claim on the JWT to identify a user. This is typically 'sub' or 'email'. */ readonly uidKey: string; /** * The value of the uidKey claim on the JWT. This intended to be a stable user identifier. */ readonly uidVal: string; /** * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's * OIDC registration with the identity provider. */ readonly aud: string; /** * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider. */ readonly pepper: Uint8Array; /** * Account address associated with the account */ readonly accountAddress: AccountAddress; /** * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair. */ proof: ZeroKnowledgeSig | undefined; /** * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on * fetching the proof. */ readonly proofOrPromise: ZeroKnowledgeSig | Promise; /** * Signing scheme used to sign transactions */ readonly signingScheme: SigningScheme; /** * The JWT token used to derive the account */ readonly jwt: string; /** * An event emitter used to assist in handling asycronous proof fetching. */ private readonly emitter; private constructor(); /** * This initializes the asyncronous proof fetch * @return */ init(promise: Promise): Promise; serialize(serializer: Serializer): void; static deserialize(deserializer: Deserializer): KeylessAccount; /** * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair * and JWT token. * @return boolean */ isExpired(): boolean; /** * Sign a message using Keyless. * @param message the message to sign, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey; /** * Sign a transaction using Keyless. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey; /** * Waits for asyncronous proof fetching to finish. * @return */ waitForProofFetch(): Promise; /** * Sign the given message using Keyless. * @param message in HexInput format * @returns Signature */ sign(data: HexInput): KeylessSignature; /** * Sign the given transaction with Keyless. * Signs the transaction and proof to guard against proof malleability. * @param transaction the transaction to be signed * @returns KeylessSignature */ signTransaction(transaction: AnyRawTransaction): KeylessSignature; /** * Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount * * Verifies a signature given the message. * * TODO: Groth16 proof verification * * @param args.message the message that was signed. * @param args.signature the KeylessSignature to verify * @returns boolean */ verifySignature(args: { message: HexInput; signature: KeylessSignature; }): boolean; static fromBytes(bytes: Uint8Array): KeylessAccount; static create(args: { address?: AccountAddress; proof: ZeroKnowledgeSig | Promise; jwt: string; ephemeralKeyPair: EphemeralKeyPair; pepper: HexInput; uidKey?: string; proofFetchCallback?: ProofFetchCallback; }): KeylessAccount; } type ProofFetchSuccess = { status: "Success"; }; type ProofFetchFailure = { status: "Failed"; error: string; }; type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure; type ProofFetchCallback = (status: ProofFetchStatus) => Promise; interface ProofFetchEvents { proofFetchFinish: (status: ProofFetchStatus) => void; } interface VerifyMultiKeySignatureArgs { message: HexInput; signature: MultiKeySignature; } /** * Signer implementation for the MultiKey authentication scheme. * * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey} * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}. * * Note: Generating a signer instance does not create the account on-chain. */ declare class MultiKeyAccount implements Account$1 { /** * Public key associated with the account */ readonly publicKey: MultiKey; /** * Account address associated with the account */ readonly accountAddress: AccountAddress; /** * Signing scheme used to sign transactions */ readonly signingScheme: SigningScheme; /** * The signers used to sign messages. These signers should correspond to public keys in the * MultiKeyAccount's public key. The number of signers should be equal or greater * than this.publicKey.signaturesRequired */ readonly signers: Account$1[]; /** * An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in * publicKey.publicKeys. Used to derive the right public key to use for verification. */ readonly signerIndicies: number[]; readonly signaturesBitmap: Uint8Array; /** * constructor for MultiKeyAccount * * @param args.multiKey the multikey of the account which consists of N public keys and a number M which is * the number of required signatures. * @param args.signers an array of M signers that will be used to sign the transaction * @returns MultiKeyAccount */ constructor(args: { multiKey: MultiKey; signers: Account$1[]; }); /** * Static constructor for MultiKeyAccount * * @param args.publicKeys the N public keys of the MultiKeyAccount * @param args.signaturesRequired the number of signatures required * @param args.signers an array of M signers that will be used to sign the transaction * @returns MultiKeyAccount */ static fromPublicKeysAndSigners(args: { publicKeys: PublicKey[]; signaturesRequired: number; signers: Account$1[]; }): MultiKeyAccount; static isMultiKeySigner(account: Account$1): account is MultiKeyAccount; /** * Sign a message using the account's signers. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey; /** * Sign a transaction using the account's signers. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey; /** * Waits for any proofs on any KeylessAccount signers to be fetched. If the proof is fetched a syncronously, call this * to ensure signing with the KeylessAccount does not fail as the proof must be ready. * @return */ waitForProofFetch(): Promise; /** * Sign the given message using the MultiKeyAccount's signers * @param message in HexInput format * @returns MultiKeySignature */ sign(data: HexInput): MultiKeySignature; /** * Sign the given transaction using the MultiKeyAccount's signers * @param transaction the transaction to be signed * @returns MultiKeySignature */ signTransaction(transaction: AnyRawTransaction): MultiKeySignature; /** * Verify the given message and signature with the public key. * * @param args.message raw message data in HexInput format * @param args.signatures signed message MultiKeySignature * @returns boolean */ verifySignature(args: VerifyMultiKeySignatureArgs): boolean; } interface VerifyMultiAuthKeySignatureArgs { message: HexInput; signature: MultiAuthKeySignature; } /** * Signer implementation for the MultiKey authentication scheme. * * This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey} * It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}. * * Note: Generating a signer instance does not create the account on-chain. */ declare class MultiAuthKeyAccount implements Account$1 { readonly publicKey: MultiAuthKeyPublicKey; /** * Account address associated with the account */ readonly accountAddress: AccountAddress; /** * Signing scheme used to sign transactions */ readonly signingScheme: SigningScheme; /** * The signers used to sign messages. These signers should correspond to public keys in the * MultiKeyAccount's public key. The number of signers should be equal or greater * than this.publicKey.signaturesRequired */ readonly signers: Account$1[]; constructor(args: { sender: AccountAddress; signers: Account$1[]; }); static isMultiKeySigner(account: Account$1): account is MultiAuthKeyAccount; /** * Sign a message using the account's signers. * @param message the signing message, as binary input * @return the AccountAuthenticator containing the signature, together with the account's public key */ signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiAuthKey; /** * Sign a transaction using the account's signers. * @param transaction the raw transaction * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key */ signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiAuthKey; /** * Waits for any proofs on any KeylessAccount signers to be fetched. If the proof is fetched a syncronously, call this * to ensure signing with the KeylessAccount does not fail as the proof must be ready. * @return */ waitForProofFetch(): Promise; /** * Sign the given message using the MultiKeyAccount's signers * @param message in HexInput format * @returns MultiKeySignature */ sign(data: HexInput): MultiAuthKeySignature; /** * Sign the given transaction using the MultiKeyAccount's signers * @param transaction the transaction to be signed * @returns MultiKeySignature */ signTransaction(transaction: AnyRawTransaction): MultiAuthKeySignature; /** * Verify the given message and signature with the public key. * * @param args.message raw message data in HexInput format * @param args.signatures signed message MultiKeySignature * @returns boolean */ verifySignature(args: VerifyMultiAuthKeySignatureArgs): boolean; } /** * A class to query all `Account` related queries on Endless. */ declare class Account { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Queries the current state for an Endless account given its account address * * @param args.accountAddress Endless account address * * @returns The account data * * @example An example of the returned account * ``` * { * sequence_number: "1", * authentication_key: "0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69" * } * ``` */ getAccountInfo(args: { accountAddress: AccountAddressInput; }): Promise; /** * Queries for all modules in an account given an account address * * Note: In order to get all account modules, this function may call the API * multiple times as it auto paginates. * * @param args.accountAddress Endless account address * @param args.options.offset The number module to start returning results from * @param args.options.limit The number of results to return * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @returns Account modules */ getAccountModules(args: { accountAddress: AccountAddressInput; options?: PaginationArgs & LedgerVersionArg; }): Promise; /** * Queries for a specific account module given account address and module name * * @param args.accountAddress Endless account address * @param args.moduleName The name of the module * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @returns Account module * * @example * const module = await endless.getAccountModule({accountAddress:"0x456"}) * // An example of an account module response * ``` * { * bytecode: "0xa11ceb0b0600000006010002030206050807070f0d081c200", * abi: { address: "0x1" } * } * ``` */ getAccountModule(args: { accountAddress: AccountAddressInput; moduleName: string; options?: LedgerVersionArg; }): Promise; /** * Queries account transactions given an account address * * Note: In order to get all account transactions, this function may call the API * multiple times as it auto paginates. * * @example * const transactions = await endless.getAccountTransactions({accountAddress:"0x456"}) * * @param args.accountAddress Endless account address * @param args.options.offset The number transaction to start returning results from * @param args.options.limit The number of results to return * * @returns The account transactions */ getAccountTransactions(args: { accountAddress: AccountAddressInput; options?: PaginationArgs; }): Promise; /** * Queries all account resources given an account address * * Note: In order to get all account resources, this function may call the API * multiple times as it auto paginates. * * @example * const resources = await endless.getAccountResources({accountAddress:"0x456"}) * * @param args.accountAddress Endless account address * @param args.options.offset The number resource to start returning results from * @param args.options.limit The number of results to return * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * @returns Account resources */ getAccountResources(args: { accountAddress: AccountAddressInput; options?: PaginationArgs & LedgerVersionArg; }): Promise; /** * Queries a specific account resource given account address and resource type. Note that the default is `any` in order * to allow for ease of accessing properties of the object. * * @type The typed output of the resource * @param args.accountAddress Endless account address * @param args.resourceType String representation of an on-chain Move struct type, i.e "0x1::endless_coin::EndlessCoin" * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @returns Account resource * * @example * const resource = await endless.getAccountResource({accountAddress:"0x456"}) * */ getAccountResource(args: { accountAddress: AccountAddressInput; resourceType: MoveStructId; options?: LedgerVersionArg; }): Promise; /** * Looks up the account address for a given authentication key * * This handles both if the account's authentication key has been rotated or not. * * @example * const accountAddress = await endless.lookupOriginalAccountAddress({authenticationKey:account.accountAddress}) * * @param args.authenticationKey The authentication key * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * @returns Promise The accountAddress associated with the authentication key */ lookupOriginalAccountAddress(args: { authenticationKey: AccountAddressInput; options?: LedgerVersionArg; }): Promise; /** * Queries an account's coins data * * @example * const accountCoinsData = await endless.getAccountCoinsData({accountAddress:"0x123"}) * * @param args.accountAddress The account address we want to get the coins data for * @param args.options.page optional. The page number * @param args.options.pageSize optional. The number of results to return * @param args.options.coin optional. Filter by coin id * @returns Array with the coins data */ getAccountCoinsData(args: { accountAddress: AccountAddressInput; options?: PaginationArgsOfIndexer & { coin?: string; }; }): Promise; /** * Queries coins data created by account * * @example * const accountCoinsData = await endless.getCoinsDataCreatedBy({accountAddress:"0x123"}) * * @param args.accountAddress The account address of who create the coins * @param args.options.page optional. The page number * @param args.options.pageSize optional. The number of results to return * @param args.options.coin optional. Filter by coin id * @returns Array with the coins data */ getCoinsDataCreatedBy(args: { accountAddress: AccountAddressInput; options?: PaginationArgsOfIndexer & { coin?: string; }; }): Promise; /** * Queries the account's EDS amount * * @example * const accountAPTAmount = await endless.getAccountAPTAmount({accountAddress:"0x123"}) * * @param args.accountAddress The account address we want to get the total count for * @returns Current amount of account's APT */ getAccountEDSAmount(args: { accountAddress: AccountAddressInput; }): Promise; /** * Queries the account's coin amount by the coin type * * @example * const accountCoinAmount = await endless.getAccountCoinAmount({accountAddress:"0x123", coinType:"0x1::endless_coin::EndlessCoin"}) * * @param args.accountAddress The account address we want to get the total count for * @param args.coinType The coin type to query * @returns Current amount of account's coin */ getAccountCoinAmount(args: { accountAddress: AccountAddressInput; coinId: string; }): Promise; /** * Derives an account by providing a private key. * This functions resolves the provided private key type and derives the public key from it. * * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and * auth key using the SingleKey scheme locally. * * If the privateKey is a ED25519 type, it looks up the authentication key on chain, and uses it to resolve * whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based * on that. * * @example * const account = await endless.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey("0x123")}) * * @param args.privateKey An account private key * @returns Account type */ deriveAccountFromPrivateKey(args: { privateKey: PrivateKey; }): Promise; /** * Queries an account's coins data * * @example * const accountCoinsData = await endless.getAccountCoinsData({accountAddress:["0x123"]}) * * @param args.accountAddress The account address we want to get the coins data for * @param args.coinAddress The coinAddress address we want to get the coins data for * @returns Array with the coins data */ getAccountsCoinBalance(args: { accountAddress: AccountAddressInput[]; coinAddress: AccountAddressInput; }): Promise; /** * Queries the balances of specified coins for multiple accounts. * * @example * const balances = await endless.getAccountsCoinsBalances({ * accounts: ["0x123", "0x456"], * coins: ["0x1::aptos_coin::AptosCoin"] * }); * * @param args.accounts The account addresses to query balances for. * @param args.coins The coin types (e.g., "0x1::aptos_coin::AptosCoin") to query balances for. * @returns An array of account balances corresponding to the requested accounts. */ getAccountsCoinsBalances(args: { accounts: AccountAddressInput[]; coins: string[]; }): Promise; /** * Queries for collections created by an account * * @param args.accountAddress The account address * @param args.options.page optional. The page number * @param args.options.pageSize optional. The number of results per page * @param args.options.collection optional. Filter by collection name or ID * @returns PageableCollectionResponse */ getAccountCollections(args: { accountAddress: AccountAddressInput; options?: PaginationArgsOfIndexer & { collection?: string; }; }): Promise; /** * Queries for NFTs owned by an account * * @param args.accountAddress The account address * @param args.options.page optional. The page number * @param args.options.pageSize optional. The number of results per page * @param args.options.token optional. Filter by token name or ID * @param args.options.collection optional. Filter by collection name or ID * @returns PageableNftTokenResponse */ getAccountNfts(args: { accountAddress: AccountAddressInput; options?: PaginationArgsOfIndexer & { token?: string; collection?: string; }; }): Promise; /** * Queries for NFT collections where the account owns tokens * * @param args.accountAddress The account address * @param args.options.page optional. The page number * @param args.options.pageSize optional. The number of results per page * @param args.options.collection optional. Filter by collection name or ID * @returns PageableNftOwnedCollectionResponse */ getAccountNftCollections(args: { accountAddress: AccountAddressInput; options?: PaginationArgsOfIndexer & { collection?: string; }; }): Promise; } /** * A class to handle all `Coin` operations */ declare class Coin { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Generate a transfer coin transaction that can be simulated and/or signed and submitted * * @example * const transferCoinTransaction = await endless.transferCoinTransaction({ * sender: "0x123", * recipient:"0x456", * amount: 10, * }) * * @param args.sender The sender account * @param args.recipient The recipient address * @param args.amount The amount to transfer * @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::endless_coin::EndlessCoin * * @returns SimpleTransaction */ transferCoinTransaction(args: { sender: AccountAddressInput; fungibleAssetMetadataAddress: AccountAddress; recipient: AccountAddress; amount: AnyNumber; coinType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * @param args.coinAddress The coin address * * @returns GetCoinDataResponse */ getCoinData(coinAddress: AccountAddressInput): Promise; /** * @param args.coinListAddress The coin list address * * @returns GetCoinDataResponse[] */ getCoinListDataById(coinListAddress: AccountAddressInput[]): Promise; /** * Get coin holders * * @param coinAddress The coin address * @param options.page The page number, default is 0 * @param options.pageSize The page size, default is 30, max is 200 * * @returns PageableHoldersItem */ getCoinHolders(coinAddress: AccountAddressInput, options?: PaginationArgsOfIndexer): Promise; /** * Get all coins from indexer * * @param options.page The page number, default is 0 * @param options.pageSize The page size, default is 30, max is 200 * * @returns PageableFungibleAssetMetadataResponse */ getCoinsList(options?: PaginationArgsOfIndexer): Promise; } /** * This file contains the underlying implementations for exposed API surface in * the {@link api/digitalAsset}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * digitalAsset namespace and without having a dependency cycle error. */ declare const PropertyTypeMap: { BOOLEAN: string; U8: string; U16: string; U32: string; U64: string; U128: string; U256: string; ADDRESS: string; STRING: string; ARRAY: string; }; type PropertyType = keyof typeof PropertyTypeMap; type PropertyValue = boolean | number | bigint | string | AccountAddress | Uint8Array; interface CreateCollectionOptions { maxSupply?: AnyNumber; mutableDescription?: boolean; mutableRoyalty?: boolean; mutableURI?: boolean; mutableTokenDescription?: boolean; mutableTokenName?: boolean; mutableTokenProperties?: boolean; mutableTokenURI?: boolean; tokensBurnableByCreator?: boolean; tokensFreezableByCreator?: boolean; royaltyNumerator?: number; royaltyDenominator?: number; } /** * A class to query all `DigitalAsset` related queries on Endless. */ declare class DigitalAsset { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Creates a new collection within the specified account * * @example * const transaction = await endless.createCollectionTransaction({ * creator: alice, * description: "collectionDescription", * name: "collectionName", * uri: "collection-uri.com", * }); * * @param args.creator the account of the collection's creator * @param args.description the description of the collection * @param args.name the name of the collection * @param args.uri the URI to additional info about the collection * * The parameters below are optional. * @param args.maxSupply controls the max supply of the digital assets - defaults MAX_U64_BIG_INT * @param args.mutableDescription controls mutability of the collection's description - defaults true * @param args.mutableRoyalty controls mutability of the collection's description - defaults true * @param args.mutableUri controls mutability of the collection's URI - defaults true * @param args.mutableTokenDescription controls mutability of the digital asset's description - defaults true * @param args.mutableTokenName controls mutability of the digital asset's name - defaults true * @param args.mutableTokenProperties controls mutability of digital asset's properties - defaults true * @param args.mutableTokenUri controls mutability of the digital asset's URI - defaults true * @param args.tokensBurnableByCreator controls whether digital assets can be burnable by the creator - defaults true * @param args.tokensFreezableByCreator controls whether digital assets can be frozen by the creator - defaults true * @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when * a digital asset is transferred - defaults 0 * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator * when a digital asset is transferred - defaults 1 * * @returns A SimpleTransaction that when submitted will create the collection. */ createCollectionTransaction(args: { creator: Account$1; description: string; name: string; uri: string; options?: InputGenerateTransactionOptions; } & CreateCollectionOptions): Promise; /** * Create a transaction to mint a digital asset into the creators account within an existing collection. * * @example * const transaction = await endless.mintDigitalAssetTransaction({ * creator: alice, * description: "collectionDescription", * collection: "collectionName", * name: "digitalAssetName", * uri: "digital-asset-uri.com", * }); * * @param args.creator the creator of the collection * @param args.collection the name of the collection the digital asset belongs to * @param args.description the description of the digital asset * @param args.name the name of the digital asset * @param args.uri the URI to additional info about the digital asset * * @returns A SimpleTransaction that can be simulated or submitted to chain */ mintDigitalAssetTransaction(args: { creator: Account$1; collection: string; description: string; name: string; uri: string; propertyKeys?: Array; propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Transfer a digital asset (non fungible digital asset) ownership. * * We can transfer a digital asset only when the digital asset is not frozen * (i.e. owner transfer is not disabled such as for soul bound digital assets) * * @example * const transaction = await endless.transferDigitalAssetTransaction({ * sender: alice, * digitalAssetAddress: "0x123", * recipient: "0x456", * }); * * @param args.sender The sender account of the current digital asset owner * @param args.digitalAssetAddress The digital asset address * @param args.recipient The recipient account address * @param args.digitalAssetType optional. The digital asset type, default to "0x4::token::Token" * * @returns A SimpleTransaction that can be simulated or submitted to chain */ transferDigitalAssetTransaction(args: { sender: Account$1; digitalAssetAddress: AccountAddressInput; recipient: AccountAddress; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Mint a soul bound digital asset into a recipient's account * * @example * const transaction = await endless.mintSoulBoundTransaction({ * account: alice, * collection: "collectionName", * description: "collectionDescription", * name: "digitalAssetName", * uri: "digital-asset-uri.com", * recipient: "0x123" * }); * * @param args.account The account that mints the digital asset * @param args.collection The collection name that the digital asset belongs to * @param args.description The digital asset description * @param args.name The digital asset name * @param args.uri The digital asset URL * @param args.recipient The account address where the digital asset will be created * @param args.propertyKeys The property keys for storing on-chain properties * @param args.propertyTypes The type of property values * @param args.propertyValues The property values to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ mintSoulBoundTransaction(args: { account: Account$1; collection: string; description: string; name: string; uri: string; recipient: AccountAddressInput; propertyKeys?: Array; propertyTypes?: Array; propertyValues?: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Burn a digital asset by its creator * * @example * const transaction = await endless.burnDigitalAssetTransaction({ * creator: alice, * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ burnDigitalAssetTransaction(args: { creator: Account$1; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Freeze digital asset transfer ability * * @example * const transaction = await endless.freezeDigitalAssetTransaferTransaction({ * creator: alice, * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ freezeDigitalAssetTransaferTransaction(args: { creator: Account$1; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Unfreeze digital asset transfer ability * * @example * const transaction = await endless.unfreezeDigitalAssetTransaferTransaction({ * creator: alice, * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ unfreezeDigitalAssetTransaferTransaction(args: { creator: Account$1; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the digital asset description * * @example * const transaction = await endless.setDigitalAssetDescriptionTransaction({ * creator: alice, * description: "digitalAssetDescription", * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.description The digital asset description * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ setDigitalAssetDescriptionTransaction(args: { creator: Account$1; description: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the digital asset name * * @example * const transaction = await endless.setDigitalAssetNameTransaction({ * creator: alice, * name: "digitalAssetName", * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.name The digital asset name * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ setDigitalAssetNameTransaction(args: { creator: Account$1; name: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Set the digital asset name * * @example * const transaction = await endless.setDigitalAssetURITransaction({ * creator: alice, * uri: "digital-asset-uri.com", * digitalAssetAddress: "0x123", * }); * * @param args.creator The creator account * @param args.uri The digital asset uri * @param args.digitalAssetAddress The digital asset address * * @returns A SimpleTransaction that can be simulated or submitted to chain */ setDigitalAssetURITransaction(args: { creator: Account$1; uri: string; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Add a digital asset property * * @example * const transaction = await endless.addDigitalAssetPropertyTransaction({ * creator: alice, * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: true, * digitalAssetAddress: "0x123", * }); * * @param args.account The account that mints the digital asset * @param args.digitalAssetAddress The digital asset address * @param args.propertyKey The property key for storing on-chain properties * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ addDigitalAssetPropertyTransaction(args: { creator: Account$1; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Remove a digital asset property * * @example * const transaction = await endless.removeDigitalAssetPropertyTransaction({ * creator: alice, * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: true, * digitalAssetAddress: "0x123", * }); * * @param args.account The account that mints the digital asset * @param args.digitalAssetAddress The digital asset address * @param args.propertyKey The property key for storing on-chain properties * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ removeDigitalAssetPropertyTransaction(args: { creator: Account$1; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Update a digital asset property * * @example * const transaction = await endless.updateDigitalAssetPropertyTransaction({ * creator: alice, * propertyKey: "newKey", * propertyType: "BOOLEAN", * propertyValue: false, * digitalAssetAddress: "0x123", * }); * * @param args.account The account that mints the digital asset * @param args.digitalAssetAddress The digital asset address * @param args.propertyKey The property key for storing on-chain properties * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ updateDigitalAssetPropertyTransaction(args: { creator: Account$1; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Add a typed digital asset property * * @example * const transaction = await endless.addDigitalAssetTypedPropertyTransaction({ * creator: alice, * propertyKey: "typedKey", * propertyType: "STRING", * propertyValue: "hello", * digitalAssetAddress: "0x123", * }); * * @param args.account The account that mints the digital asset * @param args.digitalAssetAddress The digital asset address * @param args.propertyKey The property key for storing on-chain properties * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ addDigitalAssetTypedPropertyTransaction(args: { creator: Account$1; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; /** * Update a typed digital asset property * * @example * const transaction = await endless.updateDigitalAssetTypedPropertyTransaction({ * creator: alice, * propertyKey: "typedKey", * propertyType: "U8", * propertyValue: 2, * digitalAssetAddress: "0x123", * }); * * @param args.account The account that mints the digital asset * @param args.digitalAssetAddress The digital asset address * @param args.propertyKey The property key for storing on-chain properties * @param args.propertyType The type of property value * @param args.propertyValue The property value to be stored on-chain * * @returns A SimpleTransaction that can be simulated or submitted to chain */ updateDigitalAssetTypedPropertyTransaction(args: { creator: Account$1; propertyKey: string; propertyType: PropertyType; propertyValue: PropertyValue; digitalAssetAddress: AccountAddressInput; digitalAssetType?: MoveStructId; options?: InputGenerateTransactionOptions; }): Promise; } declare function isBool(arg: SimpleEntryFunctionArgumentTypes): arg is boolean; declare function isString(arg: any): arg is string; declare function isNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number; declare function isLargeNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number | bigint | string; declare function isNull(arg: SimpleEntryFunctionArgumentTypes): arg is null | undefined; declare function isEncodedEntryFunctionArgument(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is EntryFunctionArgumentTypes; declare function isBcsBool(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is Bool; declare function isBcsAddress(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is AccountAddress; declare function isBcsString(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is MoveString; declare function isBcsFixedBytes(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is FixedBytes; declare function isBcsU8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U8; declare function isBcsU16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U16; declare function isBcsU32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U32; declare function isBcsU64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U64; declare function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U128; declare function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256; declare function isScriptDataInput(arg: InputGenerateTransactionPayloadDataWithRemoteABI | InputGenerateTransactionPayloadData): arg is InputScriptData; declare function throwTypeMismatch(expectedType: string, position: number): void; /** * Finds first non-signer arg. * * A function is often defined with a `signer` or `&signer` arguments at the start, which are filled in * by signatures, and not by the caller. * @param functionAbi */ declare function findFirstNonSignerArg(functionAbi: MoveFunction): number; declare function getFunctionParts(functionArg: MoveFunctionId): { moduleAddress: string; moduleName: string; functionName: string; }; /** * We are defining function signatures, each with its specific input and output. * These are the possible function signature for our `generateTransactionPayload` function. * When we call our `generateTransactionPayload` function with the relevant type properties, * Typescript can infer the return type based on the appropriate function overload. */ declare function generateTransactionPayload(args: InputScriptData): Promise; declare function generateTransactionPayload(args: InputEntryFunctionDataWithRemoteABI): Promise; declare function generateTransactionPayload(args: InputMultiSigDataWithRemoteABI): Promise; declare function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction; declare function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig; declare function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise; declare function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction; /** * Generates a raw transaction * * @param args.endlessConfig EndlessConfig * @param args.sender The transaction's sender account address as a hex input * @param args.payload The transaction payload - can create by using generateTransactionPayload() * * @returns RawTransaction */ declare function generateRawTransaction(args: { endlessConfig: EndlessConfig; sender: AccountAddressInput; payload: AnyTransactionPayloadInstance; options?: InputGenerateTransactionOptions; feePayerAddress?: AccountAddressInput; }): Promise; /** * We are defining function signatures, each with its specific input and output. * These are the possible function signature for our `generateTransaction` function. * When we call our `generateTransaction` function with the relevant type properties, * Typescript can infer the return type based on the appropriate function overload. */ declare function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise; declare function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise; /** * Simulate a transaction before signing and submit to chain * * @param args.transaction A endless transaction type to sign * @param args.signerPublicKey The signer public key * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction * @param args.options optional. SimulateTransactionOptions * * @returns A signed serialized transaction that can be simulated */ declare function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array; /** * Simulate a transaction before signing and submit to chain * * @param transaction A endless transaction type to sign * * @returns A signed serialized transaction that can be simulated */ declare function generateMockSignedTransactionForSimulation(transaction: AnyRawTransaction): Uint8Array; declare function getAuthenticatorForSimulation(publicKey: PublicKey): AccountAuthenticatorEd25519 | AccountAuthenticatorSingleKey; /** * Prepare a transaction to be submitted to chain * * @param args.transaction A endless transaction type * @param args.senderAuthenticator The account authenticator of the transaction sender * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction * * @returns A SignedTransaction */ declare function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array; /** * Hashes the set of values with a SHA-3 256 hash * @param input array of UTF-8 strings or Uint8array byte arrays */ declare function hashValues(input: (Uint8Array | string)[]): Uint8Array; /** * Generates a user transaction hash for the given transaction payload. It must already have an authenticator * @param args InputSubmitTransactionData */ declare function generateUserTransactionHash(args: InputSubmitTransactionData): string; /** * Convert type arguments to only type tags, allowing for string representations of type tags */ declare function standardizeTypeTags(typeArguments?: Array): Array; /** * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function. * @param moduleAddress * @param moduleName * @param functionName * @param endlessConfig */ declare function fetchFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, endlessConfig: EndlessConfig): Promise; /** * Fetches the ABI for an entry function from the module * * @param moduleAddress * @param moduleName * @param functionName * @param endlessConfig */ declare function fetchEntryFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, endlessConfig: EndlessConfig): Promise; /** * Fetches the ABI for a view function from the module * * @param moduleAddress * @param moduleName * @param functionName * @param endlessConfig */ declare function fetchViewFunctionAbi(moduleAddress: string, moduleName: string, functionName: string, endlessConfig: EndlessConfig): Promise; /** * Converts a non-BCS encoded argument into BCS encoded, if necessary * @param functionName * @param functionAbi * @param arg * @param position */ declare function convertArgument(functionName: string, functionAbi: FunctionABI, arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes, position: number, genericTypeParams: Array): EntryFunctionArgumentTypes; declare function checkOrConvertArgument(arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes, param: TypeTag, position: number, genericTypeParams: Array): EntryFunctionArgumentTypes; /** * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction * * @param transaction A endless transaction type * * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction */ declare function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance; /** * Generates the 'signing message' form of a message to be signed. * * @param bytes The byte representation of the message to be signed and sent to the chain * @param domainSeparator A domain separator that starts with 'ENDLESS::' * * @returns The Uint8Array of the signing message */ declare function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array; /** * Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of * its constructor as the domain separator. * * @param serializable An object that has a bcs serialized form * * @returns The Uint8Array of the signing message */ declare function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array; /** * Generates the 'signing message' form of a transaction. It derives the type of transaction and * applies the appropriate domain separator based on if there is extra data such as a fee payer or * secondary signers. * * @param transaction A transaction that is to be signed * * @returns The Uint8Array of the signing message */ declare function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array; declare enum TypeTagParserErrorType { InvalidTypeTag = "unknown type", UnexpectedGenericType = "unexpected generic type", UnexpectedTypeArgumentClose = "unexpected '>'", UnexpectedWhitespaceCharacter = "unexpected whitespace character", UnexpectedComma = "unexpected ','", TypeArgumentCountMismatch = "type argument count doesn't match expected amount", MissingTypeArgumentClose = "no matching '>' for '<'", MissingTypeArgument = "no type argument before ','", UnexpectedPrimitiveTypeArguments = "primitive types not expected to have type arguments", UnexpectedVectorTypeArgumentCount = "vector type expected to have exactly one type argument", UnexpectedStructFormat = "unexpected struct format, must be of the form 0xaddress::module_name::struct_name", InvalidModuleNameCharacter = "module name must only contain alphanumeric or '_' characters", InvalidStructNameCharacter = "struct name must only contain alphanumeric or '_' characters", InvalidAddress = "struct address must be valid" } declare class TypeTagParserError extends Error { constructor(typeTagStr: string, invalidReason: TypeTagParserErrorType); } /** * All types are made of a few parts they're either: * 1. A simple type e.g. u8 * 2. A standalone struct e.g. 0x1::account::Account * 3. A nested struct e.g. 0x1::coin::Coin<0x1234::coin::MyCoin> * * There are a few more special cases that need to be handled, however. * 1. Multiple generics e.g 0x1::pair::Pair * 2. Spacing in the generics e.g. 0x1::pair::Pair< u8 , u16> * 3. Nested generics of different depths e.g. 0x1::pair::Pair<0x1::coin::Coin<0x1234::coin::MyCoin>, u8> * 4. Generics for types in ABIs are filled in with placeholders e.g T1, T2, T3 */ declare function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolean; }): TypeTag; /** * A class to query all `FungibleAsset` related queries on Endless. */ declare class FungibleAsset { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Transfer `amount` of fungible asset from sender's primary store to recipient's primary store. * * Use this method to transfer any fungible asset including fungible token. * * @example * const transaction = await endless.transferFungibleAsset({ * sender: alice, * fungibleAssetMetadataAddress: "0x123", * recipient: "0x456", * amount: 5 * }) * * @param sender The sender account * @param fungibleAssetMetadataAddress The fungible asset account address. * For example if you’re transferring USDT this would be the USDT address * @param recipient The recipient account address * @param amount Number of assets to transfer * * @returns A SimpleTransaction that can be simulated or submitted to chain. */ transferFungibleAsset(args: { sender: Account$1; fungibleAssetMetadataAddress: AccountAddressInput; recipient: AccountAddressInput; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise; } /** * A class to query all `General` Endless related queries */ declare class General { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Queries for the Endless ledger info * * @returns Endless Ledger Info * * @example * const ledgerInfo = await endless.getLedgerInfo() * // an example of the returned data * ``` * { * "chain_id": 4, * "epoch": "8", * "ledger_version": "714", * "oldest_ledger_version": "0", * "ledger_timestamp": "1694695496521775", * "node_role": "validator", * "oldest_block_height": "0", * "block_height": "359", * "git_hash": "c82193f36f4e185fed9f68c4ad21f6c6dd390c6e" * } * ``` */ getLedgerInfo(): Promise; /** * Queries for indexer service status * * @param args.durationSecs The interval between latest indexed tx time and service time * @returns Indexer status */ getIndexerStatus(args?: { durationSecs?: number; }): Promise; /** * Queries for the chain id * * @example * const chainId = await endless.getChainId() * * @returns The chain id */ getChainId(): Promise; /** * Queries for block by transaction version * * @example * const block = await endless.getBlockByVersion({ledgerVersion:5}) * * @param args.ledgerVersion Ledger version to lookup block information for * @param args.options.withTransactions If set to true, include all transactions in the block * * @returns Block information with optional transactions */ getBlockByVersion(args: { ledgerVersion: AnyNumber; options?: { withTransactions?: boolean; }; }): Promise; /** * Get block by block height * * @example * const block = await endless.getBlockByVersion({blockHeight:5}) * * @param args.blockHeight Block height to lookup. Starts at 0 * @param args.options.withTransactions If set to true, include all transactions in the block * * @returns Block with optional transactions */ getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean; }; }): Promise; /** * Queries for a Move view function * @param args.payload Payload for the view function * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @example * const data = await endless.view({ * payload: { * function: "0x1::coin::balance", * typeArguments: ["0x1::endless_coin::EndlessCoin"], * functionArguments: [accountAddress], * } * }) * * @returns an array of Move values */ view>(args: { payload: InputViewFunctionData; options?: LedgerVersionArg; }): Promise; /** * Search coin or collection by name * * @param args.query Search keyword * @returns Search results */ search(args: { query: string; }): Promise; } /** * This file contains the underlying implementations for exposed API surface in * the {@link api/name}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * name namespace and without having a dependency cycle error. */ interface RegisterNameParameters { endlessConfig: EndlessConfig; sender: Account$1; name: string; expiration: { policy: "domain"; years?: 1; } | { policy: "subdomain:follow-domain"; } | { policy: "subdomain:independent"; expirationDate: number; }; transferable?: boolean; toAddress?: AccountAddressInput; targetAddress?: AccountAddressInput; options?: InputGenerateTransactionOptions; } /** * A class to handle all `ANS` operations */ declare class ANS { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Retrieve the owner address of a domain name or subdomain name from the contract. * * @example * // Will return the owner address of "test.endless.apt" or undefined * const owner = await endless.getOwnerAddress({name: "test.endless"}) * // owner = 0x123... * * @param args.name - A string of the name to retrieve * * @returns AccountAddress if the name is owned, undefined otherwise */ getOwnerAddress(args: { name: string; }): Promise; /** * Retrieve the expiration time of a domain name or subdomain name from the contract. * * @example * // Will return the expiration of "test.endless.apt" or undefined * const exp = await endless.getExpiration({name: "test.endless"}) * // new Date(exp) would give you the date in question: 2021-01-01T00:00:00.000Z * * @param args.name - A string of the name to retrieve * * @returns number as a unix timestamp in milliseconds. */ getExpiration(args: { name: string; }): Promise; /** * Retrieve the target address of a domain or subdomain name. This is the * address the name points to for use on chain. Note, the target address can * point to addresses that are not the owner of the name * * @example * const targetAddr = await endless.getTargetAddress({name: "test.endless"}) * // targetAddr = 0x123... * * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc. * * @returns AccountAddress if the name has a target, undefined otherwise */ getTargetAddress(args: { name: string; }): Promise; /** * Sets the target address of a domain or subdomain name. This is the * address the name points to for use on chain. Note, the target address can * point to addresses that are not the owner of the name * * @example * await endless.setTargetAddress({sender: alice, name: "test.endless", address: bob.accountAddress}) * const address = await endless.getTargetAddress({name: "test.endless"}) * // address = bob.accountAddress * * @param args.name - A string of the name: test.endless.apt, test.apt, test, test.endless, etc. * @param args.address - A AccountAddressInput of the address to set the domain or subdomain to * * @returns SimpleTransaction */ setTargetAddress(args: { sender: Account$1; name: string; address: AccountAddressInput; options?: InputGenerateTransactionOptions; }): Promise; /** * Retrieve the primary name for an account. An account can have * multiple names that target it, but only a single name that is primary. An * account also may not have a primary name. * * @example * const name = await endless.getPrimaryName({address: alice.accountAddress}) * // name = test.endless * * @param args.address - A AccountAddressInput (address) of the account * * @returns a string if the account has a primary name, undefined otherwise */ getPrimaryName(args: { address: AccountAddressInput; }): Promise; /** * Sets the primary name for the sender. An account can have * multiple names that target it, but only a single name that is primary. An * account also may not have a primary name. * * @example * await endless.setPrimaryName({sender: alice, name: "test.endless"}) * const primaryName = await endless.getPrimaryName({address: alice.accountAddress}) * // primaryName = test.endless * * @param args.sender - The sender account * @param args.name - A string of the name: test, test.apt, test.endless, test.endless.apt, etc. * * @returns SimpleTransaction */ setPrimaryName(args: { sender: Account$1; name?: string; options?: InputGenerateTransactionOptions; }): Promise; /** * Registers a new name * * @example * // An example of registering a subdomain name assuming def.apt is already registered * // and belongs to the sender alice. * const txn = endless.registerName({ * sender: alice, * name: "test.endless.apt", * expiration: { * policy: "subdomain:independent", * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000, * }, * }); * * @param args.sender - The sender account * @param args.name - A string of the name to register. This can be inclusive or exclusive of the .apt suffix. * Examples include: "test", "test.apt", "test.endless.apt", etc. * @param args.expiration - An object with the expiration policy of the name. * @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent' * - domain: Years is required and the name will expire after the given number of years. * - subdomain:follow-domain: The name will expire at the same time as the domain name. * - subdomain:independent: The name will expire at the given date. * @param args.expiration.expirationDate - An epoch number in milliseconds of * the date when the subdomain will expire. Only applicable when the policy is * set to 'subdomain:independent'. * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains. * @param args.targetAddress optional - The address the domain name will resolve to. If not provided, * the sender's address will be used. * @param args.toAddress optional - The address to send the domain name to. If not provided, * the transaction will be sent to the router. * * @returns SimpleTransaction */ registerName(args: Omit): Promise; /** * Renews a domain name * * Note: If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction. * * @example * await endless.renewDomain({sender: alice, name: "test"}) * // test.apt will be renewed for one year * * @param args.sender - The sender account * @param args.name - A string of the domain the subdomain will be under. The signer must be the domain owner. * Subdomains cannot be renewed. * @param args.years - The number of years to renew the name. Currently only one year is permitted. * * @returns SimpleTransaction */ renewDomain(args: { sender: Account$1; name: string; years?: 1; options?: InputGenerateTransactionOptions; }): Promise; } /** * A class to query all `NFT` related queries on Endless. */ declare class NFT { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Get all collections * * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collections */ getCollections(args?: { options?: PaginationArgsOfIndexer; }): Promise; /** * Batch get collections by IDs * * @param args.ids The IDs of the collections to retrieve * @returns The collections */ batchGetCollections(args: { ids: AccountAddressInput[]; }): Promise; /** * Get a collection by ID * * @param args.id The ID of the collection to retrieve * @returns The collection */ getCollection(args: { id: AccountAddressInput; }): Promise; /** * Get collection history by ID * * @param args.id The ID of the collection to retrieve history for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection history */ getCollectionHistory(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise; /** * Get collection holders by ID * * @param args.id The ID of the collection to retrieve holders for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection holders */ getCollectionHolders(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise; /** * Get collection tokens by ID * * @param args.id The ID of the collection to retrieve tokens for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The collection tokens */ getCollectionTokens(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise; /** * Get an NFT by ID * * @param args.id The ID of the NFT to retrieve * @returns The NFT */ getNft(args: { id: AccountAddressInput; }): Promise; /** * Get NFT history by ID * * @param args.id The ID of the NFT to retrieve history for * @param args.options.page The page number to retrieve * @param args.options.pageSize The number of items to retrieve per page * @returns The NFT history */ getNftHistory(args: { id: AccountAddressInput; options?: PaginationArgsOfIndexer; }): Promise; /** * Get NFT metrics * * @returns The NFT metrics */ getNftMetrics(): Promise; } /** * A class to query all `Stake` related queries on Endless indexer. */ declare class Stake { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Get all delegation pools * * @param args.user Optional user address to filter pools * @returns Delegation pools */ getDelegationPools(args?: { user?: AccountAddressInput; }): Promise; /** * Batch get pool rewards by pool address list * * @param args.pools Pool addresses * @returns Pool rewards */ batchGetPoolRewards(args: { pools: AccountAddressInput[]; }): Promise; /** * Get pool rewards by pool address * * @param args.pool Pool address * @returns Pool reward */ getPoolRewards(args: { pool: AccountAddressInput; }): Promise; /** * Get delegated pools by delegator address * * @param args.user Delegator address * @returns Delegated pools */ getDelegatedPools(args: { user: AccountAddressInput; }): Promise; } /** * A class to handle all `Build` transaction operations */ declare class Build { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Build a simple transaction * * @param args.sender The sender account address * @param args.data The transaction data * @param args.options optional. Optional transaction configurations * @param args.withFeePayer optional. Whether there is a fee payer for the transaction * * @returns SimpleTransaction */ simple(args: { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; }): Promise; /** * Build a multi agent transaction * * @param args.sender The sender account address * @param args.data The transaction data * @param args.secondarySignerAddresses An array of the secondary signers account addresses * @param args.options optional. Optional transaction configurations * @param args.withFeePayer optional. Whether there is a fee payer for the transaction * * @returns MultiAgentTransaction */ multiAgent(args: { sender: AccountAddressInput; data: InputGenerateTransactionPayloadData; secondarySignerAddresses: AccountAddressInput[]; options?: InputGenerateTransactionOptions; withFeePayer?: boolean; }): Promise; } /** * A class to handle all `Simulate` transaction operations */ declare class Simulate { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Simulate a simple transaction * * @param args.signerPublicKey The signer public key * @param args.transaction An instance of a raw transaction * @param args.options optional. Optional transaction configurations * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction * * @returns Array */ simple(args: { signerPublicKey: PublicKey; transaction: AnyRawTransaction; feePayerPublicKey?: PublicKey; options?: InputSimulateTransactionOptions; }): Promise>; /** * Simulate a multi agent transaction * * @param args.signerPublicKey The signer public key * @param args.transaction An instance of a raw transaction * @param args.secondarySignersPublicKeys An array of the secondary signers public keys * @param args.options optional. Optional transaction configurations * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction * * @returns Array */ multiAgent(args: { signerPublicKey: PublicKey; transaction: AnyRawTransaction; secondarySignersPublicKeys: Array; feePayerPublicKey?: PublicKey; options?: InputSimulateTransactionOptions; }): Promise>; /** * Simulate a transaction * * @param args.transaction An instance of a raw transaction * @param args.options optional. Optional transaction configurations * * @returns Array */ mock(args: { transaction: AnyRawTransaction; options?: InputSimulateTransactionOptions; }): Promise>; } /** * A class to handle all `Submit` transaction operations */ declare class Submit { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Submit a simple transaction * * @param args.transaction An instance of a raw transaction * @param args.senderAuthenticator optional. The sender account authenticator * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction * * @returns PendingTransactionResponse */ simple(args: { transaction: AnyRawTransaction; senderAuthenticator: AccountAuthenticator; feePayerAuthenticator?: AccountAuthenticator; }): Promise; /** * Submit a multi agent transaction * * @param args.transaction An instance of a raw transaction * @param args.senderAuthenticator optional. The sender account authenticator * @param args.additionalSignersAuthenticators An array of the secondary signers account authenticators * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction * * @returns PendingTransactionResponse */ multiAgent(args: { transaction: AnyRawTransaction; senderAuthenticator: AccountAuthenticator; additionalSignersAuthenticators: Array; feePayerAuthenticator?: AccountAuthenticator; }): Promise; /** * Submit a multi auth key transaction * * @param args.transaction An instance of a raw transaction * @param args.publicKeys An array of the signers public key * @param args.signatures An array of the signature * * @returns PendingTransactionResponse */ multiAuthKey(args: { transaction: AnyRawTransaction; publicKeys: Array; signatures: Array; }): Promise; } /** * A wrapper that handles and manages an account sequence number. * * Submit up to `maximumInFlight` transactions per account in parallel with a timeout of `sleepTime` * If local assumes `maximumInFlight` are in flight, determine the actual committed state from the network * If there are less than `maximumInFlight` due to some being committed, adjust the window * If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating * If ever waiting more than `maxWaitTime` restart the sequence number to the current on-chain state * * Assumptions: * Accounts are expected to be managed by a single AccountSequenceNumber and not used otherwise. * They are initialized to the current on-chain state, so if there are already transactions in * flight, they may take some time to reset. * Accounts are automatically initialized if not explicitly * * Notes: * This is co-routine safe, that is many async tasks can be reading from this concurrently. * The state of an account cannot be used across multiple AccountSequenceNumber services. * The synchronize method will create a barrier that prevents additional nextSequenceNumber * calls until it is complete. * This only manages the distribution of sequence numbers it does not help handle transaction * failures. * If a transaction fails, you should call synchronize and wait for timeouts. */ declare class AccountSequenceNumber { readonly endlessConfig: EndlessConfig; readonly account: Account$1; lastUncommintedNumber: bigint | null; currentNumber: bigint | null; /** * We want to guarantee that we preserve ordering of workers to requests. * * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time, * which can result in race conditions and data inconsistency. * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition. * * The ideal solution is likely that each thread grabs the next number from a incremental integer. * When they complete, they increment that number and that entity is able to enter the `lock`. * That would guarantee ordering. */ lock: boolean; maxWaitTime: number; maximumInFlight: number; sleepTime: number; constructor(endlessConfig: EndlessConfig, account: Account$1, maxWaitTime: number, maximumInFlight: number, sleepTime: number); /** * Returns the next available sequence number for this account * * @returns next available sequence number */ nextSequenceNumber(): Promise; /** * Initializes this account with the sequence number on chain */ initialize(): Promise; /** * Updates this account sequence number with the one on-chain * * @returns on-chain sequence number for this account */ update(): Promise; /** * Synchronizes local sequence number with the seqeunce number on chain for this account. * * Poll the network until all submitted transactions have either been committed or until * the maximum wait time has elapsed */ synchronize(): Promise; } /** * The AsyncQueue class is an async-aware data structure that provides a queue-like * behavior for managing asynchronous tasks or operations. * It allows to enqueue items and dequeue them asynchronously. * This is not thread-safe but it is async concurrency safe and * it does not guarantee ordering for those that call into and await on enqueue. */ declare class AsyncQueue { readonly queue: T[]; private pendingDequeue; private cancelled; /** * The enqueue method adds an item to the queue. If there are pending dequeued promises, * in the pendingDequeue, it resolves the oldest promise with the enqueued item immediately. * Otherwise, it adds the item to the queue. * * @param item T */ enqueue(item: T): void; /** * The dequeue method returns a promise that resolves to the next item in the queue. * If the queue is not empty, it resolves the promise immediately with the next item. * Otherwise, it creates a new promise. The promise's resolve function is stored * in the pendingDequeue with a unique counter value as the key. * The newly created promise is then returned, and it will be resolved later when an item is enqueued. * * @returns Promise */ dequeue(): Promise; /** * The isEmpty method returns whether the queue is empty or not. * * @returns boolean */ isEmpty(): boolean; /** * The cancel method cancels all pending promises in the queue. * It rejects the promises with a AsyncQueueCancelledError error, * ensuring that any awaiting code can handle the cancellation appropriately. */ cancel(): void; /** * The isCancelled method returns whether the queue is cancelled or not. * * @returns boolean */ isCancelled(): boolean; /** * The pendingDequeueLength method returns the length of the pendingDequeue. * * @returns number */ pendingDequeueLength(): number; } declare const promiseFulfilledStatus = "fulfilled"; declare enum TransactionWorkerEventsEnum { TransactionSent = "transactionSent", TransactionSendFailed = "transactionSendFailed", TransactionExecuted = "transactionExecuted", TransactionExecutionFailed = "transactionExecutionFailed", ExecutionFinish = "executionFinish" } interface TransactionWorkerEvents { transactionSent: (data: SuccessEventData) => void; transactionSendFailed: (data: FailureEventData) => void; transactionExecuted: (data: SuccessEventData) => void; transactionExecutionFailed: (data: FailureEventData) => void; executionFinish: (data: ExecutionFinishEventData) => void; } type ExecutionFinishEventData = { message: string; }; type SuccessEventData = { message: string; transactionHash: string; }; type FailureEventData = { message: string; error: string; }; /** * TransactionWorker provides a simple framework for receiving payloads to be processed. * * Once one `start()` the process and pushes a new transaction, the worker acquires * the current account's next sequence number (by using the AccountSequenceNumber class), * generates a signed transaction and pushes an async submission process into the `outstandingTransactions` queue. * At the same time, the worker processes transactions by reading the `outstandingTransactions` queue * and submits the next transaction to chain, it * 1) waits for resolution of the submission process or get pre-execution validation error * and 2) waits for the resolution of the execution process or get an execution error. * The worker fires events for any submission and/or execution success and/or failure. */ declare class TransactionWorker extends EventEmitter { readonly endlessConfig: EndlessConfig; readonly account: Account$1; readonly accountSequnceNumber: AccountSequenceNumber; readonly taskQueue: AsyncQueue<() => Promise>; started: boolean; /** * transactions payloads waiting to be generated and signed * * TODO support entry function payload from ABI builder */ transactionsQueue: AsyncQueue<[InputGenerateTransactionPayloadData, InputGenerateTransactionOptions | undefined]>; /** * signed transactions waiting to be submitted */ outstandingTransactions: AsyncQueue<[Promise, bigint]>; /** * transactions that have been submitted to chain */ sentTransactions: Array<[string, bigint, any]>; /** * transactions that have been committed to chain */ executedTransactions: Array<[string, bigint, any]>; /** * Provides a simple framework for receiving payloads to be processed. * * @param endlessConfig - a config object * @param sender - a sender as Account * @param maxWaitTime - the max wait time to wait before resyncing the sequence number * to the current on-chain state, default to 30 * @param maximumInFlight - submit up to `maximumInFlight` transactions per account. * Mempool limits the number of transactions per account to 100, hence why we default to 100. * @param sleepTime - If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating, default to 10 */ constructor(endlessConfig: EndlessConfig, account: Account$1, maxWaitTime?: number, maximumInFlight?: number, sleepTime?: number); /** * Gets the current account sequence number, * generates the transaction with the account sequence number, * adds the transaction to the outstanding transaction queue * to be processed later. */ submitNextTransaction(): Promise; /** * Reads the outstanding transaction queue and submits the transaction to chain. * * If the transaction has fulfilled, it pushes the transaction to the processed * transactions queue and fires a transactionsFulfilled event. * * If the transaction has failed, it pushes the transaction to the processed * transactions queue with the failure reason and fires a transactionsFailed event. */ processTransactions(): Promise; /** * Once transaction has been sent to chain, we check for its execution status. * @param sentTransaction transactions that were sent to chain and are now waiting to be executed * @param sequenceNumber the account's sequence number that was sent with the transaction */ checkTransaction(sentTransaction: PromiseFulfilledResult, sequenceNumber: bigint): Promise; /** * Push transaction to the transactions queue * * @param transactionData Transaction payload * @param transactionData.abi For all entry function payloads, the ABI to skip remote ABI lookups * @param options.maxGasAmount Maximum gas amount for the transaction * @param options.gasUnitPrice Gas unit price for the transaction * @param options.expireTimestamp expiration timestamp on the transaction * @param options.accountSequenceNumber the sequence number for the transaction */ push(transactionData: InputGenerateTransactionPayloadData, options?: InputGenerateTransactionOptions): Promise; /** * Generates a signed transaction that can be submitted to chain * @param account an Endless account * @param sequenceNumber a sequence number the transaction will be generated with * @returns */ generateNextTransaction(account: Account$1, sequenceNumber: bigint): Promise; /** * Starts transaction submission and transaction processing. */ run(): Promise; /** * Starts the transaction management process. */ start(): void; /** * Stops the the transaction management process. */ stop(): void; } declare class TransactionManagement extends EventEmitter { account: Account$1; transactionWorker: TransactionWorker; readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Internal function to start the transaction worker and * listen to worker events * * @param args.sender The sender account to sign and submit the transaction */ private start; /** * Internal function to push transaction data to the transaction worker. * * @param args.data An array of transaction payloads * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber) * * TODO - make this public once worker supports adding transactions to existing queue */ private push; /** * Internal function to start listening to transaction worker events * * TODO - should we ask events to listen to as an input? */ private registerToEvents; /** * Send batch transactions for a single account. * * This function uses a transaction worker that receives payloads to be processed * and submitted to chain. * Note that this process is best for submitting multiple transactions that * dont rely on each other, i.e batch funds, batch token mints, etc. * * If any worker failure, the functions throws an error. * * @param args.sender The sender account to sign and submit the transaction * @param args.data An array of transaction payloads * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber) * * @return void. Throws if any error */ forSingleAccount(args: { sender: Account$1; data: InputGenerateTransactionPayloadData[]; options?: Omit; }): void; } declare class Transaction { readonly config: EndlessConfig; readonly build: Build; readonly simulate: Simulate; readonly submit: Submit; readonly batch: TransactionManagement; constructor(config: EndlessConfig); /** * Queries on-chain transactions. This function will not return pending * transactions. For that, use `getTransactionsByHash`. * * @example * const transactions = await endless.getTransactions() * * @param args.options.offset The number transaction to start with * @param args.options.limit Number of results to return * * @returns Array of on-chain transactions */ getTransactions(args?: { options?: PaginationArgs; }): Promise; /** * Queries on-chain transaction by version. This function will not return pending transactions. * * @example * const transaction = await endless.getTransactions({ledgerVersion:1}) * * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number. * @returns On-chain transaction. Only on-chain transactions have versions, so this * function cannot be used to query pending transactions. */ getTransactionByVersion(args: { ledgerVersion: AnyNumber; }): Promise; /** * Queries on-chain transaction by transaction hash. This function will return pending transactions. * * @example * const transaction = await endless.getTransactionByHash({transactionHash:"0x123"}) * * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix. * @returns Transaction from mempool (pending) or on-chain (committed) transaction */ getTransactionByHash(args: { transactionHash: HexInput; }): Promise; /** * Defines if specified transaction is currently in pending state * * To create a transaction hash: * * 1. Create a hash message from the bytes: "Endless::Transaction" bytes + the BCS-serialized Transaction bytes. * 2. Apply hash algorithm SHA3-256 to the hash message bytes. * 3. Hex-encode the hash bytes with 0x prefix. * * @example * const isPendingTransaction = await endless.isPendingTransaction({transactionHash:"0x123"}) * * @param args.transactionHash A hash of transaction * @returns `true` if transaction is in pending state and `false` otherwise */ isPendingTransaction(args: { transactionHash: HexInput; }): Promise; /** * Waits for a transaction to move past the pending state. * * There are 4 cases. * 1. Transaction is successfully processed and committed to the chain. * - The function will resolve with the transaction response from the API. * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain. * - The function will throw an EndlessApiError with an HTTP status code indicating some problem with the request. * 3. Transaction is committed but execution failed, meaning no changes were * written to the blockchain state. * - If `checkSuccess` is true, the function will throw a FailedTransactionError * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false. * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds. * - The function will throw a WaitForTransactionError * * @example * const transaction = await endless.waitForTransaction({transactionHash:"0x123"}) * * @param args.transactionHash The hash of a transaction previously submitted to the blockchain. * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds. * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed. * Defaults to true. See case 3 above. * @returns The transaction on-chain. See above for more details. */ waitForTransaction(args: { transactionHash: HexInput; options?: WaitForTransactionOptions; }): Promise; /** * Gives an estimate of the gas unit price required to get a * transaction on chain in a reasonable amount of time. * For more information {@link https://api.mainnet.endlesslabs.com/v1/spec#/operations/estimate_gas_price} * * @returns Object holding the outputs of the estimate gas API * * @example * const gasPrice = await endless.waitForTransaction() */ getGasPriceEstimation(): Promise; /** * Get daily transaction count from indexer * * @param args.options.days Number of days * @param args.options.tz Timezone offset in hours * @returns Daily transaction count list */ getDailyTransactions(args?: { options?: { days?: AnyNumber; tz?: number; }; }): Promise; /** * Get transaction versions filtered by user transaction type from indexer * * @param args.options.page The page number * @param args.options.pageSize The page size * @returns PageableU64 */ getUserTransactions(args?: { options?: PaginationArgsOfIndexer; }): Promise; /** * Returns a signing message for a transaction. * * This allows a user to sign a transaction using their own preferred signing method, and * then submit it to the network. * * @example * const transaction = await endless.transaction.build.simple({...}) * const message = await endless.getSigningMessage({transaction}) * * @param args.transaction A raw transaction for signing elsewhere */ getSigningMessage(args: { transaction: AnyRawTransaction; }): Uint8Array; /** * Generates a transaction to publish a move package to chain. * * To get the `metadataBytes` and `byteCode`, can compile using Endless CLI with command * `endless move compile --save-metadata ...`, * For more info {@link https://endless.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module} * * @example * const transaction = await endless.publishPackageTransaction({ * account: alice, * metadataBytes, * moduleBytecode: [byteCode], * }) * * @param args.account The publisher account * @param args.metadataBytes The package metadata bytes * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order * * @returns A SimpleTransaction that can be simulated or submitted to chain */ publishPackageTransaction(args: { account: AccountAddressInput; metadataBytes: HexInput; moduleBytecode: Array; options?: InputGenerateTransactionOptions; }): Promise; /** * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for * the account. * Note: Only legacy Ed25519 scheme is supported for now. * More info: {@link https://endless.dev/guides/account-management/key-rotation/} * * @example * const response = await endless.rotateAuthKey({ * fromAccount: alice, * toNewPrivateKey: new ED25519PublicKey("0x123"), * }) * * @param args.fromAccount The account to rotate the auth key for * @param args.toNewPrivateKey The new private key to rotate to * * @returns PendingTransactionResponse */ rotateAuthKey(args: { fromAccount: Account$1; toNewPrivateKey: PrivateKey; }): Promise; /** * Sign a transaction that can later be submitted to chain * * @example * const transaction = await endless.transaction.build.simple({...}) * const transaction = await endless.transaction.sign({ * signer: alice, * transaction * }) * * @param args.signer The signer account * @param args.transaction A raw transaction to sign on * * @returns AccountAuthenticator */ sign(args: { signer: Account$1; transaction: AnyRawTransaction; }): AccountAuthenticator; /** * Sign a transaction as a fee payer that can later be submitted to chain * * @example * const transaction = await endless.transaction.build.simple({...}) * const transaction = await endless.transaction.signAsFeePayer({ * signer: alice, * transaction * }) * * @param args.signer The fee payer signer account * @param args.transaction A raw transaction to sign on * * @returns AccountAuthenticator */ signAsFeePayer(args: { signer: Account$1; transaction: AnyRawTransaction; }): AccountAuthenticator; /** * @deprecated Prefer to use `endless.transaction.batch.forSingleAccount()` * * Batch transactions for a single account. * * This function uses a transaction worker that receives payloads to be processed * and submitted to chain. * Note that this process is best for submitting multiple transactions that * dont rely on each other, i.e batch funds, batch token mints, etc. * * If any worker failure, the functions throws an error. * * @param args.sender The sender account to sign and submit the transaction * @param args.data An array of transaction payloads * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber) * * @return void. Throws if any error */ batchTransactionsForSingleAccount(args: { sender: Account$1; data: InputGenerateTransactionPayloadData[]; options?: Omit; }): Promise; /** * Sign and submit a single signer transaction to chain * * @param args.signer The signer account to sign the transaction * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses * * @example * const transaction = await endless.transaction.build.simple({...}) * const transaction = await endless.signAndSubmitTransaction({ * signer: alice, * transaction * }) * * @return PendingTransactionResponse */ signAndSubmitTransaction(args: { signer: Account$1; transaction: AnyRawTransaction; }): Promise; fundAccount(args: { signer: Account$1; address?: string; }): Promise; } /** * A class to query all `Table` Endless related queries */ declare class Table { readonly config: EndlessConfig; constructor(config: EndlessConfig); /** * Queries for a table item for a table identified by the handle and the key for the item. * Key and value types need to be passed in to help with key serialization and value deserialization. * * Note, this query calls the fullnode server * * @example https://api.devnet.endlesslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::endless_coin::EndlessCoin%3E * const tableItem = await endless.getTableItem({ * handle: "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca", * data: { * key_type: "address", // Move type of table key * value_type: "u128", // Move type of table value * key: "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935" // Value of table key * }, * }) * * @param args.handle A pointer to where that table is stored * @param args.data Object that describes table item * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version * * @returns Table item value rendered in JSON */ getTableItem(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg; }): Promise; } declare class EndlessAccount { readonly config: EndlessConfig; constructor(config: EndlessConfig); transferEDS(args: { sender: Account$1; recipient: AccountAddress; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise; transferCoin(args: { sender: Account$1; fungibleAssetMetadataAddress: AccountAddress; recipient: AccountAddress; amount: AnyNumber; options?: InputGenerateTransactionOptions; }): Promise; viewCoinBalance(account: AccountAddress, fungibleAssetMetadataAddress: AccountAddress): Promise; viewEDSBalance(account: AccountAddress): Promise; } /** * This class is the main entry point into Endless's * APIs and separates functionality into different namespaces. * * To use the SDK, create a new Endless instance to get access * to all the sdk functionality. * * @example * * const endless = new Endless(); */ declare class Endless { readonly config: EndlessConfig; readonly account: Account; readonly ans: ANS; readonly coin: Coin; readonly digitalAsset: DigitalAsset; readonly endlessAccount: EndlessAccount; readonly fungibleAsset: FungibleAsset; readonly general: General; readonly nft: NFT; readonly transaction: Transaction; readonly table: Table; readonly stake: Stake; constructor(settings?: EndlessConfig); } interface Endless extends Account, ANS, Coin, DigitalAsset, EndlessAccount, FungibleAsset, General, NFT, Stake, Table, Omit { } declare function getPaymentChecksum(simulateResult: UserTransactionResponse): Uint8Array; /** * The API response type * * @param status - the response status. i.e. 200 * @param statusText - the response message * @param data the response data * @param url the url the request was made to * @param headers the response headers * @param config (optional) - the request object * @param request (optional) - the request object */ interface EndlessResponse { status: number; statusText: string; data: Res; url: string; headers: any; config?: any; request?: Req; } /** * The type returned from an API error * * @param name - the error name "EndlessApiError" * @param url the url the request was made to * @param status - the response status. i.e. 400 * @param statusText - the response message * @param data the response data * @param request - the EndlessRequest */ declare class EndlessApiError extends Error { readonly url: string; readonly status: number; readonly statusText: string; readonly data: any; readonly request: EndlessRequest; constructor(request: EndlessRequest, response: EndlessResponse, message: string); } type DeserializableClass = { deserialize(deserializer: Deserializer): T; }; /** * Utility function that serializes and deserialize an object back into the same bundle as the sdk. * This is a workaround to have the `instanceof` operator work when input objects come from a different * bundle. * @param cls The class of the object to normalize * @param value the instance to normalize */ declare function normalizeBundle(cls: DeserializableClass, value: T): T; /** * Given a url and method, sends the request with axios and * returns the response. */ declare function request(options: ClientRequest, client: Client): Promise>; /** * The main function to use when doing an API request. * * @param options EndlessRequest * @param endlessConfig The config information for the SDK client instance * @returns the response or EndlessApiError */ declare function endlessRequest(options: EndlessRequest, endlessConfig: EndlessConfig, apiType: EndlessApiType): Promise>; type GetRequestOptions = { /** * The config for the API client */ endlessConfig: EndlessConfig; /** * The type of API endpoint to call e.g. fullnode, indexer, etc */ type: EndlessApiType; /** * The name of the API method */ originMethod: string; /** * The URL path to the API method */ path: string; /** * The content type of the request body */ contentType?: MimeType; /** * The accepted content type of the response of the API */ acceptType?: MimeType; /** * The query parameters for the request */ params?: Record; /** * Specific client overrides for this request to override endlessConfig */ overrides?: ClientConfig; }; type GetEndlessRequestOptions = Omit; /** * Main function to do a Get request * * @param options GetRequestOptions * @returns */ declare function get(options: GetRequestOptions): Promise>; declare function getEndlessFullNode(options: GetEndlessRequestOptions): Promise>; declare function getEndlessIndexer(options: GetEndlessRequestOptions): Promise>; declare function paginateWithCursor, Res extends Array<{}>>(options: GetEndlessRequestOptions): Promise; type PostRequestOptions = { /** * The config for the API client */ endlessConfig: EndlessConfig; /** * The type of API endpoint to call e.g. fullnode, indexer, etc */ type: EndlessApiType; /** * The name of the API method */ originMethod: string; /** * The URL path to the API method */ path: string; /** * The content type of the request body */ contentType?: MimeType; /** * The accepted content type of the response of the API */ acceptType?: MimeType; /** * The query parameters for the request */ params?: Record; /** * The body of the request, should match the content type of the request */ body?: any; /** * Specific client overrides for this request to override endlessConfig */ overrides?: ClientConfig; }; type PostEndlessRequestOptions = Omit; /** * Main function to do a Post request * * @param options PostRequestOptions * @returns */ declare function post(options: PostRequestOptions): Promise>; declare function postEndlessFullNode(options: PostEndlessRequestOptions): Promise>; declare function postEndlessIndexer(options: PostEndlessRequestOptions): Promise>; declare function postEndlessFaucet(options: PostEndlessRequestOptions): Promise>; /** * Makes a post request to the pepper service * * @param options GetEndlessRequestOptions * @returns EndlessResponse */ declare function postEndlessPepperService(options: PostEndlessRequestOptions): Promise>; declare function postEndlessProvingService(options: PostEndlessRequestOptions): Promise>; /** * This file contains the underlying implementations for exposed API surface in * the {@link api/keyless}. By moving the methods out into a separate file, * other namespaces and processes can access these methods without depending on the entire * keyless namespace and without having a dependency cycle error. */ declare function deriveKeylessAccount(args: { endlessConfig: EndlessConfig; jwt: string; ephemeralKeyPair: EphemeralKeyPair; pepper: HexInput; uidKey?: string; proofFetchCallback?: ProofFetchCallback; }): Promise; export { Account$1 as Account, AccountAddress, type AccountAddressInput, AccountAuthenticator, AccountAuthenticatorBls12381, AccountAuthenticatorEd25519, AccountAuthenticatorMock, AccountAuthenticatorMultiAuthKey, AccountAuthenticatorMultiEd25519, AccountAuthenticatorMultiKey, AccountAuthenticatorSingleKey, AccountAuthenticatorVariant, type AccountBalanceItem, type AccountBalancesResponse, type AccountData, AccountPublicKey, AccountSequenceNumber, type AccountSignature, AddressInvalidReason, type AnyNumber, AnyPublicKey, AnyPublicKeyVariant, type AnyRawTransaction, type AnyRawTransactionInstance, AnySignature, AnySignatureVariant, type AnyTransactionPayloadInstance, AuthenticationKey, type AuthenticationKeyScheme, type Block, type BlockEndInfo, type BlockEpilogueTransactionResponse, type BlockMetadataTransactionResponse, Bls12381PrivateKey, Bls12381PublicKey, Bls12381Signature, Bool, CKDPriv, ChainId, type Client, type ClientConfig, type ClientHeadersType, type ClientRequest, type ClientResponse, type CoinBalanceResponse, type CoinResponse, type CollectionResponse, type CommittedTransactionResponse, type CreateAccountFromPrivateKeyArgs, type CreateEd25519AccountFromPrivateKeyArgs, type CreateEd25519SingleKeyAccountFromPrivateKeyArgs, type CreateSingleKeyAccountFromPrivateKeyArgs, DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW, DEFAULT_TXN_TIMEOUT_SEC, type DecodedTableData, type DelegatedPoolResponse, type DelegationPoolResponse, type DeletedTableData, DeriveScheme, type DerivedKeys, type Deserializable, type DeserializableClass, Deserializer, type DirectWriteSet, ENDLESS_BIP44_REGEX, ENDLESS_COIN, ENDLESS_COIN_ID, ENDLESS_HARDENED_REGEX, EPK_HORIZON_SECS, Ed25519Account, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, type Ed25519SignerConstructorArgs, type Ed25519SignerFromDerivationPathArgs, Endless, EndlessApiError, EndlessApiType, EndlessConfig, type EndlessRequest, type EndlessResponse, type EndlessSettings, EntryFunction, type EntryFunctionABI, type EntryFunctionArgument, type EntryFunctionArgumentTypes, EntryFunctionBytes, type EntryFunctionPayloadResponse, EphemeralCertificate, EphemeralCertificateVariant, EphemeralKeyPair, EphemeralPublicKey, EphemeralPublicKeyVariant, EphemeralSignature, EphemeralSignatureVariant, type Event, type EventGuid, type ExecutionFinishEventData, type FailureEventData, FeePayerRawTransaction, FixedBytes, type FullNodeConfig, type FunctionABI, type FungibleAssetMetadataResponse, type GasEstimation, type GenerateAccount, type GenerateAccountArgs, type GenerateAccountWithEd25519, type GenerateAccountWithSingleSignerSecp256k1Key, type GenerateEd25519AccountArgs, type GenerateEd25519SingleKeyAccountArgs, type GenerateSingleKeyAccountArgs, type GenesisPayload, type GenesisTransactionResponse, type GetAccountCoinData, type GetAccountCoinsDataResponse, type GetAccountsBalancesRequest, type GetAccountsCoinBalanceData, type GetAccountsCoinBalanceResponse, type GetCoinDataResponse, type GetCreatedCoinDataResponse, type GetEndlessRequestOptions, type GetRequestOptions, Groth16Zkp, HARDENED_OFFSET, Hex, type HexInput, HexInvalidReason, type HoldersItem, Identifier, type IndexerConfig, type InputEntryFunctionData, type InputEntryFunctionDataWithABI, type InputEntryFunctionDataWithRemoteABI, type InputGenerateMultiAgentRawTransactionArgs, type InputGenerateMultiAgentRawTransactionData, type InputGenerateRawTransactionArgs, type InputGenerateSingleSignerRawTransactionArgs, type InputGenerateSingleSignerRawTransactionData, type InputGenerateTransactionData, type InputGenerateTransactionOptions, type InputGenerateTransactionPayloadData, type InputGenerateTransactionPayloadDataWithABI, type InputGenerateTransactionPayloadDataWithRemoteABI, type InputMultiSigData, type InputMultiSigDataWithABI, type InputMultiSigDataWithRemoteABI, type InputScriptData, type InputSimulateTransactionData, type InputSimulateTransactionDataMock, type InputSimulateTransactionOptions, type InputSubmitTransactionData, type InputViewFunctionData, type InputViewFunctionDataWithABI, type InputViewFunctionDataWithRemoteABI, KeyType, KeylessAccount, KeylessConfiguration, KeylessPublicKey, KeylessSignature, type LedgerInfo, type LedgerVersionArg, MAX_AUD_VAL_BYTES, MAX_COMMITED_EPK_BYTES, MAX_EXTRA_FIELD_BYTES, MAX_ISS_VAL_BYTES, MAX_JWT_HEADER_B64_BYTES, MAX_UID_KEY_BYTES, MAX_UID_VAL_BYTES, MimeType, ModuleId, MoveAbility, type MoveAddressType, type MoveFunction, type MoveFunctionGenericTypeParam, type MoveFunctionId, MoveFunctionVisibility, type MoveModule, type MoveModuleBytecode, type MoveModuleId, type MoveObjectType, MoveOption, type MoveOptionType, type MoveResource, type MoveScriptBytecode, MoveString, type MoveStruct, type MoveStructField, type MoveStructId, type MoveStructType, type MoveType, type MoveUint128Type, type MoveUint16Type, type MoveUint256Type, type MoveUint32Type, type MoveUint64Type, type MoveUint8Type, type MoveValue, MoveVector, MultiAgentRawTransaction, MultiAgentTransaction, MultiAuthKeyAccount, MultiAuthKeyPublicKey, MultiAuthKeySignature, MultiEd25519PublicKey, MultiEd25519Signature, MultiKey, MultiKeyAccount, MultiKeySignature, MultiSig, MultiSigTransactionPayload, type MultisigPayloadResponse, NFT, Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToIndexerAPIV2, NetworkToNetworkName, NetworkToNodeAPI, NetworkToProverAPI, type NftCollectionHistoryRecord, type NftHistoryRecordToken, type NftMetrics, type NftOwnedCollectionResponse, type NftTokenHistoryRecord, type NftTokenResponse, type OrderBy, type OrderByArg, type OrderByValue, type PageableCoinResponse, type PageableCollectionResponse, type PageableFungibleAssetMetadataResponse, type PageableHoldersItem, type PageableNftCollectionHistoryRecord, type PageableNftOwnedCollectionResponse, type PageableNftTokenHistoryRecord, type PageableNftTokenResponse, type PageableU64, type PaginationArgs, type PaginationArgsOfIndexer, ParsingError, type ParsingResult, type PendingTransactionResponse, type PoolRewardResponse, type PostEndlessRequestOptions, type PostRequestOptions, type PrivateKey, type PrivateKeyFromDerivationPathArgs, type ProofFetchCallback, type ProofFetchEvents, type ProofFetchFailure, type ProofFetchStatus, type ProofFetchSuccess, PublicKey, RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT, RawTransaction, RawTransactionWithData, RoleType, RotationProofChallenge, type Royalty, Script, type ScriptFunctionArgument, type ScriptFunctionArgumentTypes, type ScriptPayloadResponse, ScriptTransactionArgumentVariants, type ScriptWriteSet, type SearchResponse, Secp256k1PrivateKey, Secp256k1PublicKey, Secp256k1Signature, Serializable, Serializer, Signature, SignedTransaction, SigningScheme, SigningSchemeInput, type SimpleEntryFunctionArgumentTypes, SimpleTransaction, SingleKeyAccount, type SingleKeySignerConstructorArgs, type SingleKeySignerFromDerivationPathArgs, type SingleKeySignerGenerateArgs, Stake, type StateCheckpointTransactionResponse, type Status, StructTag, type SuccessEventData, type TableItemRequest, type TokenStandard, type TransactionArgument, TransactionAuthenticator, TransactionAuthenticatorEd25519, TransactionAuthenticatorFeePayer, TransactionAuthenticatorMultiAgent, TransactionAuthenticatorMultiEd25519, TransactionAuthenticatorSingleSender, TransactionAuthenticatorVariant, type TransactionEd25519Signature, type TransactionFeePayerSignature, type TransactionMultiAgentSignature, type TransactionMultiEd25519Signature, TransactionPayload, TransactionPayloadEntryFunction, TransactionPayloadMultiSig, type TransactionPayloadResponse, TransactionPayloadScript, TransactionPayloadVariants, type TransactionResponse, TransactionResponseType, type TransactionSecp256k1Signature, type TransactionSignature, TransactionVariants, TransactionWorker, type TransactionWorkerEvents, TransactionWorkerEventsEnum, type TypeArgument, TypeTag, TypeTagAddress, TypeTagBool, TypeTagGeneric, TypeTagParserError, TypeTagParserErrorType, TypeTagReference, TypeTagSigner, TypeTagStruct, TypeTagU128, TypeTagU16, TypeTagU256, TypeTagU32, TypeTagU64, TypeTagU8, TypeTagVariants, TypeTagVector, U128, U16, U256, U32, U64, U8, type Uint128, type Uint16, type Uint256, type Uint32, type Uint64, type Uint8, type UserTransactionResponse, type ValidatorTransactionResponse, type VerifyEd25519SignatureArgs, type VerifyMultiAuthKeySignatureArgs, type VerifyMultiKeySignatureArgs, type VerifySignatureArgs, type VerifySingleKeySignatureArgs, type ViewFunctionABI, type WaitForTransactionOptions, type WhereArg, type WriteSet, type WriteSetChange, type WriteSetChangeDeleteModule, type WriteSetChangeDeleteResource, type WriteSetChangeDeleteTableItem, type WriteSetChangeWriteModule, type WriteSetChangeWriteResource, type WriteSetChangeWriteTableItem, ZeroKnowledgeSig, buildTransaction, checkOrConvertArgument, convertArgument, deriveKey, deriveKeylessAccount, deriveTransactionType, deserializeFromScriptArgument, endlessCoinStructTag, endlessRequest, ensureBoolean, fetchEntryFunctionAbi, fetchFunctionAbi, fetchViewFunctionAbi, findFirstNonSignerArg, generateMockSignedTransactionForSimulation, generateRawTransaction, generateSignedTransaction, generateSignedTransactionForSimulation, generateSigningMessage, generateSigningMessageForSerializable, generateSigningMessageForTransaction, generateTransactionPayload, generateTransactionPayloadWithABI, generateUserTransactionHash, generateViewFunctionPayload, generateViewFunctionPayloadWithABI, get, getAuthenticatorForSimulation, getEndlessFullNode, getEndlessIndexer, getFunctionParts, getKeylessConfig, getPaymentChecksum, hashValues, isBcsAddress, isBcsBool, isBcsFixedBytes, isBcsString, isBcsU128, isBcsU16, isBcsU256, isBcsU32, isBcsU64, isBcsU8, isBlockEpilogueTransactionResponse, isBlockMetadataTransactionResponse, isBool, isEd25519Signature, isEncodedEntryFunctionArgument, isFeePayerSignature, isGenesisTransactionResponse, isLargeNumber, isMultiAgentSignature, isMultiEd25519Signature, isNull, isNumber, isPendingTransactionResponse, isScriptDataInput, isSecp256k1Signature, isStateCheckpointTransactionResponse, isString, isUserTransactionResponse, isValidBIP44Path, isValidHardenedPath, isValidatorTransactionResponse, mnemonicToSeed, normalizeBundle, objectStructTag, optionStructTag, outOfRangeErrorMessage, paginateWithCursor, parseTypeTag, post, postEndlessFaucet, postEndlessFullNode, postEndlessIndexer, postEndlessPepperService, postEndlessProvingService, promiseFulfilledStatus, request, splitPath, standardizeTypeTags, stringStructTag, throwTypeMismatch, validateNumberInRange };