@virtuals-protocol/acp-node 0.3.0-beta.22 → 0.3.0-beta.23
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 +53 -23
- package/dist/index.d.ts +53 -23
- package/dist/index.js +1576 -126
- package/dist/index.mjs +1584 -119
- 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.23",
|
|
39
39
|
main: "./dist/index.js",
|
|
40
40
|
module: "./dist/index.mjs",
|
|
41
41
|
types: "./dist/index.d.ts",
|
|
@@ -92,6 +92,7 @@ __export(index_exports, {
|
|
|
92
92
|
AcpJob: () => acpJob_default,
|
|
93
93
|
AcpJobPhases: () => AcpJobPhases,
|
|
94
94
|
AcpMemo: () => acpMemo_default,
|
|
95
|
+
AcpMemoState: () => AcpMemoState,
|
|
95
96
|
AcpMemoStatus: () => AcpMemoStatus,
|
|
96
97
|
AcpOnlineStatus: () => AcpOnlineStatus,
|
|
97
98
|
BaseAcpContractClient: () => baseAcpContractClient_default,
|
|
@@ -107,6 +108,7 @@ __export(index_exports, {
|
|
|
107
108
|
baseAcpX402ConfigV2: () => baseAcpX402ConfigV2,
|
|
108
109
|
baseSepoliaAcpConfig: () => baseSepoliaAcpConfig,
|
|
109
110
|
baseSepoliaAcpConfigV2: () => baseSepoliaAcpConfigV2,
|
|
111
|
+
baseSepoliaAcpX402ConfigV2: () => baseSepoliaAcpX402ConfigV2,
|
|
110
112
|
default: () => index_default,
|
|
111
113
|
ethFare: () => ethFare,
|
|
112
114
|
preparePayload: () => preparePayload,
|
|
@@ -1285,7 +1287,7 @@ var ACP_ABI = [
|
|
|
1285
1287
|
var acpAbi_default = ACP_ABI;
|
|
1286
1288
|
|
|
1287
1289
|
// src/acpClient.ts
|
|
1288
|
-
var
|
|
1290
|
+
var import_viem6 = require("viem");
|
|
1289
1291
|
var import_socket = require("socket.io-client");
|
|
1290
1292
|
|
|
1291
1293
|
// src/contractClients/baseAcpContractClient.ts
|
|
@@ -1314,27 +1316,42 @@ var acpError_default = AcpError;
|
|
|
1314
1316
|
|
|
1315
1317
|
// src/acpFare.ts
|
|
1316
1318
|
var Fare = class _Fare {
|
|
1317
|
-
constructor(contractAddress, decimals) {
|
|
1319
|
+
constructor(contractAddress, decimals, chainId) {
|
|
1318
1320
|
this.contractAddress = contractAddress;
|
|
1319
1321
|
this.decimals = decimals;
|
|
1322
|
+
this.chainId = chainId;
|
|
1320
1323
|
}
|
|
1321
1324
|
formatAmount(amount) {
|
|
1322
1325
|
return (0, import_viem.parseUnits)(amount.toString(), this.decimals);
|
|
1323
1326
|
}
|
|
1324
|
-
static async fromContractAddress(contractAddress, config = baseAcpConfig) {
|
|
1327
|
+
static async fromContractAddress(contractAddress, config = baseAcpConfig, chainId = config.chain.id) {
|
|
1325
1328
|
if (contractAddress === config.baseFare.contractAddress) {
|
|
1326
1329
|
return config.baseFare;
|
|
1327
1330
|
}
|
|
1331
|
+
let chainConfig = config.chain;
|
|
1332
|
+
let rpcUrl = config.rpcEndpoint;
|
|
1333
|
+
if (chainId !== config.chain.id) {
|
|
1334
|
+
const selectedConfig = config.chains?.find(
|
|
1335
|
+
(chain) => chain.chain.id === chainId
|
|
1336
|
+
);
|
|
1337
|
+
if (!selectedConfig) {
|
|
1338
|
+
throw new acpError_default(
|
|
1339
|
+
`Chain configuration for chainId ${chainId} not found.`
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
chainConfig = selectedConfig.chain;
|
|
1343
|
+
rpcUrl = selectedConfig.rpcUrl;
|
|
1344
|
+
}
|
|
1328
1345
|
const publicClient = (0, import_viem.createPublicClient)({
|
|
1329
|
-
chain:
|
|
1330
|
-
transport: (0, import_viem.http)(
|
|
1346
|
+
chain: chainConfig,
|
|
1347
|
+
transport: (0, import_viem.http)(rpcUrl)
|
|
1331
1348
|
});
|
|
1332
1349
|
const decimals = await publicClient.readContract({
|
|
1333
1350
|
address: contractAddress,
|
|
1334
1351
|
abi: import_viem.erc20Abi,
|
|
1335
1352
|
functionName: "decimals"
|
|
1336
1353
|
});
|
|
1337
|
-
return new _Fare(contractAddress, decimals);
|
|
1354
|
+
return new _Fare(contractAddress, decimals, chainId);
|
|
1338
1355
|
}
|
|
1339
1356
|
};
|
|
1340
1357
|
var FareAmountBase = class {
|
|
@@ -1753,6 +1770,34 @@ var ACP_V2_ABI = [
|
|
|
1753
1770
|
stateMutability: "nonpayable",
|
|
1754
1771
|
type: "function"
|
|
1755
1772
|
},
|
|
1773
|
+
{
|
|
1774
|
+
inputs: [
|
|
1775
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
1776
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
1777
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
1778
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
1779
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
1780
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
1781
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
1782
|
+
{
|
|
1783
|
+
internalType: "enum ACPTypes.MemoType",
|
|
1784
|
+
name: "memoType",
|
|
1785
|
+
type: "uint8"
|
|
1786
|
+
},
|
|
1787
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1788
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
1789
|
+
{
|
|
1790
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
1791
|
+
name: "nextPhase",
|
|
1792
|
+
type: "uint8"
|
|
1793
|
+
},
|
|
1794
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
1795
|
+
],
|
|
1796
|
+
name: "createCrossChainPayableMemo",
|
|
1797
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1798
|
+
stateMutability: "nonpayable",
|
|
1799
|
+
type: "function"
|
|
1800
|
+
},
|
|
1756
1801
|
{
|
|
1757
1802
|
inputs: [
|
|
1758
1803
|
{ internalType: "address", name: "provider", type: "address" },
|
|
@@ -1937,7 +1982,12 @@ var ACP_V2_ABI = [
|
|
|
1937
1982
|
name: "nextPhase",
|
|
1938
1983
|
type: "uint8"
|
|
1939
1984
|
},
|
|
1940
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
1985
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1986
|
+
{
|
|
1987
|
+
internalType: "enum ACPTypes.MemoState",
|
|
1988
|
+
name: "state",
|
|
1989
|
+
type: "uint8"
|
|
1990
|
+
}
|
|
1941
1991
|
],
|
|
1942
1992
|
internalType: "struct ACPTypes.Memo[]",
|
|
1943
1993
|
name: "memos",
|
|
@@ -1984,7 +2034,12 @@ var ACP_V2_ABI = [
|
|
|
1984
2034
|
name: "nextPhase",
|
|
1985
2035
|
type: "uint8"
|
|
1986
2036
|
},
|
|
1987
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
2037
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
2038
|
+
{
|
|
2039
|
+
internalType: "enum ACPTypes.MemoState",
|
|
2040
|
+
name: "state",
|
|
2041
|
+
type: "uint8"
|
|
2042
|
+
}
|
|
1988
2043
|
],
|
|
1989
2044
|
internalType: "struct ACPTypes.Memo[]",
|
|
1990
2045
|
name: "memos",
|
|
@@ -2027,7 +2082,12 @@ var ACP_V2_ABI = [
|
|
|
2027
2082
|
name: "nextPhase",
|
|
2028
2083
|
type: "uint8"
|
|
2029
2084
|
},
|
|
2030
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
2085
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
2086
|
+
{
|
|
2087
|
+
internalType: "enum ACPTypes.MemoState",
|
|
2088
|
+
name: "state",
|
|
2089
|
+
type: "uint8"
|
|
2090
|
+
}
|
|
2031
2091
|
],
|
|
2032
2092
|
internalType: "struct ACPTypes.Memo[]",
|
|
2033
2093
|
name: "memos",
|
|
@@ -2283,7 +2343,7 @@ var acpAbiV2_default = ACP_V2_ABI;
|
|
|
2283
2343
|
var V1_MAX_RETRIES = 10;
|
|
2284
2344
|
var V2_MAX_RETRIES = 3;
|
|
2285
2345
|
var AcpContractConfig2 = class {
|
|
2286
|
-
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, retryConfig) {
|
|
2346
|
+
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, retryConfig, chains = []) {
|
|
2287
2347
|
this.chain = chain;
|
|
2288
2348
|
this.contractAddress = contractAddress;
|
|
2289
2349
|
this.baseFare = baseFare;
|
|
@@ -2294,6 +2354,7 @@ var AcpContractConfig2 = class {
|
|
|
2294
2354
|
this.rpcEndpoint = rpcEndpoint;
|
|
2295
2355
|
this.x402Config = x402Config;
|
|
2296
2356
|
this.retryConfig = retryConfig;
|
|
2357
|
+
this.chains = chains;
|
|
2297
2358
|
}
|
|
2298
2359
|
};
|
|
2299
2360
|
var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
@@ -3569,6 +3630,7 @@ var BaseAcpContractClient = class {
|
|
|
3569
3630
|
constructor(agentWalletAddress, config = baseAcpConfig) {
|
|
3570
3631
|
this.agentWalletAddress = agentWalletAddress;
|
|
3571
3632
|
this.config = config;
|
|
3633
|
+
this.publicClients = {};
|
|
3572
3634
|
this.chain = config.chain;
|
|
3573
3635
|
this.abi = config.abi;
|
|
3574
3636
|
this.contractAddress = config.contractAddress;
|
|
@@ -3668,12 +3730,12 @@ ${JSON.stringify(
|
|
|
3668
3730
|
throw new acpError_default("Failed to create job", error);
|
|
3669
3731
|
}
|
|
3670
3732
|
}
|
|
3671
|
-
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
3733
|
+
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress, targetAddress) {
|
|
3672
3734
|
try {
|
|
3673
3735
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
3674
3736
|
abi: import_viem2.erc20Abi,
|
|
3675
3737
|
functionName: "approve",
|
|
3676
|
-
args: [this.contractAddress, amountBaseUnit]
|
|
3738
|
+
args: [targetAddress ?? this.contractAddress, amountBaseUnit]
|
|
3677
3739
|
});
|
|
3678
3740
|
const payload = {
|
|
3679
3741
|
data,
|
|
@@ -3712,6 +3774,35 @@ ${JSON.stringify(
|
|
|
3712
3774
|
throw new acpError_default("Failed to create payable memo", error);
|
|
3713
3775
|
}
|
|
3714
3776
|
}
|
|
3777
|
+
createCrossChainPayableMemo(jobId, content, token, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, type, expiredAt, nextPhase, destinationEid, secured = true) {
|
|
3778
|
+
try {
|
|
3779
|
+
const data = (0, import_viem2.encodeFunctionData)({
|
|
3780
|
+
abi: this.abi,
|
|
3781
|
+
functionName: "createCrossChainPayableMemo",
|
|
3782
|
+
args: [
|
|
3783
|
+
jobId,
|
|
3784
|
+
content,
|
|
3785
|
+
token,
|
|
3786
|
+
amountBaseUnit,
|
|
3787
|
+
recipient,
|
|
3788
|
+
feeAmountBaseUnit,
|
|
3789
|
+
feeType,
|
|
3790
|
+
type,
|
|
3791
|
+
expiredAt,
|
|
3792
|
+
secured,
|
|
3793
|
+
nextPhase,
|
|
3794
|
+
destinationEid
|
|
3795
|
+
]
|
|
3796
|
+
});
|
|
3797
|
+
const payload = {
|
|
3798
|
+
data,
|
|
3799
|
+
contractAddress: this.contractAddress
|
|
3800
|
+
};
|
|
3801
|
+
return payload;
|
|
3802
|
+
} catch (error) {
|
|
3803
|
+
throw new acpError_default("Failed to create cross chain payable memo", error);
|
|
3804
|
+
}
|
|
3805
|
+
}
|
|
3715
3806
|
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
3716
3807
|
try {
|
|
3717
3808
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
@@ -3728,6 +3819,22 @@ ${JSON.stringify(
|
|
|
3728
3819
|
throw new acpError_default("Failed to create memo", error);
|
|
3729
3820
|
}
|
|
3730
3821
|
}
|
|
3822
|
+
createMemoWithMetadata(jobId, content, type, isSecured, nextPhase, metadata) {
|
|
3823
|
+
try {
|
|
3824
|
+
const data = (0, import_viem2.encodeFunctionData)({
|
|
3825
|
+
abi: this.abi,
|
|
3826
|
+
functionName: "createMemoWithMetadata",
|
|
3827
|
+
args: [jobId, content, type, isSecured, nextPhase, metadata]
|
|
3828
|
+
});
|
|
3829
|
+
const payload = {
|
|
3830
|
+
data,
|
|
3831
|
+
contractAddress: this.contractAddress
|
|
3832
|
+
};
|
|
3833
|
+
return payload;
|
|
3834
|
+
} catch (error) {
|
|
3835
|
+
throw new acpError_default("Failed to create memo with metadata", error);
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3731
3838
|
signMemo(memoId, isApproved, reason) {
|
|
3732
3839
|
try {
|
|
3733
3840
|
const data = (0, import_viem2.encodeFunctionData)({
|
|
@@ -3813,9 +3920,47 @@ ${JSON.stringify(
|
|
|
3813
3920
|
throw new acpError_default("Failed to submit TransferWithAuthorization", error);
|
|
3814
3921
|
}
|
|
3815
3922
|
}
|
|
3923
|
+
async getERC20Balance(chainId, tokenAddress, walletAddress) {
|
|
3924
|
+
const publicClient = this.publicClients[chainId];
|
|
3925
|
+
if (!publicClient) {
|
|
3926
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3927
|
+
}
|
|
3928
|
+
return await publicClient.readContract({
|
|
3929
|
+
address: tokenAddress,
|
|
3930
|
+
abi: import_viem2.erc20Abi,
|
|
3931
|
+
functionName: "balanceOf",
|
|
3932
|
+
args: [walletAddress]
|
|
3933
|
+
});
|
|
3934
|
+
}
|
|
3935
|
+
async getERC20Allowance(chainId, tokenAddress, walletAddress, spenderAddress) {
|
|
3936
|
+
const publicClient = this.publicClients[chainId];
|
|
3937
|
+
if (!publicClient) {
|
|
3938
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3939
|
+
}
|
|
3940
|
+
return await publicClient.readContract({
|
|
3941
|
+
address: tokenAddress,
|
|
3942
|
+
abi: import_viem2.erc20Abi,
|
|
3943
|
+
functionName: "allowance",
|
|
3944
|
+
args: [walletAddress, spenderAddress]
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
async getERC20Symbol(chainId, tokenAddress) {
|
|
3948
|
+
const publicClient = this.publicClients[chainId];
|
|
3949
|
+
if (!publicClient) {
|
|
3950
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3951
|
+
}
|
|
3952
|
+
return await publicClient.readContract({
|
|
3953
|
+
address: tokenAddress,
|
|
3954
|
+
abi: import_viem2.erc20Abi,
|
|
3955
|
+
functionName: "symbol"
|
|
3956
|
+
});
|
|
3957
|
+
}
|
|
3816
3958
|
};
|
|
3817
3959
|
var baseAcpContractClient_default = BaseAcpContractClient;
|
|
3818
3960
|
|
|
3961
|
+
// src/acpJob.ts
|
|
3962
|
+
var import_viem5 = require("viem");
|
|
3963
|
+
|
|
3819
3964
|
// src/interfaces.ts
|
|
3820
3965
|
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
3821
3966
|
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
@@ -3823,6 +3968,15 @@ var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
|
3823
3968
|
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
3824
3969
|
return AcpMemoStatus2;
|
|
3825
3970
|
})(AcpMemoStatus || {});
|
|
3971
|
+
var AcpMemoState = /* @__PURE__ */ ((AcpMemoState2) => {
|
|
3972
|
+
AcpMemoState2[AcpMemoState2["NONE"] = 0] = "NONE";
|
|
3973
|
+
AcpMemoState2[AcpMemoState2["PENDING"] = 1] = "PENDING";
|
|
3974
|
+
AcpMemoState2[AcpMemoState2["IN_PROGRESS"] = 2] = "IN_PROGRESS";
|
|
3975
|
+
AcpMemoState2[AcpMemoState2["READY"] = 3] = "READY";
|
|
3976
|
+
AcpMemoState2[AcpMemoState2["COMPLETED"] = 4] = "COMPLETED";
|
|
3977
|
+
AcpMemoState2[AcpMemoState2["REJECTED"] = 5] = "REJECTED";
|
|
3978
|
+
return AcpMemoState2;
|
|
3979
|
+
})(AcpMemoState || {});
|
|
3826
3980
|
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
3827
3981
|
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
3828
3982
|
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
@@ -3861,6 +4015,8 @@ var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
|
|
|
3861
4015
|
})(PositionDirection || {});
|
|
3862
4016
|
|
|
3863
4017
|
// src/utils.ts
|
|
4018
|
+
var import_viem3 = require("viem");
|
|
4019
|
+
var import_chains2 = require("viem/chains");
|
|
3864
4020
|
function tryParseJson(content) {
|
|
3865
4021
|
try {
|
|
3866
4022
|
return JSON.parse(content);
|
|
@@ -3877,9 +4033,34 @@ function safeBase64Encode(data) {
|
|
|
3877
4033
|
}
|
|
3878
4034
|
return Buffer.from(data).toString("base64");
|
|
3879
4035
|
}
|
|
4036
|
+
function getDestinationEndpointId(chainId) {
|
|
4037
|
+
switch (chainId) {
|
|
4038
|
+
case import_chains2.baseSepolia.id:
|
|
4039
|
+
return 40245;
|
|
4040
|
+
case import_chains2.sepolia.id:
|
|
4041
|
+
return 40161;
|
|
4042
|
+
case import_chains2.polygonAmoy.id:
|
|
4043
|
+
return 40267;
|
|
4044
|
+
case import_chains2.arbitrumSepolia.id:
|
|
4045
|
+
return 40231;
|
|
4046
|
+
case import_chains2.bscTestnet.id:
|
|
4047
|
+
return 40102;
|
|
4048
|
+
case import_chains2.base.id:
|
|
4049
|
+
return 30184;
|
|
4050
|
+
case import_chains2.mainnet.id:
|
|
4051
|
+
return 30101;
|
|
4052
|
+
case import_chains2.polygon.id:
|
|
4053
|
+
return 30109;
|
|
4054
|
+
case import_chains2.arbitrum.id:
|
|
4055
|
+
return 30110;
|
|
4056
|
+
case import_chains2.bsc.id:
|
|
4057
|
+
return 30102;
|
|
4058
|
+
}
|
|
4059
|
+
throw new Error(`Unsupported chain ID: ${chainId}`);
|
|
4060
|
+
}
|
|
3880
4061
|
|
|
3881
4062
|
// src/acpJobOffering.ts
|
|
3882
|
-
var
|
|
4063
|
+
var import_viem4 = require("viem");
|
|
3883
4064
|
var import_ajv = __toESM(require("ajv"));
|
|
3884
4065
|
var AcpJobOffering = class {
|
|
3885
4066
|
constructor(acpClient, acpContractClient, providerAddress, name, price, priceType = "fixed" /* FIXED */, requirement) {
|
|
@@ -3938,7 +4119,7 @@ var AcpJobOffering = class {
|
|
|
3938
4119
|
} else {
|
|
3939
4120
|
createJobPayload = this.acpContractClient.createJobWithAccount(
|
|
3940
4121
|
account.id,
|
|
3941
|
-
evaluatorAddress ||
|
|
4122
|
+
evaluatorAddress || import_viem4.zeroAddress,
|
|
3942
4123
|
fareAmount.amount,
|
|
3943
4124
|
fareAmount.fare.contractAddress,
|
|
3944
4125
|
expiredAt,
|
|
@@ -4079,25 +4260,43 @@ var AcpJob = class {
|
|
|
4079
4260
|
}
|
|
4080
4261
|
const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
|
|
4081
4262
|
const isPercentagePricing = this.priceType === "percentage" /* PERCENTAGE */;
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
this.
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4263
|
+
if (amount.fare.chainId && amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4264
|
+
operations.push(
|
|
4265
|
+
this.acpContractClient.createCrossChainPayableMemo(
|
|
4266
|
+
this.id,
|
|
4267
|
+
content,
|
|
4268
|
+
amount.fare.contractAddress,
|
|
4269
|
+
amount.amount,
|
|
4270
|
+
recipient,
|
|
4271
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4272
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4273
|
+
type,
|
|
4274
|
+
expiredAt,
|
|
4275
|
+
2 /* TRANSACTION */,
|
|
4276
|
+
getDestinationEndpointId(amount.fare.chainId)
|
|
4277
|
+
)
|
|
4278
|
+
);
|
|
4279
|
+
} else {
|
|
4280
|
+
operations.push(
|
|
4281
|
+
this.acpContractClient.createPayableMemo(
|
|
4282
|
+
this.id,
|
|
4283
|
+
content,
|
|
4284
|
+
amount.amount,
|
|
4285
|
+
recipient,
|
|
4286
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4287
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4288
|
+
2 /* TRANSACTION */,
|
|
4289
|
+
type,
|
|
4290
|
+
expiredAt,
|
|
4291
|
+
amount.fare.contractAddress
|
|
4292
|
+
)
|
|
4293
|
+
);
|
|
4294
|
+
}
|
|
4096
4295
|
return await this.acpContractClient.handleOperation(operations);
|
|
4097
4296
|
}
|
|
4098
4297
|
async payAndAcceptRequirement(reason) {
|
|
4099
4298
|
const memo = this.memos.find(
|
|
4100
|
-
(m) => m.nextPhase === 2 /* TRANSACTION */
|
|
4299
|
+
(m) => m.nextPhase === 2 /* TRANSACTION */ || m.nextPhase === 4 /* COMPLETED */
|
|
4101
4300
|
);
|
|
4102
4301
|
if (!memo) {
|
|
4103
4302
|
throw new acpError_default("No notification memo found");
|
|
@@ -4225,6 +4424,9 @@ var AcpJob = class {
|
|
|
4225
4424
|
if (this.latestMemo?.nextPhase !== 3 /* EVALUATION */) {
|
|
4226
4425
|
throw new acpError_default("No transaction memo found");
|
|
4227
4426
|
}
|
|
4427
|
+
if (amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4428
|
+
return await this.deliverCrossChainPayable(this.clientAddress, amount);
|
|
4429
|
+
}
|
|
4228
4430
|
const operations = [];
|
|
4229
4431
|
operations.push(
|
|
4230
4432
|
this.acpContractClient.approveAllowance(
|
|
@@ -4355,6 +4557,57 @@ var AcpJob = class {
|
|
|
4355
4557
|
waitMs = Math.min(waitMs * 2, maxWaitMs);
|
|
4356
4558
|
}
|
|
4357
4559
|
}
|
|
4560
|
+
async deliverCrossChainPayable(recipient, amount, isRequest = false) {
|
|
4561
|
+
if (!amount.fare.chainId) {
|
|
4562
|
+
throw new acpError_default("Chain ID is required for cross chain payable");
|
|
4563
|
+
}
|
|
4564
|
+
const chainId = amount.fare.chainId;
|
|
4565
|
+
const assetManagerAddress = await this.acpContractClient.getAssetManager();
|
|
4566
|
+
const tokenBalance = await this.acpContractClient.getERC20Balance(
|
|
4567
|
+
chainId,
|
|
4568
|
+
amount.fare.contractAddress,
|
|
4569
|
+
this.acpContractClient.agentWalletAddress
|
|
4570
|
+
);
|
|
4571
|
+
if (tokenBalance < amount.amount) {
|
|
4572
|
+
throw new acpError_default("Insufficient token balance for cross chain payable");
|
|
4573
|
+
}
|
|
4574
|
+
const currentAllowance = await this.acpContractClient.getERC20Allowance(
|
|
4575
|
+
chainId,
|
|
4576
|
+
amount.fare.contractAddress,
|
|
4577
|
+
this.acpContractClient.agentWalletAddress,
|
|
4578
|
+
assetManagerAddress
|
|
4579
|
+
);
|
|
4580
|
+
const approveAllowanceOperation = this.acpContractClient.approveAllowance(
|
|
4581
|
+
amount.amount + currentAllowance,
|
|
4582
|
+
amount.fare.contractAddress,
|
|
4583
|
+
assetManagerAddress
|
|
4584
|
+
);
|
|
4585
|
+
await this.acpContractClient.handleOperation(
|
|
4586
|
+
[approveAllowanceOperation],
|
|
4587
|
+
chainId
|
|
4588
|
+
);
|
|
4589
|
+
const tokenSymbol = await this.acpContractClient.getERC20Symbol(
|
|
4590
|
+
chainId,
|
|
4591
|
+
amount.fare.contractAddress
|
|
4592
|
+
);
|
|
4593
|
+
const createMemoOperation = this.acpContractClient.createCrossChainPayableMemo(
|
|
4594
|
+
this.id,
|
|
4595
|
+
`Performing cross chain payable transfer of ${(0, import_viem5.formatUnits)(
|
|
4596
|
+
amount.amount,
|
|
4597
|
+
amount.fare.decimals
|
|
4598
|
+
)} ${tokenSymbol} to ${recipient}`,
|
|
4599
|
+
amount.fare.contractAddress,
|
|
4600
|
+
amount.amount,
|
|
4601
|
+
recipient,
|
|
4602
|
+
BigInt(0),
|
|
4603
|
+
0 /* NO_FEE */,
|
|
4604
|
+
isRequest ? 6 /* PAYABLE_REQUEST */ : 7 /* PAYABLE_TRANSFER */,
|
|
4605
|
+
new Date(Date.now() + 1e3 * 60 * 5),
|
|
4606
|
+
isRequest ? 2 /* TRANSACTION */ : 4 /* COMPLETED */,
|
|
4607
|
+
getDestinationEndpointId(chainId)
|
|
4608
|
+
);
|
|
4609
|
+
await this.acpContractClient.handleOperation([createMemoOperation]);
|
|
4610
|
+
}
|
|
4358
4611
|
[util.inspect.custom]() {
|
|
4359
4612
|
return {
|
|
4360
4613
|
id: this.id,
|
|
@@ -4378,7 +4631,7 @@ var acpJob_default = AcpJob;
|
|
|
4378
4631
|
// src/acpMemo.ts
|
|
4379
4632
|
var import_util = __toESM(require("util"));
|
|
4380
4633
|
var AcpMemo = class {
|
|
4381
|
-
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash) {
|
|
4634
|
+
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash, state) {
|
|
4382
4635
|
this.contractClient = contractClient;
|
|
4383
4636
|
this.id = id;
|
|
4384
4637
|
this.type = type;
|
|
@@ -4391,6 +4644,7 @@ var AcpMemo = class {
|
|
|
4391
4644
|
this.payableDetails = payableDetails;
|
|
4392
4645
|
this.txHash = txHash;
|
|
4393
4646
|
this.signedTxHash = signedTxHash;
|
|
4647
|
+
this.state = state;
|
|
4394
4648
|
if (this.payableDetails) {
|
|
4395
4649
|
this.payableDetails.amount = BigInt(this.payableDetails.amount);
|
|
4396
4650
|
this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
|
|
@@ -4541,7 +4795,8 @@ var AcpClient = class {
|
|
|
4541
4795
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4542
4796
|
memo.payableDetails,
|
|
4543
4797
|
memo.txHash,
|
|
4544
|
-
memo.signedTxHash
|
|
4798
|
+
memo.signedTxHash,
|
|
4799
|
+
memo.state
|
|
4545
4800
|
);
|
|
4546
4801
|
}),
|
|
4547
4802
|
data.phase,
|
|
@@ -4579,7 +4834,8 @@ var AcpClient = class {
|
|
|
4579
4834
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4580
4835
|
memo.payableDetails,
|
|
4581
4836
|
memo.txHash,
|
|
4582
|
-
memo.signedTxHash
|
|
4837
|
+
memo.signedTxHash,
|
|
4838
|
+
memo.state
|
|
4583
4839
|
);
|
|
4584
4840
|
}),
|
|
4585
4841
|
data.phase,
|
|
@@ -4604,7 +4860,14 @@ var AcpClient = class {
|
|
|
4604
4860
|
process.on("SIGTERM", cleanup);
|
|
4605
4861
|
}
|
|
4606
4862
|
async browseAgents(keyword, options) {
|
|
4607
|
-
let {
|
|
4863
|
+
let {
|
|
4864
|
+
cluster,
|
|
4865
|
+
sort_by,
|
|
4866
|
+
top_k,
|
|
4867
|
+
graduationStatus,
|
|
4868
|
+
onlineStatus,
|
|
4869
|
+
showHiddenOfferings
|
|
4870
|
+
} = options;
|
|
4608
4871
|
top_k = top_k ?? 5;
|
|
4609
4872
|
let url = `${this.acpUrl}/api/agents/v4/search?search=${keyword}`;
|
|
4610
4873
|
if (sort_by && sort_by.length > 0) {
|
|
@@ -4686,7 +4949,7 @@ var AcpClient = class {
|
|
|
4686
4949
|
baseAcpConfig.contractAddress,
|
|
4687
4950
|
baseAcpX402Config.contractAddress
|
|
4688
4951
|
].includes(this.acpContractClient.config.contractAddress);
|
|
4689
|
-
const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress :
|
|
4952
|
+
const defaultEvaluatorAddress = isV1 && !evaluatorAddress ? this.walletAddress : import_viem6.zeroAddress;
|
|
4690
4953
|
const chainId = this.acpContractClient.config.chain.id;
|
|
4691
4954
|
const isUsdcPaymentToken = USDC_TOKEN_ADDRESS[chainId].toLowerCase() === fareAmount.fare.contractAddress.toLowerCase();
|
|
4692
4955
|
const isX402Job = this.acpContractClient.config.x402Config && isUsdcPaymentToken;
|
|
@@ -4795,7 +5058,8 @@ var AcpClient = class {
|
|
|
4795
5058
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4796
5059
|
memo.payableDetails,
|
|
4797
5060
|
memo.txHash,
|
|
4798
|
-
memo.signedTxHash
|
|
5061
|
+
memo.signedTxHash,
|
|
5062
|
+
memo.state
|
|
4799
5063
|
)
|
|
4800
5064
|
);
|
|
4801
5065
|
jobs.push(
|
|
@@ -4869,7 +5133,8 @@ var AcpClient = class {
|
|
|
4869
5133
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4870
5134
|
memo.payableDetails,
|
|
4871
5135
|
memo.txHash,
|
|
4872
|
-
memo.signedTxHash
|
|
5136
|
+
memo.signedTxHash,
|
|
5137
|
+
memo.state
|
|
4873
5138
|
)
|
|
4874
5139
|
);
|
|
4875
5140
|
return new acpJob_default(
|
|
@@ -4928,7 +5193,8 @@ var AcpClient = class {
|
|
|
4928
5193
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4929
5194
|
memo.payableDetails,
|
|
4930
5195
|
memo.txHash,
|
|
4931
|
-
memo.signedTxHash
|
|
5196
|
+
memo.signedTxHash,
|
|
5197
|
+
memo.state
|
|
4932
5198
|
);
|
|
4933
5199
|
} catch (err) {
|
|
4934
5200
|
throw new acpError_default(
|
|
@@ -4992,10 +5258,10 @@ var acpClient_default = AcpClient;
|
|
|
4992
5258
|
var import_core = require("@aa-sdk/core");
|
|
4993
5259
|
var import_infra2 = require("@account-kit/infra");
|
|
4994
5260
|
var import_smart_contracts = require("@account-kit/smart-contracts");
|
|
4995
|
-
var
|
|
5261
|
+
var import_viem8 = require("viem");
|
|
4996
5262
|
|
|
4997
5263
|
// src/acpX402.ts
|
|
4998
|
-
var
|
|
5264
|
+
var import_viem7 = require("viem");
|
|
4999
5265
|
var import_crypto = require("crypto");
|
|
5000
5266
|
var AcpX402 = class {
|
|
5001
5267
|
constructor(config, sessionKeyClient, publicClient) {
|
|
@@ -5053,7 +5319,7 @@ var AcpX402 = class {
|
|
|
5053
5319
|
contracts: [
|
|
5054
5320
|
{
|
|
5055
5321
|
address: USDC_CONTRACT,
|
|
5056
|
-
abi:
|
|
5322
|
+
abi: import_viem7.erc20Abi,
|
|
5057
5323
|
functionName: "name"
|
|
5058
5324
|
},
|
|
5059
5325
|
{
|
|
@@ -5270,7 +5536,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5270
5536
|
const contractLogs = result.logs.filter((log) => {
|
|
5271
5537
|
return log.address.toLowerCase() === this.contractAddress.toLowerCase();
|
|
5272
5538
|
}).map(
|
|
5273
|
-
(log) => (0,
|
|
5539
|
+
(log) => (0, import_viem8.decodeEventLog)({
|
|
5274
5540
|
abi: this.abi,
|
|
5275
5541
|
data: log.data,
|
|
5276
5542
|
topics: log.topics
|
|
@@ -5286,7 +5552,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5286
5552
|
}
|
|
5287
5553
|
createJob(providerAddress, evaluatorAddress, expireAt, paymentTokenAddress, budgetBaseUnit, metadata, isX402Job) {
|
|
5288
5554
|
try {
|
|
5289
|
-
const data = (0,
|
|
5555
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5290
5556
|
abi: this.abi,
|
|
5291
5557
|
functionName: isX402Job ? "createJobWithX402" : "createJob",
|
|
5292
5558
|
args: [
|
|
@@ -5306,7 +5572,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5306
5572
|
}
|
|
5307
5573
|
setBudgetWithPaymentToken(jobId, budgetBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
5308
5574
|
try {
|
|
5309
|
-
const data = (0,
|
|
5575
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5310
5576
|
abi: this.abi,
|
|
5311
5577
|
functionName: "setBudgetWithPaymentToken",
|
|
5312
5578
|
args: [jobId, budgetBaseUnit, paymentTokenAddress]
|
|
@@ -5322,7 +5588,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5322
5588
|
}
|
|
5323
5589
|
createPayableMemo(jobId, content, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, nextPhase, type, expiredAt, token = this.config.baseFare.contractAddress, secured = true) {
|
|
5324
5590
|
try {
|
|
5325
|
-
const data = (0,
|
|
5591
|
+
const data = (0, import_viem8.encodeFunctionData)({
|
|
5326
5592
|
abi: this.abi,
|
|
5327
5593
|
functionName: "createPayableMemo",
|
|
5328
5594
|
args: [
|
|
@@ -5362,6 +5628,9 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5362
5628
|
async performX402Request(url, version2, budget, signature) {
|
|
5363
5629
|
return await this.acpX402.performRequest(url, version2, budget, signature);
|
|
5364
5630
|
}
|
|
5631
|
+
async getAssetManager() {
|
|
5632
|
+
throw new Error("Asset Manager not supported");
|
|
5633
|
+
}
|
|
5365
5634
|
getAcpVersion() {
|
|
5366
5635
|
return "1";
|
|
5367
5636
|
}
|
|
@@ -5372,7 +5641,7 @@ var acpContractClient_default = AcpContractClient;
|
|
|
5372
5641
|
var import_core2 = require("@aa-sdk/core");
|
|
5373
5642
|
var import_infra3 = require("@account-kit/infra");
|
|
5374
5643
|
var import_smart_contracts2 = require("@account-kit/smart-contracts");
|
|
5375
|
-
var
|
|
5644
|
+
var import_viem9 = require("viem");
|
|
5376
5645
|
|
|
5377
5646
|
// src/abis/jobManagerAbi.ts
|
|
5378
5647
|
var JOB_MANAGER_ABI = [
|
|
@@ -6076,80 +6345,1238 @@ var JOB_MANAGER_ABI = [
|
|
|
6076
6345
|
var jobManagerAbi_default = JOB_MANAGER_ABI;
|
|
6077
6346
|
|
|
6078
6347
|
// src/contractClients/acpContractClientV2.ts
|
|
6079
|
-
var
|
|
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
|
-
|
|
6348
|
+
var import_chains3 = require("viem/chains");
|
|
6349
|
+
|
|
6350
|
+
// src/abis/memoManagerAbi.ts
|
|
6351
|
+
var MEMO_MANAGER_ABI = [
|
|
6352
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
6353
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
6354
|
+
{
|
|
6355
|
+
inputs: [
|
|
6356
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
6357
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" }
|
|
6358
|
+
],
|
|
6359
|
+
name: "AccessControlUnauthorizedAccount",
|
|
6360
|
+
type: "error"
|
|
6361
|
+
},
|
|
6362
|
+
{
|
|
6363
|
+
inputs: [{ internalType: "address", name: "target", type: "address" }],
|
|
6364
|
+
name: "AddressEmptyCode",
|
|
6365
|
+
type: "error"
|
|
6366
|
+
},
|
|
6367
|
+
{ inputs: [], name: "AlreadyVoted", type: "error" },
|
|
6368
|
+
{ inputs: [], name: "CannotApproveMemo", type: "error" },
|
|
6369
|
+
{ inputs: [], name: "CannotUpdateApprovedMemo", type: "error" },
|
|
6370
|
+
{ inputs: [], name: "CannotUpdateMemo", type: "error" },
|
|
6371
|
+
{ inputs: [], name: "CannotWithdrawYet", type: "error" },
|
|
6372
|
+
{ inputs: [], name: "DestinationChainNotConfigured", type: "error" },
|
|
6373
|
+
{
|
|
6374
|
+
inputs: [
|
|
6375
|
+
{ internalType: "address", name: "implementation", type: "address" }
|
|
6376
|
+
],
|
|
6377
|
+
name: "ERC1967InvalidImplementation",
|
|
6378
|
+
type: "error"
|
|
6379
|
+
},
|
|
6380
|
+
{ inputs: [], name: "ERC1967NonPayable", type: "error" },
|
|
6381
|
+
{ inputs: [], name: "EmptyContent", type: "error" },
|
|
6382
|
+
{ inputs: [], name: "FailedInnerCall", type: "error" },
|
|
6383
|
+
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
6384
|
+
{ inputs: [], name: "InvalidMemoState", type: "error" },
|
|
6385
|
+
{ inputs: [], name: "InvalidMemoStateTransition", type: "error" },
|
|
6386
|
+
{ inputs: [], name: "InvalidMemoType", type: "error" },
|
|
6387
|
+
{ inputs: [], name: "JobAlreadyCompleted", type: "error" },
|
|
6388
|
+
{ inputs: [], name: "JobDoesNotExist", type: "error" },
|
|
6389
|
+
{ inputs: [], name: "MemoAlreadyApproved", type: "error" },
|
|
6390
|
+
{ inputs: [], name: "MemoAlreadyExecuted", type: "error" },
|
|
6391
|
+
{ inputs: [], name: "MemoAlreadySigned", type: "error" },
|
|
6392
|
+
{ inputs: [], name: "MemoCannotBeSigned", type: "error" },
|
|
6393
|
+
{ inputs: [], name: "MemoDoesNotExist", type: "error" },
|
|
6394
|
+
{ inputs: [], name: "MemoDoesNotRequireApproval", type: "error" },
|
|
6395
|
+
{ inputs: [], name: "MemoExpired", type: "error" },
|
|
6396
|
+
{ inputs: [], name: "MemoNotApproved", type: "error" },
|
|
6397
|
+
{ inputs: [], name: "MemoNotReadyToBeSigned", type: "error" },
|
|
6398
|
+
{ inputs: [], name: "MemoStateUnchanged", type: "error" },
|
|
6399
|
+
{ inputs: [], name: "NoAmountToTransfer", type: "error" },
|
|
6400
|
+
{ inputs: [], name: "NoPaymentAmount", type: "error" },
|
|
6401
|
+
{ inputs: [], name: "NotEscrowTransferMemoType", type: "error" },
|
|
6402
|
+
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
6403
|
+
{ inputs: [], name: "NotPayableMemoType", type: "error" },
|
|
6404
|
+
{ inputs: [], name: "OnlyACPContract", type: "error" },
|
|
6405
|
+
{ inputs: [], name: "OnlyAssetManager", type: "error" },
|
|
6406
|
+
{ inputs: [], name: "OnlyClientOrProvider", type: "error" },
|
|
6407
|
+
{ inputs: [], name: "OnlyCounterParty", type: "error" },
|
|
6408
|
+
{ inputs: [], name: "OnlyEvaluator", type: "error" },
|
|
6409
|
+
{ inputs: [], name: "OnlyMemoSender", type: "error" },
|
|
6410
|
+
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
6411
|
+
{ inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
|
|
6412
|
+
{
|
|
6413
|
+
inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
|
|
6414
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
6415
|
+
type: "error"
|
|
6416
|
+
},
|
|
6417
|
+
{ inputs: [], name: "ZeroAcpContractAddress", type: "error" },
|
|
6418
|
+
{ inputs: [], name: "ZeroAddressRecipient", type: "error" },
|
|
6419
|
+
{ inputs: [], name: "ZeroAddressToken", type: "error" },
|
|
6420
|
+
{ inputs: [], name: "ZeroAssetManagerAddress", type: "error" },
|
|
6421
|
+
{ inputs: [], name: "ZeroJobManagerAddress", type: "error" },
|
|
6422
|
+
{
|
|
6423
|
+
anonymous: false,
|
|
6424
|
+
inputs: [
|
|
6425
|
+
{
|
|
6426
|
+
indexed: false,
|
|
6427
|
+
internalType: "uint64",
|
|
6428
|
+
name: "version",
|
|
6429
|
+
type: "uint64"
|
|
6147
6430
|
}
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6431
|
+
],
|
|
6432
|
+
name: "Initialized",
|
|
6433
|
+
type: "event"
|
|
6434
|
+
},
|
|
6435
|
+
{
|
|
6436
|
+
anonymous: false,
|
|
6437
|
+
inputs: [
|
|
6438
|
+
{
|
|
6439
|
+
indexed: true,
|
|
6440
|
+
internalType: "uint256",
|
|
6441
|
+
name: "memoId",
|
|
6442
|
+
type: "uint256"
|
|
6443
|
+
},
|
|
6444
|
+
{
|
|
6445
|
+
indexed: true,
|
|
6446
|
+
internalType: "address",
|
|
6447
|
+
name: "approver",
|
|
6448
|
+
type: "address"
|
|
6449
|
+
},
|
|
6450
|
+
{ indexed: false, internalType: "bool", name: "approved", type: "bool" },
|
|
6451
|
+
{
|
|
6452
|
+
indexed: false,
|
|
6453
|
+
internalType: "string",
|
|
6454
|
+
name: "reason",
|
|
6455
|
+
type: "string"
|
|
6456
|
+
}
|
|
6457
|
+
],
|
|
6458
|
+
name: "MemoSigned",
|
|
6459
|
+
type: "event"
|
|
6460
|
+
},
|
|
6461
|
+
{
|
|
6462
|
+
anonymous: false,
|
|
6463
|
+
inputs: [
|
|
6464
|
+
{
|
|
6465
|
+
indexed: true,
|
|
6466
|
+
internalType: "uint256",
|
|
6467
|
+
name: "memoId",
|
|
6468
|
+
type: "uint256"
|
|
6469
|
+
},
|
|
6470
|
+
{
|
|
6471
|
+
indexed: false,
|
|
6472
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6473
|
+
name: "oldState",
|
|
6474
|
+
type: "uint8"
|
|
6475
|
+
},
|
|
6476
|
+
{
|
|
6477
|
+
indexed: false,
|
|
6478
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6479
|
+
name: "newState",
|
|
6480
|
+
type: "uint8"
|
|
6481
|
+
}
|
|
6482
|
+
],
|
|
6483
|
+
name: "MemoStateUpdated",
|
|
6484
|
+
type: "event"
|
|
6485
|
+
},
|
|
6486
|
+
{
|
|
6487
|
+
anonymous: false,
|
|
6488
|
+
inputs: [
|
|
6489
|
+
{
|
|
6490
|
+
indexed: true,
|
|
6491
|
+
internalType: "uint256",
|
|
6492
|
+
name: "memoId",
|
|
6493
|
+
type: "uint256"
|
|
6494
|
+
},
|
|
6495
|
+
{
|
|
6496
|
+
indexed: true,
|
|
6497
|
+
internalType: "uint256",
|
|
6498
|
+
name: "jobId",
|
|
6499
|
+
type: "uint256"
|
|
6500
|
+
},
|
|
6501
|
+
{
|
|
6502
|
+
indexed: true,
|
|
6503
|
+
internalType: "address",
|
|
6504
|
+
name: "sender",
|
|
6505
|
+
type: "address"
|
|
6506
|
+
},
|
|
6507
|
+
{
|
|
6508
|
+
indexed: false,
|
|
6509
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6510
|
+
name: "memoType",
|
|
6511
|
+
type: "uint8"
|
|
6512
|
+
},
|
|
6513
|
+
{
|
|
6514
|
+
indexed: false,
|
|
6515
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6516
|
+
name: "nextPhase",
|
|
6517
|
+
type: "uint8"
|
|
6518
|
+
},
|
|
6519
|
+
{
|
|
6520
|
+
indexed: false,
|
|
6521
|
+
internalType: "string",
|
|
6522
|
+
name: "content",
|
|
6523
|
+
type: "string"
|
|
6524
|
+
}
|
|
6525
|
+
],
|
|
6526
|
+
name: "NewMemo",
|
|
6527
|
+
type: "event"
|
|
6528
|
+
},
|
|
6529
|
+
{
|
|
6530
|
+
anonymous: false,
|
|
6531
|
+
inputs: [
|
|
6532
|
+
{
|
|
6533
|
+
indexed: true,
|
|
6534
|
+
internalType: "uint256",
|
|
6535
|
+
name: "jobId",
|
|
6536
|
+
type: "uint256"
|
|
6537
|
+
},
|
|
6538
|
+
{
|
|
6539
|
+
indexed: true,
|
|
6540
|
+
internalType: "uint256",
|
|
6541
|
+
name: "memoId",
|
|
6542
|
+
type: "uint256"
|
|
6543
|
+
},
|
|
6544
|
+
{
|
|
6545
|
+
indexed: true,
|
|
6546
|
+
internalType: "address",
|
|
6547
|
+
name: "sender",
|
|
6548
|
+
type: "address"
|
|
6549
|
+
},
|
|
6550
|
+
{
|
|
6551
|
+
indexed: false,
|
|
6552
|
+
internalType: "address",
|
|
6553
|
+
name: "token",
|
|
6554
|
+
type: "address"
|
|
6555
|
+
},
|
|
6556
|
+
{
|
|
6557
|
+
indexed: false,
|
|
6558
|
+
internalType: "uint256",
|
|
6559
|
+
name: "amount",
|
|
6560
|
+
type: "uint256"
|
|
6561
|
+
}
|
|
6562
|
+
],
|
|
6563
|
+
name: "PayableFeeRefunded",
|
|
6564
|
+
type: "event"
|
|
6565
|
+
},
|
|
6566
|
+
{
|
|
6567
|
+
anonymous: false,
|
|
6568
|
+
inputs: [
|
|
6569
|
+
{
|
|
6570
|
+
indexed: true,
|
|
6571
|
+
internalType: "uint256",
|
|
6572
|
+
name: "jobId",
|
|
6573
|
+
type: "uint256"
|
|
6574
|
+
},
|
|
6575
|
+
{
|
|
6576
|
+
indexed: true,
|
|
6577
|
+
internalType: "uint256",
|
|
6578
|
+
name: "memoId",
|
|
6579
|
+
type: "uint256"
|
|
6580
|
+
},
|
|
6581
|
+
{
|
|
6582
|
+
indexed: true,
|
|
6583
|
+
internalType: "address",
|
|
6584
|
+
name: "sender",
|
|
6585
|
+
type: "address"
|
|
6586
|
+
},
|
|
6587
|
+
{
|
|
6588
|
+
indexed: false,
|
|
6589
|
+
internalType: "address",
|
|
6590
|
+
name: "token",
|
|
6591
|
+
type: "address"
|
|
6592
|
+
},
|
|
6593
|
+
{
|
|
6594
|
+
indexed: false,
|
|
6595
|
+
internalType: "uint256",
|
|
6596
|
+
name: "amount",
|
|
6597
|
+
type: "uint256"
|
|
6598
|
+
}
|
|
6599
|
+
],
|
|
6600
|
+
name: "PayableFundsRefunded",
|
|
6601
|
+
type: "event"
|
|
6602
|
+
},
|
|
6603
|
+
{
|
|
6604
|
+
anonymous: false,
|
|
6605
|
+
inputs: [
|
|
6606
|
+
{
|
|
6607
|
+
indexed: true,
|
|
6608
|
+
internalType: "uint256",
|
|
6609
|
+
name: "memoId",
|
|
6610
|
+
type: "uint256"
|
|
6611
|
+
},
|
|
6612
|
+
{
|
|
6613
|
+
indexed: true,
|
|
6614
|
+
internalType: "uint256",
|
|
6615
|
+
name: "jobId",
|
|
6616
|
+
type: "uint256"
|
|
6617
|
+
},
|
|
6618
|
+
{
|
|
6619
|
+
indexed: true,
|
|
6620
|
+
internalType: "address",
|
|
6621
|
+
name: "executor",
|
|
6622
|
+
type: "address"
|
|
6623
|
+
},
|
|
6624
|
+
{
|
|
6625
|
+
indexed: false,
|
|
6626
|
+
internalType: "uint256",
|
|
6627
|
+
name: "amount",
|
|
6628
|
+
type: "uint256"
|
|
6629
|
+
}
|
|
6630
|
+
],
|
|
6631
|
+
name: "PayableMemoExecuted",
|
|
6632
|
+
type: "event"
|
|
6633
|
+
},
|
|
6634
|
+
{
|
|
6635
|
+
anonymous: false,
|
|
6636
|
+
inputs: [
|
|
6637
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6638
|
+
{
|
|
6639
|
+
indexed: true,
|
|
6640
|
+
internalType: "bytes32",
|
|
6641
|
+
name: "previousAdminRole",
|
|
6642
|
+
type: "bytes32"
|
|
6643
|
+
},
|
|
6644
|
+
{
|
|
6645
|
+
indexed: true,
|
|
6646
|
+
internalType: "bytes32",
|
|
6647
|
+
name: "newAdminRole",
|
|
6648
|
+
type: "bytes32"
|
|
6649
|
+
}
|
|
6650
|
+
],
|
|
6651
|
+
name: "RoleAdminChanged",
|
|
6652
|
+
type: "event"
|
|
6653
|
+
},
|
|
6654
|
+
{
|
|
6655
|
+
anonymous: false,
|
|
6656
|
+
inputs: [
|
|
6657
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6658
|
+
{
|
|
6659
|
+
indexed: true,
|
|
6660
|
+
internalType: "address",
|
|
6661
|
+
name: "account",
|
|
6662
|
+
type: "address"
|
|
6663
|
+
},
|
|
6664
|
+
{
|
|
6665
|
+
indexed: true,
|
|
6666
|
+
internalType: "address",
|
|
6667
|
+
name: "sender",
|
|
6668
|
+
type: "address"
|
|
6669
|
+
}
|
|
6670
|
+
],
|
|
6671
|
+
name: "RoleGranted",
|
|
6672
|
+
type: "event"
|
|
6673
|
+
},
|
|
6674
|
+
{
|
|
6675
|
+
anonymous: false,
|
|
6676
|
+
inputs: [
|
|
6677
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6678
|
+
{
|
|
6679
|
+
indexed: true,
|
|
6680
|
+
internalType: "address",
|
|
6681
|
+
name: "account",
|
|
6682
|
+
type: "address"
|
|
6683
|
+
},
|
|
6684
|
+
{
|
|
6685
|
+
indexed: true,
|
|
6686
|
+
internalType: "address",
|
|
6687
|
+
name: "sender",
|
|
6688
|
+
type: "address"
|
|
6689
|
+
}
|
|
6690
|
+
],
|
|
6691
|
+
name: "RoleRevoked",
|
|
6692
|
+
type: "event"
|
|
6693
|
+
},
|
|
6694
|
+
{
|
|
6695
|
+
anonymous: false,
|
|
6696
|
+
inputs: [
|
|
6697
|
+
{
|
|
6698
|
+
indexed: true,
|
|
6699
|
+
internalType: "address",
|
|
6700
|
+
name: "implementation",
|
|
6701
|
+
type: "address"
|
|
6702
|
+
}
|
|
6703
|
+
],
|
|
6704
|
+
name: "Upgraded",
|
|
6705
|
+
type: "event"
|
|
6706
|
+
},
|
|
6707
|
+
{
|
|
6708
|
+
inputs: [],
|
|
6709
|
+
name: "ACP_CONTRACT_ROLE",
|
|
6710
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6711
|
+
stateMutability: "view",
|
|
6712
|
+
type: "function"
|
|
6713
|
+
},
|
|
6714
|
+
{
|
|
6715
|
+
inputs: [],
|
|
6716
|
+
name: "ADMIN_ROLE",
|
|
6717
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6718
|
+
stateMutability: "view",
|
|
6719
|
+
type: "function"
|
|
6720
|
+
},
|
|
6721
|
+
{
|
|
6722
|
+
inputs: [],
|
|
6723
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
6724
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6725
|
+
stateMutability: "view",
|
|
6726
|
+
type: "function"
|
|
6727
|
+
},
|
|
6728
|
+
{
|
|
6729
|
+
inputs: [],
|
|
6730
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
6731
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
6732
|
+
stateMutability: "view",
|
|
6733
|
+
type: "function"
|
|
6734
|
+
},
|
|
6735
|
+
{
|
|
6736
|
+
inputs: [],
|
|
6737
|
+
name: "acpContract",
|
|
6738
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6739
|
+
stateMutability: "view",
|
|
6740
|
+
type: "function"
|
|
6741
|
+
},
|
|
6742
|
+
{
|
|
6743
|
+
inputs: [
|
|
6744
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6745
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6746
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6747
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6748
|
+
],
|
|
6749
|
+
name: "approveMemo",
|
|
6750
|
+
outputs: [],
|
|
6751
|
+
stateMutability: "nonpayable",
|
|
6752
|
+
type: "function"
|
|
6753
|
+
},
|
|
6754
|
+
{
|
|
6755
|
+
inputs: [],
|
|
6756
|
+
name: "assetManager",
|
|
6757
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6758
|
+
stateMutability: "view",
|
|
6759
|
+
type: "function"
|
|
6760
|
+
},
|
|
6761
|
+
{
|
|
6762
|
+
inputs: [
|
|
6763
|
+
{ internalType: "uint256[]", name: "memoIds", type: "uint256[]" },
|
|
6764
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6765
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6766
|
+
],
|
|
6767
|
+
name: "bulkApproveMemos",
|
|
6768
|
+
outputs: [],
|
|
6769
|
+
stateMutability: "nonpayable",
|
|
6770
|
+
type: "function"
|
|
6771
|
+
},
|
|
6772
|
+
{
|
|
6773
|
+
inputs: [
|
|
6774
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6775
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
6776
|
+
],
|
|
6777
|
+
name: "canApproveMemo",
|
|
6778
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
6779
|
+
stateMutability: "view",
|
|
6780
|
+
type: "function"
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
inputs: [
|
|
6784
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6785
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6786
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6787
|
+
{
|
|
6788
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6789
|
+
name: "memoType",
|
|
6790
|
+
type: "uint8"
|
|
6791
|
+
},
|
|
6792
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6793
|
+
{
|
|
6794
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6795
|
+
name: "nextPhase",
|
|
6796
|
+
type: "uint8"
|
|
6797
|
+
},
|
|
6798
|
+
{ internalType: "string", name: "metadata", type: "string" }
|
|
6799
|
+
],
|
|
6800
|
+
name: "createMemo",
|
|
6801
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6802
|
+
stateMutability: "nonpayable",
|
|
6803
|
+
type: "function"
|
|
6804
|
+
},
|
|
6805
|
+
{
|
|
6806
|
+
inputs: [
|
|
6807
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6808
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6809
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6810
|
+
{
|
|
6811
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6812
|
+
name: "memoType",
|
|
6813
|
+
type: "uint8"
|
|
6814
|
+
},
|
|
6815
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6816
|
+
{
|
|
6817
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6818
|
+
name: "nextPhase",
|
|
6819
|
+
type: "uint8"
|
|
6820
|
+
},
|
|
6821
|
+
{
|
|
6822
|
+
components: [
|
|
6823
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
6824
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
6825
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
6826
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
6827
|
+
{
|
|
6828
|
+
internalType: "enum ACPTypes.FeeType",
|
|
6829
|
+
name: "feeType",
|
|
6830
|
+
type: "uint8"
|
|
6831
|
+
},
|
|
6832
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
6833
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6834
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
6835
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
6836
|
+
],
|
|
6837
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
6838
|
+
name: "payableDetails_",
|
|
6839
|
+
type: "tuple"
|
|
6840
|
+
},
|
|
6841
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
6842
|
+
],
|
|
6843
|
+
name: "createPayableMemo",
|
|
6844
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6845
|
+
stateMutability: "nonpayable",
|
|
6846
|
+
type: "function"
|
|
6847
|
+
},
|
|
6848
|
+
{
|
|
6849
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6850
|
+
name: "emergencyApproveMemo",
|
|
6851
|
+
outputs: [],
|
|
6852
|
+
stateMutability: "nonpayable",
|
|
6853
|
+
type: "function"
|
|
6854
|
+
},
|
|
6855
|
+
{
|
|
6856
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6857
|
+
name: "executePayableMemo",
|
|
6858
|
+
outputs: [],
|
|
6859
|
+
stateMutability: "nonpayable",
|
|
6860
|
+
type: "function"
|
|
6861
|
+
},
|
|
6862
|
+
{
|
|
6863
|
+
inputs: [],
|
|
6864
|
+
name: "getAssetManager",
|
|
6865
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6866
|
+
stateMutability: "view",
|
|
6867
|
+
type: "function"
|
|
6868
|
+
},
|
|
6869
|
+
{
|
|
6870
|
+
inputs: [
|
|
6871
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6872
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6873
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6874
|
+
],
|
|
6875
|
+
name: "getJobMemos",
|
|
6876
|
+
outputs: [
|
|
6877
|
+
{
|
|
6878
|
+
components: [
|
|
6879
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6880
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6881
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6882
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6883
|
+
{
|
|
6884
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6885
|
+
name: "memoType",
|
|
6886
|
+
type: "uint8"
|
|
6887
|
+
},
|
|
6888
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6889
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6890
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6891
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6892
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6893
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6894
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6895
|
+
{
|
|
6896
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6897
|
+
name: "nextPhase",
|
|
6898
|
+
type: "uint8"
|
|
6899
|
+
},
|
|
6900
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6901
|
+
{
|
|
6902
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6903
|
+
name: "state",
|
|
6904
|
+
type: "uint8"
|
|
6905
|
+
}
|
|
6906
|
+
],
|
|
6907
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
6908
|
+
name: "memoArray",
|
|
6909
|
+
type: "tuple[]"
|
|
6910
|
+
},
|
|
6911
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
6912
|
+
],
|
|
6913
|
+
stateMutability: "view",
|
|
6914
|
+
type: "function"
|
|
6915
|
+
},
|
|
6916
|
+
{
|
|
6917
|
+
inputs: [
|
|
6918
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6919
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "phase", type: "uint8" },
|
|
6920
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6921
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6922
|
+
],
|
|
6923
|
+
name: "getJobMemosByPhase",
|
|
6924
|
+
outputs: [
|
|
6925
|
+
{
|
|
6926
|
+
components: [
|
|
6927
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6928
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6929
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6930
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6931
|
+
{
|
|
6932
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6933
|
+
name: "memoType",
|
|
6934
|
+
type: "uint8"
|
|
6935
|
+
},
|
|
6936
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6937
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6938
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6939
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6940
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6941
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6942
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6943
|
+
{
|
|
6944
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6945
|
+
name: "nextPhase",
|
|
6946
|
+
type: "uint8"
|
|
6947
|
+
},
|
|
6948
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6949
|
+
{
|
|
6950
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6951
|
+
name: "state",
|
|
6952
|
+
type: "uint8"
|
|
6953
|
+
}
|
|
6954
|
+
],
|
|
6955
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
6956
|
+
name: "memoArray",
|
|
6957
|
+
type: "tuple[]"
|
|
6958
|
+
},
|
|
6959
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
6960
|
+
],
|
|
6961
|
+
stateMutability: "view",
|
|
6962
|
+
type: "function"
|
|
6963
|
+
},
|
|
6964
|
+
{
|
|
6965
|
+
inputs: [
|
|
6966
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6967
|
+
{
|
|
6968
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6969
|
+
name: "memoType",
|
|
6970
|
+
type: "uint8"
|
|
6971
|
+
},
|
|
6972
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6973
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6974
|
+
],
|
|
6975
|
+
name: "getJobMemosByType",
|
|
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
|
+
name: "getLocalEid",
|
|
7019
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
|
7020
|
+
stateMutability: "view",
|
|
7021
|
+
type: "function"
|
|
7022
|
+
},
|
|
7023
|
+
{
|
|
7024
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7025
|
+
name: "getMemo",
|
|
7026
|
+
outputs: [
|
|
7027
|
+
{
|
|
7028
|
+
components: [
|
|
7029
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7030
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7031
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7032
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7033
|
+
{
|
|
7034
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7035
|
+
name: "memoType",
|
|
7036
|
+
type: "uint8"
|
|
7037
|
+
},
|
|
7038
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7039
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7040
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7041
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7042
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7043
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7044
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7045
|
+
{
|
|
7046
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7047
|
+
name: "nextPhase",
|
|
7048
|
+
type: "uint8"
|
|
7049
|
+
},
|
|
7050
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7051
|
+
{
|
|
7052
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7053
|
+
name: "state",
|
|
7054
|
+
type: "uint8"
|
|
7055
|
+
}
|
|
7056
|
+
],
|
|
7057
|
+
internalType: "struct ACPTypes.Memo",
|
|
7058
|
+
name: "",
|
|
7059
|
+
type: "tuple"
|
|
7060
|
+
}
|
|
7061
|
+
],
|
|
7062
|
+
stateMutability: "view",
|
|
7063
|
+
type: "function"
|
|
7064
|
+
},
|
|
7065
|
+
{
|
|
7066
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7067
|
+
name: "getMemoApprovalStatus",
|
|
7068
|
+
outputs: [
|
|
7069
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7070
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7071
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" }
|
|
7072
|
+
],
|
|
7073
|
+
stateMutability: "view",
|
|
7074
|
+
type: "function"
|
|
7075
|
+
},
|
|
7076
|
+
{
|
|
7077
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7078
|
+
name: "getMemoWithPayableDetails",
|
|
7079
|
+
outputs: [
|
|
7080
|
+
{
|
|
7081
|
+
components: [
|
|
7082
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7083
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7084
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7085
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7086
|
+
{
|
|
7087
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7088
|
+
name: "memoType",
|
|
7089
|
+
type: "uint8"
|
|
7090
|
+
},
|
|
7091
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7092
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7093
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7094
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7095
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7096
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7097
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7098
|
+
{
|
|
7099
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7100
|
+
name: "nextPhase",
|
|
7101
|
+
type: "uint8"
|
|
7102
|
+
},
|
|
7103
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7104
|
+
{
|
|
7105
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7106
|
+
name: "state",
|
|
7107
|
+
type: "uint8"
|
|
7108
|
+
}
|
|
7109
|
+
],
|
|
7110
|
+
internalType: "struct ACPTypes.Memo",
|
|
7111
|
+
name: "memo",
|
|
7112
|
+
type: "tuple"
|
|
7113
|
+
},
|
|
7114
|
+
{
|
|
7115
|
+
components: [
|
|
7116
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7117
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7118
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7119
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7120
|
+
{
|
|
7121
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7122
|
+
name: "feeType",
|
|
7123
|
+
type: "uint8"
|
|
7124
|
+
},
|
|
7125
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7126
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7127
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7128
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7129
|
+
],
|
|
7130
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7131
|
+
name: "details",
|
|
7132
|
+
type: "tuple"
|
|
7133
|
+
}
|
|
7134
|
+
],
|
|
7135
|
+
stateMutability: "view",
|
|
7136
|
+
type: "function"
|
|
7137
|
+
},
|
|
7138
|
+
{
|
|
7139
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7140
|
+
name: "getPayableDetails",
|
|
7141
|
+
outputs: [
|
|
7142
|
+
{
|
|
7143
|
+
components: [
|
|
7144
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7145
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7146
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7147
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7148
|
+
{
|
|
7149
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7150
|
+
name: "feeType",
|
|
7151
|
+
type: "uint8"
|
|
7152
|
+
},
|
|
7153
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7154
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7155
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7156
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7157
|
+
],
|
|
7158
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7159
|
+
name: "",
|
|
7160
|
+
type: "tuple"
|
|
7161
|
+
}
|
|
7162
|
+
],
|
|
7163
|
+
stateMutability: "view",
|
|
7164
|
+
type: "function"
|
|
7165
|
+
},
|
|
7166
|
+
{
|
|
7167
|
+
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
7168
|
+
name: "getRoleAdmin",
|
|
7169
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7170
|
+
stateMutability: "view",
|
|
7171
|
+
type: "function"
|
|
7172
|
+
},
|
|
7173
|
+
{
|
|
7174
|
+
inputs: [
|
|
7175
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7176
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7177
|
+
],
|
|
7178
|
+
name: "grantRole",
|
|
7179
|
+
outputs: [],
|
|
7180
|
+
stateMutability: "nonpayable",
|
|
7181
|
+
type: "function"
|
|
7182
|
+
},
|
|
7183
|
+
{
|
|
7184
|
+
inputs: [
|
|
7185
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7186
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7187
|
+
],
|
|
7188
|
+
name: "hasRole",
|
|
7189
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7190
|
+
stateMutability: "view",
|
|
7191
|
+
type: "function"
|
|
7192
|
+
},
|
|
7193
|
+
{
|
|
7194
|
+
inputs: [
|
|
7195
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7196
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7197
|
+
{ internalType: "address", name: "paymentManager_", type: "address" }
|
|
7198
|
+
],
|
|
7199
|
+
name: "initialize",
|
|
7200
|
+
outputs: [],
|
|
7201
|
+
stateMutability: "nonpayable",
|
|
7202
|
+
type: "function"
|
|
7203
|
+
},
|
|
7204
|
+
{
|
|
7205
|
+
inputs: [
|
|
7206
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7207
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7208
|
+
],
|
|
7209
|
+
name: "isJobEvaluator",
|
|
7210
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7211
|
+
stateMutability: "view",
|
|
7212
|
+
type: "function"
|
|
7213
|
+
},
|
|
7214
|
+
{
|
|
7215
|
+
inputs: [
|
|
7216
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7217
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7218
|
+
],
|
|
7219
|
+
name: "isMemoSigner",
|
|
7220
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7221
|
+
stateMutability: "view",
|
|
7222
|
+
type: "function"
|
|
7223
|
+
},
|
|
7224
|
+
{
|
|
7225
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7226
|
+
name: "isPayable",
|
|
7227
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7228
|
+
stateMutability: "view",
|
|
7229
|
+
type: "function"
|
|
7230
|
+
},
|
|
7231
|
+
{
|
|
7232
|
+
inputs: [],
|
|
7233
|
+
name: "jobManager",
|
|
7234
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7235
|
+
stateMutability: "view",
|
|
7236
|
+
type: "function"
|
|
7237
|
+
},
|
|
7238
|
+
{
|
|
7239
|
+
inputs: [
|
|
7240
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7241
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7242
|
+
],
|
|
7243
|
+
name: "jobMemos",
|
|
7244
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7245
|
+
stateMutability: "view",
|
|
7246
|
+
type: "function"
|
|
7247
|
+
},
|
|
7248
|
+
{
|
|
7249
|
+
inputs: [
|
|
7250
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7251
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "", type: "uint8" },
|
|
7252
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7253
|
+
],
|
|
7254
|
+
name: "jobMemosByPhase",
|
|
7255
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7256
|
+
stateMutability: "view",
|
|
7257
|
+
type: "function"
|
|
7258
|
+
},
|
|
7259
|
+
{
|
|
7260
|
+
inputs: [
|
|
7261
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7262
|
+
{ internalType: "enum ACPTypes.MemoType", name: "", type: "uint8" },
|
|
7263
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7264
|
+
],
|
|
7265
|
+
name: "jobMemosByType",
|
|
7266
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7267
|
+
stateMutability: "view",
|
|
7268
|
+
type: "function"
|
|
7269
|
+
},
|
|
7270
|
+
{
|
|
7271
|
+
inputs: [
|
|
7272
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7273
|
+
{ internalType: "address", name: "", type: "address" }
|
|
7274
|
+
],
|
|
7275
|
+
name: "memoApprovals",
|
|
7276
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7277
|
+
stateMutability: "view",
|
|
7278
|
+
type: "function"
|
|
7279
|
+
},
|
|
7280
|
+
{
|
|
7281
|
+
inputs: [],
|
|
7282
|
+
name: "memoCounter",
|
|
7283
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7284
|
+
stateMutability: "view",
|
|
7285
|
+
type: "function"
|
|
7286
|
+
},
|
|
7287
|
+
{
|
|
7288
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7289
|
+
name: "memos",
|
|
7290
|
+
outputs: [
|
|
7291
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7292
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7293
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7294
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7295
|
+
{
|
|
7296
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7297
|
+
name: "memoType",
|
|
7298
|
+
type: "uint8"
|
|
7299
|
+
},
|
|
7300
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7301
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7302
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7303
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7304
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7305
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7306
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7307
|
+
{
|
|
7308
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7309
|
+
name: "nextPhase",
|
|
7310
|
+
type: "uint8"
|
|
7311
|
+
},
|
|
7312
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7313
|
+
{ internalType: "enum ACPTypes.MemoState", name: "state", type: "uint8" }
|
|
7314
|
+
],
|
|
7315
|
+
stateMutability: "view",
|
|
7316
|
+
type: "function"
|
|
7317
|
+
},
|
|
7318
|
+
{
|
|
7319
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7320
|
+
name: "payableDetails",
|
|
7321
|
+
outputs: [
|
|
7322
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7323
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7324
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7325
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7326
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
7327
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7328
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7329
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7330
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7331
|
+
],
|
|
7332
|
+
stateMutability: "view",
|
|
7333
|
+
type: "function"
|
|
7334
|
+
},
|
|
7335
|
+
{
|
|
7336
|
+
inputs: [],
|
|
7337
|
+
name: "paymentManager",
|
|
7338
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7339
|
+
stateMutability: "view",
|
|
7340
|
+
type: "function"
|
|
7341
|
+
},
|
|
7342
|
+
{
|
|
7343
|
+
inputs: [],
|
|
7344
|
+
name: "proxiableUUID",
|
|
7345
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7346
|
+
stateMutability: "view",
|
|
7347
|
+
type: "function"
|
|
7348
|
+
},
|
|
7349
|
+
{
|
|
7350
|
+
inputs: [
|
|
7351
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7352
|
+
{ internalType: "address", name: "callerConfirmation", type: "address" }
|
|
7353
|
+
],
|
|
7354
|
+
name: "renounceRole",
|
|
7355
|
+
outputs: [],
|
|
7356
|
+
stateMutability: "nonpayable",
|
|
7357
|
+
type: "function"
|
|
7358
|
+
},
|
|
7359
|
+
{
|
|
7360
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7361
|
+
name: "requiredApprovals",
|
|
7362
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7363
|
+
stateMutability: "view",
|
|
7364
|
+
type: "function"
|
|
7365
|
+
},
|
|
7366
|
+
{
|
|
7367
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7368
|
+
name: "requiresApproval",
|
|
7369
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7370
|
+
stateMutability: "view",
|
|
7371
|
+
type: "function"
|
|
7372
|
+
},
|
|
7373
|
+
{
|
|
7374
|
+
inputs: [
|
|
7375
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7376
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7377
|
+
],
|
|
7378
|
+
name: "revokeRole",
|
|
7379
|
+
outputs: [],
|
|
7380
|
+
stateMutability: "nonpayable",
|
|
7381
|
+
type: "function"
|
|
7382
|
+
},
|
|
7383
|
+
{
|
|
7384
|
+
inputs: [
|
|
7385
|
+
{
|
|
7386
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7387
|
+
name: "memoType",
|
|
7388
|
+
type: "uint8"
|
|
7389
|
+
},
|
|
7390
|
+
{ internalType: "uint256", name: "requiredApprovals_", type: "uint256" }
|
|
7391
|
+
],
|
|
7392
|
+
name: "setApprovalRequirements",
|
|
7393
|
+
outputs: [],
|
|
7394
|
+
stateMutability: "nonpayable",
|
|
7395
|
+
type: "function"
|
|
7396
|
+
},
|
|
7397
|
+
{
|
|
7398
|
+
inputs: [
|
|
7399
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7400
|
+
],
|
|
7401
|
+
name: "setAssetManager",
|
|
7402
|
+
outputs: [],
|
|
7403
|
+
stateMutability: "nonpayable",
|
|
7404
|
+
type: "function"
|
|
7405
|
+
},
|
|
7406
|
+
{
|
|
7407
|
+
inputs: [
|
|
7408
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7409
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7410
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7411
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
7412
|
+
],
|
|
7413
|
+
name: "signMemo",
|
|
7414
|
+
outputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
|
|
7415
|
+
stateMutability: "nonpayable",
|
|
7416
|
+
type: "function"
|
|
7417
|
+
},
|
|
7418
|
+
{
|
|
7419
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
7420
|
+
name: "supportsInterface",
|
|
7421
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7422
|
+
stateMutability: "view",
|
|
7423
|
+
type: "function"
|
|
7424
|
+
},
|
|
7425
|
+
{
|
|
7426
|
+
inputs: [
|
|
7427
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7428
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7429
|
+
{ internalType: "address", name: "paymentManager_", type: "address" },
|
|
7430
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7431
|
+
],
|
|
7432
|
+
name: "updateContracts",
|
|
7433
|
+
outputs: [],
|
|
7434
|
+
stateMutability: "nonpayable",
|
|
7435
|
+
type: "function"
|
|
7436
|
+
},
|
|
7437
|
+
{
|
|
7438
|
+
inputs: [
|
|
7439
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7440
|
+
{ internalType: "string", name: "newContent", type: "string" }
|
|
7441
|
+
],
|
|
7442
|
+
name: "updateMemoContent",
|
|
7443
|
+
outputs: [],
|
|
7444
|
+
stateMutability: "nonpayable",
|
|
7445
|
+
type: "function"
|
|
7446
|
+
},
|
|
7447
|
+
{
|
|
7448
|
+
inputs: [
|
|
7449
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7450
|
+
{
|
|
7451
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7452
|
+
name: "newMemoState",
|
|
7453
|
+
type: "uint8"
|
|
7454
|
+
}
|
|
7455
|
+
],
|
|
7456
|
+
name: "updateMemoState",
|
|
7457
|
+
outputs: [],
|
|
7458
|
+
stateMutability: "nonpayable",
|
|
7459
|
+
type: "function"
|
|
7460
|
+
},
|
|
7461
|
+
{
|
|
7462
|
+
inputs: [
|
|
7463
|
+
{ internalType: "address", name: "newImplementation", type: "address" },
|
|
7464
|
+
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
7465
|
+
],
|
|
7466
|
+
name: "upgradeToAndCall",
|
|
7467
|
+
outputs: [],
|
|
7468
|
+
stateMutability: "payable",
|
|
7469
|
+
type: "function"
|
|
7470
|
+
},
|
|
7471
|
+
{
|
|
7472
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7473
|
+
name: "withdrawEscrowedFunds",
|
|
7474
|
+
outputs: [],
|
|
7475
|
+
stateMutability: "nonpayable",
|
|
7476
|
+
type: "function"
|
|
7477
|
+
}
|
|
7478
|
+
];
|
|
7479
|
+
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7480
|
+
|
|
7481
|
+
// src/contractClients/acpContractClientV2.ts
|
|
7482
|
+
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7483
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7484
|
+
super(agentWalletAddress, config);
|
|
7485
|
+
this.jobManagerAddress = jobManagerAddress;
|
|
7486
|
+
this.memoManagerAddress = memoManagerAddress;
|
|
7487
|
+
this.accountManagerAddress = accountManagerAddress;
|
|
7488
|
+
this.PRIORITY_FEE_MULTIPLIER = 2;
|
|
7489
|
+
this.MAX_FEE_PER_GAS = 2e7;
|
|
7490
|
+
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
7491
|
+
this.GAS_FEE_MULTIPLIER = 0.5;
|
|
7492
|
+
this.RETRY_CONFIG = {
|
|
7493
|
+
intervalMs: 200,
|
|
7494
|
+
multiplier: 1.1,
|
|
7495
|
+
maxRetries: 10
|
|
7496
|
+
};
|
|
7497
|
+
this._sessionKeyClients = {};
|
|
7498
|
+
}
|
|
7499
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7500
|
+
const publicClients = {};
|
|
7501
|
+
for (const chain of config.chains) {
|
|
7502
|
+
publicClients[chain.chain.id] = (0, import_viem9.createPublicClient)({
|
|
7503
|
+
chain: chain.chain,
|
|
7504
|
+
transport: (0, import_viem9.http)(chain.rpcUrl)
|
|
7505
|
+
});
|
|
7506
|
+
}
|
|
7507
|
+
const publicClient = (0, import_viem9.createPublicClient)({
|
|
7508
|
+
chain: config.chain,
|
|
7509
|
+
transport: (0, import_viem9.http)(config.rpcEndpoint)
|
|
7510
|
+
});
|
|
7511
|
+
const [jobManagerAddress, memoManagerAddress, accountManagerAddress] = await publicClient.multicall({
|
|
7512
|
+
contracts: [
|
|
7513
|
+
{
|
|
7514
|
+
address: config.contractAddress,
|
|
7515
|
+
abi: config.abi,
|
|
7516
|
+
functionName: "jobManager"
|
|
7517
|
+
},
|
|
7518
|
+
{
|
|
7519
|
+
address: config.contractAddress,
|
|
7520
|
+
abi: config.abi,
|
|
7521
|
+
functionName: "memoManager"
|
|
7522
|
+
},
|
|
7523
|
+
{
|
|
7524
|
+
address: config.contractAddress,
|
|
7525
|
+
abi: config.abi,
|
|
7526
|
+
functionName: "accountManager"
|
|
7527
|
+
}
|
|
7528
|
+
]
|
|
7529
|
+
});
|
|
7530
|
+
if (!jobManagerAddress || !memoManagerAddress || !accountManagerAddress) {
|
|
7531
|
+
throw new acpError_default(
|
|
7532
|
+
"Failed to get job manager, memo manager, or account manager address"
|
|
7533
|
+
);
|
|
7534
|
+
}
|
|
7535
|
+
const acpContractClient = new _AcpContractClientV2(
|
|
7536
|
+
jobManagerAddress.result,
|
|
7537
|
+
memoManagerAddress.result,
|
|
7538
|
+
accountManagerAddress.result,
|
|
7539
|
+
agentWalletAddress,
|
|
7540
|
+
config
|
|
7541
|
+
);
|
|
7542
|
+
acpContractClient.publicClients = publicClients;
|
|
7543
|
+
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
7544
|
+
return acpContractClient;
|
|
7545
|
+
}
|
|
7546
|
+
async init(privateKey, sessionEntityKeyId) {
|
|
7547
|
+
const sessionKeySigner = import_core2.LocalAccountSigner.privateKeyToAccountSigner(privateKey);
|
|
7548
|
+
this._sessionKeyClient = await (0, import_smart_contracts2.createModularAccountV2Client)({
|
|
7549
|
+
chain: this.chain,
|
|
7550
|
+
transport: (0, import_infra3.alchemy)({
|
|
7551
|
+
rpcUrl: this.config.alchemyRpcUrl
|
|
7552
|
+
}),
|
|
7553
|
+
signer: sessionKeySigner,
|
|
7554
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7555
|
+
accountAddress: this.agentWalletAddress,
|
|
7556
|
+
signerEntity: {
|
|
7557
|
+
entityId: sessionEntityKeyId,
|
|
7558
|
+
isGlobalValidation: true
|
|
7559
|
+
}
|
|
7560
|
+
});
|
|
7561
|
+
for (const chain of this.config.chains) {
|
|
7562
|
+
this._sessionKeyClients[chain.chain.id] = await (0, import_smart_contracts2.createModularAccountV2Client)({
|
|
7563
|
+
chain: chain.chain,
|
|
7564
|
+
transport: (0, import_infra3.alchemy)({
|
|
7565
|
+
rpcUrl: `${this.config.alchemyRpcUrl}?chainId=${chain.chain.id}`
|
|
7566
|
+
}),
|
|
7567
|
+
signer: sessionKeySigner,
|
|
7568
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7569
|
+
accountAddress: this.agentWalletAddress,
|
|
7570
|
+
signerEntity: {
|
|
7571
|
+
entityId: sessionEntityKeyId,
|
|
7572
|
+
isGlobalValidation: true
|
|
7573
|
+
}
|
|
7574
|
+
});
|
|
7575
|
+
}
|
|
7576
|
+
this._acpX402 = new AcpX402(
|
|
7577
|
+
this.config,
|
|
7578
|
+
this.sessionKeyClient,
|
|
7579
|
+
this.publicClient
|
|
6153
7580
|
);
|
|
6154
7581
|
const account = this.sessionKeyClient.account;
|
|
6155
7582
|
const sessionSignerAddress = await account.getSigner().getAddress();
|
|
@@ -6190,11 +7617,20 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6190
7617
|
}
|
|
6191
7618
|
return this._acpX402;
|
|
6192
7619
|
}
|
|
6193
|
-
async calculateGasFees() {
|
|
7620
|
+
async calculateGasFees(chainId) {
|
|
7621
|
+
if (chainId) {
|
|
7622
|
+
const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
|
|
7623
|
+
const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
|
|
7624
|
+
return increasedMaxFeePerGas;
|
|
7625
|
+
}
|
|
6194
7626
|
const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
|
|
6195
7627
|
return finalMaxFeePerGas;
|
|
6196
7628
|
}
|
|
6197
|
-
async handleOperation(operations) {
|
|
7629
|
+
async handleOperation(operations, chainId) {
|
|
7630
|
+
const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
|
|
7631
|
+
if (!sessionKeyClient) {
|
|
7632
|
+
throw new acpError_default("Session key client not initialized");
|
|
7633
|
+
}
|
|
6198
7634
|
const basePayload = {
|
|
6199
7635
|
uo: operations.map((operation) => ({
|
|
6200
7636
|
target: operation.contractAddress,
|
|
@@ -6219,12 +7655,17 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6219
7655
|
}
|
|
6220
7656
|
}
|
|
6221
7657
|
};
|
|
6222
|
-
const { hash } = await
|
|
6223
|
-
const
|
|
7658
|
+
const { hash } = await sessionKeyClient.sendUserOperation(payload);
|
|
7659
|
+
const checkTransactionConfig = {
|
|
6224
7660
|
hash,
|
|
6225
|
-
tag: "pending",
|
|
6226
7661
|
retries: this.RETRY_CONFIG
|
|
6227
|
-
}
|
|
7662
|
+
};
|
|
7663
|
+
if (!chainId || chainId === import_chains3.baseSepolia.id || chainId === import_chains3.base.id) {
|
|
7664
|
+
checkTransactionConfig["tag"] = "pending";
|
|
7665
|
+
}
|
|
7666
|
+
const txnHash = await sessionKeyClient.waitForUserOperationTransaction(
|
|
7667
|
+
checkTransactionConfig
|
|
7668
|
+
);
|
|
6228
7669
|
return { userOpHash: hash, txnHash };
|
|
6229
7670
|
} catch (error) {
|
|
6230
7671
|
iteration++;
|
|
@@ -6248,7 +7689,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6248
7689
|
const contractLogs = result.logs.filter((log) => {
|
|
6249
7690
|
return log.address.toLowerCase() === this.jobManagerAddress.toLowerCase();
|
|
6250
7691
|
}).map(
|
|
6251
|
-
(log) => (0,
|
|
7692
|
+
(log) => (0, import_viem9.decodeEventLog)({
|
|
6252
7693
|
abi: jobManagerAbi_default,
|
|
6253
7694
|
data: log.data,
|
|
6254
7695
|
topics: log.topics
|
|
@@ -6287,6 +7728,13 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6287
7728
|
throw new acpError_default("Failed to get X402 payment details", error);
|
|
6288
7729
|
}
|
|
6289
7730
|
}
|
|
7731
|
+
async getAssetManager() {
|
|
7732
|
+
return await this.publicClient.readContract({
|
|
7733
|
+
address: this.memoManagerAddress,
|
|
7734
|
+
abi: memoManagerAbi_default,
|
|
7735
|
+
functionName: "assetManager"
|
|
7736
|
+
});
|
|
7737
|
+
}
|
|
6290
7738
|
getAcpVersion() {
|
|
6291
7739
|
return "2";
|
|
6292
7740
|
}
|
|
@@ -6307,6 +7755,7 @@ var index_default = acpClient_default;
|
|
|
6307
7755
|
AcpJob,
|
|
6308
7756
|
AcpJobPhases,
|
|
6309
7757
|
AcpMemo,
|
|
7758
|
+
AcpMemoState,
|
|
6310
7759
|
AcpMemoStatus,
|
|
6311
7760
|
AcpOnlineStatus,
|
|
6312
7761
|
BaseAcpContractClient,
|
|
@@ -6322,6 +7771,7 @@ var index_default = acpClient_default;
|
|
|
6322
7771
|
baseAcpX402ConfigV2,
|
|
6323
7772
|
baseSepoliaAcpConfig,
|
|
6324
7773
|
baseSepoliaAcpConfigV2,
|
|
7774
|
+
baseSepoliaAcpX402ConfigV2,
|
|
6325
7775
|
ethFare,
|
|
6326
7776
|
preparePayload,
|
|
6327
7777
|
wethFare
|