Skip to content

Commit

Permalink
Fix send action (#41)
Browse files Browse the repository at this point in the history
* Fix send button disabled check

* Notify failed to construct bridge

* Console endpoint disconnected

* Update endpoint of Hydration
  • Loading branch information
JayJay1024 authored Aug 8, 2024
1 parent 1f46199 commit 340e2e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/components/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ export default function Transfer() {
} else if (sender_) {
await transfer(bridgeInstance, sender_, recipient.address, transferAmount.amount, callback);
}
} else {
notification.warn({ title: "Oops!", description: "Failed to construct bridge." });
}
}, [
activeSenderAccount,
Expand Down Expand Up @@ -275,7 +277,6 @@ export default function Transfer() {
!recipient?.valid ||
!transferAmount.input ||
!transferAmount.valid ||
needSwitchNetwork ||
!!feeAlert ||
!!existentialAlertOnSourceChain ||
!!existentialAlertOnTargetChain;
Expand Down Expand Up @@ -362,7 +363,13 @@ export default function Transfer() {
</TransferSection>

{/* Send */}
<Button kind="primary" className="mt-4 py-middle" onClick={handleSend} disabled={disabledSend} busy={busy}>
<Button
kind="primary"
className="mt-4 py-middle"
onClick={handleSend}
disabled={!needSwitchNetwork && disabledSend}
busy={busy}
>
{needSwitchNetwork ? "Switch network" : "Send"}
</Button>

Expand Down
3 changes: 2 additions & 1 deletion src/config/chains/hydradx-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const hydradxChain: ChainConfig = {
/**
* Substrate
*/
endpoint: "wss://rpc.hydradx.cloud",
// endpoint: "wss://rpc.hydradx.cloud",
endpoint: "wss://hydradx-rpc.dwellir.com",
parachainId: ParachainID.HYDRADX,
};
1 change: 1 addition & 0 deletions src/hooks/use-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function useApi(chain: ChainConfig) {
setApi(_api);
};
const failedListener = () => {
console.error(new Error(`API has been disconnected from the endpoint(${chain.endpoint})`));
setApi(undefined);
};

Expand Down

0 comments on commit 340e2e0

Please sign in to comment.