From 2da9e18e2feb974098ba56cb84631e1efbf363df Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 16 May 2025 16:11:32 +0800 Subject: [PATCH 01/19] change readme to mdx --- .gitignore | 4 +- README.md | 165 ----------------- README.mdx | 176 +++++++++++++++++++ docs/{ => advanced}/auth-wallet-signer.md | 0 docs/{ => advanced}/auth.md | 0 docs/{ => advanced}/migration-from-cosmjs.md | 0 docs/{ => advanced}/signer.md | 0 docs/{ => advanced}/tutorial.md | 0 docs/{ => advanced}/wallet.md | 0 9 files changed, 179 insertions(+), 166 deletions(-) delete mode 100644 README.md create mode 100644 README.mdx rename docs/{ => advanced}/auth-wallet-signer.md (100%) rename docs/{ => advanced}/auth.md (100%) rename docs/{ => advanced}/migration-from-cosmjs.md (100%) rename docs/{ => advanced}/signer.md (100%) rename docs/{ => advanced}/tutorial.md (100%) rename docs/{ => advanced}/wallet.md (100%) diff --git a/.gitignore b/.gitignore index e90e9979f..94aaefbb5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ **/dist **/dist_spec **/yarn-error.log -lerna-debug.log \ No newline at end of file +lerna-debug.log + +docDraft.ts \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 8521598a4..000000000 --- a/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# InterchainJS - -

- -

- -

- - - - - -

- -A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. - -## Table of Contents - -- [Introduction](#interchainjs-universal-signing-for-web3) -- [Overview](#overview) -- [Tutorials and Docs](#tutorial-for-building-a-custom-signer) -- [Auth](#auth) -- [Supported Networks](#supported-networks) - - [Cosmos Network](#cosmos-network) - - [Injective Network](#injective-network) - - [Ethereum Network](#ethereum-network) -- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-⚛️) -- [Credits](#credits) -- [Disclaimer](#disclaimer) - -## InterchainJS: Universal Signing for Web3 - -[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. - -At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. - -## Overview - -InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: - -- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. -- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. -- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. -- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. - -This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. - -### Visualizing InterchainJS Components - -The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. - -```mermaid -graph LR - signers --> cosmos_signer["Cosmos Network"] - signers --> injective_signer["Injective Network"] - signers --> ethereum_signer["Ethereum Network"] - signers --> implement_signer["ANY Network"] - - cosmos_signer --> cosmos_amino["Amino Signer"] - cosmos_signer --> cosmos_direct["Direct Signer"] - - ethereum_signer --> ethereum_eip712["EIP712 Signer"] - - injective_signer --> injective_amino["Amino Signer"] - injective_signer --> injective_direct["Direct Signer"] - - implement_signer --> any_signer["Any Signer"] - - style signers fill:#f9f,stroke:#333,stroke-width:2px -``` - -```mermaid -graph LR - encoders[Encoders] --> auth["@interchainjs/auth"] - encoders --> utils["@interchainjs/utils"] - encoders --> cosmos_types["@interchainjs/cosmos-types"] - - auth --> secp256k1_auth["Secp256k1 Auth"] - auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] - - utils --> signer_utils["Signer Utilities"] - utils --> crypto_utils["Crypto Utilities"] - - style encoders fill:#f9f,stroke:#333,stroke-width:2px - style auth fill:#ccf,stroke:#333,stroke-width:2px - style utils fill:#ccf,stroke:#333,stroke-width:2px -``` - - ---- - - -## Tutorials & Documentation - -| Topic | Documentation | -|----------------------------------|--------------| -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | - ---- - -## Auth - -The authentication module is universally applied across different networks. - -| Package | Description | -|---------|-------------| -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | -| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | - ---- - -## Supported Networks - -### Cosmos Network - -| Feature | Package | -|---------|---------| -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | - ---- - -### Injective Network - -| Feature | Package | -|---------|---------| -| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | - ---- - -### Ethereum Network - -| Feature | Package | -|---------|---------| -| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | - ---- - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/README.mdx b/README.mdx new file mode 100644 index 000000000..bc26d8e62 --- /dev/null +++ b/README.mdx @@ -0,0 +1,176 @@ +# InterchainJS + +
+ +
+ +
+ + + + + + + + + +
+ +A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. + +## Table of Contents + +- [Introduction](#interchainjs-universal-signing-for-web3) +- [Overview](#overview) +- [Tutorials and Docs](#tutorial-for-building-a-custom-signer) +- [Auth](#auth) +- [Supported Networks](#supported-networks) + - [Cosmos Network](#cosmos-network) + - [Injective Network](#injective-network) + - [Ethereum Network](#ethereum-network) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-⚛️) +- [Credits](#credits) +- [Disclaimer](#disclaimer) + +## InterchainJS: Universal Signing for Web3 + +[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. + +At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. + +## Overview + +InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: + +- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. +- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. +- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. +- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. + +This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. + +### Visualizing InterchainJS Components + +The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. + +```mermaid +graph LR + signers --> cosmos_signer["Cosmos Network"] + signers --> injective_signer["Injective Network"] + signers --> ethereum_signer["Ethereum Network"] + signers --> implement_signer["ANY Network"] + + cosmos_signer --> cosmos_amino["Amino Signer"] + cosmos_signer --> cosmos_direct["Direct Signer"] + + ethereum_signer --> ethereum_eip712["EIP712 Signer"] + + injective_signer --> injective_amino["Amino Signer"] + injective_signer --> injective_direct["Direct Signer"] + + implement_signer --> any_signer["Any Signer"] + + style signers fill:#f9f,stroke:#333,stroke-width:2px +``` + +```mermaid +graph LR + encoders[Encoders] --> auth["@interchainjs/auth"] + encoders --> utils["@interchainjs/utils"] + encoders --> cosmos_types["@interchainjs/cosmos-types"] + + auth --> secp256k1_auth["Secp256k1 Auth"] + auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] + + utils --> signer_utils["Signer Utilities"] + utils --> crypto_utils["Crypto Utilities"] + + style encoders fill:#f9f,stroke:#333,stroke-width:2px + style auth fill:#ccf,stroke:#333,stroke-width:2px + style utils fill:#ccf,stroke:#333,stroke-width:2px +``` + +--- + +## Tutorials & Documentation + +| Topic | Documentation | +| ---------------------------- | ----------------------------- | +| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | +| **Advanced Documentation** | [View Docs](/docs/) | + +--- + +## Auth + +The authentication module is universally applied across different networks. + +| Package | Description | +| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | + +--- + +## Supported Networks + +### Cosmos Network + +| Feature | Package | +| ---------------------------- | ------------------------------------------------------------- | +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | + +--- + +### Injective Network + +| Feature | Package | +| ---------------- | -------------------------------------------------------- | +| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | + +--- + +### Ethereum Network + +| Feature | Package | +| ---------------- | ------------------------------------------------------ | +| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | + +--- + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/auth-wallet-signer.md b/docs/advanced/auth-wallet-signer.md similarity index 100% rename from docs/auth-wallet-signer.md rename to docs/advanced/auth-wallet-signer.md diff --git a/docs/auth.md b/docs/advanced/auth.md similarity index 100% rename from docs/auth.md rename to docs/advanced/auth.md diff --git a/docs/migration-from-cosmjs.md b/docs/advanced/migration-from-cosmjs.md similarity index 100% rename from docs/migration-from-cosmjs.md rename to docs/advanced/migration-from-cosmjs.md diff --git a/docs/signer.md b/docs/advanced/signer.md similarity index 100% rename from docs/signer.md rename to docs/advanced/signer.md diff --git a/docs/tutorial.md b/docs/advanced/tutorial.md similarity index 100% rename from docs/tutorial.md rename to docs/advanced/tutorial.md diff --git a/docs/wallet.md b/docs/advanced/wallet.md similarity index 100% rename from docs/wallet.md rename to docs/advanced/wallet.md From eead6eebe68106bf58de0743c41afa1ff663a294 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 16 May 2025 16:30:43 +0800 Subject: [PATCH 02/19] fix style --- README.mdx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/README.mdx b/README.mdx index bc26d8e62..7bce68dfb 100644 --- a/README.mdx +++ b/README.mdx @@ -1,23 +1,34 @@ # InterchainJS -
+
+
+
- + - + - +
-A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. +
+ +A single, universal signing interface for any network. Birthed from +the interchain ecosystem for builders. Create adapters for any Web3 network. ## Table of Contents From 7c75bde61d1cdae9f4501c87083b034242da6100 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 16 May 2025 18:25:10 +0800 Subject: [PATCH 03/19] fix style --- README.mdx | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/README.mdx b/README.mdx index 7bce68dfb..38d333990 100644 --- a/README.mdx +++ b/README.mdx @@ -1,34 +1,25 @@ # InterchainJS -
+
-
+
 
- + - + - +
-
+
 
A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. From e74fb2df312bf588940be04cedadd36fb5d462ad Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 16 May 2025 20:20:10 +0800 Subject: [PATCH 04/19] fix style --- README.mdx => README.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) rename README.mdx => README.md (98%) diff --git a/README.mdx b/README.md similarity index 98% rename from README.mdx rename to README.md index 38d333990..6b111a6e7 100644 --- a/README.mdx +++ b/README.md @@ -1,15 +1,13 @@ # InterchainJS -
+

-

+

-
 
- -
+

-

- -
 
+

-A single, universal signing interface for any network. Birthed from -the interchain ecosystem for builders. Create adapters for any Web3 network. +A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. ## Table of Contents From 2e2c12bf8da935b0a781a8b08a15d9436ea17886 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 16 May 2025 20:33:55 +0800 Subject: [PATCH 05/19] add classes to links --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6b111a6e7..06f864a7c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # InterchainJS -

+

- + - + - + Date: Fri, 16 May 2025 20:56:30 +0800 Subject: [PATCH 06/19] test styles --- README.md | 87 ++++++++++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 06f864a7c..9d3760c07 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,15 @@ # InterchainJS -

+

-

- - - - - - - - +

+ + + +

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. @@ -99,14 +86,16 @@ graph LR style utils fill:#ccf,stroke:#333,stroke-width:2px ``` + --- + ## Tutorials & Documentation -| Topic | Documentation | -| ---------------------------- | ----------------------------- | -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | +| Topic | Documentation | +|----------------------------------|--------------| +| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | +| **Advanced Documentation** | [View Docs](/docs/) | --- @@ -114,9 +103,9 @@ graph LR The authentication module is universally applied across different networks. -| Package | Description | -| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| Package | Description | +|---------|-------------| +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | | [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | --- @@ -125,26 +114,26 @@ The authentication module is universally applied across different networks. ### Cosmos Network -| Feature | Package | -| ---------------------------- | ------------------------------------------------------------- | -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | +| Feature | Package | +|---------|---------| +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | --- ### Injective Network -| Feature | Package | -| ---------------- | -------------------------------------------------------- | +| Feature | Package | +|---------|---------| | **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | --- ### Ethereum Network -| Feature | Package | -| ---------------- | ------------------------------------------------------ | +| Feature | Package | +|---------|---------| | **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | --- @@ -153,24 +142,24 @@ The authentication module is universally applied across different networks. A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) ## Disclaimer -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. From c5a056d7f6bf26eeac6daeb823696f281ba619a7 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sat, 17 May 2025 12:35:00 +0800 Subject: [PATCH 07/19] fix style --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d3760c07..5bccf1397 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # InterchainJS -

- +

+

-

+

From 50ec146f3472660ab81c7957f14030ee8cdcb509 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sat, 17 May 2025 12:55:44 +0800 Subject: [PATCH 08/19] add scripts to copy readmes --- docs/README.mdx | 165 +++++ docs/libs/cosmos-types/README.mdx | 43 ++ docs/libs/injective-react/README.mdx | 646 ++++++++++++++++++ docs/libs/injective-vue/README.mdx | 389 +++++++++++ docs/libs/injectivejs/README.mdx | 605 ++++++++++++++++ docs/libs/interchain-react/README.mdx | 150 ++++ docs/libs/interchain-vue/README.mdx | 147 ++++ docs/libs/interchainjs/README.mdx | 721 ++++++++++++++++++++ docs/libs/interchainjs/starship/README.mdx | 159 +++++ docs/networks/cosmos/README.mdx | 150 ++++ docs/networks/cosmos/starship/README.mdx | 159 +++++ docs/networks/ethereum/README.mdx | 171 +++++ docs/networks/ethereum/devnet/README.mdx | 23 + docs/networks/ethereum/starship/README.mdx | 162 +++++ docs/networks/injective/README.mdx | 66 ++ docs/networks/injective/starship/README.mdx | 157 +++++ docs/packages/amino/README.mdx | 15 + docs/packages/auth/README.mdx | 87 +++ docs/packages/crypto/README.mdx | 19 + docs/packages/encoding/README.mdx | 27 + docs/packages/math/README.mdx | 15 + docs/packages/pubkey/README.mdx | 15 + docs/packages/types/README.mdx | 39 ++ docs/packages/utils/README.mdx | 39 ++ package.json | 3 +- scripts/copy_readmes.sh | 21 + 26 files changed, 4192 insertions(+), 1 deletion(-) create mode 100644 docs/README.mdx create mode 100644 docs/libs/cosmos-types/README.mdx create mode 100644 docs/libs/injective-react/README.mdx create mode 100644 docs/libs/injective-vue/README.mdx create mode 100644 docs/libs/injectivejs/README.mdx create mode 100644 docs/libs/interchain-react/README.mdx create mode 100644 docs/libs/interchain-vue/README.mdx create mode 100644 docs/libs/interchainjs/README.mdx create mode 100644 docs/libs/interchainjs/starship/README.mdx create mode 100644 docs/networks/cosmos/README.mdx create mode 100644 docs/networks/cosmos/starship/README.mdx create mode 100644 docs/networks/ethereum/README.mdx create mode 100644 docs/networks/ethereum/devnet/README.mdx create mode 100644 docs/networks/ethereum/starship/README.mdx create mode 100644 docs/networks/injective/README.mdx create mode 100644 docs/networks/injective/starship/README.mdx create mode 100644 docs/packages/amino/README.mdx create mode 100644 docs/packages/auth/README.mdx create mode 100644 docs/packages/crypto/README.mdx create mode 100644 docs/packages/encoding/README.mdx create mode 100644 docs/packages/math/README.mdx create mode 100644 docs/packages/pubkey/README.mdx create mode 100644 docs/packages/types/README.mdx create mode 100644 docs/packages/utils/README.mdx create mode 100755 scripts/copy_readmes.sh diff --git a/docs/README.mdx b/docs/README.mdx new file mode 100644 index 000000000..5bccf1397 --- /dev/null +++ b/docs/README.mdx @@ -0,0 +1,165 @@ +# InterchainJS + +

+ +

+ +

+ + + + + +

+ +A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. + +## Table of Contents + +- [Introduction](#interchainjs-universal-signing-for-web3) +- [Overview](#overview) +- [Tutorials and Docs](#tutorial-for-building-a-custom-signer) +- [Auth](#auth) +- [Supported Networks](#supported-networks) + - [Cosmos Network](#cosmos-network) + - [Injective Network](#injective-network) + - [Ethereum Network](#ethereum-network) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-⚛️) +- [Credits](#credits) +- [Disclaimer](#disclaimer) + +## InterchainJS: Universal Signing for Web3 + +[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. + +At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. + +## Overview + +InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: + +- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. +- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. +- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. +- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. + +This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. + +### Visualizing InterchainJS Components + +The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. + +```mermaid +graph LR + signers --> cosmos_signer["Cosmos Network"] + signers --> injective_signer["Injective Network"] + signers --> ethereum_signer["Ethereum Network"] + signers --> implement_signer["ANY Network"] + + cosmos_signer --> cosmos_amino["Amino Signer"] + cosmos_signer --> cosmos_direct["Direct Signer"] + + ethereum_signer --> ethereum_eip712["EIP712 Signer"] + + injective_signer --> injective_amino["Amino Signer"] + injective_signer --> injective_direct["Direct Signer"] + + implement_signer --> any_signer["Any Signer"] + + style signers fill:#f9f,stroke:#333,stroke-width:2px +``` + +```mermaid +graph LR + encoders[Encoders] --> auth["@interchainjs/auth"] + encoders --> utils["@interchainjs/utils"] + encoders --> cosmos_types["@interchainjs/cosmos-types"] + + auth --> secp256k1_auth["Secp256k1 Auth"] + auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] + + utils --> signer_utils["Signer Utilities"] + utils --> crypto_utils["Crypto Utilities"] + + style encoders fill:#f9f,stroke:#333,stroke-width:2px + style auth fill:#ccf,stroke:#333,stroke-width:2px + style utils fill:#ccf,stroke:#333,stroke-width:2px +``` + + +--- + + +## Tutorials & Documentation + +| Topic | Documentation | +|----------------------------------|--------------| +| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | +| **Advanced Documentation** | [View Docs](/docs/) | + +--- + +## Auth + +The authentication module is universally applied across different networks. + +| Package | Description | +|---------|-------------| +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | + +--- + +## Supported Networks + +### Cosmos Network + +| Feature | Package | +|---------|---------| +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | + +--- + +### Injective Network + +| Feature | Package | +|---------|---------| +| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | + +--- + +### Ethereum Network + +| Feature | Package | +|---------|---------| +| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | + +--- + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/cosmos-types/README.mdx b/docs/libs/cosmos-types/README.mdx new file mode 100644 index 000000000..b97d59051 --- /dev/null +++ b/docs/libs/cosmos-types/README.mdx @@ -0,0 +1,43 @@ +# @interchainjs/cosmos-types + +

+ +

+ +

+ + + + + +

+ +Fundamental types for Networks/Cosmos to use. + +Generated by Telescope. (Will generate code with less redundancy in future version.) + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/injective-react/README.mdx b/docs/libs/injective-react/README.mdx new file mode 100644 index 000000000..50d1fcae4 --- /dev/null +++ b/docs/libs/injective-react/README.mdx @@ -0,0 +1,646 @@ +# injective-react + +

+ +

+ +

+ + + + + +

+ +## install + +```sh +npm install injective-react +``` + +## Table of contents + +- [injective-react](#injective-react) + - [install](#install) + - [Table of contents](#table-of-contents) + - [Usage](#usage) + - [RPC Clients](#rpc-clients) + - [Tx Hooks](#tx-hooks) + - [Tx Helpers](#tx-helpers) + - [Auction](#auction) + - [Exchange](#exchange) + - [Insurance](#insurance) + - [OCR](#ocr) + - [Oracle](#oracle) + - [Peggy](#peggy) + - [CosmWasm](#cosmwasm) + - [IBC](#ibc) + - [Cosmos](#cosmos) + - [Composing Messages](#composing-messages) + - [Auction Messages](#auction-messages) + - [Exchange Messages](#exchange-messages) + - [Insurance Messages](#insurance-messages) + - [OCR Messages](#ocr-messages) + - [Oracle Messages](#oracle-messages) + - [Peggy Messages](#peggy-messages) + - [CosmWasm Messages](#cosmwasm-messages) + - [IBC Messages](#ibc-messages) + - [Cosmos Messages](#cosmos-messages) + - [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) + - [Initializing the Signing Client](#initializing-the-signing-client) + - [Creating Signers](#creating-signers) + - [Broadcasting Messages](#broadcasting-messages) + - [All In One Example](#all-in-one-example) + - [Advanced Usage](#advanced-usage) + - [Developing](#developing) + - [Codegen](#codegen) + - [Publishing](#publishing) + - [Credits](#credits) + - [License](#license) + +## Usage + +### RPC Clients + +```js +import { getAllBalances } from "injectivejs/cosmos/bank/v1beta1/query.rpc.func"; +import { getExchangeBalances } from "injectivejs/injective/exchange/v1beta1/query.rpc.func"; + +{ getRpcEndpoint } = useChain("injective"); + +const endpoint = await getRpcEndpoint(); + +// now you can query the cosmos modules +const balance = await getAllBalances(endpoint, { + address: "inj1addresshere", +}); + +// you can also query the injective modules +const exchangeBalance = await getExchangeBalances(endpoint, {}); +``` + +### Tx Hooks + +injective-react provides hooks for sending transactions. These hooks are built on top of the `useQuery` hook and the `useMutation` hook from `react-query`. The hooks are designed to be used with the `useDelegate` and `useGetValidators` functions from `injectivejs`. + +There's also an all in one example of how to use these hooks in the [all in one example](#all-in-one-example) section. + +```js +import { useDelegate } from "injective-react/cosmos/staking/v1beta1/tx.rpc.react"; +import { useGetValidators } from "injective-react/cosmos/staking/v1beta1/query.rpc.react"; + +const { + data, + isSuccess: isGetValidatorsDone, + isLoading: isGetValidatorsLoading, +} = useGetValidators({ + request: { + status: "BOND_STATUS_BONDED", + }, + options: { + context: defaultContext, + enabled: !validatorAddress, + }, + rpcClient, +}); + +const { mutate: delegate, isSuccess: isDelegateSuccess } = useDelegate({ + clientResolver: signingClient, + options: { + context: defaultContext, + onSuccess: (data: any) => { + console.log("onSuccess", data); + }, + onError: (error) => { + console.log("onError", error); + }, + }, +}); +``` + +### Tx Helpers + +For tx messages, there're helper functions to sign and broadcast messages: + +For more detailed usage on how to use these functions, please see the starship tests in the [networks/injective repo](https://github.com/hyperweb-io/interchainjs/tree/main/networks/injective/starship/__tests__) + +There're also react hooks for helper functions. Please see the [Tx Hooks](#tx-hooks) section. + +```js +import { + deposit, + liquidatePosition, + activateStakeGrant, +} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; +``` + +#### Auction + +```js +import { bid } from "injectivejs/injective/auction/v1beta1/tx.rpc.func"; +``` + +#### Exchange + +```js +import { + activateStakeGrant, + adminUpdateBinaryOptionsMarket, + authorizeStakeGrants, + batchCancelBinaryOptionsOrders, + batchCancelDerivativeOrders, + batchCancelSpotOrders, + batchCreateDerivativeLimitOrders, + batchCreateSpotLimitOrders, + batchUpdateOrders, + cancelBinaryOptionsOrder, + cancelDerivativeOrder, + cancelSpotOrder, + createBinaryOptionsLimitOrder, + createBinaryOptionsMarketOrder, + createDerivativeLimitOrder, + createDerivativeMarketOrder, + createSpotLimitOrder, + createSpotMarketOrder, + decreasePositionMargin, + deposit, + emergencySettleMarket, + externalTransfer, + increasePositionMargin, + instantBinaryOptionsMarketLaunch, + instantExpiryFuturesMarketLaunch, + instantPerpetualMarketLaunch, + instantSpotMarketLaunch, + liquidatePosition, + privilegedExecuteContract, + rewardsOptOut, + subaccountTransfer, + updateDerivativeMarket, + updateParams, + updateSpotMarket, + withdraw, +} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; +``` + +#### Insurance + +```js +import { + createInsuranceFund, + requestRedemption, + underwrite, +} from "injectivejs/injective/insurance/v1beta1/tx.rpc.func"; +``` + +#### OCR + +```js +import { + acceptPayeeship, + createFeed, + fundFeedRewardPool, + setPayees, + transferPayeeship, + transmit, + updateFeed, + withdrawFeedRewardPool, +} from "injectivejs/injective/ocr/v1beta1/tx.rpc.func"; +``` + +#### Oracle + +```js +import { + relayBandRates, + relayCoinbaseMessages, + relayPriceFeedPrice, + relayProviderPrices, + relayPythPrices, + relayStorkMessage, + requestBandIBCRates, +} from "injectivejs/injective/oracle/v1beta1/tx.rpc.func"; +``` + +#### Peggy + +```js +import { + blacklistEthereumAddresses, + cancelSendToEth, + confirmBatch, + depositClaim, + eRC20DeployedClaim, + requestBatch, + revokeEthereumBlacklist, + sendToEth, + setOrchestratorAddresses, + submitBadSignatureEvidence, + valsetConfirm, + valsetUpdateClaim, + withdrawClaim, +} from "injectivejs/injective/peggy/v1/msgs.rpc.func"; +``` + +#### CosmWasm + +```js +import { + executeContract, + clearAdmin, + instantiateContract, + instantiateContract2, + migrateContract, + pinCodes, + removeCodeUploadParamsAddresses, + storeAndInstantiateContract, + storeCode, + sudoContract, + unpinCodes, + updateAdmin, + updateContractLabel, + updateInstantiateConfig, + addCodeUploadParamsAddresses, + storeAndMigrateContract, +} from "injectivejs/cosmwasm/wasm/v1/tx.rpc.func"; +``` + +#### IBC + +```js +import { transfer } from "injectivejs/ibc/applications/transfer/v1/tx.rpc.func"; +``` + +#### Cosmos + +```js +import { + fundCommunityPool, + communityPoolSpend, + depositValidatorRewardsPool, +} from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; + +import { + send, + multiSend, +} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; + +import { + delegate, + undelegate, + cancelUnbondingDelegation, + createValidator, +} from "injectivejs/cosmos/staking/v1beta1/tx.rpc.func"; + +import { + deposit, + submitProposal, + vote, + voteWeighted, +} from "injectivejs/cosmos/gov/v1beta1/tx.rpc.func"; +``` + +### Composing Messages + +Import the `injective` object from `injectivejs`. + +```js +import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; + +const { createSpotLimitOrder, createSpotMarketOrder, deposit } = + MessageComposer.withTypeUrl; +``` + +#### Auction Messages + +```js +import { MessageComposer } from "injectivejs/injective/auction/v1beta1/tx.registry"; + +const { bid } = MessageComposer.withTypeUrl; +``` + +#### Exchange Messages + +```js +import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; + +const { + adminUpdateBinaryOptionsMarket, + batchCancelBinaryOptionsOrders, + batchCancelDerivativeOrders, + batchCancelSpotOrders, + batchCreateDerivativeLimitOrders, + batchCreateSpotLimitOrders, + batchUpdateOrders, + cancelBinaryOptionsOrder, + cancelDerivativeOrder, + cancelSpotOrder, + createBinaryOptionsLimitOrder, + createBinaryOptionsMarketOrder, + createDerivativeLimitOrder, + createDerivativeMarketOrder, + createSpotLimitOrder, + createSpotMarketOrder, + deposit, + exec, + externalTransfer, + increasePositionMargin, + instantBinaryOptionsMarketLaunch, + instantExpiryFuturesMarketLaunch, + instantPerpetualMarketLaunch, + instantSpotMarketLaunch, + liquidatePosition, + rewardsOptOut, + subaccountTransfer, + withdraw, +} = MessageComposer.withTypeUrl; +``` + +#### Insurance Messages + +```js +import { MessageComposer } from "injectivejs/injective/insurance/v1beta1/tx.registry"; + +const { createInsuranceFund, requestRedemption, underwrite } = + MessageComposer.withTypeUrl; +``` + +#### OCR Messages + +```js +import { MessageComposer } from "injectivejs/injective/ocr/v1beta1/tx.registry"; + +const { + acceptPayeeship, + createFeed, + fundFeedRewardPool, + setPayees, + transferPayeeship, + transmit, + updateFeed, + withdrawFeedRewardPool, +} = MessageComposer.withTypeUrl; +``` + +#### Oracle Messages + +```js +import { MessageComposer } from "injectivejs/injective/oracle/v1beta1/tx.registry"; + +const { + relayBandRates, + relayCoinbaseMessages, + relayPriceFeedPrice, + relayProviderPrices, + requestBandIBCRates, +} = MessageComposer.withTypeUrl; +``` + +#### Peggy Messages + +```js +import { MessageComposer } from "injectivejs/injective/peggy/v1/tx.registry"; + +const { + cancelSendToEth, + confirmBatch, + depositClaim, + eRC20DeployedClaim, + requestBatch, + sendToEth, + setOrchestratorAddresses, + submitBadSignatureEvidence, + valsetConfirm, + valsetUpdateClaim, + withdrawClaim, +} = MessageComposer.withTypeUrl; +``` + +#### CosmWasm Messages + +```js +import { MessageComposer } from "injectivejs/cosmwasm/wasm/v1/tx.registry"; + +const { + clearAdmin, + executeContract, + instantiateContract, + migrateContract, + storeCode, + updateAdmin, +} = MessageComposer.withTypeUrl; +``` + +#### IBC Messages + +```js +import { MessageComposer } from "injectivejs/ibc/applications/transfer/v1/tx.registry"; + +const { transfer } = MessageComposer.withTypeUrl; +``` + +#### Cosmos Messages + +```js +import { MessageComposer } from "injectivejs/cosmos/distribution/v1beta1/tx.registry"; + +const { + fundCommunityPool, + setWithdrawAddress, + withdrawDelegatorReward, + withdrawValidatorCommission, +} = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/bank/v1beta1/tx.registry"; + +const { multiSend, send } = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/staking/v1beta1/tx.registry"; + +const { + beginRedelegate, + createValidator, + delegate, + editValidator, + undelegate, +} = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/gov/v1beta1/tx.registry"; + +const { deposit, submitProposal, vote, voteWeighted } = + cosmos.gov.v1beta1.MessageComposer.fromPartial; +``` + +## Connecting with Wallets and Signing Messages + +⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. + +Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. + +### Initializing the Signing Client + +Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: + +```js +import { SigningClient } from "@interchainjs/cosmos/signing-client"; +import { defaultSignerOptions } from "@interchainjs/injective/defaults"; + +const signingClient = await SigningClient.connectWithSigner( + await getRpcEndpoint(), + new AminoGenericOfflineSigner(aminoOfflineSigner), + { + signerOptions: defaultSignerOptions.Cosmos, + } +); +``` + +### Creating Signers + +To broadcast messages, you can create signers with a variety of options: + +- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) +- [keplr](https://docs.keplr.app/api/cosmjs.html) +- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) + +### Broadcasting Messages + +When you have your `signing client`, you can broadcast messages: + +```js +const msg = { + typeUrl: MsgSend.typeUrl, + value: MsgSend.fromPartial({ + amount: [ + { + denom: "inj", + amount: "1000", + }, + ], + toAddress: address, + fromAddress: address, + }), +}; + +const fee: StdFee = { + amount: [ + { + denom: "inj", + amount: "864", + }, + ], + gas: "86364", +}; +const response = await signingClient.signAndBroadcast(address, [msg], fee); +``` + +### All In One Example + +For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: + +- Initialize the client. +- Create and sign messages. +- Broadcast transactions. +- Handle responses and errors. + +The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. + +Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. + +## Advanced Usage + +If you want to manually construct a signing client, you can do so by following the example below: + +```js +import { + cosmosAminoConverters, + cosmosProtoRegistry, + cosmwasmAminoConverters, + cosmwasmProtoRegistry, + ibcProtoRegistry, + ibcAminoConverters, + injectiveAminoConverters, + injectiveProtoRegistry +} from 'injectivejs'; + +const signer: OfflineSigner = /* create your signer (see above) */ +const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL + +const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosProtoRegistry, + ...cosmwasmProtoRegistry, + ...ibcProtoRegistry, + ...injectiveProtoRegistry +]; + +const aminoConverters = { + ...cosmosAminoConverters, + ...cosmwasmAminoConverters, + ...ibcAminoConverters, + ...injectiveAminoConverters +}; + +const registry = new Registry(protoRegistry); +const aminoTypes = new AminoTypes(aminoConverters); + +const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); + +signingClient.addEncoders(registry); +signingClient.addConverters(aminoTypes); +``` + +## Developing + +When first cloning the repo: + +```shell +yarn +yarn build:dev +``` + +### Codegen + +Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: + +```shell +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +```shell +yarn build +yarn publish +``` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/injective-vue/README.mdx b/docs/libs/injective-vue/README.mdx new file mode 100644 index 000000000..610dae17e --- /dev/null +++ b/docs/libs/injective-vue/README.mdx @@ -0,0 +1,389 @@ +# injective-vue + +

