@dcentralab/d402-client 0.2.1 → 0.2.3

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.
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
- import { http, createPublicClient, createWalletClient, decodeEventLog, isAddress } from 'viem';
2
- import { sepolia, localhost } from 'viem/chains';
3
- import { privateKeyToAccount } from 'viem/accounts';
1
+ import { http, createPublicClient, createWalletClient, decodeEventLog, isAddress, encodeFunctionData } from 'viem';
2
+ import { sepolia } from 'viem/chains';
4
3
 
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -198,38 +197,17 @@ var CHAIN_IDS, NETWORKS, TOKEN_ADDRESSES, DEFAULT_VALIDITY_WINDOW_SECONDS, EIP71
198
197
  var init_constants = __esm({
199
198
  "src/constants.ts"() {
200
199
  CHAIN_IDS = {
201
- mainnet: 1,
202
- sepolia: 11155111,
203
- base: 8453,
204
- polygon: 137
200
+ sepolia: 11155111
205
201
  };
206
202
  NETWORKS = {
207
- mainnet: {
208
- chainId: 1,
209
- name: "Ethereum Mainnet",
210
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }
211
- },
212
203
  sepolia: {
213
204
  chainId: 11155111,
214
205
  name: "Sepolia Testnet",
215
206
  nativeCurrency: { name: "Sepolia Ether", symbol: "SEP", decimals: 18 }
216
- },
217
- base: {
218
- chainId: 8453,
219
- name: "Base",
220
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }
221
- },
222
- polygon: {
223
- chainId: 137,
224
- name: "Polygon",
225
- nativeCurrency: { name: "MATIC", symbol: "MATIC", decimals: 18 }
226
207
  }
227
208
  };
228
209
  TOKEN_ADDRESSES = {
229
- mainnet: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
230
- sepolia: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
231
- base: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
232
- polygon: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
210
+ sepolia: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"
233
211
  };
234
212
  DEFAULT_VALIDITY_WINDOW_SECONDS = 300;
235
213
  EIP712_TYPES = {
@@ -290,8 +268,7 @@ function getChainId(network) {
290
268
  "arbitrum-sepolia": 421614,
291
269
  "arbitrum-mainnet": 42161,
292
270
  "avalanche-fuji": 43113,
293
- "avalanche": 43114,
294
- "localhost": 31337
271
+ "avalanche": 43114
295
272
  };
296
273
  const chainId = networkMap[network];
297
274
  if (!chainId) {
@@ -532,132 +509,6 @@ function sortPaymentRequirements(requirements, preferredNetwork) {
532
509
  });
533
510
  }
534
511
 
535
- // src/client.ts
536
- var D402Client = class {
537
- /**
538
- * Create a new D402 Client.
539
- *
540
- * Matches Python: d402Client.__init__ (base.py lines 66-95)
541
- *
542
- * @param config - Client configuration
543
- */
544
- constructor(config) {
545
- this.operatorAccount = config.operatorAccount;
546
- this.iatpWalletAddress = config.iatpWalletAddress || config.operatorAccount.address;
547
- this.maxValue = config.maxValue;
548
- this.networkFilter = config.networkFilter;
549
- this.schemeFilter = config.schemeFilter || "exact";
550
- this.paymentRequirementsSelector = config.paymentRequirementsSelector || selectPaymentRequirement;
551
- }
552
- /**
553
- * Select payment requirement from list of options.
554
- *
555
- * Matches Python: select_payment_requirements (base.py lines 152-174)
556
- *
557
- * @param requirements - List of payment requirements from 402 response
558
- * @returns Selected payment requirement
559
- */
560
- selectPaymentRequirement(requirements) {
561
- return this.paymentRequirementsSelector(requirements, {
562
- network: this.networkFilter,
563
- scheme: this.schemeFilter,
564
- maxAmount: this.maxValue
565
- });
566
- }
567
- /**
568
- * Get the IATP wallet address used for payments.
569
- *
570
- * @returns IATPWallet contract address or operator EOA address
571
- */
572
- getIATPWalletAddress() {
573
- return this.iatpWalletAddress;
574
- }
575
- /**
576
- * Get the operator account used for signing.
577
- *
578
- * @returns Operator account
579
- */
580
- getOperatorAccount() {
581
- return this.operatorAccount;
582
- }
583
- /**
584
- * Get the maximum payment value limit.
585
- *
586
- * @returns Maximum value in base units, or undefined if no limit
587
- */
588
- getMaxValue() {
589
- return this.maxValue;
590
- }
591
- /**
592
- * Fetch with automatic 402 payment handling.
593
- *
594
- * Matches Python: HttpxHooks.on_response() (httpx.py lines 33-117)
595
- *
596
- * Flow:
597
- * 1. Make request without payment
598
- * 2. If 402 response, parse payment requirements
599
- * 3. Select appropriate payment option
600
- * 4. Sign payment with EIP-712
601
- * 5. Retry request with X-Payment header
602
- * 6. Return final response
603
- *
604
- * @param url - URL to fetch
605
- * @param init - Fetch options (method, headers, body, etc.)
606
- * @returns Response object (after payment if 402)
607
- *
608
- * @example
609
- * ```ts
610
- * const client = new D402Client({ operatorAccount, iatpWalletAddress })
611
- *
612
- * const response = await client.fetch('http://api.example.com/analyze', {
613
- * method: 'POST',
614
- * headers: { 'Content-Type': 'application/json' },
615
- * body: JSON.stringify({ text: 'Analyze this' })
616
- * })
617
- *
618
- * const data = await response.json()
619
- * ```
620
- */
621
- async fetch(url, init) {
622
- const { parseAllPaymentRequirements: parseAllPaymentRequirements2 } = await Promise.resolve().then(() => (init_parser(), parser_exports));
623
- const { signD402Payment: signD402Payment2 } = await Promise.resolve().then(() => (init_signer(), signer_exports));
624
- const { encodePayment: encodePayment2 } = await Promise.resolve().then(() => (init_encoder(), encoder_exports));
625
- let response = await fetch(url, init);
626
- if (response.status !== 402) {
627
- return response;
628
- }
629
- try {
630
- const requirements = await parseAllPaymentRequirements2(response);
631
- const selectedRequirement = this.selectPaymentRequirement(requirements);
632
- const signedPayment = await signD402Payment2({
633
- operatorAccount: this.operatorAccount,
634
- paymentRequirement: selectedRequirement,
635
- iatpWalletAddress: this.iatpWalletAddress
636
- });
637
- const paymentHeader = encodePayment2(signedPayment);
638
- response = await fetch(url, {
639
- ...init,
640
- headers: {
641
- ...init?.headers,
642
- "X-Payment": paymentHeader,
643
- "Access-Control-Expose-Headers": "X-Payment-Response"
644
- }
645
- });
646
- return response;
647
- } catch (error) {
648
- throw error;
649
- }
650
- }
651
- };
652
-
653
- // src/index.ts
654
- init_signer();
655
- init_parser();
656
- init_encoder();
657
- init_utils();
658
- init_errors();
659
- init_constants();
660
-
661
512
  // src/contracts/abis/sepolia.json
662
513
  var sepolia_default = {
663
514
  sepolia: {
@@ -1227,6 +1078,25 @@ var sepolia_default = {
1227
1078
  stateMutability: "nonpayable",
1228
1079
  type: "function"
1229
1080
  },
1081
+ {
1082
+ inputs: [
1083
+ {
1084
+ internalType: "address",
1085
+ name: "token",
1086
+ type: "address"
1087
+ }
1088
+ ],
1089
+ name: "getAvailableBalance",
1090
+ outputs: [
1091
+ {
1092
+ internalType: "uint256",
1093
+ name: "",
1094
+ type: "uint256"
1095
+ }
1096
+ ],
1097
+ stateMutability: "view",
1098
+ type: "function"
1099
+ },
1230
1100
  {
1231
1101
  inputs: [
1232
1102
  {
@@ -1339,6 +1209,50 @@ var sepolia_default = {
1339
1209
  stateMutability: "view",
1340
1210
  type: "function"
1341
1211
  },
1212
+ {
1213
+ inputs: [
1214
+ {
1215
+ internalType: "address",
1216
+ name: "token",
1217
+ type: "address"
1218
+ },
1219
+ {
1220
+ internalType: "uint256",
1221
+ name: "amount",
1222
+ type: "uint256"
1223
+ },
1224
+ {
1225
+ internalType: "address",
1226
+ name: "provider",
1227
+ type: "address"
1228
+ },
1229
+ {
1230
+ internalType: "uint256",
1231
+ name: "deadline",
1232
+ type: "uint256"
1233
+ },
1234
+ {
1235
+ internalType: "string",
1236
+ name: "requestPath",
1237
+ type: "string"
1238
+ },
1239
+ {
1240
+ internalType: "bytes",
1241
+ name: "signature",
1242
+ type: "bytes"
1243
+ }
1244
+ ],
1245
+ name: "isValidSettlementRequest",
1246
+ outputs: [
1247
+ {
1248
+ internalType: "bool",
1249
+ name: "",
1250
+ type: "bool"
1251
+ }
1252
+ ],
1253
+ stateMutability: "view",
1254
+ type: "function"
1255
+ },
1342
1256
  {
1343
1257
  inputs: [],
1344
1258
  name: "operatorAddress",
@@ -1579,6 +1493,11 @@ var sepolia_default = {
1579
1493
  internalType: "address",
1580
1494
  name: "token",
1581
1495
  type: "address"
1496
+ },
1497
+ {
1498
+ internalType: "bool",
1499
+ name: "sendToOwner",
1500
+ type: "bool"
1582
1501
  }
1583
1502
  ],
1584
1503
  name: "withdrawAllFromSettlement",
@@ -2568,6 +2487,31 @@ var sepolia_default = {
2568
2487
  name: "EpochReleased",
2569
2488
  type: "event"
2570
2489
  },
2490
+ {
2491
+ anonymous: false,
2492
+ inputs: [
2493
+ {
2494
+ indexed: true,
2495
+ internalType: "address",
2496
+ name: "facilitator",
2497
+ type: "address"
2498
+ },
2499
+ {
2500
+ indexed: true,
2501
+ internalType: "address",
2502
+ name: "token",
2503
+ type: "address"
2504
+ },
2505
+ {
2506
+ indexed: false,
2507
+ internalType: "uint256",
2508
+ name: "amount",
2509
+ type: "uint256"
2510
+ }
2511
+ ],
2512
+ name: "FacilitatorEarningsWithdrawn",
2513
+ type: "event"
2514
+ },
2571
2515
  {
2572
2516
  anonymous: false,
2573
2517
  inputs: [
@@ -2986,6 +2930,11 @@ var sepolia_default = {
2986
2930
  internalType: "struct IIATPSettlementLayer.SettlementRequest",
2987
2931
  name: "req",
2988
2932
  type: "tuple"
2933
+ },
2934
+ {
2935
+ internalType: "address",
2936
+ name: "facilitator",
2937
+ type: "address"
2989
2938
  }
2990
2939
  ],
2991
2940
  name: "_settleRequest",
@@ -3198,6 +3147,30 @@ var sepolia_default = {
3198
3147
  stateMutability: "view",
3199
3148
  type: "function"
3200
3149
  },
3150
+ {
3151
+ inputs: [
3152
+ {
3153
+ internalType: "address",
3154
+ name: "",
3155
+ type: "address"
3156
+ },
3157
+ {
3158
+ internalType: "address",
3159
+ name: "",
3160
+ type: "address"
3161
+ }
3162
+ ],
3163
+ name: "facilitatorFeeBalances",
3164
+ outputs: [
3165
+ {
3166
+ internalType: "uint256",
3167
+ name: "",
3168
+ type: "uint256"
3169
+ }
3170
+ ],
3171
+ stateMutability: "view",
3172
+ type: "function"
3173
+ },
3201
3174
  {
3202
3175
  inputs: [
3203
3176
  {
@@ -3320,13 +3293,18 @@ var sepolia_default = {
3320
3293
  },
3321
3294
  {
3322
3295
  inputs: [
3296
+ {
3297
+ internalType: "address",
3298
+ name: "facilitator",
3299
+ type: "address"
3300
+ },
3323
3301
  {
3324
3302
  internalType: "address",
3325
3303
  name: "token",
3326
3304
  type: "address"
3327
3305
  }
3328
3306
  ],
3329
- name: "getFeeBalance",
3307
+ name: "getFacilitatorEarnings",
3330
3308
  outputs: [
3331
3309
  {
3332
3310
  internalType: "uint256",
@@ -3339,18 +3317,13 @@ var sepolia_default = {
3339
3317
  },
3340
3318
  {
3341
3319
  inputs: [
3342
- {
3343
- internalType: "address",
3344
- name: "provider",
3345
- type: "address"
3346
- },
3347
3320
  {
3348
3321
  internalType: "address",
3349
3322
  name: "token",
3350
3323
  type: "address"
3351
3324
  }
3352
3325
  ],
3353
- name: "getLockedBalanceForProvider",
3326
+ name: "getFeeBalance",
3354
3327
  outputs: [
3355
3328
  {
3356
3329
  internalType: "uint256",
@@ -3367,4083 +3340,14 @@ var sepolia_default = {
3367
3340
  internalType: "address",
3368
3341
  name: "provider",
3369
3342
  type: "address"
3343
+ },
3344
+ {
3345
+ internalType: "address",
3346
+ name: "token",
3347
+ type: "address"
3370
3348
  }
3371
3349
  ],
3372
- name: "getProviderReputation",
3373
- outputs: [
3374
- {
3375
- components: [
3376
- {
3377
- internalType: "uint256",
3378
- name: "completed",
3379
- type: "uint256"
3380
- },
3381
- {
3382
- internalType: "uint256",
3383
- name: "failed",
3384
- type: "uint256"
3385
- },
3386
- {
3387
- internalType: "uint256",
3388
- name: "faults",
3389
- type: "uint256"
3390
- },
3391
- {
3392
- internalType: "int256",
3393
- name: "score",
3394
- type: "int256"
3395
- },
3396
- {
3397
- internalType: "uint256",
3398
- name: "firstSettlementAt",
3399
- type: "uint256"
3400
- }
3401
- ],
3402
- internalType: "struct IIATPSettlementLayer.Reputation",
3403
- name: "",
3404
- type: "tuple"
3405
- }
3406
- ],
3407
- stateMutability: "view",
3408
- type: "function"
3409
- },
3410
- {
3411
- inputs: [
3412
- {
3413
- internalType: "address",
3414
- name: "provider",
3415
- type: "address"
3416
- }
3417
- ],
3418
- name: "getProviderReputationScore",
3419
- outputs: [
3420
- {
3421
- internalType: "int256",
3422
- name: "",
3423
- type: "int256"
3424
- }
3425
- ],
3426
- stateMutability: "view",
3427
- type: "function"
3428
- },
3429
- {
3430
- inputs: [
3431
- {
3432
- internalType: "address",
3433
- name: "provider",
3434
- type: "address"
3435
- },
3436
- {
3437
- internalType: "address",
3438
- name: "token",
3439
- type: "address"
3440
- }
3441
- ],
3442
- name: "getUnlockedBalanceForProvider",
3443
- outputs: [
3444
- {
3445
- internalType: "uint256",
3446
- name: "",
3447
- type: "uint256"
3448
- }
3449
- ],
3450
- stateMutability: "view",
3451
- type: "function"
3452
- },
3453
- {
3454
- inputs: [
3455
- {
3456
- internalType: "address",
3457
- name: "_roleManager",
3458
- type: "address"
3459
- },
3460
- {
3461
- internalType: "address",
3462
- name: "_feeCollector",
3463
- type: "address"
3464
- }
3465
- ],
3466
- name: "initialize",
3467
- outputs: [],
3468
- stateMutability: "nonpayable",
3469
- type: "function"
3470
- },
3471
- {
3472
- inputs: [
3473
- {
3474
- internalType: "address",
3475
- name: "account",
3476
- type: "address"
3477
- }
3478
- ],
3479
- name: "isMaintainer",
3480
- outputs: [
3481
- {
3482
- internalType: "bool",
3483
- name: "",
3484
- type: "bool"
3485
- }
3486
- ],
3487
- stateMutability: "view",
3488
- type: "function"
3489
- },
3490
- {
3491
- inputs: [
3492
- {
3493
- internalType: "address",
3494
- name: "",
3495
- type: "address"
3496
- },
3497
- {
3498
- internalType: "address",
3499
- name: "",
3500
- type: "address"
3501
- }
3502
- ],
3503
- name: "lastWithdrawnEpoch",
3504
- outputs: [
3505
- {
3506
- internalType: "uint256",
3507
- name: "",
3508
- type: "uint256"
3509
- }
3510
- ],
3511
- stateMutability: "view",
3512
- type: "function"
3513
- },
3514
- {
3515
- inputs: [],
3516
- name: "maxFacilitatorFee",
3517
- outputs: [
3518
- {
3519
- internalType: "uint256",
3520
- name: "",
3521
- type: "uint256"
3522
- }
3523
- ],
3524
- stateMutability: "view",
3525
- type: "function"
3526
- },
3527
- {
3528
- inputs: [],
3529
- name: "protocolFee",
3530
- outputs: [
3531
- {
3532
- internalType: "uint256",
3533
- name: "",
3534
- type: "uint256"
3535
- }
3536
- ],
3537
- stateMutability: "view",
3538
- type: "function"
3539
- },
3540
- {
3541
- inputs: [
3542
- {
3543
- internalType: "address",
3544
- name: "",
3545
- type: "address"
3546
- },
3547
- {
3548
- internalType: "uint256",
3549
- name: "",
3550
- type: "uint256"
3551
- },
3552
- {
3553
- internalType: "address",
3554
- name: "",
3555
- type: "address"
3556
- }
3557
- ],
3558
- name: "providerEpochBalances",
3559
- outputs: [
3560
- {
3561
- internalType: "uint256",
3562
- name: "balance",
3563
- type: "uint256"
3564
- },
3565
- {
3566
- internalType: "uint256",
3567
- name: "disputeInProgressBalance",
3568
- type: "uint256"
3569
- },
3570
- {
3571
- internalType: "bool",
3572
- name: "isWithdrawn",
3573
- type: "bool"
3574
- }
3575
- ],
3576
- stateMutability: "view",
3577
- type: "function"
3578
- },
3579
- {
3580
- inputs: [
3581
- {
3582
- internalType: "address",
3583
- name: "",
3584
- type: "address"
3585
- }
3586
- ],
3587
- name: "providerReputations",
3588
- outputs: [
3589
- {
3590
- internalType: "uint256",
3591
- name: "completed",
3592
- type: "uint256"
3593
- },
3594
- {
3595
- internalType: "uint256",
3596
- name: "failed",
3597
- type: "uint256"
3598
- },
3599
- {
3600
- internalType: "uint256",
3601
- name: "faults",
3602
- type: "uint256"
3603
- },
3604
- {
3605
- internalType: "int256",
3606
- name: "score",
3607
- type: "int256"
3608
- },
3609
- {
3610
- internalType: "uint256",
3611
- name: "firstSettlementAt",
3612
- type: "uint256"
3613
- }
3614
- ],
3615
- stateMutability: "view",
3616
- type: "function"
3617
- },
3618
- {
3619
- inputs: [],
3620
- name: "proxiableUUID",
3621
- outputs: [
3622
- {
3623
- internalType: "bytes32",
3624
- name: "",
3625
- type: "bytes32"
3626
- }
3627
- ],
3628
- stateMutability: "view",
3629
- type: "function"
3630
- },
3631
- {
3632
- inputs: [
3633
- {
3634
- internalType: "bytes32",
3635
- name: "requestId",
3636
- type: "bytes32"
3637
- },
3638
- {
3639
- internalType: "bool",
3640
- name: "consumerWon",
3641
- type: "bool"
3642
- }
3643
- ],
3644
- name: "resolveDispute",
3645
- outputs: [],
3646
- stateMutability: "nonpayable",
3647
- type: "function"
3648
- },
3649
- {
3650
- inputs: [],
3651
- name: "roleManager",
3652
- outputs: [
3653
- {
3654
- internalType: "contract IRoleManager",
3655
- name: "",
3656
- type: "address"
3657
- }
3658
- ],
3659
- stateMutability: "view",
3660
- type: "function"
3661
- },
3662
- {
3663
- inputs: [
3664
- {
3665
- internalType: "uint256",
3666
- name: "_epochDuration",
3667
- type: "uint256"
3668
- },
3669
- {
3670
- internalType: "uint256",
3671
- name: "_epochReleaseDelay",
3672
- type: "uint256"
3673
- }
3674
- ],
3675
- name: "setEpochParameters",
3676
- outputs: [],
3677
- stateMutability: "nonpayable",
3678
- type: "function"
3679
- },
3680
- {
3681
- inputs: [
3682
- {
3683
- internalType: "uint256",
3684
- name: "_protocolFee",
3685
- type: "uint256"
3686
- },
3687
- {
3688
- internalType: "address",
3689
- name: "_feeCollector",
3690
- type: "address"
3691
- }
3692
- ],
3693
- name: "setFeeConfig",
3694
- outputs: [],
3695
- stateMutability: "nonpayable",
3696
- type: "function"
3697
- },
3698
- {
3699
- inputs: [
3700
- {
3701
- internalType: "uint256",
3702
- name: "_maxFacilitatorFee",
3703
- type: "uint256"
3704
- }
3705
- ],
3706
- name: "setMaxFacilitatorFee",
3707
- outputs: [],
3708
- stateMutability: "nonpayable",
3709
- type: "function"
3710
- },
3711
- {
3712
- inputs: [
3713
- {
3714
- internalType: "uint256",
3715
- name: "_requestExpirationTime",
3716
- type: "uint256"
3717
- }
3718
- ],
3719
- name: "setRequestExpirationTime",
3720
- outputs: [],
3721
- stateMutability: "nonpayable",
3722
- type: "function"
3723
- },
3724
- {
3725
- inputs: [
3726
- {
3727
- components: [
3728
- {
3729
- components: [
3730
- {
3731
- internalType: "contract IIATPWallet",
3732
- name: "consumer",
3733
- type: "address"
3734
- },
3735
- {
3736
- internalType: "contract IIATPWallet",
3737
- name: "provider",
3738
- type: "address"
3739
- },
3740
- {
3741
- internalType: "address",
3742
- name: "tokenAddress",
3743
- type: "address"
3744
- },
3745
- {
3746
- internalType: "uint256",
3747
- name: "amount",
3748
- type: "uint256"
3749
- },
3750
- {
3751
- internalType: "string",
3752
- name: "requestPath",
3753
- type: "string"
3754
- },
3755
- {
3756
- internalType: "uint256",
3757
- name: "consumerDeadline",
3758
- type: "uint256"
3759
- },
3760
- {
3761
- internalType: "uint256",
3762
- name: "timestamp",
3763
- type: "uint256"
3764
- },
3765
- {
3766
- internalType: "bytes32",
3767
- name: "serviceDescription",
3768
- type: "bytes32"
3769
- },
3770
- {
3771
- internalType: "bytes",
3772
- name: "outputHash",
3773
- type: "bytes"
3774
- },
3775
- {
3776
- internalType: "uint256",
3777
- name: "facilitatorFeePercent",
3778
- type: "uint256"
3779
- }
3780
- ],
3781
- internalType: "struct IIATPSettlementLayer.SettlementRequestData",
3782
- name: "requestData",
3783
- type: "tuple"
3784
- },
3785
- {
3786
- internalType: "bytes",
3787
- name: "consumerSignature",
3788
- type: "bytes"
3789
- },
3790
- {
3791
- internalType: "bytes",
3792
- name: "providerSignature",
3793
- type: "bytes"
3794
- }
3795
- ],
3796
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
3797
- name: "req",
3798
- type: "tuple"
3799
- }
3800
- ],
3801
- name: "settleRequest",
3802
- outputs: [],
3803
- stateMutability: "nonpayable",
3804
- type: "function"
3805
- },
3806
- {
3807
- inputs: [
3808
- {
3809
- components: [
3810
- {
3811
- components: [
3812
- {
3813
- internalType: "contract IIATPWallet",
3814
- name: "consumer",
3815
- type: "address"
3816
- },
3817
- {
3818
- internalType: "contract IIATPWallet",
3819
- name: "provider",
3820
- type: "address"
3821
- },
3822
- {
3823
- internalType: "address",
3824
- name: "tokenAddress",
3825
- type: "address"
3826
- },
3827
- {
3828
- internalType: "uint256",
3829
- name: "amount",
3830
- type: "uint256"
3831
- },
3832
- {
3833
- internalType: "string",
3834
- name: "requestPath",
3835
- type: "string"
3836
- },
3837
- {
3838
- internalType: "uint256",
3839
- name: "consumerDeadline",
3840
- type: "uint256"
3841
- },
3842
- {
3843
- internalType: "uint256",
3844
- name: "timestamp",
3845
- type: "uint256"
3846
- },
3847
- {
3848
- internalType: "bytes32",
3849
- name: "serviceDescription",
3850
- type: "bytes32"
3851
- },
3852
- {
3853
- internalType: "bytes",
3854
- name: "outputHash",
3855
- type: "bytes"
3856
- },
3857
- {
3858
- internalType: "uint256",
3859
- name: "facilitatorFeePercent",
3860
- type: "uint256"
3861
- }
3862
- ],
3863
- internalType: "struct IIATPSettlementLayer.SettlementRequestData",
3864
- name: "requestData",
3865
- type: "tuple"
3866
- },
3867
- {
3868
- internalType: "bytes",
3869
- name: "consumerSignature",
3870
- type: "bytes"
3871
- },
3872
- {
3873
- internalType: "bytes",
3874
- name: "providerSignature",
3875
- type: "bytes"
3876
- }
3877
- ],
3878
- internalType: "struct IIATPSettlementLayer.SettlementRequest[]",
3879
- name: "serviceRequests",
3880
- type: "tuple[]"
3881
- }
3882
- ],
3883
- name: "settleRequests",
3884
- outputs: [
3885
- {
3886
- internalType: "uint256[]",
3887
- name: "failedIndices",
3888
- type: "uint256[]"
3889
- }
3890
- ],
3891
- stateMutability: "nonpayable",
3892
- type: "function"
3893
- },
3894
- {
3895
- inputs: [
3896
- {
3897
- internalType: "bytes32",
3898
- name: "",
3899
- type: "bytes32"
3900
- }
3901
- ],
3902
- name: "settlements",
3903
- outputs: [
3904
- {
3905
- components: [
3906
- {
3907
- components: [
3908
- {
3909
- internalType: "contract IIATPWallet",
3910
- name: "consumer",
3911
- type: "address"
3912
- },
3913
- {
3914
- internalType: "contract IIATPWallet",
3915
- name: "provider",
3916
- type: "address"
3917
- },
3918
- {
3919
- internalType: "address",
3920
- name: "tokenAddress",
3921
- type: "address"
3922
- },
3923
- {
3924
- internalType: "uint256",
3925
- name: "amount",
3926
- type: "uint256"
3927
- },
3928
- {
3929
- internalType: "string",
3930
- name: "requestPath",
3931
- type: "string"
3932
- },
3933
- {
3934
- internalType: "uint256",
3935
- name: "consumerDeadline",
3936
- type: "uint256"
3937
- },
3938
- {
3939
- internalType: "uint256",
3940
- name: "timestamp",
3941
- type: "uint256"
3942
- },
3943
- {
3944
- internalType: "bytes32",
3945
- name: "serviceDescription",
3946
- type: "bytes32"
3947
- },
3948
- {
3949
- internalType: "bytes",
3950
- name: "outputHash",
3951
- type: "bytes"
3952
- },
3953
- {
3954
- internalType: "uint256",
3955
- name: "facilitatorFeePercent",
3956
- type: "uint256"
3957
- }
3958
- ],
3959
- internalType: "struct IIATPSettlementLayer.SettlementRequestData",
3960
- name: "requestData",
3961
- type: "tuple"
3962
- },
3963
- {
3964
- internalType: "bytes",
3965
- name: "consumerSignature",
3966
- type: "bytes"
3967
- },
3968
- {
3969
- internalType: "bytes",
3970
- name: "providerSignature",
3971
- type: "bytes"
3972
- }
3973
- ],
3974
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
3975
- name: "settlementRequest",
3976
- type: "tuple"
3977
- },
3978
- {
3979
- internalType: "uint256",
3980
- name: "epoch",
3981
- type: "uint256"
3982
- },
3983
- {
3984
- internalType: "enum IIATPSettlementLayer.RequestStatus",
3985
- name: "status",
3986
- type: "uint8"
3987
- }
3988
- ],
3989
- stateMutability: "view",
3990
- type: "function"
3991
- },
3992
- {
3993
- inputs: [
3994
- {
3995
- internalType: "address",
3996
- name: "newImplementation",
3997
- type: "address"
3998
- },
3999
- {
4000
- internalType: "bytes",
4001
- name: "data",
4002
- type: "bytes"
4003
- }
4004
- ],
4005
- name: "upgradeToAndCall",
4006
- outputs: [],
4007
- stateMutability: "payable",
4008
- type: "function"
4009
- },
4010
- {
4011
- inputs: [
4012
- {
4013
- internalType: "bytes32",
4014
- name: "",
4015
- type: "bytes32"
4016
- }
4017
- ],
4018
- name: "usedSignatures",
4019
- outputs: [
4020
- {
4021
- internalType: "bool",
4022
- name: "",
4023
- type: "bool"
4024
- }
4025
- ],
4026
- stateMutability: "view",
4027
- type: "function"
4028
- },
4029
- {
4030
- inputs: [
4031
- {
4032
- internalType: "address",
4033
- name: "token",
4034
- type: "address"
4035
- }
4036
- ],
4037
- name: "withdrawAllAvailableEpochs",
4038
- outputs: [],
4039
- stateMutability: "nonpayable",
4040
- type: "function"
4041
- },
4042
- {
4043
- inputs: [
4044
- {
4045
- internalType: "uint256",
4046
- name: "epoch",
4047
- type: "uint256"
4048
- },
4049
- {
4050
- internalType: "address",
4051
- name: "token",
4052
- type: "address"
4053
- }
4054
- ],
4055
- name: "withdrawEpochToken",
4056
- outputs: [],
4057
- stateMutability: "nonpayable",
4058
- type: "function"
4059
- }
4060
- ],
4061
- IATPWalletFactory: [
4062
- {
4063
- inputs: [],
4064
- stateMutability: "nonpayable",
4065
- type: "constructor"
4066
- },
4067
- {
4068
- inputs: [
4069
- {
4070
- internalType: "address",
4071
- name: "target",
4072
- type: "address"
4073
- }
4074
- ],
4075
- name: "AddressEmptyCode",
4076
- type: "error"
4077
- },
4078
- {
4079
- inputs: [
4080
- {
4081
- internalType: "address",
4082
- name: "implementation",
4083
- type: "address"
4084
- }
4085
- ],
4086
- name: "ERC1967InvalidImplementation",
4087
- type: "error"
4088
- },
4089
- {
4090
- inputs: [],
4091
- name: "ERC1967NonPayable",
4092
- type: "error"
4093
- },
4094
- {
4095
- inputs: [],
4096
- name: "FailedCall",
4097
- type: "error"
4098
- },
4099
- {
4100
- inputs: [],
4101
- name: "InvalidInitialization",
4102
- type: "error"
4103
- },
4104
- {
4105
- inputs: [],
4106
- name: "InvalidParameters",
4107
- type: "error"
4108
- },
4109
- {
4110
- inputs: [],
4111
- name: "NotInitializing",
4112
- type: "error"
4113
- },
4114
- {
4115
- inputs: [],
4116
- name: "UUPSUnauthorizedCallContext",
4117
- type: "error"
4118
- },
4119
- {
4120
- inputs: [
4121
- {
4122
- internalType: "bytes32",
4123
- name: "slot",
4124
- type: "bytes32"
4125
- }
4126
- ],
4127
- name: "UUPSUnsupportedProxiableUUID",
4128
- type: "error"
4129
- },
4130
- {
4131
- inputs: [],
4132
- name: "ZeroAddress",
4133
- type: "error"
4134
- },
4135
- {
4136
- anonymous: false,
4137
- inputs: [
4138
- {
4139
- indexed: false,
4140
- internalType: "uint64",
4141
- name: "version",
4142
- type: "uint64"
4143
- }
4144
- ],
4145
- name: "Initialized",
4146
- type: "event"
4147
- },
4148
- {
4149
- anonymous: false,
4150
- inputs: [
4151
- {
4152
- indexed: true,
4153
- internalType: "address",
4154
- name: "newRoleManager",
4155
- type: "address"
4156
- }
4157
- ],
4158
- name: "RoleManagerUpdated",
4159
- type: "event"
4160
- },
4161
- {
4162
- anonymous: false,
4163
- inputs: [
4164
- {
4165
- indexed: true,
4166
- internalType: "address",
4167
- name: "newSettlementLayer",
4168
- type: "address"
4169
- }
4170
- ],
4171
- name: "SettlementLayerUpdated",
4172
- type: "event"
4173
- },
4174
- {
4175
- anonymous: false,
4176
- inputs: [
4177
- {
4178
- indexed: true,
4179
- internalType: "address",
4180
- name: "implementation",
4181
- type: "address"
4182
- }
4183
- ],
4184
- name: "Upgraded",
4185
- type: "event"
4186
- },
4187
- {
4188
- anonymous: false,
4189
- inputs: [
4190
- {
4191
- indexed: true,
4192
- internalType: "address",
4193
- name: "wallet",
4194
- type: "address"
4195
- },
4196
- {
4197
- indexed: true,
4198
- internalType: "address",
4199
- name: "owner",
4200
- type: "address"
4201
- },
4202
- {
4203
- indexed: true,
4204
- internalType: "address",
4205
- name: "operatorAddress",
4206
- type: "address"
4207
- },
4208
- {
4209
- indexed: false,
4210
- internalType: "address",
4211
- name: "settlementLayer",
4212
- type: "address"
4213
- }
4214
- ],
4215
- name: "WalletCreated",
4216
- type: "event"
4217
- },
4218
- {
4219
- anonymous: false,
4220
- inputs: [
4221
- {
4222
- indexed: true,
4223
- internalType: "address",
4224
- name: "newImplementation",
4225
- type: "address"
4226
- }
4227
- ],
4228
- name: "WalletImplementationUpdated",
4229
- type: "event"
4230
- },
4231
- {
4232
- anonymous: false,
4233
- inputs: [
4234
- {
4235
- indexed: true,
4236
- internalType: "address",
4237
- name: "newRoleManager",
4238
- type: "address"
4239
- }
4240
- ],
4241
- name: "WalletRoleManagerUpdated",
4242
- type: "event"
4243
- },
4244
- {
4245
- inputs: [],
4246
- name: "BONDING_ROLE",
4247
- outputs: [
4248
- {
4249
- internalType: "bytes32",
4250
- name: "",
4251
- type: "bytes32"
4252
- }
4253
- ],
4254
- stateMutability: "view",
4255
- type: "function"
4256
- },
4257
- {
4258
- inputs: [],
4259
- name: "DEFAULT_ADMIN_ROLE",
4260
- outputs: [
4261
- {
4262
- internalType: "bytes32",
4263
- name: "",
4264
- type: "bytes32"
4265
- }
4266
- ],
4267
- stateMutability: "view",
4268
- type: "function"
4269
- },
4270
- {
4271
- inputs: [],
4272
- name: "UPGRADE_INTERFACE_VERSION",
4273
- outputs: [
4274
- {
4275
- internalType: "string",
4276
- name: "",
4277
- type: "string"
4278
- }
4279
- ],
4280
- stateMutability: "view",
4281
- type: "function"
4282
- },
4283
- {
4284
- inputs: [
4285
- {
4286
- internalType: "uint256",
4287
- name: "",
4288
- type: "uint256"
4289
- }
4290
- ],
4291
- name: "allWallets",
4292
- outputs: [
4293
- {
4294
- internalType: "address",
4295
- name: "",
4296
- type: "address"
4297
- }
4298
- ],
4299
- stateMutability: "view",
4300
- type: "function"
4301
- },
4302
- {
4303
- inputs: [
4304
- {
4305
- internalType: "address",
4306
- name: "_operatorAddress",
4307
- type: "address"
4308
- }
4309
- ],
4310
- name: "createWallet",
4311
- outputs: [
4312
- {
4313
- internalType: "address",
4314
- name: "wallet",
4315
- type: "address"
4316
- }
4317
- ],
4318
- stateMutability: "nonpayable",
4319
- type: "function"
4320
- },
4321
- {
4322
- inputs: [
4323
- {
4324
- internalType: "address",
4325
- name: "_owner",
4326
- type: "address"
4327
- },
4328
- {
4329
- internalType: "address",
4330
- name: "_operatorAddress",
4331
- type: "address"
4332
- }
4333
- ],
4334
- name: "createWalletFor",
4335
- outputs: [
4336
- {
4337
- internalType: "address",
4338
- name: "wallet",
4339
- type: "address"
4340
- }
4341
- ],
4342
- stateMutability: "nonpayable",
4343
- type: "function"
4344
- },
4345
- {
4346
- inputs: [
4347
- {
4348
- internalType: "address",
4349
- name: "_operator",
4350
- type: "address"
4351
- }
4352
- ],
4353
- name: "getOperatorWalletCount",
4354
- outputs: [
4355
- {
4356
- internalType: "uint256",
4357
- name: "",
4358
- type: "uint256"
4359
- }
4360
- ],
4361
- stateMutability: "view",
4362
- type: "function"
4363
- },
4364
- {
4365
- inputs: [
4366
- {
4367
- internalType: "address",
4368
- name: "_owner",
4369
- type: "address"
4370
- }
4371
- ],
4372
- name: "getOwnerWalletCount",
4373
- outputs: [
4374
- {
4375
- internalType: "uint256",
4376
- name: "",
4377
- type: "uint256"
4378
- }
4379
- ],
4380
- stateMutability: "view",
4381
- type: "function"
4382
- },
4383
- {
4384
- inputs: [],
4385
- name: "getTotalWallets",
4386
- outputs: [
4387
- {
4388
- internalType: "uint256",
4389
- name: "",
4390
- type: "uint256"
4391
- }
4392
- ],
4393
- stateMutability: "view",
4394
- type: "function"
4395
- },
4396
- {
4397
- inputs: [
4398
- {
4399
- internalType: "address",
4400
- name: "_owner",
4401
- type: "address"
4402
- }
4403
- ],
4404
- name: "getWallet",
4405
- outputs: [
4406
- {
4407
- internalType: "address",
4408
- name: "",
4409
- type: "address"
4410
- }
4411
- ],
4412
- stateMutability: "view",
4413
- type: "function"
4414
- },
4415
- {
4416
- inputs: [
4417
- {
4418
- internalType: "uint256",
4419
- name: "_offset",
4420
- type: "uint256"
4421
- },
4422
- {
4423
- internalType: "uint256",
4424
- name: "_limit",
4425
- type: "uint256"
4426
- }
4427
- ],
4428
- name: "getWallets",
4429
- outputs: [
4430
- {
4431
- internalType: "address[]",
4432
- name: "wallets",
4433
- type: "address[]"
4434
- },
4435
- {
4436
- internalType: "uint256",
4437
- name: "total",
4438
- type: "uint256"
4439
- }
4440
- ],
4441
- stateMutability: "view",
4442
- type: "function"
4443
- },
4444
- {
4445
- inputs: [
4446
- {
4447
- internalType: "address",
4448
- name: "_operator",
4449
- type: "address"
4450
- }
4451
- ],
4452
- name: "getWalletsByOperator",
4453
- outputs: [
4454
- {
4455
- internalType: "address[]",
4456
- name: "",
4457
- type: "address[]"
4458
- }
4459
- ],
4460
- stateMutability: "view",
4461
- type: "function"
4462
- },
4463
- {
4464
- inputs: [
4465
- {
4466
- internalType: "address",
4467
- name: "_owner",
4468
- type: "address"
4469
- }
4470
- ],
4471
- name: "getWalletsByOwner",
4472
- outputs: [
4473
- {
4474
- internalType: "address[]",
4475
- name: "",
4476
- type: "address[]"
4477
- }
4478
- ],
4479
- stateMutability: "view",
4480
- type: "function"
4481
- },
4482
- {
4483
- inputs: [
4484
- {
4485
- internalType: "address",
4486
- name: "_owner",
4487
- type: "address"
4488
- }
4489
- ],
4490
- name: "hasWallet",
4491
- outputs: [
4492
- {
4493
- internalType: "bool",
4494
- name: "",
4495
- type: "bool"
4496
- }
4497
- ],
4498
- stateMutability: "view",
4499
- type: "function"
4500
- },
4501
- {
4502
- inputs: [
4503
- {
4504
- internalType: "address",
4505
- name: "_roleManager",
4506
- type: "address"
4507
- },
4508
- {
4509
- internalType: "address",
4510
- name: "_walletRoleManager",
4511
- type: "address"
4512
- },
4513
- {
4514
- internalType: "address",
4515
- name: "_settlementLayer",
4516
- type: "address"
4517
- },
4518
- {
4519
- internalType: "address",
4520
- name: "_walletImplementation",
4521
- type: "address"
4522
- }
4523
- ],
4524
- name: "initialize",
4525
- outputs: [],
4526
- stateMutability: "nonpayable",
4527
- type: "function"
4528
- },
4529
- {
4530
- inputs: [
4531
- {
4532
- internalType: "address",
4533
- name: "account",
4534
- type: "address"
4535
- }
4536
- ],
4537
- name: "isMaintainer",
4538
- outputs: [
4539
- {
4540
- internalType: "bool",
4541
- name: "",
4542
- type: "bool"
4543
- }
4544
- ],
4545
- stateMutability: "view",
4546
- type: "function"
4547
- },
4548
- {
4549
- inputs: [
4550
- {
4551
- internalType: "address",
4552
- name: "",
4553
- type: "address"
4554
- }
4555
- ],
4556
- name: "ownerByWallet",
4557
- outputs: [
4558
- {
4559
- internalType: "address",
4560
- name: "",
4561
- type: "address"
4562
- }
4563
- ],
4564
- stateMutability: "view",
4565
- type: "function"
4566
- },
4567
- {
4568
- inputs: [],
4569
- name: "proxiableUUID",
4570
- outputs: [
4571
- {
4572
- internalType: "bytes32",
4573
- name: "",
4574
- type: "bytes32"
4575
- }
4576
- ],
4577
- stateMutability: "view",
4578
- type: "function"
4579
- },
4580
- {
4581
- inputs: [],
4582
- name: "roleManager",
4583
- outputs: [
4584
- {
4585
- internalType: "contract IRoleManager",
4586
- name: "",
4587
- type: "address"
4588
- }
4589
- ],
4590
- stateMutability: "view",
4591
- type: "function"
4592
- },
4593
- {
4594
- inputs: [
4595
- {
4596
- internalType: "address",
4597
- name: "_newSettlementLayer",
4598
- type: "address"
4599
- }
4600
- ],
4601
- name: "setSettlementLayer",
4602
- outputs: [],
4603
- stateMutability: "nonpayable",
4604
- type: "function"
4605
- },
4606
- {
4607
- inputs: [
4608
- {
4609
- internalType: "address",
4610
- name: "_newWalletImplementation",
4611
- type: "address"
4612
- }
4613
- ],
4614
- name: "setWalletImplementation",
4615
- outputs: [],
4616
- stateMutability: "nonpayable",
4617
- type: "function"
4618
- },
4619
- {
4620
- inputs: [
4621
- {
4622
- internalType: "address",
4623
- name: "_newWalletRoleManager",
4624
- type: "address"
4625
- }
4626
- ],
4627
- name: "setWalletRoleManager",
4628
- outputs: [],
4629
- stateMutability: "nonpayable",
4630
- type: "function"
4631
- },
4632
- {
4633
- inputs: [],
4634
- name: "settlementLayer",
4635
- outputs: [
4636
- {
4637
- internalType: "address",
4638
- name: "",
4639
- type: "address"
4640
- }
4641
- ],
4642
- stateMutability: "view",
4643
- type: "function"
4644
- },
4645
- {
4646
- inputs: [],
4647
- name: "totalWallets",
4648
- outputs: [
4649
- {
4650
- internalType: "uint256",
4651
- name: "",
4652
- type: "uint256"
4653
- }
4654
- ],
4655
- stateMutability: "view",
4656
- type: "function"
4657
- },
4658
- {
4659
- inputs: [
4660
- {
4661
- internalType: "address",
4662
- name: "newImplementation",
4663
- type: "address"
4664
- },
4665
- {
4666
- internalType: "bytes",
4667
- name: "data",
4668
- type: "bytes"
4669
- }
4670
- ],
4671
- name: "upgradeToAndCall",
4672
- outputs: [],
4673
- stateMutability: "payable",
4674
- type: "function"
4675
- },
4676
- {
4677
- inputs: [],
4678
- name: "walletImplementation",
4679
- outputs: [
4680
- {
4681
- internalType: "address",
4682
- name: "",
4683
- type: "address"
4684
- }
4685
- ],
4686
- stateMutability: "view",
4687
- type: "function"
4688
- },
4689
- {
4690
- inputs: [],
4691
- name: "walletRoleManager",
4692
- outputs: [
4693
- {
4694
- internalType: "address",
4695
- name: "",
4696
- type: "address"
4697
- }
4698
- ],
4699
- stateMutability: "view",
4700
- type: "function"
4701
- },
4702
- {
4703
- inputs: [
4704
- {
4705
- internalType: "address",
4706
- name: "",
4707
- type: "address"
4708
- },
4709
- {
4710
- internalType: "uint256",
4711
- name: "",
4712
- type: "uint256"
4713
- }
4714
- ],
4715
- name: "walletsByOperator",
4716
- outputs: [
4717
- {
4718
- internalType: "address",
4719
- name: "",
4720
- type: "address"
4721
- }
4722
- ],
4723
- stateMutability: "view",
4724
- type: "function"
4725
- },
4726
- {
4727
- inputs: [
4728
- {
4729
- internalType: "address",
4730
- name: "",
4731
- type: "address"
4732
- },
4733
- {
4734
- internalType: "uint256",
4735
- name: "",
4736
- type: "uint256"
4737
- }
4738
- ],
4739
- name: "walletsByOwner",
4740
- outputs: [
4741
- {
4742
- internalType: "address",
4743
- name: "",
4744
- type: "address"
4745
- }
4746
- ],
4747
- stateMutability: "view",
4748
- type: "function"
4749
- }
4750
- ]
4751
- }
4752
- };
4753
-
4754
- // src/contracts/abis/localhost.json
4755
- var localhost_default = {
4756
- localhost: {
4757
- IATPWallet: [
4758
- {
4759
- inputs: [],
4760
- stateMutability: "nonpayable",
4761
- type: "constructor"
4762
- },
4763
- {
4764
- inputs: [
4765
- {
4766
- internalType: "address",
4767
- name: "target",
4768
- type: "address"
4769
- }
4770
- ],
4771
- name: "AddressEmptyCode",
4772
- type: "error"
4773
- },
4774
- {
4775
- inputs: [],
4776
- name: "ECDSAInvalidSignature",
4777
- type: "error"
4778
- },
4779
- {
4780
- inputs: [
4781
- {
4782
- internalType: "uint256",
4783
- name: "length",
4784
- type: "uint256"
4785
- }
4786
- ],
4787
- name: "ECDSAInvalidSignatureLength",
4788
- type: "error"
4789
- },
4790
- {
4791
- inputs: [
4792
- {
4793
- internalType: "bytes32",
4794
- name: "s",
4795
- type: "bytes32"
4796
- }
4797
- ],
4798
- name: "ECDSAInvalidSignatureS",
4799
- type: "error"
4800
- },
4801
- {
4802
- inputs: [
4803
- {
4804
- internalType: "address",
4805
- name: "implementation",
4806
- type: "address"
4807
- }
4808
- ],
4809
- name: "ERC1967InvalidImplementation",
4810
- type: "error"
4811
- },
4812
- {
4813
- inputs: [],
4814
- name: "ERC1967NonPayable",
4815
- type: "error"
4816
- },
4817
- {
4818
- inputs: [],
4819
- name: "FailedCall",
4820
- type: "error"
4821
- },
4822
- {
4823
- inputs: [],
4824
- name: "InsufficientBalance",
4825
- type: "error"
4826
- },
4827
- {
4828
- inputs: [],
4829
- name: "InvalidAmount",
4830
- type: "error"
4831
- },
4832
- {
4833
- inputs: [],
4834
- name: "InvalidInitialization",
4835
- type: "error"
4836
- },
4837
- {
4838
- inputs: [],
4839
- name: "InvalidOperatorAddress",
4840
- type: "error"
4841
- },
4842
- {
4843
- inputs: [],
4844
- name: "InvalidOwnerAddress",
4845
- type: "error"
4846
- },
4847
- {
4848
- inputs: [],
4849
- name: "InvalidProvider",
4850
- type: "error"
4851
- },
4852
- {
4853
- inputs: [],
4854
- name: "InvalidSettlementLayerAddress",
4855
- type: "error"
4856
- },
4857
- {
4858
- inputs: [],
4859
- name: "InvalidSignature",
4860
- type: "error"
4861
- },
4862
- {
4863
- inputs: [],
4864
- name: "InvalidTokenAddress",
4865
- type: "error"
4866
- },
4867
- {
4868
- inputs: [],
4869
- name: "NotAuthorized",
4870
- type: "error"
4871
- },
4872
- {
4873
- inputs: [],
4874
- name: "NotInitializing",
4875
- type: "error"
4876
- },
4877
- {
4878
- inputs: [],
4879
- name: "NotSettlementLayer",
4880
- type: "error"
4881
- },
4882
- {
4883
- inputs: [],
4884
- name: "OnlyOwner",
4885
- type: "error"
4886
- },
4887
- {
4888
- inputs: [],
4889
- name: "PendingWithdrawalExists",
4890
- type: "error"
4891
- },
4892
- {
4893
- inputs: [
4894
- {
4895
- internalType: "address",
4896
- name: "token",
4897
- type: "address"
4898
- }
4899
- ],
4900
- name: "SafeERC20FailedOperation",
4901
- type: "error"
4902
- },
4903
- {
4904
- inputs: [],
4905
- name: "SignatureExpired",
4906
- type: "error"
4907
- },
4908
- {
4909
- inputs: [],
4910
- name: "TransferFailed",
4911
- type: "error"
4912
- },
4913
- {
4914
- inputs: [],
4915
- name: "UUPSUnauthorizedCallContext",
4916
- type: "error"
4917
- },
4918
- {
4919
- inputs: [
4920
- {
4921
- internalType: "bytes32",
4922
- name: "slot",
4923
- type: "bytes32"
4924
- }
4925
- ],
4926
- name: "UUPSUnsupportedProxiableUUID",
4927
- type: "error"
4928
- },
4929
- {
4930
- inputs: [],
4931
- name: "WithdrawalAlreadyExecuted",
4932
- type: "error"
4933
- },
4934
- {
4935
- inputs: [],
4936
- name: "WithdrawalLockupNotExpired",
4937
- type: "error"
4938
- },
4939
- {
4940
- inputs: [],
4941
- name: "WithdrawalRequestNotFound",
4942
- type: "error"
4943
- },
4944
- {
4945
- anonymous: false,
4946
- inputs: [
4947
- {
4948
- indexed: true,
4949
- internalType: "address",
4950
- name: "owner",
4951
- type: "address"
4952
- },
4953
- {
4954
- indexed: true,
4955
- internalType: "address",
4956
- name: "operatorAddress",
4957
- type: "address"
4958
- },
4959
- {
4960
- indexed: false,
4961
- internalType: "address",
4962
- name: "settlementLayer",
4963
- type: "address"
4964
- }
4965
- ],
4966
- name: "ClientInitialized",
4967
- type: "event"
4968
- },
4969
- {
4970
- anonymous: false,
4971
- inputs: [],
4972
- name: "EIP712DomainChanged",
4973
- type: "event"
4974
- },
4975
- {
4976
- anonymous: false,
4977
- inputs: [
4978
- {
4979
- indexed: true,
4980
- internalType: "address",
4981
- name: "token",
4982
- type: "address"
4983
- },
4984
- {
4985
- indexed: false,
4986
- internalType: "uint256",
4987
- name: "amount",
4988
- type: "uint256"
4989
- }
4990
- ],
4991
- name: "FundsDeposited",
4992
- type: "event"
4993
- },
4994
- {
4995
- anonymous: false,
4996
- inputs: [
4997
- {
4998
- indexed: true,
4999
- internalType: "address",
5000
- name: "token",
5001
- type: "address"
5002
- },
5003
- {
5004
- indexed: false,
5005
- internalType: "uint256",
5006
- name: "amount",
5007
- type: "uint256"
5008
- },
5009
- {
5010
- indexed: true,
5011
- internalType: "address",
5012
- name: "provider",
5013
- type: "address"
5014
- },
5015
- {
5016
- indexed: true,
5017
- internalType: "address",
5018
- name: "signer",
5019
- type: "address"
5020
- }
5021
- ],
5022
- name: "FundsTransferredToSettlement",
5023
- type: "event"
5024
- },
5025
- {
5026
- anonymous: false,
5027
- inputs: [
5028
- {
5029
- indexed: false,
5030
- internalType: "uint64",
5031
- name: "version",
5032
- type: "uint64"
5033
- }
5034
- ],
5035
- name: "Initialized",
5036
- type: "event"
5037
- },
5038
- {
5039
- anonymous: false,
5040
- inputs: [
5041
- {
5042
- indexed: true,
5043
- internalType: "address",
5044
- name: "oldOperator",
5045
- type: "address"
5046
- },
5047
- {
5048
- indexed: true,
5049
- internalType: "address",
5050
- name: "newOperator",
5051
- type: "address"
5052
- }
5053
- ],
5054
- name: "OperatorAddressUpdated",
5055
- type: "event"
5056
- },
5057
- {
5058
- anonymous: false,
5059
- inputs: [
5060
- {
5061
- indexed: true,
5062
- internalType: "address",
5063
- name: "newRoleManager",
5064
- type: "address"
5065
- }
5066
- ],
5067
- name: "RoleManagerUpdated",
5068
- type: "event"
5069
- },
5070
- {
5071
- anonymous: false,
5072
- inputs: [
5073
- {
5074
- indexed: true,
5075
- internalType: "address",
5076
- name: "implementation",
5077
- type: "address"
5078
- }
5079
- ],
5080
- name: "Upgraded",
5081
- type: "event"
5082
- },
5083
- {
5084
- anonymous: false,
5085
- inputs: [
5086
- {
5087
- indexed: true,
5088
- internalType: "address",
5089
- name: "token",
5090
- type: "address"
5091
- },
5092
- {
5093
- indexed: false,
5094
- internalType: "uint256",
5095
- name: "amount",
5096
- type: "uint256"
5097
- }
5098
- ],
5099
- name: "WithdrawalCancelled",
5100
- type: "event"
5101
- },
5102
- {
5103
- anonymous: false,
5104
- inputs: [
5105
- {
5106
- indexed: true,
5107
- internalType: "address",
5108
- name: "token",
5109
- type: "address"
5110
- },
5111
- {
5112
- indexed: false,
5113
- internalType: "uint256",
5114
- name: "amount",
5115
- type: "uint256"
5116
- },
5117
- {
5118
- indexed: true,
5119
- internalType: "address",
5120
- name: "recipient",
5121
- type: "address"
5122
- }
5123
- ],
5124
- name: "WithdrawalExecuted",
5125
- type: "event"
5126
- },
5127
- {
5128
- anonymous: false,
5129
- inputs: [
5130
- {
5131
- indexed: true,
5132
- internalType: "address",
5133
- name: "token",
5134
- type: "address"
5135
- },
5136
- {
5137
- indexed: false,
5138
- internalType: "uint256",
5139
- name: "amount",
5140
- type: "uint256"
5141
- },
5142
- {
5143
- indexed: false,
5144
- internalType: "uint256",
5145
- name: "requestedAt",
5146
- type: "uint256"
5147
- },
5148
- {
5149
- indexed: false,
5150
- internalType: "uint256",
5151
- name: "unlockTime",
5152
- type: "uint256"
5153
- }
5154
- ],
5155
- name: "WithdrawalRequested",
5156
- type: "event"
5157
- },
5158
- {
5159
- inputs: [],
5160
- name: "BONDING_ROLE",
5161
- outputs: [
5162
- {
5163
- internalType: "bytes32",
5164
- name: "",
5165
- type: "bytes32"
5166
- }
5167
- ],
5168
- stateMutability: "view",
5169
- type: "function"
5170
- },
5171
- {
5172
- inputs: [],
5173
- name: "DEFAULT_ADMIN_ROLE",
5174
- outputs: [
5175
- {
5176
- internalType: "bytes32",
5177
- name: "",
5178
- type: "bytes32"
5179
- }
5180
- ],
5181
- stateMutability: "view",
5182
- type: "function"
5183
- },
5184
- {
5185
- inputs: [],
5186
- name: "PROVIDER_ATTESTATION_TYPEHASH",
5187
- outputs: [
5188
- {
5189
- internalType: "bytes32",
5190
- name: "",
5191
- type: "bytes32"
5192
- }
5193
- ],
5194
- stateMutability: "view",
5195
- type: "function"
5196
- },
5197
- {
5198
- inputs: [],
5199
- name: "PULL_FUNDS_FOR_SETTLEMENT_TYPEHASH",
5200
- outputs: [
5201
- {
5202
- internalType: "bytes32",
5203
- name: "",
5204
- type: "bytes32"
5205
- }
5206
- ],
5207
- stateMutability: "view",
5208
- type: "function"
5209
- },
5210
- {
5211
- inputs: [],
5212
- name: "UPGRADE_INTERFACE_VERSION",
5213
- outputs: [
5214
- {
5215
- internalType: "string",
5216
- name: "",
5217
- type: "string"
5218
- }
5219
- ],
5220
- stateMutability: "view",
5221
- type: "function"
5222
- },
5223
- {
5224
- inputs: [],
5225
- name: "WITHDRAWAL_LOCKUP_PERIOD",
5226
- outputs: [
5227
- {
5228
- internalType: "uint256",
5229
- name: "",
5230
- type: "uint256"
5231
- }
5232
- ],
5233
- stateMutability: "view",
5234
- type: "function"
5235
- },
5236
- {
5237
- inputs: [
5238
- {
5239
- internalType: "address",
5240
- name: "token",
5241
- type: "address"
5242
- }
5243
- ],
5244
- name: "cancelWithdrawal",
5245
- outputs: [],
5246
- stateMutability: "nonpayable",
5247
- type: "function"
5248
- },
5249
- {
5250
- inputs: [
5251
- {
5252
- internalType: "address",
5253
- name: "token",
5254
- type: "address"
5255
- },
5256
- {
5257
- internalType: "uint256",
5258
- name: "amount",
5259
- type: "uint256"
5260
- }
5261
- ],
5262
- name: "deposit",
5263
- outputs: [],
5264
- stateMutability: "nonpayable",
5265
- type: "function"
5266
- },
5267
- {
5268
- inputs: [],
5269
- name: "eip712Domain",
5270
- outputs: [
5271
- {
5272
- internalType: "bytes1",
5273
- name: "fields",
5274
- type: "bytes1"
5275
- },
5276
- {
5277
- internalType: "string",
5278
- name: "name",
5279
- type: "string"
5280
- },
5281
- {
5282
- internalType: "string",
5283
- name: "version",
5284
- type: "string"
5285
- },
5286
- {
5287
- internalType: "uint256",
5288
- name: "chainId",
5289
- type: "uint256"
5290
- },
5291
- {
5292
- internalType: "address",
5293
- name: "verifyingContract",
5294
- type: "address"
5295
- },
5296
- {
5297
- internalType: "bytes32",
5298
- name: "salt",
5299
- type: "bytes32"
5300
- },
5301
- {
5302
- internalType: "uint256[]",
5303
- name: "extensions",
5304
- type: "uint256[]"
5305
- }
5306
- ],
5307
- stateMutability: "view",
5308
- type: "function"
5309
- },
5310
- {
5311
- inputs: [
5312
- {
5313
- internalType: "address",
5314
- name: "token",
5315
- type: "address"
5316
- }
5317
- ],
5318
- name: "executeWithdrawal",
5319
- outputs: [],
5320
- stateMutability: "nonpayable",
5321
- type: "function"
5322
- },
5323
- {
5324
- inputs: [
5325
- {
5326
- internalType: "address",
5327
- name: "token",
5328
- type: "address"
5329
- }
5330
- ],
5331
- name: "getBalance",
5332
- outputs: [
5333
- {
5334
- internalType: "uint256",
5335
- name: "",
5336
- type: "uint256"
5337
- }
5338
- ],
5339
- stateMutability: "view",
5340
- type: "function"
5341
- },
5342
- {
5343
- inputs: [
5344
- {
5345
- internalType: "address",
5346
- name: "token",
5347
- type: "address"
5348
- }
5349
- ],
5350
- name: "getWithdrawalRequest",
5351
- outputs: [
5352
- {
5353
- components: [
5354
- {
5355
- internalType: "address",
5356
- name: "token",
5357
- type: "address"
5358
- },
5359
- {
5360
- internalType: "uint256",
5361
- name: "amount",
5362
- type: "uint256"
5363
- },
5364
- {
5365
- internalType: "uint256",
5366
- name: "requestedAt",
5367
- type: "uint256"
5368
- },
5369
- {
5370
- internalType: "bool",
5371
- name: "executed",
5372
- type: "bool"
5373
- }
5374
- ],
5375
- internalType: "struct IIATPWallet.WithdrawalRequest",
5376
- name: "request",
5377
- type: "tuple"
5378
- },
5379
- {
5380
- internalType: "uint256",
5381
- name: "unlockTime",
5382
- type: "uint256"
5383
- }
5384
- ],
5385
- stateMutability: "view",
5386
- type: "function"
5387
- },
5388
- {
5389
- inputs: [
5390
- {
5391
- internalType: "address",
5392
- name: "_roleManager",
5393
- type: "address"
5394
- },
5395
- {
5396
- internalType: "address",
5397
- name: "_owner",
5398
- type: "address"
5399
- },
5400
- {
5401
- internalType: "address",
5402
- name: "_operatorAddress",
5403
- type: "address"
5404
- },
5405
- {
5406
- internalType: "address",
5407
- name: "_settlementLayer",
5408
- type: "address"
5409
- }
5410
- ],
5411
- name: "initialize",
5412
- outputs: [],
5413
- stateMutability: "nonpayable",
5414
- type: "function"
5415
- },
5416
- {
5417
- inputs: [
5418
- {
5419
- internalType: "address",
5420
- name: "account",
5421
- type: "address"
5422
- }
5423
- ],
5424
- name: "isMaintainer",
5425
- outputs: [
5426
- {
5427
- internalType: "bool",
5428
- name: "",
5429
- type: "bool"
5430
- }
5431
- ],
5432
- stateMutability: "view",
5433
- type: "function"
5434
- },
5435
- {
5436
- inputs: [],
5437
- name: "operatorAddress",
5438
- outputs: [
5439
- {
5440
- internalType: "address",
5441
- name: "",
5442
- type: "address"
5443
- }
5444
- ],
5445
- stateMutability: "view",
5446
- type: "function"
5447
- },
5448
- {
5449
- inputs: [],
5450
- name: "owner",
5451
- outputs: [
5452
- {
5453
- internalType: "address",
5454
- name: "",
5455
- type: "address"
5456
- }
5457
- ],
5458
- stateMutability: "view",
5459
- type: "function"
5460
- },
5461
- {
5462
- inputs: [],
5463
- name: "proxiableUUID",
5464
- outputs: [
5465
- {
5466
- internalType: "bytes32",
5467
- name: "",
5468
- type: "bytes32"
5469
- }
5470
- ],
5471
- stateMutability: "view",
5472
- type: "function"
5473
- },
5474
- {
5475
- inputs: [
5476
- {
5477
- internalType: "address",
5478
- name: "token",
5479
- type: "address"
5480
- },
5481
- {
5482
- internalType: "uint256",
5483
- name: "amount",
5484
- type: "uint256"
5485
- },
5486
- {
5487
- internalType: "address",
5488
- name: "provider",
5489
- type: "address"
5490
- },
5491
- {
5492
- internalType: "uint256",
5493
- name: "deadline",
5494
- type: "uint256"
5495
- },
5496
- {
5497
- internalType: "string",
5498
- name: "requestPath",
5499
- type: "string"
5500
- },
5501
- {
5502
- internalType: "bytes",
5503
- name: "signature",
5504
- type: "bytes"
5505
- }
5506
- ],
5507
- name: "pullFundsForSettlement",
5508
- outputs: [],
5509
- stateMutability: "nonpayable",
5510
- type: "function"
5511
- },
5512
- {
5513
- inputs: [
5514
- {
5515
- internalType: "address",
5516
- name: "token",
5517
- type: "address"
5518
- },
5519
- {
5520
- internalType: "uint256",
5521
- name: "amount",
5522
- type: "uint256"
5523
- }
5524
- ],
5525
- name: "requestWithdrawal",
5526
- outputs: [],
5527
- stateMutability: "nonpayable",
5528
- type: "function"
5529
- },
5530
- {
5531
- inputs: [],
5532
- name: "roleManager",
5533
- outputs: [
5534
- {
5535
- internalType: "contract IRoleManager",
5536
- name: "",
5537
- type: "address"
5538
- }
5539
- ],
5540
- stateMutability: "view",
5541
- type: "function"
5542
- },
5543
- {
5544
- inputs: [],
5545
- name: "settlementLayer",
5546
- outputs: [
5547
- {
5548
- internalType: "contract IIATPSettlementLayer",
5549
- name: "",
5550
- type: "address"
5551
- }
5552
- ],
5553
- stateMutability: "view",
5554
- type: "function"
5555
- },
5556
- {
5557
- inputs: [
5558
- {
5559
- internalType: "address",
5560
- name: "_newOperatorAddress",
5561
- type: "address"
5562
- }
5563
- ],
5564
- name: "updateOperatorAddress",
5565
- outputs: [],
5566
- stateMutability: "nonpayable",
5567
- type: "function"
5568
- },
5569
- {
5570
- inputs: [
5571
- {
5572
- internalType: "address",
5573
- name: "newImplementation",
5574
- type: "address"
5575
- },
5576
- {
5577
- internalType: "bytes",
5578
- name: "data",
5579
- type: "bytes"
5580
- }
5581
- ],
5582
- name: "upgradeToAndCall",
5583
- outputs: [],
5584
- stateMutability: "payable",
5585
- type: "function"
5586
- },
5587
- {
5588
- inputs: [
5589
- {
5590
- internalType: "address",
5591
- name: "token",
5592
- type: "address"
5593
- },
5594
- {
5595
- internalType: "uint256",
5596
- name: "amount",
5597
- type: "uint256"
5598
- },
5599
- {
5600
- internalType: "address",
5601
- name: "provider",
5602
- type: "address"
5603
- },
5604
- {
5605
- internalType: "uint256",
5606
- name: "deadline",
5607
- type: "uint256"
5608
- },
5609
- {
5610
- internalType: "string",
5611
- name: "requestPath",
5612
- type: "string"
5613
- },
5614
- {
5615
- internalType: "bytes",
5616
- name: "signature",
5617
- type: "bytes"
5618
- }
5619
- ],
5620
- name: "validateConsumerSignature",
5621
- outputs: [
5622
- {
5623
- internalType: "bool",
5624
- name: "",
5625
- type: "bool"
5626
- }
5627
- ],
5628
- stateMutability: "view",
5629
- type: "function"
5630
- },
5631
- {
5632
- inputs: [
5633
- {
5634
- internalType: "bytes",
5635
- name: "consumerSignature",
5636
- type: "bytes"
5637
- },
5638
- {
5639
- internalType: "bytes",
5640
- name: "outputHash",
5641
- type: "bytes"
5642
- },
5643
- {
5644
- internalType: "uint256",
5645
- name: "timestamp",
5646
- type: "uint256"
5647
- },
5648
- {
5649
- internalType: "bytes32",
5650
- name: "serviceDescription",
5651
- type: "bytes32"
5652
- },
5653
- {
5654
- internalType: "uint256",
5655
- name: "facilitatorFeePercent",
5656
- type: "uint256"
5657
- },
5658
- {
5659
- internalType: "bytes",
5660
- name: "signature",
5661
- type: "bytes"
5662
- }
5663
- ],
5664
- name: "validateProviderAttestation",
5665
- outputs: [],
5666
- stateMutability: "view",
5667
- type: "function"
5668
- },
5669
- {
5670
- inputs: [
5671
- {
5672
- internalType: "address",
5673
- name: "token",
5674
- type: "address"
5675
- }
5676
- ],
5677
- name: "withdrawAllFromSettlement",
5678
- outputs: [],
5679
- stateMutability: "nonpayable",
5680
- type: "function"
5681
- },
5682
- {
5683
- inputs: [
5684
- {
5685
- internalType: "uint256",
5686
- name: "epoch",
5687
- type: "uint256"
5688
- },
5689
- {
5690
- internalType: "address",
5691
- name: "token",
5692
- type: "address"
5693
- }
5694
- ],
5695
- name: "withdrawEpochFromSettlement",
5696
- outputs: [],
5697
- stateMutability: "nonpayable",
5698
- type: "function"
5699
- },
5700
- {
5701
- inputs: [
5702
- {
5703
- internalType: "address",
5704
- name: "",
5705
- type: "address"
5706
- }
5707
- ],
5708
- name: "withdrawalRequests",
5709
- outputs: [
5710
- {
5711
- internalType: "address",
5712
- name: "token",
5713
- type: "address"
5714
- },
5715
- {
5716
- internalType: "uint256",
5717
- name: "amount",
5718
- type: "uint256"
5719
- },
5720
- {
5721
- internalType: "uint256",
5722
- name: "requestedAt",
5723
- type: "uint256"
5724
- },
5725
- {
5726
- internalType: "bool",
5727
- name: "executed",
5728
- type: "bool"
5729
- }
5730
- ],
5731
- stateMutability: "view",
5732
- type: "function"
5733
- },
5734
- {
5735
- stateMutability: "payable",
5736
- type: "receive"
5737
- }
5738
- ],
5739
- RoleManager: [
5740
- {
5741
- inputs: [],
5742
- name: "AccessControlBadConfirmation",
5743
- type: "error"
5744
- },
5745
- {
5746
- inputs: [
5747
- {
5748
- internalType: "address",
5749
- name: "account",
5750
- type: "address"
5751
- },
5752
- {
5753
- internalType: "bytes32",
5754
- name: "neededRole",
5755
- type: "bytes32"
5756
- }
5757
- ],
5758
- name: "AccessControlUnauthorizedAccount",
5759
- type: "error"
5760
- },
5761
- {
5762
- inputs: [
5763
- {
5764
- internalType: "address",
5765
- name: "target",
5766
- type: "address"
5767
- }
5768
- ],
5769
- name: "AddressEmptyCode",
5770
- type: "error"
5771
- },
5772
- {
5773
- inputs: [
5774
- {
5775
- internalType: "address",
5776
- name: "implementation",
5777
- type: "address"
5778
- }
5779
- ],
5780
- name: "ERC1967InvalidImplementation",
5781
- type: "error"
5782
- },
5783
- {
5784
- inputs: [],
5785
- name: "ERC1967NonPayable",
5786
- type: "error"
5787
- },
5788
- {
5789
- inputs: [],
5790
- name: "FailedCall",
5791
- type: "error"
5792
- },
5793
- {
5794
- inputs: [],
5795
- name: "InvalidInitialization",
5796
- type: "error"
5797
- },
5798
- {
5799
- inputs: [],
5800
- name: "NotInitializing",
5801
- type: "error"
5802
- },
5803
- {
5804
- inputs: [],
5805
- name: "UUPSUnauthorizedCallContext",
5806
- type: "error"
5807
- },
5808
- {
5809
- inputs: [
5810
- {
5811
- internalType: "bytes32",
5812
- name: "slot",
5813
- type: "bytes32"
5814
- }
5815
- ],
5816
- name: "UUPSUnsupportedProxiableUUID",
5817
- type: "error"
5818
- },
5819
- {
5820
- anonymous: false,
5821
- inputs: [
5822
- {
5823
- indexed: false,
5824
- internalType: "uint64",
5825
- name: "version",
5826
- type: "uint64"
5827
- }
5828
- ],
5829
- name: "Initialized",
5830
- type: "event"
5831
- },
5832
- {
5833
- anonymous: false,
5834
- inputs: [
5835
- {
5836
- indexed: true,
5837
- internalType: "bytes32",
5838
- name: "role",
5839
- type: "bytes32"
5840
- },
5841
- {
5842
- indexed: true,
5843
- internalType: "bytes32",
5844
- name: "previousAdminRole",
5845
- type: "bytes32"
5846
- },
5847
- {
5848
- indexed: true,
5849
- internalType: "bytes32",
5850
- name: "newAdminRole",
5851
- type: "bytes32"
5852
- }
5853
- ],
5854
- name: "RoleAdminChanged",
5855
- type: "event"
5856
- },
5857
- {
5858
- anonymous: false,
5859
- inputs: [
5860
- {
5861
- indexed: true,
5862
- internalType: "bytes32",
5863
- name: "role",
5864
- type: "bytes32"
5865
- },
5866
- {
5867
- indexed: true,
5868
- internalType: "address",
5869
- name: "account",
5870
- type: "address"
5871
- },
5872
- {
5873
- indexed: true,
5874
- internalType: "address",
5875
- name: "sender",
5876
- type: "address"
5877
- }
5878
- ],
5879
- name: "RoleGranted",
5880
- type: "event"
5881
- },
5882
- {
5883
- anonymous: false,
5884
- inputs: [
5885
- {
5886
- indexed: true,
5887
- internalType: "bytes32",
5888
- name: "role",
5889
- type: "bytes32"
5890
- },
5891
- {
5892
- indexed: true,
5893
- internalType: "address",
5894
- name: "account",
5895
- type: "address"
5896
- },
5897
- {
5898
- indexed: true,
5899
- internalType: "address",
5900
- name: "sender",
5901
- type: "address"
5902
- }
5903
- ],
5904
- name: "RoleRevoked",
5905
- type: "event"
5906
- },
5907
- {
5908
- anonymous: false,
5909
- inputs: [
5910
- {
5911
- indexed: true,
5912
- internalType: "address",
5913
- name: "implementation",
5914
- type: "address"
5915
- }
5916
- ],
5917
- name: "Upgraded",
5918
- type: "event"
5919
- },
5920
- {
5921
- inputs: [],
5922
- name: "DEFAULT_ADMIN_ROLE",
5923
- outputs: [
5924
- {
5925
- internalType: "bytes32",
5926
- name: "",
5927
- type: "bytes32"
5928
- }
5929
- ],
5930
- stateMutability: "view",
5931
- type: "function"
5932
- },
5933
- {
5934
- inputs: [],
5935
- name: "MAINTAINER_ROLE",
5936
- outputs: [
5937
- {
5938
- internalType: "bytes32",
5939
- name: "",
5940
- type: "bytes32"
5941
- }
5942
- ],
5943
- stateMutability: "view",
5944
- type: "function"
5945
- },
5946
- {
5947
- inputs: [],
5948
- name: "UPGRADE_INTERFACE_VERSION",
5949
- outputs: [
5950
- {
5951
- internalType: "string",
5952
- name: "",
5953
- type: "string"
5954
- }
5955
- ],
5956
- stateMutability: "view",
5957
- type: "function"
5958
- },
5959
- {
5960
- inputs: [
5961
- {
5962
- internalType: "address",
5963
- name: "maintainer",
5964
- type: "address"
5965
- }
5966
- ],
5967
- name: "addMaintainer",
5968
- outputs: [],
5969
- stateMutability: "nonpayable",
5970
- type: "function"
5971
- },
5972
- {
5973
- inputs: [],
5974
- name: "getDefaultAdmin",
5975
- outputs: [
5976
- {
5977
- internalType: "address",
5978
- name: "",
5979
- type: "address"
5980
- }
5981
- ],
5982
- stateMutability: "view",
5983
- type: "function"
5984
- },
5985
- {
5986
- inputs: [
5987
- {
5988
- internalType: "bytes32",
5989
- name: "role",
5990
- type: "bytes32"
5991
- }
5992
- ],
5993
- name: "getRoleAdmin",
5994
- outputs: [
5995
- {
5996
- internalType: "bytes32",
5997
- name: "",
5998
- type: "bytes32"
5999
- }
6000
- ],
6001
- stateMutability: "view",
6002
- type: "function"
6003
- },
6004
- {
6005
- inputs: [
6006
- {
6007
- internalType: "bytes32",
6008
- name: "role",
6009
- type: "bytes32"
6010
- },
6011
- {
6012
- internalType: "uint256",
6013
- name: "index",
6014
- type: "uint256"
6015
- }
6016
- ],
6017
- name: "getRoleMember",
6018
- outputs: [
6019
- {
6020
- internalType: "address",
6021
- name: "",
6022
- type: "address"
6023
- }
6024
- ],
6025
- stateMutability: "view",
6026
- type: "function"
6027
- },
6028
- {
6029
- inputs: [
6030
- {
6031
- internalType: "bytes32",
6032
- name: "role",
6033
- type: "bytes32"
6034
- }
6035
- ],
6036
- name: "getRoleMemberCount",
6037
- outputs: [
6038
- {
6039
- internalType: "uint256",
6040
- name: "",
6041
- type: "uint256"
6042
- }
6043
- ],
6044
- stateMutability: "view",
6045
- type: "function"
6046
- },
6047
- {
6048
- inputs: [
6049
- {
6050
- internalType: "bytes32",
6051
- name: "role",
6052
- type: "bytes32"
6053
- }
6054
- ],
6055
- name: "getRoleMembers",
6056
- outputs: [
6057
- {
6058
- internalType: "address[]",
6059
- name: "",
6060
- type: "address[]"
6061
- }
6062
- ],
6063
- stateMutability: "view",
6064
- type: "function"
6065
- },
6066
- {
6067
- inputs: [
6068
- {
6069
- internalType: "bytes32",
6070
- name: "role",
6071
- type: "bytes32"
6072
- },
6073
- {
6074
- internalType: "address",
6075
- name: "account",
6076
- type: "address"
6077
- }
6078
- ],
6079
- name: "grantRole",
6080
- outputs: [],
6081
- stateMutability: "nonpayable",
6082
- type: "function"
6083
- },
6084
- {
6085
- inputs: [
6086
- {
6087
- internalType: "bytes32",
6088
- name: "role",
6089
- type: "bytes32"
6090
- },
6091
- {
6092
- internalType: "address",
6093
- name: "account",
6094
- type: "address"
6095
- }
6096
- ],
6097
- name: "hasRole",
6098
- outputs: [
6099
- {
6100
- internalType: "bool",
6101
- name: "",
6102
- type: "bool"
6103
- }
6104
- ],
6105
- stateMutability: "view",
6106
- type: "function"
6107
- },
6108
- {
6109
- inputs: [
6110
- {
6111
- internalType: "address",
6112
- name: "congress",
6113
- type: "address"
6114
- },
6115
- {
6116
- internalType: "address[]",
6117
- name: "maintainers",
6118
- type: "address[]"
6119
- }
6120
- ],
6121
- name: "initialize",
6122
- outputs: [],
6123
- stateMutability: "nonpayable",
6124
- type: "function"
6125
- },
6126
- {
6127
- inputs: [],
6128
- name: "proxiableUUID",
6129
- outputs: [
6130
- {
6131
- internalType: "bytes32",
6132
- name: "",
6133
- type: "bytes32"
6134
- }
6135
- ],
6136
- stateMutability: "view",
6137
- type: "function"
6138
- },
6139
- {
6140
- inputs: [
6141
- {
6142
- internalType: "address",
6143
- name: "maintainer",
6144
- type: "address"
6145
- }
6146
- ],
6147
- name: "removeMaintainer",
6148
- outputs: [],
6149
- stateMutability: "nonpayable",
6150
- type: "function"
6151
- },
6152
- {
6153
- inputs: [
6154
- {
6155
- internalType: "bytes32",
6156
- name: "role",
6157
- type: "bytes32"
6158
- },
6159
- {
6160
- internalType: "address",
6161
- name: "callerConfirmation",
6162
- type: "address"
6163
- }
6164
- ],
6165
- name: "renounceRole",
6166
- outputs: [],
6167
- stateMutability: "nonpayable",
6168
- type: "function"
6169
- },
6170
- {
6171
- inputs: [
6172
- {
6173
- internalType: "bytes32",
6174
- name: "role",
6175
- type: "bytes32"
6176
- },
6177
- {
6178
- internalType: "address",
6179
- name: "account",
6180
- type: "address"
6181
- }
6182
- ],
6183
- name: "revokeRole",
6184
- outputs: [],
6185
- stateMutability: "nonpayable",
6186
- type: "function"
6187
- },
6188
- {
6189
- inputs: [
6190
- {
6191
- internalType: "bytes4",
6192
- name: "interfaceId",
6193
- type: "bytes4"
6194
- }
6195
- ],
6196
- name: "supportsInterface",
6197
- outputs: [
6198
- {
6199
- internalType: "bool",
6200
- name: "",
6201
- type: "bool"
6202
- }
6203
- ],
6204
- stateMutability: "view",
6205
- type: "function"
6206
- },
6207
- {
6208
- inputs: [
6209
- {
6210
- internalType: "address",
6211
- name: "newAdmin",
6212
- type: "address"
6213
- }
6214
- ],
6215
- name: "transferDefaultAdmin",
6216
- outputs: [],
6217
- stateMutability: "nonpayable",
6218
- type: "function"
6219
- },
6220
- {
6221
- inputs: [
6222
- {
6223
- internalType: "address",
6224
- name: "newImplementation",
6225
- type: "address"
6226
- },
6227
- {
6228
- internalType: "bytes",
6229
- name: "data",
6230
- type: "bytes"
6231
- }
6232
- ],
6233
- name: "upgradeToAndCall",
6234
- outputs: [],
6235
- stateMutability: "payable",
6236
- type: "function"
6237
- }
6238
- ],
6239
- IATPSettlementLayer: [
6240
- {
6241
- inputs: [],
6242
- stateMutability: "nonpayable",
6243
- type: "constructor"
6244
- },
6245
- {
6246
- inputs: [
6247
- {
6248
- internalType: "address",
6249
- name: "target",
6250
- type: "address"
6251
- }
6252
- ],
6253
- name: "AddressEmptyCode",
6254
- type: "error"
6255
- },
6256
- {
6257
- inputs: [],
6258
- name: "AmountMustBePositive",
6259
- type: "error"
6260
- },
6261
- {
6262
- inputs: [],
6263
- name: "ArrayLengthMismatch",
6264
- type: "error"
6265
- },
6266
- {
6267
- inputs: [],
6268
- name: "CannotReleaseEpochYet",
6269
- type: "error"
6270
- },
6271
- {
6272
- inputs: [],
6273
- name: "ConsumerProviderSame",
6274
- type: "error"
6275
- },
6276
- {
6277
- inputs: [],
6278
- name: "DisputeAlreadyFiled",
6279
- type: "error"
6280
- },
6281
- {
6282
- inputs: [],
6283
- name: "DisputeAlreadyResolved",
6284
- type: "error"
6285
- },
6286
- {
6287
- inputs: [],
6288
- name: "DisputeNotFound",
6289
- type: "error"
6290
- },
6291
- {
6292
- inputs: [],
6293
- name: "DisputePeriodExpired",
6294
- type: "error"
6295
- },
6296
- {
6297
- inputs: [
6298
- {
6299
- internalType: "address",
6300
- name: "implementation",
6301
- type: "address"
6302
- }
6303
- ],
6304
- name: "ERC1967InvalidImplementation",
6305
- type: "error"
6306
- },
6307
- {
6308
- inputs: [],
6309
- name: "ERC1967NonPayable",
6310
- type: "error"
6311
- },
6312
- {
6313
- inputs: [],
6314
- name: "EmptyArray",
6315
- type: "error"
6316
- },
6317
- {
6318
- inputs: [],
6319
- name: "EpochMustBeNextOne",
6320
- type: "error"
6321
- },
6322
- {
6323
- inputs: [],
6324
- name: "EpochMustBeOne",
6325
- type: "error"
6326
- },
6327
- {
6328
- inputs: [],
6329
- name: "FailedCall",
6330
- type: "error"
6331
- },
6332
- {
6333
- inputs: [],
6334
- name: "InsufficientBalance",
6335
- type: "error"
6336
- },
6337
- {
6338
- inputs: [],
6339
- name: "InvalidAddress",
6340
- type: "error"
6341
- },
6342
- {
6343
- inputs: [],
6344
- name: "InvalidConsumer",
6345
- type: "error"
6346
- },
6347
- {
6348
- inputs: [],
6349
- name: "InvalidConsumerSignature",
6350
- type: "error"
6351
- },
6352
- {
6353
- inputs: [],
6354
- name: "InvalidEpoch",
6355
- type: "error"
6356
- },
6357
- {
6358
- inputs: [],
6359
- name: "InvalidInitialization",
6360
- type: "error"
6361
- },
6362
- {
6363
- inputs: [],
6364
- name: "InvalidInput",
6365
- type: "error"
6366
- },
6367
- {
6368
- inputs: [],
6369
- name: "InvalidProvider",
6370
- type: "error"
6371
- },
6372
- {
6373
- inputs: [],
6374
- name: "InvalidProviderSignature",
6375
- type: "error"
6376
- },
6377
- {
6378
- inputs: [],
6379
- name: "InvalidTraiaToken",
6380
- type: "error"
6381
- },
6382
- {
6383
- inputs: [],
6384
- name: "InvalidUtilityAgentFactory",
6385
- type: "error"
6386
- },
6387
- {
6388
- inputs: [],
6389
- name: "NoFundsToRelease",
6390
- type: "error"
6391
- },
6392
- {
6393
- inputs: [],
6394
- name: "NoLockedFunds",
6395
- type: "error"
6396
- },
6397
- {
6398
- inputs: [],
6399
- name: "NotAuthorized",
6400
- type: "error"
6401
- },
6402
- {
6403
- inputs: [],
6404
- name: "NotInitializing",
6405
- type: "error"
6406
- },
6407
- {
6408
- inputs: [],
6409
- name: "ProviderNotRegistered",
6410
- type: "error"
6411
- },
6412
- {
6413
- inputs: [],
6414
- name: "ReentrancyGuardReentrantCall",
6415
- type: "error"
6416
- },
6417
- {
6418
- inputs: [],
6419
- name: "RequestAlreadyProcessed",
6420
- type: "error"
6421
- },
6422
- {
6423
- inputs: [],
6424
- name: "RequestExpired",
6425
- type: "error"
6426
- },
6427
- {
6428
- inputs: [],
6429
- name: "RequestNotSettled",
6430
- type: "error"
6431
- },
6432
- {
6433
- inputs: [
6434
- {
6435
- internalType: "address",
6436
- name: "token",
6437
- type: "address"
6438
- }
6439
- ],
6440
- name: "SafeERC20FailedOperation",
6441
- type: "error"
6442
- },
6443
- {
6444
- inputs: [],
6445
- name: "SignatureAlreadyUsed",
6446
- type: "error"
6447
- },
6448
- {
6449
- inputs: [],
6450
- name: "UUPSUnauthorizedCallContext",
6451
- type: "error"
6452
- },
6453
- {
6454
- inputs: [
6455
- {
6456
- internalType: "bytes32",
6457
- name: "slot",
6458
- type: "bytes32"
6459
- }
6460
- ],
6461
- name: "UUPSUnsupportedProxiableUUID",
6462
- type: "error"
6463
- },
6464
- {
6465
- anonymous: false,
6466
- inputs: [
6467
- {
6468
- indexed: true,
6469
- internalType: "address",
6470
- name: "consumer",
6471
- type: "address"
6472
- },
6473
- {
6474
- indexed: false,
6475
- internalType: "uint256",
6476
- name: "refillAmount",
6477
- type: "uint256"
6478
- },
6479
- {
6480
- indexed: false,
6481
- internalType: "uint256",
6482
- name: "previousBalance",
6483
- type: "uint256"
6484
- },
6485
- {
6486
- indexed: false,
6487
- internalType: "uint256",
6488
- name: "newBalance",
6489
- type: "uint256"
6490
- }
6491
- ],
6492
- name: "AutoRefillExecuted",
6493
- type: "event"
6494
- },
6495
- {
6496
- anonymous: false,
6497
- inputs: [
6498
- {
6499
- indexed: false,
6500
- internalType: "uint256",
6501
- name: "newMaxAutoRefillAmount",
6502
- type: "uint256"
6503
- },
6504
- {
6505
- indexed: false,
6506
- internalType: "uint256",
6507
- name: "newBalanceThresholdMultiplier",
6508
- type: "uint256"
6509
- },
6510
- {
6511
- indexed: false,
6512
- internalType: "uint256",
6513
- name: "newAutoRefillMultiplier",
6514
- type: "uint256"
6515
- }
6516
- ],
6517
- name: "AutoRefillParametersUpdated",
6518
- type: "event"
6519
- },
6520
- {
6521
- anonymous: false,
6522
- inputs: [
6523
- {
6524
- indexed: true,
6525
- internalType: "address",
6526
- name: "consumer",
6527
- type: "address"
6528
- },
6529
- {
6530
- indexed: false,
6531
- internalType: "uint256",
6532
- name: "amount",
6533
- type: "uint256"
6534
- }
6535
- ],
6536
- name: "ConsumerDeposit",
6537
- type: "event"
6538
- },
6539
- {
6540
- anonymous: false,
6541
- inputs: [
6542
- {
6543
- indexed: true,
6544
- internalType: "address",
6545
- name: "consumer",
6546
- type: "address"
6547
- },
6548
- {
6549
- indexed: false,
6550
- internalType: "uint256",
6551
- name: "amount",
6552
- type: "uint256"
6553
- }
6554
- ],
6555
- name: "ConsumerWithdraw",
6556
- type: "event"
6557
- },
6558
- {
6559
- anonymous: false,
6560
- inputs: [
6561
- {
6562
- indexed: true,
6563
- internalType: "bytes32",
6564
- name: "requestId",
6565
- type: "bytes32"
6566
- },
6567
- {
6568
- indexed: true,
6569
- internalType: "address",
6570
- name: "consumer",
6571
- type: "address"
6572
- },
6573
- {
6574
- indexed: true,
6575
- internalType: "address",
6576
- name: "provider",
6577
- type: "address"
6578
- },
6579
- {
6580
- indexed: false,
6581
- internalType: "string",
6582
- name: "reason",
6583
- type: "string"
6584
- }
6585
- ],
6586
- name: "DisputeFiled",
6587
- type: "event"
6588
- },
6589
- {
6590
- anonymous: false,
6591
- inputs: [
6592
- {
6593
- indexed: true,
6594
- internalType: "bytes32",
6595
- name: "requestId",
6596
- type: "bytes32"
6597
- },
6598
- {
6599
- indexed: false,
6600
- internalType: "bool",
6601
- name: "consumerWon",
6602
- type: "bool"
6603
- },
6604
- {
6605
- indexed: false,
6606
- internalType: "address",
6607
- name: "resolvedBy",
6608
- type: "address"
6609
- }
6610
- ],
6611
- name: "DisputeResolved",
6612
- type: "event"
6613
- },
6614
- {
6615
- anonymous: false,
6616
- inputs: [],
6617
- name: "EIP712DomainChanged",
6618
- type: "event"
6619
- },
6620
- {
6621
- anonymous: false,
6622
- inputs: [
6623
- {
6624
- indexed: false,
6625
- internalType: "uint256",
6626
- name: "epochDurationSeconds",
6627
- type: "uint256"
6628
- },
6629
- {
6630
- indexed: false,
6631
- internalType: "uint256",
6632
- name: "maxEpochsToRelease",
6633
- type: "uint256"
6634
- }
6635
- ],
6636
- name: "EpochParametersSet",
6637
- type: "event"
6638
- },
6639
- {
6640
- anonymous: false,
6641
- inputs: [
6642
- {
6643
- indexed: true,
6644
- internalType: "address",
6645
- name: "provider",
6646
- type: "address"
6647
- },
6648
- {
6649
- indexed: false,
6650
- internalType: "uint256",
6651
- name: "epoch",
6652
- type: "uint256"
6653
- },
6654
- {
6655
- indexed: false,
6656
- internalType: "uint256",
6657
- name: "amount",
6658
- type: "uint256"
6659
- }
6660
- ],
6661
- name: "EpochReleased",
6662
- type: "event"
6663
- },
6664
- {
6665
- anonymous: false,
6666
- inputs: [
6667
- {
6668
- indexed: false,
6669
- internalType: "uint256",
6670
- name: "newFeePercent",
6671
- type: "uint256"
6672
- },
6673
- {
6674
- indexed: true,
6675
- internalType: "address",
6676
- name: "newFeeCollector",
6677
- type: "address"
6678
- }
6679
- ],
6680
- name: "FeeConfigUpdated",
6681
- type: "event"
6682
- },
6683
- {
6684
- anonymous: false,
6685
- inputs: [
6686
- {
6687
- indexed: true,
6688
- internalType: "address",
6689
- name: "provider",
6690
- type: "address"
6691
- },
6692
- {
6693
- indexed: true,
6694
- internalType: "address",
6695
- name: "feeCollector",
6696
- type: "address"
6697
- },
6698
- {
6699
- indexed: false,
6700
- internalType: "uint256",
6701
- name: "feeAmount",
6702
- type: "uint256"
6703
- },
6704
- {
6705
- indexed: false,
6706
- internalType: "uint256",
6707
- name: "providerAmount",
6708
- type: "uint256"
6709
- }
6710
- ],
6711
- name: "FeesCollected",
6712
- type: "event"
6713
- },
6714
- {
6715
- anonymous: false,
6716
- inputs: [
6717
- {
6718
- indexed: false,
6719
- internalType: "uint64",
6720
- name: "version",
6721
- type: "uint64"
6722
- }
6723
- ],
6724
- name: "Initialized",
6725
- type: "event"
6726
- },
6727
- {
6728
- anonymous: false,
6729
- inputs: [
6730
- {
6731
- indexed: false,
6732
- internalType: "uint256",
6733
- name: "newMaxFacilitatorFee",
6734
- type: "uint256"
6735
- }
6736
- ],
6737
- name: "MaxFacilitatorFeeUpdated",
6738
- type: "event"
6739
- },
6740
- {
6741
- anonymous: false,
6742
- inputs: [
6743
- {
6744
- indexed: true,
6745
- internalType: "address",
6746
- name: "provider",
6747
- type: "address"
6748
- },
6749
- {
6750
- indexed: false,
6751
- internalType: "uint256",
6752
- name: "amount",
6753
- type: "uint256"
6754
- }
6755
- ],
6756
- name: "ProviderWithdrawn",
6757
- type: "event"
6758
- },
6759
- {
6760
- anonymous: false,
6761
- inputs: [
6762
- {
6763
- indexed: true,
6764
- internalType: "bytes32",
6765
- name: "requestId",
6766
- type: "bytes32"
6767
- },
6768
- {
6769
- indexed: true,
6770
- internalType: "address",
6771
- name: "consumer",
6772
- type: "address"
6773
- },
6774
- {
6775
- indexed: true,
6776
- internalType: "address",
6777
- name: "provider",
6778
- type: "address"
6779
- },
6780
- {
6781
- indexed: false,
6782
- internalType: "uint256",
6783
- name: "amount",
6784
- type: "uint256"
6785
- },
6786
- {
6787
- indexed: false,
6788
- internalType: "uint256",
6789
- name: "consumerRequestCount",
6790
- type: "uint256"
6791
- },
6792
- {
6793
- indexed: false,
6794
- internalType: "uint256",
6795
- name: "epoch",
6796
- type: "uint256"
6797
- },
6798
- {
6799
- indexed: false,
6800
- internalType: "address",
6801
- name: "tokenAddress",
6802
- type: "address"
6803
- }
6804
- ],
6805
- name: "RequestSettled",
6806
- type: "event"
6807
- },
6808
- {
6809
- anonymous: false,
6810
- inputs: [
6811
- {
6812
- indexed: true,
6813
- internalType: "uint256",
6814
- name: "index",
6815
- type: "uint256"
6816
- },
6817
- {
6818
- indexed: true,
6819
- internalType: "address",
6820
- name: "consumer",
6821
- type: "address"
6822
- },
6823
- {
6824
- indexed: true,
6825
- internalType: "address",
6826
- name: "provider",
6827
- type: "address"
6828
- },
6829
- {
6830
- indexed: false,
6831
- internalType: "bytes32",
6832
- name: "requestId",
6833
- type: "bytes32"
6834
- },
6835
- {
6836
- indexed: false,
6837
- internalType: "bytes",
6838
- name: "reason",
6839
- type: "bytes"
6840
- }
6841
- ],
6842
- name: "RequestSettlementFailed",
6843
- type: "event"
6844
- },
6845
- {
6846
- anonymous: false,
6847
- inputs: [
6848
- {
6849
- indexed: true,
6850
- internalType: "address",
6851
- name: "newRoleManager",
6852
- type: "address"
6853
- }
6854
- ],
6855
- name: "RoleManagerUpdated",
6856
- type: "event"
6857
- },
6858
- {
6859
- anonymous: false,
6860
- inputs: [
6861
- {
6862
- indexed: true,
6863
- internalType: "address",
6864
- name: "implementation",
6865
- type: "address"
6866
- }
6867
- ],
6868
- name: "Upgraded",
6869
- type: "event"
6870
- },
6871
- {
6872
- anonymous: false,
6873
- inputs: [
6874
- {
6875
- indexed: true,
6876
- internalType: "address",
6877
- name: "oldFactory",
6878
- type: "address"
6879
- },
6880
- {
6881
- indexed: true,
6882
- internalType: "address",
6883
- name: "newFactory",
6884
- type: "address"
6885
- }
6886
- ],
6887
- name: "UtilityAgentFactoryUpdated",
6888
- type: "event"
6889
- },
6890
- {
6891
- inputs: [],
6892
- name: "BASIS_POINTS",
6893
- outputs: [
6894
- {
6895
- internalType: "uint256",
6896
- name: "",
6897
- type: "uint256"
6898
- }
6899
- ],
6900
- stateMutability: "view",
6901
- type: "function"
6902
- },
6903
- {
6904
- inputs: [],
6905
- name: "BONDING_ROLE",
6906
- outputs: [
6907
- {
6908
- internalType: "bytes32",
6909
- name: "",
6910
- type: "bytes32"
6911
- }
6912
- ],
6913
- stateMutability: "view",
6914
- type: "function"
6915
- },
6916
- {
6917
- inputs: [],
6918
- name: "DEFAULT_ADMIN_ROLE",
6919
- outputs: [
6920
- {
6921
- internalType: "bytes32",
6922
- name: "",
6923
- type: "bytes32"
6924
- }
6925
- ],
6926
- stateMutability: "view",
6927
- type: "function"
6928
- },
6929
- {
6930
- inputs: [],
6931
- name: "EpochDuration",
6932
- outputs: [
6933
- {
6934
- internalType: "uint256",
6935
- name: "",
6936
- type: "uint256"
6937
- }
6938
- ],
6939
- stateMutability: "view",
6940
- type: "function"
6941
- },
6942
- {
6943
- inputs: [],
6944
- name: "EpochReleaseDelay",
6945
- outputs: [
6946
- {
6947
- internalType: "uint256",
6948
- name: "",
6949
- type: "uint256"
6950
- }
6951
- ],
6952
- stateMutability: "view",
6953
- type: "function"
6954
- },
6955
- {
6956
- inputs: [],
6957
- name: "MAX_FEE_PERCENT",
6958
- outputs: [
6959
- {
6960
- internalType: "uint256",
6961
- name: "",
6962
- type: "uint256"
6963
- }
6964
- ],
6965
- stateMutability: "view",
6966
- type: "function"
6967
- },
6968
- {
6969
- inputs: [],
6970
- name: "RequestExpirationTime",
6971
- outputs: [
6972
- {
6973
- internalType: "uint256",
6974
- name: "",
6975
- type: "uint256"
6976
- }
6977
- ],
6978
- stateMutability: "view",
6979
- type: "function"
6980
- },
6981
- {
6982
- inputs: [],
6983
- name: "SETTLEMENT_POINTS",
6984
- outputs: [
6985
- {
6986
- internalType: "uint256",
6987
- name: "",
6988
- type: "uint256"
6989
- }
6990
- ],
6991
- stateMutability: "view",
6992
- type: "function"
6993
- },
6994
- {
6995
- inputs: [],
6996
- name: "UPGRADE_INTERFACE_VERSION",
6997
- outputs: [
6998
- {
6999
- internalType: "string",
7000
- name: "",
7001
- type: "string"
7002
- }
7003
- ],
7004
- stateMutability: "view",
7005
- type: "function"
7006
- },
7007
- {
7008
- inputs: [
7009
- {
7010
- components: [
7011
- {
7012
- components: [
7013
- {
7014
- internalType: "contract IIATPWallet",
7015
- name: "consumer",
7016
- type: "address"
7017
- },
7018
- {
7019
- internalType: "contract IIATPWallet",
7020
- name: "provider",
7021
- type: "address"
7022
- },
7023
- {
7024
- internalType: "address",
7025
- name: "tokenAddress",
7026
- type: "address"
7027
- },
7028
- {
7029
- internalType: "uint256",
7030
- name: "amount",
7031
- type: "uint256"
7032
- },
7033
- {
7034
- internalType: "string",
7035
- name: "requestPath",
7036
- type: "string"
7037
- },
7038
- {
7039
- internalType: "uint256",
7040
- name: "consumerDeadline",
7041
- type: "uint256"
7042
- },
7043
- {
7044
- internalType: "uint256",
7045
- name: "timestamp",
7046
- type: "uint256"
7047
- },
7048
- {
7049
- internalType: "bytes32",
7050
- name: "serviceDescription",
7051
- type: "bytes32"
7052
- },
7053
- {
7054
- internalType: "bytes",
7055
- name: "outputHash",
7056
- type: "bytes"
7057
- },
7058
- {
7059
- internalType: "uint256",
7060
- name: "facilitatorFeePercent",
7061
- type: "uint256"
7062
- }
7063
- ],
7064
- internalType: "struct IIATPSettlementLayer.SettlementRequestData",
7065
- name: "requestData",
7066
- type: "tuple"
7067
- },
7068
- {
7069
- internalType: "bytes",
7070
- name: "consumerSignature",
7071
- type: "bytes"
7072
- },
7073
- {
7074
- internalType: "bytes",
7075
- name: "providerSignature",
7076
- type: "bytes"
7077
- }
7078
- ],
7079
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
7080
- name: "req",
7081
- type: "tuple"
7082
- }
7083
- ],
7084
- name: "_settleRequest",
7085
- outputs: [],
7086
- stateMutability: "nonpayable",
7087
- type: "function"
7088
- },
7089
- {
7090
- inputs: [
7091
- {
7092
- internalType: "uint256",
7093
- name: "epoch",
7094
- type: "uint256"
7095
- }
7096
- ],
7097
- name: "canReleaseEpoch",
7098
- outputs: [
7099
- {
7100
- internalType: "bool",
7101
- name: "",
7102
- type: "bool"
7103
- }
7104
- ],
7105
- stateMutability: "view",
7106
- type: "function"
7107
- },
7108
- {
7109
- inputs: [
7110
- {
7111
- internalType: "address",
7112
- name: "token",
7113
- type: "address"
7114
- }
7115
- ],
7116
- name: "collectFees",
7117
- outputs: [],
7118
- stateMutability: "nonpayable",
7119
- type: "function"
7120
- },
7121
- {
7122
- inputs: [
7123
- {
7124
- internalType: "address",
7125
- name: "",
7126
- type: "address"
7127
- }
7128
- ],
7129
- name: "consumerReputations",
7130
- outputs: [
7131
- {
7132
- internalType: "uint256",
7133
- name: "completed",
7134
- type: "uint256"
7135
- },
7136
- {
7137
- internalType: "uint256",
7138
- name: "failed",
7139
- type: "uint256"
7140
- },
7141
- {
7142
- internalType: "uint256",
7143
- name: "faults",
7144
- type: "uint256"
7145
- },
7146
- {
7147
- internalType: "int256",
7148
- name: "score",
7149
- type: "int256"
7150
- },
7151
- {
7152
- internalType: "uint256",
7153
- name: "firstSettlementAt",
7154
- type: "uint256"
7155
- }
7156
- ],
7157
- stateMutability: "view",
7158
- type: "function"
7159
- },
7160
- {
7161
- inputs: [
7162
- {
7163
- internalType: "address",
7164
- name: "",
7165
- type: "address"
7166
- }
7167
- ],
7168
- name: "consumerRequestCounts",
7169
- outputs: [
7170
- {
7171
- internalType: "uint256",
7172
- name: "",
7173
- type: "uint256"
7174
- }
7175
- ],
7176
- stateMutability: "view",
7177
- type: "function"
7178
- },
7179
- {
7180
- inputs: [
7181
- {
7182
- internalType: "bytes32",
7183
- name: "requestId",
7184
- type: "bytes32"
7185
- },
7186
- {
7187
- internalType: "string",
7188
- name: "reason",
7189
- type: "string"
7190
- }
7191
- ],
7192
- name: "disputeRequest",
7193
- outputs: [],
7194
- stateMutability: "nonpayable",
7195
- type: "function"
7196
- },
7197
- {
7198
- inputs: [
7199
- {
7200
- internalType: "bytes32",
7201
- name: "",
7202
- type: "bytes32"
7203
- }
7204
- ],
7205
- name: "disputes",
7206
- outputs: [
7207
- {
7208
- internalType: "bytes32",
7209
- name: "requestId",
7210
- type: "bytes32"
7211
- },
7212
- {
7213
- internalType: "address",
7214
- name: "consumer",
7215
- type: "address"
7216
- },
7217
- {
7218
- internalType: "address",
7219
- name: "provider",
7220
- type: "address"
7221
- },
7222
- {
7223
- internalType: "uint256",
7224
- name: "amount",
7225
- type: "uint256"
7226
- },
7227
- {
7228
- internalType: "uint256",
7229
- name: "epoch",
7230
- type: "uint256"
7231
- },
7232
- {
7233
- internalType: "string",
7234
- name: "reason",
7235
- type: "string"
7236
- },
7237
- {
7238
- internalType: "uint256",
7239
- name: "filedAt",
7240
- type: "uint256"
7241
- },
7242
- {
7243
- internalType: "bool",
7244
- name: "resolved",
7245
- type: "bool"
7246
- }
7247
- ],
7248
- stateMutability: "view",
7249
- type: "function"
7250
- },
7251
- {
7252
- inputs: [],
7253
- name: "eip712Domain",
7254
- outputs: [
7255
- {
7256
- internalType: "bytes1",
7257
- name: "fields",
7258
- type: "bytes1"
7259
- },
7260
- {
7261
- internalType: "string",
7262
- name: "name",
7263
- type: "string"
7264
- },
7265
- {
7266
- internalType: "string",
7267
- name: "version",
7268
- type: "string"
7269
- },
7270
- {
7271
- internalType: "uint256",
7272
- name: "chainId",
7273
- type: "uint256"
7274
- },
7275
- {
7276
- internalType: "address",
7277
- name: "verifyingContract",
7278
- type: "address"
7279
- },
7280
- {
7281
- internalType: "bytes32",
7282
- name: "salt",
7283
- type: "bytes32"
7284
- },
7285
- {
7286
- internalType: "uint256[]",
7287
- name: "extensions",
7288
- type: "uint256[]"
7289
- }
7290
- ],
7291
- stateMutability: "view",
7292
- type: "function"
7293
- },
7294
- {
7295
- inputs: [
7296
- {
7297
- internalType: "address",
7298
- name: "",
7299
- type: "address"
7300
- }
7301
- ],
7302
- name: "feeBalances",
7303
- outputs: [
7304
- {
7305
- internalType: "uint256",
7306
- name: "",
7307
- type: "uint256"
7308
- }
7309
- ],
7310
- stateMutability: "view",
7311
- type: "function"
7312
- },
7313
- {
7314
- inputs: [],
7315
- name: "feeCollector",
7316
- outputs: [
7317
- {
7318
- internalType: "address",
7319
- name: "",
7320
- type: "address"
7321
- }
7322
- ],
7323
- stateMutability: "view",
7324
- type: "function"
7325
- },
7326
- {
7327
- inputs: [],
7328
- name: "getCurrentEpoch",
7329
- outputs: [
7330
- {
7331
- internalType: "uint256",
7332
- name: "",
7333
- type: "uint256"
7334
- }
7335
- ],
7336
- stateMutability: "view",
7337
- type: "function"
7338
- },
7339
- {
7340
- inputs: [
7341
- {
7342
- internalType: "address",
7343
- name: "provider",
7344
- type: "address"
7345
- },
7346
- {
7347
- internalType: "uint256",
7348
- name: "epoch",
7349
- type: "uint256"
7350
- },
7351
- {
7352
- internalType: "address",
7353
- name: "token",
7354
- type: "address"
7355
- }
7356
- ],
7357
- name: "getDisputeInProgressAmount",
7358
- outputs: [
7359
- {
7360
- internalType: "uint256",
7361
- name: "",
7362
- type: "uint256"
7363
- }
7364
- ],
7365
- stateMutability: "view",
7366
- type: "function"
7367
- },
7368
- {
7369
- inputs: [
7370
- {
7371
- internalType: "address",
7372
- name: "provider",
7373
- type: "address"
7374
- },
7375
- {
7376
- internalType: "uint256",
7377
- name: "epoch",
7378
- type: "uint256"
7379
- },
7380
- {
7381
- internalType: "address",
7382
- name: "token",
7383
- type: "address"
7384
- }
7385
- ],
7386
- name: "getEpochBalance",
7387
- outputs: [
7388
- {
7389
- components: [
7390
- {
7391
- internalType: "uint256",
7392
- name: "balance",
7393
- type: "uint256"
7394
- },
7395
- {
7396
- internalType: "uint256",
7397
- name: "disputeInProgressBalance",
7398
- type: "uint256"
7399
- },
7400
- {
7401
- internalType: "bool",
7402
- name: "isWithdrawn",
7403
- type: "bool"
7404
- }
7405
- ],
7406
- internalType: "struct IIATPSettlementLayer.EpochBalance",
7407
- name: "",
7408
- type: "tuple"
7409
- }
7410
- ],
7411
- stateMutability: "view",
7412
- type: "function"
7413
- },
7414
- {
7415
- inputs: [
7416
- {
7417
- internalType: "address",
7418
- name: "token",
7419
- type: "address"
7420
- }
7421
- ],
7422
- name: "getFeeBalance",
7423
- outputs: [
7424
- {
7425
- internalType: "uint256",
7426
- name: "",
7427
- type: "uint256"
7428
- }
7429
- ],
7430
- stateMutability: "view",
7431
- type: "function"
7432
- },
7433
- {
7434
- inputs: [
7435
- {
7436
- internalType: "address",
7437
- name: "provider",
7438
- type: "address"
7439
- },
7440
- {
7441
- internalType: "address",
7442
- name: "token",
7443
- type: "address"
7444
- }
7445
- ],
7446
- name: "getLockedBalanceForProvider",
3350
+ name: "getLockedBalanceForProvider",
7447
3351
  outputs: [
7448
3352
  {
7449
3353
  internalType: "uint256",
@@ -8119,6 +4023,30 @@ var localhost_default = {
8119
4023
  stateMutability: "view",
8120
4024
  type: "function"
8121
4025
  },
4026
+ {
4027
+ inputs: [
4028
+ {
4029
+ internalType: "uint256",
4030
+ name: "amount",
4031
+ type: "uint256"
4032
+ },
4033
+ {
4034
+ internalType: "uint256",
4035
+ name: "facilitatorFeePercent",
4036
+ type: "uint256"
4037
+ }
4038
+ ],
4039
+ name: "validatePaymentAmount",
4040
+ outputs: [
4041
+ {
4042
+ internalType: "bool",
4043
+ name: "isValid",
4044
+ type: "bool"
4045
+ }
4046
+ ],
4047
+ stateMutability: "view",
4048
+ type: "function"
4049
+ },
8122
4050
  {
8123
4051
  inputs: [
8124
4052
  {
@@ -8149,6 +4077,19 @@ var localhost_default = {
8149
4077
  outputs: [],
8150
4078
  stateMutability: "nonpayable",
8151
4079
  type: "function"
4080
+ },
4081
+ {
4082
+ inputs: [
4083
+ {
4084
+ internalType: "address[]",
4085
+ name: "tokens",
4086
+ type: "address[]"
4087
+ }
4088
+ ],
4089
+ name: "withdrawFacilitatorEarnings",
4090
+ outputs: [],
4091
+ stateMutability: "nonpayable",
4092
+ type: "function"
8152
4093
  }
8153
4094
  ],
8154
4095
  IATPWalletFactory: [
@@ -8846,11 +4787,6 @@ var localhost_default = {
8846
4787
 
8847
4788
  // src/contracts/addresses/proxies.json
8848
4789
  var proxies_default = {
8849
- localhost: {
8850
- RoleManager: "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
8851
- IATPSettlementLayer: "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9",
8852
- IATPWalletFactory: "0xa513E6E4b8f2a923D98304ec87F64353C4D5C853"
8853
- },
8854
4790
  sepolia: {
8855
4791
  RoleManager: "0x71d388142EA9194e5b51Eee3FEfe3B87D494dd38",
8856
4792
  IATPSettlementLayer: "0xAa91081571404d7E2f2B8F12FB2Be092EBe6d2B8",
@@ -8860,19 +4796,12 @@ var proxies_default = {
8860
4796
 
8861
4797
  // src/contracts/addresses/implementations.json
8862
4798
  var implementations_default = {
8863
- localhost: {
8864
- IATPWalletImplementation: "0x5FC8d32690cc91D4c39d9d3abcBD16989F875707",
8865
- RoleManagerImplementation: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
8866
- Congress: "0x94Fc9eddBd1779542b78eb92F0569762603876e2",
8867
- IATPSettlementLayerImplementation: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
8868
- IATPWalletFactoryImplementation: "0x0165878A594ca255338adfa4d48449f69242Eb8F"
8869
- },
8870
4799
  sepolia: {
8871
4800
  Congress: "0x94Fc9eddBd1779542b78eb92F0569762603876e2",
8872
4801
  TraiaCongressMembersRegistry: "0x3B685403b195f16D103b42FCf56F848A278d6049",
8873
- IATPWalletImplementation: "0xab2Ea0765B9dBCf997Fe7ad2fE826D0dA51cfB69",
4802
+ IATPWalletImplementation: "0xfE32B4ae6606F70342749AD0C62E1C7e5F84E1B4",
8874
4803
  RoleManagerImplementation: "0x585AD85FCFBec3B1503E50b46407bF65d4006560",
8875
- IATPSettlementLayerImplementation: "0x88Ff3cdb3c8F7cd480DC48E849D5550F9cAeCBb7",
4804
+ IATPSettlementLayerImplementation: "0x0fDd39d323EE3538c800d4A13730eecE3F0bA975",
8876
4805
  IATPWalletFactoryImplementation: "0xA1E5a53cE5b4e78801d9394EC60D0B53390CA240"
8877
4806
  }
8878
4807
  };
@@ -8886,8 +4815,7 @@ var ContractName = /* @__PURE__ */ ((ContractName2) => {
8886
4815
  return ContractName2;
8887
4816
  })(ContractName || {});
8888
4817
  var ABIS = {
8889
- sepolia: sepolia_default.sepolia || {},
8890
- localhost: localhost_default.localhost || {}
4818
+ sepolia: sepolia_default.sepolia || {}
8891
4819
  };
8892
4820
  var PROXY_ADDRESSES = proxies_default;
8893
4821
  var IMPL_ADDRESSES = implementations_default;
@@ -8922,16 +4850,16 @@ function isContractDeployed(contractName, network) {
8922
4850
  const abi = getContractAbi(contractName, network);
8923
4851
  return address !== null && abi !== null;
8924
4852
  }
8925
- init_utils();
4853
+
4854
+ // src/wallet.ts
8926
4855
  async function createIATPWallet(params) {
8927
- const { ownerAccount, network = "sepolia", rpcUrl, operatorPrivateKey } = params;
4856
+ const { ownerAccount, network = "sepolia", rpcUrl } = params;
8928
4857
  const factoryConfig = getContractConfig("IATPWalletFactory" /* IATP_WALLET_FACTORY */, network);
8929
4858
  if (!factoryConfig) {
8930
4859
  throw new Error(`IATPWalletFactory not found for network: ${network}`);
8931
4860
  }
8932
- const operatorKey = operatorPrivateKey || generateNonce();
8933
- const operatorAccount = privateKeyToAccount(operatorKey);
8934
- const chain = network === "sepolia" ? sepolia : localhost;
4861
+ const operatorAddress = ownerAccount.address;
4862
+ const chain = sepolia;
8935
4863
  const transport = http(rpcUrl);
8936
4864
  const publicClient = createPublicClient({
8937
4865
  chain,
@@ -8951,7 +4879,7 @@ async function createIATPWallet(params) {
8951
4879
  address: factoryConfig.address,
8952
4880
  abi: factoryConfig.abi,
8953
4881
  functionName: "createWallet",
8954
- args: [operatorAccount.address]
4882
+ args: [operatorAddress]
8955
4883
  });
8956
4884
  const hash = await walletClient.writeContract(request);
8957
4885
  const receipt = await publicClient.waitForTransactionReceipt({
@@ -8985,8 +4913,6 @@ async function createIATPWallet(params) {
8985
4913
  return {
8986
4914
  walletAddress,
8987
4915
  ownerAddress: ownerAccount.address,
8988
- operatorAddress: operatorAccount.address,
8989
- operatorPrivateKey: operatorKey,
8990
4916
  transactionHash: hash,
8991
4917
  blockNumber: receipt.blockNumber,
8992
4918
  network,
@@ -8999,7 +4925,7 @@ async function getWalletsByOwner(params) {
8999
4925
  if (!factoryConfig) {
9000
4926
  throw new Error(`IATPWalletFactory not found for network: ${network}`);
9001
4927
  }
9002
- const chain = network === "sepolia" ? sepolia : localhost;
4928
+ const chain = sepolia;
9003
4929
  const transport = http(rpcUrl);
9004
4930
  const publicClient = createPublicClient({
9005
4931
  chain,
@@ -9013,7 +4939,327 @@ async function getWalletsByOwner(params) {
9013
4939
  });
9014
4940
  return wallets;
9015
4941
  }
4942
+ async function getAvailableBalance(params) {
4943
+ const { publicClient, walletAddress, tokenAddress, network = "sepolia" } = params;
4944
+ const walletConfig = getContractConfig("IATPWallet" /* IATP_WALLET */, network);
4945
+ if (!walletConfig) {
4946
+ throw new Error(`IATPWallet contract not found for network: ${network}`);
4947
+ }
4948
+ const balance = await publicClient.readContract({
4949
+ address: walletAddress,
4950
+ abi: walletConfig.abi,
4951
+ functionName: "getAvailableBalance",
4952
+ args: [tokenAddress]
4953
+ });
4954
+ return balance;
4955
+ }
4956
+ async function getWithdrawalRequest(params) {
4957
+ const { publicClient, walletAddress, tokenAddress, network = "sepolia" } = params;
4958
+ const walletConfig = getContractConfig("IATPWallet" /* IATP_WALLET */, network);
4959
+ if (!walletConfig) {
4960
+ throw new Error(`IATPWallet contract not found for network: ${network}`);
4961
+ }
4962
+ const result = await publicClient.readContract({
4963
+ address: walletAddress,
4964
+ abi: walletConfig.abi,
4965
+ functionName: "getWithdrawalRequest",
4966
+ args: [tokenAddress]
4967
+ });
4968
+ if (result[0] === 0n) {
4969
+ return null;
4970
+ }
4971
+ return result;
4972
+ }
4973
+ async function requestWithdrawal(params) {
4974
+ const { walletClient, publicClient, walletAddress, tokenAddress, amount, account, network = "sepolia" } = params;
4975
+ const walletConfig = getContractConfig("IATPWallet" /* IATP_WALLET */, network);
4976
+ if (!walletConfig) {
4977
+ throw new Error(`IATPWallet contract not found for network: ${network}`);
4978
+ }
4979
+ const data = encodeFunctionData({
4980
+ abi: walletConfig.abi,
4981
+ functionName: "requestWithdrawal",
4982
+ args: [tokenAddress, amount]
4983
+ });
4984
+ const estimatedGas = await publicClient.estimateGas({
4985
+ account: account.address,
4986
+ to: walletAddress,
4987
+ data
4988
+ });
4989
+ const gasLimit = estimatedGas + estimatedGas * BigInt(20) / BigInt(100);
4990
+ const { request } = await publicClient.simulateContract({
4991
+ account,
4992
+ address: walletAddress,
4993
+ abi: walletConfig.abi,
4994
+ functionName: "requestWithdrawal",
4995
+ args: [tokenAddress, amount]
4996
+ });
4997
+ const hash = await walletClient.writeContract({
4998
+ ...request,
4999
+ gas: gasLimit
5000
+ });
5001
+ await publicClient.waitForTransactionReceipt({ hash });
5002
+ return hash;
5003
+ }
5004
+ async function executeWithdrawal(params) {
5005
+ const { walletClient, publicClient, walletAddress, tokenAddress, account, network = "sepolia" } = params;
5006
+ const walletConfig = getContractConfig("IATPWallet" /* IATP_WALLET */, network);
5007
+ if (!walletConfig) {
5008
+ throw new Error(`IATPWallet contract not found for network: ${network}`);
5009
+ }
5010
+ const data = encodeFunctionData({
5011
+ abi: walletConfig.abi,
5012
+ functionName: "executeWithdrawal",
5013
+ args: [tokenAddress]
5014
+ });
5015
+ const estimatedGas = await publicClient.estimateGas({
5016
+ account: account.address,
5017
+ to: walletAddress,
5018
+ data
5019
+ });
5020
+ const gasLimit = estimatedGas + estimatedGas * BigInt(20) / BigInt(100);
5021
+ const { request } = await publicClient.simulateContract({
5022
+ account,
5023
+ address: walletAddress,
5024
+ abi: walletConfig.abi,
5025
+ functionName: "executeWithdrawal",
5026
+ args: [tokenAddress]
5027
+ });
5028
+ const hash = await walletClient.writeContract({
5029
+ ...request,
5030
+ gas: gasLimit
5031
+ });
5032
+ await publicClient.waitForTransactionReceipt({ hash });
5033
+ return hash;
5034
+ }
5035
+
5036
+ // src/client.ts
5037
+ var D402Client = class {
5038
+ /**
5039
+ * Create a new D402 Client.
5040
+ *
5041
+ * @param config - Client configuration
5042
+ *
5043
+ * @example
5044
+ * ```ts
5045
+ * const client = new D402Client({
5046
+ * operatorAccount: walletClient.account, // User's wallet from wagmi
5047
+ * iatpWalletAddress: userWallet, // From createIATPWallet() or getWalletsByOwner()
5048
+ * maxValue: 1000000n // Safety limit: 1 USDC max
5049
+ * })
5050
+ * ```
5051
+ */
5052
+ constructor(config) {
5053
+ this.operatorAccount = config.operatorAccount;
5054
+ this.iatpWalletAddress = config.iatpWalletAddress;
5055
+ this.maxValue = config.maxValue;
5056
+ this.networkFilter = config.networkFilter;
5057
+ this.schemeFilter = config.schemeFilter || "exact";
5058
+ this.paymentRequirementsSelector = config.paymentRequirementsSelector || selectPaymentRequirement;
5059
+ }
5060
+ /**
5061
+ * Select payment requirement from list of options.
5062
+ *
5063
+ * Applies configured filters (network, scheme, maxValue) to choose
5064
+ * the appropriate payment option from the server's requirements list.
5065
+ *
5066
+ * @param requirements - List of payment requirements from 402 response
5067
+ * @returns Selected payment requirement
5068
+ */
5069
+ selectPaymentRequirement(requirements) {
5070
+ return this.paymentRequirementsSelector(requirements, {
5071
+ network: this.networkFilter,
5072
+ scheme: this.schemeFilter,
5073
+ maxAmount: this.maxValue
5074
+ });
5075
+ }
5076
+ /**
5077
+ * Get the IATP wallet address used for payments.
5078
+ *
5079
+ * @returns IATPWallet contract address, or user's EOA address if no wallet configured
5080
+ */
5081
+ getIATPWalletAddress() {
5082
+ return this.iatpWalletAddress;
5083
+ }
5084
+ /**
5085
+ * Get the user's account used for signing payments.
5086
+ *
5087
+ * @returns User's wallet account
5088
+ */
5089
+ getOperatorAccount() {
5090
+ return this.operatorAccount;
5091
+ }
5092
+ /**
5093
+ * Get the maximum payment value limit.
5094
+ *
5095
+ * @returns Maximum value in base units, or undefined if no limit
5096
+ */
5097
+ getMaxValue() {
5098
+ return this.maxValue;
5099
+ }
5100
+ /**
5101
+ * Get available balance for a token in the IATP wallet.
5102
+ *
5103
+ * @param publicClient - Viem PublicClient (from wagmi usePublicClient)
5104
+ * @param tokenAddress - Token contract address
5105
+ * @returns Available balance in token's base units (wei)
5106
+ */
5107
+ async getAvailableBalance(publicClient, tokenAddress) {
5108
+ return getAvailableBalance({
5109
+ publicClient,
5110
+ walletAddress: this.iatpWalletAddress,
5111
+ tokenAddress
5112
+ });
5113
+ }
5114
+ /**
5115
+ * Get withdrawal request for a token.
5116
+ *
5117
+ * @param publicClient - Viem PublicClient
5118
+ * @param tokenAddress - Token contract address
5119
+ * @returns Withdrawal request: [amount, unlockTimestamp] or null if no request exists
5120
+ */
5121
+ async getWithdrawalRequest(publicClient, tokenAddress) {
5122
+ return getWithdrawalRequest({
5123
+ publicClient,
5124
+ walletAddress: this.iatpWalletAddress,
5125
+ tokenAddress
5126
+ });
5127
+ }
5128
+ /**
5129
+ * Request a withdrawal from the IATP wallet.
5130
+ *
5131
+ * @param walletClient - Viem WalletClient (from wagmi useWalletClient)
5132
+ * @param publicClient - Viem PublicClient (from wagmi usePublicClient)
5133
+ * @param tokenAddress - Token contract address
5134
+ * @param amount - Amount in token's base units (wei)
5135
+ * @returns Transaction hash
5136
+ */
5137
+ async requestWithdrawal(walletClient, publicClient, tokenAddress, amount) {
5138
+ return requestWithdrawal({
5139
+ walletClient,
5140
+ publicClient,
5141
+ walletAddress: this.iatpWalletAddress,
5142
+ tokenAddress,
5143
+ amount,
5144
+ account: this.operatorAccount
5145
+ });
5146
+ }
5147
+ /**
5148
+ * Execute a withdrawal for a token (after unlock period).
5149
+ *
5150
+ * @param walletClient - Viem WalletClient
5151
+ * @param publicClient - Viem PublicClient
5152
+ * @param tokenAddress - Token contract address
5153
+ * @returns Transaction hash
5154
+ */
5155
+ async executeWithdrawal(walletClient, publicClient, tokenAddress) {
5156
+ return executeWithdrawal({
5157
+ walletClient,
5158
+ publicClient,
5159
+ walletAddress: this.iatpWalletAddress,
5160
+ tokenAddress,
5161
+ account: this.operatorAccount
5162
+ });
5163
+ }
5164
+ /**
5165
+ * Fetch with automatic 402 payment handling.
5166
+ *
5167
+ *
5168
+ * Flow:
5169
+ * 1. Make request without payment
5170
+ * 2. If 402 response, parse payment requirements
5171
+ * 3. Select appropriate payment option
5172
+ * 4. Sign payment with EIP-712
5173
+ * 5. Retry request with X-Payment header
5174
+ * 6. Return final response
5175
+ *
5176
+ * @param url - URL to fetch
5177
+ * @param init - Fetch options (method, headers, body, etc.)
5178
+ * @returns Response object (after payment if 402)
5179
+ *
5180
+ * @example
5181
+ * ```ts
5182
+ * const client = new D402Client({ operatorAccount, iatpWalletAddress })
5183
+ *
5184
+ * const response = await client.fetch('http://api.example.com/analyze', {
5185
+ * method: 'POST',
5186
+ * headers: { 'Content-Type': 'application/json' },
5187
+ * body: JSON.stringify({ text: 'Analyze this' })
5188
+ * })
5189
+ *
5190
+ * const data = await response.json()
5191
+ * ```
5192
+ */
5193
+ async fetch(url, init) {
5194
+ const { parseAllPaymentRequirements: parseAllPaymentRequirements2 } = await Promise.resolve().then(() => (init_parser(), parser_exports));
5195
+ const { signD402Payment: signD402Payment2 } = await Promise.resolve().then(() => (init_signer(), signer_exports));
5196
+ const { encodePayment: encodePayment2 } = await Promise.resolve().then(() => (init_encoder(), encoder_exports));
5197
+ let response = await fetch(url, init);
5198
+ if (response.status !== 402) {
5199
+ return response;
5200
+ }
5201
+ try {
5202
+ const requirements = await parseAllPaymentRequirements2(response);
5203
+ const selectedRequirement = this.selectPaymentRequirement(requirements);
5204
+ const signedPayment = await signD402Payment2({
5205
+ operatorAccount: this.operatorAccount,
5206
+ paymentRequirement: selectedRequirement,
5207
+ iatpWalletAddress: this.iatpWalletAddress
5208
+ });
5209
+ const paymentHeader = encodePayment2(signedPayment);
5210
+ response = await fetch(url, {
5211
+ ...init,
5212
+ headers: {
5213
+ ...init?.headers,
5214
+ "X-Payment": paymentHeader,
5215
+ "Access-Control-Expose-Headers": "X-Payment-Response"
5216
+ }
5217
+ });
5218
+ return response;
5219
+ } catch (error) {
5220
+ throw error;
5221
+ }
5222
+ }
5223
+ };
5224
+
5225
+ // src/index.ts
5226
+ init_signer();
5227
+ init_parser();
5228
+ init_encoder();
5229
+ init_utils();
5230
+ init_errors();
5231
+ init_constants();
5232
+
5233
+ // src/settlement.ts
5234
+ async function getLockedBalanceForProvider(params) {
5235
+ const { publicClient, settlementLayerAddress, providerAddress, network = "sepolia" } = params;
5236
+ const settlementConfig = getContractConfig("IATPSettlementLayer" /* IATP_SETTLEMENT_LAYER */, network);
5237
+ if (!settlementConfig) {
5238
+ throw new Error(`IATPSettlementLayer contract not found for network: ${network}`);
5239
+ }
5240
+ const balance = await publicClient.readContract({
5241
+ address: settlementLayerAddress,
5242
+ abi: settlementConfig.abi,
5243
+ functionName: "getLockedBalanceForProvider",
5244
+ args: [providerAddress]
5245
+ });
5246
+ return balance;
5247
+ }
5248
+ async function getUnlockedBalanceForProvider(params) {
5249
+ const { publicClient, settlementLayerAddress, providerAddress, network = "sepolia" } = params;
5250
+ const settlementConfig = getContractConfig("IATPSettlementLayer" /* IATP_SETTLEMENT_LAYER */, network);
5251
+ if (!settlementConfig) {
5252
+ throw new Error(`IATPSettlementLayer contract not found for network: ${network}`);
5253
+ }
5254
+ const balance = await publicClient.readContract({
5255
+ address: settlementLayerAddress,
5256
+ abi: settlementConfig.abi,
5257
+ functionName: "getUnlockedBalanceForProvider",
5258
+ args: [providerAddress]
5259
+ });
5260
+ return balance;
5261
+ }
9016
5262
 
9017
- export { CHAIN_IDS, ContractName, D402Client, DEFAULT_VALIDITY_WINDOW_SECONDS, EIP712_TYPES, Invalid402ResponseError, MissingRequestConfigError, NETWORKS, PaymentAlreadyAttemptedError, PaymentAmountExceededError, PaymentError, PaymentVerificationError, TOKEN_ADDRESSES, UnsupportedNetworkError, UnsupportedSchemeError, createIATPWallet, createPaymentSelector, decodePayment, decodePaymentResponse, encodePayment, findMatchingPaymentRequirement, formatMoney, generateNonce, getAllContractAddresses, getChainId, getContractAbi, getContractAddress, getContractConfig, getCurrentTimestamp, getUsdcAddress, getWalletsByOwner, isContractDeployed, isValidAddress, normalizeAddress, parseMoney, parsePaymentRequirement, selectPaymentRequirement, signD402Payment, sortPaymentRequirements, usdToUsdc };
5263
+ export { CHAIN_IDS, ContractName, D402Client, DEFAULT_VALIDITY_WINDOW_SECONDS, EIP712_TYPES, Invalid402ResponseError, MissingRequestConfigError, NETWORKS, PaymentAlreadyAttemptedError, PaymentAmountExceededError, PaymentError, PaymentVerificationError, TOKEN_ADDRESSES, UnsupportedNetworkError, UnsupportedSchemeError, createIATPWallet, createPaymentSelector, decodePayment, decodePaymentResponse, encodePayment, findMatchingPaymentRequirement, formatMoney, generateNonce, getAllContractAddresses, getAvailableBalance, getChainId, getContractAbi, getContractAddress, getContractConfig, getCurrentTimestamp, getLockedBalanceForProvider, getUnlockedBalanceForProvider, getUsdcAddress, getWalletsByOwner, isContractDeployed, isValidAddress, normalizeAddress, parseMoney, parsePaymentRequirement, selectPaymentRequirement, signD402Payment, sortPaymentRequirements, usdToUsdc };
9018
5264
  //# sourceMappingURL=index.mjs.map
9019
5265
  //# sourceMappingURL=index.mjs.map