Skip to content

Commit

Permalink
pending status fixed, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
KorbinianK committed Oct 29, 2023
1 parent 23af720 commit b82bf8f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 110 deletions.
4 changes: 1 addition & 3 deletions packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
function onBridgeClick() {
bridging = true;
bridge().finally(() => {
bridging = false;
});
bridge();
}
//TODO: this should probably be checked somewhere else?
Expand Down
101 changes: 1 addition & 100 deletions packages/bridge-ui-v2/src/components/Bridge/NFTBridge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,103 +79,6 @@
});
}
// async function approve() {
// try {
// if (!$selectedToken || !$network || !$destinationChain) return;
// const type: TokenType = $selectedToken.type;
// const walletClient = await getConnectedWallet($network.id);
// let tokenAddress = await getAddress($selectedToken.addresses[$network.id]);
// if (!tokenAddress) {
// const crossChainAddress = await getCrossChainAddress({
// token: $selectedToken,
// srcChainId: $network.id,
// destChainId: $destinationChain.id,
// });
// if (!crossChainAddress) throw new Error('cross chain address not found');
// tokenAddress = crossChainAddress;
// }
// if (!tokenAddress) {
// throw new Error('token address not found');
// }
// const tokenIds =
// nftIdArray.length > 0
// ? nftIdArray.map((num) => BigInt(num))
// : $selectedNFTs && $selectedNFTs.map((nft) => BigInt(nft.tokenId));
// let txHash: Hash;
// const spenderAddress =
// type === TokenType.ERC1155
// ? routingContractsMap[$network.id][$destinationChain.id].erc1155VaultAddress
// : routingContractsMap[$network.id][$destinationChain.id].erc721VaultAddress;
// const args: NFTApproveArgs = { tokenIds: tokenIds!, tokenAddress, spenderAddress, wallet: walletClient };
// txHash = await (bridges[type] as ERC721Bridge | ERC1155Bridge).approve(args);
// const { explorer } = chainConfig[$network.id].urls;
// if (txHash)
// infoToast({
// title: $t('bridge.actions.approve.tx.title'),
// message: $t('bridge.actions.approve.tx.message', {
// values: {
// token: $selectedToken.symbol,
// url: `${explorer}/tx/${txHash}`,
// },
// }),
// });
// await pendingTransactions.add(txHash, $network.id);
// actionsComponent.checkTokensApproved();
// successToast({
// title: $t('bridge.actions.approve.success.title'),
// message: $t('bridge.actions.approve.success.message', {
// values: {
// token: $selectedToken.symbol,
// },
// }),
// });
// } catch (err) {
// console.error(err);
// handleBridgeError(err as Error);
// }
// }
// async function bridge() {
// if (!$bridgeService || !$selectedToken || !$network || !$destinationChain || !$account?.address) return;
// try {
// const walletClient = await getConnectedWallet($network.id);
// const commonArgs = {
// to: $recipientAddress || $account.address,
// wallet: walletClient,
// srcChainId: $network.id,
// destChainId: $destinationChain.id,
// fee: $processingFee,
// };
// const tokenIds =
// nftIdArray.length > 0
// ? nftIdArray.map((num) => BigInt(num))
// : $selectedNFTs && $selectedNFTs.map((nft) => BigInt(nft.tokenId));
// const bridgeArgs = await getBridgeArgs($selectedToken, $enteredAmount, commonArgs, nftIdArray);
// const args = { ...bridgeArgs, tokenIds };
// bridgeTxHash = await $bridgeService.bridge(args);
// activeStep = NFTSteps.CONFIRM;
// //TODO: everything below should be handled differently for the stepper design. Still tbd
// } catch (err) {
// console.error(err);
// handleBridgeError(err as Error);
// }
// }
$: if ($selectedToken && amountComponent) {
amountComponent.validateAmount();
}
Expand Down Expand Up @@ -305,9 +208,7 @@
<Step stepIndex={NFTSteps.CONFIRM} currentStepIndex={activeStep} isActive={activeStep === NFTSteps.CONFIRM}
>{$t('bridge.nft.step.confirm.title')}</Step>
</Stepper>
<button on:click={() => (activeStep = NFTSteps.CONFIRM)} class="flex justify-center py-3 link">
{$t('bridge.nft.step.confirm.button.back')}
</button>

<Card class="mt-[32px] w-full md:w-[524px]" title={nftStepTitle} text={nftStepDescription}>
<div class="space-y-[30px]">
<!-- IMPORT STEP -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
status: MessageStatus.NEW,
timestamp: Date.now(),
} as BridgeTransaction;
bridging = false;
bridgeTxService.addTxByAddress(userAccount, bridgeTx);
});
Expand Down Expand Up @@ -144,7 +145,7 @@
async function bridge() {
if (!$bridgeService || !$selectedToken || !$network || !$destNetwork?.id || !$account?.address) return;
bridging = true;
try {
const walletClient = await getConnectedWallet($network.id);
const commonArgs = {
Expand All @@ -168,6 +169,7 @@
handleBridgeTxHash(bridgeTxHash);
}
} catch (err) {
bridging = false;
console.error(err);
handleBridgeError(err as Error);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ NFT List or Card View

<div class="h-sep" />
<!--
Recipient & Processing Fee
-->
Recipient & Processing Fee
-->

<div class="f-col">
<div class="f-between-center mb-[10px]">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export let nft: NFT;
export let selectNFT: (nft: NFT) => void;
export let viewOnly = false;
export let viewOnly: boolean;
const placeholderUrl = 'https://placehold.co/400x400.png';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
<div class="f-col w-full space-y-[30px]">
<h3 class="title-body-bold">{$t('bridge.nft.step.import.nft_card.title')}</h3>

<img alt="placeholder nft" src={nft.metadata?.image || placeholderUrl} class="rounded-[20px] self-center" />
<img
alt="placeholder nft"
src={nft.metadata?.image || placeholderUrl}
class="rounded-[20px] self-center bg-white" />
<div id="metadata">
<div class="f-between-center">
<div class="text-secondary-content">{$t('common.collection')}</div>
Expand Down Expand Up @@ -76,15 +79,15 @@
<Button
type="primary"
hasBorder={true}
class="px-[28px] py-[14px] rounded-full flex-1 w-full"
class="px-[28px] py-[14px] rounded-full flex-1 w-full text-white"
on:click={closeModal}>
{$t('common.ok')}
</Button>
{:else}
<Button
type="primary"
hasBorder={true}
class="px-[28px] py-[14px] rounded-full flex-1 w-full"
class="px-[28px] py-[14px] rounded-full flex-1 w-full text-white"
on:click={() => selectNFT()}>
{$t('bridge.nft.step.import.nft_card.select')}
</Button>
Expand Down

0 comments on commit b82bf8f

Please sign in to comment.