Skip to content

Commit

Permalink
Merge branch 'main' into feat/solana
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioVentilii authored Dec 23, 2024
2 parents e9d3c6d + 1edc6ea commit 95ba881
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 100 deletions.
9 changes: 9 additions & 0 deletions .github/repo_policies/BOT_APPROVED_FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of approved files that can be changed by a bot via an automated PR
# This is to increase security and prevent accidentally updating files that shouldn't be changed by a bot

package.json
package-lock.json
e2e/**/*.png
declarations/**/*
src/frontend/src/env/tokens/tokens.*.json
src/frontend/src/env/tokens/tokens-erc20/
93 changes: 47 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@
"@dfinity/agent": "^2.1.2",
"@dfinity/auth-client": "^2.1.2",
"@dfinity/candid": "^2.1.2",
"@dfinity/ckbtc": "^3.1.0",
"@dfinity/cketh": "^3.3.1",
"@dfinity/ckbtc": "^3.1.5",
"@dfinity/cketh": "^3.4.2",
"@dfinity/gix-components": "^5.0.0-next-2024-12-10",
"@dfinity/ic-management": "^5.2.1",
"@dfinity/ledger-icp": "^2.6.0",
"@dfinity/ledger-icrc": "^2.6.0",
"@dfinity/oisy-wallet-signer": "^0.0.1",
"@dfinity/ledger-icp": "^2.6.5",
"@dfinity/ledger-icrc": "^2.7.0",
"@dfinity/oisy-wallet-signer": "^0.0.3",
"@dfinity/principal": "^2.1.2",
"@dfinity/utils": "^2.5.1",
"@dfinity/utils": "^2.8.0",
"@dfinity/verifiable-credentials": "^0.0.4",
"@junobuild/analytics": "^0.0.31",
"@metamask/detect-provider": "^2.0.0",
Expand All @@ -78,12 +77,13 @@
},
"devDependencies": {
"@dfinity/eslint-config-oisy-wallet": "^0.0.6",
"@dfinity/ic-management": "^6.0.2",
"@dfinity/identity-secp256k1": "^2.1.2",
"@dfinity/internet-identity-playwright": "^0.0.4",
"@playwright/test": "^1.49.1",
"@rollup/plugin-inject": "^5.0.5",
"@solana/rpc-types": "^2.0.0",
"@sveltejs/adapter-static": "^3.0.6",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/kit": "^2.11.1",
"@sveltejs/vite-plugin-svelte": "^3.1.2",
"@testing-library/jest-dom": "^6.6.3",
Expand Down
8 changes: 4 additions & 4 deletions scripts/update-agent.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

npm rm @dfinity/agent @dfinity/auth-client @dfinity/candid @dfinity/principal @dfinity/ckbtc @dfinity/cketh @dfinity/ic-management @dfinity/ledger-icp @dfinity/ledger-icrc @dfinity/utils
npm rm @dfinity/agent @dfinity/auth-client @dfinity/candid @dfinity/principal @dfinity/ckbtc @dfinity/cketh @dfinity/ledger-icp @dfinity/ledger-icrc @dfinity/utils

npm rm @dfinity/identity-secp256k1 -D
npm rm @dfinity/identity-secp256k1 @dfinity/ic-management -D

npm i @dfinity/[email protected] @dfinity/[email protected] @dfinity/[email protected] @dfinity/[email protected] @dfinity/ckbtc@latest @dfinity/cketh@latest @dfinity/ic-management@latest @dfinity/ledger-icp@latest @dfinity/ledger-icrc@latest @dfinity/utils@latest
npm i @dfinity/[email protected] @dfinity/[email protected] @dfinity/[email protected] @dfinity/[email protected] @dfinity/ckbtc@latest @dfinity/cketh@latest @dfinity/ledger-icp@latest @dfinity/ledger-icrc@latest @dfinity/utils@latest

npm i @dfinity/[email protected] -D
npm i @dfinity/[email protected] @dfinity/ic-management@latest -D
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { fromNullable, isNullish, nonNullish, notEmptyString } from '@dfinity/utils';
import { fromNullable, isNullish, nonNullish, isEmptyString } from '@dfinity/utils';
import type { TransactionResponse } from '@ethersproject/abstract-provider';
import { onDestroy } from 'svelte';
import { initPendingTransactionsListener as initEthPendingTransactionsListenerProvider } from '$eth/providers/alchemy.providers';
Expand Down Expand Up @@ -85,7 +85,7 @@
}) => {
await listener?.disconnect();
if (isNullish(toAddress) || !notEmptyString(toAddress)) {
if (isNullish(toAddress) || isEmptyString(toAddress)) {
return;
}
Expand Down
39 changes: 3 additions & 36 deletions src/frontend/src/icp/utils/icrc.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { CanisterIdText } from '$lib/types/canister';
import type { TokenCategory, TokenMetadata } from '$lib/types/token';
import {
IcrcMetadataResponseEntries,
mapTokenMetadata,
type IcrcTokenMetadataResponse,
type IcrcValue
} from '@dfinity/ledger-icrc';
Expand Down Expand Up @@ -52,42 +53,8 @@ export const mapIcrcToken = ({

type IcrcTokenMetadata = TokenMetadata & IcFee;

const mapOptionalToken = (response: IcrcTokenMetadataResponse): IcrcTokenMetadata | undefined => {
const nullishToken: Partial<IcrcTokenMetadata> = response.reduce((acc, [key, value]) => {
switch (key) {
case IcrcMetadataResponseEntries.SYMBOL:
acc = { ...acc, ...('Text' in value && { symbol: value.Text }) };
break;
case IcrcMetadataResponseEntries.NAME:
acc = { ...acc, ...('Text' in value && { name: value.Text }) };
break;
case IcrcMetadataResponseEntries.FEE:
acc = { ...acc, ...('Nat' in value && { fee: value.Nat }) };
break;
case IcrcMetadataResponseEntries.DECIMALS:
acc = {
...acc,
...('Nat' in value && { decimals: Number(value.Nat) })
};
break;
case IcrcMetadataResponseEntries.LOGO:
acc = { ...acc, ...('Text' in value && { icon: value.Text }) };
}

return acc;
}, {});

if (
isNullish(nullishToken.symbol) ||
isNullish(nullishToken.name) ||
isNullish(nullishToken.fee) ||
isNullish(nullishToken.decimals)
) {
return undefined;
}

return nullishToken as IcrcTokenMetadata;
};
const mapOptionalToken = (response: IcrcTokenMetadataResponse): IcrcTokenMetadata | undefined =>
mapTokenMetadata(response);

// eslint-disable-next-line local-rules/prefer-object-params -- This is a sorting function, so the parameters will be provided not as an object but as separate arguments.
export const sortIcTokens = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import ConvertWizard from '$lib/components/convert/ConvertWizard.svelte';
import { convertWizardSteps } from '$lib/config/convert.config';
import { ProgressStepsConvert } from '$lib/enums/progress-steps';
import { WizardStepsConvert } from '$lib/enums/wizard-steps.js';
import { WizardStepsConvert } from '$lib/enums/wizard-steps';
import {
CONVERT_CONTEXT_KEY,
type ConvertContext,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import { slide } from 'svelte/transition';
import MessageBox from '$lib/components/ui/MessageBox.svelte';
import { SLIDE_DURATION } from '$lib/constants/transition.constants.js';
import { i18n } from '$lib/stores/i18n.store.js';
import { SLIDE_DURATION } from '$lib/constants/transition.constants';
import { i18n } from '$lib/stores/i18n.store';
export let testId: string | undefined = undefined;
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { testnetsEnabled } from '$lib/derived/settings.derived';
import { i18n } from '$lib/stores/i18n.store';
import type { TokenUi } from '$lib/types/token';
import { replacePlaceholders } from '$lib/utils/i18n.utils.js';
import { replacePlaceholders } from '$lib/utils/i18n.utils';
$: enabledTokensWithoutTransaction = $enabledNetworkTokens
.filter((token) => $icTransactionsStore?.[token.id] === null)
Expand Down

0 comments on commit 95ba881

Please sign in to comment.