coreum-js 2.8.25 → 2.9.1
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/dist/main/client/index.d.ts +9 -2
- package/dist/main/client/index.js +19 -2
- package/dist/module/client/index.d.ts +9 -2
- package/dist/module/client/index.js +19 -2
- package/dist/module/coreum/asset/ft/v1/token.js +4 -4
- package/dist/module/cosmos/authz/v1beta1/authz.js +4 -4
- package/dist/module/cosmos/feegrant/v1beta1/feegrant.js +4 -4
- package/dist/module/cosmos/gov/v1beta1/gov.js +4 -4
- package/dist/module/cosmos/staking/v1beta1/staking.js +4 -4
- package/dist/module/cosmos/staking/v1beta1/tx.js +4 -4
- package/dist/module/tendermint/abci/types.js +4 -4
- package/dist/module/tendermint/types/types.js +4 -4
- package/dist/module/utils/calculations.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreumNetworkConfig } from "../types/coreum";
|
|
2
|
-
import { EncodeObject, Registry } from "@cosmjs/proto-signing";
|
|
2
|
+
import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing";
|
|
3
3
|
import { ExtensionWallets, FeeCalculation, ClientQueryClient } from "../types";
|
|
4
4
|
import { DeliverTxResponse, StargateClient } from "@cosmjs/stargate";
|
|
5
5
|
import EventEmitter from "eventemitter3";
|
|
@@ -41,6 +41,13 @@ export declare class Client {
|
|
|
41
41
|
* @returns A Stargate client or undefined if the connection hasn't been created
|
|
42
42
|
*/
|
|
43
43
|
get stargate(): SigningCosmWasmClient | StargateClient | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a custom offlineSigner
|
|
46
|
+
*
|
|
47
|
+
* @param offlineSigner Defines the signer to be used to create the client
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
addCustomSigner(offlineSigner: OfflineSigner): Promise<void>;
|
|
44
51
|
/**
|
|
45
52
|
* Initializes the connection to the Chain, without a signer. Just for querying purposes
|
|
46
53
|
*
|
|
@@ -100,7 +107,7 @@ export declare class Client {
|
|
|
100
107
|
* @param memo An arbitrary string to add as Memo for the transaction
|
|
101
108
|
* @returns TxRaw object to be submitted to the chain
|
|
102
109
|
*/
|
|
103
|
-
signTx(msgs: readonly EncodeObject[], memo?: string): Promise<
|
|
110
|
+
signTx(msgs: readonly EncodeObject[], memo?: string): Promise<import("cosmjs-types/cosmos/tx/v1beta1/tx").TxRaw>;
|
|
104
111
|
/**
|
|
105
112
|
*
|
|
106
113
|
* @param event String describing the event to subscribe to.
|
|
@@ -14,7 +14,6 @@ const coreum_2 = require("../types/coreum");
|
|
|
14
14
|
const query_1 = require("../coreum/feemodel/v1/query");
|
|
15
15
|
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
16
16
|
const tendermint_rpc_1 = require("@cosmjs/tendermint-rpc");
|
|
17
|
-
const cosmos_1 = require("../cosmos");
|
|
18
17
|
const types_1 = require("../types");
|
|
19
18
|
const utils_1 = require("../utils");
|
|
20
19
|
const stargate_1 = require("@cosmjs/stargate");
|
|
@@ -33,6 +32,7 @@ class Client {
|
|
|
33
32
|
}
|
|
34
33
|
constructor(props) {
|
|
35
34
|
this._eventSequence = 0;
|
|
35
|
+
console.log("Coreum JS => Test");
|
|
36
36
|
this.config = (props === null || props === void 0 ? void 0 : props.network)
|
|
37
37
|
? coreum_2.COREUM_CONFIG[props.network]
|
|
38
38
|
: coreum_2.COREUM_CONFIG.mainnet;
|
|
@@ -66,6 +66,23 @@ class Client {
|
|
|
66
66
|
get stargate() {
|
|
67
67
|
return this._client;
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Adds a custom offlineSigner
|
|
71
|
+
*
|
|
72
|
+
* @param offlineSigner Defines the signer to be used to create the client
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
async addCustomSigner(offlineSigner) {
|
|
76
|
+
try {
|
|
77
|
+
await this._createClient(offlineSigner);
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
throw {
|
|
81
|
+
thrower: e.thrower || "addCustomSigner",
|
|
82
|
+
error: e,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
69
86
|
/**
|
|
70
87
|
* Initializes the connection to the Chain, without a signer. Just for querying purposes
|
|
71
88
|
*
|
|
@@ -233,7 +250,7 @@ class Client {
|
|
|
233
250
|
const signed = await signingClient.sign(this.address, msgs, fee, this._tx_memo
|
|
234
251
|
? `${this._tx_memo} ${memo ? `- ${memo}` : ""}`
|
|
235
252
|
: memo || "", signerData);
|
|
236
|
-
return
|
|
253
|
+
return signed;
|
|
237
254
|
}
|
|
238
255
|
catch (e) {
|
|
239
256
|
throw {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreumNetworkConfig } from "../types/coreum";
|
|
2
|
-
import { EncodeObject, Registry } from "@cosmjs/proto-signing";
|
|
2
|
+
import { EncodeObject, OfflineSigner, Registry } from "@cosmjs/proto-signing";
|
|
3
3
|
import { ExtensionWallets, FeeCalculation, ClientQueryClient } from "../types";
|
|
4
4
|
import { DeliverTxResponse, StargateClient } from "@cosmjs/stargate";
|
|
5
5
|
import EventEmitter from "eventemitter3";
|
|
@@ -41,6 +41,13 @@ export declare class Client {
|
|
|
41
41
|
* @returns A Stargate client or undefined if the connection hasn't been created
|
|
42
42
|
*/
|
|
43
43
|
get stargate(): SigningCosmWasmClient | StargateClient | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Adds a custom offlineSigner
|
|
46
|
+
*
|
|
47
|
+
* @param offlineSigner Defines the signer to be used to create the client
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
addCustomSigner(offlineSigner: OfflineSigner): Promise<void>;
|
|
44
51
|
/**
|
|
45
52
|
* Initializes the connection to the Chain, without a signer. Just for querying purposes
|
|
46
53
|
*
|
|
@@ -100,7 +107,7 @@ export declare class Client {
|
|
|
100
107
|
* @param memo An arbitrary string to add as Memo for the transaction
|
|
101
108
|
* @returns TxRaw object to be submitted to the chain
|
|
102
109
|
*/
|
|
103
|
-
signTx(msgs: readonly EncodeObject[], memo?: string): Promise<
|
|
110
|
+
signTx(msgs: readonly EncodeObject[], memo?: string): Promise<import("cosmjs-types/cosmos/tx/v1beta1/tx").TxRaw>;
|
|
104
111
|
/**
|
|
105
112
|
*
|
|
106
113
|
* @param event String describing the event to subscribe to.
|
|
@@ -8,7 +8,6 @@ import { COREUM_CONFIG } from "../types/coreum";
|
|
|
8
8
|
import { QueryClientImpl as FeeModelClient } from "../coreum/feemodel/v1/query";
|
|
9
9
|
import { Registry, } from "@cosmjs/proto-signing";
|
|
10
10
|
import { Tendermint34Client, WebsocketClient } from "@cosmjs/tendermint-rpc";
|
|
11
|
-
import { TxRaw } from "../cosmos";
|
|
12
11
|
import { ExtensionWallets } from "../types";
|
|
13
12
|
import { generateWalletFromMnemonic, generateMultisigFromPubkeys, } from "../utils";
|
|
14
13
|
import { GasPrice, QueryClient, StargateClient, calculateFee, createProtobufRpcClient, decodeCosmosSdkDecFromProto, defaultRegistryTypes, setupAuthExtension, setupFeegrantExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, } from "@cosmjs/stargate";
|
|
@@ -37,6 +36,7 @@ export class Client {
|
|
|
37
36
|
return this._queryClient;
|
|
38
37
|
}
|
|
39
38
|
constructor(props) {
|
|
39
|
+
console.log("Coreum JS => Test");
|
|
40
40
|
this.config = props?.network
|
|
41
41
|
? COREUM_CONFIG[props.network]
|
|
42
42
|
: COREUM_CONFIG.mainnet;
|
|
@@ -70,6 +70,23 @@ export class Client {
|
|
|
70
70
|
get stargate() {
|
|
71
71
|
return this._client;
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Adds a custom offlineSigner
|
|
75
|
+
*
|
|
76
|
+
* @param offlineSigner Defines the signer to be used to create the client
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
async addCustomSigner(offlineSigner) {
|
|
80
|
+
try {
|
|
81
|
+
await this._createClient(offlineSigner);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
throw {
|
|
85
|
+
thrower: e.thrower || "addCustomSigner",
|
|
86
|
+
error: e,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
73
90
|
/**
|
|
74
91
|
* Initializes the connection to the Chain, without a signer. Just for querying purposes
|
|
75
92
|
*
|
|
@@ -236,7 +253,7 @@ export class Client {
|
|
|
236
253
|
const signed = await signingClient.sign(this.address, msgs, fee, this._tx_memo
|
|
237
254
|
? `${this._tx_memo} ${memo ? `- ${memo}` : ""}`
|
|
238
255
|
: memo || "", signerData);
|
|
239
|
-
return
|
|
256
|
+
return signed;
|
|
240
257
|
}
|
|
241
258
|
catch (e) {
|
|
242
259
|
throw {
|
|
@@ -641,13 +641,13 @@ export const TokenUpgradeStatuses = {
|
|
|
641
641
|
},
|
|
642
642
|
};
|
|
643
643
|
function toTimestamp(date) {
|
|
644
|
-
const seconds = date.getTime() /
|
|
645
|
-
const nanos = (date.getTime() %
|
|
644
|
+
const seconds = date.getTime() / 1000;
|
|
645
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
646
646
|
return { seconds, nanos };
|
|
647
647
|
}
|
|
648
648
|
function fromTimestamp(t) {
|
|
649
|
-
let millis = (t.seconds || 0) *
|
|
650
|
-
millis += (t.nanos || 0) /
|
|
649
|
+
let millis = (t.seconds || 0) * 1000;
|
|
650
|
+
millis += (t.nanos || 0) / 1000000;
|
|
651
651
|
return new Date(millis);
|
|
652
652
|
}
|
|
653
653
|
function fromJsonTimestamp(o) {
|
|
@@ -284,13 +284,13 @@ export const GrantQueueItem = {
|
|
|
284
284
|
},
|
|
285
285
|
};
|
|
286
286
|
function toTimestamp(date) {
|
|
287
|
-
const seconds = date.getTime() /
|
|
288
|
-
const nanos = (date.getTime() %
|
|
287
|
+
const seconds = date.getTime() / 1000;
|
|
288
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
289
289
|
return { seconds, nanos };
|
|
290
290
|
}
|
|
291
291
|
function fromTimestamp(t) {
|
|
292
|
-
let millis = (t.seconds || 0) *
|
|
293
|
-
millis += (t.nanos || 0) /
|
|
292
|
+
let millis = (t.seconds || 0) * 1000;
|
|
293
|
+
millis += (t.nanos || 0) / 1000000;
|
|
294
294
|
return new Date(millis);
|
|
295
295
|
}
|
|
296
296
|
function fromJsonTimestamp(o) {
|
|
@@ -377,13 +377,13 @@ export const Grant = {
|
|
|
377
377
|
},
|
|
378
378
|
};
|
|
379
379
|
function toTimestamp(date) {
|
|
380
|
-
const seconds = date.getTime() /
|
|
381
|
-
const nanos = (date.getTime() %
|
|
380
|
+
const seconds = date.getTime() / 1000;
|
|
381
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
382
382
|
return { seconds, nanos };
|
|
383
383
|
}
|
|
384
384
|
function fromTimestamp(t) {
|
|
385
|
-
let millis = (t.seconds || 0) *
|
|
386
|
-
millis += (t.nanos || 0) /
|
|
385
|
+
let millis = (t.seconds || 0) * 1000;
|
|
386
|
+
millis += (t.nanos || 0) / 1000000;
|
|
387
387
|
return new Date(millis);
|
|
388
388
|
}
|
|
389
389
|
function fromJsonTimestamp(o) {
|
|
@@ -984,13 +984,13 @@ function base64FromBytes(arr) {
|
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
986
|
function toTimestamp(date) {
|
|
987
|
-
const seconds = date.getTime() /
|
|
988
|
-
const nanos = (date.getTime() %
|
|
987
|
+
const seconds = date.getTime() / 1000;
|
|
988
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
989
989
|
return { seconds, nanos };
|
|
990
990
|
}
|
|
991
991
|
function fromTimestamp(t) {
|
|
992
|
-
let millis = (t.seconds || 0) *
|
|
993
|
-
millis += (t.nanos || 0) /
|
|
992
|
+
let millis = (t.seconds || 0) * 1000;
|
|
993
|
+
millis += (t.nanos || 0) / 1000000;
|
|
994
994
|
return new Date(millis);
|
|
995
995
|
}
|
|
996
996
|
function fromJsonTimestamp(o) {
|
|
@@ -2062,13 +2062,13 @@ var tsProtoGlobalThis = (() => {
|
|
|
2062
2062
|
throw "Unable to locate global object";
|
|
2063
2063
|
})();
|
|
2064
2064
|
function toTimestamp(date) {
|
|
2065
|
-
const seconds = date.getTime() /
|
|
2066
|
-
const nanos = (date.getTime() %
|
|
2065
|
+
const seconds = date.getTime() / 1000;
|
|
2066
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
2067
2067
|
return { seconds, nanos };
|
|
2068
2068
|
}
|
|
2069
2069
|
function fromTimestamp(t) {
|
|
2070
|
-
let millis = (t.seconds || 0) *
|
|
2071
|
-
millis += (t.nanos || 0) /
|
|
2070
|
+
let millis = (t.seconds || 0) * 1000;
|
|
2071
|
+
millis += (t.nanos || 0) / 1000000;
|
|
2072
2072
|
return new Date(millis);
|
|
2073
2073
|
}
|
|
2074
2074
|
function fromJsonTimestamp(o) {
|
|
@@ -1092,13 +1092,13 @@ var tsProtoGlobalThis = (() => {
|
|
|
1092
1092
|
throw "Unable to locate global object";
|
|
1093
1093
|
})();
|
|
1094
1094
|
function toTimestamp(date) {
|
|
1095
|
-
const seconds = date.getTime() /
|
|
1096
|
-
const nanos = (date.getTime() %
|
|
1095
|
+
const seconds = date.getTime() / 1000;
|
|
1096
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
1097
1097
|
return { seconds, nanos };
|
|
1098
1098
|
}
|
|
1099
1099
|
function fromTimestamp(t) {
|
|
1100
|
-
let millis = (t.seconds || 0) *
|
|
1101
|
-
millis += (t.nanos || 0) /
|
|
1100
|
+
let millis = (t.seconds || 0) * 1000;
|
|
1101
|
+
millis += (t.nanos || 0) / 1000000;
|
|
1102
1102
|
return new Date(millis);
|
|
1103
1103
|
}
|
|
1104
1104
|
function fromJsonTimestamp(o) {
|
|
@@ -4842,13 +4842,13 @@ function base64FromBytes(arr) {
|
|
|
4842
4842
|
}
|
|
4843
4843
|
}
|
|
4844
4844
|
function toTimestamp(date) {
|
|
4845
|
-
const seconds = date.getTime() /
|
|
4846
|
-
const nanos = (date.getTime() %
|
|
4845
|
+
const seconds = date.getTime() / 1000;
|
|
4846
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
4847
4847
|
return { seconds, nanos };
|
|
4848
4848
|
}
|
|
4849
4849
|
function fromTimestamp(t) {
|
|
4850
|
-
let millis = (t.seconds || 0) *
|
|
4851
|
-
millis += (t.nanos || 0) /
|
|
4850
|
+
let millis = (t.seconds || 0) * 1000;
|
|
4851
|
+
millis += (t.nanos || 0) / 1000000;
|
|
4852
4852
|
return new Date(millis);
|
|
4853
4853
|
}
|
|
4854
4854
|
function fromJsonTimestamp(o) {
|
|
@@ -1545,13 +1545,13 @@ function base64FromBytes(arr) {
|
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
1547
|
function toTimestamp(date) {
|
|
1548
|
-
const seconds = date.getTime() /
|
|
1549
|
-
const nanos = (date.getTime() %
|
|
1548
|
+
const seconds = date.getTime() / 1000;
|
|
1549
|
+
const nanos = (date.getTime() % 1000) * 1000000;
|
|
1550
1550
|
return { seconds, nanos };
|
|
1551
1551
|
}
|
|
1552
1552
|
function fromTimestamp(t) {
|
|
1553
|
-
let millis = (t.seconds || 0) *
|
|
1554
|
-
millis += (t.nanos || 0) /
|
|
1553
|
+
let millis = (t.seconds || 0) * 1000;
|
|
1554
|
+
millis += (t.nanos || 0) / 1000000;
|
|
1555
1555
|
return new Date(millis);
|
|
1556
1556
|
}
|
|
1557
1557
|
function fromJsonTimestamp(o) {
|
|
@@ -4,14 +4,14 @@ import BigNumber from "bignumber.js";
|
|
|
4
4
|
* @returns A string representing CORE value of ucore
|
|
5
5
|
*/
|
|
6
6
|
export const ucoreToCORE = (ucore) => {
|
|
7
|
-
return new BigNumber(ucore).dividedBy(
|
|
7
|
+
return new BigNumber(ucore).dividedBy(1000000).valueOf();
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* @param core CORE to convert to ucore
|
|
11
11
|
* @returns A string representing ucore value of CORE
|
|
12
12
|
*/
|
|
13
13
|
export const coreToUCORE = (core) => {
|
|
14
|
-
return new BigNumber(core).multipliedBy(
|
|
14
|
+
return new BigNumber(core).multipliedBy(1000000).valueOf();
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* @param royalty Float to convert to royalty rate format
|