@agirails/sdk 2.5.3 → 2.5.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 (169) hide show
  1. package/dist/ACTPClient.d.ts +18 -0
  2. package/dist/ACTPClient.d.ts.map +1 -1
  3. package/dist/ACTPClient.js +72 -23
  4. package/dist/ACTPClient.js.map +1 -1
  5. package/dist/adapters/BasicAdapter.d.ts +15 -0
  6. package/dist/adapters/BasicAdapter.d.ts.map +1 -1
  7. package/dist/adapters/BasicAdapter.js +33 -4
  8. package/dist/adapters/BasicAdapter.js.map +1 -1
  9. package/dist/adapters/StandardAdapter.d.ts +20 -3
  10. package/dist/adapters/StandardAdapter.d.ts.map +1 -1
  11. package/dist/adapters/StandardAdapter.js +90 -12
  12. package/dist/adapters/StandardAdapter.js.map +1 -1
  13. package/dist/cli/commands/publish.js +16 -4
  14. package/dist/cli/commands/publish.js.map +1 -1
  15. package/dist/cli/commands/register.js +16 -4
  16. package/dist/cli/commands/register.js.map +1 -1
  17. package/dist/cli/commands/tx.js +31 -3
  18. package/dist/cli/commands/tx.js.map +1 -1
  19. package/dist/config/networks.d.ts +10 -2
  20. package/dist/config/networks.d.ts.map +1 -1
  21. package/dist/config/networks.js +31 -22
  22. package/dist/config/networks.js.map +1 -1
  23. package/dist/level0/request.d.ts.map +1 -1
  24. package/dist/level0/request.js +2 -1
  25. package/dist/level0/request.js.map +1 -1
  26. package/dist/runtime/BlockchainRuntime.d.ts.map +1 -1
  27. package/dist/runtime/BlockchainRuntime.js +11 -5
  28. package/dist/runtime/BlockchainRuntime.js.map +1 -1
  29. package/dist/utils/IPFSClient.d.ts +3 -1
  30. package/dist/utils/IPFSClient.d.ts.map +1 -1
  31. package/dist/utils/IPFSClient.js +27 -7
  32. package/dist/utils/IPFSClient.js.map +1 -1
  33. package/dist/wallet/AutoWalletProvider.d.ts +11 -1
  34. package/dist/wallet/AutoWalletProvider.d.ts.map +1 -1
  35. package/dist/wallet/AutoWalletProvider.js +84 -19
  36. package/dist/wallet/AutoWalletProvider.js.map +1 -1
  37. package/dist/wallet/IWalletProvider.d.ts +34 -0
  38. package/dist/wallet/IWalletProvider.d.ts.map +1 -1
  39. package/dist/wallet/SmartWalletRouter.d.ts +128 -0
  40. package/dist/wallet/SmartWalletRouter.d.ts.map +1 -0
  41. package/dist/wallet/SmartWalletRouter.js +248 -0
  42. package/dist/wallet/SmartWalletRouter.js.map +1 -0
  43. package/dist/wallet/aa/DualNonceManager.d.ts +26 -1
  44. package/dist/wallet/aa/DualNonceManager.d.ts.map +1 -1
  45. package/dist/wallet/aa/DualNonceManager.js +140 -6
  46. package/dist/wallet/aa/DualNonceManager.js.map +1 -1
  47. package/package.json +3 -6
  48. package/src/ACTPClient.ts +0 -1579
  49. package/src/abi/ACTPKernel.json +0 -1356
  50. package/src/abi/AgentRegistry.json +0 -915
  51. package/src/abi/ERC20.json +0 -40
  52. package/src/abi/EscrowVault.json +0 -134
  53. package/src/abi/IdentityRegistry.json +0 -316
  54. package/src/adapters/AdapterRegistry.ts +0 -173
  55. package/src/adapters/AdapterRouter.ts +0 -416
  56. package/src/adapters/BaseAdapter.ts +0 -498
  57. package/src/adapters/BasicAdapter.ts +0 -514
  58. package/src/adapters/IAdapter.ts +0 -292
  59. package/src/adapters/StandardAdapter.ts +0 -555
  60. package/src/adapters/X402Adapter.ts +0 -731
  61. package/src/adapters/index.ts +0 -60
  62. package/src/builders/DeliveryProofBuilder.ts +0 -327
  63. package/src/builders/QuoteBuilder.ts +0 -483
  64. package/src/builders/index.ts +0 -17
  65. package/src/cli/commands/balance.ts +0 -110
  66. package/src/cli/commands/batch.ts +0 -487
  67. package/src/cli/commands/config.ts +0 -231
  68. package/src/cli/commands/deploy-check.ts +0 -364
  69. package/src/cli/commands/deploy-env.ts +0 -120
  70. package/src/cli/commands/diff.ts +0 -141
  71. package/src/cli/commands/init.ts +0 -469
  72. package/src/cli/commands/mint.ts +0 -116
  73. package/src/cli/commands/pay.ts +0 -113
  74. package/src/cli/commands/publish.ts +0 -475
  75. package/src/cli/commands/pull.ts +0 -124
  76. package/src/cli/commands/register.ts +0 -247
  77. package/src/cli/commands/simulate.ts +0 -345
  78. package/src/cli/commands/time.ts +0 -302
  79. package/src/cli/commands/tx.ts +0 -448
  80. package/src/cli/commands/watch.ts +0 -211
  81. package/src/cli/index.ts +0 -134
  82. package/src/cli/utils/client.ts +0 -252
  83. package/src/cli/utils/config.ts +0 -389
  84. package/src/cli/utils/output.ts +0 -465
  85. package/src/cli/utils/wallet.ts +0 -109
  86. package/src/config/agirailsmd.ts +0 -262
  87. package/src/config/networks.ts +0 -275
  88. package/src/config/pendingPublish.ts +0 -237
  89. package/src/config/publishPipeline.ts +0 -359
  90. package/src/config/syncOperations.ts +0 -279
  91. package/src/erc8004/ERC8004Bridge.ts +0 -462
  92. package/src/erc8004/ReputationReporter.ts +0 -468
  93. package/src/erc8004/index.ts +0 -61
  94. package/src/errors/index.ts +0 -427
  95. package/src/index.ts +0 -364
  96. package/src/level0/Provider.ts +0 -117
  97. package/src/level0/ServiceDirectory.ts +0 -131
  98. package/src/level0/index.ts +0 -10
  99. package/src/level0/provide.ts +0 -132
  100. package/src/level0/request.ts +0 -432
  101. package/src/level1/Agent.ts +0 -1426
  102. package/src/level1/index.ts +0 -10
  103. package/src/level1/pricing/PriceCalculator.ts +0 -255
  104. package/src/level1/pricing/PricingStrategy.ts +0 -198
  105. package/src/level1/types/Job.ts +0 -179
  106. package/src/level1/types/Options.ts +0 -291
  107. package/src/level1/types/index.ts +0 -8
  108. package/src/protocol/ACTPKernel.ts +0 -808
  109. package/src/protocol/AgentRegistry.ts +0 -559
  110. package/src/protocol/DIDManager.ts +0 -629
  111. package/src/protocol/DIDResolver.ts +0 -554
  112. package/src/protocol/EASHelper.ts +0 -378
  113. package/src/protocol/EscrowVault.ts +0 -255
  114. package/src/protocol/EventMonitor.ts +0 -204
  115. package/src/protocol/MessageSigner.ts +0 -510
  116. package/src/protocol/ProofGenerator.ts +0 -339
  117. package/src/protocol/QuoteBuilder.ts +0 -15
  118. package/src/registry/AgentRegistryClient.ts +0 -202
  119. package/src/runtime/BlockchainRuntime.ts +0 -1015
  120. package/src/runtime/IACTPRuntime.ts +0 -306
  121. package/src/runtime/MockRuntime.ts +0 -1298
  122. package/src/runtime/MockStateManager.ts +0 -577
  123. package/src/runtime/index.ts +0 -25
  124. package/src/runtime/types/MockState.ts +0 -237
  125. package/src/storage/ArchiveBundleBuilder.ts +0 -561
  126. package/src/storage/ArweaveClient.ts +0 -946
  127. package/src/storage/FilebaseClient.ts +0 -790
  128. package/src/storage/index.ts +0 -96
  129. package/src/storage/types.ts +0 -348
  130. package/src/types/adapter.ts +0 -310
  131. package/src/types/agent.ts +0 -79
  132. package/src/types/did.ts +0 -223
  133. package/src/types/eip712.ts +0 -175
  134. package/src/types/erc8004.ts +0 -293
  135. package/src/types/escrow.ts +0 -27
  136. package/src/types/index.ts +0 -17
  137. package/src/types/message.ts +0 -145
  138. package/src/types/state.ts +0 -87
  139. package/src/types/transaction.ts +0 -69
  140. package/src/types/x402.ts +0 -251
  141. package/src/utils/ErrorRecoveryGuide.ts +0 -676
  142. package/src/utils/Helpers.ts +0 -688
  143. package/src/utils/IPFSClient.ts +0 -368
  144. package/src/utils/Logger.ts +0 -484
  145. package/src/utils/NonceManager.ts +0 -591
  146. package/src/utils/RateLimiter.ts +0 -534
  147. package/src/utils/ReceivedNonceTracker.ts +0 -567
  148. package/src/utils/SDKLifecycle.ts +0 -416
  149. package/src/utils/SecureNonce.ts +0 -78
  150. package/src/utils/Semaphore.ts +0 -276
  151. package/src/utils/UsedAttestationTracker.ts +0 -385
  152. package/src/utils/canonicalJson.ts +0 -38
  153. package/src/utils/circuitBreaker.ts +0 -324
  154. package/src/utils/computeTypeHash.ts +0 -48
  155. package/src/utils/fsSafe.ts +0 -80
  156. package/src/utils/index.ts +0 -80
  157. package/src/utils/retry.ts +0 -364
  158. package/src/utils/security.ts +0 -418
  159. package/src/utils/validation.ts +0 -540
  160. package/src/wallet/AutoWalletProvider.ts +0 -299
  161. package/src/wallet/EOAWalletProvider.ts +0 -69
  162. package/src/wallet/IWalletProvider.ts +0 -135
  163. package/src/wallet/aa/BundlerClient.ts +0 -274
  164. package/src/wallet/aa/DualNonceManager.ts +0 -173
  165. package/src/wallet/aa/PaymasterClient.ts +0 -174
  166. package/src/wallet/aa/TransactionBatcher.ts +0 -353
  167. package/src/wallet/aa/UserOpBuilder.ts +0 -246
  168. package/src/wallet/aa/constants.ts +0 -60
  169. package/src/wallet/keystore.ts +0 -240
