coreum-js 2.8.25 → 2.9.0

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.
@@ -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
  *
@@ -33,6 +33,7 @@ class Client {
33
33
  }
34
34
  constructor(props) {
35
35
  this._eventSequence = 0;
36
+ console.log("Coreum JS => Test");
36
37
  this.config = (props === null || props === void 0 ? void 0 : props.network)
37
38
  ? coreum_2.COREUM_CONFIG[props.network]
38
39
  : coreum_2.COREUM_CONFIG.mainnet;
@@ -66,6 +67,23 @@ class Client {
66
67
  get stargate() {
67
68
  return this._client;
68
69
  }
70
+ /**
71
+ * Adds a custom offlineSigner
72
+ *
73
+ * @param offlineSigner Defines the signer to be used to create the client
74
+ *
75
+ */
76
+ async addCustomSigner(offlineSigner) {
77
+ try {
78
+ await this._createClient(offlineSigner);
79
+ }
80
+ catch (e) {
81
+ throw {
82
+ thrower: e.thrower || "addCustomSigner",
83
+ error: e,
84
+ };
85
+ }
86
+ }
69
87
  /**
70
88
  * Initializes the connection to the Chain, without a signer. Just for querying purposes
71
89
  *
@@ -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
  *
@@ -37,6 +37,7 @@ export class Client {
37
37
  return this._queryClient;
38
38
  }
39
39
  constructor(props) {
40
+ console.log("Coreum JS => Test");
40
41
  this.config = props?.network
41
42
  ? COREUM_CONFIG[props.network]
42
43
  : COREUM_CONFIG.mainnet;
@@ -70,6 +71,23 @@ export class Client {
70
71
  get stargate() {
71
72
  return this._client;
72
73
  }
74
+ /**
75
+ * Adds a custom offlineSigner
76
+ *
77
+ * @param offlineSigner Defines the signer to be used to create the client
78
+ *
79
+ */
80
+ async addCustomSigner(offlineSigner) {
81
+ try {
82
+ await this._createClient(offlineSigner);
83
+ }
84
+ catch (e) {
85
+ throw {
86
+ thrower: e.thrower || "addCustomSigner",
87
+ error: e,
88
+ };
89
+ }
90
+ }
73
91
  /**
74
92
  * Initializes the connection to the Chain, without a signer. Just for querying purposes
75
93
  *
@@ -641,13 +641,13 @@ export const TokenUpgradeStatuses = {
641
641
  },
642
642
  };
643
643
  function toTimestamp(date) {
644
- const seconds = date.getTime() / 1_000;
645
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
650
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
288
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
293
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
381
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
386
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
988
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
993
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
2066
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
2071
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
1096
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
1101
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
4846
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
4851
- millis += (t.nanos || 0) / 1_000_000;
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() / 1_000;
1549
- const nanos = (date.getTime() % 1_000) * 1_000_000;
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) * 1_000;
1554
- millis += (t.nanos || 0) / 1_000_000;
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(1_000_000).valueOf();
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(1_000_000).valueOf();
14
+ return new BigNumber(core).multipliedBy(1000000).valueOf();
15
15
  };
16
16
  /**
17
17
  * @param royalty Float to convert to royalty rate format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coreum-js",
3
- "version": "2.8.25",
3
+ "version": "2.9.0",
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",