Class DefaultChainAbstract

Hierarchy (view full)

Constructors

Properties

connected: boolean = false
name: string = ""
provider: any = null
rpc_url: string = ""
signer: any = null
wallet: any = null

Methods

  • Connects to a wallet using a private key

    Parameters

    • privateKey: string

      The private key of the wallet

    • Optionaloptions: {}

      Returns Promise<any>

      The wallet object

    • Gets the balance of a wallet

      Parameters

      • address: string

        The wallet address

      • Optionaloptions: {}

        Options

        Returns Promise<string>

        The balance of the wallet as a string

      • Alias

        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: any

          Options

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

        The signed transaction

        prepareTransfer

      • Creates a list of signed transactions to transfer default chain currency

        Parameters

        • payments: IPayOptions[]

          A list of transfers to prepare

        • options: {}

          Options

          Returns Promise<any[]>

          An ordered list of signed transactions

        • 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

        • Signs a message using the connected wallet

          Parameters

          • message: string

            The message to sign

          • Optionaloptions: {
                privateKey?: string;
            }

            Options

            • OptionalprivateKey?: string

          Returns Promise<string | Uint8Array<ArrayBufferLike>>

          The signed message

        • Signs a transaction using the connected wallet

          Type Parameters

          Parameters

          • this: T
          • tx: Tx

            The transaction to sign

          • Optionaloptions: any

            Options

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

          The signed transaction

        • Signs a list of transactions using the connected wallet. The transaction nonce is incremented for each transaction in order of appearance.

          Parameters

          • transactions: any[]

            A list of transactions to sign

          • Optionaloptions: {
                privateKey?: string;
            }

            Options

            • OptionalprivateKey?: string

          Returns Promise<any[]>

        • Verifies a message using the connected wallet

          Parameters

          • message: string

            The message to verify

          • signature: string | Uint8Array<ArrayBufferLike>

            The signature to verify

          • publicKey: string | Uint8Array<ArrayBufferLike>

          Returns Promise<boolean>

          A boolean indicating if the message was verified

        • Creates a new instance of this sdk

          Type Parameters

          Parameters

          • this: (new (rpc_url: string) => T)
              • new (rpc_url): T
              • Parameters

                • rpc_url: string

                Returns T

          • rpc_url: string = ""

            The RPC URL

          Returns Promise<T>

          The sdk instance connected to the RPC provider