diff --git a/scripts/build.tokens.sns.mjs b/scripts/build.tokens.sns.mjs index d91ddc66ee..f7c768deef 100644 --- a/scripts/build.tokens.sns.mjs +++ b/scripts/build.tokens.sns.mjs @@ -1,12 +1,8 @@ #!/usr/bin/env node -import { AnonymousIdentity } from '@dfinity/agent'; -import { Ed25519KeyIdentity } from '@dfinity/identity'; -import { IcrcIndexNgCanister, IcrcMetadataResponseEntries } from '@dfinity/ledger-icrc'; -import { Principal } from '@dfinity/principal'; +import { IcrcMetadataResponseEntries } from '@dfinity/ledger-icrc'; import { candidNumberArrayToBigInt, - createAgent, fromNullable, isNullish, jsonReplacer, @@ -115,34 +111,6 @@ const mapOptionalToken = (response) => { return nullishToken; }; -const assertIndexCanister = async (indexCanisterId) => { - try { - const agent = await createAgent({ - identity: new AnonymousIdentity(), - host: 'https://icp-api.io' - }); - - const { getTransactions } = IcrcIndexNgCanister.create({ - agent, - canisterId: Principal.fromText(indexCanisterId) - }); - - const { balance } = await getTransactions({ - certified: true, - max_results: 0n, - account: { owner: Ed25519KeyIdentity.generate().getPrincipal() } - }); - - return balance >= 0n; - } catch (err) { - if (err.response?.body?.reject_message?.includes('out of cycles')) { - throw new Error(err.response.body.reject_message); - } - - return false; - } -}; - export const findSnses = async () => { const data = await querySnsAggregator(); @@ -199,23 +167,7 @@ export const findSnses = async () => { { tokens: [], icons: [] } ); - const indexCanisterVersion = async (token) => { - const { indexCanisterId } = token; - - const valid = await assertIndexCanister(indexCanisterId); - - return { - ...token, - indexCanisterVersion: valid ? 'up-to-date' : 'outdated' - }; - }; - - const enhancedTokens = await Promise.all(tokens.map(indexCanisterVersion)); - - writeFileSync( - join(DATA_FOLDER, 'tokens.sns.json'), - JSON.stringify(enhancedTokens, jsonReplacer, 8) - ); + writeFileSync(join(DATA_FOLDER, 'tokens.sns.json'), JSON.stringify(tokens, jsonReplacer, 8)); await saveLogos(icons); }; diff --git a/src/frontend/src/env/schema/env-sns-token.schema.ts b/src/frontend/src/env/schema/env-sns-token.schema.ts index d2840473d1..5f61d0f4e6 100644 --- a/src/frontend/src/env/schema/env-sns-token.schema.ts +++ b/src/frontend/src/env/schema/env-sns-token.schema.ts @@ -1,12 +1,9 @@ import { EnvIcrcTokenMetadataSchema, EnvIcTokenSchema } from '$env/schema/env-icrc-token.schema'; import { z } from 'zod'; -const IndexCanisterVersionSchema = z.union([z.literal('up-to-date'), z.literal('outdated')]); - export const EnvSnsTokenSchema = EnvIcTokenSchema.extend({ rootCanisterId: z.string(), - metadata: EnvIcrcTokenMetadataSchema, - indexCanisterVersion: IndexCanisterVersionSchema + metadata: EnvIcrcTokenMetadataSchema }); export const EnvSnsTokensSchema = z.array(EnvSnsTokenSchema); diff --git a/src/frontend/src/env/tokens.sns.json b/src/frontend/src/env/tokens.sns.json index 560cf17bf6..0b738ade8d 100644 --- a/src/frontend/src/env/tokens.sns.json +++ b/src/frontend/src/env/tokens.sns.json @@ -12,8 +12,7 @@ }, "alternativeName": "Dragginz", "url": "https://dragginz.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "2ouva-viaaa-aaaaq-aaamq-cai", @@ -28,8 +27,7 @@ }, "alternativeName": "OpenChat", "url": "https://oc.app" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "73mez-iiaaa-aaaaq-aaasq-cai", @@ -44,8 +42,7 @@ }, "alternativeName": "Kinic", "url": "https://kinic.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "6rdgd-kyaaa-aaaaq-aaavq-cai", @@ -60,8 +57,7 @@ }, "alternativeName": "YRAL", "url": "https://yral.com" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "4c4fd-caaaa-aaaaq-aaa3a-cai", @@ -76,8 +72,7 @@ }, "alternativeName": "ICGhost", "url": "https://yadjb-mqaaa-aaaan-qaqlq-cai.raw.ic0.app/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "xsi2v-cyaaa-aaaaq-aabfq-cai", @@ -92,8 +87,7 @@ }, "alternativeName": "DecideAI DAO", "url": "https://decideai.xyz" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "vtrom-gqaaa-aaaaq-aabia-cai", @@ -108,8 +102,7 @@ }, "alternativeName": "BOOM DAO", "url": "https://boomdao.xyz/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "uf2wh-taaaa-aaaaq-aabna-cai", @@ -124,8 +117,7 @@ }, "alternativeName": "Catalyze", "url": "https://catalyze.one" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "rffwt-piaaa-aaaaq-aabqq-cai", @@ -140,8 +132,7 @@ }, "alternativeName": "Seers AI", "url": "https://seers.social" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "rxdbk-dyaaa-aaaaq-aabtq-cai", @@ -156,8 +147,7 @@ }, "alternativeName": "Nuance", "url": "https://nuance.xyz" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "qbizb-wiaaa-aaaaq-aabwq-cai", @@ -172,8 +162,7 @@ }, "alternativeName": "SONIC", "url": "https://app.sonic.ooo" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "tyyy3-4aaaa-aaaaq-aab7a-cai", @@ -188,8 +177,7 @@ }, "alternativeName": "Gold DAO", "url": "https://www.gold-dao.org" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "emww2-4yaaa-aaaaq-aacbq-cai", @@ -204,8 +192,7 @@ }, "alternativeName": "TRAX", "url": "https://trax.so" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "f54if-eqaaa-aaaaq-aacea-cai", @@ -220,8 +207,7 @@ }, "alternativeName": "Neutrinite", "url": "https://icpcoins.com" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "hvgxa-wqaaa-aaaaq-aacia-cai", @@ -236,8 +222,7 @@ }, "alternativeName": "Sneed", "url": "https://4pk43-5qaaa-aaaag-qc44a-cai.icp0.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "hhaaz-2aaaa-aaaaq-aacla-cai", @@ -252,8 +237,7 @@ }, "alternativeName": "ICLighthouse DAO", "url": "https://iclight.io" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "gemj7-oyaaa-aaaaq-aacnq-cai", @@ -268,8 +252,7 @@ }, "alternativeName": "ELNA AI", "url": "https://dapp.elna.ai" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "ddsp7-7iaaa-aaaaq-aacqq-cai", @@ -284,8 +267,7 @@ }, "alternativeName": "OpenFPL", "url": "https://openfpl.xyz/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "druyg-tyaaa-aaaaq-aactq-cai", @@ -300,8 +282,7 @@ }, "alternativeName": "ICPanda DAO", "url": "https://panda.fans" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "ca6gz-lqaaa-aaaaq-aacwa-cai", @@ -316,8 +297,7 @@ }, "alternativeName": "ICPSwap", "url": "https://www.icpswap.com" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "atbfz-diaaa-aaaaq-aacyq-cai", @@ -332,8 +312,7 @@ }, "alternativeName": "Yuku DAO", "url": "https://yuku.app/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "bliq2-niaaa-aaaaq-aac4q-cai", @@ -348,8 +327,7 @@ }, "alternativeName": "EstateDAO", "url": "https://wbdy5-yyaaa-aaaap-abysq-cai.icp0.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "k45jy-aiaaa-aaaaq-aadcq-cai", @@ -364,8 +342,7 @@ }, "alternativeName": "Motoko", "url": "https://2uktw-yiaaa-aaaah-adwxq-cai.icp0.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "lrtnw-paaaa-aaaaq-aadfa-cai", @@ -380,8 +357,7 @@ }, "alternativeName": "ICPCC DAO LLC", "url": "https://osjzm-oaaaa-aaaal-ajcoq-cai.icp0.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "lkwrt-vyaaa-aaaaq-aadhq-cai", @@ -396,8 +372,7 @@ }, "alternativeName": "ORIGYN", "url": "https://www.origyn.com/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "jcmow-hyaaa-aaaaq-aadlq-cai", @@ -412,8 +387,7 @@ }, "alternativeName": "WaterNeuron", "url": "https://waterneuron.fi/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "itgqj-7qaaa-aaaaq-aadoa-cai", @@ -428,8 +402,7 @@ }, "alternativeName": "CYCLES-TRANSFER-STATION", "url": "https://cycles-transfer-station.com" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "np5km-uyaaa-aaaaq-aadrq-cai", @@ -444,8 +417,7 @@ }, "alternativeName": "DOGMI", "url": "https://qu2gy-uqaaa-aaaal-qcv6a-cai.icp0.io" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "m6xut-mqaaa-aaaaq-aadua-cai", @@ -460,8 +432,7 @@ }, "alternativeName": "ICVC", "url": "https://mnc6b-aaaaa-aaaap-qhnrq-cai.icp0.io/" - }, - "indexCanisterVersion": "up-to-date" + } }, { "ledgerCanisterId": "o7oak-iyaaa-aaaaq-aadzq-cai", @@ -476,7 +447,6 @@ }, "alternativeName": "KongSwap", "url": "https://www.kongswap.io/" - }, - "indexCanisterVersion": "up-to-date" + } } ] diff --git a/src/frontend/src/icp/components/tokens/IcManageTokenToggle.svelte b/src/frontend/src/icp/components/tokens/IcManageTokenToggle.svelte index 79a07292dc..efa2b8bbea 100644 --- a/src/frontend/src/icp/components/tokens/IcManageTokenToggle.svelte +++ b/src/frontend/src/icp/components/tokens/IcManageTokenToggle.svelte @@ -3,15 +3,10 @@ import { createEventDispatcher } from 'svelte'; import { type IcrcCustomToken } from '$icp/types/icrc-custom-token'; import { i18n } from '$lib/stores/i18n.store'; - import { toastsShow } from '$lib/stores/toasts.store'; - import { replaceOisyPlaceholders, replacePlaceholders } from '$lib/utils/i18n.utils'; import { isIcrcTokenToggleDisabled } from '$lib/utils/token-toggle.utils'; export let token: IcrcCustomToken; - let outdated = false; - $: outdated = token.indexCanisterVersion === 'outdated'; - let disabled = false; $: disabled = isIcrcTokenToggleDisabled(token); @@ -32,32 +27,11 @@ enabled: checked }); }; - - const onClick = () => { - if (!outdated) { - return; - } - - toastsShow({ - text: replacePlaceholders( - replaceOisyPlaceholders($i18n.tokens.manage.info.outdated_index_canister), - { - $token: token.name - } - ), - level: 'info', - duration: 5000 - }); - }; - - -