@virtuals-protocol/acp-node 0.3.0-beta.36 → 0.3.0-beta.38
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 +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +28 -20
- package/dist/index.mjs +34 -21
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -8962,12 +8962,13 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
8962
8962
|
private jobManagerAddress;
|
|
8963
8963
|
private memoManagerAddress;
|
|
8964
8964
|
private accountManagerAddress;
|
|
8965
|
+
private builderCode?;
|
|
8965
8966
|
private RETRY_CONFIG;
|
|
8966
8967
|
private _sessionKeyClient;
|
|
8967
8968
|
private _sessionKeyClients;
|
|
8968
8969
|
private _acpX402;
|
|
8969
|
-
constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig);
|
|
8970
|
-
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClientV2>;
|
|
8970
|
+
constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string | undefined);
|
|
8971
|
+
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string): Promise<AcpContractClientV2>;
|
|
8971
8972
|
init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
|
|
8972
8973
|
getRandomNonce(bits?: number): bigint;
|
|
8973
8974
|
private get sessionKeyClient();
|
package/dist/index.d.ts
CHANGED
|
@@ -8962,12 +8962,13 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
|
|
|
8962
8962
|
private jobManagerAddress;
|
|
8963
8963
|
private memoManagerAddress;
|
|
8964
8964
|
private accountManagerAddress;
|
|
8965
|
+
private builderCode?;
|
|
8965
8966
|
private RETRY_CONFIG;
|
|
8966
8967
|
private _sessionKeyClient;
|
|
8967
8968
|
private _sessionKeyClients;
|
|
8968
8969
|
private _acpX402;
|
|
8969
|
-
constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig);
|
|
8970
|
-
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClientV2>;
|
|
8970
|
+
constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string | undefined);
|
|
8971
|
+
static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string): Promise<AcpContractClientV2>;
|
|
8971
8972
|
init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
|
|
8972
8973
|
getRandomNonce(bits?: number): bigint;
|
|
8973
8974
|
private get sessionKeyClient();
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var require_package = __commonJS({
|
|
|
35
35
|
"package.json"(exports2, module2) {
|
|
36
36
|
module2.exports = {
|
|
37
37
|
name: "@virtuals-protocol/acp-node",
|
|
38
|
-
version: "0.3.0-beta.
|
|
38
|
+
version: "0.3.0-beta.38",
|
|
39
39
|
main: "./dist/index.js",
|
|
40
40
|
module: "./dist/index.mjs",
|
|
41
41
|
types: "./dist/index.d.ts",
|
|
@@ -70,6 +70,7 @@ var require_package = __commonJS({
|
|
|
70
70
|
ajv: "^8.17.1",
|
|
71
71
|
axios: "^1.13.2",
|
|
72
72
|
"jwt-decode": "^4.0.0",
|
|
73
|
+
ox: "^0.13.1",
|
|
73
74
|
"socket.io-client": "^4.8.1",
|
|
74
75
|
tsup: "^8.5.0",
|
|
75
76
|
viem: "^2.28.2"
|
|
@@ -2351,13 +2352,7 @@ var TESTNET_CHAINS = [
|
|
|
2351
2352
|
import_infra.arbitrumSepolia,
|
|
2352
2353
|
import_infra.bscTestnet
|
|
2353
2354
|
];
|
|
2354
|
-
var MAINNET_CHAINS = [
|
|
2355
|
-
import_infra.base,
|
|
2356
|
-
import_infra.mainnet,
|
|
2357
|
-
import_infra.polygon,
|
|
2358
|
-
import_infra.arbitrum,
|
|
2359
|
-
import_infra.bsc
|
|
2360
|
-
];
|
|
2355
|
+
var MAINNET_CHAINS = [import_infra.base, import_infra.mainnet, import_infra.polygon, import_infra.arbitrum, import_infra.bsc];
|
|
2361
2356
|
var DEFAULT_RETRY_CONFIG = {
|
|
2362
2357
|
intervalMs: 200,
|
|
2363
2358
|
multiplier: 1.1,
|
|
@@ -2381,7 +2376,7 @@ var AcpContractConfig2 = class {
|
|
|
2381
2376
|
var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
2382
2377
|
import_infra.baseSepolia,
|
|
2383
2378
|
"0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
2384
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2379
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, import_infra.baseSepolia.id),
|
|
2385
2380
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2386
2381
|
"https://acpx.virtuals.gg",
|
|
2387
2382
|
acpAbi_default,
|
|
@@ -2394,7 +2389,7 @@ var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
|
2394
2389
|
var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
2395
2390
|
import_infra.baseSepolia,
|
|
2396
2391
|
"0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
2397
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2392
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, import_infra.baseSepolia.id),
|
|
2398
2393
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2399
2394
|
"https://acpx.virtuals.gg",
|
|
2400
2395
|
acpAbi_default,
|
|
@@ -2409,7 +2404,7 @@ var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
|
2409
2404
|
var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
2410
2405
|
import_infra.baseSepolia,
|
|
2411
2406
|
"0xdf54E6Ed6cD1d0632d973ADECf96597b7e87893c",
|
|
2412
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2407
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, import_infra.baseSepolia.id),
|
|
2413
2408
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2414
2409
|
"https://acpx.virtuals.gg",
|
|
2415
2410
|
acpAbiV2_default,
|
|
@@ -2422,7 +2417,7 @@ var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
|
2422
2417
|
var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2423
2418
|
import_infra.baseSepolia,
|
|
2424
2419
|
"0xdf54E6Ed6cD1d0632d973ADECf96597b7e87893c",
|
|
2425
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2420
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, import_infra.baseSepolia.id),
|
|
2426
2421
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2427
2422
|
"https://acpx.virtuals.gg",
|
|
2428
2423
|
acpAbiV2_default,
|
|
@@ -2437,7 +2432,7 @@ var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
|
2437
2432
|
var baseAcpConfig = new AcpContractConfig2(
|
|
2438
2433
|
import_infra.base,
|
|
2439
2434
|
"0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
2440
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2435
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, import_infra.base.id),
|
|
2441
2436
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2442
2437
|
"https://acpx.virtuals.io",
|
|
2443
2438
|
acpAbi_default,
|
|
@@ -2450,7 +2445,7 @@ var baseAcpConfig = new AcpContractConfig2(
|
|
|
2450
2445
|
var baseAcpX402Config = new AcpContractConfig2(
|
|
2451
2446
|
import_infra.base,
|
|
2452
2447
|
"0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
2453
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2448
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, import_infra.base.id),
|
|
2454
2449
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2455
2450
|
"https://acpx.virtuals.io",
|
|
2456
2451
|
acpAbi_default,
|
|
@@ -2465,7 +2460,7 @@ var baseAcpX402Config = new AcpContractConfig2(
|
|
|
2465
2460
|
var baseAcpConfigV2 = new AcpContractConfig2(
|
|
2466
2461
|
import_infra.base,
|
|
2467
2462
|
"0xa6C9BA866992cfD7fd6460ba912bfa405adA9df0",
|
|
2468
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2463
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, import_infra.base.id),
|
|
2469
2464
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2470
2465
|
"https://acpx.virtuals.io",
|
|
2471
2466
|
acpAbiV2_default,
|
|
@@ -2478,7 +2473,7 @@ var baseAcpConfigV2 = new AcpContractConfig2(
|
|
|
2478
2473
|
var baseAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2479
2474
|
import_infra.base,
|
|
2480
2475
|
"0xa6C9BA866992cfD7fd6460ba912bfa405adA9df0",
|
|
2481
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2476
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, import_infra.base.id),
|
|
2482
2477
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2483
2478
|
"https://acpx.virtuals.io",
|
|
2484
2479
|
acpAbiV2_default,
|
|
@@ -4113,6 +4108,15 @@ function getDestinationChainId(endpointId) {
|
|
|
4113
4108
|
}
|
|
4114
4109
|
throw new Error(`Unsupported endpoint ID: ${endpointId}`);
|
|
4115
4110
|
}
|
|
4111
|
+
function appendBuilderCodeData(data, suffix) {
|
|
4112
|
+
const opDataByteLength = (data.length - 2) / 2;
|
|
4113
|
+
const suffixByteLength = (suffix.length - 2) / 2;
|
|
4114
|
+
const opDataPaddedSize = Math.ceil(opDataByteLength / 32) * 32;
|
|
4115
|
+
const suffixPaddedSize = Math.ceil(suffixByteLength / 32) * 32;
|
|
4116
|
+
const paddedData = (0, import_viem3.pad)(data, { size: opDataPaddedSize, dir: "right" });
|
|
4117
|
+
const paddedSuffix = (0, import_viem3.pad)(suffix, { size: suffixPaddedSize });
|
|
4118
|
+
return (0, import_viem3.concatHex)([paddedData, paddedSuffix]);
|
|
4119
|
+
}
|
|
4116
4120
|
|
|
4117
4121
|
// src/acpJobOffering.ts
|
|
4118
4122
|
var import_viem4 = require("viem");
|
|
@@ -7647,12 +7651,14 @@ var MEMO_MANAGER_ABI = [
|
|
|
7647
7651
|
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7648
7652
|
|
|
7649
7653
|
// src/contractClients/acpContractClientV2.ts
|
|
7654
|
+
var import_erc8021 = require("ox/erc8021");
|
|
7650
7655
|
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7651
|
-
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7656
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7652
7657
|
super(agentWalletAddress, config);
|
|
7653
7658
|
this.jobManagerAddress = jobManagerAddress;
|
|
7654
7659
|
this.memoManagerAddress = memoManagerAddress;
|
|
7655
7660
|
this.accountManagerAddress = accountManagerAddress;
|
|
7661
|
+
this.builderCode = builderCode;
|
|
7656
7662
|
this.RETRY_CONFIG = {
|
|
7657
7663
|
intervalMs: 200,
|
|
7658
7664
|
multiplier: 1.1,
|
|
@@ -7660,7 +7666,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7660
7666
|
};
|
|
7661
7667
|
this._sessionKeyClients = {};
|
|
7662
7668
|
}
|
|
7663
|
-
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7669
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7664
7670
|
const publicClients = {};
|
|
7665
7671
|
for (const chain of config.chains) {
|
|
7666
7672
|
publicClients[chain.id] = (0, import_viem9.createPublicClient)({
|
|
@@ -7701,7 +7707,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7701
7707
|
memoManagerAddress.result,
|
|
7702
7708
|
accountManagerAddress.result,
|
|
7703
7709
|
agentWalletAddress,
|
|
7704
|
-
config
|
|
7710
|
+
config,
|
|
7711
|
+
builderCode
|
|
7705
7712
|
);
|
|
7706
7713
|
acpContractClient.publicClients = publicClients;
|
|
7707
7714
|
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
@@ -7786,10 +7793,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7786
7793
|
if (!sessionKeyClient) {
|
|
7787
7794
|
throw new acpError_default("Session key client not initialized");
|
|
7788
7795
|
}
|
|
7796
|
+
const dataSuffix = this.builderCode ? import_erc8021.Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
|
|
7789
7797
|
const basePayload = {
|
|
7790
7798
|
uo: operations.map((operation) => ({
|
|
7791
7799
|
target: operation.contractAddress,
|
|
7792
|
-
data: operation.data,
|
|
7800
|
+
data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
|
|
7793
7801
|
value: operation.value
|
|
7794
7802
|
}))
|
|
7795
7803
|
};
|
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.38",
|
|
12
12
|
main: "./dist/index.js",
|
|
13
13
|
module: "./dist/index.mjs",
|
|
14
14
|
types: "./dist/index.d.ts",
|
|
@@ -43,6 +43,7 @@ var require_package = __commonJS({
|
|
|
43
43
|
ajv: "^8.17.1",
|
|
44
44
|
axios: "^1.13.2",
|
|
45
45
|
"jwt-decode": "^4.0.0",
|
|
46
|
+
ox: "^0.13.1",
|
|
46
47
|
"socket.io-client": "^4.8.1",
|
|
47
48
|
tsup: "^8.5.0",
|
|
48
49
|
viem: "^2.28.2"
|
|
@@ -2314,13 +2315,7 @@ var TESTNET_CHAINS = [
|
|
|
2314
2315
|
arbitrumSepolia,
|
|
2315
2316
|
bscTestnet
|
|
2316
2317
|
];
|
|
2317
|
-
var MAINNET_CHAINS = [
|
|
2318
|
-
base,
|
|
2319
|
-
mainnet,
|
|
2320
|
-
polygon,
|
|
2321
|
-
arbitrum,
|
|
2322
|
-
bsc
|
|
2323
|
-
];
|
|
2318
|
+
var MAINNET_CHAINS = [base, mainnet, polygon, arbitrum, bsc];
|
|
2324
2319
|
var DEFAULT_RETRY_CONFIG = {
|
|
2325
2320
|
intervalMs: 200,
|
|
2326
2321
|
multiplier: 1.1,
|
|
@@ -2344,7 +2339,7 @@ var AcpContractConfig2 = class {
|
|
|
2344
2339
|
var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
2345
2340
|
baseSepolia,
|
|
2346
2341
|
"0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
2347
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2342
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, baseSepolia.id),
|
|
2348
2343
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2349
2344
|
"https://acpx.virtuals.gg",
|
|
2350
2345
|
acpAbi_default,
|
|
@@ -2357,7 +2352,7 @@ var baseSepoliaAcpConfig = new AcpContractConfig2(
|
|
|
2357
2352
|
var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
2358
2353
|
baseSepolia,
|
|
2359
2354
|
"0x8Db6B1c839Fc8f6bd35777E194677B67b4D51928",
|
|
2360
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2355
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, baseSepolia.id),
|
|
2361
2356
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2362
2357
|
"https://acpx.virtuals.gg",
|
|
2363
2358
|
acpAbi_default,
|
|
@@ -2372,7 +2367,7 @@ var baseSepoliaAcpX402Config = new AcpContractConfig2(
|
|
|
2372
2367
|
var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
2373
2368
|
baseSepolia,
|
|
2374
2369
|
"0xdf54E6Ed6cD1d0632d973ADECf96597b7e87893c",
|
|
2375
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2370
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, baseSepolia.id),
|
|
2376
2371
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2377
2372
|
"https://acpx.virtuals.gg",
|
|
2378
2373
|
acpAbiV2_default,
|
|
@@ -2385,7 +2380,7 @@ var baseSepoliaAcpConfigV2 = new AcpContractConfig2(
|
|
|
2385
2380
|
var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2386
2381
|
baseSepolia,
|
|
2387
2382
|
"0xdf54E6Ed6cD1d0632d973ADECf96597b7e87893c",
|
|
2388
|
-
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6),
|
|
2383
|
+
new Fare("0x036CbD53842c5426634e7929541eC2318f3dCF7e", 6, baseSepolia.id),
|
|
2389
2384
|
"https://alchemy-proxy.virtuals.io/api/proxy/rpc",
|
|
2390
2385
|
"https://acpx.virtuals.gg",
|
|
2391
2386
|
acpAbiV2_default,
|
|
@@ -2400,7 +2395,7 @@ var baseSepoliaAcpX402ConfigV2 = new AcpContractConfig2(
|
|
|
2400
2395
|
var baseAcpConfig = new AcpContractConfig2(
|
|
2401
2396
|
base,
|
|
2402
2397
|
"0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
2403
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2398
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, base.id),
|
|
2404
2399
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2405
2400
|
"https://acpx.virtuals.io",
|
|
2406
2401
|
acpAbi_default,
|
|
@@ -2413,7 +2408,7 @@ var baseAcpConfig = new AcpContractConfig2(
|
|
|
2413
2408
|
var baseAcpX402Config = new AcpContractConfig2(
|
|
2414
2409
|
base,
|
|
2415
2410
|
"0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
|
|
2416
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2411
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, base.id),
|
|
2417
2412
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2418
2413
|
"https://acpx.virtuals.io",
|
|
2419
2414
|
acpAbi_default,
|
|
@@ -2428,7 +2423,7 @@ var baseAcpX402Config = new AcpContractConfig2(
|
|
|
2428
2423
|
var baseAcpConfigV2 = new AcpContractConfig2(
|
|
2429
2424
|
base,
|
|
2430
2425
|
"0xa6C9BA866992cfD7fd6460ba912bfa405adA9df0",
|
|
2431
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2426
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, base.id),
|
|
2432
2427
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2433
2428
|
"https://acpx.virtuals.io",
|
|
2434
2429
|
acpAbiV2_default,
|
|
@@ -2441,7 +2436,7 @@ var baseAcpConfigV2 = new AcpContractConfig2(
|
|
|
2441
2436
|
var baseAcpX402ConfigV2 = new AcpContractConfig2(
|
|
2442
2437
|
base,
|
|
2443
2438
|
"0xa6C9BA866992cfD7fd6460ba912bfa405adA9df0",
|
|
2444
|
-
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6),
|
|
2439
|
+
new Fare("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", 6, base.id),
|
|
2445
2440
|
"https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
|
|
2446
2441
|
"https://acpx.virtuals.io",
|
|
2447
2442
|
acpAbiV2_default,
|
|
@@ -4011,7 +4006,12 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
|
4011
4006
|
})(AcpOnlineStatus || {});
|
|
4012
4007
|
|
|
4013
4008
|
// src/utils.ts
|
|
4014
|
-
import {
|
|
4009
|
+
import {
|
|
4010
|
+
concatHex,
|
|
4011
|
+
decodeAbiParameters,
|
|
4012
|
+
encodeAbiParameters,
|
|
4013
|
+
pad
|
|
4014
|
+
} from "viem";
|
|
4015
4015
|
import {
|
|
4016
4016
|
arbitrum as arbitrum3,
|
|
4017
4017
|
arbitrumSepolia as arbitrumSepolia3,
|
|
@@ -4090,6 +4090,15 @@ function getDestinationChainId(endpointId) {
|
|
|
4090
4090
|
}
|
|
4091
4091
|
throw new Error(`Unsupported endpoint ID: ${endpointId}`);
|
|
4092
4092
|
}
|
|
4093
|
+
function appendBuilderCodeData(data, suffix) {
|
|
4094
|
+
const opDataByteLength = (data.length - 2) / 2;
|
|
4095
|
+
const suffixByteLength = (suffix.length - 2) / 2;
|
|
4096
|
+
const opDataPaddedSize = Math.ceil(opDataByteLength / 32) * 32;
|
|
4097
|
+
const suffixPaddedSize = Math.ceil(suffixByteLength / 32) * 32;
|
|
4098
|
+
const paddedData = pad(data, { size: opDataPaddedSize, dir: "right" });
|
|
4099
|
+
const paddedSuffix = pad(suffix, { size: suffixPaddedSize });
|
|
4100
|
+
return concatHex([paddedData, paddedSuffix]);
|
|
4101
|
+
}
|
|
4093
4102
|
|
|
4094
4103
|
// src/acpJobOffering.ts
|
|
4095
4104
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
@@ -7637,12 +7646,14 @@ var MEMO_MANAGER_ABI = [
|
|
|
7637
7646
|
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7638
7647
|
|
|
7639
7648
|
// src/contractClients/acpContractClientV2.ts
|
|
7649
|
+
import { Attribution } from "ox/erc8021";
|
|
7640
7650
|
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7641
|
-
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7651
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7642
7652
|
super(agentWalletAddress, config);
|
|
7643
7653
|
this.jobManagerAddress = jobManagerAddress;
|
|
7644
7654
|
this.memoManagerAddress = memoManagerAddress;
|
|
7645
7655
|
this.accountManagerAddress = accountManagerAddress;
|
|
7656
|
+
this.builderCode = builderCode;
|
|
7646
7657
|
this.RETRY_CONFIG = {
|
|
7647
7658
|
intervalMs: 200,
|
|
7648
7659
|
multiplier: 1.1,
|
|
@@ -7650,7 +7661,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7650
7661
|
};
|
|
7651
7662
|
this._sessionKeyClients = {};
|
|
7652
7663
|
}
|
|
7653
|
-
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7664
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7654
7665
|
const publicClients = {};
|
|
7655
7666
|
for (const chain of config.chains) {
|
|
7656
7667
|
publicClients[chain.id] = createPublicClient4({
|
|
@@ -7691,7 +7702,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7691
7702
|
memoManagerAddress.result,
|
|
7692
7703
|
accountManagerAddress.result,
|
|
7693
7704
|
agentWalletAddress,
|
|
7694
|
-
config
|
|
7705
|
+
config,
|
|
7706
|
+
builderCode
|
|
7695
7707
|
);
|
|
7696
7708
|
acpContractClient.publicClients = publicClients;
|
|
7697
7709
|
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
@@ -7776,10 +7788,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7776
7788
|
if (!sessionKeyClient) {
|
|
7777
7789
|
throw new acpError_default("Session key client not initialized");
|
|
7778
7790
|
}
|
|
7791
|
+
const dataSuffix = this.builderCode ? Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
|
|
7779
7792
|
const basePayload = {
|
|
7780
7793
|
uo: operations.map((operation) => ({
|
|
7781
7794
|
target: operation.contractAddress,
|
|
7782
|
-
data: operation.data,
|
|
7795
|
+
data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
|
|
7783
7796
|
value: operation.value
|
|
7784
7797
|
}))
|
|
7785
7798
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@virtuals-protocol/acp-node",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.38",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"ajv": "^8.17.1",
|
|
36
36
|
"axios": "^1.13.2",
|
|
37
37
|
"jwt-decode": "^4.0.0",
|
|
38
|
+
"ox": "^0.13.1",
|
|
38
39
|
"socket.io-client": "^4.8.1",
|
|
39
40
|
"tsup": "^8.5.0",
|
|
40
41
|
"viem": "^2.28.2"
|