Interface for local sdk exclusive methods

Hierarchy (view full)

Constructors

Properties

connected: boolean = false
name: string = ""
provider: TronWeb
rpc_url: string = ""
signer: any = null
wallet: TronWeb
SUN_PER_TRX: 1000000 = 1_000_000

Methods

  • Connects to a wallet using a private key

    Parameters

    • privateKey: string

      The private key of the wallet

    Returns Promise<TronWeb>

    The wallet object

  • Creates a new TRON wallet

    Parameters

    • _password: string

      Password parameter (reserved for future encryption support)

    Returns Promise<{
        address: string;
        privateKey: string;
    }>

    Object containing the wallet address and private key

    Currently returns unencrypted private key. Password parameter is accepted for interface compatibility but not yet used for encryption.

  • Gets the balance of a wallet

    Parameters

    • address: string

      The wallet address

    Returns Promise<string>

    The balance of the wallet as a string

  • Prepare a TRX transfer transaction

    Parameters

    • receiver: string

      Recipient address (base58 format)

    • amount: string

      Amount in SUN (1 TRX = 1,000,000 SUN)

    • Optionaloptions: {
          privateKey?: string;
      }

      Options including optional privateKey

      • OptionalprivateKey?: string

    Returns Promise<any>

    Signed transaction ready to broadcast

  • Prepare multiple TRX transfer transactions

    Parameters

    • payments: IPayOptions[]

      Array of payments with address and amount (in SUN)

    • Optionaloptions: {
          privateKey?: string;
      }

      Options including optional privateKey

      • OptionalprivateKey?: string

    Returns Promise<any[]>

    Array 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

  • Sets the RPC URL only. Use await instance.connect() to connect to the rpc provider

    Parameters

    • rpc_url: string

    Returns void

  • 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

    • 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

      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

  • Convert SUN to TRX with full precision preservation

    Parameters

    • sun: bigint

      Amount in SUN as bigint

    Returns string

    Amount in TRX as a decimal string (e.g., "123.456789")

    This method returns a string to preserve precision for large values. For display purposes, you may want to parse this with a BigNumber library.