diff --git a/frontend/package-lock.json b/frontend/package-lock.json index e971975cdee..2b3a5b566dc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -749,9 +749,9 @@ } }, "node_modules/@dfinity/ckbtc": { - "version": "0.0.12-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ckbtc/-/ckbtc-0.0.12-next-2023-09-12.1.tgz", - "integrity": "sha512-FT9BfI6h0Q8Ju6HrtHPxiv4bkP63DblNf8hJo/o5LC1q3H3o0CeJy31cRWMFFJaEtjfzRCh7EZ/Vs4KHSd5Ffw==", + "version": "0.0.12-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ckbtc/-/ckbtc-0.0.12-next-2023-09-18.2.tgz", + "integrity": "sha512-HPWMPLFe9FWdE2ZUEgR4hcmbCVTnwR5gdtY8kcKDmNN8dsANUHCRYYGA7IUzDiubMG059GD2q2bftojwXCTyiQ==", "dependencies": { "@noble/hashes": "^1.3.2", "base58-js": "^1.0.5", @@ -765,9 +765,9 @@ } }, "node_modules/@dfinity/cmc": { - "version": "0.0.19-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/cmc/-/cmc-0.0.19-next-2023-09-12.1.tgz", - "integrity": "sha512-/S8RvE89uyT0uwuGyJOOgutuNo7i2h0DA1bKqzL9bayJiMY8KTcQO/Saq8sDpcXk/Xda11swk1VW0azXAXDs2w==", + "version": "0.0.19-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/cmc/-/cmc-0.0.19-next-2023-09-18.2.tgz", + "integrity": "sha512-ZfV86w12K5msWMzW6ngxZ5ynaKz4ljyrpuZ7gtTCq8nr0UMKyKd/e2mUFg9NizEf6VVsSqZYbWMcuE3BL+/1SA==", "peerDependencies": { "@dfinity/agent": "*", "@dfinity/candid": "*", @@ -790,9 +790,9 @@ } }, "node_modules/@dfinity/ic-management": { - "version": "0.0.9-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-0.0.9-next-2023-09-12.1.tgz", - "integrity": "sha512-hSvlEKk89JitjA/qbDdeiJKcW006/4GMy4J4dj1BzEPKzsA8dexCtthbKCWQgaBeGbSH2WJaPxUKk9WVvTuWLA==", + "version": "0.0.9-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-0.0.9-next-2023-09-18.2.tgz", + "integrity": "sha512-GjIku6+Sq4Sx6GQW3xHE4B7Mca3YKJElAV5+dJVyyBNLBY/4LjQ5yQSx2RT3cURjbgRj1PFxyC+oVHjpKRo7pg==", "peerDependencies": { "@dfinity/agent": "*", "@dfinity/candid": "*", @@ -816,9 +816,9 @@ } }, "node_modules/@dfinity/ledger": { - "version": "0.0.16-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-12.1.tgz", - "integrity": "sha512-ehgnuaAGI18l243JutBxJ1mnUsKpoa2pAXot0gsjt0GFK4UbvHBQr4ZMlae0nwlYeZuuHBMnwqeM4orirwmIpg==", + "version": "0.0.16-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-18.2.tgz", + "integrity": "sha512-+RPBsd6X4f23FO0KKvNDSwaiz3t21OYgBerjOT6yuAcjxWVwMchr3vUU/lHfO9DCM0m3Z/3FfZg4vHQJwvsPXg==", "peerDependencies": { "@dfinity/agent": "*", "@dfinity/candid": "*", @@ -827,9 +827,9 @@ } }, "node_modules/@dfinity/nns": { - "version": "0.16.8-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/nns/-/nns-0.16.8-next-2023-09-12.1.tgz", - "integrity": "sha512-p/Zb9zK++rVuAGTK8pUdiOVK+vadelkbm7O6fnBDc4ZudAJyHLR+CuRtWjCqjR34r3Lv39a2dQoTg4kxQnvgFQ==", + "version": "0.16.8-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/nns/-/nns-0.16.8-next-2023-09-18.2.tgz", + "integrity": "sha512-OCddJszT461Po8WJSu5PikkNbsYgcIaqdyBp9968GGxrKt+ofFNjmG4DPrcbPVx5X7jUXFeXJmlTzKUsokhfsA==", "dependencies": { "@noble/hashes": "^1.3.2", "randombytes": "^2.1.0" @@ -843,9 +843,9 @@ } }, "node_modules/@dfinity/nns-proto": { - "version": "0.0.9-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/nns-proto/-/nns-proto-0.0.9-next-2023-09-12.1.tgz", - "integrity": "sha512-pI2TPRzAj0nClMx3aRl6XSA09z9S2R/N+rA39zOMlXckqyhscMNfGlc3OFI1oSHuqYadXpZBWfaonDoutr8j6w==", + "version": "0.0.9-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/nns-proto/-/nns-proto-0.0.9-next-2023-09-18.2.tgz", + "integrity": "sha512-ZhGgDrmyd1cgOJjwLBvNQFwTdbEy8YbYtLYDU15Lny+T+qZO/5Empcuj/1vxhU/ljFl30Vip1bUmWcKB+I3G1g==", "dependencies": { "google-protobuf": "^3.21.2" } @@ -859,9 +859,9 @@ } }, "node_modules/@dfinity/sns": { - "version": "0.0.23-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/sns/-/sns-0.0.23-next-2023-09-12.1.tgz", - "integrity": "sha512-I83OiuKzJiCrJmojelJZn7HeCki1wnrUENPt+sEtNy3vhLvW1yh91nw2GjvdMFfSj2xoGSLmJYjJyi4xOssbVQ==", + "version": "0.0.23-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/sns/-/sns-0.0.23-next-2023-09-18.2.tgz", + "integrity": "sha512-TEhtABo0+sl7O9kjXG1cTahvovUnwxoMPcjWkNn2e3ntpS5pmUgcA9wWhDC6VrwR4v93H2XH9H+23IgiI2Dkkw==", "dependencies": { "@noble/hashes": "^1.3.2" }, @@ -874,9 +874,9 @@ } }, "node_modules/@dfinity/utils": { - "version": "0.0.23-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.23-next-2023-09-12.1.tgz", - "integrity": "sha512-18e/XdV/5M934GAt7vjaeWhDMvSRk4P1SnvFzIc9Et1VQAObJt9vpKOpfemsdaZz9V2EHoaJXZJTMrNyDHZ85Q==", + "version": "0.0.23-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.23-next-2023-09-18.2.tgz", + "integrity": "sha512-1cl2UyhfnnPn3RFkjWFhYKLNRv/8ab/RO+k/puFG/VU1igqagLhVB8HcGcLFcZdwpQhO2BEwUR3d/P5/HiPjtA==", "peerDependencies": { "@dfinity/agent": "*", "@dfinity/candid": "*", @@ -10052,9 +10052,9 @@ "requires": {} }, "@dfinity/ckbtc": { - "version": "0.0.12-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ckbtc/-/ckbtc-0.0.12-next-2023-09-12.1.tgz", - "integrity": "sha512-FT9BfI6h0Q8Ju6HrtHPxiv4bkP63DblNf8hJo/o5LC1q3H3o0CeJy31cRWMFFJaEtjfzRCh7EZ/Vs4KHSd5Ffw==", + "version": "0.0.12-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ckbtc/-/ckbtc-0.0.12-next-2023-09-18.2.tgz", + "integrity": "sha512-HPWMPLFe9FWdE2ZUEgR4hcmbCVTnwR5gdtY8kcKDmNN8dsANUHCRYYGA7IUzDiubMG059GD2q2bftojwXCTyiQ==", "requires": { "@noble/hashes": "^1.3.2", "base58-js": "^1.0.5", @@ -10062,9 +10062,9 @@ } }, "@dfinity/cmc": { - "version": "0.0.19-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/cmc/-/cmc-0.0.19-next-2023-09-12.1.tgz", - "integrity": "sha512-/S8RvE89uyT0uwuGyJOOgutuNo7i2h0DA1bKqzL9bayJiMY8KTcQO/Saq8sDpcXk/Xda11swk1VW0azXAXDs2w==", + "version": "0.0.19-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/cmc/-/cmc-0.0.19-next-2023-09-18.2.tgz", + "integrity": "sha512-ZfV86w12K5msWMzW6ngxZ5ynaKz4ljyrpuZ7gtTCq8nr0UMKyKd/e2mUFg9NizEf6VVsSqZYbWMcuE3BL+/1SA==", "requires": {} }, "@dfinity/gix-components": { @@ -10078,9 +10078,9 @@ } }, "@dfinity/ic-management": { - "version": "0.0.9-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-0.0.9-next-2023-09-12.1.tgz", - "integrity": "sha512-hSvlEKk89JitjA/qbDdeiJKcW006/4GMy4J4dj1BzEPKzsA8dexCtthbKCWQgaBeGbSH2WJaPxUKk9WVvTuWLA==", + "version": "0.0.9-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ic-management/-/ic-management-0.0.9-next-2023-09-18.2.tgz", + "integrity": "sha512-GjIku6+Sq4Sx6GQW3xHE4B7Mca3YKJElAV5+dJVyyBNLBY/4LjQ5yQSx2RT3cURjbgRj1PFxyC+oVHjpKRo7pg==", "requires": {} }, "@dfinity/identity": { @@ -10094,24 +10094,24 @@ } }, "@dfinity/ledger": { - "version": "0.0.16-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-12.1.tgz", - "integrity": "sha512-ehgnuaAGI18l243JutBxJ1mnUsKpoa2pAXot0gsjt0GFK4UbvHBQr4ZMlae0nwlYeZuuHBMnwqeM4orirwmIpg==", + "version": "0.0.16-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/ledger/-/ledger-0.0.16-next-2023-09-18.2.tgz", + "integrity": "sha512-+RPBsd6X4f23FO0KKvNDSwaiz3t21OYgBerjOT6yuAcjxWVwMchr3vUU/lHfO9DCM0m3Z/3FfZg4vHQJwvsPXg==", "requires": {} }, "@dfinity/nns": { - "version": "0.16.8-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/nns/-/nns-0.16.8-next-2023-09-12.1.tgz", - "integrity": "sha512-p/Zb9zK++rVuAGTK8pUdiOVK+vadelkbm7O6fnBDc4ZudAJyHLR+CuRtWjCqjR34r3Lv39a2dQoTg4kxQnvgFQ==", + "version": "0.16.8-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/nns/-/nns-0.16.8-next-2023-09-18.2.tgz", + "integrity": "sha512-OCddJszT461Po8WJSu5PikkNbsYgcIaqdyBp9968GGxrKt+ofFNjmG4DPrcbPVx5X7jUXFeXJmlTzKUsokhfsA==", "requires": { "@noble/hashes": "^1.3.2", "randombytes": "^2.1.0" } }, "@dfinity/nns-proto": { - "version": "0.0.9-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/nns-proto/-/nns-proto-0.0.9-next-2023-09-12.1.tgz", - "integrity": "sha512-pI2TPRzAj0nClMx3aRl6XSA09z9S2R/N+rA39zOMlXckqyhscMNfGlc3OFI1oSHuqYadXpZBWfaonDoutr8j6w==", + "version": "0.0.9-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/nns-proto/-/nns-proto-0.0.9-next-2023-09-18.2.tgz", + "integrity": "sha512-ZhGgDrmyd1cgOJjwLBvNQFwTdbEy8YbYtLYDU15Lny+T+qZO/5Empcuj/1vxhU/ljFl30Vip1bUmWcKB+I3G1g==", "requires": { "google-protobuf": "^3.21.2" } @@ -10125,17 +10125,17 @@ } }, "@dfinity/sns": { - "version": "0.0.23-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/sns/-/sns-0.0.23-next-2023-09-12.1.tgz", - "integrity": "sha512-I83OiuKzJiCrJmojelJZn7HeCki1wnrUENPt+sEtNy3vhLvW1yh91nw2GjvdMFfSj2xoGSLmJYjJyi4xOssbVQ==", + "version": "0.0.23-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/sns/-/sns-0.0.23-next-2023-09-18.2.tgz", + "integrity": "sha512-TEhtABo0+sl7O9kjXG1cTahvovUnwxoMPcjWkNn2e3ntpS5pmUgcA9wWhDC6VrwR4v93H2XH9H+23IgiI2Dkkw==", "requires": { "@noble/hashes": "^1.3.2" } }, "@dfinity/utils": { - "version": "0.0.23-next-2023-09-12.1", - "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.23-next-2023-09-12.1.tgz", - "integrity": "sha512-18e/XdV/5M934GAt7vjaeWhDMvSRk4P1SnvFzIc9Et1VQAObJt9vpKOpfemsdaZz9V2EHoaJXZJTMrNyDHZ85Q==", + "version": "0.0.23-next-2023-09-18.2", + "resolved": "https://registry.npmjs.org/@dfinity/utils/-/utils-0.0.23-next-2023-09-18.2.tgz", + "integrity": "sha512-1cl2UyhfnnPn3RFkjWFhYKLNRv/8ab/RO+k/puFG/VU1igqagLhVB8HcGcLFcZdwpQhO2BEwUR3d/P5/HiPjtA==", "requires": {} }, "@esbuild/android-arm": { diff --git a/frontend/src/lib/utils/anonymize.utils.ts b/frontend/src/lib/utils/anonymize.utils.ts index 43ae9c3e130..4da1d5e2e09 100644 --- a/frontend/src/lib/utils/anonymize.utils.ts +++ b/frontend/src/lib/utils/anonymize.utils.ts @@ -321,6 +321,7 @@ const anonymizeSnsTransaction = async ( burn: await anonymizeTransfer(tx.burn as TransferOpt), mint: await anonymizeTransfer(tx.mint as TransferOpt), transfer: await anonymizeTransfer(tx.transfer as TransferOpt), + approve: await anonymizeTransfer(tx.approve as TransferOpt), }; }; diff --git a/frontend/src/lib/utils/sns-ledger.utils.ts b/frontend/src/lib/utils/sns-ledger.utils.ts index eee4cf5b4b9..3c5dad864ac 100644 --- a/frontend/src/lib/utils/sns-ledger.utils.ts +++ b/frontend/src/lib/utils/sns-ledger.utils.ts @@ -14,39 +14,38 @@ export const ledgerErrorToToastError = ({ substitutions?: I18nSubstitutions; } => { if (err instanceof IcrcTransferError) { - const error: IcrcTransferError = err; - if ("GenericError" in error.errorType) { + if ("GenericError" in err.errorType) { return { labelKey: "error.transaction_error", - err: new Error(error.errorType.GenericError.message), + err: new Error(err.errorType.GenericError.message), }; } - if ("TemporarilyUnavailable" in error.errorType) { + if ("TemporarilyUnavailable" in err.errorType) { return { labelKey: "error__sns.ledger_temporarily_unavailable", }; } - if ("Duplicate" in error.errorType) { + if ("Duplicate" in err.errorType) { return { labelKey: "error__sns.ledger_duplicate", }; } - if ("BadFee" in error.errorType) { + if ("BadFee" in err.errorType) { return { labelKey: "error__sns.ledger_bad_fee", }; } - if ("CreatedInFuture" in error.errorType) { + if ("CreatedInFuture" in err.errorType) { return { labelKey: "error__sns.ledger_created_future", }; } - if ("TooOld" in error.errorType) { + if ("TooOld" in err.errorType) { return { labelKey: "error__sns.ledger_too_old", }; } - if ("InsufficientFunds" in error.errorType) { + if ("InsufficientFunds" in err.errorType) { return { labelKey: "error__sns.ledger_insufficient_funds", }; diff --git a/frontend/src/tests/mocks/icrc-transactions.mock.ts b/frontend/src/tests/mocks/icrc-transactions.mock.ts index d03c6af12b1..0325ae2a028 100644 --- a/frontend/src/tests/mocks/icrc-transactions.mock.ts +++ b/frontend/src/tests/mocks/icrc-transactions.mock.ts @@ -29,8 +29,10 @@ export const createIcrcTransactionWithId = ({ created_at_time: [BigInt(123)], amount: BigInt(33), fee: [BigInt(1)], + spender: [], }, ], + approve: [], }, }); @@ -52,8 +54,10 @@ const mockIcrcTransactionTransfer: IcrcTransaction = { created_at_time: [BigInt(123)], amount: BigInt(33), fee: [BigInt(1)], + spender: [], }, ], + approve: [], }; export const mockIcrcTransactionBurn: IcrcTransaction = { @@ -65,10 +69,12 @@ export const mockIcrcTransactionBurn: IcrcTransaction = { from: fakeAccount, memo: [], created_at_time: [BigInt(123)], + spender: [], }, ], mint: [], transfer: [], + approve: [], }; export const mockIcrcTransactionMint: IcrcTransaction = { @@ -84,6 +90,7 @@ export const mockIcrcTransactionMint: IcrcTransaction = { }, ], transfer: [], + approve: [], }; export const mockIcrcTransactionWithId: IcrcTransactionWithId = {