@virtuals-protocol/acp-node 0.1.0-beta.14 → 0.1.0-beta.16

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
@@ -69,7 +69,7 @@ var require_package = __commonJS({
69
69
  "package.json"(exports2, module2) {
70
70
  module2.exports = {
71
71
  name: "@virtuals-protocol/acp-node",
72
- version: "0.1.0-beta.14",
72
+ version: "0.1.0-beta.16",
73
73
  main: "./dist/index.js",
74
74
  module: "./dist/index.mjs",
75
75
  types: "./dist/index.d.ts",
@@ -812,18 +812,25 @@ var baseSepoliaAcpConfig = {
812
812
  contractAddress: "0xD1D196Ac27Fd386dDc04879a86C074aBF3AD9d0f",
813
813
  virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
814
814
  alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
815
- acpUrl: "https://acpx-staging.virtuals.io"
815
+ acpUrl: "https://acpx-staging.virtuals.io",
816
+ priorityFeeMultiplier: 2,
817
+ maxFeePerGas: 2e7,
818
+ maxPriorityFeePerGas: 21e6
816
819
  };
817
820
  var baseAcpConfig = {
818
821
  chain: import_infra.base,
819
822
  contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
820
823
  virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
821
824
  alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
822
- acpUrl: "https://acpx.virtuals.io"
825
+ acpUrl: "https://acpx.virtuals.io",
826
+ priorityFeeMultiplier: 2,
827
+ maxFeePerGas: 2e7,
828
+ maxPriorityFeePerGas: 21e6
823
829
  };
824
830
 
825
831
  // src/acpContractClient.ts
826
832
  var import_viem = require("viem");
833
+ var import_op_stack = require("viem/op-stack");
827
834
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
828
835
  MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
829
836
  MemoType2[MemoType2["CONTEXT_URL"] = 1] = "CONTEXT_URL";
@@ -844,22 +851,30 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
844
851
  return AcpJobPhases2;
845
852
  })(AcpJobPhases || {});
846
853
  var AcpContractClient = class _AcpContractClient {
847
- constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
854
+ constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig, customRpcUrl) {
848
855
  this.walletPrivateKey = walletPrivateKey;
849
856
  this.sessionEntityKeyId = sessionEntityKeyId;
850
857
  this.agentWalletAddress = agentWalletAddress;
851
858
  this.config = config;
859
+ this.customRpcUrl = customRpcUrl;
860
+ this.MAX_RETRIES = 3;
852
861
  this.chain = config.chain;
853
862
  this.contractAddress = config.contractAddress;
854
863
  this.virtualsTokenAddress = config.virtualsTokenAddress;
864
+ this.customRpcUrl = customRpcUrl;
865
+ this.customRpcClient = (0, import_viem.createPublicClient)({
866
+ chain: this.chain,
867
+ transport: this.customRpcUrl ? (0, import_viem.http)(this.customRpcUrl) : (0, import_viem.http)()
868
+ }).extend((0, import_op_stack.publicActionsL2)());
855
869
  }
856
- static build(_0, _1, _2) {
857
- return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
870
+ static build(_0, _1, _2, _3) {
871
+ return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, customRpcUrl, config = baseAcpConfig) {
858
872
  const acpContractClient = new _AcpContractClient(
859
873
  walletPrivateKey,
860
874
  sessionEntityKeyId,
861
875
  agentWalletAddress,
862
- config
876
+ config,
877
+ customRpcUrl
863
878
  );
864
879
  yield acpContractClient.init();
865
880
  return acpContractClient;
@@ -892,6 +907,54 @@ var AcpContractClient = class _AcpContractClient {
892
907
  get walletAddress() {
893
908
  return this.sessionKeyClient.account.address;
894
909
  }
910
+ calculateGasFees() {
911
+ return __async(this, null, function* () {
912
+ const { maxFeePerGas, maxPriorityFeePerGas } = yield this.customRpcClient.estimateFeesPerGas();
913
+ let finalMaxFeePerGas = maxFeePerGas;
914
+ let priorityFeeMultiplier = Number(this.config.priorityFeeMultiplier) || 2;
915
+ const overrideMaxFeePerGas = this.config.maxFeePerGas || maxFeePerGas;
916
+ const overrideMaxPriorityFeePerGas = this.config.maxPriorityFeePerGas || maxPriorityFeePerGas;
917
+ finalMaxFeePerGas = BigInt(overrideMaxFeePerGas) + BigInt(overrideMaxPriorityFeePerGas) * BigInt(Math.max(0, priorityFeeMultiplier - 1));
918
+ return finalMaxFeePerGas;
919
+ });
920
+ }
921
+ handleSendUserOperation(_0) {
922
+ return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
923
+ const payload = {
924
+ uo: {
925
+ target: contractAddress,
926
+ data
927
+ },
928
+ overrides: {}
929
+ };
930
+ let retries = this.MAX_RETRIES;
931
+ let finalError;
932
+ while (retries > 0) {
933
+ try {
934
+ if (this.MAX_RETRIES > retries) {
935
+ const gasFees = yield this.calculateGasFees();
936
+ payload["overrides"] = {
937
+ maxFeePerGas: `0x${gasFees.toString(16)}`
938
+ };
939
+ }
940
+ const { hash } = yield this.sessionKeyClient.sendUserOperation(payload);
941
+ yield this.sessionKeyClient.waitForUserOperationTransaction({
942
+ hash
943
+ });
944
+ return hash;
945
+ } catch (error) {
946
+ console.debug("Failed to send user operation", error);
947
+ retries -= 1;
948
+ if (retries === 0) {
949
+ finalError = error;
950
+ break;
951
+ }
952
+ yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
953
+ }
954
+ }
955
+ throw new Error(`Failed to send user operation ${finalError}`);
956
+ });
957
+ }
895
958
  getJobId(hash) {
896
959
  return __async(this, null, function* () {
897
960
  const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
@@ -919,98 +982,61 @@ var AcpContractClient = class _AcpContractClient {
919
982
  Math.floor(expireAt.getTime() / 1e3)
920
983
  ]
921
984
  });
922
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
923
- uo: {
924
- target: this.contractAddress,
925
- data
926
- }
927
- });
928
- yield this.sessionKeyClient.waitForUserOperationTransaction({
929
- hash
930
- });
985
+ const hash = yield this.handleSendUserOperation(data);
931
986
  const jobId = yield this.getJobId(hash);
932
987
  return { txHash: hash, jobId };
933
988
  } catch (error) {
934
- console.error(error);
989
+ console.error(`Failed to create job ${error}`);
935
990
  throw new Error("Failed to create job");
936
991
  }
937
992
  });
