diff --git a/common/changes/@cityofzion/bs-swap/CU-86a5au9aq-1_2024-11-05-16-40.json b/common/changes/@cityofzion/bs-swap/CU-86a5au9aq-1_2024-11-05-16-40.json new file mode 100644 index 0000000..543a897 --- /dev/null +++ b/common/changes/@cityofzion/bs-swap/CU-86a5au9aq-1_2024-11-05-16-40.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@cityofzion/bs-swap", + "comment": "Fix find in available token", + "type": "patch" + } + ], + "packageName": "@cityofzion/bs-swap" +} \ No newline at end of file diff --git a/packages/bs-swap/src/services/SimpleSwapService.ts b/packages/bs-swap/src/services/SimpleSwapService.ts index 180124f..7539c40 100644 --- a/packages/bs-swap/src/services/SimpleSwapService.ts +++ b/packages/bs-swap/src/services/SimpleSwapService.ts @@ -204,7 +204,7 @@ export class SimpleSwapService implements SwapSe let simpleSwapCurrency: SimpleSwapApiCurrency | null = null if (token) { - simpleSwapCurrency = this.#availableTokensToUse.value.find(item => item.symbol === token.symbol) ?? null + simpleSwapCurrency = this.#availableTokensToUse.value.find(item => item.id === token.id) ?? null if (!simpleSwapCurrency) throw new Error('You are trying to use a token that is not available') } @@ -234,7 +234,7 @@ export class SimpleSwapService implements SwapSe let simpleSwapCurrency: SimpleSwapApiCurrency | null = null if (token) { - simpleSwapCurrency = this.#availableTokensToReceive.value.find(item => item.symbol === token.symbol) ?? null + simpleSwapCurrency = this.#availableTokensToReceive.value.find(item => item.id === token.id) ?? null if (!simpleSwapCurrency) throw new Error('You are trying to use a token that is not available') }