boing-sdk 0.3.0

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 (186) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +191 -0
  3. package/dist/accessList.d.ts +22 -0
  4. package/dist/accessList.d.ts.map +1 -0
  5. package/dist/accessList.js +45 -0
  6. package/dist/bincode.d.ts +92 -0
  7. package/dist/bincode.d.ts.map +1 -0
  8. package/dist/bincode.js +154 -0
  9. package/dist/callAbi.d.ts +119 -0
  10. package/dist/callAbi.d.ts.map +1 -0
  11. package/dist/callAbi.js +156 -0
  12. package/dist/calldata.d.ts +35 -0
  13. package/dist/calldata.d.ts.map +1 -0
  14. package/dist/calldata.js +93 -0
  15. package/dist/canonicalDeployArtifacts.d.ts +154 -0
  16. package/dist/canonicalDeployArtifacts.d.ts.map +1 -0
  17. package/dist/canonicalDeployArtifacts.js +271 -0
  18. package/dist/canonicalTestnet.d.ts +15 -0
  19. package/dist/canonicalTestnet.d.ts.map +1 -0
  20. package/dist/canonicalTestnet.js +15 -0
  21. package/dist/canonicalTestnetDex.d.ts +17 -0
  22. package/dist/canonicalTestnetDex.d.ts.map +1 -0
  23. package/dist/canonicalTestnetDex.js +17 -0
  24. package/dist/chainIds.d.ts +18 -0
  25. package/dist/chainIds.d.ts.map +1 -0
  26. package/dist/chainIds.js +56 -0
  27. package/dist/client.d.ts +223 -0
  28. package/dist/client.d.ts.map +1 -0
  29. package/dist/client.js +659 -0
  30. package/dist/connectionMonitor.d.ts +47 -0
  31. package/dist/connectionMonitor.d.ts.map +1 -0
  32. package/dist/connectionMonitor.js +93 -0
  33. package/dist/create2.d.ts +94 -0
  34. package/dist/create2.d.ts.map +1 -0
  35. package/dist/create2.js +225 -0
  36. package/dist/dappDeploy.d.ts +100 -0
  37. package/dist/dappDeploy.d.ts.map +1 -0
  38. package/dist/dappDeploy.js +140 -0
  39. package/dist/dappUiHelpers.d.ts +28 -0
  40. package/dist/dappUiHelpers.d.ts.map +1 -0
  41. package/dist/dappUiHelpers.js +69 -0
  42. package/dist/defaultReferenceFungibleSecuredRuntimeBytecodeHex.d.ts +6 -0
  43. package/dist/defaultReferenceFungibleSecuredRuntimeBytecodeHex.d.ts.map +1 -0
  44. package/dist/defaultReferenceFungibleSecuredRuntimeBytecodeHex.js +5 -0
  45. package/dist/defaultReferenceFungibleSecuredTemplateBytecodeHex.d.ts +6 -0
  46. package/dist/defaultReferenceFungibleSecuredTemplateBytecodeHex.d.ts.map +1 -0
  47. package/dist/defaultReferenceFungibleSecuredTemplateBytecodeHex.js +5 -0
  48. package/dist/defaultReferenceFungibleTemplateBytecodeHex.d.ts +6 -0
  49. package/dist/defaultReferenceFungibleTemplateBytecodeHex.d.ts.map +1 -0
  50. package/dist/defaultReferenceFungibleTemplateBytecodeHex.js +5 -0
  51. package/dist/defaultReferenceNftCollectionTemplateBytecodeHex.d.ts +7 -0
  52. package/dist/defaultReferenceNftCollectionTemplateBytecodeHex.d.ts.map +1 -0
  53. package/dist/defaultReferenceNftCollectionTemplateBytecodeHex.js +6 -0
  54. package/dist/dexIntegration.d.ts +61 -0
  55. package/dist/dexIntegration.d.ts.map +1 -0
  56. package/dist/dexIntegration.js +193 -0
  57. package/dist/erc721Logs.d.ts +21 -0
  58. package/dist/erc721Logs.d.ts.map +1 -0
  59. package/dist/erc721Logs.js +69 -0
  60. package/dist/errors.d.ts +60 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +153 -0
  63. package/dist/hex.d.ts +27 -0
  64. package/dist/hex.d.ts.map +1 -0
  65. package/dist/hex.js +82 -0
  66. package/dist/index.d.ts +83 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +78 -0
  69. package/dist/indexerBatch.d.ts +111 -0
  70. package/dist/indexerBatch.d.ts.map +1 -0
  71. package/dist/indexerBatch.js +253 -0
  72. package/dist/indexerGaps.d.ts +50 -0
  73. package/dist/indexerGaps.d.ts.map +1 -0
  74. package/dist/indexerGaps.js +117 -0
  75. package/dist/indexerSync.d.ts +61 -0
  76. package/dist/indexerSync.d.ts.map +1 -0
  77. package/dist/indexerSync.js +100 -0
  78. package/dist/nativeAmm.d.ts +64 -0
  79. package/dist/nativeAmm.d.ts.map +1 -0
  80. package/dist/nativeAmm.js +174 -0
  81. package/dist/nativeAmmLogs.d.ts +48 -0
  82. package/dist/nativeAmmLogs.d.ts.map +1 -0
  83. package/dist/nativeAmmLogs.js +114 -0
  84. package/dist/nativeAmmLpVault.d.ts +94 -0
  85. package/dist/nativeAmmLpVault.d.ts.map +1 -0
  86. package/dist/nativeAmmLpVault.js +205 -0
  87. package/dist/nativeAmmPool.d.ts +124 -0
  88. package/dist/nativeAmmPool.d.ts.map +1 -0
  89. package/dist/nativeAmmPool.js +245 -0
  90. package/dist/nativeContractSubmit.d.ts +26 -0
  91. package/dist/nativeContractSubmit.d.ts.map +1 -0
  92. package/dist/nativeContractSubmit.js +23 -0
  93. package/dist/nativeDexDirectory.d.ts +83 -0
  94. package/dist/nativeDexDirectory.d.ts.map +1 -0
  95. package/dist/nativeDexDirectory.js +147 -0
  96. package/dist/nativeDexDirectoryApi.d.ts +121 -0
  97. package/dist/nativeDexDirectoryApi.d.ts.map +1 -0
  98. package/dist/nativeDexDirectoryApi.js +408 -0
  99. package/dist/nativeDexFactory.d.ts +25 -0
  100. package/dist/nativeDexFactory.d.ts.map +1 -0
  101. package/dist/nativeDexFactory.js +72 -0
  102. package/dist/nativeDexFactoryLogs.d.ts +19 -0
  103. package/dist/nativeDexFactoryLogs.d.ts.map +1 -0
  104. package/dist/nativeDexFactoryLogs.js +61 -0
  105. package/dist/nativeDexFactoryPool.d.ts +61 -0
  106. package/dist/nativeDexFactoryPool.d.ts.map +1 -0
  107. package/dist/nativeDexFactoryPool.js +120 -0
  108. package/dist/nativeDexIndexerStats.d.ts +96 -0
  109. package/dist/nativeDexIndexerStats.d.ts.map +1 -0
  110. package/dist/nativeDexIndexerStats.js +448 -0
  111. package/dist/nativeDexLedgerRouter.d.ts +67 -0
  112. package/dist/nativeDexLedgerRouter.d.ts.map +1 -0
  113. package/dist/nativeDexLedgerRouter.js +108 -0
  114. package/dist/nativeDexLpPositions.d.ts +39 -0
  115. package/dist/nativeDexLpPositions.d.ts.map +1 -0
  116. package/dist/nativeDexLpPositions.js +69 -0
  117. package/dist/nativeDexNftIndexer.d.ts +26 -0
  118. package/dist/nativeDexNftIndexer.d.ts.map +1 -0
  119. package/dist/nativeDexNftIndexer.js +50 -0
  120. package/dist/nativeDexPoolHistory.d.ts +40 -0
  121. package/dist/nativeDexPoolHistory.d.ts.map +1 -0
  122. package/dist/nativeDexPoolHistory.js +110 -0
  123. package/dist/nativeDexReceiptArchive.d.ts +25 -0
  124. package/dist/nativeDexReceiptArchive.d.ts.map +1 -0
  125. package/dist/nativeDexReceiptArchive.js +47 -0
  126. package/dist/nativeDexRouting.d.ts +160 -0
  127. package/dist/nativeDexRouting.d.ts.map +1 -0
  128. package/dist/nativeDexRouting.js +345 -0
  129. package/dist/nativeDexSeamless.d.ts +86 -0
  130. package/dist/nativeDexSeamless.d.ts.map +1 -0
  131. package/dist/nativeDexSeamless.js +131 -0
  132. package/dist/nativeDexSwap2Router.d.ts +45 -0
  133. package/dist/nativeDexSwap2Router.d.ts.map +1 -0
  134. package/dist/nativeDexSwap2Router.js +276 -0
  135. package/dist/nativeLpShareToken.d.ts +54 -0
  136. package/dist/nativeLpShareToken.d.ts.map +1 -0
  137. package/dist/nativeLpShareToken.js +135 -0
  138. package/dist/nativeTokenSecurity.d.ts +59 -0
  139. package/dist/nativeTokenSecurity.d.ts.map +1 -0
  140. package/dist/nativeTokenSecurity.js +59 -0
  141. package/dist/networkProfile.d.ts +8 -0
  142. package/dist/networkProfile.d.ts.map +1 -0
  143. package/dist/networkProfile.js +29 -0
  144. package/dist/newHeadsWs.d.ts +43 -0
  145. package/dist/newHeadsWs.d.ts.map +1 -0
  146. package/dist/newHeadsWs.js +139 -0
  147. package/dist/preflightGate.d.ts +16 -0
  148. package/dist/preflightGate.d.ts.map +1 -0
  149. package/dist/preflightGate.js +29 -0
  150. package/dist/receiptLogs.d.ts +29 -0
  151. package/dist/receiptLogs.d.ts.map +1 -0
  152. package/dist/receiptLogs.js +66 -0
  153. package/dist/referenceFungibleSecuredDeployBytecode.d.ts +54 -0
  154. package/dist/referenceFungibleSecuredDeployBytecode.d.ts.map +1 -0
  155. package/dist/referenceFungibleSecuredDeployBytecode.js +274 -0
  156. package/dist/referenceNft.d.ts +14 -0
  157. package/dist/referenceNft.d.ts.map +1 -0
  158. package/dist/referenceNft.js +34 -0
  159. package/dist/referenceToken.d.ts +14 -0
  160. package/dist/referenceToken.d.ts.map +1 -0
  161. package/dist/referenceToken.js +29 -0
  162. package/dist/retryAfter.d.ts +6 -0
  163. package/dist/retryAfter.d.ts.map +1 -0
  164. package/dist/retryAfter.js +24 -0
  165. package/dist/rpcCapabilities.d.ts +43 -0
  166. package/dist/rpcCapabilities.d.ts.map +1 -0
  167. package/dist/rpcCapabilities.js +159 -0
  168. package/dist/rpcDoctor.d.ts +27 -0
  169. package/dist/rpcDoctor.d.ts.map +1 -0
  170. package/dist/rpcDoctor.js +66 -0
  171. package/dist/rpcSurfaceUi.d.ts +32 -0
  172. package/dist/rpcSurfaceUi.d.ts.map +1 -0
  173. package/dist/rpcSurfaceUi.js +49 -0
  174. package/dist/submitFlow.d.ts +70 -0
  175. package/dist/submitFlow.d.ts.map +1 -0
  176. package/dist/submitFlow.js +121 -0
  177. package/dist/transactionBuilder.d.ts +55 -0
  178. package/dist/transactionBuilder.d.ts.map +1 -0
  179. package/dist/transactionBuilder.js +100 -0
  180. package/dist/types.d.ts +436 -0
  181. package/dist/types.d.ts.map +1 -0
  182. package/dist/types.js +4 -0
  183. package/dist/walletProvider.d.ts +46 -0
  184. package/dist/walletProvider.d.ts.map +1 -0
  185. package/dist/walletProvider.js +126 -0
  186. package/package.json +44 -0
