@virtuals-protocol/acp-node 0.3.0-beta.26 → 0.3.0-beta.27
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 +75 -54
- package/dist/index.d.ts +75 -54
- package/dist/index.js +1700 -144
- package/dist/index.mjs +1715 -136
- package/package.json +1 -1
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.
|
|
38
|
+
version: "0.3.0-beta.27",
|
|
39
39
|
main: "./dist/index.js",
|
|
40
40
|
module: "./dist/index.mjs",
|
|
41
41
|
types: "./dist/index.d.ts",
|
|
@@ -95,6 +95,7 @@ __export(index_exports, {
|
|
|
95
95
|
AcpJob: () => acpJob_default,
|
|
96
96
|
AcpJobPhases: () => AcpJobPhases,
|
|
97
97
|
AcpMemo: () => acpMemo_default,
|
|
98
|
+
AcpMemoState: () => AcpMemoState,
|
|
98
99
|
AcpMemoStatus: () => AcpMemoStatus,
|
|
99
100
|
AcpOnlineStatus: () => AcpOnlineStatus,
|
|
100
101
|
BaseAcpContractClient: () => baseAcpContractClient_default,
|
|
@@ -108,6 +109,7 @@ __export(index_exports, {
|
|
|
108
109
|
baseAcpX402ConfigV2: () => baseAcpX402ConfigV2,
|
|
109
110
|
baseSepoliaAcpConfig: () => baseSepoliaAcpConfig,
|
|
110
111
|
baseSepoliaAcpConfigV2: () => baseSepoliaAcpConfigV2,
|
|
112
|
+
baseSepoliaAcpX402ConfigV2: () => baseSepoliaAcpX402ConfigV2,
|
|
111
113
|
default: () => index_default,
|
|
112
114
|
ethFare: () => ethFare,
|
|
113
115
|
preparePayload: () => preparePayload,
|
|
@@ -1286,7 +1288,7 @@ var ACP_ABI = [
|
|
|
1286
1288
|
var acpAbi_default = ACP_ABI;
|
|
1287
1289
|
|
|
1288
1290
|
// src/acpClient.ts
|
|
1289
|
-
var
|
|
1291
|
+
var import_viem6 = require("viem");
|
|
1290
1292
|
var import_socket = require("socket.io-client");
|
|
1291
1293
|
var import_jwt_decode = require("jwt-decode");
|
|
1292
1294
|
|
|
@@ -1316,27 +1318,42 @@ var acpError_default = AcpError;
|
|
|
1316
1318
|
|
|
1317
1319
|
// src/acpFare.ts
|
|
1318
1320
|
var Fare = class _Fare {
|
|
1319
|
-
constructor(contractAddress, decimals) {
|
|
1321
|
+
constructor(contractAddress, decimals, chainId) {
|
|
1320
1322
|
this.contractAddress = contractAddress;
|
|
1321
1323
|
this.decimals = decimals;
|
|
1324
|
+
this.chainId = chainId;
|
|
1322
1325
|
}
|
|
1323
1326
|
formatAmount(amount) {
|
|
1324
1327
|
return (0, import_viem.parseUnits)(amount.toString(), this.decimals);
|
|
1325
1328
|
}
|
|
1326
|
-
static async fromContractAddress(contractAddress, config = baseAcpConfig) {
|
|
1329
|
+
static async fromContractAddress(contractAddress, config = baseAcpConfig, chainId = config.chain.id) {
|
|
1327
1330
|
if (contractAddress === config.baseFare.contractAddress) {
|
|
1328
1331
|
return config.baseFare;
|
|
1329
1332
|
}
|
|
1333
|
+
let chainConfig = config.chain;
|
|
1334
|
+
let rpcUrl = config.rpcEndpoint;
|
|
1335
|
+
if (chainId !== config.chain.id) {
|
|
1336
|
+
const selectedChainConfig = config.chains.find(
|
|
1337
|
+
(chain) => chain.id === chainId
|
|
1338
|
+
);
|
|
1339
|
+
if (!selectedChainConfig) {
|
|
1340
|
+
throw new acpError_default(
|
|
1341
|
+
`Chain configuration for chainId ${chainId} not found.`
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
chainConfig = selectedChainConfig;
|
|
1345
|
+
rpcUrl = `${config.alchemyRpcUrl}?chainId=${chainId}`;
|
|
1346
|
+
}
|
|
1330
1347
|
const publicClient = (0, import_viem.createPublicClient)({
|
|
1331
|
-
chain:
|
|
1332
|
-
transport: (0, import_viem.http)(
|
|
1348
|
+
chain: chainConfig,
|
|
1349
|
+
transport: (0, import_viem.http)(rpcUrl)
|
|
1333
1350
|
});
|
|
1334
1351
|
const decimals = await publicClient.readContract({
|
|
1335
1352
|
address: contractAddress,
|
|
1336
1353
|
abi: import_viem.erc20Abi,
|
|
1337
1354
|
functionName: "decimals"
|
|
1338
1355
|
});
|
|
1339
|
-
return new _Fare(contractAddress, decimals);
|
|
1356
|
+
return new _Fare(contractAddress, decimals, chainId);
|
|
1340
1357
|
}
|
|
1341
1358
|
};
|
|
1342
1359
|
var FareAmountBase = class {
|
|
@@ -1755,6 +1772,34 @@ var ACP_V2_ABI = [
|
|
|
1755
1772
|
stateMutability: "nonpayable",
|
|
1756
1773
|
type: "function"
|
|
1757
1774
|
},
|
|
1775
|
+
{
|
|
1776
|
+
inputs: [
|
|
1777
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
1778
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
1779
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
1780
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
1781
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
1782
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
1783
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
1784
|
+
{
|
|
1785
|
+
internalType: "enum ACPTypes.MemoType",
|
|
1786
|
+
name: "memoType",
|
|
1787
|
+
type: "uint8"
|
|
1788
|
+
},
|
|
1789
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1790
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
1791
|
+
{
|
|
1792
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
1793
|
+
name: "nextPhase",
|
|
1794
|
+
type: "uint8"
|
|
1795
|
+
},
|
|
1796
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
1797
|
+
],
|
|
1798
|
+
name: "createCrossChainPayableMemo",
|
|
1799
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1800
|
+
stateMutability: "nonpayable",
|
|
1801
|
+
type: "function"
|
|
1802
|
+
},
|
|
1758
1803
|
{
|
|
1759
1804
|
inputs: [
|
|
1760
1805
|
{ internalType: "address", name: "provider", type: "address" },
|
|
@@ -1939,7 +1984,12 @@ var ACP_V2_ABI = [
|
|
|
1939
1984
|
name: "nextPhase",
|
|
1940
1985
|
type: "uint8"
|
|
1941
1986
|
},
|
|
1942
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
1987
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1988
|
+
{
|
|
1989
|
+
internalType: "enum ACPTypes.MemoState",
|
|
1990
|
+
name: "state",
|
|
1991
|
+
type: "uint8"
|
|
1992
|
+
}
|
|
1943
1993
|
],
|
|
1944
1994
|
internalType: "struct ACPTypes.Memo[]",
|
|
1945
1995
|
name: "memos",
|
|
@@ -1986,7 +2036,12 @@ var ACP_V2_ABI = [
|
|
|
1986
2036
|
name: "nextPhase",
|
|
1987
2037
|
type: "uint8"
|
|
1988
2038
|
},
|
|
1989
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
2039
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
2040
|
+
{
|
|
2041
|
+
internalType: "enum ACPTypes.MemoState",
|
|
2042
|
+
name: "state",
|
|
2043
|
+
type: "uint8"
|
|
2044
|
+
}
|
|
1990
2045
|
],
|
|
1991
2046
|
internalType: "struct ACPTypes.Memo[]",
|
|
1992
2047
|
name: "memos",
|
|
@@ -2029,7 +2084,12 @@ var ACP_V2_ABI = [
|
|
|
2029
2084
|
name: "nextPhase",
|
|
2030
2085
|
type: "uint8"
|
|
2031
2086
|
},
|
|
2032
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
2087
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
2088
|
+
{
|
|
2089
|
+
internalType: "enum ACPTypes.MemoState",
|
|
2090
|
+
name: "state",
|
|
2091
|
+
type: "uint8"
|
|
2092
|
+
}
|
|
2033
2093
|
],
|
|
2034
2094
|
internalType: "struct ACPTypes.Memo[]",
|
|
2035
2095
|
name: "memos",
|
|
@@ -2284,8 +2344,27 @@ var acpAbiV2_default = ACP_V2_ABI;
|
|
|
2284
2344
|
// src/configs/acpConfigs.ts
|
|
2285
2345
|
var V1_MAX_RETRIES = 10;
|
|
2286
2346
|
var V2_MAX_RETRIES = 3;
|
|
2347
|
+
var TESTNET_CHAINS = [
|
|
2348
|
+
import_infra.baseSepolia,
|
|
2349
|
+
import_infra.sepolia,
|
|
2350
|
+
import_infra.polygonAmoy,
|
|
2351
|
+
import_infra.arbitrumSepolia,
|
|
2352
|
+
import_infra.bscTestnet
|
|
2353
|
+
];
|
|
2354
|
+
var MAINNET_CHAINS = [
|
|
2355
|
+
import_infra.base,
|
|
2356
|
+
import_infra.mainnet,
|
|
2357
|
+
import_infra.polygon,
|
|
2358
|
+
import_infra.arbitrum,
|
|
2359
|
+
import_infra.bsc
|
|
2360
|
+
];
|
|
2361
|
+
var DEFAULT_RETRY_CONFIG = {
|
|
2362
|
+
intervalMs: 200,
|
|
2363
|
+
multiplier: 1.1,
|
|
2364
|
+
maxRetries: 10
|
|
2365
|
+
};
|
|
2287
2366
|
var AcpContractConfig2 = class {
|
|
2288
|
-
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, retryConfig) {
|
|
2367
|
+
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, retryConfig, chains = []) {
|
|
2289
2368
|
this.chain = chain;
|
|
2290
2369
|
this.contractAddress = contractAddress;
|
|
2291
2370
|
this.baseFare = baseFare;
|
|
@@ -2296,6 +2375,7 @@ var AcpContractConfig2 = class {
|
|
|
2296
2375
|
this.rpcEndpoint = rpcEndpoint;
|
|
2297
2376
|
this.x402Config = x402Config;
|
|
2298
2377
|
this.retryConfig = retryConfig;
|
|
2378
|
+
this.chains = chains;
|
|
2299
2379
|
}
|
|
2300
2380
|
};
|
|
2301
2381
|
var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
@@ -2307,7 +2387,9 @@ var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
|
2307
2387
|
acpAbi_default,
|
|
2308
2388
|
V1_MAX_RETRIES,
|
|
2309
2389
|
void 0,
|
|
2310
|
-
void 0
|
|
2390
|
+
void 0,
|
|
2391
|
+
DEFAULT_RETRY_CONFIG,
|
|
2392
|
+
TESTNET_CHAINS
|
|
2311
2393
|
);
|
|
2312
2394
|
var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
2313
2395
|
import_infra.baseSepolia,
|
|
@@ -2320,7 +2402,9 @@ var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
|
2320
2402
|
void 0,
|
|
2321
2403
|
{
|
|
2322
2404
|
url: "https://dev-acp-x402.virtuals.io"
|
|
2323
|
-
}
|
|
2405
|
+
},
|
|
2406
|
+
DEFAULT_RETRY_CONFIG,
|
|
2407
|
+
TESTNET_CHAINS
|
|
2324
2408
|
);
|
|
2325
2409
|
var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
2326
2410
|
import_infra.baseSepolia,
|
|
@@ -2331,7 +2415,9 @@ var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
|
2331
2415
|
acpAbiV2_default,
|
|
2332
2416
|
V2_MAX_RETRIES,
|
|
2333
2417
|
void 0,
|
|
2334
|
-
void 0
|
|
2418
|
+
void 0,
|
|
2419
|
+
DEFAULT_RETRY_CONFIG,
|
|
2420
|
+
TESTNET_CHAINS
|
|
2335
2421
|
);
|
|
2336
2422
|
var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2337
2423
|
import_infra.baseSepolia,
|
|
@@ -2344,7 +2430,9 @@ var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
|
2344
2430
|
void 0,
|
|
2345
2431
|
{
|
|
2346
2432
|
url: "https://dev-acp-x402.virtuals.io"
|
|
2347
|
-
}
|
|
2433
|
+
},
|
|
2434
|
+
DEFAULT_RETRY_CONFIG,
|
|
2435
|
+
TESTNET_CHAINS
|
|
2348
2436
|
);
|
|
2349
2437
|
var baseAcpConfig = new AcpContractConfig2(
|
|
2350
2438
|
import_infra.base,
|
|
@@ -2355,7 +2443,9 @@ var baseAcpConfig = new AcpContractConfig2(
|
|
|
2355
2443
|
acpAbi_default,
|
|
2356
2444
|
V1_MAX_RETRIES,
|
|
2357
2445
|
void 0,
|
|
2358
|
-
void 0
|
|
2446
|
+
void 0,
|
|
2447
|
+
DEFAULT_RETRY_CONFIG,
|
|
2448
|
+
MAINNET_CHAINS
|
|
2359
2449
|
);
|
|
2360
2450
|
var baseAcpX402Config = new AcpContractConfig2(
|
|
2361
2451
|
import_infra.base,
|
|
@@ -2368,7 +2458,9 @@ var baseAcpX402Config = new AcpContractConfig2(
|
|
|
2368
2458
|
void 0,
|
|
2369
2459
|
{
|
|
2370
2460
|
url: "https://acp-x402.virtuals.io"
|
|
2371
|
-
}
|
|
2461
|
+
},
|
|
2462
|
+
DEFAULT_RETRY_CONFIG,
|
|
2463
|
+
MAINNET_CHAINS
|
|
2372
2464
|
);
|
|
2373
2465
|
var baseAcpConfigV2 = new AcpContractConfig2(
|
|
2374
2466
|
import_infra.base,
|
|
@@ -2379,7 +2471,9 @@ var baseAcpConfigV2 = new AcpContractConfig2(
|
|
|
2379
2471
|
acpAbiV2_default,
|
|
2380
2472
|
V2_MAX_RETRIES,
|
|
2381
2473
|
void 0,
|
|
2382
|
-
void 0
|
|
2474
|
+
void 0,
|
|
2475
|
+
DEFAULT_RETRY_CONFIG,
|
|
2476
|
+
MAINNET_CHAINS
|
|
2383
2477
|
);
|
|
2384
2478
|
var baseAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2385
2479
|
import_infra.base,
|
|
@@ -2392,7 +2486,9 @@ var baseAcpX402ConfigV2 = new AcpContractConfig2(
|
|
|
2392
2486
|
void 0,
|
|
2393
2487
|
{
|
|
2394
2488
|
url: "https://acp-x402.virtuals.io"
|
|
2395
|
-
}
|
|
2489
|
+
},
|
|
2490
|
+
DEFAULT_RETRY_CONFIG,
|
|
2491
|
+
MAINNET_CHAINS
|
|
2396
2492
|
);
|
|
2397
2493
|
|
|
2398
2494
|
// src/abis/wethAbi.ts
|
|
@@ -3571,6 +3667,7 @@ var BaseAcpContractClient = class {
|
|
|
3571
3667
|
constructor(agentWalletAddress, config = baseAcpConfig) {
|
|
3572
3668
|
this.agentWalletAddress = agentWalletAddress;
|
|
3573
3669
|
this.config = config;
|
|
3670
|
+
this.publicClients = {};
|
|
3574
3671
|
this.chain = config.chain;
|
|
3575
3672
|
this.abi = config.abi;
|
|
3576
3673
|
this.contractAddress = config.contractAddress;
|
|
@@ -3670,12 +3767,12 @@ ${JSON.stringify(
|
|
|
3670
3767
|
throw new acpError_default("Failed to create job", error);
|
|
3671
3768
|
}
|
|
3672
3769
|
}
|
|
3673
|
-
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
3770
|
+
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress, targetAddress) {
|
|
3674
3771
|
try {
|
|
3675
3772
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
3676
3773
|
abi: import_viem2.erc20Abi,
|
|
3677
3774
|
functionName: "approve",
|
|
3678
|
-
args: [this.contractAddress, amountBaseUnit]
|
|
3775
|
+
args: [targetAddress ?? this.contractAddress, amountBaseUnit]
|
|
3679
3776
|
});
|
|
3680
3777
|
const payload = {
|
|
3681
3778
|
data,
|
|
@@ -3714,6 +3811,35 @@ ${JSON.stringify(
|
|
|
3714
3811
|
throw new acpError_default("Failed to create payable memo", error);
|
|
3715
3812
|
}
|
|
3716
3813
|
}
|
|
3814
|
+
createCrossChainPayableMemo(jobId, content, token, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, type, expiredAt, nextPhase, destinationEid, secured = true) {
|
|
3815
|
+
try {
|
|
3816
|
+
const data = (0, import_viem2.encodeFunctionData)({
|
|
3817
|
+
abi: this.abi,
|
|
3818
|
+
functionName: "createCrossChainPayableMemo",
|
|
3819
|
+
args: [
|
|
3820
|
+
jobId,
|
|
3821
|
+
content,
|
|
3822
|
+
token,
|
|
3823
|
+
amountBaseUnit,
|
|
3824
|
+
recipient,
|
|
3825
|
+
feeAmountBaseUnit,
|
|
3826
|
+
feeType,
|
|
3827
|
+
type,
|
|
3828
|
+
Math.floor(expiredAt.getTime() / 1e3),
|
|
3829
|
+
secured,
|
|
3830
|
+
nextPhase,
|
|
3831
|
+
destinationEid
|
|
3832
|
+
]
|
|
3833
|
+
});
|
|
3834
|
+
const payload = {
|
|
3835
|
+
data,
|
|
3836
|
+
contractAddress: this.contractAddress
|
|
3837
|
+
};
|
|
3838
|
+
return payload;
|
|
3839
|
+
} catch (error) {
|
|
3840
|
+
throw new acpError_default("Failed to create cross chain payable memo", error);
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3717
3843
|
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
3718
3844
|
try {
|
|
3719
3845
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
@@ -3730,6 +3856,22 @@ ${JSON.stringify(
|
|
|
3730
3856
|
throw new acpError_default("Failed to create memo", error);
|
|
3731
3857
|
}
|
|
3732
3858
|
}
|
|
3859
|
+
createMemoWithMetadata(jobId, content, type, isSecured, nextPhase, metadata) {
|
|
3860
|
+
try {
|
|
3861
|
+
const data = (0, import_viem2.encodeFunctionData)({
|
|
3862
|
+
abi: this.abi,
|
|
3863
|
+
functionName: "createMemoWithMetadata",
|
|
3864
|
+
args: [jobId, content, type, isSecured, nextPhase, metadata]
|
|
3865
|
+
});
|
|
3866
|
+
const payload = {
|
|
3867
|
+
data,
|
|
3868
|
+
contractAddress: this.contractAddress
|
|
3869
|
+
};
|
|
3870
|
+
return payload;
|
|
3871
|
+
} catch (error) {
|
|
3872
|
+
throw new acpError_default("Failed to create memo with metadata", error);
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3733
3875
|
signMemo(memoId, isApproved, reason) {
|
|
3734
3876
|
try {
|
|
3735
3877
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
@@ -3815,9 +3957,58 @@ ${JSON.stringify(
|
|
|
3815
3957
|
throw new acpError_default("Failed to submit TransferWithAuthorization", error);
|
|
3816
3958
|
}
|
|
3817
3959
|
}
|
|
3960
|
+
async getERC20Balance(chainId, tokenAddress, walletAddress) {
|
|
3961
|
+
const publicClient = this.publicClients[chainId];
|
|
3962
|
+
if (!publicClient) {
|
|
3963
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3964
|
+
}
|
|
3965
|
+
return await publicClient.readContract({
|
|
3966
|
+
address: tokenAddress,
|
|
3967
|
+
abi: import_viem2.erc20Abi,
|
|
3968
|
+
functionName: "balanceOf",
|
|
3969
|
+
args: [walletAddress]
|
|
3970
|
+
});
|
|
3971
|
+
}
|
|
3972
|
+
async getERC20Allowance(chainId, tokenAddress, walletAddress, spenderAddress) {
|
|
3973
|
+
const publicClient = this.publicClients[chainId];
|
|
3974
|
+
if (!publicClient) {
|
|
3975
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3976
|
+
}
|
|
3977
|
+
return await publicClient.readContract({
|
|
3978
|
+
address: tokenAddress,
|
|
3979
|
+
abi: import_viem2.erc20Abi,
|
|
3980
|
+
functionName: "allowance",
|
|
3981
|
+
args: [walletAddress, spenderAddress]
|
|
3982
|
+
});
|
|
3983
|
+
}
|
|
3984
|
+
async getERC20Symbol(chainId, tokenAddress) {
|
|
3985
|
+
const publicClient = this.publicClients[chainId];
|
|
3986
|
+
if (!publicClient) {
|
|
3987
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3988
|
+
}
|
|
3989
|
+
return await publicClient.readContract({
|
|
3990
|
+
address: tokenAddress,
|
|
3991
|
+
abi: import_viem2.erc20Abi,
|
|
3992
|
+
functionName: "symbol"
|
|
3993
|
+
});
|
|
3994
|
+
}
|
|
3995
|
+
async getERC20Decimals(chainId, tokenAddress) {
|
|
3996
|
+
const publicClient = this.publicClients[chainId];
|
|
3997
|
+
if (!publicClient) {
|
|
3998
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3999
|
+
}
|
|
4000
|
+
return await publicClient.readContract({
|
|
4001
|
+
address: tokenAddress,
|
|
4002
|
+
abi: import_viem2.erc20Abi,
|
|
4003
|
+
functionName: "decimals"
|
|
4004
|
+
});
|
|
4005
|
+
}
|
|
3818
4006
|
};
|
|
3819
4007
|
var baseAcpContractClient_default = BaseAcpContractClient;
|
|
3820
4008
|
|
|
4009
|
+
// src/acpJob.ts
|
|
4010
|
+
var import_viem5 = require("viem");
|
|
4011
|
+
|
|
3821
4012
|
// src/interfaces.ts
|
|
3822
4013
|
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
3823
4014
|
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
@@ -3825,6 +4016,14 @@ var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
|
3825
4016
|
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
3826
4017
|
return AcpMemoStatus2;
|
|
3827
4018
|
})(AcpMemoStatus || {});
|
|
4019
|
+
var AcpMemoState = /* @__PURE__ */ ((AcpMemoState2) => {
|
|
4020
|
+
AcpMemoState2[AcpMemoState2["NONE"] = 0] = "NONE";
|
|
4021
|
+
AcpMemoState2[AcpMemoState2["PENDING"] = 1] = "PENDING";
|
|
4022
|
+
AcpMemoState2[AcpMemoState2["IN_PROGRESS"] = 2] = "IN_PROGRESS";
|
|
4023
|
+
AcpMemoState2[AcpMemoState2["FAILED"] = 3] = "FAILED";
|
|
4024
|
+
AcpMemoState2[AcpMemoState2["COMPLETED"] = 4] = "COMPLETED";
|
|
4025
|
+
return AcpMemoState2;
|
|
4026
|
+
})(AcpMemoState || {});
|
|
3828
4027
|
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
3829
4028
|
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
3830
4029
|
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
@@ -3846,6 +4045,8 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
|
3846
4045
|
})(AcpOnlineStatus || {});
|
|
3847
4046
|
|
|
3848
4047
|
// src/utils.ts
|
|
4048
|
+
var import_viem3 = require("viem");
|
|
4049
|
+
var import_chains2 = require("viem/chains");
|
|
3849
4050
|
function tryParseJson(content) {
|
|
3850
4051
|
try {
|
|
3851
4052
|
return JSON.parse(content);
|
|
@@ -3862,9 +4063,59 @@ function safeBase64Encode(data) {
|
|
|
3862
4063
|
}
|
|
3863
4064
|
return Buffer.from(data).toString("base64");
|
|
3864
4065
|
}
|
|
4066
|
+
function getDestinationEndpointId(chainId) {
|
|
4067
|
+
switch (chainId) {
|
|
4068
|
+
case import_chains2.baseSepolia.id:
|
|
4069
|
+
return 40245;
|
|
4070
|
+
case import_chains2.sepolia.id:
|
|
4071
|
+
return 40161;
|
|
4072
|
+
case import_chains2.polygonAmoy.id:
|
|
4073
|
+
return 40267;
|
|
4074
|
+
case import_chains2.arbitrumSepolia.id:
|
|
4075
|
+
return 40231;
|
|
4076
|
+
case import_chains2.bscTestnet.id:
|
|
4077
|
+
return 40102;
|
|
4078
|
+
case import_chains2.base.id:
|
|
4079
|
+
return 30184;
|
|
4080
|
+
case import_chains2.mainnet.id:
|
|
4081
|
+
return 30101;
|
|
4082
|
+
case import_chains2.polygon.id:
|
|
4083
|
+
return 30109;
|
|
4084
|
+
case import_chains2.arbitrum.id:
|
|
4085
|
+
return 30110;
|
|
4086
|
+
case import_chains2.bsc.id:
|
|
4087
|
+
return 30102;
|
|
4088
|
+
}
|
|
4089
|
+
throw new Error(`Unsupported chain ID: ${chainId}`);
|
|
4090
|
+
}
|
|
4091
|
+
function getDestinationChainId(endpointId) {
|
|
4092
|
+
switch (endpointId) {
|
|
4093
|
+
case 40245:
|
|
4094
|
+
return import_chains2.baseSepolia.id;
|
|
4095
|
+
case 40161:
|
|
4096
|
+
return import_chains2.sepolia.id;
|
|
4097
|
+
case 40267:
|
|
4098
|
+
return import_chains2.polygonAmoy.id;
|
|
4099
|
+
case 40231:
|
|
4100
|
+
return import_chains2.arbitrumSepolia.id;
|
|
4101
|
+
case 40102:
|
|
4102
|
+
return import_chains2.bscTestnet.id;
|
|
4103
|
+
case 30184:
|
|
4104
|
+
return import_chains2.base.id;
|
|
4105
|
+
case 30101:
|
|
4106
|
+
return import_chains2.mainnet.id;
|
|
4107
|
+
case 30109:
|
|
4108
|
+
return import_chains2.polygon.id;
|
|
4109
|
+
case 30110:
|
|
4110
|
+
return import_chains2.arbitrum.id;
|
|
4111
|
+
case 30102:
|
|
4112
|
+
return import_chains2.bsc.id;
|
|
4113
|
+
}
|
|
4114
|
+
throw new Error(`Unsupported endpoint ID: ${endpointId}`);
|
|
4115
|
+
}
|
|
3865
4116
|
|
|
3866
4117
|
// src/acpJobOffering.ts
|
|
3867
|
-
var
|
|
4118
|
+
var import_viem4 = require("viem");
|
|
3868
4119
|
var import_ajv = __toESM(require("ajv"));
|
|
3869
4120
|
var AcpJobOffering = class {
|
|
3870
4121
|
constructor(acpClient, acpContractClient, providerAddress, name, price, priceType = "fixed" /* FIXED */, requirement) {
|
|
@@ -3928,7 +4179,7 @@ var AcpJobOffering = class {
|
|
|
3928
4179
|
} else {
|
|
3929
4180
|
createJobPayload = this.acpContractClient.createJobWithAccount(
|
|
3930
4181
|
account.id,
|
|
3931
|
-
evaluatorAddress ||
|
|
4182
|
+
evaluatorAddress || import_viem4.zeroAddress,
|
|
3932
4183
|
fareAmount.amount,
|
|
3933
4184
|
fareAmount.fare.contractAddress,
|
|
3934
4185
|
expiredAt,
|
|
@@ -4069,29 +4320,50 @@ var AcpJob = class {
|
|
|
4069
4320
|
}
|
|
4070
4321
|
const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
|
|
4071
4322
|
const isPercentagePricing = this.priceType === "percentage" /* PERCENTAGE */;
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
this.
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4323
|
+
if (amount.fare.chainId && amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4324
|
+
operations.push(
|
|
4325
|
+
this.acpContractClient.createCrossChainPayableMemo(
|
|
4326
|
+
this.id,
|
|
4327
|
+
content,
|
|
4328
|
+
amount.fare.contractAddress,
|
|
4329
|
+
amount.amount,
|
|
4330
|
+
recipient,
|
|
4331
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4332
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4333
|
+
type,
|
|
4334
|
+
expiredAt,
|
|
4335
|
+
2 /* TRANSACTION */,
|
|
4336
|
+
getDestinationEndpointId(amount.fare.chainId)
|
|
4337
|
+
)
|
|
4338
|
+
);
|
|
4339
|
+
} else {
|
|
4340
|
+
operations.push(
|
|
4341
|
+
this.acpContractClient.createPayableMemo(
|
|
4342
|
+
this.id,
|
|
4343
|
+
content,
|
|
4344
|
+
amount.amount,
|
|
4345
|
+
recipient,
|
|
4346
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4347
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4348
|
+
2 /* TRANSACTION */,
|
|
4349
|
+
type,
|
|
4350
|
+
expiredAt,
|
|
4351
|
+
amount.fare.contractAddress
|
|
4352
|
+
)
|
|
4353
|
+
);
|
|
4354
|
+
}
|
|
4086
4355
|
return await this.acpContractClient.handleOperation(operations);
|
|
4087
4356
|
}
|
|
4088
4357
|
async payAndAcceptRequirement(reason) {
|
|
4089
4358
|
const memo = this.memos.find(
|
|
4090
|
-
(m) => m.nextPhase === 2 /* TRANSACTION */
|
|
4359
|
+
(m) => m.nextPhase === 2 /* TRANSACTION */ || m.nextPhase === 4 /* COMPLETED */
|
|
4091
4360
|
);
|
|
4092
4361
|
if (!memo) {
|
|
4093
4362
|
throw new acpError_default("No notification memo found");
|
|
4094
4363
|
}
|
|
4364
|
+
if (memo.type === 6 /* PAYABLE_REQUEST */ && memo.state !== 1 /* PENDING */ && memo.payableDetails?.lzDstEid !== void 0 && memo.payableDetails?.lzDstEid !== 0) {
|
|
4365
|
+
return;
|
|
4366
|
+
}
|
|
4095
4367
|
const operations = [];
|
|
4096
4368
|
const baseFareAmount = new FareAmount(this.price, this.baseFare);
|
|
4097
4369
|
const transferAmount = memo.payableDetails ? await FareAmountBase.fromContractAddress(
|
|
@@ -4124,6 +4396,53 @@ var AcpJob = class {
|
|
|
4124
4396
|
3 /* EVALUATION */
|
|
4125
4397
|
)
|
|
4126
4398
|
);
|
|
4399
|
+
if (memo.payableDetails) {
|
|
4400
|
+
const destinationChainId = memo.payableDetails.lzDstEid ? getDestinationChainId(memo.payableDetails.lzDstEid) : this.config.chain.id;
|
|
4401
|
+
if (destinationChainId !== this.config.chain.id) {
|
|
4402
|
+
if (memo.type === 6 /* PAYABLE_REQUEST */) {
|
|
4403
|
+
const tokenBalance = await this.acpContractClient.getERC20Balance(
|
|
4404
|
+
destinationChainId,
|
|
4405
|
+
memo.payableDetails.token,
|
|
4406
|
+
this.acpContractClient.agentWalletAddress
|
|
4407
|
+
);
|
|
4408
|
+
if (tokenBalance < memo.payableDetails.amount) {
|
|
4409
|
+
const tokenDecimals = await this.acpContractClient.getERC20Decimals(
|
|
4410
|
+
destinationChainId,
|
|
4411
|
+
memo.payableDetails.token
|
|
4412
|
+
);
|
|
4413
|
+
const tokenSymbol = await this.acpContractClient.getERC20Symbol(
|
|
4414
|
+
destinationChainId,
|
|
4415
|
+
memo.payableDetails.token
|
|
4416
|
+
);
|
|
4417
|
+
throw new Error(
|
|
4418
|
+
`You do not have enough funds to pay for the job which costs ${(0, import_viem5.formatUnits)(
|
|
4419
|
+
memo.payableDetails.amount,
|
|
4420
|
+
tokenDecimals
|
|
4421
|
+
)} ${tokenSymbol} on chainId ${destinationChainId}`
|
|
4422
|
+
);
|
|
4423
|
+
}
|
|
4424
|
+
const assetManagerAddress = await this.acpContractClient.getAssetManager();
|
|
4425
|
+
const allowance = await this.acpContractClient.getERC20Allowance(
|
|
4426
|
+
destinationChainId,
|
|
4427
|
+
memo.payableDetails.token,
|
|
4428
|
+
this.acpContractClient.agentWalletAddress,
|
|
4429
|
+
assetManagerAddress
|
|
4430
|
+
);
|
|
4431
|
+
const destinationChainOperations = [];
|
|
4432
|
+
destinationChainOperations.push(
|
|
4433
|
+
this.acpContractClient.approveAllowance(
|
|
4434
|
+
memo.payableDetails.amount + allowance,
|
|
4435
|
+
memo.payableDetails.token,
|
|
4436
|
+
assetManagerAddress
|
|
4437
|
+
)
|
|
4438
|
+
);
|
|
4439
|
+
await this.acpContractClient.handleOperation(
|
|
4440
|
+
destinationChainOperations,
|
|
4441
|
+
destinationChainId
|
|
4442
|
+
);
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4127
4446
|
if (this.price > 0) {
|
|
4128
4447
|
const x402PaymentDetails = await this.acpContractClient.getX402PaymentDetails(this.id);
|
|
4129
4448
|
if (x402PaymentDetails.isX402) {
|
|
@@ -4196,9 +4515,6 @@ var AcpJob = class {
|
|
|
4196
4515
|
return await this.acpContractClient.handleOperation(operations);
|
|
4197
4516
|
}
|
|
4198
4517
|
async deliver(deliverable) {
|
|
4199
|
-
if (this.phase !== 2 /* TRANSACTION */) {
|
|
4200
|
-
throw new acpError_default("Job is not in transaction phase");
|
|
4201
|
-
}
|
|
4202
4518
|
const operations = [];
|
|
4203
4519
|
operations.push(
|
|
4204
4520
|
this.acpContractClient.createMemo(
|
|
@@ -4212,8 +4528,13 @@ var AcpJob = class {
|
|
|
4212
4528
|
return await this.acpContractClient.handleOperation(operations);
|
|
4213
4529
|
}
|
|
4214
4530
|
async deliverPayable(deliverable, amount, skipFee = false, expiredAt = new Date(Date.now() + 1e3 * 60 * 5)) {
|
|
4215
|
-
if (
|
|
4216
|
-
|
|
4531
|
+
if (amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4532
|
+
return await this.deliverCrossChainPayable(
|
|
4533
|
+
this.clientAddress,
|
|
4534
|
+
preparePayload(deliverable),
|
|
4535
|
+
amount,
|
|
4536
|
+
skipFee
|
|
4537
|
+
);
|
|
4217
4538
|
}
|
|
4218
4539
|
const operations = [];
|
|
4219
4540
|
operations.push(
|
|
@@ -4227,7 +4548,6 @@ var AcpJob = class {
|
|
|
4227
4548
|
operations.push(
|
|
4228
4549
|
this.acpContractClient.createPayableMemo(
|
|
4229
4550
|
this.id,
|
|
4230
|
-
// memoContent.url,
|
|
4231
4551
|
preparePayload(deliverable),
|
|
4232
4552
|
amount.amount,
|
|
4233
4553
|
this.clientAddress,
|
|
@@ -4346,6 +4666,56 @@ var AcpJob = class {
|
|
|
4346
4666
|
waitMs = Math.min(waitMs * 2, maxWaitMs);
|
|
4347
4667
|
}
|
|
4348
4668
|
}
|
|
4669
|
+
async deliverCrossChainPayable(recipient, content, amount, skipFee = false) {
|
|
4670
|
+
if (!amount.fare.chainId) {
|
|
4671
|
+
throw new acpError_default("Chain ID is required for cross chain payable");
|
|
4672
|
+
}
|
|
4673
|
+
const chainId = amount.fare.chainId;
|
|
4674
|
+
const assetManagerAddress = await this.acpContractClient.getAssetManager();
|
|
4675
|
+
const tokenBalance = await this.acpContractClient.getERC20Balance(
|
|
4676
|
+
chainId,
|
|
4677
|
+
amount.fare.contractAddress,
|
|
4678
|
+
this.acpContractClient.agentWalletAddress
|
|
4679
|
+
);
|
|
4680
|
+
if (tokenBalance < amount.amount) {
|
|
4681
|
+
throw new acpError_default("Insufficient token balance for cross chain payable");
|
|
4682
|
+
}
|
|
4683
|
+
const currentAllowance = await this.acpContractClient.getERC20Allowance(
|
|
4684
|
+
chainId,
|
|
4685
|
+
amount.fare.contractAddress,
|
|
4686
|
+
this.acpContractClient.agentWalletAddress,
|
|
4687
|
+
assetManagerAddress
|
|
4688
|
+
);
|
|
4689
|
+
const approveAllowanceOperation = this.acpContractClient.approveAllowance(
|
|
4690
|
+
amount.amount + currentAllowance,
|
|
4691
|
+
amount.fare.contractAddress,
|
|
4692
|
+
assetManagerAddress
|
|
4693
|
+
);
|
|
4694
|
+
await this.acpContractClient.handleOperation(
|
|
4695
|
+
[approveAllowanceOperation],
|
|
4696
|
+
chainId
|
|
4697
|
+
);
|
|
4698
|
+
const tokenSymbol = await this.acpContractClient.getERC20Symbol(
|
|
4699
|
+
chainId,
|
|
4700
|
+
amount.fare.contractAddress
|
|
4701
|
+
);
|
|
4702
|
+
const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
|
|
4703
|
+
const isPercentagePricing = this.priceType === "percentage" /* PERCENTAGE */ && !skipFee;
|
|
4704
|
+
const createMemoOperation = this.acpContractClient.createCrossChainPayableMemo(
|
|
4705
|
+
this.id,
|
|
4706
|
+
content,
|
|
4707
|
+
amount.fare.contractAddress,
|
|
4708
|
+
amount.amount,
|
|
4709
|
+
recipient,
|
|
4710
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4711
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4712
|
+
7 /* PAYABLE_TRANSFER */,
|
|
4713
|
+
new Date(Date.now() + 1e3 * 60 * 5),
|
|
4714
|
+
4 /* COMPLETED */,
|
|
4715
|
+
getDestinationEndpointId(chainId)
|
|
4716
|
+
);
|
|
4717
|
+
await this.acpContractClient.handleOperation([createMemoOperation]);
|
|
4718
|
+
}
|
|
4349
4719
|
[util.inspect.custom]() {
|
|
4350
4720
|
return {
|
|
4351
4721
|
id: this.id,
|
|
@@ -4369,7 +4739,7 @@ var acpJob_default = AcpJob;
|
|
|
4369
4739
|
// src/acpMemo.ts
|
|
4370
4740
|
var import_util = __toESM(require("util"));
|
|
4371
4741
|
var AcpMemo = class {
|
|
4372
|
-
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash) {
|
|
4742
|
+
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash, state) {
|
|
4373
4743
|
this.contractClient = contractClient;
|
|
4374
4744
|
this.id = id;
|
|
4375
4745
|
this.type = type;
|
|
@@ -4382,6 +4752,7 @@ var AcpMemo = class {
|
|
|
4382
4752
|
this.payableDetails = payableDetails;
|
|
4383
4753
|
this.txHash = txHash;
|
|
4384
4754
|
this.signedTxHash = signedTxHash;
|
|
4755
|
+
this.state = state;
|
|
4385
4756
|
if (this.payableDetails) {
|
|
4386
4757
|
this.payableDetails.amount = BigInt(this.payableDetails.amount);
|
|
4387
4758
|
this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
|
|
@@ -4664,7 +5035,8 @@ var AcpClient = class {
|
|
|
4664
5035
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4665
5036
|
memo.payableDetails,
|
|
4666
5037
|
memo.txHash,
|
|
4667
|
-
memo.signedTxHash
|
|
5038
|
+
memo.signedTxHash,
|
|
5039
|
+
memo.state
|
|
4668
5040
|
);
|
|
4669
5041
|
} catch (err) {
|
|
4670
5042
|
throw new acpError_default(`Failed to hydrate memo ${memo.id}`, err);
|
|
@@ -4795,7 +5167,7 @@ var AcpClient = class {
|
|
|
4795
5167
|
baseAcpConfig.contractAddress,
|
|
4796
5168
|
baseAcpX402Config.contractAddress
|
|
4797
5169
|
].includes(this.acpContractClient.config.contractAddress);
|
|
4798
|
-
const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress :
|
|
5170
|
+
const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress : import_viem6.zeroAddress;
|
|
4799
5171
|
const chainId = this.acpContractClient.config.chain.id;
|
|
4800
5172
|
const isUsdcPaymentToken = USDC_TOKEN_ADDRESS[chainId].toLowerCase() === fareAmount.fare.contractAddress.toLowerCase();
|
|
4801
5173
|
const isX402Job = this.acpContractClient.config.x402Config && isUsdcPaymentToken;
|
|
@@ -4983,10 +5355,10 @@ var acpClient_default = AcpClient;
|
|
|
4983
5355
|
var import_core = require("@aa-sdk/core");
|
|
4984
5356
|
var import_infra2 = require("@account-kit/infra");
|
|
4985
5357
|
var import_smart_contracts = require("@account-kit/smart-contracts");
|
|
4986
|
-
var
|
|
5358
|
+
var import_viem8 = require("viem");
|
|
4987
5359
|
|
|
4988
5360
|
// src/acpX402.ts
|
|
4989
|
-
var
|
|
5361
|
+
var import_viem7 = require("viem");
|
|
4990
5362
|
var import_crypto = require("crypto");
|
|
4991
5363
|
var AcpX402 = class {
|
|
4992
5364
|
constructor(config, sessionKeyClient, publicClient) {
|
|
@@ -5044,7 +5416,7 @@ var AcpX402 = class {
|
|
|
5044
5416
|
contracts: [
|
|
5045
5417
|
{
|
|
5046
5418
|
address: USDC_CONTRACT,
|
|
5047
|
-
abi:
|
|
5419
|
+
abi: import_viem7.erc20Abi,
|
|
5048
5420
|
functionName: "name"
|
|
5049
5421
|
},
|
|
5050
5422
|
{
|
|
@@ -5261,7 +5633,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5261
5633
|
const contractLogs = result.logs.filter((log) => {
|
|
5262
5634
|
return log.address.toLowerCase() === this.contractAddress.toLowerCase();
|
|
5263
5635
|
}).map(
|
|
5264
|
-
(log) => (0,
|
|
5636
|
+
(log) => (0, import_viem8.decodeEventLog)({
|
|
5265
5637
|
abi: this.abi,
|
|
5266
5638
|
data: log.data,
|
|
5267
5639
|
topics: log.topics
|
|
@@ -5277,7 +5649,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5277
5649
|
}
|
|
5278
5650
|
createJob(providerAddress, evaluatorAddress, expireAt, paymentTokenAddress, budgetBaseUnit, metadata, isX402Job) {
|
|
5279
5651
|
try {
|
|
5280
|
-
const data = (0,
|
|
5652
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5281
5653
|
abi: this.abi,
|
|
5282
5654
|
functionName: isX402Job ? "createJobWithX402" : "createJob",
|
|
5283
5655
|
args: [
|
|
@@ -5297,7 +5669,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5297
5669
|
}
|
|
5298
5670
|
setBudgetWithPaymentToken(jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
5299
5671
|
try {
|
|
5300
|
-
const data = (0,
|
|
5672
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5301
5673
|
abi: this.abi,
|
|
5302
5674
|
functionName: "setBudgetWithPaymentToken",
|
|
5303
5675
|
args: [jobId, budgetBaseUnit, paymentTokenAddress]
|
|
@@ -5313,7 +5685,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5313
5685
|
}
|
|
5314
5686
|
createPayableMemo(jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress, secured = true) {
|
|
5315
5687
|
try {
|
|
5316
|
-
const data = (0,
|
|
5688
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5317
5689
|
abi: this.abi,
|
|
5318
5690
|
functionName: "createPayableMemo",
|
|
5319
5691
|
args: [
|
|
@@ -5353,6 +5725,9 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5353
5725
|
async performX402Request(url, version2, budget, signature) {
|
|
5354
5726
|
return await this.acpX402.performRequest(url, version2, budget, signature);
|
|
5355
5727
|
}
|
|
5728
|
+
async getAssetManager() {
|
|
5729
|
+
throw new Error("Asset Manager not supported");
|
|
5730
|
+
}
|
|
5356
5731
|
getAcpVersion() {
|
|
5357
5732
|
return "1";
|
|
5358
5733
|
}
|
|
@@ -5366,7 +5741,7 @@ var acpContractClient_default = AcpContractClient;
|
|
|
5366
5741
|
var import_core2 = require("@aa-sdk/core");
|
|
5367
5742
|
var import_infra3 = require("@account-kit/infra");
|
|
5368
5743
|
var import_smart_contracts2 = require("@account-kit/smart-contracts");
|
|
5369
|
-
var
|
|
5744
|
+
var import_viem9 = require("viem");
|
|
5370
5745
|
|
|
5371
5746
|
// src/abis/jobManagerAbi.ts
|
|
5372
5747
|
var JOB_MANAGER_ABI = [
|
|
@@ -6070,88 +6445,1246 @@ var JOB_MANAGER_ABI = [
|
|
|
6070
6445
|
var jobManagerAbi_default = JOB_MANAGER_ABI;
|
|
6071
6446
|
|
|
6072
6447
|
// src/contractClients/acpContractClientV2.ts
|
|
6073
|
-
var
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
}
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6448
|
+
var import_chains3 = require("viem/chains");
|
|
6449
|
+
|
|
6450
|
+
// src/abis/memoManagerAbi.ts
|
|
6451
|
+
var MEMO_MANAGER_ABI = [
|
|
6452
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
6453
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
6454
|
+
{
|
|
6455
|
+
inputs: [
|
|
6456
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
6457
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" }
|
|
6458
|
+
],
|
|
6459
|
+
name: "AccessControlUnauthorizedAccount",
|
|
6460
|
+
type: "error"
|
|
6461
|
+
},
|
|
6462
|
+
{
|
|
6463
|
+
inputs: [{ internalType: "address", name: "target", type: "address" }],
|
|
6464
|
+
name: "AddressEmptyCode",
|
|
6465
|
+
type: "error"
|
|
6466
|
+
},
|
|
6467
|
+
{ inputs: [], name: "AlreadyVoted", type: "error" },
|
|
6468
|
+
{ inputs: [], name: "CannotApproveMemo", type: "error" },
|
|
6469
|
+
{ inputs: [], name: "CannotUpdateApprovedMemo", type: "error" },
|
|
6470
|
+
{ inputs: [], name: "CannotUpdateMemo", type: "error" },
|
|
6471
|
+
{ inputs: [], name: "CannotWithdrawYet", type: "error" },
|
|
6472
|
+
{ inputs: [], name: "DestinationChainNotConfigured", type: "error" },
|
|
6473
|
+
{
|
|
6474
|
+
inputs: [
|
|
6475
|
+
{ internalType: "address", name: "implementation", type: "address" }
|
|
6476
|
+
],
|
|
6477
|
+
name: "ERC1967InvalidImplementation",
|
|
6478
|
+
type: "error"
|
|
6479
|
+
},
|
|
6480
|
+
{ inputs: [], name: "ERC1967NonPayable", type: "error" },
|
|
6481
|
+
{ inputs: [], name: "EmptyContent", type: "error" },
|
|
6482
|
+
{ inputs: [], name: "FailedInnerCall", type: "error" },
|
|
6483
|
+
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
6484
|
+
{ inputs: [], name: "InvalidMemoState", type: "error" },
|
|
6485
|
+
{ inputs: [], name: "InvalidMemoStateTransition", type: "error" },
|
|
6486
|
+
{ inputs: [], name: "InvalidMemoType", type: "error" },
|
|
6487
|
+
{ inputs: [], name: "JobAlreadyCompleted", type: "error" },
|
|
6488
|
+
{ inputs: [], name: "JobDoesNotExist", type: "error" },
|
|
6489
|
+
{ inputs: [], name: "MemoAlreadyApproved", type: "error" },
|
|
6490
|
+
{ inputs: [], name: "MemoAlreadyExecuted", type: "error" },
|
|
6491
|
+
{ inputs: [], name: "MemoAlreadySigned", type: "error" },
|
|
6492
|
+
{ inputs: [], name: "MemoCannotBeSigned", type: "error" },
|
|
6493
|
+
{ inputs: [], name: "MemoDoesNotExist", type: "error" },
|
|
6494
|
+
{ inputs: [], name: "MemoDoesNotRequireApproval", type: "error" },
|
|
6495
|
+
{ inputs: [], name: "MemoExpired", type: "error" },
|
|
6496
|
+
{ inputs: [], name: "MemoNotApproved", type: "error" },
|
|
6497
|
+
{ inputs: [], name: "MemoNotReadyToBeSigned", type: "error" },
|
|
6498
|
+
{ inputs: [], name: "MemoStateUnchanged", type: "error" },
|
|
6499
|
+
{ inputs: [], name: "NoAmountToTransfer", type: "error" },
|
|
6500
|
+
{ inputs: [], name: "NoPaymentAmount", type: "error" },
|
|
6501
|
+
{ inputs: [], name: "NotEscrowTransferMemoType", type: "error" },
|
|
6502
|
+
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
6503
|
+
{ inputs: [], name: "NotPayableMemoType", type: "error" },
|
|
6504
|
+
{ inputs: [], name: "OnlyACPContract", type: "error" },
|
|
6505
|
+
{ inputs: [], name: "OnlyAssetManager", type: "error" },
|
|
6506
|
+
{ inputs: [], name: "OnlyClientOrProvider", type: "error" },
|
|
6507
|
+
{ inputs: [], name: "OnlyCounterParty", type: "error" },
|
|
6508
|
+
{ inputs: [], name: "OnlyEvaluator", type: "error" },
|
|
6509
|
+
{ inputs: [], name: "OnlyMemoSender", type: "error" },
|
|
6510
|
+
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
6511
|
+
{ inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
|
|
6512
|
+
{
|
|
6513
|
+
inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
|
|
6514
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
6515
|
+
type: "error"
|
|
6516
|
+
},
|
|
6517
|
+
{ inputs: [], name: "ZeroAcpContractAddress", type: "error" },
|
|
6518
|
+
{ inputs: [], name: "ZeroAddressRecipient", type: "error" },
|
|
6519
|
+
{ inputs: [], name: "ZeroAddressToken", type: "error" },
|
|
6520
|
+
{ inputs: [], name: "ZeroAssetManagerAddress", type: "error" },
|
|
6521
|
+
{ inputs: [], name: "ZeroJobManagerAddress", type: "error" },
|
|
6522
|
+
{
|
|
6523
|
+
anonymous: false,
|
|
6524
|
+
inputs: [
|
|
6525
|
+
{
|
|
6526
|
+
indexed: false,
|
|
6527
|
+
internalType: "uint64",
|
|
6528
|
+
name: "version",
|
|
6529
|
+
type: "uint64"
|
|
6530
|
+
}
|
|
6531
|
+
],
|
|
6532
|
+
name: "Initialized",
|
|
6533
|
+
type: "event"
|
|
6534
|
+
},
|
|
6535
|
+
{
|
|
6536
|
+
anonymous: false,
|
|
6537
|
+
inputs: [
|
|
6538
|
+
{
|
|
6539
|
+
indexed: true,
|
|
6540
|
+
internalType: "uint256",
|
|
6541
|
+
name: "memoId",
|
|
6542
|
+
type: "uint256"
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
indexed: true,
|
|
6546
|
+
internalType: "address",
|
|
6547
|
+
name: "approver",
|
|
6548
|
+
type: "address"
|
|
6549
|
+
},
|
|
6550
|
+
{ indexed: false, internalType: "bool", name: "approved", type: "bool" },
|
|
6551
|
+
{
|
|
6552
|
+
indexed: false,
|
|
6553
|
+
internalType: "string",
|
|
6554
|
+
name: "reason",
|
|
6555
|
+
type: "string"
|
|
6556
|
+
}
|
|
6557
|
+
],
|
|
6558
|
+
name: "MemoSigned",
|
|
6559
|
+
type: "event"
|
|
6560
|
+
},
|
|
6561
|
+
{
|
|
6562
|
+
anonymous: false,
|
|
6563
|
+
inputs: [
|
|
6564
|
+
{
|
|
6565
|
+
indexed: true,
|
|
6566
|
+
internalType: "uint256",
|
|
6567
|
+
name: "memoId",
|
|
6568
|
+
type: "uint256"
|
|
6569
|
+
},
|
|
6570
|
+
{
|
|
6571
|
+
indexed: false,
|
|
6572
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6573
|
+
name: "oldState",
|
|
6574
|
+
type: "uint8"
|
|
6575
|
+
},
|
|
6576
|
+
{
|
|
6577
|
+
indexed: false,
|
|
6578
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6579
|
+
name: "newState",
|
|
6580
|
+
type: "uint8"
|
|
6581
|
+
}
|
|
6582
|
+
],
|
|
6583
|
+
name: "MemoStateUpdated",
|
|
6584
|
+
type: "event"
|
|
6585
|
+
},
|
|
6586
|
+
{
|
|
6587
|
+
anonymous: false,
|
|
6588
|
+
inputs: [
|
|
6589
|
+
{
|
|
6590
|
+
indexed: true,
|
|
6591
|
+
internalType: "uint256",
|
|
6592
|
+
name: "memoId",
|
|
6593
|
+
type: "uint256"
|
|
6594
|
+
},
|
|
6595
|
+
{
|
|
6596
|
+
indexed: true,
|
|
6597
|
+
internalType: "uint256",
|
|
6598
|
+
name: "jobId",
|
|
6599
|
+
type: "uint256"
|
|
6600
|
+
},
|
|
6601
|
+
{
|
|
6602
|
+
indexed: true,
|
|
6603
|
+
internalType: "address",
|
|
6604
|
+
name: "sender",
|
|
6605
|
+
type: "address"
|
|
6606
|
+
},
|
|
6607
|
+
{
|
|
6608
|
+
indexed: false,
|
|
6609
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6610
|
+
name: "memoType",
|
|
6611
|
+
type: "uint8"
|
|
6612
|
+
},
|
|
6613
|
+
{
|
|
6614
|
+
indexed: false,
|
|
6615
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6616
|
+
name: "nextPhase",
|
|
6617
|
+
type: "uint8"
|
|
6618
|
+
},
|
|
6619
|
+
{
|
|
6620
|
+
indexed: false,
|
|
6621
|
+
internalType: "string",
|
|
6622
|
+
name: "content",
|
|
6623
|
+
type: "string"
|
|
6624
|
+
}
|
|
6625
|
+
],
|
|
6626
|
+
name: "NewMemo",
|
|
6627
|
+
type: "event"
|
|
6628
|
+
},
|
|
6629
|
+
{
|
|
6630
|
+
anonymous: false,
|
|
6631
|
+
inputs: [
|
|
6632
|
+
{
|
|
6633
|
+
indexed: true,
|
|
6634
|
+
internalType: "uint256",
|
|
6635
|
+
name: "jobId",
|
|
6636
|
+
type: "uint256"
|
|
6637
|
+
},
|
|
6638
|
+
{
|
|
6639
|
+
indexed: true,
|
|
6640
|
+
internalType: "uint256",
|
|
6641
|
+
name: "memoId",
|
|
6642
|
+
type: "uint256"
|
|
6643
|
+
},
|
|
6644
|
+
{
|
|
6645
|
+
indexed: true,
|
|
6646
|
+
internalType: "address",
|
|
6647
|
+
name: "sender",
|
|
6648
|
+
type: "address"
|
|
6649
|
+
},
|
|
6650
|
+
{
|
|
6651
|
+
indexed: false,
|
|
6652
|
+
internalType: "address",
|
|
6653
|
+
name: "token",
|
|
6654
|
+
type: "address"
|
|
6655
|
+
},
|
|
6656
|
+
{
|
|
6657
|
+
indexed: false,
|
|
6658
|
+
internalType: "uint256",
|
|
6659
|
+
name: "amount",
|
|
6660
|
+
type: "uint256"
|
|
6661
|
+
}
|
|
6662
|
+
],
|
|
6663
|
+
name: "PayableFeeRefunded",
|
|
6664
|
+
type: "event"
|
|
6665
|
+
},
|
|
6666
|
+
{
|
|
6667
|
+
anonymous: false,
|
|
6668
|
+
inputs: [
|
|
6669
|
+
{
|
|
6670
|
+
indexed: true,
|
|
6671
|
+
internalType: "uint256",
|
|
6672
|
+
name: "jobId",
|
|
6673
|
+
type: "uint256"
|
|
6674
|
+
},
|
|
6675
|
+
{
|
|
6676
|
+
indexed: true,
|
|
6677
|
+
internalType: "uint256",
|
|
6678
|
+
name: "memoId",
|
|
6679
|
+
type: "uint256"
|
|
6680
|
+
},
|
|
6681
|
+
{
|
|
6682
|
+
indexed: true,
|
|
6683
|
+
internalType: "address",
|
|
6684
|
+
name: "sender",
|
|
6685
|
+
type: "address"
|
|
6686
|
+
},
|
|
6687
|
+
{
|
|
6688
|
+
indexed: false,
|
|
6689
|
+
internalType: "address",
|
|
6690
|
+
name: "token",
|
|
6691
|
+
type: "address"
|
|
6692
|
+
},
|
|
6693
|
+
{
|
|
6694
|
+
indexed: false,
|
|
6695
|
+
internalType: "uint256",
|
|
6696
|
+
name: "amount",
|
|
6697
|
+
type: "uint256"
|
|
6698
|
+
}
|
|
6699
|
+
],
|
|
6700
|
+
name: "PayableFundsRefunded",
|
|
6701
|
+
type: "event"
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
anonymous: false,
|
|
6705
|
+
inputs: [
|
|
6706
|
+
{
|
|
6707
|
+
indexed: true,
|
|
6708
|
+
internalType: "uint256",
|
|
6709
|
+
name: "memoId",
|
|
6710
|
+
type: "uint256"
|
|
6711
|
+
},
|
|
6712
|
+
{
|
|
6713
|
+
indexed: true,
|
|
6714
|
+
internalType: "uint256",
|
|
6715
|
+
name: "jobId",
|
|
6716
|
+
type: "uint256"
|
|
6717
|
+
},
|
|
6718
|
+
{
|
|
6719
|
+
indexed: true,
|
|
6720
|
+
internalType: "address",
|
|
6721
|
+
name: "executor",
|
|
6722
|
+
type: "address"
|
|
6723
|
+
},
|
|
6724
|
+
{
|
|
6725
|
+
indexed: false,
|
|
6726
|
+
internalType: "uint256",
|
|
6727
|
+
name: "amount",
|
|
6728
|
+
type: "uint256"
|
|
6729
|
+
}
|
|
6730
|
+
],
|
|
6731
|
+
name: "PayableMemoExecuted",
|
|
6732
|
+
type: "event"
|
|
6733
|
+
},
|
|
6734
|
+
{
|
|
6735
|
+
anonymous: false,
|
|
6736
|
+
inputs: [
|
|
6737
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6738
|
+
{
|
|
6739
|
+
indexed: true,
|
|
6740
|
+
internalType: "bytes32",
|
|
6741
|
+
name: "previousAdminRole",
|
|
6742
|
+
type: "bytes32"
|
|
6743
|
+
},
|
|
6744
|
+
{
|
|
6745
|
+
indexed: true,
|
|
6746
|
+
internalType: "bytes32",
|
|
6747
|
+
name: "newAdminRole",
|
|
6748
|
+
type: "bytes32"
|
|
6749
|
+
}
|
|
6750
|
+
],
|
|
6751
|
+
name: "RoleAdminChanged",
|
|
6752
|
+
type: "event"
|
|
6753
|
+
},
|
|
6754
|
+
{
|
|
6755
|
+
anonymous: false,
|
|
6756
|
+
inputs: [
|
|
6757
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6758
|
+
{
|
|
6759
|
+
indexed: true,
|
|
6760
|
+
internalType: "address",
|
|
6761
|
+
name: "account",
|
|
6762
|
+
type: "address"
|
|
6763
|
+
},
|
|
6764
|
+
{
|
|
6765
|
+
indexed: true,
|
|
6766
|
+
internalType: "address",
|
|
6767
|
+
name: "sender",
|
|
6768
|
+
type: "address"
|
|
6769
|
+
}
|
|
6770
|
+
],
|
|
6771
|
+
name: "RoleGranted",
|
|
6772
|
+
type: "event"
|
|
6773
|
+
},
|
|
6774
|
+
{
|
|
6775
|
+
anonymous: false,
|
|
6776
|
+
inputs: [
|
|
6777
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6778
|
+
{
|
|
6779
|
+
indexed: true,
|
|
6780
|
+
internalType: "address",
|
|
6781
|
+
name: "account",
|
|
6782
|
+
type: "address"
|
|
6783
|
+
},
|
|
6784
|
+
{
|
|
6785
|
+
indexed: true,
|
|
6786
|
+
internalType: "address",
|
|
6787
|
+
name: "sender",
|
|
6788
|
+
type: "address"
|
|
6789
|
+
}
|
|
6790
|
+
],
|
|
6791
|
+
name: "RoleRevoked",
|
|
6792
|
+
type: "event"
|
|
6793
|
+
},
|
|
6794
|
+
{
|
|
6795
|
+
anonymous: false,
|
|
6796
|
+
inputs: [
|
|
6797
|
+
{
|
|
6798
|
+
indexed: true,
|
|
6799
|
+
internalType: "address",
|
|
6800
|
+
name: "implementation",
|
|
6801
|
+
type: "address"
|
|
6802
|
+
}
|
|
6803
|
+
],
|
|
6804
|
+
name: "Upgraded",
|
|
6805
|
+
type: "event"
|
|
6806
|
+
},
|
|
6807
|
+
{
|
|
6808
|
+
inputs: [],
|
|
6809
|
+
name: "ACP_CONTRACT_ROLE",
|
|
6810
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6811
|
+
stateMutability: "view",
|
|
6812
|
+
type: "function"
|
|
6813
|
+
},
|
|
6814
|
+
{
|
|
6815
|
+
inputs: [],
|
|
6816
|
+
name: "ADMIN_ROLE",
|
|
6817
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6818
|
+
stateMutability: "view",
|
|
6819
|
+
type: "function"
|
|
6820
|
+
},
|
|
6821
|
+
{
|
|
6822
|
+
inputs: [],
|
|
6823
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
6824
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6825
|
+
stateMutability: "view",
|
|
6826
|
+
type: "function"
|
|
6827
|
+
},
|
|
6828
|
+
{
|
|
6829
|
+
inputs: [],
|
|
6830
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
6831
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
6832
|
+
stateMutability: "view",
|
|
6833
|
+
type: "function"
|
|
6834
|
+
},
|
|
6835
|
+
{
|
|
6836
|
+
inputs: [],
|
|
6837
|
+
name: "acpContract",
|
|
6838
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6839
|
+
stateMutability: "view",
|
|
6840
|
+
type: "function"
|
|
6841
|
+
},
|
|
6842
|
+
{
|
|
6843
|
+
inputs: [
|
|
6844
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6845
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6846
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6847
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6848
|
+
],
|
|
6849
|
+
name: "approveMemo",
|
|
6850
|
+
outputs: [],
|
|
6851
|
+
stateMutability: "nonpayable",
|
|
6852
|
+
type: "function"
|
|
6853
|
+
},
|
|
6854
|
+
{
|
|
6855
|
+
inputs: [],
|
|
6856
|
+
name: "assetManager",
|
|
6857
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6858
|
+
stateMutability: "view",
|
|
6859
|
+
type: "function"
|
|
6860
|
+
},
|
|
6861
|
+
{
|
|
6862
|
+
inputs: [
|
|
6863
|
+
{ internalType: "uint256[]", name: "memoIds", type: "uint256[]" },
|
|
6864
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6865
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6866
|
+
],
|
|
6867
|
+
name: "bulkApproveMemos",
|
|
6868
|
+
outputs: [],
|
|
6869
|
+
stateMutability: "nonpayable",
|
|
6870
|
+
type: "function"
|
|
6871
|
+
},
|
|
6872
|
+
{
|
|
6873
|
+
inputs: [
|
|
6874
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6875
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
6876
|
+
],
|
|
6877
|
+
name: "canApproveMemo",
|
|
6878
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
6879
|
+
stateMutability: "view",
|
|
6880
|
+
type: "function"
|
|
6881
|
+
},
|
|
6882
|
+
{
|
|
6883
|
+
inputs: [
|
|
6884
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6885
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6886
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6887
|
+
{
|
|
6888
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6889
|
+
name: "memoType",
|
|
6890
|
+
type: "uint8"
|
|
6891
|
+
},
|
|
6892
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6893
|
+
{
|
|
6894
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6895
|
+
name: "nextPhase",
|
|
6896
|
+
type: "uint8"
|
|
6897
|
+
},
|
|
6898
|
+
{ internalType: "string", name: "metadata", type: "string" }
|
|
6899
|
+
],
|
|
6900
|
+
name: "createMemo",
|
|
6901
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6902
|
+
stateMutability: "nonpayable",
|
|
6903
|
+
type: "function"
|
|
6904
|
+
},
|
|
6905
|
+
{
|
|
6906
|
+
inputs: [
|
|
6907
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6908
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6909
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6910
|
+
{
|
|
6911
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6912
|
+
name: "memoType",
|
|
6913
|
+
type: "uint8"
|
|
6914
|
+
},
|
|
6915
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6916
|
+
{
|
|
6917
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6918
|
+
name: "nextPhase",
|
|
6919
|
+
type: "uint8"
|
|
6920
|
+
},
|
|
6921
|
+
{
|
|
6922
|
+
components: [
|
|
6923
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
6924
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
6925
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
6926
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
6927
|
+
{
|
|
6928
|
+
internalType: "enum ACPTypes.FeeType",
|
|
6929
|
+
name: "feeType",
|
|
6930
|
+
type: "uint8"
|
|
6931
|
+
},
|
|
6932
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
6933
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6934
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
6935
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
6936
|
+
],
|
|
6937
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
6938
|
+
name: "payableDetails_",
|
|
6939
|
+
type: "tuple"
|
|
6940
|
+
},
|
|
6941
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
6942
|
+
],
|
|
6943
|
+
name: "createPayableMemo",
|
|
6944
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6945
|
+
stateMutability: "nonpayable",
|
|
6946
|
+
type: "function"
|
|
6947
|
+
},
|
|
6948
|
+
{
|
|
6949
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6950
|
+
name: "emergencyApproveMemo",
|
|
6951
|
+
outputs: [],
|
|
6952
|
+
stateMutability: "nonpayable",
|
|
6953
|
+
type: "function"
|
|
6954
|
+
},
|
|
6955
|
+
{
|
|
6956
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6957
|
+
name: "executePayableMemo",
|
|
6958
|
+
outputs: [],
|
|
6959
|
+
stateMutability: "nonpayable",
|
|
6960
|
+
type: "function"
|
|
6961
|
+
},
|
|
6962
|
+
{
|
|
6963
|
+
inputs: [],
|
|
6964
|
+
name: "getAssetManager",
|
|
6965
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6966
|
+
stateMutability: "view",
|
|
6967
|
+
type: "function"
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
inputs: [
|
|
6971
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6972
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6973
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6974
|
+
],
|
|
6975
|
+
name: "getJobMemos",
|
|
6976
|
+
outputs: [
|
|
6977
|
+
{
|
|
6978
|
+
components: [
|
|
6979
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6980
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6981
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6982
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6983
|
+
{
|
|
6984
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6985
|
+
name: "memoType",
|
|
6986
|
+
type: "uint8"
|
|
6987
|
+
},
|
|
6988
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6989
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6990
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6991
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6992
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6993
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6994
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6995
|
+
{
|
|
6996
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6997
|
+
name: "nextPhase",
|
|
6998
|
+
type: "uint8"
|
|
6999
|
+
},
|
|
7000
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7001
|
+
{
|
|
7002
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7003
|
+
name: "state",
|
|
7004
|
+
type: "uint8"
|
|
7005
|
+
}
|
|
7006
|
+
],
|
|
7007
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
7008
|
+
name: "memoArray",
|
|
7009
|
+
type: "tuple[]"
|
|
7010
|
+
},
|
|
7011
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
7012
|
+
],
|
|
7013
|
+
stateMutability: "view",
|
|
7014
|
+
type: "function"
|
|
7015
|
+
},
|
|
7016
|
+
{
|
|
7017
|
+
inputs: [
|
|
7018
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7019
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "phase", type: "uint8" },
|
|
7020
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
7021
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
7022
|
+
],
|
|
7023
|
+
name: "getJobMemosByPhase",
|
|
7024
|
+
outputs: [
|
|
7025
|
+
{
|
|
7026
|
+
components: [
|
|
7027
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7028
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7029
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7030
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7031
|
+
{
|
|
7032
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7033
|
+
name: "memoType",
|
|
7034
|
+
type: "uint8"
|
|
7035
|
+
},
|
|
7036
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7037
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7038
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7039
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7040
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7041
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7042
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7043
|
+
{
|
|
7044
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7045
|
+
name: "nextPhase",
|
|
7046
|
+
type: "uint8"
|
|
7047
|
+
},
|
|
7048
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7049
|
+
{
|
|
7050
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7051
|
+
name: "state",
|
|
7052
|
+
type: "uint8"
|
|
7053
|
+
}
|
|
7054
|
+
],
|
|
7055
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
7056
|
+
name: "memoArray",
|
|
7057
|
+
type: "tuple[]"
|
|
7058
|
+
},
|
|
7059
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
7060
|
+
],
|
|
7061
|
+
stateMutability: "view",
|
|
7062
|
+
type: "function"
|
|
7063
|
+
},
|
|
7064
|
+
{
|
|
7065
|
+
inputs: [
|
|
7066
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7067
|
+
{
|
|
7068
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7069
|
+
name: "memoType",
|
|
7070
|
+
type: "uint8"
|
|
7071
|
+
},
|
|
7072
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
7073
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
7074
|
+
],
|
|
7075
|
+
name: "getJobMemosByType",
|
|
7076
|
+
outputs: [
|
|
7077
|
+
{
|
|
7078
|
+
components: [
|
|
7079
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7080
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7081
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7082
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7083
|
+
{
|
|
7084
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7085
|
+
name: "memoType",
|
|
7086
|
+
type: "uint8"
|
|
7087
|
+
},
|
|
7088
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7089
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7090
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7091
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7092
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7093
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7094
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7095
|
+
{
|
|
7096
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7097
|
+
name: "nextPhase",
|
|
7098
|
+
type: "uint8"
|
|
7099
|
+
},
|
|
7100
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7101
|
+
{
|
|
7102
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7103
|
+
name: "state",
|
|
7104
|
+
type: "uint8"
|
|
7105
|
+
}
|
|
7106
|
+
],
|
|
7107
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
7108
|
+
name: "memoArray",
|
|
7109
|
+
type: "tuple[]"
|
|
7110
|
+
},
|
|
7111
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
7112
|
+
],
|
|
7113
|
+
stateMutability: "view",
|
|
7114
|
+
type: "function"
|
|
7115
|
+
},
|
|
7116
|
+
{
|
|
7117
|
+
inputs: [],
|
|
7118
|
+
name: "getLocalEid",
|
|
7119
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
|
7120
|
+
stateMutability: "view",
|
|
7121
|
+
type: "function"
|
|
7122
|
+
},
|
|
7123
|
+
{
|
|
7124
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7125
|
+
name: "getMemo",
|
|
7126
|
+
outputs: [
|
|
7127
|
+
{
|
|
7128
|
+
components: [
|
|
7129
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7130
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7131
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7132
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7133
|
+
{
|
|
7134
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7135
|
+
name: "memoType",
|
|
7136
|
+
type: "uint8"
|
|
7137
|
+
},
|
|
7138
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7139
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7140
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7141
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7142
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7143
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7144
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7145
|
+
{
|
|
7146
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7147
|
+
name: "nextPhase",
|
|
7148
|
+
type: "uint8"
|
|
7149
|
+
},
|
|
7150
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7151
|
+
{
|
|
7152
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7153
|
+
name: "state",
|
|
7154
|
+
type: "uint8"
|
|
7155
|
+
}
|
|
7156
|
+
],
|
|
7157
|
+
internalType: "struct ACPTypes.Memo",
|
|
7158
|
+
name: "",
|
|
7159
|
+
type: "tuple"
|
|
7160
|
+
}
|
|
7161
|
+
],
|
|
7162
|
+
stateMutability: "view",
|
|
7163
|
+
type: "function"
|
|
7164
|
+
},
|
|
7165
|
+
{
|
|
7166
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7167
|
+
name: "getMemoApprovalStatus",
|
|
7168
|
+
outputs: [
|
|
7169
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7170
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7171
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" }
|
|
7172
|
+
],
|
|
7173
|
+
stateMutability: "view",
|
|
7174
|
+
type: "function"
|
|
7175
|
+
},
|
|
7176
|
+
{
|
|
7177
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7178
|
+
name: "getMemoWithPayableDetails",
|
|
7179
|
+
outputs: [
|
|
7180
|
+
{
|
|
7181
|
+
components: [
|
|
7182
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7183
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7184
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7185
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7186
|
+
{
|
|
7187
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7188
|
+
name: "memoType",
|
|
7189
|
+
type: "uint8"
|
|
7190
|
+
},
|
|
7191
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7192
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7193
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7194
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7195
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7196
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7197
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7198
|
+
{
|
|
7199
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7200
|
+
name: "nextPhase",
|
|
7201
|
+
type: "uint8"
|
|
7202
|
+
},
|
|
7203
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7204
|
+
{
|
|
7205
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7206
|
+
name: "state",
|
|
7207
|
+
type: "uint8"
|
|
7208
|
+
}
|
|
7209
|
+
],
|
|
7210
|
+
internalType: "struct ACPTypes.Memo",
|
|
7211
|
+
name: "memo",
|
|
7212
|
+
type: "tuple"
|
|
7213
|
+
},
|
|
7214
|
+
{
|
|
7215
|
+
components: [
|
|
7216
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7217
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7218
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7219
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7220
|
+
{
|
|
7221
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7222
|
+
name: "feeType",
|
|
7223
|
+
type: "uint8"
|
|
7224
|
+
},
|
|
7225
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7226
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7227
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7228
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7229
|
+
],
|
|
7230
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7231
|
+
name: "details",
|
|
7232
|
+
type: "tuple"
|
|
7233
|
+
}
|
|
7234
|
+
],
|
|
7235
|
+
stateMutability: "view",
|
|
7236
|
+
type: "function"
|
|
7237
|
+
},
|
|
7238
|
+
{
|
|
7239
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7240
|
+
name: "getPayableDetails",
|
|
7241
|
+
outputs: [
|
|
7242
|
+
{
|
|
7243
|
+
components: [
|
|
7244
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7245
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7246
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7247
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7248
|
+
{
|
|
7249
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7250
|
+
name: "feeType",
|
|
7251
|
+
type: "uint8"
|
|
7252
|
+
},
|
|
7253
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7254
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7255
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7256
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7257
|
+
],
|
|
7258
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7259
|
+
name: "",
|
|
7260
|
+
type: "tuple"
|
|
7261
|
+
}
|
|
7262
|
+
],
|
|
7263
|
+
stateMutability: "view",
|
|
7264
|
+
type: "function"
|
|
7265
|
+
},
|
|
7266
|
+
{
|
|
7267
|
+
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
7268
|
+
name: "getRoleAdmin",
|
|
7269
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7270
|
+
stateMutability: "view",
|
|
7271
|
+
type: "function"
|
|
7272
|
+
},
|
|
7273
|
+
{
|
|
7274
|
+
inputs: [
|
|
7275
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7276
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7277
|
+
],
|
|
7278
|
+
name: "grantRole",
|
|
7279
|
+
outputs: [],
|
|
7280
|
+
stateMutability: "nonpayable",
|
|
7281
|
+
type: "function"
|
|
7282
|
+
},
|
|
7283
|
+
{
|
|
7284
|
+
inputs: [
|
|
7285
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7286
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7287
|
+
],
|
|
7288
|
+
name: "hasRole",
|
|
7289
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7290
|
+
stateMutability: "view",
|
|
7291
|
+
type: "function"
|
|
7292
|
+
},
|
|
7293
|
+
{
|
|
7294
|
+
inputs: [
|
|
7295
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7296
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7297
|
+
{ internalType: "address", name: "paymentManager_", type: "address" }
|
|
7298
|
+
],
|
|
7299
|
+
name: "initialize",
|
|
7300
|
+
outputs: [],
|
|
7301
|
+
stateMutability: "nonpayable",
|
|
7302
|
+
type: "function"
|
|
7303
|
+
},
|
|
7304
|
+
{
|
|
7305
|
+
inputs: [
|
|
7306
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7307
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7308
|
+
],
|
|
7309
|
+
name: "isJobEvaluator",
|
|
7310
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7311
|
+
stateMutability: "view",
|
|
7312
|
+
type: "function"
|
|
7313
|
+
},
|
|
7314
|
+
{
|
|
7315
|
+
inputs: [
|
|
7316
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7317
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7318
|
+
],
|
|
7319
|
+
name: "isMemoSigner",
|
|
7320
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7321
|
+
stateMutability: "view",
|
|
7322
|
+
type: "function"
|
|
7323
|
+
},
|
|
7324
|
+
{
|
|
7325
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7326
|
+
name: "isPayable",
|
|
7327
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7328
|
+
stateMutability: "view",
|
|
7329
|
+
type: "function"
|
|
7330
|
+
},
|
|
7331
|
+
{
|
|
7332
|
+
inputs: [],
|
|
7333
|
+
name: "jobManager",
|
|
7334
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7335
|
+
stateMutability: "view",
|
|
7336
|
+
type: "function"
|
|
7337
|
+
},
|
|
7338
|
+
{
|
|
7339
|
+
inputs: [
|
|
7340
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7341
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7342
|
+
],
|
|
7343
|
+
name: "jobMemos",
|
|
7344
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7345
|
+
stateMutability: "view",
|
|
7346
|
+
type: "function"
|
|
7347
|
+
},
|
|
7348
|
+
{
|
|
7349
|
+
inputs: [
|
|
7350
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7351
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "", type: "uint8" },
|
|
7352
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7353
|
+
],
|
|
7354
|
+
name: "jobMemosByPhase",
|
|
7355
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7356
|
+
stateMutability: "view",
|
|
7357
|
+
type: "function"
|
|
7358
|
+
},
|
|
7359
|
+
{
|
|
7360
|
+
inputs: [
|
|
7361
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7362
|
+
{ internalType: "enum ACPTypes.MemoType", name: "", type: "uint8" },
|
|
7363
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7364
|
+
],
|
|
7365
|
+
name: "jobMemosByType",
|
|
7366
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7367
|
+
stateMutability: "view",
|
|
7368
|
+
type: "function"
|
|
7369
|
+
},
|
|
7370
|
+
{
|
|
7371
|
+
inputs: [
|
|
7372
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7373
|
+
{ internalType: "address", name: "", type: "address" }
|
|
7374
|
+
],
|
|
7375
|
+
name: "memoApprovals",
|
|
7376
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7377
|
+
stateMutability: "view",
|
|
7378
|
+
type: "function"
|
|
7379
|
+
},
|
|
7380
|
+
{
|
|
7381
|
+
inputs: [],
|
|
7382
|
+
name: "memoCounter",
|
|
7383
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7384
|
+
stateMutability: "view",
|
|
7385
|
+
type: "function"
|
|
7386
|
+
},
|
|
7387
|
+
{
|
|
7388
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7389
|
+
name: "memos",
|
|
7390
|
+
outputs: [
|
|
7391
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7392
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7393
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7394
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7395
|
+
{
|
|
7396
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7397
|
+
name: "memoType",
|
|
7398
|
+
type: "uint8"
|
|
7399
|
+
},
|
|
7400
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7401
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7402
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7403
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7404
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7405
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7406
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7407
|
+
{
|
|
7408
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7409
|
+
name: "nextPhase",
|
|
7410
|
+
type: "uint8"
|
|
7411
|
+
},
|
|
7412
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7413
|
+
{ internalType: "enum ACPTypes.MemoState", name: "state", type: "uint8" }
|
|
7414
|
+
],
|
|
7415
|
+
stateMutability: "view",
|
|
7416
|
+
type: "function"
|
|
7417
|
+
},
|
|
7418
|
+
{
|
|
7419
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7420
|
+
name: "payableDetails",
|
|
7421
|
+
outputs: [
|
|
7422
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7423
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7424
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7425
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7426
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
7427
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7428
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7429
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7430
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7431
|
+
],
|
|
7432
|
+
stateMutability: "view",
|
|
7433
|
+
type: "function"
|
|
7434
|
+
},
|
|
7435
|
+
{
|
|
7436
|
+
inputs: [],
|
|
7437
|
+
name: "paymentManager",
|
|
7438
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7439
|
+
stateMutability: "view",
|
|
7440
|
+
type: "function"
|
|
7441
|
+
},
|
|
7442
|
+
{
|
|
7443
|
+
inputs: [],
|
|
7444
|
+
name: "proxiableUUID",
|
|
7445
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7446
|
+
stateMutability: "view",
|
|
7447
|
+
type: "function"
|
|
7448
|
+
},
|
|
7449
|
+
{
|
|
7450
|
+
inputs: [
|
|
7451
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7452
|
+
{ internalType: "address", name: "callerConfirmation", type: "address" }
|
|
7453
|
+
],
|
|
7454
|
+
name: "renounceRole",
|
|
7455
|
+
outputs: [],
|
|
7456
|
+
stateMutability: "nonpayable",
|
|
7457
|
+
type: "function"
|
|
7458
|
+
},
|
|
7459
|
+
{
|
|
7460
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7461
|
+
name: "requiredApprovals",
|
|
7462
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7463
|
+
stateMutability: "view",
|
|
7464
|
+
type: "function"
|
|
7465
|
+
},
|
|
7466
|
+
{
|
|
7467
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7468
|
+
name: "requiresApproval",
|
|
7469
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7470
|
+
stateMutability: "view",
|
|
7471
|
+
type: "function"
|
|
7472
|
+
},
|
|
7473
|
+
{
|
|
7474
|
+
inputs: [
|
|
7475
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7476
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7477
|
+
],
|
|
7478
|
+
name: "revokeRole",
|
|
7479
|
+
outputs: [],
|
|
7480
|
+
stateMutability: "nonpayable",
|
|
7481
|
+
type: "function"
|
|
7482
|
+
},
|
|
7483
|
+
{
|
|
7484
|
+
inputs: [
|
|
7485
|
+
{
|
|
7486
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7487
|
+
name: "memoType",
|
|
7488
|
+
type: "uint8"
|
|
7489
|
+
},
|
|
7490
|
+
{ internalType: "uint256", name: "requiredApprovals_", type: "uint256" }
|
|
7491
|
+
],
|
|
7492
|
+
name: "setApprovalRequirements",
|
|
7493
|
+
outputs: [],
|
|
7494
|
+
stateMutability: "nonpayable",
|
|
7495
|
+
type: "function"
|
|
7496
|
+
},
|
|
7497
|
+
{
|
|
7498
|
+
inputs: [
|
|
7499
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7500
|
+
],
|
|
7501
|
+
name: "setAssetManager",
|
|
7502
|
+
outputs: [],
|
|
7503
|
+
stateMutability: "nonpayable",
|
|
7504
|
+
type: "function"
|
|
7505
|
+
},
|
|
7506
|
+
{
|
|
7507
|
+
inputs: [
|
|
7508
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7509
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7510
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7511
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
7512
|
+
],
|
|
7513
|
+
name: "signMemo",
|
|
7514
|
+
outputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
|
|
7515
|
+
stateMutability: "nonpayable",
|
|
7516
|
+
type: "function"
|
|
7517
|
+
},
|
|
7518
|
+
{
|
|
7519
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
7520
|
+
name: "supportsInterface",
|
|
7521
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7522
|
+
stateMutability: "view",
|
|
7523
|
+
type: "function"
|
|
7524
|
+
},
|
|
7525
|
+
{
|
|
7526
|
+
inputs: [
|
|
7527
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7528
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7529
|
+
{ internalType: "address", name: "paymentManager_", type: "address" },
|
|
7530
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7531
|
+
],
|
|
7532
|
+
name: "updateContracts",
|
|
7533
|
+
outputs: [],
|
|
7534
|
+
stateMutability: "nonpayable",
|
|
7535
|
+
type: "function"
|
|
7536
|
+
},
|
|
7537
|
+
{
|
|
7538
|
+
inputs: [
|
|
7539
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7540
|
+
{ internalType: "string", name: "newContent", type: "string" }
|
|
7541
|
+
],
|
|
7542
|
+
name: "updateMemoContent",
|
|
7543
|
+
outputs: [],
|
|
7544
|
+
stateMutability: "nonpayable",
|
|
7545
|
+
type: "function"
|
|
7546
|
+
},
|
|
7547
|
+
{
|
|
7548
|
+
inputs: [
|
|
7549
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7550
|
+
{
|
|
7551
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7552
|
+
name: "newMemoState",
|
|
7553
|
+
type: "uint8"
|
|
7554
|
+
}
|
|
7555
|
+
],
|
|
7556
|
+
name: "updateMemoState",
|
|
7557
|
+
outputs: [],
|
|
7558
|
+
stateMutability: "nonpayable",
|
|
7559
|
+
type: "function"
|
|
7560
|
+
},
|
|
7561
|
+
{
|
|
7562
|
+
inputs: [
|
|
7563
|
+
{ internalType: "address", name: "newImplementation", type: "address" },
|
|
7564
|
+
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
7565
|
+
],
|
|
7566
|
+
name: "upgradeToAndCall",
|
|
7567
|
+
outputs: [],
|
|
7568
|
+
stateMutability: "payable",
|
|
7569
|
+
type: "function"
|
|
7570
|
+
},
|
|
7571
|
+
{
|
|
7572
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7573
|
+
name: "withdrawEscrowedFunds",
|
|
7574
|
+
outputs: [],
|
|
7575
|
+
stateMutability: "nonpayable",
|
|
7576
|
+
type: "function"
|
|
7577
|
+
}
|
|
7578
|
+
];
|
|
7579
|
+
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7580
|
+
|
|
7581
|
+
// src/contractClients/acpContractClientV2.ts
|
|
7582
|
+
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7583
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7584
|
+
super(agentWalletAddress, config);
|
|
7585
|
+
this.jobManagerAddress = jobManagerAddress;
|
|
7586
|
+
this.memoManagerAddress = memoManagerAddress;
|
|
7587
|
+
this.accountManagerAddress = accountManagerAddress;
|
|
7588
|
+
this.PRIORITY_FEE_MULTIPLIER = 2;
|
|
7589
|
+
this.MAX_FEE_PER_GAS = 2e7;
|
|
7590
|
+
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
7591
|
+
this.GAS_FEE_MULTIPLIER = 0.5;
|
|
7592
|
+
this.RETRY_CONFIG = {
|
|
7593
|
+
intervalMs: 200,
|
|
7594
|
+
multiplier: 1.1,
|
|
7595
|
+
maxRetries: 10
|
|
7596
|
+
};
|
|
7597
|
+
this._sessionKeyClients = {};
|
|
7598
|
+
}
|
|
7599
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7600
|
+
const publicClients = {};
|
|
7601
|
+
for (const chain of config.chains) {
|
|
7602
|
+
publicClients[chain.id] = (0, import_viem9.createPublicClient)({
|
|
7603
|
+
chain,
|
|
7604
|
+
transport: (0, import_viem9.http)(`${config.alchemyRpcUrl}?chainId=${chain.id}`)
|
|
7605
|
+
});
|
|
7606
|
+
}
|
|
7607
|
+
const publicClient = (0, import_viem9.createPublicClient)({
|
|
7608
|
+
chain: config.chain,
|
|
7609
|
+
transport: (0, import_viem9.http)(config.rpcEndpoint)
|
|
7610
|
+
});
|
|
7611
|
+
const [jobManagerAddress, memoManagerAddress, accountManagerAddress] = await publicClient.multicall({
|
|
7612
|
+
contracts: [
|
|
7613
|
+
{
|
|
7614
|
+
address: config.contractAddress,
|
|
7615
|
+
abi: config.abi,
|
|
7616
|
+
functionName: "jobManager"
|
|
7617
|
+
},
|
|
7618
|
+
{
|
|
7619
|
+
address: config.contractAddress,
|
|
7620
|
+
abi: config.abi,
|
|
7621
|
+
functionName: "memoManager"
|
|
7622
|
+
},
|
|
7623
|
+
{
|
|
7624
|
+
address: config.contractAddress,
|
|
7625
|
+
abi: config.abi,
|
|
7626
|
+
functionName: "accountManager"
|
|
7627
|
+
}
|
|
7628
|
+
]
|
|
7629
|
+
});
|
|
7630
|
+
if (!jobManagerAddress || !memoManagerAddress || !accountManagerAddress) {
|
|
7631
|
+
throw new acpError_default(
|
|
7632
|
+
"Failed to get job manager, memo manager, or account manager address"
|
|
7633
|
+
);
|
|
7634
|
+
}
|
|
7635
|
+
const acpContractClient = new _AcpContractClientV2(
|
|
7636
|
+
jobManagerAddress.result,
|
|
7637
|
+
memoManagerAddress.result,
|
|
7638
|
+
accountManagerAddress.result,
|
|
7639
|
+
agentWalletAddress,
|
|
7640
|
+
config
|
|
7641
|
+
);
|
|
7642
|
+
acpContractClient.publicClients = publicClients;
|
|
7643
|
+
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
7644
|
+
return acpContractClient;
|
|
7645
|
+
}
|
|
7646
|
+
async init(privateKey, sessionEntityKeyId) {
|
|
7647
|
+
const sessionKeySigner = import_core2.LocalAccountSigner.privateKeyToAccountSigner(privateKey);
|
|
7648
|
+
this._sessionKeyClient = await (0, import_smart_contracts2.createModularAccountV2Client)({
|
|
7649
|
+
chain: this.chain,
|
|
7650
|
+
transport: (0, import_infra3.alchemy)({
|
|
7651
|
+
rpcUrl: this.config.alchemyRpcUrl
|
|
7652
|
+
}),
|
|
7653
|
+
signer: sessionKeySigner,
|
|
7654
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7655
|
+
accountAddress: this.agentWalletAddress,
|
|
7656
|
+
signerEntity: {
|
|
7657
|
+
entityId: sessionEntityKeyId,
|
|
7658
|
+
isGlobalValidation: true
|
|
7659
|
+
}
|
|
7660
|
+
});
|
|
7661
|
+
for (const chain of this.config.chains) {
|
|
7662
|
+
this._sessionKeyClients[chain.id] = await (0, import_smart_contracts2.createModularAccountV2Client)({
|
|
7663
|
+
chain,
|
|
7664
|
+
transport: (0, import_infra3.alchemy)({
|
|
7665
|
+
rpcUrl: `${this.config.alchemyRpcUrl}?chainId=${chain.id}`
|
|
7666
|
+
}),
|
|
7667
|
+
signer: sessionKeySigner,
|
|
7668
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7669
|
+
accountAddress: this.agentWalletAddress,
|
|
7670
|
+
signerEntity: {
|
|
7671
|
+
entityId: sessionEntityKeyId,
|
|
7672
|
+
isGlobalValidation: true
|
|
7673
|
+
}
|
|
7674
|
+
});
|
|
7675
|
+
}
|
|
7676
|
+
this._acpX402 = new AcpX402(
|
|
7677
|
+
this.config,
|
|
7678
|
+
this.sessionKeyClient,
|
|
7679
|
+
this.publicClient
|
|
7680
|
+
);
|
|
7681
|
+
const account = this.sessionKeyClient.account;
|
|
7682
|
+
const sessionSignerAddress = await account.getSigner().getAddress();
|
|
7683
|
+
if (!await account.isAccountDeployed()) {
|
|
7684
|
+
throw new acpError_default(
|
|
7685
|
+
`ACP Contract Client validation failed: agent account ${this.agentWalletAddress} is not deployed on-chain`
|
|
7686
|
+
);
|
|
7687
|
+
}
|
|
6155
7688
|
await this.validateSessionKeyOnChain(
|
|
6156
7689
|
sessionSignerAddress,
|
|
6157
7690
|
sessionEntityKeyId
|
|
@@ -6184,11 +7717,20 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6184
7717
|
}
|
|
6185
7718
|
return this._acpX402;
|
|
6186
7719
|
}
|
|
6187
|
-
async calculateGasFees() {
|
|
7720
|
+
async calculateGasFees(chainId) {
|
|
7721
|
+
if (chainId) {
|
|
7722
|
+
const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
|
|
7723
|
+
const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
|
|
7724
|
+
return increasedMaxFeePerGas;
|
|
7725
|
+
}
|
|
6188
7726
|
const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
|
|
6189
7727
|
return finalMaxFeePerGas;
|
|
6190
7728
|
}
|
|
6191
|
-
async handleOperation(operations) {
|
|
7729
|
+
async handleOperation(operations, chainId) {
|
|
7730
|
+
const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
|
|
7731
|
+
if (!sessionKeyClient) {
|
|
7732
|
+
throw new acpError_default("Session key client not initialized");
|
|
7733
|
+
}
|
|
6192
7734
|
const basePayload = {
|
|
6193
7735
|
uo: operations.map((operation) => ({
|
|
6194
7736
|
target: operation.contractAddress,
|
|
@@ -6213,12 +7755,17 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6213
7755
|
}
|
|
6214
7756
|
}
|
|
6215
7757
|
};
|
|
6216
|
-
const { hash } = await
|
|
6217
|
-
const
|
|
7758
|
+
const { hash } = await sessionKeyClient.sendUserOperation(payload);
|
|
7759
|
+
const checkTransactionConfig = {
|
|
6218
7760
|
hash,
|
|
6219
|
-
tag: "pending",
|
|
6220
7761
|
retries: this.RETRY_CONFIG
|
|
6221
|
-
}
|
|
7762
|
+
};
|
|
7763
|
+
if (!chainId || chainId === import_chains3.baseSepolia.id || chainId === import_chains3.base.id) {
|
|
7764
|
+
checkTransactionConfig["tag"] = "pending";
|
|
7765
|
+
}
|
|
7766
|
+
const txnHash = await sessionKeyClient.waitForUserOperationTransaction(
|
|
7767
|
+
checkTransactionConfig
|
|
7768
|
+
);
|
|
6222
7769
|
return { userOpHash: hash, txnHash };
|
|
6223
7770
|
} catch (error) {
|
|
6224
7771
|
iteration++;
|
|
@@ -6242,7 +7789,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6242
7789
|
const contractLogs = result.logs.filter((log) => {
|
|
6243
7790
|
return log.address.toLowerCase() === this.jobManagerAddress.toLowerCase();
|
|
6244
7791
|
}).map(
|
|
6245
|
-
(log) => (0,
|
|
7792
|
+
(log) => (0, import_viem9.decodeEventLog)({
|
|
6246
7793
|
abi: jobManagerAbi_default,
|
|
6247
7794
|
data: log.data,
|
|
6248
7795
|
topics: log.topics
|
|
@@ -6281,6 +7828,13 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6281
7828
|
throw new acpError_default("Failed to get X402 payment details", error);
|
|
6282
7829
|
}
|
|
6283
7830
|
}
|
|
7831
|
+
async getAssetManager() {
|
|
7832
|
+
return await this.publicClient.readContract({
|
|
7833
|
+
address: this.memoManagerAddress,
|
|
7834
|
+
abi: memoManagerAbi_default,
|
|
7835
|
+
functionName: "assetManager"
|
|
7836
|
+
});
|
|
7837
|
+
}
|
|
6284
7838
|
getAcpVersion() {
|
|
6285
7839
|
return "2";
|
|
6286
7840
|
}
|
|
@@ -6305,6 +7859,7 @@ var index_default = acpClient_default;
|
|
|
6305
7859
|
AcpJob,
|
|
6306
7860
|
AcpJobPhases,
|
|
6307
7861
|
AcpMemo,
|
|
7862
|
+
AcpMemoState,
|
|
6308
7863
|
AcpMemoStatus,
|
|
6309
7864
|
AcpOnlineStatus,
|
|
6310
7865
|
BaseAcpContractClient,
|
|
@@ -6318,6 +7873,7 @@ var index_default = acpClient_default;
|
|
|
6318
7873
|
baseAcpX402ConfigV2,
|
|
6319
7874
|
baseSepoliaAcpConfig,
|
|
6320
7875
|
baseSepoliaAcpConfigV2,
|
|
7876
|
+
baseSepoliaAcpX402ConfigV2,
|
|
6321
7877
|
ethFare,
|
|
6322
7878
|
preparePayload,
|
|
6323
7879
|
wethFare
|