@ember-finance/sdk 2.12.0-ccip.0 → 2.12.0

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 (30) hide show
  1. package/dist/src/abis/index.d.ts +1 -3
  2. package/dist/src/abis/index.js +1 -4
  3. package/dist/src/api/v2/models/evm-contracts.d.ts +0 -9
  4. package/dist/src/api/v2/models/evm-oftadapter.d.ts +0 -11
  5. package/dist/src/api/v2/models/evm-oftadapter.js +1 -4
  6. package/dist/src/api/v2/models/evm-oftpeer.d.ts +0 -12
  7. package/dist/src/api/v2/models/index.d.ts +0 -3
  8. package/dist/src/api/v2/models/index.js +0 -3
  9. package/dist/src/api/v2/models/vault-parking-lot-info.d.ts +6 -0
  10. package/dist/src/evm-vaults/interfaces/index.d.ts +0 -39
  11. package/dist/src/evm-vaults/on-chain-calls/tx-builder.d.ts +1 -15
  12. package/dist/src/evm-vaults/on-chain-calls/tx-builder.js +0 -36
  13. package/dist/src/evm-vaults/on-chain-calls/user.d.ts +1 -33
  14. package/dist/src/evm-vaults/on-chain-calls/user.js +0 -61
  15. package/dist/src/evm-vaults/on-chain-calls/vault-reader.d.ts +1 -14
  16. package/dist/src/evm-vaults/on-chain-calls/vault-reader.js +0 -30
  17. package/dist/src/evm-vaults/utils/deployment-parser.d.ts +1 -27
  18. package/dist/src/evm-vaults/utils/deployment-parser.js +0 -37
  19. package/dist/src/evm-vaults/utils/index.d.ts +0 -1
  20. package/dist/src/evm-vaults/utils/index.js +0 -1
  21. package/package.json +1 -1
  22. package/dist/src/abis/CcipRouter.json +0 -58
  23. package/dist/src/api/v2/models/evm-ccip-lane.d.ts +0 -73
  24. package/dist/src/api/v2/models/evm-ccip-lane.js +0 -14
  25. package/dist/src/api/v2/models/evm-ccip-rate-limits.d.ts +0 -36
  26. package/dist/src/api/v2/models/evm-ccip-rate-limits.js +0 -14
  27. package/dist/src/api/v2/models/evm-ccip-token-pool.d.ts +0 -122
  28. package/dist/src/api/v2/models/evm-ccip-token-pool.js +0 -17
  29. package/dist/src/evm-vaults/utils/ccip.d.ts +0 -23
  30. package/dist/src/evm-vaults/utils/ccip.js +0 -32
@@ -3,7 +3,6 @@ import EmberProtocolConfigABI from "./EmberProtocolConfig.json";
3
3
  import ERC20TokenABI from "./ERC20Token.json";
4
4
  import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json";
5
5
  import OpenCoverVaultABI from "./OpenCoverVault.json";
6
- import CcipRouterABI from "./CcipRouter.json";
7
6
  import { Interface } from "ethers";
8
7
  declare const EmberVault: Interface;
9
8
  declare const EmberProtocolConfig: Interface;
@@ -11,5 +10,4 @@ declare const ERC20Token: Interface;
11
10
  declare const EmberETHVault: Interface;
12
11
  declare const EmberVaultOFTAdapter: Interface;
13
12
  declare const OpenCoverVault: Interface;
14
- declare const CcipRouter: Interface;
15
- export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault, CcipRouterABI, CcipRouter };
13
+ export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
@@ -4,7 +4,6 @@ import ERC20TokenABI from "./ERC20Token.json" with { type: "json" };
4
4
  import EmberETHVaultABI from "./EmberETHVault.json" with { type: "json" };
5
5
  import EmberVaultOFTAdapterABI from "./EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
6
6
  import OpenCoverVaultABI from "./OpenCoverVault.json" with { type: "json" };
7
- import CcipRouterABI from "./CcipRouter.json" with { type: "json" };
8
7
  import { Interface } from "ethers";
9
8
  const EmberVault = new Interface(EmberVaultABI.abi);
10
9
  const EmberProtocolConfig = new Interface(EmberProtocolConfigABI.abi);
@@ -12,6 +11,4 @@ const ERC20Token = new Interface(ERC20TokenABI.abi);
12
11
  const EmberETHVault = new Interface(EmberETHVaultABI.abi);
13
12
  const EmberVaultOFTAdapter = new Interface(EmberVaultOFTAdapterABI.abi);
14
13
  const OpenCoverVault = new Interface(OpenCoverVaultABI.abi);
15
- // Chainlink's Router, trimmed to what a bridge send needs: quote, then send.
16
- const CcipRouter = new Interface(CcipRouterABI.abi);
17
- export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault, CcipRouterABI, CcipRouter };
14
+ export { EmberVaultABI, EmberProtocolConfigABI, ERC20TokenABI, EmberVault, EmberProtocolConfig, ERC20Token, EmberETHVault, EmberVaultOFTAdapterABI, EmberVaultOFTAdapter, OpenCoverVaultABI, OpenCoverVault };
@@ -11,7 +11,6 @@
11
11
  */
12
12
  import type { EvmAtomicLiquidityLib } from "./evm-atomic-liquidity-lib.js";
13
13
  import type { EvmAtomicVault } from "./evm-atomic-vault.js";
14
- import type { EvmCcipTokenPool } from "./evm-ccip-token-pool.js";
15
14
  import type { EvmDepositParkingLot } from "./evm-deposit-parking-lot.js";
16
15
  import type { EvmDepositToken } from "./evm-deposit-token.js";