@@ -1,416 +0,0 @@
1
- /**
2
- * AdapterRouter - Intelligent adapter selection with guard-rails.
3
- *
4
- * The router selects the best adapter for each payment based on:
5
- * - Explicit adapter preference
6
- * - Required capabilities (escrow, disputes, identity)
7
- * - Recipient type (address vs HTTP endpoint)
8
- * - Adapter priority
9
- *
10
- * SECURITY: All parameters are validated before selection.
11
- * SECURITY: All adapters must enforce explicit release (no auto-settle).
12
- *
13
- * @module adapters/AdapterRouter
14
- */
15
-
16
- import { AdapterRegistry } from './AdapterRegistry';
17
- import { IAdapter } from './IAdapter';
18
- import {
19
- UnifiedPayParams,
20
- safeValidatePayParams,
21
- } from '../types/adapter';
22
- import { ValidationError } from './BaseAdapter';
23
- import { ERC8004Bridge } from '../erc8004/ERC8004Bridge';
24
-
25
- /**
26
- * Result of adapter selection with potential ERC-8004 resolution.
27
- */
28
- export interface AdapterSelectionResult {
29
- /** Selected adapter */
30
- adapter: IAdapter;
31
-
32
- /** Resolved payment parameters (with wallet instead of agentId) */
33
- resolvedParams: UnifiedPayParams;
34
-
35
- /** Whether an ERC-8004 agent ID was resolved */
36
- wasAgentIdResolved: boolean;
37
- }
38
-
39
- /**
40
- * AdapterRouter - Intelligent adapter selection with guard-rails.
41
- *
42
- * Selection logic (in order):
43
- * 1. Validate params (throws if invalid)
44
- * 2. Explicit adapter requested -> use it
45
- * 3. Escrow/dispute required -> StandardAdapter
46
- * 4. HTTP endpoint + no escrow -> X402Adapter (when available)
47
- * 5. ERC-8004 identity -> ERC8004Adapter (when available)
48
- * 6. Default -> First adapter that can handle (by priority)
49
- *
50
- * @example
51
- * ```typescript
52
- * const registry = new AdapterRegistry();
53
- * registry.register(basicAdapter);
54
- * registry.register(standardAdapter);
55
- *
56
- * const router = new AdapterRouter(registry);
57
- *
58
- * // Auto-select best adapter
59
- * const adapter = router.select({ to: '0x...', amount: '100' });
60
- *
61
- * // Explicit adapter request
62
- * const adapter = router.select({
63
- * to: '0x...',
64
- * amount: '100',
65
- * metadata: { preferredAdapter: 'standard' }
66
- * });
67
- * ```
68
- */
69
- export class AdapterRouter {
70
- private erc8004Bridge?: ERC8004Bridge;
71
-
72
- /**
73
- * Creates a new AdapterRouter instance.
74
- *
75
- * @param registry - AdapterRegistry containing available adapters
76
- * @param erc8004Bridge - Optional ERC-8004 bridge for agent ID resolution
77
- */
78
- constructor(
79
- private registry: AdapterRegistry,
80
- erc8004Bridge?: ERC8004Bridge
81
- ) {
82
- this.erc8004Bridge = erc8004Bridge;
83
- }
84
-
85
- /**
86
- * Set the ERC-8004 bridge for agent ID resolution.
87
- *
88
- * @param bridge - ERC8004Bridge instance
89
- */
90
- setERC8004Bridge(bridge: ERC8004Bridge): void {
91
- this.erc8004Bridge = bridge;
92
- }
93
-
94
- /**
95
- * Select the best adapter for the given payment parameters.
96
- *
97
- * @param params - Unified payment parameters
98
- * @returns The selected adapter
99
- * @throws {ValidationError} If params are invalid
100
- * @throws {Error} If no suitable adapter found
101
- *
102
- * @example
103
- * ```typescript
104
- * const adapter = router.select({
105
- * to: '0xProvider...',
106
- * amount: '100',
107
- * });
108
- * const result = await adapter.pay(params);
109
- * ```
110
- */
111
- select(params: UnifiedPayParams): IAdapter {
112
- // GUARD-RAIL: Validate all params first
113
- this.validateParams(params);
114
-
115
- const metadata = params.metadata || {};
116
-
117
- // 1. Explicit adapter requested
118
- if (metadata.preferredAdapter) {
119
- const adapter = this.registry.get(metadata.preferredAdapter);
120
- if (!adapter) {
121
- throw new Error(
122
- `Preferred adapter '${metadata.preferredAdapter}' not found. ` +
123
- `Available adapters: ${this.registry.getIds().join(', ') || 'none'}`
124
- );
125
- }
126
- // Verify adapter can handle these params
127
- adapter.validate(params);
128
- return adapter;
129
- }
130
-
131
- // 2. Escrow/dispute required -> STRICT enforcement
132
- if (metadata.requiresEscrow || metadata.requiresDispute) {
133
- // First try standard adapter
134
- const standard = this.registry.get('standard');
135
- if (standard && standard.canHandle(params)) {
136
- return standard;
137
- }
138
-
139
- // Find any adapter that meets the capability requirements
140
- const compatibleAdapters = this.registry.getByPriority().filter((adapter) => {
141
- const meta = adapter.metadata;
142
- const meetsEscrow = !metadata.requiresEscrow || meta.usesEscrow;
143
- const meetsDispute = !metadata.requiresDispute || meta.supportsDisputes;
144
- return meetsEscrow && meetsDispute && adapter.canHandle(params);
145
- });
146
-
147
- if (compatibleAdapters.length > 0) {
148
- return compatibleAdapters[0];
149
- }
150
-
151
- // STRICT: No compatible adapter found - throw error instead of falling through
152
- const requirements = [];
153
- if (metadata.requiresEscrow) requirements.push('escrow');
154
- if (metadata.requiresDispute) requirements.push('dispute resolution');
155
- throw new Error(
156
- `No adapter found that supports required capabilities: ${requirements.join(', ')}. ` +
157
- `Available adapters: ${this.registry.getIds().join(', ') || 'none'}`
158
- );
159
- }
160
-
161
- // 3. HTTP endpoint -> x402 (when registered)
162
- // NOTE: X402Adapter is ATOMIC (usesEscrow: false) - instant payment, no escrow.
163
- // Route HTTPS endpoints to x402 for fire-and-forget API payments.
164
- // If caller needs escrow protection, they should use ACTP with address, not URL.
165
- if (this.isHttpEndpoint(params.to)) {
166
- const x402 = this.registry.get('x402');
167
- if (x402 && x402.canHandle(params)) {
168
- return x402;
169
- }
170
- // HTTP endpoints without x402 adapter will fall through
171
- // and likely fail with basic/standard adapters
172
- }
173
-
174
- // 4. ERC-8004 identity -> erc8004 (when registered)
175
- if (metadata.identity?.type === 'erc8004') {
176
- const erc8004 = this.registry.get('erc8004');
177
- if (erc8004 && erc8004.canHandle(params)) {
178
- return erc8004;
179
- }
180
- }
181
-
182
- // 5. Find first adapter that can handle it (by priority)
183
- for (const adapter of this.registry.getByPriority()) {
184
- if (adapter.canHandle(params)) {
185
- return adapter;
186
- }
187
- }
188
-
189
- // 6. Default to basic as last resort
190
- const basic = this.registry.get('basic');
191
- if (basic) {
192
- // Try to use basic even if canHandle returned false
193
- // Let it fail with a proper error message during pay()
194
- return basic;
195
- }
196
-
197
- throw new Error(
198
- `No suitable adapter found for params. ` +
199
- `Available adapters: ${this.registry.getIds().join(', ') || 'none'}`
200
- );
201
- }
202
-
203
- /**
204
- * Validate payment parameters with Zod schema.
205
- *
206
- * GUARD-RAIL: Performs strict validation before any adapter selection.
207
- *
208
- * @param params - Parameters to validate
209
- * @throws {ValidationError} If params are invalid
210
- */
211
- private validateParams(params: UnifiedPayParams): void {
212
- const result = safeValidatePayParams(params);
213
-
214
- if (!result.success) {
215
- const issues = result.error.issues
216
- .map((i) => `${i.path.join('.')}: ${i.message}`)
217
- .join('; ');
218
- throw new ValidationError(`Invalid payment params: ${issues}`);
219
- }
220
-
221
- // Additional security checks
222
-
223
- // Check for path traversal attempts in 'to' field
224
- if (typeof params.to === 'string') {
225
- if (params.to.includes('..')) {
226
- throw new ValidationError(
227
- 'Invalid recipient: path traversal characters not allowed'
228
- );
229
- }
230
-
231
- // Check for script injection attempts
232
- if (params.to.includes('<') || params.to.includes('>')) {
233
- throw new ValidationError(
234
- 'Invalid recipient: HTML/script characters not allowed'
235
- );
236
- }
237
-
238
- // Check for null bytes
239
- if (params.to.includes('\0')) {
240
- throw new ValidationError(
241
- 'Invalid recipient: null bytes not allowed'
242
- );
243
- }
244
- }
245
-
246
- // Validate description if provided
247
- if (params.description) {
248
- if (params.description.length > 1000) {
249
- throw new ValidationError(
250
- 'Description too long: maximum 1000 characters'
251
- );
252
- }
253
- }
254
- }
255
-
256
- /**
257
- * Check if a string is an HTTP/HTTPS endpoint.
258
- *
259
- * @param to - Recipient string to check
260
- * @returns True if it's an HTTP endpoint
261
- */
262
- private isHttpEndpoint(to: string): boolean {
263
- try {
264
- const url = new URL(to);
265
- return url.protocol === 'http:' || url.protocol === 'https:';
266
- } catch {
267
- return false;
268
- }
269
- }
270
-
271
- /**
272
- * Get all adapters that can handle the given params.
273
- *
274
- * Useful for debugging or letting users choose from multiple options.
275
- *
276
- * @param params - Payment parameters
277
- * @returns Array of adapters that can handle params
278
- */
279
- getCompatibleAdapters(params: UnifiedPayParams): IAdapter[] {
280
- this.validateParams(params);
281
- return this.registry.getAll().filter((adapter) => {
282
- try {
283
- return adapter.canHandle(params);
284
- } catch {
285
- return false;
286
- }
287
- });
288
- }
289
-
290
- /**
291
- * Check if any adapter can handle the given params.
292
- *
293
- * @param params - Payment parameters
294
- * @returns True if at least one adapter can handle
295
- */
296
- canHandle(params: UnifiedPayParams): boolean {
297
- try {
298
- this.validateParams(params);
299
- return this.getCompatibleAdapters(params).length > 0;
300
- } catch {
301
- return false;
302
- }
303
- }
304
-
305
- // ==========================================================================
306
- // ERC-8004 Agent ID Resolution
307
- // ==========================================================================
308
-
309
- /**
310
- * Select adapter AND resolve ERC-8004 agent IDs.
311
- *
312
- * This is the recommended method for payment flows. It:
313
- * 1. Checks if `to` is an ERC-8004 agent ID (numeric string)
314
- * 2. If so, resolves it to a wallet address via ERC8004Bridge
315
- * 3. Stores the original agentId in erc8004AgentId field
316
- * 4. Selects the appropriate adapter
317
- *
318
- * @param params - Unified payment parameters
319
- * @returns Selection result with resolved params
320
- * @throws {ValidationError} If params invalid or agent not found
321
- *
322
- * @example
323
- * ```typescript
324
- * const { adapter, resolvedParams } = await router.selectAndResolve({
325
- * to: '12345', // ERC-8004 agent ID
326
- * amount: '100',
327
- * });
328
- *
329
- * // resolvedParams.to is now the wallet address
330
- * // resolvedParams.erc8004AgentId is '12345'
331
- * const result = await adapter.pay(resolvedParams);
332
- * ```
333
- */
334
- async selectAndResolve(params: UnifiedPayParams): Promise<AdapterSelectionResult> {
335
- // Check if 'to' is an ERC-8004 agent ID
336
- if (this.isERC8004AgentId(params.to)) {
337
- if (!this.erc8004Bridge) {
338
- throw new ValidationError(
339
- `Cannot resolve ERC-8004 agent ID '${params.to}': ` +
340
- 'ERC-8004 resolution requires testnet or mainnet mode. ' +
341
- 'Use a wallet address (0x...) in mock mode, or switch to testnet/mainnet.'
342
- );
343
- }
344
-
345
- try {
346
- // Resolve agent ID to wallet address
347
- const wallet = await this.erc8004Bridge.getAgentWallet(params.to);
348
-
349
- // Create resolved params with wallet and stored agentId
350
- const resolvedParams: UnifiedPayParams = {
351
- ...params,
352
- to: wallet,
353
- erc8004AgentId: params.to,
354
- };
355
-
356
- // Select adapter for resolved params
357
- const adapter = this.select(resolvedParams);
358
-
359
- return {
360
- adapter,
361
- resolvedParams,
362
- wasAgentIdResolved: true,
363
- };
364
- } catch (error) {
365
- // Re-throw with clearer message
366
- const errorMsg = error instanceof Error ? error.message : String(error);
367
- throw new ValidationError(
368
- `Failed to resolve ERC-8004 agent '${params.to}': ${errorMsg}`
369
- );
370
- }
371
- }
372
-
373
- // Not an agent ID - proceed normally
374
- const adapter = this.select(params);
375
- return {
376
- adapter,
377
- resolvedParams: params,
378
- wasAgentIdResolved: false,
379
- };
380
- }
381
-
382
- /**
383
- * Check if a string looks like an ERC-8004 agent ID.
384
- *
385
- * Agent IDs are numeric strings (uint256) that are:
386
- * - NOT Ethereum addresses (0x-prefixed)
387
- * - NOT URLs (http/https)
388
- * - Valid as BigInt in range [0, 2^256)
389
- *
390
- * @param to - Recipient string to check
391
- * @returns True if it looks like an agent ID
392
- */
393
- isERC8004AgentId(to: string): boolean {
394
- if (!to || typeof to !== 'string') {
395
- return false;
396
- }
397
-
398
- // Not an Ethereum address
399
- if (to.startsWith('0x')) {
400
- return false;
401
- }
402
-
403
- // Not a URL
404
- if (to.includes('://') || to.startsWith('http')) {
405
- return false;
406
- }
407
-
408
- // Must be a valid uint256
409
- try {
410
- const bn = BigInt(to);
411
- return bn >= 0n && bn < 2n ** 256n;
412
- } catch {
413
- return false;
414
- }
415
- }
416
- }