Skip to content

Commit fbca747

Browse files
authored
Merge pull request #131 from hyperweb-io/docs-and-gen
Docs and gen
2 parents 4c7d65f + c799551 commit fbca747

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+4017
-366
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
**/dist
44
**/dist_spec
55
**/yarn-error.log
6-
lerna-debug.log
6+
lerna-debug.log

README.md

Lines changed: 154 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
# InterchainJS
22

3-
<p align="center">
4-
<img src="https://raw.githubusercontent.com/hyperweb-io/interchainjs/refs/heads/main/assets/logo.svg" width="280">
3+
<p align="center" style={{ marginBottom: "20px" }}>
4+
<img
5+
src="https://raw.githubusercontent.com/hyperweb-io/interchainjs/refs/heads/main/assets/logo.svg"
6+
width="280"
7+
/>
58
</p>
69

7-
<p align="center" width="100%">
10+
<p
11+
align="center"
12+
width="100%"
13+
style={{
14+
display: "flex",
15+
justifyContent: "center",
16+
alignItems: "center",
17+
gap: "2px",
18+
}}
19+
>
820
<a href="https://github.com/hyperweb-io/interchainjs/actions/workflows/run-tests.yaml">
9-
<img height="20" src="https://github.com/hyperweb-io/interchainjs/actions/workflows/run-tests.yaml/badge.svg" />
21+
<img
22+
height="20"
23+
src="https://github.com/hyperweb-io/interchainjs/actions/workflows/run-tests.yaml/badge.svg"
24+
/>
25+
</a>
26+
<a href="https://github.com/hyperweb-io/interchainjs/blob/main/LICENSE-MIT">
27+
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg" />
28+
</a>
29+
<a href="https://github.com/hyperweb-io/interchainjs/blob/main/LICENSE-Apache">
30+
<img
31+
height="20"
32+
src="https://img.shields.io/badge/license-Apache-blue.svg"
33+
/>
1034
</a>
11-
<a href="https://github.com/hyperweb-io/interchainjs/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
12-
<a href="https://github.com/hyperweb-io/interchainjs/blob/main/LICENSE-Apache"><img height="20" src="https://img.shields.io/badge/license-Apache-blue.svg"></a>
1335
</p>
1436

1537
A single, universal signing interface for any network. Birthed from the interchain ecosystem for builders. Create adapters for any Web3 network.
@@ -18,13 +40,14 @@ A single, universal signing interface for any network. Birthed from the intercha
1840

