damm-sdk 1.1.28 → 1.1.29-alpha.1

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.
Files changed (104) hide show
  1. package/dist/abi/index.d.ts +0 -1
  2. package/dist/abi/index.d.ts.map +1 -1
  3. package/dist/index.cjs +50153 -41423
  4. package/dist/index.cjs.map +137 -70
  5. package/dist/index.js +4634 -2916
  6. package/dist/index.js.map +41 -29
  7. package/dist/integrations/aaveV3/aave.v3.d.ts +5 -5
  8. package/dist/integrations/aaveV3/aave.v3.d.ts.map +1 -1
  9. package/dist/integrations/aaveV3/index.d.ts +2 -2
  10. package/dist/integrations/aaveV3/index.d.ts.map +1 -1
  11. package/dist/integrations/erc20/erc20.abi.d.ts.map +1 -0
  12. package/dist/{lib → integrations/erc20}/erc20.d.ts +6 -5
  13. package/dist/integrations/erc20/erc20.d.ts.map +1 -0
  14. package/dist/integrations/erc20/index.d.ts +3 -0
  15. package/dist/integrations/erc20/index.d.ts.map +1 -0
  16. package/dist/integrations/gmx/gmx.d.ts +6 -6
  17. package/dist/integrations/gmx/gmx.d.ts.map +1 -1
  18. package/dist/integrations/gmx/index.d.ts +1 -1
  19. package/dist/integrations/gmx/index.d.ts.map +1 -1
  20. package/dist/integrations/gnosis/gnosis.d.ts +3 -3
  21. package/dist/integrations/gnosis/gnosis.d.ts.map +1 -1
  22. package/dist/integrations/gnosis/gnosis.multisend.d.ts +5 -5
  23. package/dist/integrations/gnosis/gnosis.multisend.d.ts.map +1 -1
  24. package/dist/integrations/gnosis/index.d.ts +1 -1
  25. package/dist/integrations/gnosis/index.d.ts.map +1 -1
  26. package/dist/integrations/index.d.ts +1 -0
  27. package/dist/integrations/index.d.ts.map +1 -1
  28. package/dist/integrations/lagoonV1/lagoon.v1.d.ts +7 -7
  29. package/dist/integrations/lagoonV1/lagoon.v1.d.ts.map +1 -1
  30. package/dist/integrations/lendleV1/index.d.ts +1 -1
  31. package/dist/integrations/lendleV1/index.d.ts.map +1 -1
  32. package/dist/integrations/lendleV1/lendle.v1.d.ts +9 -9
  33. package/dist/integrations/lendleV1/lendle.v1.d.ts.map +1 -1
  34. package/dist/integrations/morphoBlue/index.d.ts +1 -1
  35. package/dist/integrations/morphoBlue/index.d.ts.map +1 -1
  36. package/dist/integrations/morphoBlue/morpho.blue.d.ts +7 -7
  37. package/dist/integrations/morphoBlue/morpho.blue.d.ts.map +1 -1
  38. package/dist/integrations/permit2/index.d.ts +1 -1
  39. package/dist/integrations/permit2/index.d.ts.map +1 -1
  40. package/dist/integrations/permit2/permit2.d.ts +2 -2
  41. package/dist/integrations/permit2/permit2.d.ts.map +1 -1
  42. package/dist/integrations/uniswapV3/index.d.ts +4 -3
  43. package/dist/integrations/uniswapV3/index.d.ts.map +1 -1
  44. package/dist/integrations/uniswapV3/{swap.router.abi.d.ts → swap.router.01.abi.d.ts} +1 -1
  45. package/dist/integrations/uniswapV3/{swap.router.abi.d.ts.map → swap.router.01.abi.d.ts.map} +1 -1
  46. package/dist/integrations/uniswapV3/swap.router.02.abi.d.ts +822 -0
  47. package/dist/integrations/uniswapV3/swap.router.02.abi.d.ts.map +1 -0
  48. package/dist/integrations/uniswapV3/uniswap.v3.d.ts +26 -17
  49. package/dist/integrations/uniswapV3/uniswap.v3.d.ts.map +1 -1
  50. package/dist/integrations/uniswapV4/index.d.ts +3 -3
  51. package/dist/integrations/uniswapV4/index.d.ts.map +1 -1
  52. package/dist/integrations/uniswapV4/uniswap.v4.d.ts +3 -3
  53. package/dist/integrations/uniswapV4/uniswap.v4.d.ts.map +1 -1
  54. package/dist/integrations/zodiac/delay/index.d.ts +1 -1
  55. package/dist/integrations/zodiac/delay/index.d.ts.map +1 -1
  56. package/dist/integrations/zodiac/delay/zodiac.delay.d.ts +3 -3
  57. package/dist/integrations/zodiac/delay/zodiac.delay.d.ts.map +1 -1
  58. package/dist/integrations/zodiac/roles/index.d.ts +1 -1
  59. package/dist/integrations/zodiac/roles/index.d.ts.map +1 -1
  60. package/dist/integrations/zodiac/roles/zodiac.roles.d.ts +15 -4
  61. package/dist/integrations/zodiac/roles/zodiac.roles.d.ts.map +1 -1
  62. package/dist/lib/index.d.ts +0 -1
  63. package/dist/lib/index.d.ts.map +1 -1
  64. package/dist/lib/native.eth.d.ts +2 -2
  65. package/dist/lib/native.eth.d.ts.map +1 -1
  66. package/dist/types/primitives.d.ts +11 -8
  67. package/dist/types/primitives.d.ts.map +1 -1
  68. package/package.json +1 -1
  69. package/src/abi/index.ts +0 -1
  70. package/src/integrations/aaveV3/aave.v3.ts +17 -17
  71. package/src/integrations/aaveV3/index.ts +2 -2
  72. package/src/{lib → integrations/erc20}/erc20.ts +35 -13
  73. package/src/integrations/erc20/index.ts +2 -0
  74. package/src/integrations/gmx/gmx.ts +17 -11
  75. package/src/integrations/gmx/index.ts +1 -1
  76. package/src/integrations/gnosis/gnosis.multisend.ts +10 -11
  77. package/src/integrations/gnosis/gnosis.ts +6 -6
  78. package/src/integrations/gnosis/index.ts +1 -1
  79. package/src/integrations/index.ts +1 -0
  80. package/src/integrations/lagoonV1/lagoon.v1.ts +27 -13
  81. package/src/integrations/lendleV1/index.ts +1 -1
  82. package/src/integrations/lendleV1/lendle.v1.ts +39 -15
  83. package/src/integrations/morphoBlue/index.ts +1 -1
  84. package/src/integrations/morphoBlue/morpho.blue.ts +78 -25
  85. package/src/integrations/permit2/index.ts +1 -1
  86. package/src/integrations/permit2/permit2.ts +6 -6
  87. package/src/integrations/uniswapV3/index.ts +4 -3
  88. package/src/integrations/uniswapV3/swap.router.02.abi.ts +764 -0
  89. package/src/integrations/uniswapV3/uniswap.v3.ts +93 -40
  90. package/src/integrations/uniswapV4/index.ts +3 -3
  91. package/src/integrations/uniswapV4/uniswap.v4.ts +9 -9
  92. package/src/integrations/zodiac/delay/index.ts +1 -1
  93. package/src/integrations/zodiac/delay/zodiac.delay.ts +9 -9
  94. package/src/integrations/zodiac/roles/index.ts +1 -1
  95. package/src/integrations/zodiac/roles/zodiac.roles.ts +51 -12
  96. package/src/lib/contractsRegistry.json +35 -12
  97. package/src/lib/index.ts +0 -1
  98. package/src/lib/native.eth.ts +4 -4
  99. package/src/types/primitives.ts +28 -4
  100. package/dist/abi/erc20.abi.d.ts.map +0 -1
  101. package/dist/lib/erc20.d.ts.map +0 -1
  102. /package/dist/{abi → integrations/erc20}/erc20.abi.d.ts +0 -0
  103. /package/src/{abi → integrations/erc20}/erc20.abi.ts +0 -0
  104. /package/src/integrations/uniswapV3/{swap.router.abi.ts → swap.router.01.abi.ts} +0 -0
