Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Fix: User is not able to send tBTC from Sui network #412

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,959 changes: 1,540 additions & 419 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "0.1.78",
"private": true,
"dependencies": {
"@certusone/wormhole-sdk": "^0.9.22",
"@injectivelabs/sdk-ts": "^1.10.72",
"@injectivelabs/ts-types": "^1.10.4",
"@injectivelabs/wallet-ts": "^1.10.51",
"@certusone/wormhole-sdk": "^0.10.2",
"@injectivelabs/sdk-ts": "^1.12.1",
"@injectivelabs/ts-types": "^1.12.1",
"@injectivelabs/wallet-ts": "^1.12.1",
"@manahippo/aptos-wallet-adapter": "^1.0.2",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
Expand Down Expand Up @@ -48,7 +48,7 @@
"@xpla/wallet-provider": "^0.3.4",
"@xpla/xpla.js": "^0.2.1",
"alchemy-sdk": "2.8.0",
"algosdk": "^1.15.0",
"algosdk": "^2.5.0",
"aptos": "1.5.0",
"axios": "^0.21.1",
"bech32": "^1.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/providers/tbtc/solana/WormholeGateway.v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
import {
CHAIN_ID_ETH,
CHAIN_ID_SOLANA,
ChainId,
SignedVaa,
parseTokenTransferVaa,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { WormholeGatewayIdl } from "./WormholeGatewayIdl";
import * as coreBridge from "@certusone/wormhole-sdk/lib/esm/solana/wormhole";
import * as tokenBridge from "@certusone/wormhole-sdk/lib/esm/solana/tokenBridge";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConnectWalletButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { useCallback, useEffect, useState } from "react";
import { Wallet } from "@xlabs-libs/wallet-aggregator-core";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/KeyAndBalance.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
CHAIN_ID_INJECTIVE,
Expand All @@ -10,6 +9,7 @@ import {
isTerraChain,
CHAIN_ID_SUI,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import ConnectWalletButton from "./ConnectWalletButton";

function isChainAllowed(chainId: ChainId) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/LowBalanceWarning.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChainId, isTerraChain } from "@certusone/wormhole-sdk";
import { isTerraChain } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { makeStyles, Typography } from "@material-ui/core";
import { Alert } from "@material-ui/lab";
import { useSelector } from "react-redux";
Expand Down
3 changes: 2 additions & 1 deletion src/components/Migration/EvmQuickMigrate.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChainId, ethers_contracts } from "@certusone/wormhole-sdk";
import { ethers_contracts } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { Signer } from "@ethersproject/abstract-signer";
import { getAddress } from "@ethersproject/address";
import { BigNumber } from "@ethersproject/bignumber";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Migration/EvmWorkflow.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { CircularProgress, makeStyles, Typography } from "@material-ui/core";
import { Alert } from "@material-ui/lab";
import { parseUnits } from "ethers/lib/utils";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Migration/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
ChainId,
CHAIN_ID_BSC,
CHAIN_ID_CELO,
CHAIN_ID_ETH,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { getAddress } from "@ethersproject/address";
import { Container, makeStyles, Paper, Typography } from "@material-ui/core";
import { withRouter } from "react-router";
Expand Down
4 changes: 2 additions & 2 deletions src/components/NFT/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ function NFT() {
return;
}
if (sourceChain) {
dispatch(setSourceChain(sourceChain));
dispatch(setSourceChain(sourceChain as any));
}
if (targetChain) {
dispatch(setTargetChain(targetChain));
dispatch(setTargetChain(targetChain as any));
}
} catch (e) {
console.error("Invalid path params specified.");
Expand Down
6 changes: 3 additions & 3 deletions src/components/NFTOriginVerifier.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_AURORA,
CHAIN_ID_AVAX,
CHAIN_ID_BSC,
Expand All @@ -11,6 +10,7 @@ import {
isEVMChain,
CHAIN_ID_APTOS,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import {
getOriginalAssetEth,
getOriginalAssetSol,
Expand Down Expand Up @@ -82,8 +82,8 @@ export default function NFTOriginVerifier() {
const classes = useStyles();
const isBeta = useBetaContext();
const [lookupChain, setLookupChain] = useState<ChainId>(CHAIN_ID_ETH);
const { provider, signerAddress } = useEthereumProvider(lookupChain);
const { isReady, statusMessage } = useIsWalletReady(lookupChain);
const { provider, signerAddress } = useEthereumProvider(lookupChain as any);
const { isReady, statusMessage } = useIsWalletReady(lookupChain as any);
const [lookupAsset, setLookupAsset] = useState("");
const [lookupTokenId, setLookupTokenId] = useState("");
const [lookupCreatorAddress, setLookupCreatorAddress] = useState("");
Expand Down
6 changes: 3 additions & 3 deletions src/components/Recovery.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_ACALA,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
Expand Down Expand Up @@ -37,6 +36,7 @@ import {
CHAIN_ID_SUI,
getForeignAssetSui,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { repairVaa } from "@certusone/wormhole-sdk/lib/esm/utils/repairVaa";
import {
Accordion,
Expand Down Expand Up @@ -623,7 +623,7 @@ export default function Recovery() {
const tokenBridgeAddress =
getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
const tokenId = await queryExternalIdInjective(
client,
client as any,
tokenBridgeAddress,
parsedPayload.originAddress
);
Expand Down Expand Up @@ -658,7 +658,7 @@ export default function Recovery() {
useEffect(() => {
try {
if (sourceChain && transactionId) {
setRecoverySourceChain(sourceChain);
setRecoverySourceChain(sourceChain as any);
setRecoverySourceTx(transactionId);
} else if (vaaHex) {
setRecoverySignedVAA(vaaHex);
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenOriginVerifier.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
ChainId,
CHAIN_ID_ETH,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA2,
isEVMChain,
nativeToHexString,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import {
Card,
CircularProgress,
Expand Down
7 changes: 2 additions & 5 deletions src/components/TokenSelectors/EvmTokenPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import {
ChainId,
CHAIN_ID_ETH,
ethers_contracts,
} from "@certusone/wormhole-sdk";
import { CHAIN_ID_ETH, ethers_contracts } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { WormholeAbi__factory } from "@certusone/wormhole-sdk/lib/esm/ethers-contracts/abi";
import { getAddress as getEthAddress } from "@ethersproject/address";
import React, { useCallback } from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_ACALA,
CHAIN_ID_ARBITRUM,
CHAIN_ID_AURORA,
Expand All @@ -16,6 +15,7 @@ import {
isEVMChain,
CHAIN_ID_BASE,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { LinearProgress, makeStyles, Typography } from "@material-ui/core";
import { Connection } from "@solana/web3.js";
import { useEffect, useState } from "react";
Expand Down
4 changes: 2 additions & 2 deletions src/components/Transfer/RegisterNowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
selectTransferTargetChain,
} from "../../store/selectors";
import {
ChainId,
CHAIN_ID_APTOS,
CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
Expand All @@ -25,6 +24,7 @@ import {
hexToNativeAssetString,
CHAIN_ID_SUI,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";

export function RegisterNowButtonCore({
originChain,
Expand Down Expand Up @@ -57,7 +57,7 @@ export function RegisterNowButtonCore({
if (originChain && originAsset && nativeAsset && canSwitch) {
dispatch(setSourceChain(originChain));
dispatch(setSourceAsset(nativeAsset));
dispatch(setTargetChain(targetChain));
dispatch(setTargetChain(targetChain as any));
dispatch(setStep(2));
history.push("/register");
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Transfer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function Transfer() {

useEffect(() => {
if (sourceChain && targetChain) {
dispatch(setSourceChain(sourceChain));
dispatch(setTargetChain(targetChain));
dispatch(setSourceChain(sourceChain as any));
dispatch(setTargetChain(targetChain as any));
}
}, [sourceChain, targetChain, dispatch]);

Expand Down
3 changes: 2 additions & 1 deletion src/contexts/TerraWalletContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConnectType } from "@terra-money/wallet-provider";
import { ChainId, isTerraChain } from "@xlabs-libs/wallet-aggregator-core";
import { isTerraChain } from "@xlabs-libs/wallet-aggregator-core";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { useWallet } from "@xlabs-libs/wallet-aggregator-react";
import { getWallets, TerraWallet } from "@xlabs-libs/wallet-aggregator-terra";
import { useEffect, useMemo, useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useAllowance.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {
approveEth,
ChainId,
CHAIN_ID_KLAYTN,
getAllowanceEth,
isEVMChain,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { BigNumber } from "ethers";
import { useEffect, useMemo, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
Expand Down
7 changes: 4 additions & 3 deletions src/hooks/useCheckIfWormholeWrapped.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
CHAIN_ID_NEAR,
Expand All @@ -20,6 +19,7 @@ import {
getOriginalAssetSui,
CHAIN_ID_ETH,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import {
getOriginalAssetEth as getOriginalAssetEthNFT,
getOriginalAssetSol as getOriginalAssetSolNFT,
Expand Down Expand Up @@ -75,6 +75,7 @@ const makeStateSafe = (
info: WormholeWrappedInfo
): StateSafeWormholeWrappedInfo => ({
...info,
chainId: info.chainId as any,
assetAddress: uint8ArrayToHex(info.assetAddress),
});

Expand Down Expand Up @@ -247,7 +248,7 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
);
const wrappedInfo = makeStateSafe(
await getOriginalAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
BigInt(sourceAsset)
)
Expand Down Expand Up @@ -280,7 +281,7 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
try {
const client = getInjectiveWasmClient();
const wrappedInfo = makeStateSafe(
await getOriginalAssetInjective(sourceAsset, client)
await getOriginalAssetInjective(sourceAsset, client as any)
);
if (!cancelled) {
dispatch(setSourceWormholeWrappedInfo(wrappedInfo));
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useEvmMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChainId, isEVMChain } from "@certusone/wormhole-sdk";
import { isEVMChain } from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { ethers } from "ethers";
import { useEffect, useMemo, useState } from "react";
import {
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useFetchForeignAsset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
buildTokenId,
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
CHAIN_ID_INJECTIVE,
Expand All @@ -22,6 +21,7 @@ import {
CHAIN_ID_SUI,
getForeignAssetSui,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import { Connection } from "@solana/web3.js";
import { LCDClient } from "@terra-money/terra.js";
import { ethers } from "ethers";
Expand Down Expand Up @@ -196,7 +196,7 @@ function useFetchForeignAsset(
ALGORAND_HOST.algodPort
);
return getForeignAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
originChain,
originAssetHex
Expand All @@ -220,7 +220,7 @@ function useFetchForeignAsset(
const client = getInjectiveWasmClient();
return getForeignAssetInjective(
getTokenBridgeAddressForChain(foreignChain),
client,
client as any,
originChain,
hexToUint8Array(originAssetHex)
);
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useFetchTargetAsset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
CHAIN_ID_INJECTIVE,
Expand All @@ -25,6 +24,7 @@ import {
CHAIN_ID_SUI,
getForeignAssetSui,
} from "@certusone/wormhole-sdk";
import { ChainId } from "@xlabs-libs/wallet-aggregator-core";
import {
getForeignAssetEth as getForeignAssetEthNFT,
getForeignAssetSol as getForeignAssetSolNFT,
Expand Down Expand Up @@ -263,7 +263,7 @@ function useFetchTargetAsset(nft?: boolean) {
const tokenBridgeAddress =
getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
const tokenId = await queryExternalIdInjective(
client,
client as any,
tokenBridgeAddress,
originAsset || ""
);
Expand Down Expand Up @@ -525,7 +525,7 @@ function useFetchTargetAsset(nft?: boolean) {
ALGORAND_HOST.algodPort
);
const asset = await getForeignAssetAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
originChain,
originAsset
Expand Down Expand Up @@ -599,7 +599,7 @@ function useFetchTargetAsset(nft?: boolean) {
const client = getInjectiveWasmClient();
const asset = await getForeignAssetInjective(
getTokenBridgeAddressForChain(targetChain),
client,
client as any,
originChain,
hexToUint8Array(originAsset)
);
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useGetIsTransferCompleted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export default function useGetIsTransferCompleted(
ALGORAND_HOST.algodPort
);
transferCompleted = await getIsTransferCompletedAlgorand(
algodClient,
algodClient as any,
ALGORAND_TOKEN_BRIDGE_ID,
signedVAA
);
Expand Down Expand Up @@ -233,7 +233,7 @@ export default function useGetIsTransferCompleted(
transferCompleted = await getIsTransferCompletedInjective(
getTokenBridgeAddressForChain(targetChain),
signedVAA,
client
client as any
);
} catch (error) {
console.error(error);
Expand Down
Loading
Loading