17
16
  import type { EvmOFTAdapter } from "./evm-oftadapter.js";
@@ -81,14 +80,6 @@ export interface EvmContracts {
81
80
  oftAdapters?: {
82
81
  [key: string]: EvmOFTAdapter;
83
82
  };
84
- /**
85
- * Map of CCIP token pools by name
86
- * @type {{ [key: string]: EvmCcipTokenPool; }}
87
- * @memberof EvmContracts
88
- */
89
- ccipTokenPools?: {
90
- [key: string]: EvmCcipTokenPool;
91
- };
92
83
  /**
93
84
  *
94
85
  * @type {EvmVaultValidator}
@@ -82,12 +82,6 @@ export interface EvmOFTAdapter {
82
82
  * @memberof EvmOFTAdapter
83
83
  */
84
84
  deploymentBlockNumber?: number;
85
- /**
86
- * Which bridge this entry describes. Read this rather than inferring the transport from which map the entry was found in.
87
- * @type {string}
88
- * @memberof EvmOFTAdapter
89
- */
90
- bridgeTransport?: EvmOFTAdapterBridgeTransportEnum;
91
85
  /**
92
86
  * Map of peers by LayerZero endpoint ID
93
87
  * @type {{ [key: string]: EvmOFTPeer; }}
@@ -97,8 +91,3 @@ export interface EvmOFTAdapter {
97
91
  [key: string]: EvmOFTPeer;
98
92
  };
99
93
  }
100
- export declare const EvmOFTAdapterBridgeTransportEnum: {
101
- readonly LayerZero: "LayerZero";
102
- readonly Ccip: "CCIP";
103
- };
104
- export type EvmOFTAdapterBridgeTransportEnum = (typeof EvmOFTAdapterBridgeTransportEnum)[keyof typeof EvmOFTAdapterBridgeTransportEnum];
@@ -11,7 +11,4 @@
11
11
  * https://openapi-generator.tech
12
12
  * Do not edit the class manually.
13
13
  */
14
- export const EvmOFTAdapterBridgeTransportEnum = {
15
- LayerZero: "LayerZero",
16
- Ccip: "CCIP"
17
- };
14
+ export {};
@@ -15,18 +15,6 @@
15
15
  * @interface EvmOFTPeer
16
16
  */
17
17
  export interface EvmOFTPeer {
18
- /**
19
- * The remote chain\'s network name, e.g. atlantic. The map key is a LayerZero endpoint ID, which names nothing outside LayerZero, so read this instead.
20
- * @type {string}
21
- * @memberof EvmOFTPeer
22
- */
23
- remoteNetwork?: string;
24
- /**
25
- * The bridge contract at the far end, as a plain address. Same meaning as remoteAddress on a CCIP lane.
26
- * @type {string}
27
- * @memberof EvmOFTPeer
28
- */
29
- remoteAddress?: string;
30
18
  /**
31
19
  * The peer address in bytes32 format
32
20
  * @type {string}
@@ -24,9 +24,6 @@ export * from "./ember-position.js";
24
24
  export * from "./escrow-claim-transaction.js";
25
25
  export * from "./evm-atomic-liquidity-lib.js";
26
26
  export * from "./evm-atomic-vault.js";
27
- export * from "./evm-ccip-lane.js";
28
- export * from "./evm-ccip-rate-limits.js";
29
- export * from "./evm-ccip-token-pool.js";
30
27
  export * from "./evm-contracts.js";
31
28
  export * from "./evm-deposit-parking-lot.js";
32
29
  export * from "./evm-deposit-token.js";
@@ -24,9 +24,6 @@ export * from "./ember-position.js";
24
24
  export * from "./escrow-claim-transaction.js";
25
25
  export * from "./evm-atomic-liquidity-lib.js";
26
26
  export * from "./evm-atomic-vault.js";
27
- export * from "./evm-ccip-lane.js";
28
- export * from "./evm-ccip-rate-limits.js";
29
- export * from "./evm-ccip-token-pool.js";
30
27
  export * from "./evm-contracts.js";
31
28
  export * from "./evm-deposit-parking-lot.js";
32
29
  export * from "./evm-deposit-token.js";
@@ -27,6 +27,12 @@ export interface VaultParkingLotInfo {
27
27
  * @memberof VaultParkingLotInfo
28
28
  */
29
29
  depositsPaused: boolean;
30
+ /**
31
+ * Whether cancelling a pending deposit request is currently blocked. New requests still join the queue and the operator still processes it, so the pending total can grow but not shrink. A client must not offer \"cancel\" while this is true — the on-chain call reverts.
32
+ * @type {boolean}
33
+ * @memberof VaultParkingLotInfo
34
+ */
35
+ cancellationsPaused: boolean;
30
36
  /**
31
37
  * Whether the parking lot is the vault\'s active deposit gate
32
38
  * @type {boolean}
@@ -242,45 +242,6 @@ export interface ICoverVaultCallOptions extends IUserCallOptions {
242
242
  /**
243
243
  * Optional parameters for high-level OFT bridge send calls.
244
244
  */
245
- /**
246
- * Parameters for a CCIP bridge send.
247
- *
248
- * Deliberately shaped like IOFTSendParam so the two transports read the same
249
- * way, but CCIP names a destination by chain selector rather than endpoint id,
250
- * and takes the receiver as a plain address — the SDK encodes it.
251
- */
252
- export interface ICcipSendParam {
253
- /** CCIP chain selector of the destination. A 64-bit value, so a string. */
254
- destinationChainSelector: string;
255
- /** Recipient address on the destination chain */
256
- receiver: string;
257
- /** Amount to send in local token decimals */
258
- amount: bigint;
259
- /** Fee token; omit to pay in the chain's native currency */
260
- feeToken?: string;
261
- /** Destination execution gas. 0 for a plain token transfer. */
262
- destinationGasLimit?: bigint;
263
- }
264
- /**
265
- * A CCIP fee quote.
266
- *
267
- * CCIP charges one fee, unlike LayerZero's native/LZ token split, and does not
268
- * quote the received amount separately: a burn-and-mint pool mints exactly what
269
- * was burned, so the amount received is the amount sent.
270
- */
271
- export interface ICcipFeeQuote {
272
- /** Fee required to send, in feeToken units (wei when paying natively) */
273
- fee: bigint;
274
- /** Token the fee is charged in; the zero address means native currency */
275
- feeToken: string;
276
- }
277
- /** Overrides for a CCIP bridge send. */
278
- export interface ICcipBridgeSendOptions extends IEvmCallOptions {
279
- /** Fee token; omit to pay in the chain's native currency */
280
- feeToken?: string;
281
- /** Destination execution gas. 0 for a plain token transfer. */
282
- destinationGasLimit?: bigint;
283
- }
284
245
  export interface IBridgeSendOptions extends IEvmCallOptions {
285
246
  /** Minimum amount to receive on destination; defaults to amount */
286
247
  minAmount?: bigint;
@@ -1,5 +1,5 @@
1
1
  import { EVMDeploymentParser } from "../utils/index.js";
2
- import { EvmProtocolInfo, VaultPauseOperation, ITransactionCall, IPermitSignature, IOFTSendParam, IOFTMessagingFee, ICcipSendParam } from "../interfaces/index.js";
2
+ import { EvmProtocolInfo, VaultPauseOperation, ITransactionCall, IPermitSignature, IOFTSendParam, IOFTMessagingFee } from "../interfaces/index.js";
3
3
  import { NumStr } from "../../common/types.js";
4
4
  /**
5
5
  * EVM Transaction Builder for Ember Protocol (ERC-4626 Compatible)
@@ -543,20 +543,6 @@ export declare class EVMTxBuilder {
543
543
  * @returns Transaction call object
544
544
  */
545
545
  bridgeSend(adapterAddress: string, sendParam: IOFTSendParam, fee: IOFTMessagingFee, refundAddress: string): ITransactionCall;
546
- /**
547
- * Builds the CCIP send call.
548
- *
549
- * The counterpart to bridgeSend, but the call goes to Chainlink's Router
550
- * rather than to our own pool: the Router pulls the tokens, charges the fee
551
- * and hands off to the pool. That is also why the approval for a CCIP bridge
552
- * goes to the Router and not to the pool.
553
- *
554
- * @param routerAddress The CCIP Router on the source chain
555
- * @param sendParam Destination, receiver and amount
556
- * @param tokenAddress The receipt token being bridged
557
- * @param fee Fee from getCcipFeeQuote, sent as value when paying natively
558
- */
559
- ccipSend(routerAddress: string, sendParam: ICcipSendParam, tokenAddress: string, fee: bigint): ITransactionCall;
560
546
  private atomicCall;
561
547
  /** Claim the caller's own escrowed (deferred) holdback collateral. */
562
548
  atomicClaimHoldback(vaultAddress: string): ITransactionCall;
@@ -4,8 +4,6 @@ import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json"
4
4
  import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
5
5
  import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
6
6
  import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
7
- import CcipRouterABI from "../../abis/CcipRouter.json" with { type: "json" };
8
- import { ZERO_ADDRESS, encodeCcipReceiver, encodeCcipExtraArgs } from "../utils/ccip.js";
9
7
  import AtomicLiquidityABI from "../../abis/AtomicLiquidity.json" with { type: "json" };
10
8
  import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
11
9
  import OpenCoverVaultABI from "../../abis/OpenCoverVault.json" with { type: "json" };
@@ -1149,40 +1147,6 @@ export class EVMTxBuilder {
1149
1147
  chainId: this.getChainId()
1150
1148
  };
1151
1149
  }
1152
- /**
1153
- * Builds the CCIP send call.
1154
- *
1155
- * The counterpart to bridgeSend, but the call goes to Chainlink's Router
1156
- * rather than to our own pool: the Router pulls the tokens, charges the fee
1157
- * and hands off to the pool. That is also why the approval for a CCIP bridge
1158
- * goes to the Router and not to the pool.
1159
- *
1160
- * @param routerAddress The CCIP Router on the source chain
1161
- * @param sendParam Destination, receiver and amount
1162
- * @param tokenAddress The receipt token being bridged
1163
- * @param fee Fee from getCcipFeeQuote, sent as value when paying natively
1164
- */
1165
- ccipSend(routerAddress, sendParam, tokenAddress, fee) {
1166
- const feeToken = sendParam.feeToken ?? ZERO_ADDRESS;
1167
- return {
1168
- to: routerAddress,
1169
- functionName: "ccipSend",
1170
- args: [
1171
- sendParam.destinationChainSelector,
1172
- {
1173
- receiver: encodeCcipReceiver(sendParam.receiver),
1174
- data: "0x",
1175
- tokenAmounts: [{ token: tokenAddress, amount: sendParam.amount }],
1176
- feeToken,
1177
- extraArgs: encodeCcipExtraArgs(sendParam.destinationGasLimit)
1178
- }
1179
- ],
1180
- abi: CcipRouterABI.abi,
1181
- // Paying in a token means the Router pulls it instead, so no value.
1182
- value: feeToken === ZERO_ADDRESS ? fee : 0n,
1183
- chainId: this.getChainId()
1184
- };
1185
- }
1186
1150
  // ============================================
1187
1151
  // Atomic Liquidity Vault methods (BFE-817/818)
1188
1152
  //
@@ -1,6 +1,6 @@
1
1
  import { Signer, Provider } from "ethers";
2
2
  import { EVMOnChainCalls } from "./onchain-calls.js";
3
- import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, ICoverVaultCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote, ICcipFeeQuote, ICcipBridgeSendOptions } from "../interfaces/index.js";
3
+ import { EvmProtocolInfo, IUserCallOptions, IEvmCallOptions, ICoverVaultCallOptions, EvmOnChainCallResponse, IPermitSignature, IETHDepositOptions, IBridgeSendOptions, IOFTFeeQuote } from "../interfaces/index.js";
4
4
  import { NumStr } from "../../common/types.js";
5
5
  import { Chain } from "../../api/v2/index.js";
6
6
  /**
@@ -423,38 +423,6 @@ export declare class EVMUserCalls extends EVMOnChainCalls {
423
423
  * @returns Transaction execution response
424
424
  */
425
425
  bridgeSendToken(destinationChain: Chain, tokenAddress: string, amount: NumStr, receiver: string, feeQuote: IOFTFeeQuote, options?: IBridgeSendOptions): Promise<EvmOnChainCallResponse>;
426
- /**
427
- * Bridges a receipt token to a destination chain using the vault's CCIP pool.
428
- *
429
- * The counterpart to bridgeSendToken. Call getBridgeTransportForVault first
430
- * and pick the matching method — a vault has exactly one active bridge, and
431
- * calling the wrong one throws rather than silently doing nothing.
432
- *
433
- * Two differences from the LayerZero path worth knowing:
434
- * - the allowance goes to the CCIP Router, not to the pool, because the
435
- * Router is what pulls the tokens;
436
- * - the destination is named by network, and the chain selector is read
437
- * from the configured lane. An unconfigured route throws here rather
438
- * than reverting on chain.
439
- *
440
- * @param destinationNetwork Destination network name, e.g. "atlantic"
441
- * @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
442
- * @param amount Amount to bridge in local token decimals
443
- * @param receiver Recipient wallet address on the destination chain
444
- * @param feeQuote Fee quote returned by reader.getCcipFeeQuote
445
- * @param options Optional bridge/send overrides
446
- * @returns Transaction execution response
447
- */
448
- bridgeSendTokenViaCcip(destinationNetwork: string, tokenAddress: string, amount: NumStr, receiver: string, feeQuote: ICcipFeeQuote, options?: ICcipBridgeSendOptions): Promise<EvmOnChainCallResponse>;
449
- /**
450
- * Reports which bridge a vault uses, or undefined if it has none.
451
- *
452
- * A vault has exactly one active bridge, but different vaults use different
453
- * ones, so branch on this rather than assuming either transport.
454
- *
455
- * @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
456
- */
457
- getBridgeTransportForVault(tokenAddress: string): "LayerZero" | "CCIP" | undefined;
458
426
  /**
459
427
  * Gets the vault contract instance for read operations
460
428
  * @param vaultAddress The address of the vault
@@ -637,67 +637,6 @@ export class EVMUserCalls extends EVMOnChainCalls {
637
637
  }, refundAddress);
638
638
  return this.execCall(txCall, options);
639
639
  }
640
- /**
641
- * Bridges a receipt token to a destination chain using the vault's CCIP pool.
642
- *
643
- * The counterpart to bridgeSendToken. Call getBridgeTransportForVault first
644
- * and pick the matching method — a vault has exactly one active bridge, and
645
- * calling the wrong one throws rather than silently doing nothing.
646
- *
647
- * Two differences from the LayerZero path worth knowing:
648
- * - the allowance goes to the CCIP Router, not to the pool, because the
649
- * Router is what pulls the tokens;
650
- * - the destination is named by network, and the chain selector is read
651
- * from the configured lane. An unconfigured route throws here rather
652
- * than reverting on chain.
653
- *
654
- * @param destinationNetwork Destination network name, e.g. "atlantic"
655
- * @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
656
- * @param amount Amount to bridge in local token decimals
657
- * @param receiver Recipient wallet address on the destination chain
658
- * @param feeQuote Fee quote returned by reader.getCcipFeeQuote
659
- * @param options Optional bridge/send overrides
660
- * @returns Transaction execution response
661
- */
662
- async bridgeSendTokenViaCcip(destinationNetwork, tokenAddress, amount, receiver, feeQuote, options) {
663
- if (!this.provider) {
664
- throw new Error("Provider required for bridge send read operations and allowance checks");
665
- }
666
- const pool = this.parser.getCcipTokenPoolByVaultAddress(tokenAddress);
667
- if (!pool?.router) {
668
- throw new Error(`CCIP token pool not found for token address: ${tokenAddress}`);
669
- }
670
- const lane = this.parser.getCcipLaneByVaultAndNetwork(tokenAddress, destinationNetwork);
671
- if (!lane?.remoteChainSelector) {
672
- throw new Error(`No CCIP lane configured from this chain to "${destinationNetwork}" for token ${tokenAddress}`);
673
- }
674
- const amountBigInt = BigInt(amount);
675
- // The Router moves the tokens, so it is the Router that needs approval.
676
- const token = new ethers.Contract(tokenAddress, ["function allowance(address,address) view returns (uint256)"], this.provider);
677
- const currentAllowance = await token.allowance(await this.getWalletAddress(), pool.router);
678
- if (currentAllowance < amountBigInt) {
679
- throw new Error(`Insufficient allowance for bridge transfer. Current allowance: ${currentAllowance}, required: ${amountBigInt}`);
680
- }
681
- const txCall = this.txBuilder.ccipSend(pool.router, {
682
- destinationChainSelector: lane.remoteChainSelector,
683
- receiver,
684
- amount: amountBigInt,
685
- feeToken: options?.feeToken,
686
- destinationGasLimit: options?.destinationGasLimit
687
- }, tokenAddress, feeQuote.fee);
688
- return this.execCall(txCall, options);
689
- }
690
- /**
691
- * Reports which bridge a vault uses, or undefined if it has none.
692
- *
693
- * A vault has exactly one active bridge, but different vaults use different
694
- * ones, so branch on this rather than assuming either transport.
695
- *
696
- * @param tokenAddress Receipt token address (also the vault identifier in EVM deployment data)
697
- */
698
- getBridgeTransportForVault(tokenAddress) {
699
- return this.parser.getBridgeTransportByVaultAddress(tokenAddress);
700
- }
701
640
  // ============================================
702
641
  // Read-Only Methods
703
642
  // ============================================
@@ -1,6 +1,6 @@
1
1
  import { Provider } from "ethers";
2
2
  import { EVMDeploymentParser } from "../utils/deployment-parser.js";
3
- import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain, IParkingLotInfo, ICcipSendParam, ICcipFeeQuote } from "../interfaces/index.js";
3
+ import { EvmProtocolInfo, IOFTSendParam, IOFTFeeQuote, IOFTVaultSupportedChain, IParkingLotInfo } from "../interfaces/index.js";
4
4
  import { NumStr } from "../../common/types.js";
