@virtuals-protocol/acp-node 0.3.0-beta.37 → 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 +19 -5
- package/dist/index.mjs +25 -6
- 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"
|
|
@@ -4107,6 +4108,15 @@ function getDestinationChainId(endpointId) {
|
|
|
4107
4108
|
}
|
|
4108
4109
|
throw new Error(`Unsupported endpoint ID: ${endpointId}`);
|
|
4109
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
|
+
}
|
|
4110
4120
|
|
|
4111
4121
|
// src/acpJobOffering.ts
|
|
4112
4122
|
var import_viem4 = require("viem");
|
|
@@ -7641,12 +7651,14 @@ var MEMO_MANAGER_ABI = [
|
|
|
7641
7651
|
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7642
7652
|
|
|
7643
7653
|
// src/contractClients/acpContractClientV2.ts
|
|
7654
|
+
var import_erc8021 = require("ox/erc8021");
|
|
7644
7655
|
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7645
|
-
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7656
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7646
7657
|
super(agentWalletAddress, config);
|
|
7647
7658
|
this.jobManagerAddress = jobManagerAddress;
|
|
7648
7659
|
this.memoManagerAddress = memoManagerAddress;
|
|
7649
7660
|
this.accountManagerAddress = accountManagerAddress;
|
|
7661
|
+
this.builderCode = builderCode;
|
|
7650
7662
|
this.RETRY_CONFIG = {
|
|
7651
7663
|
intervalMs: 200,
|
|
7652
7664
|
multiplier: 1.1,
|
|
@@ -7654,7 +7666,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7654
7666
|
};
|
|
7655
7667
|
this._sessionKeyClients = {};
|
|
7656
7668
|
}
|
|
7657
|
-
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7669
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7658
7670
|
const publicClients = {};
|
|
7659
7671
|
for (const chain of config.chains) {
|
|
7660
7672
|
publicClients[chain.id] = (0, import_viem9.createPublicClient)({
|
|
@@ -7695,7 +7707,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7695
7707
|
memoManagerAddress.result,
|
|
7696
7708
|
accountManagerAddress.result,
|
|
7697
7709
|
agentWalletAddress,
|
|
7698
|
-
config
|
|
7710
|
+
config,
|
|
7711
|
+
builderCode
|
|
7699
7712
|
);
|
|
7700
7713
|
acpContractClient.publicClients = publicClients;
|
|
7701
7714
|
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
@@ -7780,10 +7793,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7780
7793
|
if (!sessionKeyClient) {
|
|
7781
7794
|
throw new acpError_default("Session key client not initialized");
|
|
7782
7795
|
}
|
|
7796
|
+
const dataSuffix = this.builderCode ? import_erc8021.Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
|
|
7783
7797
|
const basePayload = {
|
|
7784
7798
|
uo: operations.map((operation) => ({
|
|
7785
7799
|
target: operation.contractAddress,
|
|
7786
|
-
data: operation.data,
|
|
7800
|
+
data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
|
|
7787
7801
|
value: operation.value
|
|
7788
7802
|
}))
|
|
7789
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"
|
|
@@ -4005,7 +4006,12 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
|
|
|
4005
4006
|
})(AcpOnlineStatus || {});
|
|
4006
4007
|
|
|
4007
4008
|
// src/utils.ts
|
|
4008
|
-
import {
|
|
4009
|
+
import {
|
|
4010
|
+
concatHex,
|
|
4011
|
+
decodeAbiParameters,
|
|
4012
|
+
encodeAbiParameters,
|
|
4013
|
+
pad
|
|
4014
|
+
} from "viem";
|
|
4009
4015
|
import {
|
|
4010
4016
|
arbitrum as arbitrum3,
|
|
4011
4017
|
arbitrumSepolia as arbitrumSepolia3,
|
|
@@ -4084,6 +4090,15 @@ function getDestinationChainId(endpointId) {
|
|
|
4084
4090
|
}
|
|
4085
4091
|
throw new Error(`Unsupported endpoint ID: ${endpointId}`);
|
|
4086
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
|
+
}
|
|
4087
4102
|
|
|
4088
4103
|
// src/acpJobOffering.ts
|
|
4089
4104
|
import { zeroAddress as zeroAddress2 } from "viem";
|
|
@@ -7631,12 +7646,14 @@ var MEMO_MANAGER_ABI = [
|
|
|
7631
7646
|
var memoManagerAbi_default = MEMO_MANAGER_ABI;
|
|
7632
7647
|
|
|
7633
7648
|
// src/contractClients/acpContractClientV2.ts
|
|
7649
|
+
import { Attribution } from "ox/erc8021";
|
|
7634
7650
|
var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
|
|
7635
|
-
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7651
|
+
constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7636
7652
|
super(agentWalletAddress, config);
|
|
7637
7653
|
this.jobManagerAddress = jobManagerAddress;
|
|
7638
7654
|
this.memoManagerAddress = memoManagerAddress;
|
|
7639
7655
|
this.accountManagerAddress = accountManagerAddress;
|
|
7656
|
+
this.builderCode = builderCode;
|
|
7640
7657
|
this.RETRY_CONFIG = {
|
|
7641
7658
|
intervalMs: 200,
|
|
7642
7659
|
multiplier: 1.1,
|
|
@@ -7644,7 +7661,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7644
7661
|
};
|
|
7645
7662
|
this._sessionKeyClients = {};
|
|
7646
7663
|
}
|
|
7647
|
-
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
|
|
7664
|
+
static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
|
|
7648
7665
|
const publicClients = {};
|
|
7649
7666
|
for (const chain of config.chains) {
|
|
7650
7667
|
publicClients[chain.id] = createPublicClient4({
|
|
@@ -7685,7 +7702,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7685
7702
|
memoManagerAddress.result,
|
|
7686
7703
|
accountManagerAddress.result,
|
|
7687
7704
|
agentWalletAddress,
|
|
7688
|
-
config
|
|
7705
|
+
config,
|
|
7706
|
+
builderCode
|
|
7689
7707
|
);
|
|
7690
7708
|
acpContractClient.publicClients = publicClients;
|
|
7691
7709
|
await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
|
|
@@ -7770,10 +7788,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
|
|
|
7770
7788
|
if (!sessionKeyClient) {
|
|
7771
7789
|
throw new acpError_default("Session key client not initialized");
|
|
7772
7790
|
}
|
|
7791
|
+
const dataSuffix = this.builderCode ? Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
|
|
7773
7792
|
const basePayload = {
|
|
7774
7793
|
uo: operations.map((operation) => ({
|
|
7775
7794
|
target: operation.contractAddress,
|
|
7776
|
-
data: operation.data,
|
|
7795
|
+
data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
|
|
7777
7796
|
value: operation.value
|
|
7778
7797
|
}))
|
|
7779
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"
|