damm-sdk 1.4.32 → 1.4.34

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 (27) hide show
  1. package/dist/index.cjs +24984 -31772
  2. package/dist/index.cjs.map +72 -120
  3. package/dist/index.js +44372 -39922
  4. package/dist/index.js.map +137 -93
  5. package/dist/integrations/etherfi/etherfi.abi.d.ts +75 -0
  6. package/dist/integrations/etherfi/etherfi.abi.d.ts.map +1 -0
  7. package/dist/integrations/etherfi/etherfi.d.ts +45 -0
  8. package/dist/integrations/etherfi/etherfi.d.ts.map +1 -0
  9. package/dist/integrations/etherfi/index.d.ts +2 -0
  10. package/dist/integrations/etherfi/index.d.ts.map +1 -0
  11. package/dist/integrations/index.d.ts +2 -0
  12. package/dist/integrations/index.d.ts.map +1 -1
  13. package/dist/integrations/morphoPublicAllocator/index.d.ts +3 -0
  14. package/dist/integrations/morphoPublicAllocator/index.d.ts.map +1 -0
  15. package/dist/integrations/morphoPublicAllocator/morpho.public.allocator.abi.d.ts +76 -0
  16. package/dist/integrations/morphoPublicAllocator/morpho.public.allocator.abi.d.ts.map +1 -0
  17. package/dist/integrations/morphoPublicAllocator/morpho.public.allocator.d.ts +76 -0
  18. package/dist/integrations/morphoPublicAllocator/morpho.public.allocator.d.ts.map +1 -0
  19. package/package.json +1 -1
  20. package/src/integrations/etherfi/etherfi.abi.ts +55 -0
  21. package/src/integrations/etherfi/etherfi.ts +153 -0
  22. package/src/integrations/etherfi/index.ts +1 -0
  23. package/src/integrations/index.ts +2 -0
  24. package/src/integrations/morphoPublicAllocator/index.ts +2 -0
  25. package/src/integrations/morphoPublicAllocator/morpho.public.allocator.abi.ts +25 -0
  26. package/src/integrations/morphoPublicAllocator/morpho.public.allocator.ts +113 -0
  27. package/src/lib/contractsRegistry.json +23 -8
