damm-sdk 1.4.20 → 1.4.22
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.cjs +1749 -213
- package/dist/index.cjs.map +30 -3
- package/dist/index.js +4230 -2724
- package/dist/index.js.map +41 -15
- package/dist/integrations/ccip/ccip.router.abi.d.ts +85 -0
- package/dist/integrations/ccip/ccip.router.abi.d.ts.map +1 -0
- package/dist/integrations/ccip/ccip.router.d.ts +72 -0
- package/dist/integrations/ccip/ccip.router.d.ts.map +1 -0
- package/dist/integrations/ccip/index.d.ts +3 -0
- package/dist/integrations/ccip/index.d.ts.map +1 -0
- package/dist/integrations/enso/enso.d.ts +75 -0
- package/dist/integrations/enso/enso.d.ts.map +1 -0
- package/dist/integrations/enso/enso.route.api.d.ts +67 -0
- package/dist/integrations/enso/enso.route.api.d.ts.map +1 -0
- package/dist/integrations/enso/enso.router.abi.d.ts +68 -0
- package/dist/integrations/enso/enso.router.abi.d.ts.map +1 -0
- package/dist/integrations/enso/index.d.ts +4 -0
- package/dist/integrations/enso/index.d.ts.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/integrations/ccip/ccip.router.abi.ts +62 -0
- package/src/integrations/ccip/ccip.router.ts +172 -0
- package/src/integrations/ccip/index.ts +19 -0
- package/src/integrations/enso/enso.route.api.ts +127 -0
- package/src/integrations/enso/enso.router.abi.ts +48 -0
- package/src/integrations/enso/enso.ts +172 -0
- package/src/integrations/enso/index.ts +3 -0
- package/src/integrations/index.ts +2 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal ABI for Chainlink CCIP Router contract.
|
|
3
|
+
* Only includes functions needed for bridge operations.
|
|
4
|
+
*
|
|
5
|
+
* Full contract: https://etherscan.io/address/0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
|
|
6
|
+
*/
|
|
7
|
+
declare const _default: readonly [{
|
|
8
|
+
readonly inputs: readonly [{
|
|
9
|
+
readonly name: "destinationChainSelector";
|
|
10
|
+
readonly type: "uint64";
|
|
11
|
+
}, {
|
|
12
|
+
readonly name: "message";
|
|
13
|
+
readonly type: "tuple";
|
|
14
|
+
readonly components: readonly [{
|
|
15
|
+
readonly name: "receiver";
|
|
16
|
+
readonly type: "bytes";
|
|
17
|
+
}, {
|
|
18
|
+
readonly name: "data";
|
|
19
|
+
readonly type: "bytes";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "tokenAmounts";
|
|
22
|
+
readonly type: "tuple[]";
|
|
23
|
+
readonly components: readonly [{
|
|
24
|
+
readonly name: "token";
|
|
25
|
+
readonly type: "address";
|
|
26
|
+
}, {
|
|
27
|
+
readonly name: "amount";
|
|
28
|
+
readonly type: "uint256";
|
|
29
|
+
}];
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "feeToken";
|
|
32
|
+
readonly type: "address";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "extraArgs";
|
|
35
|
+
readonly type: "bytes";
|
|
36
|
+
}];
|
|
37
|
+
}];
|
|
38
|
+
readonly name: "ccipSend";
|
|
39
|
+
readonly outputs: readonly [{
|
|
40
|
+
readonly name: "messageId";
|
|
41
|
+
readonly type: "bytes32";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "payable";
|
|
44
|
+
readonly type: "function";
|
|
45
|
+
}, {
|
|
46
|
+
readonly inputs: readonly [{
|
|
47
|
+
readonly name: "destinationChainSelector";
|
|
48
|
+
readonly type: "uint64";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "message";
|
|
51
|
+
readonly type: "tuple";
|
|
52
|
+
readonly components: readonly [{
|
|
53
|
+
readonly name: "receiver";
|
|
54
|
+
readonly type: "bytes";
|
|
55
|
+
}, {
|
|
56
|
+
readonly name: "data";
|
|
57
|
+
readonly type: "bytes";
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "tokenAmounts";
|
|
60
|
+
readonly type: "tuple[]";
|
|
61
|
+
readonly components: readonly [{
|
|
62
|
+
readonly name: "token";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "amount";
|
|
66
|
+
readonly type: "uint256";
|
|
67
|
+
}];
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "feeToken";
|
|
70
|
+
readonly type: "address";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "extraArgs";
|
|
73
|
+
readonly type: "bytes";
|
|
74
|
+
}];
|
|
75
|
+
}];
|
|
76
|
+
readonly name: "getFee";
|
|
77
|
+
readonly outputs: readonly [{
|
|
78
|
+
readonly name: "fee";
|
|
79
|
+
readonly type: "uint256";
|
|
80
|
+
}];
|
|
81
|
+
readonly stateMutability: "view";
|
|
82
|
+
readonly type: "function";
|
|
83
|
+
}];
|
|
84
|
+
export default _default;
|
|
85
|
+
//# sourceMappingURL=ccip.router.abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ccip.router.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/ccip/ccip.router.abi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAuDW"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Call, HexString, Unwrapable } from "../../types";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
/**
|
|
4
|
+
* CCIP chain selectors (uint64).
|
|
5
|
+
* Source: https://docs.chain.link/ccip/directory/mainnet
|
|
6
|
+
* Verified on-chain 2026-04-13 via typeAndVersion() on each Router.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CCIP_CHAIN_SELECTORS: Readonly<Record<number, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* Get the CCIP chain selector for a given chain ID.
|
|
11
|
+
* @throws if the chain is not supported
|
|
12
|
+
*/
|
|
13
|
+
export declare const getCCIPChainSelector: (chainId: number) => string;
|
|
14
|
+
export type CCIPTokenAmount = Readonly<{
|
|
15
|
+
token: Address;
|
|
16
|
+
amount: bigint;
|
|
17
|
+
}>;
|
|
18
|
+
export type EVM2AnyMessage = Readonly<{
|
|
19
|
+
/** abi.encode(destinationAddress) */
|
|
20
|
+
receiver: HexString;
|
|
21
|
+
/** Empty (0x) for token-only transfers */
|
|
22
|
+
data: HexString;
|
|
23
|
+
/** Tokens to bridge */
|
|
24
|
+
tokenAmounts: readonly CCIPTokenAmount[];
|
|
25
|
+
/** address(0) = pay fee in native ETH/MON */
|
|
26
|
+
feeToken: Address;
|
|
27
|
+
/** Extra args (0x for defaults) */
|
|
28
|
+
extraArgs: HexString;
|
|
29
|
+
}>;
|
|
30
|
+
export type GetFeeArgs = Readonly<{
|
|
31
|
+
destinationChainSelector: string;
|
|
32
|
+
message: EVM2AnyMessage;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Encode calldata for Router.getFee(destinationChainSelector, message).
|
|
36
|
+
* Use this to quote the CCIP fee via an RPC call.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CCIPGetFeeCalldata: (args: GetFeeArgs) => HexString;
|
|
39
|
+
/**
|
|
40
|
+
* Build a Call for Router.getFee (read-only, value=0).
|
|
41
|
+
*/
|
|
42
|
+
export declare const CCIPGetFeeTrx: ({ routerAddress, args, }: {
|
|
43
|
+
routerAddress: Address;
|
|
44
|
+
args: GetFeeArgs;
|
|
45
|
+
}) => Unwrapable<Call>;
|
|
46
|
+
export type CCIPSendArgs = Readonly<{
|
|
47
|
+
destinationChainSelector: string;
|
|
48
|
+
message: EVM2AnyMessage;
|
|
49
|
+
/** Native fee (from getFee). The Router does NOT refund excess. */
|
|
50
|
+
nativeFee: bigint;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Encode calldata for Router.ccipSend(destinationChainSelector, message).
|
|
54
|
+
*/
|
|
55
|
+
export declare const CCIPSendCalldata: (args: CCIPSendArgs) => HexString;
|
|
56
|
+
/**
|
|
57
|
+
* Build a Call for Router.ccipSend with msg.value = nativeFee.
|
|
58
|
+
*/
|
|
59
|
+
export declare const ccipSendTrx: ({ routerAddress, args, }: {
|
|
60
|
+
routerAddress: Address;
|
|
61
|
+
args: CCIPSendArgs;
|
|
62
|
+
}) => Unwrapable<Call>;
|
|
63
|
+
/**
|
|
64
|
+
* Build a standard EVM2AnyMessage for bridging a single token.
|
|
65
|
+
* Receiver = abi.encode(destinationAddress), feeToken = address(0) (native).
|
|
66
|
+
*/
|
|
67
|
+
export declare const buildCCIPMessage: ({ receiver, token, amount, }: {
|
|
68
|
+
receiver: Address;
|
|
69
|
+
token: Address;
|
|
70
|
+
amount: bigint;
|
|
71
|
+
}) => EVM2AnyMessage;
|
|
72
|
+
//# sourceMappingURL=ccip.router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ccip.router.d.ts","sourceRoot":"","sources":["../../../src/integrations/ccip/ccip.router.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQhE,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,YAAa,MAAM,KAAG,MAMtD,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACnC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IAClC,qCAAqC;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,IAAI,EAAE,SAAS,CAAC;IAChB,uBAAuB;IACvB,YAAY,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB,mCAAmC;IACnC,SAAS,EAAE,SAAS,CAAC;CACxB,CAAC,CAAC;AAIH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;IACjC,OAAO,EAAE,cAAc,CAAC;CAC3B,CAAC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,SAAU,UAAU,KAAG,SAcrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;mBAIP,OAAO;UAChB,UAAU;MAChB,WAAW,IAAI,CAOlB,CAAC;AAIF,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;IACjC,OAAO,EAAE,cAAc,CAAC;IACxB,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,YAAY,KAAG,SAcrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;mBAIL,OAAO;UAChB,YAAY;MAClB,WAAW,IAAI,CAOlB,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;cAKf,OAAO;WACV,OAAO;YACN,MAAM;MACd,cAWH,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as CCIPRouterAbi } from "./ccip.router.abi";
|
|
2
|
+
export { CCIP_CHAIN_SELECTORS, getCCIPChainSelector, CCIPGetFeeCalldata, CCIPGetFeeTrx, CCIPSendCalldata, ccipSendTrx, buildCCIPMessage, type CCIPTokenAmount, type EVM2AnyMessage, type GetFeeArgs, type CCIPSendArgs, } from "./ccip.router";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/ccip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAEH,oBAAoB,EACpB,oBAAoB,EAEpB,kBAAkB,EAClB,aAAa,EAEb,gBAAgB,EAChB,WAAW,EAEX,gBAAgB,EAEhB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,GACpB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enso RouterV2 transaction builders.
|
|
3
|
+
*
|
|
4
|
+
* Enso's `/v1/shortcuts/route` API only returns `routeSingle(Token tokenOut,
|
|
5
|
+
* bytes data)` calldata. Our Zodiac Roles scopes only permit the stricter
|
|
6
|
+
* 4-arg `safeRouteSingle(Token tokenIn, Token tokenOut, address receiver,
|
|
7
|
+
* bytes data)`, which validates tokenIn consumption and an explicit receiver.
|
|
8
|
+
*
|
|
9
|
+
* The shortcut `bundle` payload is identical between the two entry points —
|
|
10
|
+
* safeRouteSingle just layers additional validation on top — so we fetch the
|
|
11
|
+
* route once, extract the bundle, and re-encode as safeRouteSingle.
|
|
12
|
+
*
|
|
13
|
+
* Workflow:
|
|
14
|
+
* ensoSafeRouteSingleTrx({ api args, routerAddress })
|
|
15
|
+
* → fetchEnsoRoute(...) (HTTP)
|
|
16
|
+
* → rewrapRouteSingleAsSafeRouteSingle(...) (pure)
|
|
17
|
+
* → createCall({ to: routerAddress, data, … }) (Unwrapable<Call>)
|
|
18
|
+
*/
|
|
19
|
+
import { type Address } from "viem";
|
|
20
|
+
import type { Call, HexString, Unwrapable } from "../../types";
|
|
21
|
+
import { type EnsoRouteArgs } from "./enso.route.api.ts";
|
|
22
|
+
export declare enum EnsoTokenType {
|
|
23
|
+
Native = 0,
|
|
24
|
+
ERC20 = 1
|
|
25
|
+
}
|
|
26
|
+
export type EnsoToken = Readonly<{
|
|
27
|
+
tokenType: EnsoTokenType;
|
|
28
|
+
data: HexString;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Encode a token as Enso's `Token` struct:
|
|
32
|
+
* - ERC20: (tokenType=1, abi.encode(address, uint256))
|
|
33
|
+
* - Native: (tokenType=0, abi.encode(uint256))
|
|
34
|
+
*/
|
|
35
|
+
export declare const encodeEnsoToken: (token: Address, amount: bigint) => EnsoToken;
|
|
36
|
+
export declare class UnexpectedEnsoSelectorError extends Error {
|
|
37
|
+
readonly selector: string;
|
|
38
|
+
constructor(selector: string);
|
|
39
|
+
}
|
|
40
|
+
export type RewrapArgs = Readonly<{
|
|
41
|
+
routeSingleCalldata: HexString;
|
|
42
|
+
tokenIn: Address;
|
|
43
|
+
amountIn: bigint;
|
|
44
|
+
receiver: Address;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Decode `routeSingle(tokenOut, bundle)` calldata, then re-encode as
|
|
48
|
+
* `safeRouteSingle(tokenIn, tokenOut, receiver, bundle)` using the same
|
|
49
|
+
* bundle payload. The bundle is byte-identical; only the wrapper changes.
|
|
50
|
+
*
|
|
51
|
+
* Throws `UnexpectedEnsoSelectorError` if the input doesn't start with the
|
|
52
|
+
* routeSingle selector — a fail-fast guard in case Enso's API ever switches
|
|
53
|
+
* output format.
|
|
54
|
+
*/
|
|
55
|
+
export declare const rewrapRouteSingleAsSafeRouteSingle: (args: RewrapArgs) => HexString;
|
|
56
|
+
export declare class EnsoUnexpectedRouterError extends Error {
|
|
57
|
+
readonly got: Address;
|
|
58
|
+
readonly expected: Address;
|
|
59
|
+
constructor(got: Address, expected: Address);
|
|
60
|
+
}
|
|
61
|
+
export type EnsoSafeRouteSingleTrxArgs = EnsoRouteArgs & Readonly<{
|
|
62
|
+
/** Address of the Enso RouterV2 on the target chain. Must match the scope in Zodiac Roles. */
|
|
63
|
+
routerAddress: Address;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Fetch an Enso route and return a `safeRouteSingle` call ready to be added
|
|
67
|
+
* to a MultisendBuilder.
|
|
68
|
+
*
|
|
69
|
+
* Aborts (throws) if Enso's API returns a tx targeting any address other than
|
|
70
|
+
* the provided RouterV2 — this protects against the API silently switching to
|
|
71
|
+
* EnsoWallet or EnsoShortcutsDelegate, neither of which our Zodiac scope
|
|
72
|
+
* permits.
|
|
73
|
+
*/
|
|
74
|
+
export declare const ensoSafeRouteSingleTrx: (args: EnsoSafeRouteSingleTrxArgs) => Promise<Unwrapable<Call>>;
|
|
75
|
+
//# sourceMappingURL=enso.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enso.d.ts","sourceRoot":"","sources":["../../../src/integrations/enso/enso.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAA+D,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACjG,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAkB,KAAK,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAIjG,oBAAY,aAAa;IACrB,MAAM,IAAI;IACV,KAAK,IAAI;CACZ;AAED,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC7B,SAAS,EAAE,aAAa,CAAC;IACzB,IAAI,EAAE,SAAS,CAAC;CACnB,CAAC,CAAC;AAMH;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,OAAO,UAAU,MAAM,KAAG,SAWhE,CAAC;AAMF,qBAAa,2BAA4B,SAAQ,KAAK;IAClD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBACd,QAAQ,EAAE,MAAM;CAQ/B;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAC9B,mBAAmB,EAAE,SAAS,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,SAAU,UAAU,KAAG,SAyBrE,CAAC;AAIF,qBAAa,yBAA0B,SAAQ,KAAK;IAChD,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;gBACf,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO;CAS9C;AAED,MAAM,MAAM,0BAA0B,GAAG,aAAa,GAClD,QAAQ,CAAC;IACL,8FAA8F;IAC9F,aAAa,EAAE,OAAO,CAAC;CAC1B,CAAC,CAAC;AAEP;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,SAAgB,0BAA0B,KAAG,QAAQ,WAAW,IAAI,CAAC,CAsBvG,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enso Shortcuts API client.
|
|
3
|
+
*
|
|
4
|
+
* Fetches a swap route from Enso's public `/v1/shortcuts/route` endpoint and
|
|
5
|
+
* returns the raw `tx.data` (which is always `routeSingle` calldata — see
|
|
6
|
+
* `enso.ts` for the rewrap into `safeRouteSingle`).
|
|
7
|
+
*
|
|
8
|
+
* API reference: https://docs.enso.build/pages/api-reference/shortcuts/route
|
|
9
|
+
*/
|
|
10
|
+
import type { Address } from "viem";
|
|
11
|
+
import type { HexString } from "../../types";
|
|
12
|
+
export declare const ENSO_API_BASE: "https://api.enso.finance";
|
|
13
|
+
/**
|
|
14
|
+
* Raw response shape from the Enso route endpoint. We only model the fields
|
|
15
|
+
* we use; Enso returns many more (amountOut, priceImpact, route, …) that are
|
|
16
|
+
* intentionally ignored.
|
|
17
|
+
*/
|
|
18
|
+
export type EnsoRouteResponse = Readonly<{
|
|
19
|
+
tx: Readonly<{
|
|
20
|
+
to: HexString;
|
|
21
|
+
data: HexString;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
export type EnsoRouteArgs = Readonly<{
|
|
26
|
+
chainId: number;
|
|
27
|
+
/** Caller address — also used as `receiver` by default. */
|
|
28
|
+
fromAddress: Address;
|
|
29
|
+
/** Destination for the swap output. Typically equal to `fromAddress` (the Safe). */
|
|
30
|
+
receiver: Address;
|
|
31
|
+
tokenIn: Address;
|
|
32
|
+
tokenOut: Address;
|
|
33
|
+
/** Decimal string, no decimals adjustment — matches token units. */
|
|
34
|
+
amountIn: string;
|
|
35
|
+
/**
|
|
36
|
+
* Slippage in integer basis points (e.g. 20 = 0.2%, 300 = 3%).
|
|
37
|
+
*
|
|
38
|
+
* Enso's `slippage` param is a number string in bips. Passing a decimal
|
|
39
|
+
* like `0.2` triggers a 400 Bad Request ("slippage must be a number
|
|
40
|
+
* string").
|
|
41
|
+
*/
|
|
42
|
+
slippageBips: number;
|
|
43
|
+
/** Optional Enso API key for 10 rps; no key = 1 rps global limit. */
|
|
44
|
+
apiKey?: string;
|
|
45
|
+
/** Override the API base URL (useful for tests). */
|
|
46
|
+
apiBase?: string;
|
|
47
|
+
}>;
|
|
48
|
+
export declare class EnsoRouteApiError extends Error {
|
|
49
|
+
readonly status: number;
|
|
50
|
+
readonly statusText: string;
|
|
51
|
+
readonly tokenIn: Address;
|
|
52
|
+
readonly tokenOut: Address;
|
|
53
|
+
constructor({ status, statusText, tokenIn, tokenOut, }: {
|
|
54
|
+
status: number;
|
|
55
|
+
statusText: string;
|
|
56
|
+
tokenIn: Address;
|
|
57
|
+
tokenOut: Address;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Fetch a shortcut route from Enso. Always returns `routeSingle` calldata —
|
|
62
|
+
* use `rewrapRouteSingleAsSafeRouteSingle` in `enso.ts` to convert to
|
|
63
|
+
* `safeRouteSingle` before submitting on-chain if your Safe's Zodiac scope
|
|
64
|
+
* only permits safeRouteSingle.
|
|
65
|
+
*/
|
|
66
|
+
export declare const fetchEnsoRoute: (args: EnsoRouteArgs) => Promise<EnsoRouteResponse>;
|
|
67
|
+
//# sourceMappingURL=enso.route.api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enso.route.api.d.ts","sourceRoot":"","sources":["../../../src/integrations/enso/enso.route.api.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,aAAa,4BAAsC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACrC,EAAE,EAAE,QAAQ,CAAC;QACT,EAAE,EAAE,SAAS,CAAC;QACd,IAAI,EAAE,SAAS,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;CACN,CAAC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,WAAW,EAAE,OAAO,CAAC;IACrB,oFAAoF;IACpF,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH,qBAAa,iBAAkB,SAAQ,KAAK;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;gBAEf,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,QAAQ,GACX,EAAE;QACC,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,OAAO,CAAC;KACrB;CAQJ;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,SAAgB,aAAa,KAAG,QAAQ,iBAAiB,CA0CnF,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enso RouterV2 — minimal ABI covering the entry points we use:
|
|
3
|
+
*
|
|
4
|
+
* routeSingle(Token tokenOut, bytes data)
|
|
5
|
+
* safeRouteSingle(Token tokenIn, Token tokenOut, address receiver, bytes data)
|
|
6
|
+
*
|
|
7
|
+
* `Token` is Enso's internal struct `{ uint8 tokenType, bytes data }` where:
|
|
8
|
+
* - tokenType = 0 (Native): data = abi.encode(uint256 amount)
|
|
9
|
+
* - tokenType = 1 (ERC20): data = abi.encode(address token, uint256 amount)
|
|
10
|
+
*
|
|
11
|
+
* We intentionally expose only these two selectors — we never call the Enso
|
|
12
|
+
* router with routeMulti / safeRouteMulti / delegate variants from any DAMM
|
|
13
|
+
* context, and shipping their ABIs here would just invite unaudited usage.
|
|
14
|
+
*/
|
|
15
|
+
declare const _default: readonly [{
|
|
16
|
+
readonly name: "routeSingle";
|
|
17
|
+
readonly type: "function";
|
|
18
|
+
readonly stateMutability: "payable";
|
|
19
|
+
readonly inputs: readonly [{
|
|
20
|
+
readonly name: "tokenOut";
|
|
21
|
+
readonly type: "tuple";
|
|
22
|
+
readonly components: readonly [{
|
|
23
|
+
readonly name: "tokenType";
|
|
24
|
+
readonly type: "uint8";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "data";
|
|
27
|
+
readonly type: "bytes";
|
|
28
|
+
}];
|
|
29
|
+
}, {
|
|
30
|
+
readonly name: "data";
|
|
31
|
+
readonly type: "bytes";
|
|
32
|
+
}];
|
|
33
|
+
readonly outputs: readonly [];
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "safeRouteSingle";
|
|
36
|
+
readonly type: "function";
|
|
37
|
+
readonly stateMutability: "payable";
|
|
38
|
+
readonly inputs: readonly [{
|
|
39
|
+
readonly name: "tokenIn";
|
|
40
|
+
readonly type: "tuple";
|
|
41
|
+
readonly components: readonly [{
|
|
42
|
+
readonly name: "tokenType";
|
|
43
|
+
readonly type: "uint8";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "data";
|
|
46
|
+
readonly type: "bytes";
|
|
47
|
+
}];
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "tokenOut";
|
|
50
|
+
readonly type: "tuple";
|
|
51
|
+
readonly components: readonly [{
|
|
52
|
+
readonly name: "tokenType";
|
|
53
|
+
readonly type: "uint8";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "data";
|
|
56
|
+
readonly type: "bytes";
|
|
57
|
+
}];
|
|
58
|
+
}, {
|
|
59
|
+
readonly name: "receiver";
|
|
60
|
+
readonly type: "address";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "data";
|
|
63
|
+
readonly type: "bytes";
|
|
64
|
+
}];
|
|
65
|
+
readonly outputs: readonly [];
|
|
66
|
+
}];
|
|
67
|
+
export default _default;
|
|
68
|
+
//# sourceMappingURL=enso.router.abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enso.router.abi.d.ts","sourceRoot":"","sources":["../../../src/integrations/enso/enso.router.abi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWH,wBAuBW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/enso/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC"}
|
|
@@ -13,6 +13,7 @@ export * from "./slipstream";
|
|
|
13
13
|
export * from "./morphoVault";
|
|
14
14
|
export * from "./merkl";
|
|
15
15
|
export * from "./oft";
|
|
16
|
+
export * from "./ccip";
|
|
16
17
|
export * from "./cctp";
|
|
17
18
|
export * from "./erc721";
|
|
18
19
|
export * from "./iporFusion";
|
|
@@ -23,4 +24,5 @@ export * from "./fluidLite";
|
|
|
23
24
|
export * from "./weth";
|
|
24
25
|
export * from "./pendle";
|
|
25
26
|
export * from "./wormhole";
|
|
27
|
+
export * from "./enso";
|
|
26
28
|
//# 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;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,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,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"}
|
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.
|
|
7
|
+
"version": "1.4.22",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"src",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "rm -rf ./dist && bun build ./src/index.ts --outdir ./dist --entry-naming index.js --format esm --sourcemap=external && bun build ./src/index.ts --outdir ./dist --entry-naming index.cjs --format cjs --sourcemap=external && bun tsc --project tsconfig.json",
|
|
22
|
+
"verify:dist": "bun run scripts/verify-dist.ts",
|
|
22
23
|
"fmt": "prettier --write . && forge fmt",
|
|
23
|
-
"release": "bun run fmt && bun run build && npm publish --tag latest"
|
|
24
|
+
"release": "bun run fmt && bun run build && bun run verify:dist && npm publish --tag latest"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/bun": "latest",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal ABI for Chainlink CCIP Router contract.
|
|
3
|
+
* Only includes functions needed for bridge operations.
|
|
4
|
+
*
|
|
5
|
+
* Full contract: https://etherscan.io/address/0x80226fc0Ee2b096224EeAc085Bb9a8cba1146f7D
|
|
6
|
+
*/
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
inputs: [
|
|
10
|
+
{ name: "destinationChainSelector", type: "uint64" },
|
|
11
|
+
{
|
|
12
|
+
name: "message",
|
|
13
|
+
type: "tuple",
|
|
14
|
+
components: [
|
|
15
|
+
{ name: "receiver", type: "bytes" },
|
|
16
|
+
{ name: "data", type: "bytes" },
|
|
17
|
+
{
|
|
18
|
+
name: "tokenAmounts",
|
|
19
|
+
type: "tuple[]",
|
|
20
|
+
components: [
|
|
21
|
+
{ name: "token", type: "address" },
|
|
22
|
+
{ name: "amount", type: "uint256" },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{ name: "feeToken", type: "address" },
|
|
26
|
+
{ name: "extraArgs", type: "bytes" },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
name: "ccipSend",
|
|
31
|
+
outputs: [{ name: "messageId", type: "bytes32" }],
|
|
32
|
+
stateMutability: "payable",
|
|
33
|
+
type: "function",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
inputs: [
|
|
37
|
+
{ name: "destinationChainSelector", type: "uint64" },
|
|
38
|
+
{
|
|
39
|
+
name: "message",
|
|
40
|
+
type: "tuple",
|
|
41
|
+
components: [
|
|
42
|
+
{ name: "receiver", type: "bytes" },
|
|
43
|
+
{ name: "data", type: "bytes" },
|
|
44
|
+
{
|
|
45
|
+
name: "tokenAmounts",
|
|
46
|
+
type: "tuple[]",
|
|
47
|
+
components: [
|
|
48
|
+
{ name: "token", type: "address" },
|
|
49
|
+
{ name: "amount", type: "uint256" },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
{ name: "feeToken", type: "address" },
|
|
53
|
+
{ name: "extraArgs", type: "bytes" },
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
name: "getFee",
|
|
58
|
+
outputs: [{ name: "fee", type: "uint256" }],
|
|
59
|
+
stateMutability: "view",
|
|
60
|
+
type: "function",
|
|
61
|
+
},
|
|
62
|
+
] as const;
|