@virtuals-protocol/acp-node 0.3.0-beta-subscription.1 → 0.3.0-beta-subscription.2

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 CHANGED
@@ -9060,12 +9060,13 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
9060
9060
  private jobManagerAddress;
9061
9061
  private memoManagerAddress;
9062
9062
  private accountManagerAddress;
9063
+ private builderCode?;
9063
9064
  private RETRY_CONFIG;
9064
9065
  private _sessionKeyClient;
9065
9066
  private _sessionKeyClients;
9066
9067
  private _acpX402;
9067
- constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig);
9068
- static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClientV2>;
9068
+ constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string | undefined);
9069
+ static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string): Promise<AcpContractClientV2>;
9069
9070
  init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
9070
9071
  getRandomNonce(bits?: number): bigint;
9071
9072
  private get sessionKeyClient();
package/dist/index.d.ts CHANGED
@@ -9060,12 +9060,13 @@ declare class AcpContractClientV2 extends BaseAcpContractClient {
9060
9060
  private jobManagerAddress;
9061
9061
  private memoManagerAddress;
9062
9062
  private accountManagerAddress;
9063
+ private builderCode?;
9063
9064
  private RETRY_CONFIG;
9064
9065
  private _sessionKeyClient;
9065
9066
  private _sessionKeyClients;
9066
9067
  private _acpX402;
9067
- constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig);
9068
- static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig): Promise<AcpContractClientV2>;
9068
+ constructor(jobManagerAddress: Address$1, memoManagerAddress: Address$1, accountManagerAddress: Address$1, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string | undefined);
9069
+ static build(walletPrivateKey: Address$1, sessionEntityKeyId: number, agentWalletAddress: Address$1, config?: AcpContractConfig, builderCode?: string): Promise<AcpContractClientV2>;
9069
9070
  init(privateKey: Address$1, sessionEntityKeyId: number): Promise<void>;
9070
9071
  getRandomNonce(bits?: number): bigint;
9071
9072
  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-subscription.1",
38
+ version: "0.3.0-beta-subscription.2",
39
39
  main: "./dist/index.js",
40
40
  module: "./dist/index.mjs",
41
41
  types: "./dist/index.d.ts",
