From 820bc2e2e26a1cd1909b063b46d3779580a88455 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 18 Nov 2024 16:31:31 +0100 Subject: [PATCH 1/5] feat: update ckETH minter Signed-off-by: David Dal Busco --- packages/cketh/candid/minter.certified.idl.js | 4 ++++ packages/cketh/candid/minter.d.ts | 4 ++++ packages/cketh/candid/minter.did | 22 +++++++++++++++++-- packages/cketh/candid/minter.idl.js | 4 ++++ 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/cketh/candid/minter.certified.idl.js b/packages/cketh/candid/minter.certified.idl.js index f905b330..09ce19ad 100644 --- a/packages/cketh/candid/minter.certified.idl.js +++ b/packages/cketh/candid/minter.certified.idl.js @@ -264,6 +264,7 @@ export const idlFactory = ({ IDL }) => { ) ), 'minter_address' : IDL.Opt(IDL.Text), + 'last_deposit_with_subaccount_scraped_block_number' : IDL.Opt(IDL.Nat), 'ethereum_block_height' : IDL.Opt(BlockTag), }); const EthTransaction = IDL.Record({ 'transaction_hash' : IDL.Text }); @@ -289,6 +290,8 @@ export const idlFactory = ({ IDL }) => { const WithdrawErc20Arg = IDL.Record({ 'ckerc20_ledger_id' : IDL.Principal, 'recipient' : IDL.Text, + 'from_cketh_subaccount' : IDL.Opt(Subaccount), + 'from_ckerc20_subaccount' : IDL.Opt(Subaccount), 'amount' : IDL.Nat, }); const RetrieveErc20Request = IDL.Record({ @@ -330,6 +333,7 @@ export const idlFactory = ({ IDL }) => { }); const WithdrawalArg = IDL.Record({ 'recipient' : IDL.Text, + 'from_subaccount' : IDL.Opt(Subaccount), 'amount' : IDL.Nat, }); const RetrieveEthRequest = IDL.Record({ 'block_index' : IDL.Nat }); diff --git a/packages/cketh/candid/minter.d.ts b/packages/cketh/candid/minter.d.ts index 77b6c25b..40be61db 100644 --- a/packages/cketh/candid/minter.d.ts +++ b/packages/cketh/candid/minter.d.ts @@ -256,6 +256,7 @@ export interface MinterInfo { | [] | [Array<{ balance: bigint; erc20_contract_address: string }>]; minter_address: [] | [string]; + last_deposit_with_subaccount_scraped_block_number: [] | [bigint]; ethereum_block_height: [] | [BlockTag]; } export interface QueryStats { @@ -339,6 +340,8 @@ export interface UpgradeArg { export interface WithdrawErc20Arg { ckerc20_ledger_id: Principal; recipient: string; + from_cketh_subaccount: [] | [Subaccount]; + from_ckerc20_subaccount: [] | [Subaccount]; amount: bigint; } export type WithdrawErc20Error = @@ -356,6 +359,7 @@ export type WithdrawErc20Error = | { RecipientAddressBlocked: { address: string } }; export interface WithdrawalArg { recipient: string; + from_subaccount: [] | [Subaccount]; amount: bigint; } export interface WithdrawalDetail { diff --git a/packages/cketh/candid/minter.did b/packages/cketh/candid/minter.did index a0705c80..7af94a89 100644 --- a/packages/cketh/candid/minter.did +++ b/packages/cketh/candid/minter.did @@ -1,4 +1,4 @@ -// Generated from IC repo commit c47e172 (2024-10-25 tags: release-2024-11-07_03-07-6.11-kernel) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ethereum/cketh/minter/cketh_minter.did' by import-candid type EthereumNetwork = variant { // The public Ethereum mainnet. Mainnet; @@ -202,6 +202,9 @@ type MinterInfo = record { // Last scraped block number for logs of the ERC20 helper contract. last_erc20_scraped_block_number: opt nat; + // Last scraped block number for logs of the deposit with subaccount helper contract. + last_deposit_with_subaccount_scraped_block_number: opt nat; + // Canister ID of the ckETH ledger. cketh_ledger_id: opt principal; @@ -263,7 +266,16 @@ type RetrieveEthStatus = variant { TxFinalized : TxFinalizedStatus; }; -type WithdrawalArg = record { recipient : text; amount : nat }; +type WithdrawalArg = record { + // The address to which the minter should deposit ETH. + recipient : text; + + // The amount of ckETH in Wei that the client wants to withdraw. + amount : nat; + + // The subaccount to burn ckETH from. + from_subaccount : opt Subaccount; +}; // Details of a withdrawal request and its status. type WithdrawalDetail = record { @@ -351,6 +363,12 @@ type WithdrawErc20Arg = record { // Ethereum address to withdraw to. recipient : text; + + // The subaccount to burn ckETH from to pay for the transaction fee. + from_cketh_subaccount : opt Subaccount; + + // The subaccount to burn ckERC20 from. + from_ckerc20_subaccount : opt Subaccount; }; type RetrieveErc20Request = record { diff --git a/packages/cketh/candid/minter.idl.js b/packages/cketh/candid/minter.idl.js index 48ff9024..335ddb19 100644 --- a/packages/cketh/candid/minter.idl.js +++ b/packages/cketh/candid/minter.idl.js @@ -264,6 +264,7 @@ export const idlFactory = ({ IDL }) => { ) ), 'minter_address' : IDL.Opt(IDL.Text), + 'last_deposit_with_subaccount_scraped_block_number' : IDL.Opt(IDL.Nat), 'ethereum_block_height' : IDL.Opt(BlockTag), }); const EthTransaction = IDL.Record({ 'transaction_hash' : IDL.Text }); @@ -289,6 +290,8 @@ export const idlFactory = ({ IDL }) => { const WithdrawErc20Arg = IDL.Record({ 'ckerc20_ledger_id' : IDL.Principal, 'recipient' : IDL.Text, + 'from_cketh_subaccount' : IDL.Opt(Subaccount), + 'from_ckerc20_subaccount' : IDL.Opt(Subaccount), 'amount' : IDL.Nat, }); const RetrieveErc20Request = IDL.Record({ @@ -330,6 +333,7 @@ export const idlFactory = ({ IDL }) => { }); const WithdrawalArg = IDL.Record({ 'recipient' : IDL.Text, + 'from_subaccount' : IDL.Opt(Subaccount), 'amount' : IDL.Nat, }); const RetrieveEthRequest = IDL.Record({ 'block_index' : IDL.Nat }); From 07fcad32cc15af29efba6184cfda063b27ab44b8 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 18 Nov 2024 16:46:42 +0100 Subject: [PATCH 2/5] feat: from subacount parameters Signed-off-by: David Dal Busco --- packages/cketh/src/minter.canister.spec.ts | 117 ++++++++++++++++++++- packages/cketh/src/minter.canister.ts | 21 +++- 2 files changed, 135 insertions(+), 3 deletions(-) diff --git a/packages/cketh/src/minter.canister.spec.ts b/packages/cketh/src/minter.canister.spec.ts index b82ea662..87f66130 100644 --- a/packages/cketh/src/minter.canister.spec.ts +++ b/packages/cketh/src/minter.canister.spec.ts @@ -1,6 +1,6 @@ import { ActorSubclass } from "@dfinity/agent"; import { Principal } from "@dfinity/principal"; -import { toNullable } from "@dfinity/utils"; +import { arrayOfNumberToUint8Array, toNullable } from "@dfinity/utils"; import { mock } from "jest-mock-extended"; import { _SERVICE as CkETHMinterService, @@ -100,12 +100,55 @@ describe("ckETH minter canister", () => { const { address, ...rest } = params; expect(service.withdraw_eth).toBeCalledWith({ recipient: address, + from_subaccount: toNullable(), ...rest, }); expect(res).toEqual(success); }); + it("should call with subaccount numbers", async () => { + const service = mock>(); + service.withdraw_eth.mockResolvedValue(ok); + + const canister = minter(service); + + const fromSubaccount = [1, 2, 3]; + + await canister.withdrawEth({ + ...params, + fromSubaccount, + }); + + const { address, ...rest } = params; + expect(service.withdraw_eth).toHaveBeenNthCalledWith(1, { + recipient: address, + from_subaccount: toNullable(fromSubaccount), + ...rest, + }); + }); + + it("should call with subaccount uintarray", async () => { + const service = mock>(); + service.withdraw_eth.mockResolvedValue(ok); + + const canister = minter(service); + + const fromSubaccount = arrayOfNumberToUint8Array([1, 2, 3]); + + await canister.withdrawEth({ + ...params, + fromSubaccount, + }); + + const { address, ...rest } = params; + expect(service.withdraw_eth).toHaveBeenNthCalledWith(1, { + recipient: address, + from_subaccount: toNullable(fromSubaccount), + ...rest, + }); + }); + it("should throw MinterTemporarilyUnavailable", async () => { const service = mock>(); @@ -236,12 +279,83 @@ describe("ckETH minter canister", () => { expect(service.withdraw_erc20).toBeCalledWith({ recipient: address, ckerc20_ledger_id: ledgerCanisterIdMock, + from_cketh_subaccount: toNullable(), + from_ckerc20_subaccount: toNullable(), ...rest, }); expect(res).toEqual(success); }); + describe.each([[4, 5, 6], arrayOfNumberToUint8Array([7, 8, 9])])( + "should call with expected subaccount", + (account) => { + it("should call with ckEth subaccount", async () => { + const service = mock>(); + service.withdraw_erc20.mockResolvedValue(ok); + + const canister = minter(service); + + await canister.withdrawErc20({ + ...params, + fromCkEthSubaccount: account, + }); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + recipient: address, + ckerc20_ledger_id: ledgerCanisterIdMock, + from_cketh_subaccount: toNullable(account), + from_ckerc20_subaccount: toNullable(), + ...rest, + }); + }); + + it("should call with ckErc20 subaccount", async () => { + const service = mock>(); + service.withdraw_erc20.mockResolvedValue(ok); + + const canister = minter(service); + + await canister.withdrawErc20({ + ...params, + fromCkErc20Subaccount: account, + }); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + recipient: address, + ckerc20_ledger_id: ledgerCanisterIdMock, + from_cketh_subaccount: toNullable(), + from_ckerc20_subaccount: toNullable(account), + ...rest, + }); + }); + + it("should call with ckEth and ckErc20 subaccount", async () => { + const service = mock>(); + service.withdraw_erc20.mockResolvedValue(ok); + + const canister = minter(service); + + await canister.withdrawErc20({ + ...params, + fromCkEthSubaccount: account, + fromCkErc20Subaccount: account, + }); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + recipient: address, + ckerc20_ledger_id: ledgerCanisterIdMock, + from_cketh_subaccount: toNullable(account), + from_ckerc20_subaccount: toNullable(account), + ...rest, + }); + }); + }, + ); + it("should throw MinterTemporarilyUnavailable", async () => { const service = mock>(); @@ -744,6 +858,7 @@ describe("ckETH minter canister", () => { evm_rpc_id: toNullable( Principal.fromText("7hfb6-caaaa-aaaar-qadga-cai"), ), + last_deposit_with_subaccount_scraped_block_number: [], }; const service = mock>(); diff --git a/packages/cketh/src/minter.canister.ts b/packages/cketh/src/minter.canister.ts index c5fb68d3..43e15fa0 100644 --- a/packages/cketh/src/minter.canister.ts +++ b/packages/cketh/src/minter.canister.ts @@ -1,5 +1,11 @@ +import type { Subaccount } from "@dfinity/ledger-icrc/candid/icrc_ledger"; import type { Principal } from "@dfinity/principal"; -import { Canister, createServices, type QueryParams } from "@dfinity/utils"; +import { + Canister, + createServices, + toNullable, + type QueryParams, +} from "@dfinity/utils"; import type { _SERVICE as CkETHMinterService, Eip1559TransactionPrice, @@ -57,14 +63,17 @@ export class CkETHMinterCanister extends Canister { * @param {Object} params The parameters to withdrawal ckETH to ETH. * @param {string} params.address The destination ETH address. * @param {bigint} params.amount The ETH amount in wei. + * @param {Subacount} params.fromSubaccount The optional subaccount to burn ckETH from. * @returns {Promise} The successful result or the operation. */ withdrawEth = async ({ address, + fromSubaccount, ...rest }: { address: string; amount: bigint; + fromSubaccount?: Subaccount; }): Promise => { const { withdraw_eth } = this.caller({ certified: true, @@ -72,6 +81,7 @@ export class CkETHMinterCanister extends Canister { const response = await withdraw_eth({ recipient: address, + from_subaccount: toNullable(fromSubaccount), ...rest, }); @@ -93,17 +103,22 @@ export class CkETHMinterCanister extends Canister { * @param {Object} params The parameters to withdrawal ckErc20 to Erc20. * @param {string} params.address The destination ETH address. * @param {bigint} params.amount The ETH amount in wei. - * @param {Principal} params.ledgerCanisterId The ledger canister ID of the ckErc20. + * @param {Subaccount} params.fromCkEthSubaccount The optional subaccount to burn ckETH from to pay for the transaction fee. + * @param {Subaccount} params.fromCkEthSubaccount The optional subaccount to burn ckERC20 from. * @returns {Promise} The successful result or the operation. */ withdrawErc20 = async ({ address, ledgerCanisterId, + fromCkEthSubaccount, + fromCkErc20Subaccount, ...rest }: { address: string; amount: bigint; ledgerCanisterId: Principal; + fromCkEthSubaccount?: Subaccount; + fromCkErc20Subaccount?: Subaccount; }): Promise => { const { withdraw_erc20 } = this.caller({ certified: true, @@ -112,6 +127,8 @@ export class CkETHMinterCanister extends Canister { const response = await withdraw_erc20({ recipient: address, ckerc20_ledger_id: ledgerCanisterId, + from_cketh_subaccount: toNullable(fromCkEthSubaccount), + from_ckerc20_subaccount: toNullable(fromCkErc20Subaccount), ...rest, }); From 34dcbab2a16853b0eef9825aef25cd08371fd947 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 15:48:14 +0000 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=A4=96=20Documentation=20auto-update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cketh/README.md | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/cketh/README.md b/packages/cketh/README.md index 413d9aef..435bc528 100644 --- a/packages/cketh/README.md +++ b/packages/cketh/README.md @@ -53,7 +53,7 @@ const address = await getSmartContractAddress({}); ### :factory: CkETHMinterCanister -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L23) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L29) #### Methods @@ -71,7 +71,7 @@ const address = await getSmartContractAddress({}); | -------- | ------------------------------------------------------------------------ | | `create` | `(options: CkETHMinterCanisterOptions<_SERVICE>) => CkETHMinterCanister` | -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L24) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L30) ##### :gear: getSmartContractAddress @@ -86,7 +86,7 @@ Parameters: - `params`: The parameters to resolve the ckETH smart contract address. - `params.certified`: query or update call -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L42) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L48) ##### :gear: withdrawEth @@ -97,17 +97,18 @@ Preconditions: The caller allowed the minter's principal to spend its funds using [icrc2_approve] on the ckETH ledger. -| Method | Type | -| ------------- | --------------------------------------------------------------------------------------------- | -| `withdrawEth` | `({ address, ...rest }: { address: string; amount: bigint; }) => Promise` | +| Method | Type | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `withdrawEth` | `({ address, fromSubaccount, ...rest }: { address: string; amount: bigint; fromSubaccount?: Subaccount or undefined; }) => Promise` | Parameters: - `params`: The parameters to withdrawal ckETH to ETH. - `params.address`: The destination ETH address. - `params.amount`: The ETH amount in wei. +- `params.fromSubaccount`: The optional subaccount to burn ckETH from. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L62) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L69) ##### :gear: withdrawErc20 @@ -118,18 +119,19 @@ Preconditions: The caller allowed the minter's principal to spend its funds using [icrc2_approve] on the ckErc20 ledger and to burn some of the user’s ckETH tokens to pay for the transaction fees on the CkETH ledger. -| Method | Type | -| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | -| `withdrawErc20` | `({ address, ledgerCanisterId, ...rest }: { address: string; amount: bigint; ledgerCanisterId: Principal; }) => Promise` | +| Method | Type | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `withdrawErc20` | `({ address, ledgerCanisterId, fromCkEthSubaccount, fromCkErc20Subaccount, ...rest }: { address: string; amount: bigint; ledgerCanisterId: Principal; fromCkEthSubaccount?: Subaccount or undefined; fromCkErc20Subaccount?: Subaccount or undefined; }) => Promise<...>` | Parameters: - `params`: The parameters to withdrawal ckErc20 to Erc20. - `params.address`: The destination ETH address. - `params.amount`: The ETH amount in wei. -- `params.ledgerCanisterId`: The ledger canister ID of the ckErc20. +- `params.fromCkEthSubaccount`: The optional subaccount to burn ckETH from to pay for the transaction fee. +- `params.fromCkEthSubaccount`: The optional subaccount to burn ckERC20 from. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L99) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L110) ##### :gear: eip1559TransactionPrice @@ -145,7 +147,7 @@ Parameters: - `params.ckErc20LedgerId`: - The optional identifier for a particular ckERC20 ledger. - `params.certified`: - Indicates whether this is a certified query or an update call. -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L134) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L151) ##### :gear: retrieveEthStatus @@ -155,7 +157,7 @@ Retrieve the status of a withdrawal request. | ------------------- | ---------------------------------------------------- | | `retrieveEthStatus` | `(blockIndex: bigint) => Promise` | -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L149) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L166) ##### :gear: getMinterInfo @@ -170,7 +172,7 @@ Parameters: - `params`: The parameters to get the minter info. - `params.certified`: query or update call -[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L162) +[:link: Source](https://github.com/dfinity/ic-js/tree/main/packages/cketh/src/minter.canister.ts#L179) ### :factory: CkETHOrchestratorCanister From e34b08840a0635ddc0281f4a91c93e29a6f8696f Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 18 Nov 2024 19:23:17 +0100 Subject: [PATCH 4/5] feat: review feedback Signed-off-by: David Dal Busco --- packages/cketh/src/minter.canister.spec.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/cketh/src/minter.canister.spec.ts b/packages/cketh/src/minter.canister.spec.ts index 87f66130..0fb4ba43 100644 --- a/packages/cketh/src/minter.canister.spec.ts +++ b/packages/cketh/src/minter.canister.spec.ts @@ -120,8 +120,10 @@ describe("ckETH minter canister", () => { fromSubaccount, }); + expect(service.withdraw_eth).toBeCalledTimes(1); + const { address, ...rest } = params; - expect(service.withdraw_eth).toHaveBeenNthCalledWith(1, { + expect(service.withdraw_eth).toBeCalledWith(1, { recipient: address, from_subaccount: toNullable(fromSubaccount), ...rest, @@ -141,8 +143,10 @@ describe("ckETH minter canister", () => { fromSubaccount, }); + expect(service.withdraw_erc20).toBeCalledTimes(1); + const { address, ...rest } = params; - expect(service.withdraw_eth).toHaveBeenNthCalledWith(1, { + expect(service.withdraw_eth).toHaveBeenCalledWith({ recipient: address, from_subaccount: toNullable(fromSubaccount), ...rest, @@ -301,8 +305,10 @@ describe("ckETH minter canister", () => { fromCkEthSubaccount: account, }); + expect(service.withdraw_eth).toBeCalledTimes(1); + const { address, ledgerCanisterId, ...rest } = params; - expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + expect(service.withdraw_erc20).toHaveBeenCalledWith({ recipient: address, ckerc20_ledger_id: ledgerCanisterIdMock, from_cketh_subaccount: toNullable(account), @@ -322,8 +328,10 @@ describe("ckETH minter canister", () => { fromCkErc20Subaccount: account, }); + expect(service.withdraw_erc20).toBeCalledTimes(1); + const { address, ledgerCanisterId, ...rest } = params; - expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + expect(service.withdraw_erc20).toHaveBeenCalledWith({ recipient: address, ckerc20_ledger_id: ledgerCanisterIdMock, from_cketh_subaccount: toNullable(), @@ -344,8 +352,10 @@ describe("ckETH minter canister", () => { fromCkErc20Subaccount: account, }); + expect(service.withdraw_erc20).toBeCalledTimes(1); + const { address, ledgerCanisterId, ...rest } = params; - expect(service.withdraw_erc20).toHaveBeenNthCalledWith(1, { + expect(service.withdraw_erc20).toHaveBeenCalledWith({ recipient: address, ckerc20_ledger_id: ledgerCanisterIdMock, from_cketh_subaccount: toNullable(account), From a7bdeeb2c41f3c589d152e013c0b41daa89cf132 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Mon, 18 Nov 2024 19:28:40 +0100 Subject: [PATCH 5/5] fix: copy/paste errors Signed-off-by: David Dal Busco --- packages/cketh/src/minter.canister.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cketh/src/minter.canister.spec.ts b/packages/cketh/src/minter.canister.spec.ts index 0fb4ba43..47cbc69e 100644 --- a/packages/cketh/src/minter.canister.spec.ts +++ b/packages/cketh/src/minter.canister.spec.ts @@ -123,7 +123,7 @@ describe("ckETH minter canister", () => { expect(service.withdraw_eth).toBeCalledTimes(1); const { address, ...rest } = params; - expect(service.withdraw_eth).toBeCalledWith(1, { + expect(service.withdraw_eth).toBeCalledWith({ recipient: address, from_subaccount: toNullable(fromSubaccount), ...rest, @@ -143,7 +143,7 @@ describe("ckETH minter canister", () => { fromSubaccount, }); - expect(service.withdraw_erc20).toBeCalledTimes(1); + expect(service.withdraw_eth).toBeCalledTimes(1); const { address, ...rest } = params; expect(service.withdraw_eth).toHaveBeenCalledWith({ @@ -305,7 +305,7 @@ describe("ckETH minter canister", () => { fromCkEthSubaccount: account, }); - expect(service.withdraw_eth).toBeCalledTimes(1); + expect(service.withdraw_erc20).toBeCalledTimes(1); const { address, ledgerCanisterId, ...rest } = params; expect(service.withdraw_erc20).toHaveBeenCalledWith({