@@ -1,37 +1,44 @@
1
1
  import type { Address } from "viem";
2
2
  import { Wallet, ethers } from "ethers";
3
- import type { Call, HexString } from "../../types";
4
- import UniswapRouter from "./swap.router.abi";
5
- import PositionManager from "./position.manager.abi";
3
+ import { type Call, createCall, type HexString, type Unwrapable } from "../../types";
4
+ import UniswapV3Router01Abi from "./swap.router.01.abi.ts";
5
+ import UniswapV3Router02Abi from "./swap.router.02.abi.ts";
6
+ import UniswapV3PositionManagerAbi from "./position.manager.abi.ts";
6
7
  import type { FeeAmount } from "@uniswap/v3-sdk";
7
8
 
8
- const swapRouterInterface = new ethers.utils.Interface(UniswapRouter);
9
- const positionManagerInterface = new ethers.utils.Interface(PositionManager);
9
+ const swapRouter01Interface = new ethers.utils.Interface(UniswapV3Router01Abi);
10
+ const swapRouter02Interface = new ethers.utils.Interface(UniswapV3Router02Abi);
11
+ const positionManagerInterface = new ethers.utils.Interface(UniswapV3PositionManagerAbi);
10
12
 
11
- export type UniswapV3SwapArgs = Readonly<{
13
+ export type UniswapV3BaseSwapArgs = Readonly<{
12
14
  tokenIn: Address;
13
15
  tokenOut: Address;
14
16
  fee: FeeAmount;
15
17
  recipient: Address | Wallet;
16
- deadline: bigint;
17
18
  sqrtPriceLimitX96: bigint;
18
19
  }>;
19
20
 
20
- export type UniswapV3ExactInputSingleArgs = Readonly<
21
+ export type UniswapV3Router01ExactInputSingleArgs = Readonly<
21
22
  {
22
23
  amountIn: bigint;
23
24
  amountOutMinimum: bigint;
24
- } & UniswapV3SwapArgs
25
+ deadline: bigint;
26
+ } & UniswapV3BaseSwapArgs
25
27
  >;
