Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions examples/authz/components/authz/GrantCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
PrettyPermission,
} from '@/utils';
import { useAuthzContext } from '@/context';
import { useAuthzTx, useGrants, useSigningClient } from '@/hooks';
import { useAuthzTx, useGrants } from '@/hooks';
import { getCoin, permissionNameToRouteMap } from '@/configs';

import styles from '@/styles/custom.module.css';
Expand Down Expand Up @@ -86,7 +86,7 @@ export const GrantCard = ({
amount: [
{
denom: token.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
4 changes: 2 additions & 2 deletions examples/authz/components/authz/GrantDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { useState } from 'react';
import { BasicModal, Box, Button } from '@interchain-ui/react';

import { useAuthzTx, useGrants, useSigningClient } from '@/hooks';
import { useAuthzTx, useGrants } from '@/hooks';
import { getTokenByChainName, PrettyGrant, PrettyPermission } from '@/utils';
import { PermissionDetailCard } from './PermissionDetailCard';
import { useRevoke } from '@interchainjs/react/cosmos/authz/v1beta1/tx.rpc.react';
Expand Down Expand Up @@ -52,7 +52,7 @@ export const GrantDetailsModal = ({
amount: [
{
denom: token.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
7 changes: 4 additions & 3 deletions examples/authz/components/authz/GrantModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
permissions,
} from '@/configs';
import { AuthorizationType } from '@interchainjs/react/cosmos/staking/v1beta1/authz';
import { GrantMsg, useAuthzTx, useGrants, useSigningClient } from '@/hooks';
import { GrantMsg, useAuthzTx, useGrants } from '@/hooks';
import { getTokenByChainName, shiftDigits } from '@/utils';
import { CustomizationField } from './CustomizationField';
import { AddressInput } from '@/components';
Expand Down Expand Up @@ -140,7 +140,7 @@ export const GrantModal = ({ isOpen, onClose, chainName }: GrantModalProps) => {
amount: [
{
denom: token.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand All @@ -154,7 +154,8 @@ export const GrantModal = ({ isOpen, onClose, chainName }: GrantModalProps) => {
memo: 'granting permission',
},
{
onSuccess: () => {
onSuccess: (data) => {
console.log('data', data);
refetch();
onModalClose();
},
Expand Down
4 changes: 2 additions & 2 deletions examples/authz/components/claim-rewards/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@interchain-ui/react';

import { getCoin } from '@/configs';
import { Prices, useAuthzTx, useSigningClient } from '@/hooks';
import { Prices, useAuthzTx } from '@/hooks';
import {
sum,
calcDollarValue,
Expand Down Expand Up @@ -68,7 +68,7 @@ const Overview = ({
amount: [
{
denom: token.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
4 changes: 2 additions & 2 deletions examples/authz/components/send/send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useChain } from '@interchain-kit/react';
import { Box, Button, Spinner, Text, TokenInput } from '@interchain-ui/react';
import BigNumber from 'bignumber.js';

import { useAuthzTx, useSendData, useSigningClient, useToast } from '@/hooks';
import { useAuthzTx, useSendData, useToast } from '@/hooks';
import {
getCoin,
getExponent,
Expand Down Expand Up @@ -82,7 +82,7 @@ export const SendSection = ({ chainName }: SendSectionProps) => {
amount: [
{
denom: coin.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
10 changes: 2 additions & 8 deletions examples/authz/components/staking/DelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,7 @@ import {
} from '@/utils';
import { getCoin, getExponent } from '@/configs';
import { useAuthzContext } from '@/context';
import {
Prices,
useAuthzTx,
UseDisclosureReturn,
useSigningClient,
useToast,
} from '@/hooks';
import { Prices, useAuthzTx, UseDisclosureReturn, useToast } from '@/hooks';
import { MsgDelegate } from '@interchainjs/react/cosmos/staking/v1beta1/tx';
import { StakeAuthorization } from '@interchainjs/react/cosmos/staking/v1beta1/authz';
import { useExec } from '@interchainjs/react/cosmos/authz/v1beta1/tx.rpc.react';
Expand Down Expand Up @@ -136,7 +130,7 @@ export const DelegateModal = ({
amount: [
{
denom: coin.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
4 changes: 2 additions & 2 deletions examples/authz/components/staking/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useChain } from '@interchain-kit/react';
import { useWithdrawDelegatorReward } from '@interchainjs/react/cosmos/distribution/v1beta1/tx.rpc.react';

import { getCoin } from '@/configs';
import { Prices, useSigningClient, useTx } from '@/hooks';
import { Prices, useTx } from '@/hooks';
import {
sum,
calcDollarValue,
Expand Down Expand Up @@ -63,7 +63,7 @@ const Overview = ({
amount: [
{
denom: coin.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
2 changes: 1 addition & 1 deletion examples/authz/components/voting/Proposal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function Proposal({
amount: [
{
denom: coin.base,
amount: '2500',
amount: '75000',
},
],
gas: '1000000',
Expand Down
10 changes: 5 additions & 5 deletions examples/authz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
"@cosmjs/stargate": "0.32.4",
"@cosmjs/tendermint-rpc": "0.32.4",
"@cosmology/lcd": "^0.12.0",
"@interchain-kit/core": "0.2.222",
"@interchain-kit/keplr-extension": "0.2.222",
"@interchain-kit/leap-extension": "0.2.222",
"@interchain-kit/react": "0.2.222",
"@interchain-kit/core": "0.3.17",
"@interchain-kit/keplr-extension": "0.3.17",
"@interchain-kit/leap-extension": "0.3.17",
"@interchain-kit/react": "0.3.17",
"@interchain-ui/react": "1.23.22",
"@interchain-ui/react-no-ssr": "^0.1.6",
"@interchainjs/cosmos": "1.11.2",
Expand All @@ -56,7 +56,7 @@
"chain-registry": "^1.69.32",
"dayjs": "1.11.10",
"fast-fuzzy": "^1.12.0",
"interchain-kit": "0.2.222",
"interchain-kit": "0.3.17",
"next": "^13",
"react": "18.2.0",
"react-calendar": "4.8.0",
Expand Down
21 changes: 9 additions & 12 deletions examples/authz/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,27 @@ import { useAuthzContext } from '@/context';
import { Layout, Wallet, AuthzSection } from '@/components';
import { useChain } from '@interchain-kit/react';
import { defaultChainName } from '@/configs';
import { useSigningClient } from '@/hooks';
export default function Home() {
const [selectedChain, setSelectedChain] = useState<string>();
const { setChainName } = useAuthzContext();
const queryClient = useQueryClient();

const { rpcEndpoint, status } = useChain(selectedChain ?? defaultChainName);

const { data: client, isSuccess: isSigningClientSuccess } = useSigningClient(
selectedChain ?? defaultChainName,
{
walletStatus: status,
}
);
const {
rpcEndpoint,
status,
signingClient: client,
isSigningClientLoading,
} = useChain(selectedChain ?? defaultChainName);

useEffect(() => {
if (isSigningClientSuccess) {
if (!isSigningClientLoading) {
queryClient.setQueryData([DEFAULT_SIGNING_CLIENT_QUERY_KEY], client);
}

if (isSigningClientSuccess && rpcEndpoint) {
if (rpcEndpoint) {
queryClient.setQueryData([DEFAULT_RPC_CLIENT_QUERY_KEY], rpcEndpoint);
}
}, [isSigningClientSuccess, rpcEndpoint, client, queryClient]);
}, [isSigningClientLoading, rpcEndpoint, client, queryClient]);

return (
<Layout>
Expand Down
Loading
Loading