Skip to content

Commit

Permalink
Merge pull request #3935 from Koniverse/koni/dev/issue-3855-v3
Browse files Browse the repository at this point in the history
[Issue 3855] Support swap TAO on SimpleSwap
  • Loading branch information
saltict authored Dec 18, 2024
2 parents b0aa001 + 8f76891 commit 7584a07
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"@polkadot/types-support": "^15.0.1",
"@polkadot/util": "^13.2.3",
"@polkadot/util-crypto": "^13.2.3",
"@subwallet/chain-list": "0.2.96-beta.3",
"@subwallet/chain-list": "0.2.96",
"@subwallet/keyring": "^0.1.8-beta.0",
"@subwallet/react-ui": "5.1.2-b79",
"@subwallet/ui-keyring": "0.1.8-beta.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@reduxjs/toolkit": "^1.9.1",
"@sora-substrate/type-definitions": "^1.17.7",
"@substrate/connect": "^0.8.9",
"@subwallet/chain-list": "0.2.96-beta.3",
"@subwallet/chain-list": "0.2.96",
"@subwallet/extension-base": "^1.3.10-0",
"@subwallet/extension-chains": "^1.3.10-0",
"@subwallet/extension-dapp": "^1.3.10-0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/K
import { _getSimpleSwapEarlyValidationError } from '@subwallet/extension-base/core/logic-validation/swap';
import { _getAssetDecimals, _getChainNativeTokenSlug, _getContractAddressOfToken, _isChainSubstrateCompatible, _isNativeToken, _isSmartContractToken } from '@subwallet/extension-base/services/chain-service/utils';
import { BaseStepDetail, BasicTxErrorType, CommonFeeComponent, CommonOptimalPath, CommonStepFeeInfo, CommonStepType, OptimalSwapPathParams, SimpleSwapTxData, SimpleSwapValidationMetadata, SwapEarlyValidation, SwapErrorType, SwapFeeType, SwapProviderId, SwapQuote, SwapRequest, SwapStepType, SwapSubmitParams, SwapSubmitStepData, TransactionData, ValidateSwapProcessParams } from '@subwallet/extension-base/types';
import { formatNumber } from '@subwallet/extension-base/utils';
import { _reformatAddressWithChain, formatNumber } from '@subwallet/extension-base/utils';
import BigN, { BigNumber } from 'bignumber.js';

import { SubmittableExtrinsic } from '@polkadot/api/types';
Expand Down Expand Up @@ -381,8 +381,9 @@ export class SimpleSwapHandler implements SwapBaseInterface {
const fromAsset = this.chainService.getAssetBySlug(pair.from);
const toAsset = this.chainService.getAssetBySlug(pair.to);
const chainInfo = this.chainService.getChainInfoByKey(fromAsset.originChain);
const toChainInfo = this.chainService.getChainInfoByKey(toAsset.originChain);
const chainType = _isChainSubstrateCompatible(chainInfo) ? ChainType.SUBSTRATE : ChainType.EVM;
const receiver = recipient ?? address;
const receiver = _reformatAddressWithChain(recipient ?? address, toChainInfo);

const fromSymbol = SIMPLE_SWAP_SUPPORTED_TESTNET_ASSET_MAPPING[fromAsset.slug];
const toSymbol = SIMPLE_SWAP_SUPPORTED_TESTNET_ASSET_MAPPING[toAsset.slug];
Expand Down Expand Up @@ -418,7 +419,7 @@ export class SimpleSwapHandler implements SwapBaseInterface {
provider: this.providerInfo,
quote: params.quote,
slippage: params.slippage,
recipient,
recipient: receiver,
process: params.process
};

Expand Down
2 changes: 1 addition & 1 deletion packages/extension-koni-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@polkadot/util-crypto": "^12.6.2",
"@ramonak/react-progress-bar": "^5.0.3",
"@reduxjs/toolkit": "^1.9.1",
"@subwallet/chain-list": "0.2.96-beta.3",
"@subwallet/chain-list": "0.2.96",
"@subwallet/extension-base": "^1.3.10-0",
"@subwallet/extension-chains": "^1.3.10-0",
"@subwallet/extension-dapp": "^1.3.10-0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ const Component = ({ targetAccountProxy }: ComponentProps) => {
address: from,
process: currentOptimalSwapPath,
selectedQuote: currentQuote,
recipient
recipient // Need to assign format address with toChainInfo in case there's no recipient
});

const _errors = await validatePromise;
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-web-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@polkadot/util-crypto": "^12.6.2",
"@ramonak/react-progress-bar": "^5.0.3",
"@reduxjs/toolkit": "^1.9.1",
"@subwallet/chain-list": "0.2.96-beta.3",
"@subwallet/chain-list": "0.2.96",
"@subwallet/extension-base": "^1.3.10-0",
"@subwallet/extension-chains": "^1.3.10-0",
"@subwallet/extension-dapp": "^1.3.10-0",
Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6439,15 +6439,15 @@ __metadata:
languageName: node
linkType: hard

"@subwallet/chain-list@npm:0.2.96-beta.3":
version: 0.2.96-beta.3
resolution: "@subwallet/chain-list@npm:0.2.96-beta.3"
"@subwallet/chain-list@npm:0.2.96":
version: 0.2.96
resolution: "@subwallet/chain-list@npm:0.2.96"
dependencies:
"@polkadot/dev": 0.67.167
"@polkadot/util": ^12.5.1
eventemitter3: ^5.0.1
ts-md5: ^1.3.1
checksum: eae4f1fd2ec2454266d9176f7da236a6c1287b42a4e05da72e9c522c82a08e81e3a001e4858a4405641eca9dc83c30263bfa5a2236c06e5e4e59cbc14ca490ee
checksum: a7d9436d2e799f3ad0e976fea33ff2319a3a69fc45dda7915ebead94007c4de81069411bf30be27136ea6eb8a11aa77750e230c62747885d19d8f06cf2924f47
languageName: node
linkType: hard

Expand Down Expand Up @@ -6490,7 +6490,7 @@ __metadata:
"@reduxjs/toolkit": ^1.9.1
"@sora-substrate/type-definitions": ^1.17.7
"@substrate/connect": ^0.8.9
"@subwallet/chain-list": 0.2.96-beta.3
"@subwallet/chain-list": 0.2.96
"@subwallet/extension-base": ^1.3.10-0
"@subwallet/extension-chains": ^1.3.10-0
"@subwallet/extension-dapp": ^1.3.10-0
Expand Down Expand Up @@ -6629,7 +6629,7 @@ __metadata:
"@polkadot/util-crypto": ^12.6.2
"@ramonak/react-progress-bar": ^5.0.3
"@reduxjs/toolkit": ^1.9.1
"@subwallet/chain-list": 0.2.96-beta.3
"@subwallet/chain-list": 0.2.96
"@subwallet/extension-base": ^1.3.10-0
"@subwallet/extension-chains": ^1.3.10-0
"@subwallet/extension-dapp": ^1.3.10-0
Expand Down Expand Up @@ -6769,7 +6769,7 @@ __metadata:
"@polkadot/util-crypto": ^12.6.2
"@ramonak/react-progress-bar": ^5.0.3
"@reduxjs/toolkit": ^1.9.1
"@subwallet/chain-list": 0.2.96-beta.3
"@subwallet/chain-list": 0.2.96
"@subwallet/extension-base": ^1.3.10-0
"@subwallet/extension-chains": ^1.3.10-0
"@subwallet/extension-dapp": ^1.3.10-0
Expand Down

1 comment on commit 7584a07

@saltict
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.