Aptos SDK implementation following official @aptos-labs/ts-sdk patterns

Hierarchy (view full)

Implements

  • AptosDefaultChain

Constructors

Properties

account: Account = null
aptos: Aptos
connected: boolean = false
name: string = ""
network: Network
provider: Aptos
rpc_url: string = ""
signer: any = null
wallet: any = null

Methods

  • Connects to the Aptos network

    Returns Promise<boolean>

    A boolean indicating whether the connection was successful

  • Connects to a wallet using a private key

    Parameters

    • privateKey: string

      The private key of the wallet (hex string)

    Returns Promise<Account>

    The Account object

  • Gets the APT balance from the Aptos network given an address

    Parameters

    • address: string

      The wallet address

    Returns Promise<any>

    XM operation object for Demos Network relay

  • Gets the APT balance directly from Aptos RPC given an address

    The other get balance methods use this method to get the balance

    Parameters

    • address: string

      The wallet address

    Returns Promise<string>

    The balance as a string (in Octas)

  • Gets the APT balance from the Aptos network given an address

    Parameters

    • address: string

      The wallet address

    Returns Promise<any>

    XM operation object for Demos Network relay

  • Gets a coin balance from the Aptos network given a coin type and address

    Parameters

    • coinType: string

      The coin type (e.g., "0x1::aptos_coin::AptosCoin")

    • address: string

      The wallet address

    Returns Promise<any>

    XM operation object for Demos Network relay

  • Gets the balance of a specific coin type directly from Aptos RPC given a coin type and address

    The other get balance methods use this method to get the balance

    Parameters

    • coinType: string

      The coin type (e.g., "0x1::aptos_coin::AptosCoin")

    • address: string

      The wallet address

    Returns Promise<string>

    The balance as a string

  • Gets the public key of the connected wallet

    Returns string

    The public key as hex string

  • Check if an address is valid

    Parameters

    • address: string

      The address to validate

    Returns boolean

    Boolean indicating if the address is valid

  • Creates a signed transaction to transfer APT

    Parameters

    • receiver: string

      The receiver's address

    • amount: string

      The amount to transfer (in Octas)

    Returns Promise<string>

    The signed Aptos transaction as hex string

  • Creates multiple signed transactions to transfer APT

    Parameters

    Returns Promise<string[]>

    Array of signed Aptos transactions as hex strings

  • Creates a signed transaction to transfer default chain currency

    Type Parameters

    Parameters

    • this: T
    • receiver: string

      The receiver's address

    • amount: string

      The amount to transfer

    • Optionaloptions: Options

      Options

    Returns Promise<Awaited<ReturnType<T["preparePays"]>>[number]>

    The signed transaction

  • Creatthis.provider = new JsonRpcProvider(this.rpc_url)es a list of signed transactions to transfer default chain currency

    Type Parameters

    Parameters

    Returns Promise<Awaited<ReturnType<T["preparePays"]>>>

    An ordered list of signed transactions

  • Read from a smart contract via Demos Network XM operation (default behavior)

    Parameters

    • moduleAddress: string

      The module address

    • moduleName: string

      The module name

    • functionName: string

      The function name

    • args: any[]

      Function arguments

    • typeArguments: string[] = []

      Type arguments for generic functions (optional)

    Returns Promise<XMScript>

    The XMScript object ready to be used in a Demos transaction

  • Read from a smart contract directly (bypasses Demos Network) Use only when explicit direct access is needed

    Parameters

    • moduleAddress: string

      The module address

    • moduleName: string

      The module name

    • functionName: string

      The function name

    • args: any[]

      Function arguments

    • typeArguments: string[] = []

      Type arguments for generic functions (optional)

    Returns Promise<any>

    The function result

  • Signs a message using the connected wallet

    Parameters

    • message: string

      The message to sign

    Returns Promise<string>

    The signed message as hex string

  • Signs a transaction using the connected wallet

    Parameters

    • transaction: SimpleTransaction

      The transaction to sign

    Returns Promise<string>

    The signed Aptos transaction as hex string

  • Signs multiple transactions

    Parameters

    • transactions: SimpleTransaction[]

      Array of transactions to sign

    Returns Promise<string[]>

    Array of signed Aptos transactions as hex strings

  • Verifies a message signature

    Parameters

    • message: string

      The original message

    • signature: string

      The signature to verify

    • publicKey: string

      The public key to verify against

    Returns Promise<boolean>

    Boolean indicating if the signature is valid

  • Wait for transaction confirmation

    Parameters

    • transactionHash: string

      The transaction hash

    Returns Promise<UserTransactionResponse>

    The transaction response

  • Prepare a smart contract write transaction for Demos Network relay Builds transaction for XM operations - does NOT execute directly All contract writes must go through Demos Network XM system

    Parameters

    • moduleAddress: string

      The module address

    • moduleName: string

      The module name

    • functionName: string

      The function name

    • args: any[]

      Function arguments

    • typeArguments: string[] = []

      Type arguments (optional)

    Returns Promise<XMScript>

    The XMScript object ready to be used in a Demos transaction