5
5
  import { Chain, VaultsApi } from "../../api/v2/index.js";
6
6
  /**
@@ -524,17 +524,4 @@ export declare class EVMVaultReader {
524
524
  * @returns Combined fee quote including native fee and expected amounts
525
525
  */
526
526
  getOFTFeeQuote(vaultId: string, sendParam: IOFTSendParam, payInLzToken?: boolean): Promise<IOFTFeeQuote>;
527
- /**
528
- * Quotes what a CCIP bridge send will cost.
529
- *
530
- * The counterpart to getOFTFeeQuote. CCIP charges one fee rather than
531
- * LayerZero's native/LZ-token pair, and quotes no received amount: a
532
- * burn-and-mint pool mints exactly what it burned, so the amount received is
533
- * the amount sent.
534
- *
535
- * @param vaultId The vault (receipt token) address on the source chain
536
- * @param sendParam Destination, receiver and amount
537
- * @returns The fee and the token it is charged in
538
- */
539
- getCcipFeeQuote(vaultId: string, sendParam: ICcipSendParam): Promise<ICcipFeeQuote>;
540
527
  }
@@ -4,8 +4,6 @@ import EmberVaultABI from "../../abis/EmberVault.json" with { type: "json" };
4
4
  import EmberETHVaultABI from "../../abis/EmberETHVault.json" with { type: "json" };
