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

Fix for provider not set or invalid error #970

Merged
merged 3 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion src/hooks/transfer/useTokenTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export function useTokenTransfer(selectedToken: Ref<Asset>) {
const route = useRoute();
const router = useRouter();

const { nativeTokenSymbol, evmNetworkIdx, isSupportXvmTransfer } = useNetworkInfo();
const { nativeTokenSymbol, evmNetworkIdx, isSupportXvmTransfer, currentNetworkName } =
useNetworkInfo();
const isH160 = computed<boolean>(() => store.getters['general/isH160Formatted']);
const tokenSymbol = computed<string>(() => route.query.token as string);
const isLoading = computed<boolean>(() => store.getters['general/isLoading']);
Expand Down Expand Up @@ -189,6 +190,7 @@ export function useTokenTransfer(selectedToken: Ref<Asset>) {
decimals,
finalizedCallback,
successMessage,
network: currentNetworkName.value.toLowerCase(),
});
} else {
const receivingAddress = isValidEvmAddress(toAddress)
Expand Down
4 changes: 4 additions & 0 deletions src/v2/app.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export function setCurrentWallet(
currentWallet: string,
isLockdrop: boolean
): void {
if (!currentWallet) {
return;
}

currentWalletType = isEthWallet ? WalletType.Metamask : WalletType.Polkadot;
currentWalletName = currentWallet;
isLockdropAccount = isLockdrop;
Expand Down
7 changes: 5 additions & 2 deletions src/v2/repositories/implementations/AssetsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ export class AssetsRepository implements IAssetsRepository {
param: ParamEvmTransfer;
web3: Web3;
}): Promise<TransactionConfig> {
const { contractAddress, senderAddress, toAddress, amount, decimals } = param;
const { contractAddress, senderAddress, toAddress, amount, decimals, network } = param;
// memo: don't use gas station for Shibuya, because it gives wrong gas price.
const gas = network === 'shibuya' ? '0' : this.gasPriceProvider.getGas().price;
const [nonce, gasPrice] = await Promise.all([
web3.eth.getTransactionCount(senderAddress),
getEvmGas(web3, this.gasPriceProvider.getGas().price),
// if gas === 0 the method will use gas value from RPC endpoint.
getEvmGas(web3, gas),
]);
if (contractAddress === astarNativeTokenErcAddr) {
return {
Expand Down
1 change: 1 addition & 0 deletions src/v2/services/IAssetsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface ParamEvmTransfer {
contractAddress: string;
decimals: number;
successMessage: string;
network: string;
finalizedCallback: (hash: string) => void;
}

Expand Down
Loading