938
993
  }
939
994
  approveAllowance(priceInWei) {
940
995
  return __async(this, null, function* () {
941
- const data = (0, import_viem.encodeFunctionData)({
942
- abi: import_viem.erc20Abi,
943
- functionName: "approve",
944
- args: [this.contractAddress, priceInWei]
945
- });
946
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
947
- uo: {
948
- target: this.virtualsTokenAddress,
949
- data
950
- }
951
- });
952
- yield this.sessionKeyClient.waitForUserOperationTransaction({
953
- hash
954
- });
955
- return hash;
996
+ try {
997
+ const data = (0, import_viem.encodeFunctionData)({
998
+ abi: import_viem.erc20Abi,
999
+ functionName: "approve",
1000
+ args: [this.contractAddress, priceInWei]
1001
+ });
1002
+ return yield this.handleSendUserOperation(
1003
+ data,
1004
+ this.virtualsTokenAddress
1005
+ );
1006
+ } catch (error) {
1007
+ console.error(`Failed to approve allowance ${error}`);
1008
+ throw new Error("Failed to approve allowance");
1009
+ }
956
1010
  });
957
1011
  }
958
1012
  createMemo(jobId, content, type, isSecured, nextPhase) {
959
1013
  return __async(this, null, function* () {
960
- let retries = 3;
961
- while (retries > 0) {
962
- try {
963
- const data = (0, import_viem.encodeFunctionData)({
964
- abi: acpAbi_default,
965
- functionName: "createMemo",
966
- args: [jobId, content, type, isSecured, nextPhase]
967
- });
968
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
969
- uo: {
970
- target: this.contractAddress,
971
- data
972
- }
973
- });
974
- yield this.sessionKeyClient.waitForUserOperationTransaction({
975
- hash
976
- });
977
- return hash;
978
- } catch (error) {
979
- console.error(`failed to create memo ${jobId} ${content} ${error}`);
980
- retries -= 1;
981
- yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
982
- }
1014
+ try {
1015
+ const data = (0, import_viem.encodeFunctionData)({
1016
+ abi: acpAbi_default,
1017
+ functionName: "createMemo",
1018
+ args: [jobId, content, type, isSecured, nextPhase]
1019
+ });
1020
+ return yield this.handleSendUserOperation(data);
1021
+ } catch (error) {
1022
+ console.error(`Failed to create memo ${jobId} ${content} ${error}`);
1023
+ throw new Error("Failed to create memo");
983
1024
  }
984
- throw new Error("Failed to create memo");
985
1025
  });