+ +

+ +

+ + + + + +

+ +## install + +```sh +npm install injective-vue +``` + +## Table of contents + +- [injective-vue](#injective-vue) + - [install](#install) + - [Table of contents](#table-of-contents) +- [Usage](#usage) + - [RPC Clients](#rpc-clients) + - [Composing Messages](#composing-messages) + - [Auction Messages](#auction-messages) + - [Exchange Messages](#exchange-messages) + - [Insurance Messages](#insurance-messages) + - [OCR Messages](#ocr-messages) + - [Oracle Messages](#oracle-messages) + - [Peggy Messages](#peggy-messages) + - [CosmWasm Messages](#cosmwasm-messages) + - [IBC Messages](#ibc-messages) + - [Cosmos Messages](#cosmos-messages) +- [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) + - [Initializing the Signing Client](#initializing-the-signing-client) + - [Creating Signers](#creating-signers) + - [Broadcasting Messages](#broadcasting-messages) + - [All In One Example](#all-in-one-example) +- [Advanced Usage](#advanced-usage) +- [Developing](#developing) + - [Codegen](#codegen) + - [Publishing](#publishing) +- [Credits](#credits) +- [License](#license) + +## Usage + +### RPC Clients + +```js +import { injective } from "injective-vue"; + +const { createRPCQueryClient } = injective.ClientFactory; +const client = await createRPCQueryClient({ rpcEndpoint: RPC_ENDPOINT }); + +// now you can query the cosmos modules +const balance = await client.cosmos.bank.v1beta1.allBalances({ + address: "inj1addresshere", +}); + +// you can also query the injective modules +const balances = await client.injective.exchange.v1beta1.exchangeBalances(); +``` + +### Composing Messages + +Import the `injective` object from `injective-vue`. + +```js +import { injective } from "injective-vue"; + +const { createSpotLimitOrder, createSpotMarketOrder, deposit } = + injective.exchange.v1beta1.MessageComposer.withTypeUrl; +``` + +#### Auction Messages + +```js +const { bid } = injective.auction.v1beta1.MessageComposer.withTypeUrl; +``` + +#### Exchange Messages + +```js +const { + adminUpdateBinaryOptionsMarket, + batchCancelBinaryOptionsOrders, + batchCancelDerivativeOrders, + batchCancelSpotOrders, + batchCreateDerivativeLimitOrders, + batchCreateSpotLimitOrders, + batchUpdateOrders, + cancelBinaryOptionsOrder, + cancelDerivativeOrder, + cancelSpotOrder, + createBinaryOptionsLimitOrder, + createBinaryOptionsMarketOrder, + createDerivativeLimitOrder, + createDerivativeMarketOrder, + createSpotLimitOrder, + createSpotMarketOrder, + deposit, + exec, + externalTransfer, + increasePositionMargin, + instantBinaryOptionsMarketLaunch, + instantExpiryFuturesMarketLaunch, + instantPerpetualMarketLaunch, + instantSpotMarketLaunch, + liquidatePosition, + rewardsOptOut, + subaccountTransfer, + withdraw, +} = injective.exchange.v1beta1.MessageComposer.withTypeUrl; +``` + +#### Insurance Messages + +```js +const { createInsuranceFund, requestRedemption, underwrite } = + injective.insurance.v1beta1.MessageComposer.withTypeUrl; +``` + +#### OCR Messages + +```js +const { + acceptPayeeship, + createFeed, + fundFeedRewardPool, + setPayees, + transferPayeeship, + transmit, + updateFeed, + withdrawFeedRewardPool, +} = injective.ocr.v1beta1.MessageComposer.withTypeUrl; +``` + +#### Oracle Messages + +```js +const { + relayBandRates, + relayCoinbaseMessages, + relayPriceFeedPrice, + relayProviderPrices, + requestBandIBCRates, +} = injective.oracle.v1beta1.MessageComposer.withTypeUrl; +``` + +#### Peggy Messages + +```js +const { + cancelSendToEth, + confirmBatch, + depositClaim, + eRC20DeployedClaim, + requestBatch, + sendToEth, + setOrchestratorAddresses, + submitBadSignatureEvidence, + valsetConfirm, + valsetUpdateClaim, + withdrawClaim, +} = injective.peggy.v1.MessageComposer.withTypeUrl; +``` + +#### CosmWasm Messages + +```js +import { cosmwasm } from "injective-vue"; + +const { + clearAdmin, + executeContract, + instantiateContract, + migrateContract, + storeCode, + updateAdmin, +} = cosmwasm.wasm.v1.MessageComposer.withTypeUrl; +``` + +#### IBC Messages + +```js +import { ibc } from "injective-vue"; + +const { transfer } = ibc.applications.transfer.v1.MessageComposer.withTypeUrl; +``` + +#### Cosmos Messages + +```js +import { cosmos } from "injective-vue"; + +const { + fundCommunityPool, + setWithdrawAddress, + withdrawDelegatorReward, + withdrawValidatorCommission, +} = cosmos.distribution.v1beta1.MessageComposer.fromPartial; + +const { multiSend, send } = cosmos.bank.v1beta1.MessageComposer.fromPartial; + +const { + beginRedelegate, + createValidator, + delegate, + editValidator, + undelegate, +} = cosmos.staking.v1beta1.MessageComposer.fromPartial; + +const { deposit, submitProposal, vote, voteWeighted } = + cosmos.gov.v1beta1.MessageComposer.fromPartial; +``` + +## Connecting with Wallets and Signing Messages + +⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. + +Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. + +### Initializing the Signing Client + +Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: + +```js +import { SigningClient } from "@interchainjs/cosmos/signing-client"; +import { defaultSignerOptions } from "@interchainjs/injective/defaults"; + +const signingClient = await SigningClient.connectWithSigner( + await getRpcEndpoint(), + new AminoGenericOfflineSigner(aminoOfflineSigner), + { + signerOptions: defaultSignerOptions.Cosmos, + } +); +``` + +### Creating Signers + +To broadcast messages, you can create signers with a variety of options: + +- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) +- [keplr](https://docs.keplr.app/api/cosmjs.html) +- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) + +### Broadcasting Messages + +When you have your `signing client`, you can broadcast messages: + +```js +const msg = { + typeUrl: MsgSend.typeUrl, + value: MsgSend.fromPartial({ + amount: [ + { + denom: "inj", + amount: "1000", + }, + ], + toAddress: address, + fromAddress: address, + }), +}; + +const fee: StdFee = { + amount: [ + { + denom: "inj", + amount: "864", + }, + ], + gas: "86364", +}; +const response = await signingClient.signAndBroadcast(address, [msg], fee); +``` + +### All In One Example + +For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: + +- Initialize the client. +- Create and sign messages. +- Broadcast transactions. +- Handle responses and errors. + +The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. + +Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. + +## Advanced Usage + +If you want to manually construct a signing client, you can do so by following the example below: + +```js +import { + cosmosAminoConverters, + cosmosProtoRegistry, + cosmwasmAminoConverters, + cosmwasmProtoRegistry, + ibcProtoRegistry, + ibcAminoConverters, + injectiveAminoConverters, + injectiveProtoRegistry +} from 'injective-vue'; + +const signer: OfflineSigner = /* create your signer (see above) */ +const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL + +const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosProtoRegistry, + ...cosmwasmProtoRegistry, + ...ibcProtoRegistry, + ...injectiveProtoRegistry +]; + +const aminoConverters = { + ...cosmosAminoConverters, + ...cosmwasmAminoConverters, + ...ibcAminoConverters, + ...injectiveAminoConverters +}; + +const registry = new Registry(protoRegistry); +const aminoTypes = new AminoTypes(aminoConverters); + +const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); + +signingClient.addEncoders(registry); +signingClient.addConverters(aminoTypes); +``` + +## Developing + +When first cloning the repo: + +```shell +yarn +yarn build:dev +``` + +### Codegen + +Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: + +```shell +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +```shell +yarn build +yarn publish +``` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/injectivejs/README.mdx b/docs/libs/injectivejs/README.mdx new file mode 100644 index 000000000..a97344d49 --- /dev/null +++ b/docs/libs/injectivejs/README.mdx @@ -0,0 +1,605 @@ +# InjectiveJS + +

+ +

+ +

+ + + + + +

+ +## install + +```sh +npm install injectivejs +``` + +## Table of contents + +- [InjectiveJS](#injectivejs) +- [Install](#install) +- [Table of contents](#table-of-contents) +- [Usage](#usage) + - [RPC Clients](#rpc-clients) + - [Tx Helpers](#tx-helpers) + - [Auction](#auction) + - [Exchange](#exchange) + - [Insurance](#insurance) + - [OCR](#ocr) + - [Oracle](#oracle) + - [Peggy](#peggy) + - [CosmWasm](#cosmwasm) + - [IBC](#ibc) + - [Cosmos](#cosmos) + - [Composing Messages](#composing-messages) + - [Auction Messages](#auction-messages) + - [Exchange Messages](#exchange-messages) + - [Insurance Messages](#insurance-messages) + - [OCR Messages](#ocr-messages) + - [Oracle Messages](#oracle-messages) + - [Peggy Messages](#peggy-messages) + - [CosmWasm Messages](#cosmwasm-messages) + - [IBC Messages](#ibc-messages) + - [Cosmos Messages](#cosmos-messages) +- [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) + - [Initializing the Signing Client](#initializing-the-signing-client) + - [Creating Signers](#creating-signers) + - [Broadcasting Messages](#broadcasting-messages) +- [All In One Example](#all-in-one-example) +- [Advanced Usage](#advanced-usage) +- [Developing](#developing) + - [Codegen](#codegen) + - [Publishing](#publishing) +- [Credits](#credits) +- [License](#license) + +## Usage + +### RPC Clients + +```js +import { getAllBalances } from "injectivejs/cosmos/bank/v1beta1/query.rpc.func"; +import { getExchangeBalances } from "injectivejs/injective/exchange/v1beta1/query.rpc.func"; + +{ getRpcEndpoint } = useChain("injective"); + +const endpoint = await getRpcEndpoint(); + +// now you can query the cosmos modules +const balance = await getAllBalances(endpoint, { + address: "inj1addresshere", +}); + +const exchangeBalance = await getExchangeBalances(endpoint, {}); +``` + +### Tx Helpers + +For tx messages, there're helper functions to sign and broadcast messages: + +For more detailed usage on how to use these functions, please see the starship tests in the [networks/injective repo](https://github.com/hyperweb-io/interchainjs/tree/main/networks/injective/starship/__tests__) + +There're also react and vue hooks for helper functions. Please see [injective-react](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-react) and [injective-vue](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-vue) repos for more information. + +```js +import { + createDeposit, + createLiquidatePosition, + createActivateStakeGrant, +} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; +``` + +#### Auction + +```js +import { bid } from "injectivejs/injective/auction/v1beta1/tx.rpc.func"; +``` + +#### Exchange + +```js +import { + activateStakeGrant, + adminUpdateBinaryOptionsMarket, + authorizeStakeGrants, + batchCancelBinaryOptionsOrders, + batchCancelDerivativeOrders, + batchCancelSpotOrders, + batchCreateDerivativeLimitOrders, + batchCreateSpotLimitOrders, + batchUpdateOrders, + cancelBinaryOptionsOrder, + cancelDerivativeOrder, + cancelSpotOrder, + createBinaryOptionsLimitOrder, + createBinaryOptionsMarketOrder, + createDerivativeLimitOrder, + createDerivativeMarketOrder, + createSpotLimitOrder, + createSpotMarketOrder, + decreasePositionMargin, + deposit, + emergencySettleMarket, + externalTransfer, + increasePositionMargin, + instantBinaryOptionsMarketLaunch, + instantExpiryFuturesMarketLaunch, + instantPerpetualMarketLaunch, + instantSpotMarketLaunch, + liquidatePosition, + privilegedExecuteContract, + rewardsOptOut, + subaccountTransfer, + updateDerivativeMarket, + updateParams, + updateSpotMarket, + withdraw, +} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; +``` + +#### Insurance + +```js +import { + createInsuranceFund, + requestRedemption, + underwrite, +} from "injectivejs/injective/insurance/v1beta1/tx.rpc.func"; +``` + +#### OCR + +```js +import { + acceptPayeeship, + createFeed, + fundFeedRewardPool, + setPayees, + transferPayeeship, + transmit, + updateFeed, + withdrawFeedRewardPool, +} from "injectivejs/injective/ocr/v1beta1/tx.rpc.func"; +``` + +#### Oracle + +```js +import { + relayBandRates, + relayCoinbaseMessages, + relayPriceFeedPrice, + relayProviderPrices, + relayPythPrices, + relayStorkMessage, + requestBandIBCRates, +} from "injectivejs/injective/oracle/v1beta1/tx.rpc.func"; +``` + +#### Peggy + +```js +import { + blacklistEthereumAddresses, + cancelSendToEth, + confirmBatch, + depositClaim, + eRC20DeployedClaim, + requestBatch, + revokeEthereumBlacklist, + sendToEth, + setOrchestratorAddresses, + submitBadSignatureEvidence, + valsetConfirm, + valsetUpdateClaim, + withdrawClaim, +} from "injectivejs/injective/peggy/v1/msgs.rpc.func"; +``` + +#### CosmWasm + +```js +import { + executeContract, + clearAdmin, + instantiateContract, + instantiateContract2, + migrateContract, + pinCodes, + removeCodeUploadParamsAddresses, + storeAndInstantiateContract, + storeCode, + sudoContract, + unpinCodes, + updateAdmin, + updateContractLabel, + updateInstantiateConfig, + addCodeUploadParamsAddresses, + storeAndMigrateContract, +} from "injectivejs/cosmwasm/wasm/v1/tx.rpc.func"; +``` + +#### IBC + +```js +import { transfer } from "injectivejs/ibc/applications/transfer/v1/tx.rpc.func"; +``` + +#### Cosmos + +```js +import { + fundCommunityPool, + communityPoolSpend, + depositValidatorRewardsPool, +} from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; + +import { + send, + multiSend, +} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; + +import { + delegate, + undelegate, + cancelUnbondingDelegation, + createValidator, +} from "injectivejs/cosmos/staking/v1beta1/tx.rpc.func"; + +import { + deposit, + submitProposal, + vote, + voteWeighted, +} from "injectivejs/cosmos/gov/v1beta1/tx.rpc.func"; +``` + +### Composing Messages + +Import the `injective` object from `injectivejs`. + +```js +import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; + +const { createSpotLimitOrder, createSpotMarketOrder, deposit } = + MessageComposer.withTypeUrl; +``` + +#### Auction Messages + +```js +import { MessageComposer } from "injectivejs/injective/auction/v1beta1/tx.registry"; + +const { bid } = MessageComposer.withTypeUrl; +``` + +#### Exchange Messages + +```js +import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; + +const { + adminUpdateBinaryOptionsMarket, + batchCancelBinaryOptionsOrders, + batchCancelDerivativeOrders, + batchCancelSpotOrders, + batchCreateDerivativeLimitOrders, + batchCreateSpotLimitOrders, + batchUpdateOrders, + cancelBinaryOptionsOrder, + cancelDerivativeOrder, + cancelSpotOrder, + createBinaryOptionsLimitOrder, + createBinaryOptionsMarketOrder, + createDerivativeLimitOrder, + createDerivativeMarketOrder, + createSpotLimitOrder, + createSpotMarketOrder, + deposit, + exec, + externalTransfer, + increasePositionMargin, + instantBinaryOptionsMarketLaunch, + instantExpiryFuturesMarketLaunch, + instantPerpetualMarketLaunch, + instantSpotMarketLaunch, + liquidatePosition, + rewardsOptOut, + subaccountTransfer, + withdraw, +} = MessageComposer.withTypeUrl; +``` + +#### Insurance Messages + +```js +import { MessageComposer } from "injectivejs/injective/insurance/v1beta1/tx.registry"; + +const { createInsuranceFund, requestRedemption, underwrite } = + MessageComposer.withTypeUrl; +``` + +#### OCR Messages + +```js +import { MessageComposer } from "injectivejs/injective/ocr/v1beta1/tx.registry"; + +const { + acceptPayeeship, + createFeed, + fundFeedRewardPool, + setPayees, + transferPayeeship, + transmit, + updateFeed, + withdrawFeedRewardPool, +} = MessageComposer.withTypeUrl; +``` + +#### Oracle Messages + +```js +import { MessageComposer } from "injectivejs/injective/oracle/v1beta1/tx.registry"; + +const { + relayBandRates, + relayCoinbaseMessages, + relayPriceFeedPrice, + relayProviderPrices, + requestBandIBCRates, +} = MessageComposer.withTypeUrl; +``` + +#### Peggy Messages + +```js +import { MessageComposer } from "injectivejs/injective/peggy/v1/tx.registry"; + +const { + cancelSendToEth, + confirmBatch, + depositClaim, + eRC20DeployedClaim, + requestBatch, + sendToEth, + setOrchestratorAddresses, + submitBadSignatureEvidence, + valsetConfirm, + valsetUpdateClaim, + withdrawClaim, +} = MessageComposer.withTypeUrl; +``` + +#### CosmWasm Messages + +```js +import { MessageComposer } from "injectivejs/cosmwasm/wasm/v1/tx.registry"; + +const { + clearAdmin, + executeContract, + instantiateContract, + migrateContract, + storeCode, + updateAdmin, +} = MessageComposer.withTypeUrl; +``` + +#### IBC Messages + +```js +import { MessageComposer } from "injectivejs/ibc/applications/transfer/v1/tx.registry"; + +const { transfer } = MessageComposer.withTypeUrl; +``` + +#### Cosmos Messages + +```js +import { MessageComposer } from "injectivejs/cosmos/distribution/v1beta1/tx.registry"; + +const { + fundCommunityPool, + setWithdrawAddress, + withdrawDelegatorReward, + withdrawValidatorCommission, +} = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/bank/v1beta1/tx.registry"; + +const { multiSend, send } = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/staking/v1beta1/tx.registry"; + +const { + beginRedelegate, + createValidator, + delegate, + editValidator, + undelegate, +} = MessageComposer.fromPartial; +``` + +```js +import { MessageComposer } from "injectivejs/cosmos/gov/v1beta1/tx.registry"; + +const { deposit, submitProposal, vote, voteWeighted } = + cosmos.gov.v1beta1.MessageComposer.fromPartial; +``` + +## Connecting with Wallets and Signing Messages + +⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. + +Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. + +### Initializing the Signing Client + +Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: + +```js +import { SigningClient } from "@interchainjs/cosmos/signing-client"; +import { defaultSignerOptions } from "@interchainjs/injective/defaults"; + +const signingClient = await SigningClient.connectWithSigner( + await getRpcEndpoint(), + new AminoGenericOfflineSigner(aminoOfflineSigner), + { + signerOptions: defaultSignerOptions.Cosmos, + } +); +``` + +### Creating Signers + +To broadcast messages, you can create signers with a variety of options: + +- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) +- [keplr](https://docs.keplr.app/api/cosmjs.html) +- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) + +### Broadcasting Messages + +When you have your `signing client`, you can broadcast messages: + +```js +const msg = { + typeUrl: MsgSend.typeUrl, + value: MsgSend.fromPartial({ + amount: [ + { + denom: "inj", + amount: "1000", + }, + ], + toAddress: address, + fromAddress: address, + }), +}; + +const fee: StdFee = { + amount: [ + { + denom: "inj", + amount: "864", + }, + ], + gas: "86364", +}; +const response = await signingClient.signAndBroadcast(address, [msg], fee); +``` + +### All In One Example + +For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: + +- Initialize the client. +- Create and sign messages. +- Broadcast transactions. +- Handle responses and errors. + +The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. + +Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. + +## Advanced Usage + +If you want to manually construct a signing client, you can do so by following the example below: + +```js +import { + cosmosAminoConverters, + cosmosProtoRegistry, + cosmwasmAminoConverters, + cosmwasmProtoRegistry, + ibcProtoRegistry, + ibcAminoConverters, + injectiveAminoConverters, + injectiveProtoRegistry +} from 'injectivejs'; + +const signer: OfflineSigner = /* create your signer (see above) */ +const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL + +const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosProtoRegistry, + ...cosmwasmProtoRegistry, + ...ibcProtoRegistry, + ...injectiveProtoRegistry +]; + +const aminoConverters = { + ...cosmosAminoConverters, + ...cosmwasmAminoConverters, + ...ibcAminoConverters, + ...injectiveAminoConverters +}; + +const registry = new Registry(protoRegistry); +const aminoTypes = new AminoTypes(aminoConverters); + +const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); + +signingClient.addEncoders(registry); +signingClient.addConverters(aminoTypes); +``` + +## Developing + +When first cloning the repo: + +```shell +yarn +yarn build:dev +``` + +### Codegen + +Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: + +```shell +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +```shell +yarn build +yarn publish +``` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/interchain-react/README.mdx b/docs/libs/interchain-react/README.mdx new file mode 100644 index 000000000..a3ad92e2f --- /dev/null +++ b/docs/libs/interchain-react/README.mdx @@ -0,0 +1,150 @@ +# @interchainjs/react + +

+ +

+ +

+ + + + + +

+ +React query helper hooks(Tx, Query) generated by Telescope. + +### Tree Shakable Helpers + +InterchainJS provides tree shakable helper functions to optimize your application's bundle size. These helpers follow a factory pattern that allows modern JavaScript bundlers to eliminate unused code through tree shaking. These helpers improve modularity and optimize performance by allowing you to import only the functionality you need. +Tree shakable tutorial video: https://youtu.be/3dRm9HEklMo + +#### How Tree Shakable Helpers Work + +Each helper function is individually exported using a `create*` prefix (e.g., `getAllBalances`). +Each customized hook is individually exported using a `use*` prefix (e.g., `useGetBalance`) +This pattern enables: + +1. **Bundle Size Optimization**: Only the functions you import and use are included in your final bundle +2. **Lazy Initialization**: Helper functions are only constructed when explicitly called +3. **Customizable Configuration**: Each helper can be configured with specific parameters + +For example, query helpers are functions that return other functions, constructed with specific parameters: + +```js +// Import only what you need +import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; + +// Now you can query the blockchain +const balance = await getAllBalances(endpoint, { + address: "cosmos1addresshere", +}); +``` + +For example, customized hooks are functions that return the result you want: + +```typescript +// Import only what you need +import { defaultContext } from "@tanstack/react-query"; +import { useGetBalance } from "@interchainjs/react/cosmos/bank/v1beta1/query.rpc.react"; + +// Initialize RPC endpoint and address +const { rpcEndpoint } = + useQueryHooks(defaultChainName, { + context: defaultContext, + enabled: !!address, + }); + +//Now you can get balance by tree shakable hooks +const balanceRes = useGetBalance({ + request: { + address: address || '', + denom: 'osmo', + }, + options: { + context: defaultContext, + enabled: !!address && !!rpcEndpoint, + select: ({ balance }) => balance?.amount, + staleTime: 0, + }, + clientResolver: rpcEndpoint, +}) + +const balance = balanceRes?.data +``` + +#### Available Helper Types + +InterchainJS provides two main types of tree shakable helpers and customized hooks: + +1. **Query Helpers/Customized Hooks**: For retrieving data from the blockchain + + ```js + import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; + import { useGetValidators } from "@interchainjs/react/cosmos/staking/v1beta1/query.rpc.react"; + ``` + +2. **Transaction Helpers/Customized Hooks**: For broadcasting transactions + + ```js + import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + import { useDelegate } from "@interchainjs/react/cosmos/staking/v1beta1/tx.rpc.react"; + ``` + +#### Example: Combining Query and Transaction Helpers + +Here's how you might use both types together in a staking scenario: + +```js +// Import helpers +import { createQueryRpc } from "@interchainjs/cosmos/utils"; +import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; +import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + +// Query validator info +const { validator } = await getValidator(endpoint, { + validatorAddr: "cosmosvaloper1...", +}); + +// Execute delegation +const result = await delegate( + signingClient, + signerAddress, + { + delegatorAddress: signerAddress, + validatorAddress: validator.operatorAddress, + amount: { denom: "uatom", amount: "1000000" }, + }, + fee, + "Delegation via InterchainJS" +); +``` + +By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. + + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/interchain-vue/README.mdx b/docs/libs/interchain-vue/README.mdx new file mode 100644 index 000000000..24b9e6fb3 --- /dev/null +++ b/docs/libs/interchain-vue/README.mdx @@ -0,0 +1,147 @@ +# @interchainjs/vue + +

+ +

+ +

+ + + + + +

+ +React query helper hooks(Tx, Query) generated by Telescope. + +### Tree Shakable Helpers + +InterchainJS provides tree shakable helper functions to optimize your application's bundle size. These helpers follow a factory pattern that allows modern JavaScript bundlers to eliminate unused code through tree shaking. These helpers improve modularity and optimize performance by allowing you to import only the functionality you need. +Tree shakable tutorial video: https://youtu.be/3dRm9HEklMo + +#### How Tree Shakable Helpers Work + +Each helper function is individually exported (e.g., `getAllBalances`). +Each customized hook is individually exported using a `use*` prefix (e.g., `useGetBalance`) +This pattern enables: + +1. **Bundle Size Optimization**: Only the functions you import and use are included in your final bundle +2. **Lazy Initialization**: Helper functions are only constructed when explicitly called +3. **Customizable Configuration**: Each helper can be configured with specific parameters + +For example, query helpers are functions that return other functions, constructed with specific parameters: + +```js +// Import only what you need +import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; + +// Now you can query the blockchain +const balance = await getAllBalances(endpoint, { + address: "cosmos1addresshere", +}); +``` + +For example, customized hooks are functions that return the result you want: + +```typescript +// Import only what you need +import { useGetBalance } from '@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue'; + +// Initialize RPC endpoint and address, then you can get balance by tree shakable hooks + const request = computed(() => ({ + address: address.value, + denom, + })); + + const { + data: balance, + isSuccess: isBalanceLoaded, + isLoading: isFetchingBalance, + refetch: refetchBalance + } = useGetBalance({ + request, + options: { + enabled: !!address, + select: ({ balance }) => + new BigNumber(balance?.amount ?? 0).multipliedBy( + 10 ** -COIN_DISPLAY_EXPONENT + ), + }, + clientResolver: rpcEndpoint, + }) +``` + +#### Available Helper Types + +InterchainJS provides two main types of tree shakable helpers and customized hooks: + +1. **Query Helpers/Customized Hooks**: For retrieving data from the blockchain + + ```js + import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; + import { useGetValidators } from "@interchainjs/vue/cosmos/staking/v1beta1/query.rpc.vue"; + ``` + +2. **Transaction Helpers/Customized Hooks**: For broadcasting transactions + + ```js + import { createDelegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + import { useDelegate } from "@interchainjs/vue/cosmos/staking/v1beta1/tx.rpc.vue"; + ``` + +#### Example: Combining Query and Transaction Helpers + +Here's how you might use both types together in a staking scenario: + +```js +// Import helpers +import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; +import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + +// Query validator info +const { validator } = await getValidator(endpoint, { + validatorAddr: "cosmosvaloper1...", +}); + +// Execute delegation +const result = await delegate( + singingClient, + signerAddress, + { + delegatorAddress: signerAddress, + validatorAddress: validator.operatorAddress, + amount: { denom: "uatom", amount: "1000000" }, + }, + fee, + "Delegation via InterchainJS" +); +``` + +By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. + + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/interchainjs/README.mdx b/docs/libs/interchainjs/README.mdx new file mode 100644 index 000000000..fc50888a5 --- /dev/null +++ b/docs/libs/interchainjs/README.mdx @@ -0,0 +1,721 @@ +# InterchainJS + +

+ +

+ +

+ + + + + +