@@ -0,0 +1,75 @@
1
+ export declare const EtherFiLiquidityPoolAbi: readonly [{
2
+ readonly inputs: readonly [{
3
+ readonly internalType: "address";
4
+ readonly name: "_referral";
5
+ readonly type: "address";
6
+ }];
7
+ readonly name: "depositETHForWeETH";
8
+ readonly outputs: readonly [{
9
+ readonly internalType: "uint256";
10
+ readonly name: "";
11
+ readonly type: "uint256";
12
+ }];
13
+ readonly stateMutability: "payable";
14
+ readonly type: "function";
15
+ }];
16
+ export declare const EtherFiWeEthAbi: readonly [{
17
+ readonly inputs: readonly [{
18
+ readonly internalType: "uint256";
19
+ readonly name: "_eETHAmount";
20
+ readonly type: "uint256";
21
+ }];
22
+ readonly name: "wrap";
23
+ readonly outputs: readonly [{
24
+ readonly internalType: "uint256";
25
+ readonly name: "";
26
+ readonly type: "uint256";
27
+ }];
28
+ readonly stateMutability: "nonpayable";
29
+ readonly type: "function";
30
+ }, {
31
+ readonly inputs: readonly [{
32
+ readonly internalType: "uint256";
33
+ readonly name: "_weETHAmount";
34
+ readonly type: "uint256";
35
+ }];
36
+ readonly name: "unwrap";
37
+ readonly outputs: readonly [{
38
+ readonly internalType: "uint256";
39
+ readonly name: "";
40
+ readonly type: "uint256";
41
+ }];
42
+ readonly stateMutability: "nonpayable";
43
+ readonly type: "function";
44
+ }];
45
+ export declare const EtherFiWithdrawAdapterAbi: readonly [{
46
+ readonly inputs: readonly [{
47
+ readonly internalType: "uint256";
48
+ readonly name: "amount";
49
+ readonly type: "uint256";
50
+ }, {
51
+ readonly internalType: "address";
52
+ readonly name: "recipient";
53
+ readonly type: "address";
54
+ }];
55
+ readonly name: "requestWithdraw";
56
+ readonly outputs: readonly [{
57
+ readonly internalType: "uint256";
58
+ readonly name: "tokenId";
59
+ readonly type: "uint256";
60
+ }];
61
+ readonly stateMutability: "nonpayable";
62
+ readonly type: "function";
63
+ }];
64
+ export declare const EtherFiWithdrawRequestNftAbi: readonly [{
65
+ readonly inputs: readonly [{
66
+ readonly internalType: "uint256";
67
+ readonly name: "tokenId";
68
+ readonly type: "uint256";
69
+ }];
70
+ readonly name: "claimWithdraw";
71
+ readonly outputs: readonly [];
72
+ readonly stateMutability: "nonpayable";
73
+ readonly type: "function";
74
+ }];
75
+ //# sourceMappingURL=etherfi.abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etherfi.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/etherfi/etherfi.abi.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;EAQ1B,CAAC;AAGX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAelB,CAAC;AAIX,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;EAW5B,CAAC;AAIX,eAAO,MAAM,4BAA4B;;;;;;;;;;EAQ/B,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { Address } from "viem";
2
+ import type { HexString, Unwrapable, Call } from "../../types";
3
+ export type StakeEthEtherFiArgs = Readonly<{
4
+ referral: Address;
5
+ }>;
6
+ export declare const StakeEthEtherFiCalldata: ({ referral }: StakeEthEtherFiArgs) => HexString;
7
+ export declare const stakeEthEtherFiTrx: ({ args, liquidityPoolAddress, value, }: {
8
+ args: StakeEthEtherFiArgs;
9
+ liquidityPoolAddress: Address;
10
+ value: bigint;
11
+ }) => Unwrapable<Call>;
12
+ export type WrapEEthEtherFiArgs = Readonly<{
13
+ eEthAmount: bigint;
14
+ }>;
15
+ export declare const WrapEEthEtherFiCalldata: ({ eEthAmount }: WrapEEthEtherFiArgs) => HexString;
16
+ export declare const wrapEEthEtherFiTrx: ({ args, weEthAddress, }: {
17
+ args: WrapEEthEtherFiArgs;
18
+ weEthAddress: Address;
19
+ }) => Unwrapable<Call>;
20
+ export type UnwrapWeEthEtherFiArgs = Readonly<{
21
+ weEthAmount: bigint;
22
+ }>;
23
+ export declare const UnwrapWeEthEtherFiCalldata: ({ weEthAmount }: UnwrapWeEthEtherFiArgs) => HexString;
24
+ export declare const unwrapWeEthEtherFiTrx: ({ args, weEthAddress, }: {
25
+ args: UnwrapWeEthEtherFiArgs;
26
+ weEthAddress: Address;
27
+ }) => Unwrapable<Call>;
28
+ export type RequestWithdrawEtherFiArgs = Readonly<{
29
+ amount: bigint;
30
+ recipient: Address;
31
+ }>;
32
+ export declare const RequestWithdrawEtherFiCalldata: ({ amount, recipient }: RequestWithdrawEtherFiArgs) => HexString;
33
+ export declare const requestWithdrawEtherFiTrx: ({ args, withdrawAdapterAddress, }: {
34
+ args: RequestWithdrawEtherFiArgs;
35
+ withdrawAdapterAddress: Address;
36
+ }) => Unwrapable<Call>;
37
+ export type ClaimWithdrawEtherFiArgs = Readonly<{
38
+ tokenId: bigint;
39
+ }>;
40
+ export declare const ClaimWithdrawEtherFiCalldata: ({ tokenId }: ClaimWithdrawEtherFiArgs) => HexString;
41
+ export declare const claimWithdrawEtherFiTrx: ({ args, withdrawRequestNftAddress, }: {
42
+ args: ClaimWithdrawEtherFiArgs;
43
+ withdrawRequestNftAddress: Address;
44
+ }) => Unwrapable<Call>;
45
+ //# sourceMappingURL=etherfi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"etherfi.d.ts","sourceRoot":"","sources":["../../../src/integrations/etherfi/etherfi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAY/D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH,eAAO,MAAM,uBAAuB,iBAAkB,mBAAmB,KAAG,SAE3E,CAAC;AAEF,eAAO,MAAM,kBAAkB;UAKrB,mBAAmB;0BACH,OAAO;WACtB,MAAM;MACb,WAAW,IAAI,CAOlB,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,eAAO,MAAM,uBAAuB,mBAAoB,mBAAmB,KAAG,SAE7E,CAAC;AAEF,eAAO,MAAM,kBAAkB;UAIrB,mBAAmB;kBACX,OAAO;MACrB,WAAW,IAAI,CAOlB,CAAC;AAMF,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC,CAAC;AAEH,eAAO,MAAM,0BAA0B,oBAAqB,sBAAsB,KAAG,SAEpF,CAAC;AAEF,eAAO,MAAM,qBAAqB;UAIxB,sBAAsB;kBACd,OAAO;MACrB,WAAW,IAAI,CAOlB,CAAC;AAMF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;CACtB,CAAC,CAAC;AAEH,eAAO,MAAM,8BAA8B,0BAA2B,0BAA0B,KAAG,SAElG,CAAC;AAEF,eAAO,MAAM,yBAAyB;UAI5B,0BAA0B;4BACR,OAAO;MAC/B,WAAW,IAAI,CAOlB,CAAC;AAMF,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,eAAO,MAAM,4BAA4B,gBAAiB,wBAAwB,KAAG,SAEpF,CAAC;AAEF,eAAO,MAAM,uBAAuB;UAI1B,wBAAwB;+BACH,OAAO;MAClC,WAAW,IAAI,CAOlB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./etherfi";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/etherfi/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
@@ -11,6 +11,7 @@ export * from "./morphoBlue";
11
11
  export * from "./erc20";
