@virtuals-protocol/acp-node 0.3.0-beta.20 → 0.3.0-beta.21
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 +54 -23
- package/dist/index.d.ts +54 -23
- package/dist/index.js +1584 -127
- package/dist/index.mjs +1592 -120
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -8,12 +8,13 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "@virtuals-protocol/acp-node",
|
|
11
|
-
version: "0.3.0-beta.
|
|
11
|
+
version: "0.3.0-beta.21",
|
|
12
12
|
main: "./dist/index.js",
|
|
13
13
|
module: "./dist/index.mjs",
|
|
14
14
|
types: "./dist/index.d.ts",
|
|
15
15
|
scripts: {
|
|
16
16
|
test: "jest",
|
|
17
|
+
"test:unit": "jest test/unit test/component",
|
|
17
18
|
"test:ci": "jest --ci --reporters=default --reporters=jest-junit",
|
|
18
19
|
"test:watch": "jest --watch",
|
|
19
20
|
"test:coverage": "jest --coverage",
|
|
@@ -1238,7 +1239,10 @@ import {
|
|
|
1238
1239
|
} from "viem";
|
|
1239
1240
|
|
|
1240
1241
|
// src/configs/acpConfigs.ts
|
|
1241
|
-
import {
|
|
1242
|
+
import {
|
|
1243
|
+
baseSepolia,
|
|
1244
|
+
base
|
|
1245
|
+
} from "@account-kit/infra";
|
|
1242
1246
|
|
|
1243
1247
|
// src/acpFare.ts
|
|
1244
1248
|
import {
|
|
@@ -1266,27 +1270,42 @@ var acpError_default = AcpError;
|
|
|
1266
1270
|
|
|
1267
1271
|
// src/acpFare.ts
|
|
1268
1272
|
var Fare = class _Fare {
|
|
1269
|
-
constructor(contractAddress, decimals) {
|
|
1273
|
+
constructor(contractAddress, decimals, chainId) {
|
|
1270
1274
|
this.contractAddress = contractAddress;
|
|
1271
1275
|
this.decimals = decimals;
|
|
1276
|
+
this.chainId = chainId;
|
|
1272
1277
|
}
|
|
1273
1278
|
formatAmount(amount) {
|
|
1274
1279
|
return parseUnits(amount.toString(), this.decimals);
|
|
1275
1280
|
}
|
|
1276
|
-
static async fromContractAddress(contractAddress, config = baseAcpConfig) {
|
|
1281
|
+
static async fromContractAddress(contractAddress, config = baseAcpConfig, chainId = config.chain.id) {
|
|
1277
1282
|
if (contractAddress === config.baseFare.contractAddress) {
|
|
1278
1283
|
return config.baseFare;
|
|
1279
1284
|
}
|
|
1285
|
+
let chainConfig = config.chain;
|
|
1286
|
+
let rpcUrl = config.rpcEndpoint;
|
|
1287
|
+
if (chainId !== config.chain.id) {
|
|
1288
|
+
const selectedConfig = config.chains?.find(
|
|
1289
|
+
(chain) => chain.chain.id === chainId
|
|
1290
|
+
);
|
|
1291
|
+
if (!selectedConfig) {
|
|
1292
|
+
throw new acpError_default(
|
|
1293
|
+
`Chain configuration for chainId ${chainId} not found.`
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
chainConfig = selectedConfig.chain;
|
|
1297
|
+
rpcUrl = selectedConfig.rpcUrl;
|
|
1298
|
+
}
|
|
1280
1299
|
const publicClient = createPublicClient({
|
|
1281
|
-
chain:
|
|
1282
|
-
transport: http(
|
|
1300
|
+
chain: chainConfig,
|
|
1301
|
+
transport: http(rpcUrl)
|
|
1283
1302
|
});
|
|
1284
1303
|
const decimals = await publicClient.readContract({
|
|
1285
1304
|
address: contractAddress,
|
|
1286
1305
|
abi: erc20Abi,
|
|
1287
1306
|
functionName: "decimals"
|
|
1288
1307
|
});
|
|
1289
|
-
return new _Fare(contractAddress, decimals);
|
|
1308
|
+
return new _Fare(contractAddress, decimals, chainId);
|
|
1290
1309
|
}
|
|
1291
1310
|
};
|
|
1292
1311
|
var FareAmountBase = class {
|
|
@@ -1705,6 +1724,34 @@ var ACP_V2_ABI = [
|
|
|
1705
1724
|
stateMutability: "nonpayable",
|
|
1706
1725
|
type: "function"
|
|
1707
1726
|
},
|
|
1727
|
+
{
|
|
1728
|
+
inputs: [
|
|
1729
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
1730
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
1731
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
1732
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
1733
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
1734
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
1735
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
1736
|
+
{
|
|
1737
|
+
internalType: "enum ACPTypes.MemoType",
|
|
1738
|
+
name: "memoType",
|
|
1739
|
+
type: "uint8"
|
|
1740
|
+
},
|
|
1741
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1742
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
1743
|
+
{
|
|
1744
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
1745
|
+
name: "nextPhase",
|
|
1746
|
+
type: "uint8"
|
|
1747
|
+
},
|
|
1748
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
1749
|
+
],
|
|
1750
|
+
name: "createCrossChainPayableMemo",
|
|
1751
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
1752
|
+
stateMutability: "nonpayable",
|
|
1753
|
+
type: "function"
|
|
1754
|
+
},
|
|
1708
1755
|
{
|
|
1709
1756
|
inputs: [
|
|
1710
1757
|
{ internalType: "address", name: "provider", type: "address" },
|
|
@@ -1889,7 +1936,12 @@ var ACP_V2_ABI = [
|
|
|
1889
1936
|
name: "nextPhase",
|
|
1890
1937
|
type: "uint8"
|
|
1891
1938
|
},
|
|
1892
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
1939
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1940
|
+
{
|
|
1941
|
+
internalType: "enum ACPTypes.MemoState",
|
|
1942
|
+
name: "state",
|
|
1943
|
+
type: "uint8"
|
|
1944
|
+
}
|
|
1893
1945
|
],
|
|
1894
1946
|
internalType: "struct ACPTypes.Memo[]",
|
|
1895
1947
|
name: "memos",
|
|
@@ -1936,7 +1988,12 @@ var ACP_V2_ABI = [
|
|
|
1936
1988
|
name: "nextPhase",
|
|
1937
1989
|
type: "uint8"
|
|
1938
1990
|
},
|
|
1939
|
-
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
1991
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
1992
|
+
{
|
|
1993
|
+
internalType: "enum ACPTypes.MemoState",
|
|
1994
|
+
name: "state",
|
|
1995
|
+
type: "uint8"
|
|
1996
|
+
}
|
|
1940
1997
|
],
|
|
1941
1998
|
internalType: "struct ACPTypes.Memo[]",
|
|
1942
1999
|
name: "memos",
|
|
@@ -1979,7 +2036,12 @@ var ACP_V2_ABI = [
|
|
|
1979
2036
|
name: "nextPhase",
|
|
1980
2037
|
type: "uint8"
|
|
1981
2038
|
},
|
|
1982
|
-
{ 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
|
+
}
|
|
1983
2045
|
],
|
|
1984
2046
|
internalType: "struct ACPTypes.Memo[]",
|
|
1985
2047
|
name: "memos",
|
|
@@ -2235,7 +2297,7 @@ var acpAbiV2_default = ACP_V2_ABI;
|
|
|
2235
2297
|
var V1_MAX_RETRIES = 10;
|
|
2236
2298
|
var V2_MAX_RETRIES = 3;
|
|
2237
2299
|
var AcpContractConfig2 = class {
|
|
2238
|
-
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config) {
|
|
2300
|
+
constructor(chain, contractAddress, baseFare, alchemyRpcUrl, acpUrl, abi, maxRetries, rpcEndpoint, x402Config, chains = []) {
|
|
2239
2301
|
this.chain = chain;
|
|
2240
2302
|
this.contractAddress = contractAddress;
|
|
2241
2303
|
this.baseFare = baseFare;
|
|
@@ -2245,6 +2307,7 @@ var AcpContractConfig2 = class {
|
|
|
2245
2307
|
this.maxRetries = maxRetries;
|
|
2246
2308
|
this.rpcEndpoint = rpcEndpoint;
|
|
2247
2309
|
this.x402Config = x402Config;
|
|
2310
|
+
this.chains = chains;
|
|
2248
2311
|
}
|
|
2249
2312
|
};
|
|
2250
2313
|
var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
@@ -3472,7 +3535,10 @@ var SINGLE_SIGNER_VALIDATION_MODULE_ABI = [
|
|
|
3472
3535
|
var singleSignerValidationModuleAbi_default = SINGLE_SIGNER_VALIDATION_MODULE_ABI;
|
|
3473
3536
|
|
|
3474
3537
|
// src/constants.ts
|
|
3475
|
-
import {
|
|
3538
|
+
import {
|
|
3539
|
+
base as base2,
|
|
3540
|
+
baseSepolia as baseSepolia2
|
|
3541
|
+
} from "viem/chains";
|
|
3476
3542
|
var USDC_TOKEN_ADDRESS = {
|
|
3477
3543
|
[baseSepolia2.id]: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
3478
3544
|
[base2.id]: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
@@ -3520,6 +3586,7 @@ var BaseAcpContractClient = class {
|
|
|
3520
3586
|
constructor(agentWalletAddress, config = baseAcpConfig) {
|
|
3521
3587
|
this.agentWalletAddress = agentWalletAddress;
|
|
3522
3588
|
this.config = config;
|
|
3589
|
+
this.publicClients = {};
|
|
3523
3590
|
this.chain = config.chain;
|
|
3524
3591
|
this.abi = config.abi;
|
|
3525
3592
|
this.contractAddress = config.contractAddress;
|
|
@@ -3619,12 +3686,12 @@ ${JSON.stringify(
|
|
|
3619
3686
|
throw new acpError_default("Failed to create job", error);
|
|
3620
3687
|
}
|
|
3621
3688
|
}
|
|
3622
|
-
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress) {
|
|
3689
|
+
approveAllowance(amountBaseUnit, paymentTokenAddress = this.config.baseFare.contractAddress, targetAddress) {
|
|
3623
3690
|
try {
|
|
3624
3691
|
const data = encodeFunctionData({
|
|
3625
3692
|
abi: erc20Abi2,
|
|
3626
3693
|
functionName: "approve",
|
|
3627
|
-
args: [this.contractAddress, amountBaseUnit]
|
|
3694
|
+
args: [targetAddress ?? this.contractAddress, amountBaseUnit]
|
|
3628
3695
|
});
|
|
3629
3696
|
const payload = {
|
|
3630
3697
|
data,
|
|
@@ -3663,6 +3730,35 @@ ${JSON.stringify(
|
|
|
3663
3730
|
throw new acpError_default("Failed to create payable memo", error);
|
|
3664
3731
|
}
|
|
3665
3732
|
}
|
|
3733
|
+
createCrossChainPayableMemo(jobId, content, token, amountBaseUnit, recipient, feeAmountBaseUnit, feeType, type, expiredAt, nextPhase, destinationEid, secured = true) {
|
|
3734
|
+
try {
|
|
3735
|
+
const data = encodeFunctionData({
|
|
3736
|
+
abi: this.abi,
|
|
3737
|
+
functionName: "createCrossChainPayableMemo",
|
|
3738
|
+
args: [
|
|
3739
|
+
jobId,
|
|
3740
|
+
content,
|
|
3741
|
+
token,
|
|
3742
|
+
amountBaseUnit,
|
|
3743
|
+
recipient,
|
|
3744
|
+
feeAmountBaseUnit,
|
|
3745
|
+
feeType,
|
|
3746
|
+
type,
|
|
3747
|
+
expiredAt,
|
|
3748
|
+
secured,
|
|
3749
|
+
nextPhase,
|
|
3750
|
+
destinationEid
|
|
3751
|
+
]
|
|
3752
|
+
});
|
|
3753
|
+
const payload = {
|
|
3754
|
+
data,
|
|
3755
|
+
contractAddress: this.contractAddress
|
|
3756
|
+
};
|
|
3757
|
+
return payload;
|
|
3758
|
+
} catch (error) {
|
|
3759
|
+
throw new acpError_default("Failed to create cross chain payable memo", error);
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3666
3762
|
createMemo(jobId, content, type, isSecured, nextPhase) {
|
|
3667
3763
|
try {
|
|
3668
3764
|
const data = encodeFunctionData({
|
|
@@ -3679,6 +3775,22 @@ ${JSON.stringify(
|
|
|
3679
3775
|
throw new acpError_default("Failed to create memo", error);
|
|
3680
3776
|
}
|
|
3681
3777
|
}
|
|
3778
|
+
createMemoWithMetadata(jobId, content, type, isSecured, nextPhase, metadata) {
|
|
3779
|
+
try {
|
|
3780
|
+
const data = encodeFunctionData({
|
|
3781
|
+
abi: this.abi,
|
|
3782
|
+
functionName: "createMemoWithMetadata",
|
|
3783
|
+
args: [jobId, content, type, isSecured, nextPhase, metadata]
|
|
3784
|
+
});
|
|
3785
|
+
const payload = {
|
|
3786
|
+
data,
|
|
3787
|
+
contractAddress: this.contractAddress
|
|
3788
|
+
};
|
|
3789
|
+
return payload;
|
|
3790
|
+
} catch (error) {
|
|
3791
|
+
throw new acpError_default("Failed to create memo with metadata", error);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3682
3794
|
signMemo(memoId, isApproved, reason) {
|
|
3683
3795
|
try {
|
|
3684
3796
|
const data = encodeFunctionData({
|
|
@@ -3764,9 +3876,47 @@ ${JSON.stringify(
|
|
|
3764
3876
|
throw new acpError_default("Failed to submit TransferWithAuthorization", error);
|
|
3765
3877
|
}
|
|
3766
3878
|
}
|
|
3879
|
+
async getERC20Balance(chainId, tokenAddress, walletAddress) {
|
|
3880
|
+
const publicClient = this.publicClients[chainId];
|
|
3881
|
+
if (!publicClient) {
|
|
3882
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3883
|
+
}
|
|
3884
|
+
return await publicClient.readContract({
|
|
3885
|
+
address: tokenAddress,
|
|
3886
|
+
abi: erc20Abi2,
|
|
3887
|
+
functionName: "balanceOf",
|
|
3888
|
+
args: [walletAddress]
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
async getERC20Allowance(chainId, tokenAddress, walletAddress, spenderAddress) {
|
|
3892
|
+
const publicClient = this.publicClients[chainId];
|
|
3893
|
+
if (!publicClient) {
|
|
3894
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3895
|
+
}
|
|
3896
|
+
return await publicClient.readContract({
|
|
3897
|
+
address: tokenAddress,
|
|
3898
|
+
abi: erc20Abi2,
|
|
3899
|
+
functionName: "allowance",
|
|
3900
|
+
args: [walletAddress, spenderAddress]
|
|
3901
|
+
});
|
|
3902
|
+
}
|
|
3903
|
+
async getERC20Symbol(chainId, tokenAddress) {
|
|
3904
|
+
const publicClient = this.publicClients[chainId];
|
|
3905
|
+
if (!publicClient) {
|
|
3906
|
+
throw new acpError_default(`Public client for chainId ${chainId} not found`);
|
|
3907
|
+
}
|
|
3908
|
+
return await publicClient.readContract({
|
|
3909
|
+
address: tokenAddress,
|
|
3910
|
+
abi: erc20Abi2,
|
|
3911
|
+
functionName: "symbol"
|
|
3912
|
+
});
|
|
3913
|
+
}
|
|
3767
3914
|
};
|
|
3768
3915
|
var baseAcpContractClient_default = BaseAcpContractClient;
|
|
3769
3916
|
|
|
3917
|
+
// src/acpJob.ts
|
|
3918
|
+
import { formatUnits } from "viem";
|
|
3919
|
+
|
|
3770
3920
|
// src/interfaces.ts
|
|
3771
3921
|
var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
3772
3922
|
AcpMemoStatus2["PENDING"] = "PENDING";
|
|
@@ -3774,6 +3924,15 @@ var AcpMemoStatus = /* @__PURE__ */ ((AcpMemoStatus2) => {
|
|
|
3774
3924
|
AcpMemoStatus2["REJECTED"] = "REJECTED";
|
|
3775
3925
|
return AcpMemoStatus2;
|
|
3776
3926
|
})(AcpMemoStatus || {});
|
|
3927
|
+
var AcpMemoState = /* @__PURE__ */ ((AcpMemoState2) => {
|
|
3928
|
+
AcpMemoState2[AcpMemoState2["NONE"] = 0] = "NONE";
|
|
3929
|
+
AcpMemoState2[AcpMemoState2["PENDING"] = 1] = "PENDING";
|
|
3930
|
+
AcpMemoState2[AcpMemoState2["IN_PROGRESS"] = 2] = "IN_PROGRESS";
|
|
3931
|
+
AcpMemoState2[AcpMemoState2["READY"] = 3] = "READY";
|
|
3932
|
+
AcpMemoState2[AcpMemoState2["COMPLETED"] = 4] = "COMPLETED";
|
|
3933
|
+
AcpMemoState2[AcpMemoState2["REJECTED"] = 5] = "REJECTED";
|
|
3934
|
+
return AcpMemoState2;
|
|
3935
|
+
})(AcpMemoState || {});
|
|
3777
3936
|
var AcpAgentSort = /* @__PURE__ */ ((AcpAgentSort2) => {
|
|
3778
3937
|
AcpAgentSort2["SUCCESSFUL_JOB_COUNT"] = "successfulJobCount";
|
|
3779
3938
|
AcpAgentSort2["SUCCESS_RATE"] = "successRate";
|
|
@@ -3812,6 +3971,19 @@ var PositionDirection = /* @__PURE__ */ ((PositionDirection2) => {
|
|
|
3812
3971
|
})(PositionDirection || {});
|
|
3813
3972
|
|
|
3814
3973
|
// src/utils.ts
|
|
3974
|
+
import { decodeAbiParameters, encodeAbiParameters } from "viem";
|
|
3975
|
+
import {
|
|
3976
|
+
arbitrum as arbitrum3,
|
|
3977
|
+
arbitrumSepolia as arbitrumSepolia3,
|
|
3978
|
+
base as base3,
|
|
3979
|
+
baseSepolia as baseSepolia3,
|
|
3980
|
+
bsc as bsc3,
|
|
3981
|
+
bscTestnet as bscTestnet3,
|
|
3982
|
+
mainnet as mainnet3,
|
|
3983
|
+
polygon as polygon3,
|
|
3984
|
+
polygonAmoy as polygonAmoy3,
|
|
3985
|
+
sepolia as sepolia3
|
|
3986
|
+
} from "viem/chains";
|
|
3815
3987
|
function tryParseJson(content) {
|
|
3816
3988
|
try {
|
|
3817
3989
|
return JSON.parse(content);
|
|
@@ -3828,6 +4000,31 @@ function safeBase64Encode(data) {
|
|
|
3828
4000
|
}
|
|
3829
4001
|
return Buffer.from(data).toString("base64");
|
|
3830
4002
|
}
|
|
4003
|
+
function getDestinationEndpointId(chainId) {
|
|
4004
|
+
switch (chainId) {
|
|
4005
|
+
case baseSepolia3.id:
|
|
4006
|
+
return 40245;
|
|
4007
|
+
case sepolia3.id:
|
|
4008
|
+
return 40161;
|
|
4009
|
+
case polygonAmoy3.id:
|
|
4010
|
+
return 40267;
|
|
4011
|
+
case arbitrumSepolia3.id:
|
|
4012
|
+
return 40231;
|
|
4013
|
+
case bscTestnet3.id:
|
|
4014
|
+
return 40102;
|
|
4015
|
+
case base3.id:
|
|
4016
|
+
return 30184;
|
|
4017
|
+
case mainnet3.id:
|
|
4018
|
+
return 30101;
|
|
4019
|
+
case polygon3.id:
|
|
4020
|
+
return 30109;
|
|
4021
|
+
case arbitrum3.id:
|
|
4022
|
+
return 30110;
|
|
4023
|
+
case bsc3.id:
|
|
4024
|
+
return 30102;
|
|
4025
|
+
}
|
|
4026
|
+
throw new Error(`Unsupported chain ID: ${chainId}`);
|
|
4027
|
+
}
|
|
3831
4028
|
|
|
3832
4029
|
// src/acpJobOffering.ts
|
|
3833
4030
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
@@ -4030,25 +4227,43 @@ var AcpJob = class {
|
|
|
4030
4227
|
}
|
|
4031
4228
|
const feeAmount = new FareAmount(0, this.acpContractClient.config.baseFare);
|
|
4032
4229
|
const isPercentagePricing = this.priceType === "percentage" /* PERCENTAGE */;
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
this.
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4230
|
+
if (amount.fare.chainId && amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4231
|
+
operations.push(
|
|
4232
|
+
this.acpContractClient.createCrossChainPayableMemo(
|
|
4233
|
+
this.id,
|
|
4234
|
+
content,
|
|
4235
|
+
amount.fare.contractAddress,
|
|
4236
|
+
amount.amount,
|
|
4237
|
+
recipient,
|
|
4238
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4239
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4240
|
+
type,
|
|
4241
|
+
expiredAt,
|
|
4242
|
+
2 /* TRANSACTION */,
|
|
4243
|
+
getDestinationEndpointId(amount.fare.chainId)
|
|
4244
|
+
)
|
|
4245
|
+
);
|
|
4246
|
+
} else {
|
|
4247
|
+
operations.push(
|
|
4248
|
+
this.acpContractClient.createPayableMemo(
|
|
4249
|
+
this.id,
|
|
4250
|
+
content,
|
|
4251
|
+
amount.amount,
|
|
4252
|
+
recipient,
|
|
4253
|
+
isPercentagePricing ? BigInt(Math.round(this.priceValue * 1e4)) : feeAmount.amount,
|
|
4254
|
+
isPercentagePricing ? 3 /* PERCENTAGE_FEE */ : 0 /* NO_FEE */,
|
|
4255
|
+
2 /* TRANSACTION */,
|
|
4256
|
+
type,
|
|
4257
|
+
expiredAt,
|
|
4258
|
+
amount.fare.contractAddress
|
|
4259
|
+
)
|
|
4260
|
+
);
|
|
4261
|
+
}
|
|
4047
4262
|
return await this.acpContractClient.handleOperation(operations);
|
|
4048
4263
|
}
|
|
4049
4264
|
async payAndAcceptRequirement(reason) {
|
|
4050
4265
|
const memo = this.memos.find(
|
|
4051
|
-
(m) => m.nextPhase === 2 /* TRANSACTION */
|
|
4266
|
+
(m) => m.nextPhase === 2 /* TRANSACTION */ || m.nextPhase === 4 /* COMPLETED */
|
|
4052
4267
|
);
|
|
4053
4268
|
if (!memo) {
|
|
4054
4269
|
throw new acpError_default("No notification memo found");
|
|
@@ -4176,6 +4391,9 @@ var AcpJob = class {
|
|
|
4176
4391
|
if (this.latestMemo?.nextPhase !== 3 /* EVALUATION */) {
|
|
4177
4392
|
throw new acpError_default("No transaction memo found");
|
|
4178
4393
|
}
|
|
4394
|
+
if (amount.fare.chainId !== this.acpContractClient.config.chain.id) {
|
|
4395
|
+
return await this.deliverCrossChainPayable(this.clientAddress, amount);
|
|
4396
|
+
}
|
|
4179
4397
|
const operations = [];
|
|
4180
4398
|
operations.push(
|
|
4181
4399
|
this.acpContractClient.approveAllowance(
|
|
@@ -4306,6 +4524,57 @@ var AcpJob = class {
|
|
|
4306
4524
|
waitMs = Math.min(waitMs * 2, maxWaitMs);
|
|
4307
4525
|
}
|
|
4308
4526
|
}
|
|
4527
|
+
async deliverCrossChainPayable(recipient, amount, isRequest = false) {
|
|
4528
|
+
if (!amount.fare.chainId) {
|
|
4529
|
+
throw new acpError_default("Chain ID is required for cross chain payable");
|
|
4530
|
+
}
|
|
4531
|
+
const chainId = amount.fare.chainId;
|
|
4532
|
+
const assetManagerAddress = await this.acpContractClient.getAssetManager();
|
|
4533
|
+
const tokenBalance = await this.acpContractClient.getERC20Balance(
|
|
4534
|
+
chainId,
|
|
4535
|
+
amount.fare.contractAddress,
|
|
4536
|
+
this.acpContractClient.agentWalletAddress
|
|
4537
|
+
);
|
|
4538
|
+
if (tokenBalance < amount.amount) {
|
|
4539
|
+
throw new acpError_default("Insufficient token balance for cross chain payable");
|
|
4540
|
+
}
|
|
4541
|
+
const currentAllowance = await this.acpContractClient.getERC20Allowance(
|
|
4542
|
+
chainId,
|
|
4543
|
+
amount.fare.contractAddress,
|
|
4544
|
+
this.acpContractClient.agentWalletAddress,
|
|
4545
|
+
assetManagerAddress
|
|
4546
|
+
);
|
|
4547
|
+
const approveAllowanceOperation = this.acpContractClient.approveAllowance(
|
|
4548
|
+
amount.amount + currentAllowance,
|
|
4549
|
+
amount.fare.contractAddress,
|
|
4550
|
+
assetManagerAddress
|
|
4551
|
+
);
|
|
4552
|
+
await this.acpContractClient.handleOperation(
|
|
4553
|
+
[approveAllowanceOperation],
|
|
4554
|
+
chainId
|
|
4555
|
+
);
|
|
4556
|
+
const tokenSymbol = await this.acpContractClient.getERC20Symbol(
|
|
4557
|
+
chainId,
|
|
4558
|
+
amount.fare.contractAddress
|
|
4559
|
+
);
|
|
4560
|
+
const createMemoOperation = this.acpContractClient.createCrossChainPayableMemo(
|
|
4561
|
+
this.id,
|
|
4562
|
+
`Performing cross chain payable transfer of ${formatUnits(
|
|
4563
|
+
amount.amount,
|
|
4564
|
+
amount.fare.decimals
|
|
4565
|
+
)} ${tokenSymbol} to ${recipient}`,
|
|
4566
|
+
amount.fare.contractAddress,
|
|
4567
|
+
amount.amount,
|
|
4568
|
+
recipient,
|
|
4569
|
+
BigInt(0),
|
|
4570
|
+
0 /* NO_FEE */,
|
|
4571
|
+
isRequest ? 6 /* PAYABLE_REQUEST */ : 7 /* PAYABLE_TRANSFER */,
|
|
4572
|
+
new Date(Date.now() + 1e3 * 60 * 5),
|
|
4573
|
+
isRequest ? 2 /* TRANSACTION */ : 4 /* COMPLETED */,
|
|
4574
|
+
getDestinationEndpointId(chainId)
|
|
4575
|
+
);
|
|
4576
|
+
await this.acpContractClient.handleOperation([createMemoOperation]);
|
|
4577
|
+
}
|
|
4309
4578
|
[util.inspect.custom]() {
|
|
4310
4579
|
return {
|
|
4311
4580
|
id: this.id,
|
|
@@ -4329,7 +4598,7 @@ var acpJob_default = AcpJob;
|
|
|
4329
4598
|
// src/acpMemo.ts
|
|
4330
4599
|
import util2 from "util";
|
|
4331
4600
|
var AcpMemo = class {
|
|
4332
|
-
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash) {
|
|
4601
|
+
constructor(contractClient, id, type, content, nextPhase, status, senderAddress, signedReason, expiry, payableDetails, txHash, signedTxHash, state) {
|
|
4333
4602
|
this.contractClient = contractClient;
|
|
4334
4603
|
this.id = id;
|
|
4335
4604
|
this.type = type;
|
|
@@ -4342,6 +4611,7 @@ var AcpMemo = class {
|
|
|
4342
4611
|
this.payableDetails = payableDetails;
|
|
4343
4612
|
this.txHash = txHash;
|
|
4344
4613
|
this.signedTxHash = signedTxHash;
|
|
4614
|
+
this.state = state;
|
|
4345
4615
|
if (this.payableDetails) {
|
|
4346
4616
|
this.payableDetails.amount = BigInt(this.payableDetails.amount);
|
|
4347
4617
|
this.payableDetails.feeAmount = BigInt(this.payableDetails.feeAmount);
|
|
@@ -4492,7 +4762,8 @@ var AcpClient = class {
|
|
|
4492
4762
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4493
4763
|
memo.payableDetails,
|
|
4494
4764
|
memo.txHash,
|
|
4495
|
-
memo.signedTxHash
|
|
4765
|
+
memo.signedTxHash,
|
|
4766
|
+
memo.state
|
|
4496
4767
|
);
|
|
4497
4768
|
}),
|
|
4498
4769
|
data.phase,
|
|
@@ -4530,7 +4801,8 @@ var AcpClient = class {
|
|
|
4530
4801
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4531
4802
|
memo.payableDetails,
|
|
4532
4803
|
memo.txHash,
|
|
4533
|
-
memo.signedTxHash
|
|
4804
|
+
memo.signedTxHash,
|
|
4805
|
+
memo.state
|
|
4534
4806
|
);
|
|
4535
4807
|
}),
|
|
4536
4808
|
data.phase,
|
|
@@ -4555,7 +4827,14 @@ var AcpClient = class {
|
|
|
4555
4827
|
process.on("SIGTERM", cleanup);
|
|
4556
4828
|
}
|
|
4557
4829
|
async browseAgents(keyword, options) {
|
|
4558
|
-
let {
|
|
4830
|
+
let {
|
|
4831
|
+
cluster,
|
|
4832
|
+
sort_by,
|
|
4833
|
+
top_k,
|
|
4834
|
+
graduationStatus,
|
|
4835
|
+
onlineStatus,
|
|
4836
|
+
showHiddenOfferings
|
|
4837
|
+
} = options;
|
|
4559
4838
|
top_k = top_k ?? 5;
|
|
4560
4839
|
let url = `${this.acpUrl}/api/agents/v4/search?search=${keyword}`;
|
|
4561
4840
|
if (sort_by && sort_by.length > 0) {
|
|
@@ -4746,7 +5025,8 @@ var AcpClient = class {
|
|
|
4746
5025
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4747
5026
|
memo.payableDetails,
|
|
4748
5027
|
memo.txHash,
|
|
4749
|
-
memo.signedTxHash
|
|
5028
|
+
memo.signedTxHash,
|
|
5029
|
+
memo.state
|
|
4750
5030
|
)
|
|
4751
5031
|
);
|
|
4752
5032
|
jobs.push(
|
|
@@ -4820,7 +5100,8 @@ var AcpClient = class {
|
|
|
4820
5100
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4821
5101
|
memo.payableDetails,
|
|
4822
5102
|
memo.txHash,
|
|
4823
|
-
memo.signedTxHash
|
|
5103
|
+
memo.signedTxHash,
|
|
5104
|
+
memo.state
|
|
4824
5105
|
)
|
|
4825
5106
|
);
|
|
4826
5107
|
return new acpJob_default(
|
|
@@ -4879,7 +5160,8 @@ var AcpClient = class {
|
|
|
4879
5160
|
memo.expiry ? new Date(parseInt(memo.expiry) * 1e3) : void 0,
|
|
4880
5161
|
memo.payableDetails,
|
|
4881
5162
|
memo.txHash,
|
|
4882
|
-
memo.signedTxHash
|
|
5163
|
+
memo.signedTxHash,
|
|
5164
|
+
memo.state
|
|
4883
5165
|
);
|
|
4884
5166
|
} catch (err) {
|
|
4885
5167
|
throw new acpError_default(
|
|
@@ -5100,10 +5382,7 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5100
5382
|
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
5101
5383
|
}
|
|
5102
5384
|
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
|
|
5103
|
-
const acpContractClient = new _AcpContractClient(
|
|
5104
|
-
agentWalletAddress,
|
|
5105
|
-
config
|
|
5106
|
-
);
|
|
5385
|
+
const acpContractClient = new _AcpContractClient(agentWalletAddress, config);
|
|
5107
5386
|
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
5108
5387
|
return acpContractClient;
|
|
5109
5388
|
}
|
|
@@ -5134,7 +5413,10 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5134
5413
|
`ACP Contract Client validation failed: agent account ${this.agentWalletAddress} is not deployed on-chain`
|
|
5135
5414
|
);
|
|
5136
5415
|
}
|
|
5137
|
-
await this.validateSessionKeyOnChain(
|
|
5416
|
+
await this.validateSessionKeyOnChain(
|
|
5417
|
+
sessionSignerAddress,
|
|
5418
|
+
sessionEntityKeyId
|
|
5419
|
+
);
|
|
5138
5420
|
console.log("Connected to ACP with v1 Contract Client (Legacy):", {
|
|
5139
5421
|
agentWalletAddress: this.agentWalletAddress,
|
|
5140
5422
|
whitelistedWalletAddress: sessionSignerAddress,
|
|
@@ -5204,7 +5486,9 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5204
5486
|
throw new acpError_default(`Failed to send user operation`, finalError);
|
|
5205
5487
|
}
|
|
5206
5488
|
async getJobId(createJobUserOpHash, clientAddress, providerAddress) {
|
|
5207
|
-
const result = await this.sessionKeyClient.getUserOperationReceipt(
|
|
5489
|
+
const result = await this.sessionKeyClient.getUserOperationReceipt(
|
|
5490
|
+
createJobUserOpHash
|
|
5491
|
+
);
|
|
5208
5492
|
if (!result) {
|
|
5209
5493
|
throw new acpError_default("Failed to get user operation receipt");
|
|
5210
5494
|
}
|
|
@@ -5303,6 +5587,9 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
|
|
|
5303
5587
|
async performX402Request(url, version2, budget, signature) {
|
|
5304
5588
|
return await this.acpX402.performRequest(url, version2, budget, signature);
|
|
5305
5589
|
}
|
|
5590
|
+
async getAssetManager() {
|
|
5591
|
+
throw new Error("Asset Manager not supported");
|
|
5592
|
+
}
|
|
5306
5593
|
getAcpVersion() {
|
|
5307
5594
|
return "1";
|
|
5308
5595
|
}
|
|
@@ -6019,83 +6306,1245 @@ var JOB_MANAGER_ABI = [
|
|
|
6019
6306
|
var jobManagerAbi_default = JOB_MANAGER_ABI;
|
|
6020
6307
|
|
|
6021
6308
|
// src/contractClients/acpContractClientV2.ts
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
}
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6309
|
+
import { base as base4, baseSepolia as baseSepolia4 } from "viem/chains";
|
|
6310
|
+
|
|
6311
|
+
// src/abis/memoManagerAbi.ts
|
|
6312
|
+
var MEMO_MANAGER_ABI = [
|
|
6313
|
+
{ inputs: [], stateMutability: "nonpayable", type: "constructor" },
|
|
6314
|
+
{ inputs: [], name: "AccessControlBadConfirmation", type: "error" },
|
|
6315
|
+
{
|
|
6316
|
+
inputs: [
|
|
6317
|
+
{ internalType: "address", name: "account", type: "address" },
|
|
6318
|
+
{ internalType: "bytes32", name: "neededRole", type: "bytes32" }
|
|
6319
|
+
],
|
|
6320
|
+
name: "AccessControlUnauthorizedAccount",
|
|
6321
|
+
type: "error"
|
|
6322
|
+
},
|
|
6323
|
+
{
|
|
6324
|
+
inputs: [{ internalType: "address", name: "target", type: "address" }],
|
|
6325
|
+
name: "AddressEmptyCode",
|
|
6326
|
+
type: "error"
|
|
6327
|
+
},
|
|
6328
|
+
{ inputs: [], name: "AlreadyVoted", type: "error" },
|
|
6329
|
+
{ inputs: [], name: "CannotApproveMemo", type: "error" },
|
|
6330
|
+
{ inputs: [], name: "CannotUpdateApprovedMemo", type: "error" },
|
|
6331
|
+
{ inputs: [], name: "CannotUpdateMemo", type: "error" },
|
|
6332
|
+
{ inputs: [], name: "CannotWithdrawYet", type: "error" },
|
|
6333
|
+
{ inputs: [], name: "DestinationChainNotConfigured", type: "error" },
|
|
6334
|
+
{
|
|
6335
|
+
inputs: [
|
|
6336
|
+
{ internalType: "address", name: "implementation", type: "address" }
|
|
6337
|
+
],
|
|
6338
|
+
name: "ERC1967InvalidImplementation",
|
|
6339
|
+
type: "error"
|
|
6340
|
+
},
|
|
6341
|
+
{ inputs: [], name: "ERC1967NonPayable", type: "error" },
|
|
6342
|
+
{ inputs: [], name: "EmptyContent", type: "error" },
|
|
6343
|
+
{ inputs: [], name: "FailedInnerCall", type: "error" },
|
|
6344
|
+
{ inputs: [], name: "InvalidInitialization", type: "error" },
|
|
6345
|
+
{ inputs: [], name: "InvalidMemoState", type: "error" },
|
|
6346
|
+
{ inputs: [], name: "InvalidMemoStateTransition", type: "error" },
|
|
6347
|
+
{ inputs: [], name: "InvalidMemoType", type: "error" },
|
|
6348
|
+
{ inputs: [], name: "JobAlreadyCompleted", type: "error" },
|
|
6349
|
+
{ inputs: [], name: "JobDoesNotExist", type: "error" },
|
|
6350
|
+
{ inputs: [], name: "MemoAlreadyApproved", type: "error" },
|
|
6351
|
+
{ inputs: [], name: "MemoAlreadyExecuted", type: "error" },
|
|
6352
|
+
{ inputs: [], name: "MemoAlreadySigned", type: "error" },
|
|
6353
|
+
{ inputs: [], name: "MemoCannotBeSigned", type: "error" },
|
|
6354
|
+
{ inputs: [], name: "MemoDoesNotExist", type: "error" },
|
|
6355
|
+
{ inputs: [], name: "MemoDoesNotRequireApproval", type: "error" },
|
|
6356
|
+
{ inputs: [], name: "MemoExpired", type: "error" },
|
|
6357
|
+
{ inputs: [], name: "MemoNotApproved", type: "error" },
|
|
6358
|
+
{ inputs: [], name: "MemoNotReadyToBeSigned", type: "error" },
|
|
6359
|
+
{ inputs: [], name: "MemoStateUnchanged", type: "error" },
|
|
6360
|
+
{ inputs: [], name: "NoAmountToTransfer", type: "error" },
|
|
6361
|
+
{ inputs: [], name: "NoPaymentAmount", type: "error" },
|
|
6362
|
+
{ inputs: [], name: "NotEscrowTransferMemoType", type: "error" },
|
|
6363
|
+
{ inputs: [], name: "NotInitializing", type: "error" },
|
|
6364
|
+
{ inputs: [], name: "NotPayableMemoType", type: "error" },
|
|
6365
|
+
{ inputs: [], name: "OnlyACPContract", type: "error" },
|
|
6366
|
+
{ inputs: [], name: "OnlyAssetManager", type: "error" },
|
|
6367
|
+
{ inputs: [], name: "OnlyClientOrProvider", type: "error" },
|
|
6368
|
+
{ inputs: [], name: "OnlyCounterParty", type: "error" },
|
|
6369
|
+
{ inputs: [], name: "OnlyEvaluator", type: "error" },
|
|
6370
|
+
{ inputs: [], name: "OnlyMemoSender", type: "error" },
|
|
6371
|
+
{ inputs: [], name: "ReentrancyGuardReentrantCall", type: "error" },
|
|
6372
|
+
{ inputs: [], name: "UUPSUnauthorizedCallContext", type: "error" },
|
|
6373
|
+
{
|
|
6374
|
+
inputs: [{ internalType: "bytes32", name: "slot", type: "bytes32" }],
|
|
6375
|
+
name: "UUPSUnsupportedProxiableUUID",
|
|
6376
|
+
type: "error"
|
|
6377
|
+
},
|
|
6378
|
+
{ inputs: [], name: "ZeroAcpContractAddress", type: "error" },
|
|
6379
|
+
{ inputs: [], name: "ZeroAddressRecipient", type: "error" },
|
|
6380
|
+
{ inputs: [], name: "ZeroAddressToken", type: "error" },
|
|
6381
|
+
{ inputs: [], name: "ZeroAssetManagerAddress", type: "error" },
|
|
6382
|
+
{ inputs: [], name: "ZeroJobManagerAddress", type: "error" },
|
|
6383
|
+
{
|
|
6384
|
+
anonymous: false,
|
|
6385
|
+
inputs: [
|
|
6386
|
+
{
|
|
6387
|
+
indexed: false,
|
|
6388
|
+
internalType: "uint64",
|
|
6389
|
+
name: "version",
|
|
6390
|
+
type: "uint64"
|
|
6084
6391
|
}
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6392
|
+
],
|
|
6393
|
+
name: "Initialized",
|
|
6394
|
+
type: "event"
|
|
6395
|
+
},
|
|
6396
|
+
{
|
|
6397
|
+
anonymous: false,
|
|
6398
|
+
inputs: [
|
|
6399
|
+
{
|
|
6400
|
+
indexed: true,
|
|
6401
|
+
internalType: "uint256",
|
|
6402
|
+
name: "memoId",
|
|
6403
|
+
type: "uint256"
|
|
6404
|
+
},
|
|
6405
|
+
{
|
|
6406
|
+
indexed: true,
|
|
6407
|
+
internalType: "address",
|
|
6408
|
+
name: "approver",
|
|
6409
|
+
type: "address"
|
|
6410
|
+
},
|
|
6411
|
+
{ indexed: false, internalType: "bool", name: "approved", type: "bool" },
|
|
6412
|
+
{
|
|
6413
|
+
indexed: false,
|
|
6414
|
+
internalType: "string",
|
|
6415
|
+
name: "reason",
|
|
6416
|
+
type: "string"
|
|
6417
|
+
}
|
|
6418
|
+
],
|
|
6419
|
+
name: "MemoSigned",
|
|
6420
|
+
type: "event"
|
|
6421
|
+
},
|
|
6422
|
+
{
|
|
6423
|
+
anonymous: false,
|
|
6424
|
+
inputs: [
|
|
6425
|
+
{
|
|
6426
|
+
indexed: true,
|
|
6427
|
+
internalType: "uint256",
|
|
6428
|
+
name: "memoId",
|
|
6429
|
+
type: "uint256"
|
|
6430
|
+
},
|
|
6431
|
+
{
|
|
6432
|
+
indexed: false,
|
|
6433
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6434
|
+
name: "oldState",
|
|
6435
|
+
type: "uint8"
|
|
6436
|
+
},
|
|
6437
|
+
{
|
|
6438
|
+
indexed: false,
|
|
6439
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6440
|
+
name: "newState",
|
|
6441
|
+
type: "uint8"
|
|
6442
|
+
}
|
|
6443
|
+
],
|
|
6444
|
+
name: "MemoStateUpdated",
|
|
6445
|
+
type: "event"
|
|
6446
|
+
},
|
|
6447
|
+
{
|
|
6448
|
+
anonymous: false,
|
|
6449
|
+
inputs: [
|
|
6450
|
+
{
|
|
6451
|
+
indexed: true,
|
|
6452
|
+
internalType: "uint256",
|
|
6453
|
+
name: "memoId",
|
|
6454
|
+
type: "uint256"
|
|
6455
|
+
},
|
|
6456
|
+
{
|
|
6457
|
+
indexed: true,
|
|
6458
|
+
internalType: "uint256",
|
|
6459
|
+
name: "jobId",
|
|
6460
|
+
type: "uint256"
|
|
6461
|
+
},
|
|
6462
|
+
{
|
|
6463
|
+
indexed: true,
|
|
6464
|
+
internalType: "address",
|
|
6465
|
+
name: "sender",
|
|
6466
|
+
type: "address"
|
|
6467
|
+
},
|
|
6468
|
+
{
|
|
6469
|
+
indexed: false,
|
|
6470
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6471
|
+
name: "memoType",
|
|
6472
|
+
type: "uint8"
|
|
6473
|
+
},
|
|
6474
|
+
{
|
|
6475
|
+
indexed: false,
|
|
6476
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6477
|
+
name: "nextPhase",
|
|
6478
|
+
type: "uint8"
|
|
6479
|
+
},
|
|
6480
|
+
{
|
|
6481
|
+
indexed: false,
|
|
6482
|
+
internalType: "string",
|
|
6483
|
+
name: "content",
|
|
6484
|
+
type: "string"
|
|
6485
|
+
}
|
|
6486
|
+
],
|
|
6487
|
+
name: "NewMemo",
|
|
6488
|
+
type: "event"
|
|
6489
|
+
},
|
|
6490
|
+
{
|
|
6491
|
+
anonymous: false,
|
|
6492
|
+
inputs: [
|
|
6493
|
+
{
|
|
6494
|
+
indexed: true,
|
|
6495
|
+
internalType: "uint256",
|
|
6496
|
+
name: "jobId",
|
|
6497
|
+
type: "uint256"
|
|
6498
|
+
},
|
|
6499
|
+
{
|
|
6500
|
+
indexed: true,
|
|
6501
|
+
internalType: "uint256",
|
|
6502
|
+
name: "memoId",
|
|
6503
|
+
type: "uint256"
|
|
6504
|
+
},
|
|
6505
|
+
{
|
|
6506
|
+
indexed: true,
|
|
6507
|
+
internalType: "address",
|
|
6508
|
+
name: "sender",
|
|
6509
|
+
type: "address"
|
|
6510
|
+
},
|
|
6511
|
+
{
|
|
6512
|
+
indexed: false,
|
|
6513
|
+
internalType: "address",
|
|
6514
|
+
name: "token",
|
|
6515
|
+
type: "address"
|
|
6516
|
+
},
|
|
6517
|
+
{
|
|
6518
|
+
indexed: false,
|
|
6519
|
+
internalType: "uint256",
|
|
6520
|
+
name: "amount",
|
|
6521
|
+
type: "uint256"
|
|
6522
|
+
}
|
|
6523
|
+
],
|
|
6524
|
+
name: "PayableFeeRefunded",
|
|
6525
|
+
type: "event"
|
|
6526
|
+
},
|
|
6527
|
+
{
|
|
6528
|
+
anonymous: false,
|
|
6529
|
+
inputs: [
|
|
6530
|
+
{
|
|
6531
|
+
indexed: true,
|
|
6532
|
+
internalType: "uint256",
|
|
6533
|
+
name: "jobId",
|
|
6534
|
+
type: "uint256"
|
|
6535
|
+
},
|
|
6536
|
+
{
|
|
6537
|
+
indexed: true,
|
|
6538
|
+
internalType: "uint256",
|
|
6539
|
+
name: "memoId",
|
|
6540
|
+
type: "uint256"
|
|
6541
|
+
},
|
|
6542
|
+
{
|
|
6543
|
+
indexed: true,
|
|
6544
|
+
internalType: "address",
|
|
6545
|
+
name: "sender",
|
|
6546
|
+
type: "address"
|
|
6547
|
+
},
|
|
6548
|
+
{
|
|
6549
|
+
indexed: false,
|
|
6550
|
+
internalType: "address",
|
|
6551
|
+
name: "token",
|
|
6552
|
+
type: "address"
|
|
6553
|
+
},
|
|
6554
|
+
{
|
|
6555
|
+
indexed: false,
|
|
6556
|
+
internalType: "uint256",
|
|
6557
|
+
name: "amount",
|
|
6558
|
+
type: "uint256"
|
|
6559
|
+
}
|
|
6560
|
+
],
|
|
6561
|
+
name: "PayableFundsRefunded",
|
|
6562
|
+
type: "event"
|
|
6563
|
+
},
|
|
6564
|
+
{
|
|
6565
|
+
anonymous: false,
|
|
6566
|
+
inputs: [
|
|
6567
|
+
{
|
|
6568
|
+
indexed: true,
|
|
6569
|
+
internalType: "uint256",
|
|
6570
|
+
name: "memoId",
|
|
6571
|
+
type: "uint256"
|
|
6572
|
+
},
|
|
6573
|
+
{
|
|
6574
|
+
indexed: true,
|
|
6575
|
+
internalType: "uint256",
|
|
6576
|
+
name: "jobId",
|
|
6577
|
+
type: "uint256"
|
|
6578
|
+
},
|
|
6579
|
+
{
|
|
6580
|
+
indexed: true,
|
|
6581
|
+
internalType: "address",
|
|
6582
|
+
name: "executor",
|
|
6583
|
+
type: "address"
|
|
6584
|
+
},
|
|
6585
|
+
{
|
|
6586
|
+
indexed: false,
|
|
6587
|
+
internalType: "uint256",
|
|
6588
|
+
name: "amount",
|
|
6589
|
+
type: "uint256"
|
|
6590
|
+
}
|
|
6591
|
+
],
|
|
6592
|
+
name: "PayableMemoExecuted",
|
|
6593
|
+
type: "event"
|
|
6594
|
+
},
|
|
6595
|
+
{
|
|
6596
|
+
anonymous: false,
|
|
6597
|
+
inputs: [
|
|
6598
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6599
|
+
{
|
|
6600
|
+
indexed: true,
|
|
6601
|
+
internalType: "bytes32",
|
|
6602
|
+
name: "previousAdminRole",
|
|
6603
|
+
type: "bytes32"
|
|
6604
|
+
},
|
|
6605
|
+
{
|
|
6606
|
+
indexed: true,
|
|
6607
|
+
internalType: "bytes32",
|
|
6608
|
+
name: "newAdminRole",
|
|
6609
|
+
type: "bytes32"
|
|
6610
|
+
}
|
|
6611
|
+
],
|
|
6612
|
+
name: "RoleAdminChanged",
|
|
6613
|
+
type: "event"
|
|
6614
|
+
},
|
|
6615
|
+
{
|
|
6616
|
+
anonymous: false,
|
|
6617
|
+
inputs: [
|
|
6618
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6619
|
+
{
|
|
6620
|
+
indexed: true,
|
|
6621
|
+
internalType: "address",
|
|
6622
|
+
name: "account",
|
|
6623
|
+
type: "address"
|
|
6624
|
+
},
|
|
6625
|
+
{
|
|
6626
|
+
indexed: true,
|
|
6627
|
+
internalType: "address",
|
|
6628
|
+
name: "sender",
|
|
6629
|
+
type: "address"
|
|
6630
|
+
}
|
|
6631
|
+
],
|
|
6632
|
+
name: "RoleGranted",
|
|
6633
|
+
type: "event"
|
|
6634
|
+
},
|
|
6635
|
+
{
|
|
6636
|
+
anonymous: false,
|
|
6637
|
+
inputs: [
|
|
6638
|
+
{ indexed: true, internalType: "bytes32", name: "role", type: "bytes32" },
|
|
6639
|
+
{
|
|
6640
|
+
indexed: true,
|
|
6641
|
+
internalType: "address",
|
|
6642
|
+
name: "account",
|
|
6643
|
+
type: "address"
|
|
6644
|
+
},
|
|
6645
|
+
{
|
|
6646
|
+
indexed: true,
|
|
6647
|
+
internalType: "address",
|
|
6648
|
+
name: "sender",
|
|
6649
|
+
type: "address"
|
|
6650
|
+
}
|
|
6651
|
+
],
|
|
6652
|
+
name: "RoleRevoked",
|
|
6653
|
+
type: "event"
|
|
6654
|
+
},
|
|
6655
|
+
{
|
|
6656
|
+
anonymous: false,
|
|
6657
|
+
inputs: [
|
|
6658
|
+
{
|
|
6659
|
+
indexed: true,
|
|
6660
|
+
internalType: "address",
|
|
6661
|
+
name: "implementation",
|
|
6662
|
+
type: "address"
|
|
6663
|
+
}
|
|
6664
|
+
],
|
|
6665
|
+
name: "Upgraded",
|
|
6666
|
+
type: "event"
|
|
6667
|
+
},
|
|
6668
|
+
{
|
|
6669
|
+
inputs: [],
|
|
6670
|
+
name: "ACP_CONTRACT_ROLE",
|
|
6671
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6672
|
+
stateMutability: "view",
|
|
6673
|
+
type: "function"
|
|
6674
|
+
},
|
|
6675
|
+
{
|
|
6676
|
+
inputs: [],
|
|
6677
|
+
name: "ADMIN_ROLE",
|
|
6678
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6679
|
+
stateMutability: "view",
|
|
6680
|
+
type: "function"
|
|
6681
|
+
},
|
|
6682
|
+
{
|
|
6683
|
+
inputs: [],
|
|
6684
|
+
name: "DEFAULT_ADMIN_ROLE",
|
|
6685
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
6686
|
+
stateMutability: "view",
|
|
6687
|
+
type: "function"
|
|
6688
|
+
},
|
|
6689
|
+
{
|
|
6690
|
+
inputs: [],
|
|
6691
|
+
name: "UPGRADE_INTERFACE_VERSION",
|
|
6692
|
+
outputs: [{ internalType: "string", name: "", type: "string" }],
|
|
6693
|
+
stateMutability: "view",
|
|
6694
|
+
type: "function"
|
|
6695
|
+
},
|
|
6696
|
+
{
|
|
6697
|
+
inputs: [],
|
|
6698
|
+
name: "acpContract",
|
|
6699
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6700
|
+
stateMutability: "view",
|
|
6701
|
+
type: "function"
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
inputs: [
|
|
6705
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6706
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6707
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6708
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6709
|
+
],
|
|
6710
|
+
name: "approveMemo",
|
|
6711
|
+
outputs: [],
|
|
6712
|
+
stateMutability: "nonpayable",
|
|
6713
|
+
type: "function"
|
|
6714
|
+
},
|
|
6715
|
+
{
|
|
6716
|
+
inputs: [],
|
|
6717
|
+
name: "assetManager",
|
|
6718
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6719
|
+
stateMutability: "view",
|
|
6720
|
+
type: "function"
|
|
6721
|
+
},
|
|
6722
|
+
{
|
|
6723
|
+
inputs: [
|
|
6724
|
+
{ internalType: "uint256[]", name: "memoIds", type: "uint256[]" },
|
|
6725
|
+
{ internalType: "bool", name: "approved", type: "bool" },
|
|
6726
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
6727
|
+
],
|
|
6728
|
+
name: "bulkApproveMemos",
|
|
6729
|
+
outputs: [],
|
|
6730
|
+
stateMutability: "nonpayable",
|
|
6731
|
+
type: "function"
|
|
6732
|
+
},
|
|
6733
|
+
{
|
|
6734
|
+
inputs: [
|
|
6735
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
6736
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
6737
|
+
],
|
|
6738
|
+
name: "canApproveMemo",
|
|
6739
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
6740
|
+
stateMutability: "view",
|
|
6741
|
+
type: "function"
|
|
6742
|
+
},
|
|
6743
|
+
{
|
|
6744
|
+
inputs: [
|
|
6745
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6746
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6747
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6748
|
+
{
|
|
6749
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6750
|
+
name: "memoType",
|
|
6751
|
+
type: "uint8"
|
|
6752
|
+
},
|
|
6753
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6754
|
+
{
|
|
6755
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6756
|
+
name: "nextPhase",
|
|
6757
|
+
type: "uint8"
|
|
6758
|
+
},
|
|
6759
|
+
{ internalType: "string", name: "metadata", type: "string" }
|
|
6760
|
+
],
|
|
6761
|
+
name: "createMemo",
|
|
6762
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6763
|
+
stateMutability: "nonpayable",
|
|
6764
|
+
type: "function"
|
|
6765
|
+
},
|
|
6766
|
+
{
|
|
6767
|
+
inputs: [
|
|
6768
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6769
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6770
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6771
|
+
{
|
|
6772
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6773
|
+
name: "memoType",
|
|
6774
|
+
type: "uint8"
|
|
6775
|
+
},
|
|
6776
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6777
|
+
{
|
|
6778
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6779
|
+
name: "nextPhase",
|
|
6780
|
+
type: "uint8"
|
|
6781
|
+
},
|
|
6782
|
+
{
|
|
6783
|
+
components: [
|
|
6784
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
6785
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
6786
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
6787
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
6788
|
+
{
|
|
6789
|
+
internalType: "enum ACPTypes.FeeType",
|
|
6790
|
+
name: "feeType",
|
|
6791
|
+
type: "uint8"
|
|
6792
|
+
},
|
|
6793
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
6794
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6795
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
6796
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
6797
|
+
],
|
|
6798
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
6799
|
+
name: "payableDetails_",
|
|
6800
|
+
type: "tuple"
|
|
6801
|
+
},
|
|
6802
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" }
|
|
6803
|
+
],
|
|
6804
|
+
name: "createPayableMemo",
|
|
6805
|
+
outputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6806
|
+
stateMutability: "nonpayable",
|
|
6807
|
+
type: "function"
|
|
6808
|
+
},
|
|
6809
|
+
{
|
|
6810
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6811
|
+
name: "emergencyApproveMemo",
|
|
6812
|
+
outputs: [],
|
|
6813
|
+
stateMutability: "nonpayable",
|
|
6814
|
+
type: "function"
|
|
6815
|
+
},
|
|
6816
|
+
{
|
|
6817
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6818
|
+
name: "executePayableMemo",
|
|
6819
|
+
outputs: [],
|
|
6820
|
+
stateMutability: "nonpayable",
|
|
6821
|
+
type: "function"
|
|
6822
|
+
},
|
|
6823
|
+
{
|
|
6824
|
+
inputs: [],
|
|
6825
|
+
name: "getAssetManager",
|
|
6826
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
6827
|
+
stateMutability: "view",
|
|
6828
|
+
type: "function"
|
|
6829
|
+
},
|
|
6830
|
+
{
|
|
6831
|
+
inputs: [
|
|
6832
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6833
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6834
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6835
|
+
],
|
|
6836
|
+
name: "getJobMemos",
|
|
6837
|
+
outputs: [
|
|
6838
|
+
{
|
|
6839
|
+
components: [
|
|
6840
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6841
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6842
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6843
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6844
|
+
{
|
|
6845
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6846
|
+
name: "memoType",
|
|
6847
|
+
type: "uint8"
|
|
6848
|
+
},
|
|
6849
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6850
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6851
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6852
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6853
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6854
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6855
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6856
|
+
{
|
|
6857
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6858
|
+
name: "nextPhase",
|
|
6859
|
+
type: "uint8"
|
|
6860
|
+
},
|
|
6861
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6862
|
+
{
|
|
6863
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6864
|
+
name: "state",
|
|
6865
|
+
type: "uint8"
|
|
6866
|
+
}
|
|
6867
|
+
],
|
|
6868
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
6869
|
+
name: "memoArray",
|
|
6870
|
+
type: "tuple[]"
|
|
6871
|
+
},
|
|
6872
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
6873
|
+
],
|
|
6874
|
+
stateMutability: "view",
|
|
6875
|
+
type: "function"
|
|
6876
|
+
},
|
|
6877
|
+
{
|
|
6878
|
+
inputs: [
|
|
6879
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6880
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "phase", type: "uint8" },
|
|
6881
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6882
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6883
|
+
],
|
|
6884
|
+
name: "getJobMemosByPhase",
|
|
6885
|
+
outputs: [
|
|
6886
|
+
{
|
|
6887
|
+
components: [
|
|
6888
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6889
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6890
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6891
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6892
|
+
{
|
|
6893
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6894
|
+
name: "memoType",
|
|
6895
|
+
type: "uint8"
|
|
6896
|
+
},
|
|
6897
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6898
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6899
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6900
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6901
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6902
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6903
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6904
|
+
{
|
|
6905
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6906
|
+
name: "nextPhase",
|
|
6907
|
+
type: "uint8"
|
|
6908
|
+
},
|
|
6909
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6910
|
+
{
|
|
6911
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6912
|
+
name: "state",
|
|
6913
|
+
type: "uint8"
|
|
6914
|
+
}
|
|
6915
|
+
],
|
|
6916
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
6917
|
+
name: "memoArray",
|
|
6918
|
+
type: "tuple[]"
|
|
6919
|
+
},
|
|
6920
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
6921
|
+
],
|
|
6922
|
+
stateMutability: "view",
|
|
6923
|
+
type: "function"
|
|
6924
|
+
},
|
|
6925
|
+
{
|
|
6926
|
+
inputs: [
|
|
6927
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6928
|
+
{
|
|
6929
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6930
|
+
name: "memoType",
|
|
6931
|
+
type: "uint8"
|
|
6932
|
+
},
|
|
6933
|
+
{ internalType: "uint256", name: "offset", type: "uint256" },
|
|
6934
|
+
{ internalType: "uint256", name: "limit", type: "uint256" }
|
|
6935
|
+
],
|
|
6936
|
+
name: "getJobMemosByType",
|
|
6937
|
+
outputs: [
|
|
6938
|
+
{
|
|
6939
|
+
components: [
|
|
6940
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6941
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6942
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6943
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6944
|
+
{
|
|
6945
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6946
|
+
name: "memoType",
|
|
6947
|
+
type: "uint8"
|
|
6948
|
+
},
|
|
6949
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
6950
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
6951
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
6952
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
6953
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
6954
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
6955
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
6956
|
+
{
|
|
6957
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
6958
|
+
name: "nextPhase",
|
|
6959
|
+
type: "uint8"
|
|
6960
|
+
},
|
|
6961
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
6962
|
+
{
|
|
6963
|
+
internalType: "enum ACPTypes.MemoState",
|
|
6964
|
+
name: "state",
|
|
6965
|
+
type: "uint8"
|
|
6966
|
+
}
|
|
6967
|
+
],
|
|
6968
|
+
internalType: "struct ACPTypes.Memo[]",
|
|
6969
|
+
name: "memoArray",
|
|
6970
|
+
type: "tuple[]"
|
|
6971
|
+
},
|
|
6972
|
+
{ internalType: "uint256", name: "total", type: "uint256" }
|
|
6973
|
+
],
|
|
6974
|
+
stateMutability: "view",
|
|
6975
|
+
type: "function"
|
|
6976
|
+
},
|
|
6977
|
+
{
|
|
6978
|
+
inputs: [],
|
|
6979
|
+
name: "getLocalEid",
|
|
6980
|
+
outputs: [{ internalType: "uint32", name: "", type: "uint32" }],
|
|
6981
|
+
stateMutability: "view",
|
|
6982
|
+
type: "function"
|
|
6983
|
+
},
|
|
6984
|
+
{
|
|
6985
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
6986
|
+
name: "getMemo",
|
|
6987
|
+
outputs: [
|
|
6988
|
+
{
|
|
6989
|
+
components: [
|
|
6990
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
6991
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
6992
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
6993
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
6994
|
+
{
|
|
6995
|
+
internalType: "enum ACPTypes.MemoType",
|
|
6996
|
+
name: "memoType",
|
|
6997
|
+
type: "uint8"
|
|
6998
|
+
},
|
|
6999
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7000
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7001
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7002
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7003
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7004
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7005
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7006
|
+
{
|
|
7007
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7008
|
+
name: "nextPhase",
|
|
7009
|
+
type: "uint8"
|
|
7010
|
+
},
|
|
7011
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7012
|
+
{
|
|
7013
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7014
|
+
name: "state",
|
|
7015
|
+
type: "uint8"
|
|
7016
|
+
}
|
|
7017
|
+
],
|
|
7018
|
+
internalType: "struct ACPTypes.Memo",
|
|
7019
|
+
name: "",
|
|
7020
|
+
type: "tuple"
|
|
7021
|
+
}
|
|
7022
|
+
],
|
|
7023
|
+
stateMutability: "view",
|
|
7024
|
+
type: "function"
|
|
7025
|
+
},
|
|
7026
|
+
{
|
|
7027
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7028
|
+
name: "getMemoApprovalStatus",
|
|
7029
|
+
outputs: [
|
|
7030
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7031
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7032
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" }
|
|
7033
|
+
],
|
|
7034
|
+
stateMutability: "view",
|
|
7035
|
+
type: "function"
|
|
7036
|
+
},
|
|
7037
|
+
{
|
|
7038
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7039
|
+
name: "getMemoWithPayableDetails",
|
|
7040
|
+
outputs: [
|
|
7041
|
+
{
|
|
7042
|
+
components: [
|
|
7043
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7044
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7045
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7046
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7047
|
+
{
|
|
7048
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7049
|
+
name: "memoType",
|
|
7050
|
+
type: "uint8"
|
|
7051
|
+
},
|
|
7052
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7053
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7054
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7055
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7056
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7057
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7058
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7059
|
+
{
|
|
7060
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7061
|
+
name: "nextPhase",
|
|
7062
|
+
type: "uint8"
|
|
7063
|
+
},
|
|
7064
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7065
|
+
{
|
|
7066
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7067
|
+
name: "state",
|
|
7068
|
+
type: "uint8"
|
|
7069
|
+
}
|
|
7070
|
+
],
|
|
7071
|
+
internalType: "struct ACPTypes.Memo",
|
|
7072
|
+
name: "memo",
|
|
7073
|
+
type: "tuple"
|
|
7074
|
+
},
|
|
7075
|
+
{
|
|
7076
|
+
components: [
|
|
7077
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7078
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7079
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7080
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7081
|
+
{
|
|
7082
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7083
|
+
name: "feeType",
|
|
7084
|
+
type: "uint8"
|
|
7085
|
+
},
|
|
7086
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7087
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7088
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7089
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7090
|
+
],
|
|
7091
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7092
|
+
name: "details",
|
|
7093
|
+
type: "tuple"
|
|
7094
|
+
}
|
|
7095
|
+
],
|
|
7096
|
+
stateMutability: "view",
|
|
7097
|
+
type: "function"
|
|
7098
|
+
},
|
|
7099
|
+
{
|
|
7100
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7101
|
+
name: "getPayableDetails",
|
|
7102
|
+
outputs: [
|
|
7103
|
+
{
|
|
7104
|
+
components: [
|
|
7105
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7106
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7107
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7108
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7109
|
+
{
|
|
7110
|
+
internalType: "enum ACPTypes.FeeType",
|
|
7111
|
+
name: "feeType",
|
|
7112
|
+
type: "uint8"
|
|
7113
|
+
},
|
|
7114
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7115
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7116
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7117
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7118
|
+
],
|
|
7119
|
+
internalType: "struct ACPTypes.PayableDetails",
|
|
7120
|
+
name: "",
|
|
7121
|
+
type: "tuple"
|
|
7122
|
+
}
|
|
7123
|
+
],
|
|
7124
|
+
stateMutability: "view",
|
|
7125
|
+
type: "function"
|
|
7126
|
+
},
|
|
7127
|
+
{
|
|
7128
|
+
inputs: [{ internalType: "bytes32", name: "role", type: "bytes32" }],
|
|
7129
|
+
name: "getRoleAdmin",
|
|
7130
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7131
|
+
stateMutability: "view",
|
|
7132
|
+
type: "function"
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
inputs: [
|
|
7136
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7137
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7138
|
+
],
|
|
7139
|
+
name: "grantRole",
|
|
7140
|
+
outputs: [],
|
|
7141
|
+
stateMutability: "nonpayable",
|
|
7142
|
+
type: "function"
|
|
7143
|
+
},
|
|
7144
|
+
{
|
|
7145
|
+
inputs: [
|
|
7146
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7147
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7148
|
+
],
|
|
7149
|
+
name: "hasRole",
|
|
7150
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7151
|
+
stateMutability: "view",
|
|
7152
|
+
type: "function"
|
|
7153
|
+
},
|
|
7154
|
+
{
|
|
7155
|
+
inputs: [
|
|
7156
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7157
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7158
|
+
{ internalType: "address", name: "paymentManager_", type: "address" }
|
|
7159
|
+
],
|
|
7160
|
+
name: "initialize",
|
|
7161
|
+
outputs: [],
|
|
7162
|
+
stateMutability: "nonpayable",
|
|
7163
|
+
type: "function"
|
|
7164
|
+
},
|
|
7165
|
+
{
|
|
7166
|
+
inputs: [
|
|
7167
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7168
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7169
|
+
],
|
|
7170
|
+
name: "isJobEvaluator",
|
|
7171
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7172
|
+
stateMutability: "view",
|
|
7173
|
+
type: "function"
|
|
7174
|
+
},
|
|
7175
|
+
{
|
|
7176
|
+
inputs: [
|
|
7177
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7178
|
+
{ internalType: "address", name: "user", type: "address" }
|
|
7179
|
+
],
|
|
7180
|
+
name: "isMemoSigner",
|
|
7181
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7182
|
+
stateMutability: "view",
|
|
7183
|
+
type: "function"
|
|
7184
|
+
},
|
|
7185
|
+
{
|
|
7186
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7187
|
+
name: "isPayable",
|
|
7188
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7189
|
+
stateMutability: "view",
|
|
7190
|
+
type: "function"
|
|
7191
|
+
},
|
|
7192
|
+
{
|
|
7193
|
+
inputs: [],
|
|
7194
|
+
name: "jobManager",
|
|
7195
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7196
|
+
stateMutability: "view",
|
|
7197
|
+
type: "function"
|
|
7198
|
+
},
|
|
7199
|
+
{
|
|
7200
|
+
inputs: [
|
|
7201
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7202
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7203
|
+
],
|
|
7204
|
+
name: "jobMemos",
|
|
7205
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7206
|
+
stateMutability: "view",
|
|
7207
|
+
type: "function"
|
|
7208
|
+
},
|
|
7209
|
+
{
|
|
7210
|
+
inputs: [
|
|
7211
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7212
|
+
{ internalType: "enum ACPTypes.JobPhase", name: "", type: "uint8" },
|
|
7213
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7214
|
+
],
|
|
7215
|
+
name: "jobMemosByPhase",
|
|
7216
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7217
|
+
stateMutability: "view",
|
|
7218
|
+
type: "function"
|
|
7219
|
+
},
|
|
7220
|
+
{
|
|
7221
|
+
inputs: [
|
|
7222
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7223
|
+
{ internalType: "enum ACPTypes.MemoType", name: "", type: "uint8" },
|
|
7224
|
+
{ internalType: "uint256", name: "", type: "uint256" }
|
|
7225
|
+
],
|
|
7226
|
+
name: "jobMemosByType",
|
|
7227
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7228
|
+
stateMutability: "view",
|
|
7229
|
+
type: "function"
|
|
7230
|
+
},
|
|
7231
|
+
{
|
|
7232
|
+
inputs: [
|
|
7233
|
+
{ internalType: "uint256", name: "", type: "uint256" },
|
|
7234
|
+
{ internalType: "address", name: "", type: "address" }
|
|
7235
|
+
],
|
|
7236
|
+
name: "memoApprovals",
|
|
7237
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7238
|
+
stateMutability: "view",
|
|
7239
|
+
type: "function"
|
|
7240
|
+
},
|
|
7241
|
+
{
|
|
7242
|
+
inputs: [],
|
|
7243
|
+
name: "memoCounter",
|
|
7244
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7245
|
+
stateMutability: "view",
|
|
7246
|
+
type: "function"
|
|
7247
|
+
},
|
|
7248
|
+
{
|
|
7249
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7250
|
+
name: "memos",
|
|
7251
|
+
outputs: [
|
|
7252
|
+
{ internalType: "uint256", name: "id", type: "uint256" },
|
|
7253
|
+
{ internalType: "uint256", name: "jobId", type: "uint256" },
|
|
7254
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7255
|
+
{ internalType: "string", name: "content", type: "string" },
|
|
7256
|
+
{
|
|
7257
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7258
|
+
name: "memoType",
|
|
7259
|
+
type: "uint8"
|
|
7260
|
+
},
|
|
7261
|
+
{ internalType: "uint256", name: "createdAt", type: "uint256" },
|
|
7262
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7263
|
+
{ internalType: "address", name: "approvedBy", type: "address" },
|
|
7264
|
+
{ internalType: "uint256", name: "approvedAt", type: "uint256" },
|
|
7265
|
+
{ internalType: "bool", name: "requiresApproval", type: "bool" },
|
|
7266
|
+
{ internalType: "string", name: "metadata", type: "string" },
|
|
7267
|
+
{ internalType: "bool", name: "isSecured", type: "bool" },
|
|
7268
|
+
{
|
|
7269
|
+
internalType: "enum ACPTypes.JobPhase",
|
|
7270
|
+
name: "nextPhase",
|
|
7271
|
+
type: "uint8"
|
|
7272
|
+
},
|
|
7273
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7274
|
+
{ internalType: "enum ACPTypes.MemoState", name: "state", type: "uint8" }
|
|
7275
|
+
],
|
|
7276
|
+
stateMutability: "view",
|
|
7277
|
+
type: "function"
|
|
7278
|
+
},
|
|
7279
|
+
{
|
|
7280
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7281
|
+
name: "payableDetails",
|
|
7282
|
+
outputs: [
|
|
7283
|
+
{ internalType: "address", name: "token", type: "address" },
|
|
7284
|
+
{ internalType: "uint256", name: "amount", type: "uint256" },
|
|
7285
|
+
{ internalType: "address", name: "recipient", type: "address" },
|
|
7286
|
+
{ internalType: "uint256", name: "feeAmount", type: "uint256" },
|
|
7287
|
+
{ internalType: "enum ACPTypes.FeeType", name: "feeType", type: "uint8" },
|
|
7288
|
+
{ internalType: "bool", name: "isExecuted", type: "bool" },
|
|
7289
|
+
{ internalType: "uint256", name: "expiredAt", type: "uint256" },
|
|
7290
|
+
{ internalType: "uint32", name: "lzSrcEid", type: "uint32" },
|
|
7291
|
+
{ internalType: "uint32", name: "lzDstEid", type: "uint32" }
|
|
7292
|
+
],
|
|
7293
|
+
stateMutability: "view",
|
|
7294
|
+
type: "function"
|
|
7295
|
+
},
|
|
7296
|
+
{
|
|
7297
|
+
inputs: [],
|
|
7298
|
+
name: "paymentManager",
|
|
7299
|
+
outputs: [{ internalType: "address", name: "", type: "address" }],
|
|
7300
|
+
stateMutability: "view",
|
|
7301
|
+
type: "function"
|
|
7302
|
+
},
|
|
7303
|
+
{
|
|
7304
|
+
inputs: [],
|
|
7305
|
+
name: "proxiableUUID",
|
|
7306
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
7307
|
+
stateMutability: "view",
|
|
7308
|
+
type: "function"
|
|
7309
|
+
},
|
|
7310
|
+
{
|
|
7311
|
+
inputs: [
|
|
7312
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7313
|
+
{ internalType: "address", name: "callerConfirmation", type: "address" }
|
|
7314
|
+
],
|
|
7315
|
+
name: "renounceRole",
|
|
7316
|
+
outputs: [],
|
|
7317
|
+
stateMutability: "nonpayable",
|
|
7318
|
+
type: "function"
|
|
7319
|
+
},
|
|
7320
|
+
{
|
|
7321
|
+
inputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7322
|
+
name: "requiredApprovals",
|
|
7323
|
+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
7324
|
+
stateMutability: "view",
|
|
7325
|
+
type: "function"
|
|
7326
|
+
},
|
|
7327
|
+
{
|
|
7328
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7329
|
+
name: "requiresApproval",
|
|
7330
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7331
|
+
stateMutability: "view",
|
|
7332
|
+
type: "function"
|
|
7333
|
+
},
|
|
7334
|
+
{
|
|
7335
|
+
inputs: [
|
|
7336
|
+
{ internalType: "bytes32", name: "role", type: "bytes32" },
|
|
7337
|
+
{ internalType: "address", name: "account", type: "address" }
|
|
7338
|
+
],
|
|
7339
|
+
name: "revokeRole",
|
|
7340
|
+
outputs: [],
|
|
7341
|
+
stateMutability: "nonpayable",
|
|
7342
|
+
type: "function"
|
|
7343
|
+
},
|
|
7344
|
+
{
|
|
7345
|
+
inputs: [
|
|
7346
|
+
{
|
|
7347
|
+
internalType: "enum ACPTypes.MemoType",
|
|
7348
|
+
name: "memoType",
|
|
7349
|
+
type: "uint8"
|
|
7350
|
+
},
|
|
7351
|
+
{ internalType: "uint256", name: "requiredApprovals_", type: "uint256" }
|
|
7352
|
+
],
|
|
7353
|
+
name: "setApprovalRequirements",
|
|
7354
|
+
outputs: [],
|
|
7355
|
+
stateMutability: "nonpayable",
|
|
7356
|
+
type: "function"
|
|
7357
|
+
},
|
|
7358
|
+
{
|
|
7359
|
+
inputs: [
|
|
7360
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7361
|
+
],
|
|
7362
|
+
name: "setAssetManager",
|
|
7363
|
+
outputs: [],
|
|
7364
|
+
stateMutability: "nonpayable",
|
|
7365
|
+
type: "function"
|
|
7366
|
+
},
|
|
7367
|
+
{
|
|
7368
|
+
inputs: [
|
|
7369
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7370
|
+
{ internalType: "address", name: "sender", type: "address" },
|
|
7371
|
+
{ internalType: "bool", name: "isApproved", type: "bool" },
|
|
7372
|
+
{ internalType: "string", name: "reason", type: "string" }
|
|
7373
|
+
],
|
|
7374
|
+
name: "signMemo",
|
|
7375
|
+
outputs: [{ internalType: "uint256", name: "jobId", type: "uint256" }],
|
|
7376
|
+
stateMutability: "nonpayable",
|
|
7377
|
+
type: "function"
|
|
7378
|
+
},
|
|
7379
|
+
{
|
|
7380
|
+
inputs: [{ internalType: "bytes4", name: "interfaceId", type: "bytes4" }],
|
|
7381
|
+
name: "supportsInterface",
|
|
7382
|
+
outputs: [{ internalType: "bool", name: "", type: "bool" }],
|
|
7383
|
+
stateMutability: "view",
|
|
7384
|
+
type: "function"
|
|
7385
|
+
},
|
|
7386
|
+
{
|
|
7387
|
+
inputs: [
|
|
7388
|
+
{ internalType: "address", name: "acpContract_", type: "address" },
|
|
7389
|
+
{ internalType: "address", name: "jobManager_", type: "address" },
|
|
7390
|
+
{ internalType: "address", name: "paymentManager_", type: "address" },
|
|
7391
|
+
{ internalType: "address", name: "assetManager_", type: "address" }
|
|
7392
|
+
],
|
|
7393
|
+
name: "updateContracts",
|
|
7394
|
+
outputs: [],
|
|
7395
|
+
stateMutability: "nonpayable",
|
|
7396
|
+
type: "function"
|
|
7397
|
+
},
|
|
7398
|
+
{
|
|
7399
|
+
inputs: [
|
|
7400
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7401
|
+
{ internalType: "string", name: "newContent", type: "string" }
|
|
7402
|
+
],
|
|
7403
|
+
name: "updateMemoContent",
|
|
7404
|
+
outputs: [],
|
|
7405
|
+
stateMutability: "nonpayable",
|
|
7406
|
+
type: "function"
|
|
7407
|
+
},
|
|
7408
|
+
{
|
|
7409
|
+
inputs: [
|
|
7410
|
+
{ internalType: "uint256", name: "memoId", type: "uint256" },
|
|
7411
|
+
{
|
|
7412
|
+
internalType: "enum ACPTypes.MemoState",
|
|
7413
|
+
name: "newMemoState",
|
|
7414
|
+
type: "uint8"
|
|
7415
|
+
}
|
|
7416
|
+
],
|
|
7417
|
+
name: "updateMemoState",
|
|
7418
|
+
outputs: [],
|
|
7419
|
+
stateMutability: "nonpayable",
|
|
7420
|
+
type: "function"
|
|
7421
|
+
},
|
|
7422
|
+
{
|
|
7423
|
+
inputs: [
|
|
7424
|
+
{ internalType: "address", name: "newImplementation", type: "address" },
|
|
7425
|
+
{ internalType: "bytes", name: "data", type: "bytes" }
|
|
7426
|
+
],
|
|
7427
|
+
name: "upgradeToAndCall",
|
|
7428
|
+
outputs: [],
|
|
7429
|
+
stateMutability: "payable",
|
|
7430
|
+
type: "function"
|
|
7431
|
+
},
|
|
7432
|
+
{
|
|
7433
|
+
inputs: [{ internalType: "uint256", name: "memoId", type: "uint256" }],
|
|
7434
|
+
name: "withdrawEscrowedFunds",
|
|
7435
|
+
outputs: [],
|
|
7436
|
+
stateMutability: "nonpayable",
|
|
7437
|
+
type: "function"
|
|
7438
|
+
}
|
|
7439
|
+
];
|
|
7440
|
+
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7441
|
+
|
|
7442
|
+
// src/contractClients/acpContractClientV2.ts
|
|
7443
|
+
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7444
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7445
|
+
super(agentWalletAddress, config);
|
|
7446
|
+
this.jobManagerAddress = jobManagerAddress;
|
|
7447
|
+
this.memoManagerAddress = memoManagerAddress;
|
|
7448
|
+
this.accountManagerAddress = accountManagerAddress;
|
|
7449
|
+
this.PRIORITY_FEE_MULTIPLIER = 2;
|
|
7450
|
+
this.MAX_FEE_PER_GAS = 2e7;
|
|
7451
|
+
this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
|
|
7452
|
+
this.GAS_FEE_MULTIPLIER = 0.5;
|
|
7453
|
+
this._sessionKeyClients = {};
|
|
7454
|
+
}
|
|
7455
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7456
|
+
const publicClients = {};
|
|
7457
|
+
for (const chain of config.chains) {
|
|
7458
|
+
publicClients[chain.chain.id] = createPublicClient4({
|
|
7459
|
+
chain: chain.chain,
|
|
7460
|
+
transport: http3(chain.rpcUrl)
|
|
7461
|
+
});
|
|
7462
|
+
}
|
|
7463
|
+
const publicClient = createPublicClient4({
|
|
7464
|
+
chain: config.chain,
|
|
7465
|
+
transport: http3(config.rpcEndpoint)
|
|
7466
|
+
});
|
|
7467
|
+
const [jobManagerAddress, memoManagerAddress, accountManagerAddress] = await publicClient.multicall({
|
|
7468
|
+
contracts: [
|
|
7469
|
+
{
|
|
7470
|
+
address: config.contractAddress,
|
|
7471
|
+
abi: config.abi,
|
|
7472
|
+
functionName: "jobManager"
|
|
7473
|
+
},
|
|
7474
|
+
{
|
|
7475
|
+
address: config.contractAddress,
|
|
7476
|
+
abi: config.abi,
|
|
7477
|
+
functionName: "memoManager"
|
|
7478
|
+
},
|
|
7479
|
+
{
|
|
7480
|
+
address: config.contractAddress,
|
|
7481
|
+
abi: config.abi,
|
|
7482
|
+
functionName: "accountManager"
|
|
7483
|
+
}
|
|
7484
|
+
]
|
|
7485
|
+
});
|
|
7486
|
+
if (!jobManagerAddress || !memoManagerAddress || !accountManagerAddress) {
|
|
7487
|
+
throw new acpError_default(
|
|
7488
|
+
"Failed to get job manager, memo manager, or account manager address"
|
|
7489
|
+
);
|
|
7490
|
+
}
|
|
7491
|
+
const acpContractClient = new _AcpContractClientV2(
|
|
7492
|
+
jobManagerAddress.result,
|
|
7493
|
+
memoManagerAddress.result,
|
|
7494
|
+
accountManagerAddress.result,
|
|
7495
|
+
agentWalletAddress,
|
|
7496
|
+
config
|
|
7497
|
+
);
|
|
7498
|
+
acpContractClient.publicClients = publicClients;
|
|
7499
|
+
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
7500
|
+
return acpContractClient;
|
|
7501
|
+
}
|
|
7502
|
+
async init(privateKey, sessionEntityKeyId) {
|
|
7503
|
+
const sessionKeySigner = LocalAccountSigner2.privateKeyToAccountSigner(privateKey);
|
|
7504
|
+
this._sessionKeyClient = await createModularAccountV2Client2({
|
|
7505
|
+
chain: this.chain,
|
|
7506
|
+
transport: alchemy2({
|
|
7507
|
+
rpcUrl: this.config.alchemyRpcUrl
|
|
7508
|
+
}),
|
|
7509
|
+
signer: sessionKeySigner,
|
|
7510
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7511
|
+
accountAddress: this.agentWalletAddress,
|
|
7512
|
+
signerEntity: {
|
|
7513
|
+
entityId: sessionEntityKeyId,
|
|
7514
|
+
isGlobalValidation: true
|
|
7515
|
+
}
|
|
7516
|
+
});
|
|
7517
|
+
for (const chain of this.config.chains) {
|
|
7518
|
+
this._sessionKeyClients[chain.chain.id] = await createModularAccountV2Client2({
|
|
7519
|
+
chain: chain.chain,
|
|
7520
|
+
transport: alchemy2({
|
|
7521
|
+
rpcUrl: `${this.config.alchemyRpcUrl}?chainId=${chain.chain.id}`
|
|
7522
|
+
}),
|
|
7523
|
+
signer: sessionKeySigner,
|
|
7524
|
+
policyId: "186aaa4a-5f57-4156-83fb-e456365a8820",
|
|
7525
|
+
accountAddress: this.agentWalletAddress,
|
|
7526
|
+
signerEntity: {
|
|
7527
|
+
entityId: sessionEntityKeyId,
|
|
7528
|
+
isGlobalValidation: true
|
|
7529
|
+
}
|
|
7530
|
+
});
|
|
7531
|
+
}
|
|
7532
|
+
this._acpX402 = new AcpX402(
|
|
7533
|
+
this.config,
|
|
7534
|
+
this.sessionKeyClient,
|
|
7535
|
+
this.publicClient
|
|
7536
|
+
);
|
|
7537
|
+
const account = this.sessionKeyClient.account;
|
|
7538
|
+
const sessionSignerAddress = await account.getSigner().getAddress();
|
|
7539
|
+
if (!await account.isAccountDeployed()) {
|
|
6094
7540
|
throw new acpError_default(
|
|
6095
7541
|
`ACP Contract Client validation failed: agent account ${this.agentWalletAddress} is not deployed on-chain`
|
|
6096
7542
|
);
|
|
6097
7543
|
}
|
|
6098
|
-
await this.validateSessionKeyOnChain(
|
|
7544
|
+
await this.validateSessionKeyOnChain(
|
|
7545
|
+
sessionSignerAddress,
|
|
7546
|
+
sessionEntityKeyId
|
|
7547
|
+
);
|
|
6099
7548
|
console.log("Connected to ACP:", {
|
|
6100
7549
|
agentWalletAddress: this.agentWalletAddress,
|
|
6101
7550
|
whitelistedWalletAddress: sessionSignerAddress,
|
|
@@ -6123,11 +7572,20 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6123
7572
|
}
|
|
6124
7573
|
return this._acpX402;
|
|
6125
7574
|
}
|
|
6126
|
-
async calculateGasFees() {
|
|
7575
|
+
async calculateGasFees(chainId) {
|
|
7576
|
+
if (chainId) {
|
|
7577
|
+
const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
|
|
7578
|
+
const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
|
|
7579
|
+
return increasedMaxFeePerGas;
|
|
7580
|
+
}
|
|
6127
7581
|
const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
|
|
6128
7582
|
return finalMaxFeePerGas;
|
|
6129
7583
|
}
|
|
6130
|
-
async handleOperation(operations) {
|
|
7584
|
+
async handleOperation(operations, chainId) {
|
|
7585
|
+
const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
|
|
7586
|
+
if (!sessionKeyClient) {
|
|
7587
|
+
throw new acpError_default("Session key client not initialized");
|
|
7588
|
+
}
|
|
6131
7589
|
const payload = {
|
|
6132
7590
|
uo: operations.map((operation) => ({
|
|
6133
7591
|
target: operation.contractAddress,
|
|
@@ -6148,16 +7606,21 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6148
7606
|
maxFeePerGas: `0x${gasFees.toString(16)}`
|
|
6149
7607
|
};
|
|
6150
7608
|
}
|
|
6151
|
-
const { hash } = await
|
|
6152
|
-
const
|
|
7609
|
+
const { hash } = await sessionKeyClient.sendUserOperation(payload);
|
|
7610
|
+
const checkTransactionConfig = {
|
|
6153
7611
|
hash,
|
|
6154
|
-
tag: "pending",
|
|
6155
7612
|
retries: {
|
|
6156
7613
|
intervalMs: 200,
|
|
6157
7614
|
multiplier: 1.1,
|
|
6158
7615
|
maxRetries: 10
|
|
6159
7616
|
}
|
|
6160
|
-
}
|
|
7617
|
+
};
|
|
7618
|
+
if (!chainId || chainId === baseSepolia4.id || chainId === base4.id) {
|
|
7619
|
+
checkTransactionConfig["tag"] = "pending";
|
|
7620
|
+
}
|
|
7621
|
+
const txnHash = await sessionKeyClient.waitForUserOperationTransaction(
|
|
7622
|
+
checkTransactionConfig
|
|
7623
|
+
);
|
|
6161
7624
|
return { userOpHash: hash, txnHash };
|
|
6162
7625
|
} catch (error) {
|
|
6163
7626
|
retries -= 1;
|
|
@@ -6220,6 +7683,13 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
6220
7683
|
throw new acpError_default("Failed to get X402 payment details", error);
|
|
6221
7684
|
}
|
|
6222
7685
|
}
|
|
7686
|
+
async getAssetManager() {
|
|
7687
|
+
return await this.publicClient.readContract({
|
|
7688
|
+
address: this.memoManagerAddress,
|
|
7689
|
+
abi: memoManagerAbi_default,
|
|
7690
|
+
functionName: "assetManager"
|
|
7691
|
+
});
|
|
7692
|
+
}
|
|
6223
7693
|
getAcpVersion() {
|
|
6224
7694
|
return "2";
|
|
6225
7695
|
}
|
|
@@ -6239,6 +7709,7 @@ export {
|
|
|
6239
7709
|
acpJob_default as AcpJob,
|
|
6240
7710
|
AcpJobPhases,
|
|
6241
7711
|
acpMemo_default as AcpMemo,
|
|
7712
|
+
AcpMemoState,
|
|
6242
7713
|
AcpMemoStatus,
|
|
6243
7714
|
AcpOnlineStatus,
|
|
6244
7715
|
baseAcpContractClient_default as BaseAcpContractClient,
|
|
@@ -6254,6 +7725,7 @@ export {
|
|
|
6254
7725
|
baseAcpX402ConfigV2,
|
|
6255
7726
|
baseSepoliaAcpConfig,
|
|
6256
7727
|
baseSepoliaAcpConfigV2,
|
|
7728
|
+
baseSepoliaAcpX402ConfigV2,
|
|
6257
7729
|
index_default as default,
|
|
6258
7730
|
ethFare,
|
|
6259
7731
|
preparePayload,
|