@gnolang/tm2-js-client 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/CHANGELOG.md +424 -0
  2. package/CONTRIBUTING.md +83 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.cjs +12 -0
  4. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.143.0/helpers/esm}/defineProperty.mjs +3 -3
  5. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.143.0/helpers/esm}/toPrimitive.cjs +4 -4
  6. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.143.0/helpers/esm}/toPrimitive.mjs +3 -3
  7. package/dist/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.cjs +9 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/toPropertyKey.mjs +9 -0
  9. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.143.0/helpers/esm}/typeof.cjs +2 -2
  10. package/dist/_virtual/{_@oxc-project_runtime@0.122.0/helpers → _@oxc-project_runtime@0.143.0/helpers/esm}/typeof.mjs +2 -2
  11. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  12. package/dist/index.d.cts +5 -0
  13. package/dist/index.d.mts +5 -0
  14. package/dist/proto/google/protobuf/any.cjs +3 -4
  15. package/dist/proto/google/protobuf/any.cjs.map +1 -1
  16. package/dist/proto/google/protobuf/any.d.cts +3 -4
  17. package/dist/proto/google/protobuf/any.d.cts.map +1 -1
  18. package/dist/proto/google/protobuf/any.d.mts +3 -4
  19. package/dist/proto/google/protobuf/any.d.mts.map +1 -1
  20. package/dist/proto/google/protobuf/any.mjs +3 -3
  21. package/dist/proto/google/protobuf/any.mjs.map +1 -1
  22. package/dist/proto/index.cjs +15 -4
  23. package/dist/proto/index.d.cts +2 -1
  24. package/dist/proto/index.d.mts +2 -1
  25. package/dist/proto/index.mjs +5 -5
  26. package/dist/proto/tm2/abci.cjs +3 -4
  27. package/dist/proto/tm2/abci.cjs.map +1 -1
  28. package/dist/proto/tm2/abci.d.cts +3 -4
  29. package/dist/proto/tm2/abci.d.cts.map +1 -1
  30. package/dist/proto/tm2/abci.d.mts +3 -4
  31. package/dist/proto/tm2/abci.d.mts.map +1 -1
  32. package/dist/proto/tm2/abci.mjs +3 -3
  33. package/dist/proto/tm2/abci.mjs.map +1 -1
  34. package/dist/proto/tm2/multisig.cjs +3 -4
  35. package/dist/proto/tm2/multisig.cjs.map +1 -1
  36. package/dist/proto/tm2/multisig.d.cts +3 -4
  37. package/dist/proto/tm2/multisig.d.cts.map +1 -1
  38. package/dist/proto/tm2/multisig.d.mts +3 -4
  39. package/dist/proto/tm2/multisig.d.mts.map +1 -1
  40. package/dist/proto/tm2/multisig.mjs +3 -3
  41. package/dist/proto/tm2/multisig.mjs.map +1 -1
  42. package/dist/proto/tm2/tx.cjs +6 -7
  43. package/dist/proto/tm2/tx.cjs.map +1 -1
  44. package/dist/proto/tm2/tx.d.cts +2 -3
  45. package/dist/proto/tm2/tx.d.cts.map +1 -1
  46. package/dist/proto/tm2/tx.d.mts +2 -3
  47. package/dist/proto/tm2/tx.d.mts.map +1 -1
  48. package/dist/proto/tm2/tx.mjs +6 -6
  49. package/dist/proto/tm2/tx.mjs.map +1 -1
  50. package/dist/provider/endpoints.cjs.map +1 -1
  51. package/dist/provider/endpoints.d.cts.map +1 -1
  52. package/dist/provider/endpoints.d.mts.map +1 -1
  53. package/dist/provider/endpoints.mjs.map +1 -1
  54. package/dist/provider/errors/errors.cjs +2 -2
  55. package/dist/provider/errors/errors.cjs.map +1 -1
  56. package/dist/provider/errors/errors.d.cts.map +1 -1
  57. package/dist/provider/errors/errors.d.mts.map +1 -1
  58. package/dist/provider/errors/errors.mjs +1 -1
  59. package/dist/provider/errors/errors.mjs.map +1 -1
  60. package/dist/provider/errors/index.cjs +20 -1
  61. package/dist/provider/errors/index.d.cts +2 -1
  62. package/dist/provider/errors/index.d.mts +2 -1
  63. package/dist/provider/errors/index.mjs +2 -2
  64. package/dist/provider/index.cjs +61 -9
  65. package/dist/provider/index.d.cts +7 -1
  66. package/dist/provider/index.d.mts +7 -1
  67. package/dist/provider/index.mjs +10 -10
  68. package/dist/provider/jsonrpc/index.cjs +2 -1
  69. package/dist/provider/jsonrpc/index.d.cts +2 -1
  70. package/dist/provider/jsonrpc/index.d.mts +2 -1
  71. package/dist/provider/jsonrpc/index.mjs +2 -2
  72. package/dist/provider/jsonrpc/jsonrpc.cjs +2 -2
  73. package/dist/provider/jsonrpc/jsonrpc.cjs.map +1 -1
  74. package/dist/provider/jsonrpc/jsonrpc.d.cts +0 -1
  75. package/dist/provider/jsonrpc/jsonrpc.d.cts.map +1 -1
  76. package/dist/provider/jsonrpc/jsonrpc.d.mts +0 -1
  77. package/dist/provider/jsonrpc/jsonrpc.d.mts.map +1 -1
  78. package/dist/provider/jsonrpc/jsonrpc.mjs +2 -1
  79. package/dist/provider/jsonrpc/jsonrpc.mjs.map +1 -1
  80. package/dist/provider/provider.cjs +8 -9
  81. package/dist/provider/provider.cjs.map +1 -1
  82. package/dist/provider/provider.d.cts +2 -1
  83. package/dist/provider/provider.d.cts.map +1 -1
  84. package/dist/provider/provider.d.mts +2 -1
  85. package/dist/provider/provider.d.mts.map +1 -1
  86. package/dist/provider/provider.mjs +43 -26
  87. package/dist/provider/provider.mjs.map +1 -1
  88. package/dist/provider/types/abci.d.cts.map +1 -1
  89. package/dist/provider/types/abci.d.mts.map +1 -1
  90. package/dist/provider/types/common.d.cts +1 -2
  91. package/dist/provider/types/common.d.cts.map +1 -1
  92. package/dist/provider/types/common.d.mts +1 -2
  93. package/dist/provider/types/common.d.mts.map +1 -1
  94. package/dist/provider/types/index.cjs +2 -1
  95. package/dist/provider/types/index.d.cts +2 -1
  96. package/dist/provider/types/index.d.mts +2 -1
  97. package/dist/provider/types/index.mjs +2 -2
  98. package/dist/provider/types/jsonrpc.d.cts.map +1 -1
  99. package/dist/provider/types/jsonrpc.d.mts.map +1 -1
  100. package/dist/provider/utility/adapters.cjs +1 -1
  101. package/dist/provider/utility/adapters.cjs.map +1 -1
  102. package/dist/provider/utility/adapters.d.cts +1 -1
  103. package/dist/provider/utility/adapters.d.cts.map +1 -1
  104. package/dist/provider/utility/adapters.d.mts +1 -1
  105. package/dist/provider/utility/adapters.d.mts.map +1 -1
  106. package/dist/provider/utility/adapters.mjs +1 -1
  107. package/dist/provider/utility/adapters.mjs.map +1 -1
  108. package/dist/provider/utility/errors.utility.cjs.map +1 -1
  109. package/dist/provider/utility/errors.utility.mjs.map +1 -1
  110. package/dist/provider/utility/index.cjs +27 -3
  111. package/dist/provider/utility/index.d.cts +2 -1
  112. package/dist/provider/utility/index.d.mts +2 -1
  113. package/dist/provider/utility/index.mjs +4 -4
  114. package/dist/provider/utility/provider.utility.cjs +0 -1
  115. package/dist/provider/utility/provider.utility.cjs.map +1 -1
  116. package/dist/provider/utility/provider.utility.d.cts +2 -1
  117. package/dist/provider/utility/provider.utility.d.cts.map +1 -1
  118. package/dist/provider/utility/provider.utility.d.mts +2 -1
  119. package/dist/provider/utility/provider.utility.d.mts.map +1 -1
  120. package/dist/provider/utility/provider.utility.mjs +2 -1
  121. package/dist/provider/utility/provider.utility.mjs.map +1 -1
  122. package/dist/provider/utility/requests.utility.cjs +0 -1
  123. package/dist/provider/utility/requests.utility.cjs.map +1 -1
  124. package/dist/provider/utility/requests.utility.d.cts +1 -1
  125. package/dist/provider/utility/requests.utility.d.cts.map +1 -1
  126. package/dist/provider/utility/requests.utility.d.mts +1 -1
  127. package/dist/provider/utility/requests.utility.d.mts.map +1 -1
  128. package/dist/provider/utility/requests.utility.mjs.map +1 -1
  129. package/dist/provider/websocket/index.cjs +2 -1
  130. package/dist/provider/websocket/index.d.cts +2 -1
  131. package/dist/provider/websocket/index.d.mts +2 -1
  132. package/dist/provider/websocket/index.mjs +2 -2
  133. package/dist/provider/websocket/ws.cjs +2 -2
  134. package/dist/provider/websocket/ws.cjs.map +1 -1
  135. package/dist/provider/websocket/ws.d.cts +0 -1
  136. package/dist/provider/websocket/ws.d.cts.map +1 -1
  137. package/dist/provider/websocket/ws.d.mts +0 -1
  138. package/dist/provider/websocket/ws.d.mts.map +1 -1
  139. package/dist/provider/websocket/ws.mjs +2 -1
  140. package/dist/provider/websocket/ws.mjs.map +1 -1
  141. package/dist/services/index.cjs +2 -1
  142. package/dist/services/index.d.cts +2 -1
  143. package/dist/services/index.d.mts +2 -1
  144. package/dist/services/index.mjs +2 -2
  145. package/dist/services/rest/restService.cjs +1 -1
  146. package/dist/services/rest/restService.cjs.map +1 -1
  147. package/dist/services/rest/restService.d.cts +0 -1
  148. package/dist/services/rest/restService.d.cts.map +1 -1
  149. package/dist/services/rest/restService.d.mts +0 -1
  150. package/dist/services/rest/restService.d.mts.map +1 -1
  151. package/dist/services/rest/restService.mjs.map +1 -1
  152. package/dist/services/rest/restService.types.d.cts +1 -1
  153. package/dist/services/rest/restService.types.d.cts.map +1 -1
  154. package/dist/services/rest/restService.types.d.mts +1 -1
  155. package/dist/services/rest/restService.types.d.mts.map +1 -1
  156. package/dist/utility/compact-bit-array.cjs +1 -1
  157. package/dist/utility/compact-bit-array.cjs.map +1 -1
  158. package/dist/utility/compact-bit-array.d.cts +0 -1
  159. package/dist/utility/compact-bit-array.d.cts.map +1 -1
  160. package/dist/utility/compact-bit-array.d.mts +0 -1
  161. package/dist/utility/compact-bit-array.d.mts.map +1 -1
  162. package/dist/utility/compact-bit-array.mjs +1 -1
  163. package/dist/utility/compact-bit-array.mjs.map +1 -1
  164. package/dist/utility/index.cjs +3 -1
  165. package/dist/utility/index.d.cts +2 -1
  166. package/dist/utility/index.d.mts +2 -1
  167. package/dist/utility/index.mjs +2 -2
  168. package/dist/wallet/index.cjs +16 -5
  169. package/dist/wallet/index.d.cts +6 -1
  170. package/dist/wallet/index.d.mts +6 -1
  171. package/dist/wallet/index.mjs +6 -6
  172. package/dist/wallet/key/index.cjs +2 -1
  173. package/dist/wallet/key/index.d.cts +2 -1
  174. package/dist/wallet/key/index.d.mts +2 -1
  175. package/dist/wallet/key/index.mjs +2 -2
  176. package/dist/wallet/key/key.cjs +9 -10
  177. package/dist/wallet/key/key.cjs.map +1 -1
  178. package/dist/wallet/key/key.d.cts +0 -1
  179. package/dist/wallet/key/key.d.cts.map +1 -1
  180. package/dist/wallet/key/key.d.mts +0 -1
  181. package/dist/wallet/key/key.d.mts.map +1 -1
  182. package/dist/wallet/key/key.mjs +1 -1
  183. package/dist/wallet/key/key.mjs.map +1 -1
  184. package/dist/wallet/ledger/index.cjs +2 -1
  185. package/dist/wallet/ledger/index.d.cts +2 -1
  186. package/dist/wallet/ledger/index.d.mts +2 -1
  187. package/dist/wallet/ledger/index.mjs +2 -2
  188. package/dist/wallet/ledger/ledger.cjs +9 -10
  189. package/dist/wallet/ledger/ledger.cjs.map +1 -1
  190. package/dist/wallet/ledger/ledger.d.cts +0 -1
  191. package/dist/wallet/ledger/ledger.d.cts.map +1 -1
  192. package/dist/wallet/ledger/ledger.d.mts +0 -1
  193. package/dist/wallet/ledger/ledger.d.mts.map +1 -1
  194. package/dist/wallet/ledger/ledger.mjs +3 -2
  195. package/dist/wallet/ledger/ledger.mjs.map +1 -1
  196. package/dist/wallet/signer.d.cts.map +1 -1
  197. package/dist/wallet/signer.d.mts.map +1 -1
  198. package/dist/wallet/types/index.cjs +2 -1
  199. package/dist/wallet/types/index.d.cts +2 -1
  200. package/dist/wallet/types/index.d.mts +2 -1
  201. package/dist/wallet/types/index.mjs +2 -2
  202. package/dist/wallet/types/sign.d.cts.map +1 -1
  203. package/dist/wallet/types/sign.d.mts.map +1 -1
  204. package/dist/wallet/types/wallet.d.cts.map +1 -1
  205. package/dist/wallet/types/wallet.d.mts.map +1 -1
  206. package/dist/wallet/utility/index.cjs +8 -1
  207. package/dist/wallet/utility/index.d.cts +2 -1
  208. package/dist/wallet/utility/index.d.mts +2 -1
  209. package/dist/wallet/utility/index.mjs +2 -2
  210. package/dist/wallet/utility/utility.cjs +1 -1
  211. package/dist/wallet/utility/utility.cjs.map +1 -1
  212. package/dist/wallet/utility/utility.d.cts +0 -1
  213. package/dist/wallet/utility/utility.d.cts.map +1 -1
  214. package/dist/wallet/utility/utility.d.mts +0 -1
  215. package/dist/wallet/utility/utility.d.mts.map +1 -1
  216. package/dist/wallet/utility/utility.mjs.map +1 -1
  217. package/dist/wallet/wallet.cjs +16 -17
  218. package/dist/wallet/wallet.cjs.map +1 -1
  219. package/dist/wallet/wallet.d.cts +3 -1
  220. package/dist/wallet/wallet.d.cts.map +1 -1
  221. package/dist/wallet/wallet.d.mts +3 -1
  222. package/dist/wallet/wallet.d.mts.map +1 -1
  223. package/dist/wallet/wallet.mjs +4 -3
  224. package/dist/wallet/wallet.mjs.map +1 -1
  225. package/package.json +38 -36
  226. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.cjs +0 -12
  227. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.cjs +0 -9
  228. package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.mjs +0 -9
  229. package/dist/index.cjs.map +0 -1
  230. package/dist/index.d.cts.map +0 -1
  231. package/dist/index.d.mts.map +0 -1
  232. package/dist/index.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  const require_tx = require("../proto/tm2/tx.cjs");