5
5
  import EmberProtocolConfigABI from "../../abis/EmberProtocolConfig.json" with { type: "json" };
6
6
  import ERC20TokenABI from "../../abis/ERC20Token.json" with { type: "json" };
7
- import CcipRouterABI from "../../abis/CcipRouter.json" with { type: "json" };
8
- import { ZERO_ADDRESS, encodeCcipReceiver, encodeCcipExtraArgs } from "../utils/ccip.js";
9
7
  import EmberVaultOFTAdapterABI from "../../abis/EmberVaultMintBurnOFTAdapter.json" with { type: "json" };
10
8
  import EmberDepositParkingLotABI from "../../abis/EmberDepositParkingLot.json" with { type: "json" };
11
9
  import { Configuration, VaultsApi } from "../../api/v2/index.js";
@@ -738,32 +736,4 @@ export class EVMVaultReader {
738
736
  maxAmountLD: oftQuote.oftLimit.maxAmountLD
739
737
  };
740
738
  }
741
- /**
742
- * Quotes what a CCIP bridge send will cost.
743
- *
744
- * The counterpart to getOFTFeeQuote. CCIP charges one fee rather than
745
- * LayerZero's native/LZ-token pair, and quotes no received amount: a
746
- * burn-and-mint pool mints exactly what it burned, so the amount received is
747
- * the amount sent.
748
- *
749
- * @param vaultId The vault (receipt token) address on the source chain
750
- * @param sendParam Destination, receiver and amount
751
- * @returns The fee and the token it is charged in
752
- */
753
- async getCcipFeeQuote(vaultId, sendParam) {
754
- const pool = this.parser.getCcipTokenPoolByVaultAddress(vaultId);
755
- if (!pool?.router) {
756
- throw new Error(`CCIP token pool not found for vault: ${vaultId}`);
757
- }
758
- const feeToken = sendParam.feeToken ?? ZERO_ADDRESS;
759
- const router = new Contract(pool.router, CcipRouterABI.abi, this.provider);
760
- const fee = await router.getFee(sendParam.destinationChainSelector, {
761
- receiver: encodeCcipReceiver(sendParam.receiver),
762
- data: "0x",
763
- tokenAmounts: [{ token: vaultId, amount: sendParam.amount }],
764
- feeToken,
765
- extraArgs: encodeCcipExtraArgs(sendParam.destinationGasLimit)
766
- });
767
- return { fee, feeToken };
768
- }
769
739
  }