986
1026
  }
987
1027
  signMemo(memoId, isApproved, reason) {
988
1028
  return __async(this, null, function* () {
989
- let retries = 3;
990
- while (retries > 0) {
991
- try {
992
- const data = (0, import_viem.encodeFunctionData)({
993
- abi: acpAbi_default,
994
- functionName: "signMemo",
995
- args: [memoId, isApproved, reason]
996
- });
997
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
998
- uo: {
999
- target: this.contractAddress,
1000
- data
1001
- }
1002
- });
1003
- yield this.sessionKeyClient.waitForUserOperationTransaction({
1004
- hash
1005
- });
1006
- return hash;
1007
- } catch (error) {
1008
- console.error(`failed to sign memo ${error}`);
1009
- retries -= 1;
1010
- yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
1011
- }
1029
+ try {
1030
+ const data = (0, import_viem.encodeFunctionData)({
1031
+ abi: acpAbi_default,
1032
+ functionName: "signMemo",
1033
+ args: [memoId, isApproved, reason]
1034
+ });
1035
+ return yield this.handleSendUserOperation(data);
1036
+ } catch (error) {
1037
+ console.error(`Failed to sign memo ${error}`);
1038
+ throw new Error("Failed to sign memo");
1012
1039
  }
1013
- throw new Error("Failed to sign memo");
1014
1040
  });
1015
1041
  }
1016
1042
  setBudget(jobId, budget) {
@@ -1021,18 +1047,9 @@ var AcpContractClient = class _AcpContractClient {
1021
1047
  functionName: "setBudget",
1022
1048
  args: [jobId, budget]
1023
1049
  });
1024
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
1025
- uo: {
1026
- target: this.contractAddress,
1027
- data
1028
- }
1029
- });
1030
- yield this.sessionKeyClient.waitForUserOperationTransaction({
1031
- hash
1032
- });
1033
- return hash;
1050
+ return yield this.handleSendUserOperation(data);
1034
1051
  } catch (error) {
1035
- console.error(error);
1052
+ console.error(`Failed to set budget ${error}`);
1036
1053
  throw new Error("Failed to set budget");
1037
1054
  }
1038
1055
  });
