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

v0.1.18 #160

Merged
merged 5 commits into from
May 30, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/docs/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ sidebar_position: 8

# Changelog

## Version 0.1.18

- Added Wallet connect mobile clot integration
- Fix signing client hooks client side error

## Version 0.1.16

- Bump capsule deps

## Version 0.1.15

- Fetch all keys from wallet instead of transforming bech32

## Version 0.1.14

- Support iframe autoconnect

## version 0.1.13

- Support iframe connection

## Version 0.1.9

- graz cli fix null `gasPriceStep`
Expand Down
6 changes: 6 additions & 0 deletions docs/docs/migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ sidebar_position: 3

# Migration Guide

## 0.1.18 Breaking Changes

### Signing client hooks

Now siging client hooks not returning `undefined` when the signing client is not available, it will return `null` instead.

## 0.1.0 Breaking Changes

### `<GrazProvider/>`
Expand Down
1 change: 1 addition & 0 deletions docs/docs/types/walletType.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum WalletType {
WC_KEPLR_MOBILE = "wc_keplr_mobile",
WC_LEAP_MOBILE = "wc_leap_mobile",
WC_COSMOSTATION_MOBILE = "wc_cosmostation_mobile",
WC_CLOT_MOBILE = "wc_clot_mobile",
METAMASK_SNAP_LEAP = "metamask_snap_leap",
METAMASK_SNAP_COSMOS = "metamask_snap_cosmos",
STATION = "station",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/wallet-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ export const AvailableWallets = () => {
`WalletType.WC_COSMOSTATION_MOBILE`
- `WalletType.WC_KEPLR_MOBILE` |
`WalletType.WC_LEAP_MOBILE`|
`WalletType.WC_COSMOSTATION_MOBILE` only returns true on mobile, `WalletType.WALLETCONNECT` will shows on anywhere
`WalletType.WC_COSMOSTATION_MOBILE` | `WalletType.WC_CLOT_MOBILE` only returns true on mobile, `WalletType.WALLETCONNECT` will shows on anywhere
2 changes: 1 addition & 1 deletion packages/graz/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graz",
"description": "React hooks for Cosmos",
"version": "0.1.17",
"version": "0.1.18",
"author": "Griko Nibras <[email protected]>",
"repository": "https://github.com/graz-sh/graz.git",
"homepage": "https://github.com/graz-sh/graz",
Expand Down
2 changes: 1 addition & 1 deletion packages/graz/src/actions/wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { getMetamaskSnapLeap } from "./leap-metamask-snap/leap";
import { getStation } from "./station";
import { getVectis } from "./vectis";
import { getWalletConnect } from "./wallet-connect";
import { getWCClot } from "./wallet-connect/clot";
import { getWCCosmostation } from "./wallet-connect/cosmostation";
import { getWCKeplr } from "./wallet-connect/keplr";
import { getWCLeap } from "./wallet-connect/leap";
import { getWCClot } from "./wallet-connect/clot";
import { getXDefi } from "./xdefi";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ export const getMetamaskSnap = (params?: GetMetamaskSnap): Wallet => {
};
};

// eslint-disable-next-line @typescript-eslint/require-await
const getOfflineSignerAuto = async (chainId: string) => {
return getOfflineSignerOnlyAmino(chainId);
};
Expand Down
1 change: 1 addition & 0 deletions packages/graz/src/actions/wallet/wallet-connect/clot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const getWCClot = (): Wallet => {
encoding: "base64",
appUrl: {
mobile: {
android: "clot://",
ios: "clot://",
},
},
Expand Down
6 changes: 5 additions & 1 deletion packages/graz/src/actions/wallet/wallet-connect/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ export interface WalletConnectSignDirectResponse {

export interface GetWalletConnectParams {
encoding: BufferEncoding;
walletType: WalletType.WC_KEPLR_MOBILE | WalletType.WC_LEAP_MOBILE | WalletType.WC_COSMOSTATION_MOBILE | WalletType.WC_CLOT_MOBILE;
walletType:
| WalletType.WC_KEPLR_MOBILE
| WalletType.WC_LEAP_MOBILE
| WalletType.WC_COSMOSTATION_MOBILE
| WalletType.WC_CLOT_MOBILE;
appUrl: {
mobile: {
ios: string;
Expand Down
32 changes: 16 additions & 16 deletions packages/graz/src/hooks/signingClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ interface BaseSigningClientArgs extends QueryConfig {
}
export function useStargateSigningClient(
args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningStargateClientOptions>,
): UseQueryResult<SigningStargateClient | undefined>;
): UseQueryResult<SigningStargateClient | null>;
export function useStargateSigningClient(
args?: BaseSigningClientArgs & SiginingClientMultichainArgs<SigningStargateClientOptions>,
): UseQueryResult<Record<string, SigningStargateClient | undefined>>;
): UseQueryResult<Record<string, SigningStargateClient | null>>;
/**
* graz query hook to retrieve a SigningStargateClient.
*
Expand All @@ -56,7 +56,7 @@ export function useStargateSigningClient(
// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions
export function useStargateSigningClient(
args?: BaseSigningClientArgs & Args<SigningStargateClientOptions>,
): UseQueryResult<SigningStargateClient | undefined | Record<string, SigningStargateClient | undefined>> {
): UseQueryResult<SigningStargateClient | null | Record<string, SigningStargateClient | null>> {
const chains = useChainsFromArgs({ chainId: args?.chainId, multiChain: args?.multiChain });
const wallet = useGrazInternalStore((x) => x.walletType);
const activeChainIds = useGrazSessionStore((x) => x.activeChainIds);
Expand All @@ -70,7 +70,7 @@ export function useStargateSigningClient(
if (_chains.length < 1) throw new Error("No chains found");
const res = await createMultiChainAsyncFunction(Boolean(args?.multiChain), _chains, async (_chain) => {
// Chain is not connected return undefined
if (!activeChainIds?.includes(_chain.chainId)) return undefined;
if (!activeChainIds?.includes(_chain.chainId)) return null;
const isWalletAvailable = checkWallet(_wallet);
if (!isWalletAvailable) {
throw new Error(`${_wallet} is not available`);
Expand Down Expand Up @@ -112,10 +112,10 @@ export function useStargateSigningClient(

export function useCosmWasmSigningClient(
args?: BaseSigningClientArgs & SiginingClientSinglechainArgs<SigningCosmWasmClientOptions>,
): UseQueryResult<SigningCosmWasmClient | undefined>;
): UseQueryResult<SigningCosmWasmClient | null>;
export function useCosmWasmSigningClient(
args?: BaseSigningClientArgs & SiginingClientMultichainArgs<SigningCosmWasmClientOptions>,
): UseQueryResult<Record<string, SigningCosmWasmClient | undefined>>;
): UseQueryResult<Record<string, SigningCosmWasmClient | null>>;
/**
* graz query hook to retrieve a SigningCosmWasmClient.
*
Expand All @@ -134,7 +134,7 @@ export function useCosmWasmSigningClient(
// eslint-disable-next-line prefer-arrow-functions/prefer-arrow-functions
export function useCosmWasmSigningClient(
args?: BaseSigningClientArgs & Args<SigningStargateClientOptions>,
): UseQueryResult<SigningCosmWasmClient | undefined | Record<string, SigningCosmWasmClient | undefined>> {
): UseQueryResult<SigningCosmWasmClient | null | Record<string, SigningCosmWasmClient | null>> {
const chains = useChainsFromArgs({ chainId: args?.chainId, multiChain: args?.multiChain });
const wallet = useGrazInternalStore((x) => x.walletType);
const activeChainIds = useGrazSessionStore((x) => x.activeChainIds);
Expand All @@ -149,7 +149,7 @@ export function useCosmWasmSigningClient(
if (_chains.length < 1) throw new Error("No chains found");
const res = await createMultiChainAsyncFunction(Boolean(args?.multiChain), _chains, async (_chain) => {
// Chain is not connected return undefined
if (!activeChainIds?.includes(_chain.chainId)) return undefined;
if (!activeChainIds?.includes(_chain.chainId)) return null;
const isWalletAvailable = checkWallet(_wallet);
if (!isWalletAvailable) {
throw new Error(`${_wallet} is not available`);
Expand Down Expand Up @@ -193,13 +193,13 @@ export function useStargateTmSigningClient(
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
SiginingClientSinglechainArgs<SigningStargateClientOptions>,
): UseQueryResult<SigningStargateClient | undefined>;
): UseQueryResult<SigningStargateClient | null>;
export function useStargateTmSigningClient(
args: {
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
SiginingClientMultichainArgs<SigningStargateClientOptions>,
): UseQueryResult<Record<string, SigningStargateClient | undefined>>;
): UseQueryResult<Record<string, SigningStargateClient | null>>;
/**
* graz query hook to retrieve a SigningStargateClient with tendermint client.
*
Expand All @@ -223,7 +223,7 @@ export function useStargateTmSigningClient(
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
Args<SigningStargateClientOptions>,
): UseQueryResult<SigningStargateClient | undefined | Record<string, SigningStargateClient | undefined>> {
): UseQueryResult<SigningStargateClient | null | Record<string, SigningStargateClient | null>> {
const chains = useChainsFromArgs({ chainId: args.chainId, multiChain: args.multiChain });
const wallet = useGrazInternalStore((x) => x.walletType);
const activeChainIds = useGrazSessionStore((x) => x.activeChainIds);
Expand All @@ -244,7 +244,7 @@ export function useStargateTmSigningClient(
if (_chains.length < 1) throw new Error("No chains found");
const res = await createMultiChainAsyncFunction(Boolean(args.multiChain), _chains, async (_chain) => {
// Chain is not connected return undefined
if (!activeChainIds?.includes(_chain.chainId)) return undefined;
if (!activeChainIds?.includes(_chain.chainId)) return null;
const isWalletAvailable = checkWallet(_wallet);
if (!isWalletAvailable) {
throw new Error(`${_wallet} is not available`);
Expand Down Expand Up @@ -289,13 +289,13 @@ export function useCosmWasmTmSigningClient(
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
SiginingClientSinglechainArgs<SigningCosmWasmClientOptions>,
): UseQueryResult<SigningCosmWasmClient | undefined>;
): UseQueryResult<SigningCosmWasmClient | null>;
export function useCosmWasmTmSigningClient(
args: {
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
SiginingClientMultichainArgs<SigningCosmWasmClientOptions>,
): UseQueryResult<Record<string, SigningCosmWasmClient | undefined>>;
): UseQueryResult<Record<string, SigningCosmWasmClient | null>>;
/**
* graz query hook to retrieve a SigningCosmWasmClient with tendermint client.
*
Expand All @@ -319,7 +319,7 @@ export function useCosmWasmTmSigningClient(
type: "tm34" | "tm37";
} & BaseSigningClientArgs &
Args<SigningCosmWasmClientOptions>,
): UseQueryResult<SigningCosmWasmClient | undefined | Record<string, SigningCosmWasmClient | undefined>> {
): UseQueryResult<SigningCosmWasmClient | null | Record<string, SigningCosmWasmClient | null>> {
const chains = useChainsFromArgs({ chainId: args.chainId, multiChain: args.multiChain });
const wallet = useGrazInternalStore((x) => x.walletType);
const activeChainIds = useGrazSessionStore((x) => x.activeChainIds);
Expand Down Expand Up @@ -348,7 +348,7 @@ export function useCosmWasmTmSigningClient(
if (_chains.length < 1) throw new Error("No chains found");
const res = await createMultiChainAsyncFunction(Boolean(args.multiChain), _chains, async (_chain) => {
// Chain is not connected return undefined
if (!activeChainIds?.includes(_chain.chainId)) return undefined;
if (!activeChainIds?.includes(_chain.chainId)) return null;
const isWalletAvailable = checkWallet(_wallet);
if (!isWalletAvailable) {
throw new Error(`${_wallet} is not available`);
Expand Down
Loading