@@ -1,4 +1,4 @@
1
- import { EvmCcipLane, EvmCcipTokenPool, EvmOFTAdapter } from "../../api/v2/index.js";
1
+ import { EvmOFTAdapter } from "../../api/v2/index.js";
2
2
  import { EvmProtocolInfo } from "../interfaces/index.js";
3
3
  export declare class EVMDeploymentParser {
4
4
  deployment: EvmProtocolInfo;
@@ -124,30 +124,4 @@ export declare class EVMDeploymentParser {
124
124
  * @param vaultAddress The vault address (receipt token address in EVM deployment data)
125
125
  */
126
126
  getOFTAdapterObjectByVaultAddress(vaultAddress: string): EvmOFTAdapter | undefined;
127
- /**
128
- * Finds the CCIP token pool entry for a given vault address.
129
- * @param vaultAddress The vault address (receipt token address in EVM deployment data)
130
- */
131
- getCcipTokenPoolByVaultAddress(vaultAddress: string): EvmCcipTokenPool | undefined;
132
- /**
133
- * Reports which bridge a vault uses, or undefined if it has none.
134
- *
135
- * A vault has exactly one active bridge, but different vaults use different
136
- * ones, so call this before choosing between the LayerZero and CCIP send
137
- * methods rather than assuming either.
138
- *
139
- * @param vaultAddress The vault address (receipt token address in EVM deployment data)
140
- */
141
- getBridgeTransportByVaultAddress(vaultAddress: string): "LayerZero" | "CCIP" | undefined;
142
- /**
143
- * Finds the configured CCIP lane from a vault to a destination network.
144
- *
145
- * Lanes are keyed by the destination's CCIP chain selector, which nothing
146
- * outside CCIP knows, so this looks the lane up by network name instead.
147
- * A missing lane means the route is not configured — sending would revert.
148
- *
149
- * @param vaultAddress The vault address on the source chain
150
- * @param destinationNetwork The destination network name, e.g. "atlantic"
151
- */
152
- getCcipLaneByVaultAndNetwork(vaultAddress: string, destinationNetwork: string): EvmCcipLane | undefined;
153
127
  }
@@ -206,41 +206,4 @@ export class EVMDeploymentParser {
206
206
  }
207
207
  return entry;
208
208
  }