2
2
  require("../proto/index.cjs");
3
- const require_endpoints = require("./endpoints.cjs");
4
- const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.cjs");
3
+ require("./endpoints.cjs");
4
+ const require_defineProperty = require("../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.cjs");
5
5
  const require_abci = require("./types/abci.cjs");
6
6
  require("./types/index.cjs");
7
7
  const require_errors_utility = require("./utility/errors.utility.cjs");
@@ -16,7 +16,7 @@ require("./utility/index.cjs");
16
16
  */
17
17
  var BaseTm2Provider = class {
18
18
  constructor(client) {
19
- require_defineProperty._defineProperty(this, "client", void 0);
19
+ require_defineProperty.default(this, "client", void 0);
20
20
  this.client = client;
21
21
  }
22
22
  async estimateGas(tx) {
@@ -36,7 +36,7 @@ var BaseTm2Provider = class {
36
36
  async getBalance(address, denomination, height) {
37
37
  const rpcResponse = await this.client.abciQuery({
38
38
  path: `bank/balances/${address}`,
39
- data: new Uint8Array(),
39
+ data: /* @__PURE__ */ new Uint8Array(),
40
40
  height: height ? height : 0,
41
41
  prove: false
42
42
  });
@@ -69,7 +69,7 @@ var BaseTm2Provider = class {
69
69
  async getAccountSequence(address, height) {
70
70
  const rpcResponse = await this.client.abciQuery({
71
71
  path: `auth/accounts/${address}`,
72
- data: new Uint8Array(),
72
+ data: /* @__PURE__ */ new Uint8Array(),
73
73
  height: height ? height : 0,
74
74
  prove: false
75
75
  });
@@ -79,7 +79,7 @@ var BaseTm2Provider = class {
79
79
  async getAccountNumber(address, height) {
80
80
  const rpcResponse = await this.client.abciQuery({
81
81
  path: `auth/accounts/${address}`,
82
- data: new Uint8Array(),
82
+ data: /* @__PURE__ */ new Uint8Array(),
83
83
  height: height ? height : 0,
84
84
  prove: false
85
85
  });
@@ -89,7 +89,7 @@ var BaseTm2Provider = class {
89
89
  async getAccount(address, height) {
90
90
  const rpcResponse = await this.client.abciQuery({
91
91
  path: `auth/accounts/${address}`,
92
- data: new Uint8Array(),
92
+ data: /* @__PURE__ */ new Uint8Array(),
93
93
  height: height ? height : 0,
94
94
  prove: false
95
95
  });
@@ -108,8 +108,7 @@ var BaseTm2Provider = class {
108
108
  async sendTransaction(tx, endpoint) {
109
109
  const txBytes = Uint8Array.from(Buffer.from(tx, "base64"));
110
110
  switch (endpoint) {
111
- case require_endpoints.TransactionEndpoint.BROADCAST_TX_COMMIT: return this.broadcastTxCommit(txBytes);
112
- case require_endpoints.TransactionEndpoint.BROADCAST_TX_SYNC:
111
+ case "broadcast_tx_commit": return this.broadcastTxCommit(txBytes);
113
112
  default: return this.broadcastTxSync(txBytes);
114
113
  }
115
114
  }
@@ -1 +1 @@
1
- {"version":3,"file":"provider.cjs","names":["uint8ArrayToBase64","Tx","adaptAbciQueryResponse","extractSimulateFromResponse","constructRequestError","extractBalanceFromResponse","adaptBlockResponse","adaptBlockResultsResponse","adaptConsensusParamsResponse","adaptNetInfoResponse","extractSequenceFromResponse","extractAccountNumberFromResponse","extractAccountFromResponse","adaptStatusResponse","adaptTxResponse","TransactionEndpoint","adaptBroadcastTxSyncResponse","ABCIErrorKey","adaptBroadcastTxCommitResponse","waitForTransaction"],"sources":["../../src/provider/provider.ts"],"sourcesContent":["import {\n Tm2Client,\n} from \"@gnolang/tm2-rpc\";\n\nimport {\n Tx,\n} from \"../proto/index.js\";\nimport {\n TransactionEndpoint,\n} from \"./endpoints.js\";\nimport {\n ABCIAccount,\n ABCIErrorKey,\n ABCIResponse,\n BlockInfo,\n BlockResult,\n BroadcastAsGeneric,\n BroadcastTransactionMap,\n BroadcastTxCommitResult,\n BroadcastTxSyncResult,\n ConsensusParams,\n NetworkInfo,\n Status,\n TxResult,\n} from \"./types/index.js\";\nimport {\n constructRequestError,\n} from \"./utility/errors.utility.js\";\nimport {\n adaptAbciQueryResponse,\n adaptBlockResponse,\n adaptBlockResultsResponse,\n adaptBroadcastTxCommitResponse,\n adaptBroadcastTxSyncResponse,\n adaptConsensusParamsResponse,\n adaptNetInfoResponse,\n adaptStatusResponse,\n adaptTxResponse,\n extractAccountFromResponse,\n extractAccountNumberFromResponse,\n extractBalanceFromResponse,\n extractSequenceFromResponse,\n extractSimulateFromResponse,\n uint8ArrayToBase64,\n waitForTransaction,\n} from \"./utility/index.js\";\n\n/**\n * Read-only abstraction for accessing blockchain data\n */\nexport interface Provider {\n // Account-specific methods //\n\n /**\n * Fetches the denomination balance of the account\n * @param {string} address the bech32 address of the account\n * @param {string} [denomination=ugnot] the balance denomination\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getBalance(\n address: string,\n denomination?: string,\n height?: number\n ): Promise<number>\n\n /**\n * Fetches the account sequence\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used.\n * @deprecated use {@link getAccount} instead\n */\n getAccountSequence(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account number. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n * @deprecated use {@link getAccount} instead\n */\n getAccountNumber(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getAccount(address: string, height?: number): Promise<ABCIAccount>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlock(height: number): Promise<BlockInfo>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlockResult(height: number): Promise<BlockResult>\n\n /**\n * Fetches the latest block number from the chain\n */\n getBlockNumber(): Promise<number>\n\n // Network-specific methods //\n\n /**\n * Fetches the network information\n */\n getNetwork(): Promise<NetworkInfo>\n\n /**\n * Fetches the consensus params for the specific block height\n * @param {number} height the height for querying\n */\n getConsensusParams(height: number): Promise<ConsensusParams>\n\n /**\n * Fetches the current node status\n */\n getStatus(): Promise<Status>\n\n /**\n * Fetches the current (recommended) average gas price\n */\n getGasPrice(): Promise<number>\n\n /**\n * Estimates the gas limit for the transaction\n * @param {Tx} tx the transaction that needs estimating\n */\n estimateGas(tx: Tx): Promise<bigint>\n\n // Transaction specific methods //\n\n /**\n * Sends the transaction to the node. If the type of endpoint\n * is a broadcast commit, waits for the transaction to be committed to the chain.\n * The transaction needs to be signed beforehand.\n * Returns the transaction broadcast result.\n * @param {string} tx the base64-encoded signed transaction\n * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)\n */\n sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K\n ): Promise<BroadcastAsGeneric<K>[\"result\"]>\n\n /**\n * Waits for the transaction to be committed on the chain.\n * NOTE: This method will not take in the fromHeight parameter once\n * proper transaction indexing is added - the implementation should\n * simply try to fetch the transaction first to see if it's included in a block\n * before starting to wait for it; Until then, this method should be used\n * in the sequence:\n * get latest block -> send transaction -> waitForTransaction(block before send)\n * @param {string} hash The transaction hash\n * @param {number} [fromHeight=latest] The block height used to begin the search\n * @param {number} [timeout=15000] Optional wait timeout in MS\n */\n waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number\n ): Promise<Tx>\n}\n\n/**\n * Base provider implementation backed by a Tm2Client.\n * Subclasses only need to provide a static `create()` factory.\n */\nexport abstract class BaseTm2Provider implements Provider {\n protected readonly client: Tm2Client;\n\n protected constructor(client: Tm2Client) {\n this.client = client;\n }\n\n async estimateGas(tx: Tx): Promise<bigint> {\n const encodedTx = uint8ArrayToBase64(Tx.encode(tx).finish());\n const rpcResponse = await this.client.abciQuery({\n path: \".app/simulate\",\n data: new TextEncoder().encode(encodedTx),\n height: 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n const simulateResult = extractSimulateFromResponse(abciResponse);\n\n const resultErrorKey = simulateResult.response_base?.error?.type_url;\n if (resultErrorKey) {\n throw constructRequestError(resultErrorKey);\n }\n\n return simulateResult.gas_used;\n }\n\n async getBalance(\n address: string,\n denomination?: string,\n height?: number,\n ): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `bank/balances/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n\n return extractBalanceFromResponse(\n abciResponse.response.ResponseBase.Data,\n denomination ? denomination : \"ugnot\",\n );\n }\n\n async getBlock(height: number): Promise<BlockInfo> {\n const rpcResponse = await this.client.block(height);\n return adaptBlockResponse(rpcResponse);\n }\n\n async getBlockResult(height: number): Promise<BlockResult> {\n const rpcResponse = await this.client.blockResults(height);\n return adaptBlockResultsResponse(rpcResponse);\n }\n\n async getBlockNumber(): Promise<number> {\n const status = await this.getStatus();\n return parseInt(status.sync_info.latest_block_height);\n }\n\n async getConsensusParams(height: number): Promise<ConsensusParams> {\n const rpcResponse = await this.client.consensusParams(height);\n return adaptConsensusParamsResponse(rpcResponse);\n }\n\n getGasPrice(): Promise<number> {\n return Promise.reject(\"not supported\");\n }\n\n async getNetwork(): Promise<NetworkInfo> {\n const rpcResponse = await this.client.netInfo();\n return adaptNetInfoResponse(rpcResponse);\n }\n\n async getAccountSequence(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractSequenceFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getAccountNumber(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountNumberFromResponse(\n abciResponse.response.ResponseBase.Data,\n );\n }\n\n async getAccount(address: string, height?: number): Promise<ABCIAccount> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getStatus(): Promise<Status> {\n const rpcResponse = await this.client.status();\n return adaptStatusResponse(rpcResponse);\n }\n\n async getTransaction(hash: string): Promise<TxResult> {\n const hashBytes = Uint8Array.from(\n (hash.match(/.{1,2}/g) ?? []).map(byte => parseInt(byte, 16)),\n );\n const rpcResponse = await this.client.tx({\n hash: hashBytes,\n });\n return adaptTxResponse(rpcResponse);\n }\n\n async sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K,\n ): Promise<BroadcastTransactionMap[K][\"result\"]> {\n const txBytes = Uint8Array.from(Buffer.from(tx, \"base64\"));\n\n switch (endpoint) {\n case TransactionEndpoint.BROADCAST_TX_COMMIT:\n return this.broadcastTxCommit(txBytes);\n case TransactionEndpoint.BROADCAST_TX_SYNC:\n default:\n return this.broadcastTxSync(txBytes);\n }\n }\n\n private async broadcastTxSync(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxSyncResult> {\n const rpcResponse = await this.client.broadcastTxSync({\n tx: txBytes,\n });\n const response = adaptBroadcastTxSyncResponse(rpcResponse);\n\n if (response.error) {\n const errType: string = response.error[ABCIErrorKey];\n const log: string = response.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n private async broadcastTxCommit(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxCommitResult> {\n const rpcResponse = await this.client.broadcastTxCommit({\n tx: txBytes,\n });\n const response = adaptBroadcastTxCommitResponse(rpcResponse);\n\n const {\n check_tx, deliver_tx,\n } = response;\n\n if (check_tx.ResponseBase.Error) {\n const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = check_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n if (deliver_tx.ResponseBase.Error) {\n const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = deliver_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n async waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number,\n ): Promise<Tx> {\n return waitForTransaction(this, hash, fromHeight, timeout);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkLA,IAAsB,kBAAtB,MAA0D;CAGxD,YAAsB,QAAmB;+CAFtB,UAAA,KAAA,EAAkB;AAG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AAAA,gBAAgB,YAAY;;CAGrC,MAAM,gBACJ,IACA,UAC+C;EAC/C,MAAM,UAAU,WAAW,KAAK,OAAO,KAAK,IAAI,SAAS,CAAC;AAE1D,UAAQ,UAAR;GACE,KAAKC,kBAAAA,oBAAoB,oBACvB,QAAO,KAAK,kBAAkB,QAAQ;GACxC,KAAKA,kBAAAA,oBAAoB;GACzB,QACE,QAAO,KAAK,gBAAgB,QAAQ;;;CAI1C,MAAc,gBACZ,SACgC;EAChC,MAAM,cAAc,MAAM,KAAK,OAAO,gBAAgB,EACpD,IAAI,SACL,CAAC;EACF,MAAM,WAAWC,iBAAAA,6BAA6B,YAAY;AAE1D,MAAI,SAAS,OAAO;GAClB,MAAM,UAAkB,SAAS,MAAMC,aAAAA;GACvC,MAAM,MAAc,SAAS;AAE7B,SAAMb,uBAAAA,sBAAsB,SAAS,IAAI;;AAG3C,SAAO;;CAGT,MAAc,kBACZ,SACkC;EAClC,MAAM,cAAc,MAAM,KAAK,OAAO,kBAAkB,EACtD,IAAI,SACL,CAAC;EACF,MAAM,WAAWc,iBAAAA,+BAA+B,YAAY;EAE5D,MAAM,EACJ,UAAU,eACR;AAEJ,MAAI,SAAS,aAAa,OAAO;GAC/B,MAAM,UAAkB,SAAS,aAAa,MAAMD,aAAAA;GACpD,MAAM,MAAc,SAAS,aAAa;AAE1C,SAAMb,uBAAAA,sBAAsB,SAAS,IAAI;;AAG3C,MAAI,WAAW,aAAa,OAAO;GACjC,MAAM,UAAkB,WAAW,aAAa,MAAMa,aAAAA;GACtD,MAAM,MAAc,WAAW,aAAa;AAE5C,SAAMb,uBAAAA,sBAAsB,SAAS,IAAI;;AAG3C,SAAO;;CAGT,MAAM,mBACJ,MACA,YACA,SACa;AACb,SAAOe,yBAAAA,mBAAmB,MAAM,MAAM,YAAY,QAAQ"}
1
+ {"version":3,"file":"provider.cjs","names":["uint8ArrayToBase64","Tx","adaptAbciQueryResponse","extractSimulateFromResponse","constructRequestError","extractBalanceFromResponse","adaptBlockResponse","adaptBlockResultsResponse","adaptConsensusParamsResponse","adaptNetInfoResponse","extractSequenceFromResponse","extractAccountNumberFromResponse","extractAccountFromResponse","adaptStatusResponse","adaptTxResponse","adaptBroadcastTxSyncResponse","ABCIErrorKey","adaptBroadcastTxCommitResponse","waitForTransaction"],"sources":["../../src/provider/provider.ts"],"sourcesContent":["import {\n Tm2Client,\n} from \"@gnolang/tm2-rpc\";\n\nimport {\n Tx,\n} from \"../proto/index.js\";\nimport {\n TransactionEndpoint,\n} from \"./endpoints.js\";\nimport {\n ABCIAccount,\n ABCIErrorKey,\n ABCIResponse,\n BlockInfo,\n BlockResult,\n BroadcastAsGeneric,\n BroadcastTransactionMap,\n BroadcastTxCommitResult,\n BroadcastTxSyncResult,\n ConsensusParams,\n NetworkInfo,\n Status,\n TxResult,\n} from \"./types/index.js\";\nimport {\n constructRequestError,\n} from \"./utility/errors.utility.js\";\nimport {\n adaptAbciQueryResponse,\n adaptBlockResponse,\n adaptBlockResultsResponse,\n adaptBroadcastTxCommitResponse,\n adaptBroadcastTxSyncResponse,\n adaptConsensusParamsResponse,\n adaptNetInfoResponse,\n adaptStatusResponse,\n adaptTxResponse,\n extractAccountFromResponse,\n extractAccountNumberFromResponse,\n extractBalanceFromResponse,\n extractSequenceFromResponse,\n extractSimulateFromResponse,\n uint8ArrayToBase64,\n waitForTransaction,\n} from \"./utility/index.js\";\n\n/**\n * Read-only abstraction for accessing blockchain data\n */\nexport interface Provider {\n // Account-specific methods //\n\n /**\n * Fetches the denomination balance of the account\n * @param {string} address the bech32 address of the account\n * @param {string} [denomination=ugnot] the balance denomination\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getBalance(\n address: string,\n denomination?: string,\n height?: number\n ): Promise<number>\n\n /**\n * Fetches the account sequence\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used.\n * @deprecated use {@link getAccount} instead\n */\n getAccountSequence(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account number. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n * @deprecated use {@link getAccount} instead\n */\n getAccountNumber(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getAccount(address: string, height?: number): Promise<ABCIAccount>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlock(height: number): Promise<BlockInfo>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlockResult(height: number): Promise<BlockResult>\n\n /**\n * Fetches the latest block number from the chain\n */\n getBlockNumber(): Promise<number>\n\n // Network-specific methods //\n\n /**\n * Fetches the network information\n */\n getNetwork(): Promise<NetworkInfo>\n\n /**\n * Fetches the consensus params for the specific block height\n * @param {number} height the height for querying\n */\n getConsensusParams(height: number): Promise<ConsensusParams>\n\n /**\n * Fetches the current node status\n */\n getStatus(): Promise<Status>\n\n /**\n * Fetches the current (recommended) average gas price\n */\n getGasPrice(): Promise<number>\n\n /**\n * Estimates the gas limit for the transaction\n * @param {Tx} tx the transaction that needs estimating\n */\n estimateGas(tx: Tx): Promise<bigint>\n\n // Transaction specific methods //\n\n /**\n * Sends the transaction to the node. If the type of endpoint\n * is a broadcast commit, waits for the transaction to be committed to the chain.\n * The transaction needs to be signed beforehand.\n * Returns the transaction broadcast result.\n * @param {string} tx the base64-encoded signed transaction\n * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)\n */\n sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K\n ): Promise<BroadcastAsGeneric<K>[\"result\"]>\n\n /**\n * Waits for the transaction to be committed on the chain.\n * NOTE: This method will not take in the fromHeight parameter once\n * proper transaction indexing is added - the implementation should\n * simply try to fetch the transaction first to see if it's included in a block\n * before starting to wait for it; Until then, this method should be used\n * in the sequence:\n * get latest block -> send transaction -> waitForTransaction(block before send)\n * @param {string} hash The transaction hash\n * @param {number} [fromHeight=latest] The block height used to begin the search\n * @param {number} [timeout=15000] Optional wait timeout in MS\n */\n waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number\n ): Promise<Tx>\n}\n\n/**\n * Base provider implementation backed by a Tm2Client.\n * Subclasses only need to provide a static `create()` factory.\n */\nexport abstract class BaseTm2Provider implements Provider {\n protected readonly client: Tm2Client;\n\n protected constructor(client: Tm2Client) {\n this.client = client;\n }\n\n async estimateGas(tx: Tx): Promise<bigint> {\n const encodedTx = uint8ArrayToBase64(Tx.encode(tx).finish());\n const rpcResponse = await this.client.abciQuery({\n path: \".app/simulate\",\n data: new TextEncoder().encode(encodedTx),\n height: 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n const simulateResult = extractSimulateFromResponse(abciResponse);\n\n const resultErrorKey = simulateResult.response_base?.error?.type_url;\n if (resultErrorKey) {\n throw constructRequestError(resultErrorKey);\n }\n\n return simulateResult.gas_used;\n }\n\n async getBalance(\n address: string,\n denomination?: string,\n height?: number,\n ): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `bank/balances/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n\n return extractBalanceFromResponse(\n abciResponse.response.ResponseBase.Data,\n denomination ? denomination : \"ugnot\",\n );\n }\n\n async getBlock(height: number): Promise<BlockInfo> {\n const rpcResponse = await this.client.block(height);\n return adaptBlockResponse(rpcResponse);\n }\n\n async getBlockResult(height: number): Promise<BlockResult> {\n const rpcResponse = await this.client.blockResults(height);\n return adaptBlockResultsResponse(rpcResponse);\n }\n\n async getBlockNumber(): Promise<number> {\n const status = await this.getStatus();\n return parseInt(status.sync_info.latest_block_height);\n }\n\n async getConsensusParams(height: number): Promise<ConsensusParams> {\n const rpcResponse = await this.client.consensusParams(height);\n return adaptConsensusParamsResponse(rpcResponse);\n }\n\n getGasPrice(): Promise<number> {\n return Promise.reject(\"not supported\");\n }\n\n async getNetwork(): Promise<NetworkInfo> {\n const rpcResponse = await this.client.netInfo();\n return adaptNetInfoResponse(rpcResponse);\n }\n\n async getAccountSequence(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractSequenceFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getAccountNumber(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountNumberFromResponse(\n abciResponse.response.ResponseBase.Data,\n );\n }\n\n async getAccount(address: string, height?: number): Promise<ABCIAccount> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getStatus(): Promise<Status> {\n const rpcResponse = await this.client.status();\n return adaptStatusResponse(rpcResponse);\n }\n\n async getTransaction(hash: string): Promise<TxResult> {\n const hashBytes = Uint8Array.from(\n (hash.match(/.{1,2}/g) ?? []).map(byte => parseInt(byte, 16)),\n );\n const rpcResponse = await this.client.tx({\n hash: hashBytes,\n });\n return adaptTxResponse(rpcResponse);\n }\n\n async sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K,\n ): Promise<BroadcastTransactionMap[K][\"result\"]> {\n const txBytes = Uint8Array.from(Buffer.from(tx, \"base64\"));\n\n switch (endpoint) {\n case TransactionEndpoint.BROADCAST_TX_COMMIT:\n return this.broadcastTxCommit(txBytes);\n case TransactionEndpoint.BROADCAST_TX_SYNC:\n default:\n return this.broadcastTxSync(txBytes);\n }\n }\n\n private async broadcastTxSync(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxSyncResult> {\n const rpcResponse = await this.client.broadcastTxSync({\n tx: txBytes,\n });\n const response = adaptBroadcastTxSyncResponse(rpcResponse);\n\n if (response.error) {\n const errType: string = response.error[ABCIErrorKey];\n const log: string = response.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n private async broadcastTxCommit(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxCommitResult> {\n const rpcResponse = await this.client.broadcastTxCommit({\n tx: txBytes,\n });\n const response = adaptBroadcastTxCommitResponse(rpcResponse);\n\n const {\n check_tx, deliver_tx,\n } = response;\n\n if (check_tx.ResponseBase.Error) {\n const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = check_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n if (deliver_tx.ResponseBase.Error) {\n const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = deliver_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n async waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number,\n ): Promise<Tx> {\n return waitForTransaction(this, hash, fromHeight, timeout);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkLA,IAAsB,kBAAtB,MAA0D;CAGxD,YAAsB,QAAmB;EAFtB,uBAAA,QAAA,MAAA,UAAA,KAAA,CAAA;EAGjB,KAAK,SAAS;CAChB;CAEA,MAAM,YAAY,IAAyB;EACzC,MAAM,YAAYA,yBAAAA,mBAAmBC,WAAAA,GAAG,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;EAC3D,MAAM,cAAc,MAAM,KAAK,OAAO,UAAU;GAC9C,MAAM;GACN,MAAM,IAAI,YAAY,CAAC,CAAC,O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AAK,kBAAkB,OAAO;GAEvC,SACE,OAAO,KAAK,gBAAgB,OAAO;EACvC;CACF;CAEA,MAAc,gBACZ,SACgC;EAChC,MAAM,cAAc,MAAM,KAAK,OAAO,gBAAgB,EACpD,IAAI,QACN,CAAC;EACD,MAAM,WAAWC,iBAAAA,6BAA6B,WAAW;EAEzD,IAAI,SAAS,OAAO;GAClB,MAAM,UAAkB,SAAS,MAAMC,aAAAA;GACvC,MAAM,MAAc,SAAS;GAE7B,MAAMZ,uBAAAA,sBAAsB,SAAS,GAAG;EAC1C;EAEA,OAAO;CACT;CAEA,MAAc,kBACZ,SACkC;EAClC,MAAM,cAAc,MAAM,KAAK,OAAO,kBAAkB,EACtD,IAAI,QACN,CAAC;EACD,MAAM,WAAWa,iBAAAA,+BAA+B,WAAW;EAE3D,MAAM,EACJ,UAAU,eACR;EAEJ,IAAI,SAAS,aAAa,OAAO;GAC/B,MAAM,UAAkB,SAAS,aAAa,MAAMD,aAAAA;GACpD,MAAM,MAAc,SAAS,aAAa;GAE1C,MAAMZ,uBAAAA,sBAAsB,SAAS,GAAG;EAC1C;EAEA,IAAI,WAAW,aAAa,OAAO;GACjC,MAAM,UAAkB,WAAW,aAAa,MAAMY,aAAAA;GACtD,MAAM,MAAc,WAAW,aAAa;GAE5C,MAAMZ,uBAAAA,sBAAsB,SAAS,GAAG;EAC1C;EAEA,OAAO;CACT;CAEA,MAAM,mBACJ,MACA,YACA,SACa;EACb,OAAOc,yBAAAA,mBAAmB,MAAM,MAAM,YAAY,OAAO;CAC3D;AACF"}
@@ -1,8 +1,9 @@
1
1
  import { Tx } from "../proto/tm2/tx.cjs";
2
+ import "../proto/index.cjs";
2
3
  import { ABCIAccount } from "./types/abci.cjs";
3
4
  import { BlockInfo, BlockResult, BroadcastAsGeneric, BroadcastTransactionMap, ConsensusParams, NetworkInfo, Status, TxResult } from "./types/common.cjs";
5
+ import "./types/index.cjs";
4
6
  import { Tm2Client } from "@gnolang/tm2-rpc";
5
-
6
7
  //#region src/provider/provider.d.ts
7
8
  /**
8
9
  * Read-only abstraction for accessing blockchain data
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.cts","names":[],"sources":["../../src/provider/provider.ts"],"mappings":";;;;;;;;;UAkDiB,QAAA;;AAAjB;;;;;;EAUE,UAAA,CACE,OAAA,UACA,YAAA,WACA,MAAA,YACC,OAAA;EA4B2C;;;;;;;EAnB9C,kBAAA,CAAmB,OAAA,UAAiB,MAAA,YAAkB,OAAA;EAiDV;;;;;;;;EAvC5C,gBAAA,CAAiB,OAAA,UAAiB,MAAA,YAAkB,OAAA;EAsEtB;;;;;;;EA7D9B,UAAA,CAAW,OAAA,UAAiB,MAAA,YAAkB,OAAA,CAAQ,WAAA;EA/BpD;;;;EAqCF,QAAA,CAAS,MAAA,WAAiB,OAAA,CAAQ,SAAA;EAzBf;;;;EA+BnB,cAAA,CAAe,MAAA,WAAiB,OAAA,CAAQ,WAAA;EArBN;;;EA0BlC,cAAA,IAAkB,OAAA;EAjBU;;;EAwB5B,UAAA,IAAc,OAAA,CAAQ,WAAA;EAlBb;;;;EAwBT,kBAAA,CAAmB,MAAA,WAAiB,OAAA,CAAQ,eAAA;EAlBZ;;;EAuBhC,SAAA,IAAa,OAAA,CAAQ,MAAA;EAXrB;;;EAgBA,WAAA,IAAe,OAAA;EAVI;;;;EAgBnB,WAAA,CAAY,EAAA,EAAI,EAAA,GAAK,OAAA;EAXA;;;;;;;;EAuBrB,eAAA,iBAAgC,uBAAA,EAC9B,EAAA,UACA,QAAA,EAAU,CAAA,GACT,OAAA,CAAQ,kBAAA,CAAmB,CAAA;EAHE;;;;;;;;;;;;EAiBhC,kBAAA,CACE,IAAA,UACA,UAAA,WACA,OAAA,YACC,OAAA,CAAQ,EAAA;AAAA;;AAOb;;;uBAAsB,eAAA,YAA2B,QAAA;EAAA,mBAC5B,MAAA,EAAQ,SAAA;EAAA,UAElB,WAAA,CAAa,MAAA,EAAQ,SAAA;EAIxB,WAAA,CAAY,EAAA,EAA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;;EAK5C,aAAa,QAAQ;;;;EAKrB,eAAe;;;;;EAMf,YAAY,IAAI,KAAK;;;;;;;;;EAYrB,gBAAgB,gBAAgB,yBAC9B,YACA,UAAU,IACT,QAAQ,mBAAmB;;;;;;;;;;;;;EAc9B,mBACE,cACA,qBACA,mBACC,QAAQ;;;;;;uBAOS,2BAA2B;qBAC5B,QAAQ;YAElB,YAAa,QAAQ;EAIxB,YAAY,IAAI,KAAK;EAoBrB,WACJ,iBACA,uBACA,kBACC;EAgBG,SAAS,iBAAiB,QAAQ;EAKlC,eAAe,iBAAiB,QAAQ;EAKxC,kBAAkB;EAKlB,mBAAmB,iBAAiB,QAAQ;EAKlD,eAAe;EAIT,cAAc,QAAQ;EAKtB,mBAAmB,iBAAiB,kBAAkB;EAYtD,iBAAiB,iBAAiB,kBAAkB;EAcpD,WAAW,iBAAiB,kBAAkB,QAAQ;EAYtD,aAAa,QAAQ;EAKrB,eAAe,eAAe,QAAQ;EAUtC,gBAAgB,gBAAgB,yBACpC,YACA,UAAU,IACT,QAAQ,wBAAwB;UAYrB;UAkBA;EA6BR,mBACJ,cACA,qBACA,mBACC,QAAQ"}
@@ -1,8 +1,9 @@
1
1
  import { Tx } from "../proto/tm2/tx.mjs";
2
+ import "../proto/index.mjs";
2
3
  import { ABCIAccount } from "./types/abci.mjs";
3
4
  import { BlockInfo, BlockResult, BroadcastAsGeneric, BroadcastTransactionMap, ConsensusParams, NetworkInfo, Status, TxResult } from "./types/common.mjs";
5
+ import "./types/index.mjs";
4
6
  import { Tm2Client } from "@gnolang/tm2-rpc";
5
-
6
7
  //#region src/provider/provider.d.ts
7
8
  /**
8
9
  * Read-only abstraction for accessing blockchain data
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.mts","names":[],"sources":["../../src/provider/provider.ts"],"mappings":";;;;;;;;;UAkDiB,QAAA;;AAAjB;;;;;;EAUE,UAAA,CACE,OAAA,UACA,YAAA,WACA,MAAA,YACC,OAAA;EA4B2C;;;;;;;EAnB9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Q;EAIxB,YAAY,IAAI,KAAK;EAoBrB,WACJ,iBACA,uBACA,kBACC;EAgBG,SAAS,iBAAiB,QAAQ;EAKlC,eAAe,iBAAiB,QAAQ;EAKxC,kBAAkB;EAKlB,mBAAmB,iBAAiB,QAAQ;EAKlD,eAAe;EAIT,cAAc,QAAQ;EAKtB,mBAAmB,iBAAiB,kBAAkB;EAYtD,iBAAiB,iBAAiB,kBAAkB;EAcpD,WAAW,iBAAiB,kBAAkB,QAAQ;EAYtD,aAAa,QAAQ;EAKrB,eAAe,eAAe,QAAQ;EAUtC,gBAAgB,gBAAgB,yBACpC,YACA,UAAU,IACT,QAAQ,wBAAwB;UAYrB;UAkBA;EA6BR,mBACJ,cACA,qBACA,mBACC,QAAQ"}
@@ -1,7 +1,7 @@
1
1
  import { Tx } from "../proto/tm2/tx.mjs";
2
2
  import "../proto/index.mjs";
3
- import { TransactionEndpoint } from "./endpoints.mjs";
4
- import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.mjs";
3
+ import "./endpoints.mjs";
4
+ import _defineProperty from "../_virtual/_@oxc-project_runtime@0.143.0/helpers/esm/defineProperty.mjs";
5
5
  import { ABCIErrorKey } from "./types/abci.mjs";
6
6
  import "./types/index.mjs";
7
7
  import { constructRequestError } from "./utility/errors.utility.mjs";
@@ -21,84 +21,100 @@ var BaseTm2Provider = class {
21
21
  }
22
22
  async estimateGas(tx) {
23
23
  const encodedTx = uint8ArrayToBase64(Tx.encode(tx).finish());
24
- const simulateResult = extractSimulateFromResponse(adaptAbciQueryResponse(await this.client.abciQuery({
24
+ const rpcResponse = await this.client.abciQuery({
25
25
  path: ".app/simulate",
26
26
  data: new TextEncoder().encode(encodedTx),
27
27
  height: 0,
28
28
  prove: false
29
- })));
29
+ });
30
+ const abciResponse = adaptAbciQueryResponse(rpcResponse);
31
+ const simulateResult = extractSimulateFromResponse(abciResponse);
30
32
  const resultErrorKey = simulateResult.response_base?.error?.type_url;
31
33
  if (resultErrorKey) throw constructRequestError(resultErrorKey);
32
34
  return simulateResult.gas_used;
33
35
  }
34
36
  async getBalance(address, denomination, height) {
35
- return extractBalanceFromResponse(adaptAbciQueryResponse(await this.client.abciQuery({
37
+ const rpcResponse = await this.client.abciQuery({
36
38
  path: `bank/balances/${address}`,
37
- data: new Uint8Array(),
39
+ data: /* @__PURE__ */ new Uint8Array(),
38
40
  height: height ? height : 0,
39
41
  prove: false
40
- })).response.ResponseBase.Data, denomination ? denomination : "ugnot");
42
+ });
43
+ const abciResponse = adaptAbciQueryResponse(rpcResponse);
44
+ return extractBalanceFromResponse(abciResponse.response.ResponseBase.Data, denomination ? denomination : "ugnot");
41
45
  }
42
46
  async getBlock(height) {
43
- return adaptBlockResponse(await this.client.block(height));
47
+ const rpcResponse = await this.client.block(height);
48
+ return adaptBlockResponse(rpcResponse);
44
49
  }
45
50
  async getBlockResult(height) {
46
- return adaptBlockResultsResponse(await this.client.blockResults(height));
51
+ const rpcResponse = await this.client.blockResults(height);
52
+ return adaptBlockResultsResponse(rpcResponse);
47
53
  }
48
54
  async getBlockNumber() {
49
55
  const status = await this.getStatus();
50
56
  return parseInt(status.sync_info.latest_block_height);
51
57
  }
52
58
  async getConsensusParams(height) {
53
- return adaptConsensusParamsResponse(await this.client.consensusParams(height));
59
+ const rpcResponse = await this.client.consensusParams(height);
60
+ return adaptConsensusParamsResponse(rpcResponse);
54
61
  }
55
62
  getGasPrice() {
56
63
  return Promise.reject("not supported");
57
64
  }
58
65
  async getNetwork() {
59
- return adaptNetInfoResponse(await this.client.netInfo());
66
+ const rpcResponse = await this.client.netInfo();
67
+ return adaptNetInfoResponse(rpcResponse);
60
68
  }
61
69
  async getAccountSequence(address, height) {
62
- return extractSequenceFromResponse(adaptAbciQueryResponse(await this.client.abciQuery({
70
+ const rpcResponse = await this.client.abciQuery({
63
71
  path: `auth/accounts/${address}`,
64
- data: new Uint8Array(),
72
+ data: /* @__PURE__ */ new Uint8Array(),
65
73
  height: height ? height : 0,
66
74
  prove: false
67
- })).response.ResponseBase.Data);
75
+ });
76
+ const abciResponse = adaptAbciQueryResponse(rpcResponse);
77
+ return extractSequenceFromResponse(abciResponse.response.ResponseBase.Data);
68
78
  }
69
79
  async getAccountNumber(address, height) {
70
- return extractAccountNumberFromResponse(adaptAbciQueryResponse(await this.client.abciQuery({
80
+ const rpcResponse = await this.client.abciQuery({
71
81
  path: `auth/accounts/${address}`,
72
- data: new Uint8Array(),
82
+ data: /* @__PURE__ */ new Uint8Array(),
73
83
  height: height ? height : 0,
74
84
  prove: false
75
- })).response.ResponseBase.Data);
85
+ });
86
+ const abciResponse = adaptAbciQueryResponse(rpcResponse);
87
+ return extractAccountNumberFromResponse(abciResponse.response.ResponseBase.Data);
76
88
  }
77
89
  async getAccount(address, height) {
78
- return extractAccountFromResponse(adaptAbciQueryResponse(await this.client.abciQuery({
90
+ const rpcResponse = await this.client.abciQuery({
79
91
  path: `auth/accounts/${address}`,
80
- data: new Uint8Array(),
92
+ data: /* @__PURE__ */ new Uint8Array(),
81
93
  height: height ? height : 0,
82
94
  prove: false
83
- })).response.ResponseBase.Data);
95
+ });
96
+ const abciResponse = adaptAbciQueryResponse(rpcResponse);
97
+ return extractAccountFromResponse(abciResponse.response.ResponseBase.Data);
84
98
  }
85
99
  async getStatus() {
86
- return adaptStatusResponse(await this.client.status());
100
+ const rpcResponse = await this.client.status();
101
+ return adaptStatusResponse(rpcResponse);
87
102
  }
88
103
  async getTransaction(hash) {
89
104
  const hashBytes = Uint8Array.from((hash.match(/.{1,2}/g) ?? []).map((byte) => parseInt(byte, 16)));
90
- return adaptTxResponse(await this.client.tx({ hash: hashBytes }));
105
+ const rpcResponse = await this.client.tx({ hash: hashBytes });
106
+ return adaptTxResponse(rpcResponse);
91
107
  }
92
108
  async sendTransaction(tx, endpoint) {
93
109
  const txBytes = Uint8Array.from(Buffer.from(tx, "base64"));
94
110
  switch (endpoint) {
95
- case TransactionEndpoint.BROADCAST_TX_COMMIT: return this.broadcastTxCommit(txBytes);
96
- case TransactionEndpoint.BROADCAST_TX_SYNC:
111
+ case "broadcast_tx_commit": return this.broadcastTxCommit(txBytes);
97
112
  default: return this.broadcastTxSync(txBytes);
98
113
  }
99
114
  }
100
115
  async broadcastTxSync(txBytes) {
101
- const response = adaptBroadcastTxSyncResponse(await this.client.broadcastTxSync({ tx: txBytes }));
116
+ const rpcResponse = await this.client.broadcastTxSync({ tx: txBytes });
117
+ const response = adaptBroadcastTxSyncResponse(rpcResponse);
102
118
  if (response.error) {
103
119
  const errType = response.error[ABCIErrorKey];
104
120
  const log = response.Log;
@@ -107,7 +123,8 @@ var BaseTm2Provider = class {
107
123
  return response;
108
124
  }
109
125
  async broadcastTxCommit(txBytes) {
110
- const response = adaptBroadcastTxCommitResponse(await this.client.broadcastTxCommit({ tx: txBytes }));
126
+ const rpcResponse = await this.client.broadcastTxCommit({ tx: txBytes });
127
+ const response = adaptBroadcastTxCommitResponse(rpcResponse);
111
128
  const { check_tx, deliver_tx } = response;
112
129
  if (check_tx.ResponseBase.Error) {
113
130
  const errType = check_tx.ResponseBase.Error[ABCIErrorKey];
@@ -1 +1 @@
1
- {"version":3,"file":"provider.mjs","names":[],"sources":["../../src/provider/provider.ts"],"sourcesContent":["import {\n Tm2Client,\n} from \"@gnolang/tm2-rpc\";\n\nimport {\n Tx,\n} from \"../proto/index.js\";\nimport {\n TransactionEndpoint,\n} from \"./endpoints.js\";\nimport {\n ABCIAccount,\n ABCIErrorKey,\n ABCIResponse,\n BlockInfo,\n BlockResult,\n BroadcastAsGeneric,\n BroadcastTransactionMap,\n BroadcastTxCommitResult,\n BroadcastTxSyncResult,\n ConsensusParams,\n NetworkInfo,\n Status,\n TxResult,\n} from \"./types/index.js\";\nimport {\n constructRequestError,\n} from \"./utility/errors.utility.js\";\nimport {\n adaptAbciQueryResponse,\n adaptBlockResponse,\n adaptBlockResultsResponse,\n adaptBroadcastTxCommitResponse,\n adaptBroadcastTxSyncResponse,\n adaptConsensusParamsResponse,\n adaptNetInfoResponse,\n adaptStatusResponse,\n adaptTxResponse,\n extractAccountFromResponse,\n extractAccountNumberFromResponse,\n extractBalanceFromResponse,\n extractSequenceFromResponse,\n extractSimulateFromResponse,\n uint8ArrayToBase64,\n waitForTransaction,\n} from \"./utility/index.js\";\n\n/**\n * Read-only abstraction for accessing blockchain data\n */\nexport interface Provider {\n // Account-specific methods //\n\n /**\n * Fetches the denomination balance of the account\n * @param {string} address the bech32 address of the account\n * @param {string} [denomination=ugnot] the balance denomination\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getBalance(\n address: string,\n denomination?: string,\n height?: number\n ): Promise<number>\n\n /**\n * Fetches the account sequence\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used.\n * @deprecated use {@link getAccount} instead\n */\n getAccountSequence(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account number. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n * @deprecated use {@link getAccount} instead\n */\n getAccountNumber(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getAccount(address: string, height?: number): Promise<ABCIAccount>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlock(height: number): Promise<BlockInfo>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlockResult(height: number): Promise<BlockResult>\n\n /**\n * Fetches the latest block number from the chain\n */\n getBlockNumber(): Promise<number>\n\n // Network-specific methods //\n\n /**\n * Fetches the network information\n */\n getNetwork(): Promise<NetworkInfo>\n\n /**\n * Fetches the consensus params for the specific block height\n * @param {number} height the height for querying\n */\n getConsensusParams(height: number): Promise<ConsensusParams>\n\n /**\n * Fetches the current node status\n */\n getStatus(): Promise<Status>\n\n /**\n * Fetches the current (recommended) average gas price\n */\n getGasPrice(): Promise<number>\n\n /**\n * Estimates the gas limit for the transaction\n * @param {Tx} tx the transaction that needs estimating\n */\n estimateGas(tx: Tx): Promise<bigint>\n\n // Transaction specific methods //\n\n /**\n * Sends the transaction to the node. If the type of endpoint\n * is a broadcast commit, waits for the transaction to be committed to the chain.\n * The transaction needs to be signed beforehand.\n * Returns the transaction broadcast result.\n * @param {string} tx the base64-encoded signed transaction\n * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)\n */\n sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K\n ): Promise<BroadcastAsGeneric<K>[\"result\"]>\n\n /**\n * Waits for the transaction to be committed on the chain.\n * NOTE: This method will not take in the fromHeight parameter once\n * proper transaction indexing is added - the implementation should\n * simply try to fetch the transaction first to see if it's included in a block\n * before starting to wait for it; Until then, this method should be used\n * in the sequence:\n * get latest block -> send transaction -> waitForTransaction(block before send)\n * @param {string} hash The transaction hash\n * @param {number} [fromHeight=latest] The block height used to begin the search\n * @param {number} [timeout=15000] Optional wait timeout in MS\n */\n waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number\n ): Promise<Tx>\n}\n\n/**\n * Base provider implementation backed by a Tm2Client.\n * Subclasses only need to provide a static `create()` factory.\n */\nexport abstract class BaseTm2Provider implements Provider {\n protected readonly client: Tm2Client;\n\n protected constructor(client: Tm2Client) {\n this.client = client;\n }\n\n async estimateGas(tx: Tx): Promise<bigint> {\n const encodedTx = uint8ArrayToBase64(Tx.encode(tx).finish());\n const rpcResponse = await this.client.abciQuery({\n path: \".app/simulate\",\n data: new TextEncoder().encode(encodedTx),\n height: 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n const simulateResult = extractSimulateFromResponse(abciResponse);\n\n const resultErrorKey = simulateResult.response_base?.error?.type_url;\n if (resultErrorKey) {\n throw constructRequestError(resultErrorKey);\n }\n\n return simulateResult.gas_used;\n }\n\n async getBalance(\n address: string,\n denomination?: string,\n height?: number,\n ): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `bank/balances/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n\n return extractBalanceFromResponse(\n abciResponse.response.ResponseBase.Data,\n denomination ? denomination : \"ugnot\",\n );\n }\n\n async getBlock(height: number): Promise<BlockInfo> {\n const rpcResponse = await this.client.block(height);\n return adaptBlockResponse(rpcResponse);\n }\n\n async getBlockResult(height: number): Promise<BlockResult> {\n const rpcResponse = await this.client.blockResults(height);\n return adaptBlockResultsResponse(rpcResponse);\n }\n\n async getBlockNumber(): Promise<number> {\n const status = await this.getStatus();\n return parseInt(status.sync_info.latest_block_height);\n }\n\n async getConsensusParams(height: number): Promise<ConsensusParams> {\n const rpcResponse = await this.client.consensusParams(height);\n return adaptConsensusParamsResponse(rpcResponse);\n }\n\n getGasPrice(): Promise<number> {\n return Promise.reject(\"not supported\");\n }\n\n async getNetwork(): Promise<NetworkInfo> {\n const rpcResponse = await this.client.netInfo();\n return adaptNetInfoResponse(rpcResponse);\n }\n\n async getAccountSequence(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractSequenceFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getAccountNumber(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountNumberFromResponse(\n abciResponse.response.ResponseBase.Data,\n );\n }\n\n async getAccount(address: string, height?: number): Promise<ABCIAccount> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getStatus(): Promise<Status> {\n const rpcResponse = await this.client.status();\n return adaptStatusResponse(rpcResponse);\n }\n\n async getTransaction(hash: string): Promise<TxResult> {\n const hashBytes = Uint8Array.from(\n (hash.match(/.{1,2}/g) ?? []).map(byte => parseInt(byte, 16)),\n );\n const rpcResponse = await this.client.tx({\n hash: hashBytes,\n });\n return adaptTxResponse(rpcResponse);\n }\n\n async sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K,\n ): Promise<BroadcastTransactionMap[K][\"result\"]> {\n const txBytes = Uint8Array.from(Buffer.from(tx, \"base64\"));\n\n switch (endpoint) {\n case TransactionEndpoint.BROADCAST_TX_COMMIT:\n return this.broadcastTxCommit(txBytes);\n case TransactionEndpoint.BROADCAST_TX_SYNC:\n default:\n return this.broadcastTxSync(txBytes);\n }\n }\n\n private async broadcastTxSync(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxSyncResult> {\n const rpcResponse = await this.client.broadcastTxSync({\n tx: txBytes,\n });\n const response = adaptBroadcastTxSyncResponse(rpcResponse);\n\n if (response.error) {\n const errType: string = response.error[ABCIErrorKey];\n const log: string = response.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n private async broadcastTxCommit(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxCommitResult> {\n const rpcResponse = await this.client.broadcastTxCommit({\n tx: txBytes,\n });\n const response = adaptBroadcastTxCommitResponse(rpcResponse);\n\n const {\n check_tx, deliver_tx,\n } = response;\n\n if (check_tx.ResponseBase.Error) {\n const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = check_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n if (deliver_tx.ResponseBase.Error) {\n const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = deliver_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n async waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number,\n ): Promise<Tx> {\n return waitForTransaction(this, hash, fromHeight, timeout);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkLA,IAAsB,kBAAtB,MAA0D;CAGxD,YAAsB,QAAmB;wBAFtB,UAAA,KAAA,EAAkB;AAGnC,OAAK,SAAS;;CAGhB,MAAM,YAAY,IAAyB;EACzC,MAAM,YAAY,mBAAmB,GAAG,OAAO,GAAG,CAAC,QAAQ,CAAC;EAS5D,MAAM,iBAAiB,4BADY,uBAPf,MAAM,KAAK,OAAO,UAAU;GAC9C,MAAM;GACN,MAAM,IAAI,aAAa,CAAC,OAAO,UAAU;GACzC,QAAQ;GACR,OAAO;GACR,CAAC,CAEoE,CACN;EAEhE,MAAM,iBAAiB,eAAe,eAAe,OAAO;AAC5D,MAAI,eACF,OAAM,sBAAsB,eAAe;AAG7C,SAAO,eAAe;;CAGxB,MAAM,WACJ,SACA,cACA,QACiB;AAUjB,SAAO,2BAF4B,uBAPf,MAAM,KAAK,OAAO,UAAU;GAC9C,MAAM,iBAAiB;GACvB,MAAM,IAAI,YAAY;GACtB,QAAQ,SAAS,SAAS;GAC1B,OAAO;GACR,CAAC,CAEoE,CAGvD,SAAS,aAAa,MACnC,eAAe,eAAe,QAC/B;;CAGH,MAAM,SAAS,QAAoC;AAEjD,SAAO,mBADa,MAAM,KAAK,OAAO,MAAM,OAAO,CACb;;CAGxC,MAAM,eAAe,QAAsC;AAEzD,SAAO,0BADa,MAAM,KAAK,OAAO,aAAa,OAAO,CACb;;CAG/C,MAAM,iBAAkC;EACtC,MAAM,SAAS,MAAM,KAAK,WAAW;AACrC,SAAO,SAAS,OAAO,UAAU,oBAAoB;;CAGvD,MAAM,mBAAmB,QAA0C;AAEjE,SAAO,6BADa,MAAM,KAAK,OAAO,gBAAg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xC,KAAK,oBAAoB;GACzB,QACE,QAAO,KAAK,gBAAgB,QAAQ;;;CAI1C,MAAc,gBACZ,SACgC;EAIhC,MAAM,WAAW,6BAHG,MAAM,KAAK,OAAO,gBAAgB,EACpD,IAAI,SACL,CAAC,CACwD;AAE1D,MAAI,SAAS,OAAO;GAClB,MAAM,UAAkB,SAAS,MAAM;GACvC,MAAM,MAAc,SAAS;AAE7B,SAAM,sBAAsB,SAAS,IAAI;;AAG3C,SAAO;;CAGT,MAAc,kBACZ,SACkC;EAIlC,MAAM,WAAW,+BAHG,MAAM,KAAK,OAAO,kBAAkB,EACtD,IAAI,SACL,CAAC,CAC0D;EAE5D,MAAM,EACJ,UAAU,eACR;AAEJ,MAAI,SAAS,aAAa,OAAO;GAC/B,MAAM,UAAkB,SAAS,aAAa,MAAM;GACpD,MAAM,MAAc,SAAS,aAAa;AAE1C,SAAM,sBAAsB,SAAS,IAAI;;AAG3C,MAAI,WAAW,aAAa,OAAO;GACjC,MAAM,UAAkB,WAAW,aAAa,MAAM;GACtD,MAAM,MAAc,WAAW,aAAa;AAE5C,SAAM,sBAAsB,SAAS,IAAI;;AAG3C,SAAO;;CAGT,MAAM,mBACJ,MACA,YACA,SACa;AACb,SAAO,mBAAmB,MAAM,MAAM,YAAY,QAAQ"}
1
+ {"version":3,"file":"provider.mjs","names":[],"sources":["../../src/provider/provider.ts"],"sourcesContent":["import {\n Tm2Client,\n} from \"@gnolang/tm2-rpc\";\n\nimport {\n Tx,\n} from \"../proto/index.js\";\nimport {\n TransactionEndpoint,\n} from \"./endpoints.js\";\nimport {\n ABCIAccount,\n ABCIErrorKey,\n ABCIResponse,\n BlockInfo,\n BlockResult,\n BroadcastAsGeneric,\n BroadcastTransactionMap,\n BroadcastTxCommitResult,\n BroadcastTxSyncResult,\n ConsensusParams,\n NetworkInfo,\n Status,\n TxResult,\n} from \"./types/index.js\";\nimport {\n constructRequestError,\n} from \"./utility/errors.utility.js\";\nimport {\n adaptAbciQueryResponse,\n adaptBlockResponse,\n adaptBlockResultsResponse,\n adaptBroadcastTxCommitResponse,\n adaptBroadcastTxSyncResponse,\n adaptConsensusParamsResponse,\n adaptNetInfoResponse,\n adaptStatusResponse,\n adaptTxResponse,\n extractAccountFromResponse,\n extractAccountNumberFromResponse,\n extractBalanceFromResponse,\n extractSequenceFromResponse,\n extractSimulateFromResponse,\n uint8ArrayToBase64,\n waitForTransaction,\n} from \"./utility/index.js\";\n\n/**\n * Read-only abstraction for accessing blockchain data\n */\nexport interface Provider {\n // Account-specific methods //\n\n /**\n * Fetches the denomination balance of the account\n * @param {string} address the bech32 address of the account\n * @param {string} [denomination=ugnot] the balance denomination\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getBalance(\n address: string,\n denomination?: string,\n height?: number\n ): Promise<number>\n\n /**\n * Fetches the account sequence\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used.\n * @deprecated use {@link getAccount} instead\n */\n getAccountSequence(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account number. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n * @deprecated use {@link getAccount} instead\n */\n getAccountNumber(address: string, height?: number): Promise<number>\n\n /**\n * Fetches the account. Errors out if the account\n * is not initialized\n * @param {string} address the bech32 address of the account\n * @param {number} [height=0] the height for querying.\n * If omitted, the latest height is used\n */\n getAccount(address: string, height?: number): Promise<ABCIAccount>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlock(height: number): Promise<BlockInfo>\n\n /**\n * Fetches the block at the specific height, if any\n * @param {number} height the height for querying\n */\n getBlockResult(height: number): Promise<BlockResult>\n\n /**\n * Fetches the latest block number from the chain\n */\n getBlockNumber(): Promise<number>\n\n // Network-specific methods //\n\n /**\n * Fetches the network information\n */\n getNetwork(): Promise<NetworkInfo>\n\n /**\n * Fetches the consensus params for the specific block height\n * @param {number} height the height for querying\n */\n getConsensusParams(height: number): Promise<ConsensusParams>\n\n /**\n * Fetches the current node status\n */\n getStatus(): Promise<Status>\n\n /**\n * Fetches the current (recommended) average gas price\n */\n getGasPrice(): Promise<number>\n\n /**\n * Estimates the gas limit for the transaction\n * @param {Tx} tx the transaction that needs estimating\n */\n estimateGas(tx: Tx): Promise<bigint>\n\n // Transaction specific methods //\n\n /**\n * Sends the transaction to the node. If the type of endpoint\n * is a broadcast commit, waits for the transaction to be committed to the chain.\n * The transaction needs to be signed beforehand.\n * Returns the transaction broadcast result.\n * @param {string} tx the base64-encoded signed transaction\n * @param {BroadcastType} endpoint the transaction broadcast type (sync / commit)\n */\n sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K\n ): Promise<BroadcastAsGeneric<K>[\"result\"]>\n\n /**\n * Waits for the transaction to be committed on the chain.\n * NOTE: This method will not take in the fromHeight parameter once\n * proper transaction indexing is added - the implementation should\n * simply try to fetch the transaction first to see if it's included in a block\n * before starting to wait for it; Until then, this method should be used\n * in the sequence:\n * get latest block -> send transaction -> waitForTransaction(block before send)\n * @param {string} hash The transaction hash\n * @param {number} [fromHeight=latest] The block height used to begin the search\n * @param {number} [timeout=15000] Optional wait timeout in MS\n */\n waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number\n ): Promise<Tx>\n}\n\n/**\n * Base provider implementation backed by a Tm2Client.\n * Subclasses only need to provide a static `create()` factory.\n */\nexport abstract class BaseTm2Provider implements Provider {\n protected readonly client: Tm2Client;\n\n protected constructor(client: Tm2Client) {\n this.client = client;\n }\n\n async estimateGas(tx: Tx): Promise<bigint> {\n const encodedTx = uint8ArrayToBase64(Tx.encode(tx).finish());\n const rpcResponse = await this.client.abciQuery({\n path: \".app/simulate\",\n data: new TextEncoder().encode(encodedTx),\n height: 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n const simulateResult = extractSimulateFromResponse(abciResponse);\n\n const resultErrorKey = simulateResult.response_base?.error?.type_url;\n if (resultErrorKey) {\n throw constructRequestError(resultErrorKey);\n }\n\n return simulateResult.gas_used;\n }\n\n async getBalance(\n address: string,\n denomination?: string,\n height?: number,\n ): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `bank/balances/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n\n return extractBalanceFromResponse(\n abciResponse.response.ResponseBase.Data,\n denomination ? denomination : \"ugnot\",\n );\n }\n\n async getBlock(height: number): Promise<BlockInfo> {\n const rpcResponse = await this.client.block(height);\n return adaptBlockResponse(rpcResponse);\n }\n\n async getBlockResult(height: number): Promise<BlockResult> {\n const rpcResponse = await this.client.blockResults(height);\n return adaptBlockResultsResponse(rpcResponse);\n }\n\n async getBlockNumber(): Promise<number> {\n const status = await this.getStatus();\n return parseInt(status.sync_info.latest_block_height);\n }\n\n async getConsensusParams(height: number): Promise<ConsensusParams> {\n const rpcResponse = await this.client.consensusParams(height);\n return adaptConsensusParamsResponse(rpcResponse);\n }\n\n getGasPrice(): Promise<number> {\n return Promise.reject(\"not supported\");\n }\n\n async getNetwork(): Promise<NetworkInfo> {\n const rpcResponse = await this.client.netInfo();\n return adaptNetInfoResponse(rpcResponse);\n }\n\n async getAccountSequence(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractSequenceFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getAccountNumber(address: string, height?: number): Promise<number> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountNumberFromResponse(\n abciResponse.response.ResponseBase.Data,\n );\n }\n\n async getAccount(address: string, height?: number): Promise<ABCIAccount> {\n const rpcResponse = await this.client.abciQuery({\n path: `auth/accounts/${address}`,\n data: new Uint8Array(),\n height: height ? height : 0,\n prove: false,\n });\n\n const abciResponse: ABCIResponse = adaptAbciQueryResponse(rpcResponse);\n return extractAccountFromResponse(abciResponse.response.ResponseBase.Data);\n }\n\n async getStatus(): Promise<Status> {\n const rpcResponse = await this.client.status();\n return adaptStatusResponse(rpcResponse);\n }\n\n async getTransaction(hash: string): Promise<TxResult> {\n const hashBytes = Uint8Array.from(\n (hash.match(/.{1,2}/g) ?? []).map(byte => parseInt(byte, 16)),\n );\n const rpcResponse = await this.client.tx({\n hash: hashBytes,\n });\n return adaptTxResponse(rpcResponse);\n }\n\n async sendTransaction<K extends keyof BroadcastTransactionMap>(\n tx: string,\n endpoint: K,\n ): Promise<BroadcastTransactionMap[K][\"result\"]> {\n const txBytes = Uint8Array.from(Buffer.from(tx, \"base64\"));\n\n switch (endpoint) {\n case TransactionEndpoint.BROADCAST_TX_COMMIT:\n return this.broadcastTxCommit(txBytes);\n case TransactionEndpoint.BROADCAST_TX_SYNC:\n default:\n return this.broadcastTxSync(txBytes);\n }\n }\n\n private async broadcastTxSync(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxSyncResult> {\n const rpcResponse = await this.client.broadcastTxSync({\n tx: txBytes,\n });\n const response = adaptBroadcastTxSyncResponse(rpcResponse);\n\n if (response.error) {\n const errType: string = response.error[ABCIErrorKey];\n const log: string = response.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n private async broadcastTxCommit(\n txBytes: Uint8Array,\n ): Promise<BroadcastTxCommitResult> {\n const rpcResponse = await this.client.broadcastTxCommit({\n tx: txBytes,\n });\n const response = adaptBroadcastTxCommitResponse(rpcResponse);\n\n const {\n check_tx, deliver_tx,\n } = response;\n\n if (check_tx.ResponseBase.Error) {\n const errType: string = check_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = check_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n if (deliver_tx.ResponseBase.Error) {\n const errType: string = deliver_tx.ResponseBase.Error[ABCIErrorKey];\n const log: string = deliver_tx.ResponseBase.Log;\n\n throw constructRequestError(errType, log);\n }\n\n return response;\n }\n\n async waitForTransaction(\n hash: string,\n fromHeight?: number,\n timeout?: number,\n ): Promise<Tx> {\n return waitForTransaction(this, hash, fromHeight, timeout);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkLA,IAAsB,kBAAtB,MAA0D;CAGxD,YAAsB,QAAmB;EAFtB,gBAAA,MAAA,UAAA,KAAA,CAAA;EAGjB,KAAK,SAAS;CAChB;CAEA,MAAM,YAAY,IAAyB;EACzC,MAAM,YAAY,mBAAmB,GAAG,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC;EAC3D,MAAM,cAAc,MAAM,KAAK,OAAO,UAAU;GAC9C,MAAM;GACN,MAAM,IAAI,YAAY,CAAC,CAAC,OAAO,SAAS;GACxC,QAAQ;GACR,OAAO;EACT,CAAC;EAED,MAAM,eAA6B,uBAAuB,WAAW;EACrE,MAAM,iBAAiB,4BAA4B,YAAY;EAE/D,MAAM,iBAAiB,eAAe,eAAe,OAAO;EAC5D,IAAI,gBACF,MAAM,sBAAsB,cAAc;EAG5C,OAAO,eAAe;CACxB;CAEA,MAAM,WACJ,SACA,cACA,QACiB;EACjB,MAAM,cAAc,MAAM,KAAK,OAAO,UAAU;GAC9C,MAAM,iBAAiB;GACvB,sBAAM,IAAI,WAAW;GACrB,QAAQ,SAAS,SAAS;GAC1B,OAAO;EACT,CAAC;EAED,MAAM,eAA6B,uBAAuB,WAAW;EAErE,OAAO,2BACL,aAAa,SAAS,aAAa,MACnC,eAAe,eAAe,OAChC;CACF;CAEA,MAAM,SAAS,QAAoC;EACjD,MAAM,cAAc,MAAM,KAAK,OAAO,MAAM,MAAM;EAClD,OAAO,mBAAmB,WAAW;CACvC;CAEA,MAAM,eAAe,Q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ACT;CAEA,MAAM,mBACJ,MACA,YACA,SACa;EACb,OAAO,mBAAmB,MAAM,MAAM,YAAY,OAAO;CAC3D;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"abci.d.cts","names":[],"sources":["../../../src/provider/types/abci.ts"],"mappings":";UAAiB,YAAA;EACf,QAAA;IACE,YAAA,EAAc,gBAAA;IACd,GAAA;IACA,KAAA;IACA,KAAA,EAAO,WAAA;IACP,MAAA;EAAA;AAAA;AAAA,UAIa,gBAAA;EACf,KAAA;IAAA,CAEG,GAAA;EAAA;EAEH,IAAA;EACA,MAAA;EACA,GAAA;EACA,IAAA;AAAA;AAAA,UAGQ,WAAA;EACR,GAAA;IACE,IAAA;IACA,GAAA;IACA,IAAA;EAAA;AAAA;AAAA,UAIa,WAAA;EACf,WAAA;IAEE,OAAA;IAEA,KAAA;IAEA,UAAA;MAEE,OAAA;MAEA,KAAA;IAAA;IAGF,cAAA;IAEA,QAAA;EAAA;AAAA;AAAA,cAIS,YAAA"}
1
+ {"version":3,"file":"abci.d.cts","names":[],"sources":["../../../src/provider/types/abci.ts"],"mappings":";UAAiB;EACf;IACE,cAAc;IACd;IACA;IACA,OAAO;IACP;;;UAIa;EACf;KAEG;;EAEH;EACA;EACA;EACA;;UAGQ;EACR;IACE;IACA;IACA;;;UAIa;EACf;IAEE;IAEA;IAEA;MAEE;MAEA;;IAGF;IAEA;;;cAIS"}
@@ -1 +1 @@
1
- {"version":3,"file":"abci.d.mts","names":[],"sources":["../../../src/provider/types/abci.ts"],"mappings":";UAAiB,YAAA;EACf,QAAA;IACE,YAAA,EAAc,gBAAA;IACd,GAAA;IACA,KAAA;IACA,KAAA,EAAO,WAAA;IACP,MAAA;EAAA;AAAA;AAAA,UAIa,gBAAA;EACf,KAAA;IAAA,CAEG,GAAA;EAAA;EAEH,IAAA;EACA,MAAA;EACA,GAAA;EACA,IAAA;AAAA;AAAA,UAGQ,WAAA;EACR,GAAA;IACE,IAAA;IACA,GAAA;IACA,IAAA;EAAA;AAAA;AAAA,UAIa,WAAA;EACf,WAAA;IAEE,OAAA;IAEA,KAAA;IAEA,UAAA;MAEE,OAAA;MAEA,KAAA;IAAA;IAGF,cAAA;IAEA,QAAA;EAAA;AAAA;AAAA,cAIS,YAAA"}
1
+ {"version":3,"file":"abci.d.mts","names":[],"sources":["../../../src/provider/types/abci.ts"],"mappings":";UAAiB;EACf;IACE,cAAc;IACd;IACA;IACA,OAAO;IACP;;;UAIa;EACf;KAEG;;EAEH;EACA;EACA;EACA;;UAGQ;EACR;IACE;IACA;IACA;;;UAIa;EACf;IAEE;IAEA;IAEA;MAEE;MAEA;;IAGF;IAEA;;;cAIS"}
@@ -1,6 +1,5 @@
1
1
  import { TransactionEndpoint } from "../endpoints.cjs";
2
2
  import { ABCIResponseBase } from "./abci.cjs";
3
-
4
3
  //#region src/provider/types/common.d.ts
5
4
  interface NetworkInfo {
6
5
  listening: boolean;
@@ -180,7 +179,7 @@ type BroadcastTransactionMap = {
180
179
  [TransactionEndpoint.BROADCAST_TX_COMMIT]: BroadcastTransactionCommit;
181
180
  [TransactionEndpoint.BROADCAST_TX_SYNC]: BroadcastTransactionSync;
182
181
  };
183
- type BroadcastAsGeneric<K extends keyof BroadcastTransactionMap = keyof BroadcastTransactionMap> = { [P in K]: BroadcastTransactionMap[P] }[K];
182
+ type BroadcastAsGeneric<K extends keyof BroadcastTransactionMap = keyof BroadcastTransactionMap> = { [P in K]: BroadcastTransactionMap[P]; }[K];
184
183
  //#endregion
185
184
  export { BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, Status, TxResult };
186
185
  //# sourceMappingURL=common.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.cts","names":[],"sources":["../../../src/provider/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;;EAEH;EACA;EAEA;;UAGe;EACf,UAAU;EACV,YAAY;EACZ;EACA;;KAGU,gBACN,oBAAoB,oBACpB,oBAAoB;KAEd;EACV,UAAU,oBAAoB;EAC9B,QAAQ;;KAGE;EACV,UAAU,oBAAoB;EAC9B,QAAQ;;KAGE;GACT,oBAAoB,sBAAsB;GAC1C,oBAAoB,oBAAoB;;KAG/B,mBACV,gBAAgB,gCAAgC,8BAE/C,KAAK,IAAI,wBAAwB,MAClC"}
@@ -1,6 +1,5 @@
1
1
  import { TransactionEndpoint } from "../endpoints.mjs";
2
2
  import { ABCIResponseBase } from "./abci.mjs";
3
-
4
3
  //#region src/provider/types/common.d.ts
5
4
  interface NetworkInfo {
6
5
  listening: boolean;
@@ -180,7 +179,7 @@ type BroadcastTransactionMap = {
180
179
  [TransactionEndpoint.BROADCAST_TX_COMMIT]: BroadcastTransactionCommit;
181
180
  [TransactionEndpoint.BROADCAST_TX_SYNC]: BroadcastTransactionSync;
182
181
  };
183
- type BroadcastAsGeneric<K extends keyof BroadcastTransactionMap = keyof BroadcastTransactionMap> = { [P in K]: BroadcastTransactionMap[P] }[K];
182
+ type BroadcastAsGeneric<K extends keyof BroadcastTransactionMap = keyof BroadcastTransactionMap> = { [P in K]: BroadcastTransactionMap[P]; }[K];
184
183
  //#endregion
185
184
  export { BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, Status, TxResult };
186
185
  //# sourceMappingURL=common.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.mts","names":[],"sources":["../../../src/provider/types/common.ts"],"mappings":";;;;UAOiB,WAAA;EAEf,SAAA;EAEA,SAAA;EAEA,OAAA;EAEA,KAAA;AAAA;AAAA,UAGe,MAAA;EAEf,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,oBAAoB;EAC9B,QAAQ;;KAGE;EACV,UAAU,oBAAoB;EAC9B,QAAQ;;KAGE;GACT,oBAAoB,sBAAsB;GAC1C,oBAAoB,oBAAoB;;KAG/B,mBACV,gBAAgB,gCAAgC,8BAE/C,KAAK,IAAI,wBAAwB,MAClC"}
@@ -1,3 +1,4 @@
1
- require("./abci.cjs");
1
+ const require_abci = require("./abci.cjs");
2
2
  require("./common.cjs");
3
3
  require("./jsonrpc.cjs");
4
+ exports.ABCIErrorKey = require_abci.ABCIErrorKey;
@@ -1,3 +1,4 @@
1
1
  import { ABCIAccount, ABCIErrorKey, ABCIResponse, ABCIResponseBase } from "./abci.cjs";
2
2
  import { BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, Status, TxResult } from "./common.cjs";
3
- import { RPCError, RPCRequest, RPCResponse } from "./jsonrpc.cjs";
3
+ import { RPCError, RPCRequest, RPCResponse } from "./jsonrpc.cjs";
4
+ export { ABCIAccount, ABCIErrorKey, ABCIResponse, ABCIResponseBase, BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, RPCError, RPCRequest, RPCResponse, Status, TxResult };
@@ -1,3 +1,4 @@
1
1
  import { ABCIAccount, ABCIErrorKey, ABCIResponse, ABCIResponseBase } from "./abci.mjs";
2
2
  import { BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, Status, TxResult } from "./common.mjs";
3
- import { RPCError, RPCRequest, RPCResponse } from "./jsonrpc.mjs";
3
+ import { RPCError, RPCRequest, RPCResponse } from "./jsonrpc.mjs";
4
+ export { ABCIAccount, ABCIErrorKey, ABCIResponse, ABCIResponseBase, BeginBlock, Block, BlockHeader, BlockID, BlockInfo, BlockMeta, BlockResult, BroadcastAsGeneric, BroadcastTransactionCommit, BroadcastTransactionMap, BroadcastTransactionSync, BroadcastTxCommitResult, BroadcastTxSyncResult, BroadcastType, ConsensusParams, ConsensusState, DeliverTx, EndBlock, NetworkInfo, PrecommitInfo, RPCError, RPCRequest, RPCResponse, Status, TxResult };
@@ -1,4 +1,4 @@
1
- import "./abci.mjs";
1
+ import { ABCIErrorKey } from "./abci.mjs";
2
2
  import "./common.mjs";
3
3
  import "./jsonrpc.mjs";
4
- export {};
4
+ export { ABCIErrorKey };
@@ -1 +1 @@
1
- {"version":3,"file":"jsonrpc.d.cts","names":[],"sources":["../../../src/provider/types/jsonrpc.ts"],"mappings":";;AAGA;;UAAiB,UAAA;EACf,OAAA;EACA,EAAA;EACA,MAAA;EAEA,MAAA;AAAA;;;AAMF;UAAiB,WAAA;EACf,OAAA;EACA,EAAA;EAEA,MAAA,GAAS,MAAA;EACT,KAAA,GAAQ,QAAA;AAAA;;;;UAMO,QAAA;EACf,IAAA;EACA,OAAA;EAEA,IAAA;AAAA"}
1
+ {"version":3,"file":"jsonrpc.d.cts","names":[],"sources":["../../../src/provider/types/jsonrpc.ts"],"mappings":";;;;UAGiB;EACf;EACA;EACA;EAEA;;;;;UAMe,YAAY;EAC3B;EACA;EAEA,SAAS;EACT,QAAQ;;;;;UAMO;EACf;EACA;EAEA"}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonrpc.d.mts","names":[],"sources":["../../../src/provider/types/jsonrpc.ts"],"mappings":";;AAGA;;UAAiB,UAAA;EACf,OAAA;EACA,EAAA;EACA,MAAA;EAEA,MAAA;AAAA;;;AAMF;UAAiB,WAAA;EACf,OAAA;EACA,EAAA;EAEA,MAAA,GAAS,MAAA;EACT,KAAA,GAAQ,QAAA;AAAA;;;;UAMO,QAAA;EACf,IAAA;EACA,OAAA;EAEA,IAAA;AAAA"}
1
+ {"version":3,"file":"jsonrpc.d.mts","names":[],"sources":["../../../src/provider/types/jsonrpc.ts"],"mappings":";;;;UAGiB;EACf;EACA;EACA;EAEA;;;;;UAMe,YAAY;EAC3B;EACA;EAEA,SAAS;EACT,QAAQ;;;;;UAMO;EACf;EACA;EAEA"}
@@ -54,7 +54,7 @@ const adaptStatusResponse = (r) => {
54
54
  address: toHexString(r.validatorInfo.address),
55
55
  pub_key: {
56
56
  type: r.validatorInfo.pubkey?.algorithm ?? "",
57
- value: toBase64(r.validatorInfo.pubkey?.data ?? new Uint8Array())
57
+ value: toBase64(r.validatorInfo.pubkey?.data ?? /* @__PURE__ */ new Uint8Array())
58
58
  },
59
59
  voting_power: String(r.validatorInfo.votingPower)
60
60
  }