12
12
  export * from "./slipstream";
13
13
  export * from "./morphoVault";
14
+ export * from "./morphoPublicAllocator";
14
15
  export * from "./merkl";
15
16
  export * from "./oft";
16
17
  export * from "./ccip";
@@ -18,6 +19,7 @@ export * from "./cctp";
18
19
  export * from "./erc721";
19
20
  export * from "./iporFusion";
20
21
  export * from "./originArm";
22
+ export * from "./etherfi";
21
23
  export * from "./syrup";
22
24
  export * from "./gearbox";
23
25
  export * from "./fluidLite";
@@ -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,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,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,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./morpho.public.allocator";
2
+ export { PublicAllocatorReallocateToAbi } from "./morpho.public.allocator.abi";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/morphoPublicAllocator/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Minimal ABI for Morpho's PublicAllocator contract — only the
3
+ * `reallocateTo` entrypoint we currently encode. Struct types must
4
+ * match the on-chain layout exactly:
5
+ *
6
+ * struct MarketParams {
7
+ * address loanToken;
8
+ * address collateralToken;
9
+ * address oracle;
10
+ * address irm;
11
+ * uint256 lltv;
12
+ * }
13
+ *
14
+ * struct Withdrawal {
15
+ * MarketParams marketParams;
16
+ * uint128 amount;
17
+ * }
18
+ *
19
+ * Reference: https://github.com/morpho-org/public-allocator
20
+ */
21
+ export declare const PublicAllocatorReallocateToAbi: readonly [{
22
+ readonly name: "reallocateTo";
23
+ readonly type: "function";
24
+ readonly stateMutability: "payable";
25
+ readonly inputs: readonly [{
26
+ readonly type: "address";
27
+ readonly name: "vault";
28
+ }, {
29
+ readonly type: "tuple[]";
30
+ readonly components: readonly [{
31
+ readonly type: "tuple";
32
+ readonly components: readonly [{
33
+ readonly type: "address";
34
+ readonly name: "loanToken";
35
+ }, {
36
+ readonly type: "address";
37
+ readonly name: "collateralToken";
38
+ }, {
39
+ readonly type: "address";
40
+ readonly name: "oracle";
41
+ }, {
42
+ readonly type: "address";
43
+ readonly name: "irm";
44
+ }, {
45
+ readonly type: "uint256";
46
+ readonly name: "lltv";
47
+ }];
48
+ readonly name: "marketParams";
49
+ }, {
50
+ readonly type: "uint128";
51
+ readonly name: "amount";
52
+ }];
53
+ readonly name: "withdrawals";
54
+ }, {
55
+ readonly type: "tuple";
56
+ readonly components: readonly [{
57
+ readonly type: "address";
58
+ readonly name: "loanToken";
59
+ }, {
60
+ readonly type: "address";
61
+ readonly name: "collateralToken";
62
+ }, {
63
+ readonly type: "address";
64
+ readonly name: "oracle";
65
+ }, {
66
+ readonly type: "address";
67
+ readonly name: "irm";
68
+ }, {
69
+ readonly type: "uint256";
70
+ readonly name: "lltv";
71
+ }];
72
+ readonly name: "supplyMarketParams";
73
+ }];
74
+ readonly outputs: readonly [];
75
+ }];
76
+ //# sourceMappingURL=morpho.public.allocator.abi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morpho.public.allocator.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/morphoPublicAllocator/morpho.public.allocator.abi.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEzC,CAAC"}
@@ -0,0 +1,76 @@
1
+ import { type Address } from "viem";
2
+ import type { MorphoBlueMarketParams } from "../morphoBlue/morpho.blue";
3
+ /**
4
+ * Mirrors the on-chain `PublicAllocator.Withdrawal` struct.
5
+ *
6
+ * struct Withdrawal {
7
+ * MarketParams marketParams;
8
+ * uint128 amount;
9
+ * }
10
+ *
11
+ * `marketParams` reuses `MorphoBlueMarketParams` from `../morphoBlue` —
12
+ * the SDK exposes a single canonical Morpho Blue market struct, no
13
+ * duplicate definition.
14
+ *
15
+ * `amount` is `uint128` on-chain; we accept `bigint` here for ergonomics.
16
+ * The caller is responsible for ensuring `amount` fits in `uint128`. The
17
+ * Guardian Relay already bounds amounts via per-market `flowCaps.maxOut`,
18
+ * which is itself `uint128`, so this constraint is satisfied upstream.
19
+ */
20
+ export type Withdrawal = Readonly<{
21
+ marketParams: MorphoBlueMarketParams;
22
+ amount: bigint;
23
+ }>;
24
+ /**
25
+ * Resolves the canonical Morpho `PublicAllocator` contract address for the
26
+ * given chain. Throws if no deployment is registered for that chain.
27
+ *
28
+ * Source of truth: `src/lib/contractsRegistry.json` under
29
+ * `<chain>.morpho.publicAllocator`.
30
+ */
31
+ export declare const getMorphoPublicAllocatorAddress: (chainId: number) => Address;
32
+ /**
33
+ * Encodes calldata for `PublicAllocator.reallocateTo(vault, withdrawals, supplyMarketParams)`.
34
+ *
35
+ * Two on-chain invariants the helper does NOT enforce — they are validated
36
+ * by the contract itself, but callers should be aware:
37
+ *
38
+ * 1. `withdrawals` MUST be sorted strictly ascending by Morpho market id
39
+ * (i.e. `keccak256(abi.encode(MarketParams))`). The PublicAllocator
40
+ * reverts (`InconsistentWithdrawals`) if this ordering is violated or
41
+ * if any market id is duplicated.
42
+ *
43
+ * 2. `supplyMarketParams` MUST NOT appear in `withdrawals`. The destination
44
+ * market cannot also be a source. The PublicAllocator reverts
45
+ * (`DepositMarketInWithdrawals`) otherwise.
46
+ *
47
+ * The Guardian Relay's action-builder enforces (1) and (2) before calling
48
+ * this helper; downstream callers should do the same.
49
+ */
50
+ export declare const encodeReallocateTo: (params: {
51
+ vault: Address;
52
+ withdrawals: ReadonlyArray<Withdrawal>;
53
+ supplyMarketParams: MorphoBlueMarketParams;
54
+ }) => `0x${string}`;
55
+ /**
56
+ * Returns a `{ to, data, value }` envelope ready to be plugged into a
57
+ * multicall, Safe `execTransaction`, or `Roles.execTransactionWithRole`.
58
+ *
59
+ * `feeWei` MUST equal the per-vault ETH fee returned by
60
+ * `PublicAllocator.fee(vault)` at the time of execution. Sending more or
61
+ * less makes the contract revert (`msg.value != fee`). Fetch the fee
62
+ * immediately before building the call to avoid races with operator
63
+ * fee changes.
64
+ */
65
+ export declare const buildReallocateToCall: (params: {
66
+ chainId: number;
67
+ vault: Address;
68
+ withdrawals: ReadonlyArray<Withdrawal>;
69
+ supplyMarketParams: MorphoBlueMarketParams;
70
+ feeWei: bigint;
71
+ }) => {
72
+ to: Address;
73
+ data: `0x${string}`;
74
+ value: bigint;
75
+ };
76
+ //# sourceMappingURL=morpho.public.allocator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morpho.public.allocator.d.ts","sourceRoot":"","sources":["../../../src/integrations/morphoPublicAllocator/morpho.public.allocator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAExD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAOxE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,YAAY,EAAE,sBAAsB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,YAAa,MAAM,KAAG,OAEjE,CAAC;AAMF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,kBAAkB,WAAY;IACvC,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,cAAc,UAAU,CAAC,CAAC;IACvC,kBAAkB,EAAE,sBAAsB,CAAC;CAC9C,KAAG,KAAK,MAAM,EAOd,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,WAAY;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,cAAc,UAAU,CAAC,CAAC;IACvC,kBAAkB,EAAE,sBAAsB,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAClB,KAAG;IACA,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CAQjB,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.4.32",
7
+ "version": "1.4.34",
8
8
  "files": [
9
9
  "dist",
10
10
  "src",
@@ -0,0 +1,55 @@
1
+ // EtherFi LiquidityPool — accepts ETH, returns weETH directly via depositETHForWeETH.
2
+ export const EtherFiLiquidityPoolAbi = [
3
+ {
4
+ inputs: [{ internalType: "address", name: "_referral", type: "address" }],
5
+ name: "depositETHForWeETH",
6
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
7
+ stateMutability: "payable",
8
+ type: "function",
9
+ },
10
+ ] as const;
11
+
12
+ // EtherFi WeETH — wraps eETH (rebasing) into weETH (non-rebasing) and back.
13
+ export const EtherFiWeEthAbi = [
14
+ {
15
+ inputs: [{ internalType: "uint256", name: "_eETHAmount", type: "uint256" }],
16
+ name: "wrap",
17
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
18
+ stateMutability: "nonpayable",
19
+ type: "function",
20
+ },
21
+ {
22
+ inputs: [{ internalType: "uint256", name: "_weETHAmount", type: "uint256" }],
23
+ name: "unwrap",
24
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
25
+ stateMutability: "nonpayable",
26
+ type: "function",
27
+ },
28
+ ] as const;
29
+
30
+ // EtherFi WithdrawAdapter — entry point for async withdrawals; pulls weETH from the
31
+ // caller, unwraps to eETH, and mints a WithdrawRequestNFT to `recipient`.
32
+ export const EtherFiWithdrawAdapterAbi = [
33
+ {
34
+ inputs: [
35
+ { internalType: "uint256", name: "amount", type: "uint256" },
36
+ { internalType: "address", name: "recipient", type: "address" },
37
+ ],
38
+ name: "requestWithdraw",
39
+ outputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
40
+ stateMutability: "nonpayable",
41
+ type: "function",
42
+ },
43
+ ] as const;
44
+
45
+ // EtherFi WithdrawRequestNFT — burns the NFT and pays out ETH once the request is
46
+ // finalized off-chain by EtherFi governance.
47
+ export const EtherFiWithdrawRequestNftAbi = [
48
+ {
49
+ inputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }],
50
+ name: "claimWithdraw",
51
+ outputs: [],
52
+ stateMutability: "nonpayable",
53
+ type: "function",
54
+ },
55
+ ] as const;
@@ -0,0 +1,153 @@
1
+ import { ethers } from "ethers";
2
+ import {
3
+ EtherFiLiquidityPoolAbi,
4
+ EtherFiWeEthAbi,
5
+ EtherFiWithdrawAdapterAbi,
6
+ EtherFiWithdrawRequestNftAbi,
7
+ } from "./etherfi.abi";
8
+ import type { Address } from "viem";
9
+ import type { HexString, Unwrapable, Call } from "../../types";
10
+ import { createCall } from "../../types";
11
+
12
+ const liquidityPoolInterface = new ethers.utils.Interface(EtherFiLiquidityPoolAbi);
13
+ const weEthInterface = new ethers.utils.Interface(EtherFiWeEthAbi);
14
+ const withdrawAdapterInterface = new ethers.utils.Interface(EtherFiWithdrawAdapterAbi);
15
+ const withdrawRequestNftInterface = new ethers.utils.Interface(EtherFiWithdrawRequestNftAbi);
16
+
17
+ // ============================================================================
18
+ // Stake ETH (payable, returns weETH directly)
19
+ // ============================================================================
20
+
21
+ export type StakeEthEtherFiArgs = Readonly<{
22
+ referral: Address;
23
+ }>;
24
+
25
+ export const StakeEthEtherFiCalldata = ({ referral }: StakeEthEtherFiArgs): HexString => {
26
+ return liquidityPoolInterface.encodeFunctionData("depositETHForWeETH", [referral]) as HexString;
27
+ };
28
+
29
+ export const stakeEthEtherFiTrx = ({
30
+ args,
31
+ liquidityPoolAddress,
32
+ value,
33
+ }: {
34
+ args: StakeEthEtherFiArgs;
35
+ liquidityPoolAddress: Address;
36
+ value: bigint;
37
+ }): Unwrapable<Call> => {
38
+ return createCall({
39
+ operation: 0,
40
+ to: liquidityPoolAddress,
41
+ value,
42
+ data: StakeEthEtherFiCalldata(args),
43
+ });
44
+ };
45
+
46
+ // ============================================================================
47
+ // Wrap eETH → weETH
48
+ // ============================================================================
49
+
50
+ export type WrapEEthEtherFiArgs = Readonly<{
51
+ eEthAmount: bigint;
52
+ }>;
53
+
54
+ export const WrapEEthEtherFiCalldata = ({ eEthAmount }: WrapEEthEtherFiArgs): HexString => {
55
+ return weEthInterface.encodeFunctionData("wrap", [eEthAmount]) as HexString;
56
+ };
57
+
58
+ export const wrapEEthEtherFiTrx = ({
59
+ args,
60
+ weEthAddress,
61
+ }: {
62
+ args: WrapEEthEtherFiArgs;
63
+ weEthAddress: Address;
64
+ }): Unwrapable<Call> => {
65
+ return createCall({
66
+ operation: 0,
67
+ to: weEthAddress,
68
+ value: 0n,
69
+ data: WrapEEthEtherFiCalldata(args),
70
+ });
71
+ };
72
+
73
+ // ============================================================================
74
+ // Unwrap weETH → eETH
75
+ // ============================================================================
76
+
77
+ export type UnwrapWeEthEtherFiArgs = Readonly<{
78
+ weEthAmount: bigint;
79
+ }>;
80
+
81
+ export const UnwrapWeEthEtherFiCalldata = ({ weEthAmount }: UnwrapWeEthEtherFiArgs): HexString => {
82
+ return weEthInterface.encodeFunctionData("unwrap", [weEthAmount]) as HexString;
83
+ };
84
+
85
+ export const unwrapWeEthEtherFiTrx = ({
86
+ args,
87
+ weEthAddress,
88
+ }: {
89
+ args: UnwrapWeEthEtherFiArgs;
90
+ weEthAddress: Address;
91
+ }): Unwrapable<Call> => {
92
+ return createCall({
93
+ operation: 0,
94
+ to: weEthAddress,
95
+ value: 0n,
96
+ data: UnwrapWeEthEtherFiCalldata(args),
97
+ });
98
+ };
99
+
100
+ // ============================================================================
101
+ // Request Withdraw (async — burns weETH, mints a WithdrawRequestNFT)
102
+ // ============================================================================
103
+
104
+ export type RequestWithdrawEtherFiArgs = Readonly<{
105
+ amount: bigint;
106
+ recipient: Address;
107
+ }>;
108
+
109
+ export const RequestWithdrawEtherFiCalldata = ({ amount, recipient }: RequestWithdrawEtherFiArgs): HexString => {
110
+ return withdrawAdapterInterface.encodeFunctionData("requestWithdraw", [amount, recipient]) as HexString;
111
+ };
112
+
113
+ export const requestWithdrawEtherFiTrx = ({
114
+ args,
115
+ withdrawAdapterAddress,
116
+ }: {
117
+ args: RequestWithdrawEtherFiArgs;
118
+ withdrawAdapterAddress: Address;
119
+ }): Unwrapable<Call> => {
120
+ return createCall({
121
+ operation: 0,
122
+ to: withdrawAdapterAddress,
123
+ value: 0n,
124
+ data: RequestWithdrawEtherFiCalldata(args),
125
+ });
126
+ };
127
+
128
+ // ============================================================================
129
+ // Claim Withdraw (async — burns the NFT, pays ETH from the buffer)
130
+ // ============================================================================
131
+
132
+ export type ClaimWithdrawEtherFiArgs = Readonly<{
133
+ tokenId: bigint;
134
+ }>;
135
+
136
+ export const ClaimWithdrawEtherFiCalldata = ({ tokenId }: ClaimWithdrawEtherFiArgs): HexString => {
137
+ return withdrawRequestNftInterface.encodeFunctionData("claimWithdraw", [tokenId]) as HexString;
138
+ };
139
+
140
+ export const claimWithdrawEtherFiTrx = ({
141
+ args,
142
+ withdrawRequestNftAddress,
143
+ }: {
144
+ args: ClaimWithdrawEtherFiArgs;
145
+ withdrawRequestNftAddress: Address;
146
+ }): Unwrapable<Call> => {
147
+ return createCall({
148
+ operation: 0,
149
+ to: withdrawRequestNftAddress,
150
+ value: 0n,
151
+ data: ClaimWithdrawEtherFiCalldata(args),
152
+ });
153
+ };
@@ -0,0 +1 @@
1
+ export * from "./etherfi";
@@ -11,6 +11,7 @@ export * from "./morphoBlue";
11
11
  export * from "./erc20";