209
- /**
210
- * Finds the CCIP token pool entry for a given vault address.
211
- * @param vaultAddress The vault address (receipt token address in EVM deployment data)
212
- */
213
- getCcipTokenPoolByVaultAddress(vaultAddress) {
214
- return Object.values(this.deployment.contracts?.ccipTokenPools ?? {}).find(pool => pool.vaultAddress?.toLowerCase() === vaultAddress.toLowerCase());
215
- }
216
- /**
217
- * Reports which bridge a vault uses, or undefined if it has none.
218
- *
219
- * A vault has exactly one active bridge, but different vaults use different
220
- * ones, so call this before choosing between the LayerZero and CCIP send
221
- * methods rather than assuming either.
222
- *
223
- * @param vaultAddress The vault address (receipt token address in EVM deployment data)
224
- */
225
- getBridgeTransportByVaultAddress(vaultAddress) {
226
- if (this.getCcipTokenPoolByVaultAddress(vaultAddress))
227
- return "CCIP";
228
- if (this.getOFTAdapterObjectByVaultAddress(vaultAddress))
229
- return "LayerZero";
230
- return undefined;
231
- }
232
- /**
233
- * Finds the configured CCIP lane from a vault to a destination network.
234
- *
235
- * Lanes are keyed by the destination's CCIP chain selector, which nothing
236
- * outside CCIP knows, so this looks the lane up by network name instead.
237
- * A missing lane means the route is not configured — sending would revert.
238
- *
239
- * @param vaultAddress The vault address on the source chain
240
- * @param destinationNetwork The destination network name, e.g. "atlantic"
241
- */
242
- getCcipLaneByVaultAndNetwork(vaultAddress, destinationNetwork) {
243
- const pool = this.getCcipTokenPoolByVaultAddress(vaultAddress);
244
- return Object.values(pool?.lanes ?? {}).find(lane => lane.remoteNetwork?.toLowerCase() === destinationNetwork.toLowerCase());
245
- }
246
209
  }
@@ -1,3 +1,2 @@
1
1
  export * from "./deployment-parser.js";
2
2
  export * from "./permit-utils.js";
3
- export * from "./ccip.js";
@@ -1,3 +1,2 @@
1
1
  export * from "./deployment-parser.js";
2
2
  export * from "./permit-utils.js";
3
- export * from "./ccip.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ember-finance/sdk",
3
3
  "description": "Ember Protocol SDK",
4
- "version": "2.12.0-ccip.0",
4
+ "version": "2.12.0",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
7
7
  "main": "./dist/index.js",
