@dcentralab/d402-client 0.3.13 → 0.3.15

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.d.mts CHANGED
@@ -56,8 +56,6 @@ interface PaymentAuthorization {
56
56
  validBefore: string;
57
57
  /** Unique nonce */
58
58
  nonce: `0x${string}`;
59
- /** Request path/resource */
60
- requestPath: string;
61
59
  }
62
60
  /**
63
61
  * Signed payment ready to send
@@ -448,7 +446,6 @@ declare class D402Client {
448
446
  * @param params.walletClient - Optional wallet client for signing (wagmi). If provided, uses walletClient.signTypedData
449
447
  * @param params.paymentRequirement - Payment requirements from 402 response
450
448
  * @param params.iatpWalletAddress - IATPWallet contract address (optional)
451
- * @param params.requestPath - API request path (optional, uses payment_requirements.resource if not provided)
452
449
  * @returns Signed payment ready to encode and send
453
450
  *
454
451
  * @example
@@ -473,7 +470,6 @@ declare function signD402Payment(params: {
473
470
  walletClient?: WalletClient;
474
471
  paymentRequirement: PaymentRequirement;
475
472
  iatpWalletAddress: `0x${string}`;
476
- requestPath?: string;
477
473
  d402Version?: number;
478
474
  }): Promise<SignedPayment>;
479
475
 
package/dist/index.d.ts CHANGED
@@ -56,8 +56,6 @@ interface PaymentAuthorization {
56
56
  validBefore: string;
57
57
  /** Unique nonce */
58
58
  nonce: `0x${string}`;
59
- /** Request path/resource */
60
- requestPath: string;
61
59
  }
