Skip to content

Commit

Permalink
check wallet ton before init wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
haunv3 committed Nov 29, 2024
1 parent 77bdcdc commit 82db98c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
20 changes: 11 additions & 9 deletions src/pages/UniversalSwap/Swap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,17 @@ const SwapComponent: React.FC<{
const isCustomRecipient = validAddress.isValid && addressTransfer !== initAddressTransfer;
const alphaSmartRoutes = simulateData?.routes;

const tonWallet = await TonWallet.create('mainnet', {
mnemonicData: {
mnemonic: undefined,
tonWalletVersion: 'V4'
},
tonConnector: window?.Ton as any
});
let tonWallet = undefined;
if ([originalFromToken.chainId, originalToToken.chainId].includes('ton') && !!walletByNetworks.ton) {
tonWallet = await TonWallet.create('mainnet', {
mnemonicData: {
mnemonic: undefined,
tonWalletVersion: 'V4'
},
tonConnector: window?.Ton as any
});
}

const tonAddress = tonWallet?.sender?.address?.toString();
const swapData = {
sender: {
Expand All @@ -350,7 +354,6 @@ const SwapComponent: React.FC<{
alphaSmartRoutes
};

// @ts-ignore
const univeralSwapHandler = new UniversalSwapHandler(swapData, {
cosmosWallet: window.Keplr,
evmWallet: new Metamask(window.tronWebDapp),
Expand All @@ -365,7 +368,6 @@ const SwapComponent: React.FC<{
});

const result = await univeralSwapHandler.processUniversalSwap();
// @ts-ignore
let transactionHash = result?.transactionHash;

if (transactionHash) {
Expand Down
13 changes: 4 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3374,21 +3374,16 @@
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-build/-/oraidex-contracts-build-1.0.22.tgz#70b765dd8ea3b500a77cc37e6a45ea9d75f0c5c4"
integrity sha512-eJniKkXlOghPhgSYeH59szYjT3aWaE4K04HZaTPhi435sm9kaTfESj68pr0AsGepf4YeAcoQ9ZwUMbIeSmZtYw==

"@oraichain/[email protected].51-beta.3":
version "1.0.51-beta.3"
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.51-beta.3.tgz#cb7c369081bcb036cc78d91a35a51ff4fb2b42d0"
integrity sha512-r1g0Ikzi21TAVIrB4I3MVF6rVTPdSHeBiQnwZTZuv0tw/muciuZHsiGSF5O2M5rcyMVHWjck9cQ3VVbAN+gFLg==
"@oraichain/[email protected].55", "@oraichain/oraidex-contracts-sdk@^1.0.54":
version "1.0.55"
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.55.tgz#a9c8aadd5bfae4e2d2b71b4804ce3eadd35a0185"
integrity sha512-MlASHfRDnNwhM172PlFlqarCMUhcqFHYsDIrh1aP6Rzh7/xI0L444WXlzMkANb0JHgz0qAvcJ+3Q834bUKhwag==

"@oraichain/oraidex-contracts-sdk@^1.0.49":
version "1.0.49"
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.49.tgz#093221564552e92901c73f6043ce4dc72208d857"
integrity sha512-J15JR0+wueYMLMFjz/Omg5ADSKOmmTvsBstVf76NQjrvYpekzdlIGvoTIUCGjyf+DOdzu8MevOk5HDAnOrj3Fw==

"@oraichain/oraidex-contracts-sdk@^1.0.54":
version "1.0.55"
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.55.tgz#a9c8aadd5bfae4e2d2b71b4804ce3eadd35a0185"
integrity sha512-MlASHfRDnNwhM172PlFlqarCMUhcqFHYsDIrh1aP6Rzh7/xI0L444WXlzMkANb0JHgz0qAvcJ+3Q834bUKhwag==

"@oraichain/oraidex-contracts-sdk@latest":
version "1.0.45"
resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365"
Expand Down

0 comments on commit 82db98c

Please sign in to comment.