From dd4f6c09ecb2de5afc3dc79914449bb5ad61c1b4 Mon Sep 17 00:00:00 2001 From: Paul Puey Date: Fri, 2 Feb 2024 17:54:40 -0800 Subject: [PATCH] Fix token activation --- CHANGELOG.md | 4 ++++ src/core/account/account-api.ts | 18 ++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a23f48d2..a006dccbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 2.1.1 (2024-02-02) + +- fixed: Token activation causing error and insufficient funds when used with core 1.x plugins + ## 2.1.0 (2024-01-18) - added: Make swap timeouts adjustable. diff --git a/src/core/account/account-api.ts b/src/core/account/account-api.ts index 1d8c82b5a..e755411fd 100644 --- a/src/core/account/account-api.ts +++ b/src/core/account/account-api.ts @@ -596,10 +596,14 @@ export function makeAccountApi(ai: ApiInput, accountId: string): EdgeAccount { `getActivationAssets unsupported by walletId ${activateWalletId}` ) - return await engine.engineGetActivationAssets({ + const out = await engine.engineGetActivationAssets({ currencyWallets, activateTokenIds }) + + // Added for backward compatibility for plugins using core 1.x + out.assetOptions.forEach(asset => (asset.tokenId = asset.tokenId ?? null)) + return out }, async activateWallet( @@ -632,8 +636,18 @@ export function makeAccountApi(ai: ApiInput, accountId: string): EdgeAccount { wallet, tokenId: paymentInfo.tokenId } - : undefined + : undefined, + + // Added for backward compatibility for plugins using core 1.x + // @ts-expect-error + paymentTokenId: paymentInfo?.tokenId, + paymentWallet: wallet }) + + // Added for backward compatibility for plugins using core 1.x + // @ts-expect-error + if (out.networkFee.tokenId === undefined) out.networkFee.tokenId = null + return bridgifyObject(out) },