coreum-js 2.6.7 → 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -64
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# coreum-js
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Warning:**
|
|
4
|
+
> This library is still in development and it is not production ready.
|
|
4
5
|
|
|
5
6
|
[](https://nodei.co/npm/coreum-js/)
|
|
6
7
|
|
|
@@ -8,25 +9,28 @@ A JavaScript/TypeScript library for interacting with the Coreum Blockchain
|
|
|
8
9
|
|
|
9
10
|
This is the recommended library for integrating a JavaScript/TypeScript app with the Coreum Blockchain, especially for the use of the modules assetft, assetnft, and more. It supports integration with the most popular Browser-Extension wallets; like Keplr, Cosmostation and Leap.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
> **Warning**
|
|
13
|
+
> IF YOU DECIDE TO USE A **MNEMONIC SIGNER**, FOR BETTER SECURITY USE ONLY ON THE SERVER-SIDE.
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Contents
|
|
14
16
|
|
|
15
|
-
1.
|
|
16
|
-
2.
|
|
17
|
-
3.
|
|
18
|
-
4.
|
|
17
|
+
1. [Features](#features)
|
|
18
|
+
2. [Installation](#installation)
|
|
19
|
+
3. [Query Clients](#query-clients)
|
|
20
|
+
4. [Transaction Modules](#transaction-modules)
|
|
21
|
+
5. [Usage - General](#general)
|
|
22
|
+
6. [Usage - Query balances](#query-balances)
|
|
23
|
+
7. [Usage - Submit Transaction](#submit-transaction)
|
|
24
|
+
8. [Usage - Event Subscription](#event-subscription)
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
## Features
|
|
21
27
|
|
|
22
|
-
1. [
|
|
23
|
-
2. [
|
|
24
|
-
3. [
|
|
25
|
-
4.
|
|
26
|
-
5. [Submit Transaction](#md:submit-transaction)
|
|
27
|
-
6. [Event Subscription](#md:event-subscription)
|
|
28
|
+
1. Query the Coreum Blockchain with ease, using the [QueryClients](#query-clients).
|
|
29
|
+
2. Sign and broadcast transactions to the Coreum Blockchain using [Transaction Modules](#transaction-modules)
|
|
30
|
+
3. [Subscribe to events](<(#event-subscription)>) that happen on the Coreum Blockchain
|
|
31
|
+
4. Connect using the most popular Browser-Extension wallets ([Keplr](https://www.keplr.app#extension), [Cosmostation](https://www.cosmostation.io/wallet#extension), [Leap](https://www.leapwallet.io/download))
|
|
28
32
|
|
|
29
|
-
##
|
|
33
|
+
## Installation
|
|
30
34
|
|
|
31
35
|
Installing coreum-js
|
|
32
36
|
|
|
@@ -34,7 +38,39 @@ Installing coreum-js
|
|
|
34
38
|
npm i coreum-js
|
|
35
39
|
```
|
|
36
40
|
|
|
37
|
-
##
|
|
41
|
+
## Query Clients
|
|
42
|
+
|
|
43
|
+
_coreum-js_ comes with out-of-the-box modules to query the Coreum Blockchain.
|
|
44
|
+
|
|
45
|
+
- [Auth](./docs/interfaces/ClientQueryClient.md#auth)
|
|
46
|
+
- [Bank](./docs/interfaces/ClientQueryClient.md#bank)
|
|
47
|
+
- [Coreum Asset-FT](./docs/interfaces/ClientQueryClient.md#ft)
|
|
48
|
+
- [Coreum Asset-NFT](./docs/interfaces/ClientQueryClient.md#nft)
|
|
49
|
+
- [Distribution](./docs/interfaces/ClientQueryClient.md#distribution)
|
|
50
|
+
- [Feegrant](./docs/interfaces/ClientQueryClient.md#feegrant)
|
|
51
|
+
- [Gov](./docs/interfaces/ClientQueryClient.md#gov)
|
|
52
|
+
- [IBC](./docs/interfaces/ClientQueryClient.md#ibc)
|
|
53
|
+
- [Mint](./docs/interfaces/ClientQueryClient.md#mint)
|
|
54
|
+
- [NFTBeta](./docs/interfaces/ClientQueryClient.md#nftbeta)
|
|
55
|
+
- [Staking](./docs/interfaces/ClientQueryClient.md#staking)
|
|
56
|
+
- [TX](./docs/interfaces/ClientQueryClient.md#tx)
|
|
57
|
+
- [WASM](./docs/interfaces/ClientQueryClient.md#wasm)
|
|
58
|
+
|
|
59
|
+
## Transaction Modules
|
|
60
|
+
|
|
61
|
+
_coreum-js_ comes with out-of-the-box modules to create transaction messages compatible with the Cosmos-SDK and Coreum Blockchain.
|
|
62
|
+
|
|
63
|
+
- [Authz vesting](./docs/modules/Vesting.md) - Vesting itself
|
|
64
|
+
- [Authz](./docs/modules/Authz.md)- Authorization for accounts to perform actions on behalf of other accounts.
|
|
65
|
+
- [Bank](./docs/modules/Bank.md) - Token transfer functionalities.
|
|
66
|
+
- [Coreum Asset-FT](./docs/modules/FT.md) - Token issuance and management functionalities.
|
|
67
|
+
- [Coreum Asset-NFT](./docs/modules/NFT.md) - Non-Fungible Tokens minting and management functionalities.
|
|
68
|
+
- [CosmWasm](./docs/modules/CosmWasm.md) - Smart Contracts functionalities.
|
|
69
|
+
- [Distribution](./docs/modules/Distribution.md) - Fee distribution, and staking token provision distribution.
|
|
70
|
+
- [Feegrant](./docs/modules/Feegrant.md) - Grant fee allowances for executing transactions.
|
|
71
|
+
- [Staking](./docs/modules/Staking.md) - Proof-of-Stake layer for public blockchains.
|
|
72
|
+
|
|
73
|
+
### General
|
|
38
74
|
|
|
39
75
|
```typescript
|
|
40
76
|
import { Client } from "coreum-js";
|
|
@@ -48,8 +84,8 @@ const connectOptions = {
|
|
|
48
84
|
withWS: true | false, // optional
|
|
49
85
|
};
|
|
50
86
|
// connect() will only connect for querying purposes, it won't sign any transaction.
|
|
51
|
-
// In order to sign transactions, you need to connect with connectWithExtension
|
|
52
|
-
//
|
|
87
|
+
// In order to sign transactions, you need to connect with connectWithExtension or with connectWithMnemonic,
|
|
88
|
+
// If choose connectWithMnemonic, DO NOT USE ON CLIENT SIDE.
|
|
53
89
|
await coreum.connect(connectOptions); // connectWithExtension || connectWithMnemonic
|
|
54
90
|
// If withWS is true, the client will also create and connect to the Coreum Websocket.
|
|
55
91
|
|
|
@@ -95,49 +131,9 @@ subscription.unsubscribe();
|
|
|
95
131
|
const registry = Client.getRegistry();
|
|
96
132
|
```
|
|
97
133
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
_coreum-js_ comes with out-of-the-box modules to create messages compatible with the Cosmos-SDK and Coreum Blockchain.
|
|
101
|
-
|
|
102
|
-
- [Authz](./modules/Authz.html)
|
|
103
|
-
Authorization for accounts to perform actions on behalf of other accounts.
|
|
104
|
-
- [Bank](./modules/Bank.html)
|
|
105
|
-
Token transfer functionalities.
|
|
106
|
-
- [CosmWasm](./modules/CosmWasm.html)
|
|
107
|
-
Smart Contracts functionalities.
|
|
108
|
-
- [Distribution](./modules/Distribution.html)
|
|
109
|
-
Fee distribution, and staking token provision distribution.
|
|
110
|
-
- [Feegrant](./modules/Feegrant.html)
|
|
111
|
-
Grant fee allowances for executing transactions.
|
|
112
|
-
- [FT](./modules/FT.html)
|
|
113
|
-
Token issuance and management functionalities.
|
|
114
|
-
- [NFT](./modules/NFT.html)
|
|
115
|
-
Non-Fungible Tokens minting and management functionalities.
|
|
116
|
-
- [Staking](./modules/Staking.html)
|
|
117
|
-
Proof-of-Stake layer for public blockchains.
|
|
118
|
-
- [Vesting](./modules/Vesting.html)
|
|
119
|
-
|
|
120
|
-
## Query Clients
|
|
121
|
-
|
|
122
|
-
_coreum-js_ comes with out-of-the-box modules to query the Coreum Blockchain.
|
|
134
|
+
### Query Balances
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
- [Bank](./interfaces/ClientQueryClient.html#bank)
|
|
126
|
-
- [FT](./interfaces/ClientQueryClient.html#ft)
|
|
127
|
-
- [NFT](./interfaces/ClientQueryClient.html#nft)
|
|
128
|
-
- [NFTBeta](./interfaces/ClientQueryClient.html#nftbeta)
|
|
129
|
-
- [Gov](./interfaces/ClientQueryClient.html#gov)
|
|
130
|
-
- [Staking](./interfaces/ClientQueryClient.html#staking)
|
|
131
|
-
- [Distribution](./interfaces/ClientQueryClient.html#distribution)
|
|
132
|
-
- [Mint](./interfaces/ClientQueryClient.html#mint)
|
|
133
|
-
- [Feegrant](./interfaces/ClientQueryClient.html#feegrant)
|
|
134
|
-
- [IBC](./interfaces/ClientQueryClient.html#ibc)
|
|
135
|
-
- [WASM](./interfaces/ClientQueryClient.html#wasm)
|
|
136
|
-
- [TX](./interfaces/ClientQueryClient.html#tx)
|
|
137
|
-
|
|
138
|
-
## Query Balances
|
|
139
|
-
|
|
140
|
-
```js
|
|
136
|
+
```typescript
|
|
141
137
|
// We take the bank query client from the coreum instance.
|
|
142
138
|
const { bank } = coreum.queryClients;
|
|
143
139
|
|
|
@@ -146,9 +142,9 @@ const address = "core1ll9gdh5ur6gyv6swgshcm4zkkw4ttakt4ukjma";
|
|
|
146
142
|
const balances = await bank.allBalances(address);
|
|
147
143
|
```
|
|
148
144
|
|
|
149
|
-
|
|
145
|
+
### Submit a Transaction
|
|
150
146
|
|
|
151
|
-
```
|
|
147
|
+
```typescript
|
|
152
148
|
// We take the Bank Transaction Module from the Library.
|
|
153
149
|
// Note: This TX module and the Query module are different thing. Query Module is ONLY for queries, not transaction handling
|
|
154
150
|
import { Bank } from "coreum-js";
|
|
@@ -174,9 +170,9 @@ const send_message = Bank.Send({
|
|
|
174
170
|
const response = await coreum.sendTx([send_message]);
|
|
175
171
|
```
|
|
176
172
|
|
|
177
|
-
|
|
173
|
+
### Subscribe to an Event
|
|
178
174
|
|
|
179
|
-
```
|
|
175
|
+
```typescript
|
|
180
176
|
// The event is the typeUrl of the desired Msg to track.
|
|
181
177
|
// You can read more about Event subscription here.
|
|
182
178
|
// https://docs.cosmos.network/v0.46/core/events.html#examples
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coreum-js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.8",
|
|
4
4
|
"description": "JS/TS Library to to easily make use of the Coreum Blockchain",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"build:version": "npm run build && standard-version && git add -A",
|
|
11
11
|
"build:main": "npx tsc -p tsconfig.json",
|
|
12
12
|
"build:module": "npx tsc -p tsconfig.module.json",
|
|
13
|
-
"generate:docs": "npx typedoc --plugin typedoc-plugin-missing-exports src/index.ts"
|
|
13
|
+
"generate:docs": "npx typedoc --plugin typedoc-plugin-missing-exports --plugin typedoc-plugin-markdown src/index.ts && rm ./docs/README.md"
|
|
14
14
|
},
|
|
15
15
|
"pre-commit": [
|
|
16
16
|
"build:version"
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"standard-version": "^9.5.0",
|
|
52
52
|
"ts-node": "^10.9.1",
|
|
53
53
|
"typedoc": "^0.24.4",
|
|
54
|
+
"typedoc-plugin-markdown": "^3.15.3",
|
|
54
55
|
"typedoc-plugin-missing-exports": "^2.0.0",
|
|
55
56
|
"typescript": "^5.0.2"
|
|
56
57
|
}
|