1941
- [Introduction](#interchainjs-universal-signing-for-web3)
2042
- [Overview](#overview)
21-
- [Tutorials and Docs](#tutorial-for-building-a-custom-signer)
22-
- [Auth](#auth)
43+
- [Installation](#installation)
44+
- [Quick Start](#quick-start)
45+
- [Create Interchain App](#quick-setup-with-create-interchain-app)
2346
- [Supported Networks](#supported-networks)
2447
- [Cosmos Network](#cosmos-network)
2548
- [Injective Network](#injective-network)
2649
- [Ethereum Network](#ethereum-network)
27-
- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-)
50+
- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️)
2851
- [Credits](#credits)
2952
- [Disclaimer](#disclaimer)
3053

@@ -86,80 +109,165 @@ graph LR
86109
style utils fill:#ccf,stroke:#333,stroke-width:2px
87110
```
88111

112+
## Installation
89113

90-
---
114+
This guide will walk you through the process of installing and setting up interchainjs for your project.
91115

116+
You can install interchainjs using Yarn:
92117

93-
## Tutorials & Documentation
118+
```bash
119+
yarn add interchainjs
120+
yarn add @interchainjs/cosmos
121+
```
94122

95-
| Topic | Documentation |
96-
|----------------------------------|--------------|
97-
| **Building a Custom Signer** | [Tutorial](/docs/tutorial.md) |
98-
| **Advanced Documentation** | [View Docs](/docs/) |
123+
or npm
124+
125+
```bash
126+
npm i interchainjs
127+
npm i @interchainjs/cosmos
128+
```
129+
130+
## Quick Start
131+
132+
Get a signing client to send the trasactions:
133+
134+
```ts
135+
import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos";
136+
137+
const signingClient = await CosmosSigningClient.connectWithSigner(
138+
await getRpcEndpoint(),
139+
new DirectGenericOfflineSigner(directSigner),
140+
{
141+
registry: [
142+
// as many as possible encoders registered here.
143+
MsgDelegate,
144+
MsgSend,
145+
],
146+
broadcast: {
147+
checkTx: true,
148+
},
149+
}
150+
);
151+
152+
// sign and broadcast
153+
const result = await signingClient.signAndBroadcast(<MESSAGE>[]);
154+
console.log(result.hash); // the hash of TxRaw
155+
```
156+
157+
Use the tree shakable helper functions provided by interchainjs or generated by telescope for query or send the transctions:
158+
159+
```ts
160+
import { SigningClient as CosmosSigningClient } from "@interchainjs/cosmos/signing-client";
161+
import { getBalance } from "interchainjs/cosmos/bank/v1beta1/query.rpc.func";
162+
import { submitProposal } from "interchainjs/cosmos/gov/v1beta1/tx.rpc.func";
163+
164+
// query to get balance
165+
const { balance } = await getBalance(await getRpcEndpoint(), {
166+
address: directAddress,
167+
denom,
168+
});
169+
170+
const signingClient = await CosmosSigningClient.connectWithSigner(
171+
await getRpcEndpoint(),
172+
new DirectGenericOfflineSigner(directSigner),
173+
{
174+
// no registry needed here anymore
175+
// registry: [
176+
// ],
177+
broadcast: {
178+
checkTx: true,
179+
},
180+
}
181+
);
182+
183+
// Necessary typeurl and codecs will be registered automatically in the helper functions. Meaning users don't have to register them all at once.
184+
const result = await submitProposal(
185+
signingClient,
186+
directAddress,
187+
{
188+
proposer: directAddress,
189+
initialDeposit: [
190+
{
191+
amount: "1000000",
192+
denom: denom,
193+
},
194+
],
195+
content: {
196+
typeUrl: "/cosmos.gov.v1beta1.TextProposal",
197+
value: TextProposal.encode(contentMsg).finish(),
198+
},
199+
},
200+
fee,
201+
"submit proposal"
202+
);
203+
console.log(result.hash); // the hash of TxRaw
204+
```
99205

100-
---
101206

102-
## Auth
207+
### Quick Setup with create-interchain-app
103208

104-
The authentication module is universally applied across different networks.
209+
The easiest way to get started is by using the create-interchain-app tool, which sets up a complete project with all necessary dependencies:
210+
211+
```bash
212+
npm install -g create-interchain-app
213+
214+
cia --example authz
215+
```
105216

106-
| Package | Description |
107-
|---------|-------------|
108-
| [@interchainjs/auth](/packages/auth/README.md) | Handles authentication across blockchain networks. |
109-
| [Advanced Docs: `Auth vs. Wallet vs. Signer`](/docs/auth-wallet-signer.md) | Explanation of the differences between authentication, wallets, and signers. |
217+
Then an authz example website will be created and users can take a look how signing clients and helper functions are used.
110218

111219
---
112220

113221
## Supported Networks
114222

115223
### Cosmos Network
116224

117-
| Feature | Package |
118-
|---------|---------|
119-
| **Transactions** | [@interchainjs/cosmos](/networks/cosmos/README.md) |
120-
| **Cosmos Types** | [@interchainjs/cosmos-types](/networks/cosmos-msgs/README.md) |
121-
| **Migration from `@cosmjs`** | [Migration Guide](/docs/migration-from-cosmjs.md) |
225+
| Feature | Package |
226+
| ---------------------------- | ------------------------------------------------------------- |
227+
| **Transactions** | [@interchainjs/cosmos](https://docs.hyperweb.io/interchain-js/networks/cosmos) |
228+
| **Cosmos Types** | [@interchainjs/cosmos-types](https://docs.hyperweb.io/interchain-js/libs/cosmos-types) |
229+
| **Migration from `@cosmjs`** | [Migration Guide](https://docs.hyperweb.io/interchain-js/advanced/migration-from-cosmjs.mdx) |
122230

123231
---
124232

125233
### Injective Network
126234

127-
| Feature | Package |
128-
|---------|---------|
129-
| **Transactions** | [@interchainjs/injective](/networks/injective/README.md) |
235+
| Feature | Package |
236+
| ---------------- | -------------------------------------------------------- |
237+
| **Transactions** | [@interchainjs/injective](https://docs.hyperweb.io/interchain-js/networks/injective) |
130238

131239
---
132240

133241
### Ethereum Network
134242

135-
| Feature | Package |
136-
|---------|---------|
137-
| **Transactions** | [@interchainjs/ethereum](/networks/ethereum/README.md) |
243+
| Feature | Package |
244+
| ---------------- | ------------------------------------------------------ |
245+
| **Transactions** | [@interchainjs/ethereum](https://docs.hyperweb.io/interchain-js/networks/ethereum) |
138246

139247
---
140248

141249
## Interchain JavaScript Stack ⚛️
142250

143251
A unified toolkit for building applications and smart contracts in the Interchain ecosystem
144252

145-
| Category | Tools | Description |
146-
|----------------------|------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
147-
| **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. |
148-
| **Wallet Connectors**| [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)<sup>beta</sup>, [**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. |
149-
| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)<sup>beta</sup>, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network |
150-
| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. |
151-
| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)<sup>beta</sup>, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. |
152-
| **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. |
153-
| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. |
154-
| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript |
155-
| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. |
253+
| Category | Tools | Description |
254+
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
255+
| **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. |
256+
| **Wallet Connectors** | [**Interchain Kit**](https://github.com/hyperweb-io/interchain-kit)<sup>beta</sup>, [**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. |
257+
| **Signing Clients** | [**InterchainJS**](https://github.com/hyperweb-io/interchainjs)<sup>beta</sup>, [**CosmJS**](https://github.com/cosmos/cosmjs) | A single, universal signing interface for any network |
258+
| **SDK Clients** | [**Telescope**](https://github.com/hyperweb-io/telescope) | Your Frontend Companion for Building with TypeScript with Cosmos SDK Modules. |
259+
| **Starter Kits** | [**Create Interchain App**](https://github.com/hyperweb-io/create-interchain-app)<sup>beta</sup>, [**Create Cosmos App**](https://github.com/hyperweb-io/create-cosmos-app) | Set up a modern Interchain app by running one command. |
260+
| **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. |
261+
| **Testing Frameworks** | [**Starship**](https://github.com/hyperweb-io/starship) | Unified Testing and Development for the Interchain. |
262+
| **TypeScript Smart Contracts** | [**Create Hyperweb App**](https://github.com/hyperweb-io/create-hyperweb-app) | Build and deploy full-stack blockchain applications with TypeScript |
263+
| **CosmWasm Contracts** | [**CosmWasm TS Codegen**](https://github.com/CosmWasm/ts-codegen) | Convert your CosmWasm smart contracts into dev-friendly TypeScript classes. |
156264

157265
## Credits
158266

159-
🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
267+
🛠 Built by Hyperweb (formerly Cosmology) — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/hyperweb-io)
160268

161269
## Disclaimer
162270

163-
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED AS IS, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
271+
AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
164272

165273
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.

docs/_meta.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"index": "Overview",
3+
"networks": "Networks",
4+
"libs": "Libs",
5+
"packages": "Packages",
6+
"advanced": "Advanced"
7+
}

docs/advanced/_meta.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"auth-wallet-signer": "Auth Wallet Signer",
3+
"auth": "Auth",
4+
"migration-from-cosmjs": "Migration from CosmJS",
5+
"signer": "Signer",
6+
"tutorial": "Tutorial",
7+
"wallet": "Wallet"
8+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)