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

0.1.x #121

Merged
merged 88 commits into from
Nov 17, 2023
Merged

0.1.x #121

merged 88 commits into from
Nov 17, 2023

Conversation

codingki
Copy link
Member

@codingki codingki commented Nov 10, 2023

v0.1.0-beta.2: https://npmjs.com/package/graz/v/0.1.0-beta.2
docs: https://0-1-x-iteration-1.graz.pages.dev/docs/
Example :

0.1.0 Breaking Changes

<GrazProvider/>

grazOptions is required to provide a ChainInfo[] to the chains param. Read more

const cosmoshub = {
  chainId: "cosmoshub-4",
  chainName: "Cosmos Hub",
  //...
}
- <GrazProvider>
+ <GrazProvider grazOptions={{
+   chains: [cosmoshub]
+ }}>
  // children
  </GrazProvider>

defaultChain removed from grazOptions

Removed GrazChain type

We are using ChainInfo from @keplr-wallet/types instead of GrazChain

Our initial intention having GrazChain is for adding and only using required value for interacting with signingClients. We adding rpcHeaders and gas in there for interacting with clients and signingClient for simplicity, but this can make a different problem when you already have a ChainInfo you will need to mutate those constants. Read RFC.

For adding rpcHeaders and gas, we can add it in GrazProvider on grazOptions.chainsConfig to provide those values.

interface ChainConfig {
  rpcHeaders?: Dictionary<string>;
  gas?: { price: string; denom: string };
}

type ChainsConfig = Record<string, ChainConfig>;
// previous GrazChain
const cosmoshub = {
  chainId: "cosmoshub-4",
  chainName: "Cosmos Hub",
- rpcHeaders: {
-   "custom-header": "custom-value"
-  },
- gas: {
-   price: "0.025",
-   denom: "uatom"
- }
}

  <GrazProvider grazOptions={
    chains: [cosmoshub],
+   chainsConfig:{
+     "cosmoshub-4": {
+       rpcHeaders: {
+         "custom-header": "custom-value"
+       },
+       gas: {
+         price: "0.025",
+         denom: "uatom"
+       }
+      }
+   }
  }>
  // children
  </GrazProvider>

When you connect you don't need GrazChain anymore, you only need the chainId

  const { connect } = useConnect();
  connect({
-   chain: cosmoshub,
+   chainId: "cosmoshub-4", // chainId receive string | string[]
    // ...
  })

useConnect

const { connect } = useConnect();
  connect({
-   chain: cosmoshub,
+   chainId: "cosmoshub-4", // chainId receive string | string[]
    // ...
  })

ConnectResult

return type of connect in useConnect and onConnect params

interface ConnectResult {
- account: Key;
+ account: Record<string, Key>
  walletType: WalletType;
- chain: GrazChain;
+ chains: ChainInfo[];
}

useBalance

- const balance = useBalance(denom, bech32Address);
+ const balance = useBalance({ denom, bech32Address });

useBalances

- const balances = useBalances(denom, bech32Address);
+ const balances = useBalances({ denom, bech32Address });

useBalanceStaked

- const balanceStaked = useBalances(bech32Address);
+ const balanceStaked = useBalanceStaked({ bech32Address });

useQuerySmart

- const querySmart = useQuerySmart(address, message);
+ const querySmart = useQuerySmart({ address, message });

useQueryRaw

- const queryRaw = useQueryRaw(address, key);
+ const queryRaw = useQueryRaw({ address, key });

@codingki codingki self-assigned this Nov 10, 2023
@codingki codingki requested a review from grikomsn as a code owner November 10, 2023 05:41
CONTRIBUTING.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
docs/docs/contributing.md Outdated Show resolved Hide resolved
docs/docs/getting-started.mdx Outdated Show resolved Hide resolved
codingki and others added 5 commits November 15, 2023 14:55
Co-authored-by: Griko Nibras <[email protected]>
Signed-off-by: Nur Fikri <[email protected]>
Co-authored-by: Griko Nibras <[email protected]>
Signed-off-by: Nur Fikri <[email protected]>
Co-authored-by: Griko Nibras <[email protected]>
Signed-off-by: Nur Fikri <[email protected]>
Co-authored-by: Griko Nibras <[email protected]>
Signed-off-by: Nur Fikri <[email protected]>
@codingki codingki merged commit 4c33ac8 into dev Nov 17, 2023
2 checks passed
@apollo-sturdy
Copy link
Contributor

With this change, where do we find gas prices? We must hardcode them in our app? Seems like they exist in chain-registry, so would be great if they can be fetched when setting up graz.

@codingki
Copy link
Member Author

@apollo-sturdy previously we need to hardcode too in graz chain. now you need to do this https://graz.sh/docs/migration-guide#removed-grazchain-type

@apollo-sturdy
Copy link
Contributor

@apollo-sturdy previously we need to hardcode too in graz chain. now you need to do this https://graz.sh/docs/migration-guide#removed-grazchain-type

Is it worth updating the --generate command to fetch them from chain-registry?

@grikomsn
Copy link
Member

@apollo-sturdy graz --generate is getting the data from the chain registry, which you can check on the CLI script here: https://github.com/graz-sh/graz/blob/dev/packages/graz/src/cli.mjs

We are still researching on another solution to generate chain info metadatas, which you can also check here: https://github.com/graz-sh/wadesta

@grikomsn grikomsn deleted the 0.1.x-iteration-1 branch April 21, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants