damm-sdk 1.3.3 → 1.3.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.
@@ -19,4 +19,5 @@ export * from "./iporFusion";
19
19
  export * from "./originArm";
20
20
  export * from "./syrup";
21
21
  export * from "./gearbox";
22
+ export * from "./weth";
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as WethAbi } from "./weth.abi";
2
+ export * from "./weth";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/weth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;AAChD,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,33 @@
1
+ declare const _default: readonly [{
2
+ readonly inputs: readonly [];
3
+ readonly name: "deposit";
4
+ readonly outputs: readonly [];
5
+ readonly stateMutability: "payable";
6
+ readonly type: "function";
7
+ }, {
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "uint256";
10
+ readonly name: "wad";
11
+ readonly type: "uint256";
12
+ }];
13
+ readonly name: "withdraw";
14
+ readonly outputs: readonly [];
15
+ readonly stateMutability: "nonpayable";
16
+ readonly type: "function";
17
+ }, {
18
+ readonly inputs: readonly [{
19
+ readonly internalType: "address";
20
+ readonly name: "";
21
+ readonly type: "address";
22
+ }];
23
+ readonly name: "balanceOf";
24
+ readonly outputs: readonly [{
25
+ readonly internalType: "uint256";
26
+ readonly name: "";
27
+ readonly type: "uint256";
28
+ }];
29
+ readonly stateMutability: "view";
30
+ readonly type: "function";
31
+ }];
32
+ export default _default;
33
+ //# sourceMappingURL=weth.abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weth.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/weth/weth.abi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAsBW"}
@@ -0,0 +1,15 @@
1
+ import type { Address } from "viem";
2
+ import { type Call, type HexString, type Unwrapable } from "../../types";
3
+ export type WrapEthArgs = Readonly<{
4
+ weth: Address;
5
+ amount: bigint;
6
+ }>;
7
+ export declare const WrapEthCalldata: () => HexString;
8
+ export declare const wrapEthTrx: ({ weth, amount }: WrapEthArgs) => Unwrapable<Call>;
9
+ export type UnwrapWethArgs = Readonly<{
10
+ weth: Address;
11
+ amount: bigint;
12
+ }>;
13
+ export declare const UnwrapWethCalldata: ({ amount }: Omit<UnwrapWethArgs, "weth">) => HexString;
14
+ export declare const unwrapWethTrx: ({ weth, amount }: UnwrapWethArgs) => Unwrapable<Call>;
15
+ //# sourceMappingURL=weth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"weth.d.ts","sourceRoot":"","sources":["../../../src/integrations/weth/weth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAc,MAAM,aAAa,CAAC;AAKrF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,eAAO,MAAM,eAAe,QAAO,SAElC,CAAC;AAEF,eAAO,MAAM,UAAU,qBAAsB,WAAW,KAAG,WAAW,IAAI,CAOzE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,eAAO,MAAM,kBAAkB,eAAgB,KAAK,cAAc,EAAE,MAAM,CAAC,KAAG,SAE7E,CAAC;AAEF,eAAO,MAAM,aAAa,qBAAsB,cAAc,KAAG,WAAW,IAAI,CAO/E,CAAC"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",
7
- "version": "1.3.3",
7
+ "version": "1.3.4",
8
8
  "files": [
9
9
  "dist",
10
10
  "src",
@@ -19,3 +19,4 @@ export * from "./iporFusion";
19
19
  export * from "./originArm";
20
20
  export * from "./syrup";
21
21
  export * from "./gearbox";
22
+ export * from "./weth";
@@ -0,0 +1,2 @@
1
+ export { default as WethAbi } from "./weth.abi";
2
+ export * from "./weth";
@@ -0,0 +1,23 @@
1
+ export default [
2
+ {
3
+ inputs: [],
4
+ name: "deposit",
5
+ outputs: [],
6
+ stateMutability: "payable",
7
+ type: "function",
8
+ },
9
+ {
10
+ inputs: [{ internalType: "uint256", name: "wad", type: "uint256" }],
11
+ name: "withdraw",
12
+ outputs: [],
13
+ stateMutability: "nonpayable",
14
+ type: "function",
15
+ },
16
+ {
17
+ inputs: [{ internalType: "address", name: "", type: "address" }],
18
+ name: "balanceOf",
19
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
20
+ stateMutability: "view",
21
+ type: "function",
22
+ },
23
+ ] as const;
@@ -0,0 +1,42 @@
1
+ import { ethers } from "ethers";
2
+ import type { Address } from "viem";
3
+ import { type Call, type HexString, type Unwrapable, createCall } from "../../types";
4
+ import WethAbi from "./weth.abi.ts";
5
+
6
+ const wethInterface = new ethers.utils.Interface(WethAbi);
7
+
8
+ export type WrapEthArgs = Readonly<{
9
+ weth: Address;
10
+ amount: bigint;
11
+ }>;
12
+
13
+ export const WrapEthCalldata = (): HexString => {
14
+ return wethInterface.encodeFunctionData("deposit") as HexString;
15
+ };
16
+
17
+ export const wrapEthTrx = ({ weth, amount }: WrapEthArgs): Unwrapable<Call> => {
18
+ return createCall({
19
+ to: weth,
20
+ data: WrapEthCalldata(),
21
+ value: amount,
22
+ operation: 0,
23
+ });
24
+ };
25
+
26
+ export type UnwrapWethArgs = Readonly<{
27
+ weth: Address;
28
+ amount: bigint;
29
+ }>;
30
+
31
+ export const UnwrapWethCalldata = ({ amount }: Omit<UnwrapWethArgs, "weth">): HexString => {
32
+ return wethInterface.encodeFunctionData("withdraw", [amount]) as HexString;
33
+ };
34
+
35
+ export const unwrapWethTrx = ({ weth, amount }: UnwrapWethArgs): Unwrapable<Call> => {
36
+ return createCall({
37
+ to: weth,
38
+ data: UnwrapWethCalldata({ amount }),
39
+ value: 0n,
40
+ operation: 0,
41
+ });
42
+ };