toncenter-js
    Preparing search index...

    Class TonHttpApiV2

    Index

    Constructors

    Methods

    • Get all possible address forms.

      Parameters

      • address: string

      Returns Promise<
          {
              bounceable: { b64: string; b64url: string };
              given_type:
                  | "raw_form"
                  | "dns"
                  | "friendly_bounceable"
                  | "friendly_non_bounceable";
              non_bounceable: { b64: string; b64url: string };
              raw_form: string;
              test_only: boolean;
          },
      >

    • Estimate fees required for query processing. body, init-code and init-data accepted in serialized format (b64-encoded).

      Parameters

      • address: string
      • body: string
      • init_code: string
      • init_data: string
      • ignore_chksig: boolean

      Returns Promise<
          {
              "@type": "query.fees";
              destination_fees: {
                  "@type": "fees";
                  fwd_fee: string
                  | number;
                  gas_fee: string | number;
                  in_fwd_fee: string | number;
                  storage_fee: string | number;
              }[];
              source_fees: {
                  "@type": "fees";
                  fwd_fee: string
                  | number;
                  gas_fee: string | number;
                  in_fwd_fee: string | number;
                  storage_fee: string | number;
              };
          },
      >

    • Get balance (in nanotons) of a given address.

      Parameters

      • address: string

      Returns Promise<string | number>

    • Get basic information about the address: balance, code, data, last_transaction_id.

      Parameters

      • address: string

      Returns Promise<
          {
              "@type": "raw.fullAccountState";
              balance: string
              | number;
              block_id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              code: string;
              data: string;
              frozen_hash: string;
              last_transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              state: "active"
              | "uninitialized"
              | "frozen";
              sync_utime: number;
          },
      >

    • Get state of a given address. State can be either unitialized, active or frozen.

      Parameters

      • address: string

      Returns Promise<"active" | "uninitialized" | "frozen">

    • Get metadata of a given block.

      Parameters

      • workchain: number
      • shard: string
      • seqno: number
      • Optionaloptional: { file_hash?: string; root_hash?: string }

      Returns Promise<
          {
              "@type": "blocks.header";
              after_merge: boolean;
              after_split: boolean;
              before_split: boolean;
              catchain_seqno: number;
              end_lt: string;
              flags: number;
              gen_utime: number;
              global_id: number;
              id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              is_key_block: boolean;
              min_ref_mc_seqno: number;
              prev_blocks: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              }[];
              prev_key_block_seqno: number;
              start_lt: string;
              validator_list_hash_short: number;
              version: number;
              vert_seqno: number;
              want_merge: boolean;
              want_split: boolean;
          },
      >

    • Get transactions of the given block.

      Parameters

      • workchain: number
      • shard: string
      • seqno: number
      • Optionaloptional: {
            after_hash?: string;
            after_lt?: string;
            count?: number;
            file_hash?: string;
            root_hash?: string;
        }

      Returns Promise<
          {
              "@type": "blocks.transactions";
              id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              incomplete: boolean;
              req_count: number;
              transactions: {
                  "@type": "blocks.shortTxId";
                  account: string;
                  hash: string;
                  lt: string;
                  mode: number;
              }[];
          },
      >

    • Get config by id.

      Parameters

      • config_id: number
      • Optionaloptional: { seqno?: number }

      Returns Promise<
          {
              "@type": "configInfo";
              config: { "@type": "tvm.cell"; bytes: string };
          },
      >

    • Get consensus block and its update timestamp.

      Returns Promise<{ consensus_block: number; timestamp: number }>

    • Similar to previous one but tries to parse additional information for known contract types. This method is based on tonlib's function getAccountState. For detecting wallets we recommend to use getWalletInformation.

      Parameters

      • address: string

      Returns Promise<
          {
              "@type": "fullAccountState";
              account_state: | {
                  "@type": "raw.accountState";
                  code: string;
                  data: string;
                  frozen_hash: string;
              }
              | {
                  "@type": "wallet.v3.accountState";
                  seqno: number;
                  wallet_id: string
                  | number;
              }
              | {
                  "@type": "wallet.v4.accountState";
                  seqno: number;
                  wallet_id: string
                  | number;
              }
              | {
                  "@type": "wallet.highload.v1.accountState";
                  seqno: number;
                  wallet_id: string
                  | number;
              }
              | {
                  "@type": "wallet.highload.v2.accountState";
                  wallet_id: string
                  | number;
              }
              | { "@type": "dns.accountState"; wallet_id: string
              | number }
              | {
                  "@type": "rwallet.accountState";
                  config: {
                      "@type": "rwallet.config";
                      limits: { "@type": "rwallet.limit"; seconds: number; value: number }[];
                      start_at: number;
                  };
                  seqno: number;
                  unlocked_balance: string
                  | number;
                  wallet_id: string | number;
              };
              address: { "@type": "accountAddress"; account_address: string };
              balance: string | number;
              block_id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              last_transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              revision: number;
              sync_utime: number;
          },
      >

    • Get metadata of a given masterchain block.

      Parameters

      • seqno: number

      Returns Promise<
          {
              "@type": "blocks.header";
              after_merge: boolean;
              after_split: boolean;
              before_split: boolean;
              catchain_seqno: number;
              end_lt: string;
              flags: number;
              gen_utime: number;
              global_id: number;
              id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              is_key_block: boolean;
              min_ref_mc_seqno: number;
              prev_blocks: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              }[];
              prev_key_block_seqno: number;
              start_lt: string;
              validator_list_hash_short: number;
              version: number;
              vert_seqno: number;
              want_merge: boolean;
              want_split: boolean;
          },
      >

    • Get up-to-date masterchain state.

      Parameters

      • seqno: number

      Returns Promise<
          {
              "@type": "blocks.blockSignatures";
              id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              signatures: {
                  "@type": "blocks.signature";
                  node_id_short: string;
                  signature: string;
              }[];
          },
      >

    • Get transactions of the given masterchain block.

      Parameters

      • seqno: number

      Returns Promise<
          {
              "@type": "blocks.transactions";
              id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              incomplete: boolean;
              req_count: number;
              transactions: {
                  "@type": "blocks.shortTxId";
                  account: string;
                  hash: string;
                  lt: string;
                  mode: number;
              }[];
          },
      >

    • Get up-to-date masterchain state.

      Returns Promise<
          {
              "@type": "blocks.masterchainInfo";
              init: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              last: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              state_root_hash: string;
          },
      >

    • Get merkle proof of shardchain block.

      Parameters

      • workchain: number
      • shard: string
      • seqno: number
      • Optionaloptional: { from_seqno?: number }

      Returns Promise<
          {
              "@type": "blocks.shardBlockProof";
              from: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              links: {
                  "@type": "blocks.shardBlockLink";
                  id: {
                      "@type": "ton.blockIdExt";
                      file_hash: string;
                      root_hash: string;
                      seqno: number;
                      shard: string;
                      workchain: number;
                  };
                  proof: string;
              }[];
              mc_id: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              };
              mc_proof: {
                  "@type": "blocks.blockLinkBack";
                  dest_proof: string;
                  from: {
                      "@type": "ton.blockIdExt";
                      file_hash: string;
                      root_hash: string;
                      seqno: number;
                      shard: string;
                      workchain: number;
                  };
                  proof: string;
                  state_proof: string;
                  to: {
                      "@type": "ton.blockIdExt";
                      file_hash: string;
                      root_hash: string;
                      seqno: number;
                      shard: string;
                      workchain: number;
                  };
                  to_key_block: boolean;
              }[];
          },
      >

    • Get shards information.

      Parameters

      • seqno: number

      Returns Promise<
          {
              "@type": "blocks.shards";
              shards: {
                  "@type": "ton.blockIdExt";
                  file_hash: string;
                  root_hash: string;
                  seqno: number;
                  shard: string;
                  workchain: number;
              }[];
          },
      >

    • Get transaction history of a given address.

      Parameters

      • address: string
      • Optionaloptional: {
            archival?: boolean;
            hash?: string;
            limit?: number;
            lt?: string;
            to_lt?: string;
        }

      Returns Promise<
          {
              "@type": "raw.transaction";
              address: { "@type": "accountAddress"; account_address: string };
              data: string;
              fee: string | number;
              in_msg: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              };
              other_fee: string
              | number;
              out_msgs: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              }[];
              storage_fee: string
              | number;
              transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              utime: number;
          }[],
      >

    • Retrieve wallet information. This method parses contract state and currently supports more wallet types than getExtendedAddressInformation: simple wallet, standart wallet, v3 wallet, v4 wallet.

      Parameters

      • address: string

      Returns Promise<
          {
              account_state: string;
              balance: string
              | number;
              last_transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              seqno: number;
              wallet: boolean;
              wallet_id: string
              | number;
              wallet_type: string;
          },
      >

    • Look up block by either seqno, lt or unixtime.

      Parameters

      • workchain: number
      • shard: string
      • Optionaloptional: { lt?: string; seqno?: number; unixtime?: number }

      Returns Promise<
          {
              "@type": "ton.blockIdExt";
              file_hash: string;
              root_hash: string;
              seqno: number;
              shard: string;
              workchain: number;
          },
      >

    • Convert an address from raw to human-readable format.

      Parameters

      • address: string

      Returns Promise<string>

    • Run get method on smart contract.

      Parameters

      • address: string
      • method: string
      • stack: TupleItem[]

      Returns Promise<{ exit_code: number; gas_used: number; stack: unknown[] }>

    • Send serialized boc file: fully packed and serialized external message to blockchain. boc accepted in serialized format (b64-encoded).

      Parameters

      • boc: string

      Returns Promise<{ "@type": "ok" }>

    • Send serialized boc file: fully packed and serialized external message to blockchain. The method returns message hash. boc accepted in serialized format (b64-encoded).

      Parameters

      • boc: string

      Returns Promise<{ "@type": "raw.extMessageInfo"; hash: string }>

    • Send query - unpacked external message.

      Parameters

      • address: string
      • body: string
      • init_code: string = ""
      • init_data: string = ""

      Returns Promise<{ "@type": "ok" }>

    • Same as previous. Locate outcoming transaction of destination address by incoming message.

      Parameters

      • source: string
      • destination: string
      • created_lt: string

      Returns Promise<
          {
              "@type": "raw.transaction";
              address: { "@type": "accountAddress"; account_address: string };
              data: string;
              fee: string | number;
              in_msg: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              };
              other_fee: string
              | number;
              out_msgs: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              }[];
              storage_fee: string
              | number;
              transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              utime: number;
          },
      >

    • Locate incoming transaction of source address by outcoming message.

      Parameters

      • source: string
      • destination: string
      • created_lt: string

      Returns Promise<
          {
              "@type": "raw.transaction";
              address: { "@type": "accountAddress"; account_address: string };
              data: string;
              fee: string | number;
              in_msg: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              };
              other_fee: string
              | number;
              out_msgs: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              }[];
              storage_fee: string
              | number;
              transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              utime: number;
          },
      >

    • Locate outcoming transaction of destination address by incoming message.

      Parameters

      • source: string
      • destination: string
      • created_lt: string

      Returns Promise<
          {
              "@type": "raw.transaction";
              address: { "@type": "accountAddress"; account_address: string };
              data: string;
              fee: string | number;
              in_msg: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              };
              other_fee: string
              | number;
              out_msgs: {
                  "@type": "raw.message";
                  body_hash: string;
                  created_lt: string;
                  destination: string;
                  fwd_fee: string | number;
                  ihr_fee: string | number;
                  message?: string;
                  msg_data:
                      | { "@type": "msg.dataRaw"; body: string; init_state: string }
                      | { "@type": "msg.dataText"; text: string }
                      | { "@type": "msg.dataDecryptedText"; text: string }
                      | { "@type": "msg.dataEncryptedText"; text: string };
                  source: string;
                  value: string;
              }[];
              storage_fee: string
              | number;
              transaction_id: {
                  "@type": "internal.transactionId";
                  hash: string;
                  lt: string;
              };
              utime: number;
          },
      >

    • Convert an address from human-readable to raw format.

      Parameters

      • address: string

      Returns Promise<string>