@@ -0,0 +1,436 @@
1
+ /**
2
+ * Types for Boing RPC results and params.
3
+ */
4
+ /** Effective limits advertised in `boing_health` / `boing_getNetworkInfo.rpc_surface` (mirrors node env / config). */
5
+ export interface BoingHealthRpcSurface {
6
+ /** Max JSON-RPC batch length (`BOING_RPC_MAX_BATCH`, capped). */
7
+ jsonrpc_batch_max: number;
8
+ /** `BOING_RPC_WS_MAX_CONNECTIONS` (0 = unlimited). */
9
+ websocket_max_connections: number;
10
+ /** Node HTTP JSON-RPC rate limit RPS (0 = disabled). */
11
+ http_rate_limit_requests_per_sec: number;
12
+ /** `BOING_RPC_READY_MIN_PEERS` when set; otherwise `null`. */
13
+ ready_min_peers: number | null;
14
+ /** Effective max POST body size in MiB (`BOING_RPC_MAX_BODY_MB`). */
15
+ http_max_body_megabytes: number;
16
+ /** Max inclusive block span for `boing_getLogs` on this node. */
17
+ get_logs_max_block_range: number;
18
+ /** Max log rows returned per `boing_getLogs` call. */
19
+ get_logs_max_results: number;
20
+ /** Max topic filter entries for `boing_getLogs`. */
21
+ max_log_topic_filters: number;
22
+ }
23
+ /** Cumulative counters since node process start (`boing_health.rpc_metrics`). */
24
+ export interface BoingRpcMetrics {
25
+ rate_limited_total: number;
26
+ json_parse_errors_total: number;
27
+ batch_too_large_total: number;
28
+ method_not_found_total: number;
29
+ websocket_cap_rejects_total: number;
30
+ }
31
+ /** Result of `boing_health` — cheap liveness / version probe for load balancers and scripts. */
32
+ export interface BoingHealth {
33
+ ok: boolean;
34
+ client_version: string;
35
+ /** From `BOING_CHAIN_ID` when set on the node process; otherwise `null`. */
36
+ chain_id: number | null;
37
+ /** From `BOING_CHAIN_NAME` when set; otherwise `null`. */
38
+ chain_name: string | null;
39
+ head_height: number;
40
+ /** Present on current `boing-node`; omit on older binaries. */
41
+ rpc_surface?: BoingHealthRpcSurface;
42
+ /** Present on current `boing-node`; omit on older binaries. */
43
+ rpc_metrics?: BoingRpcMetrics;
44
+ }
45
+ /** Result of `BoingClient.preflightRpc()` — one-shot readiness for dashboards and CI. */
46
+ export interface BoingRpcPreflightResult {
47
+ health: BoingHealth;
48
+ supportedMethodCount: number;
49
+ /** Length of embedded catalog `methods` when `boing_getRpcMethodCatalog` exists; otherwise `null`. */
50
+ catalogMethodCount: number | null;
51
+ /** True when `boing_getRpcOpenApi` returns an object with an `openapi` field. */
52
+ openApiPresent: boolean;
53
+ /** `GET {baseUrl}/live` returned HTTP 200 when checked. */
54
+ httpLiveOk: boolean;
55
+ /** `GET {baseUrl}/ready` returned HTTP 200 when checked. */
56
+ httpReadyOk: boolean;
57
+ /** True when a two-call JSON-RPC batch returned a well-formed array (current `boing-node`). */
58
+ jsonrpcBatchOk: boolean;
59
+ /** `GET {baseUrl}/openapi.json` returned HTTP 200 with JSON (current `boing-node`). */
60
+ httpOpenApiJsonOk: boolean;
61
+ /** `GET {baseUrl}/.well-known/boing-rpc` returned HTTP 200 with JSON. */
62
+ wellKnownBoingRpcOk: boolean;
63
+ /** `GET {baseUrl}/live.json` parsed as `{ ok: true }` (or compatible). */
64
+ httpLiveJsonOk: boolean;
65
+ }
66
+ /** One row from **`boing_listDexPools`** (DEX-derived discovery). */
67
+ export interface DexPoolListRow {
68
+ poolHex: string;
69
+ tokenAHex: string;
70
+ tokenBHex: string;
71
+ /** Token A decimals (**`BOING_DEX_TOKEN_DECIMALS_JSON`** or default **18**). */
72
+ tokenADecimals: number;
73
+ /** Token B decimals (**`BOING_DEX_TOKEN_DECIMALS_JSON`** or default **18**). */
74
+ tokenBDecimals: number;
75
+ feeBps: number;
76
+ reserveA: string;
77
+ reserveB: string;
78
+ /** Block height of a validated factory **`register_pair`** log for this pool, when known. */
79
+ createdAtHeight: number | null;
80
+ }
81
+ /** Optional scan counters when **`includeDiagnostics: true`** was sent on the request. */
82
+ export interface DexDiscoveryPoolDiagnostics {
83
+ receiptScans: number;
84
+ receiptScanCapped: boolean;
85
+ }
86
+ /** Optional counters for token discovery (includes deploy metadata scan stats). */
87
+ export interface DexDiscoveryTokenDiagnostics extends DexDiscoveryPoolDiagnostics {
88
+ deployBlocksScanned: number;
89
+ deployMetadataMatched: number;
90
+ deployMetadataUnmatchedWant: number;
91
+ }
92
+ /** One row from **`boing_listDexTokens`** (DEX-derived token universe). */
93
+ export interface DexTokenListRow {
94
+ id: string;
95
+ symbol: string;
96
+ name: string;
97
+ decimals: number;
98
+ poolCount: number;
99
+ /** Minimum known pool registration height for this token in the directory, when known. */
100
+ firstSeenHeight: number | null;
101
+ /** `deploy` when **`symbol` / `name`** came from an on-chain metadata deploy scan; otherwise `abbrev`. */
102
+ metadataSource?: 'deploy' | 'abbrev';
103
+ /** Present on **`boing_getDexToken`** when **`includeDiagnostics: true`**. */
104
+ diagnostics?: DexDiscoveryTokenDiagnostics;
105
+ }
106
+ /** Paginated **`boing_listDexPools`** result. */
107
+ export interface DexPoolListPage {
108
+ pools: DexPoolListRow[];
109
+ nextCursor: string | null;
110
+ diagnostics?: DexDiscoveryPoolDiagnostics;
111
+ }
112
+ /** Paginated **`boing_listDexTokens`** result. */
113
+ export interface DexTokenListPage {
114
+ tokens: DexTokenListRow[];
115
+ nextCursor: string | null;
116
+ diagnostics?: DexDiscoveryTokenDiagnostics;
117
+ }
118
+ /** Result of `boing_getSyncState` — committed tip; `finalized_height` matches `head_height` until the node exposes pre-commit data. */
119
+ export interface SyncState {
120
+ head_height: number;
121
+ finalized_height: number;
122
+ /** Tip block hash (32-byte hex with `0x`). */
123
+ latest_block_hash: string;
124
+ }
125
+ /** Chain-wide sums from the committed account table (`boing_getNetworkInfo.chain_native`). */
126
+ export interface ChainNativeAggregates {
127
+ account_count: number;
128
+ /** Sum of `balance` over all accounts (u128 decimal string). */
129
+ total_balance: string;
130
+ /** Sum of `stake` over all accounts (u128 decimal string). */
131
+ total_stake: string;
132
+ /** `total_balance + total_stake` (u128 decimal string). Not “circulating” or treasury supply. */
133
+ total_native_held: string;
134
+ /** Committed chain height these aggregates match. */
135
+ as_of_height: number;
136
+ }
137
+ /** `boing_getNetworkInfo.developer` — links and discovery hints (env-overridable on the node). */
138
+ export interface NetworkDeveloperHints {
139
+ repository_url: string;
140
+ rpc_spec_url: string;
141
+ dapp_integration_doc_url: string;
142
+ sdk_npm_package: string;
143
+ websocket: {
144
+ path: string;
145
+ handshake: {
146
+ type: string;
147
+ channel: string;
148
+ };
149
+ event_types: string[];
150
+ };
151
+ api_discovery_methods: string[];
152
+ /** Plain-HTTP probes for orchestration (Kubernetes, Docker, load balancers). */
153
+ http: {
154
+ live_path: string;
155
+ ready_path: string;
156
+ jsonrpc_post_path: string;
157
+ response_header_rpc_version: string;
158
+ /** Response header for request correlation (optional on request; server may generate). */
159
+ request_id_header: string;
160
+ /** `POST /` accepts a JSON array of JSON-RPC requests (batch). */
161
+ supports_jsonrpc_batch: boolean;
162
+ /** Env var on the node controlling max batch length (default 32, cap 256). */
163
+ jsonrpc_batch_max_env: string;
164
+ /** Env var for optional WebSocket subscriber cap (0 = unlimited). */
165
+ websocket_max_connections_env: string;
166
+ /** Env var for optional `/ready` minimum P2P peer count. */
167
+ ready_min_peers_env: string;
168
+ /** Env var for max JSON-RPC POST body size (MiB); present on current `boing-node`. */
169
+ jsonrpc_max_body_mb_env?: string;
170
+ /** Plain-HTTP OpenAPI (`GET`); present on current `boing-node`. */
171
+ openapi_http_path?: string;
172
+ /** Discovery document (`GET`); present on current `boing-node`. */
173
+ well_known_boing_rpc_path?: string;
174
+ live_json_path?: string;
175
+ ready_json_path?: string;
176
+ };
177
+ }
178
+ /** Optional wallet-facing hints from node env (`boing_getNetworkInfo.end_user`). */
179
+ export interface NetworkEndUserHints {
180
+ chain_display_name: string | null;
181
+ explorer_url: string | null;
182
+ faucet_url: string | null;
183
+ /** Set on the node via **`BOING_CANONICAL_NATIVE_CP_POOL`** — canonical native CP pool `AccountId` (32-byte hex). */
184
+ canonical_native_cp_pool?: string | null;
185
+ /** Set on the node via **`BOING_CANONICAL_NATIVE_DEX_FACTORY`** — pair-directory contract `AccountId`. */
186
+ canonical_native_dex_factory?: string | null;
187
+ /** **`BOING_CANONICAL_NATIVE_DEX_MULTIHOP_SWAP_ROUTER`** — native multihop (2–6 pool) swap router. */
188
+ canonical_native_dex_multihop_swap_router?: string | null;
189
+ /** **`BOING_CANONICAL_NATIVE_DEX_LEDGER_ROUTER_V2`** — ledger forwarder for 160-byte inner calldata (e.g. v5 `swap_to`). */
190
+ canonical_native_dex_ledger_router_v2?: string | null;
191
+ /** **`BOING_CANONICAL_NATIVE_DEX_LEDGER_ROUTER_V3`** — ledger forwarder for 192-byte inner calldata (e.g. v5 `remove_liquidity_to`). */
192
+ canonical_native_dex_ledger_router_v3?: string | null;
193
+ /** **`BOING_CANONICAL_NATIVE_AMM_LP_VAULT`** — optional LP vault contract `AccountId`. */
194
+ canonical_native_amm_lp_vault?: string | null;
195
+ /** **`BOING_CANONICAL_NATIVE_LP_SHARE_TOKEN`** — optional LP share token `AccountId`. */
196
+ canonical_native_lp_share_token?: string | null;
197
+ }
198
+ /** Serializable snapshot for pinning “this is network X” in CI or local dev. */
199
+ export interface BoingNetworkProfile {
200
+ captured_at_ms: number;
201
+ base_url: string;
202
+ health: BoingHealth;
203
+ network_info: NetworkInfo | null;
204
+ supported_methods: string[] | null;
205
+ preflight: BoingRpcPreflightResult;
206
+ }
207
+ /** One entry in a JSON-RPC batch response array. */
208
+ export interface JsonRpcBatchResponseItem {
209
+ jsonrpc?: string;
210
+ id?: unknown;
211
+ result?: unknown;
212
+ error?: {
213
+ code: number;
214
+ message: string;
215
+ data?: unknown;
216
+ };
217
+ }
218
+ /** Result of `boing_getRpcMethodCatalog` — embedded JSON Schema-style entries per method. */
219
+ export interface RpcMethodCatalog {
220
+ description?: string;
221
+ methods: Array<{
222
+ name: string;
223
+ summary?: string;
224
+ params?: unknown;
225
+ result?: unknown;
226
+ }>;
227
+ }
228
+ /** Result of `boing_getRpcOpenApi` — minimal OpenAPI 3.1 for `POST /`, `GET /ws`, `GET /live`, `GET /ready`. */
229
+ export type RpcOpenApiDocument = Record<string, unknown>;
230
+ /** Result of `boing_getNetworkInfo` — dApp discovery; see RPC-API-SPEC.md. */
231
+ export interface NetworkInfo {
232
+ /** Present when the node process sets `BOING_CHAIN_ID` (decimal). */
233
+ chain_id: number | null;
234
+ /** Present when `BOING_CHAIN_NAME` is set. */
235
+ chain_name: string | null;
236
+ head_height: number;
237
+ finalized_height: number;
238
+ latest_block_hash: string;
239
+ target_block_time_secs: number;
240
+ client_version: string;
241
+ consensus: {
242
+ validator_count: number;
243
+ model: string;
244
+ };
245
+ native_currency: {
246
+ symbol: string;
247
+ decimals: number;
248
+ };
249
+ chain_native: ChainNativeAggregates;
250
+ developer: NetworkDeveloperHints;
251
+ /** Same shape as `boing_health.rpc_surface` on current `boing-node`; omit on older binaries. */
252
+ rpc_surface?: BoingHealthRpcSurface;
253
+ /** Optional display URLs / names from node env (`BOING_CHAIN_DISPLAY_NAME`, etc.). */
254
+ end_user?: NetworkEndUserHints;
255
+ rpc: {
256
+ not_available: string[];
257
+ not_available_note: string;
258
+ };
259
+ }
260
+ /** Balance and stake are u128 as decimal strings. */
261
+ export interface AccountBalance {
262
+ balance: string;
263
+ }
264
+ export interface AccountState {
265
+ balance: string;
266
+ nonce: number;
267
+ stake: string;
268
+ }
269
+ export interface BlockHeader {
270
+ parent_hash: string;
271
+ height: number;
272
+ timestamp: number;
273
+ proposer: string;
274
+ tx_root: string;
275
+ /** Merkle root over serialized receipts (see protocol spec). */
276
+ receipts_root: string;
277
+ state_root: string;
278
+ }
279
+ /** One log entry from contract execution (`LOG0`..`LOG4`). */
280
+ export interface ExecutionLog {
281
+ topics: string[];
282
+ data: string;
283
+ }
284
+ /** Params for `boing_getLogs` — block numbers as JSON numbers or decimal / `0x` hex strings. */
285
+ export interface GetLogsFilter {
286
+ fromBlock: number | string;
287
+ toBlock: number | string;
288
+ /** When set, only logs attributed to this contract (32-byte account id hex). */
289
+ address?: string;
290
+ /** Per-index topic matchers: `null` = wildcard (same topic-slot rules as typical `*_getLogs` JSON-RPC). Max 4 entries. */
291
+ topics?: (string | null)[];
292
+ }
293
+ /** One log row from `boing_getLogs` (flattened; includes block / tx placement). */
294
+ export interface RpcLogEntry {
295
+ block_height: number;
296
+ tx_index: number;
297
+ tx_id: string;
298
+ log_index: number;
299
+ /** Emitting contract when the node can attribute it (`ContractCall` / deploy address). */
300
+ address: string | null;
301
+ topics: string[];
302
+ data: string;
303
+ }
304
+ /** On-chain execution result for an included transaction (`boing_getTransactionReceipt`). */
305
+ export interface ExecutionReceipt {
306
+ tx_id: string;
307
+ block_height: number;
308
+ tx_index: number;
309
+ success: boolean;
310
+ gas_used: number;
311
+ return_data: string;
312
+ logs: ExecutionLog[];
313
+ error?: string | null;
314
+ }
315
+ export interface Block {
316
+ /** BLAKE3 block hash (32-byte hex); RPC includes this on `boing_getBlockByHeight` / `boing_getBlockByHash`. */
317
+ hash?: string;
318
+ header: BlockHeader;
319
+ transactions: unknown[];
320
+ /** Present when fetched with `include_receipts: true` on `boing_getBlockByHeight`. */
321
+ receipts?: (ExecutionReceipt | null)[];
322
+ }
323
+ export interface AccountProof {
324
+ proof: string;
325
+ root: string;
326
+ value_hash: string;
327
+ }
328
+ export interface VerifyProofResult {
329
+ valid: boolean;
330
+ }
331
+ /** Shape of `suggested_access_list` on `boing_simulateTransaction`. */
332
+ export interface AccessListJson {
333
+ read: string[];
334
+ write: string[];
335
+ }
336
+ export interface SimulateResult {
337
+ gas_used: number;
338
+ success: boolean;
339
+ /** Hex-encoded contract return buffer when `success` is true. */
340
+ return_data?: string;
341
+ /** Emitted logs when `success` is true (contract calls). */
342
+ logs?: ExecutionLog[];
343
+ error?: string;
344
+ /** Heuristic minimum accounts for parallel scheduling (Track A). */
345
+ suggested_access_list?: AccessListJson;
346
+ /** Whether the simulated tx’s declared access list includes every suggested account. */
347
+ access_list_covers_suggestion?: boolean;
348
+ }
349
+ /** One 32-byte contract storage word (`boing_getContractStorage`). */
350
+ export interface ContractStorageWord {
351
+ value: string;
352
+ }
353
+ export interface SubmitTransactionResult {
354
+ tx_hash: string;
355
+ }
356
+ export interface RegisterDappResult {
357
+ registered: true;
358
+ contract: string;
359
+ owner: string;
360
+ }
361
+ export interface SubmitIntentResult {
362
+ intent_id: string;
363
+ }
364
+ /** QA pre-flight result. */
365
+ export type QaCheckResult = 'allow' | 'reject' | 'unsure';
366
+ export interface QaCheckResponse {
367
+ result: QaCheckResult;
368
+ rule_id?: string;
369
+ message?: string;
370
+ }
371
+ export interface FaucetResult {
372
+ ok: true;
373
+ amount: number;
374
+ to: string;
375
+ message: string;
376
+ }
377
+ /** Row from `boing_qaPoolList`. */
378
+ export interface QaPoolItemSummary {
379
+ tx_hash: string;
380
+ bytecode_hash: string;
381
+ deployer: string;
382
+ allow_votes: number;
383
+ reject_votes: number;
384
+ age_secs: number;
385
+ }
386
+ export interface QaPoolListResult {
387
+ items: QaPoolItemSummary[];
388
+ }
389
+ /** Result of `boing_qaPoolConfig`. */
390
+ export interface QaPoolConfigResult {
391
+ max_pending_items: number;
392
+ max_pending_per_deployer: number;
393
+ review_window_secs: number;
394
+ quorum_fraction: number;
395
+ allow_threshold_fraction: number;
396
+ reject_threshold_fraction: number;
397
+ default_on_expiry: 'reject' | 'allow';
398
+ dev_open_voting: boolean;
399
+ administrator_count: number;
400
+ accepts_new_pending: boolean;
401
+ pending_count: number;
402
+ }
403
+ /** Result of `boing_qaPoolVote`. */
404
+ export interface QaPoolVoteResult {
405
+ outcome: 'pending' | 'reject' | 'allow';
406
+ mempool?: boolean;
407
+ duplicate?: boolean;
408
+ error?: string;
409
+ }
410
+ /** Result of `boing_operatorApplyQaPolicy`. */
411
+ export interface OperatorApplyQaPolicyResult {
412
+ ok: true;
413
+ }
414
+ /**
415
+ * Effective protocol QA rule registry from `boing_getQaRegistry` (read-only).
416
+ * `blocklist` entries are 32-byte arrays; `scam_patterns` are byte arrays.
417
+ */
418
+ export interface QaRegistryResult {
419
+ max_bytecode_size: number;
420
+ blocklist: number[][];
421
+ scam_patterns: number[][];
422
+ always_review_categories: string[];
423
+ content_blocklist: string[];
424
+ }
425
+ /** JSON-RPC 2.0 response. */
426
+ export interface JsonRpcResponse<T = unknown> {
427
+ jsonrpc: '2.0';
428
+ id: number | string | null;
429
+ result?: T;
430
+ error?: {
431
+ code: number;
432
+ message: string;
433
+ data?: unknown;
434
+ };
435
+ }
436
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,sHAAsH;AACtH,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,yBAAyB,EAAE,MAAM,CAAC;IAClC,wDAAwD;IACxD,gCAAgC,EAAE,MAAM,CAAC;IACzC,8DAA8D;IAC9D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,qEAAqE;IACrE,uBAAuB,EAAE,MAAM,CAAC;IAChC,iEAAiE;IACjE,wBAAwB,EAAE,MAAM,CAAC;IACjC,sDAAsD;IACtD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oDAAoD;IACpD,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uBAAuB,EAAE,MAAM,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAED,gGAAgG;AAChG,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,qBAAqB,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iB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,6BAA6B;AAC7B,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;CACH"}
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Types for Boing RPC results and params.
3
+ */
4
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Thin **EIP-1193** helpers for **Boing Express** and compatible injected providers.
3
+ * Reduces branching in dApps that call **`boing_sendTransaction`**, **`boing_requestAccounts`**, **`boing_chainId`**.
4
+ */
5
+ /**
6
+ * EIP-1193 methods Boing-native dApps typically rely on (Boing Express implements these).
7
+ * Generic `eth_sendTransaction` alone is **not** enough for Boing **`contract_call`** (32-byte ids + access lists).
8
+ */
9
+ export declare const BOING_WALLET_RPC_METHODS_NATIVE_DAPP: readonly ["boing_chainId", "boing_requestAccounts", "boing_sendTransaction"];
10
+ /** Explains why **`eth_sendTransaction`**-centric wallets are insufficient for native Boing **`contract_call`**. */
11
+ export declare function explainEthSendTransactionInsufficientForBoingNativeCall(): string;
12
+ /** Minimal provider surface (MetaMask / Boing Express). */
13
+ export type Eip1193Requester = {
14
+ request: (args: {
15
+ method: string;
16
+ params?: unknown;
17
+ }) => Promise<unknown>;
18
+ };
19
+ /**
20
+ * Prefer **`window.boing`**, then **`window.ethereum`**, when both expose **`.request`**.
21
+ */
22
+ export declare function getInjectedEip1193Provider(globalObj?: typeof globalThis): Eip1193Requester | undefined;
23
+ /**
24
+ * True if the wallet speaks Boing JSON-RPC aliases (**`boing_chainId`**), without sending a transaction.
25
+ */
26
+ export declare function providerSupportsBoingNativeRpc(provider: Eip1193Requester): Promise<boolean>;
27
+ /** Call **`boing_sendTransaction`**; returns transaction hash string from the wallet. */
28
+ export declare function boingSendTransaction(provider: Eip1193Requester, tx: Record<string, unknown>): Promise<string>;
29
+ /** **`boing_requestAccounts`** first, then **`eth_requestAccounts`**. */
30
+ export declare function requestAccounts(provider: Eip1193Requester): Promise<string[]>;
31
+ /** Read **`boing_chainId`** or **`eth_chainId`** (hex string). */
32
+ export declare function readChainIdHex(provider: Eip1193Requester): Promise<string>;
33
+ export type BoingInjectedWalletConnectResult = {
34
+ accounts: string[];
35
+ chainIdHex: string;
36
+ supportsBoingNativeRpc: boolean;
37
+ };
38
+ /**
39
+ * Single **`requestAccounts`** + **`readChainIdHex`** + **`providerSupportsBoingNativeRpc`** — typical “Connect wallet” success payload.
40
+ */
41
+ export declare function connectInjectedBoingWallet(provider: Eip1193Requester): Promise<BoingInjectedWalletConnectResult>;
42
+ /**
43
+ * Map common injected-wallet errors to short UI strings (MetaMask-style **`code`** when present).
44
+ */
45
+ export declare function mapInjectedProviderErrorToUiMessage(err: unknown): string;
46
+ //# sourceMappingURL=walletProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walletProvider.d.ts","sourceRoot":"","sources":["../src/walletProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,eAAO,MAAM,oCAAoC,8EAIvC,CAAC;AAEX,oHAAoH;AACpH,wBAAgB,uDAAuD,IAAI,MAAM,CAMhF;AAED,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC3E,CAAC;AASF;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,GAAE,OAAO,UAAuB,GAAG,gBAAgB,GAAG,SAAS,CAGlH;AAED;;GAEG;AACH,wBAAsB,8BAA8B,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAOjG;AAED,yFAAyF;AACzF,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,gBAAgB,EAC1B,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1B,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,yEAAyE;AACzE,wBAAsB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYnF;AAED,kEAAkE;AAClE,wBAAsB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhF;AAED,MAAM,MAAM,gCAAgC,GAAG;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,gBAAgB,GACzB,OAAO,CAAC,gCAAgC,CAAC,CAO3C;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAqBxE"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Thin **EIP-1193** helpers for **Boing Express** and compatible injected providers.
3
+ * Reduces branching in dApps that call **`boing_sendTransaction`**, **`boing_requestAccounts`**, **`boing_chainId`**.
4
+ */
5
+ const BOING_SEND = 'boing_sendTransaction';
6
+ const BOING_ACCOUNTS = 'boing_requestAccounts';
7
+ const BOING_CHAIN = 'boing_chainId';
8
+ const ETH_CHAIN = 'eth_chainId';
9
+ const ETH_ACCOUNTS = 'eth_requestAccounts';
10
+ /**
11
+ * EIP-1193 methods Boing-native dApps typically rely on (Boing Express implements these).
12
+ * Generic `eth_sendTransaction` alone is **not** enough for Boing **`contract_call`** (32-byte ids + access lists).
13
+ */
14
+ export const BOING_WALLET_RPC_METHODS_NATIVE_DAPP = [
15
+ BOING_CHAIN,
16
+ BOING_ACCOUNTS,
17
+ BOING_SEND,
18
+ ];
19
+ /** Explains why **`eth_sendTransaction`**-centric wallets are insufficient for native Boing **`contract_call`**. */
20
+ export function explainEthSendTransactionInsufficientForBoingNativeCall() {
21
+ return [
22
+ 'Boing `contract_call` transactions use 32-byte account ids, explicit access lists, and bincode signing—not the implicit 20-byte `to`/`data` shape most `eth_sendTransaction` wallets assume.',
23
+ 'Use Boing Express (or an injected provider that implements `boing_sendTransaction` / `boing_chainId`) or sign server-side with `boing-sdk` and `boing_submitTransaction`.',
24
+ `Methods to look for: ${BOING_WALLET_RPC_METHODS_NATIVE_DAPP.join(', ')}.`,
25
+ ].join('\n');
26
+ }
27
+ function asRequester(v) {
28
+ if (v != null && typeof v === 'object' && typeof v.request === 'function') {
29
+ return v;
30
+ }
31
+ return undefined;
32
+ }
33
+ /**
34
+ * Prefer **`window.boing`**, then **`window.ethereum`**, when both expose **`.request`**.
35
+ */
36
+ export function getInjectedEip1193Provider(globalObj = globalThis) {
37
+ const g = globalObj;
38
+ return asRequester(g.boing) ?? asRequester(g.ethereum);
39
+ }
40
+ /**
41
+ * True if the wallet speaks Boing JSON-RPC aliases (**`boing_chainId`**), without sending a transaction.
42
+ */
43
+ export async function providerSupportsBoingNativeRpc(provider) {
44
+ try {
45
+ const r = await provider.request({ method: BOING_CHAIN, params: [] });
46
+ return typeof r === 'string' && r.startsWith('0x');
47
+ }
48
+ catch {
49
+ return false;
50
+ }
51
+ }
52
+ /** Call **`boing_sendTransaction`**; returns transaction hash string from the wallet. */
53
+ export async function boingSendTransaction(provider, tx) {
54
+ const out = await provider.request({ method: BOING_SEND, params: [tx] });
55
+ if (typeof out !== 'string') {
56
+ throw new Error('boing_sendTransaction: expected string tx hash from wallet');
57
+ }
58
+ return out;
59
+ }
60
+ /** **`boing_requestAccounts`** first, then **`eth_requestAccounts`**. */
61
+ export async function requestAccounts(provider) {
62
+ try {
63
+ const a = await provider.request({ method: BOING_ACCOUNTS, params: [] });
64
+ if (Array.isArray(a) && a.every((x) => typeof x === 'string'))
65
+ return a;
66
+ }
67
+ catch {
68
+ /* fall through */
69
+ }
70
+ const a = await provider.request({ method: ETH_ACCOUNTS, params: [] });
71
+ if (!Array.isArray(a) || !a.every((x) => typeof x === 'string')) {
72
+ throw new Error('requestAccounts: wallet did not return string[]');
73
+ }
74
+ return a;
75
+ }
76
+ /** Read **`boing_chainId`** or **`eth_chainId`** (hex string). */
77
+ export async function readChainIdHex(provider) {
78
+ try {
79
+ const id = await provider.request({ method: BOING_CHAIN, params: [] });
80
+ if (typeof id === 'string' && id.startsWith('0x'))
81
+ return id.toLowerCase();
82
+ }
83
+ catch {
84
+ /* fall through */
85
+ }
86
+ const id = await provider.request({ method: ETH_CHAIN, params: [] });
87
+ if (typeof id !== 'string' || !id.startsWith('0x')) {
88
+ throw new Error('readChainIdHex: wallet did not return 0x-prefixed chain id');
89
+ }
90
+ return id.toLowerCase();
91
+ }
92
+ /**
93
+ * Single **`requestAccounts`** + **`readChainIdHex`** + **`providerSupportsBoingNativeRpc`** — typical “Connect wallet” success payload.
94
+ */
95
+ export async function connectInjectedBoingWallet(provider) {
96
+ const [accounts, chainIdHex, supportsBoingNativeRpc] = await Promise.all([
97
+ requestAccounts(provider),
98
+ readChainIdHex(provider),
99
+ providerSupportsBoingNativeRpc(provider),
100
+ ]);
101
+ return { accounts, chainIdHex, supportsBoingNativeRpc };
102
+ }
103
+ /**
104
+ * Map common injected-wallet errors to short UI strings (MetaMask-style **`code`** when present).
105
+ */
106
+ export function mapInjectedProviderErrorToUiMessage(err) {
107
+ const o = err;
108
+ const code = typeof o?.code === 'number' ? o.code : undefined;
109
+ const msg = typeof o?.message === 'string' ? o.message : '';
110
+ if (code === 4001 || /user rejected|denied|rejected/i.test(msg)) {
111
+ return 'Request was cancelled in the wallet.';
112
+ }
113
+ if (code === -32603 || /internal error/i.test(msg)) {
114
+ return 'The wallet reported an internal error. Try again or switch networks.';
115
+ }
116
+ if (/method not found|not supported|does not exist/i.test(msg)) {
117
+ return 'This wallet may not support Boing RPC methods. Use Boing Express or sign with boing-sdk on the server.';
118
+ }
119
+ if (/network|chain/i.test(msg) && /wrong|invalid|mismatch/i.test(msg)) {
120
+ return 'Wrong network selected in the wallet. Switch to the Boing chain and retry.';
121
+ }
122
+ if (msg.trim().length > 0) {
123
+ return msg.length > 200 ? `${msg.slice(0, 197)}…` : msg;
124
+ }
125
+ return 'Wallet request failed. Try again or use a Boing-compatible wallet.';
126
+ }