4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

nem / symbolAdvent Calendar 2024

Day 20

Windows と TypeScript ではじめる Symbol 通信 10【アナウンス2】

Last updated at Posted at 2024-12-19

ノードへパーシャルトランザクションをアナウンス

パーシャルのパケットタイプ(PUSH_PARTIAL_TRANSACTIONS)は、0x100です。

Catapult.ts
/** パケットタイプ */
private PacketType = {
  CHAIN_STATISTICS: 0x0_05,
  PUSH_TRANSACTIONS: 0x0_09,
  PUSH_PARTIAL_TRANSACTIONS: 0x1_00,
  NODE_DISCOVERY_PULL_PING: 0x1_11,
  TIME_SYNC_NETWORK_TIME: 0x1_20,
  FINALIZATION_STATISTICS: 0x1_32,
  UNLOCKED_ACCOUNTS: 0x3_04,
}

/**
 * アグリゲートボンデッドトランザクションアナウンス
 * API必要
 * @param payloadHex トランザクションペイロード
 * @returns
 */
async announceTxPartial(payload: Uint8Array): Promise<boolean> {
  console.info('announceTxPartial')
  try {
    await this.request(
      this.PacketType.PUSH_PARTIAL_TRANSACTIONS,
      payload,
      false
    )
  } catch {
    return false
  } finally {
    this.close()
  }
  return true
}

レスポンスデータの解析

レスポンスはありません。
トランザクションのエラー確認は、WebSocket か ZeroMQ の Status を参照する必要があります。

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?