diff --git a/docs/docs/faqs/liquid-markets.mdx b/docs/docs/faqs/liquid-markets.mdx
index 587bcfaa6..d92491833 100644
--- a/docs/docs/faqs/liquid-markets.mdx
+++ b/docs/docs/faqs/liquid-markets.mdx
@@ -31,8 +31,6 @@ import EthAptos from './_liquid-markets/eth-aptos.md'
import EthAlgorand from './_liquid-markets/eth-algorand.md'
import SolAlgorand from './_liquid-markets/sol-algorand.md'
import AvaxAlgorand from './_liquid-markets/avax-algorand.md'
-import SolInjective from './_liquid-markets/sol-injective.md'
-import EthInjective from './_liquid-markets/eth-injective.md'
import EthSui from './_liquid-markets/eth-sui.md'
import SolSui from './_liquid-markets/sol-sui.md'
import AptosOsmosis from './_liquid-markets/aptos-osmosis.md'
@@ -201,17 +199,6 @@ Check out the [Wormhole Token list](https://github.com/certusone/wormhole-token-
-## Target chain: Injective
-
-
-
-
-
-
-
-
-
-
## Target chain: Sui
diff --git a/package-lock.json b/package-lock.json
index 1dc21e4d9..29d4d7146 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,10 +11,6 @@
"@certusone/wormhole-sdk": "^0.10.17",
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/tendermint-rpc": "^0.32.3",
- "@injectivelabs/networks": "^1.14.4",
- "@injectivelabs/sdk-ts": "^1.14.4",
- "@injectivelabs/ts-types": "^1.14.4",
- "@injectivelabs/wallet-ts": "^1.14.4",
"@manahippo/aptos-wallet-adapter": "^1.0.2",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
diff --git a/package.json b/package.json
index bc472a67d..3e5252969 100644
--- a/package.json
+++ b/package.json
@@ -6,10 +6,6 @@
"@certusone/wormhole-sdk": "^0.10.17",
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/tendermint-rpc": "^0.32.3",
- "@injectivelabs/networks": "^1.14.4",
- "@injectivelabs/sdk-ts": "^1.14.4",
- "@injectivelabs/ts-types": "^1.14.4",
- "@injectivelabs/wallet-ts": "^1.14.4",
"@manahippo/aptos-wallet-adapter": "^1.0.2",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
diff --git a/src/components/KeyAndBalance.tsx b/src/components/KeyAndBalance.tsx
index bbe761af1..f88fa2d2d 100644
--- a/src/components/KeyAndBalance.tsx
+++ b/src/components/KeyAndBalance.tsx
@@ -2,7 +2,6 @@ import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_XPLA,
@@ -22,7 +21,6 @@ function isChainAllowed(chainId: ChainId) {
chainId === CHAIN_ID_NEAR ||
chainId === CHAIN_ID_XPLA ||
chainId === CHAIN_ID_APTOS ||
- chainId === CHAIN_ID_INJECTIVE ||
chainId === CHAIN_ID_SUI ||
chainId === CHAIN_ID_SEI
);
diff --git a/src/components/Recovery.tsx b/src/components/Recovery.tsx
index cce679ddb..15aba528d 100644
--- a/src/components/Recovery.tsx
+++ b/src/components/Recovery.tsx
@@ -3,7 +3,6 @@ import {
CHAIN_ID_ACALA,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_KARURA,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
@@ -12,7 +11,6 @@ import {
CHAIN_ID_SEI,
getEmitterAddressAlgorand,
getEmitterAddressEth,
- getEmitterAddressInjective,
getEmitterAddressSolana,
getEmitterAddressTerra,
getEmitterAddressXpla,
@@ -25,14 +23,12 @@ import {
parseNFTPayload,
parseSequenceFromLogAlgorand,
parseSequenceFromLogEth,
- parseSequenceFromLogInjective,
parseSequenceFromLogSolana,
parseSequenceFromLogTerra,
parseSequenceFromLogXpla,
parseTransferPayload,
parseVaa,
queryExternalId,
- queryExternalIdInjective,
TerraChainId,
uint8ArrayToHex,
CHAIN_ID_SUI,
@@ -115,10 +111,6 @@ import {
getEmitterAddressAndSequenceFromResult,
} from "../utils/aptos";
import { Types } from "aptos";
-import {
- getInjectiveTxClient,
- getInjectiveWasmClient,
-} from "../utils/injective";
import { getSuiProvider } from "../utils/sui";
import {
getEmitterAddressAndSequenceFromResponseSui,
@@ -385,26 +377,6 @@ async function xpla(tx: string, enqueueSnackbar: any) {
}
}
-async function injective(txHash: string, enqueueSnackbar: any) {
- try {
- const client = getInjectiveTxClient();
- const tx = await client.fetchTx(txHash);
- if (!tx) {
- throw new Error("Unable to fetch transaction");
- }
- const sequence = parseSequenceFromLogInjective(tx);
- if (!sequence) {
- throw new Error("Sequence not found");
- }
- const emitterAddress = await getEmitterAddressInjective(
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE)
- );
- return await fetchSignedVAA(CHAIN_ID_INJECTIVE, emitterAddress, sequence);
- } catch (e) {
- return handleError(e, enqueueSnackbar);
- }
-}
-
async function sui(digest: string, enqueueSnackbar: any) {
try {
const provider = getSuiProvider();
@@ -649,21 +621,6 @@ export default function Recovery() {
}
})();
}
- if (parsedPayload && parsedPayload.targetChain === CHAIN_ID_INJECTIVE) {
- (async () => {
- const client = getInjectiveWasmClient();
- const tokenBridgeAddress =
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
- const tokenId = await queryExternalIdInjective(
- client as any,
- tokenBridgeAddress,
- parsedPayload.originAddress
- );
- if (!cancelled) {
- setTokenId(tokenId || "");
- }
- })();
- }
if (parsedPayload && parsedPayload.targetChain === CHAIN_ID_SUI) {
(async () => {
@@ -845,26 +802,6 @@ export default function Recovery() {
setIsVAAPending(isPending);
}
})();
- } else if (recoverySourceChain === CHAIN_ID_INJECTIVE) {
- setRecoverySourceTxError("");
- setRecoverySourceTxIsLoading(true);
- setTokenId("");
- (async () => {
- const { vaa, isPending, error } = await injective(
- recoverySourceTx,
- enqueueSnackbar
- );
- if (!cancelled) {
- setRecoverySourceTxIsLoading(false);
- if (vaa) {
- setRecoverySignedVAA(vaa);
- }
- if (error) {
- setRecoverySourceTxError(error);
- }
- setIsVAAPending(isPending);
- }
- })();
} else if (recoverySourceChain === CHAIN_ID_SUI) {
setRecoverySourceTxError("");
setRecoverySourceTxIsLoading(true);
@@ -1229,8 +1166,7 @@ export default function Recovery() {
value={
parsedPayload
? parsedPayload.targetChain === CHAIN_ID_TERRA2 ||
- parsedPayload.targetChain === CHAIN_ID_XPLA ||
- parsedPayload.targetChain === CHAIN_ID_INJECTIVE
+ parsedPayload.targetChain === CHAIN_ID_XPLA
? tokenId
: hexToNativeAssetString(
parsedPayload.originAddress,
diff --git a/src/components/ShowTx.tsx b/src/components/ShowTx.tsx
index f6eb078de..82ab88c66 100644
--- a/src/components/ShowTx.tsx
+++ b/src/components/ShowTx.tsx
@@ -20,7 +20,6 @@ import {
CHAIN_ID_XPLA,
CHAIN_ID_APTOS,
CHAIN_ID_ARBITRUM,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_OPTIMISM,
CHAIN_ID_SUI,
CHAIN_ID_BASE,
@@ -174,10 +173,6 @@ export default function ShowTx({
? `https://${
CLUSTER === "testnet" ? "goerli." : ""
}arbiscan.io/tx/${tx?.id}`
- : chainId === CHAIN_ID_INJECTIVE
- ? `https://${
- CLUSTER === "testnet" ? "testnet." : ""
- }explorer.injective.network/transaction/${tx.id}`
: chainId === CHAIN_ID_OPTIMISM
? `https://${
CLUSTER === "testnet" ? "goerli-optimism." : "optimistic."
diff --git a/src/components/SmartAddress.tsx b/src/components/SmartAddress.tsx
index 350502d38..9dd0643db 100644
--- a/src/components/SmartAddress.tsx
+++ b/src/components/SmartAddress.tsx
@@ -23,7 +23,6 @@ import {
CHAIN_ID_APTOS,
isValidAptosType,
CHAIN_ID_ARBITRUM,
- CHAIN_ID_INJECTIVE,
terra,
CHAIN_ID_OPTIMISM,
CHAIN_ID_SUI,
@@ -235,14 +234,6 @@ export default function SmartAddress({
? `https://${CLUSTER === "testnet" ? "goerli." : ""}arbiscan.io/${
isAsset ? "token" : "address"
}/${useableAddress}`
- : chainId === CHAIN_ID_INJECTIVE
- ? `https://${
- CLUSTER === "testnet" ? "testnet." : ""
- }explorer.injective.network/${
- isAsset
- ? `asset/?tokenType=${isNative ? "native" : "cw20"}&tokenIdentifier=`
- : "account/"
- }${useableAddress}`
: chainId === CHAIN_ID_OPTIMISM
? `https://${
CLUSTER === "testnet" ? "goerli-optimism." : "optimistic."
diff --git a/src/components/TokenSelectors/InjectiveTokenPicker.tsx b/src/components/TokenSelectors/InjectiveTokenPicker.tsx
deleted file mode 100644
index 390411b37..000000000
--- a/src/components/TokenSelectors/InjectiveTokenPicker.tsx
+++ /dev/null
@@ -1,168 +0,0 @@
-import {
- CHAIN_ID_INJECTIVE,
- isNativeDenomInjective,
- parseSmartContractStateResponse,
-} from "@certusone/wormhole-sdk";
-import { formatUnits } from "@ethersproject/units";
-import { useCallback, useMemo, useRef } from "react";
-import { createParsedTokenAccount } from "../../hooks/useGetSourceParsedTokenAccounts";
-import useIsWalletReady from "../../hooks/useIsWalletReady";
-import useInjectiveNativeBalances from "../../hooks/useInjectiveNativeBalances";
-import { DataWrapper } from "../../store/helpers";
-import { NFTParsedTokenAccount } from "../../store/nftSlice";
-import { ParsedTokenAccount } from "../../store/transferSlice";
-import TokenPicker, { BasicAccountRender } from "./TokenPicker";
-import {
- formatNativeDenom,
- getInjectiveWasmClient,
- INJECTIVE_NATIVE_DENOM,
- isValidInjectiveAddress,
- NATIVE_INJECTIVE_DECIMALS,
-} from "../../utils/injective";
-import injectiveIcon from "../../icons/injective.svg";
-
-type InjectiveTokenPickerProps = {
- value: ParsedTokenAccount | null;
- onChange: (newValue: ParsedTokenAccount | null) => void;
- tokenAccounts: DataWrapper | undefined;
- disabled: boolean;
- resetAccounts: (() => void) | undefined;
-};
-
-const returnsFalse = () => false;
-
-export default function InjectiveTokenPicker(props: InjectiveTokenPickerProps) {
- const { value, onChange, disabled } = props;
- const { walletAddress } = useIsWalletReady(CHAIN_ID_INJECTIVE);
- const nativeRefresh = useRef<() => void>(() => {});
- const { balances, isLoading: nativeIsLoading } = useInjectiveNativeBalances(
- walletAddress,
- nativeRefresh
- );
-
- const resetAccountWrapper = useCallback(() => {
- //we can currently skip calling this as we don't read from sourceParsedTokenAccounts
- //resetAccounts && resetAccounts();
- nativeRefresh.current();
- }, []);
- const isLoading = nativeIsLoading; // || (tokenMap?.isFetching || false);
-
- const onChangeWrapper = useCallback(
- async (account: NFTParsedTokenAccount | null) => {
- if (account === null) {
- onChange(null);
- return Promise.resolve();
- }
- onChange(account);
- return Promise.resolve();
- },
- [onChange]
- );
-
- const injTokenArray = useMemo(() => {
- const balancesItems =
- balances && walletAddress
- ? Object.keys(balances).map((denom) =>
- //This token account makes a lot of assumptions
- createParsedTokenAccount(
- walletAddress,
- denom,
- balances[denom], //amount
- NATIVE_INJECTIVE_DECIMALS, //TODO actually get decimals rather than hardcode
- 0, //uiAmount is unused
- formatUnits(balances[denom], NATIVE_INJECTIVE_DECIMALS), //uiAmountString
- formatNativeDenom(denom), // symbol
- undefined, //name
- injectiveIcon,
- true //is native asset
- )
- )
- : [];
- return balancesItems.filter(
- (metadata) => metadata.mintKey === INJECTIVE_NATIVE_DENOM
- );
- }, [walletAddress, balances]);
-
- //TODO this only supports non-native assets. Native assets come from the hook.
- //TODO correlate against token list to get metadata
- const lookupInjectiveAddress = useCallback(
- (lookupAsset: string) => {
- if (!walletAddress) {
- return Promise.reject("Wallet not connected");
- }
- const client = getInjectiveWasmClient();
- return client
- .fetchSmartContractState(
- lookupAsset,
- Buffer.from(
- JSON.stringify({
- token_info: {},
- })
- ).toString("base64")
- )
- .then((infoData) =>
- client
- .fetchSmartContractState(
- lookupAsset,
- Buffer.from(
- JSON.stringify({
- balance: {
- address: walletAddress,
- },
- })
- ).toString("base64")
- )
- .then((balanceData) => {
- if (infoData && balanceData) {
- const balance = parseSmartContractStateResponse(balanceData);
- const info = parseSmartContractStateResponse(infoData);
- return createParsedTokenAccount(
- walletAddress,
- lookupAsset,
- balance.balance.toString(),
- info.decimals,
- Number(formatUnits(balance.balance, info.decimals)),
- formatUnits(balance.balance, info.decimals),
- info.symbol,
- info.name
- );
- } else {
- throw new Error("Failed to retrieve Injective account.");
- }
- })
- )
- .catch((e) => {
- return Promise.reject(e);
- });
- },
- [walletAddress]
- );
-
- const isSearchableAddress = useCallback((address: string) => {
- return isValidInjectiveAddress(address) && !isNativeDenomInjective(address);
- }, []);
-
- const RenderComp = useCallback(
- ({ account }: { account: NFTParsedTokenAccount }) => {
- return BasicAccountRender(account, returnsFalse, false);
- },
- []
- );
-
- return (
-
- );
-}
diff --git a/src/components/TokenSelectors/SourceTokenSelector.tsx b/src/components/TokenSelectors/SourceTokenSelector.tsx
index a744e913f..d3e50f208 100644
--- a/src/components/TokenSelectors/SourceTokenSelector.tsx
+++ b/src/components/TokenSelectors/SourceTokenSelector.tsx
@@ -2,7 +2,6 @@
import {
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_SUI,
@@ -39,7 +38,6 @@ import RefreshButtonWrapper from "./RefreshButtonWrapper";
import SolanaTokenPicker from "./SolanaTokenPicker";
import TerraTokenPicker from "./TerraTokenPicker";
import XplaTokenPicker from "./XplaTokenPicker";
-import InjectiveTokenPicker from "./InjectiveTokenPicker";
import SuiTokenPicker from "./SuiTokenPicker";
import SeiTokenPicker from "./SeiTokenPicker";
@@ -162,14 +160,6 @@ export const TokenSelector = (props: TokenSelectorProps) => {
tokenAccounts={maps?.tokenAccounts}
nft={nft}
/>
- ) : lookupChain === CHAIN_ID_INJECTIVE ? (
-
) : lookupChain === CHAIN_ID_SUI ? (
{
- const isValidNetwork = INJECTIVE_NETWORKS.includes(
- process.env.REACT_APP_CLUSTER || ""
- );
- if (!isValidNetwork) return [];
-
- const network = getInjectiveNetworkName();
- const networkEndpoints = getNetworkInfo(network);
-
- const opts = {
- networkChainId: getInjectiveNetworkChainId(),
- broadcasterOptions: {
- network,
- networkEndpoints,
- },
- };
-
- return [new KeplrWallet(opts)];
-};
-
-export interface IInjectiveContext {
- wallet?: InjectiveWallet;
- address?: string;
-}
-
-export const useInjectiveContext = (): IInjectiveContext => {
- const wallet = useWallet(CHAIN_ID_INJECTIVE);
-
- const address = useMemo(() => wallet?.getAddress(), [wallet]);
-
- return useMemo(
- () => ({
- wallet,
- address,
- }),
- [wallet, address]
- );
-};
diff --git a/src/hooks/useCheckIfWormholeWrapped.ts b/src/hooks/useCheckIfWormholeWrapped.ts
index 6e616a6ad..8185ba063 100644
--- a/src/hooks/useCheckIfWormholeWrapped.ts
+++ b/src/hooks/useCheckIfWormholeWrapped.ts
@@ -16,8 +16,6 @@ import {
isTerraChain,
uint8ArrayToHex,
WormholeWrappedInfo,
- CHAIN_ID_INJECTIVE,
- getOriginalAssetInjective,
CHAIN_ID_SUI,
getOriginalAssetSui,
CHAIN_ID_ETH,
@@ -64,7 +62,6 @@ import {
import { getOriginalAssetNear, makeNearAccount } from "../utils/near";
import { LCDClient as XplaLCDClient } from "@xpla/xpla.js";
import { getAptosClient } from "../utils/aptos";
-import { getInjectiveWasmClient } from "../utils/injective";
import { getSuiProvider } from "../utils/sui";
import { getOriginalAssetSei, getSeiWasmClient } from "../utils/sei";
import { base58 } from "ethers/lib/utils";
@@ -300,17 +297,6 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
}
} catch (e) {}
}
- if (sourceChain === CHAIN_ID_INJECTIVE && sourceAsset) {
- try {
- const client = getInjectiveWasmClient();
- const wrappedInfo = makeStateSafe(
- await getOriginalAssetInjective(sourceAsset, client as any)
- );
- if (!cancelled) {
- dispatch(setSourceWormholeWrappedInfo(wrappedInfo));
- }
- } catch (e) {}
- }
if (sourceChain === CHAIN_ID_SUI && sourceAsset) {
try {
const wrappedInfo = makeStateSafe(
diff --git a/src/hooks/useFetchForeignAsset.ts b/src/hooks/useFetchForeignAsset.ts
index 9ab2efdc9..1d949fc3a 100644
--- a/src/hooks/useFetchForeignAsset.ts
+++ b/src/hooks/useFetchForeignAsset.ts
@@ -3,7 +3,6 @@ import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA2,
@@ -12,7 +11,6 @@ import {
getForeignAssetAlgorand,
getForeignAssetAptos,
getForeignAssetEth,
- getForeignAssetInjective,
getForeignAssetSolana,
getForeignAssetTerra,
getForeignAssetXpla,
@@ -52,7 +50,6 @@ import {
import { useNearContext } from "../contexts/NearWalletContext";
import { LCDClient as XplaLCDClient } from "@xpla/xpla.js";
import { getAptosClient } from "../utils/aptos";
-import { getInjectiveWasmClient } from "../utils/injective";
import { getSuiProvider } from "../utils/sui";
import { getForeignAssetSei, getSeiWasmClient } from "../utils/sei";
@@ -227,16 +224,6 @@ function useFetchForeignAsset(
)
.catch(() => Promise.reject("Failed to make Near account"));
}
- : foreignChain === CHAIN_ID_INJECTIVE
- ? () => {
- const client = getInjectiveWasmClient();
- return getForeignAssetInjective(
- getTokenBridgeAddressForChain(foreignChain),
- client as any,
- originChain,
- hexToUint8Array(originAssetHex)
- );
- }
: foreignChain === CHAIN_ID_SUI
? () => {
return getForeignAssetSui(
diff --git a/src/hooks/useFetchTargetAsset.ts b/src/hooks/useFetchTargetAsset.ts
index 84dc373dd..13962f1e4 100644
--- a/src/hooks/useFetchTargetAsset.ts
+++ b/src/hooks/useFetchTargetAsset.ts
@@ -2,7 +2,6 @@ import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA2,
@@ -12,7 +11,6 @@ import {
getForeignAssetAlgorand,
getForeignAssetAptos,
getForeignAssetEth,
- getForeignAssetInjective,
getForeignAssetSolana,
getForeignAssetTerra,
getForeignAssetXpla,
@@ -22,7 +20,6 @@ import {
isEVMChain,
isTerraChain,
queryExternalId,
- queryExternalIdInjective,
CHAIN_ID_SUI,
getForeignAssetSui,
} from "@certusone/wormhole-sdk";
@@ -85,7 +82,6 @@ import {
} from "../utils/near";
import { LCDClient as XplaLCDClient } from "@xpla/xpla.js";
import { getAptosClient } from "../utils/aptos";
-import { getInjectiveWasmClient } from "../utils/injective";
import { getSuiProvider } from "../utils/sui";
import {
getForeignAssetSei,
@@ -283,25 +279,6 @@ function useFetchTargetAsset(nft?: boolean) {
);
}
}
- } else if (originChain === CHAIN_ID_INJECTIVE) {
- const client = getInjectiveWasmClient();
- const tokenBridgeAddress =
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
- const tokenId = await queryExternalIdInjective(
- client as any,
- tokenBridgeAddress,
- originAsset || ""
- );
- if (!cancelled) {
- dispatch(
- setTargetAsset(
- receiveDataWrapper({
- doesExist: true,
- address: tokenId,
- })
- )
- );
- }
} else if (originChain === CHAIN_ID_SUI) {
const coinType = await getForeignAssetSui(
getSuiProvider(),
@@ -648,36 +625,6 @@ function useFetchTargetAsset(nft?: boolean) {
}
}
}
- if (targetChain === CHAIN_ID_INJECTIVE && originChain && originAsset) {
- dispatch(setTargetAsset(fetchDataWrapper()));
- try {
- const client = getInjectiveWasmClient();
- const asset = await getForeignAssetInjective(
- getTokenBridgeAddressForChain(targetChain),
- client as any,
- originChain,
- hexToUint8Array(originAsset)
- );
- if (!cancelled) {
- dispatch(
- setTargetAsset(
- receiveDataWrapper({ doesExist: !!asset, address: asset })
- )
- );
- setArgs();
- }
- } catch (e) {
- if (!cancelled) {
- dispatch(
- setTargetAsset(
- errorDataWrapper(
- "Unable to determine existence of wrapped asset"
- )
- )
- );
- }
- }
- }
if (targetChain === CHAIN_ID_SUI && originChain && originAsset) {
dispatch(setTargetAsset(fetchDataWrapper()));
try {
diff --git a/src/hooks/useGetIsTransferCompleted.ts b/src/hooks/useGetIsTransferCompleted.ts
index e6c60f52f..ee3c6034d 100644
--- a/src/hooks/useGetIsTransferCompleted.ts
+++ b/src/hooks/useGetIsTransferCompleted.ts
@@ -1,7 +1,6 @@
import {
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_SUI,
@@ -10,7 +9,6 @@ import {
getIsTransferCompletedAlgorand,
getIsTransferCompletedAptos,
getIsTransferCompletedEth,
- getIsTransferCompletedInjective,
getIsTransferCompletedSolana,
getIsTransferCompletedSui,
getIsTransferCompletedTerra,
@@ -45,7 +43,6 @@ import useIsWalletReady from "./useIsWalletReady";
import useTransferSignedVAA from "./useTransferSignedVAA";
import { LCDClient as XplaLCDClient } from "@xpla/xpla.js";
import { getAptosClient } from "../utils/aptos";
-import { getInjectiveWasmClient } from "../utils/injective";
import { getSuiProvider } from "../utils/sui";
import { getIsTransferCompletedSei, getSeiWasmClient } from "../utils/sei";
@@ -243,24 +240,6 @@ export default function useGetIsTransferCompleted(
setIsLoading(false);
}
})();
- } else if (targetChain === CHAIN_ID_INJECTIVE) {
- setIsLoading(true);
- (async () => {
- try {
- const client = getInjectiveWasmClient();
- transferCompleted = await getIsTransferCompletedInjective(
- getTokenBridgeAddressForChain(targetChain),
- signedVAA,
- client as any
- );
- } catch (error) {
- console.error(error);
- }
- if (!cancelled) {
- setIsTransferCompleted(transferCompleted);
- setIsLoading(false);
- }
- })();
} else if (targetChain === CHAIN_ID_SUI) {
setIsLoading(true);
(async () => {
diff --git a/src/hooks/useGetSourceParsedTokenAccounts.ts b/src/hooks/useGetSourceParsedTokenAccounts.ts
index 9a5209cde..80648c788 100644
--- a/src/hooks/useGetSourceParsedTokenAccounts.ts
+++ b/src/hooks/useGetSourceParsedTokenAccounts.ts
@@ -24,7 +24,6 @@ import {
ethers_contracts,
WSOL_ADDRESS,
WSOL_DECIMALS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_SUI,
CHAIN_ID_ARBITRUM,
CHAIN_ID_BASE,
@@ -2066,10 +2065,6 @@ function useGetAvailableTokens(nft: boolean = false) {
tokenAccounts,
resetAccounts: resetSourceAccounts,
}
- : lookupChain === CHAIN_ID_INJECTIVE
- ? {
- resetAccounts: resetSourceAccounts,
- }
: lookupChain === CHAIN_ID_SUI
? {
tokenAccounts,
diff --git a/src/hooks/useGetTargetParsedTokenAccounts.ts b/src/hooks/useGetTargetParsedTokenAccounts.ts
index 2d0a12f66..17170bb73 100644
--- a/src/hooks/useGetTargetParsedTokenAccounts.ts
+++ b/src/hooks/useGetTargetParsedTokenAccounts.ts
@@ -1,7 +1,6 @@
import {
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
CHAIN_ID_SUI,
@@ -10,7 +9,6 @@ import {
ensureHexPrefix,
ethers_contracts,
isEVMChain,
- isNativeDenomInjective,
isNativeDenomXpla,
isTerraChain,
parseSmartContractStateResponse,
@@ -52,12 +50,6 @@ import { LCDClient as XplaLCDClient } from "@xpla/xpla.js";
import { NATIVE_XPLA_DECIMALS } from "../utils/xpla";
import { useAptosContext } from "../contexts/AptosWalletContext";
import { getAptosClient } from "../utils/aptos";
-import {
- getInjectiveBankClient,
- NATIVE_INJECTIVE_DECIMALS,
- getInjectiveWasmClient,
-} from "../utils/injective";
-import { useInjectiveContext } from "../contexts/InjectiveWalletContext";
import { useTerraWallet } from "../contexts/TerraWalletContext";
import { useSuiWallet } from "../contexts/SuiWalletContext";
import { getSuiProvider } from "../utils/sui";
@@ -89,7 +81,6 @@ function useGetTargetParsedTokenAccounts() {
const { address: algoAccount } = useAlgorandWallet();
const { accountId: nearAccountId } = useNearContext();
const { account: aptosAddress } = useAptosContext();
- const { address: injAddress } = useInjectiveContext();
const seiWallet = useSeiWallet();
const seiAddress = seiWallet?.getAddress();
const suiWallet = useSuiWallet();
@@ -589,87 +580,6 @@ function useGetTargetParsedTokenAccounts() {
}
}
}
- if (targetChain === CHAIN_ID_INJECTIVE && injAddress) {
- if (isNativeDenomInjective(targetAsset)) {
- const client = getInjectiveBankClient();
- client
- .fetchBalance({ accountAddress: injAddress, denom: targetAsset })
- .then(({ amount }) => {
- if (!cancelled) {
- dispatch(
- setTargetParsedTokenAccount(
- createParsedTokenAccount(
- "",
- "",
- amount,
- NATIVE_INJECTIVE_DECIMALS,
- Number(formatUnits(amount, NATIVE_INJECTIVE_DECIMALS)),
- formatUnits(amount, NATIVE_INJECTIVE_DECIMALS),
- symbol,
- tokenName,
- logo
- )
- )
- );
- }
- })
- .catch(() => {
- if (!cancelled) {
- // TODO: error state
- }
- });
- } else {
- const client = getInjectiveWasmClient();
- client
- .fetchSmartContractState(
- targetAsset,
- Buffer.from(
- JSON.stringify({
- token_info: {},
- })
- ).toString("base64")
- )
- .then((infoData) =>
- client
- .fetchSmartContractState(
- targetAsset,
- Buffer.from(
- JSON.stringify({
- balance: {
- address: injAddress,
- },
- })
- ).toString("base64")
- )
- .then((balanceData) => {
- if (infoData && balanceData && !cancelled) {
- const balance = parseSmartContractStateResponse(balanceData);
- const info = parseSmartContractStateResponse(infoData);
- dispatch(
- setTargetParsedTokenAccount(
- createParsedTokenAccount(
- "",
- "",
- balance.balance.toString(),
- info.decimals,
- Number(formatUnits(balance.balance, info.decimals)),
- formatUnits(balance.balance, info.decimals),
- symbol,
- tokenName,
- logo
- )
- )
- );
- }
- })
- )
- .catch((e) => {
- if (!cancelled) {
- // TODO: error state
- }
- });
- }
- }
return () => {
cancelled = true;
@@ -693,7 +603,6 @@ function useGetTargetParsedTokenAccounts() {
nearAccountId,
xplaWallet,
aptosAddress,
- injAddress,
seiAddress,
suiAddress,
]);
diff --git a/src/hooks/useHandleAttest.tsx b/src/hooks/useHandleAttest.tsx
index 563718040..16b286925 100644
--- a/src/hooks/useHandleAttest.tsx
+++ b/src/hooks/useHandleAttest.tsx
@@ -2,14 +2,12 @@ import {
attestFromAlgorand,
attestFromAptos,
attestFromEth,
- attestFromInjective,
attestFromSolana,
attestFromTerra,
attestFromXpla,
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_KLAYTN,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
@@ -17,7 +15,6 @@ import {
CHAIN_ID_SEI,
getEmitterAddressAlgorand,
getEmitterAddressEth,
- getEmitterAddressInjective,
getEmitterAddressSolana,
getEmitterAddressTerra,
getEmitterAddressXpla,
@@ -26,7 +23,6 @@ import {
isTerraChain,
parseSequenceFromLogAlgorand,
parseSequenceFromLogEth,
- parseSequenceFromLogInjective,
parseSequenceFromLogSolana,
parseSequenceFromLogTerra,
parseSequenceFromLogXpla,
@@ -95,12 +91,9 @@ import parseError from "../utils/parseError";
import { signSendAndConfirm } from "../utils/solana";
import { postWithFees, waitForTerraExecution } from "../utils/terra";
import { postWithFeesXpla, waitForXplaExecution } from "../utils/xpla";
-import { useInjectiveContext } from "../contexts/InjectiveWalletContext";
-import { broadcastInjectiveTx } from "../utils/injective";
import { AlgorandWallet } from "@xlabs-libs/wallet-aggregator-algorand";
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
import { AptosWallet } from "@xlabs-libs/wallet-aggregator-aptos";
-import { InjectiveWallet } from "@xlabs-libs/wallet-aggregator-injective";
import { NearWallet } from "@xlabs-libs/wallet-aggregator-near";
import { useTerraWallet } from "../contexts/TerraWalletContext";
import { TerraWallet } from "@xlabs-libs/wallet-aggregator-terra";
@@ -515,63 +508,6 @@ async function terra(
}
}
-async function injective(
- dispatch: any,
- enqueueSnackbar: any,
- wallet: InjectiveWallet,
- walletAddress: string,
- asset: string,
- onError: (error: any) => void,
- onStart: (extra?: Partial) => void
-) {
- dispatch(setIsSending(true));
- try {
- const tokenBridgeAddress =
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
- const msg = await attestFromInjective(
- tokenBridgeAddress,
- walletAddress,
- asset
- );
- const tx = await broadcastInjectiveTx(
- wallet,
- walletAddress,
- msg,
- "Attest Token"
- );
- onStart?.({ txId: tx.txHash });
- dispatch(setAttestTx({ id: tx.txHash, block: tx.height }));
- enqueueSnackbar(null, {
- content: Transaction confirmed,
- });
- const sequence = parseSequenceFromLogInjective(tx);
- if (!sequence) {
- throw new Error("Sequence not found");
- }
- const emitterAddress = await getEmitterAddressInjective(tokenBridgeAddress);
- enqueueSnackbar(null, {
- content: Fetching VAA,
- });
- const { vaaBytes } = await getSignedVAAWithRetry(
- WORMHOLE_RPC_HOSTS,
- CHAIN_ID_INJECTIVE,
- emitterAddress,
- sequence
- );
- dispatch(setSignedVAAHex(uint8ArrayToHex(vaaBytes)));
- enqueueSnackbar(null, {
- content: Fetched Signed VAA,
- });
- } catch (e) {
- console.error(e);
- enqueueSnackbar(null, {
- content: {parseError(e)},
- });
- dispatch(setIsSending(false));
- onError(e);
- }
-}
-
async function sui(
dispatch: any,
enqueueSnackbar: any,
@@ -729,7 +665,6 @@ export function useHandleAttest() {
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
const { account: aptosAddress, wallet: aptosWallet } = useAptosContext();
const { accountId: nearAccountId, wallet } = useNearContext();
- const { wallet: injWallet, address: injAddress } = useInjectiveContext();
const seiWallet = useSeiWallet();
const seiAddress = seiWallet?.getAddress();
const suiWallet = useSuiWallet();
@@ -822,16 +757,6 @@ export function useHandleAttest() {
onError,
onStart
);
- } else if (sourceChain === CHAIN_ID_INJECTIVE && injWallet && injAddress) {
- injective(
- dispatch,
- enqueueSnackbar,
- injWallet,
- injAddress,
- sourceAsset,
- onError,
- onStart
- );
} else if (sourceChain === CHAIN_ID_SEI && seiWallet && seiAddress) {
sei(dispatch, enqueueSnackbar, seiWallet, sourceAsset, onError, onStart);
} else if (
@@ -855,8 +780,6 @@ export function useHandleAttest() {
aptosAddress,
nearAccountId,
wallet,
- injWallet,
- injAddress,
seiWallet,
seiAddress,
suiWallet,
diff --git a/src/hooks/useHandleCreateWrapped.tsx b/src/hooks/useHandleCreateWrapped.tsx
index c3ebdc12d..56c96bb7a 100644
--- a/src/hooks/useHandleCreateWrapped.tsx
+++ b/src/hooks/useHandleCreateWrapped.tsx
@@ -3,7 +3,6 @@ import {
CHAIN_ID_ACALA,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_KARURA,
CHAIN_ID_KLAYTN,
CHAIN_ID_NEAR,
@@ -12,7 +11,6 @@ import {
createWrappedOnAlgorand,
createWrappedOnAptos,
createWrappedOnEth,
- createWrappedOnInjective,
createWrappedOnSolana,
createWrappedOnTerra,
createWrappedOnXpla,
@@ -21,7 +19,6 @@ import {
isTerraChain,
TerraChainId,
updateWrappedOnEth,
- updateWrappedOnInjective,
updateWrappedOnSolana,
updateWrappedOnTerra,
updateWrappedOnXpla,
@@ -78,12 +75,9 @@ import parseError from "../utils/parseError";
import { postVaa, signSendAndConfirm } from "../utils/solana";
import { postWithFees } from "../utils/terra";
import useAttestSignedVAA from "./useAttestSignedVAA";
-import { broadcastInjectiveTx } from "../utils/injective";
-import { useInjectiveContext } from "../contexts/InjectiveWalletContext";
import { AlgorandWallet } from "@xlabs-libs/wallet-aggregator-algorand";
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
import { AptosWallet } from "@xlabs-libs/wallet-aggregator-aptos";
-import { InjectiveWallet } from "@xlabs-libs/wallet-aggregator-injective";
import { NearWallet } from "@xlabs-libs/wallet-aggregator-near";
import { useTerraWallet } from "../contexts/TerraWalletContext";
import { TerraWallet } from "@xlabs-libs/wallet-aggregator-terra";
@@ -549,50 +543,6 @@ async function terra(
}
}
-async function injective(
- dispatch: any,
- enqueueSnackbar: any,
- wallet: InjectiveWallet,
- walletAddress: string,
- signedVAA: Uint8Array,
- shouldUpdate: boolean,
- onError: (error: any) => void,
- onStart: (extra?: Partial) => void
-) {
- dispatch(setIsCreating(true));
- const tokenBridgeAddress = getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
- try {
- const msg = shouldUpdate
- ? await updateWrappedOnInjective(
- tokenBridgeAddress,
- walletAddress,
- signedVAA
- )
- : await createWrappedOnInjective(
- tokenBridgeAddress,
- walletAddress,
- signedVAA
- );
- const tx = await broadcastInjectiveTx(
- wallet,
- walletAddress,
- msg,
- "Wormhole - Create Wrapped"
- );
- onStart({ txId: tx.txHash });
- dispatch(setCreateTx({ id: tx.txHash, block: tx.height }));
- enqueueSnackbar(null, {
- content: Transaction confirmed,
- });
- } catch (e) {
- enqueueSnackbar(null, {
- content: {parseError(e)},
- });
- dispatch(setIsCreating(false));
- onError(e);
- }
-}
-
async function sui(
dispatch: any,
enqueueSnackbar: any,
@@ -648,7 +598,7 @@ async function sui(
}
const wrappedAssetSetupEvent =
suiPrepareRegistrationTxRes.objectChanges?.find(
- (oc) =>
+ (oc: any) =>
oc.type === "created" && oc.objectType.includes("WrappedAssetSetup")
);
const wrappedAssetSetupType =
@@ -807,7 +757,6 @@ export function useHandleCreateWrapped(
const xplaWallet = useXplaWallet();
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
const { account: aptosAddress, wallet: aptosWallet } = useAptosContext();
- const { wallet: injWallet, address: injAddress } = useInjectiveContext();
const { accountId: nearAccountId, wallet } = useNearContext();
const suiWallet = useSuiWallet();
const seiWallet = useSeiWallet();
@@ -937,22 +886,6 @@ export function useHandleCreateWrapped(
onError,
onStart
);
- } else if (
- targetChain === CHAIN_ID_INJECTIVE &&
- injWallet &&
- injAddress &&
- !!signedVAA
- ) {
- injective(
- dispatch,
- enqueueSnackbar,
- injWallet,
- injAddress,
- signedVAA,
- shouldUpdate,
- onError,
- onStart
- );
} else if (
targetChain === CHAIN_ID_SUI &&
suiWallet &&
@@ -1006,8 +939,6 @@ export function useHandleCreateWrapped(
xplaWallet,
aptosAddress,
aptosWallet,
- injWallet,
- injAddress,
foreignAddress,
suiWallet,
seiWallet,
diff --git a/src/hooks/useHandleRedeem.tsx b/src/hooks/useHandleRedeem.tsx
index e06d70a91..2b4402a42 100644
--- a/src/hooks/useHandleRedeem.tsx
+++ b/src/hooks/useHandleRedeem.tsx
@@ -2,7 +2,6 @@ import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_KLAYTN,
CHAIN_ID_NEAR,
CHAIN_ID_SOLANA,
@@ -12,7 +11,6 @@ import {
redeemOnAlgorand,
redeemOnEth,
redeemOnEthNative,
- redeemOnInjective,
redeemOnSolana,
redeemOnTerra,
redeemOnXpla,
@@ -81,12 +79,9 @@ import { postVaa, signSendAndConfirm } from "../utils/solana";
import { postWithFees } from "../utils/terra";
import useTransferSignedVAA from "./useTransferSignedVAA";
import { postWithFeesXpla } from "../utils/xpla";
-import { broadcastInjectiveTx } from "../utils/injective";
-import { useInjectiveContext } from "../contexts/InjectiveWalletContext";
import { AlgorandWallet } from "@xlabs-libs/wallet-aggregator-algorand";
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
import { AptosWallet } from "@xlabs-libs/wallet-aggregator-aptos";
-import { InjectiveWallet } from "@xlabs-libs/wallet-aggregator-injective";
import { NearWallet } from "@xlabs-libs/wallet-aggregator-near";
import { useTerraWallet } from "../contexts/TerraWalletContext";
import { TerraWallet } from "@xlabs-libs/wallet-aggregator-terra";
@@ -340,7 +335,7 @@ async function sei(
try {
const vaa = parseVaa(signedVAA);
const transfer = parseTokenTransferPayload(vaa.payload);
- const receiver = cosmos.humanAddress("sei", transfer.to);
+ const receiver = cosmos.humanAddress("sei", new Uint8Array(transfer.to));
const contractAddress =
receiver === SEI_TRANSLATOR
? SEI_TRANSLATOR
@@ -402,40 +397,6 @@ async function sei(
}
}
-async function injective(
- dispatch: any,
- enqueueSnackbar: any,
- wallet: InjectiveWallet,
- walletAddress: string,
- signedVAA: Uint8Array,
- onSuccess?: () => void
-) {
- dispatch(setIsRedeeming(true));
- try {
- const msg = await redeemOnInjective(
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE),
- walletAddress,
- signedVAA
- );
- const tx = await broadcastInjectiveTx(
- wallet,
- walletAddress,
- msg,
- "Wormhole - Complete Transfer"
- );
- dispatch(setRedeemTx({ id: tx.txHash, block: tx.height }));
- enqueueSnackbar(null, {
- content: Transaction confirmed,
- });
- onSuccess?.();
- } catch (e) {
- enqueueSnackbar(null, {
- content: {parseError(e)},
- });
- dispatch(setIsRedeeming(false));
- }
-}
-
async function solana(
dispatch: any,
enqueueSnackbar: any,
@@ -605,7 +566,6 @@ export function useHandleRedeem() {
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
const { accountId: nearAccountId, wallet } = useNearContext();
const { account: aptosAddress, wallet: aptosWallet } = useAptosContext();
- const { wallet: injWallet, address: injAddress } = useInjectiveContext();
const suiWallet = useSuiWallet();
const seiWallet = useSeiWallet();
const seiAddress = seiWallet?.getAddress();
@@ -714,20 +674,6 @@ export function useHandleRedeem() {
wallet,
onSuccess
);
- } else if (
- targetChain === CHAIN_ID_INJECTIVE &&
- injWallet &&
- injAddress &&
- signedVAA
- ) {
- injective(
- dispatch,
- enqueueSnackbar,
- injWallet,
- injAddress,
- signedVAA,
- onSuccess
- );
} else if (
targetChain === CHAIN_ID_SUI &&
suiWallet?.getAddress() &&
@@ -749,8 +695,6 @@ export function useHandleRedeem() {
algoAccount,
nearAccountId,
wallet,
- injWallet,
- injAddress,
suiWallet,
dispatch,
enqueueSnackbar,
@@ -805,20 +749,6 @@ export function useHandleRedeem() {
!!signedVAA
) {
algo(dispatch, enqueueSnackbar, algoWallet, signedVAA, onSuccess);
- } else if (
- targetChain === CHAIN_ID_INJECTIVE &&
- injWallet &&
- injAddress &&
- signedVAA
- ) {
- injective(
- dispatch,
- enqueueSnackbar,
- injWallet,
- injAddress,
- signedVAA,
- onSuccess
- );
} else if (
targetChain === CHAIN_ID_SEI &&
seiWallet &&
@@ -841,8 +771,6 @@ export function useHandleRedeem() {
solPK,
terraWallet,
algoAccount,
- injWallet,
- injAddress,
seiWallet,
seiAddress,
suiWallet,
diff --git a/src/hooks/useHandleTransfer.tsx b/src/hooks/useHandleTransfer.tsx
index 8ea67c908..1dec01294 100644
--- a/src/hooks/useHandleTransfer.tsx
+++ b/src/hooks/useHandleTransfer.tsx
@@ -2,7 +2,6 @@ import {
ChainId,
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
- CHAIN_ID_INJECTIVE,
CHAIN_ID_KLAYTN,
CHAIN_ID_SOLANA,
CHAIN_ID_XPLA,
@@ -11,7 +10,6 @@ import {
createNonce,
getEmitterAddressAlgorand,
getEmitterAddressEth,
- getEmitterAddressInjective,
getEmitterAddressSolana,
getEmitterAddressTerra,
getEmitterAddressXpla,
@@ -20,7 +18,6 @@ import {
isTerraChain,
parseSequenceFromLogAlgorand,
parseSequenceFromLogEth,
- parseSequenceFromLogInjective,
parseSequenceFromLogSolana,
parseSequenceFromLogTerra,
parseSequenceFromLogXpla,
@@ -28,7 +25,6 @@ import {
transferFromAlgorand,
transferFromEth,
transferFromEthNative,
- transferFromInjective,
transferFromTerra,
transferFromXpla,
transferFromAptos,
@@ -121,12 +117,9 @@ import { signSendAndConfirm } from "../utils/solana";
import { postWithFees, waitForTerraExecution } from "../utils/terra";
import useTransferTargetAddressHex from "./useTransferTargetAddress";
import { postWithFeesXpla, waitForXplaExecution } from "../utils/xpla";
-import { broadcastInjectiveTx } from "../utils/injective";
-import { useInjectiveContext } from "../contexts/InjectiveWalletContext";
import { AlgorandWallet } from "@xlabs-libs/wallet-aggregator-algorand";
import { SolanaWallet } from "@xlabs-libs/wallet-aggregator-solana";
import { AptosWallet } from "@xlabs-libs/wallet-aggregator-aptos";
-import { InjectiveWallet } from "@xlabs-libs/wallet-aggregator-injective";
import { NearWallet } from "@xlabs-libs/wallet-aggregator-near";
import { useTerraWallet } from "../contexts/TerraWalletContext";
import { TerraWallet } from "@xlabs-libs/wallet-aggregator-terra";
@@ -803,68 +796,6 @@ async function terra(
}
}
-async function injective(
- dispatch: any,
- enqueueSnackbar: any,
- wallet: InjectiveWallet,
- walletAddress: string,
- asset: string,
- amount: string,
- decimals: number,
- targetChain: ChainId,
- targetAddress: Uint8Array,
- maybeAdditionalPayload: MaybeAdditionalPayloadFn,
- relayerFee?: string,
- onError?: (error: any) => void,
- onStart?: (extra?: Partial) => void
-) {
- dispatch(setIsSending(true));
- try {
- const baseAmountParsed = parseUnits(amount, decimals);
- const feeParsed = parseUnits(relayerFee || "0", decimals);
- const transferAmountParsed = baseAmountParsed.add(feeParsed);
- const additionalPayload = maybeAdditionalPayload();
- const tokenBridgeAddress =
- getTokenBridgeAddressForChain(CHAIN_ID_INJECTIVE);
- const msgs = await transferFromInjective(
- walletAddress,
- tokenBridgeAddress,
- asset,
- transferAmountParsed.toString(),
- targetChain,
- additionalPayload?.receivingContract || targetAddress,
- feeParsed.toString(),
- additionalPayload?.payload
- );
- const tx = await broadcastInjectiveTx(
- wallet,
- walletAddress,
- msgs,
- "Wormhole - Initiate Transfer"
- );
- onStart?.({ txId: tx.txHash });
- dispatch(setTransferTx({ id: tx.txHash, block: tx.height }));
- enqueueSnackbar(null, {
- content: Transaction confirmed,
- });
- const sequence = parseSequenceFromLogInjective(tx);
- if (!sequence) {
- throw new Error("Sequence not found");
- }
- const emitterAddress = await getEmitterAddressInjective(tokenBridgeAddress);
- await fetchSignedVAA(
- CHAIN_ID_INJECTIVE,
- emitterAddress,
- sequence,
- enqueueSnackbar,
- dispatch
- );
- } catch (e) {
- handleError(e, enqueueSnackbar, dispatch);
- onError?.(e);
- }
-}
-
async function sei(
dispatch: any,
enqueueSnackbar: any,
@@ -1091,7 +1022,6 @@ export function useHandleTransfer() {
const { address: algoAccount, wallet: algoWallet } = useAlgorandWallet();
const { accountId: nearAccountId, wallet } = useNearContext();
const { account: aptosAddress, wallet: aptosWallet } = useAptosContext();
- const { wallet: injWallet, address: injAddress } = useInjectiveContext();
const suiWallet = useSuiWallet();
const seiWallet = useSeiWallet();
const seiAddress = seiWallet?.getAddress();
@@ -1364,29 +1294,6 @@ export function useHandleTransfer() {
onError,
onStart
);
- } else if (
- sourceChain === CHAIN_ID_INJECTIVE &&
- injWallet &&
- injAddress &&
- !!sourceAsset &&
- decimals !== undefined &&
- !!targetAddress
- ) {
- injective(
- dispatch,
- enqueueSnackbar,
- injWallet,
- injAddress,
- sourceAsset,
- amount,
- decimals,
- targetChain,
- targetAddress,
- maybeAdditionalPayload,
- relayerFee,
- onError,
- onStart
- );
} else if (
sourceChain === CHAIN_ID_SUI &&
suiWallet?.isConnected() &&
@@ -1434,8 +1341,6 @@ export function useHandleTransfer() {
nearAccountId,
wallet,
aptosAddress,
- injWallet,
- injAddress,
suiWallet,
dispatch,
enqueueSnackbar,
diff --git a/src/hooks/useInjectiveMetadata.ts b/src/hooks/useInjectiveMetadata.ts
deleted file mode 100644
index 940302b3f..000000000
--- a/src/hooks/useInjectiveMetadata.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { parseSmartContractStateResponse } from "@certusone/wormhole-sdk";
-import { ChainGrpcWasmApi } from "@injectivelabs/sdk-ts";
-import { useLayoutEffect, useMemo, useState } from "react";
-import { DataWrapper } from "../store/helpers";
-import { getInjectiveWasmClient } from "../utils/injective";
-
-export type InjectiveMetadata = {
- symbol?: string;
- logo?: string;
- tokenName?: string;
- decimals?: number;
-};
-
-const fetchSingleMetadata = async (address: string, client: ChainGrpcWasmApi) =>
- client
- .fetchSmartContractState(
- address,
- Buffer.from(JSON.stringify({ token_info: {} })).toString("base64")
- )
- .then((data) => {
- const parsed = parseSmartContractStateResponse(data);
- return {
- symbol: parsed.symbol,
- tokenName: parsed.name,
- decimals: parsed.decimals,
- } as InjectiveMetadata;
- });
-
-const fetchInjectiveMetadata = async (addresses: string[]) => {
- const client = getInjectiveWasmClient();
- const promises: Promise[] = [];
- addresses.forEach((address) => {
- promises.push(fetchSingleMetadata(address, client));
- });
- const resultsArray = await Promise.all(promises);
- const output = new Map();
- addresses.forEach((address, index) => {
- output.set(address, resultsArray[index]);
- });
-
- return output;
-};
-
-const useInjectiveMetadata = (
- addresses: string[]
-): DataWrapper