@virtuals-protocol/acp-node 0.2.0-beta.11 → 0.2.0-beta.13

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
@@ -96,6 +96,7 @@ declare class Fare {
96
96
  contractAddress: Address;
97
97
  decimals: number;
98
98
  constructor(contractAddress: Address, decimals: number);
99
+ maxAmount(): bigint;
99
100
  formatAmount(amount: number): bigint;
100
101
  }
101
102
  interface IFareAmount {
@@ -442,6 +443,7 @@ declare class AcpContractClient {
442
443
  [x: `bool[${string}]`]: undefined;
443
444
  [x: `bytes4[${string}]`]: undefined;
444
445
  [x: `bytes[${string}]`]: undefined;
446
+ [x: `bytes10[${string}]`]: undefined;
445
447
  [x: `bytes1[${string}]`]: undefined;
446
448
  [x: `bytes6[${string}]`]: undefined;
447
449
  [x: `bytes18[${string}]`]: undefined;
@@ -451,7 +453,6 @@ declare class AcpContractClient {
451
453
  [x: `bytes7[${string}]`]: undefined;
452
454
  [x: `bytes8[${string}]`]: undefined;
453
455
  [x: `bytes9[${string}]`]: undefined;
454
- [x: `bytes10[${string}]`]: undefined;
455
456
  [x: `bytes11[${string}]`]: undefined;
456
457
  [x: `bytes12[${string}]`]: undefined;
457
458
  [x: `bytes13[${string}]`]: undefined;
@@ -544,6 +545,7 @@ declare class AcpContractClient {
544
545
  bool?: undefined;
545
546
  bytes4?: undefined;
546
547
  bytes?: undefined;
548
+ bytes10?: undefined;
547
549
  bytes1?: undefined;
548
550
  bytes6?: undefined;
549
551
  bytes18?: undefined;
@@ -553,7 +555,6 @@ declare class AcpContractClient {
553
555
  bytes7?: undefined;
554
556
  bytes8?: undefined;
555
557
  bytes9?: undefined;
556
- bytes10?: undefined;
557
558
  bytes11?: undefined;
558
559
  bytes12?: undefined;
559
560
  bytes13?: undefined;
@@ -7752,6 +7753,7 @@ declare class AcpContractClient {
7752
7753
  [x: `bool[${string}]`]: undefined;
7753
7754
  [x: `bytes4[${string}]`]: undefined;
7754
7755
  [x: `bytes[${string}]`]: undefined;
7756
+ [x: `bytes10[${string}]`]: undefined;
7755
7757
  [x: `bytes1[${string}]`]: undefined;
7756
7758
  [x: `bytes6[${string}]`]: undefined;
7757
7759
  [x: `bytes18[${string}]`]: undefined;
@@ -7761,7 +7763,6 @@ declare class AcpContractClient {
7761
7763
  [x: `bytes7[${string}]`]: undefined;
7762
7764
  [x: `bytes8[${string}]`]: undefined;
7763
7765
  [x: `bytes9[${string}]`]: undefined;
7764
- [x: `bytes10[${string}]`]: undefined;
7765
7766
  [x: `bytes11[${string}]`]: undefined;
7766
7767
  [x: `bytes12[${string}]`]: undefined;
7767
7768
  [x: `bytes13[${string}]`]: undefined;
@@ -7854,6 +7855,7 @@ declare class AcpContractClient {
7854
7855
  bool?: undefined;
7855
7856
  bytes4?: undefined;
7856
7857
  bytes?: undefined;
7858
+ bytes10?: undefined;
7857
7859
  bytes1?: undefined;
7858
7860
  bytes6?: undefined;
7859
7861
  bytes18?: undefined;
@@ -7863,7 +7865,6 @@ declare class AcpContractClient {
7863
7865
  bytes7?: undefined;
7864
7866
  bytes8?: undefined;
7865
7867
  bytes9?: undefined;
7866
- bytes10?: undefined;
7867
7868
  bytes11?: undefined;
7868
7869
  bytes12?: undefined;
7869
7870
  bytes13?: undefined;
@@ -8203,6 +8204,7 @@ declare class AcpContractClient {
8203
8204
  [x: `bool[${string}]`]: undefined;
8204
8205
  [x: `bytes4[${string}]`]: undefined;
8205
8206
  [x: `bytes[${string}]`]: undefined;
8207
+ [x: `bytes10[${string}]`]: undefined;
8206
8208
  [x: `bytes1[${string}]`]: undefined;
8207
8209
  [x: `bytes6[${string}]`]: undefined;
8208
8210
  [x: `bytes18[${string}]`]: undefined;
@@ -8212,7 +8214,6 @@ declare class AcpContractClient {
8212
8214
  [x: `bytes7[${string}]`]: undefined;
8213
8215
  [x: `bytes8[${string}]`]: undefined;
8214
8216
  [x: `bytes9[${string}]`]: undefined;
8215
- [x: `bytes10[${string}]`]: undefined;
8216
8217
  [x: `bytes11[${string}]`]: undefined;
8217
8218
  [x: `bytes12[${string}]`]: undefined;
8218
8219
  [x: `bytes13[${string}]`]: undefined;
@@ -8305,6 +8306,7 @@ declare class AcpContractClient {
8305
8306
  bool?: undefined;
8306
8307
  bytes4?: undefined;
8307
8308
  bytes?: undefined;
8309
+ bytes10?: undefined;
8308
8310
  bytes1?: undefined;
8309
8311
  bytes6?: undefined;
8310
8312
  bytes18?: undefined;
@@ -8314,7 +8316,6 @@ declare class AcpContractClient {
8314
8316
  bytes7?: undefined;
8315
8317
  bytes8?: undefined;
8316
8318
  bytes9?: undefined;
8317
- bytes10?: undefined;
8318
8319
  bytes11?: undefined;
8319
8320
  bytes12?: undefined;
8320
8321
  bytes13?: undefined;
@@ -8428,11 +8429,12 @@ declare class AcpMemo {
8428
8429
  content: string;
8429
8430
  nextPhase: AcpJobPhases;
8430
8431
  status: AcpMemoStatus;
8432
+ senderAddress: Address;
8431
8433
  signedReason?: string | undefined;
8432
8434
  expiry?: Date | undefined;
8433
8435
  payableDetails?: PayableDetails | undefined;
8434
8436
  structuredContent: GenericPayload | undefined;
8435
- constructor(acpClient: AcpClient, id: number, type: MemoType, content: string, nextPhase: AcpJobPhases, status: AcpMemoStatus, signedReason?: string | undefined, expiry?: Date | undefined, payableDetails?: PayableDetails | undefined);
8437
+ constructor(acpClient: AcpClient, id: number, type: MemoType, content: string, nextPhase: AcpJobPhases, status: AcpMemoStatus, senderAddress: Address, signedReason?: string | undefined, expiry?: Date | undefined, payableDetails?: PayableDetails | undefined);
8436
8438
  get payloadType(): PayloadType | undefined;
8437
8439
  getStructuredContent<T>(): GenericPayload<T> | undefined;
8438
8440
  create(jobId: number, isSecured?: boolean): Promise<`0x${string}`>;
@@ -8674,6 +8676,7 @@ declare class AcpClient {
8674
8676
  responseFundsTransfer(memoId: number, accept: boolean, reason?: string): Promise<`0x${string}`>;
8675
8677
  deliverJob(jobId: number, deliverable: IDeliverable): Promise<`0x${string}`>;
8676
8678
  getActiveJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8679
+ getPendingMemoJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8677
8680
  getCompletedJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8678
8681
  getCancelledJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8679
8682
  getJobById(jobId: number): Promise<AcpJob | undefined>;
package/dist/index.d.ts CHANGED
@@ -96,6 +96,7 @@ declare class Fare {
96
96
  contractAddress: Address;
97
97
  decimals: number;
98
98
  constructor(contractAddress: Address, decimals: number);
99
+ maxAmount(): bigint;
99
100
  formatAmount(amount: number): bigint;
100
101
  }
101
102
  interface IFareAmount {
@@ -442,6 +443,7 @@ declare class AcpContractClient {
442
443
  [x: `bool[${string}]`]: undefined;
443
444
  [x: `bytes4[${string}]`]: undefined;
444
445
  [x: `bytes[${string}]`]: undefined;
446
+ [x: `bytes10[${string}]`]: undefined;
445
447
  [x: `bytes1[${string}]`]: undefined;
446
448
  [x: `bytes6[${string}]`]: undefined;
447
449
  [x: `bytes18[${string}]`]: undefined;
@@ -451,7 +453,6 @@ declare class AcpContractClient {
451
453
  [x: `bytes7[${string}]`]: undefined;
452
454
  [x: `bytes8[${string}]`]: undefined;
453
455
  [x: `bytes9[${string}]`]: undefined;
454
- [x: `bytes10[${string}]`]: undefined;
455
456
  [x: `bytes11[${string}]`]: undefined;
456
457
  [x: `bytes12[${string}]`]: undefined;
457
458
  [x: `bytes13[${string}]`]: undefined;
@@ -544,6 +545,7 @@ declare class AcpContractClient {
544
545
  bool?: undefined;
545
546
  bytes4?: undefined;
546
547
  bytes?: undefined;
548
+ bytes10?: undefined;
547
549
  bytes1?: undefined;
548
550
  bytes6?: undefined;
549
551
  bytes18?: undefined;
@@ -553,7 +555,6 @@ declare class AcpContractClient {
553
555
  bytes7?: undefined;
554
556
  bytes8?: undefined;
555
557
  bytes9?: undefined;
556
- bytes10?: undefined;
557
558
  bytes11?: undefined;
558
559
  bytes12?: undefined;
559
560
  bytes13?: undefined;
@@ -7752,6 +7753,7 @@ declare class AcpContractClient {
7752
7753
  [x: `bool[${string}]`]: undefined;
7753
7754
  [x: `bytes4[${string}]`]: undefined;
7754
7755
  [x: `bytes[${string}]`]: undefined;
7756
+ [x: `bytes10[${string}]`]: undefined;
7755
7757
  [x: `bytes1[${string}]`]: undefined;
7756
7758
  [x: `bytes6[${string}]`]: undefined;
7757
7759
  [x: `bytes18[${string}]`]: undefined;
@@ -7761,7 +7763,6 @@ declare class AcpContractClient {
7761
7763
  [x: `bytes7[${string}]`]: undefined;
7762
7764
  [x: `bytes8[${string}]`]: undefined;
7763
7765
  [x: `bytes9[${string}]`]: undefined;
7764
- [x: `bytes10[${string}]`]: undefined;
7765
7766
  [x: `bytes11[${string}]`]: undefined;
7766
7767
  [x: `bytes12[${string}]`]: undefined;
7767
7768
  [x: `bytes13[${string}]`]: undefined;
@@ -7854,6 +7855,7 @@ declare class AcpContractClient {
7854
7855
  bool?: undefined;
7855
7856
  bytes4?: undefined;
7856
7857
  bytes?: undefined;
7858
+ bytes10?: undefined;
7857
7859
  bytes1?: undefined;
7858
7860
  bytes6?: undefined;
7859
7861
  bytes18?: undefined;
@@ -7863,7 +7865,6 @@ declare class AcpContractClient {
7863
7865
  bytes7?: undefined;
7864
7866
  bytes8?: undefined;
7865
7867
  bytes9?: undefined;
7866
- bytes10?: undefined;
7867
7868
  bytes11?: undefined;
7868
7869
  bytes12?: undefined;
7869
7870
  bytes13?: undefined;
@@ -8203,6 +8204,7 @@ declare class AcpContractClient {
8203
8204
  [x: `bool[${string}]`]: undefined;
8204
8205
  [x: `bytes4[${string}]`]: undefined;
8205
8206
  [x: `bytes[${string}]`]: undefined;
8207
+ [x: `bytes10[${string}]`]: undefined;
8206
8208
  [x: `bytes1[${string}]`]: undefined;
8207
8209
  [x: `bytes6[${string}]`]: undefined;
8208
8210
  [x: `bytes18[${string}]`]: undefined;
@@ -8212,7 +8214,6 @@ declare class AcpContractClient {
8212
8214
  [x: `bytes7[${string}]`]: undefined;
8213
8215
  [x: `bytes8[${string}]`]: undefined;
8214
8216
  [x: `bytes9[${string}]`]: undefined;
8215
- [x: `bytes10[${string}]`]: undefined;
8216
8217
  [x: `bytes11[${string}]`]: undefined;
8217
8218
  [x: `bytes12[${string}]`]: undefined;
8218
8219
  [x: `bytes13[${string}]`]: undefined;
@@ -8305,6 +8306,7 @@ declare class AcpContractClient {
8305
8306
  bool?: undefined;
8306
8307
  bytes4?: undefined;
8307
8308
  bytes?: undefined;
8309
+ bytes10?: undefined;
8308
8310
  bytes1?: undefined;
8309
8311
  bytes6?: undefined;
8310
8312
  bytes18?: undefined;
@@ -8314,7 +8316,6 @@ declare class AcpContractClient {
8314
8316
  bytes7?: undefined;
8315
8317
  bytes8?: undefined;
8316
8318
  bytes9?: undefined;
8317
- bytes10?: undefined;
8318
8319
  bytes11?: undefined;
8319
8320
  bytes12?: undefined;
8320
8321
  bytes13?: undefined;
@@ -8428,11 +8429,12 @@ declare class AcpMemo {
8428
8429
  content: string;
8429
8430
  nextPhase: AcpJobPhases;
8430
8431
  status: AcpMemoStatus;
8432
+ senderAddress: Address;
8431
8433
  signedReason?: string | undefined;
8432
8434
  expiry?: Date | undefined;
8433
8435
  payableDetails?: PayableDetails | undefined;
8434
8436
  structuredContent: GenericPayload | undefined;
8435
- constructor(acpClient: AcpClient, id: number, type: MemoType, content: string, nextPhase: AcpJobPhases, status: AcpMemoStatus, signedReason?: string | undefined, expiry?: Date | undefined, payableDetails?: PayableDetails | undefined);
8437
+ constructor(acpClient: AcpClient, id: number, type: MemoType, content: string, nextPhase: AcpJobPhases, status: AcpMemoStatus, senderAddress: Address, signedReason?: string | undefined, expiry?: Date | undefined, payableDetails?: PayableDetails | undefined);
8436
8438
  get payloadType(): PayloadType | undefined;
8437
8439
  getStructuredContent<T>(): GenericPayload<T> | undefined;
8438
8440
  create(jobId: number, isSecured?: boolean): Promise<`0x${string}`>;
@@ -8674,6 +8676,7 @@ declare class AcpClient {
8674
8676
  responseFundsTransfer(memoId: number, accept: boolean, reason?: string): Promise<`0x${string}`>;
8675
8677
  deliverJob(jobId: number, deliverable: IDeliverable): Promise<`0x${string}`>;
8676
8678
  getActiveJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8679
+ getPendingMemoJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8677
8680
  getCompletedJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8678
8681
  getCancelledJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
8679
8682
  getJobById(jobId: number): Promise<AcpJob | undefined>;
package/dist/index.js CHANGED
@@ -1939,6 +1939,9 @@ var Fare = class {
1939
1939
  this.contractAddress = contractAddress;
1940
1940
  this.decimals = decimals;
1941
1941
  }
1942
+ maxAmount() {
1943
+ return BigInt(Number.MAX_SAFE_INTEGER) * BigInt(10 ** this.decimals);
1944
+ }
1942
1945
  formatAmount(amount) {
1943
1946
  return (0, import_viem.parseUnits)(amount.toString(), this.decimals);
1944
1947
  }
@@ -2586,7 +2589,8 @@ var AcpJob = class {
2586
2589
  }
2587
2590
  return yield this.acpClient.payJob(
2588
2591
  this.id,
2589
- this.baseFare.formatAmount(amount),
2592
+ // this.baseFare.formatAmount(amount),
2593
+ this.baseFare.maxAmount(),
2590
2594
  memo.id,
2591
2595
  reason
2592
2596
  );
@@ -2746,7 +2750,8 @@ var AcpJob = class {
2746
2750
  return yield this.acpClient.responseFundsRequest(
2747
2751
  memo.id,
2748
2752
  accept,
2749
- this.baseFare.formatAmount(payload.data.amount),
2753
+ // this.baseFare.formatAmount(payload.data.amount),
2754
+ this.baseFare.maxAmount(),
2750
2755
  reason
2751
2756
  );
2752
2757
  });
@@ -2949,13 +2954,14 @@ var acpJob_default = AcpJob;
2949
2954
 
2950
2955
  // src/acpMemo.ts
2951
2956
  var AcpMemo = class {
2952
- constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
2957
+ constructor(acpClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails) {
2953
2958
  this.acpClient = acpClient;
2954
2959
  this.id = id;
2955
2960
  this.type = type;
2956
2961
  this.content = content;
2957
2962
  this.nextPhase = nextPhase;
2958
2963
  this.status = status;
2964
+ this.senderAddress = senderAddress;
2959
2965
  this.signedReason = signedReason;
2960
2966
  this.expiry = expiry;
2961
2967
  this.payableDetails = payableDetails;
@@ -3096,6 +3102,7 @@ var AcpClient = class {
3096
3102
  memo.content,
3097
3103
  memo.nextPhase,
3098
3104
  memo.status,
3105
+ memo.senderAddress,
3099
3106
  memo.signedReason,
3100
3107
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3101
3108
  memo.payableDetails
@@ -3129,6 +3136,7 @@ var AcpClient = class {
3129
3136
  memo.content,
3130
3137
  memo.nextPhase,
3131
3138
  memo.status,
3139
+ memo.senderAddress,
3132
3140
  memo.signedReason,
3133
3141
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3134
3142
  memo.payableDetails
@@ -3295,13 +3303,13 @@ var AcpClient = class {
3295
3303
  const isFeeTokenDifferent = feeFareAmount.fare.contractAddress !== transferFareAmount.fare.contractAddress;
3296
3304
  if (isFeeTokenDifferent) {
3297
3305
  yield this.acpContractClient.approveAllowance(
3298
- feeFareAmount.amount,
3306
+ feeFareAmount.fare.maxAmount(),
3299
3307
  feeFareAmount.fare.contractAddress
3300
3308
  );
3301
3309
  }
3302
3310
  const finalAmount = isFeeTokenDifferent ? transferFareAmount : transferFareAmount.add(feeFareAmount);
3303
3311
  yield this.acpContractClient.approveAllowance(
3304
- finalAmount.amount,
3312
+ finalAmount.fare.maxAmount(),
3305
3313
  transferFareAmount.fare.contractAddress
3306
3314
  );
3307
3315
  return yield this.acpContractClient.createPayableMemo(
@@ -3375,6 +3383,7 @@ var AcpClient = class {
3375
3383
  memo.content,
3376
3384
  memo.nextPhase,
3377
3385
  memo.status,
3386
+ memo.senderAddress,
3378
3387
  memo.signedReason,
3379
3388
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3380
3389
  memo.payableDetails
@@ -3389,6 +3398,51 @@ var AcpClient = class {
3389
3398
  }
3390
3399
  });
3391
3400
  }
3401
+ getPendingMemoJobs(page = 1, pageSize = 10) {
3402
+ return __async(this, null, function* () {
3403
+ let url = `${this.acpUrl}/api/jobs/pending-memos?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
3404
+ try {
3405
+ const response = yield fetch(url, {
3406
+ headers: {
3407
+ "wallet-address": this.acpContractClient.walletAddress
3408
+ }
3409
+ });
3410
+ const data = yield response.json();
3411
+ if (data.error) {
3412
+ throw new acpError_default(data.error.message);
3413
+ }
3414
+ return data.data.map((job) => {
3415
+ return new acpJob_default(
3416
+ this,
3417
+ job.id,
3418
+ job.clientAddress,
3419
+ job.providerAddress,
3420
+ job.evaluatorAddress,
3421
+ job.price,
3422
+ job.priceTokenAddress,
3423
+ job.memos.map((memo) => {
3424
+ return new acpMemo_default(
3425
+ this,
3426
+ memo.id,
3427
+ memo.memoType,
3428
+ memo.content,
3429
+ memo.nextPhase,
3430
+ memo.status,
3431
+ memo.senderAddress,
3432
+ memo.signedReason,
3433
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3434
+ typeof memo.payableDetails === "string" ? tryParseJson(memo.payableDetails) || void 0 : memo.payableDetails
3435
+ );
3436
+ }),
3437
+ job.phase,
3438
+ job.context
3439
+ );
3440
+ });
3441
+ } catch (error) {
3442
+ throw new acpError_default("Failed to get pending memo jobs", error);
3443
+ }
3444
+ });
3445
+ }
3392
3446
  getCompletedJobs(page = 1, pageSize = 10) {
3393
3447
  return __async(this, null, function* () {
3394
3448
  let url = `${this.acpUrl}/api/jobs/completed?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
@@ -3419,6 +3473,7 @@ var AcpClient = class {
3419
3473
  memo.content,
3420
3474
  memo.nextPhase,
3421
3475
  memo.status,
3476
+ memo.senderAddress,
3422
3477
  memo.signedReason,
3423
3478
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3424
3479
  memo.payableDetails
@@ -3463,6 +3518,7 @@ var AcpClient = class {
3463
3518
  memo.content,
3464
3519
  memo.nextPhase,
3465
3520
  memo.status,
3521
+ memo.senderAddress,
3466
3522
  memo.signedReason,
3467
3523
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3468
3524
  memo.payableDetails
@@ -3510,6 +3566,7 @@ var AcpClient = class {
3510
3566
  memo.content,
3511
3567
  memo.nextPhase,
3512
3568
  memo.status,
3569
+ memo.senderAddress,
3513
3570
  memo.signedReason,
3514
3571
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3515
3572
  memo.payableDetails
@@ -3547,6 +3604,7 @@ var AcpClient = class {
3547
3604
  memo.content,
3548
3605
  memo.nextPhase,
3549
3606
  memo.status,
3607
+ memo.senderAddress,
3550
3608
  memo.signedReason,
3551
3609
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3552
3610
  memo.payableDetails
package/dist/index.mjs CHANGED
@@ -1888,6 +1888,9 @@ var Fare = class {
1888
1888
  this.contractAddress = contractAddress;
1889
1889
  this.decimals = decimals;
1890
1890
  }
1891
+ maxAmount() {
1892
+ return BigInt(Number.MAX_SAFE_INTEGER) * BigInt(10 ** this.decimals);
1893
+ }
1891
1894
  formatAmount(amount) {
1892
1895
  return parseUnits(amount.toString(), this.decimals);
1893
1896
  }
@@ -2535,7 +2538,8 @@ var AcpJob = class {
2535
2538
  }
2536
2539
  return yield this.acpClient.payJob(
2537
2540
  this.id,
2538
- this.baseFare.formatAmount(amount),
2541
+ // this.baseFare.formatAmount(amount),
2542
+ this.baseFare.maxAmount(),
2539
2543
  memo.id,
2540
2544
  reason
2541
2545
  );
@@ -2695,7 +2699,8 @@ var AcpJob = class {
2695
2699
  return yield this.acpClient.responseFundsRequest(
2696
2700
  memo.id,
2697
2701
  accept,
2698
- this.baseFare.formatAmount(payload.data.amount),
2702
+ // this.baseFare.formatAmount(payload.data.amount),
2703
+ this.baseFare.maxAmount(),
2699
2704
  reason
2700
2705
  );
2701
2706
  });
@@ -2898,13 +2903,14 @@ var acpJob_default = AcpJob;
2898
2903
 
2899
2904
  // src/acpMemo.ts
2900
2905
  var AcpMemo = class {
2901
- constructor(acpClient, id, type, content, nextPhase, status, signedReason, expiry, payableDetails) {
2906
+ constructor(acpClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails) {
2902
2907
  this.acpClient = acpClient;
2903
2908
  this.id = id;
2904
2909
  this.type = type;
2905
2910
  this.content = content;
2906
2911
  this.nextPhase = nextPhase;
2907
2912
  this.status = status;
2913
+ this.senderAddress = senderAddress;
2908
2914
  this.signedReason = signedReason;
2909
2915
  this.expiry = expiry;
2910
2916
  this.payableDetails = payableDetails;
@@ -3045,6 +3051,7 @@ var AcpClient = class {
3045
3051
  memo.content,
3046
3052
  memo.nextPhase,
3047
3053
  memo.status,
3054
+ memo.senderAddress,
3048
3055
  memo.signedReason,
3049
3056
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3050
3057
  memo.payableDetails
@@ -3078,6 +3085,7 @@ var AcpClient = class {
3078
3085
  memo.content,
3079
3086
  memo.nextPhase,
3080
3087
  memo.status,
3088
+ memo.senderAddress,
3081
3089
  memo.signedReason,
3082
3090
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3083
3091
  memo.payableDetails
@@ -3244,13 +3252,13 @@ var AcpClient = class {
3244
3252
  const isFeeTokenDifferent = feeFareAmount.fare.contractAddress !== transferFareAmount.fare.contractAddress;
3245
3253
  if (isFeeTokenDifferent) {
3246
3254
  yield this.acpContractClient.approveAllowance(
3247
- feeFareAmount.amount,
3255
+ feeFareAmount.fare.maxAmount(),
3248
3256
  feeFareAmount.fare.contractAddress
3249
3257
  );
3250
3258
  }
3251
3259
  const finalAmount = isFeeTokenDifferent ? transferFareAmount : transferFareAmount.add(feeFareAmount);
3252
3260
  yield this.acpContractClient.approveAllowance(
3253
- finalAmount.amount,
3261
+ finalAmount.fare.maxAmount(),
3254
3262
  transferFareAmount.fare.contractAddress
3255
3263
  );
3256
3264
  return yield this.acpContractClient.createPayableMemo(
@@ -3324,6 +3332,7 @@ var AcpClient = class {
3324
3332
  memo.content,
3325
3333
  memo.nextPhase,
3326
3334
  memo.status,
3335
+ memo.senderAddress,
3327
3336
  memo.signedReason,
3328
3337
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3329
3338
  memo.payableDetails
@@ -3338,6 +3347,51 @@ var AcpClient = class {
3338
3347
  }
3339
3348
  });
3340
3349
  }
3350
+ getPendingMemoJobs(page = 1, pageSize = 10) {
3351
+ return __async(this, null, function* () {
3352
+ let url = `${this.acpUrl}/api/jobs/pending-memos?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
3353
+ try {
3354
+ const response = yield fetch(url, {
3355
+ headers: {
3356
+ "wallet-address": this.acpContractClient.walletAddress
3357
+ }
3358
+ });
3359
+ const data = yield response.json();
3360
+ if (data.error) {
3361
+ throw new acpError_default(data.error.message);
3362
+ }
3363
+ return data.data.map((job) => {
3364
+ return new acpJob_default(
3365
+ this,
3366
+ job.id,
3367
+ job.clientAddress,
3368
+ job.providerAddress,
3369
+ job.evaluatorAddress,
3370
+ job.price,
3371
+ job.priceTokenAddress,
3372
+ job.memos.map((memo) => {
3373
+ return new acpMemo_default(
3374
+ this,
3375
+ memo.id,
3376
+ memo.memoType,
3377
+ memo.content,
3378
+ memo.nextPhase,
3379
+ memo.status,
3380
+ memo.senderAddress,
3381
+ memo.signedReason,
3382
+ memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3383
+ typeof memo.payableDetails === "string" ? tryParseJson(memo.payableDetails) || void 0 : memo.payableDetails
3384
+ );
3385
+ }),
3386
+ job.phase,
3387
+ job.context
3388
+ );
3389
+ });
3390
+ } catch (error) {
3391
+ throw new acpError_default("Failed to get pending memo jobs", error);
3392
+ }
3393
+ });
3394
+ }
3341
3395
  getCompletedJobs(page = 1, pageSize = 10) {
3342
3396
  return __async(this, null, function* () {
3343
3397
  let url = `${this.acpUrl}/api/jobs/completed?pagination[page]=${page}&pagination[pageSize]=${pageSize}`;
@@ -3368,6 +3422,7 @@ var AcpClient = class {
3368
3422
  memo.content,
3369
3423
  memo.nextPhase,
3370
3424
  memo.status,
3425
+ memo.senderAddress,
3371
3426
  memo.signedReason,
3372
3427
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3373
3428
  memo.payableDetails
@@ -3412,6 +3467,7 @@ var AcpClient = class {
3412
3467
  memo.content,
3413
3468
  memo.nextPhase,
3414
3469
  memo.status,
3470
+ memo.senderAddress,
3415
3471
  memo.signedReason,
3416
3472
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3417
3473
  memo.payableDetails
@@ -3459,6 +3515,7 @@ var AcpClient = class {
3459
3515
  memo.content,
3460
3516
  memo.nextPhase,
3461
3517
  memo.status,
3518
+ memo.senderAddress,
3462
3519
  memo.signedReason,
3463
3520
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3464
3521
  memo.payableDetails
@@ -3496,6 +3553,7 @@ var AcpClient = class {
3496
3553
  memo.content,
3497
3554
  memo.nextPhase,
3498
3555
  memo.status,
3556
+ memo.senderAddress,
3499
3557
  memo.signedReason,
3500
3558
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
3501
3559
  memo.payableDetails
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtuals-protocol/acp-node",
3
- "version": "0.2.0-beta.11",
3
+ "version": "0.2.0-beta.13",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",