+ +A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. + +## install + +```sh +npm install interchainjs +``` + +## Table of Contents + +- [InterchainJS](#interchainjs) +- [Install](#install) +- [Introduction](#interchainjs-universal-signing-for-web3) +- [Overview](#overview) +- [Tutorials & Documentation](#tutorials--documentation) + - [RPC Clients](#rpc-clients) + - [Tree Shakable Helpers](#tree-shakable-helpers) + - [Module-Specific Helpers](#module-specific-helpers) +- [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) + - [Initializing the Signing Client](#initializing-the-signing-client) + - [Creating Signers](#creating-signers) + - [Broadcasting Messages](#broadcasting-messages) + - [All In One Example](#all-in-one-example) +- [Amino Helpers](#amino-helpers) +- [Auth](#auth) +- [Crypto Helpers](#crypto-helpers) +- [Encoding Helpers](#encoding-helpers) +- [Math Helpers](#math-helpers) +- [Pubkey Helpers](#pubkey-helpers) +- [Supported Networks](#supported-networks) + - [Cosmos Network](#cosmos-network) + - [Injective Network](#injective-network) + - [Ethereum Network](#ethereum-network) +- [Developing](#developing) + - [Codegen](#codegen) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️) +- [Credits](#credits) +- [Disclaimer](#disclaimer) + +## InterchainJS: Universal Signing for Web3 + +[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. + +At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. + +## Overview + +InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: + +- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. +- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. +- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. +- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. + +This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. + +### Visualizing InterchainJS Components + +The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. + +```mermaid +graph LR + signers --> cosmos_signer["Cosmos Network"] + signers --> injective_signer["Injective Network"] + signers --> ethereum_signer["Ethereum Network"] + signers --> implement_signer["ANY Network"] + + cosmos_signer --> cosmos_amino["Amino Signer"] + cosmos_signer --> cosmos_direct["Direct Signer"] + + ethereum_signer --> ethereum_eip712["EIP712 Signer"] + + injective_signer --> injective_amino["Amino Signer"] + injective_signer --> injective_direct["Direct Signer"] + + implement_signer --> any_signer["Any Signer"] + + style signers fill:#f9f,stroke:#333,stroke-width:2px +``` + +```mermaid +graph LR + encoders[Encoders] --> auth["@interchainjs/auth"] + encoders --> utils["@interchainjs/utils"] + encoders --> cosmos_types["@interchainjs/cosmos-types"] + + auth --> secp256k1_auth["Secp256k1 Auth"] + auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] + + utils --> signer_utils["Signer Utilities"] + utils --> crypto_utils["Crypto Utilities"] + + style encoders fill:#f9f,stroke:#333,stroke-width:2px + style auth fill:#ccf,stroke:#333,stroke-width:2px + style utils fill:#ccf,stroke:#333,stroke-width:2px +``` + +--- + +## Tutorials & Documentation + +The following resources provide comprehensive guidance for developers working with InterchainJS. Whether you're setting up a new application, implementing custom signers, or exploring advanced features, these tutorials and documentation will help you leverage the full power of InterchainJS across various blockchain networks. + +| Topic | Documentation | +| ---------------------------- | ----------------------------------------------------------------------------- | +| **Create Interchain App** | [Create Interchain App](https://github.com/hyperweb-io/create-interchain-app) | +| **Building a Custom Signer** | [Building a Custom Signer](/docs/building-a-custom-signer.md) | +| **Advanced Documentation** | [View Docs](/docs/) | + +### RPC Clients + +RPC (Remote Procedure Call) clients enable communication between your application and blockchain networks. InterchainJS provides a flexible and type-safe way to create these clients, allowing you to query blockchain data with minimal configuration. The following example demonstrates how to create and use an RPC client to query data from a Cosmos-based blockchain. + +```js +import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; + +{ getRpcEndpoint } = useChain("cosmoshub"); + +const endpoint = await getRpcEndpoint(); + +// now you can query the cosmos modules +const balance = await getAllBalances(endpoint,{ + address: "cosmos1addresshere", +}); +``` + +### Tree Shakable Helpers + +InterchainJS provides tree shakable helper functions to optimize your application's bundle size. These helpers follow a factory pattern that allows modern JavaScript bundlers to eliminate unused code through tree shaking. These helpers improve modularity and optimize performance by allowing you to import only the functionality you need. +Tree shakable tutorial video: https://youtu.be/3dRm9HEklMo + +#### How Tree Shakable Helpers Work + +Each helper function is individually exported (e.g., `getAllBalances`). +This pattern enables: + +1. **Bundle Size Optimization**: Only the functions you import and use are included in your final bundle +2. **Lazy Initialization**: Helper functions are only constructed when explicitly called +3. **Customizable Configuration**: Each helper can be configured with specific parameters + +For example, query helpers are functions that return other functions, constructed with specific parameters: + +```js +// Import only what you need +import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; + +// Now you can query the blockchain +const balance = await getAllBalances(endpoint, { + address: "cosmos1addresshere", +}); +``` + +#### Available Helper Types + +InterchainJS provides two main types of tree shakable helpers: + +1. **Query Helpers**: For retrieving data from the blockchain + + ```js + import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; + ``` + +2. **Transaction Helpers**: For broadcasting transactions + + ```js + import { createDelegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + ``` + +#### Example: Combining Query and Transaction Helpers + +Here's how you might use both types together in a staking scenario: + +```js +// Import helpers +import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; +import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; + +// Query validator info +const { validator } = await getValidator(endpoint, { + validatorAddr: "cosmosvaloper1...", +}); + +// Execute delegation +const result = await delegate( + signingClient, + signerAddress, + { + delegatorAddress: signerAddress, + validatorAddress: validator.operatorAddress, + amount: { denom: "uatom", amount: "1000000" }, + }, + fee, + "Delegation via InterchainJS" +); +``` + +By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. + +#### Framework Integration + +These tree shakable helpers can be used with framework-specific implementations: + +- **React**: Available as hooks in `@interchainjs/react` + + ```js + import { useGetAllBalances } from "@interchainjs/react/cosmos/bank/v1beta1/query.rpc.react"; + ``` + +- **Vue**: Available as composables in `@interchainjs/vue` + + ```js + import { useGetAllBalances } from "@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue"; + ``` + +#### Examples and Documentation + +For detailed usage examples and implementation patterns, refer to the test suite in the [starship/**tests**](https://github.com/hyperweb-io/interchainjs/tree/main/libs/interchainjs/starship/__tests__) directory. + +#### Module-Specific Helpers + +The following sections provide import examples for various Cosmos SDK modules. + +##### Authz + +```js +// query helpers +import { + getGrants, + getGranterGrants, + getGranteeGrants, +} from "@interchainjs/cosmos/authz/v1beta1/query.rpc.func"; + +// tx helpers +import { + grant, + revoke, + exec, +} from "@interchainjs/cosmos/authz/v1beta1/tx.rpc.func"; +``` + +##### Bank + +```js +// query helpers +import { + getAllBalances, + getDenomMetadata, + getSupply, + getParams, +} from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; + +// tx helpers +import { + send, + multiSend, +} from "@interchainjs/cosmos/bank/v1beta1/tx.rpc.func"; +``` + +##### Circuit + +```js +// query helpers +import { + getAccount, + getAccounts, + getDisabledList, +} from "@interchainjs/cosmos/circuit/v1/query.rpc.func"; + +// tx helpers +import { + authorizeCircuitBreaker, + tripCircuitBreaker, + resetCircuitBreaker, +} from "@interchainjs/cosmos/circuit/v1/tx.rpc.func"; +``` + +##### Consensus + +```js +// query helpers +import { getParams } from "@interchainjs/cosmos/consensus/v1/query.rpc.func"; + +// tx helpers +import { updateParams } from "@interchainjs/cosmos/consensus/v1/tx.rpc.func"; +``` + +##### Crisis + +```js +// tx helpers +import { + verifyInvariant, + updateParams, +} from "@interchainjs/cosmos/crisis/v1beta1/tx.rpc.func"; +``` + +##### Distribution + +```js +// query helpers +import { + getParams, + getValidatorDistributionInfo, + getValidatorOutstandingRewards, + getValidatorCommission, + getValidatorSlashes, + getDelegationRewards, + getDelegationTotalRewards, +} from "@interchainjs/cosmos/distribution/v1beta1/query.rpc.func"; + +// tx helpers +import { + setWithdrawAddress, + withdrawDelegatorReward, + withdrawValidatorCommission, + fundCommunityPool, + communityPoolSpend, + updateParams, +} from "@interchainjs/cosmos/distribution/v1beta1/tx.rpc.func"; +``` + +##### Evidence + +```js +// query helpers +import { + getEvidence, + getAllEvidence, +} from "@interchainjs/cosmos/evidence/v1beta1/query.rpc.func"; + +// tx helpers +import { submitEvidence } from "@interchainjs/cosmos/evidence/v1beta1/tx.rpc.func"; +``` + +##### Feegrant + +```js +// query helpers +import { + getAllowance, + getAllowances, + getAllowancesByGranter, +} from "@interchainjs/cosmos/feegrant/v1beta1/query.rpc.func"; + +// tx helpers +import { + grantAllowance, + revokeAllowance, + pruneAllowances, +} from "@interchainjs/cosmos/feegrant/v1beta1/tx.rpc.func"; +``` + +##### Gov + +```js +// query helpers +import { + getProposal, + getProposals, + getVote, + getVotes, + getParams, + getDeposit, + getDeposits, + getTallyResult, +} from "@interchainjs/cosmos/gov/v1beta1/query.rpc.func"; + +// tx helpers +import { + submitProposal, + deposit, + vote, + voteWeighted, +} from "@interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; +``` + +##### Group + +```js +// query helpers +import { + getGroupInfo, + getGroupPolicyInfo, + getGroupMembers, + getGroupsByAdmin, + getGroupPoliciesByGroup, + getGroupPoliciesByAdmin, +} from "@interchainjs/cosmos/group/v1/query.rpc.func"; + +// tx helpers +import { + createGroup, + updateGroupMetadata, + updateGroupMembers, + updateGroupAdmin, + updateGroupPolicyMetadata, + submitProposal, + vote, + exec, +} from "@interchainjs/cosmos/group/v1/tx.rpc.func"; +``` + +##### Mint + +```js +// query helpers +import { + getParams, + getInflation, + getAnnualProvisions, +} from "@interchainjs/cosmos/mint/v1beta1/query.rpc.func"; + +// tx helpers +import { updateParams } from "@interchainjs/cosmos/mint/v1beta1/tx.rpc.func"; +``` + +##### Nft + +```js +// query helpers +import { + getBalance, + getOwner, + getClass, + getClasses, + getNFTs, + getNFT, +} from "@interchainjs/cosmos/nft/v1/query.rpc.func"; + +// tx helpers +import { send } from "@interchainjs/cosmos/nft/v1/tx.rpc.func"; +``` + +##### Staking + +```js +// query helpers +import { + getValidators, + getValidator, + getValidatorDelegations, + getValidatorUnbondingDelegations, + getDelegation, + getUnbondingDelegation, +} from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; + +// tx helpers +import { + createValidator, + editValidator, + delegate, + undelegate, + redelegate, +} from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; +``` + +##### Vesting + +```js +// tx helpers +import { + createVestingAccount, + createPermanentLockedAccount, + createPeriodicVestingAccount, +} from "@interchainjs/cosmos/vesting/v1beta1/tx.rpc.func"; +``` + +##### CosmWasm + +```js +// query helpers +import { + getContractInfo, + getContractHistory, + getContractsByCode, + getAllContractState, + getRawContractState, + getSmartContractState, + getCode, + getCodes, +} from "@interchainjs/cosmwasm/wasm/v1/query.rpc.func"; + +// tx helpers +import { + storeCode, + instantiateContract, + migrateContract, + updateAdmin, + clearAdmin, +} from "@interchainjs/cosmwasm/wasm/v1/tx.rpc.func"; +``` + +##### IBC + +```js +// query helpers +import { + getParams, + getDenomHash, + getEscrowAddress, + getTotalEscrowForDenom, +} from "@interchainjs/ibc/applications/transfer/v1/query.rpc.func"; + +// tx helpers +import { + transfer, + updateParams, +} from "@interchainjs/ibc/applications/transfer/v1/tx.rpc.func"; +``` + +## Connecting with Wallets and Signing Messages + +⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. + +Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. + +### Initializing the Signing Client + +Use SigningClient.connectWithSigner to get your `SigningClient`: + +```js +import { SigningClient } from "@interchainjs/cosmos/signing-client"; + +const signingClient = await SigningClient.connectWithSigner( + await getRpcEndpoint(), + new AminoGenericOfflineSigner(aminoOfflineSigner) +); +``` + +### Creating Signers + +To broadcast messages, you can create signers with a variety of options: + +- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) +- [keplr](https://docs.keplr.app/api/cosmjs.html) + +### Broadcasting Messages + +When you have your `signing client`, you can broadcast messages: + +```js +const msg = { + typeUrl: MsgSend.typeUrl, + value: MsgSend.fromPartial({ + amount: [ + { + denom: "uatom", + amount: "1000", + }, + ], + toAddress: address, + fromAddress: address, + }), +}; + +const fee: StdFee = { + amount: [ + { + denom: "uatom", + amount: "1000", + }, + ], + gas: "86364", +}; +const response = await signingClient.signAndBroadcast(address, [msg], fee); +``` + +### All In One Example + +For a comprehensive example of how to use InterchainJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/authz). This example demonstrates how to: + +- Initialize the client. +- Create and sign messages. +- Broadcast transactions. +- Handle responses and errors. + +The example provides a complete walkthrough of setting up the client, creating a message for sending txs, and broadcasting the transaction to the chain. + +--- + +## Amino Helpers + +The `@interchainjs/amino` package provides utilities for working with Amino messages and types. It includes functions for encoding and decoding messages, as well as for creating and manipulating Amino types. + +| Package | Description | +| ------------------------------------------------ | --------------------------------- | +| [@interchainjs/amino](/packages/amino/README.md) | Amino message and type utilities. | + +## Auth + +The authentication module is universally applied across different networks. + +| Package | Description | +| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | + +## Crypto Helpers + +The `@interchainjs/crypto` package provides utilities for working with cryptographic primitives. It includes functions for encoding and decoding messages, as well as for creating and manipulating Amino types. + +| Package | Description | +| -------------------------------------------------- | ---------------------------------- | +| [@interchainjs/crypto](/packages/crypto/README.md) | Crypto message and type utilities. | + +## Encoding Helpers + +The `@interchainjs/encoding` package provides utilities for working with encoding. It includes functions for encoding and decoding messages, as well as for creating and manipulating encoding types. + +| Package | Description | +| ------------------------------------------------------ | ------------------------------------ | +| [@interchainjs/encoding](/packages/encoding/README.md) | Encoding message and type utilities. | + +## Math Helpers + +The `@interchainjs/math` package provides utilities for working with math. It includes functions for encoding and decoding messages, as well as for creating and manipulating math types. + +| Package | Description | +| ---------------------------------------------- | -------------------------------- | +| [@interchainjs/math](/packages/math/README.md) | Math message and type utilities. | + +## Pubkey Helpers + +The `@interchainjs/pubkey` package provides utilities for working with pubkeys. It includes functions for encoding and decoding messages, as well as for creating and manipulating pubkey types. + +| Package | Description | +| -------------------------------------------------- | ---------------------------------- | +| [@interchainjs/pubkey](/packages/pubkey/README.md) | Pubkey message and type utilities. | + +## Supported Networks + +### Cosmos Network + +| Feature | Package | +| ---------------------------- | ------------------------------------------------------------- | +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [interchainjs](/networks/cosmjs/README.md) | + +--- + +### Injective Network + +| Feature | Package | +| ---------------- | -------------------------------------------------------- | +| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | + +--- + +### Ethereum Network + +| Feature | Package | +| ---------------- | ------------------------------------------------------ | +| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | + +--- + +## Developing + +When first cloning the repo: + +```shell +yarn +yarn build:dev +``` + +### Codegen + +Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/interchainjs.telescope.json` and configure the settings for bundling your SDK and contracts into `interchainjs`: + +```shell +yarn codegen +``` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. + +``` + +``` + +``` + +``` diff --git a/docs/libs/interchainjs/starship/README.mdx b/docs/libs/interchainjs/starship/README.mdx new file mode 100644 index 000000000..85d877872 --- /dev/null +++ b/docs/libs/interchainjs/starship/README.mdx @@ -0,0 +1,159 @@ +## TLDR + +Deploy + +```sh +# setup helm/starship +yarn starship setup + +# sanity check +yarn starship get-pods + +# deploy starship +yarn starship deploy + +# wait til STATUS=Running +yarn starship wait-for-pods +or +watch yarn starship get-pods + +# port forwarding +yarn starship start-ports + +# check pids +yarn starship port-pids +``` + +Run Tests + +```sh +# test +yarn starship:test + +# watch +yarn starship:watch +``` + +Teardown + +```sh +# stop port forwarding (done by clean() too) +# yarn starship stop-ports + +# stop ports and delete & remove helm chart +yarn starship clean +``` + +## 1. Installation + +Inorder to get started with starship, one needs to install the following + +- `kubectl`: https://kubernetes.io/docs/tasks/tools/ +- `kind`: https://kind.sigs.k8s.io/docs/user/quick-start/#installation +- `helm`: https://helm.sh/docs/intro/install/ + +Note: To make the process easy we have a simple command that will try and install dependencies +so that you dont have to. + +```bash +yarn starship setup +``` + +This command will + +- check (and install) if your system has all the dependencies needed to run the e2e tests wtih Starship +- fetch the helm charts for Starship + +## 2. Connect to a kubernetes cluster + +Inorder to set up the infrastructure, for Starship, we need access to a kubernetes cluster. +One can either perform connect to a + +- remote cluster in a managed kubernetes service +- use kubernetes desktop to spin up a cluster +- use kind to create a local cluster on local machine + +To make this easier we have a handy command which will create a local kind cluster and give you access +to a kubernetes cluster locally. + +NOTE: Resources constraint on local machine will affect the performance of Starship spinup time + +```bash +yarn starship setup-kind +``` + +Run the following command to check connection to a k8s cluster + +```bash +kubectl get pods +``` + +## 3. Start Starship + +Now with the dependencies and a kubernetes cluster in handy, we can proceed with creating the mini-cosmos ecosystem + +Run + +```bash +yarn starship deploy +``` + +We use the config file `configs/config.yaml` as the genesis file to define the topology of the e2e test infra. Change it as required + +Note: Spinup will take some time, while you wait for the system, can check the progress in another tab with `kubectl get pods` + +## 4. Run the tests + +We have everything we need, our desired infrastructure is now running as intended, now we can run +our end-to-end tests. + +Run + +```bash +npm run starship:test +``` + +## 5. Stop the infra + +The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins). + +Once the state of the mini-cosmos is corrupted, you can stop the deployments with + +```bash +npm run starship clean +``` + +Which will + +- Stop port-forwarding the traffic to your local +- Delete all the helm charts deployed + +## 6. Cleanup kind (optional) + +If you are using kind for your kubernetes cluster, you can delete it with + +```bash +yarn starship clean-kind +``` + +## Related + +Checkout these related projects: + +- [@cosmology/telescope](https://github.com/hyperweb-io/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. +- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. +- [chain-registry](https://github.com/hyperweb-io/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. +- [cosmos-kit](https://github.com/hyperweb-io/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +- [create-cosmos-app](https://github.com/hyperweb-io/create-cosmos-app) Set up a modern Cosmos app by running one command. +- [interchain-ui](https://github.com/hyperweb-io/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. +- [starship](https://github.com/hyperweb-io/starship) Unified Testing and Development for the Interchain. + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/cosmos/README.mdx b/docs/networks/cosmos/README.mdx new file mode 100644 index 000000000..2acffcf39 --- /dev/null +++ b/docs/networks/cosmos/README.mdx @@ -0,0 +1,150 @@ +# @interchainjs/cosmos + +

+ +

+ +

+ + + +

+ +Transaction codec and client to communicate with any cosmos blockchain. + +## Usage + +```sh +npm install @interchainjs/cosmos +``` + +Example for signing client here: + +```ts +import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + registry: [ + // as many as possible encoders registered here. + MsgDelegate, + MsgSend, + ], + broadcast: { + checkTx: true, + }, + } +); + +// sign and broadcast +const result = await signingClient.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw + +``` + +Or use the tree shakable helper functions (**Most Recommended**) we generate in interchainjs libs: + +```ts +import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; +import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + // no registry needed here anymore + // registry: [ + // ], + broadcast: { + checkTx: true, + }, + } +); + +// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once. +const result = await submitProposal( + signingClient, + directAddress, + { + proposer: directAddress, + initialDeposit: [ + { + amount: '1000000', + denom: denom, + }, + ], + content: { + typeUrl: '/cosmos.gov.v1beta1.TextProposal', + value: TextProposal.encode(contentMsg).finish(), + }, + }, + fee, + "submit proposal" +); +console.log(result.hash); // the hash of TxRaw +``` + +Examples for direct and amino signers here: + +```ts +import { DirectSigner } from "@interchainjs/cosmos/signers/direct"; + +// const signer = new DirectSigner(, [], ); // **ONLY** rpc endpoint is supported for now +const signer = new DirectSigner( + directAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } + ); +const aminoSigner = new AminoSigner( + aminoAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + // as many as possible converters registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } + ); +const result = await signer.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw +``` + + +- See [@interchainjs/auth](/packages/auth/README.md) to construct `` +- See [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) to construct ``s and ``s, and also different message types. + +## Implementations + +- **direct signer** from `@interchainjs/cosmos/signers/direct` +- **amino signer** from `@interchainjs/cosmos/signers/amino` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/cosmos/starship/README.mdx b/docs/networks/cosmos/starship/README.mdx new file mode 100644 index 000000000..85d877872 --- /dev/null +++ b/docs/networks/cosmos/starship/README.mdx @@ -0,0 +1,159 @@ +## TLDR + +Deploy + +```sh +# setup helm/starship +yarn starship setup + +# sanity check +yarn starship get-pods + +# deploy starship +yarn starship deploy + +# wait til STATUS=Running +yarn starship wait-for-pods +or +watch yarn starship get-pods + +# port forwarding +yarn starship start-ports + +# check pids +yarn starship port-pids +``` + +Run Tests + +```sh +# test +yarn starship:test + +# watch +yarn starship:watch +``` + +Teardown + +```sh +# stop port forwarding (done by clean() too) +# yarn starship stop-ports + +# stop ports and delete & remove helm chart +yarn starship clean +``` + +## 1. Installation + +Inorder to get started with starship, one needs to install the following + +- `kubectl`: https://kubernetes.io/docs/tasks/tools/ +- `kind`: https://kind.sigs.k8s.io/docs/user/quick-start/#installation +- `helm`: https://helm.sh/docs/intro/install/ + +Note: To make the process easy we have a simple command that will try and install dependencies +so that you dont have to. + +```bash +yarn starship setup +``` + +This command will + +- check (and install) if your system has all the dependencies needed to run the e2e tests wtih Starship +- fetch the helm charts for Starship + +## 2. Connect to a kubernetes cluster + +Inorder to set up the infrastructure, for Starship, we need access to a kubernetes cluster. +One can either perform connect to a + +- remote cluster in a managed kubernetes service +- use kubernetes desktop to spin up a cluster +- use kind to create a local cluster on local machine + +To make this easier we have a handy command which will create a local kind cluster and give you access +to a kubernetes cluster locally. + +NOTE: Resources constraint on local machine will affect the performance of Starship spinup time + +```bash +yarn starship setup-kind +``` + +Run the following command to check connection to a k8s cluster + +```bash +kubectl get pods +``` + +## 3. Start Starship + +Now with the dependencies and a kubernetes cluster in handy, we can proceed with creating the mini-cosmos ecosystem + +Run + +```bash +yarn starship deploy +``` + +We use the config file `configs/config.yaml` as the genesis file to define the topology of the e2e test infra. Change it as required + +Note: Spinup will take some time, while you wait for the system, can check the progress in another tab with `kubectl get pods` + +## 4. Run the tests + +We have everything we need, our desired infrastructure is now running as intended, now we can run +our end-to-end tests. + +Run + +```bash +npm run starship:test +``` + +## 5. Stop the infra + +The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins). + +Once the state of the mini-cosmos is corrupted, you can stop the deployments with + +```bash +npm run starship clean +``` + +Which will + +- Stop port-forwarding the traffic to your local +- Delete all the helm charts deployed + +## 6. Cleanup kind (optional) + +If you are using kind for your kubernetes cluster, you can delete it with + +```bash +yarn starship clean-kind +``` + +## Related + +Checkout these related projects: + +- [@cosmology/telescope](https://github.com/hyperweb-io/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. +- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. +- [chain-registry](https://github.com/hyperweb-io/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. +- [cosmos-kit](https://github.com/hyperweb-io/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +- [create-cosmos-app](https://github.com/hyperweb-io/create-cosmos-app) Set up a modern Cosmos app by running one command. +- [interchain-ui](https://github.com/hyperweb-io/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. +- [starship](https://github.com/hyperweb-io/starship) Unified Testing and Development for the Interchain. + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/ethereum/README.mdx b/docs/networks/ethereum/README.mdx new file mode 100644 index 000000000..24863007a --- /dev/null +++ b/docs/networks/ethereum/README.mdx @@ -0,0 +1,171 @@ +# @interchainjs/ethereum + +

+ +

+ +

+ + + +

+ +Transaction codec and client to communicate with ethereum blockchain. + +## Usage + +```sh +npm install @interchainjs/ethereum +``` + +### Using private key + +```typescript +import { SignerFromPrivateKey } from "@interchainjs/ethereum/signers/SignerFromPrivateKey" +const signer = new SignerFromPrivateKey(privateKey, RPC_URL) +const { txHash, wait } = await signer.sendEIP1559TransactionAutoGasLimit( + recipientAddress, + amount +) +const receipt = await wait() +``` + +```typescript +// Get the address and current balance +type Address = string +const address: Address = signer.getAddress() +console.log("Address:", address) + +const balance: bigint = await signer.getBalance() +console.log("Balance (wei):", balance) + +// Get the current nonce +const nonce: number = await signer.getNonce() +console.log("Nonce:", nonce) + +// Send a legacy transaction with automatic gas limit +const { txHash: legacyHash, wait: legacyWait } = await signer.sendLegacyTransactionAutoGasLimit( + recipientAddress, + 1000000000000000n, // 0.001 ETH + '0x' +) +const legacyReceipt = await legacyWait() +console.log("Legacy tx receipt:", legacyReceipt) + +// Send an EIP-1559 transaction with automatic gas settings +const { txHash: eipHash, wait: eipWait } = await signer.sendEIP1559TransactionAutoGasLimit( + recipientAddress, + 1000000000000000n // 0.001 ETH +) +const eipReceipt = await eipWait() +console.log("EIP-1559 tx receipt:", eipReceipt) + +// Sign and verify a personal message +const message: string = "Hello, Ethereum!" +const signature: string = signer.personalSign(message) +console.log("Signature:", signature) + +const isValid: boolean = SignerFromPrivateKey.verifyPersonalSignature( + message, + signature, + address +) +console.log("Signature valid:", isValid) +} +``` + +```typescript +// Estimate gas for an arbitrary transaction +const estimatedGas: bigint = await signer.estimateGas( + recipientAddress, + 500000000000000000n, // 0.5 ETH + '0x' // optional data +) +console.log('Estimated gas:', estimatedGas.toString()) +``` + +```typescript +// Deploy a smart contract +const bytecode = '0x...'; // compiled contract bytecode +const { txHash: deployHash, wait: deployWait } = await signer.sendLegacyTransactionAutoGasLimit( + '', + 0n, + bytecode +) +const deployReceipt = await deployWait() +console.log('Contract deployed at:', deployReceipt.contractAddress) +``` + +```typescript +// Interact with a deployed contract (transfer ERC20 tokens) +import { ContractEncoder } from "@interchainjs/ethereum/utils/ContractEncoder" +const abi = [ /* ERC20 contract ABI */ ] +const contractAddress = deployReceipt.contractAddress +const contract = new ContractEncoder(abi) +const dataHex = contract.transfer(recipientAddress, 1000000n) +const { txHash: tokenHash, wait: tokenWait } = await signer.sendLegacyTransactionAutoGasLimit( + contractAddress, + 0n, + dataHex +) +const tokenReceipt = await tokenWait() +console.log('Token transfer receipt:', tokenReceipt) +``` + +```typescript +// Monitor contract events via WebSocket +import { WebSocketContractMonitor } from "@interchainjs/ethereum/providers/WebSocketContractMonitor" +const wsUrl = 'ws://127.0.0.1:8546' +const monitor = new WebSocketContractMonitor(contractAddress, abi, wsUrl) +await monitor.connect() +monitor.on('Transfer', (event) => { + console.log('Transfer event:', event) +}) +``` +See more usages in the [unit test](starship/__tests__/token.test.ts) + +### In the frontend + +``` typescript +import { SignerFromBrowser } from "@interchainjs/ethereum/signers/SignerFromBrowser" +const signer = new SignerFromBrowser(window.ethereum) +const tx = await signer.send({ + to: recipientAddress, + value: BigInt(10**18), +}) +const receipt = await tx.wait() +``` +For more details, see this example: https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/ethereum/app/page.tsx + +## Implementations + +- **SignerFromPrivateKey** from `@interchainjs/ethereum/signers/SignerFromPrivateKey` +- **SignerFromBrowser** from `@interchainjs/ethereum/signers/SignerFromBrowser` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/ethereum/devnet/README.mdx b/docs/networks/ethereum/devnet/README.mdx new file mode 100644 index 000000000..29f8f3cd7 --- /dev/null +++ b/docs/networks/ethereum/devnet/README.mdx @@ -0,0 +1,23 @@ +1. use ganache js to run a ethereum node locally + +``` +npx ganache \ + --account="0x0000000000000000000000000000000000000000000000000000000000000001,1000000000000000000" \ + --account="0x0000000000000000000000000000000000000000000000000000000000000002,1000000000000000000" +``` +or +``` +yarn run-ganache +``` + +2. run test under networks/ethereum: + +``` +yarn test:devnet +``` + +3. for ethers test, run under networks/ethereum: + +``` +yarn test:ethers +``` \ No newline at end of file diff --git a/docs/networks/ethereum/starship/README.mdx b/docs/networks/ethereum/starship/README.mdx new file mode 100644 index 000000000..ae9f3510b --- /dev/null +++ b/docs/networks/ethereum/starship/README.mdx @@ -0,0 +1,162 @@ +## TLDR + +Deploy + +```sh +yarn starship +``` + +Run Tests + +```sh +yarn starship:test +``` + +Teardown + +```sh +yarn starship:stop +``` + +Port fording manually if needed +```sh +kubectl port-forward pods/ethereum-1337-0 8545:8545 +``` + +Get chain id from node +```sh +curl -X POST -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' \ + http://localhost:8545/ +``` + +Get balance: +```sh +curl -X POST \ + -H "Content-Type: application/json" \ + --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x7e5f4552091a69125d5dfcb7b8c2659029395bdf", "latest"],"id":1}' \ + http://localhost:8545 +``` + +use ws to get latest block height: +```sh +wscat -c ws://127.0.0.1:8546 +``` +and then paste: +``` +{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newHeads"]} +``` + +## 1. Installation + +Inorder to get started with starship, one needs to install the following + +- `kubectl`: https://kubernetes.io/docs/tasks/tools/ +- `kind`: https://kind.sigs.k8s.io/docs/user/quick-start/#installation +- `helm`: https://helm.sh/docs/intro/install/ + +Note: To make the process easy we have a simple command that will try and install dependencies +so that you dont have to. + +```bash +yarn starship setup +``` + +This command will + +- check (and install) if your system has all the dependencies needed to run the e2e tests wtih Starship +- fetch the helm charts for Starship + +## 2. Connect to a kubernetes cluster + +Inorder to set up the infrastructure, for Starship, we need access to a kubernetes cluster. +One can either perform connect to a + +- remote cluster in a managed kubernetes service +- use kubernetes desktop to spin up a cluster +- use kind to create a local cluster on local machine + +To make this easier we have a handy command which will create a local kind cluster and give you access +to a kubernetes cluster locally. + +NOTE: Resources constraint on local machine will affect the performance of Starship spinup time + +```bash +yarn starship setup-kind +``` + +Run the following command to check connection to a k8s cluster + +```bash +kubectl get pods +``` + +## 3. Start Starship + +Now with the dependencies and a kubernetes cluster in handy, we can proceed with creating the mini-cosmos ecosystem + +Run + +```bash +yarn starship deploy +``` + +We use the config file `configs/config.yaml` as the genesis file to define the topology of the e2e test infra. Change it as required + +Note: Spinup will take some time, while you wait for the system, can check the progress in another tab with `kubectl get pods` + +## 4. Run the tests + +We have everything we need, our desired infrastructure is now running as intended, now we can run +our end-to-end tests. + +Run + +```bash +npm run starship:test +``` + +## 5. Stop the infra + +The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins). + +Once the state of the mini-cosmos is corrupted, you can stop the deployments with + +```bash +npm run starship clean +``` + +Which will + +- Stop port-forwarding the traffic to your local +- Delete all the helm charts deployed + +## 6. Cleanup kind (optional) + +If you are using kind for your kubernetes cluster, you can delete it with + +```bash +yarn starship clean-kind +``` + +## Related + +Checkout these related projects: + +- [@cosmology/telescope](https://github.com/hyperweb-io/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. +- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. +- [chain-registry](https://github.com/hyperweb-io/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. +- [interchain-kit](https://github.com/hyperweb-io/interchain-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +- [create-interchain-app](https://github.com/hyperweb-io/create-interchain-app) Set up a modern Cosmos app by running one command. +- [interchain-ui](https://github.com/hyperweb-io/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. +- [starship](https://github.com/hyperweb-io/starship) Unified Testing and Development for the Interchain. + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/injective/README.mdx b/docs/networks/injective/README.mdx new file mode 100644 index 000000000..a428d6ffe --- /dev/null +++ b/docs/networks/injective/README.mdx @@ -0,0 +1,66 @@ +# @interchainjs/injective + +

