Skip to content

Commit

Permalink
Merge pull request #584 from EdgeApp/paul/fixTokenActivation
Browse files Browse the repository at this point in the history
Fix token activation
  • Loading branch information
paullinator authored Feb 3, 2024
2 parents 340a05b + dd4f6c0 commit c952aca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 16 additions & 2 deletions src/core/account/account-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
},

Expand Down

0 comments on commit c952aca

Please sign in to comment.