From c0cc019b978db9c2df227951c7a63667fedb8af1 Mon Sep 17 00:00:00 2001 From: Yana Date: Tue, 14 Nov 2023 14:57:19 +0000 Subject: [PATCH] WIP --- .../Delegations/components/DelegateModal.tsx | 20 ++++++++++++---- explorer/src/components/TableToolbar.tsx | 24 ++++++++++++++++--- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/explorer/src/components/Delegations/components/DelegateModal.tsx b/explorer/src/components/Delegations/components/DelegateModal.tsx index d01bdd6b990..0ecb5019813 100644 --- a/explorer/src/components/Delegations/components/DelegateModal.tsx +++ b/explorer/src/components/Delegations/components/DelegateModal.tsx @@ -98,12 +98,18 @@ export const DelegateModal: FCWithChildren<{ useEffect(() => { const getClient = async () => { await getSigningCosmWasmClient() - .then((res) => setCosmWasmSignerClient(res)) + .then((res) => { + setCosmWasmSignerClient(res); + console.log('res :>> ', res); + }) .catch((e) => console.log('e :>> ', e)); }; - getClient(); - }, []); + isWalletConnected && getClient(); + }, [isWalletConnected]); + + console.log('cosmWasmSignerClient :>> ', cosmWasmSignerClient); + console.log('isWalletConnected :>> ', isWalletConnected); useEffect(() => { const getBalance = async (walletAddress: string) => { @@ -182,9 +188,11 @@ export const DelegateModal: FCWithChildren<{ memo?: string, _funds?: DecCoin[], ): Promise => { + console.log('cosmWasmSignerClient :>> ', cosmWasmSignerClient); return await cosmWasmSignerClient.execute( address, MIXNET_CONTRACT_ADDRESS, + //sandboxContractAddress, { delegate_to_mixnode: { mix_id: mixId, @@ -198,9 +206,11 @@ export const DelegateModal: FCWithChildren<{ const handleConfirm = async () => { const memo: string = 'test delegation'; + const fee = { gas: '1000000', amount: [{ amount: '100000', denom: 'unym' }] }; if (mixId && amount) { - await delegateToMixnode({ mixId }, 'auto', memo, [amount]); + console.log('trying to delegate :>> '); + await delegateToMixnode({ mixId }, fee, memo, [amount]); } }; @@ -316,7 +326,7 @@ export const DelegateModal: FCWithChildren<{ required fullWidth label="Amount" - initialValue={amount} + // initialValue={amount} autoFocus={Boolean(initialIdentityKey)} onChanged={handleAmountChanged} denom={denom} diff --git a/explorer/src/components/TableToolbar.tsx b/explorer/src/components/TableToolbar.tsx index eefe864db40..dcbf4c6ea2f 100644 --- a/explorer/src/components/TableToolbar.tsx +++ b/explorer/src/components/TableToolbar.tsx @@ -32,9 +32,9 @@ export const TableToolbar: FCWithChildren = ({ const [showNewDelegationModal, setShowNewDelegationModal] = useState(false); const assetsFixedUp = useMemo(() => { - const nyx = assets.find((a) => a.chain_name === 'nyx'); + const nyx = assets.find((a) => a.chain_name === 'sandbox'); if (nyx) { - const nyxCoin = nyx.assets.find((a) => a.name === 'nyx'); + const nyxCoin = nyx.assets.find((a) => a.name === 'sandbox'); if (nyxCoin) { nyxCoin.coingecko_id = 'nyx'; } @@ -59,6 +59,23 @@ export const TableToolbar: FCWithChildren = ({ return chains; }, [chains]); + // SANDBOX + // const chainsFixedUp = useMemo(() => { + // const nyx = chains.find((c) => c.chain_id === 'sandbox'); + // if (nyx) { + // if (!nyx.staking) { + // nyx.staking = { + // staking_tokens: [{ denom: 'unyx' }], + // lock_duration: { + // blocks: 10000, + // }, + // }; + // if (nyx.apis) nyx.apis.rpc = [{ address: 'https://sandbox-validator1.nymtech.net', provider: 'nym' }]; + // } + // } + // return chains; + // }, [chains]); + const isMobile = useIsMobile(); return ( = ({ }} >