@virtuals-protocol/acp-node 0.3.0-beta.33 → 0.3.0-beta.35

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.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.33",
38
+ version: "0.3.0-beta.35",
39
39
  main: "./dist/index.js",
40
40
  module: "./dist/index.mjs",
41
41
  types: "./dist/index.d.ts",
@@ -4885,6 +4885,18 @@ var AcpClient = class {
4885
4885
  config.headers["authorization"] = `Bearer ${accessToken}`;
4886
4886
  return config;
4887
4887
  });
4888
+ this.acpClient.interceptors.response.use(
4889
+ (response) => response,
4890
+ async (error) => {
4891
+ const originalRequest = error.config;
4892
+ if (error.response?.status === 401 && originalRequest && !originalRequest._retried) {
4893
+ originalRequest._retried = true;
4894
+ this.accessToken = null;
4895
+ return this.acpClient(originalRequest);
4896
+ }
4897
+ return Promise.reject(error);
4898
+ }
4899
+ );
4888
4900
  this.onNewTask = options.onNewTask;
4889
4901
  this.onEvaluate = options.onEvaluate || this.defaultOnEvaluate;
4890
4902
  this.init(options.skipSocketConnection);
@@ -5782,6 +5794,11 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5782
5794
  signTypedData(typedData) {
5783
5795
  return this.sessionKeyClient.signTypedData({ typedData });
5784
5796
  }
5797
+ async sendTransaction(request) {
5798
+ return await this.sessionKeyClient.sendTransaction(request, {
5799
+ paymasterAndData: "0x"
5800
+ });
5801
+ }
5785
5802
  };
5786
5803
  var acpContractClient_default = AcpContractClient;
5787
5804
 
@@ -7633,10 +7650,6 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7633
7650
  this.jobManagerAddress = jobManagerAddress;
7634
7651
  this.memoManagerAddress = memoManagerAddress;
7635
7652
  this.accountManagerAddress = accountManagerAddress;
7636
- this.PRIORITY_FEE_MULTIPLIER = 2;
7637
- this.MAX_FEE_PER_GAS = 2e7;
7638
- this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
7639
- this.GAS_FEE_MULTIPLIER = 0.5;
7640
7653
  this.RETRY_CONFIG = {
7641
7654
  intervalMs: 200,
7642
7655
  multiplier: 1.1,
@@ -7765,15 +7778,6 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7765
7778
  }
7766
7779
  return this._acpX402;
7767
7780
  }
7768
- async calculateGasFees(chainId) {
7769
- if (chainId) {
7770
- const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
7771
- const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
7772
- return increasedMaxFeePerGas;
7773
- }
7774
- const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
7775
- return finalMaxFeePerGas;
7776
- }
7777
7781
  async handleOperation(operations, chainId) {
7778
7782
  const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
7779
7783
  if (!sessionKeyClient) {
@@ -7889,6 +7893,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7889
7893
  async signTypedData(typedData) {
7890
7894
  return await this.sessionKeyClient.signTypedData({ typedData });
7891
7895
  }
7896
+ async sendTransaction(request) {
7897
+ return await this.sessionKeyClient.sendTransaction(request, {
7898
+ paymasterAndData: "0x"
7899
+ });
7900
+ }
7892
7901
  };
7893
7902
  var acpContractClientV2_default = AcpContractClientV2;
7894
7903
 
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.33",
11
+ version: "0.3.0-beta.35",
12
12
  main: "./dist/index.js",
13
13
  module: "./dist/index.mjs",
14
14
  types: "./dist/index.d.ts",
@@ -4862,6 +4862,18 @@ var AcpClient = class {
4862
4862
  config.headers["authorization"] = `Bearer ${accessToken}`;
4863
4863
  return config;
4864
4864
  });
4865
+ this.acpClient.interceptors.response.use(
4866
+ (response) => response,
4867
+ async (error) => {
4868
+ const originalRequest = error.config;
4869
+ if (error.response?.status === 401 && originalRequest && !originalRequest._retried) {
4870
+ originalRequest._retried = true;
4871
+ this.accessToken = null;
4872
+ return this.acpClient(originalRequest);
4873
+ }
4874
+ return Promise.reject(error);
4875
+ }
4876
+ );
4865
4877
  this.onNewTask = options.onNewTask;
4866
4878
  this.onEvaluate = options.onEvaluate || this.defaultOnEvaluate;
4867
4879
  this.init(options.skipSocketConnection);
@@ -5766,6 +5778,11 @@ var AcpContractClient = class _AcpContractClient extends baseAcpContractClient_d
5766
5778
  signTypedData(typedData) {
5767
5779
  return this.sessionKeyClient.signTypedData({ typedData });
5768
5780
  }
5781
+ async sendTransaction(request) {
5782
+ return await this.sessionKeyClient.sendTransaction(request, {
5783
+ paymasterAndData: "0x"
5784
+ });
5785
+ }
5769
5786
  };
5770
5787
  var acpContractClient_default = AcpContractClient;
5771
5788
 
@@ -7623,10 +7640,6 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7623
7640
  this.jobManagerAddress = jobManagerAddress;
7624
7641
  this.memoManagerAddress = memoManagerAddress;
7625
7642
  this.accountManagerAddress = accountManagerAddress;
7626
- this.PRIORITY_FEE_MULTIPLIER = 2;
7627
- this.MAX_FEE_PER_GAS = 2e7;
7628
- this.MAX_PRIORITY_FEE_PER_GAS = 21e6;
7629
- this.GAS_FEE_MULTIPLIER = 0.5;
7630
7643
  this.RETRY_CONFIG = {
7631
7644
  intervalMs: 200,
7632
7645
  multiplier: 1.1,
@@ -7755,15 +7768,6 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7755
7768
  }
7756
7769
  return this._acpX402;
7757
7770
  }
7758
- async calculateGasFees(chainId) {
7759
- if (chainId) {
7760
- const { maxFeePerGas } = await this.publicClients[chainId].estimateFeesPerGas();
7761
- const increasedMaxFeePerGas = BigInt(maxFeePerGas) + BigInt(maxFeePerGas) * BigInt(this.GAS_FEE_MULTIPLIER * 100) / BigInt(100);
7762
- return increasedMaxFeePerGas;
7763
- }
7764
- const finalMaxFeePerGas = BigInt(this.MAX_FEE_PER_GAS) + BigInt(this.MAX_PRIORITY_FEE_PER_GAS) * BigInt(Math.max(0, this.PRIORITY_FEE_MULTIPLIER - 1));
7765
- return finalMaxFeePerGas;
7766
- }
7767
7771
  async handleOperation(operations, chainId) {
7768
7772
  const sessionKeyClient = chainId ? this._sessionKeyClients[chainId] : this.sessionKeyClient;
7769
7773
  if (!sessionKeyClient) {
@@ -7879,6 +7883,11 @@ var AcpContractClientV2 = class _AcpContractClientV2 extends baseAcpContractClie
7879
7883
  async signTypedData(typedData) {
7880
7884
  return await this.sessionKeyClient.signTypedData({ typedData });
7881
7885
  }
7886
+ async sendTransaction(request) {
7887
+ return await this.sessionKeyClient.sendTransaction(request, {
7888
+ paymasterAndData: "0x"
7889
+ });
7890
+ }
7882
7891
  };
7883
7892
  var acpContractClientV2_default = AcpContractClientV2;
7884
7893
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtuals-protocol/acp-node",
3
- "version": "0.3.0-beta.33",
3
+ "version": "0.3.0-beta.35",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",