@virtuals-protocol/acp-node 0.3.0-beta.19 → 0.3.0-beta.20

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
@@ -35,7 +35,7 @@ var require_package = __commonJS({
35
35
  "package.json"(exports2, module2) {
36
36
  module2.exports = {
37
37
  name: "@virtuals-protocol/acp-node",
38
- version: "0.3.0-beta.19",
38
+ version: "0.3.0-beta.20",
39
39
  main: "./dist/index.js",
40
40
  module: "./dist/index.mjs",
41
41
  types: "./dist/index.d.ts",
@@ -91,7 +91,6 @@ __export(index_exports, {
91
91
  AcpJob: () => acpJob_default,
92
92
  AcpJobPhases: () => AcpJobPhases,
93
93
  AcpMemo: () => acpMemo_default,
94
- AcpMemoState: () => AcpMemoState,
95
94
  AcpMemoStatus: () => AcpMemoStatus,
96
95
  AcpOnlineStatus: () => AcpOnlineStatus,
97
96
  BaseAcpContractClient: () => baseAcpContractClient_default,
@@ -107,7 +106,6 @@ __export(index_exports, {
107
106
  baseAcpX402ConfigV2: () => baseAcpX402ConfigV2,
108
107
  baseSepoliaAcpConfig: () => baseSepoliaAcpConfig,
109
108
  baseSepoliaAcpConfigV2: () => baseSepoliaAcpConfigV2,
110
- baseSepoliaAcpX402ConfigV2: () => baseSepoliaAcpX402ConfigV2,
111
109
  default: () => index_default,
112
110
  ethFare: () => ethFare,
113
111
  preparePayload: () => preparePayload,
@@ -1286,7 +1284,7 @@ var ACP_ABI = [
1286
1284
  var acpAbi_default = ACP_ABI;
1287
1285
 
1288
1286
  // src/acpClient.ts
1289
- var import_viem6 = require("viem");
1287
+ var import_viem4 = require("viem");
1290
1288
  var import_socket = require("socket.io-client");
1291
1289
 
1292
1290
  // src/contractClients/baseAcpContractClient.ts
@@ -1315,42 +1313,27 @@ var acpError_default = AcpError;
1315
1313
 
1316
1314
  // src/acpFare.ts
1317
1315
  var Fare = class _Fare {
1318
- constructor(contractAddress, decimals, chainId) {
1316
+ constructor(contractAddress, decimals) {
1319
1317
  this.contractAddress = contractAddress;
1320
1318
  this.decimals = decimals;
1321
- this.chainId = chainId;
1322
1319
  }
1323
1320
  formatAmount(amount) {
1324
1321
  return (0, import_viem.parseUnits)(amount.toString(), this.decimals);
1325
1322
  }
1326
- static async fromContractAddress(contractAddress, config = baseAcpConfig, chainId = config.chain.id) {
1323
+ static async fromContractAddress(contractAddress, config = baseAcpConfig) {
1327
1324
  if (contractAddress === config.baseFare.contractAddress) {
1328
1325
  return config.baseFare;
1329
1326
  }
1330
- let chainConfig = config.chain;
1331
- let rpcUrl = config.rpcEndpoint;
1332
- if (chainId !== config.chain.id) {
1333
- const selectedConfig = config.chains?.find(
1334
- (chain) => chain.chain.id === chainId
1335
- );
1336
- if (!selectedConfig) {
1337
- throw new acpError_default(
1338
- `Chain configuration for chainId ${chainId} not found.`
1339
- );
1340
- }
1341
- chainConfig = selectedConfig.chain;
1342
- rpcUrl = selectedConfig.rpcUrl;
1343
- }
1344
1327
  const publicClient = (0, import_viem.createPublicClient)({
1345
- chain: chainConfig,
1346
- transport: (0, import_viem.http)(rpcUrl)
1328
+ chain: config.chain,
1329
+ transport: (0, import_viem.http)(config.rpcEndpoint)
1347
1330
  });
1348
1331
  const decimals = await publicClient.readContract({
1349
1332
  address: contractAddress,
1350
1333
  abi: import_viem.erc20Abi,
1351
1334
  functionName: "decimals"
1352
1335
  });
1353
- return new _Fare(contractAddress, decimals, chainId);
1336
+ return new _Fare(contractAddress, decimals);
1354
1337
  }
1355
1338
  };
1356
1339
  var FareAmountBase = class {
@@ -1769,34 +1752,6 @@ var ACP_V2_ABI = [
1769
1752
  stateMutability: "nonpayable",
1770
1753
  type: "function"
1771
1754
  },
1772
- {
1773
- inputs: [
1774
- { internalType: "uint256", name: "jobId", type: "uint256" },
1775
- { internalType: "string", name: "content", type: "string" },
1776
- { internalType: "address", name: "token", type: "address" },
1777
- { internalType: "uint256", name: "amount", type: "uint256" },
1778
- { internalType: "address", name: "recipient", type: "address" },
1779
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
1780
- { internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
1781
- {
1782
- internalType: "enum ACPTypes.MemoType",
1783
- name: "memoType",
1784
- type: "uint8"
1785
- },
1786
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
1787
- { internalType: "bool", name: "isSecured", type: "bool" },
1788
- {
1789
- internalType: "enum ACPTypes.JobPhase",
1790
- name: "nextPhase",
1791
- type: "uint8"
1792
- },
1793
- { internalType: "uint32", name: "lzDstEid", type: "uint32" }
1794
- ],
1795
- name: "createCrossChainPayableMemo",
1796
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1797
- stateMutability: "nonpayable",
1798
- type: "function"
1799
- },
1800
1755
  {
1801
1756
  inputs: [
1802
1757
  { internalType: "address", name: "provider", type: "address" },
@@ -1981,12 +1936,7 @@ var ACP_V2_ABI = [
1981
1936
  name: "nextPhase",
1982
1937
  type: "uint8"
1983
1938
  },
1984
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
1985
- {
1986
- internalType: "enum ACPTypes.MemoState",
1987
- name: "state",
1988
- type: "uint8"
1989
- }
1939
+ { internalType: "uint256", name: "expiredAt", type: "uint256" }
1990
1940
  ],
1991
1941
  internalType: "struct ACPTypes.Memo[]",
1992
1942
  name: "memos",
@@ -2033,12 +1983,7 @@ var ACP_V2_ABI = [
2033
1983
  name: "nextPhase",
2034
1984
  type: "uint8"
2035
1985
  },
2036
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
2037
- {
2038
- internalType: "enum ACPTypes.MemoState",
2039
- name: "state",
2040
- type: "uint8"
2041
- }
1986
+ { internalType: "uint256", name: "expiredAt", type: "uint256" }
2042
1987
  ],
2043
1988
  internalType: "struct ACPTypes.Memo[]",
2044
1989
  name: "memos",
@@ -2081,12 +2026,7 @@ var ACP_V2_ABI = [
2081
2026
  name: "nextPhase",
2082
2027
  type: "uint8"
2083
2028
  },
2084
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
2085
- {
2086
- internalType: "enum ACPTypes.MemoState",
2087
- name: "state",
2088
- type: "uint8"
2089
- }
2029
+ { internalType: "uint256", name: "expiredAt", type: "uint256" }
2090
2030
  ],
2091
2031
  internalType: "struct ACPTypes.Memo[]",
2092
2032
  name: "memos",
@@ -2342,7 +2282,7 @@ var acpAbiV2_default = ACP_V2_ABI;
2342
2282
  var V1_MAX_RETRIES = 10;
2343
2283
  var V2_MAX_RETRIES = 3;
2344
2284
  var AcpContractConfig2 = class {
2345
- constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, chains = []) {
2285
+ constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config) {
2346
2286
  this.chain = chain;
2347
2287
  this.contractAddress = contractAddress;
2348
2288
  this.baseFare = baseFare;
@@ -2352,7 +2292,6 @@ var AcpContractConfig2 = class {
2352
2292
  this.maxRetries = maxRetries;
2353
2293
  this.rpcEndpoint = rpcEndpoint;
2354
2294
  this.x402Config = x402Config;
2355
- this.chains = chains;
2356
2295
  }
2357
2296
  };
2358
2297
  var baseSepoliaAcpConfig = new AcpContractConfig2(
@@ -3628,7 +3567,6 @@ var BaseAcpContractClient = class {
3628
3567
  constructor(agentWalletAddress, config = baseAcpConfig) {
3629
3568
  this.agentWalletAddress = agentWalletAddress;
3630
3569
  this.config = config;
3631
- this.publicClients = {};
3632
3570
  this.chain = config.chain;
3633
3571
  this.abi = config.abi;
3634
3572
  this.contractAddress = config.contractAddress;
@@ -3728,12 +3666,12 @@ ${JSON.stringify(
3728
3666
  throw new acpError_default("Failed to create job", error);
3729
3667
  }
3730
3668
  }
3731
- approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress, targetAddress) {
3669
+ approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
3732
3670
  try {
3733
3671
  const data = (0, import_viem2.encodeFunctionData)({
3734
3672
  abi: import_viem2.erc20Abi,
3735
3673
  functionName: "approve",
3736
- args: [targetAddress ?? this.contractAddress, amountBaseUnit]
3674
+ args: [this.contractAddress, amountBaseUnit]
3737
3675
  });
3738
3676
  const payload = {
3739
3677
  data,
@@ -3772,35 +3710,6 @@ ${JSON.stringify(
3772
3710
  throw new acpError_default("Failed to create payable memo", error);
3773
3711
  }
3774
3712
  }
3775
- createCrossChainPayableMemo(jobId, content, token, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, type, expiredAt, nextPhase, destinationEid, secured = true) {
3776
- try {
3777
- const data = (0, import_viem2.encodeFunctionData)({
3778
- abi: this.abi,
3779
- functionName: "createCrossChainPayableMemo",
3780
- args: [
3781
- jobId,
3782
- content,
3783
- token,
3784
- amountBaseUnit,
3785
- recipient,
3786
- feeAmountBaseUnit,
3787
- feeType,
3788
- type,
3789
- expiredAt,
3790
- secured,
3791
- nextPhase,
3792
- destinationEid
3793
- ]
3794
- });
3795
- const payload = {
3796
- data,
3797
- contractAddress: this.contractAddress
3798
- };
3799
- return payload;
3800
- } catch (error) {
3801
- throw new acpError_default("Failed to create cross chain payable memo", error);
3802
- }
3803
- }
3804
3713
  createMemo(jobId, content, type, isSecured, nextPhase) {
3805
3714
  try {
3806
3715
  const data = (0, import_viem2.encodeFunctionData)({
@@ -3817,22 +3726,6 @@ ${JSON.stringify(
3817
3726
  throw new acpError_default("Failed to create memo", error);
3818
3727
  }
3819
3728
  }
3820
- createMemoWithMetadata(jobId, content, type, isSecured, nextPhase, metadata) {
3821
- try {
3822
- const data = (0, import_viem2.encodeFunctionData)({
3823
- abi: this.abi,
3824
- functionName: "createMemoWithMetadata",
3825
- args: [jobId, content, type, isSecured, nextPhase, metadata]
3826
- });
3827
- const payload = {
3828
- data,
3829
- contractAddress: this.contractAddress
3830
- };
3831
- return payload;
3832
- } catch (error) {
3833
- throw new acpError_default("Failed to create memo with metadata", error);
3834
- }
3835
- }
3836
3729
  signMemo(memoId, isApproved, reason) {
3837
3730
  try {
3838
3731
  const data = (0, import_viem2.encodeFunctionData)({
@@ -3918,47 +3811,9 @@ ${JSON.stringify(
3918
3811
  throw new acpError_default("Failed to submit TransferWithAuthorization", error);
3919
3812
  }
3920
3813
  }
3921
- async getERC20Balance(chainId, tokenAddress, walletAddress) {
3922
- const publicClient = this.publicClients[chainId];
3923
- if (!publicClient) {
3924
- throw new acpError_default(`Public client for chainId ${chainId} not found`);
3925
- }
3926
- return await publicClient.readContract({
3927
- address: tokenAddress,
3928
- abi: import_viem2.erc20Abi,
3929
- functionName: "balanceOf",
3930
- args: [walletAddress]
3931
- });
3932
- }
3933
- async getERC20Allowance(chainId, tokenAddress, walletAddress, spenderAddress) {
3934
- const publicClient = this.publicClients[chainId];
3935
- if (!publicClient) {
3936
- throw new acpError_default(`Public client for chainId ${chainId} not found`);
3937
- }
3938
- return await publicClient.readContract({
3939
- address: tokenAddress,
3940
- abi: import_viem2.erc20Abi,
3941
- functionName: "allowance",
3942
- args: [walletAddress, spenderAddress]
3943
- });
3944
- }
3945
- async getERC20Symbol(chainId, tokenAddress) {
3946
- const publicClient = this.publicClients[chainId];
3947
- if (!publicClient) {
3948
- throw new acpError_default(`Public client for chainId ${chainId} not found`);
3949
- }
3950
- return await publicClient.readContract({
3951
- address: tokenAddress,
3952
- abi: import_viem2.erc20Abi,
3953
- functionName: "symbol"
3954
- });
3955
- }
3956
3814
  };
3957
3815
  var baseAcpContractClient_default = BaseAcpContractClient;
3958
3816
 
3959
- // src/acpJob.ts
3960
- var import_viem5 = require("viem");
3961
-
3962
3817
  // src/interfaces.ts
3963
3818
  var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
3964
3819
  AcpMemoStatus2["PENDING"] = "PENDING";
@@ -3966,15 +3821,6 @@ var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
3966
3821
  AcpMemoStatus2["REJECTED"] = "REJECTED";
3967
3822
  return AcpMemoStatus2;
3968
3823
  })(AcpMemoStatus || {});
3969
- var AcpMemoState = /* @__PURE__ */ ((AcpMemoState2) => {
3970
- AcpMemoState2[AcpMemoState2["NONE"] = 0] = "NONE";
3971
- AcpMemoState2[AcpMemoState2["PENDING"] = 1] = "PENDING";
3972
- AcpMemoState2[AcpMemoState2["IN_PROGRESS"] = 2] = "IN_PROGRESS";
3973
- AcpMemoState2[AcpMemoState2["READY"] = 3] = "READY";
3974
- AcpMemoState2[AcpMemoState2["COMPLETED"] = 4] = "COMPLETED";
3975
- AcpMemoState2[AcpMemoState2["REJECTED"] = 5] = "REJECTED";
3976
- return AcpMemoState2;
3977
- })(AcpMemoState || {});
3978
3824
  var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
3979
3825
  AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
3980
3826
  AcpAgentSort2["SUCCESS_RATE"] = "successRate";
@@ -4013,8 +3859,6 @@ var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
4013
3859
  })(PositionDirection || {});
4014
3860
 
4015
3861
  // src/utils.ts
4016
- var import_viem3 = require("viem");
4017
- var import_chains2 = require("viem/chains");
4018
3862
  function tryParseJson(content) {
4019
3863
  try {
4020
3864
  return JSON.parse(content);
@@ -4031,34 +3875,9 @@ function safeBase64Encode(data) {
4031
3875
  }
4032
3876
  return Buffer.from(data).toString("base64");
4033
3877
  }
4034
- function getDestinationEndpointId(chainId) {
4035
- switch (chainId) {
4036
- case import_chains2.baseSepolia.id:
4037
- return 40245;
4038
- case import_chains2.sepolia.id:
4039
- return 40161;
4040
- case import_chains2.polygonAmoy.id:
4041
- return 40267;
4042
- case import_chains2.arbitrumSepolia.id:
4043
- return 40231;
4044
- case import_chains2.bscTestnet.id:
4045
- return 40102;
4046
- case import_chains2.base.id:
4047
- return 30184;
4048
- case import_chains2.mainnet.id:
4049
- return 30101;
4050
- case import_chains2.polygon.id:
4051
- return 30109;
4052
- case import_chains2.arbitrum.id:
4053
- return 30110;
4054
- case import_chains2.bsc.id:
4055
- return 30102;
4056
- }
4057
- throw new Error(`Unsupported chain ID: ${chainId}`);
4058
- }
4059
3878
 
4060
3879
  // src/acpJobOffering.ts
4061
- var import_viem4 = require("viem");
3880
+ var import_viem3 = require("viem");
4062
3881
  var import_ajv = __toESM(require("ajv"));
4063
3882
  var AcpJobOffering = class {
4064
3883
  constructor(acpClient, acpContractClient, providerAddress, name, price, priceType = "fixed" /* FIXED */, requirement) {
@@ -4117,7 +3936,7 @@ var AcpJobOffering = class {
4117
3936
  } else {
4118
3937
  createJobPayload = this.acpContractClient.createJobWithAccount(
4119
3938
  account.id,
4120
- evaluatorAddress || import_viem4.zeroAddress,
3939
+ evaluatorAddress || import_viem3.zeroAddress,
4121
3940
  fareAmount.amount,
4122
3941
  fareAmount.fare.contractAddress,
4123
3942
  expiredAt,
@@ -4258,43 +4077,25 @@ var AcpJob = class {
4258
4077
  }
4259
4078
  const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
4260
4079
  const isPercentagePricing = this.priceType === "percentage" /* PERCENTAGE */;
4261
- if (amount.fare.chainId && amount.fare.chainId !== this.acpContractClient.config.chain.id) {
4262
- operations.push(
4263
- this.acpContractClient.createCrossChainPayableMemo(
4264
- this.id,
4265
- content,
4266
- amount.fare.contractAddress,
4267
- amount.amount,
4268
- recipient,
4269
- isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
4270
- isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
4271
- type,
4272
- expiredAt,
4273
- 2 /* TRANSACTION */,
4274
- getDestinationEndpointId(amount.fare.chainId)
4275
- )
4276
- );
4277
- } else {
4278
- operations.push(
4279
- this.acpContractClient.createPayableMemo(
4280
- this.id,
4281
- content,
4282
- amount.amount,
4283
- recipient,
4284
- isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
4285
- isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
4286
- 2 /* TRANSACTION */,
4287
- type,
4288
- expiredAt,
4289
- amount.fare.contractAddress
4290
- )
4291
- );
4292
- }
4080
+ operations.push(
4081
+ this.acpContractClient.createPayableMemo(
4082
+ this.id,
4083
+ content,
4084
+ amount.amount,
4085
+ recipient,
4086
+ isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
4087
+ isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
4088
+ 2 /* TRANSACTION */,
4089
+ type,
4090
+ expiredAt,
4091
+ amount.fare.contractAddress
4092
+ )
4093
+ );
4293
4094
  return await this.acpContractClient.handleOperation(operations);
4294
4095
  }
4295
4096
  async payAndAcceptRequirement(reason) {
4296
4097
  const memo = this.memos.find(
4297
- (m) => m.nextPhase === 2 /* TRANSACTION */ || m.nextPhase === 4 /* COMPLETED */
4098
+ (m) => m.nextPhase === 2 /* TRANSACTION */
4298
4099
  );
4299
4100
  if (!memo) {
4300
4101
  throw new acpError_default("No notification memo found");
@@ -4422,9 +4223,6 @@ var AcpJob = class {
4422
4223
  if (this.latestMemo?.nextPhase !== 3 /* EVALUATION */) {
4423
4224
  throw new acpError_default("No transaction memo found");
4424
4225
  }
4425
- if (amount.fare.chainId !== this.acpContractClient.config.chain.id) {
4426
- return await this.deliverCrossChainPayable(this.clientAddress, amount);
4427
- }
4428
4226
  const operations = [];
4429
4227
  operations.push(
4430
4228
  this.acpContractClient.approveAllowance(
@@ -4555,57 +4353,6 @@ var AcpJob = class {
4555
4353
  waitMs = Math.min(waitMs * 2, maxWaitMs);
4556
4354
  }
4557
4355
  }
4558
- async deliverCrossChainPayable(recipient, amount, isRequest = false) {
4559
- if (!amount.fare.chainId) {
4560
- throw new acpError_default("Chain ID is required for cross chain payable");
4561
- }
4562
- const chainId = amount.fare.chainId;
4563
- const assetManagerAddress = await this.acpContractClient.getAssetManager();
4564
- const tokenBalance = await this.acpContractClient.getERC20Balance(
4565
- chainId,
4566
- amount.fare.contractAddress,
4567
- this.acpContractClient.agentWalletAddress
4568
- );
4569
- if (tokenBalance < amount.amount) {
4570
- throw new acpError_default("Insufficient token balance for cross chain payable");
4571
- }
4572
- const currentAllowance = await this.acpContractClient.getERC20Allowance(
4573
- chainId,
4574
- amount.fare.contractAddress,
4575
- this.acpContractClient.agentWalletAddress,
4576
- assetManagerAddress
4577
- );
4578
- const approveAllowanceOperation = this.acpContractClient.approveAllowance(
4579
- amount.amount + currentAllowance,
4580
- amount.fare.contractAddress,
4581
- assetManagerAddress
4582
- );
4583
- await this.acpContractClient.handleOperation(
4584
- [approveAllowanceOperation],
4585
- chainId
4586
- );
4587
- const tokenSymbol = await this.acpContractClient.getERC20Symbol(
4588
- chainId,
4589
- amount.fare.contractAddress
4590
- );
4591
- const createMemoOperation = this.acpContractClient.createCrossChainPayableMemo(
4592
- this.id,
4593
- `Performing cross chain payable transfer of ${(0, import_viem5.formatUnits)(
4594
- amount.amount,
4595
- amount.fare.decimals
4596
- )} ${tokenSymbol} to ${recipient}`,
4597
- amount.fare.contractAddress,
4598
- amount.amount,
4599
- recipient,
4600
- BigInt(0),
4601
- 0 /* NO_FEE */,
4602
- isRequest ? 6 /* PAYABLE_REQUEST */ : 7 /* PAYABLE_TRANSFER */,
4603
- new Date(Date.now() + 1e3 * 60 * 5),
4604
- isRequest ? 2 /* TRANSACTION */ : 4 /* COMPLETED */,
4605
- getDestinationEndpointId(chainId)
4606
- );
4607
- await this.acpContractClient.handleOperation([createMemoOperation]);
4608
- }
4609
4356
  [util.inspect.custom]() {
4610
4357
  return {
4611
4358
  id: this.id,
@@ -4629,7 +4376,7 @@ var acpJob_default = AcpJob;
4629
4376
  // src/acpMemo.ts
4630
4377
  var import_util = __toESM(require("util"));
4631
4378
  var AcpMemo = class {
4632
- constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash, state) {
4379
+ constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash) {
4633
4380
  this.contractClient = contractClient;
4634
4381
  this.id = id;
4635
4382
  this.type = type;
@@ -4642,7 +4389,6 @@ var AcpMemo = class {
4642
4389
  this.payableDetails = payableDetails;
4643
4390
  this.txHash = txHash;
4644
4391
  this.signedTxHash = signedTxHash;
4645
- this.state = state;
4646
4392
  if (this.payableDetails) {
4647
4393
  this.payableDetails.amount = BigInt(this.payableDetails.amount);
4648
4394
  this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
@@ -4793,8 +4539,7 @@ var AcpClient = class {
4793
4539
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
4794
4540
  memo.payableDetails,
4795
4541
  memo.txHash,
4796
- memo.signedTxHash,
4797
- memo.state
4542
+ memo.signedTxHash
4798
4543
  );
4799
4544
  }),
4800
4545
  data.phase,
@@ -4832,8 +4577,7 @@ var AcpClient = class {
4832
4577
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
4833
4578
  memo.payableDetails,
4834
4579
  memo.txHash,
4835
- memo.signedTxHash,
4836
- memo.state
4580
+ memo.signedTxHash
4837
4581
  );
4838
4582
  }),
4839
4583
  data.phase,
@@ -4858,14 +4602,7 @@ var AcpClient = class {
4858
4602
  process.on("SIGTERM", cleanup);
4859
4603
  }
4860
4604
  async browseAgents(keyword, options) {
4861
- let {
4862
- cluster,
4863
- sort_by,
4864
- top_k,
4865
- graduationStatus,
4866
- onlineStatus,
4867
- showHiddenOfferings
4868
- } = options;
4605
+ let { cluster, sort_by, top_k, graduationStatus, onlineStatus, showHiddenOfferings } = options;
4869
4606
  top_k = top_k ?? 5;
4870
4607
  let url = `${this.acpUrl}/api/agents/v4/search?search=${keyword}`;
4871
4608
  if (sort_by && sort_by.length > 0) {
@@ -4947,7 +4684,7 @@ var AcpClient = class {
4947
4684
  baseAcpConfig.contractAddress,
4948
4685
  baseAcpX402Config.contractAddress
4949
4686
  ].includes(this.acpContractClient.config.contractAddress);
4950
- const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress : import_viem6.zeroAddress;
4687
+ const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress : import_viem4.zeroAddress;
4951
4688
  const chainId = this.acpContractClient.config.chain.id;
4952
4689
  const isUsdcPaymentToken = USDC_TOKEN_ADDRESS[chainId].toLowerCase() === fareAmount.fare.contractAddress.toLowerCase();
4953
4690
  const isX402Job = this.acpContractClient.config.x402Config && isUsdcPaymentToken;
@@ -5056,8 +4793,7 @@ var AcpClient = class {
5056
4793
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
5057
4794
  memo.payableDetails,
5058
4795
  memo.txHash,
5059
- memo.signedTxHash,
5060
- memo.state
4796
+ memo.signedTxHash
5061
4797
  )
5062
4798
  );
5063
4799
  jobs.push(
@@ -5131,8 +4867,7 @@ var AcpClient = class {
5131
4867
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
5132
4868
  memo.payableDetails,
5133
4869
  memo.txHash,
5134
- memo.signedTxHash,
5135
- memo.state
4870
+ memo.signedTxHash
5136
4871
  )
5137
4872
  );
5138
4873
  return new acpJob_default(
@@ -5191,8 +4926,7 @@ var AcpClient = class {
5191
4926
  memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
5192
4927
  memo.payableDetails,
5193
4928
  memo.txHash,
5194
- memo.signedTxHash,
5195
- memo.state
4929
+ memo.signedTxHash
5196
4930
  );
5197
4931
  } catch (err) {
5198
4932
  throw new acpError_default(
@@ -5256,10 +4990,10 @@ var acpClient_default = AcpClient;
5256
4990
  var import_core = require("@aa-sdk/core");
5257
4991
  var import_infra2 = require("@account-kit/infra");
5258
4992
  var import_smart_contracts = require("@account-kit/smart-contracts");
5259
- var import_viem8 = require("viem");
4993
+ var import_viem6 = require("viem");
5260
4994
 
5261
4995
  // src/acpX402.ts
5262
- var import_viem7 = require("viem");
4996
+ var import_viem5 = require("viem");
5263
4997
  var import_crypto = require("crypto");
5264
4998
  var AcpX402 = class {
5265
4999
  constructor(config, sessionKeyClient, publicClient) {
@@ -5311,13 +5045,13 @@ var AcpX402 = class {
5311
5045
  try {
5312
5046
  const USDC_CONTRACT = this.config.baseFare.contractAddress;
5313
5047
  const timeNow = Math.floor(Date.now() / 1e3);
5314
- const validAfter = timeNow.toString();
5048
+ const validAfter = (timeNow - 60).toString();
5315
5049
  const validBefore = (timeNow + requirements.accepts[0].maxTimeoutSeconds).toString();
5316
5050
  const [tokenName, tokenVersion] = await this.publicClient.multicall({
5317
5051
  contracts: [
5318
5052
  {
5319
5053
  address: USDC_CONTRACT,
5320
- abi: import_viem7.erc20Abi,
5054
+ abi: import_viem5.erc20Abi,
5321
5055
  functionName: "name"
5322
5056
  },
5323
5057
  {
@@ -5409,7 +5143,10 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5409
5143
  this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
5410
5144
  }
5411
5145
  static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
5412
- const acpContractClient = new _AcpContractClient(agentWalletAddress, config);
5146
+ const acpContractClient = new _AcpContractClient(
5147
+ agentWalletAddress,
5148
+ config
5149
+ );
5413
5150
  await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
5414
5151
  return acpContractClient;
5415
5152
  }
@@ -5440,10 +5177,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5440
5177
  `ACP Contract Client validation failed: agent account ${this.agentWalletAddress} is not deployed on-chain`
5441
5178
  );
5442
5179
  }
5443
- await this.validateSessionKeyOnChain(
5444
- sessionSignerAddress,
5445
- sessionEntityKeyId
5446
- );
5180
+ await this.validateSessionKeyOnChain(sessionSignerAddress, sessionEntityKeyId);
5447
5181
  console.log("Connected to ACP with v1 Contract Client (Legacy):", {
5448
5182
  agentWalletAddress: this.agentWalletAddress,
5449
5183
  whitelistedWalletAddress: sessionSignerAddress,
@@ -5513,16 +5247,14 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5513
5247
  throw new acpError_default(`Failed to send user operation`, finalError);
5514
5248
  }
5515
5249
  async getJobId(createJobUserOpHash, clientAddress, providerAddress) {
5516
- const result = await this.sessionKeyClient.getUserOperationReceipt(
5517
- createJobUserOpHash
5518
- );
5250
+ const result = await this.sessionKeyClient.getUserOperationReceipt(createJobUserOpHash);
5519
5251
  if (!result) {
5520
5252
  throw new acpError_default("Failed to get user operation receipt");
5521
5253
  }
5522
5254
  const contractLogs = result.logs.filter((log) => {
5523
5255
  return log.address.toLowerCase() === this.contractAddress.toLowerCase();
5524
5256
  }).map(
5525
- (log) => (0, import_viem8.decodeEventLog)({
5257
+ (log) => (0, import_viem6.decodeEventLog)({
5526
5258
  abi: this.abi,
5527
5259
  data: log.data,
5528
5260
  topics: log.topics
@@ -5538,7 +5270,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5538
5270
  }
5539
5271
  createJob(providerAddress, evaluatorAddress, expireAt, paymentTokenAddress, budgetBaseUnit, metadata, isX402Job) {
5540
5272
  try {
5541
- const data = (0, import_viem8.encodeFunctionData)({
5273
+ const data = (0, import_viem6.encodeFunctionData)({
5542
5274
  abi: this.abi,
5543
5275
  functionName: isX402Job ? "createJobWithX402" : "createJob",
5544
5276
  args: [
@@ -5558,7 +5290,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5558
5290
  }
5559
5291
  setBudgetWithPaymentToken(jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
5560
5292
  try {
5561
- const data = (0, import_viem8.encodeFunctionData)({
5293
+ const data = (0, import_viem6.encodeFunctionData)({
5562
5294
  abi: this.abi,
5563
5295
  functionName: "setBudgetWithPaymentToken",
5564
5296
  args: [jobId, budgetBaseUnit, paymentTokenAddress]
@@ -5574,7 +5306,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5574
5306
  }
5575
5307
  createPayableMemo(jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress, secured = true) {
5576
5308
  try {
5577
- const data = (0, import_viem8.encodeFunctionData)({
5309
+ const data = (0, import_viem6.encodeFunctionData)({
5578
5310
  abi: this.abi,
5579
5311
  functionName: "createPayableMemo",
5580
5312
  args: [
@@ -5614,9 +5346,6 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5614
5346
  async performX402Request(url, version2, budget, signature) {
5615
5347
  return await this.acpX402.performRequest(url, version2, budget, signature);
5616
5348
  }
5617
- async getAssetManager() {
5618
- throw new Error("Asset Manager not supported");
5619
- }
5620
5349
  getAcpVersion() {
5621
5350
  return "1";
5622
5351
  }
@@ -5627,7 +5356,7 @@ var acpContractClient_default = AcpContractClient;
5627
5356
  var import_core2 = require("@aa-sdk/core");
5628
5357
  var import_infra3 = require("@account-kit/infra");
5629
5358
  var import_smart_contracts2 = require("@account-kit/smart-contracts");
5630
- var import_viem9 = require("viem");
5359
+ var import_viem7 = require("viem");
5631
5360
 
5632
5361
  // src/abis/jobManagerAbi.ts
5633
5362
  var JOB_MANAGER_ABI = [
@@ -6331,1229 +6060,70 @@ var JOB_MANAGER_ABI = [
6331
6060
  var jobManagerAbi_default = JOB_MANAGER_ABI;
6332
6061
 
6333
6062
  // src/contractClients/acpContractClientV2.ts
6334
- var import_chains3 = require("viem/chains");
6335
-
6336
- // src/abis/memoManagerAbi.ts
6337
- var MEMO_MANAGER_ABI = [
6338
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
6339
- { inputs: [], name: "AccessControlBadConfirmation", type: "error" },
6340
- {
6341
- inputs: [
6342
- { internalType: "address", name: "account", type: "address" },
6343
- { internalType: "bytes32", name: "neededRole", type: "bytes32" }
6344
- ],
6345
- name: "AccessControlUnauthorizedAccount",
6346
- type: "error"
6347
- },
6348
- {
6349
- inputs: [{ internalType: "address", name: "target", type: "address" }],
6350
- name: "AddressEmptyCode",
6351
- type: "error"
6352
- },
6353
- { inputs: [], name: "AlreadyVoted", type: "error" },
6354
- { inputs: [], name: "CannotApproveMemo", type: "error" },
6355
- { inputs: [], name: "CannotUpdateApprovedMemo", type: "error" },
6356
- { inputs: [], name: "CannotUpdateMemo", type: "error" },
6357
- { inputs: [], name: "CannotWithdrawYet", type: "error" },
6358
- { inputs: [], name: "DestinationChainNotConfigured", type: "error" },
6359
- {
6360
- inputs: [
6361
- { internalType: "address", name: "implementation", type: "address" }
6362
- ],
6363
- name: "ERC1967InvalidImplementation",
6364
- type: "error"
6365
- },
6366
- { inputs: [], name: "ERC1967NonPayable", type: "error" },
6367
- { inputs: [], name: "EmptyContent", type: "error" },
6368
- { inputs: [], name: "FailedInnerCall", type: "error" },
6369
- { inputs: [], name: "InvalidInitialization", type: "error" },
6370
- { inputs: [], name: "InvalidMemoState", type: "error" },
6371
- { inputs: [], name: "InvalidMemoStateTransition", type: "error" },
6372
- { inputs: [], name: "InvalidMemoType", type: "error" },
6373
- { inputs: [], name: "JobAlreadyCompleted", type: "error" },
6374
- { inputs: [], name: "JobDoesNotExist", type: "error" },
6375
- { inputs: [], name: "MemoAlreadyApproved", type: "error" },
6376
- { inputs: [], name: "MemoAlreadyExecuted", type: "error" },
6377
- { inputs: [], name: "MemoAlreadySigned", type: "error" },
6378
- { inputs: [], name: "MemoCannotBeSigned", type: "error" },
6379
- { inputs: [], name: "MemoDoesNotExist", type: "error" },
6380
- { inputs: [], name: "MemoDoesNotRequireApproval", type: "error" },
6381
- { inputs: [], name: "MemoExpired", type: "error" },
6382
- { inputs: [], name: "MemoNotApproved", type: "error" },
6383
- { inputs: [], name: "MemoNotReadyToBeSigned", type: "error" },
6384
- { inputs: [], name: "MemoStateUnchanged", type: "error" },
6385
- { inputs: [], name: "NoAmountToTransfer", type: "error" },
6386
- { inputs: [], name: "NoPaymentAmount", type: "error" },
6387
- { inputs: [], name: "NotEscrowTransferMemoType", type: "error" },
6388
- { inputs: [], name: "NotInitializing", type: "error" },
6389
- { inputs: [], name: "NotPayableMemoType", type: "error" },
6390
- { inputs: [], name: "OnlyACPContract", type: "error" },
6391
- { inputs: [], name: "OnlyAssetManager", type: "error" },
6392
- { inputs: [], name: "OnlyClientOrProvider", type: "error" },
6393
- { inputs: [], name: "OnlyCounterParty", type: "error" },
6394
- { inputs: [], name: "OnlyEvaluator", type: "error" },
6395
- { inputs: [], name: "OnlyMemoSender", type: "error" },
6396
- { inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
6397
- { inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
6398
- {
6399
- inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
6400
- name: "UUPSUnsupportedProxiableUUID",
6401
- type: "error"
6402
- },
6403
- { inputs: [], name: "ZeroAcpContractAddress", type: "error" },
6404
- { inputs: [], name: "ZeroAddressRecipient", type: "error" },
6405
- { inputs: [], name: "ZeroAddressToken", type: "error" },
6406
- { inputs: [], name: "ZeroAssetManagerAddress", type: "error" },
6407
- { inputs: [], name: "ZeroJobManagerAddress", type: "error" },
6408
- {
6409
- anonymous: false,
6410
- inputs: [
6411
- {
6412
- indexed: false,
6413
- internalType: "uint64",
6414
- name: "version",
6415
- type: "uint64"
6416
- }
6417
- ],
6418
- name: "Initialized",
6419
- type: "event"
6420
- },
6421
- {
6422
- anonymous: false,
6423
- inputs: [
6424
- {
6425
- indexed: true,
6426
- internalType: "uint256",
6427
- name: "memoId",
6428
- type: "uint256"
6429
- },
6430
- {
6431
- indexed: true,
6432
- internalType: "address",
6433
- name: "approver",
6434
- type: "address"
6435
- },
6436
- { indexed: false, internalType: "bool", name: "approved", type: "bool" },
6437
- {
6438
- indexed: false,
6439
- internalType: "string",
6440
- name: "reason",
6441
- type: "string"
6442
- }
6443
- ],
6444
- name: "MemoSigned",
6445
- type: "event"
6446
- },
6447
- {
6448
- anonymous: false,
6449
- inputs: [
6450
- {
6451
- indexed: true,
6452
- internalType: "uint256",
6453
- name: "memoId",
6454
- type: "uint256"
6455
- },
6456
- {
6457
- indexed: false,
6458
- internalType: "enum ACPTypes.MemoState",
6459
- name: "oldState",
6460
- type: "uint8"
6461
- },
6462
- {
6463
- indexed: false,
6464
- internalType: "enum ACPTypes.MemoState",
6465
- name: "newState",
6466
- type: "uint8"
6467
- }
6468
- ],
6469
- name: "MemoStateUpdated",
6470
- type: "event"
6471
- },
6472
- {
6473
- anonymous: false,
6474
- inputs: [
6475
- {
6476
- indexed: true,
6477
- internalType: "uint256",
6478
- name: "memoId",
6479
- type: "uint256"
6480
- },
6481
- {
6482
- indexed: true,
6483
- internalType: "uint256",
6484
- name: "jobId",
6485
- type: "uint256"
6486
- },
6487
- {
6488
- indexed: true,
6489
- internalType: "address",
6490
- name: "sender",
6491
- type: "address"
6492
- },
6493
- {
6494
- indexed: false,
6495
- internalType: "enum ACPTypes.MemoType",
6496
- name: "memoType",
6497
- type: "uint8"
6498
- },
6499
- {
6500
- indexed: false,
6501
- internalType: "enum ACPTypes.JobPhase",
6502
- name: "nextPhase",
6503
- type: "uint8"
6504
- },
6505
- {
6506
- indexed: false,
6507
- internalType: "string",
6508
- name: "content",
6509
- type: "string"
6510
- }
6511
- ],
6512
- name: "NewMemo",
6513
- type: "event"
6514
- },
6515
- {
6516
- anonymous: false,
6517
- inputs: [
6518
- {
6519
- indexed: true,
6520
- internalType: "uint256",
6521
- name: "jobId",
6522
- type: "uint256"
6523
- },
6524
- {
6525
- indexed: true,
6526
- internalType: "uint256",
6527
- name: "memoId",
6528
- type: "uint256"
6529
- },
6530
- {
6531
- indexed: true,
6532
- internalType: "address",
6533
- name: "sender",
6534
- type: "address"
6535
- },
6536
- {
6537
- indexed: false,
6538
- internalType: "address",
6539
- name: "token",
6540
- type: "address"
6541
- },
6542
- {
6543
- indexed: false,
6544
- internalType: "uint256",
6545
- name: "amount",
6546
- type: "uint256"
6547
- }
6548
- ],
6549
- name: "PayableFeeRefunded",
6550
- type: "event"
6551
- },
6552
- {
6553
- anonymous: false,
6554
- inputs: [
6555
- {
6556
- indexed: true,
6557
- internalType: "uint256",
6558
- name: "jobId",
6559
- type: "uint256"
6560
- },
6561
- {
6562
- indexed: true,
6563
- internalType: "uint256",
6564
- name: "memoId",
6565
- type: "uint256"
6566
- },
6567
- {
6568
- indexed: true,
6569
- internalType: "address",
6570
- name: "sender",
6571
- type: "address"
6572
- },
6573
- {
6574
- indexed: false,
6575
- internalType: "address",
6576
- name: "token",
6577
- type: "address"
6578
- },
6579
- {
6580
- indexed: false,
6581
- internalType: "uint256",
6582
- name: "amount",
6583
- type: "uint256"
6584
- }
6585
- ],
6586
- name: "PayableFundsRefunded",
6587
- type: "event"
6588
- },
6589
- {
6590
- anonymous: false,
6591
- inputs: [
6592
- {
6593
- indexed: true,
6594
- internalType: "uint256",
6595
- name: "memoId",
6596
- type: "uint256"
6597
- },
6598
- {
6599
- indexed: true,
6600
- internalType: "uint256",
6601
- name: "jobId",
6602
- type: "uint256"
6603
- },
6604
- {
6605
- indexed: true,
6606
- internalType: "address",
6607
- name: "executor",
6608
- type: "address"
6609
- },
6610
- {
6611
- indexed: false,
6612
- internalType: "uint256",
6613
- name: "amount",
6614
- type: "uint256"
6615
- }
6616
- ],
6617
- name: "PayableMemoExecuted",
6618
- type: "event"
6619
- },
6620
- {
6621
- anonymous: false,
6622
- inputs: [
6623
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
6624
- {
6625
- indexed: true,
6626
- internalType: "bytes32",
6627
- name: "previousAdminRole",
6628
- type: "bytes32"
6629
- },
6630
- {
6631
- indexed: true,
6632
- internalType: "bytes32",
6633
- name: "newAdminRole",
6634
- type: "bytes32"
6635
- }
6636
- ],
6637
- name: "RoleAdminChanged",
6638
- type: "event"
6639
- },
6640
- {
6641
- anonymous: false,
6642
- inputs: [
6643
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
6644
- {
6645
- indexed: true,
6646
- internalType: "address",
6647
- name: "account",
6648
- type: "address"
6649
- },
6650
- {
6651
- indexed: true,
6652
- internalType: "address",
6653
- name: "sender",
6654
- type: "address"
6655
- }
6656
- ],
6657
- name: "RoleGranted",
6658
- type: "event"
6659
- },
6660
- {
6661
- anonymous: false,
6662
- inputs: [
6663
- { indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
6664
- {
6665
- indexed: true,
6666
- internalType: "address",
6667
- name: "account",
6668
- type: "address"
6669
- },
6670
- {
6671
- indexed: true,
6672
- internalType: "address",
6673
- name: "sender",
6674
- type: "address"
6675
- }
6676
- ],
6677
- name: "RoleRevoked",
6678
- type: "event"
6679
- },
6680
- {
6681
- anonymous: false,
6682
- inputs: [
6683
- {
6684
- indexed: true,
6685
- internalType: "address",
6686
- name: "implementation",
6687
- type: "address"
6688
- }
6689
- ],
6690
- name: "Upgraded",
6691
- type: "event"
6692
- },
6693
- {
6694
- inputs: [],
6695
- name: "ACP_CONTRACT_ROLE",
6696
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
6697
- stateMutability: "view",
6698
- type: "function"
6699
- },
6700
- {
6701
- inputs: [],
6702
- name: "ADMIN_ROLE",
6703
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
6704
- stateMutability: "view",
6705
- type: "function"
6706
- },
6707
- {
6708
- inputs: [],
6709
- name: "DEFAULT_ADMIN_ROLE",
6710
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
6711
- stateMutability: "view",
6712
- type: "function"
6713
- },
6714
- {
6715
- inputs: [],
6716
- name: "UPGRADE_INTERFACE_VERSION",
6717
- outputs: [{ internalType: "string", name: "", type: "string" }],
6718
- stateMutability: "view",
6719
- type: "function"
6720
- },
6721
- {
6722
- inputs: [],
6723
- name: "acpContract",
6724
- outputs: [{ internalType: "address", name: "", type: "address" }],
6725
- stateMutability: "view",
6726
- type: "function"
6727
- },
6728
- {
6729
- inputs: [
6730
- { internalType: "uint256", name: "memoId", type: "uint256" },
6731
- { internalType: "address", name: "sender", type: "address" },
6732
- { internalType: "bool", name: "approved", type: "bool" },
6733
- { internalType: "string", name: "reason", type: "string" }
6734
- ],
6735
- name: "approveMemo",
6736
- outputs: [],
6737
- stateMutability: "nonpayable",
6738
- type: "function"
6739
- },
6740
- {
6741
- inputs: [],
6742
- name: "assetManager",
6743
- outputs: [{ internalType: "address", name: "", type: "address" }],
6744
- stateMutability: "view",
6745
- type: "function"
6746
- },
6747
- {
6748
- inputs: [
6749
- { internalType: "uint256[]", name: "memoIds", type: "uint256[]" },
6750
- { internalType: "bool", name: "approved", type: "bool" },
6751
- { internalType: "string", name: "reason", type: "string" }
6752
- ],
6753
- name: "bulkApproveMemos",
6754
- outputs: [],
6755
- stateMutability: "nonpayable",
6756
- type: "function"
6757
- },
6758
- {
6759
- inputs: [
6760
- { internalType: "uint256", name: "memoId", type: "uint256" },
6761
- { internalType: "address", name: "user", type: "address" }
6762
- ],
6763
- name: "canApproveMemo",
6764
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
6765
- stateMutability: "view",
6766
- type: "function"
6767
- },
6768
- {
6769
- inputs: [
6770
- { internalType: "uint256", name: "jobId", type: "uint256" },
6771
- { internalType: "address", name: "sender", type: "address" },
6772
- { internalType: "string", name: "content", type: "string" },
6773
- {
6774
- internalType: "enum ACPTypes.MemoType",
6775
- name: "memoType",
6776
- type: "uint8"
6777
- },
6778
- { internalType: "bool", name: "isSecured", type: "bool" },
6779
- {
6780
- internalType: "enum ACPTypes.JobPhase",
6781
- name: "nextPhase",
6782
- type: "uint8"
6783
- },
6784
- { internalType: "string", name: "metadata", type: "string" }
6785
- ],
6786
- name: "createMemo",
6787
- outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
6788
- stateMutability: "nonpayable",
6789
- type: "function"
6790
- },
6791
- {
6792
- inputs: [
6793
- { internalType: "uint256", name: "jobId", type: "uint256" },
6794
- { internalType: "address", name: "sender", type: "address" },
6795
- { internalType: "string", name: "content", type: "string" },
6796
- {
6797
- internalType: "enum ACPTypes.MemoType",
6798
- name: "memoType",
6799
- type: "uint8"
6800
- },
6801
- { internalType: "bool", name: "isSecured", type: "bool" },
6802
- {
6803
- internalType: "enum ACPTypes.JobPhase",
6804
- name: "nextPhase",
6805
- type: "uint8"
6806
- },
6807
- {
6808
- components: [
6809
- { internalType: "address", name: "token", type: "address" },
6810
- { internalType: "uint256", name: "amount", type: "uint256" },
6811
- { internalType: "address", name: "recipient", type: "address" },
6812
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
6813
- {
6814
- internalType: "enum ACPTypes.FeeType",
6815
- name: "feeType",
6816
- type: "uint8"
6817
- },
6818
- { internalType: "bool", name: "isExecuted", type: "bool" },
6819
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
6820
- { internalType: "uint32", name: "lzSrcEid", type: "uint32" },
6821
- { internalType: "uint32", name: "lzDstEid", type: "uint32" }
6822
- ],
6823
- internalType: "struct ACPTypes.PayableDetails",
6824
- name: "payableDetails_",
6825
- type: "tuple"
6826
- },
6827
- { internalType: "uint256", name: "expiredAt", type: "uint256" }
6828
- ],
6829
- name: "createPayableMemo",
6830
- outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
6831
- stateMutability: "nonpayable",
6832
- type: "function"
6833
- },
6834
- {
6835
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
6836
- name: "emergencyApproveMemo",
6837
- outputs: [],
6838
- stateMutability: "nonpayable",
6839
- type: "function"
6840
- },
6841
- {
6842
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
6843
- name: "executePayableMemo",
6844
- outputs: [],
6845
- stateMutability: "nonpayable",
6846
- type: "function"
6847
- },
6848
- {
6849
- inputs: [],
6850
- name: "getAssetManager",
6851
- outputs: [{ internalType: "address", name: "", type: "address" }],
6852
- stateMutability: "view",
6853
- type: "function"
6854
- },
6855
- {
6856
- inputs: [
6857
- { internalType: "uint256", name: "jobId", type: "uint256" },
6858
- { internalType: "uint256", name: "offset", type: "uint256" },
6859
- { internalType: "uint256", name: "limit", type: "uint256" }
6860
- ],
6861
- name: "getJobMemos",
6862
- outputs: [
6863
- {
6864
- components: [
6865
- { internalType: "uint256", name: "id", type: "uint256" },
6866
- { internalType: "uint256", name: "jobId", type: "uint256" },
6867
- { internalType: "address", name: "sender", type: "address" },
6868
- { internalType: "string", name: "content", type: "string" },
6869
- {
6870
- internalType: "enum ACPTypes.MemoType",
6871
- name: "memoType",
6872
- type: "uint8"
6873
- },
6874
- { internalType: "uint256", name: "createdAt", type: "uint256" },
6875
- { internalType: "bool", name: "isApproved", type: "bool" },
6876
- { internalType: "address", name: "approvedBy", type: "address" },
6877
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
6878
- { internalType: "bool", name: "requiresApproval", type: "bool" },
6879
- { internalType: "string", name: "metadata", type: "string" },
6880
- { internalType: "bool", name: "isSecured", type: "bool" },
6881
- {
6882
- internalType: "enum ACPTypes.JobPhase",
6883
- name: "nextPhase",
6884
- type: "uint8"
6885
- },
6886
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
6887
- {
6888
- internalType: "enum ACPTypes.MemoState",
6889
- name: "state",
6890
- type: "uint8"
6891
- }
6892
- ],
6893
- internalType: "struct ACPTypes.Memo[]",
6894
- name: "memoArray",
6895
- type: "tuple[]"
6896
- },
6897
- { internalType: "uint256", name: "total", type: "uint256" }
6898
- ],
6899
- stateMutability: "view",
6900
- type: "function"
6901
- },
6902
- {
6903
- inputs: [
6904
- { internalType: "uint256", name: "jobId", type: "uint256" },
6905
- { internalType: "enum ACPTypes.JobPhase", name: "phase", type: "uint8" },
6906
- { internalType: "uint256", name: "offset", type: "uint256" },
6907
- { internalType: "uint256", name: "limit", type: "uint256" }
6908
- ],
6909
- name: "getJobMemosByPhase",
6910
- outputs: [
6911
- {
6912
- components: [
6913
- { internalType: "uint256", name: "id", type: "uint256" },
6914
- { internalType: "uint256", name: "jobId", type: "uint256" },
6915
- { internalType: "address", name: "sender", type: "address" },
6916
- { internalType: "string", name: "content", type: "string" },
6917
- {
6918
- internalType: "enum ACPTypes.MemoType",
6919
- name: "memoType",
6920
- type: "uint8"
6921
- },
6922
- { internalType: "uint256", name: "createdAt", type: "uint256" },
6923
- { internalType: "bool", name: "isApproved", type: "bool" },
6924
- { internalType: "address", name: "approvedBy", type: "address" },
6925
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
6926
- { internalType: "bool", name: "requiresApproval", type: "bool" },
6927
- { internalType: "string", name: "metadata", type: "string" },
6928
- { internalType: "bool", name: "isSecured", type: "bool" },
6929
- {
6930
- internalType: "enum ACPTypes.JobPhase",
6931
- name: "nextPhase",
6932
- type: "uint8"
6933
- },
6934
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
6935
- {
6936
- internalType: "enum ACPTypes.MemoState",
6937
- name: "state",
6938
- type: "uint8"
6939
- }
6940
- ],
6941
- internalType: "struct ACPTypes.Memo[]",
6942
- name: "memoArray",
6943
- type: "tuple[]"
6944
- },
6945
- { internalType: "uint256", name: "total", type: "uint256" }
6946
- ],
6947
- stateMutability: "view",
6948
- type: "function"
6949
- },
6950
- {
6951
- inputs: [
6952
- { internalType: "uint256", name: "jobId", type: "uint256" },
6953
- {
6954
- internalType: "enum ACPTypes.MemoType",
6955
- name: "memoType",
6956
- type: "uint8"
6957
- },
6958
- { internalType: "uint256", name: "offset", type: "uint256" },
6959
- { internalType: "uint256", name: "limit", type: "uint256" }
6960
- ],
6961
- name: "getJobMemosByType",
6962
- outputs: [
6963
- {
6964
- components: [
6965
- { internalType: "uint256", name: "id", type: "uint256" },
6966
- { internalType: "uint256", name: "jobId", type: "uint256" },
6967
- { internalType: "address", name: "sender", type: "address" },
6968
- { internalType: "string", name: "content", type: "string" },
6969
- {
6970
- internalType: "enum ACPTypes.MemoType",
6971
- name: "memoType",
6972
- type: "uint8"
6973
- },
6974
- { internalType: "uint256", name: "createdAt", type: "uint256" },
6975
- { internalType: "bool", name: "isApproved", type: "bool" },
6976
- { internalType: "address", name: "approvedBy", type: "address" },
6977
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
6978
- { internalType: "bool", name: "requiresApproval", type: "bool" },
6979
- { internalType: "string", name: "metadata", type: "string" },
6980
- { internalType: "bool", name: "isSecured", type: "bool" },
6981
- {
6982
- internalType: "enum ACPTypes.JobPhase",
6983
- name: "nextPhase",
6984
- type: "uint8"
6985
- },
6986
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
6987
- {
6988
- internalType: "enum ACPTypes.MemoState",
6989
- name: "state",
6990
- type: "uint8"
6991
- }
6992
- ],
6993
- internalType: "struct ACPTypes.Memo[]",
6994
- name: "memoArray",
6995
- type: "tuple[]"
6996
- },
6997
- { internalType: "uint256", name: "total", type: "uint256" }
6998
- ],
6999
- stateMutability: "view",
7000
- type: "function"
7001
- },
7002
- {
7003
- inputs: [],
7004
- name: "getLocalEid",
7005
- outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
7006
- stateMutability: "view",
7007
- type: "function"
7008
- },
7009
- {
7010
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7011
- name: "getMemo",
7012
- outputs: [
7013
- {
7014
- components: [
7015
- { internalType: "uint256", name: "id", type: "uint256" },
7016
- { internalType: "uint256", name: "jobId", type: "uint256" },
7017
- { internalType: "address", name: "sender", type: "address" },
7018
- { internalType: "string", name: "content", type: "string" },
7019
- {
7020
- internalType: "enum ACPTypes.MemoType",
7021
- name: "memoType",
7022
- type: "uint8"
7023
- },
7024
- { internalType: "uint256", name: "createdAt", type: "uint256" },
7025
- { internalType: "bool", name: "isApproved", type: "bool" },
7026
- { internalType: "address", name: "approvedBy", type: "address" },
7027
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
7028
- { internalType: "bool", name: "requiresApproval", type: "bool" },
7029
- { internalType: "string", name: "metadata", type: "string" },
7030
- { internalType: "bool", name: "isSecured", type: "bool" },
7031
- {
7032
- internalType: "enum ACPTypes.JobPhase",
7033
- name: "nextPhase",
7034
- type: "uint8"
7035
- },
7036
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7037
- {
7038
- internalType: "enum ACPTypes.MemoState",
7039
- name: "state",
7040
- type: "uint8"
7041
- }
7042
- ],
7043
- internalType: "struct ACPTypes.Memo",
7044
- name: "",
7045
- type: "tuple"
7046
- }
7047
- ],
7048
- stateMutability: "view",
7049
- type: "function"
7050
- },
7051
- {
7052
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7053
- name: "getMemoApprovalStatus",
7054
- outputs: [
7055
- { internalType: "bool", name: "isApproved", type: "bool" },
7056
- { internalType: "address", name: "approvedBy", type: "address" },
7057
- { internalType: "uint256", name: "approvedAt", type: "uint256" }
7058
- ],
7059
- stateMutability: "view",
7060
- type: "function"
7061
- },
7062
- {
7063
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7064
- name: "getMemoWithPayableDetails",
7065
- outputs: [
7066
- {
7067
- components: [
7068
- { internalType: "uint256", name: "id", type: "uint256" },
7069
- { internalType: "uint256", name: "jobId", type: "uint256" },
7070
- { internalType: "address", name: "sender", type: "address" },
7071
- { internalType: "string", name: "content", type: "string" },
7072
- {
7073
- internalType: "enum ACPTypes.MemoType",
7074
- name: "memoType",
7075
- type: "uint8"
7076
- },
7077
- { internalType: "uint256", name: "createdAt", type: "uint256" },
7078
- { internalType: "bool", name: "isApproved", type: "bool" },
7079
- { internalType: "address", name: "approvedBy", type: "address" },
7080
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
7081
- { internalType: "bool", name: "requiresApproval", type: "bool" },
7082
- { internalType: "string", name: "metadata", type: "string" },
7083
- { internalType: "bool", name: "isSecured", type: "bool" },
7084
- {
7085
- internalType: "enum ACPTypes.JobPhase",
7086
- name: "nextPhase",
7087
- type: "uint8"
7088
- },
7089
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7090
- {
7091
- internalType: "enum ACPTypes.MemoState",
7092
- name: "state",
7093
- type: "uint8"
7094
- }
7095
- ],
7096
- internalType: "struct ACPTypes.Memo",
7097
- name: "memo",
7098
- type: "tuple"
7099
- },
7100
- {
7101
- components: [
7102
- { internalType: "address", name: "token", type: "address" },
7103
- { internalType: "uint256", name: "amount", type: "uint256" },
7104
- { internalType: "address", name: "recipient", type: "address" },
7105
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
7106
- {
7107
- internalType: "enum ACPTypes.FeeType",
7108
- name: "feeType",
7109
- type: "uint8"
7110
- },
7111
- { internalType: "bool", name: "isExecuted", type: "bool" },
7112
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7113
- { internalType: "uint32", name: "lzSrcEid", type: "uint32" },
7114
- { internalType: "uint32", name: "lzDstEid", type: "uint32" }
7115
- ],
7116
- internalType: "struct ACPTypes.PayableDetails",
7117
- name: "details",
7118
- type: "tuple"
7119
- }
7120
- ],
7121
- stateMutability: "view",
7122
- type: "function"
7123
- },
7124
- {
7125
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7126
- name: "getPayableDetails",
7127
- outputs: [
7128
- {
7129
- components: [
7130
- { internalType: "address", name: "token", type: "address" },
7131
- { internalType: "uint256", name: "amount", type: "uint256" },
7132
- { internalType: "address", name: "recipient", type: "address" },
7133
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
7134
- {
7135
- internalType: "enum ACPTypes.FeeType",
7136
- name: "feeType",
7137
- type: "uint8"
7138
- },
7139
- { internalType: "bool", name: "isExecuted", type: "bool" },
7140
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7141
- { internalType: "uint32", name: "lzSrcEid", type: "uint32" },
7142
- { internalType: "uint32", name: "lzDstEid", type: "uint32" }
7143
- ],
7144
- internalType: "struct ACPTypes.PayableDetails",
7145
- name: "",
7146
- type: "tuple"
7147
- }
7148
- ],
7149
- stateMutability: "view",
7150
- type: "function"
7151
- },
7152
- {
7153
- inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
7154
- name: "getRoleAdmin",
7155
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
7156
- stateMutability: "view",
7157
- type: "function"
7158
- },
7159
- {
7160
- inputs: [
7161
- { internalType: "bytes32", name: "role", type: "bytes32" },
7162
- { internalType: "address", name: "account", type: "address" }
7163
- ],
7164
- name: "grantRole",
7165
- outputs: [],
7166
- stateMutability: "nonpayable",
7167
- type: "function"
7168
- },
7169
- {
7170
- inputs: [
7171
- { internalType: "bytes32", name: "role", type: "bytes32" },
7172
- { internalType: "address", name: "account", type: "address" }
7173
- ],
7174
- name: "hasRole",
7175
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7176
- stateMutability: "view",
7177
- type: "function"
7178
- },
7179
- {
7180
- inputs: [
7181
- { internalType: "address", name: "acpContract_", type: "address" },
7182
- { internalType: "address", name: "jobManager_", type: "address" },
7183
- { internalType: "address", name: "paymentManager_", type: "address" }
7184
- ],
7185
- name: "initialize",
7186
- outputs: [],
7187
- stateMutability: "nonpayable",
7188
- type: "function"
7189
- },
7190
- {
7191
- inputs: [
7192
- { internalType: "uint256", name: "jobId", type: "uint256" },
7193
- { internalType: "address", name: "user", type: "address" }
7194
- ],
7195
- name: "isJobEvaluator",
7196
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7197
- stateMutability: "view",
7198
- type: "function"
7199
- },
7200
- {
7201
- inputs: [
7202
- { internalType: "uint256", name: "memoId", type: "uint256" },
7203
- { internalType: "address", name: "user", type: "address" }
7204
- ],
7205
- name: "isMemoSigner",
7206
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7207
- stateMutability: "view",
7208
- type: "function"
7209
- },
7210
- {
7211
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7212
- name: "isPayable",
7213
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7214
- stateMutability: "view",
7215
- type: "function"
7216
- },
7217
- {
7218
- inputs: [],
7219
- name: "jobManager",
7220
- outputs: [{ internalType: "address", name: "", type: "address" }],
7221
- stateMutability: "view",
7222
- type: "function"
7223
- },
7224
- {
7225
- inputs: [
7226
- { internalType: "uint256", name: "", type: "uint256" },
7227
- { internalType: "uint256", name: "", type: "uint256" }
7228
- ],
7229
- name: "jobMemos",
7230
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7231
- stateMutability: "view",
7232
- type: "function"
7233
- },
7234
- {
7235
- inputs: [
7236
- { internalType: "uint256", name: "", type: "uint256" },
7237
- { internalType: "enum ACPTypes.JobPhase", name: "", type: "uint8" },
7238
- { internalType: "uint256", name: "", type: "uint256" }
7239
- ],
7240
- name: "jobMemosByPhase",
7241
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7242
- stateMutability: "view",
7243
- type: "function"
7244
- },
7245
- {
7246
- inputs: [
7247
- { internalType: "uint256", name: "", type: "uint256" },
7248
- { internalType: "enum ACPTypes.MemoType", name: "", type: "uint8" },
7249
- { internalType: "uint256", name: "", type: "uint256" }
7250
- ],
7251
- name: "jobMemosByType",
7252
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7253
- stateMutability: "view",
7254
- type: "function"
7255
- },
7256
- {
7257
- inputs: [
7258
- { internalType: "uint256", name: "", type: "uint256" },
7259
- { internalType: "address", name: "", type: "address" }
7260
- ],
7261
- name: "memoApprovals",
7262
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7263
- stateMutability: "view",
7264
- type: "function"
7265
- },
7266
- {
7267
- inputs: [],
7268
- name: "memoCounter",
7269
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7270
- stateMutability: "view",
7271
- type: "function"
7272
- },
7273
- {
7274
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7275
- name: "memos",
7276
- outputs: [
7277
- { internalType: "uint256", name: "id", type: "uint256" },
7278
- { internalType: "uint256", name: "jobId", type: "uint256" },
7279
- { internalType: "address", name: "sender", type: "address" },
7280
- { internalType: "string", name: "content", type: "string" },
7281
- {
7282
- internalType: "enum ACPTypes.MemoType",
7283
- name: "memoType",
7284
- type: "uint8"
7285
- },
7286
- { internalType: "uint256", name: "createdAt", type: "uint256" },
7287
- { internalType: "bool", name: "isApproved", type: "bool" },
7288
- { internalType: "address", name: "approvedBy", type: "address" },
7289
- { internalType: "uint256", name: "approvedAt", type: "uint256" },
7290
- { internalType: "bool", name: "requiresApproval", type: "bool" },
7291
- { internalType: "string", name: "metadata", type: "string" },
7292
- { internalType: "bool", name: "isSecured", type: "bool" },
7293
- {
7294
- internalType: "enum ACPTypes.JobPhase",
7295
- name: "nextPhase",
7296
- type: "uint8"
7297
- },
7298
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7299
- { internalType: "enum ACPTypes.MemoState", name: "state", type: "uint8" }
7300
- ],
7301
- stateMutability: "view",
7302
- type: "function"
7303
- },
7304
- {
7305
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7306
- name: "payableDetails",
7307
- outputs: [
7308
- { internalType: "address", name: "token", type: "address" },
7309
- { internalType: "uint256", name: "amount", type: "uint256" },
7310
- { internalType: "address", name: "recipient", type: "address" },
7311
- { internalType: "uint256", name: "feeAmount", type: "uint256" },
7312
- { internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
7313
- { internalType: "bool", name: "isExecuted", type: "bool" },
7314
- { internalType: "uint256", name: "expiredAt", type: "uint256" },
7315
- { internalType: "uint32", name: "lzSrcEid", type: "uint32" },
7316
- { internalType: "uint32", name: "lzDstEid", type: "uint32" }
7317
- ],
7318
- stateMutability: "view",
7319
- type: "function"
7320
- },
7321
- {
7322
- inputs: [],
7323
- name: "paymentManager",
7324
- outputs: [{ internalType: "address", name: "", type: "address" }],
7325
- stateMutability: "view",
7326
- type: "function"
7327
- },
7328
- {
7329
- inputs: [],
7330
- name: "proxiableUUID",
7331
- outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
7332
- stateMutability: "view",
7333
- type: "function"
7334
- },
7335
- {
7336
- inputs: [
7337
- { internalType: "bytes32", name: "role", type: "bytes32" },
7338
- { internalType: "address", name: "callerConfirmation", type: "address" }
7339
- ],
7340
- name: "renounceRole",
7341
- outputs: [],
7342
- stateMutability: "nonpayable",
7343
- type: "function"
7344
- },
7345
- {
7346
- inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7347
- name: "requiredApprovals",
7348
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7349
- stateMutability: "view",
7350
- type: "function"
7351
- },
7352
- {
7353
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7354
- name: "requiresApproval",
7355
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7356
- stateMutability: "view",
7357
- type: "function"
7358
- },
7359
- {
7360
- inputs: [
7361
- { internalType: "bytes32", name: "role", type: "bytes32" },
7362
- { internalType: "address", name: "account", type: "address" }
7363
- ],
7364
- name: "revokeRole",
7365
- outputs: [],
7366
- stateMutability: "nonpayable",
7367
- type: "function"
7368
- },
7369
- {
7370
- inputs: [
7371
- {
7372
- internalType: "enum ACPTypes.MemoType",
7373
- name: "memoType",
7374
- type: "uint8"
7375
- },
7376
- { internalType: "uint256", name: "requiredApprovals_", type: "uint256" }
7377
- ],
7378
- name: "setApprovalRequirements",
7379
- outputs: [],
7380
- stateMutability: "nonpayable",
7381
- type: "function"
7382
- },
7383
- {
7384
- inputs: [
7385
- { internalType: "address", name: "assetManager_", type: "address" }
7386
- ],
7387
- name: "setAssetManager",
7388
- outputs: [],
7389
- stateMutability: "nonpayable",
7390
- type: "function"
7391
- },
7392
- {
7393
- inputs: [
7394
- { internalType: "uint256", name: "memoId", type: "uint256" },
7395
- { internalType: "address", name: "sender", type: "address" },
7396
- { internalType: "bool", name: "isApproved", type: "bool" },
7397
- { internalType: "string", name: "reason", type: "string" }
7398
- ],
7399
- name: "signMemo",
7400
- outputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
7401
- stateMutability: "nonpayable",
7402
- type: "function"
7403
- },
7404
- {
7405
- inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
7406
- name: "supportsInterface",
7407
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
7408
- stateMutability: "view",
7409
- type: "function"
7410
- },
7411
- {
7412
- inputs: [
7413
- { internalType: "address", name: "acpContract_", type: "address" },
7414
- { internalType: "address", name: "jobManager_", type: "address" },
7415
- { internalType: "address", name: "paymentManager_", type: "address" },
7416
- { internalType: "address", name: "assetManager_", type: "address" }
7417
- ],
7418
- name: "updateContracts",
7419
- outputs: [],
7420
- stateMutability: "nonpayable",
7421
- type: "function"
7422
- },
7423
- {
7424
- inputs: [
7425
- { internalType: "uint256", name: "memoId", type: "uint256" },
7426
- { internalType: "string", name: "newContent", type: "string" }
7427
- ],
7428
- name: "updateMemoContent",
7429
- outputs: [],
7430
- stateMutability: "nonpayable",
7431
- type: "function"
7432
- },
7433
- {
7434
- inputs: [
7435
- { internalType: "uint256", name: "memoId", type: "uint256" },
7436
- {
7437
- internalType: "enum ACPTypes.MemoState",
7438
- name: "newMemoState",
7439
- type: "uint8"
7440
- }
7441
- ],
7442
- name: "updateMemoState",
7443
- outputs: [],
7444
- stateMutability: "nonpayable",
7445
- type: "function"
7446
- },
7447
- {
7448
- inputs: [
7449
- { internalType: "address", name: "newImplementation", type: "address" },
7450
- { internalType: "bytes", name: "data", type: "bytes" }
7451
- ],
7452
- name: "upgradeToAndCall",
7453
- outputs: [],
7454
- stateMutability: "payable",
7455
- type: "function"
7456
- },
7457
- {
7458
- inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
7459
- name: "withdrawEscrowedFunds",
7460
- outputs: [],
7461
- stateMutability: "nonpayable",
7462
- type: "function"
7463
- }
7464
- ];
7465
- var memoManagerAbi_default = MEMO_MANAGER_ABI;
7466
-
7467
- // src/contractClients/acpContractClientV2.ts
7468
- var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
7469
- constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
7470
- super(agentWalletAddress, config);
7471
- this.jobManagerAddress = jobManagerAddress;
7472
- this.memoManagerAddress = memoManagerAddress;
7473
- this.accountManagerAddress = accountManagerAddress;
7474
- this.PRIORITY_FEE_MULTIPLIER = 2;
7475
- this.MAX_FEE_PER_GAS = 2e7;
7476
- this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
7477
- this.GAS_FEE_MULTIPLIER = 0.5;
7478
- this._sessionKeyClients = {};
7479
- }
7480
- static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
7481
- const publicClients = {};
7482
- for (const chain of config.chains) {
7483
- publicClients[chain.chain.id] = (0, import_viem9.createPublicClient)({
7484
- chain: chain.chain,
7485
- transport: (0, import_viem9.http)(chain.rpcUrl)
7486
- });
7487
- }
7488
- const publicClient = (0, import_viem9.createPublicClient)({
7489
- chain: config.chain,
7490
- transport: (0, import_viem9.http)(config.rpcEndpoint)
7491
- });
7492
- const [jobManagerAddress, memoManagerAddress, accountManagerAddress] = await publicClient.multicall({
7493
- contracts: [
7494
- {
7495
- address: config.contractAddress,
7496
- abi: config.abi,
7497
- functionName: "jobManager"
7498
- },
7499
- {
7500
- address: config.contractAddress,
7501
- abi: config.abi,
7502
- functionName: "memoManager"
7503
- },
7504
- {
7505
- address: config.contractAddress,
7506
- abi: config.abi,
7507
- functionName: "accountManager"
7508
- }
7509
- ]
7510
- });
7511
- if (!jobManagerAddress || !memoManagerAddress || !accountManagerAddress) {
7512
- throw new acpError_default(
7513
- "Failed to get job manager, memo manager, or account manager address"
7514
- );
7515
- }
7516
- const acpContractClient = new _AcpContractClientV2(
7517
- jobManagerAddress.result,
7518
- memoManagerAddress.result,
7519
- accountManagerAddress.result,
7520
- agentWalletAddress,
7521
- config
7522
- );
7523
- acpContractClient.publicClients = publicClients;
7524
- await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
7525
- return acpContractClient;
7526
- }
7527
- async init(privateKey, sessionEntityKeyId) {
7528
- const sessionKeySigner = import_core2.LocalAccountSigner.privateKeyToAccountSigner(privateKey);
7529
- this._sessionKeyClient = await (0, import_smart_contracts2.createModularAccountV2Client)({
7530
- chain: this.chain,
7531
- transport: (0, import_infra3.alchemy)({
7532
- rpcUrl: this.config.alchemyRpcUrl
7533
- }),
7534
- signer: sessionKeySigner,
7535
- policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
7536
- accountAddress: this.agentWalletAddress,
7537
- signerEntity: {
7538
- entityId: sessionEntityKeyId,
7539
- isGlobalValidation: true
6063
+ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
6064
+ constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
6065
+ super(agentWalletAddress, config);
6066
+ this.jobManagerAddress = jobManagerAddress;
6067
+ this.memoManagerAddress = memoManagerAddress;
6068
+ this.accountManagerAddress = accountManagerAddress;
6069
+ this.PRIORITY_FEE_MULTIPLIER = 2;
6070
+ this.MAX_FEE_PER_GAS = 2e7;
6071
+ this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
6072
+ }
6073
+ static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
6074
+ const publicClient = (0, import_viem7.createPublicClient)({
6075
+ chain: config.chain,
6076
+ transport: (0, import_viem7.http)(config.rpcEndpoint)
6077
+ });
6078
+ const [jobManagerAddress, memoManagerAddress, accountManagerAddress] = await publicClient.multicall({
6079
+ contracts: [
6080
+ {
6081
+ address: config.contractAddress,
6082
+ abi: config.abi,
6083
+ functionName: "jobManager"
6084
+ },
6085
+ {
6086
+ address: config.contractAddress,
6087
+ abi: config.abi,
6088
+ functionName: "memoManager"
6089
+ },
6090
+ {
6091
+ address: config.contractAddress,
6092
+ abi: config.abi,
6093
+ functionName: "accountManager"
6094
+ }
6095
+ ]
6096
+ });
6097
+ if (!jobManagerAddress || !memoManagerAddress || !accountManagerAddress) {
6098
+ throw new acpError_default(
6099
+ "Failed to get job manager, memo manager, or account manager address"
6100
+ );
6101
+ }
6102
+ const acpContractClient = new _AcpContractClientV2(
6103
+ jobManagerAddress.result,
6104
+ memoManagerAddress.result,
6105
+ accountManagerAddress.result,
6106
+ agentWalletAddress,
6107
+ config
6108
+ );
6109
+ await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
6110
+ return acpContractClient;
6111
+ }
6112
+ async init(privateKey, sessionEntityKeyId) {
6113
+ const sessionKeySigner = import_core2.LocalAccountSigner.privateKeyToAccountSigner(privateKey);
6114
+ this._sessionKeyClient = await (0, import_smart_contracts2.createModularAccountV2Client)({
6115
+ chain: this.chain,
6116
+ transport: (0, import_infra3.alchemy)({
6117
+ rpcUrl: this.config.alchemyRpcUrl
6118
+ }),
6119
+ signer: sessionKeySigner,
6120
+ policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
6121
+ accountAddress: this.agentWalletAddress,
6122
+ signerEntity: {
6123
+ entityId: sessionEntityKeyId,
6124
+ isGlobalValidation: true
7540
6125
  }
7541
6126
  });
7542
- for (const chain of this.config.chains) {
7543
- this._sessionKeyClients[chain.chain.id] = await (0, import_smart_contracts2.createModularAccountV2Client)({
7544
- chain: chain.chain,
7545
- transport: (0, import_infra3.alchemy)({
7546
- rpcUrl: `${this.config.alchemyRpcUrl}?chainId=${chain.chain.id}`
7547
- }),
7548
- signer: sessionKeySigner,
7549
- policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
7550
- accountAddress: this.agentWalletAddress,
7551
- signerEntity: {
7552
- entityId: sessionEntityKeyId,
7553
- isGlobalValidation: true
7554
- }
7555
- });
7556
- }
7557
6127
  this._acpX402 = new AcpX402(
7558
6128
  this.config,
7559
6129
  this.sessionKeyClient,
@@ -7566,10 +6136,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7566
6136
  `ACP Contract Client validation failed: agent account ${this.agentWalletAddress} is not deployed on-chain`
7567
6137
  );
7568
6138
  }
7569
- await this.validateSessionKeyOnChain(
7570
- sessionSignerAddress,
7571
- sessionEntityKeyId
7572
- );
6139
+ await this.validateSessionKeyOnChain(sessionSignerAddress, sessionEntityKeyId);
7573
6140
  console.log("Connected to ACP:", {
7574
6141
  agentWalletAddress: this.agentWalletAddress,
7575
6142
  whitelistedWalletAddress: sessionSignerAddress,
@@ -7597,20 +6164,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7597
6164
  }
7598
6165
  return this._acpX402;
7599
6166
  }
7600
- async calculateGasFees(chainId) {
7601
- if (chainId) {
7602
- const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
7603
- const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
7604
- return increasedMaxFeePerGas;
7605
- }
6167
+ async calculateGasFees() {
7606
6168
  const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
7607
6169
  return finalMaxFeePerGas;
7608
6170
  }
7609
- async handleOperation(operations, chainId) {
7610
- const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
7611
- if (!sessionKeyClient) {
7612
- throw new acpError_default("Session key client not initialized");
7613
- }
6171
+ async handleOperation(operations) {
7614
6172
  const payload = {
7615
6173
  uo: operations.map((operation) => ({
7616
6174
  target: operation.contractAddress,
@@ -7631,21 +6189,16 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7631
6189
  maxFeePerGas: `0x${gasFees.toString(16)}`
7632
6190
  };
7633
6191
  }
7634
- const { hash } = await sessionKeyClient.sendUserOperation(payload);
7635
- const checkTransactionConfig = {
6192
+ const { hash } = await this.sessionKeyClient.sendUserOperation(payload);
6193
+ const txnHash = await this.sessionKeyClient.waitForUserOperationTransaction({
7636
6194
  hash,
6195
+ tag: "pending",
7637
6196
  retries: {
7638
6197
  intervalMs: 200,
7639
6198
  multiplier: 1.1,
7640
6199
  maxRetries: 10
7641
6200
  }
7642
- };
7643
- if (!chainId || chainId === import_chains3.baseSepolia.id || chainId === import_chains3.base.id) {
7644
- checkTransactionConfig["tag"] = "pending";
7645
- }
7646
- const txnHash = await sessionKeyClient.waitForUserOperationTransaction(
7647
- checkTransactionConfig
7648
- );
6201
+ });
7649
6202
  return { userOpHash: hash, txnHash };
7650
6203
  } catch (error) {
7651
6204
  retries -= 1;
@@ -7669,7 +6222,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7669
6222
  const contractLogs = result.logs.filter((log) => {
7670
6223
  return log.address.toLowerCase() === this.jobManagerAddress.toLowerCase();
7671
6224
  }).map(
7672
- (log) => (0, import_viem9.decodeEventLog)({
6225
+ (log) => (0, import_viem7.decodeEventLog)({
7673
6226
  abi: jobManagerAbi_default,
7674
6227
  data: log.data,
7675
6228
  topics: log.topics
@@ -7708,13 +6261,6 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7708
6261
  throw new acpError_default("Failed to get X402 payment details", error);
7709
6262
  }
7710
6263
  }
7711
- async getAssetManager() {
7712
- return await this.publicClient.readContract({
7713
- address: this.memoManagerAddress,
7714
- abi: memoManagerAbi_default,
7715
- functionName: "assetManager"
7716
- });
7717
- }
7718
6264
  getAcpVersion() {
7719
6265
  return "2";
7720
6266
  }
@@ -7735,7 +6281,6 @@ var index_default = acpClient_default;
7735
6281
  AcpJob,
7736
6282
  AcpJobPhases,
7737
6283
  AcpMemo,
7738
- AcpMemoState,
7739
6284
  AcpMemoStatus,
7740
6285
  AcpOnlineStatus,
7741
6286
  BaseAcpContractClient,
@@ -7751,7 +6296,6 @@ var index_default = acpClient_default;
7751
6296
  baseAcpX402ConfigV2,
7752
6297
  baseSepoliaAcpConfig,
7753
6298
  baseSepoliaAcpConfigV2,
7754
- baseSepoliaAcpX402ConfigV2,
7755
6299
  ethFare,
7756
6300
  preparePayload,
7757
6301
  wethFare