@@ -71,6 +71,7 @@ var require_package = __commonJS({
71
71
  axios: "^1.13.2",
72
72
  "jwt-decode": "^4.0.0",
73
73
  dotenv: "^17.2.3",
74
+ ox: "^0.13.1",
74
75
  "socket.io-client": "^4.8.1",
75
76
  tsup: "^8.5.0",
76
77
  viem: "^2.28.2"
@@ -4166,6 +4167,15 @@ function getDestinationChainId(endpointId) {
4166
4167
  }
4167
4168
  throw new Error(`Unsupported endpoint ID: ${endpointId}`);
4168
4169
  }
4170
+ function appendBuilderCodeData(data, suffix) {
4171
+ const opDataByteLength = (data.length - 2) / 2;
4172
+ const suffixByteLength = (suffix.length - 2) / 2;
4173
+ const opDataPaddedSize = Math.ceil(opDataByteLength / 32) * 32;
4174
+ const suffixPaddedSize = Math.ceil(suffixByteLength / 32) * 32;
4175
+ const paddedData = (0, import_viem3.pad)(data, { size: opDataPaddedSize, dir: "right" });
4176
+ const paddedSuffix = (0, import_viem3.pad)(suffix, { size: suffixPaddedSize });
4177
+ return (0, import_viem3.concatHex)([paddedData, paddedSuffix]);
4178
+ }
4169
4179
 
4170
4180
  // src/acpJobOffering.ts
4171
4181
  var import_viem4 = require("viem");
@@ -8083,12 +8093,14 @@ var MEMO_MANAGER_ABI = [
8083
8093
  var memoManagerAbi_default = MEMO_MANAGER_ABI;
8084
8094
 
8085
8095
  // src/contractClients/acpContractClientV2.ts
8096
+ var import_erc8021 = require("ox/erc8021");
8086
8097
  var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
8087
- constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
8098
+ constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
8088
8099
  super(agentWalletAddress, config);
8089
8100
  this.jobManagerAddress = jobManagerAddress;
8090
8101
  this.memoManagerAddress = memoManagerAddress;
8091
8102
  this.accountManagerAddress = accountManagerAddress;
8103
+ this.builderCode = builderCode;
8092
8104
  this.RETRY_CONFIG = {
8093
8105
  intervalMs: 200,
8094
8106
  multiplier: 1.1,
@@ -8096,7 +8108,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8096
8108
  };
8097
8109
  this._sessionKeyClients = {};
8098
8110
  }
8099
- static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
8111
+ static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
8100
8112
  const publicClients = {};
8101
8113
  for (const chain of config.chains) {
8102
8114
  publicClients[chain.id] = (0, import_viem9.createPublicClient)({
@@ -8137,7 +8149,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8137
8149
  memoManagerAddress.result,
8138
8150
  accountManagerAddress.result,
8139
8151
  agentWalletAddress,
8140
- config
8152
+ config,
8153
+ builderCode
8141
8154
  );
8142
8155
  acpContractClient.publicClients = publicClients;
8143
8156
  await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
@@ -8222,10 +8235,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8222
8235
  if (!sessionKeyClient) {
8223
8236
  throw new acpError_default("Session key client not initialized");
8224
8237
  }
8238
+ const dataSuffix = this.builderCode ? import_erc8021.Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
8225
8239
  const basePayload = {
8226
8240
  uo: operations.map((operation) => ({
8227
8241
  target: operation.contractAddress,
8228
- data: operation.data,
8242
+ data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
8229
8243
  value: operation.value
8230
8244
  }))
8231
8245
  };
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-subscription.1",
11
+ version: "0.3.0-beta-subscription.2",
12
12
  main: "./dist/index.js",
13
13
  module: "./dist/index.mjs",
14
14
  types: "./dist/index.d.ts",
@@ -44,6 +44,7 @@ var require_package = __commonJS({
44
44
  axios: "^1.13.2",
45
45
  "jwt-decode": "^4.0.0",
46
46
  dotenv: "^17.2.3",
47
+ ox: "^0.13.1",
47
48
  "socket.io-client": "^4.8.1",
48
49
  tsup: "^8.5.0",
49
50
  viem: "^2.28.2"
@@ -4062,7 +4063,12 @@ var AcpOnlineStatus = /* @__PURE__ */ ((AcpOnlineStatus2) => {
4062
4063
  })(AcpOnlineStatus || {});
4063
4064
 
4064
4065
  // src/utils.ts
4065
- import { decodeAbiParameters, encodeAbiParameters } from "viem";
4066
+ import {
4067
+ concatHex,
4068
+ decodeAbiParameters,
4069
+ encodeAbiParameters,
4070
+ pad
4071
+ } from "viem";
4066
4072
  import {
4067
4073
  arbitrum as arbitrum3,
4068
4074
  arbitrumSepolia as arbitrumSepolia3,
@@ -4141,6 +4147,15 @@ function getDestinationChainId(endpointId) {
4141
4147
  }
4142
4148
  throw new Error(`Unsupported endpoint ID: ${endpointId}`);
4143
4149
  }
4150
+ function appendBuilderCodeData(data, suffix) {
4151
+ const opDataByteLength = (data.length - 2) / 2;
4152
+ const suffixByteLength = (suffix.length - 2) / 2;
4153
+ const opDataPaddedSize = Math.ceil(opDataByteLength / 32) * 32;
4154
+ const suffixPaddedSize = Math.ceil(suffixByteLength / 32) * 32;
4155
+ const paddedData = pad(data, { size: opDataPaddedSize, dir: "right" });
4156
+ const paddedSuffix = pad(suffix, { size: suffixPaddedSize });
4157
+ return concatHex([paddedData, paddedSuffix]);
4158
+ }
4144
4159
 
4145
4160
  // src/acpJobOffering.ts
4146
4161
  import { zeroAddress as zeroAddress2 } from "viem";
@@ -8071,12 +8086,14 @@ var MEMO_MANAGER_ABI = [
8071
8086
  var memoManagerAbi_default = MEMO_MANAGER_ABI;
8072
8087
 
8073
8088
  // src/contractClients/acpContractClientV2.ts
8089
+ import { Attribution } from "ox/erc8021";
8074
8090
  var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClient_default {
8075
- constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2) {
8091
+ constructor(jobManagerAddress, memoManagerAddress, accountManagerAddress, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
8076
8092
  super(agentWalletAddress, config);
8077
8093
  this.jobManagerAddress = jobManagerAddress;
8078
8094
  this.memoManagerAddress = memoManagerAddress;
8079
8095
  this.accountManagerAddress = accountManagerAddress;
8096
+ this.builderCode = builderCode;
8080
8097
  this.RETRY_CONFIG = {
8081
8098
  intervalMs: 200,
8082
8099
  multiplier: 1.1,
@@ -8084,7 +8101,7 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8084
8101
  };
8085
8102
  this._sessionKeyClients = {};
8086
8103
  }
8087
- static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2) {
8104
+ static async build(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfigV2, builderCode) {
8088
8105
  const publicClients = {};
8089
8106
  for (const chain of config.chains) {
8090
8107
  publicClients[chain.id] = createPublicClient4({
@@ -8125,7 +8142,8 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8125
8142
  memoManagerAddress.result,
8126
8143
  accountManagerAddress.result,
8127
8144
  agentWalletAddress,
8128
- config
8145
+ config,
8146
+ builderCode
8129
8147
  );
8130
8148
  acpContractClient.publicClients = publicClients;
8131
8149
  await acpContractClient.init(walletPrivateKey, sessionEntityKeyId);
@@ -8210,10 +8228,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
8210
8228
  if (!sessionKeyClient) {
8211
8229
  throw new acpError_default("Session key client not initialized");
8212
8230
  }
8231
+ const dataSuffix = this.builderCode ? Attribution.toDataSuffix({ codes: [this.builderCode] }) : void 0;
8213
8232
  const basePayload = {
8214
8233
  uo: operations.map((operation) => ({
8215
8234
  target: operation.contractAddress,
8216
- data: operation.data,
8235
+ data: dataSuffix ? appendBuilderCodeData(operation.data, dataSuffix) : operation.data,
8217
8236
  value: operation.value
8218
8237
  }))
8219
8238
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtuals-protocol/acp-node",
3
- "version": "0.3.0-beta-subscription.1",
3
+ "version": "0.3.0-beta-subscription.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -36,6 +36,7 @@
36
36
  "axios": "^1.13.2",
37
37
  "jwt-decode": "^4.0.0",
38
38
  "dotenv": "^17.2.3",
39
+ "ox": "^0.13.1",
39
40
  "socket.io-client": "^4.8.1",
40
41
  "tsup": "^8.5.0",
41
42
  "viem": "^2.28.2"