@virtuals-protocol/acp-node 0.2.0-beta-fund.3 → 0.2.0-beta-fund.4

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
@@ -105,6 +105,8 @@ declare class FareAmount {
105
105
  format(): bigint;
106
106
  add(other: FareAmount): FareAmount;
107
107
  }
108
+ declare const wethFare: Fare;
109
+ declare const ethFare: Fare;
108
110
 
109
111
  declare class AcpContractConfig {
110
112
  chain: typeof baseSepolia | typeof base;
@@ -428,6 +430,7 @@ declare class AcpContractClient {
428
430
  [x: `bool[${string}]`]: undefined;
429
431
  [x: `bytes4[${string}]`]: undefined;
430
432
  [x: `bytes[${string}]`]: undefined;
433
+ [x: `bytes18[${string}]`]: undefined;
431
434
  [x: `bytes6[${string}]`]: undefined;
432
435
  [x: `bytes1[${string}]`]: undefined;
433
436
  [x: `bytes2[${string}]`]: undefined;
@@ -444,7 +447,6 @@ declare class AcpContractClient {
444
447
  [x: `bytes15[${string}]`]: undefined;
445
448
  [x: `bytes16[${string}]`]: undefined;
446
449
  [x: `bytes17[${string}]`]: undefined;
447
- [x: `bytes18[${string}]`]: undefined;
448
450
  [x: `bytes19[${string}]`]: undefined;
449
451
  [x: `bytes20[${string}]`]: undefined;
450
452
  [x: `bytes21[${string}]`]: undefined;
@@ -530,6 +532,7 @@ declare class AcpContractClient {
530
532
  bool?: undefined;
531
533
  bytes4?: undefined;
532
534
  bytes?: undefined;
535
+ bytes18?: undefined;
533
536
  bytes6?: undefined;
534
537
  bytes1?: undefined;
535
538
  bytes2?: undefined;
@@ -546,7 +549,6 @@ declare class AcpContractClient {
546
549
  bytes15?: undefined;
547
550
  bytes16?: undefined;
548
551
  bytes17?: undefined;
549
- bytes18?: undefined;
550
552
  bytes19?: undefined;
551
553
  bytes20?: undefined;
552
554
  bytes21?: undefined;
@@ -7738,6 +7740,7 @@ declare class AcpContractClient {
7738
7740
  [x: `bool[${string}]`]: undefined;
7739
7741
  [x: `bytes4[${string}]`]: undefined;
7740
7742
  [x: `bytes[${string}]`]: undefined;
7743
+ [x: `bytes18[${string}]`]: undefined;
7741
7744
  [x: `bytes6[${string}]`]: undefined;
7742
7745
  [x: `bytes1[${string}]`]: undefined;
7743
7746
  [x: `bytes2[${string}]`]: undefined;
@@ -7754,7 +7757,6 @@ declare class AcpContractClient {
7754
7757
  [x: `bytes15[${string}]`]: undefined;
7755
7758
  [x: `bytes16[${string}]`]: undefined;
7756
7759
  [x: `bytes17[${string}]`]: undefined;
7757
- [x: `bytes18[${string}]`]: undefined;
7758
7760
  [x: `bytes19[${string}]`]: undefined;
7759
7761
  [x: `bytes20[${string}]`]: undefined;
7760
7762
  [x: `bytes21[${string}]`]: undefined;
@@ -7840,6 +7842,7 @@ declare class AcpContractClient {
7840
7842
  bool?: undefined;
7841
7843
  bytes4?: undefined;
7842
7844
  bytes?: undefined;
7845
+ bytes18?: undefined;
7843
7846
  bytes6?: undefined;
7844
7847
  bytes1?: undefined;
7845
7848
  bytes2?: undefined;
@@ -7856,7 +7859,6 @@ declare class AcpContractClient {
7856
7859
  bytes15?: undefined;
7857
7860
  bytes16?: undefined;
7858
7861
  bytes17?: undefined;
7859
- bytes18?: undefined;
7860
7862
  bytes19?: undefined;
7861
7863
  bytes20?: undefined;
7862
7864
  bytes21?: undefined;
@@ -8189,6 +8191,7 @@ declare class AcpContractClient {
8189
8191
  [x: `bool[${string}]`]: undefined;
8190
8192
  [x: `bytes4[${string}]`]: undefined;
8191
8193
  [x: `bytes[${string}]`]: undefined;
8194
+ [x: `bytes18[${string}]`]: undefined;
8192
8195
  [x: `bytes6[${string}]`]: undefined;
8193
8196
  [x: `bytes1[${string}]`]: undefined;
8194
8197
  [x: `bytes2[${string}]`]: undefined;
@@ -8205,7 +8208,6 @@ declare class AcpContractClient {
8205
8208
  [x: `bytes15[${string}]`]: undefined;
8206
8209
  [x: `bytes16[${string}]`]: undefined;
8207
8210
  [x: `bytes17[${string}]`]: undefined;
8208
- [x: `bytes18[${string}]`]: undefined;
8209
8211
  [x: `bytes19[${string}]`]: undefined;
8210
8212
  [x: `bytes20[${string}]`]: undefined;
8211
8213
  [x: `bytes21[${string}]`]: undefined;
@@ -8291,6 +8293,7 @@ declare class AcpContractClient {
8291
8293
  bool?: undefined;
8292
8294
  bytes4?: undefined;
8293
8295
  bytes?: undefined;
8296
+ bytes18?: undefined;
8294
8297
  bytes6?: undefined;
8295
8298
  bytes1?: undefined;
8296
8299
  bytes2?: undefined;
@@ -8307,7 +8310,6 @@ declare class AcpContractClient {
8307
8310
  bytes15?: undefined;
8308
8311
  bytes16?: undefined;
8309
8312
  bytes17?: undefined;
8310
- bytes18?: undefined;
8311
8313
  bytes19?: undefined;
8312
8314
  bytes20?: undefined;
8313
8315
  bytes21?: undefined;
@@ -8404,6 +8406,7 @@ declare class AcpContractClient {
8404
8406
  signMemo(memoId: number, isApproved: boolean, reason?: string): Promise<`0x${string}`>;
8405
8407
  setBudget(jobId: number, budgetBaseUnit: bigint): Promise<`0x${string}`>;
8406
8408
  setBudgetWithPaymentToken(jobId: number, budgetBaseUnit: bigint, paymentTokenAddress?: Address$1): Promise<`0x${string}`>;
8409
+ wrapEth(amountBaseUnit: bigint): Promise<`0x${string}`>;
8407
8410
  }
8408
8411
 
8409
8412
  declare class AcpMemo {
@@ -8661,4 +8664,4 @@ declare class AcpClient {
8661
8664
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;
8662
8665
  }
8663
8666
 
8664
- export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default };
8667
+ export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };
package/dist/index.d.ts CHANGED
@@ -105,6 +105,8 @@ declare class FareAmount {
105
105
  format(): bigint;
106
106
  add(other: FareAmount): FareAmount;
107
107
  }
108
+ declare const wethFare: Fare;
109
+ declare const ethFare: Fare;
108
110
 
109
111
  declare class AcpContractConfig {
110
112
  chain: typeof baseSepolia | typeof base;
@@ -428,6 +430,7 @@ declare class AcpContractClient {
428
430
  [x: `bool[${string}]`]: undefined;
429
431
  [x: `bytes4[${string}]`]: undefined;
430
432
  [x: `bytes[${string}]`]: undefined;
433
+ [x: `bytes18[${string}]`]: undefined;
431
434
  [x: `bytes6[${string}]`]: undefined;
432
435
  [x: `bytes1[${string}]`]: undefined;
433
436
  [x: `bytes2[${string}]`]: undefined;
@@ -444,7 +447,6 @@ declare class AcpContractClient {
444
447
  [x: `bytes15[${string}]`]: undefined;
445
448
  [x: `bytes16[${string}]`]: undefined;
446
449
  [x: `bytes17[${string}]`]: undefined;
447
- [x: `bytes18[${string}]`]: undefined;
448
450
  [x: `bytes19[${string}]`]: undefined;
449
451
  [x: `bytes20[${string}]`]: undefined;
450
452
  [x: `bytes21[${string}]`]: undefined;
@@ -530,6 +532,7 @@ declare class AcpContractClient {
530
532
  bool?: undefined;
531
533
  bytes4?: undefined;
532
534
  bytes?: undefined;
535
+ bytes18?: undefined;
533
536
  bytes6?: undefined;
534
537
  bytes1?: undefined;
535
538
  bytes2?: undefined;
@@ -546,7 +549,6 @@ declare class AcpContractClient {
546
549
  bytes15?: undefined;
547
550
  bytes16?: undefined;
548
551
  bytes17?: undefined;
549
- bytes18?: undefined;
550
552
  bytes19?: undefined;
551
553
  bytes20?: undefined;
552
554
  bytes21?: undefined;
@@ -7738,6 +7740,7 @@ declare class AcpContractClient {
7738
7740
  [x: `bool[${string}]`]: undefined;
7739
7741
  [x: `bytes4[${string}]`]: undefined;
7740
7742
  [x: `bytes[${string}]`]: undefined;
7743
+ [x: `bytes18[${string}]`]: undefined;
7741
7744
  [x: `bytes6[${string}]`]: undefined;
7742
7745
  [x: `bytes1[${string}]`]: undefined;
7743
7746
  [x: `bytes2[${string}]`]: undefined;
@@ -7754,7 +7757,6 @@ declare class AcpContractClient {
7754
7757
  [x: `bytes15[${string}]`]: undefined;
7755
7758
  [x: `bytes16[${string}]`]: undefined;
7756
7759
  [x: `bytes17[${string}]`]: undefined;
7757
- [x: `bytes18[${string}]`]: undefined;
7758
7760
  [x: `bytes19[${string}]`]: undefined;
7759
7761
  [x: `bytes20[${string}]`]: undefined;
7760
7762
  [x: `bytes21[${string}]`]: undefined;
@@ -7840,6 +7842,7 @@ declare class AcpContractClient {
7840
7842
  bool?: undefined;
7841
7843
  bytes4?: undefined;
7842
7844
  bytes?: undefined;
7845
+ bytes18?: undefined;
7843
7846
  bytes6?: undefined;
7844
7847
  bytes1?: undefined;
7845
7848
  bytes2?: undefined;
@@ -7856,7 +7859,6 @@ declare class AcpContractClient {
7856
7859
  bytes15?: undefined;
7857
7860
  bytes16?: undefined;
7858
7861
  bytes17?: undefined;
7859
- bytes18?: undefined;
7860
7862
  bytes19?: undefined;
7861
7863
  bytes20?: undefined;
7862
7864
  bytes21?: undefined;
@@ -8189,6 +8191,7 @@ declare class AcpContractClient {
8189
8191
  [x: `bool[${string}]`]: undefined;
8190
8192
  [x: `bytes4[${string}]`]: undefined;
8191
8193
  [x: `bytes[${string}]`]: undefined;
8194
+ [x: `bytes18[${string}]`]: undefined;
8192
8195
  [x: `bytes6[${string}]`]: undefined;
8193
8196
  [x: `bytes1[${string}]`]: undefined;
8194
8197
  [x: `bytes2[${string}]`]: undefined;
@@ -8205,7 +8208,6 @@ declare class AcpContractClient {
8205
8208
  [x: `bytes15[${string}]`]: undefined;
8206
8209
  [x: `bytes16[${string}]`]: undefined;
8207
8210
  [x: `bytes17[${string}]`]: undefined;
8208
- [x: `bytes18[${string}]`]: undefined;
8209
8211
  [x: `bytes19[${string}]`]: undefined;
8210
8212
  [x: `bytes20[${string}]`]: undefined;
8211
8213
  [x: `bytes21[${string}]`]: undefined;
@@ -8291,6 +8293,7 @@ declare class AcpContractClient {
8291
8293
  bool?: undefined;
8292
8294
  bytes4?: undefined;
8293
8295
  bytes?: undefined;
8296
+ bytes18?: undefined;
8294
8297
  bytes6?: undefined;
8295
8298
  bytes1?: undefined;
8296
8299
  bytes2?: undefined;
@@ -8307,7 +8310,6 @@ declare class AcpContractClient {
8307
8310
  bytes15?: undefined;
8308
8311
  bytes16?: undefined;
8309
8312
  bytes17?: undefined;
8310
- bytes18?: undefined;
8311
8313
  bytes19?: undefined;
8312
8314
  bytes20?: undefined;
8313
8315
  bytes21?: undefined;
@@ -8404,6 +8406,7 @@ declare class AcpContractClient {
8404
8406
  signMemo(memoId: number, isApproved: boolean, reason?: string): Promise<`0x${string}`>;
8405
8407
  setBudget(jobId: number, budgetBaseUnit: bigint): Promise<`0x${string}`>;
8406
8408
  setBudgetWithPaymentToken(jobId: number, budgetBaseUnit: bigint, paymentTokenAddress?: Address$1): Promise<`0x${string}`>;
8409
+ wrapEth(amountBaseUnit: bigint): Promise<`0x${string}`>;
8407
8410
  }
8408
8411
 
8409
8412
  declare class AcpMemo {
@@ -8661,4 +8664,4 @@ declare class AcpClient {
8661
8664
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;
8662
8665
  }
8663
8666
 
8664
- export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default };
8667
+ export { ACP_ABI, AcpAgentSort, AcpContractClient, AcpContractConfig, AcpGraduationStatus, AcpJob, AcpJobPhases, AcpMemo, AcpMemoStatus, AcpOnlineStatus, type ClosePositionPayload, Fare, FareAmount, type FundResponsePayload, type IDeliverable, MemoType, type OpenPositionPayload, PayloadType, type RequestClosePositionPayload, type ResponseSwapTokenPayload, type SwapTokenPayload, baseAcpConfig, baseSepoliaAcpConfig, AcpClient as default, ethFare, wethFare };
package/dist/index.js CHANGED
@@ -72,7 +72,7 @@ var require_package = __commonJS({
72
72
  "package.json"(exports2, module2) {
73
73
  module2.exports = {
74
74
  name: "@virtuals-protocol/acp-node",
75
- version: "0.2.0-beta-fund.3",
75
+ version: "0.2.0-beta-fund.4",
76
76
  main: "./dist/index.js",
77
77
  module: "./dist/index.mjs",
78
78
  types: "./dist/index.d.ts",
@@ -121,7 +121,9 @@ __export(index_exports, {
121
121
  PayloadType: () => PayloadType,
122
122
  baseAcpConfig: () => baseAcpConfig,
123
123
  baseSepoliaAcpConfig: () => baseSepoliaAcpConfig,
124
- default: () => index_default
124
+ default: () => index_default,
125
+ ethFare: () => ethFare,
126
+ wethFare: () => wethFare
125
127
  });
126
128
  module.exports = __toCommonJS(index_exports);
127
129
 
@@ -1936,6 +1938,8 @@ var FareAmount = class _FareAmount {
1936
1938
  return new _FareAmount(this.amount + other.amount, this.fare);
1937
1939
  }
1938
1940
  };
1941
+ var wethFare = new Fare("0x4200000000000000000000000000000000000006", 18);
1942
+ var ethFare = new Fare(import_viem.ethAddress, 18);
1939
1943
 
1940
1944
  // src/acpConfigs.ts
1941
1945
  var AcpContractConfig = class {
@@ -1963,6 +1967,162 @@ var baseAcpConfig = new AcpContractConfig(
1963
1967
  "https://acpx.virtuals.io"
1964
1968
  );
1965
1969
 
1970
+ // src/wethAbi.ts
1971
+ var WETH_ABI = [
1972
+ {
1973
+ anonymous: false,
1974
+ inputs: [
1975
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1976
+ { indexed: true, internalType: "address", name: "guy", type: "address" },
1977
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1978
+ ],
1979
+ name: "Approval",
1980
+ type: "event"
1981
+ },
1982
+ {
1983
+ anonymous: false,
1984
+ inputs: [
1985
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
1986
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1987
+ ],
1988
+ name: "Deposit",
1989
+ type: "event"
1990
+ },
1991
+ {
1992
+ anonymous: false,
1993
+ inputs: [
1994
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1995
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
1996
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1997
+ ],
1998
+ name: "Transfer",
1999
+ type: "event"
2000
+ },
2001
+ {
2002
+ anonymous: false,
2003
+ inputs: [
2004
+ { indexed: true, internalType: "address", name: "src", type: "address" },
2005
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
2006
+ ],
2007
+ name: "Withdrawal",
2008
+ type: "event"
2009
+ },
2010
+ { payable: true, stateMutability: "payable", type: "fallback" },
2011
+ {
2012
+ constant: true,
2013
+ inputs: [
2014
+ { internalType: "address", name: "", type: "address" },
2015
+ { internalType: "address", name: "", type: "address" }
2016
+ ],
2017
+ name: "allowance",
2018
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2019
+ payable: false,
2020
+ stateMutability: "view",
2021
+ type: "function"
2022
+ },
2023
+ {
2024
+ constant: false,
2025
+ inputs: [
2026
+ { internalType: "address", name: "guy", type: "address" },
2027
+ { internalType: "uint256", name: "wad", type: "uint256" }
2028
+ ],
2029
+ name: "approve",
2030
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2031
+ payable: false,
2032
+ stateMutability: "nonpayable",
2033
+ type: "function"
2034
+ },
2035
+ {
2036
+ constant: true,
2037
+ inputs: [{ internalType: "address", name: "", type: "address" }],
2038
+ name: "balanceOf",
2039
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2040
+ payable: false,
2041
+ stateMutability: "view",
2042
+ type: "function"
2043
+ },
2044
+ {
2045
+ constant: true,
2046
+ inputs: [],
2047
+ name: "decimals",
2048
+ outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
2049
+ payable: false,
2050
+ stateMutability: "view",
2051
+ type: "function"
2052
+ },
2053
+ {
2054
+ constant: false,
2055
+ inputs: [],
2056
+ name: "deposit",
2057
+ outputs: [],
2058
+ payable: true,
2059
+ stateMutability: "payable",
2060
+ type: "function"
2061
+ },
2062
+ {
2063
+ constant: true,
2064
+ inputs: [],
2065
+ name: "name",
2066
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2067
+ payable: false,
2068
+ stateMutability: "view",
2069
+ type: "function"
2070
+ },
2071
+ {
2072
+ constant: true,
2073
+ inputs: [],
2074
+ name: "symbol",
2075
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2076
+ payable: false,
2077
+ stateMutability: "view",
2078
+ type: "function"
2079
+ },
2080
+ {
2081
+ constant: true,
2082
+ inputs: [],
2083
+ name: "totalSupply",
2084
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2085
+ payable: false,
2086
+ stateMutability: "view",
2087
+ type: "function"
2088
+ },
2089
+ {
2090
+ constant: false,
2091
+ inputs: [
2092
+ { internalType: "address", name: "dst", type: "address" },
2093
+ { internalType: "uint256", name: "wad", type: "uint256" }
2094
+ ],
2095
+ name: "transfer",
2096
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2097
+ payable: false,
2098
+ stateMutability: "nonpayable",
2099
+ type: "function"
2100
+ },
2101
+ {
2102
+ constant: false,
2103
+ inputs: [
2104
+ { internalType: "address", name: "src", type: "address" },
2105
+ { internalType: "address", name: "dst", type: "address" },
2106
+ { internalType: "uint256", name: "wad", type: "uint256" }
2107
+ ],
2108
+ name: "transferFrom",
2109
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2110
+ payable: false,
2111
+ stateMutability: "nonpayable",
2112
+ type: "function"
2113
+ },
2114
+ {
2115
+ constant: false,
2116
+ inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
2117
+ name: "withdraw",
2118
+ outputs: [],
2119
+ payable: false,
2120
+ stateMutability: "nonpayable",
2121
+ type: "function"
2122
+ }
2123
+ ];
2124
+ var wethAbi_default = WETH_ABI;
2125
+
1966
2126
  // src/acpContractClient.ts
1967
2127
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
1968
2128
  MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
@@ -2046,11 +2206,12 @@ var AcpContractClient = class _AcpContractClient {
2046
2206
  });
2047
2207
  }
2048
2208
  handleSendUserOperation(_0) {
2049
- return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
2209
+ return __async(this, arguments, function* (data, contractAddress = this.contractAddress, value) {
2050
2210
  const payload = {
2051
2211
  uo: {
2052
2212
  target: contractAddress,
2053
- data
2213
+ data,
2214
+ value
2054
2215
  },
2055
2216
  overrides: {}
2056
2217
  };
@@ -2258,6 +2419,24 @@ var AcpContractClient = class _AcpContractClient {
2258
2419
  }
2259
2420
  });
2260
2421
  }
2422
+ wrapEth(amountBaseUnit) {
2423
+ return __async(this, null, function* () {
2424
+ try {
2425
+ const data = (0, import_viem2.encodeFunctionData)({
2426
+ abi: wethAbi_default,
2427
+ functionName: "deposit"
2428
+ });
2429
+ return yield this.handleSendUserOperation(
2430
+ data,
2431
+ wethFare.contractAddress,
2432
+ amountBaseUnit
2433
+ );
2434
+ } catch (error) {
2435
+ console.error(`Failed to wrap eth ${error}`);
2436
+ throw new Error("Failed to wrap eth");
2437
+ }
2438
+ });
2439
+ }
2261
2440
  };
2262
2441
  var acpContractClient_default = AcpContractClient;
2263
2442
 
@@ -3072,6 +3251,10 @@ var AcpClient = class {
3072
3251
  }
3073
3252
  transferFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
3074
3253
  return __async(this, null, function* () {
3254
+ if (transferFareAmount.fare.contractAddress === ethFare.contractAddress) {
3255
+ yield this.acpContractClient.wrapEth(transferFareAmount.format());
3256
+ transferFareAmount = new FareAmount(transferFareAmount.amount, wethFare);
3257
+ }
3075
3258
  if (feeFareAmount.amount > 0 && feeFareAmount.fare.contractAddress !== this.acpContractClient.config.baseFare.contractAddress) {
3076
3259
  throw new Error("Fee token address is not the same as the base fare");
3077
3260
  }
@@ -3373,5 +3556,7 @@ var index_default = acpClient_default;
3373
3556
  MemoType,
3374
3557
  PayloadType,
3375
3558
  baseAcpConfig,
3376
- baseSepoliaAcpConfig
3559
+ baseSepoliaAcpConfig,
3560
+ ethFare,
3561
+ wethFare
3377
3562
  });
package/dist/index.mjs CHANGED
@@ -47,7 +47,7 @@ var require_package = __commonJS({
47
47
  "package.json"(exports, module) {
48
48
  module.exports = {
49
49
  name: "@virtuals-protocol/acp-node",
50
- version: "0.2.0-beta-fund.3",
50
+ version: "0.2.0-beta-fund.4",
51
51
  main: "./dist/index.js",
52
52
  module: "./dist/index.mjs",
53
53
  types: "./dist/index.d.ts",
@@ -1865,7 +1865,7 @@ import { decodeEventLog, encodeFunctionData, erc20Abi, fromHex } from "viem";
1865
1865
  import { baseSepolia, base } from "@account-kit/infra";
1866
1866
 
1867
1867
  // src/acpFare.ts
1868
- import { parseUnits } from "viem";
1868
+ import { ethAddress, parseUnits } from "viem";
1869
1869
  var Fare = class {
1870
1870
  constructor(contractAddress, decimals) {
1871
1871
  this.contractAddress = contractAddress;
@@ -1890,6 +1890,8 @@ var FareAmount = class _FareAmount {
1890
1890
  return new _FareAmount(this.amount + other.amount, this.fare);
1891
1891
  }
1892
1892
  };
1893
+ var wethFare = new Fare("0x4200000000000000000000000000000000000006", 18);
1894
+ var ethFare = new Fare(ethAddress, 18);
1893
1895
 
1894
1896
  // src/acpConfigs.ts
1895
1897
  var AcpContractConfig = class {
@@ -1917,6 +1919,162 @@ var baseAcpConfig = new AcpContractConfig(
1917
1919
  "https://acpx.virtuals.io"
1918
1920
  );
1919
1921
 
1922
+ // src/wethAbi.ts
1923
+ var WETH_ABI = [
1924
+ {
1925
+ anonymous: false,
1926
+ inputs: [
1927
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1928
+ { indexed: true, internalType: "address", name: "guy", type: "address" },
1929
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1930
+ ],
1931
+ name: "Approval",
1932
+ type: "event"
1933
+ },
1934
+ {
1935
+ anonymous: false,
1936
+ inputs: [
1937
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
1938
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1939
+ ],
1940
+ name: "Deposit",
1941
+ type: "event"
1942
+ },
1943
+ {
1944
+ anonymous: false,
1945
+ inputs: [
1946
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1947
+ { indexed: true, internalType: "address", name: "dst", type: "address" },
1948
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1949
+ ],
1950
+ name: "Transfer",
1951
+ type: "event"
1952
+ },
1953
+ {
1954
+ anonymous: false,
1955
+ inputs: [
1956
+ { indexed: true, internalType: "address", name: "src", type: "address" },
1957
+ { indexed: false, internalType: "uint256", name: "wad", type: "uint256" }
1958
+ ],
1959
+ name: "Withdrawal",
1960
+ type: "event"
1961
+ },
1962
+ { payable: true, stateMutability: "payable", type: "fallback" },
1963
+ {
1964
+ constant: true,
1965
+ inputs: [
1966
+ { internalType: "address", name: "", type: "address" },
1967
+ { internalType: "address", name: "", type: "address" }
1968
+ ],
1969
+ name: "allowance",
1970
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1971
+ payable: false,
1972
+ stateMutability: "view",
1973
+ type: "function"
1974
+ },
1975
+ {
1976
+ constant: false,
1977
+ inputs: [
1978
+ { internalType: "address", name: "guy", type: "address" },
1979
+ { internalType: "uint256", name: "wad", type: "uint256" }
1980
+ ],
1981
+ name: "approve",
1982
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
1983
+ payable: false,
1984
+ stateMutability: "nonpayable",
1985
+ type: "function"
1986
+ },
1987
+ {
1988
+ constant: true,
1989
+ inputs: [{ internalType: "address", name: "", type: "address" }],
1990
+ name: "balanceOf",
1991
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1992
+ payable: false,
1993
+ stateMutability: "view",
1994
+ type: "function"
1995
+ },
1996
+ {
1997
+ constant: true,
1998
+ inputs: [],
1999
+ name: "decimals",
2000
+ outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
2001
+ payable: false,
2002
+ stateMutability: "view",
2003
+ type: "function"
2004
+ },
2005
+ {
2006
+ constant: false,
2007
+ inputs: [],
2008
+ name: "deposit",
2009
+ outputs: [],
2010
+ payable: true,
2011
+ stateMutability: "payable",
2012
+ type: "function"
2013
+ },
2014
+ {
2015
+ constant: true,
2016
+ inputs: [],
2017
+ name: "name",
2018
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2019
+ payable: false,
2020
+ stateMutability: "view",
2021
+ type: "function"
2022
+ },
2023
+ {
2024
+ constant: true,
2025
+ inputs: [],
2026
+ name: "symbol",
2027
+ outputs: [{ internalType: "string", name: "", type: "string" }],
2028
+ payable: false,
2029
+ stateMutability: "view",
2030
+ type: "function"
2031
+ },
2032
+ {
2033
+ constant: true,
2034
+ inputs: [],
2035
+ name: "totalSupply",
2036
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2037
+ payable: false,
2038
+ stateMutability: "view",
2039
+ type: "function"
2040
+ },
2041
+ {
2042
+ constant: false,
2043
+ inputs: [
2044
+ { internalType: "address", name: "dst", type: "address" },
2045
+ { internalType: "uint256", name: "wad", type: "uint256" }
2046
+ ],
2047
+ name: "transfer",
2048
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2049
+ payable: false,
2050
+ stateMutability: "nonpayable",
2051
+ type: "function"
2052
+ },
2053
+ {
2054
+ constant: false,
2055
+ inputs: [
2056
+ { internalType: "address", name: "src", type: "address" },
2057
+ { internalType: "address", name: "dst", type: "address" },
2058
+ { internalType: "uint256", name: "wad", type: "uint256" }
2059
+ ],
2060
+ name: "transferFrom",
2061
+ outputs: [{ internalType: "bool", name: "", type: "bool" }],
2062
+ payable: false,
2063
+ stateMutability: "nonpayable",
2064
+ type: "function"
2065
+ },
2066
+ {
2067
+ constant: false,
2068
+ inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
2069
+ name: "withdraw",
2070
+ outputs: [],
2071
+ payable: false,
2072
+ stateMutability: "nonpayable",
2073
+ type: "function"
2074
+ }
2075
+ ];
2076
+ var wethAbi_default = WETH_ABI;
2077
+
1920
2078
  // src/acpContractClient.ts
1921
2079
  var MemoType = /* @__PURE__ */ ((MemoType2) => {
1922
2080
  MemoType2[MemoType2["MESSAGE"] = 0] = "MESSAGE";
@@ -2000,11 +2158,12 @@ var AcpContractClient = class _AcpContractClient {
2000
2158
  });
2001
2159
  }
2002
2160
  handleSendUserOperation(_0) {
2003
- return __async(this, arguments, function* (data, contractAddress = this.contractAddress) {
2161
+ return __async(this, arguments, function* (data, contractAddress = this.contractAddress, value) {
2004
2162
  const payload = {
2005
2163
  uo: {
2006
2164
  target: contractAddress,
2007
- data
2165
+ data,
2166
+ value
2008
2167
  },
2009
2168
  overrides: {}
2010
2169
  };
@@ -2212,6 +2371,24 @@ var AcpContractClient = class _AcpContractClient {
2212
2371
  }
2213
2372
  });
2214
2373
  }
2374
+ wrapEth(amountBaseUnit) {
2375
+ return __async(this, null, function* () {
2376
+ try {
2377
+ const data = encodeFunctionData({
2378
+ abi: wethAbi_default,
2379
+ functionName: "deposit"
2380
+ });
2381
+ return yield this.handleSendUserOperation(
2382
+ data,
2383
+ wethFare.contractAddress,
2384
+ amountBaseUnit
2385
+ );
2386
+ } catch (error) {
2387
+ console.error(`Failed to wrap eth ${error}`);
2388
+ throw new Error("Failed to wrap eth");
2389
+ }
2390
+ });
2391
+ }
2215
2392
  };
2216
2393
  var acpContractClient_default = AcpContractClient;
2217
2394
 
@@ -3026,6 +3203,10 @@ var AcpClient = class {
3026
3203
  }
3027
3204
  transferFunds(jobId, transferFareAmount, recipient, feeFareAmount, feeType, reason, nextPhase, expiredAt) {
3028
3205
  return __async(this, null, function* () {
3206
+ if (transferFareAmount.fare.contractAddress === ethFare.contractAddress) {
3207
+ yield this.acpContractClient.wrapEth(transferFareAmount.format());
3208
+ transferFareAmount = new FareAmount(transferFareAmount.amount, wethFare);
3209
+ }
3029
3210
  if (feeFareAmount.amount > 0 && feeFareAmount.fare.contractAddress !== this.acpContractClient.config.baseFare.contractAddress) {
3030
3211
  throw new Error("Fee token address is not the same as the base fare");
3031
3212
  }
@@ -3327,5 +3508,7 @@ export {
3327
3508
  PayloadType,
3328
3509
  baseAcpConfig,
3329
3510
  baseSepoliaAcpConfig,
3330
- index_default as default
3511
+ index_default as default,
3512
+ ethFare,
3513
+ wethFare
3331
3514
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtuals-protocol/acp-node",
3
- "version": "0.2.0-beta-fund.3",
3
+ "version": "0.2.0-beta-fund.4",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",