coreum-js 2.5.4 → 2.5.5
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 +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,12 +28,12 @@ npm i coreum-js
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
import Client from "coreum-js";
|
|
31
|
+
import { Client } from "coreum-js";
|
|
32
32
|
|
|
33
33
|
// Choose the network to connect. The library will use default nodes for this.
|
|
34
34
|
const network = "mainnet" | "testnet" | "devnet";
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const coreum: Client = new Client({ network: network });
|
|
37
37
|
|
|
38
38
|
const connectOptions = {
|
|
39
39
|
withWS: true | false, // optional
|
|
@@ -41,7 +41,7 @@ const connectOptions = {
|
|
|
41
41
|
// connect() will only connect for querying purposes, it won't sign any transaction.
|
|
42
42
|
// In order to sign transactions, you need to connect with connectWithExtension (currently only working with Keplr)
|
|
43
43
|
// Or with connectWithMnemonic, if choose connectWithMnemonic, DO NOT USE ON CLIENT SIDE.
|
|
44
|
-
await
|
|
44
|
+
await coreum.connect(connectOptions); // connectWithExtension || connectWithMnemonic
|
|
45
45
|
// If withWS is true, the client will also create and connect to the Coreum Websocket.
|
|
46
46
|
|
|
47
47
|
// Client exposes different QueryClients to query the Coreum Blockchain with ease.
|
|
@@ -58,20 +58,20 @@ const {
|
|
|
58
58
|
feegrant,
|
|
59
59
|
nftbeta,
|
|
60
60
|
tx,
|
|
61
|
-
} =
|
|
61
|
+
} = coreum.queryClients;
|
|
62
62
|
|
|
63
63
|
// Documentation for each query client can be found here
|
|
64
64
|
// https://docs.coreum.dev/api/api.html
|
|
65
65
|
|
|
66
66
|
// You can get the TX Fee for any transactions with getTxFee
|
|
67
67
|
const msgs: readonly EncodeObject[];
|
|
68
|
-
const txFee = await
|
|
68
|
+
const txFee = await coreum.getTxFee(msgs);
|
|
69
69
|
|
|
70
70
|
// Sign and broadcast the Transaction
|
|
71
|
-
const response = await
|
|
71
|
+
const response = await coreum.sendTx(msgs);
|
|
72
72
|
|
|
73
73
|
// Subscribe to Blockchain events
|
|
74
|
-
const subscription = await
|
|
74
|
+
const subscription = await coreum.subscribeToEvent($EVENT);
|
|
75
75
|
|
|
76
76
|
// Event
|
|
77
77
|
subscription.events.on($EVENT, ({ events, data }) => {
|