Interface for local sdk exclusive methods

Hierarchy (view full)

Implements

Constructors

Properties

accountId: string
actions: __module = actions
connected: boolean = false
name: string = ""
networkId: string
provider: Near
rpc_url: string = ""
signer: Signer
wallet: KeyPair

Methods

  • Connects to a wallet using a private key

    Parameters

    • privateKey: string

      The private key of the wallet

    • options: {
          accountId: string;
          networkId: string;
      }
      • accountId: string

        The accountId to use with this private key

      • networkId: string

    Returns Promise<KeyPair>

    The wallet object

  • Create a new account

    Parameters

    • accountId: string

      The new accountId

    • amount: string

      The amount of Ⓝ to deposit to the new account

    • Optionaloptions: {
          curve?: "ed25519" | "secp256k1";
      }

      Specify the curve to use when generating the key pair for the new account

      • Optionalcurve?: "ed25519" | "secp256k1"

    Returns Promise<{
        keyPair: KeyPair;
        signedTx: Uint8Array<ArrayBufferLike>;
    }>

    The signed transaction for creating the new account on Near, and its key pair

  • Alias

    Creates a signed transaction to transfer default chain currency

    Parameters

    • receiver: string

      The receiver's address

    • amount: string

      The amount to transfer

    • Optionaloptions: any

      Options

    Returns Promise<Uint8Array<ArrayBufferLike>>

    The signed transaction

    prepareTransfer

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

    Parameters

    • payments: IPayOptions[]

      A list of transfers to prepare

    • Optionaloptions: {}

      Options

      Returns Promise<Uint8Array<ArrayBufferLike>[]>

      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>

      The signed message

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

      Parameters

      • txs: Transaction[]
      • Optionaloptions: {
            privateKey?: string;
        }

        Options

        • OptionalprivateKey?: string

      Returns Promise<Uint8Array<ArrayBufferLike>[]>

    • Verifies a message using the connected wallet

      Parameters

      • message: string

        The message to verify

      • signature: string

        The signature to verify

      • publicKey: string

      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