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