26
28
 
27
- export type UniswapV3ExactOutputSingleArgs = Readonly<
29
+ export type UniswapV3Router01ExactOutputSingleArgs = Readonly<
28
30
  {
29
31
  amountOut: bigint;
30
32
  amountInMaximum: bigint;
31
- } & UniswapV3SwapArgs
33
+ deadline: bigint;
34
+ } & UniswapV3BaseSwapArgs
32
35
  >;
33
36
 
34
- export const SwapExactInputSingleCalldata = ({
37
+ export type UniswapV3Router02ExactInputSingleArgs = Readonly<Omit<UniswapV3Router01ExactInputSingleArgs, "deadline">>;
38
+
39
+ export type UniswapV3Router02ExactOutputSingleArgs = Readonly<Omit<UniswapV3Router01ExactOutputSingleArgs, "deadline">>;
40
+
41
+ export const Router01SwapExactInputSingleCalldata = ({
35
42
  tokenIn,
36
43
  tokenOut,
37
44
  fee,
@@ -40,13 +47,13 @@ export const SwapExactInputSingleCalldata = ({
40
47
  amountIn,
41
48
  amountOutMinimum,
42
49
  sqrtPriceLimitX96,
43
- }: UniswapV3ExactInputSingleArgs): HexString => {
44
- return swapRouterInterface.encodeFunctionData("exactInputSingle", [
50
+ }: UniswapV3Router01ExactInputSingleArgs): HexString => {
51
+ return swapRouter01Interface.encodeFunctionData("exactInputSingle", [
45
52
  [tokenIn, tokenOut, fee, recipient, deadline, amountIn, amountOutMinimum, sqrtPriceLimitX96],
46
53
  ]) as HexString;
47
54
  };
48
55
 
49
- export const SwapExactOutputSingleCalldata = ({
56
+ export const Router01SwapExactOutputSingleCalldata = ({
50
57
  tokenIn,
51
58
  tokenOut,
52
59
  fee,
@@ -55,28 +62,74 @@ export const SwapExactOutputSingleCalldata = ({
55
62
  amountOut,
56
63
  amountInMaximum,
57
64
  sqrtPriceLimitX96,
58
- }: UniswapV3ExactOutputSingleArgs): HexString => {
59
- return swapRouterInterface.encodeFunctionData("exactOutputSingle", [
65
+ }: UniswapV3Router01ExactOutputSingleArgs): HexString => {
66
+ return swapRouter01Interface.encodeFunctionData("exactOutputSingle", [
60
67
  [tokenIn, tokenOut, fee, recipient, deadline, amountOut, amountInMaximum, sqrtPriceLimitX96],
61
68
  ]) as HexString;
62
69
  };
63
70
 
64
- export const swapTrx = ({
71
+ export const Router02SwapExactOutputSingleCalldata = ({
72
+ tokenIn,
73
+ tokenOut,
74
+ fee,
75
+ recipient,
76
+ amountOut,
77
+ amountInMaximum,
78
+ sqrtPriceLimitX96,
79
+ }: UniswapV3Router02ExactOutputSingleArgs): HexString => {
80
+ return swapRouter02Interface.encodeFunctionData("exactOutputSingle", [
81
+ [tokenIn, tokenOut, fee, recipient, amountOut, amountInMaximum, sqrtPriceLimitX96],
82
+ ]) as HexString;
83
+ };
84
+
85
+ export const Router02SwapExactInputCalldata = ({
86
+ tokenIn,
87
+ tokenOut,
88
+ fee,
89
+ recipient,
90
+ amountIn,
91
+ amountOutMinimum,
92
+ sqrtPriceLimitX96,
93
+ }: UniswapV3Router02ExactInputSingleArgs): HexString => {
94
+ return swapRouter02Interface.encodeFunctionData("exactInputSingle", [
95
+ [tokenIn, tokenOut, fee, recipient, amountIn, amountOutMinimum, sqrtPriceLimitX96],
96
+ ]) as HexString;
97
+ };
98
+
99
+ export const swapExactInputSingleTrx = ({
100
+ swapParams,
101
+ swapRouter,
102
+ }: {
103
+ swapParams: UniswapV3Router01ExactInputSingleArgs | UniswapV3Router02ExactInputSingleArgs;
104
+ swapRouter: Address;
105
+ }): Unwrapable<Call> => {
106
+ return createCall({
107
+ to: swapRouter,
108
+ data:
109
+ "deadline" in swapParams
110
+ ? Router01SwapExactInputSingleCalldata(swapParams)
111
+ : Router02SwapExactInputCalldata(swapParams),
112
+ value: 0n,
113
+ operation: 0,
114
+ });
115
+ };
116
+
117
+ export const swapExactOutputSingleTrx = ({
65
118
  swapParams,
66
119
  swapRouter,
67
120
  }: {
68
- swapParams: UniswapV3ExactInputSingleArgs | UniswapV3ExactOutputSingleArgs;
121
+ swapParams: UniswapV3Router01ExactOutputSingleArgs | UniswapV3Router02ExactOutputSingleArgs;
69
122
  swapRouter: Address;
70
- }): Call => {
71
- return {
123
+ }): Unwrapable<Call> => {
124
+ return createCall({
72
125
  to: swapRouter,
73
126
  data:
74
- "amountIn" in swapParams
75
- ? SwapExactInputSingleCalldata(swapParams as UniswapV3ExactInputSingleArgs)
76
- : SwapExactOutputSingleCalldata(swapParams as UniswapV3ExactOutputSingleArgs),
127
+ "deadline" in swapParams
128
+ ? Router01SwapExactOutputSingleCalldata(swapParams)
129
+ : Router02SwapExactOutputSingleCalldata(swapParams),
77
130
  value: 0n,
78
131
  operation: 0,
79
- };
132
+ });
80
133
  };
81
134
 
82
135
  export type UniswapMintPositionArgs = Readonly<{
@@ -129,13 +182,13 @@ export const mintPositionTrx = ({
129
182
  }: {
130
183
  mintParams: UniswapMintPositionArgs;
131
184
  positionManager: Address;
132
- }): Call => {
133
- return {
185
+ }): Unwrapable<Call> => {
186
+ return createCall({
134
187
  to: positionManager,
135
188
  data: MintPositionCalldata(mintParams),
136
189
  value: 0n,
137
190
  operation: 0,
138
- };
191
+ });
139
192
  };
140
193
 
141
194
  export type UniswapIncreaseLiquidityArgs = Readonly<{
@@ -166,13 +219,13 @@ export const increaseLiquidityTrx = ({
166
219
  }: {
167
220
  increaseParams: UniswapIncreaseLiquidityArgs;
168
221
  positionManager: Address;
169
- }): Call => {
170
- return {
222
+ }): Unwrapable<Call> => {
223
+ return createCall({
171
224
  to: positionManager,
172
225
  data: IncreaseLiquidityCalldata(increaseParams),
173
226
  value: 0n,
174
227
  operation: 0,
175
- };
228
+ });
176
229
  };
177
230
 
178
231
  export type UniswapDecreaseLiquidityArgs = Readonly<{
@@ -201,13 +254,13 @@ export const decreaseLiquidityTrx = ({
201
254
  }: {
202
255
  decreaseParams: UniswapDecreaseLiquidityArgs;
203
256
  positionManager: Address;
204
- }): Call => {
205
- return {
257
+ }): Unwrapable<Call> => {
258
+ return createCall({
206
259
  to: positionManager,
207
260
  data: DecreaseLiquidityCalldata(decreaseParams),
208
261
  value: 0n,
209
262
  operation: 0,
210
- };
263
+ });
211
264
  };
212
265
 
213
266
  export type UniswapBurnPositionArgs = Readonly<{
@@ -224,13 +277,13 @@ export const burnPositionTrx = ({
224
277
  }: {
225
278
  burnParams: UniswapBurnPositionArgs;
226
279
  positionManager: Address;
227
- }): Call => {
228
- return {
280
+ }): Unwrapable<Call> => {
281
+ return createCall({
229
282
  to: positionManager,
230
283
  data: BurnPositionCalldata(burnParams),
231
284
  value: 0n,
232
285
  operation: 0,
233
- };
286
+ });
234
287
  };
235
288
 
236
289
  export type UniswapCollectFeesArgs = Readonly<{
@@ -257,11 +310,11 @@ export const collectFeesTrx = ({
257
310
  }: {
258
311
  collectParams: UniswapCollectFeesArgs;
259
312
  positionManager: Address;
260
- }): Call => {
261
- return {
313
+ }): Unwrapable<Call> => {
314
+ return createCall({
262
315
  to: positionManager,
263
316
  data: CollectFeesCalldata(collectParams),
264
317
  value: 0n,
265
318
  operation: 0,
266
- };
319
+ });
267
320
  };
@@ -1,5 +1,5 @@
1
1
  export * from "./uniswap.v4";
2
2
  export * from "./types";
3
- export { default as UniswapV4PositionManager } from "./position.manager.abi";
4
- export { default as UniswapV4Router } from "./swap.router.abi";
5
- export { default as UniswapV4Pool } from "./pool.manager.abi";
3
+ export { default as UniswapV4PositionManagerAbi } from "./position.manager.abi";
4
+ export { default as UniswapV4RouterAbi } from "./swap.router.abi";
5
+ export { default as UniswapV4PoolAbi } from "./pool.manager.abi";
@@ -1,7 +1,7 @@
1
1
  import type { Address } from "viem";
2
2
  import { ethers } from "ethers";
3
- import type { Call, HexString } from "../../types";
4
- import UniswapRouter from "./swap.router.abi";
3
+ import { type Call, type HexString, type Unwrapable, createCall } from "../../types";
4
+ import UniswapV4RouterAbi from "./swap.router.abi.ts";
5
5
  import { toHex } from "@uniswap/v3-sdk";
6
6
  import { V4PositionManager, V4Planner, toAddress, Pool } from "@uniswap/v4-sdk";
7
7
  import type { Hex } from "viem";
@@ -16,7 +16,7 @@ import {
16
16
  type CollectInputV4,
17
17
  } from "./types";
18
18
 
19
- const swapRouterInterface = new ethers.utils.Interface(UniswapRouter);
19
+ const swapRouterInterface = new ethers.utils.Interface(UniswapV4RouterAbi);
20
20
 
21
21
  /*
22
22
  * this is the calldata for the swap exact input single
@@ -111,13 +111,13 @@ export function finalizeActionsV4(
111
111
  deadline: number,
112
112
  positionManagerAddress: Address,
113
113
  value: bigint,
114
- ): Call {
115
- return {
114
+ ): Unwrapable<Call> {
115
+ return createCall({
116
116
  to: positionManagerAddress,
117
117
  data: V4PositionManager.encodeModifyLiquidities(planner.finalize(), deadline) as Hex,
118
118
  value: value,
119
119
  operation: 0,
120
- };
120
+ });
121
121
  }
122
122
 
123
123
  /**
@@ -194,11 +194,11 @@ export const swapTrxV4 = ({
194
194
  swapParams: UniswapExactInputSingleParamsV4;
195
195
  swapRouter: Address;
196
196
  value?: bigint;
197
- }): Call => {
198
- return {
197
+ }): Unwrapable<Call> => {
198
+ return createCall({
199
199
  to: swapRouter,
200
200
  data: SwapExactInputSingleCalldataV4(swapParams),
201
201
  value: value,
202
202
  operation: 0,
203
- };
203
+ });
204
204
  };
@@ -1,2 +1,2 @@
1
- export * from "./zodiac.delay.abi";
1
+ export { default as ZodiacDelayAbi } from "./zodiac.delay.abi";
2
2
  export * from "./zodiac.delay";
@@ -1,9 +1,9 @@
1
1
  import { ethers } from "ethers";
2
- import ZodiacDelay from "./zodiac.delay.abi";
3
- import type { HexString, Call } from "damm-sdk";
2
+ import ZodiacDelayAbi from "./zodiac.delay.abi.ts";
3
+ import { type Call, type HexString, type Unwrapable, createCall } from "../../../types";
4
4
  import type { Address } from "viem";
5
5
 
6
- const zodiacDelayInterface = new ethers.utils.Interface(ZodiacDelay);
6
+ const zodiacDelayInterface = new ethers.utils.Interface(ZodiacDelayAbi);
7
7
 
8
8
  export type DelayedTransactionArgs = Readonly<{
9
9
  to: Address;
@@ -27,15 +27,15 @@ export const execTransactionWithDelay = ({
27
27
  }: {
28
28
  args: DelayedTransactionArgs;
29
29
  delayModuleAddress: Address;
30
- }): Call => {
30
+ }): Unwrapable<Call> => {
31
31
  const data = DelayedTransactionCalldata(args);
32
32
 
33
- return {
33
+ return createCall({
34
34
  operation: 0,
35
35
  to: delayModuleAddress,
36
36
  value: 0n,
37
37
  data,
38
- };
38
+ });
39
39
  };
40
40
 
41
41
  export const NextTxCalldata = ({ to, value, data, operation }: DelayedTransactionArgs): HexString => {
@@ -48,13 +48,13 @@ export const executeNextTx = ({
48
48
  }: {
49
49
  args: DelayedTransactionArgs;
50
50
  delayModuleAddress: Address;
51
- }): Call => {
51
+ }): Unwrapable<Call> => {
52
52
  const data = NextTxCalldata(args);
53
53
 
54
- return {
54
+ return createCall({
55
55
  operation: 0,
56
56
  to: delayModuleAddress,
57
57
  value: 0n,
58
58
  data,
59
- };
59
+ });
60
60
  };
@@ -1,2 +1,2 @@
1
1
  export * from "./zodiac.roles.ts";
2
- export { default as ZodiacRoles } from "./zodiac.roles.abi.ts";
2
+ export { default as ZodiacRolesAbi } from "./zodiac.roles.abi.ts";
@@ -1,9 +1,9 @@
1
1
  import { ethers } from "ethers";
2
- import ZodiacRoles from "./zodiac.roles.abi.ts";
3
- import type { HexString, Call } from "damm-sdk";
2
+ import ZodiacRolesAbi from "./zodiac.roles.abi.ts";
3
+ import { type HexString, type Call, createCall, type Unwrapable } from "../../../types";
4
4
  import type { Address } from "viem";
5
5
 
6
- const zodiacRolesInterface = new ethers.utils.Interface(ZodiacRoles);
6
+ const zodiacRolesInterface = new ethers.utils.Interface(ZodiacRolesAbi);
7
7
 
8
8
  export type ExecWithRoleArgs = Readonly<{
9
9
  to: Address;
@@ -32,21 +32,60 @@ export const TransactionWithRoleCalldata = ({
32
32
  ]) as HexString;
33
33
  };
34
34
 
35
+ export const setUpTransactionUnwrapperCalldata = ({
36
+ multisendAddress,
37
+ multisendUnwrapperAddress,
38
+ multisendSelector,
39
+ }: {
40
+ multisendAddress: Address;
41
+ multisendUnwrapperAddress: Address;
42
+ multisendSelector: HexString;
43
+ }): HexString => {
44
+ return zodiacRolesInterface.encodeFunctionData("setTransactionUnwrapper", [
45
+ multisendAddress,
46
+ multisendSelector,
47
+ multisendUnwrapperAddress,
48
+ ]) as HexString;
49
+ };
50
+
51
+ export const setUpTransactionUnwrapper = ({
52
+ rolesModAddress,
53
+ multisendAddress,
54
+ multisendUnwrapperAddress,
55
+ multisendSelector,
56
+ }: {
57
+ rolesModAddress: Address;
58
+ multisendAddress: Address;
59
+ multisendUnwrapperAddress: Address;
60
+ multisendSelector: HexString;
61
+ }): Unwrapable<Call> => {
62
+ return createCall({
63
+ to: rolesModAddress,
64
+ data: setUpTransactionUnwrapperCalldata({
65
+ multisendAddress,
66
+ multisendUnwrapperAddress,
67
+ multisendSelector,
68
+ }),
69
+ value: 0n,
70
+ operation: 0,
71
+ });
72
+ };
73
+
35
74
  export const execWithRoleTrx = ({
36
75
  args,
37
76
  rolesModAddress,
38
77
  }: {
39
78
  args: ExecWithRoleArgs;
40
79
  rolesModAddress: Address;
41
- }): Call => {
80
+ }): Unwrapable<Call> => {
42
81
  const data = TransactionWithRoleCalldata(args);
43
82
 
44
- return {
83
+ return createCall({
45
84
  operation: 0,
46
85
  to: rolesModAddress,
47
86
  value: 0n,
48
87
  data,
49
- };
88
+ });
50
89
  };
51
90
 
52
91
  export type ExecWithRoleReturnDataArgs = Readonly<{
@@ -82,15 +121,15 @@ export const execWithRoleReturnDataTrx = ({
82
121
  }: {
83
122
  args: ExecWithRoleReturnDataArgs;
84
123
  rolesModAddress: Address;
85
- }): Call => {
124
+ }): Unwrapable<Call> => {
86
125
  const data = TransactionWithRoleReturnDataCalldata(args);
87
126
 
88
- return {
127
+ return createCall({
89
128
  operation: 0,
90
129
  to: rolesModAddress,
91
130
  value: 0n,
92
131
  data,
93
- };
132
+ });
94
133
  };
95
134
 
96
135
  export type ExecTransactionFromModuleArgs = Readonly<{
@@ -120,13 +159,13 @@ export const execTransactionFromModuleTrx = ({
120
159
  }: {
121
160
  args: ExecTransactionFromModuleArgs;
122
161
  rolesModAddress: Address;
123
- }): Call => {
162
+ }): Unwrapable<Call> => {
124
163
  const data = TransactionFromModuleCalldata(args);
125
164
 
126
- return {
165
+ return createCall({
127
166
  operation: 0,
128
167
  to: rolesModAddress,
129
168
  value: 0n,
130
169
  data,
131
- };
170
+ });
132
171
  };
@@ -40,7 +40,8 @@
40
40
  "zodiac": {
41
41
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
42
42
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
43
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
43
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
44
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
44
45
  },
45
46
  "multicall3": "0xcA11bde05977b3631167028862bE2a173976CA11",
46
47
  "permit2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
@@ -100,7 +101,8 @@
100
101
  "zodiac": {
101
102
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
102
103
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
103
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
104
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
105
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
104
106
  },
105
107
  "1inch": {
106
108
  "aggregatorV6": "0x111111125421cA6dc452d289314280a0f8842A65"
@@ -135,7 +137,8 @@
135
137
  "zodiac": {
136
138
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
137
139
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
138
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
140
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
141
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
139
142
  },
140
143
  "1inch": {
141
144
  "aggregatorV6": "0x111111125421cA6dc452d289314280a0f8842A65"
@@ -168,7 +171,8 @@
168
171
  "zodiac": {
169
172
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
170
173
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
171
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
174
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
175
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
172
176
  },
173
177
  "1inch": {
174
178
  "aggregatorV6": "0x111111125421cA6dc452d289314280a0f8842A65"
@@ -176,9 +180,14 @@
176
180
  "wrappedNativeToken": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
177
181
  },
178
182
  "optimism": {
183
+ "aaveV3": {
184
+ "pool": "0x794a61358D6845594F94dc1DB02A252b5b4814aD"
185
+ },
179
186
  "tokens": {
180
187
  "usdc": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
181
- "usdt": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"
188
+ "usdt": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
189
+ "velo": "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05",
190
+ "weth": "0x4200000000000000000000000000000000000006"
182
191
  },
183
192
  "gnosisSafe": {
184
193
  "v1_4_1": {
@@ -190,7 +199,11 @@
190
199
  },
191
200
  "zodiac": {
192
201
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
193
- "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236"
202
+ "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
203
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
204
+ },
205
+ "enso": {
206
+ "routerV2": "0xF75584eF6673aD213a685a1B58Cc0330B8eA22Cf"
194
207
  },
195
208
  "permit2": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
196
209
  "multicall3": "0xcA11bde05977b3631167028862bE2a173976CA11",
@@ -200,7 +213,12 @@
200
213
  "morpho": {
201
214
  "morphoBlue": "0xce95AfbB8EA029495c66020883F87aaE8864AF92"
202
215
  },
203
- "poster": "0x000000000000cd17345801aa8147b8D3950260FF"
216
+ "poster": "0x000000000000cd17345801aa8147b8D3950260FF",
217
+ "wrappedNativeToken": "0x4200000000000000000000000000000000000006",
218
+ "slipstream": {
219
+ "router": "0x0792a633F0c19c351081CF4B211F68F79bCc9676",
220
+ "positionManager": "0x416b433906b1B72FA758e166e239c43d68dC6F29"
221
+ }
204
222
  },
205
223
  "mainnet": {
206
224
  "uniswapV3": {
@@ -236,7 +254,8 @@
236
254
  },
237
255
  "zodiac": {
238
256
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
239
- "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236"
257
+ "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
258
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
240
259
  },
241
260
  "morpho": {
242
261
  "morphoBlue": "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb"
@@ -272,7 +291,8 @@
272
291
  "zodiac": {
273
292
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
274
293
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
275
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
294
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
295
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
276
296
  },
277
297
  "gnosisSafe": {
278
298
  "v1_4_1": {
@@ -310,7 +330,8 @@
310
330
  "zodiac": {
311
331
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
312
332
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
313
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
333
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
334
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
314
335
  },
315
336
  "tokens": {
316
337
  "ausd": "0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a",
@@ -349,7 +370,8 @@
349
370
  "zodiac": {
350
371
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
351
372
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
352
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
373
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
374
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
353
375
  },
354
376
  "morpho": {
355
377
  "morphoBlue": "0xE741BC7c34758b4caE05062794E8Ae24978AF432"
@@ -383,7 +405,8 @@
383
405
  "zodiac": {
384
406
  "rolesModule": "0x9646fDAD06d3e24444381f44362a3B0eB343D337",
385
407
  "moduleProxyFactory": "0x000000000000aDdB49795b0f9bA5BC298cDda236",
386
- "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b"
408
+ "delayModule": "0x01F8cabB808D7dE0dF4202D4B60C8310d2f1339b",
409
+ "multisendUnwrapper": "0x93B7fCbc63ED8a3a24B59e1C3e6649D50B7427c0"
387
410
  },
388
411
  "gnosisSafe": {
389
412
  "v1_4_1": {
package/src/lib/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./constants";
2
- export * from "./erc20";
3
2
  export * from "./utils";
4
3
  export * from "./native.eth";
5
4
  export * from "./transaction.simulation";
@@ -1,11 +1,11 @@
1
1
  import type { Address } from "viem";
2
- import type { Call } from "..";
2
+ import { type Call, type Unwrapable, createCall } from "../types";
3
3
 
4
- export const transferNativeEth = ({ to, amount }: { to: Address; amount: bigint }): Call => {
5
- return {
4
+ export const transferNativeEth = ({ to, amount }: { to: Address; amount: bigint }): Unwrapable<Call> => {
5
+ return createCall({
6
6
  to,
7
7
  operation: 0,
8
8
  value: amount,
9
9
  data: "0x",
10
- };
10
+ });
11
11
  };
@@ -2,13 +2,37 @@ import type { Address } from "viem";
2
2
 
3
3
  export type HexString = `0x${string}`;
4
4
 
5
- export type ExternalCall = Readonly<{
6
- operation: 0 | 1;
5
+ export type Operation = 0 | 1;
6
+
7
+ export type Transaction = Readonly<{
7
8
  to: Address;
8
9
  value: bigint;
9
10
  data: HexString;
10
11
  }>;
11
12
 
12
- export type DelegateCall = Readonly<{ operation: 1 } & ExternalCall>;
13
+ export type ExternalCall<T extends Operation> = Readonly<
14
+ {
15
+ operation: T;
16
+ } & Transaction
17
+ >;
18
+
19
+ export type DelegateCall = ExternalCall<1>;
20
+
21
+ export type Call = ExternalCall<0>;
22
+
23
+ export type Unwrapable<T extends ExternalCall<Operation>> = T & {
24
+ unwrap: () => Transaction;
25
+ };
13
26
 
14
- export type Call = Readonly<{ operation: 0 } & ExternalCall>;
27
+ export const createCall = <T extends Operation>(call: ExternalCall<T>): Unwrapable<ExternalCall<T>> => {
28
+ return {
29
+ ...call,
30
+ unwrap: () => {
31
+ return {
32
+ to: call.to,
33
+ value: call.value,
34
+ data: call.data,
35
+ };
36
+ },
37
+ };
38
+ };
@@ -1 +0,0 @@
1
- {"version":3,"file":"erc20.abi.d.ts","sourceRoot":"","sources":["../../src/abi/erc20.abi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBA6NW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../src/lib/erc20.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIhD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,eAAO,MAAM,gBAAgB,0BAA2B,KAAK,iBAAiB,EAAE,OAAO,CAAC,KAAG,SAE1F,CAAC;AAEF,eAAO,MAAM,gBAAgB,iCAAkC,iBAAiB,KAAG,IAOlF,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,eAAO,MAAM,eAAe,wBAAyB,KAAK,gBAAgB,EAAE,OAAO,CAAC,KAAG,SAEtF,CAAC;AAEF,eAAO,MAAM,eAAe,+BAAgC,gBAAgB,KAAG,IAO9E,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,eAAO,MAAM,oBAAoB,oCAI9B,KAAK,qBAAqB,EAAE,OAAO,CAAC,KAAG,SAEzC,CAAC;AAEF,eAAO,MAAM,oBAAoB,0CAA2C,qBAAqB,KAAG,IAOnG,CAAC"}