@dcentralab/d402-client 0.3.12 → 0.3.14

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.js CHANGED
@@ -3261,6 +3261,19 @@ var sepolia_default = {
3261
3261
  stateMutability: "view",
3262
3262
  type: "function"
3263
3263
  },
3264
+ {
3265
+ inputs: [],
3266
+ name: "MAX_BATCH_DISPUTE_SIZE",
3267
+ outputs: [
3268
+ {
3269
+ internalType: "uint256",
3270
+ name: "",
3271
+ type: "uint256"
3272
+ }
3273
+ ],
3274
+ stateMutability: "view",
3275
+ type: "function"
3276
+ },
3264
3277
  {
3265
3278
  inputs: [],
3266
3279
  name: "MAX_DISPUTE_REASON_LENGTH",
@@ -3326,93 +3339,6 @@ var sepolia_default = {
3326
3339
  stateMutability: "view",
3327
3340
  type: "function"
3328
3341
  },
3329
- {
3330
- inputs: [
3331
- {
3332
- components: [
3333
- {
3334
- components: [
3335
- {
3336
- internalType: "contract IIATPWallet",
3337
- name: "consumer",
3338
- type: "address"
3339
- },
3340
- {
3341
- internalType: "contract IIATPWallet",
3342
- name: "provider",
3343
- type: "address"
3344
- },
3345
- {
3346
- internalType: "address",
3347
- name: "tokenAddress",
3348
- type: "address"
3349
- },
3350
- {
3351
- internalType: "uint256",
3352
- name: "amount",
3353
- type: "uint256"
3354
- },
3355
- {
3356
- internalType: "string",
3357
- name: "requestPath",
3358
- type: "string"
3359
- },
3360
- {
3361
- internalType: "uint256",
3362
- name: "consumerDeadline",
3363
- type: "uint256"
3364
- },
3365
- {
3366
- internalType: "uint256",
3367
- name: "timestamp",
3368
- type: "uint256"
3369
- },
3370
- {
3371
- internalType: "bytes32",
3372
- name: "serviceDescription",
3373
- type: "bytes32"
3374
- },
3375
- {
3376
- internalType: "bytes",
3377
- name: "outputHash",
3378
- type: "bytes"
3379
- },
3380
- {
3381
- internalType: "uint256",
3382
- name: "facilitatorFeePercent",
3383
- type: "uint256"
3384
- }
3385
- ],
3386
- internalType: "struct IIATPSettlementLayer.SettlementRequestData",
3387
- name: "requestData",
3388
- type: "tuple"
3389
- },
3390
- {
3391
- internalType: "bytes",
3392
- name: "consumerSignature",
3393
- type: "bytes"
3394
- },
3395
- {
3396
- internalType: "bytes",
3397
- name: "providerSignature",
3398
- type: "bytes"
3399
- }
3400
- ],
3401
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
3402
- name: "req",
3403
- type: "tuple"
3404
- },
3405
- {
3406
- internalType: "address",
3407
- name: "facilitator",
3408
- type: "address"
3409
- }
3410
- ],
3411
- name: "_settleRequest",
3412
- outputs: [],
3413
- stateMutability: "nonpayable",
3414
- type: "function"
3415
- },
3416
3342
  {
3417
3343
  inputs: [
3418
3344
  {
@@ -3465,20 +3391,10 @@ var sepolia_default = {
3465
3391
  name: "failed",
3466
3392
  type: "uint256"
3467
3393
  },
3468
- {
3469
- internalType: "uint256",
3470
- name: "faults",
3471
- type: "uint256"
3472
- },
3473
3394
  {
3474
3395
  internalType: "int256",
3475
3396
  name: "score",
3476
3397
  type: "int256"
3477
- },
3478
- {
3479
- internalType: "uint256",
3480
- name: "firstSettlementAt",
3481
- type: "uint256"
3482
3398
  }
3483
3399
  ],
3484
3400
  stateMutability: "view",
@@ -3521,6 +3437,24 @@ var sepolia_default = {
3521
3437
  stateMutability: "nonpayable",
3522
3438
  type: "function"
3523
3439
  },
3440
+ {
3441
+ inputs: [
3442
+ {
3443
+ internalType: "bytes32[]",
3444
+ name: "requestIds",
3445
+ type: "bytes32[]"
3446
+ },
3447
+ {
3448
+ internalType: "string[]",
3449
+ name: "reasons",
3450
+ type: "string[]"
3451
+ }
3452
+ ],
3453
+ name: "disputeRequests",
3454
+ outputs: [],
3455
+ stateMutability: "nonpayable",
3456
+ type: "function"
3457
+ },
3524
3458
  {
3525
3459
  inputs: [
3526
3460
  {
@@ -3674,6 +3608,72 @@ var sepolia_default = {
3674
3608
  stateMutability: "view",
3675
3609
  type: "function"
3676
3610
  },
3611
+ {
3612
+ inputs: [
3613
+ {
3614
+ internalType: "address",
3615
+ name: "consumer",
3616
+ type: "address"
3617
+ },
3618
+ {
3619
+ internalType: "uint256",
3620
+ name: "offset",
3621
+ type: "uint256"
3622
+ },
3623
+ {
3624
+ internalType: "uint256",
3625
+ name: "limit",
3626
+ type: "uint256"
3627
+ }
3628
+ ],
3629
+ name: "getConsumerSettlements",
3630
+ outputs: [
3631
+ {
3632
+ components: [
3633
+ {
3634
+ internalType: "address",
3635
+ name: "consumer",
3636
+ type: "address"
3637
+ },
3638
+ {
3639
+ internalType: "address",
3640
+ name: "provider",
3641
+ type: "address"
3642
+ },
3643
+ {
3644
+ internalType: "address",
3645
+ name: "tokenAddress",
3646
+ type: "address"
3647
+ },
3648
+ {
3649
+ internalType: "uint128",
3650
+ name: "providerAmount",
3651
+ type: "uint128"
3652
+ },
3653
+ {
3654
+ internalType: "uint64",
3655
+ name: "epoch",
3656
+ type: "uint64"
3657
+ },
3658
+ {
3659
+ internalType: "enum IIATPSettlementLayer.RequestStatus",
3660
+ name: "status",
3661
+ type: "uint8"
3662
+ }
3663
+ ],
3664
+ internalType: "struct IIATPSettlementLayer.SettlementRecord[]",
3665
+ name: "records",
3666
+ type: "tuple[]"
3667
+ },
3668
+ {
3669
+ internalType: "uint256",
3670
+ name: "total",
3671
+ type: "uint256"
3672
+ }
3673
+ ],
3674
+ stateMutability: "view",
3675
+ type: "function"
3676
+ },
3677
3677
  {
3678
3678
  inputs: [],
3679
3679
  name: "getCurrentEpoch",
@@ -3687,6 +3687,19 @@ var sepolia_default = {
3687
3687
  stateMutability: "view",
3688
3688
  type: "function"
3689
3689
  },
3690
+ {
3691
+ inputs: [],
3692
+ name: "getDeploymentTimestamp",
3693
+ outputs: [
3694
+ {
3695
+ internalType: "uint256",
3696
+ name: "",
3697
+ type: "uint256"
3698
+ }
3699
+ ],
3700
+ stateMutability: "view",
3701
+ type: "function"
3702
+ },
3690
3703
  {
3691
3704
  inputs: [
3692
3705
  {
@@ -3837,39 +3850,12 @@ var sepolia_default = {
3837
3850
  type: "address"
3838
3851
  }
3839
3852
  ],
3840
- name: "getProviderReputation",
3853
+ name: "getProviderReputationScore",
3841
3854
  outputs: [
3842
3855
  {
3843
- components: [
3844
- {
3845
- internalType: "uint256",
3846
- name: "completed",
3847
- type: "uint256"
3848
- },
3849
- {
3850
- internalType: "uint256",
3851
- name: "failed",
3852
- type: "uint256"
3853
- },
3854
- {
3855
- internalType: "uint256",
3856
- name: "faults",
3857
- type: "uint256"
3858
- },
3859
- {
3860
- internalType: "int256",
3861
- name: "score",
3862
- type: "int256"
3863
- },
3864
- {
3865
- internalType: "uint256",
3866
- name: "firstSettlementAt",
3867
- type: "uint256"
3868
- }
3869
- ],
3870
- internalType: "struct IIATPSettlementLayer.Reputation",
3856
+ internalType: "int256",
3871
3857
  name: "",
3872
- type: "tuple"
3858
+ type: "int256"
3873
3859
  }
3874
3860
  ],
3875
3861
  stateMutability: "view",
@@ -3879,19 +3865,24 @@ var sepolia_default = {
3879
3865
  inputs: [
3880
3866
  {
3881
3867
  internalType: "address",
3882
- name: "provider",
3868
+ name: "consumer",
3883
3869
  type: "address"
3870
+ },
3871
+ {
3872
+ internalType: "uint256",
3873
+ name: "count",
3874
+ type: "uint256"
3884
3875
  }
3885
3876
  ],
3886
- name: "getProviderReputationScore",
3877
+ name: "getRequestIdFromConsumer",
3887
3878
  outputs: [
3888
3879
  {
3889
- internalType: "int256",
3880
+ internalType: "bytes32",
3890
3881
  name: "",
3891
- type: "int256"
3882
+ type: "bytes32"
3892
3883
  }
3893
3884
  ],
3894
- stateMutability: "view",
3885
+ stateMutability: "pure",
3895
3886
  type: "function"
3896
3887
  },
3897
3888
  {
@@ -4103,19 +4094,57 @@ var sepolia_default = {
4103
4094
  name: "failed",
4104
4095
  type: "uint256"
4105
4096
  },
4106
- {
4107
- internalType: "uint256",
4108
- name: "faults",
4109
- type: "uint256"
4110
- },
4111
4097
  {
4112
4098
  internalType: "int256",
4113
4099
  name: "score",
4114
4100
  type: "int256"
4101
+ }
4102
+ ],
4103
+ stateMutability: "view",
4104
+ type: "function"
4105
+ },
4106
+ {
4107
+ inputs: [
4108
+ {
4109
+ internalType: "address",
4110
+ name: "",
4111
+ type: "address"
4115
4112
  },
4113
+ {
4114
+ internalType: "address",
4115
+ name: "",
4116
+ type: "address"
4117
+ }
4118
+ ],
4119
+ name: "providerTotalBalance",
4120
+ outputs: [
4116
4121
  {
4117
4122
  internalType: "uint256",
4118
- name: "firstSettlementAt",
4123
+ name: "",
4124
+ type: "uint256"
4125
+ }
4126
+ ],
4127
+ stateMutability: "view",
4128
+ type: "function"
4129
+ },
4130
+ {
4131
+ inputs: [
4132
+ {
4133
+ internalType: "address",
4134
+ name: "",
4135
+ type: "address"
4136
+ },
4137
+ {
4138
+ internalType: "address",
4139
+ name: "",
4140
+ type: "address"
4141
+ }
4142
+ ],
4143
+ name: "providerTotalDisputeInProgress",
4144
+ outputs: [
4145
+ {
4146
+ internalType: "uint256",
4147
+ name: "",
4119
4148
  type: "uint256"
4120
4149
  }
4121
4150
  ],
@@ -4166,6 +4195,24 @@ var sepolia_default = {
4166
4195
  stateMutability: "nonpayable",
4167
4196
  type: "function"
4168
4197
  },
4198
+ {
4199
+ inputs: [
4200
+ {
4201
+ internalType: "bytes32[]",
4202
+ name: "requestIds",
4203
+ type: "bytes32[]"
4204
+ },
4205
+ {
4206
+ internalType: "bool[]",
4207
+ name: "consumerWonArray",
4208
+ type: "bool[]"
4209
+ }
4210
+ ],
4211
+ name: "resolveDisputes",
4212
+ outputs: [],
4213
+ stateMutability: "nonpayable",
4214
+ type: "function"
4215
+ },
4169
4216
  {
4170
4217
  inputs: [],
4171
4218
  name: "roleManager",
@@ -4280,11 +4327,6 @@ var sepolia_default = {
4280
4327
  name: "amount",
4281
4328
  type: "uint256"
4282
4329
  },
4283
- {
4284
- internalType: "string",
4285
- name: "requestPath",
4286
- type: "string"
4287
- },
4288
4330
  {
4289
4331
  internalType: "uint256",
4290
4332
  name: "consumerDeadline",
@@ -4301,9 +4343,9 @@ var sepolia_default = {
4301
4343
  type: "bytes32"
4302
4344
  },
4303
4345
  {
4304
- internalType: "bytes",
4346
+ internalType: "bytes32",
4305
4347
  name: "outputHash",
4306
- type: "bytes"
4348
+ type: "bytes32"
4307
4349
  },
4308
4350
  {
4309
4351
  internalType: "uint256",
@@ -4362,11 +4404,6 @@ var sepolia_default = {
4362
4404
  name: "amount",
4363
4405
  type: "uint256"
4364
4406
  },
4365
- {
4366
- internalType: "string",
4367
- name: "requestPath",
4368
- type: "string"
4369
- },
4370
4407
  {
4371
4408
  internalType: "uint256",
4372
4409
  name: "consumerDeadline",
@@ -4383,9 +4420,9 @@ var sepolia_default = {
4383
4420
  type: "bytes32"
4384
4421
  },
4385
4422
  {
4386
- internalType: "bytes",
4423
+ internalType: "bytes32",
4387
4424
  name: "outputHash",
4388
- type: "bytes"
4425
+ type: "bytes32"
4389
4426
  },
4390
4427
  {
4391
4428
  internalType: "uint256",
@@ -4426,14 +4463,6 @@ var sepolia_default = {
4426
4463
  },
4427
4464
  {
4428
4465
  inputs: [
4429
- {
4430
- internalType: "bytes32",
4431
- name: "",
4432
- type: "bytes32"
4433
- }
4434
- ],
4435
- name: "settlements",
4436
- outputs: [
4437
4466
  {
4438
4467
  components: [
4439
4468
  {
@@ -4458,11 +4487,6 @@ var sepolia_default = {
4458
4487
  name: "amount",
4459
4488
  type: "uint256"
4460
4489
  },
4461
- {
4462
- internalType: "string",
4463
- name: "requestPath",
4464
- type: "string"
4465
- },
4466
4490
  {
4467
4491
  internalType: "uint256",
4468
4492
  name: "consumerDeadline",
@@ -4479,9 +4503,9 @@ var sepolia_default = {
4479
4503
  type: "bytes32"
4480
4504
  },
4481
4505
  {
4482
- internalType: "bytes",
4506
+ internalType: "bytes32",
4483
4507
  name: "outputHash",
4484
- type: "bytes"
4508
+ type: "bytes32"
4485
4509
  },
4486
4510
  {
4487
4511
  internalType: "uint256",
@@ -4504,14 +4528,50 @@ var sepolia_default = {
4504
4528
  type: "bytes"
4505
4529
  }
4506
4530
  ],
4507
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
4508
- name: "settlementRequest",
4509
- type: "tuple"
4531
+ internalType: "struct IIATPSettlementLayer.SettlementRequest[]",
4532
+ name: "serviceRequests",
4533
+ type: "tuple[]"
4534
+ }
4535
+ ],
4536
+ name: "settleRequestsStrict",
4537
+ outputs: [],
4538
+ stateMutability: "nonpayable",
4539
+ type: "function"
4540
+ },
4541
+ {
4542
+ inputs: [
4543
+ {
4544
+ internalType: "bytes32",
4545
+ name: "",
4546
+ type: "bytes32"
4547
+ }
4548
+ ],
4549
+ name: "settlements",
4550
+ outputs: [
4551
+ {
4552
+ internalType: "address",
4553
+ name: "consumer",
4554
+ type: "address"
4510
4555
  },
4511
4556
  {
4512
- internalType: "uint256",
4557
+ internalType: "address",
4558
+ name: "provider",
4559
+ type: "address"
4560
+ },
4561
+ {
4562
+ internalType: "address",
4563
+ name: "tokenAddress",
4564
+ type: "address"
4565
+ },
4566
+ {
4567
+ internalType: "uint128",
4568
+ name: "providerAmount",
4569
+ type: "uint128"
4570
+ },
4571
+ {
4572
+ internalType: "uint64",
4513
4573
  name: "epoch",
4514
- type: "uint256"
4574
+ type: "uint64"
4515
4575
  },
4516
4576
  {
4517
4577
  internalType: "enum IIATPSettlementLayer.RequestStatus",
@@ -4635,24 +4695,6 @@ var sepolia_default = {
4635
4695
  stateMutability: "nonpayable",
4636
4696
  type: "function"
4637
4697
  },
4638
- {
4639
- inputs: [
4640
- {
4641
- internalType: "uint256",
4642
- name: "epoch",
4643
- type: "uint256"
4644
- },
4645
- {
4646
- internalType: "address",
4647
- name: "token",
4648
- type: "address"
4649
- }
4650
- ],
4651
- name: "withdrawEpochToken",
4652
- outputs: [],
4653
- stateMutability: "nonpayable",
4654
- type: "function"
4655
- },
4656
4698
  {
4657
4699
  inputs: [
4658
4700
  {
@@ -5363,6 +5405,19 @@ var sepolia_default = {
5363
5405
  stateMutability: "view",
5364
5406
  type: "function"
5365
5407
  },
5408
+ {
5409
+ inputs: [
5410
+ {
5411
+ internalType: "address",
5412
+ name: "_wallet",
5413
+ type: "address"
5414
+ }
5415
+ ],
5416
+ name: "registerWalletWithSettlementLayer",
5417
+ outputs: [],
5418
+ stateMutability: "nonpayable",
5419
+ type: "function"
5420
+ },
5366
5421
  {
5367
5422
  inputs: [],
5368
5423
  name: "roleManager",
@@ -10366,8 +10421,8 @@ var arbitrum_default = {
10366
10421
  var proxies_default = {
10367
10422
  sepolia: {
10368
10423
  RoleManager: "0x71d388142EA9194e5b51Eee3FEfe3B87D494dd38",
10369
- IATPSettlementLayer: "0x0205ea98258eda5f6C94116a44f9811d8089f110",
10370
- IATPWalletFactory: "0x54083Cc03c5D9D408D71D36170Ef01310E0C78fE"
10424
+ IATPSettlementLayer: "0xB82816BA396fB06aF7076202cb5d7D9e4dACBb15",
10425
+ IATPWalletFactory: "0x2A95caE178142EC53864b42891828455f45a9E01"
10371
10426
  },
10372
10427
  arbitrum: {
10373
10428
  RoleManager: "0xB256b27681FaC8b4EaB79d392083B2D992972eff",
@@ -10717,6 +10772,49 @@ async function executeWithdrawal(params) {
10717
10772
  await publicClient.waitForTransactionReceipt({ hash });
10718
10773
  return hash;
10719
10774
  }
10775
+ async function withdrawAllFromSettlement(params) {
10776
+ const {
10777
+ walletClient,
10778
+ publicClient,
10779
+ tokenAddress,
10780
+ walletAddress,
10781
+ sendToOwner = true,
10782
+ network = "sepolia"
10783
+ } = params;
10784
+ if (!walletClient?.account) {
10785
+ throw new Error("Wallet account not found. Please connect your wallet.");
10786
+ }
10787
+ const account = walletClient.account;
10788
+ const walletAbi = getContractAbi("IATPWallet" /* IATP_WALLET */, network);
10789
+ if (!walletAbi) {
10790
+ throw new Error(`IATPWallet ABI not found for network: ${network}`);
10791
+ }
10792
+ await publicClient.simulateContract({
10793
+ account,
10794
+ address: walletAddress,
10795
+ abi: walletAbi,
10796
+ functionName: "withdrawAllFromSettlement",
10797
+ args: [tokenAddress, sendToOwner]
10798
+ });
10799
+ const estimatedGas = await publicClient.estimateContractGas({
10800
+ address: walletAddress,
10801
+ abi: walletAbi,
10802
+ functionName: "withdrawAllFromSettlement",
10803
+ args: [tokenAddress, sendToOwner],
10804
+ account
10805
+ });
10806
+ const gasLimit = estimatedGas + estimatedGas / 5n;
10807
+ const hash = await walletClient.writeContract({
10808
+ address: walletAddress,
10809
+ abi: walletAbi,
10810
+ functionName: "withdrawAllFromSettlement",
10811
+ args: [tokenAddress, sendToOwner],
10812
+ account,
10813
+ gas: gasLimit
10814
+ });
10815
+ await publicClient.waitForTransactionReceipt({ hash });
10816
+ return hash;
10817
+ }
10720
10818
 
10721
10819
  // src/client/D402Client.ts
10722
10820
  var D402Client = class {
@@ -11051,42 +11149,6 @@ async function withdrawAllAvailableEpochs(params) {
11051
11149
  await publicClient.waitForTransactionReceipt({ hash });
11052
11150
  return hash;
11053
11151
  }
11054
- async function withdrawAllFromSettlement(params) {
11055
- const { walletClient, publicClient, tokenAddress, sendToOwner = true, network = "sepolia" } = params;
11056
- if (!walletClient?.account) {
11057
- throw new Error("Wallet account not found. Please connect your wallet.");
11058
- }
11059
- const account = walletClient.account;
11060
- const walletConfig = getContractConfig("IATPWallet" /* IATP_WALLET */, network);
11061
- if (!walletConfig) {
11062
- throw new Error(`IATPWallet contract not found for network: ${network}`);
11063
- }
11064
- await publicClient.simulateContract({
11065
- account,
11066
- address: walletConfig.address,
11067
- abi: walletConfig.abi,
11068
- functionName: "withdrawAllFromSettlement",
11069
- args: [tokenAddress, sendToOwner]
11070
- });
11071
- const estimatedGas = await publicClient.estimateContractGas({
11072
- address: walletConfig.address,
11073
- abi: walletConfig.abi,
11074
- functionName: "withdrawAllFromSettlement",
11075
- args: [tokenAddress, sendToOwner],
11076
- account
11077
- });
11078
- const gasLimit = estimatedGas + estimatedGas / 5n;
11079
- const hash = await walletClient.writeContract({
11080
- address: walletConfig.address,
11081
- abi: walletConfig.abi,
11082
- functionName: "withdrawAllFromSettlement",
11083
- args: [tokenAddress, sendToOwner],
11084
- account,
11085
- gas: gasLimit
11086
- });
11087
- await publicClient.waitForTransactionReceipt({ hash });
11088
- return hash;
11089
- }
11090
11152
 
11091
11153
  // src/index.ts
11092
11154
  init_utils();