12
12
  export * from "./slipstream";
13
13
  export * from "./morphoVault";
14
+ export * from "./morphoPublicAllocator";
14
15
  export * from "./merkl";
15
16
  export * from "./oft";
16
17
  export * from "./ccip";
@@ -18,6 +19,7 @@ export * from "./cctp";
18
19
  export * from "./erc721";
19
20
  export * from "./iporFusion";
20
21
  export * from "./originArm";
22
+ export * from "./etherfi";
21
23
  export * from "./syrup";
22
24
  export * from "./gearbox";
23
25
  export * from "./fluidLite";
@@ -0,0 +1,2 @@
1
+ export * from "./morpho.public.allocator";
2
+ export { PublicAllocatorReallocateToAbi } from "./morpho.public.allocator.abi";
@@ -0,0 +1,25 @@
1
+ import { parseAbi } from "viem";
2
+
3
+ /**
4
+ * Minimal ABI for Morpho's PublicAllocator contract — only the
5
+ * `reallocateTo` entrypoint we currently encode. Struct types must
6
+ * match the on-chain layout exactly:
7
+ *
8
+ * struct MarketParams {
9
+ * address loanToken;
10
+ * address collateralToken;
11
+ * address oracle;
12
+ * address irm;
13
+ * uint256 lltv;
14
+ * }
15
+ *
16
+ * struct Withdrawal {
17
+ * MarketParams marketParams;
18
+ * uint128 amount;
19
+ * }
20
+ *
21
+ * Reference: https://github.com/morpho-org/public-allocator
22
+ */
23
+ export const PublicAllocatorReallocateToAbi = parseAbi([
24
+ "function reallocateTo(address vault, ((address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams, uint128 amount)[] withdrawals, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) supplyMarketParams) payable",
25
+ ]);