+ +

+ +

+ + + +

+ +Transaction codec and client to communicate with any injective blockchain. + +## Usage + +```sh +npm install @interchainjs/injective +``` + +Taking `direct` signing mode as example. + +```ts +import { DirectSigner } from "@interchainjs/injective/signers/direct"; + +const signer = new DirectSigner(, [], ); // **ONLY** rpc endpoint is supported for now +const result = await signer.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw +``` + +- See [@interchainjs/auth](/packages/auth/README.md) to construct `` +- See `@interchainjs/injective-msgs`(on progress) to construct ``s and ``s, and also different message types. + +## Implementations + +- **direct signer** from `@interchainjs/injective/signers/direct` +- **amino signer** from `@interchainjs/injective/signers/amino` +- **eip712 signer** from `@interchainjs/injective/signers/eip712` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/injective/starship/README.mdx b/docs/networks/injective/starship/README.mdx new file mode 100644 index 000000000..497e1809f --- /dev/null +++ b/docs/networks/injective/starship/README.mdx @@ -0,0 +1,157 @@ +## TLDR + +Deploy + +```sh +# setup helm/starship +yarn starship setup + +# sanity check +yarn starship get-pods + +# deploy starship +yarn starship deploy + +# wait til STATUS=Running +yarn starship get-pods + +# port forwarding +yarn starship start-ports + +# check pids +yarn starship port-pids +``` + +Run Tests + +```sh +# test +yarn starship:test + +# watch +yarn starship:watch +``` + +Teardown + +```sh +# stop port forwarding (done by clean() too) +# yarn starship stop-ports + +# stop ports and delete & remove helm chart +yarn starship clean +``` + +## 1. Installation + +Inorder to get started with starship, one needs to install the following + +- `kubectl`: https://kubernetes.io/docs/tasks/tools/ +- `kind`: https://kind.sigs.k8s.io/docs/user/quick-start/#installation +- `helm`: https://helm.sh/docs/intro/install/ + +Note: To make the process easy we have a simple command that will try and install dependencies +so that you dont have to. + +```bash +yarn starship setup +``` + +This command will + +- check (and install) if your system has all the dependencies needed to run the e2e tests wtih Starship +- fetch the helm charts for Starship + +## 2. Connect to a kubernetes cluster + +Inorder to set up the infrastructure, for Starship, we need access to a kubernetes cluster. +One can either perform connect to a + +- remote cluster in a managed kubernetes service +- use kubernetes desktop to spin up a cluster +- use kind to create a local cluster on local machine + +To make this easier we have a handy command which will create a local kind cluster and give you access +to a kubernetes cluster locally. + +NOTE: Resources constraint on local machine will affect the performance of Starship spinup time + +```bash +yarn starship setup-kind +``` + +Run the following command to check connection to a k8s cluster + +```bash +kubectl get pods +``` + +## 3. Start Starship + +Now with the dependencies and a kubernetes cluster in handy, we can proceed with creating the mini-cosmos ecosystem + +Run + +```bash +yarn starship deploy +``` + +We use the config file `configs/config.yaml` as the genesis file to define the topology of the e2e test infra. Change it as required + +Note: Spinup will take some time, while you wait for the system, can check the progress in another tab with `kubectl get pods` + +## 4. Run the tests + +We have everything we need, our desired infrastructure is now running as intended, now we can run +our end-to-end tests. + +Run + +```bash +npm run starship:test +``` + +## 5. Stop the infra + +The tests should be ideompotent, so the tests can be run multiple times (which is recommeded), since the time to spinup is still high (around 5 to 10 mins). + +Once the state of the mini-cosmos is corrupted, you can stop the deployments with + +```bash +npm run starship clean +``` + +Which will + +- Stop port-forwarding the traffic to your local +- Delete all the helm charts deployed + +## 6. Cleanup kind (optional) + +If you are using kind for your kubernetes cluster, you can delete it with + +```bash +yarn starship clean-kind +``` + +## Related + +Checkout these related projects: + +- [@cosmology/telescope](https://github.com/hyperweb-io/telescope) Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. +- [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. +- [chain-registry](https://github.com/hyperweb-io/chain-registry) Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. +- [cosmos-kit](https://github.com/hyperweb-io/cosmos-kit) Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. +- [create-cosmos-app](https://github.com/hyperweb-io/create-cosmos-app) Set up a modern Cosmos app by running one command. +- [interchain-ui](https://github.com/hyperweb-io/interchain-ui) The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. +- [starship](https://github.com/hyperweb-io/starship) Unified Testing and Development for the Interchain. + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/packages/amino/README.mdx b/docs/packages/amino/README.mdx new file mode 100644 index 000000000..4f06d2861 --- /dev/null +++ b/docs/packages/amino/README.mdx @@ -0,0 +1,15 @@ +# @interchainjs/amino + +

+ +

+ +

+ + + + + +

+ +Helpers for Amino based signing. diff --git a/docs/packages/auth/README.mdx b/docs/packages/auth/README.mdx new file mode 100644 index 000000000..58e074409 --- /dev/null +++ b/docs/packages/auth/README.mdx @@ -0,0 +1,87 @@ +# @interchainjs/auth + +

+ +

+ +

+ + + + + +

+ +Authentication/Wallet for web3 accounts. + +## Usage + +```sh +npm install @interchainjs/auth +``` + +Taking `secp256k1` as example. + +```ts +import { Secp256k1Auth } from "@interchainjs/auth/secp256k1"; + +const [directAuth] = Secp256k1Auth.fromMnemonic(generateMnemonic(), [ + "m/44'/118'/0'/0/0", +]); +const signature = auth.sign(Uint8Array.from([1, 2, 3])); +console.log(signature.toHex()); +``` + +It's easy to derive _cosmos/injective/ethereum_ network HD path (taking `cosmos` as example) + +```ts +import { HDPath } from "@interchainjs/types"; + +// derive with Cosmos default HD path "m/44'/118'/0'/0/0" +const [auth] = Secp256k1Auth.fromMnemonic("", [ + // use cosmos hdpath built by HDPath + // we can get cosmos hdpath "m/44'/118'/0'/0/0" by this: + HDPath.cosmos().toString(), +]); +// is identical to +const [auth] = Secp256k1Auth.fromMnemonic("", [ + "m/44'/118'/0'/0/0", +]); +``` + +`Auth` objected can be utilized by different signers. See + +- [@interchainjs/cosmos](/networks/cosmos/README.md) +- [@interchainjs/ethereum](/networks/ethereum/README.md) +- [@interchainjs/injective](/networks/injective/README.md) + +## Implementations + +- **secp256k1 auth** from `@interchainjs/auth/secp256k1` +- **ethSecp256k1 auth** from `@interchainjs/auth/ethSecp256k1` + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/packages/crypto/README.mdx b/docs/packages/crypto/README.mdx new file mode 100644 index 000000000..4c3a7e3d9 --- /dev/null +++ b/docs/packages/crypto/README.mdx @@ -0,0 +1,19 @@ +# @interchainjs/crypto + +

+ +

+ +

+ + + + + +

+ +This package contains low-level cryptographic functionality used in other +`@interchainjs` libraries. Little of it is implemented here, but mainly it is a curation +of external libraries along with correctness tests. We add type safety, some +more checks, and a simple API to these libraries. This can also be freely +imported outside of `@interchainjs` based applications. diff --git a/docs/packages/encoding/README.mdx b/docs/packages/encoding/README.mdx new file mode 100644 index 000000000..e4c37c67b --- /dev/null +++ b/docs/packages/encoding/README.mdx @@ -0,0 +1,27 @@ +# @interchainjs/encoding + +

+ +

+ +

+ + + + + +

+ +This package is an extension to the JavaScript standard library that is not +bound to blockchain products. It provides basic hex/base64/ascii encoding to +Uint8Array that doesn't rely on Buffer and also provides better error messages +on invalid input. + +## Convert between bech32 and hex addresses + +``` +>> toBech32("tiov", fromHex("1234ABCD0000AA0000FFFF0000AA00001234ABCD")) +'tiov1zg62hngqqz4qqq8lluqqp2sqqqfrf27dzrrmea' +>> toHex(fromBech32("tiov1zg62hngqqz4qqq8lluqqp2sqqqfrf27dzrrmea").data) +'1234abcd0000aa0000ffff0000aa00001234abcd' +``` diff --git a/docs/packages/math/README.mdx b/docs/packages/math/README.mdx new file mode 100644 index 000000000..cf3c965fc --- /dev/null +++ b/docs/packages/math/README.mdx @@ -0,0 +1,15 @@ +# @interchainjs/math + +

+ +

+ +

+ + + + + +

+ +Math utilities diff --git a/docs/packages/pubkey/README.mdx b/docs/packages/pubkey/README.mdx new file mode 100644 index 000000000..2e4a0284f --- /dev/null +++ b/docs/packages/pubkey/README.mdx @@ -0,0 +1,15 @@ +# @interchainjs/pubkey + +

+ +

+ +

+ + + + + +

+ +Pubkey helpers for blockchain projects diff --git a/docs/packages/types/README.mdx b/docs/packages/types/README.mdx new file mode 100644 index 000000000..a46b6e92c --- /dev/null +++ b/docs/packages/types/README.mdx @@ -0,0 +1,39 @@ +# @interchainjs/types + +

+ +

+ +

+ + + + + +

+ +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/packages/utils/README.mdx b/docs/packages/utils/README.mdx new file mode 100644 index 000000000..8cc182032 --- /dev/null +++ b/docs/packages/utils/README.mdx @@ -0,0 +1,39 @@ +# @interchainjs/utils + +

+ +

+ +

+ + + + + +