@@ -1,58 +0,0 @@
1
- {
2
- "abi": [
3
- {
4
- "type": "function",
5
- "name": "getFee",
6
- "stateMutability": "view",
7
- "inputs": [
8
- { "name": "destChainSelector", "type": "uint64" },
9
- {
10
- "name": "message",
11
- "type": "tuple",
12
- "components": [
13
- { "name": "receiver", "type": "bytes" },
14
- { "name": "data", "type": "bytes" },
15
- {
16
- "name": "tokenAmounts",
17
- "type": "tuple[]",
18
- "components": [
19
- { "name": "token", "type": "address" },
20
- { "name": "amount", "type": "uint256" }
21
- ]
22
- },
23
- { "name": "feeToken", "type": "address" },
24
- { "name": "extraArgs", "type": "bytes" }
25
- ]
26
- }
27
- ],
28
- "outputs": [{ "name": "fee", "type": "uint256" }]
29
- },
30
- {
31
- "type": "function",
32
- "name": "ccipSend",
33
- "stateMutability": "payable",
34
- "inputs": [
35
- { "name": "destinationChainSelector", "type": "uint64" },
36
- {
37
- "name": "message",
38
- "type": "tuple",
39
- "components": [
40
- { "name": "receiver", "type": "bytes" },
41
- { "name": "data", "type": "bytes" },
42
- {
43
- "name": "tokenAmounts",
44
- "type": "tuple[]",
45
- "components": [
46
- { "name": "token", "type": "address" },
47
- { "name": "amount", "type": "uint256" }
48
- ]
49
- },
50
- { "name": "feeToken", "type": "address" },
51
- { "name": "extraArgs", "type": "bytes" }
52
- ]
53
- }
54
- ],
55
- "outputs": [{ "name": "messageId", "type": "bytes32" }]
56
- }
57
- ]
58
- }
@@ -1,73 +0,0 @@
1
- /**
2
- * Ember Protocol Vaults API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 2.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { EvmCcipRateLimits } from "./evm-ccip-rate-limits.js";
13
- /**
14
- * One configured destination. remoteNetwork and remoteAddress mean the same as on an OFT peer; the rest has no LayerZero equivalent.
15
- * @export
16
- * @interface EvmCcipLane
17
- */
18
- export interface EvmCcipLane {
19
- /**
20
- * The remote chain\'s network name, e.g. atlantic. The map key is a CCIP chain selector, so read this instead.
21
- * @type {string}
22
- * @memberof EvmCcipLane
23
- */
24
- remoteNetwork?: string;
25
- /**
26
- * The bridge contract at the far end, as a plain address. Same meaning as remoteAddress on an OFT peer.
27
- * @type {string}
28
- * @memberof EvmCcipLane
29
- */
30
- remoteAddress?: string;
31
- /**
32
- * The remote chain\'s CCIP selector, carried as a string because it is 64-bit
33
- * @type {string}
34
- * @memberof EvmCcipLane
35
- */
36
- remoteChainSelector?: string;
37
- /**
38
- * The remote CCIP token pool address
39
- * @type {string}
40
- * @memberof EvmCcipLane
41
- */
42
- remotePool?: string;
43
- /**
44
- * The remote receipt token address
45
- * @type {string}
46
- * @memberof EvmCcipLane
47
- */
48
- remoteToken?: string;
49
- /**
50
- *
51
- * @type {EvmCcipRateLimits}
52
- * @memberof EvmCcipLane
53
- */
54
- rateLimits?: EvmCcipRateLimits;
55
- /**
56
- * The timestamp when the lane was configured
57
- * @type {string}
58
- * @memberof EvmCcipLane
59
- */
60
- configuredAt?: string;
61
- /**
62
- * The transaction hash of the lane configuration
63
- * @type {string}
64
- * @memberof EvmCcipLane
65
- */
66
- txHash?: string;
67
- /**
68
- * The block number of the lane configuration
69
- * @type {number}
70
- * @memberof EvmCcipLane
71
- */
72
- blockNumber?: number;
73
- }
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Ember Protocol Vaults API
5
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- *
7
- * The version of the OpenAPI document: 2.0.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,36 +0,0 @@
1
- /**
2
- * Ember Protocol Vaults API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 2.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- * Per-lane outbound rate limiting. Has no LayerZero equivalent, so it is deliberately not flattened into a shared shape.
14
- * @export
15
- * @interface EvmCcipRateLimits
16
- */
17
- export interface EvmCcipRateLimits {
18
- /**
19
- * Whether rate limiting is enforced on this lane
20
- * @type {boolean}
21
- * @memberof EvmCcipRateLimits
22
- */
23
- enabled?: boolean;
24
- /**
25
- * Token bucket capacity, in receipt token base units
26
- * @type {string}
27
- * @memberof EvmCcipRateLimits
28
- */
29
- capacity?: string;
30
- /**
31
- * Refill rate, in receipt token base units per second
32
- * @type {string}
33
- * @memberof EvmCcipRateLimits
34
- */
35
- rate?: string;
36
- }
@@ -1,14 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Ember Protocol Vaults API
5
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- *
7
- * The version of the OpenAPI document: 2.0.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export {};
@@ -1,122 +0,0 @@
1
- /**
2
- * Ember Protocol Vaults API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 2.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { EvmCcipLane } from "./evm-ccip-lane.js";
13
- /**
14
- * The CCIP half of a vault\'s bridge, the counterpart to EvmOFTAdapter. A vault has one active transport; different vaults use different ones.
15
- * @export
16
- * @interface EvmCcipTokenPool
17
- */
18
- export interface EvmCcipTokenPool {
19
- /**
20
- * The CCIP token pool contract address
21
- * @type {string}
22
- * @memberof EvmCcipTokenPool
23
- */
24
- address?: string;
25
- /**
26
- * The contract name (e.g., EmberTokenPool)
27
- * @type {string}
28
- * @memberof EvmCcipTokenPool
29
- */
30
- contractName?: string;
31
- /**
32
- * Which bridge this entry describes. Read this rather than inferring the transport from which map the entry was found in.
33
- * @type {string}
34
- * @memberof EvmCcipTokenPool
35
- */
36
- bridgeTransport?: EvmCcipTokenPoolBridgeTransportEnum;
37
- /**
38
- * The pool\'s on-chain typeAndVersion (e.g., EmberBurnMintTokenPool 1.0.0)
39
- * @type {string}
40
- * @memberof EvmCcipTokenPool
41
- */
42
- typeAndVersion?: string;
43
- /**
44
- * The key of the associated vault
45
- * @type {string}
46
- * @memberof EvmCcipTokenPool
47
- */
48
- vaultKey?: string;
49
- /**
50
- * The address of the associated vault
51
- * @type {string}
52
- * @memberof EvmCcipTokenPool
53
- */
54
- vaultAddress?: string;
55
- /**
56
- * The receipt token symbol
57
- * @type {string}
58
- * @memberof EvmCcipTokenPool
59
- */
60
- receiptTokenSymbol?: string;
61
- /**
62
- * The receipt token decimals
63
- * @type {number}
64
- * @memberof EvmCcipTokenPool
65
- */
66
- decimals?: number;
67
- /**
68
- * The CCIP Router for this chain
69
- * @type {string}
70
- * @memberof EvmCcipTokenPool
71
- */
72
- router?: string;
73
- /**
74
- * The CCIP RMN proxy for this chain
75
- * @type {string}
76
- * @memberof EvmCcipTokenPool
77
- */
78
- rmnProxy?: string;
79
- /**
80
- * The CCIP token admin registry for this chain
81
- * @type {string}
82
- * @memberof EvmCcipTokenPool
83
- */
84
- tokenAdminRegistry?: string;
85
- /**
86
- * This chain\'s CCIP selector. A 64-bit value, carried as a string because it exceeds what a JSON number holds exactly.
87
- * @type {string}
88
- * @memberof EvmCcipTokenPool
89
- */
90
- chainSelector?: string;
91
- /**
92
- * The owner address
93
- * @type {string}
94
- * @memberof EvmCcipTokenPool
95
- */
96
- owner?: string;
97
- /**
98
- * The deployment timestamp
99
- * @type {string}
100
- * @memberof EvmCcipTokenPool
101
- */
102
- deployedAt?: string;
103
- /**
104
- * The block number at which the pool was deployed
105
- * @type {number}
106
- * @memberof EvmCcipTokenPool
107
- */
108
- deploymentBlockNumber?: number;
109
- /**
110
- * Map of configured destinations by remote CCIP chain selector
111
- * @type {{ [key: string]: EvmCcipLane; }}
112
- * @memberof EvmCcipTokenPool
113
- */
114
- lanes?: {
115
- [key: string]: EvmCcipLane;
116
- };
117
- }
118
- export declare const EvmCcipTokenPoolBridgeTransportEnum: {
119
- readonly LayerZero: "LayerZero";
120
- readonly Ccip: "CCIP";
121
- };
122
- export type EvmCcipTokenPoolBridgeTransportEnum = (typeof EvmCcipTokenPoolBridgeTransportEnum)[keyof typeof EvmCcipTokenPoolBridgeTransportEnum];
@@ -1,17 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Ember Protocol Vaults API
5
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
- *
7
- * The version of the OpenAPI document: 2.0.0
8
- *
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
- export const EvmCcipTokenPoolBridgeTransportEnum = {
15
- LayerZero: "LayerZero",
16
- Ccip: "CCIP"
17
- };
@@ -1,23 +0,0 @@
1
- /** The native currency, as CCIP names it when no fee token is given. */
2
- export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
3
- /**
4
- * Encodes a receiver for a CCIP message.
5
- *
6
- * CCIP carries the receiver as `bytes` rather than `address`, because the far
7
- * end of a lane need not be an EVM chain. On an EVM destination that is the
8
- * address left-padded to 32 bytes, which is why the same account looks
9
- * different on the two sides of a transfer.
10
- */
11
- export declare const encodeCcipReceiver: (receiver: string) => string;
12
- /**
13
- * Encodes CCIP extraArgs.
14
- *
15
- * `allowOutOfOrderExecution` is true because a token transfer carries no
16
- * message the destination has to apply in sequence; requiring ordering would
17
- * make one stuck message block every later one on the lane.
18
- *
19
- * gasLimit is 0 by default: a plain token transfer runs no code on the
20
- * destination beyond the pool's own mint, and paying for gas that is never used
21
- * only raises the fee.
22
- */
23
- export declare const encodeCcipExtraArgs: (destinationGasLimit?: bigint) => string;
@@ -1,32 +0,0 @@
1
- import { AbiCoder, getAddress, zeroPadValue } from "ethers";
2
- /** The native currency, as CCIP names it when no fee token is given. */
3
- export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
4
- /**
5
- * Tag for CCIP's EVMExtraArgsV2, the first four bytes of
6
- * keccak256("CCIP EVMExtraArgsV2"). Verified against a deployed ramp.
7
- */
8
- const EVM_EXTRA_ARGS_V2_TAG = "0x181dcf10";
9
- /**
10
- * Encodes a receiver for a CCIP message.
11
- *
12
- * CCIP carries the receiver as `bytes` rather than `address`, because the far
13
- * end of a lane need not be an EVM chain. On an EVM destination that is the
14
- * address left-padded to 32 bytes, which is why the same account looks
15
- * different on the two sides of a transfer.
16
- */
17
- export const encodeCcipReceiver = (receiver) => zeroPadValue(getAddress(receiver), 32);
18
- /**
19
- * Encodes CCIP extraArgs.
20
- *
21
- * `allowOutOfOrderExecution` is true because a token transfer carries no
22
- * message the destination has to apply in sequence; requiring ordering would
23
- * make one stuck message block every later one on the lane.
24
- *
25
- * gasLimit is 0 by default: a plain token transfer runs no code on the
26
- * destination beyond the pool's own mint, and paying for gas that is never used
27
- * only raises the fee.
28
- */
29
- export const encodeCcipExtraArgs = (destinationGasLimit = 0n) => {
30
- const encoded = AbiCoder.defaultAbiCoder().encode(["uint256", "bool"], [destinationGasLimit, true]);
31
- return EVM_EXTRA_ARGS_V2_TAG + encoded.slice(2);
32
- };