@@ -1385,7 +1402,7 @@ var AcpClient = class {
1385
1402
  return __async(this, null, function* () {
1386
1403
  return yield this.acpContractClient.createMemo(
1387
1404
  jobId,
1388
- deliverable,
1405
+ JSON.stringify(deliverable),
1389
1406
  4 /* OBJECT_URL */,
1390
1407
  true,
1391
1408
  4 /* COMPLETED */
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ var require_package = __commonJS({
44
44
  "package.json"(exports, module) {
45
45
  module.exports = {
46
46
  name: "@virtuals-protocol/acp-node",
47
- version: "0.1.0-beta.14",
47
+ version: "0.1.0-beta.16",
48
48
  main: "./dist/index.js",
49
49
  module: "./dist/index.mjs",
50
50
  types: "./dist/index.d.ts",
@@ -773,18 +773,31 @@ var baseSepoliaAcpConfig = {
773
773
  contractAddress: "0xD1D196Ac27Fd386dDc04879a86C074aBF3AD9d0f",
774
774
  virtualsTokenAddress: "0xbfAB80ccc15DF6fb7185f9498d6039317331846a",
775
775
  alchemyRpcUrl: "https://alchemy-proxy.virtuals.io/api/proxy/rpc",
776
- acpUrl: "https://acpx-staging.virtuals.io"
776
+ acpUrl: "https://acpx-staging.virtuals.io",
777
+ priorityFeeMultiplier: 2,
778
+ maxFeePerGas: 2e7,
779
+ maxPriorityFeePerGas: 21e6
777
780
  };
778
781
  var baseAcpConfig = {
779
782
  chain: base,
780
783
  contractAddress: "0x6a1FE26D54ab0d3E1e3168f2e0c0cDa5cC0A0A4A",
781
784
  virtualsTokenAddress: "0x0b3e328455c4059EEb9e3f84b5543F74E24e7E1b",
782
785
  alchemyRpcUrl: "https://alchemy-proxy-prod.virtuals.io/api/proxy/rpc",
783
- acpUrl: "https://acpx.virtuals.io"
786
+ acpUrl: "https://acpx.virtuals.io",
787
+ priorityFeeMultiplier: 2,
788
+ maxFeePerGas: 2e7,
789
+ maxPriorityFeePerGas: 21e6
784
790
  };
785
791
 
786
792
  // src/acpContractClient.ts
787
- import { encodeFunctionData, erc20Abi, fromHex } from "viem";
793
+ import {
794
+ createPublicClient,
795
+ encodeFunctionData,
796
+ erc20Abi,
797
+ fromHex,
798
+ http
799
+ } from "viem";
800
+ import { publicActionsL2 } from "viem/op-stack";
788
801
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
789
802
  MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
790
803
  MemoType2[MemoType2["CONTEXT_URL"] = 1] = "CONTEXT_URL";
@@ -805,22 +818,30 @@ var AcpJobPhases = /* @__PURE__ */ ((AcpJobPhases2) => {
805
818
  return AcpJobPhases2;
806
819
  })(AcpJobPhases || {});
807
820
  var AcpContractClient = class _AcpContractClient {
808
- constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
821
+ constructor(walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig, customRpcUrl) {
809
822
  this.walletPrivateKey = walletPrivateKey;
810
823
  this.sessionEntityKeyId = sessionEntityKeyId;
811
824
  this.agentWalletAddress = agentWalletAddress;
812
825
  this.config = config;
826
+ this.customRpcUrl = customRpcUrl;
827
+ this.MAX_RETRIES = 3;
813
828
  this.chain = config.chain;
814
829
  this.contractAddress = config.contractAddress;
815
830
  this.virtualsTokenAddress = config.virtualsTokenAddress;
831
+ this.customRpcUrl = customRpcUrl;
832
+ this.customRpcClient = createPublicClient({
833
+ chain: this.chain,
834
+ transport: this.customRpcUrl ? http(this.customRpcUrl) : http()
835
+ }).extend(publicActionsL2());
816
836
  }
817
- static build(_0, _1, _2) {
818
- return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, config = baseAcpConfig) {
837
+ static build(_0, _1, _2, _3) {
838
+ return __async(this, arguments, function* (walletPrivateKey, sessionEntityKeyId, agentWalletAddress, customRpcUrl, config = baseAcpConfig) {
819
839
  const acpContractClient = new _AcpContractClient(
820
840
  walletPrivateKey,
821
841
  sessionEntityKeyId,
822
842
  agentWalletAddress,
823
- config
843
+ config,
844
+ customRpcUrl
824
845
  );
825
846
  yield acpContractClient.init();
826
847
  return acpContractClient;
@@ -853,6 +874,54 @@ var AcpContractClient = class _AcpContractClient {
853
874
  get walletAddress() {
854
875
  return this.sessionKeyClient.account.address;
855
876
  }
877
+ calculateGasFees() {
878
+ return __async(this, null, function* () {
879
+ const { maxFeePerGas, maxPriorityFeePerGas } = yield this.customRpcClient.estimateFeesPerGas();
880
+ let finalMaxFeePerGas = maxFeePerGas;
881
+ let priorityFeeMultiplier = Number(this.config.priorityFeeMultiplier) || 2;
882
+ const overrideMaxFeePerGas = this.config.maxFeePerGas || maxFeePerGas;
883
+ const overrideMaxPriorityFeePerGas = this.config.maxPriorityFeePerGas || maxPriorityFeePerGas;
884
+ finalMaxFeePerGas = BigInt(overrideMaxFeePerGas) + BigInt(overrideMaxPriorityFeePerGas) * BigInt(Math.max(0, priorityFeeMultiplier - 1));
885
+ return finalMaxFeePerGas;
886
+ });
887
+ }
888
+ handleSendUserOperation(_0) {
889
+ return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
890
+ const payload = {
891
+ uo: {
892
+ target: contractAddress,
893
+ data
894
+ },
895
+ overrides: {}
896
+ };
897
+ let retries = this.MAX_RETRIES;
898
+ let finalError;
899
+ while (retries > 0) {
900
+ try {
901
+ if (this.MAX_RETRIES > retries) {
902
+ const gasFees = yield this.calculateGasFees();
903
+ payload["overrides"] = {
904
+ maxFeePerGas: `0x${gasFees.toString(16)}`
905
+ };
906
+ }
907
+ const { hash } = yield this.sessionKeyClient.sendUserOperation(payload);
908
+ yield this.sessionKeyClient.waitForUserOperationTransaction({
909
+ hash
910
+ });
911
+ return hash;
912
+ } catch (error) {
913
+ console.debug("Failed to send user operation", error);
914
+ retries -= 1;
915
+ if (retries === 0) {
916
+ finalError = error;
917
+ break;
918
+ }
919
+ yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
920
+ }
921
+ }
922
+ throw new Error(`Failed to send user operation ${finalError}`);
923
+ });
924
+ }
856
925
  getJobId(hash) {
857
926
  return __async(this, null, function* () {
858
927
  const result = yield this.sessionKeyClient.getUserOperationReceipt(hash);
@@ -880,98 +949,61 @@ var AcpContractClient = class _AcpContractClient {
880
949
  Math.floor(expireAt.getTime() / 1e3)
881
950
  ]
882
951
  });
883
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
884
- uo: {
885
- target: this.contractAddress,
886
- data
887
- }
888
- });
889
- yield this.sessionKeyClient.waitForUserOperationTransaction({
890
- hash
891
- });
952
+ const hash = yield this.handleSendUserOperation(data);
892
953
  const jobId = yield this.getJobId(hash);
893
954
  return { txHash: hash, jobId };
894
955
  } catch (error) {
895
- console.error(error);
956
+ console.error(`Failed to create job ${error}`);
896
957
  throw new Error("Failed to create job");
897
958
  }
898
959
  });
899
960
  }
900
961
  approveAllowance(priceInWei) {
901
962
  return __async(this, null, function* () {
902
- const data = encodeFunctionData({
903
- abi: erc20Abi,
904
- functionName: "approve",
905
- args: [this.contractAddress, priceInWei]
906
- });
907
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
908
- uo: {
909
- target: this.virtualsTokenAddress,
910
- data
911
- }
912
- });
913
- yield this.sessionKeyClient.waitForUserOperationTransaction({
914
- hash
915
- });
916
- return hash;
963
+ try {
964
+ const data = encodeFunctionData({
965
+ abi: erc20Abi,
966
+ functionName: "approve",
967
+ args: [this.contractAddress, priceInWei]
968
+ });
969
+ return yield this.handleSendUserOperation(
970
+ data,
971
+ this.virtualsTokenAddress
972
+ );
973
+ } catch (error) {
974
+ console.error(`Failed to approve allowance ${error}`);
975
+ throw new Error("Failed to approve allowance");
976
+ }
917
977
  });
918
978
  }
919
979
  createMemo(jobId, content, type, isSecured, nextPhase) {
920
980
  return __async(this, null, function* () {
921
- let retries = 3;
922
- while (retries > 0) {
923
- try {
924
- const data = encodeFunctionData({
925
- abi: acpAbi_default,
926
- functionName: "createMemo",
927
- args: [jobId, content, type, isSecured, nextPhase]
928
- });
929
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
930
- uo: {
931
- target: this.contractAddress,
932
- data
933
- }
934
- });
935
- yield this.sessionKeyClient.waitForUserOperationTransaction({
936
- hash
937
- });
938
- return hash;
939
- } catch (error) {
940
- console.error(`failed to create memo ${jobId} ${content} ${error}`);
941
- retries -= 1;
942
- yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
943
- }
981
+ try {
982
+ const data = encodeFunctionData({
983
+ abi: acpAbi_default,
984
+ functionName: "createMemo",
985
+ args: [jobId, content, type, isSecured, nextPhase]
986
+ });
987
+ return yield this.handleSendUserOperation(data);
988
+ } catch (error) {
989
+ console.error(`Failed to create memo ${jobId} ${content} ${error}`);
990
+ throw new Error("Failed to create memo");
944
991
  }
945
- throw new Error("Failed to create memo");
946
992
  });
947
993
  }
948
994
  signMemo(memoId, isApproved, reason) {
949
995
  return __async(this, null, function* () {
950
- let retries = 3;
951
- while (retries > 0) {
952
- try {
953
- const data = encodeFunctionData({
954
- abi: acpAbi_default,
955
- functionName: "signMemo",
956
- args: [memoId, isApproved, reason]
957
- });
958
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
959
- uo: {
960
- target: this.contractAddress,
961
- data
962
- }
963
- });
964
- yield this.sessionKeyClient.waitForUserOperationTransaction({
965
- hash
966
- });
967
- return hash;
968
- } catch (error) {
969
- console.error(`failed to sign memo ${error}`);
970
- retries -= 1;
971
- yield new Promise((resolve) => setTimeout(resolve, 2e3 * retries));
972
- }
996
+ try {
997
+ const data = encodeFunctionData({
998
+ abi: acpAbi_default,
999
+ functionName: "signMemo",
1000
+ args: [memoId, isApproved, reason]
1001
+ });
1002
+ return yield this.handleSendUserOperation(data);
1003
+ } catch (error) {
1004
+ console.error(`Failed to sign memo ${error}`);
1005
+ throw new Error("Failed to sign memo");
973
1006
  }
974
- throw new Error("Failed to sign memo");
975
1007
  });
976
1008
  }
977
1009
  setBudget(jobId, budget) {
@@ -982,18 +1014,9 @@ var AcpContractClient = class _AcpContractClient {
982
1014
  functionName: "setBudget",
983
1015
  args: [jobId, budget]
984
1016
  });
985
- const { hash } = yield this.sessionKeyClient.sendUserOperation({
986
- uo: {
987
- target: this.contractAddress,
988
- data
989
- }
990
- });
991
- yield this.sessionKeyClient.waitForUserOperationTransaction({
992
- hash
993
- });
994
- return hash;
1017
+ return yield this.handleSendUserOperation(data);
995
1018
  } catch (error) {
996
- console.error(error);
1019
+ console.error(`Failed to set budget ${error}`);
997
1020
  throw new Error("Failed to set budget");
998
1021
  }
999
1022
  });
@@ -1346,7 +1369,7 @@ var AcpClient = class {
1346
1369
  return __async(this, null, function* () {
1347
1370
  return yield this.acpContractClient.createMemo(
1348
1371
  jobId,
1349
- deliverable,
1372
+ JSON.stringify(deliverable),
1350
1373
  4 /* OBJECT_URL */,
1351
1374
  true,
1352
1375
  4 /* COMPLETED */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtuals-protocol/acp-node",
3
- "version": "0.1.0-beta.14",
3
+ "version": "0.1.0-beta.16",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",