+ +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/package.json b/package.json index de072c827..eebc39654 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "build:dev": "lerna run build:dev --stream; yarn symlink", "lint": "lerna run lint --parallel", "symlink": "symlink-workspace --logLevel error", - "postinstall": "yarn symlink" + "postinstall": "yarn symlink", + "doc": "./scripts/copy_readmes.sh" }, "devDependencies": { "@chain-registry/client": "1.18.1", diff --git a/scripts/copy_readmes.sh b/scripts/copy_readmes.sh new file mode 100755 index 000000000..8941a0f82 --- /dev/null +++ b/scripts/copy_readmes.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Set the project root directory +PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +DOCS_DIR="${PROJECT_ROOT}/docs" + +# Create docs directory if it doesn't exist +mkdir -p "${DOCS_DIR}" + +# Copy README.md files from libs, packages, and networks, excluding dist and node_modules +find "${PROJECT_ROOT}/libs" "${PROJECT_ROOT}/packages" "${PROJECT_ROOT}/networks" -type f -name "README.md" ! -path "*/dist/*" ! -path "*/node_modules/*" | while read file; do + target_dir="${DOCS_DIR}/$(dirname "${file#${PROJECT_ROOT}/}")" + mkdir -p "${target_dir}" + cp "${file}" "${target_dir}/README.mdx" + echo "README.md file copied to docs/$(dirname "${file#${PROJECT_ROOT}/}")/README.mdx" +done + +# Copy root README.md +cp "${PROJECT_ROOT}/README.md" "${DOCS_DIR}/README.mdx" + +echo "README.md files copied and renamed to README.mdx successfully!" \ No newline at end of file From ed34d91615d4eaca4dc2969abd044c7bda80d264 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 08:23:25 +0800 Subject: [PATCH 09/19] add meta files --- docs/_meta.json | 7 +++++++ docs/advanced/_meta.json | 8 ++++++++ docs/{README.mdx => index.mdx} | 0 docs/libs/_meta.json | 9 +++++++++ docs/libs/cosmos-types/_meta.json | 3 +++ docs/libs/cosmos-types/{README.mdx => index.mdx} | 0 docs/libs/injective-react/_meta.json | 3 +++ docs/libs/injective-react/{README.mdx => index.mdx} | 0 docs/libs/injective-vue/_meta.json | 3 +++ docs/libs/injective-vue/{README.mdx => index.mdx} | 0 docs/libs/injectivejs/_meta.json | 3 +++ docs/libs/injectivejs/{README.mdx => index.mdx} | 0 docs/libs/interchain-react/_meta.json | 3 +++ docs/libs/interchain-react/{README.mdx => index.mdx} | 0 docs/libs/interchain-vue/_meta.json | 3 +++ docs/libs/interchain-vue/{README.mdx => index.mdx} | 0 docs/libs/interchainjs/_meta.json | 4 ++++ docs/libs/interchainjs/{README.mdx => index.mdx} | 0 docs/libs/interchainjs/starship/_meta.json | 3 +++ .../interchainjs/starship/{README.mdx => index.mdx} | 0 docs/networks/_meta.json | 5 +++++ docs/networks/cosmos/_meta.json | 4 ++++ docs/networks/cosmos/{README.mdx => index.mdx} | 0 docs/networks/cosmos/starship/_meta.json | 3 +++ .../networks/cosmos/starship/{README.mdx => index.mdx} | 0 docs/networks/ethereum/_meta.json | 5 +++++ .../networks/ethereum/devnet/{README.mdx => index.mdx} | 0 docs/networks/ethereum/{README.mdx => index.mdx} | 0 .../ethereum/starship/{README.mdx => index.mdx} | 0 docs/networks/injective/_meta.json | 4 ++++ docs/networks/injective/{README.mdx => index.mdx} | 0 .../injective/starship/{README.mdx => index.mdx} | 0 docs/packages/_meta.json | 10 ++++++++++ docs/packages/amino/_meta.json | 3 +++ docs/packages/amino/{README.mdx => index.mdx} | 0 docs/packages/auth/{README.mdx => index.mdx} | 0 docs/packages/crypto/{README.mdx => index.mdx} | 0 docs/packages/encoding/{README.mdx => index.mdx} | 0 docs/packages/math/{README.mdx => index.mdx} | 0 docs/packages/pubkey/{README.mdx => index.mdx} | 0 docs/packages/types/{README.mdx => index.mdx} | 0 docs/packages/utils/{README.mdx => index.mdx} | 0 scripts/copy_readmes.sh | 8 ++++---- 43 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 docs/_meta.json create mode 100644 docs/advanced/_meta.json rename docs/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/_meta.json create mode 100644 docs/libs/cosmos-types/_meta.json rename docs/libs/cosmos-types/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/injective-react/_meta.json rename docs/libs/injective-react/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/injective-vue/_meta.json rename docs/libs/injective-vue/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/injectivejs/_meta.json rename docs/libs/injectivejs/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/interchain-react/_meta.json rename docs/libs/interchain-react/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/interchain-vue/_meta.json rename docs/libs/interchain-vue/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/interchainjs/_meta.json rename docs/libs/interchainjs/{README.mdx => index.mdx} (100%) create mode 100644 docs/libs/interchainjs/starship/_meta.json rename docs/libs/interchainjs/starship/{README.mdx => index.mdx} (100%) create mode 100644 docs/networks/_meta.json create mode 100644 docs/networks/cosmos/_meta.json rename docs/networks/cosmos/{README.mdx => index.mdx} (100%) create mode 100644 docs/networks/cosmos/starship/_meta.json rename docs/networks/cosmos/starship/{README.mdx => index.mdx} (100%) create mode 100644 docs/networks/ethereum/_meta.json rename docs/networks/ethereum/devnet/{README.mdx => index.mdx} (100%) rename docs/networks/ethereum/{README.mdx => index.mdx} (100%) rename docs/networks/ethereum/starship/{README.mdx => index.mdx} (100%) create mode 100644 docs/networks/injective/_meta.json rename docs/networks/injective/{README.mdx => index.mdx} (100%) rename docs/networks/injective/starship/{README.mdx => index.mdx} (100%) create mode 100644 docs/packages/_meta.json create mode 100644 docs/packages/amino/_meta.json rename docs/packages/amino/{README.mdx => index.mdx} (100%) rename docs/packages/auth/{README.mdx => index.mdx} (100%) rename docs/packages/crypto/{README.mdx => index.mdx} (100%) rename docs/packages/encoding/{README.mdx => index.mdx} (100%) rename docs/packages/math/{README.mdx => index.mdx} (100%) rename docs/packages/pubkey/{README.mdx => index.mdx} (100%) rename docs/packages/types/{README.mdx => index.mdx} (100%) rename docs/packages/utils/{README.mdx => index.mdx} (100%) diff --git a/docs/_meta.json b/docs/_meta.json new file mode 100644 index 000000000..00dd55299 --- /dev/null +++ b/docs/_meta.json @@ -0,0 +1,7 @@ +{ + "index": "Overview", + "networks": "Networks", + "packages": "Packages", + "libs": "Libraries", + "advanced": "Advanced" +} \ No newline at end of file diff --git a/docs/advanced/_meta.json b/docs/advanced/_meta.json new file mode 100644 index 000000000..a526c8cd8 --- /dev/null +++ b/docs/advanced/_meta.json @@ -0,0 +1,8 @@ +{ + "auth-wallet-signer": "Auth Wallet Signer", + "auth": "Auth", + "migration-from-cosmjs": "Migration from CosmJS", + "signer": "Signer", + "tutorial": "Tutorial", + "wallet": "Wallet" +} \ No newline at end of file diff --git a/docs/README.mdx b/docs/index.mdx similarity index 100% rename from docs/README.mdx rename to docs/index.mdx diff --git a/docs/libs/_meta.json b/docs/libs/_meta.json new file mode 100644 index 000000000..f0802add7 --- /dev/null +++ b/docs/libs/_meta.json @@ -0,0 +1,9 @@ +{ + "injective-vue": "Injective Vue", + "injective-react": "Injective React", + "interchainjs": "InterchainJS", + "interchain-vue": "Interchain Vue", + "interchain-react": "Interchain React", + "injectivejs": "InjectiveJS", + "cosmos-types": "Cosmos Types" +} \ No newline at end of file diff --git a/docs/libs/cosmos-types/_meta.json b/docs/libs/cosmos-types/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/cosmos-types/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/cosmos-types/README.mdx b/docs/libs/cosmos-types/index.mdx similarity index 100% rename from docs/libs/cosmos-types/README.mdx rename to docs/libs/cosmos-types/index.mdx diff --git a/docs/libs/injective-react/_meta.json b/docs/libs/injective-react/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/injective-react/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/injective-react/README.mdx b/docs/libs/injective-react/index.mdx similarity index 100% rename from docs/libs/injective-react/README.mdx rename to docs/libs/injective-react/index.mdx diff --git a/docs/libs/injective-vue/_meta.json b/docs/libs/injective-vue/_meta.json new file mode 100644 index 000000000..ca0a2a6cb --- /dev/null +++ b/docs/libs/injective-vue/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} diff --git a/docs/libs/injective-vue/README.mdx b/docs/libs/injective-vue/index.mdx similarity index 100% rename from docs/libs/injective-vue/README.mdx rename to docs/libs/injective-vue/index.mdx diff --git a/docs/libs/injectivejs/_meta.json b/docs/libs/injectivejs/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/injectivejs/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/injectivejs/README.mdx b/docs/libs/injectivejs/index.mdx similarity index 100% rename from docs/libs/injectivejs/README.mdx rename to docs/libs/injectivejs/index.mdx diff --git a/docs/libs/interchain-react/_meta.json b/docs/libs/interchain-react/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/interchain-react/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/interchain-react/README.mdx b/docs/libs/interchain-react/index.mdx similarity index 100% rename from docs/libs/interchain-react/README.mdx rename to docs/libs/interchain-react/index.mdx diff --git a/docs/libs/interchain-vue/_meta.json b/docs/libs/interchain-vue/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/interchain-vue/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/interchain-vue/README.mdx b/docs/libs/interchain-vue/index.mdx similarity index 100% rename from docs/libs/interchain-vue/README.mdx rename to docs/libs/interchain-vue/index.mdx diff --git a/docs/libs/interchainjs/_meta.json b/docs/libs/interchainjs/_meta.json new file mode 100644 index 000000000..903f95c72 --- /dev/null +++ b/docs/libs/interchainjs/_meta.json @@ -0,0 +1,4 @@ +{ + "index": "Overview", + "starship": "Starship" +} \ No newline at end of file diff --git a/docs/libs/interchainjs/README.mdx b/docs/libs/interchainjs/index.mdx similarity index 100% rename from docs/libs/interchainjs/README.mdx rename to docs/libs/interchainjs/index.mdx diff --git a/docs/libs/interchainjs/starship/_meta.json b/docs/libs/interchainjs/starship/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/libs/interchainjs/starship/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/libs/interchainjs/starship/README.mdx b/docs/libs/interchainjs/starship/index.mdx similarity index 100% rename from docs/libs/interchainjs/starship/README.mdx rename to docs/libs/interchainjs/starship/index.mdx diff --git a/docs/networks/_meta.json b/docs/networks/_meta.json new file mode 100644 index 000000000..6b118bb4e --- /dev/null +++ b/docs/networks/_meta.json @@ -0,0 +1,5 @@ +{ + "ethereum": "Ethereum", + "injective": "Injective", + "cosmos": "Cosmos" +} \ No newline at end of file diff --git a/docs/networks/cosmos/_meta.json b/docs/networks/cosmos/_meta.json new file mode 100644 index 000000000..903f95c72 --- /dev/null +++ b/docs/networks/cosmos/_meta.json @@ -0,0 +1,4 @@ +{ + "index": "Overview", + "starship": "Starship" +} \ No newline at end of file diff --git a/docs/networks/cosmos/README.mdx b/docs/networks/cosmos/index.mdx similarity index 100% rename from docs/networks/cosmos/README.mdx rename to docs/networks/cosmos/index.mdx diff --git a/docs/networks/cosmos/starship/_meta.json b/docs/networks/cosmos/starship/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/networks/cosmos/starship/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/networks/cosmos/starship/README.mdx b/docs/networks/cosmos/starship/index.mdx similarity index 100% rename from docs/networks/cosmos/starship/README.mdx rename to docs/networks/cosmos/starship/index.mdx diff --git a/docs/networks/ethereum/_meta.json b/docs/networks/ethereum/_meta.json new file mode 100644 index 000000000..0535bd585 --- /dev/null +++ b/docs/networks/ethereum/_meta.json @@ -0,0 +1,5 @@ +{ + "index": "Overview", + "devnet": "Devnet", + "starship": "Starship" +} \ No newline at end of file diff --git a/docs/networks/ethereum/devnet/README.mdx b/docs/networks/ethereum/devnet/index.mdx similarity index 100% rename from docs/networks/ethereum/devnet/README.mdx rename to docs/networks/ethereum/devnet/index.mdx diff --git a/docs/networks/ethereum/README.mdx b/docs/networks/ethereum/index.mdx similarity index 100% rename from docs/networks/ethereum/README.mdx rename to docs/networks/ethereum/index.mdx diff --git a/docs/networks/ethereum/starship/README.mdx b/docs/networks/ethereum/starship/index.mdx similarity index 100% rename from docs/networks/ethereum/starship/README.mdx rename to docs/networks/ethereum/starship/index.mdx diff --git a/docs/networks/injective/_meta.json b/docs/networks/injective/_meta.json new file mode 100644 index 000000000..903f95c72 --- /dev/null +++ b/docs/networks/injective/_meta.json @@ -0,0 +1,4 @@ +{ + "index": "Overview", + "starship": "Starship" +} \ No newline at end of file diff --git a/docs/networks/injective/README.mdx b/docs/networks/injective/index.mdx similarity index 100% rename from docs/networks/injective/README.mdx rename to docs/networks/injective/index.mdx diff --git a/docs/networks/injective/starship/README.mdx b/docs/networks/injective/starship/index.mdx similarity index 100% rename from docs/networks/injective/starship/README.mdx rename to docs/networks/injective/starship/index.mdx diff --git a/docs/packages/_meta.json b/docs/packages/_meta.json new file mode 100644 index 000000000..842ef9a13 --- /dev/null +++ b/docs/packages/_meta.json @@ -0,0 +1,10 @@ +{ + "amino": "Amino", + "math": "Math", + "utils": "Utils", + "encoding": "Encoding", + "pubkey": "Pubkey", + "auth": "Auth", + "types": "Types", + "crypto": "Crypto" +} \ No newline at end of file diff --git a/docs/packages/amino/_meta.json b/docs/packages/amino/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/amino/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/amino/README.mdx b/docs/packages/amino/index.mdx similarity index 100% rename from docs/packages/amino/README.mdx rename to docs/packages/amino/index.mdx diff --git a/docs/packages/auth/README.mdx b/docs/packages/auth/index.mdx similarity index 100% rename from docs/packages/auth/README.mdx rename to docs/packages/auth/index.mdx diff --git a/docs/packages/crypto/README.mdx b/docs/packages/crypto/index.mdx similarity index 100% rename from docs/packages/crypto/README.mdx rename to docs/packages/crypto/index.mdx diff --git a/docs/packages/encoding/README.mdx b/docs/packages/encoding/index.mdx similarity index 100% rename from docs/packages/encoding/README.mdx rename to docs/packages/encoding/index.mdx diff --git a/docs/packages/math/README.mdx b/docs/packages/math/index.mdx similarity index 100% rename from docs/packages/math/README.mdx rename to docs/packages/math/index.mdx diff --git a/docs/packages/pubkey/README.mdx b/docs/packages/pubkey/index.mdx similarity index 100% rename from docs/packages/pubkey/README.mdx rename to docs/packages/pubkey/index.mdx diff --git a/docs/packages/types/README.mdx b/docs/packages/types/index.mdx similarity index 100% rename from docs/packages/types/README.mdx rename to docs/packages/types/index.mdx diff --git a/docs/packages/utils/README.mdx b/docs/packages/utils/index.mdx similarity index 100% rename from docs/packages/utils/README.mdx rename to docs/packages/utils/index.mdx diff --git a/scripts/copy_readmes.sh b/scripts/copy_readmes.sh index 8941a0f82..fc4c93d3e 100755 --- a/scripts/copy_readmes.sh +++ b/scripts/copy_readmes.sh @@ -11,11 +11,11 @@ mkdir -p "${DOCS_DIR}" find "${PROJECT_ROOT}/libs" "${PROJECT_ROOT}/packages" "${PROJECT_ROOT}/networks" -type f -name "README.md" ! -path "*/dist/*" ! -path "*/node_modules/*" | while read file; do target_dir="${DOCS_DIR}/$(dirname "${file#${PROJECT_ROOT}/}")" mkdir -p "${target_dir}" - cp "${file}" "${target_dir}/README.mdx" - echo "README.md file copied to docs/$(dirname "${file#${PROJECT_ROOT}/}")/README.mdx" + cp "${file}" "${target_dir}/index.mdx" + echo "README.md file copied to docs/$(dirname "${file#${PROJECT_ROOT}/}")/index.mdx" done # Copy root README.md -cp "${PROJECT_ROOT}/README.md" "${DOCS_DIR}/README.mdx" +cp "${PROJECT_ROOT}/README.md" "${DOCS_DIR}/index.mdx" -echo "README.md files copied and renamed to README.mdx successfully!" \ No newline at end of file +echo "README.md files copied and renamed to index.mdx successfully!" \ No newline at end of file From e014089dbd14e4599d53cf7079c244ebbb46c935 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 08:28:46 +0800 Subject: [PATCH 10/19] add meta files --- docs/networks/ethereum/devnet/_meta.json | 3 + docs/networks/ethereum/starship/_meta.json | 3 + docs/networks/injective/starship/_meta.json | 3 + docs/packages/auth/_meta.json | 3 + docs/packages/crypto/_meta.json | 3 + docs/packages/encoding/_meta.json | 3 + docs/packages/math/_meta.json | 3 + docs/packages/pubkey/_meta.json | 3 + docs/packages/types/_meta.json | 3 + docs/packages/utils/_meta.json | 3 + scripts/generate_meta_json.sh | 18 ++++ scripts/generate_meta_json.ts | 106 ++++++++++++++++++++ 12 files changed, 154 insertions(+) create mode 100644 docs/networks/ethereum/devnet/_meta.json create mode 100644 docs/networks/ethereum/starship/_meta.json create mode 100644 docs/networks/injective/starship/_meta.json create mode 100644 docs/packages/auth/_meta.json create mode 100644 docs/packages/crypto/_meta.json create mode 100644 docs/packages/encoding/_meta.json create mode 100644 docs/packages/math/_meta.json create mode 100644 docs/packages/pubkey/_meta.json create mode 100644 docs/packages/types/_meta.json create mode 100644 docs/packages/utils/_meta.json create mode 100755 scripts/generate_meta_json.sh create mode 100644 scripts/generate_meta_json.ts diff --git a/docs/networks/ethereum/devnet/_meta.json b/docs/networks/ethereum/devnet/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/networks/ethereum/devnet/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/networks/ethereum/starship/_meta.json b/docs/networks/ethereum/starship/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/networks/ethereum/starship/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/networks/injective/starship/_meta.json b/docs/networks/injective/starship/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/networks/injective/starship/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/auth/_meta.json b/docs/packages/auth/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/auth/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/crypto/_meta.json b/docs/packages/crypto/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/crypto/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/encoding/_meta.json b/docs/packages/encoding/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/encoding/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/math/_meta.json b/docs/packages/math/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/math/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/pubkey/_meta.json b/docs/packages/pubkey/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/pubkey/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/types/_meta.json b/docs/packages/types/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/types/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/docs/packages/utils/_meta.json b/docs/packages/utils/_meta.json new file mode 100644 index 000000000..356de82b4 --- /dev/null +++ b/docs/packages/utils/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Overview" +} \ No newline at end of file diff --git a/scripts/generate_meta_json.sh b/scripts/generate_meta_json.sh new file mode 100755 index 000000000..15e98d172 --- /dev/null +++ b/scripts/generate_meta_json.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Get the directory where the script is located +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Change to the root directory +cd "$SCRIPT_DIR/.." + +# Run the TypeScript script using ts-node +# Check if ts-node is installed +if command -v npx &> /dev/null; then + npx ts-node "$SCRIPT_DIR/generate_meta_json.ts" +else + echo "Error: npx not found. Please install Node.js and npm." + exit 1 +fi + +echo "Meta JSON generation complete!" \ No newline at end of file diff --git a/scripts/generate_meta_json.ts b/scripts/generate_meta_json.ts new file mode 100644 index 000000000..237455641 --- /dev/null +++ b/scripts/generate_meta_json.ts @@ -0,0 +1,106 @@ +import fs from 'fs'; +import path from 'path'; + +// Base directory for docs +const DOCS_DIR = path.resolve(__dirname, '../docs'); + +/** + * Format a filename or directory name to a readable title + */ +function formatTitle(name: string): string { + // Remove file extension for files + name = name.replace(/\.(mdx?|tsx?|jsx?)$/, ''); + + // Special case for 'index' + if (name === 'index') { + return 'Overview'; + } + + // Replace hyphens with spaces + let title = name.replace(/-/g, ' '); + + // Capitalize each word + title = title.split(' ') + .map(word => word.charAt(0).toUpperCase() + word.slice(1)) + .join(' '); + + return title; +} + +/** + * Generate _meta.json content for a directory + */ +function generateMetaContent(dirPath: string): Record { + const entries = fs.readdirSync(dirPath, { withFileTypes: true }); + const meta: Record = {}; + + // Process files first (excluding _meta.json) + entries + .filter(entry => entry.isFile() && entry.name !== '_meta.json' && !entry.name.startsWith('.')) + .forEach(entry => { + // Extract name without extension + const baseName = path.basename(entry.name, path.extname(entry.name)); + meta[baseName] = formatTitle(baseName); + }); + + // Then process directories + entries + .filter(entry => entry.isDirectory() && !entry.name.startsWith('.')) + .forEach(entry => { + meta[entry.name] = formatTitle(entry.name); + }); + + // If we have an index file, make sure it's first + if (meta.index) { + const { index, ...rest } = meta; + return { index, ...rest }; + } + + return meta; +} + +/** + * Create _meta.json file in directory if it doesn't exist + */ +function createMetaFile(dirPath: string): void { + const metaPath = path.join(dirPath, '_meta.json'); + + // If _meta.json already exists, skip + if (fs.existsSync(metaPath)) { + console.log(`✓ Exists: ${metaPath}`); + return; + } + + // Generate content + const content = generateMetaContent(dirPath); + + // Write to file + fs.writeFileSync(metaPath, JSON.stringify(content, null, 2), 'utf8'); + console.log(`✓ Created: ${metaPath}`); +} + +/** + * Recursively process directories and create _meta.json files + */ +function processDirectory(dirPath: string): void { + // Create _meta.json for current directory + createMetaFile(dirPath); + + // Process all subdirectories + const entries = fs.readdirSync(dirPath, { withFileTypes: true }); + entries + .filter(entry => entry.isDirectory() && !entry.name.startsWith('.')) + .forEach(entry => { + const subdirPath = path.join(dirPath, entry.name); + processDirectory(subdirPath); + }); +} + +// Main function +function main(): void { + console.log('Generating _meta.json files...'); + processDirectory(DOCS_DIR); + console.log('Done!'); +} + +main(); \ No newline at end of file From 76cb02d7c62cf265ce5773e7ace699cfbb3a7110 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 08:50:50 +0800 Subject: [PATCH 11/19] fix html --- docs/index.mdx | 90 +++++++++++-------- docs/libs/cosmos-types/index.mdx | 56 ++++++++---- docs/libs/injective-react/index.mdx | 39 ++++++--- docs/libs/injective-vue/index.mdx | 34 ++++++-- docs/libs/injectivejs/index.mdx | 39 ++++++--- docs/libs/interchain-react/index.mdx | 74 ++++++++++------ docs/libs/interchain-vue/index.mdx | 101 +++++++++++++--------- docs/libs/interchainjs/index.mdx | 39 ++++++--- docs/networks/cosmos/index.mdx | 100 ++++++++++++--------- docs/networks/ethereum/index.mdx | 125 +++++++++++++++------------ docs/networks/injective/index.mdx | 47 ++++++---- docs/packages/amino/index.mdx | 34 ++++++-- docs/packages/auth/index.mdx | 56 ++++++++---- docs/packages/crypto/index.mdx | 34 ++++++-- docs/packages/encoding/index.mdx | 34 ++++++-- docs/packages/math/index.mdx | 34 ++++++-- docs/packages/pubkey/index.mdx | 34 ++++++-- docs/packages/types/index.mdx | 56 ++++++++---- docs/packages/utils/index.mdx | 56 ++++++++---- 19 files changed, 733 insertions(+), 349 deletions(-) diff --git a/docs/index.mdx b/docs/index.mdx index 5bccf1397..cc3a40228 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -1,15 +1,37 @@ # InterchainJS -

- +

+

-

+

- + + + + + + + - -

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. @@ -86,16 +108,14 @@ graph LR style utils fill:#ccf,stroke:#333,stroke-width:2px ``` - --- - ## Tutorials & Documentation -| Topic | Documentation | -|----------------------------------|--------------| -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | +| Topic | Documentation | +| ---------------------------- | ----------------------------- | +| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | +| **Advanced Documentation** | [View Docs](/docs/) | --- @@ -103,9 +123,9 @@ graph LR The authentication module is universally applied across different networks. -| Package | Description | -|---------|-------------| -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| Package | Description | +| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | | [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | --- @@ -114,26 +134,26 @@ The authentication module is universally applied across different networks. ### Cosmos Network -| Feature | Package | -|---------|---------| -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | +| Feature | Package | +| ---------------------------- | ------------------------------------------------------------- | +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | --- ### Injective Network -| Feature | Package | -|---------|---------| +| Feature | Package | +| ---------------- | -------------------------------------------------------- | | **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | --- ### Ethereum Network -| Feature | Package | -|---------|---------| +| Feature | Package | +| ---------------- | ------------------------------------------------------ | | **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | --- @@ -142,17 +162,17 @@ The authentication module is universally applied across different networks. A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/libs/cosmos-types/index.mdx b/docs/libs/cosmos-types/index.mdx index b97d59051..2e16e7e9d 100644 --- a/docs/libs/cosmos-types/index.mdx +++ b/docs/libs/cosmos-types/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/cosmos-types -

- +

+

-

+

- + + + + + + + - -

Fundamental types for Networks/Cosmos to use. @@ -20,17 +42,17 @@ Generated by Telescope. (Will generate code with less redundancy in future versi A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/libs/injective-react/index.mdx b/docs/libs/injective-react/index.mdx index 50d1fcae4..a3fc6d14e 100644 --- a/docs/libs/injective-react/index.mdx +++ b/docs/libs/injective-react/index.mdx @@ -1,15 +1,37 @@ # injective-react -

- +

+

-

+

- + + + + + + + - -

## install @@ -279,10 +301,7 @@ import { depositValidatorRewardsPool, } from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; -import { - send, - multiSend, -} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; import { delegate, diff --git a/docs/libs/injective-vue/index.mdx b/docs/libs/injective-vue/index.mdx index 610dae17e..bca3542d2 100644 --- a/docs/libs/injective-vue/index.mdx +++ b/docs/libs/injective-vue/index.mdx @@ -1,15 +1,37 @@ # injective-vue -

- +

+

-

+

- + + + + + + + - -

## install diff --git a/docs/libs/injectivejs/index.mdx b/docs/libs/injectivejs/index.mdx index a97344d49..f1442d2e8 100644 --- a/docs/libs/injectivejs/index.mdx +++ b/docs/libs/injectivejs/index.mdx @@ -1,15 +1,37 @@ # InjectiveJS -

- +

+

-

+

- + + + + + + + - -

## install @@ -238,10 +260,7 @@ import { depositValidatorRewardsPool, } from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; -import { - send, - multiSend, -} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; import { delegate, diff --git a/docs/libs/interchain-react/index.mdx b/docs/libs/interchain-react/index.mdx index a3ad92e2f..fc54bfc09 100644 --- a/docs/libs/interchain-react/index.mdx +++ b/docs/libs/interchain-react/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/react -

- +

+

-

+

- + + + + + + + - -

React query helper hooks(Tx, Query) generated by Telescope. @@ -49,17 +71,16 @@ import { defaultContext } from "@tanstack/react-query"; import { useGetBalance } from "@interchainjs/react/cosmos/bank/v1beta1/query.rpc.react"; // Initialize RPC endpoint and address -const { rpcEndpoint } = - useQueryHooks(defaultChainName, { - context: defaultContext, - enabled: !!address, - }); +const { rpcEndpoint } = useQueryHooks(defaultChainName, { + context: defaultContext, + enabled: !!address, +}); //Now you can get balance by tree shakable hooks const balanceRes = useGetBalance({ request: { - address: address || '', - denom: 'osmo', + address: address || "", + denom: "osmo", }, options: { context: defaultContext, @@ -68,9 +89,9 @@ const balanceRes = useGetBalance({ staleTime: 0, }, clientResolver: rpcEndpoint, -}) +}); -const balance = balanceRes?.data +const balance = balanceRes?.data; ``` #### Available Helper Types @@ -122,22 +143,21 @@ const result = await delegate( By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. - ## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/libs/interchain-vue/index.mdx b/docs/libs/interchain-vue/index.mdx index 24b9e6fb3..6f54191ab 100644 --- a/docs/libs/interchain-vue/index.mdx +++ b/docs/libs/interchain-vue/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/vue -

- +

+

-

+

- + + + + + + + - -

React query helper hooks(Tx, Query) generated by Telescope. @@ -45,30 +67,30 @@ For example, customized hooks are functions that return the result you want: ```typescript // Import only what you need -import { useGetBalance } from '@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue'; +import { useGetBalance } from "@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue"; // Initialize RPC endpoint and address, then you can get balance by tree shakable hooks - const request = computed(() => ({ - address: address.value, - denom, - })); - - const { - data: balance, - isSuccess: isBalanceLoaded, - isLoading: isFetchingBalance, - refetch: refetchBalance - } = useGetBalance({ - request, - options: { - enabled: !!address, - select: ({ balance }) => - new BigNumber(balance?.amount ?? 0).multipliedBy( - 10 ** -COIN_DISPLAY_EXPONENT - ), - }, - clientResolver: rpcEndpoint, - }) +const request = computed(() => ({ + address: address.value, + denom, +})); + +const { + data: balance, + isSuccess: isBalanceLoaded, + isLoading: isFetchingBalance, + refetch: refetchBalance, +} = useGetBalance({ + request, + options: { + enabled: !!address, + select: ({ balance }) => + new BigNumber(balance?.amount ?? 0).multipliedBy( + 10 ** -COIN_DISPLAY_EXPONENT + ), + }, + clientResolver: rpcEndpoint, +}); ``` #### Available Helper Types @@ -119,22 +141,21 @@ const result = await delegate( By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. - ## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/libs/interchainjs/index.mdx b/docs/libs/interchainjs/index.mdx index fc50888a5..f182d0c0f 100644 --- a/docs/libs/interchainjs/index.mdx +++ b/docs/libs/interchainjs/index.mdx @@ -1,15 +1,37 @@ # InterchainJS -

- +

+

-

+

- + + + + + + + - -

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. @@ -264,10 +286,7 @@ import { } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; // tx helpers -import { - send, - multiSend, -} from "@interchainjs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "@interchainjs/cosmos/bank/v1beta1/tx.rpc.func"; ``` ##### Circuit diff --git a/docs/networks/cosmos/index.mdx b/docs/networks/cosmos/index.mdx index 2acffcf39..3fe9a9f15 100644 --- a/docs/networks/cosmos/index.mdx +++ b/docs/networks/cosmos/index.mdx @@ -1,15 +1,39 @@ # @interchainjs/cosmos -

- +

+

-

- - - +

+ + + + + +

Transaction codec and client to communicate with any cosmos blockchain. @@ -23,7 +47,7 @@ npm install @interchainjs/cosmos Example for signing client here: ```ts -import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; const signingClient = await CosmosSigningClient.connectWithSigner( await getRpcEndpoint(), @@ -43,13 +67,12 @@ const signingClient = await CosmosSigningClient.connectWithSigner( // sign and broadcast const result = await signingClient.signAndBroadcast([]); console.log(result.hash); // the hash of TxRaw - ``` Or use the tree shakable helper functions (**Most Recommended**) we generate in interchainjs libs: ```ts -import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; const signingClient = await CosmosSigningClient.connectWithSigner( @@ -73,12 +96,12 @@ const result = await submitProposal( proposer: directAddress, initialDeposit: [ { - amount: '1000000', + amount: "1000000", denom: denom, }, ], content: { - typeUrl: '/cosmos.gov.v1beta1.TextProposal', + typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(contentMsg).finish(), }, }, @@ -95,26 +118,25 @@ import { DirectSigner } from "@interchainjs/cosmos/signers/direct"; // const signer = new DirectSigner(, [], ); // **ONLY** rpc endpoint is supported for now const signer = new DirectSigner( - directAuth, - // as many as possible encoders registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - rpcEndpoint, - { prefix: chainInfo.chain.bech32_prefix } - ); + directAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } +); const aminoSigner = new AminoSigner( - aminoAuth, - // as many as possible encoders registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - // as many as possible converters registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - rpcEndpoint, - { prefix: chainInfo.chain.bech32_prefix } - ); + aminoAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + // as many as possible converters registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } +); const result = await signer.signAndBroadcast([]); console.log(result.hash); // the hash of TxRaw ``` - - See [@interchainjs/auth](/packages/auth/README.md) to construct `` - See [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) to construct ``s and ``s, and also different message types. @@ -127,17 +149,17 @@ console.log(result.hash); // the hash of TxRaw A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/networks/ethereum/index.mdx b/docs/networks/ethereum/index.mdx index 24863007a..901a3cd55 100644 --- a/docs/networks/ethereum/index.mdx +++ b/docs/networks/ethereum/index.mdx @@ -4,12 +4,25 @@

-

- - - +

+ + + + + +

Transaction codec and client to communicate with ethereum blockchain. @@ -23,13 +36,13 @@ npm install @interchainjs/ethereum ### Using private key ```typescript -import { SignerFromPrivateKey } from "@interchainjs/ethereum/signers/SignerFromPrivateKey" -const signer = new SignerFromPrivateKey(privateKey, RPC_URL) +import { SignerFromPrivateKey } from "@interchainjs/ethereum/signers/SignerFromPrivateKey"; +const signer = new SignerFromPrivateKey(privateKey, RPC_URL); const { txHash, wait } = await signer.sendEIP1559TransactionAutoGasLimit( recipientAddress, amount -) -const receipt = await wait() +); +const receipt = await wait(); ``` ```typescript @@ -81,62 +94,60 @@ console.log("Signature valid:", isValid) const estimatedGas: bigint = await signer.estimateGas( recipientAddress, 500000000000000000n, // 0.5 ETH - '0x' // optional data -) -console.log('Estimated gas:', estimatedGas.toString()) + "0x" // optional data +); +console.log("Estimated gas:", estimatedGas.toString()); ``` ```typescript // Deploy a smart contract -const bytecode = '0x...'; // compiled contract bytecode -const { txHash: deployHash, wait: deployWait } = await signer.sendLegacyTransactionAutoGasLimit( - '', - 0n, - bytecode -) -const deployReceipt = await deployWait() -console.log('Contract deployed at:', deployReceipt.contractAddress) +const bytecode = "0x..."; // compiled contract bytecode +const { txHash: deployHash, wait: deployWait } = + await signer.sendLegacyTransactionAutoGasLimit("", 0n, bytecode); +const deployReceipt = await deployWait(); +console.log("Contract deployed at:", deployReceipt.contractAddress); ``` ```typescript // Interact with a deployed contract (transfer ERC20 tokens) -import { ContractEncoder } from "@interchainjs/ethereum/utils/ContractEncoder" -const abi = [ /* ERC20 contract ABI */ ] -const contractAddress = deployReceipt.contractAddress -const contract = new ContractEncoder(abi) -const dataHex = contract.transfer(recipientAddress, 1000000n) -const { txHash: tokenHash, wait: tokenWait } = await signer.sendLegacyTransactionAutoGasLimit( - contractAddress, - 0n, - dataHex -) -const tokenReceipt = await tokenWait() -console.log('Token transfer receipt:', tokenReceipt) +import { ContractEncoder } from "@interchainjs/ethereum/utils/ContractEncoder"; +const abi = [ + /* ERC20 contract ABI */ +]; +const contractAddress = deployReceipt.contractAddress; +const contract = new ContractEncoder(abi); +const dataHex = contract.transfer(recipientAddress, 1000000n); +const { txHash: tokenHash, wait: tokenWait } = + await signer.sendLegacyTransactionAutoGasLimit(contractAddress, 0n, dataHex); +const tokenReceipt = await tokenWait(); +console.log("Token transfer receipt:", tokenReceipt); ``` ```typescript // Monitor contract events via WebSocket -import { WebSocketContractMonitor } from "@interchainjs/ethereum/providers/WebSocketContractMonitor" -const wsUrl = 'ws://127.0.0.1:8546' -const monitor = new WebSocketContractMonitor(contractAddress, abi, wsUrl) -await monitor.connect() -monitor.on('Transfer', (event) => { - console.log('Transfer event:', event) -}) +import { WebSocketContractMonitor } from "@interchainjs/ethereum/providers/WebSocketContractMonitor"; +const wsUrl = "ws://127.0.0.1:8546"; +const monitor = new WebSocketContractMonitor(contractAddress, abi, wsUrl); +await monitor.connect(); +monitor.on("Transfer", (event) => { + console.log("Transfer event:", event); +}); ``` + See more usages in the [unit test](starship/__tests__/token.test.ts) ### In the frontend -``` typescript -import { SignerFromBrowser } from "@interchainjs/ethereum/signers/SignerFromBrowser" -const signer = new SignerFromBrowser(window.ethereum) +```typescript +import { SignerFromBrowser } from "@interchainjs/ethereum/signers/SignerFromBrowser"; +const signer = new SignerFromBrowser(window.ethereum); const tx = await signer.send({ to: recipientAddress, - value: BigInt(10**18), -}) -const receipt = await tx.wait() + value: BigInt(10 ** 18), +}); +const receipt = await tx.wait(); ``` + For more details, see this example: https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/ethereum/app/page.tsx ## Implementations @@ -148,17 +159,17 @@ For more details, see this example: https://github.com/hyperweb-io/create-interc A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/networks/injective/index.mdx b/docs/networks/injective/index.mdx index a428d6ffe..c95a58259 100644 --- a/docs/networks/injective/index.mdx +++ b/docs/networks/injective/index.mdx @@ -4,12 +4,25 @@

-

- - - +

+ + + + + +

Transaction codec and client to communicate with any injective blockchain. @@ -43,17 +56,17 @@ console.log(result.hash); // the hash of TxRaw A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/packages/amino/index.mdx b/docs/packages/amino/index.mdx index 4f06d2861..232fcf21f 100644 --- a/docs/packages/amino/index.mdx +++ b/docs/packages/amino/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/amino -

- +

+

-

+

- + + + + + + + - -

Helpers for Amino based signing. diff --git a/docs/packages/auth/index.mdx b/docs/packages/auth/index.mdx index 58e074409..fb99a1ba9 100644 --- a/docs/packages/auth/index.mdx +++ b/docs/packages/auth/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/auth -

- +

+

-

+

- + + + + + + + - -

Authentication/Wallet for web3 accounts. @@ -64,17 +86,17 @@ const [auth] = Secp256k1Auth.fromMnemonic("", [ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/packages/crypto/index.mdx b/docs/packages/crypto/index.mdx index 4c3a7e3d9..5130e9aa4 100644 --- a/docs/packages/crypto/index.mdx +++ b/docs/packages/crypto/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/crypto -

- +

+

-

+

- + + + + + + + - -

This package contains low-level cryptographic functionality used in other diff --git a/docs/packages/encoding/index.mdx b/docs/packages/encoding/index.mdx index e4c37c67b..9654dd020 100644 --- a/docs/packages/encoding/index.mdx +++ b/docs/packages/encoding/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/encoding -

- +

+

-

+

- + + + + + + + - -

This package is an extension to the JavaScript standard library that is not diff --git a/docs/packages/math/index.mdx b/docs/packages/math/index.mdx index cf3c965fc..cb0a96219 100644 --- a/docs/packages/math/index.mdx +++ b/docs/packages/math/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/math -

- +

+

-

+

- + + + + + + + - -

Math utilities diff --git a/docs/packages/pubkey/index.mdx b/docs/packages/pubkey/index.mdx index 2e4a0284f..dc0d065f0 100644 --- a/docs/packages/pubkey/index.mdx +++ b/docs/packages/pubkey/index.mdx @@ -1,15 +1,37 @@ # @interchainjs/pubkey -

- +

+

-

+

- + + + + + + + - -

Pubkey helpers for blockchain projects diff --git a/docs/packages/types/index.mdx b/docs/packages/types/index.mdx index a46b6e92c..886096eac 100644 --- a/docs/packages/types/index.mdx +++ b/docs/packages/types/index.mdx @@ -1,32 +1,54 @@ # @interchainjs/types -

- +

+

-

+

- + + + + + + + - -

## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/docs/packages/utils/index.mdx b/docs/packages/utils/index.mdx index 8cc182032..6f3e77796 100644 --- a/docs/packages/utils/index.mdx +++ b/docs/packages/utils/index.mdx @@ -1,32 +1,54 @@ # @interchainjs/utils -

- +

+

-

+

- + + + + + + + - -

## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits From 527aa59d64c97f877de841a3ac539d27cad76789 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 09:03:04 +0800 Subject: [PATCH 12/19] fix styles --- docs/networks/ethereum/index.mdx | 7 +++++-- docs/networks/injective/index.mdx | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/networks/ethereum/index.mdx b/docs/networks/ethereum/index.mdx index 901a3cd55..84f03238e 100644 --- a/docs/networks/ethereum/index.mdx +++ b/docs/networks/ethereum/index.mdx @@ -1,7 +1,10 @@ # @interchainjs/ethereum -

- +

+

- +

+

Date: Mon, 19 May 2025 09:19:38 +0800 Subject: [PATCH 13/19] fix style for README --- README.md | 90 +++++++++++++--------- libs/cosmos-types/README.md | 56 ++++++++++---- libs/injective-react/README.md | 39 +++++++--- libs/injective-vue/README.md | 34 ++++++-- libs/injectivejs/README.md | 39 +++++++--- libs/interchain-react/README.md | 74 +++++++++++------- libs/interchain-vue/README.md | 101 ++++++++++++++---------- libs/interchainjs/README.md | 39 +++++++--- networks/cosmos/README.md | 100 ++++++++++++++---------- networks/ethereum/README.md | 132 ++++++++++++++++++-------------- networks/injective/README.md | 54 ++++++++----- package.json | 3 +- packages/amino/README.md | 34 ++++++-- packages/auth/README.md | 56 ++++++++++---- packages/crypto/README.md | 34 ++++++-- packages/encoding/README.md | 34 ++++++-- packages/math/README.md | 34 ++++++-- packages/pubkey/README.md | 34 ++++++-- packages/types/README.md | 56 ++++++++++---- packages/utils/README.md | 56 ++++++++++---- scripts/reverse_copy_readmes.sh | 30 ++++++++ 21 files changed, 775 insertions(+), 354 deletions(-) create mode 100755 scripts/reverse_copy_readmes.sh diff --git a/README.md b/README.md index 5bccf1397..cc3a40228 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,37 @@ # InterchainJS -

- +

+

-

+

- + + + + + + + - -

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. @@ -86,16 +108,14 @@ graph LR style utils fill:#ccf,stroke:#333,stroke-width:2px ``` - --- - ## Tutorials & Documentation -| Topic | Documentation | -|----------------------------------|--------------| -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | +| Topic | Documentation | +| ---------------------------- | ----------------------------- | +| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | +| **Advanced Documentation** | [View Docs](/docs/) | --- @@ -103,9 +123,9 @@ graph LR The authentication module is universally applied across different networks. -| Package | Description | -|---------|-------------| -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | +| Package | Description | +| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | | [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | --- @@ -114,26 +134,26 @@ The authentication module is universally applied across different networks. ### Cosmos Network -| Feature | Package | -|---------|---------| -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | +| Feature | Package | +| ---------------------------- | ------------------------------------------------------------- | +| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | +| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | +| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | --- ### Injective Network -| Feature | Package | -|---------|---------| +| Feature | Package | +| ---------------- | -------------------------------------------------------- | | **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | --- ### Ethereum Network -| Feature | Package | -|---------|---------| +| Feature | Package | +| ---------------- | ------------------------------------------------------ | | **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | --- @@ -142,17 +162,17 @@ The authentication module is universally applied across different networks. A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/libs/cosmos-types/README.md b/libs/cosmos-types/README.md index b97d59051..2e16e7e9d 100644 --- a/libs/cosmos-types/README.md +++ b/libs/cosmos-types/README.md @@ -1,15 +1,37 @@ # @interchainjs/cosmos-types -

- +

+

-

+

- + + + + + + + - -

Fundamental types for Networks/Cosmos to use. @@ -20,17 +42,17 @@ Generated by Telescope. (Will generate code with less redundancy in future versi A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/libs/injective-react/README.md b/libs/injective-react/README.md index 50d1fcae4..a3fc6d14e 100644 --- a/libs/injective-react/README.md +++ b/libs/injective-react/README.md @@ -1,15 +1,37 @@ # injective-react -

- +

+

-

+

- + + + + + + + - -

## install @@ -279,10 +301,7 @@ import { depositValidatorRewardsPool, } from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; -import { - send, - multiSend, -} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; import { delegate, diff --git a/libs/injective-vue/README.md b/libs/injective-vue/README.md index 610dae17e..bca3542d2 100644 --- a/libs/injective-vue/README.md +++ b/libs/injective-vue/README.md @@ -1,15 +1,37 @@ # injective-vue -

- +

+

-

+

- + + + + + + + - -

## install diff --git a/libs/injectivejs/README.md b/libs/injectivejs/README.md index a97344d49..f1442d2e8 100644 --- a/libs/injectivejs/README.md +++ b/libs/injectivejs/README.md @@ -1,15 +1,37 @@ # InjectiveJS -

- +

+

-

+

- + + + + + + + - -

## install @@ -238,10 +260,7 @@ import { depositValidatorRewardsPool, } from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; -import { - send, - multiSend, -} from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; import { delegate, diff --git a/libs/interchain-react/README.md b/libs/interchain-react/README.md index a3ad92e2f..fc54bfc09 100644 --- a/libs/interchain-react/README.md +++ b/libs/interchain-react/README.md @@ -1,15 +1,37 @@ # @interchainjs/react -

- +

+

-

+

- + + + + + + + - -

React query helper hooks(Tx, Query) generated by Telescope. @@ -49,17 +71,16 @@ import { defaultContext } from "@tanstack/react-query"; import { useGetBalance } from "@interchainjs/react/cosmos/bank/v1beta1/query.rpc.react"; // Initialize RPC endpoint and address -const { rpcEndpoint } = - useQueryHooks(defaultChainName, { - context: defaultContext, - enabled: !!address, - }); +const { rpcEndpoint } = useQueryHooks(defaultChainName, { + context: defaultContext, + enabled: !!address, +}); //Now you can get balance by tree shakable hooks const balanceRes = useGetBalance({ request: { - address: address || '', - denom: 'osmo', + address: address || "", + denom: "osmo", }, options: { context: defaultContext, @@ -68,9 +89,9 @@ const balanceRes = useGetBalance({ staleTime: 0, }, clientResolver: rpcEndpoint, -}) +}); -const balance = balanceRes?.data +const balance = balanceRes?.data; ``` #### Available Helper Types @@ -122,22 +143,21 @@ const result = await delegate( By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. - ## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/libs/interchain-vue/README.md b/libs/interchain-vue/README.md index 24b9e6fb3..6f54191ab 100644 --- a/libs/interchain-vue/README.md +++ b/libs/interchain-vue/README.md @@ -1,15 +1,37 @@ # @interchainjs/vue -

- +

+

-

+

- + + + + + + + - -

React query helper hooks(Tx, Query) generated by Telescope. @@ -45,30 +67,30 @@ For example, customized hooks are functions that return the result you want: ```typescript // Import only what you need -import { useGetBalance } from '@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue'; +import { useGetBalance } from "@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue"; // Initialize RPC endpoint and address, then you can get balance by tree shakable hooks - const request = computed(() => ({ - address: address.value, - denom, - })); - - const { - data: balance, - isSuccess: isBalanceLoaded, - isLoading: isFetchingBalance, - refetch: refetchBalance - } = useGetBalance({ - request, - options: { - enabled: !!address, - select: ({ balance }) => - new BigNumber(balance?.amount ?? 0).multipliedBy( - 10 ** -COIN_DISPLAY_EXPONENT - ), - }, - clientResolver: rpcEndpoint, - }) +const request = computed(() => ({ + address: address.value, + denom, +})); + +const { + data: balance, + isSuccess: isBalanceLoaded, + isLoading: isFetchingBalance, + refetch: refetchBalance, +} = useGetBalance({ + request, + options: { + enabled: !!address, + select: ({ balance }) => + new BigNumber(balance?.amount ?? 0).multipliedBy( + 10 ** -COIN_DISPLAY_EXPONENT + ), + }, + clientResolver: rpcEndpoint, +}); ``` #### Available Helper Types @@ -119,22 +141,21 @@ const result = await delegate( By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. - ## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/libs/interchainjs/README.md b/libs/interchainjs/README.md index fc50888a5..f182d0c0f 100644 --- a/libs/interchainjs/README.md +++ b/libs/interchainjs/README.md @@ -1,15 +1,37 @@ # InterchainJS -

- +

+

-

+

- + + + + + + + - -

A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. @@ -264,10 +286,7 @@ import { } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; // tx helpers -import { - send, - multiSend, -} from "@interchainjs/cosmos/bank/v1beta1/tx.rpc.func"; +import { send, multiSend } from "@interchainjs/cosmos/bank/v1beta1/tx.rpc.func"; ``` ##### Circuit diff --git a/networks/cosmos/README.md b/networks/cosmos/README.md index 2acffcf39..3fe9a9f15 100644 --- a/networks/cosmos/README.md +++ b/networks/cosmos/README.md @@ -1,15 +1,39 @@ # @interchainjs/cosmos -

- +

+

-

- - - +

+ + + + + +

Transaction codec and client to communicate with any cosmos blockchain. @@ -23,7 +47,7 @@ npm install @interchainjs/cosmos Example for signing client here: ```ts -import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; const signingClient = await CosmosSigningClient.connectWithSigner( await getRpcEndpoint(), @@ -43,13 +67,12 @@ const signingClient = await CosmosSigningClient.connectWithSigner( // sign and broadcast const result = await signingClient.signAndBroadcast([]); console.log(result.hash); // the hash of TxRaw - ``` Or use the tree shakable helper functions (**Most Recommended**) we generate in interchainjs libs: ```ts -import { SigningClient as CosmosSigningClient } from '@interchainjs/cosmos/signing-client'; +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; const signingClient = await CosmosSigningClient.connectWithSigner( @@ -73,12 +96,12 @@ const result = await submitProposal( proposer: directAddress, initialDeposit: [ { - amount: '1000000', + amount: "1000000", denom: denom, }, ], content: { - typeUrl: '/cosmos.gov.v1beta1.TextProposal', + typeUrl: "/cosmos.gov.v1beta1.TextProposal", value: TextProposal.encode(contentMsg).finish(), }, }, @@ -95,26 +118,25 @@ import { DirectSigner } from "@interchainjs/cosmos/signers/direct"; // const signer = new DirectSigner(, [], ); // **ONLY** rpc endpoint is supported for now const signer = new DirectSigner( - directAuth, - // as many as possible encoders registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - rpcEndpoint, - { prefix: chainInfo.chain.bech32_prefix } - ); + directAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } +); const aminoSigner = new AminoSigner( - aminoAuth, - // as many as possible encoders registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - // as many as possible converters registered here. - [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], - rpcEndpoint, - { prefix: chainInfo.chain.bech32_prefix } - ); + aminoAuth, + // as many as possible encoders registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + // as many as possible converters registered here. + [MsgDelegate, TextProposal, MsgSubmitProposal, MsgVote], + rpcEndpoint, + { prefix: chainInfo.chain.bech32_prefix } +); const result = await signer.signAndBroadcast([]); console.log(result.hash); // the hash of TxRaw ``` - - See [@interchainjs/auth](/packages/auth/README.md) to construct `` - See [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) to construct ``s and ``s, and also different message types. @@ -127,17 +149,17 @@ console.log(result.hash); // the hash of TxRaw A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/networks/ethereum/README.md b/networks/ethereum/README.md index 24863007a..84f03238e 100644 --- a/networks/ethereum/README.md +++ b/networks/ethereum/README.md @@ -1,15 +1,31 @@ # @interchainjs/ethereum -

- +

+

-

- - - +

+ + + + + +

Transaction codec and client to communicate with ethereum blockchain. @@ -23,13 +39,13 @@ npm install @interchainjs/ethereum ### Using private key ```typescript -import { SignerFromPrivateKey } from "@interchainjs/ethereum/signers/SignerFromPrivateKey" -const signer = new SignerFromPrivateKey(privateKey, RPC_URL) +import { SignerFromPrivateKey } from "@interchainjs/ethereum/signers/SignerFromPrivateKey"; +const signer = new SignerFromPrivateKey(privateKey, RPC_URL); const { txHash, wait } = await signer.sendEIP1559TransactionAutoGasLimit( recipientAddress, amount -) -const receipt = await wait() +); +const receipt = await wait(); ``` ```typescript @@ -81,62 +97,60 @@ console.log("Signature valid:", isValid) const estimatedGas: bigint = await signer.estimateGas( recipientAddress, 500000000000000000n, // 0.5 ETH - '0x' // optional data -) -console.log('Estimated gas:', estimatedGas.toString()) + "0x" // optional data +); +console.log("Estimated gas:", estimatedGas.toString()); ``` ```typescript // Deploy a smart contract -const bytecode = '0x...'; // compiled contract bytecode -const { txHash: deployHash, wait: deployWait } = await signer.sendLegacyTransactionAutoGasLimit( - '', - 0n, - bytecode -) -const deployReceipt = await deployWait() -console.log('Contract deployed at:', deployReceipt.contractAddress) +const bytecode = "0x..."; // compiled contract bytecode +const { txHash: deployHash, wait: deployWait } = + await signer.sendLegacyTransactionAutoGasLimit("", 0n, bytecode); +const deployReceipt = await deployWait(); +console.log("Contract deployed at:", deployReceipt.contractAddress); ``` ```typescript // Interact with a deployed contract (transfer ERC20 tokens) -import { ContractEncoder } from "@interchainjs/ethereum/utils/ContractEncoder" -const abi = [ /* ERC20 contract ABI */ ] -const contractAddress = deployReceipt.contractAddress -const contract = new ContractEncoder(abi) -const dataHex = contract.transfer(recipientAddress, 1000000n) -const { txHash: tokenHash, wait: tokenWait } = await signer.sendLegacyTransactionAutoGasLimit( - contractAddress, - 0n, - dataHex -) -const tokenReceipt = await tokenWait() -console.log('Token transfer receipt:', tokenReceipt) +import { ContractEncoder } from "@interchainjs/ethereum/utils/ContractEncoder"; +const abi = [ + /* ERC20 contract ABI */ +]; +const contractAddress = deployReceipt.contractAddress; +const contract = new ContractEncoder(abi); +const dataHex = contract.transfer(recipientAddress, 1000000n); +const { txHash: tokenHash, wait: tokenWait } = + await signer.sendLegacyTransactionAutoGasLimit(contractAddress, 0n, dataHex); +const tokenReceipt = await tokenWait(); +console.log("Token transfer receipt:", tokenReceipt); ``` ```typescript // Monitor contract events via WebSocket -import { WebSocketContractMonitor } from "@interchainjs/ethereum/providers/WebSocketContractMonitor" -const wsUrl = 'ws://127.0.0.1:8546' -const monitor = new WebSocketContractMonitor(contractAddress, abi, wsUrl) -await monitor.connect() -monitor.on('Transfer', (event) => { - console.log('Transfer event:', event) -}) +import { WebSocketContractMonitor } from "@interchainjs/ethereum/providers/WebSocketContractMonitor"; +const wsUrl = "ws://127.0.0.1:8546"; +const monitor = new WebSocketContractMonitor(contractAddress, abi, wsUrl); +await monitor.connect(); +monitor.on("Transfer", (event) => { + console.log("Transfer event:", event); +}); ``` + See more usages in the [unit test](starship/__tests__/token.test.ts) ### In the frontend -``` typescript -import { SignerFromBrowser } from "@interchainjs/ethereum/signers/SignerFromBrowser" -const signer = new SignerFromBrowser(window.ethereum) +```typescript +import { SignerFromBrowser } from "@interchainjs/ethereum/signers/SignerFromBrowser"; +const signer = new SignerFromBrowser(window.ethereum); const tx = await signer.send({ to: recipientAddress, - value: BigInt(10**18), -}) -const receipt = await tx.wait() + value: BigInt(10 ** 18), +}); +const receipt = await tx.wait(); ``` + For more details, see this example: https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/ethereum/app/page.tsx ## Implementations @@ -148,17 +162,17 @@ For more details, see this example: https://github.com/hyperweb-io/create-interc A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/networks/injective/README.md b/networks/injective/README.md index a428d6ffe..32e73296b 100644 --- a/networks/injective/README.md +++ b/networks/injective/README.md @@ -1,15 +1,31 @@ # @interchainjs/injective -

- +

+

-

- - - +

+ + + + + +

Transaction codec and client to communicate with any injective blockchain. @@ -43,17 +59,17 @@ console.log(result.hash); // the hash of TxRaw A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/package.json b/package.json index eebc39654..5b944a557 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "lint": "lerna run lint --parallel", "symlink": "symlink-workspace --logLevel error", "postinstall": "yarn symlink", - "doc": "./scripts/copy_readmes.sh" + "doc": "./scripts/copy_readmes.sh", + "doc:reverse": "./scripts/reverse_copy_readmes.sh" }, "devDependencies": { "@chain-registry/client": "1.18.1", diff --git a/packages/amino/README.md b/packages/amino/README.md index 4f06d2861..232fcf21f 100644 --- a/packages/amino/README.md +++ b/packages/amino/README.md @@ -1,15 +1,37 @@ # @interchainjs/amino -

- +

+

-

+

- + + + + + + + - -

Helpers for Amino based signing. diff --git a/packages/auth/README.md b/packages/auth/README.md index 58e074409..fb99a1ba9 100644 --- a/packages/auth/README.md +++ b/packages/auth/README.md @@ -1,15 +1,37 @@ # @interchainjs/auth -

- +

+

-

+

- + + + + + + + - -

Authentication/Wallet for web3 accounts. @@ -64,17 +86,17 @@ const [auth] = Secp256k1Auth.fromMnemonic("", [ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/packages/crypto/README.md b/packages/crypto/README.md index 4c3a7e3d9..5130e9aa4 100644 --- a/packages/crypto/README.md +++ b/packages/crypto/README.md @@ -1,15 +1,37 @@ # @interchainjs/crypto -

- +

+

-

+

- + + + + + + + - -

This package contains low-level cryptographic functionality used in other diff --git a/packages/encoding/README.md b/packages/encoding/README.md index e4c37c67b..9654dd020 100644 --- a/packages/encoding/README.md +++ b/packages/encoding/README.md @@ -1,15 +1,37 @@ # @interchainjs/encoding -

- +

+

-

+

- + + + + + + + - -

This package is an extension to the JavaScript standard library that is not diff --git a/packages/math/README.md b/packages/math/README.md index cf3c965fc..cb0a96219 100644 --- a/packages/math/README.md +++ b/packages/math/README.md @@ -1,15 +1,37 @@ # @interchainjs/math -

- +

+

-

+

- + + + + + + + - -

Math utilities diff --git a/packages/pubkey/README.md b/packages/pubkey/README.md index 2e4a0284f..dc0d065f0 100644 --- a/packages/pubkey/README.md +++ b/packages/pubkey/README.md @@ -1,15 +1,37 @@ # @interchainjs/pubkey -

- +

+

-

+

- + + + + + + + - -

Pubkey helpers for blockchain projects diff --git a/packages/types/README.md b/packages/types/README.md index a46b6e92c..886096eac 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -1,32 +1,54 @@ # @interchainjs/types -

- +

+

-

+

- + + + + + + + - -

## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/packages/utils/README.md b/packages/utils/README.md index 8cc182032..6f3e77796 100644 --- a/packages/utils/README.md +++ b/packages/utils/README.md @@ -1,32 +1,54 @@ # @interchainjs/utils -

- +

+

-

+

- + + + + + + + - -

## Interchain JavaScript Stack ⚛️ A unified toolkit for building applications and smart contracts in the Interchain ecosystem -| Category | Tools | Description | -|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------| -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | ## Credits diff --git a/scripts/reverse_copy_readmes.sh b/scripts/reverse_copy_readmes.sh new file mode 100755 index 000000000..dda809a57 --- /dev/null +++ b/scripts/reverse_copy_readmes.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Set the project root directory +PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +DOCS_DIR="${PROJECT_ROOT}/docs" + +# Copy index.mdx files from docs/libs, docs/packages, and docs/networks back to their source locations +find "${DOCS_DIR}/libs" "${DOCS_DIR}/packages" "${DOCS_DIR}/networks" -type f -name "index.mdx" 2>/dev/null | while read file; do + # Extract the relative path from the docs directory + rel_path="${file#${DOCS_DIR}/}" + # Get the directory part + dir_path="$(dirname "$rel_path")" + # Construct the target path + target_path="${PROJECT_ROOT}/${dir_path}/README.md" + + # Create the target directory if it doesn't exist + mkdir -p "$(dirname "${target_path}")" + + # Copy the file back to its original location as README.md + cp "${file}" "${target_path}" + echo "index.mdx copied back to ${target_path}" +done + +# Copy root docs/index.mdx back to root README.md +if [ -f "${DOCS_DIR}/index.mdx" ]; then + cp "${DOCS_DIR}/index.mdx" "${PROJECT_ROOT}/README.md" + echo "docs/index.mdx copied back to README.md in project root" +fi + +echo "All index.mdx files copied back to their source locations as README.md successfully!" \ No newline at end of file From e7d99a4205f4d3810e10dca21cc22abc3b12766c Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 11:30:31 +0800 Subject: [PATCH 14/19] fix scripts and meta json --- docs/_meta.json | 6 +- docs/libs/_meta.json | 10 +- docs/libs/injective-react/_meta.json | 3 - docs/libs/injective-react/index.mdx | 665 --------------------- docs/libs/injective-vue/_meta.json | 3 - docs/libs/injective-vue/index.mdx | 411 ------------- docs/libs/injectivejs/_meta.json | 3 - docs/libs/injectivejs/index.mdx | 624 ------------------- docs/libs/interchain-vue/_meta.json | 3 - docs/libs/interchain-vue/index.mdx | 168 ------ docs/networks/_meta.json | 4 +- docs/packages/_meta.json | 8 +- package.json | 5 +- scripts/{ => docs}/copy_readmes.sh | 4 +- scripts/{ => docs}/generate_meta_json.sh | 2 +- scripts/{ => docs}/generate_meta_json.ts | 75 ++- scripts/{ => docs}/reverse_copy_readmes.sh | 2 +- 17 files changed, 86 insertions(+), 1910 deletions(-) delete mode 100644 docs/libs/injective-react/_meta.json delete mode 100644 docs/libs/injective-react/index.mdx delete mode 100644 docs/libs/injective-vue/_meta.json delete mode 100644 docs/libs/injective-vue/index.mdx delete mode 100644 docs/libs/injectivejs/_meta.json delete mode 100644 docs/libs/injectivejs/index.mdx delete mode 100644 docs/libs/interchain-vue/_meta.json delete mode 100644 docs/libs/interchain-vue/index.mdx rename scripts/{ => docs}/copy_readmes.sh (76%) rename scripts/{ => docs}/generate_meta_json.sh (94%) rename scripts/{ => docs}/generate_meta_json.ts (57%) rename scripts/{ => docs}/reverse_copy_readmes.sh (94%) diff --git a/docs/_meta.json b/docs/_meta.json index 00dd55299..7ac9bd02b 100644 --- a/docs/_meta.json +++ b/docs/_meta.json @@ -1,7 +1,7 @@ { "index": "Overview", + "advanced": "Advanced", + "libs": "Libs", "networks": "Networks", - "packages": "Packages", - "libs": "Libraries", - "advanced": "Advanced" + "packages": "Packages" } \ No newline at end of file diff --git a/docs/libs/_meta.json b/docs/libs/_meta.json index f0802add7..fbf216e95 100644 --- a/docs/libs/_meta.json +++ b/docs/libs/_meta.json @@ -1,9 +1,5 @@ { - "injective-vue": "Injective Vue", - "injective-react": "Injective React", - "interchainjs": "InterchainJS", - "interchain-vue": "Interchain Vue", - "interchain-react": "Interchain React", - "injectivejs": "InjectiveJS", - "cosmos-types": "Cosmos Types" + "cosmos-types": "Cosmos Types", + "interchainjs": "Interchainjs", + "interchain-react": "Interchain React" } \ No newline at end of file diff --git a/docs/libs/injective-react/_meta.json b/docs/libs/injective-react/_meta.json deleted file mode 100644 index 356de82b4..000000000 --- a/docs/libs/injective-react/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "index": "Overview" -} \ No newline at end of file diff --git a/docs/libs/injective-react/index.mdx b/docs/libs/injective-react/index.mdx deleted file mode 100644 index a3fc6d14e..000000000 --- a/docs/libs/injective-react/index.mdx +++ /dev/null @@ -1,665 +0,0 @@ -# injective-react - -

- -

- -

- - - - - - - - - -

- -## install - -```sh -npm install injective-react -``` - -## Table of contents - -- [injective-react](#injective-react) - - [install](#install) - - [Table of contents](#table-of-contents) - - [Usage](#usage) - - [RPC Clients](#rpc-clients) - - [Tx Hooks](#tx-hooks) - - [Tx Helpers](#tx-helpers) - - [Auction](#auction) - - [Exchange](#exchange) - - [Insurance](#insurance) - - [OCR](#ocr) - - [Oracle](#oracle) - - [Peggy](#peggy) - - [CosmWasm](#cosmwasm) - - [IBC](#ibc) - - [Cosmos](#cosmos) - - [Composing Messages](#composing-messages) - - [Auction Messages](#auction-messages) - - [Exchange Messages](#exchange-messages) - - [Insurance Messages](#insurance-messages) - - [OCR Messages](#ocr-messages) - - [Oracle Messages](#oracle-messages) - - [Peggy Messages](#peggy-messages) - - [CosmWasm Messages](#cosmwasm-messages) - - [IBC Messages](#ibc-messages) - - [Cosmos Messages](#cosmos-messages) - - [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) - - [Initializing the Signing Client](#initializing-the-signing-client) - - [Creating Signers](#creating-signers) - - [Broadcasting Messages](#broadcasting-messages) - - [All In One Example](#all-in-one-example) - - [Advanced Usage](#advanced-usage) - - [Developing](#developing) - - [Codegen](#codegen) - - [Publishing](#publishing) - - [Credits](#credits) - - [License](#license) - -## Usage - -### RPC Clients - -```js -import { getAllBalances } from "injectivejs/cosmos/bank/v1beta1/query.rpc.func"; -import { getExchangeBalances } from "injectivejs/injective/exchange/v1beta1/query.rpc.func"; - -{ getRpcEndpoint } = useChain("injective"); - -const endpoint = await getRpcEndpoint(); - -// now you can query the cosmos modules -const balance = await getAllBalances(endpoint, { - address: "inj1addresshere", -}); - -// you can also query the injective modules -const exchangeBalance = await getExchangeBalances(endpoint, {}); -``` - -### Tx Hooks - -injective-react provides hooks for sending transactions. These hooks are built on top of the `useQuery` hook and the `useMutation` hook from `react-query`. The hooks are designed to be used with the `useDelegate` and `useGetValidators` functions from `injectivejs`. - -There's also an all in one example of how to use these hooks in the [all in one example](#all-in-one-example) section. - -```js -import { useDelegate } from "injective-react/cosmos/staking/v1beta1/tx.rpc.react"; -import { useGetValidators } from "injective-react/cosmos/staking/v1beta1/query.rpc.react"; - -const { - data, - isSuccess: isGetValidatorsDone, - isLoading: isGetValidatorsLoading, -} = useGetValidators({ - request: { - status: "BOND_STATUS_BONDED", - }, - options: { - context: defaultContext, - enabled: !validatorAddress, - }, - rpcClient, -}); - -const { mutate: delegate, isSuccess: isDelegateSuccess } = useDelegate({ - clientResolver: signingClient, - options: { - context: defaultContext, - onSuccess: (data: any) => { - console.log("onSuccess", data); - }, - onError: (error) => { - console.log("onError", error); - }, - }, -}); -``` - -### Tx Helpers - -For tx messages, there're helper functions to sign and broadcast messages: - -For more detailed usage on how to use these functions, please see the starship tests in the [networks/injective repo](https://github.com/hyperweb-io/interchainjs/tree/main/networks/injective/starship/__tests__) - -There're also react hooks for helper functions. Please see the [Tx Hooks](#tx-hooks) section. - -```js -import { - deposit, - liquidatePosition, - activateStakeGrant, -} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; -``` - -#### Auction - -```js -import { bid } from "injectivejs/injective/auction/v1beta1/tx.rpc.func"; -``` - -#### Exchange - -```js -import { - activateStakeGrant, - adminUpdateBinaryOptionsMarket, - authorizeStakeGrants, - batchCancelBinaryOptionsOrders, - batchCancelDerivativeOrders, - batchCancelSpotOrders, - batchCreateDerivativeLimitOrders, - batchCreateSpotLimitOrders, - batchUpdateOrders, - cancelBinaryOptionsOrder, - cancelDerivativeOrder, - cancelSpotOrder, - createBinaryOptionsLimitOrder, - createBinaryOptionsMarketOrder, - createDerivativeLimitOrder, - createDerivativeMarketOrder, - createSpotLimitOrder, - createSpotMarketOrder, - decreasePositionMargin, - deposit, - emergencySettleMarket, - externalTransfer, - increasePositionMargin, - instantBinaryOptionsMarketLaunch, - instantExpiryFuturesMarketLaunch, - instantPerpetualMarketLaunch, - instantSpotMarketLaunch, - liquidatePosition, - privilegedExecuteContract, - rewardsOptOut, - subaccountTransfer, - updateDerivativeMarket, - updateParams, - updateSpotMarket, - withdraw, -} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; -``` - -#### Insurance - -```js -import { - createInsuranceFund, - requestRedemption, - underwrite, -} from "injectivejs/injective/insurance/v1beta1/tx.rpc.func"; -``` - -#### OCR - -```js -import { - acceptPayeeship, - createFeed, - fundFeedRewardPool, - setPayees, - transferPayeeship, - transmit, - updateFeed, - withdrawFeedRewardPool, -} from "injectivejs/injective/ocr/v1beta1/tx.rpc.func"; -``` - -#### Oracle - -```js -import { - relayBandRates, - relayCoinbaseMessages, - relayPriceFeedPrice, - relayProviderPrices, - relayPythPrices, - relayStorkMessage, - requestBandIBCRates, -} from "injectivejs/injective/oracle/v1beta1/tx.rpc.func"; -``` - -#### Peggy - -```js -import { - blacklistEthereumAddresses, - cancelSendToEth, - confirmBatch, - depositClaim, - eRC20DeployedClaim, - requestBatch, - revokeEthereumBlacklist, - sendToEth, - setOrchestratorAddresses, - submitBadSignatureEvidence, - valsetConfirm, - valsetUpdateClaim, - withdrawClaim, -} from "injectivejs/injective/peggy/v1/msgs.rpc.func"; -``` - -#### CosmWasm - -```js -import { - executeContract, - clearAdmin, - instantiateContract, - instantiateContract2, - migrateContract, - pinCodes, - removeCodeUploadParamsAddresses, - storeAndInstantiateContract, - storeCode, - sudoContract, - unpinCodes, - updateAdmin, - updateContractLabel, - updateInstantiateConfig, - addCodeUploadParamsAddresses, - storeAndMigrateContract, -} from "injectivejs/cosmwasm/wasm/v1/tx.rpc.func"; -``` - -#### IBC - -```js -import { transfer } from "injectivejs/ibc/applications/transfer/v1/tx.rpc.func"; -``` - -#### Cosmos - -```js -import { - fundCommunityPool, - communityPoolSpend, - depositValidatorRewardsPool, -} from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; - -import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; - -import { - delegate, - undelegate, - cancelUnbondingDelegation, - createValidator, -} from "injectivejs/cosmos/staking/v1beta1/tx.rpc.func"; - -import { - deposit, - submitProposal, - vote, - voteWeighted, -} from "injectivejs/cosmos/gov/v1beta1/tx.rpc.func"; -``` - -### Composing Messages - -Import the `injective` object from `injectivejs`. - -```js -import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; - -const { createSpotLimitOrder, createSpotMarketOrder, deposit } = - MessageComposer.withTypeUrl; -``` - -#### Auction Messages - -```js -import { MessageComposer } from "injectivejs/injective/auction/v1beta1/tx.registry"; - -const { bid } = MessageComposer.withTypeUrl; -``` - -#### Exchange Messages - -```js -import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; - -const { - adminUpdateBinaryOptionsMarket, - batchCancelBinaryOptionsOrders, - batchCancelDerivativeOrders, - batchCancelSpotOrders, - batchCreateDerivativeLimitOrders, - batchCreateSpotLimitOrders, - batchUpdateOrders, - cancelBinaryOptionsOrder, - cancelDerivativeOrder, - cancelSpotOrder, - createBinaryOptionsLimitOrder, - createBinaryOptionsMarketOrder, - createDerivativeLimitOrder, - createDerivativeMarketOrder, - createSpotLimitOrder, - createSpotMarketOrder, - deposit, - exec, - externalTransfer, - increasePositionMargin, - instantBinaryOptionsMarketLaunch, - instantExpiryFuturesMarketLaunch, - instantPerpetualMarketLaunch, - instantSpotMarketLaunch, - liquidatePosition, - rewardsOptOut, - subaccountTransfer, - withdraw, -} = MessageComposer.withTypeUrl; -``` - -#### Insurance Messages - -```js -import { MessageComposer } from "injectivejs/injective/insurance/v1beta1/tx.registry"; - -const { createInsuranceFund, requestRedemption, underwrite } = - MessageComposer.withTypeUrl; -``` - -#### OCR Messages - -```js -import { MessageComposer } from "injectivejs/injective/ocr/v1beta1/tx.registry"; - -const { - acceptPayeeship, - createFeed, - fundFeedRewardPool, - setPayees, - transferPayeeship, - transmit, - updateFeed, - withdrawFeedRewardPool, -} = MessageComposer.withTypeUrl; -``` - -#### Oracle Messages - -```js -import { MessageComposer } from "injectivejs/injective/oracle/v1beta1/tx.registry"; - -const { - relayBandRates, - relayCoinbaseMessages, - relayPriceFeedPrice, - relayProviderPrices, - requestBandIBCRates, -} = MessageComposer.withTypeUrl; -``` - -#### Peggy Messages - -```js -import { MessageComposer } from "injectivejs/injective/peggy/v1/tx.registry"; - -const { - cancelSendToEth, - confirmBatch, - depositClaim, - eRC20DeployedClaim, - requestBatch, - sendToEth, - setOrchestratorAddresses, - submitBadSignatureEvidence, - valsetConfirm, - valsetUpdateClaim, - withdrawClaim, -} = MessageComposer.withTypeUrl; -``` - -#### CosmWasm Messages - -```js -import { MessageComposer } from "injectivejs/cosmwasm/wasm/v1/tx.registry"; - -const { - clearAdmin, - executeContract, - instantiateContract, - migrateContract, - storeCode, - updateAdmin, -} = MessageComposer.withTypeUrl; -``` - -#### IBC Messages - -```js -import { MessageComposer } from "injectivejs/ibc/applications/transfer/v1/tx.registry"; - -const { transfer } = MessageComposer.withTypeUrl; -``` - -#### Cosmos Messages - -```js -import { MessageComposer } from "injectivejs/cosmos/distribution/v1beta1/tx.registry"; - -const { - fundCommunityPool, - setWithdrawAddress, - withdrawDelegatorReward, - withdrawValidatorCommission, -} = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/bank/v1beta1/tx.registry"; - -const { multiSend, send } = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/staking/v1beta1/tx.registry"; - -const { - beginRedelegate, - createValidator, - delegate, - editValidator, - undelegate, -} = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/gov/v1beta1/tx.registry"; - -const { deposit, submitProposal, vote, voteWeighted } = - cosmos.gov.v1beta1.MessageComposer.fromPartial; -``` - -## Connecting with Wallets and Signing Messages - -⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. - -Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. - -### Initializing the Signing Client - -Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: - -```js -import { SigningClient } from "@interchainjs/cosmos/signing-client"; -import { defaultSignerOptions } from "@interchainjs/injective/defaults"; - -const signingClient = await SigningClient.connectWithSigner( - await getRpcEndpoint(), - new AminoGenericOfflineSigner(aminoOfflineSigner), - { - signerOptions: defaultSignerOptions.Cosmos, - } -); -``` - -### Creating Signers - -To broadcast messages, you can create signers with a variety of options: - -- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) -- [keplr](https://docs.keplr.app/api/cosmjs.html) -- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) - -### Broadcasting Messages - -When you have your `signing client`, you can broadcast messages: - -```js -const msg = { - typeUrl: MsgSend.typeUrl, - value: MsgSend.fromPartial({ - amount: [ - { - denom: "inj", - amount: "1000", - }, - ], - toAddress: address, - fromAddress: address, - }), -}; - -const fee: StdFee = { - amount: [ - { - denom: "inj", - amount: "864", - }, - ], - gas: "86364", -}; -const response = await signingClient.signAndBroadcast(address, [msg], fee); -``` - -### All In One Example - -For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: - -- Initialize the client. -- Create and sign messages. -- Broadcast transactions. -- Handle responses and errors. - -The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. - -Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. - -## Advanced Usage - -If you want to manually construct a signing client, you can do so by following the example below: - -```js -import { - cosmosAminoConverters, - cosmosProtoRegistry, - cosmwasmAminoConverters, - cosmwasmProtoRegistry, - ibcProtoRegistry, - ibcAminoConverters, - injectiveAminoConverters, - injectiveProtoRegistry -} from 'injectivejs'; - -const signer: OfflineSigner = /* create your signer (see above) */ -const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL - -const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ - ...cosmosProtoRegistry, - ...cosmwasmProtoRegistry, - ...ibcProtoRegistry, - ...injectiveProtoRegistry -]; - -const aminoConverters = { - ...cosmosAminoConverters, - ...cosmwasmAminoConverters, - ...ibcAminoConverters, - ...injectiveAminoConverters -}; - -const registry = new Registry(protoRegistry); -const aminoTypes = new AminoTypes(aminoConverters); - -const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); - -signingClient.addEncoders(registry); -signingClient.addConverters(aminoTypes); -``` - -## Developing - -When first cloning the repo: - -```shell -yarn -yarn build:dev -``` - -### Codegen - -Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: - -```shell -yarn codegen -``` - -### Publishing - -Build the types and then publish: - -```shell -yarn build -yarn publish -``` - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/injective-vue/_meta.json b/docs/libs/injective-vue/_meta.json deleted file mode 100644 index ca0a2a6cb..000000000 --- a/docs/libs/injective-vue/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "index": "Overview" -} diff --git a/docs/libs/injective-vue/index.mdx b/docs/libs/injective-vue/index.mdx deleted file mode 100644 index bca3542d2..000000000 --- a/docs/libs/injective-vue/index.mdx +++ /dev/null @@ -1,411 +0,0 @@ -# injective-vue - -

- -

- -

- - - - - - - - - -

- -## install - -```sh -npm install injective-vue -``` - -## Table of contents - -- [injective-vue](#injective-vue) - - [install](#install) - - [Table of contents](#table-of-contents) -- [Usage](#usage) - - [RPC Clients](#rpc-clients) - - [Composing Messages](#composing-messages) - - [Auction Messages](#auction-messages) - - [Exchange Messages](#exchange-messages) - - [Insurance Messages](#insurance-messages) - - [OCR Messages](#ocr-messages) - - [Oracle Messages](#oracle-messages) - - [Peggy Messages](#peggy-messages) - - [CosmWasm Messages](#cosmwasm-messages) - - [IBC Messages](#ibc-messages) - - [Cosmos Messages](#cosmos-messages) -- [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) - - [Initializing the Signing Client](#initializing-the-signing-client) - - [Creating Signers](#creating-signers) - - [Broadcasting Messages](#broadcasting-messages) - - [All In One Example](#all-in-one-example) -- [Advanced Usage](#advanced-usage) -- [Developing](#developing) - - [Codegen](#codegen) - - [Publishing](#publishing) -- [Credits](#credits) -- [License](#license) - -## Usage - -### RPC Clients - -```js -import { injective } from "injective-vue"; - -const { createRPCQueryClient } = injective.ClientFactory; -const client = await createRPCQueryClient({ rpcEndpoint: RPC_ENDPOINT }); - -// now you can query the cosmos modules -const balance = await client.cosmos.bank.v1beta1.allBalances({ - address: "inj1addresshere", -}); - -// you can also query the injective modules -const balances = await client.injective.exchange.v1beta1.exchangeBalances(); -``` - -### Composing Messages - -Import the `injective` object from `injective-vue`. - -```js -import { injective } from "injective-vue"; - -const { createSpotLimitOrder, createSpotMarketOrder, deposit } = - injective.exchange.v1beta1.MessageComposer.withTypeUrl; -``` - -#### Auction Messages - -```js -const { bid } = injective.auction.v1beta1.MessageComposer.withTypeUrl; -``` - -#### Exchange Messages - -```js -const { - adminUpdateBinaryOptionsMarket, - batchCancelBinaryOptionsOrders, - batchCancelDerivativeOrders, - batchCancelSpotOrders, - batchCreateDerivativeLimitOrders, - batchCreateSpotLimitOrders, - batchUpdateOrders, - cancelBinaryOptionsOrder, - cancelDerivativeOrder, - cancelSpotOrder, - createBinaryOptionsLimitOrder, - createBinaryOptionsMarketOrder, - createDerivativeLimitOrder, - createDerivativeMarketOrder, - createSpotLimitOrder, - createSpotMarketOrder, - deposit, - exec, - externalTransfer, - increasePositionMargin, - instantBinaryOptionsMarketLaunch, - instantExpiryFuturesMarketLaunch, - instantPerpetualMarketLaunch, - instantSpotMarketLaunch, - liquidatePosition, - rewardsOptOut, - subaccountTransfer, - withdraw, -} = injective.exchange.v1beta1.MessageComposer.withTypeUrl; -``` - -#### Insurance Messages - -```js -const { createInsuranceFund, requestRedemption, underwrite } = - injective.insurance.v1beta1.MessageComposer.withTypeUrl; -``` - -#### OCR Messages - -```js -const { - acceptPayeeship, - createFeed, - fundFeedRewardPool, - setPayees, - transferPayeeship, - transmit, - updateFeed, - withdrawFeedRewardPool, -} = injective.ocr.v1beta1.MessageComposer.withTypeUrl; -``` - -#### Oracle Messages - -```js -const { - relayBandRates, - relayCoinbaseMessages, - relayPriceFeedPrice, - relayProviderPrices, - requestBandIBCRates, -} = injective.oracle.v1beta1.MessageComposer.withTypeUrl; -``` - -#### Peggy Messages - -```js -const { - cancelSendToEth, - confirmBatch, - depositClaim, - eRC20DeployedClaim, - requestBatch, - sendToEth, - setOrchestratorAddresses, - submitBadSignatureEvidence, - valsetConfirm, - valsetUpdateClaim, - withdrawClaim, -} = injective.peggy.v1.MessageComposer.withTypeUrl; -``` - -#### CosmWasm Messages - -```js -import { cosmwasm } from "injective-vue"; - -const { - clearAdmin, - executeContract, - instantiateContract, - migrateContract, - storeCode, - updateAdmin, -} = cosmwasm.wasm.v1.MessageComposer.withTypeUrl; -``` - -#### IBC Messages - -```js -import { ibc } from "injective-vue"; - -const { transfer } = ibc.applications.transfer.v1.MessageComposer.withTypeUrl; -``` - -#### Cosmos Messages - -```js -import { cosmos } from "injective-vue"; - -const { - fundCommunityPool, - setWithdrawAddress, - withdrawDelegatorReward, - withdrawValidatorCommission, -} = cosmos.distribution.v1beta1.MessageComposer.fromPartial; - -const { multiSend, send } = cosmos.bank.v1beta1.MessageComposer.fromPartial; - -const { - beginRedelegate, - createValidator, - delegate, - editValidator, - undelegate, -} = cosmos.staking.v1beta1.MessageComposer.fromPartial; - -const { deposit, submitProposal, vote, voteWeighted } = - cosmos.gov.v1beta1.MessageComposer.fromPartial; -``` - -## Connecting with Wallets and Signing Messages - -⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. - -Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. - -### Initializing the Signing Client - -Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: - -```js -import { SigningClient } from "@interchainjs/cosmos/signing-client"; -import { defaultSignerOptions } from "@interchainjs/injective/defaults"; - -const signingClient = await SigningClient.connectWithSigner( - await getRpcEndpoint(), - new AminoGenericOfflineSigner(aminoOfflineSigner), - { - signerOptions: defaultSignerOptions.Cosmos, - } -); -``` - -### Creating Signers - -To broadcast messages, you can create signers with a variety of options: - -- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) -- [keplr](https://docs.keplr.app/api/cosmjs.html) -- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) - -### Broadcasting Messages - -When you have your `signing client`, you can broadcast messages: - -```js -const msg = { - typeUrl: MsgSend.typeUrl, - value: MsgSend.fromPartial({ - amount: [ - { - denom: "inj", - amount: "1000", - }, - ], - toAddress: address, - fromAddress: address, - }), -}; - -const fee: StdFee = { - amount: [ - { - denom: "inj", - amount: "864", - }, - ], - gas: "86364", -}; -const response = await signingClient.signAndBroadcast(address, [msg], fee); -``` - -### All In One Example - -For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: - -- Initialize the client. -- Create and sign messages. -- Broadcast transactions. -- Handle responses and errors. - -The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. - -Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. - -## Advanced Usage - -If you want to manually construct a signing client, you can do so by following the example below: - -```js -import { - cosmosAminoConverters, - cosmosProtoRegistry, - cosmwasmAminoConverters, - cosmwasmProtoRegistry, - ibcProtoRegistry, - ibcAminoConverters, - injectiveAminoConverters, - injectiveProtoRegistry -} from 'injective-vue'; - -const signer: OfflineSigner = /* create your signer (see above) */ -const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL - -const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ - ...cosmosProtoRegistry, - ...cosmwasmProtoRegistry, - ...ibcProtoRegistry, - ...injectiveProtoRegistry -]; - -const aminoConverters = { - ...cosmosAminoConverters, - ...cosmwasmAminoConverters, - ...ibcAminoConverters, - ...injectiveAminoConverters -}; - -const registry = new Registry(protoRegistry); -const aminoTypes = new AminoTypes(aminoConverters); - -const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); - -signingClient.addEncoders(registry); -signingClient.addConverters(aminoTypes); -``` - -## Developing - -When first cloning the repo: - -```shell -yarn -yarn build:dev -``` - -### Codegen - -Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: - -```shell -yarn codegen -``` - -### Publishing - -Build the types and then publish: - -```shell -yarn build -yarn publish -``` - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/injectivejs/_meta.json b/docs/libs/injectivejs/_meta.json deleted file mode 100644 index 356de82b4..000000000 --- a/docs/libs/injectivejs/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "index": "Overview" -} \ No newline at end of file diff --git a/docs/libs/injectivejs/index.mdx b/docs/libs/injectivejs/index.mdx deleted file mode 100644 index f1442d2e8..000000000 --- a/docs/libs/injectivejs/index.mdx +++ /dev/null @@ -1,624 +0,0 @@ -# InjectiveJS - -

- -

- -

- - - - - - - - - -

- -## install - -```sh -npm install injectivejs -``` - -## Table of contents - -- [InjectiveJS](#injectivejs) -- [Install](#install) -- [Table of contents](#table-of-contents) -- [Usage](#usage) - - [RPC Clients](#rpc-clients) - - [Tx Helpers](#tx-helpers) - - [Auction](#auction) - - [Exchange](#exchange) - - [Insurance](#insurance) - - [OCR](#ocr) - - [Oracle](#oracle) - - [Peggy](#peggy) - - [CosmWasm](#cosmwasm) - - [IBC](#ibc) - - [Cosmos](#cosmos) - - [Composing Messages](#composing-messages) - - [Auction Messages](#auction-messages) - - [Exchange Messages](#exchange-messages) - - [Insurance Messages](#insurance-messages) - - [OCR Messages](#ocr-messages) - - [Oracle Messages](#oracle-messages) - - [Peggy Messages](#peggy-messages) - - [CosmWasm Messages](#cosmwasm-messages) - - [IBC Messages](#ibc-messages) - - [Cosmos Messages](#cosmos-messages) -- [Connecting with Wallets and Signing Messages](#connecting-with-wallets-and-signing-messages) - - [Initializing the Signing Client](#initializing-the-signing-client) - - [Creating Signers](#creating-signers) - - [Broadcasting Messages](#broadcasting-messages) -- [All In One Example](#all-in-one-example) -- [Advanced Usage](#advanced-usage) -- [Developing](#developing) - - [Codegen](#codegen) - - [Publishing](#publishing) -- [Credits](#credits) -- [License](#license) - -## Usage - -### RPC Clients - -```js -import { getAllBalances } from "injectivejs/cosmos/bank/v1beta1/query.rpc.func"; -import { getExchangeBalances } from "injectivejs/injective/exchange/v1beta1/query.rpc.func"; - -{ getRpcEndpoint } = useChain("injective"); - -const endpoint = await getRpcEndpoint(); - -// now you can query the cosmos modules -const balance = await getAllBalances(endpoint, { - address: "inj1addresshere", -}); - -const exchangeBalance = await getExchangeBalances(endpoint, {}); -``` - -### Tx Helpers - -For tx messages, there're helper functions to sign and broadcast messages: - -For more detailed usage on how to use these functions, please see the starship tests in the [networks/injective repo](https://github.com/hyperweb-io/interchainjs/tree/main/networks/injective/starship/__tests__) - -There're also react and vue hooks for helper functions. Please see [injective-react](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-react) and [injective-vue](https://github.com/hyperweb-io/interchainjs/tree/main/libs/injective-vue) repos for more information. - -```js -import { - createDeposit, - createLiquidatePosition, - createActivateStakeGrant, -} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; -``` - -#### Auction - -```js -import { bid } from "injectivejs/injective/auction/v1beta1/tx.rpc.func"; -``` - -#### Exchange - -```js -import { - activateStakeGrant, - adminUpdateBinaryOptionsMarket, - authorizeStakeGrants, - batchCancelBinaryOptionsOrders, - batchCancelDerivativeOrders, - batchCancelSpotOrders, - batchCreateDerivativeLimitOrders, - batchCreateSpotLimitOrders, - batchUpdateOrders, - cancelBinaryOptionsOrder, - cancelDerivativeOrder, - cancelSpotOrder, - createBinaryOptionsLimitOrder, - createBinaryOptionsMarketOrder, - createDerivativeLimitOrder, - createDerivativeMarketOrder, - createSpotLimitOrder, - createSpotMarketOrder, - decreasePositionMargin, - deposit, - emergencySettleMarket, - externalTransfer, - increasePositionMargin, - instantBinaryOptionsMarketLaunch, - instantExpiryFuturesMarketLaunch, - instantPerpetualMarketLaunch, - instantSpotMarketLaunch, - liquidatePosition, - privilegedExecuteContract, - rewardsOptOut, - subaccountTransfer, - updateDerivativeMarket, - updateParams, - updateSpotMarket, - withdraw, -} from "injectivejs/injective/exchange/v1beta1/tx.rpc.func"; -``` - -#### Insurance - -```js -import { - createInsuranceFund, - requestRedemption, - underwrite, -} from "injectivejs/injective/insurance/v1beta1/tx.rpc.func"; -``` - -#### OCR - -```js -import { - acceptPayeeship, - createFeed, - fundFeedRewardPool, - setPayees, - transferPayeeship, - transmit, - updateFeed, - withdrawFeedRewardPool, -} from "injectivejs/injective/ocr/v1beta1/tx.rpc.func"; -``` - -#### Oracle - -```js -import { - relayBandRates, - relayCoinbaseMessages, - relayPriceFeedPrice, - relayProviderPrices, - relayPythPrices, - relayStorkMessage, - requestBandIBCRates, -} from "injectivejs/injective/oracle/v1beta1/tx.rpc.func"; -``` - -#### Peggy - -```js -import { - blacklistEthereumAddresses, - cancelSendToEth, - confirmBatch, - depositClaim, - eRC20DeployedClaim, - requestBatch, - revokeEthereumBlacklist, - sendToEth, - setOrchestratorAddresses, - submitBadSignatureEvidence, - valsetConfirm, - valsetUpdateClaim, - withdrawClaim, -} from "injectivejs/injective/peggy/v1/msgs.rpc.func"; -``` - -#### CosmWasm - -```js -import { - executeContract, - clearAdmin, - instantiateContract, - instantiateContract2, - migrateContract, - pinCodes, - removeCodeUploadParamsAddresses, - storeAndInstantiateContract, - storeCode, - sudoContract, - unpinCodes, - updateAdmin, - updateContractLabel, - updateInstantiateConfig, - addCodeUploadParamsAddresses, - storeAndMigrateContract, -} from "injectivejs/cosmwasm/wasm/v1/tx.rpc.func"; -``` - -#### IBC - -```js -import { transfer } from "injectivejs/ibc/applications/transfer/v1/tx.rpc.func"; -``` - -#### Cosmos - -```js -import { - fundCommunityPool, - communityPoolSpend, - depositValidatorRewardsPool, -} from "injectivejs/cosmos/distribution/v1beta1/tx.rpc.func"; - -import { send, multiSend } from "injectivejs/cosmos/bank/v1beta1/tx.rpc.func"; - -import { - delegate, - undelegate, - cancelUnbondingDelegation, - createValidator, -} from "injectivejs/cosmos/staking/v1beta1/tx.rpc.func"; - -import { - deposit, - submitProposal, - vote, - voteWeighted, -} from "injectivejs/cosmos/gov/v1beta1/tx.rpc.func"; -``` - -### Composing Messages - -Import the `injective` object from `injectivejs`. - -```js -import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; - -const { createSpotLimitOrder, createSpotMarketOrder, deposit } = - MessageComposer.withTypeUrl; -``` - -#### Auction Messages - -```js -import { MessageComposer } from "injectivejs/injective/auction/v1beta1/tx.registry"; - -const { bid } = MessageComposer.withTypeUrl; -``` - -#### Exchange Messages - -```js -import { MessageComposer } from "injectivejs/injective/exchange/v1beta1/tx.registry"; - -const { - adminUpdateBinaryOptionsMarket, - batchCancelBinaryOptionsOrders, - batchCancelDerivativeOrders, - batchCancelSpotOrders, - batchCreateDerivativeLimitOrders, - batchCreateSpotLimitOrders, - batchUpdateOrders, - cancelBinaryOptionsOrder, - cancelDerivativeOrder, - cancelSpotOrder, - createBinaryOptionsLimitOrder, - createBinaryOptionsMarketOrder, - createDerivativeLimitOrder, - createDerivativeMarketOrder, - createSpotLimitOrder, - createSpotMarketOrder, - deposit, - exec, - externalTransfer, - increasePositionMargin, - instantBinaryOptionsMarketLaunch, - instantExpiryFuturesMarketLaunch, - instantPerpetualMarketLaunch, - instantSpotMarketLaunch, - liquidatePosition, - rewardsOptOut, - subaccountTransfer, - withdraw, -} = MessageComposer.withTypeUrl; -``` - -#### Insurance Messages - -```js -import { MessageComposer } from "injectivejs/injective/insurance/v1beta1/tx.registry"; - -const { createInsuranceFund, requestRedemption, underwrite } = - MessageComposer.withTypeUrl; -``` - -#### OCR Messages - -```js -import { MessageComposer } from "injectivejs/injective/ocr/v1beta1/tx.registry"; - -const { - acceptPayeeship, - createFeed, - fundFeedRewardPool, - setPayees, - transferPayeeship, - transmit, - updateFeed, - withdrawFeedRewardPool, -} = MessageComposer.withTypeUrl; -``` - -#### Oracle Messages - -```js -import { MessageComposer } from "injectivejs/injective/oracle/v1beta1/tx.registry"; - -const { - relayBandRates, - relayCoinbaseMessages, - relayPriceFeedPrice, - relayProviderPrices, - requestBandIBCRates, -} = MessageComposer.withTypeUrl; -``` - -#### Peggy Messages - -```js -import { MessageComposer } from "injectivejs/injective/peggy/v1/tx.registry"; - -const { - cancelSendToEth, - confirmBatch, - depositClaim, - eRC20DeployedClaim, - requestBatch, - sendToEth, - setOrchestratorAddresses, - submitBadSignatureEvidence, - valsetConfirm, - valsetUpdateClaim, - withdrawClaim, -} = MessageComposer.withTypeUrl; -``` - -#### CosmWasm Messages - -```js -import { MessageComposer } from "injectivejs/cosmwasm/wasm/v1/tx.registry"; - -const { - clearAdmin, - executeContract, - instantiateContract, - migrateContract, - storeCode, - updateAdmin, -} = MessageComposer.withTypeUrl; -``` - -#### IBC Messages - -```js -import { MessageComposer } from "injectivejs/ibc/applications/transfer/v1/tx.registry"; - -const { transfer } = MessageComposer.withTypeUrl; -``` - -#### Cosmos Messages - -```js -import { MessageComposer } from "injectivejs/cosmos/distribution/v1beta1/tx.registry"; - -const { - fundCommunityPool, - setWithdrawAddress, - withdrawDelegatorReward, - withdrawValidatorCommission, -} = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/bank/v1beta1/tx.registry"; - -const { multiSend, send } = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/staking/v1beta1/tx.registry"; - -const { - beginRedelegate, - createValidator, - delegate, - editValidator, - undelegate, -} = MessageComposer.fromPartial; -``` - -```js -import { MessageComposer } from "injectivejs/cosmos/gov/v1beta1/tx.registry"; - -const { deposit, submitProposal, vote, voteWeighted } = - cosmos.gov.v1beta1.MessageComposer.fromPartial; -``` - -## Connecting with Wallets and Signing Messages - -⚡️ For web interfaces, we recommend using [interchain-kit](https://github.com/hyperweb-io/interchain-kit/). Continue below to see how to manually construct signers and clients. - -Here are the docs on [creating signers](https://github.com/hyperweb-io/interchain-kit/blob/main/packages/core/README.md) in interchain-kit that can be used with Keplr and other wallets. - -### Initializing the Signing Client - -Use SigningClient.connectWithSigner and pass in the signer options for injective to get your `SigningClient`: - -```js -import { SigningClient } from "@interchainjs/cosmos/signing-client"; -import { defaultSignerOptions } from "@interchainjs/injective/defaults"; - -const signingClient = await SigningClient.connectWithSigner( - await getRpcEndpoint(), - new AminoGenericOfflineSigner(aminoOfflineSigner), - { - signerOptions: defaultSignerOptions.Cosmos, - } -); -``` - -### Creating Signers - -To broadcast messages, you can create signers with a variety of options: - -- [interchain-kit](https://github.com/hyperweb-io/interchain-kit/) (recommended) -- [keplr](https://docs.keplr.app/api/cosmjs.html) -- [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) - -### Broadcasting Messages - -When you have your `signing client`, you can broadcast messages: - -```js -const msg = { - typeUrl: MsgSend.typeUrl, - value: MsgSend.fromPartial({ - amount: [ - { - denom: "inj", - amount: "1000", - }, - ], - toAddress: address, - fromAddress: address, - }), -}; - -const fee: StdFee = { - amount: [ - { - denom: "inj", - amount: "864", - }, - ], - gas: "86364", -}; -const response = await signingClient.signAndBroadcast(address, [msg], fee); -``` - -### All In One Example - -For a comprehensive example of how to use InjectiveJS to send messages, please see the example [here](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective/components/SendMsg.tsx). This example demonstrates how to: - -- Initialize the client. -- Create and sign messages. -- Broadcast transactions. -- Handle responses and errors. - -The example provides a complete walkthrough of setting up the client, creating a message for sending tokens, and broadcasting the transaction to the Injective blockchain. - -Follow the [instructions](https://github.com/hyperweb-io/create-interchain-app/tree/main/examples/injective) in the example to set up your InjectiveJS client and start sending messages to the Injective blockchain. - -## Advanced Usage - -If you want to manually construct a signing client, you can do so by following the example below: - -```js -import { - cosmosAminoConverters, - cosmosProtoRegistry, - cosmwasmAminoConverters, - cosmwasmProtoRegistry, - ibcProtoRegistry, - ibcAminoConverters, - injectiveAminoConverters, - injectiveProtoRegistry -} from 'injectivejs'; - -const signer: OfflineSigner = /* create your signer (see above) */ -const rpcEndpoint = 'https://rpc.cosmos.directory/injective'; // or another URL - -const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ - ...cosmosProtoRegistry, - ...cosmwasmProtoRegistry, - ...ibcProtoRegistry, - ...injectiveProtoRegistry -]; - -const aminoConverters = { - ...cosmosAminoConverters, - ...cosmwasmAminoConverters, - ...ibcAminoConverters, - ...injectiveAminoConverters -}; - -const registry = new Registry(protoRegistry); -const aminoTypes = new AminoTypes(aminoConverters); - -const signingClient = await SigningClient.connectWithSigner(rpcEndpoint, signer); - -signingClient.addEncoders(registry); -signingClient.addConverters(aminoTypes); -``` - -## Developing - -When first cloning the repo: - -```shell -yarn -yarn build:dev -``` - -### Codegen - -Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/inj.telescope.json` and configure the settings for bundling your SDK and contracts into `injectivejs`: - -```shell -yarn codegen -``` - -### Publishing - -Build the types and then publish: - -```shell -yarn build -yarn publish -``` - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/libs/interchain-vue/_meta.json b/docs/libs/interchain-vue/_meta.json deleted file mode 100644 index 356de82b4..000000000 --- a/docs/libs/interchain-vue/_meta.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "index": "Overview" -} \ No newline at end of file diff --git a/docs/libs/interchain-vue/index.mdx b/docs/libs/interchain-vue/index.mdx deleted file mode 100644 index 6f54191ab..000000000 --- a/docs/libs/interchain-vue/index.mdx +++ /dev/null @@ -1,168 +0,0 @@ -# @interchainjs/vue - -

- -

- -

- - - - - - - - - -

- -React query helper hooks(Tx, Query) generated by Telescope. - -### Tree Shakable Helpers - -InterchainJS provides tree shakable helper functions to optimize your application's bundle size. These helpers follow a factory pattern that allows modern JavaScript bundlers to eliminate unused code through tree shaking. These helpers improve modularity and optimize performance by allowing you to import only the functionality you need. -Tree shakable tutorial video: https://youtu.be/3dRm9HEklMo - -#### How Tree Shakable Helpers Work - -Each helper function is individually exported (e.g., `getAllBalances`). -Each customized hook is individually exported using a `use*` prefix (e.g., `useGetBalance`) -This pattern enables: - -1. **Bundle Size Optimization**: Only the functions you import and use are included in your final bundle -2. **Lazy Initialization**: Helper functions are only constructed when explicitly called -3. **Customizable Configuration**: Each helper can be configured with specific parameters - -For example, query helpers are functions that return other functions, constructed with specific parameters: - -```js -// Import only what you need -import { getAllBalances } from "@interchainjs/cosmos/bank/v1beta1/query.rpc.func"; - -// Now you can query the blockchain -const balance = await getAllBalances(endpoint, { - address: "cosmos1addresshere", -}); -``` - -For example, customized hooks are functions that return the result you want: - -```typescript -// Import only what you need -import { useGetBalance } from "@interchainjs/vue/cosmos/bank/v1beta1/query.rpc.vue"; - -// Initialize RPC endpoint and address, then you can get balance by tree shakable hooks -const request = computed(() => ({ - address: address.value, - denom, -})); - -const { - data: balance, - isSuccess: isBalanceLoaded, - isLoading: isFetchingBalance, - refetch: refetchBalance, -} = useGetBalance({ - request, - options: { - enabled: !!address, - select: ({ balance }) => - new BigNumber(balance?.amount ?? 0).multipliedBy( - 10 ** -COIN_DISPLAY_EXPONENT - ), - }, - clientResolver: rpcEndpoint, -}); -``` - -#### Available Helper Types - -InterchainJS provides two main types of tree shakable helpers and customized hooks: - -1. **Query Helpers/Customized Hooks**: For retrieving data from the blockchain - - ```js - import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; - import { useGetValidators } from "@interchainjs/vue/cosmos/staking/v1beta1/query.rpc.vue"; - ``` - -2. **Transaction Helpers/Customized Hooks**: For broadcasting transactions - - ```js - import { createDelegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; - import { useDelegate } from "@interchainjs/vue/cosmos/staking/v1beta1/tx.rpc.vue"; - ``` - -#### Example: Combining Query and Transaction Helpers - -Here's how you might use both types together in a staking scenario: - -```js -// Import helpers -import { getValidator } from "@interchainjs/cosmos/staking/v1beta1/query.rpc.func"; -import { delegate } from "@interchainjs/cosmos/staking/v1beta1/tx.rpc.func"; - -// Query validator info -const { validator } = await getValidator(endpoint, { - validatorAddr: "cosmosvaloper1...", -}); - -// Execute delegation -const result = await delegate( - singingClient, - signerAddress, - { - delegatorAddress: signerAddress, - validatorAddress: validator.operatorAddress, - amount: { denom: "uatom", amount: "1000000" }, - }, - fee, - "Delegation via InterchainJS" -); -``` - -By importing only the specific helpers you need, you ensure that your application bundle remains as small and efficient as possible. - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/docs/networks/_meta.json b/docs/networks/_meta.json index 6b118bb4e..b87d48ae8 100644 --- a/docs/networks/_meta.json +++ b/docs/networks/_meta.json @@ -1,5 +1,5 @@ { + "cosmos": "Cosmos", "ethereum": "Ethereum", - "injective": "Injective", - "cosmos": "Cosmos" + "injective": "Injective" } \ No newline at end of file diff --git a/docs/packages/_meta.json b/docs/packages/_meta.json index 842ef9a13..7964fc198 100644 --- a/docs/packages/_meta.json +++ b/docs/packages/_meta.json @@ -1,10 +1,10 @@ { "amino": "Amino", - "math": "Math", - "utils": "Utils", + "auth": "Auth", + "crypto": "Crypto", "encoding": "Encoding", + "math": "Math", "pubkey": "Pubkey", - "auth": "Auth", "types": "Types", - "crypto": "Crypto" + "utils": "Utils" } \ No newline at end of file diff --git a/package.json b/package.json index 5b944a557..a57790619 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,9 @@ "lint": "lerna run lint --parallel", "symlink": "symlink-workspace --logLevel error", "postinstall": "yarn symlink", - "doc": "./scripts/copy_readmes.sh", - "doc:reverse": "./scripts/reverse_copy_readmes.sh" + "doc": "yarn doc:clean; ./scripts/docs/copy_readmes.sh; ./scripts/docs/generate_meta_json.sh", + "doc:reverse": "./scripts/docs/reverse_copy_readmes.sh", + "doc:clean": "rimraf ./docs/libs; rimraf ./docs/networks; rimraf ./docs/packages; rimraf ./docs/_meta.json; rimraf ./docs/index.mdx;" }, "devDependencies": { "@chain-registry/client": "1.18.1", diff --git a/scripts/copy_readmes.sh b/scripts/docs/copy_readmes.sh similarity index 76% rename from scripts/copy_readmes.sh rename to scripts/docs/copy_readmes.sh index fc4c93d3e..bce3f5649 100755 --- a/scripts/copy_readmes.sh +++ b/scripts/docs/copy_readmes.sh @@ -1,14 +1,14 @@ #!/bin/bash # Set the project root directory -PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" DOCS_DIR="${PROJECT_ROOT}/docs" # Create docs directory if it doesn't exist mkdir -p "${DOCS_DIR}" # Copy README.md files from libs, packages, and networks, excluding dist and node_modules -find "${PROJECT_ROOT}/libs" "${PROJECT_ROOT}/packages" "${PROJECT_ROOT}/networks" -type f -name "README.md" ! -path "*/dist/*" ! -path "*/node_modules/*" | while read file; do +find "${PROJECT_ROOT}/libs" "${PROJECT_ROOT}/packages" "${PROJECT_ROOT}/networks" -type f -name "README.md" ! -path "*/dist/*" ! -path "*/node_modules/*" ! -path "*/injective-vue/*" ! -path "*/injective-react/*" ! -path "*/injectivejs/*" ! -path "*/interchain-vue/*" | while read file; do target_dir="${DOCS_DIR}/$(dirname "${file#${PROJECT_ROOT}/}")" mkdir -p "${target_dir}" cp "${file}" "${target_dir}/index.mdx" diff --git a/scripts/generate_meta_json.sh b/scripts/docs/generate_meta_json.sh similarity index 94% rename from scripts/generate_meta_json.sh rename to scripts/docs/generate_meta_json.sh index 15e98d172..a4242c0fc 100755 --- a/scripts/generate_meta_json.sh +++ b/scripts/docs/generate_meta_json.sh @@ -4,7 +4,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Change to the root directory -cd "$SCRIPT_DIR/.." +cd "$SCRIPT_DIR/../.." # Run the TypeScript script using ts-node # Check if ts-node is installed diff --git a/scripts/generate_meta_json.ts b/scripts/docs/generate_meta_json.ts similarity index 57% rename from scripts/generate_meta_json.ts rename to scripts/docs/generate_meta_json.ts index 237455641..1433ea8d8 100644 --- a/scripts/generate_meta_json.ts +++ b/scripts/docs/generate_meta_json.ts @@ -1,8 +1,48 @@ import fs from 'fs'; import path from 'path'; +// Priority configuration for directory and file sorting +const PRIORITY_CONFIG: Record> = { + 'libs': { + 'cosmos-types': 60, + 'interchainjs': 50, + 'interchain-react': 40, + }, + 'networks': { + 'cosmos': 60, + 'ethereum': 50, + 'injective': 40, + }, + // Global defaults can be added here + '_global': { + } +}; + // Base directory for docs -const DOCS_DIR = path.resolve(__dirname, '../docs'); +const DOCS_DIR = path.resolve(__dirname, '../../docs'); + +/** + * Get priority for a specific key in a given context + */ +function getPriority(context: string, key: string): number { + // Check context-specific priority first + if (context && PRIORITY_CONFIG[context] && PRIORITY_CONFIG[context][key] !== undefined) { + return PRIORITY_CONFIG[context][key]; + } + + // Check global defaults + if (PRIORITY_CONFIG['_global'] && PRIORITY_CONFIG['_global'][key] !== undefined) { + return PRIORITY_CONFIG['_global'][key]; + } + + // Default priority for index is always 9999 + if (key === 'index') { + return 9999; + } + + // Default to 0 if no priority is specified + return 0; +} /** * Format a filename or directory name to a readable title @@ -28,9 +68,14 @@ function formatTitle(name: string): string { } /** - * Generate _meta.json content for a directory + * Generate _meta.json content for a directory with custom sorting */ function generateMetaContent(dirPath: string): Record { + // Determine context based on whether it's a file or directory + const context = fs.statSync(dirPath).isDirectory() + ? path.basename(dirPath) + : path.basename(path.dirname(dirPath)); + const entries = fs.readdirSync(dirPath, { withFileTypes: true }); const meta: Record = {}; @@ -50,13 +95,27 @@ function generateMetaContent(dirPath: string): Record { meta[entry.name] = formatTitle(entry.name); }); - // If we have an index file, make sure it's first - if (meta.index) { - const { index, ...rest } = meta; - return { index, ...rest }; - } + // Sort keys based on priority and then alphabetically + const sortedMeta: Record = {}; + Object.keys(meta) + .sort((a, b) => { + const priorityA = getPriority(context, a); + const priorityB = getPriority(context, b); + + // First, compare by priority (descending) + if (priorityA !== priorityB) { + return priorityB - priorityA; + } + + // If priorities are equal, sort alphabetically + return a.localeCompare(b); + }) + .forEach(key => { + sortedMeta[key] = meta[key]; + }); + - return meta; + return sortedMeta; } /** diff --git a/scripts/reverse_copy_readmes.sh b/scripts/docs/reverse_copy_readmes.sh similarity index 94% rename from scripts/reverse_copy_readmes.sh rename to scripts/docs/reverse_copy_readmes.sh index dda809a57..c51db9aee 100755 --- a/scripts/reverse_copy_readmes.sh +++ b/scripts/docs/reverse_copy_readmes.sh @@ -1,7 +1,7 @@ #!/bin/bash # Set the project root directory -PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" DOCS_DIR="${PROJECT_ROOT}/docs" # Copy index.mdx files from docs/libs, docs/packages, and docs/networks back to their source locations From d5e9c9304de1d66f02ad522bc484a9dbdc2d9894 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 16:36:06 +0800 Subject: [PATCH 15/19] sort folders in meta json --- docs/_meta.json | 6 +++--- scripts/docs/generate_meta_json.ts | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/_meta.json b/docs/_meta.json index 7ac9bd02b..b85e4b733 100644 --- a/docs/_meta.json +++ b/docs/_meta.json @@ -1,7 +1,7 @@ { "index": "Overview", - "advanced": "Advanced", - "libs": "Libs", "networks": "Networks", - "packages": "Packages" + "libs": "Libs", + "packages": "Packages", + "advanced": "Advanced" } \ No newline at end of file diff --git a/scripts/docs/generate_meta_json.ts b/scripts/docs/generate_meta_json.ts index 1433ea8d8..3412f2e57 100644 --- a/scripts/docs/generate_meta_json.ts +++ b/scripts/docs/generate_meta_json.ts @@ -3,6 +3,12 @@ import path from 'path'; // Priority configuration for directory and file sorting const PRIORITY_CONFIG: Record> = { + 'docs': { + 'networks': 100, + 'libs': 90, + 'packages': 80, + 'advanced': 70, + }, 'libs': { 'cosmos-types': 60, 'interchainjs': 50, From 8b354bdda3d75fd7108b092b2654305ed24587d5 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 19:39:59 +0800 Subject: [PATCH 16/19] fix gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 94aaefbb5..6258e52b9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,3 @@ **/dist_spec **/yarn-error.log lerna-debug.log - -docDraft.ts \ No newline at end of file From 4e74ef8d4fa367217bce20ffbd6aa4831fada7ca Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 19 May 2025 19:40:52 +0800 Subject: [PATCH 17/19] update eth readme --- docs/networks/ethereum/index.mdx | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/docs/networks/ethereum/index.mdx b/docs/networks/ethereum/index.mdx index 84f03238e..05b806dc4 100644 --- a/docs/networks/ethereum/index.mdx +++ b/docs/networks/ethereum/index.mdx @@ -153,6 +153,60 @@ const receipt = await tx.wait(); For more details, see this example: https://github.com/hyperweb-io/create-interchain-app/blob/main/examples/ethereum/app/page.tsx +## Utility Functions + +### Denominations + +```typescript +import { + parseEther, + formatEther, + parseUnits, + formatUnits +} from "@interchainjs/ethereum/utils/denominations"; + +// Parse ETH to wei +const wei: bigint = parseEther("1.5"); // 1500000000000000000n + +// Format wei to ETH +const eth: string = formatEther(wei); // "1.5" + +// Parse a token amount (e.g., 6 decimals) +const units: bigint = parseUnits("123.456", 6); + +// Format back to human‐readable +const amount: string = formatUnits(units, 6); // "123.456" +``` + +### Encoding + +```typescript +import { + utf8ToHex, + hexToUtf8 +} from "@interchainjs/ethereum/utils/encoding"; + +const hex = utf8ToHex("Hello, Ethereum!"); // "48656c6c6f2c20457468657265756d21" +const str = hexToUtf8("0x48656c6c6f"); // "Hello" +``` + +### Address Utilities + +```typescript +import { + isValidEthereumAddress, + toChecksumAddress +} from "@interchainjs/ethereum/utils/address"; + +const addr = "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359"; +console.log(isValidEthereumAddress(addr)); +// true + +const lower = "0xfB6916095ca1df60bb79ce92ce3ea74c37c5d359"; +console.log(toChecksumAddress(lower)); +// "0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359" +``` + ## Implementations - **SignerFromPrivateKey** from `@interchainjs/ethereum/signers/SignerFromPrivateKey` From 1cb33a924feb942c7d580419051e44ea27b9be9d Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 20 May 2025 08:51:24 +0800 Subject: [PATCH 18/19] refine the index doc --- README copy.md | 273 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 README copy.md diff --git a/README copy.md b/README copy.md new file mode 100644 index 000000000..34c58fca2 --- /dev/null +++ b/README copy.md @@ -0,0 +1,273 @@ +# InterchainJS + +

+ +

+ +

+ + + + + + + + + +

+ +A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. + +## Table of Contents + +- [Introduction](#interchainjs-universal-signing-for-web3) +- [Overview](#overview) +- [Installation](#installation) +- [Quick Start](#quick-start) + - [Create Interchain App](#quick-setup-with-create-interchain-app) +- [Supported Networks](#supported-networks) + - [Cosmos Network](#cosmos-network) + - [Injective Network](#injective-network) + - [Ethereum Network](#ethereum-network) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️) +- [Credits](#credits) +- [Disclaimer](#disclaimer) + +## InterchainJS: Universal Signing for Web3 + +[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. + +At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. + +## Overview + +InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: + +- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. +- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. +- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. +- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. + +This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. + +### Visualizing InterchainJS Components + +The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. + +```mermaid +graph LR + signers --> cosmos_signer["Cosmos Network"] + signers --> injective_signer["Injective Network"] + signers --> ethereum_signer["Ethereum Network"] + signers --> implement_signer["ANY Network"] + + cosmos_signer --> cosmos_amino["Amino Signer"] + cosmos_signer --> cosmos_direct["Direct Signer"] + + ethereum_signer --> ethereum_eip712["EIP712 Signer"] + + injective_signer --> injective_amino["Amino Signer"] + injective_signer --> injective_direct["Direct Signer"] + + implement_signer --> any_signer["Any Signer"] + + style signers fill:#f9f,stroke:#333,stroke-width:2px +``` + +```mermaid +graph LR + encoders[Encoders] --> auth["@interchainjs/auth"] + encoders --> utils["@interchainjs/utils"] + encoders --> cosmos_types["@interchainjs/cosmos-types"] + + auth --> secp256k1_auth["Secp256k1 Auth"] + auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] + + utils --> signer_utils["Signer Utilities"] + utils --> crypto_utils["Crypto Utilities"] + + style encoders fill:#f9f,stroke:#333,stroke-width:2px + style auth fill:#ccf,stroke:#333,stroke-width:2px + style utils fill:#ccf,stroke:#333,stroke-width:2px +``` + +## Installation + +This guide will walk you through the process of installing and setting up interchainjs for your project. + +You can install interchainjs using Yarn: + +```bash +yarn add interchainjs +yarn add @interchainjs/cosmos +``` + +or npm + +```bash +npm i interchainjs +npm i @interchainjs/cosmos +``` + +## Quick Start + +Get a signing client to send the trasactions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos"; + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + registry: [ + // as many as possible encoders registered here. + MsgDelegate, + MsgSend, + ], + broadcast: { + checkTx: true, + }, + } +); + +// sign and broadcast +const result = await signingClient.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw +``` + +Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; +import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func"; +import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; + +// query to get balance +const { balance } = await getBalance(await getRpcEndpoint(), { + address: directAddress, + denom, +}); + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + // no registry needed here anymore + // registry: [ + // ], + broadcast: { + checkTx: true, + }, + } +); + +// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once. +const result = await submitProposal( + signingClient, + directAddress, + { + proposer: directAddress, + initialDeposit: [ + { + amount: "1000000", + denom: denom, + }, + ], + content: { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(contentMsg).finish(), + }, + }, + fee, + "submit proposal" +); +console.log(result.hash); // the hash of TxRaw +``` + + +### Quick Setup with create-interchain-app + +The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies: + +```bash +npm install -g create-interchain-app + +cia --example authz +``` + +Then an authz example website will be created and users can take a look how signing clients and helper functions are used. + +--- + +## Supported Networks + +### Cosmos Network + +| Feature | Package | +| ---------------------------- | ------------------------------------------------------------- | +| **Transactions** | [@interchainjs/cosmos](https://docs.hyperweb.io/interchain-js/networks/cosmos) | +| **Cosmos Types** | [@interchainjs/cosmos-types](https://docs.hyperweb.io/interchain-js/libs/cosmos-types) | +| **Migration from `@cosmjs`** | [Migration Guide](https://docs.hyperweb.io/interchain-js/advanced/migration-from-cosmjs.mdx) | + +--- + +### Injective Network + +| Feature | Package | +| ---------------- | -------------------------------------------------------- | +| **Transactions** | [@interchainjs/injective](https://docs.hyperweb.io/interchain-js/networks/injective) | + +--- + +### Ethereum Network + +| Feature | Package | +| ---------------- | ------------------------------------------------------ | +| **Transactions** | [@interchainjs/ethereum](https://docs.hyperweb.io/interchain-js/networks/ethereum) | + +--- + +## Interchain JavaScript Stack ⚛️ + +A unified toolkit for building applications and smart contracts in the Interchain ecosystem + +| Category | Tools | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | +| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | +| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | +| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | +| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | +| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | +| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | +| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | +| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | + +## Credits + +🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. From c799551eab4985f1090a5599c6b0ea5bda9af480 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 20 May 2025 08:52:50 +0800 Subject: [PATCH 19/19] refine the index doc --- README copy.md | 273 ------------------------------------------------- README.md | 130 +++++++++++++++++++---- docs/index.mdx | 130 +++++++++++++++++++---- 3 files changed, 218 insertions(+), 315 deletions(-) delete mode 100644 README copy.md diff --git a/README copy.md b/README copy.md deleted file mode 100644 index 34c58fca2..000000000 --- a/README copy.md +++ /dev/null @@ -1,273 +0,0 @@ -# InterchainJS - -

- -

- -

- - - - - - - - - -

- -A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network. - -## Table of Contents - -- [Introduction](#interchainjs-universal-signing-for-web3) -- [Overview](#overview) -- [Installation](#installation) -- [Quick Start](#quick-start) - - [Create Interchain App](#quick-setup-with-create-interchain-app) -- [Supported Networks](#supported-networks) - - [Cosmos Network](#cosmos-network) - - [Injective Network](#injective-network) - - [Ethereum Network](#ethereum-network) -- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️) -- [Credits](#credits) -- [Disclaimer](#disclaimer) - -## InterchainJS: Universal Signing for Web3 - -[InterchainJS](https://hyperweb.io/stack/interchainjs) is a **universal signing interface** designed for seamless interoperability across blockchain networks. It is one of the **core libraries of the [Interchain JavaScript Stack](https://hyperweb.io/stack)**, a modular framework that brings Web3 development to millions of JavaScript developers. - -At its core, InterchainJS provides a **flexible adapter pattern** that abstracts away blockchain signing complexities, making it easy to integrate new networks, manage accounts, and support diverse authentication protocols and signing algorithms—all in a unified, extensible framework. - -## Overview - -InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks: - -- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond. -- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks. -- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design. -- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications. - -This modular architecture ensures **compatibility, extensibility, and ease of use**, allowing developers to compose powerful blockchain applications without deep protocol-specific knowledge. - -### Visualizing InterchainJS Components - -The diagram below illustrates how InterchainJS connects different signer types to various network classes, showcasing its adaptability for a wide range of blockchain environments. - -```mermaid -graph LR - signers --> cosmos_signer["Cosmos Network"] - signers --> injective_signer["Injective Network"] - signers --> ethereum_signer["Ethereum Network"] - signers --> implement_signer["ANY Network"] - - cosmos_signer --> cosmos_amino["Amino Signer"] - cosmos_signer --> cosmos_direct["Direct Signer"] - - ethereum_signer --> ethereum_eip712["EIP712 Signer"] - - injective_signer --> injective_amino["Amino Signer"] - injective_signer --> injective_direct["Direct Signer"] - - implement_signer --> any_signer["Any Signer"] - - style signers fill:#f9f,stroke:#333,stroke-width:2px -``` - -```mermaid -graph LR - encoders[Encoders] --> auth["@interchainjs/auth"] - encoders --> utils["@interchainjs/utils"] - encoders --> cosmos_types["@interchainjs/cosmos-types"] - - auth --> secp256k1_auth["Secp256k1 Auth"] - auth --> ethSecp256k1_auth["EthSecp256k1 Auth"] - - utils --> signer_utils["Signer Utilities"] - utils --> crypto_utils["Crypto Utilities"] - - style encoders fill:#f9f,stroke:#333,stroke-width:2px - style auth fill:#ccf,stroke:#333,stroke-width:2px - style utils fill:#ccf,stroke:#333,stroke-width:2px -``` - -## Installation - -This guide will walk you through the process of installing and setting up interchainjs for your project. - -You can install interchainjs using Yarn: - -```bash -yarn add interchainjs -yarn add @interchainjs/cosmos -``` - -or npm - -```bash -npm i interchainjs -npm i @interchainjs/cosmos -``` - -## Quick Start - -Get a signing client to send the trasactions: - -```ts -import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos"; - -const signingClient = await CosmosSigningClient.connectWithSigner( - await getRpcEndpoint(), - new DirectGenericOfflineSigner(directSigner), - { - registry: [ - // as many as possible encoders registered here. - MsgDelegate, - MsgSend, - ], - broadcast: { - checkTx: true, - }, - } -); - -// sign and broadcast -const result = await signingClient.signAndBroadcast([]); -console.log(result.hash); // the hash of TxRaw -``` - -Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions: - -```ts -import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; -import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func"; -import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; - -// query to get balance -const { balance } = await getBalance(await getRpcEndpoint(), { - address: directAddress, - denom, -}); - -const signingClient = await CosmosSigningClient.connectWithSigner( - await getRpcEndpoint(), - new DirectGenericOfflineSigner(directSigner), - { - // no registry needed here anymore - // registry: [ - // ], - broadcast: { - checkTx: true, - }, - } -); - -// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once. -const result = await submitProposal( - signingClient, - directAddress, - { - proposer: directAddress, - initialDeposit: [ - { - amount: "1000000", - denom: denom, - }, - ], - content: { - typeUrl: "/cosmos.gov.v1beta1.TextProposal", - value: TextProposal.encode(contentMsg).finish(), - }, - }, - fee, - "submit proposal" -); -console.log(result.hash); // the hash of TxRaw -``` - - -### Quick Setup with create-interchain-app - -The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies: - -```bash -npm install -g create-interchain-app - -cia --example authz -``` - -Then an authz example website will be created and users can take a look how signing clients and helper functions are used. - ---- - -## Supported Networks - -### Cosmos Network - -| Feature | Package | -| ---------------------------- | ------------------------------------------------------------- | -| **Transactions** | [@interchainjs/cosmos](https://docs.hyperweb.io/interchain-js/networks/cosmos) | -| **Cosmos Types** | [@interchainjs/cosmos-types](https://docs.hyperweb.io/interchain-js/libs/cosmos-types) | -| **Migration from `@cosmjs`** | [Migration Guide](https://docs.hyperweb.io/interchain-js/advanced/migration-from-cosmjs.mdx) | - ---- - -### Injective Network - -| Feature | Package | -| ---------------- | -------------------------------------------------------- | -| **Transactions** | [@interchainjs/injective](https://docs.hyperweb.io/interchain-js/networks/injective) | - ---- - -### Ethereum Network - -| Feature | Package | -| ---------------- | ------------------------------------------------------ | -| **Transactions** | [@interchainjs/ethereum](https://docs.hyperweb.io/interchain-js/networks/ethereum) | - ---- - -## Interchain JavaScript Stack ⚛️ - -A unified toolkit for building applications and smart contracts in the Interchain ecosystem - -| Category | Tools | Description | -| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -| **Chain Information** | [**Chain Registry**](https://github.com/hyperweb-io/chain-registry), [**Utils**](https://www.npmjs.com/package/@chain-registry/utils), [**Client**](https://www.npmjs.com/package/@chain-registry/client) | Everything from token symbols, logos, and IBC denominations for all assets you want to support in your application. | -| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)beta, [**Cosmos Kit**](https://github.com/hyperweb-io/cosmos-kit) | Experience the convenience of connecting with a variety of web3 wallets through a single, streamlined interface. | -| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)beta, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network | -| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. | -| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)beta, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. | -| **UI Kits** | [**Interchain UI**](https://github.com/hyperweb-io/interchain-ui) | The Interchain Design System, empowering developers with a flexible, easy-to-use UI kit. | -| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. | -| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript | -| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. | - -## Credits - -🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io) - -## Disclaimer - -AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. - -No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/README.md b/README.md index cc3a40228..34c58fca2 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,14 @@ A single, universal signing interface for any network. Birthed from the intercha - [Introduction](#interchainjs-universal-signing-for-web3) - [Overview](#overview) -- [Tutorials and Docs](#tutorial-for-building-a-custom-signer) -- [Auth](#auth) +- [Installation](#installation) +- [Quick Start](#quick-start) + - [Create Interchain App](#quick-setup-with-create-interchain-app) - [Supported Networks](#supported-networks) - [Cosmos Network](#cosmos-network) - [Injective Network](#injective-network) - [Ethereum Network](#ethereum-network) -- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-⚛️) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️) - [Credits](#credits) - [Disclaimer](#disclaimer) @@ -108,25 +109,112 @@ graph LR style utils fill:#ccf,stroke:#333,stroke-width:2px ``` ---- +## Installation -## Tutorials & Documentation +This guide will walk you through the process of installing and setting up interchainjs for your project. -| Topic | Documentation | -| ---------------------------- | ----------------------------- | -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | +You can install interchainjs using Yarn: + +```bash +yarn add interchainjs +yarn add @interchainjs/cosmos +``` + +or npm + +```bash +npm i interchainjs +npm i @interchainjs/cosmos +``` + +## Quick Start + +Get a signing client to send the trasactions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos"; + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + registry: [ + // as many as possible encoders registered here. + MsgDelegate, + MsgSend, + ], + broadcast: { + checkTx: true, + }, + } +); + +// sign and broadcast +const result = await signingClient.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw +``` + +Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; +import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func"; +import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; + +// query to get balance +const { balance } = await getBalance(await getRpcEndpoint(), { + address: directAddress, + denom, +}); + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + // no registry needed here anymore + // registry: [ + // ], + broadcast: { + checkTx: true, + }, + } +); + +// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once. +const result = await submitProposal( + signingClient, + directAddress, + { + proposer: directAddress, + initialDeposit: [ + { + amount: "1000000", + denom: denom, + }, + ], + content: { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(contentMsg).finish(), + }, + }, + fee, + "submit proposal" +); +console.log(result.hash); // the hash of TxRaw +``` ---- -## Auth +### Quick Setup with create-interchain-app -The authentication module is universally applied across different networks. +The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies: + +```bash +npm install -g create-interchain-app + +cia --example authz +``` -| Package | Description | -| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | -| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | +Then an authz example website will be created and users can take a look how signing clients and helper functions are used. --- @@ -136,9 +224,9 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------------------- | ------------------------------------------------------------- | -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | +| **Transactions** | [@interchainjs/cosmos](https://docs.hyperweb.io/interchain-js/networks/cosmos) | +| **Cosmos Types** | [@interchainjs/cosmos-types](https://docs.hyperweb.io/interchain-js/libs/cosmos-types) | +| **Migration from `@cosmjs`** | [Migration Guide](https://docs.hyperweb.io/interchain-js/advanced/migration-from-cosmjs.mdx) | --- @@ -146,7 +234,7 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------- | -------------------------------------------------------- | -| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | +| **Transactions** | [@interchainjs/injective](https://docs.hyperweb.io/interchain-js/networks/injective) | --- @@ -154,7 +242,7 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------- | ------------------------------------------------------ | -| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | +| **Transactions** | [@interchainjs/ethereum](https://docs.hyperweb.io/interchain-js/networks/ethereum) | --- diff --git a/docs/index.mdx b/docs/index.mdx index cc3a40228..34c58fca2 100644 --- a/docs/index.mdx +++ b/docs/index.mdx @@ -40,13 +40,14 @@ A single, universal signing interface for any network. Birthed from the intercha - [Introduction](#interchainjs-universal-signing-for-web3) - [Overview](#overview) -- [Tutorials and Docs](#tutorial-for-building-a-custom-signer) -- [Auth](#auth) +- [Installation](#installation) +- [Quick Start](#quick-start) + - [Create Interchain App](#quick-setup-with-create-interchain-app) - [Supported Networks](#supported-networks) - [Cosmos Network](#cosmos-network) - [Injective Network](#injective-network) - [Ethereum Network](#ethereum-network) -- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-⚛️) +- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️) - [Credits](#credits) - [Disclaimer](#disclaimer) @@ -108,25 +109,112 @@ graph LR style utils fill:#ccf,stroke:#333,stroke-width:2px ``` ---- +## Installation -## Tutorials & Documentation +This guide will walk you through the process of installing and setting up interchainjs for your project. -| Topic | Documentation | -| ---------------------------- | ----------------------------- | -| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) | -| **Advanced Documentation** | [View Docs](/docs/) | +You can install interchainjs using Yarn: + +```bash +yarn add interchainjs +yarn add @interchainjs/cosmos +``` + +or npm + +```bash +npm i interchainjs +npm i @interchainjs/cosmos +``` + +## Quick Start + +Get a signing client to send the trasactions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos"; + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + registry: [ + // as many as possible encoders registered here. + MsgDelegate, + MsgSend, + ], + broadcast: { + checkTx: true, + }, + } +); + +// sign and broadcast +const result = await signingClient.signAndBroadcast([]); +console.log(result.hash); // the hash of TxRaw +``` + +Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions: + +```ts +import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client"; +import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func"; +import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func"; + +// query to get balance +const { balance } = await getBalance(await getRpcEndpoint(), { + address: directAddress, + denom, +}); + +const signingClient = await CosmosSigningClient.connectWithSigner( + await getRpcEndpoint(), + new DirectGenericOfflineSigner(directSigner), + { + // no registry needed here anymore + // registry: [ + // ], + broadcast: { + checkTx: true, + }, + } +); + +// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once. +const result = await submitProposal( + signingClient, + directAddress, + { + proposer: directAddress, + initialDeposit: [ + { + amount: "1000000", + denom: denom, + }, + ], + content: { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(contentMsg).finish(), + }, + }, + fee, + "submit proposal" +); +console.log(result.hash); // the hash of TxRaw +``` ---- -## Auth +### Quick Setup with create-interchain-app -The authentication module is universally applied across different networks. +The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies: + +```bash +npm install -g create-interchain-app + +cia --example authz +``` -| Package | Description | -| -------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | -| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. | -| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. | +Then an authz example website will be created and users can take a look how signing clients and helper functions are used. --- @@ -136,9 +224,9 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------------------- | ------------------------------------------------------------- | -| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) | -| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) | -| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) | +| **Transactions** | [@interchainjs/cosmos](https://docs.hyperweb.io/interchain-js/networks/cosmos) | +| **Cosmos Types** | [@interchainjs/cosmos-types](https://docs.hyperweb.io/interchain-js/libs/cosmos-types) | +| **Migration from `@cosmjs`** | [Migration Guide](https://docs.hyperweb.io/interchain-js/advanced/migration-from-cosmjs.mdx) | --- @@ -146,7 +234,7 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------- | -------------------------------------------------------- | -| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) | +| **Transactions** | [@interchainjs/injective](https://docs.hyperweb.io/interchain-js/networks/injective) | --- @@ -154,7 +242,7 @@ The authentication module is universally applied across different networks. | Feature | Package | | ---------------- | ------------------------------------------------------ | -| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) | +| **Transactions** | [@interchainjs/ethereum](https://docs.hyperweb.io/interchain-js/networks/ethereum) | ---