diff --git a/package-lock.json b/package-lock.json index a4f02b0a..288a9fee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,6 @@ "@size-limit/esbuild": "^11.1.2", "@size-limit/preset-small-lib": "^11.1.2", "@types/jest": "^29.5.12", - "@types/node": "^20.12.5", "@types/text-encoding": "^0.0.39", "@typescript-eslint/eslint-plugin": "^7.5.0", "esbuild": "^0.20.2", diff --git a/package.json b/package.json index e4fe66c3..cfda5612 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "@size-limit/esbuild": "^11.1.2", "@size-limit/preset-small-lib": "^11.1.2", "@types/jest": "^29.5.12", - "@types/node": "^20.12.5", "@types/text-encoding": "^0.0.39", "@typescript-eslint/eslint-plugin": "^7.5.0", "esbuild": "^0.20.2", diff --git a/packages/ckbtc/candid/minter.certified.idl.js b/packages/ckbtc/candid/minter.certified.idl.js index 37c0da50..2052e010 100644 --- a/packages/ckbtc/candid/minter.certified.idl.js +++ b/packages/ckbtc/candid/minter.certified.idl.js @@ -10,6 +10,7 @@ export const idlFactory = ({ IDL }) => { 'kyt_principal' : IDL.Opt(IDL.Principal), 'mode' : IDL.Opt(Mode), 'retrieve_btc_min_amount' : IDL.Opt(IDL.Nat64), + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'max_time_in_queue_nanos' : IDL.Opt(IDL.Nat64), 'min_confirmations' : IDL.Opt(IDL.Nat32), 'kyt_fee' : IDL.Opt(IDL.Nat64), @@ -24,6 +25,7 @@ export const idlFactory = ({ IDL }) => { 'ecdsa_key_name' : IDL.Text, 'mode' : Mode, 'retrieve_btc_min_amount' : IDL.Nat64, + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'ledger_id' : IDL.Principal, 'max_time_in_queue_nanos' : IDL.Nat64, 'btc_network' : BtcNetwork, @@ -354,6 +356,7 @@ export const init = ({ IDL }) => { 'kyt_principal' : IDL.Opt(IDL.Principal), 'mode' : IDL.Opt(Mode), 'retrieve_btc_min_amount' : IDL.Opt(IDL.Nat64), + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'max_time_in_queue_nanos' : IDL.Opt(IDL.Nat64), 'min_confirmations' : IDL.Opt(IDL.Nat32), 'kyt_fee' : IDL.Opt(IDL.Nat64), @@ -368,6 +371,7 @@ export const init = ({ IDL }) => { 'ecdsa_key_name' : IDL.Text, 'mode' : Mode, 'retrieve_btc_min_amount' : IDL.Nat64, + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'ledger_id' : IDL.Principal, 'max_time_in_queue_nanos' : IDL.Nat64, 'btc_network' : BtcNetwork, diff --git a/packages/ckbtc/candid/minter.d.ts b/packages/ckbtc/candid/minter.d.ts index 9a998018..4e890157 100644 --- a/packages/ckbtc/candid/minter.d.ts +++ b/packages/ckbtc/candid/minter.d.ts @@ -125,6 +125,7 @@ export interface InitArgs { ecdsa_key_name: string; mode: Mode; retrieve_btc_min_amount: bigint; + new_kyt_principal: [] | [Principal]; ledger_id: Principal; max_time_in_queue_nanos: bigint; btc_network: BtcNetwork; @@ -230,6 +231,7 @@ export interface UpgradeArgs { kyt_principal: [] | [Principal]; mode: [] | [Mode]; retrieve_btc_min_amount: [] | [bigint]; + new_kyt_principal: [] | [Principal]; max_time_in_queue_nanos: [] | [bigint]; min_confirmations: [] | [number]; kyt_fee: [] | [bigint]; diff --git a/packages/ckbtc/candid/minter.did b/packages/ckbtc/candid/minter.did index 9ef8b460..7fcab692 100644 --- a/packages/ckbtc/candid/minter.did +++ b/packages/ckbtc/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/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid // Represents an account on the ckBTC ledger. type Account = record { owner : principal; subaccount : opt blob }; @@ -194,6 +194,9 @@ type InitArgs = record { /// The canister id of the KYT canister. kyt_principal: opt principal; + + /// The canister id of the new KYT canister. + new_kyt_principal: opt principal; }; // The upgrade parameters of the minter canister. @@ -217,6 +220,9 @@ type UpgradeArgs = record { /// The principal of the KYT canister. kyt_principal : opt principal; + + /// The principal of the new KYT canister. + new_kyt_principal : opt principal; }; type RetrieveBtcStatus = variant { @@ -308,6 +314,8 @@ type BitcoinAddress = variant { type MinterInfo = record { min_confirmations : nat32; + // This fee is based on the `retrieve_btc_min_amount` setting during canister + // initialization or upgrades, but may vary according to current network fees. retrieve_btc_min_amount : nat64; kyt_fee : nat64; }; diff --git a/packages/ckbtc/candid/minter.idl.js b/packages/ckbtc/candid/minter.idl.js index 749f6b62..5b70794f 100644 --- a/packages/ckbtc/candid/minter.idl.js +++ b/packages/ckbtc/candid/minter.idl.js @@ -10,6 +10,7 @@ export const idlFactory = ({ IDL }) => { 'kyt_principal' : IDL.Opt(IDL.Principal), 'mode' : IDL.Opt(Mode), 'retrieve_btc_min_amount' : IDL.Opt(IDL.Nat64), + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'max_time_in_queue_nanos' : IDL.Opt(IDL.Nat64), 'min_confirmations' : IDL.Opt(IDL.Nat32), 'kyt_fee' : IDL.Opt(IDL.Nat64), @@ -24,6 +25,7 @@ export const idlFactory = ({ IDL }) => { 'ecdsa_key_name' : IDL.Text, 'mode' : Mode, 'retrieve_btc_min_amount' : IDL.Nat64, + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'ledger_id' : IDL.Principal, 'max_time_in_queue_nanos' : IDL.Nat64, 'btc_network' : BtcNetwork, @@ -354,6 +356,7 @@ export const init = ({ IDL }) => { 'kyt_principal' : IDL.Opt(IDL.Principal), 'mode' : IDL.Opt(Mode), 'retrieve_btc_min_amount' : IDL.Opt(IDL.Nat64), + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'max_time_in_queue_nanos' : IDL.Opt(IDL.Nat64), 'min_confirmations' : IDL.Opt(IDL.Nat32), 'kyt_fee' : IDL.Opt(IDL.Nat64), @@ -368,6 +371,7 @@ export const init = ({ IDL }) => { 'ecdsa_key_name' : IDL.Text, 'mode' : Mode, 'retrieve_btc_min_amount' : IDL.Nat64, + 'new_kyt_principal' : IDL.Opt(IDL.Principal), 'ledger_id' : IDL.Principal, 'max_time_in_queue_nanos' : IDL.Nat64, 'btc_network' : BtcNetwork, 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 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 }); diff --git a/packages/cketh/candid/orchestrator.did b/packages/cketh/candid/orchestrator.did index 10ecc8c2..e059eb06 100644 --- a/packages/cketh/candid/orchestrator.did +++ b/packages/cketh/candid/orchestrator.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/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ethereum/ledger-suite-orchestrator/ledger_suite_orchestrator.did' by import-candid type OrchestratorArg = variant { UpgradeArg : UpgradeArg; InitArg : InitArg; diff --git a/packages/cketh/src/minter.canister.spec.ts b/packages/cketh/src/minter.canister.spec.ts index b82ea662..47cbc69e 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,59 @@ 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, + }); + + expect(service.withdraw_eth).toBeCalledTimes(1); + + const { address, ...rest } = params; + expect(service.withdraw_eth).toBeCalledWith({ + 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, + }); + + expect(service.withdraw_eth).toBeCalledTimes(1); + + const { address, ...rest } = params; + expect(service.withdraw_eth).toHaveBeenCalledWith({ + recipient: address, + from_subaccount: toNullable(fromSubaccount), + ...rest, + }); + }); + it("should throw MinterTemporarilyUnavailable", async () => { const service = mock>(); @@ -236,12 +283,89 @@ 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, + }); + + expect(service.withdraw_erc20).toBeCalledTimes(1); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenCalledWith({ + 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, + }); + + expect(service.withdraw_erc20).toBeCalledTimes(1); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenCalledWith({ + 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, + }); + + expect(service.withdraw_erc20).toBeCalledTimes(1); + + const { address, ledgerCanisterId, ...rest } = params; + expect(service.withdraw_erc20).toHaveBeenCalledWith({ + 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 +868,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, }); diff --git a/packages/cmc/candid/cmc.did b/packages/cmc/candid/cmc.did index 526d535b..d7dd33fa 100644 --- a/packages/cmc/candid/cmc.did +++ b/packages/cmc/candid/cmc.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/nns/cmc/cmc.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/nns/cmc/cmc.did' by import-candid type Cycles = nat; type BlockIndex = nat64; type log_visibility = variant { diff --git a/packages/ic-management/candid/ic-management.did b/packages/ic-management/candid/ic-management.did index ef4f4c4c..976d9068 100644 --- a/packages/ic-management/candid/ic-management.did +++ b/packages/ic-management/candid/ic-management.did @@ -1,4 +1,4 @@ -// Generated from dfinity/interface-spec commit 9a5077e7f90f06a5c45e83bcdbec73a6e5427537 for file 'spec/_attachments/ic.did' +// Generated from dfinity/portal commit 407ec5b92d06618c4df9f52e98514c5f4f44313e for file 'docs/references/_attachments/ic.did' type canister_id = principal; type wasm_module = blob; type snapshot_id = blob; diff --git a/packages/ledger-icp/candid/index.did b/packages/ledger-icp/candid/index.did index df13b44a..7bd5e968 100644 --- a/packages/ledger-icp/candid/index.did +++ b/packages/ledger-icp/candid/index.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/ledger_suite/icp/index/index.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ledger_suite/icp/index/index.did' by import-candid type Account = record { owner : principal; subaccount : opt vec nat8 }; type GetAccountIdentifierTransactionsArgs = record { max_results : nat64; diff --git a/packages/ledger-icp/candid/ledger.did b/packages/ledger-icp/candid/ledger.did index ade6c698..6d8af496 100644 --- a/packages/ledger-icp/candid/ledger.did +++ b/packages/ledger-icp/candid/ledger.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/ledger_suite/icp/ledger.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ledger_suite/icp/ledger.did' by import-candid // This is the official Ledger interface that is guaranteed to be backward compatible. // Amount of tokens, measured in 10^-8 of a token. diff --git a/packages/ledger-icrc/candid/icrc_index-ng.did b/packages/ledger-icrc/candid/icrc_index-ng.did index 52ea9400..864f9a04 100644 --- a/packages/ledger-icrc/candid/icrc_index-ng.did +++ b/packages/ledger-icrc/candid/icrc_index-ng.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/ledger_suite/icrc1/index-ng/index-ng.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ledger_suite/icrc1/index-ng/index-ng.did' by import-candid type Tokens = nat; type InitArg = record { diff --git a/packages/ledger-icrc/candid/icrc_index.did b/packages/ledger-icrc/candid/icrc_index.did index 9f812e44..73e23f6c 100644 --- a/packages/ledger-icrc/candid/icrc_index.did +++ b/packages/ledger-icrc/candid/icrc_index.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/ledger_suite/icrc1/index/index.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ledger_suite/icrc1/index/index.did' by import-candid type TxId = nat; type Account = record { owner : principal; subaccount : opt blob }; diff --git a/packages/ledger-icrc/candid/icrc_ledger.did b/packages/ledger-icrc/candid/icrc_ledger.did index ba0173ae..e295c539 100644 --- a/packages/ledger-icrc/candid/icrc_ledger.did +++ b/packages/ledger-icrc/candid/icrc_ledger.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/ledger_suite/icrc1/ledger/ledger.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/ledger_suite/icrc1/ledger/ledger.did' by import-candid type BlockIndex = nat; type Subaccount = blob; // Number of nanoseconds since the UNIX epoch in UTC timezone. diff --git a/packages/nns/candid/genesis_token.did b/packages/nns/candid/genesis_token.did index cceaa4ac..b3aff5bc 100644 --- a/packages/nns/candid/genesis_token.did +++ b/packages/nns/candid/genesis_token.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/nns/gtc/canister/gtc.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/nns/gtc/canister/gtc.did' by import-candid type AccountState = record { authenticated_principal_id : opt principal; successfully_transferred_neurons : vec TransferredNeuron; diff --git a/packages/nns/candid/governance.did b/packages/nns/candid/governance.did index c0c9eed5..6ac32013 100644 --- a/packages/nns/candid/governance.did +++ b/packages/nns/candid/governance.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/nns/governance/canister/governance.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/nns/governance/canister/governance.did' by import-candid type AccountIdentifier = record { hash : blob; }; diff --git a/packages/nns/candid/governance_test.did b/packages/nns/candid/governance_test.did index 7e2728b9..b4392465 100644 --- a/packages/nns/candid/governance_test.did +++ b/packages/nns/candid/governance_test.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/nns/governance/canister/governance_test.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/nns/governance/canister/governance_test.did' by import-candid type AccountIdentifier = record { hash : blob; }; diff --git a/packages/nns/candid/sns_wasm.did b/packages/nns/candid/sns_wasm.did index 9acde42f..08185a3c 100644 --- a/packages/nns/candid/sns_wasm.did +++ b/packages/nns/candid/sns_wasm.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/nns/sns-wasm/canister/sns-wasm.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid type AddWasmRequest = record { hash : blob; wasm : opt SnsWasm; diff --git a/packages/sns/candid/sns_governance.certified.idl.js b/packages/sns/candid/sns_governance.certified.idl.js index 57067b2d..e990bd8a 100644 --- a/packages/sns/candid/sns_governance.certified.idl.js +++ b/packages/sns/candid/sns_governance.certified.idl.js @@ -68,6 +68,10 @@ export const idlFactory = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -157,7 +162,7 @@ export const idlFactory = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -429,7 +434,7 @@ export const idlFactory = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), @@ -517,6 +522,12 @@ export const idlFactory = ({ IDL }) => { 'idle_cycles_burned_per_day' : IDL.Nat, 'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), }); + const UpgradeInProgress = IDL.Record({ + 'mark_failed_at_seconds' : IDL.Nat64, + 'checking_upgrade_lock' : IDL.Nat64, + 'proposal_id' : IDL.Nat64, + 'target_version' : IDL.Opt(Version), + }); const GetRunningSnsVersionResponse = IDL.Record({ 'deployed_version' : IDL.Opt(Version), 'pending_version' : IDL.Opt(UpgradeInProgress), @@ -737,6 +748,10 @@ export const init = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -770,6 +785,7 @@ export const init = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -826,7 +842,7 @@ export const init = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -1098,7 +1114,7 @@ export const init = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), diff --git a/packages/sns/candid/sns_governance.d.ts b/packages/sns/candid/sns_governance.d.ts index ffb59adb..f8595a55 100644 --- a/packages/sns/candid/sns_governance.d.ts +++ b/packages/sns/candid/sns_governance.d.ts @@ -246,7 +246,7 @@ export interface Governance { deployed_version: [] | [Version]; sns_initialization_parameters: string; latest_reward_event: [] | [RewardEvent]; - pending_version: [] | [UpgradeInProgress]; + pending_version: [] | [PendingVersion]; swap_canister_id: [] | [Principal]; ledger_canister_id: [] | [Principal]; proposals: Array<[bigint, ProposalData]>; @@ -454,6 +454,12 @@ export type Operation = | { IncreaseDissolveDelay: IncreaseDissolveDelay } | { SetDissolveTimestamp: SetDissolveTimestamp }; export type Participant = { NeuronsFund: NeuronsFund } | { Direct: {} }; +export interface PendingVersion { + mark_failed_at_seconds: bigint; + checking_upgrade_lock: bigint; + proposal_id: bigint; + target_version: [] | [Version]; +} export interface Percentage { basis_points: [] | [bigint]; } @@ -585,6 +591,7 @@ export interface UpgradeJournalEntry { | [] | [ | { TargetVersionSet: TargetVersionSet } + | { UpgradeStepsReset: UpgradeStepsReset } | { UpgradeOutcome: UpgradeOutcome } | { UpgradeStarted: UpgradeStarted } | { UpgradeStepsRefreshed: UpgradeStepsRefreshed } @@ -622,6 +629,10 @@ export interface UpgradeStarted { export interface UpgradeStepsRefreshed { upgrade_steps: [] | [Versions]; } +export interface UpgradeStepsReset { + human_readable: [] | [string]; + upgrade_steps: [] | [Versions]; +} export interface Valuation { token: [] | [number]; account: [] | [Account]; diff --git a/packages/sns/candid/sns_governance.did b/packages/sns/candid/sns_governance.did index 8109b158..dc6810b2 100644 --- a/packages/sns/candid/sns_governance.did +++ b/packages/sns/candid/sns_governance.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/sns/governance/canister/governance.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/sns/governance/canister/governance.did' by import-candid type Account = record { owner : opt principal; subaccount : opt Subaccount; @@ -283,7 +283,7 @@ type Governance = record { cached_upgrade_steps : opt CachedUpgradeSteps; sns_initialization_parameters : text; latest_reward_event : opt RewardEvent; - pending_version : opt UpgradeInProgress; + pending_version : opt PendingVersion; swap_canister_id : opt principal; ledger_canister_id : opt principal; proposals : vec record { nat64; ProposalData }; @@ -679,6 +679,13 @@ type UpgradeInProgress = record { target_version : opt Version; }; +type PendingVersion = record { + mark_failed_at_seconds : nat64; + checking_upgrade_lock : nat64; + proposal_id : nat64; + target_version : opt Version; +}; + type UpgradeSnsControlledCanister = record { new_canister_wasm : blob; mode : opt int32; @@ -724,6 +731,7 @@ type WaitForQuietState = record { type UpgradeJournalEntry = record { event : opt variant { UpgradeStepsRefreshed : UpgradeStepsRefreshed; + UpgradeStepsReset : UpgradeStepsReset; TargetVersionSet : TargetVersionSet; TargetVersionReset : TargetVersionReset; UpgradeStarted : UpgradeStarted; @@ -736,6 +744,11 @@ type UpgradeStepsRefreshed = record { upgrade_steps : opt Versions; }; +type UpgradeStepsReset = record { + human_readable : opt text; + upgrade_steps : opt Versions; +}; + type TargetVersionSet = record { new_target_version : opt Version; old_target_version : opt Version; diff --git a/packages/sns/candid/sns_governance.idl.js b/packages/sns/candid/sns_governance.idl.js index eea6036c..824428f9 100644 --- a/packages/sns/candid/sns_governance.idl.js +++ b/packages/sns/candid/sns_governance.idl.js @@ -68,6 +68,10 @@ export const idlFactory = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -157,7 +162,7 @@ export const idlFactory = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -429,7 +434,7 @@ export const idlFactory = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), @@ -517,6 +522,12 @@ export const idlFactory = ({ IDL }) => { 'idle_cycles_burned_per_day' : IDL.Nat, 'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), }); + const UpgradeInProgress = IDL.Record({ + 'mark_failed_at_seconds' : IDL.Nat64, + 'checking_upgrade_lock' : IDL.Nat64, + 'proposal_id' : IDL.Nat64, + 'target_version' : IDL.Opt(Version), + }); const GetRunningSnsVersionResponse = IDL.Record({ 'deployed_version' : IDL.Opt(Version), 'pending_version' : IDL.Opt(UpgradeInProgress), @@ -745,6 +756,10 @@ export const init = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -778,6 +793,7 @@ export const init = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -834,7 +850,7 @@ export const init = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -1106,7 +1122,7 @@ export const init = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), diff --git a/packages/sns/candid/sns_governance_test.certified.idl.js b/packages/sns/candid/sns_governance_test.certified.idl.js index ae0e278a..0d59a7c9 100644 --- a/packages/sns/candid/sns_governance_test.certified.idl.js +++ b/packages/sns/candid/sns_governance_test.certified.idl.js @@ -68,6 +68,10 @@ export const idlFactory = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -157,7 +162,7 @@ export const idlFactory = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -429,7 +434,7 @@ export const idlFactory = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), @@ -528,6 +533,12 @@ export const idlFactory = ({ IDL }) => { 'idle_cycles_burned_per_day' : IDL.Nat, 'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), }); + const UpgradeInProgress = IDL.Record({ + 'mark_failed_at_seconds' : IDL.Nat64, + 'checking_upgrade_lock' : IDL.Nat64, + 'proposal_id' : IDL.Nat64, + 'target_version' : IDL.Opt(Version), + }); const GetRunningSnsVersionResponse = IDL.Record({ 'deployed_version' : IDL.Opt(Version), 'pending_version' : IDL.Opt(UpgradeInProgress), @@ -760,6 +771,10 @@ export const init = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -793,6 +808,7 @@ export const init = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -849,7 +865,7 @@ export const init = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -1121,7 +1137,7 @@ export const init = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), diff --git a/packages/sns/candid/sns_governance_test.d.ts b/packages/sns/candid/sns_governance_test.d.ts index 757ea010..9389bb2f 100644 --- a/packages/sns/candid/sns_governance_test.d.ts +++ b/packages/sns/candid/sns_governance_test.d.ts @@ -257,7 +257,7 @@ export interface Governance { deployed_version: [] | [Version]; sns_initialization_parameters: string; latest_reward_event: [] | [RewardEvent]; - pending_version: [] | [UpgradeInProgress]; + pending_version: [] | [PendingVersion]; swap_canister_id: [] | [Principal]; ledger_canister_id: [] | [Principal]; proposals: Array<[bigint, ProposalData]>; @@ -469,6 +469,12 @@ export type Operation = | { IncreaseDissolveDelay: IncreaseDissolveDelay } | { SetDissolveTimestamp: SetDissolveTimestamp }; export type Participant = { NeuronsFund: NeuronsFund } | { Direct: {} }; +export interface PendingVersion { + mark_failed_at_seconds: bigint; + checking_upgrade_lock: bigint; + proposal_id: bigint; + target_version: [] | [Version]; +} export interface Percentage { basis_points: [] | [bigint]; } @@ -600,6 +606,7 @@ export interface UpgradeJournalEntry { | [] | [ | { TargetVersionSet: TargetVersionSet } + | { UpgradeStepsReset: UpgradeStepsReset } | { UpgradeOutcome: UpgradeOutcome } | { UpgradeStarted: UpgradeStarted } | { UpgradeStepsRefreshed: UpgradeStepsRefreshed } @@ -637,6 +644,10 @@ export interface UpgradeStarted { export interface UpgradeStepsRefreshed { upgrade_steps: [] | [Versions]; } +export interface UpgradeStepsReset { + human_readable: [] | [string]; + upgrade_steps: [] | [Versions]; +} export interface Valuation { token: [] | [number]; account: [] | [Account]; diff --git a/packages/sns/candid/sns_governance_test.did b/packages/sns/candid/sns_governance_test.did index 346e8ea5..b7945046 100644 --- a/packages/sns/candid/sns_governance_test.did +++ b/packages/sns/candid/sns_governance_test.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/sns/governance/canister/governance_test.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/sns/governance/canister/governance_test.did' by import-candid type Account = record { owner : opt principal; subaccount : opt Subaccount; @@ -292,7 +292,7 @@ type Governance = record { cached_upgrade_steps : opt CachedUpgradeSteps; sns_initialization_parameters : text; latest_reward_event : opt RewardEvent; - pending_version : opt UpgradeInProgress; + pending_version : opt PendingVersion; swap_canister_id : opt principal; ledger_canister_id : opt principal; proposals : vec record { nat64; ProposalData }; @@ -693,6 +693,13 @@ type UpgradeInProgress = record { target_version : opt Version; }; +type PendingVersion = record { + mark_failed_at_seconds : nat64; + checking_upgrade_lock : nat64; + proposal_id : nat64; + target_version : opt Version; +}; + type UpgradeSnsControlledCanister = record { new_canister_wasm : blob; mode : opt int32; @@ -738,6 +745,7 @@ type WaitForQuietState = record { type UpgradeJournalEntry = record { event : opt variant { UpgradeStepsRefreshed : UpgradeStepsRefreshed; + UpgradeStepsReset : UpgradeStepsReset; TargetVersionSet : TargetVersionSet; TargetVersionReset : TargetVersionReset; UpgradeStarted : UpgradeStarted; @@ -750,6 +758,11 @@ type UpgradeStepsRefreshed = record { upgrade_steps : opt Versions; }; +type UpgradeStepsReset = record { + human_readable : opt text; + upgrade_steps : opt Versions; +}; + type TargetVersionSet = record { new_target_version : opt Version; old_target_version : opt Version; diff --git a/packages/sns/candid/sns_governance_test.idl.js b/packages/sns/candid/sns_governance_test.idl.js index df9b28e0..e9ad158e 100644 --- a/packages/sns/candid/sns_governance_test.idl.js +++ b/packages/sns/candid/sns_governance_test.idl.js @@ -68,6 +68,10 @@ export const idlFactory = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -157,7 +162,7 @@ export const idlFactory = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -429,7 +434,7 @@ export const idlFactory = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), @@ -528,6 +533,12 @@ export const idlFactory = ({ IDL }) => { 'idle_cycles_burned_per_day' : IDL.Nat, 'module_hash' : IDL.Opt(IDL.Vec(IDL.Nat8)), }); + const UpgradeInProgress = IDL.Record({ + 'mark_failed_at_seconds' : IDL.Nat64, + 'checking_upgrade_lock' : IDL.Nat64, + 'proposal_id' : IDL.Nat64, + 'target_version' : IDL.Opt(Version), + }); const GetRunningSnsVersionResponse = IDL.Record({ 'deployed_version' : IDL.Opt(Version), 'pending_version' : IDL.Opt(UpgradeInProgress), @@ -768,6 +779,10 @@ export const init = ({ IDL }) => { 'old_target_version' : IDL.Opt(Version), 'new_target_version' : IDL.Opt(Version), }); + const UpgradeStepsReset = IDL.Record({ + 'human_readable' : IDL.Opt(IDL.Text), + 'upgrade_steps' : IDL.Opt(Versions), + }); const UpgradeOutcome = IDL.Record({ 'status' : IDL.Opt( IDL.Variant({ @@ -801,6 +816,7 @@ export const init = ({ IDL }) => { 'event' : IDL.Opt( IDL.Variant({ 'TargetVersionSet' : TargetVersionSet, + 'UpgradeStepsReset' : UpgradeStepsReset, 'UpgradeOutcome' : UpgradeOutcome, 'UpgradeStarted' : UpgradeStarted, 'UpgradeStepsRefreshed' : UpgradeStepsRefreshed, @@ -857,7 +873,7 @@ export const init = ({ IDL }) => { 'round' : IDL.Nat64, 'settled_proposals' : IDL.Vec(ProposalId), }); - const UpgradeInProgress = IDL.Record({ + const PendingVersion = IDL.Record({ 'mark_failed_at_seconds' : IDL.Nat64, 'checking_upgrade_lock' : IDL.Nat64, 'proposal_id' : IDL.Nat64, @@ -1129,7 +1145,7 @@ export const init = ({ IDL }) => { 'deployed_version' : IDL.Opt(Version), 'sns_initialization_parameters' : IDL.Text, 'latest_reward_event' : IDL.Opt(RewardEvent), - 'pending_version' : IDL.Opt(UpgradeInProgress), + 'pending_version' : IDL.Opt(PendingVersion), 'swap_canister_id' : IDL.Opt(IDL.Principal), 'ledger_canister_id' : IDL.Opt(IDL.Principal), 'proposals' : IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), diff --git a/packages/sns/candid/sns_root.did b/packages/sns/candid/sns_root.did index 4e93c33e..0c200bb4 100644 --- a/packages/sns/candid/sns_root.did +++ b/packages/sns/candid/sns_root.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/sns/root/canister/root.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/sns/root/canister/root.did' by import-candid type CanisterCallError = record { code : opt int32; description : text; diff --git a/packages/sns/candid/sns_swap.did b/packages/sns/candid/sns_swap.did index 1c9063e7..ab7bd05c 100644 --- a/packages/sns/candid/sns_swap.did +++ b/packages/sns/candid/sns_swap.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/sns/swap/canister/swap.did' by import-candid +// Generated from IC repo commit cb3cb61 (2024-11-14 tags: release-2024-11-14_03-07-base) 'rs/sns/swap/canister/swap.did' by import-candid type BuyerState = record { icp : opt TransferableAmount; has_created_neuron_recipes : opt bool;