62
60
  /**
63
61
  * Signed payment ready to send
@@ -448,7 +446,6 @@ declare class D402Client {
448
446
  * @param params.walletClient - Optional wallet client for signing (wagmi). If provided, uses walletClient.signTypedData
449
447
  * @param params.paymentRequirement - Payment requirements from 402 response
450
448
  * @param params.iatpWalletAddress - IATPWallet contract address (optional)
451
- * @param params.requestPath - API request path (optional, uses payment_requirements.resource if not provided)
452
449
  * @returns Signed payment ready to encode and send
453
450
  *
454
451
  * @example
@@ -473,7 +470,6 @@ declare function signD402Payment(params: {
473
470
  walletClient?: WalletClient;
474
471
  paymentRequirement: PaymentRequirement;
475
472
  iatpWalletAddress: `0x${string}`;
476
- requestPath?: string;
477
473
  d402Version?: number;
478
474
  }): Promise<SignedPayment>;
479
475
 
package/dist/index.js CHANGED
@@ -97,8 +97,7 @@ var init_constants = __esm({
97
97
  { name: "provider", type: "address" },
98
98
  { name: "token", type: "address" },
99
99
  { name: "amount", type: "uint256" },
100
- { name: "deadline", type: "uint256" },
101
- { name: "requestPath", type: "string" }
100
+ { name: "deadline", type: "uint256" }
102
101
  ]
103
102
  };
104
103
  }
@@ -301,13 +300,8 @@ async function signD402Payment(params) {
301
300
  walletClient,
302
301
  paymentRequirement,
303
302
  iatpWalletAddress,
304
- requestPath,
305
303
  d402Version = 1
306
304
  } = params;
307
- let finalRequestPath = requestPath || paymentRequirement.resource || "/mcp";
308
- if (!finalRequestPath || finalRequestPath.trim() === "") {
309
- finalRequestPath = "/mcp";
310
- }
311
305
  const nonce = generateNonce();
312
306
  const now = getCurrentTimestamp();
313
307
  const validAfter = (now - 60).toString();
@@ -327,8 +321,7 @@ async function signD402Payment(params) {
327
321
  provider: paymentRequirement.payTo,
328
322
  token: paymentRequirement.asset,
329
323
  amount: BigInt(paymentRequirement.maxAmountRequired),
330
- deadline: BigInt(validBefore),
331
- requestPath: finalRequestPath
324
+ deadline: BigInt(validBefore)
332
325
  };
333
326
  let signature;
334
327
  if (walletClient) {
@@ -365,8 +358,7 @@ async function signD402Payment(params) {
365
358
  value: paymentRequirement.maxAmountRequired,
366
359
  validAfter,
367
360
  validBefore,
368
- nonce,
369
- requestPath: finalRequestPath
361
+ nonce
370
362
  }
371
363
  }
372
364
  };
@@ -3261,6 +3253,19 @@ var sepolia_default = {
3261
3253
  stateMutability: "view",
3262
3254
  type: "function"
3263
3255
  },
3256
+ {
3257
+ inputs: [],
3258
+ name: "MAX_BATCH_DISPUTE_SIZE",
3259
+ outputs: [
3260
+ {
3261
+ internalType: "uint256",
3262
+ name: "",
3263
+ type: "uint256"
3264
+ }
3265
+ ],
3266
+ stateMutability: "view",
3267
+ type: "function"
3268
+ },
3264
3269
  {
3265
3270
  inputs: [],
3266
3271
  name: "MAX_DISPUTE_REASON_LENGTH",
@@ -3326,93 +3331,6 @@ var sepolia_default = {
3326
3331
  stateMutability: "view",
3327
3332
  type: "function"
3328
3333
  },
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
3334
  {
3417
3335
  inputs: [
3418
3336
  {
@@ -3465,20 +3383,10 @@ var sepolia_default = {
3465
3383
  name: "failed",
3466
3384
  type: "uint256"
3467
3385
  },
3468
- {
3469
- internalType: "uint256",
3470
- name: "faults",
3471
- type: "uint256"
3472
- },
3473
3386
  {
3474
3387
  internalType: "int256",
3475
3388
  name: "score",
3476
3389
  type: "int256"
3477
- },
3478
- {
3479
- internalType: "uint256",
3480
- name: "firstSettlementAt",
3481
- type: "uint256"
3482
3390
  }
3483
3391
  ],
3484
3392
  stateMutability: "view",
@@ -3521,6 +3429,24 @@ var sepolia_default = {
3521
3429
  stateMutability: "nonpayable",
3522
3430
  type: "function"
3523
3431
  },
3432
+ {
3433
+ inputs: [
3434
+ {
3435
+ internalType: "bytes32[]",
3436
+ name: "requestIds",
3437
+ type: "bytes32[]"
3438
+ },
3439
+ {
3440
+ internalType: "string[]",
3441
+ name: "reasons",
3442
+ type: "string[]"
3443
+ }
3444
+ ],
3445
+ name: "disputeRequests",
3446
+ outputs: [],
3447
+ stateMutability: "nonpayable",
3448
+ type: "function"
3449
+ },
3524
3450
  {
3525
3451
  inputs: [
3526
3452
  {
@@ -3674,6 +3600,72 @@ var sepolia_default = {
3674
3600
  stateMutability: "view",
3675
3601
  type: "function"
3676
3602
  },
3603
+ {
3604
+ inputs: [
3605
+ {
3606
+ internalType: "address",
3607
+ name: "consumer",
3608
+ type: "address"
3609
+ },
3610
+ {
3611
+ internalType: "uint256",
3612
+ name: "offset",
3613
+ type: "uint256"
3614
+ },
3615
+ {
3616
+ internalType: "uint256",
3617
+ name: "limit",
3618
+ type: "uint256"
3619
+ }
3620
+ ],
3621
+ name: "getConsumerSettlements",
3622
+ outputs: [
3623
+ {
3624
+ components: [
3625
+ {
3626
+ internalType: "address",
3627
+ name: "consumer",
3628
+ type: "address"
3629
+ },
3630
+ {
3631
+ internalType: "address",
3632
+ name: "provider",
3633
+ type: "address"
3634
+ },
3635
+ {
3636
+ internalType: "address",
3637
+ name: "tokenAddress",
3638
+ type: "address"
3639
+ },
3640
+ {
3641
+ internalType: "uint128",
3642
+ name: "providerAmount",
3643
+ type: "uint128"
3644
+ },
3645
+ {
3646
+ internalType: "uint64",
3647
+ name: "epoch",
3648
+ type: "uint64"
3649
+ },
3650
+ {
3651
+ internalType: "enum IIATPSettlementLayer.RequestStatus",
3652
+ name: "status",
3653
+ type: "uint8"
3654
+ }
3655
+ ],
3656
+ internalType: "struct IIATPSettlementLayer.SettlementRecord[]",
3657
+ name: "records",
3658
+ type: "tuple[]"
3659
+ },
3660
+ {
3661
+ internalType: "uint256",
3662
+ name: "total",
3663
+ type: "uint256"
3664
+ }
3665
+ ],
3666
+ stateMutability: "view",
3667
+ type: "function"
3668
+ },
3677
3669
  {
3678
3670
  inputs: [],
3679
3671
  name: "getCurrentEpoch",
@@ -3687,6 +3679,19 @@ var sepolia_default = {
3687
3679
  stateMutability: "view",
3688
3680
  type: "function"
3689
3681
  },
3682
+ {
3683
+ inputs: [],
3684
+ name: "getDeploymentTimestamp",
3685
+ outputs: [
3686
+ {
3687
+ internalType: "uint256",
3688
+ name: "",
3689
+ type: "uint256"
3690
+ }
3691
+ ],
3692
+ stateMutability: "view",
3693
+ type: "function"
3694
+ },
3690
3695
  {
3691
3696
  inputs: [
3692
3697
  {
@@ -3837,39 +3842,12 @@ var sepolia_default = {
3837
3842
  type: "address"
3838
3843
  }
3839
3844
  ],
3840
- name: "getProviderReputation",
3845
+ name: "getProviderReputationScore",
3841
3846
  outputs: [
3842
3847
  {
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",
3848
+ internalType: "int256",
3871
3849
  name: "",
3872
- type: "tuple"
3850
+ type: "int256"
3873
3851
  }
3874
3852
  ],
3875
3853
  stateMutability: "view",
@@ -3879,19 +3857,24 @@ var sepolia_default = {
3879
3857
  inputs: [
3880
3858
  {
3881
3859
  internalType: "address",
3882
- name: "provider",
3860
+ name: "consumer",
3883
3861
  type: "address"
3862
+ },
3863
+ {
3864
+ internalType: "uint256",
3865
+ name: "count",
3866
+ type: "uint256"
3884
3867
  }
3885
3868
  ],
3886
- name: "getProviderReputationScore",
3869
+ name: "getRequestIdFromConsumer",
3887
3870
  outputs: [
3888
3871
  {
3889
- internalType: "int256",
3872
+ internalType: "bytes32",
3890
3873
  name: "",
3891
- type: "int256"
3874
+ type: "bytes32"
3892
3875
  }
3893
3876
  ],
3894
- stateMutability: "view",
3877
+ stateMutability: "pure",
3895
3878
  type: "function"
3896
3879
  },
3897
3880
  {
@@ -4103,19 +4086,57 @@ var sepolia_default = {
4103
4086
  name: "failed",
4104
4087
  type: "uint256"
4105
4088
  },
4106
- {
4107
- internalType: "uint256",
4108
- name: "faults",
4109
- type: "uint256"
4110
- },
4111
4089
  {
4112
4090
  internalType: "int256",
4113
4091
  name: "score",
4114
4092
  type: "int256"
4093
+ }
4094
+ ],
4095
+ stateMutability: "view",
4096
+ type: "function"
4097
+ },
4098
+ {
4099
+ inputs: [
4100
+ {
4101
+ internalType: "address",
4102
+ name: "",
4103
+ type: "address"
4104
+ },
4105
+ {
4106
+ internalType: "address",
4107
+ name: "",
4108
+ type: "address"
4109
+ }
4110
+ ],
4111
+ name: "providerTotalBalance",
4112
+ outputs: [
4113
+ {
4114
+ internalType: "uint256",
4115
+ name: "",
4116
+ type: "uint256"
4117
+ }
4118
+ ],
4119
+ stateMutability: "view",
4120
+ type: "function"
4121
+ },
4122
+ {
4123
+ inputs: [
4124
+ {
4125
+ internalType: "address",
4126
+ name: "",
4127
+ type: "address"
4115
4128
  },
4129
+ {
4130
+ internalType: "address",
4131
+ name: "",
4132
+ type: "address"
4133
+ }
4134
+ ],
4135
+ name: "providerTotalDisputeInProgress",
4136
+ outputs: [
4116
4137
  {
4117
4138
  internalType: "uint256",
4118
- name: "firstSettlementAt",
4139
+ name: "",
4119
4140
  type: "uint256"
4120
4141
  }
4121
4142
  ],
@@ -4166,6 +4187,24 @@ var sepolia_default = {
4166
4187
  stateMutability: "nonpayable",
4167
4188
  type: "function"
4168
4189
  },
4190
+ {
4191
+ inputs: [
4192
+ {
4193
+ internalType: "bytes32[]",
4194
+ name: "requestIds",
4195
+ type: "bytes32[]"
4196
+ },
4197
+ {
4198
+ internalType: "bool[]",
4199
+ name: "consumerWonArray",
4200
+ type: "bool[]"
4201
+ }
4202
+ ],
4203
+ name: "resolveDisputes",
4204
+ outputs: [],
4205
+ stateMutability: "nonpayable",
4206
+ type: "function"
4207
+ },
4169
4208
  {
4170
4209
  inputs: [],
4171
4210
  name: "roleManager",
@@ -4280,11 +4319,6 @@ var sepolia_default = {
4280
4319
  name: "amount",
4281
4320
  type: "uint256"
4282
4321
  },
4283
- {
4284
- internalType: "string",
4285
- name: "requestPath",
4286
- type: "string"
4287
- },
4288
4322
  {
4289
4323
  internalType: "uint256",
4290
4324
  name: "consumerDeadline",
@@ -4301,9 +4335,9 @@ var sepolia_default = {
4301
4335
  type: "bytes32"
4302
4336
  },
4303
4337
  {
4304
- internalType: "bytes",
4338
+ internalType: "bytes32",
4305
4339
  name: "outputHash",
4306
- type: "bytes"
4340
+ type: "bytes32"
4307
4341
  },
4308
4342
  {
4309
4343
  internalType: "uint256",
@@ -4362,11 +4396,6 @@ var sepolia_default = {
4362
4396
  name: "amount",
4363
4397
  type: "uint256"
4364
4398
  },
4365
- {
4366
- internalType: "string",
4367
- name: "requestPath",
4368
- type: "string"
4369
- },
4370
4399
  {
4371
4400
  internalType: "uint256",
4372
4401
  name: "consumerDeadline",
@@ -4383,9 +4412,9 @@ var sepolia_default = {
4383
4412
  type: "bytes32"
4384
4413
  },
4385
4414
  {
4386
- internalType: "bytes",
4415
+ internalType: "bytes32",
4387
4416
  name: "outputHash",
4388
- type: "bytes"
4417
+ type: "bytes32"
4389
4418
  },
4390
4419
  {
4391
4420
  internalType: "uint256",
@@ -4426,14 +4455,6 @@ var sepolia_default = {
4426
4455
  },
4427
4456
  {
4428
4457
  inputs: [
4429
- {
4430
- internalType: "bytes32",
4431
- name: "",
4432
- type: "bytes32"
4433
- }
4434
- ],
4435
- name: "settlements",
4436
- outputs: [
4437
4458
  {
4438
4459
  components: [
4439
4460
  {
@@ -4458,11 +4479,6 @@ var sepolia_default = {
4458
4479
  name: "amount",
4459
4480
  type: "uint256"
4460
4481
  },
4461
- {
4462
- internalType: "string",
4463
- name: "requestPath",
4464
- type: "string"
4465
- },
4466
4482
  {
4467
4483
  internalType: "uint256",
4468
4484
  name: "consumerDeadline",
@@ -4479,9 +4495,9 @@ var sepolia_default = {
4479
4495
  type: "bytes32"
4480
4496
  },
4481
4497
  {
4482
- internalType: "bytes",
4498
+ internalType: "bytes32",
4483
4499
  name: "outputHash",
4484
- type: "bytes"
4500
+ type: "bytes32"
4485
4501
  },
4486
4502
  {
4487
4503
  internalType: "uint256",
@@ -4504,14 +4520,50 @@ var sepolia_default = {
4504
4520
  type: "bytes"
4505
4521
  }
4506
4522
  ],
4507
- internalType: "struct IIATPSettlementLayer.SettlementRequest",
4508
- name: "settlementRequest",
4509
- type: "tuple"
4523
+ internalType: "struct IIATPSettlementLayer.SettlementRequest[]",
4524
+ name: "serviceRequests",
4525
+ type: "tuple[]"
4526
+ }
4527
+ ],
4528
+ name: "settleRequestsStrict",
4529
+ outputs: [],
4530
+ stateMutability: "nonpayable",
4531
+ type: "function"
4532
+ },
4533
+ {
4534
+ inputs: [
4535
+ {
4536
+ internalType: "bytes32",
4537
+ name: "",
4538
+ type: "bytes32"
4539
+ }
4540
+ ],
4541
+ name: "settlements",
4542
+ outputs: [
4543
+ {
4544
+ internalType: "address",
4545
+ name: "consumer",
4546
+ type: "address"
4510
4547
  },
4511
4548
  {
4512
- internalType: "uint256",
4549
+ internalType: "address",
4550
+ name: "provider",
4551
+ type: "address"
4552
+ },
4553
+ {
4554
+ internalType: "address",
4555
+ name: "tokenAddress",
4556
+ type: "address"
4557
+ },
4558
+ {
4559
+ internalType: "uint128",
4560
+ name: "providerAmount",
4561
+ type: "uint128"
4562
+ },
4563
+ {
4564
+ internalType: "uint64",
4513
4565
  name: "epoch",
4514
- type: "uint256"
4566
+ type: "uint64"
4515
4567
  },
4516
4568
  {
4517
4569
  internalType: "enum IIATPSettlementLayer.RequestStatus",
@@ -4635,24 +4687,6 @@ var sepolia_default = {
4635
4687
  stateMutability: "nonpayable",
4636
4688
  type: "function"
4637
4689
  },
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
4690
  {
4657
4691
  inputs: [
4658
4692
  {
@@ -5363,6 +5397,19 @@ var sepolia_default = {
5363
5397
  stateMutability: "view",
5364
5398
  type: "function"
5365
5399
  },
5400
+ {
5401
+ inputs: [
5402
+ {
5403
+ internalType: "address",
5404
+ name: "_wallet",
5405
+ type: "address"
5406
+ }
5407
+ ],
5408
+ name: "registerWalletWithSettlementLayer",
5409
+ outputs: [],
5410
+ stateMutability: "nonpayable",
5411
+ type: "function"
5412
+ },
5366
5413
  {
5367
5414
  inputs: [],
5368
5415
  name: "roleManager",
@@ -10366,8 +10413,8 @@ var arbitrum_default = {
10366
10413
  var proxies_default = {
10367
10414
  sepolia: {
10368
10415
  RoleManager: "0x71d388142EA9194e5b51Eee3FEfe3B87D494dd38",
10369
- IATPSettlementLayer: "0x0205ea98258eda5f6C94116a44f9811d8089f110",
10370
- IATPWalletFactory: "0x54083Cc03c5D9D408D71D36170Ef01310E0C78fE"
10416
+ IATPSettlementLayer: "0xB82816BA396fB06aF7076202cb5d7D9e4dACBb15",
10417
+ IATPWalletFactory: "0x2A95caE178142EC53864b42891828455f45a9E01"
10371
10418
  },
10372
10419
  arbitrum: {
10373
10420
  RoleManager: "0xB256b27681FaC8b4EaB79d392083B2D992972eff",