@xchainjs/xchain-thorchain 0.27.6 → 0.27.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/CHANGELOG.md ADDED
@@ -0,0 +1,598 @@
1
+ # v.0.27.8 (2023-01-19)
2
+
3
+ ## Update
4
+
5
+ - Type safety `THORChain`
6
+
7
+ # v.0.27.7 (2022-12-27)
8
+
9
+ ## Add
10
+
11
+ - Add `AssetRune67C`, `AssetRuneB1A`, `AssetRuneERC20`, `AssetRuneERC20Testnet`, `THORChain` and `AssetRuneNative` definitions
12
+
13
+ ## Update
14
+
15
+ - Bump `xchain-client@13.5.0`
16
+
17
+ ## Update
18
+
19
+ - Change `AssetETH`, `AssetBNB` and `GAIAChain` imports to its own `xchain-*` package
20
+
21
+ # v.0.27.6 (2022-12-13)
22
+
23
+ ## Update
24
+
25
+ - removed `customRequestHeaders`
26
+
27
+ # v.0.27.5 (2022-12-12)
28
+
29
+ ## Update
30
+
31
+ - Add optional `sequence` to `transfer` and `deposit` to override `sequence`
32
+ - Add helpers `getAccount` and `getSequence` to `utils`
33
+
34
+ # v.0.27.4 (2022-11-??)
35
+
36
+ # v.0.27.3 (2022-11-24)
37
+
38
+ ## Update
39
+
40
+ - Added `customRequestHeaders` to `BroadcastTxParams`
41
+ - Bump `xchain-client`
42
+
43
+ # v.0.27.2 (2022-11-08)
44
+
45
+ ## Update
46
+
47
+ - changed chain-id-stagenet to `thorchain-stagenet-v2`
48
+
49
+ # v.0.27.1 (2022-10-13)
50
+
51
+ - added default `chainIds` in constructor
52
+ - added default `explorerUrls` in constructor
53
+ - Set Default network to `Network.Mainnet`
54
+
55
+ ## Update
56
+
57
+ - Bumped `xchain-utils` & `xchain-client`
58
+
59
+ # v0.27.0 (2022-10-07)
60
+
61
+ ## Breaking Changes
62
+
63
+ - Removed `getDefaultClientUrl`
64
+ - Removed `getChainIds`
65
+ - Update `ThorchainClientParams` to make clientUrl required (not optional)
66
+
67
+ # v.0.26.2 (2022-10-06)
68
+
69
+ ## Update
70
+
71
+ - Bumped `xchain-utils` & `xchain-client`
72
+
73
+ # v.0.26.1 (2022-09-29)
74
+
75
+ ## Update
76
+
77
+ - bumped deps on xchain-utils & xchain-client
78
+
79
+ # v.0.26.0 (2022-07-20)
80
+
81
+ ## Change
82
+
83
+ - updated packages xchain-client & xchain-util
84
+
85
+ # v0.25.3 (2022-07-01)
86
+
87
+ ## Update
88
+
89
+ - Latest "xchain-cosmos@0.19.0"
90
+
91
+ # v0.25.2 (2022-06-22)
92
+
93
+ ## Update
94
+
95
+ - Latest `@cosmos-client/core@0.45.10`
96
+ - Latest "xchain-cosmos@0.18.0"
97
+
98
+ ## Fix
99
+
100
+ - Fix `setNetwork` to create new instance of SDK client
101
+
102
+ # v0.25.1 (2022-06-17)
103
+
104
+ ## Fix
105
+
106
+ - Remove estimation of gas in `transfer` and `deposit` (introduced by #564) in favour of using `DEFAULT_GAS_LIMIT_VALUE` or `DEPOSIT_GAS_LIMIT_VALUE` (both can be overridden by users in `transfer` or `deposit`)
107
+ - Increase `DEPOSIT_GAS_LIMIT_VALUE` to `600000000` (before `500000000`)
108
+
109
+ # v0.25.0 (2022-06-16)
110
+
111
+ ## Fix
112
+
113
+ - Before sending a transaction, gas limits are estimated
114
+ - Helper `getEstimatedGas`
115
+
116
+ ## Breaking changes
117
+
118
+ - Client's `transferOffline` requires `fromAccountNumber` and `fromSequence`
119
+ - Rename parameters in `transferOffline` to keep names in camel case (not snake case)
120
+ - Rename `DEFAULT_GAS_VALUE` to `DEFAULT_GAS_LIMIT_VALUE`
121
+ - Rename `DEPOSIT_GAS_VALUE` to `DEPOSIT_GAS_LIMIT_VALUE`
122
+
123
+ # v0.24.1 (2022-04-23)
124
+
125
+ ## Fix
126
+
127
+ - Increase `DEFAULT_GAS_VALUE` to `4000000` (before `3000000`)
128
+
129
+ # v0.24.0 (2022-03-23)
130
+
131
+ ## Update
132
+
133
+ - upgraded to "@cosmos-client/core": "0.45.1"
134
+ - client now extend BaseXChainClient
135
+
136
+ ## Breaking Changes
137
+
138
+ - `buildDepositTx` now returns `proto.cosmos.tx.v1beta1.TxBody` from `@cosmos-client/core`
139
+
140
+ # v0.23.0 (2022-03-08)
141
+
142
+ ## Add
143
+
144
+ - Helpers `getChainId` + `getChainIds`
145
+
146
+ ## Breaking change
147
+
148
+ - `chainIds: ChainIds` is required to initialize `Client`
149
+
150
+ ## Fix
151
+
152
+ - Request fees from THORChain and use `defaultFees` in case of server errors only
153
+ - Fix `defaultFees` to be 0.02 RUNE
154
+
155
+ # v0.22.2 (2022-02-17)
156
+
157
+ ## Fix
158
+
159
+ - Request fees from THORChain and use `defaultFees` in case of server errors only
160
+ - Fix `defaultFees` to be 0.02 RUNE
161
+
162
+ # v0.22.1 (2022-02-16)
163
+
164
+ ## Fix
165
+
166
+ - Increase limit for `DEFAULT_GAS_VALUE` from 2000000 to 3000000 to accommodate recent increases in gas used that go above the old limit
167
+
168
+ # v0.22.0 (2022-02-06)
169
+
170
+ ## Add
171
+
172
+ - Option to pass `ChainIds` into constructor
173
+ - getter / setter for `chainId` in `Client`
174
+
175
+ ## Breaking change
176
+
177
+ - `buildDepositTx` needs `chainId` to be passed - all params are set as object
178
+ - Remove `enum ChainId` + `getChainId` + `isChainId` from `utils`
179
+
180
+ # v0.21.2 (2022-02-04)
181
+
182
+ ## Fix
183
+
184
+ - Use latest axios@0.25.0
185
+ - xchain-client@0.11.1
186
+ - @xchainjs/xchain-util@0.5.1
187
+ - @xchainjs/xchain-cosmos@0.16.1
188
+
189
+ # v.0.21.1 (2022-02-04)
190
+
191
+ ## Fix
192
+
193
+ - Fix chain id for `testnet` #477
194
+
195
+ ## Add
196
+
197
+ - Helper `isChainId`
198
+ - `enum ChainId`
199
+
200
+ # v.0.21.0 (2022-02-02)
201
+
202
+ ## Breaking change
203
+
204
+ - Remove `getDenomWithChain`
205
+ - Rename `getAsset` -> `assetFromDenom` (incl. fix to get synth asset properly)
206
+
207
+ ## Update
208
+
209
+ - xchain-util@0.5.0
210
+ - xchain-cosmos@0.16.0
211
+
212
+ ## Add
213
+
214
+ - `isAssetNativeRune` helper
215
+ - Add `TxOfflineParams` type
216
+
217
+ ## Fix
218
+
219
+ - Fix synth notation in `transfer|transferOffline|deposit` #473
220
+
221
+ # v0.20.1 (2022-01-11)
222
+
223
+ ## Fix
224
+
225
+ - Get chain ID from THORNode before posting to deposit handler.
226
+
227
+ # v.0.20.0 (2021-12-29)
228
+
229
+ ## Breaking change
230
+
231
+ - Add stagenet environment handling for `Network` and `BaseXChainClient` to client
232
+
233
+ # v.0.19.5 (2021-11-22)
234
+
235
+ ## Add
236
+
237
+ - Provide `transferOffline` method
238
+
239
+ # v.0.19.4 (2021-11-22)
240
+
241
+ ## Add
242
+
243
+ - Provide `getPubKey` method to access public key
244
+
245
+ ## Change
246
+
247
+ - Make `getPrivKey` method `public` to access private key
248
+
249
+ # v.0.19.3 (2021-10-31)
250
+
251
+ ## Update
252
+
253
+ - Use latest `xchain-cosmos@0.13.8` to use `sync` mode for broadcasting txs
254
+
255
+ # v.0.19.2 (2021-09-27)
256
+
257
+ ## Fix
258
+
259
+ - Increase `gas` to `500,000,000` (five hundred million)
260
+
261
+ # v.0.19.1 (2021-09-26)
262
+
263
+ ## Fix
264
+
265
+ - Increase `gas` to `30,000,000` (thirty million)
266
+
267
+ # v.0.19.0 (2021-09-10)
268
+
269
+ ## Breaking change
270
+
271
+ - Extract `buildDepositTx` from `Client` into `utils`
272
+
273
+ ## Add
274
+
275
+ - Add `getBalance` to `utils`
276
+
277
+ # v.0.18.0 (2021-09-08)
278
+
279
+ ## Add
280
+
281
+ - Make `buildDepositTx` public and overrides its fee
282
+ - Add `DEPOSIT_GAS_VALUE`
283
+
284
+ ## Breaking change
285
+
286
+ - Remove `AssetRune` in favour of using `AssetRuneNative` of `xchain-util` only
287
+ - Extract `getChainId` into `util` module
288
+
289
+ # v.0.17.7 (2021-07-20)
290
+
291
+ ## Fix
292
+
293
+ - cosmos 0.42.x has too many breaking changes that wren't caught in the last version, downgrade "cosmos-client": "0.39.2"
294
+
295
+ # v.0.17.6 (2021-07-19)
296
+
297
+ ## Update
298
+
299
+ - bumping peer dependency "cosmos-client": "0.39.2" -> "cosmos-client": "^0.42.7"
300
+
301
+ # v.0.17.5 (2021-07-18)
302
+
303
+ ## Update
304
+
305
+ - Updated rollupjs to include axios to enlable usage on node
306
+
307
+ # v.0.17.4 (2021-07-14)
308
+
309
+ ### Fix
310
+
311
+ - Bump `fee.gas to `25000000` (twenty five million) to try to avoid failing withdraw txs
312
+
313
+ # v.0.17.3 (2021-07-07)
314
+
315
+ ## Update
316
+
317
+ - Use latest `xchain-client@0.10.1` + `xchain-util@0.3.0`
318
+
319
+ # v.0.17.2 (2021-07-05)
320
+
321
+ ## Fix
322
+
323
+ - refactored client methods to use regular method syntax (not fat arrow) in order for bcall to super.xxx() to work properly
324
+
325
+ # v.0.17.1 (2021-06-29)
326
+
327
+ ### Fix
328
+
329
+ - Stick with `cosmos-client@0.39.2`
330
+
331
+ ### Add
332
+
333
+ - Add examples to README
334
+
335
+ # v.0.17.0 (2021-06-21)
336
+
337
+ ### Fix
338
+
339
+ - Fix `to` / `from` addresses by parsing tx data from event logs
340
+
341
+ ### Breaking change
342
+
343
+ - Remove deprecated `getTxDataFromResponse` helper
344
+
345
+ # v.0.16.1 (2021-06-14)
346
+
347
+ ### Fix
348
+
349
+ - Double `fee.gas to `20000000` (twenty million) to avoid failing withdraw transactions
350
+
351
+ # v.0.16.0 (2021-06-08)
352
+
353
+ ### Breaking change
354
+
355
+ - Use `viewblock` as default explorer
356
+ - [types] Refactored structure of explorer urls (via `type ExplorerUrls`)
357
+ - [types] Refactored `ExplorerUrl`
358
+ - [client] Constructor accepts `ExplorerUrls`
359
+ - [client] Removed `getExplorerNodeUrl` (use `getExplorerAddressUrl` instead)
360
+ - [client] Extract `getDefaultClientUrl` into `utils`
361
+ - [utils] Renamed `getDefaultExplorerUrlByNetwork` -> `getDefaultExplorerUrl`
362
+ - [utils] Removed `getDefaultExplorerAddressUrl`, `getDefaultExplorerNodeUrl`, `getDefaultExplorerTxUrl`
363
+ - [utils] Added `getExplorerTxUrl`, `getExplorerAddressUrl`, `getExplorerUrl` helpers
364
+
365
+ # v.0.15.2 (2021-06-01)
366
+
367
+ ### Update
368
+
369
+ - updated peer deps
370
+
371
+ # v.0.15.0 (2021-05-17)
372
+
373
+ ### Breaking change
374
+
375
+ - added support for HD wallets
376
+
377
+ # v.0.14.0 (2021-05-05)
378
+
379
+ ### Breaking change
380
+
381
+ - Latest @xchainjs/xchain-client@0.8.0
382
+ - Latest @xchainjs/xchain-util@0.2.7
383
+
384
+ # v.0.13.7 (2021-04-21)
385
+
386
+ ### Update
387
+
388
+ - Export `MSG_SEND` `MSG_DEPOSIT` `MAX_COUNT`
389
+ - Added `getCosmosClient()`
390
+ - Extend `getTransactions` parameters with an optional `filterFn`
391
+
392
+ # v.0.13.6 (2021-04-16)
393
+
394
+ ### Update
395
+
396
+ - Set `fee.gas` to `10000000` (ten million) in `deposit` due to failing withdraw transactions
397
+
398
+ # v.0.13.5 (2021-04-16)
399
+
400
+ ### Update
401
+
402
+ - Set `fee.gas` to `1000000` (one million) in `deposit`
403
+
404
+ # v.0.13.4 (2021-04-16)
405
+
406
+ ### Update
407
+
408
+ - Set `fee.gas` to `auto` in `deposit`
409
+ - Try sending `deposit` tx up to 3x
410
+ - Updates `DEFAULT_GAS_VALUE` to `2000000`
411
+
412
+ # v.0.13.3 (2021-04-12)
413
+
414
+ ### Breaking changes
415
+
416
+ - Change `/addresses` to `/address` for explorer url.
417
+
418
+ ### Update
419
+
420
+ - Add util helpers for explorer urls.
421
+
422
+ # v.0.13.2 (2021-04-01)
423
+
424
+ ### Update
425
+
426
+ - Updates `getDefaultClientUrl` to use new mainnet endpoints
427
+
428
+ # v.0.13.1 (2021-03-18)
429
+
430
+ ### Fix
431
+
432
+ - Changed `getDefaultExplorerUrl` to return valid urls
433
+
434
+ # v.0.13.0 (2021-03-02)
435
+
436
+ ### Breaking change
437
+
438
+ - replace `find`, `findIndex`
439
+ - Update @xchainjs/xchain-client package to 0.7.0
440
+ - Update @xchainjs/xchain-cosmos package to 0.11.0
441
+
442
+ # v.0.12.0 (2021-02-24)
443
+
444
+ ### Breaking change
445
+
446
+ - Update @xchainjs/xchain-client package to 0.6.0
447
+ - Update @xchainjs/xchain-cosmos package to 0.10.0
448
+ - Update `getBalance`
449
+
450
+ # v.0.11.1 (2021-02-24)
451
+
452
+ ### Breaking change
453
+
454
+ - Update @xchainjs/xchain-cosmos package to 0.9.0
455
+
456
+ ### Fix
457
+
458
+ - Fix `getTransactions` - sort transactions from latest
459
+ - Fix `DECIMAL`
460
+
461
+ # v.0.11.0 (2021-02-19)
462
+
463
+ ### Breaking change
464
+
465
+ - Update @xchainjs/xchain-client package to 0.5.0
466
+
467
+ ### Update
468
+
469
+ - Add `Service Providers` section in README.md
470
+
471
+ ### Fix
472
+
473
+ - Fix `peerDependencies`
474
+
475
+ # v.0.10.1 (2021-02-05)
476
+
477
+ ### Update
478
+
479
+ - Update `getTransactions` to support incoming transactions
480
+
481
+ ### Breaking change
482
+
483
+ - Update @xchainjs/xchain-client package to 0.4.0
484
+ - Update @xchainjs/xchain-crypto package to 0.2.3
485
+
486
+ # v.0.10.0 (2021-02-03)
487
+
488
+ ### Breaking changes
489
+
490
+ - Change `getTransactions` to use tendermint rpc. (transaction query from the latest ones.)
491
+
492
+ # v.0.9.3 (2021-02-02)
493
+
494
+ ### Update
495
+
496
+ - Add `getExplorerNodeUrl`
497
+
498
+ # v.0.9.2 (2021-01-30)
499
+
500
+ - Clear lib folder on build
501
+
502
+ # v.0.9.1 (2021-01-26)
503
+
504
+ ### Fix
505
+
506
+ - Fix `deposit`. Use `/thorchain/deposit` to build a deposit transaction.
507
+
508
+ # v.0.9.0 (2021-01-15)
509
+
510
+ ### Breaking change
511
+
512
+ - Move `getPrefix` to util
513
+
514
+ # v.0.8.0 (2021-01-13)
515
+
516
+ ### Breaking change
517
+
518
+ - change MsgNativeTx.fromJson
519
+
520
+ # v.0.7.1 (2021-01-06)
521
+
522
+ ### Fix
523
+
524
+ - Fix getTransactions pagination issue #168
525
+
526
+ ### Update
527
+
528
+ - Update comments for documentation
529
+
530
+ # v.0.7.0 (2020-12-28)
531
+
532
+ ### Breaking change
533
+
534
+ - Extract `getDefaultFees` from `Client` to `utils` #157
535
+
536
+ # v.0.6.2 (2020-12-23)
537
+
538
+ ### Update
539
+
540
+ - Use latest xchain-client@0.2.1
541
+
542
+ ### Fix
543
+
544
+ - Fix invalid assets comparison #151
545
+
546
+ ### Breaking change
547
+
548
+ - Remove `validateAddress` from `ThorchainClient` #149
549
+
550
+ # v.0.6.1 (2020-12-18)
551
+
552
+ ### Update
553
+
554
+ - Add `setClientUrl`
555
+ - Add `getDefaultClientUrl`
556
+ - Add `getClientUrlByNetwork`
557
+
558
+ ### Fix
559
+
560
+ - Fix client url for multichain testnet (`https://testnet.thornode.thorchain.info`)
561
+
562
+ # v.0.6.0 (2020-12-16)
563
+
564
+ ### Update
565
+
566
+ - Set the latest multi-chain node
567
+ - Update `getTransactionData`, `getTransactions`
568
+ - Update `transfer` (for `MsgSend`)
569
+ - Update `deposit` (for `MsgNativeTx`)
570
+
571
+ # v.0.5.0 (2020-12-11)
572
+
573
+ ### Update
574
+
575
+ - Update dependencies
576
+ - Add `getDefaultFees`
577
+
578
+ # v.0.4.2 (2020-11-23)
579
+
580
+ ### Fix
581
+
582
+ - Fix import of `cosmos/codec`
583
+
584
+ ### Update
585
+
586
+ - Use latest `@xchainjs/cosmos@0.4.2`
587
+
588
+ # v.0.4.1 (2020-11-23)
589
+
590
+ ### Update
591
+
592
+ - Update to latest `@xchainjs/*` packages and other dependencies
593
+
594
+ # v.0.4.0 (2020-11-20)
595
+
596
+ ### Breaking change
597
+
598
+ - Update @xchainjs/xchain-crypto package to 0.2.0, deprecating old keystores
package/lib/const.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ import { Asset } from '@xchainjs/xchain-util/lib';
2
+ import { ExplorerUrls } from './types';
3
+ export declare const DECIMAL = 8;
4
+ export declare const DEFAULT_GAS_ADJUSTMENT = 2;
5
+ export declare const DEFAULT_GAS_LIMIT_VALUE = "4000000";
6
+ export declare const DEPOSIT_GAS_LIMIT_VALUE = "600000000";
7
+ export declare const MAX_TX_COUNT = 100;
8
+ export declare const RUNE_SYMBOL = "\u16B1";
9
+ export declare const defaultExplorerUrls: ExplorerUrls;
10
+ /**
11
+ * Chain identifier for Thorchain
12
+ *
13
+ */
14
+ export declare const THORChain: "THOR";
15
+ /**
16
+ * Base "chain" asset for RUNE-67C on Binance test net.
17
+ *
18
+ * Based on definition in Thorchain `common`
19
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
20
+ */
21
+ export declare const AssetRune67C: Asset;
22
+ /**
23
+ * Base "chain" asset for RUNE-B1A on Binance main net.
24
+ *
25
+ * Based on definition in Thorchain `common`
26
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
27
+ */
28
+ export declare const AssetRuneB1A: Asset;
29
+ /**
30
+ * Base "chain" asset on thorchain main net.
31
+ *
32
+ * Based on definition in Thorchain `common`
33
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
34
+ */
35
+ export declare const AssetRuneNative: Asset;
36
+ /**
37
+ * Base "chain" asset for RUNE on ethereum main net.
38
+ *
39
+ * Based on definition in Thorchain `common`
40
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
41
+ */
42
+ export declare const AssetRuneERC20: Asset;
43
+ /**
44
+ * Base "chain" asset for RUNE on ethereum main net.
45
+ *
46
+ * Based on definition in Thorchain `common`
47
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
48
+ */
49
+ export declare const AssetRuneERC20Testnet: Asset;
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './client';
2
2
  export * from './types';
3
- export * from './util';
3
+ export * from './utils';
4
+ export * from './const';
package/lib/index.esm.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import cosmosclient from '@cosmos-client/core';
2
- import { Network, TxType, singleFee, FeeType, BaseXChainClient } from '@xchainjs/xchain-client';
3
- import { CosmosSDKClient } from '@xchainjs/xchain-cosmos';
4
- import { isAssetRuneNative, isSynthAsset, assetToString, AssetRuneNative, assetFromString, baseAmount, assetToBase, assetAmount, Chain } from '@xchainjs/xchain-util';
2
+ import { Network as Network$1, TxType, singleFee, FeeType, BaseXChainClient } from '@xchainjs/xchain-client';
3
+ import { GAIAChain, CosmosSDKClient } from '@xchainjs/xchain-cosmos';
4
+ import { assetToString, isSynthAsset, assetFromString, baseAmount, assetToBase, assetAmount } from '@xchainjs/xchain-util';
5
5
  import axios from 'axios';
6
+ import { Network } from '@xchainjs/xchain-client/lib';
6
7
  import { decode } from 'bech32-buffer';
7
8
 
8
9
  /*! *****************************************************************************
@@ -4260,6 +4261,84 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
4260
4261
  );
4261
4262
  };
4262
4263
 
4264
+ const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
4265
+ const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
4266
+ const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
4267
+ const RUNE_TICKER = 'RUNE';
4268
+ const DECIMAL = 8;
4269
+ const DEFAULT_GAS_ADJUSTMENT = 2;
4270
+ const DEFAULT_GAS_LIMIT_VALUE = '4000000';
4271
+ const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
4272
+ const MAX_TX_COUNT = 100;
4273
+ const RUNE_SYMBOL = 'ᚱ';
4274
+ const defaultExplorerUrls = {
4275
+ root: {
4276
+ [Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
4277
+ [Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
4278
+ [Network.Mainnet]: DEFAULT_EXPLORER_URL,
4279
+ },
4280
+ tx: {
4281
+ [Network.Testnet]: txUrl,
4282
+ [Network.Stagenet]: txUrl,
4283
+ [Network.Mainnet]: txUrl,
4284
+ },
4285
+ address: {
4286
+ [Network.Testnet]: addressUrl,
4287
+ [Network.Stagenet]: addressUrl,
4288
+ [Network.Mainnet]: addressUrl,
4289
+ },
4290
+ };
4291
+ /**
4292
+ * Chain identifier for Thorchain
4293
+ *
4294
+ */
4295
+ const THORChain = 'THOR';
4296
+ /**
4297
+ * Base "chain" asset for RUNE-67C on Binance test net.
4298
+ *
4299
+ * Based on definition in Thorchain `common`
4300
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4301
+ */
4302
+ const AssetRune67C = { chain: 'BNB', symbol: 'RUNE-67C', ticker: RUNE_TICKER, synth: false };
4303
+ /**
4304
+ * Base "chain" asset for RUNE-B1A on Binance main net.
4305
+ *
4306
+ * Based on definition in Thorchain `common`
4307
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4308
+ */
4309
+ const AssetRuneB1A = { chain: 'BNB', symbol: 'RUNE-B1A', ticker: RUNE_TICKER, synth: false };
4310
+ /**
4311
+ * Base "chain" asset on thorchain main net.
4312
+ *
4313
+ * Based on definition in Thorchain `common`
4314
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4315
+ */
4316
+ const AssetRuneNative = { chain: THORChain, symbol: RUNE_TICKER, ticker: RUNE_TICKER, synth: false };
4317
+ /**
4318
+ * Base "chain" asset for RUNE on ethereum main net.
4319
+ *
4320
+ * Based on definition in Thorchain `common`
4321
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4322
+ */
4323
+ const AssetRuneERC20 = {
4324
+ chain: 'ETH',
4325
+ symbol: `${RUNE_TICKER}-0x3155ba85d5f96b2d030a4966af206230e46849cb`,
4326
+ ticker: RUNE_TICKER,
4327
+ synth: false,
4328
+ };
4329
+ /**
4330
+ * Base "chain" asset for RUNE on ethereum main net.
4331
+ *
4332
+ * Based on definition in Thorchain `common`
4333
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4334
+ */
4335
+ const AssetRuneERC20Testnet = {
4336
+ chain: 'ETH',
4337
+ symbol: `${RUNE_TICKER}-0xd601c6A3a36721320573885A8d8420746dA3d7A0`,
4338
+ ticker: RUNE_TICKER,
4339
+ synth: false,
4340
+ };
4341
+
4263
4342
  var aspromise = asPromise;
4264
4343
 
4265
4344
  /**
@@ -9599,33 +9678,16 @@ $root.cosmos = (function() {
9599
9678
 
9600
9679
  var MsgCompiled = $root;
9601
9680
 
9602
- const DECIMAL = 8;
9603
- const DEFAULT_GAS_ADJUSTMENT = 2;
9604
- const DEFAULT_GAS_LIMIT_VALUE = '4000000';
9605
- const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
9606
- const MAX_TX_COUNT = 100;
9607
9681
  const DENOM_RUNE_NATIVE = 'rune';
9608
- const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
9609
- const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
9610
- const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
9611
- const defaultExplorerUrls = {
9612
- root: {
9613
- [Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
9614
- [Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
9615
- [Network.Mainnet]: DEFAULT_EXPLORER_URL,
9616
- },
9617
- tx: {
9618
- [Network.Testnet]: txUrl,
9619
- [Network.Stagenet]: txUrl,
9620
- [Network.Mainnet]: txUrl,
9621
- },
9622
- address: {
9623
- [Network.Testnet]: addressUrl,
9624
- [Network.Stagenet]: addressUrl,
9625
- [Network.Mainnet]: addressUrl,
9626
- },
9627
- };
9628
9682
  /**
9683
+ * Checks whether an asset is `AssetRuneNative`
9684
+ *
9685
+ * @param {Asset} asset
9686
+ * @returns {boolean} `true` or `false`
9687
+ */
9688
+ const isAssetRuneNative = (asset) => assetToString(asset) === assetToString(AssetRuneNative);
9689
+ /**
9690
+
9629
9691
  * Get denomination from Asset
9630
9692
  *
9631
9693
  * @param {Asset} asset
@@ -9668,11 +9730,11 @@ const isBroadcastSuccess = (response) => typeof response === 'object' &&
9668
9730
  **/
9669
9731
  const getPrefix = (network) => {
9670
9732
  switch (network) {
9671
- case Network.Mainnet:
9733
+ case Network$1.Mainnet:
9672
9734
  return 'thor';
9673
- case Network.Stagenet:
9735
+ case Network$1.Stagenet:
9674
9736
  return 'sthor';
9675
- case Network.Testnet:
9737
+ case Network$1.Testnet:
9676
9738
  return 'tthor';
9677
9739
  }
9678
9740
  };
@@ -9908,11 +9970,11 @@ const getExplorerUrl = ({ root }, network) => root[network];
9908
9970
  const getExplorerAddressUrl = ({ urls, network, address, }) => {
9909
9971
  const url = `${urls.address[network]}/${address}`;
9910
9972
  switch (network) {
9911
- case Network.Mainnet:
9973
+ case Network$1.Mainnet:
9912
9974
  return url;
9913
- case Network.Stagenet:
9975
+ case Network$1.Stagenet:
9914
9976
  return `${url}?network=stagenet`;
9915
- case Network.Testnet:
9977
+ case Network$1.Testnet:
9916
9978
  return `${url}?network=testnet`;
9917
9979
  }
9918
9980
  };
@@ -9927,11 +9989,11 @@ const getExplorerAddressUrl = ({ urls, network, address, }) => {
9927
9989
  const getExplorerTxUrl = ({ urls, network, txID, }) => {
9928
9990
  const url = `${urls.tx[network]}/${txID}`;
9929
9991
  switch (network) {
9930
- case Network.Mainnet:
9992
+ case Network$1.Mainnet:
9931
9993
  return url;
9932
- case Network.Stagenet:
9994
+ case Network$1.Stagenet:
9933
9995
  return `${url}?network=stagenet`;
9934
- case Network.Testnet:
9996
+ case Network$1.Testnet:
9935
9997
  return `${url}?network=testnet`;
9936
9998
  }
9937
9999
  };
@@ -9959,29 +10021,29 @@ class Client extends BaseXChainClient {
9959
10021
  *
9960
10022
  * @throws {"Invalid phrase"} Thrown if the given phase is invalid.
9961
10023
  */
9962
- constructor({ network = Network.Mainnet, phrase, clientUrl = {
9963
- [Network.Testnet]: {
10024
+ constructor({ network = Network$1.Mainnet, phrase, clientUrl = {
10025
+ [Network$1.Testnet]: {
9964
10026
  node: 'deprecated',
9965
10027
  rpc: 'deprecated',
9966
10028
  },
9967
- [Network.Stagenet]: {
10029
+ [Network$1.Stagenet]: {
9968
10030
  node: 'https://stagenet-thornode.ninerealms.com',
9969
10031
  rpc: 'https://stagenet-rpc.ninerealms.com',
9970
10032
  },
9971
- [Network.Mainnet]: {
10033
+ [Network$1.Mainnet]: {
9972
10034
  node: 'https://thornode.ninerealms.com',
9973
10035
  rpc: 'https://rpc.ninerealms.com',
9974
10036
  },
9975
10037
  }, explorerUrls = defaultExplorerUrls, rootDerivationPaths = {
9976
- [Network.Mainnet]: "44'/931'/0'/0/",
9977
- [Network.Stagenet]: "44'/931'/0'/0/",
9978
- [Network.Testnet]: "44'/931'/0'/0/",
10038
+ [Network$1.Mainnet]: "44'/931'/0'/0/",
10039
+ [Network$1.Stagenet]: "44'/931'/0'/0/",
10040
+ [Network$1.Testnet]: "44'/931'/0'/0/",
9979
10041
  }, chainIds = {
9980
- [Network.Mainnet]: 'thorchain-mainnet-v1',
9981
- [Network.Stagenet]: 'thorchain-stagenet-v2',
9982
- [Network.Testnet]: 'deprecated',
10042
+ [Network$1.Mainnet]: 'thorchain-mainnet-v1',
10043
+ [Network$1.Stagenet]: 'thorchain-stagenet-v2',
10044
+ [Network$1.Testnet]: 'deprecated',
9983
10045
  }, }) {
9984
- super(Chain.Cosmos, { network, rootDerivationPaths, phrase });
10046
+ super(GAIAChain, { network, rootDerivationPaths, phrase });
9985
10047
  /**
9986
10048
  * Get transaction history of a given address with pagination options.
9987
10049
  * By default it will return the transaction history of the current wallet.
@@ -10467,4 +10529,4 @@ const msgNativeTxFromJson = (value) => {
10467
10529
  return new MsgNativeTx(value.coins, value.memo, cosmosclient.AccAddress.fromString(value.signer));
10468
10530
  };
10469
10531
 
10470
- export { Client, DECIMAL, DEFAULT_GAS_ADJUSTMENT, DEFAULT_GAS_LIMIT_VALUE, DEPOSIT_GAS_LIMIT_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, defaultExplorerUrls, getAccount, getBalance, getChainId, getDefaultFees, getDenom, getDepositTxDataFromLogs, getEstimatedGas, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getSequence, getTxType, isBroadcastSuccess, msgNativeTxFromJson, registerDepositCodecs, registerSendCodecs };
10532
+ export { AssetRune67C, AssetRuneB1A, AssetRuneERC20, AssetRuneERC20Testnet, AssetRuneNative, Client, DECIMAL, DEFAULT_GAS_ADJUSTMENT, DEFAULT_GAS_LIMIT_VALUE, DEPOSIT_GAS_LIMIT_VALUE, MAX_TX_COUNT, MsgNativeTx, RUNE_SYMBOL, THORChain, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, defaultExplorerUrls, getAccount, getBalance, getChainId, getDefaultFees, getDenom, getDepositTxDataFromLogs, getEstimatedGas, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getSequence, getTxType, isAssetRuneNative, isBroadcastSuccess, msgNativeTxFromJson, registerDepositCodecs, registerSendCodecs };
package/lib/index.js CHANGED
@@ -7,6 +7,7 @@ var xchainClient = require('@xchainjs/xchain-client');
7
7
  var xchainCosmos = require('@xchainjs/xchain-cosmos');
8
8
  var xchainUtil = require('@xchainjs/xchain-util');
9
9
  var axios = require('axios');
10
+ var lib = require('@xchainjs/xchain-client/lib');
10
11
  var bech32Buffer = require('bech32-buffer');
11
12
 
12
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -4269,6 +4270,84 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
4269
4270
  );
4270
4271
  };
4271
4272
 
4273
+ const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
4274
+ const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
4275
+ const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
4276
+ const RUNE_TICKER = 'RUNE';
4277
+ const DECIMAL = 8;
4278
+ const DEFAULT_GAS_ADJUSTMENT = 2;
4279
+ const DEFAULT_GAS_LIMIT_VALUE = '4000000';
4280
+ const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
4281
+ const MAX_TX_COUNT = 100;
4282
+ const RUNE_SYMBOL = 'ᚱ';
4283
+ const defaultExplorerUrls = {
4284
+ root: {
4285
+ [lib.Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
4286
+ [lib.Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
4287
+ [lib.Network.Mainnet]: DEFAULT_EXPLORER_URL,
4288
+ },
4289
+ tx: {
4290
+ [lib.Network.Testnet]: txUrl,
4291
+ [lib.Network.Stagenet]: txUrl,
4292
+ [lib.Network.Mainnet]: txUrl,
4293
+ },
4294
+ address: {
4295
+ [lib.Network.Testnet]: addressUrl,
4296
+ [lib.Network.Stagenet]: addressUrl,
4297
+ [lib.Network.Mainnet]: addressUrl,
4298
+ },
4299
+ };
4300
+ /**
4301
+ * Chain identifier for Thorchain
4302
+ *
4303
+ */
4304
+ const THORChain = 'THOR';
4305
+ /**
4306
+ * Base "chain" asset for RUNE-67C on Binance test net.
4307
+ *
4308
+ * Based on definition in Thorchain `common`
4309
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4310
+ */
4311
+ const AssetRune67C = { chain: 'BNB', symbol: 'RUNE-67C', ticker: RUNE_TICKER, synth: false };
4312
+ /**
4313
+ * Base "chain" asset for RUNE-B1A on Binance main net.
4314
+ *
4315
+ * Based on definition in Thorchain `common`
4316
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4317
+ */
4318
+ const AssetRuneB1A = { chain: 'BNB', symbol: 'RUNE-B1A', ticker: RUNE_TICKER, synth: false };
4319
+ /**
4320
+ * Base "chain" asset on thorchain main net.
4321
+ *
4322
+ * Based on definition in Thorchain `common`
4323
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4324
+ */
4325
+ const AssetRuneNative = { chain: THORChain, symbol: RUNE_TICKER, ticker: RUNE_TICKER, synth: false };
4326
+ /**
4327
+ * Base "chain" asset for RUNE on ethereum main net.
4328
+ *
4329
+ * Based on definition in Thorchain `common`
4330
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4331
+ */
4332
+ const AssetRuneERC20 = {
4333
+ chain: 'ETH',
4334
+ symbol: `${RUNE_TICKER}-0x3155ba85d5f96b2d030a4966af206230e46849cb`,
4335
+ ticker: RUNE_TICKER,
4336
+ synth: false,
4337
+ };
4338
+ /**
4339
+ * Base "chain" asset for RUNE on ethereum main net.
4340
+ *
4341
+ * Based on definition in Thorchain `common`
4342
+ * @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
4343
+ */
4344
+ const AssetRuneERC20Testnet = {
4345
+ chain: 'ETH',
4346
+ symbol: `${RUNE_TICKER}-0xd601c6A3a36721320573885A8d8420746dA3d7A0`,
4347
+ ticker: RUNE_TICKER,
4348
+ synth: false,
4349
+ };
4350
+
4272
4351
  var aspromise = asPromise;
4273
4352
 
4274
4353
  /**
@@ -9608,40 +9687,23 @@ $root.cosmos = (function() {
9608
9687
 
9609
9688
  var MsgCompiled = $root;
9610
9689
 
9611
- const DECIMAL = 8;
9612
- const DEFAULT_GAS_ADJUSTMENT = 2;
9613
- const DEFAULT_GAS_LIMIT_VALUE = '4000000';
9614
- const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
9615
- const MAX_TX_COUNT = 100;
9616
9690
  const DENOM_RUNE_NATIVE = 'rune';
9617
- const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
9618
- const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
9619
- const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
9620
- const defaultExplorerUrls = {
9621
- root: {
9622
- [xchainClient.Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
9623
- [xchainClient.Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
9624
- [xchainClient.Network.Mainnet]: DEFAULT_EXPLORER_URL,
9625
- },
9626
- tx: {
9627
- [xchainClient.Network.Testnet]: txUrl,
9628
- [xchainClient.Network.Stagenet]: txUrl,
9629
- [xchainClient.Network.Mainnet]: txUrl,
9630
- },
9631
- address: {
9632
- [xchainClient.Network.Testnet]: addressUrl,
9633
- [xchainClient.Network.Stagenet]: addressUrl,
9634
- [xchainClient.Network.Mainnet]: addressUrl,
9635
- },
9636
- };
9637
9691
  /**
9692
+ * Checks whether an asset is `AssetRuneNative`
9693
+ *
9694
+ * @param {Asset} asset
9695
+ * @returns {boolean} `true` or `false`
9696
+ */
9697
+ const isAssetRuneNative = (asset) => xchainUtil.assetToString(asset) === xchainUtil.assetToString(AssetRuneNative);
9698
+ /**
9699
+
9638
9700
  * Get denomination from Asset
9639
9701
  *
9640
9702
  * @param {Asset} asset
9641
9703
  * @returns {string} The denomination of the given asset.
9642
9704
  */
9643
9705
  const getDenom = (asset) => {
9644
- if (xchainUtil.isAssetRuneNative(asset))
9706
+ if (isAssetRuneNative(asset))
9645
9707
  return DENOM_RUNE_NATIVE;
9646
9708
  if (xchainUtil.isSynthAsset(asset))
9647
9709
  return xchainUtil.assetToString(asset).toLowerCase();
@@ -9655,7 +9717,7 @@ const getDenom = (asset) => {
9655
9717
  */
9656
9718
  const assetFromDenom = (denom) => {
9657
9719
  if (denom === DENOM_RUNE_NATIVE)
9658
- return xchainUtil.AssetRuneNative;
9720
+ return AssetRuneNative;
9659
9721
  return xchainUtil.assetFromString(denom.toUpperCase());
9660
9722
  };
9661
9723
  /**
@@ -9893,7 +9955,7 @@ const getBalance = ({ address, assets, cosmosClient, }) => __awaiter(void 0, voi
9893
9955
  const balances = yield cosmosClient.getBalance(address);
9894
9956
  return balances
9895
9957
  .map((balance) => ({
9896
- asset: (balance.denom && assetFromDenom(balance.denom)) || xchainUtil.AssetRuneNative,
9958
+ asset: (balance.denom && assetFromDenom(balance.denom)) || AssetRuneNative,
9897
9959
  amount: xchainUtil.baseAmount(balance.amount, DECIMAL),
9898
9960
  }))
9899
9961
  .filter((balance) => !assets || assets.filter((asset) => xchainUtil.assetToString(balance.asset) === xchainUtil.assetToString(asset)).length);
@@ -9990,7 +10052,7 @@ class Client extends xchainClient.BaseXChainClient {
9990
10052
  [xchainClient.Network.Stagenet]: 'thorchain-stagenet-v2',
9991
10053
  [xchainClient.Network.Testnet]: 'deprecated',
9992
10054
  }, }) {
9993
- super(xchainUtil.Chain.Cosmos, { network, rootDerivationPaths, phrase });
10055
+ super(xchainCosmos.GAIAChain, { network, rootDerivationPaths, phrase });
9994
10056
  /**
9995
10057
  * Get transaction history of a given address with pagination options.
9996
10058
  * By default it will return the transaction history of the current wallet.
@@ -10229,7 +10291,7 @@ class Client extends xchainClient.BaseXChainClient {
10229
10291
  const { from, to, type } = txData;
10230
10292
  return {
10231
10293
  hash: txId,
10232
- asset: xchainUtil.AssetRuneNative,
10294
+ asset: AssetRuneNative,
10233
10295
  from,
10234
10296
  to,
10235
10297
  date: new Date(txResult.timestamp),
@@ -10265,7 +10327,7 @@ class Client extends xchainClient.BaseXChainClient {
10265
10327
  asset = xchainUtil.assetFromString(coin.asset);
10266
10328
  });
10267
10329
  return {
10268
- asset: asset || xchainUtil.AssetRuneNative,
10330
+ asset: asset || AssetRuneNative,
10269
10331
  from,
10270
10332
  to,
10271
10333
  type: xchainClient.TxType.Transfer,
@@ -10282,14 +10344,14 @@ class Client extends xchainClient.BaseXChainClient {
10282
10344
  * @throws {"insufficient funds"} Thrown if the wallet has insufficient funds.
10283
10345
  * @throws {"Invalid transaction hash"} Thrown by missing tx hash
10284
10346
  */
10285
- deposit({ walletIndex = 0, asset = xchainUtil.AssetRuneNative, amount, memo, gasLimit = new bignumber(DEPOSIT_GAS_LIMIT_VALUE), sequence, }) {
10347
+ deposit({ walletIndex = 0, asset = AssetRuneNative, amount, memo, gasLimit = new bignumber(DEPOSIT_GAS_LIMIT_VALUE), sequence, }) {
10286
10348
  var _a, _b, _c, _d;
10287
10349
  return __awaiter(this, void 0, void 0, function* () {
10288
10350
  const balances = yield this.getBalance(this.getAddress(walletIndex));
10289
- const runeBalance = (_b = (_a = balances.filter(({ asset }) => xchainUtil.isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
10351
+ const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
10290
10352
  const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => xchainUtil.assetToString(assetInList) === xchainUtil.assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : xchainUtil.baseAmount(0, DECIMAL);
10291
10353
  const { average: fee } = yield this.getFees();
10292
- if (xchainUtil.isAssetRuneNative(asset)) {
10354
+ if (isAssetRuneNative(asset)) {
10293
10355
  // amount + fee < runeBalance
10294
10356
  if (runeBalance.lt(amount.plus(fee))) {
10295
10357
  throw new Error('insufficient funds');
@@ -10345,14 +10407,14 @@ class Client extends xchainClient.BaseXChainClient {
10345
10407
  * @throws {"insufficient funds"} Thrown if the wallet has insufficient funds.
10346
10408
  * @throws {"Invalid transaction hash"} Thrown by missing tx hash
10347
10409
  */
10348
- transfer({ walletIndex = 0, asset = xchainUtil.AssetRuneNative, amount, recipient, memo, gasLimit = new bignumber(DEFAULT_GAS_LIMIT_VALUE), sequence, }) {
10410
+ transfer({ walletIndex = 0, asset = AssetRuneNative, amount, recipient, memo, gasLimit = new bignumber(DEFAULT_GAS_LIMIT_VALUE), sequence, }) {
10349
10411
  var _a, _b, _c, _d;
10350
10412
  return __awaiter(this, void 0, void 0, function* () {
10351
10413
  const balances = yield this.getBalance(this.getAddress(walletIndex));
10352
- const runeBalance = (_b = (_a = balances.filter(({ asset }) => xchainUtil.isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
10414
+ const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
10353
10415
  const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => xchainUtil.assetToString(assetInList) === xchainUtil.assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : xchainUtil.baseAmount(0, DECIMAL);
10354
10416
  const fee = (yield this.getFees()).average;
10355
- if (xchainUtil.isAssetRuneNative(asset)) {
10417
+ if (isAssetRuneNative(asset)) {
10356
10418
  // amount + fee < runeBalance
10357
10419
  if (runeBalance.lt(amount.plus(fee))) {
10358
10420
  throw new Error('insufficient funds');
@@ -10401,10 +10463,10 @@ class Client extends xchainClient.BaseXChainClient {
10401
10463
  * @param {TxOfflineParams} params The transfer offline options.
10402
10464
  * @returns {string} The signed transaction bytes.
10403
10465
  */
10404
- transferOffline({ walletIndex = 0, asset = xchainUtil.AssetRuneNative, amount, recipient, memo, fromRuneBalance: from_rune_balance, fromAssetBalance: from_asset_balance = xchainUtil.baseAmount(0, DECIMAL), fromAccountNumber = long_1.ZERO, fromSequence = long_1.ZERO, gasLimit = new bignumber(DEFAULT_GAS_LIMIT_VALUE), }) {
10466
+ transferOffline({ walletIndex = 0, asset = AssetRuneNative, amount, recipient, memo, fromRuneBalance: from_rune_balance, fromAssetBalance: from_asset_balance = xchainUtil.baseAmount(0, DECIMAL), fromAccountNumber = long_1.ZERO, fromSequence = long_1.ZERO, gasLimit = new bignumber(DEFAULT_GAS_LIMIT_VALUE), }) {
10405
10467
  return __awaiter(this, void 0, void 0, function* () {
10406
10468
  const fee = (yield this.getFees()).average;
10407
- if (xchainUtil.isAssetRuneNative(asset)) {
10469
+ if (isAssetRuneNative(asset)) {
10408
10470
  // amount + fee < runeBalance
10409
10471
  if (from_rune_balance.lt(amount.plus(fee))) {
10410
10472
  throw new Error('insufficient funds');
@@ -10476,6 +10538,11 @@ const msgNativeTxFromJson = (value) => {
10476
10538
  return new MsgNativeTx(value.coins, value.memo, cosmosclient__default['default'].AccAddress.fromString(value.signer));
10477
10539
  };
10478
10540
 
10541
+ exports.AssetRune67C = AssetRune67C;
10542
+ exports.AssetRuneB1A = AssetRuneB1A;
10543
+ exports.AssetRuneERC20 = AssetRuneERC20;
10544
+ exports.AssetRuneERC20Testnet = AssetRuneERC20Testnet;
10545
+ exports.AssetRuneNative = AssetRuneNative;
10479
10546
  exports.Client = Client;
10480
10547
  exports.DECIMAL = DECIMAL;
10481
10548
  exports.DEFAULT_GAS_ADJUSTMENT = DEFAULT_GAS_ADJUSTMENT;
@@ -10483,6 +10550,8 @@ exports.DEFAULT_GAS_LIMIT_VALUE = DEFAULT_GAS_LIMIT_VALUE;
10483
10550
  exports.DEPOSIT_GAS_LIMIT_VALUE = DEPOSIT_GAS_LIMIT_VALUE;
10484
10551
  exports.MAX_TX_COUNT = MAX_TX_COUNT;
10485
10552
  exports.MsgNativeTx = MsgNativeTx;
10553
+ exports.RUNE_SYMBOL = RUNE_SYMBOL;
10554
+ exports.THORChain = THORChain;
10486
10555
  exports.assetFromDenom = assetFromDenom;
10487
10556
  exports.buildDepositTx = buildDepositTx;
10488
10557
  exports.buildTransferTx = buildTransferTx;
@@ -10501,6 +10570,7 @@ exports.getExplorerUrl = getExplorerUrl;
10501
10570
  exports.getPrefix = getPrefix;
10502
10571
  exports.getSequence = getSequence;
10503
10572
  exports.getTxType = getTxType;
10573
+ exports.isAssetRuneNative = isAssetRuneNative;
10504
10574
  exports.isBroadcastSuccess = isBroadcastSuccess;
10505
10575
  exports.msgNativeTxFromJson = msgNativeTxFromJson;
10506
10576
  exports.registerDepositCodecs = registerDepositCodecs;
@@ -5,13 +5,15 @@ import { Address, Asset, BaseAmount } from '@xchainjs/xchain-util';
5
5
  import Long from 'long';
6
6
  import { ChainId, ExplorerUrls, TxData } from './types';
7
7
  import { MsgNativeTx } from './types/messages';
8
- export declare const DECIMAL = 8;
9
- export declare const DEFAULT_GAS_ADJUSTMENT = 2;
10
- export declare const DEFAULT_GAS_LIMIT_VALUE = "4000000";
11
- export declare const DEPOSIT_GAS_LIMIT_VALUE = "600000000";
12
- export declare const MAX_TX_COUNT = 100;
13
- export declare const defaultExplorerUrls: ExplorerUrls;
14
8
  /**
9
+ * Checks whether an asset is `AssetRuneNative`
10
+ *
11
+ * @param {Asset} asset
12
+ * @returns {boolean} `true` or `false`
13
+ */
14
+ export declare const isAssetRuneNative: (asset: Asset) => boolean;
15
+ /**
16
+
15
17
  * Get denomination from Asset
16
18
  *
17
19
  * @param {Asset} asset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain",
3
- "version": "0.27.6",
3
+ "version": "0.27.8",
4
4
  "description": "Custom Thorchain client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "THORChain",
@@ -36,10 +36,12 @@
36
36
  "devDependencies": {
37
37
  "@cosmos-client/core": "0.46.1",
38
38
  "@types/big.js": "^6.0.0",
39
- "@xchainjs/xchain-client": "^0.13.3",
40
- "@xchainjs/xchain-cosmos": "^0.20.5",
39
+ "@xchainjs/xchain-binance": "^5.6.6",
40
+ "@xchainjs/xchain-client": "^0.13.5",
41
+ "@xchainjs/xchain-cosmos": "^0.20.6",
41
42
  "@xchainjs/xchain-crypto": "^0.2.6",
42
- "@xchainjs/xchain-util": "^0.11.0",
43
+ "@xchainjs/xchain-ethereum": "^0.27.6",
44
+ "@xchainjs/xchain-util": "^0.12.0",
43
45
  "axios": "^0.25.0",
44
46
  "bech32-buffer": "^0.2.0",
45
47
  "nock": "^13.0.5"
@@ -49,10 +51,10 @@
49
51
  },
50
52
  "peerDependencies": {
51
53
  "@cosmos-client/core": "0.46.1",
52
- "@xchainjs/xchain-client": "^0.13.3",
53
- "@xchainjs/xchain-cosmos": "^0.20.5",
54
+ "@xchainjs/xchain-client": "^0.13.5",
55
+ "@xchainjs/xchain-cosmos": "^0.20.6",
54
56
  "@xchainjs/xchain-crypto": "^0.2.6",
55
- "@xchainjs/xchain-util": "^0.11.0",
57
+ "@xchainjs/xchain-util": "^0.12.0",
56
58
  "axios": "^0.25.0",
57
59
  "bech32-buffer": "^0.2.0"
58
60
  }