@xchainjs/xchain-doge 0.2.0 → 0.5.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.
- package/README.md +7 -39
- package/lib/blockcypher-api.d.ts +1 -1
- package/lib/client.d.ts +3 -2
- package/lib/const.d.ts +2 -0
- package/lib/index.esm.js +96 -117
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +96 -115
- package/lib/index.js.map +1 -1
- package/lib/types/client-types.d.ts +2 -1
- package/lib/types/ledger.d.ts +2 -1
- package/lib/utils.d.ts +2 -2
- package/package.json +5 -5
- package/CHANGELOG.md +0 -31
package/README.md
CHANGED
|
@@ -16,6 +16,13 @@ Following peer dependencies have to be installed into your project. These are no
|
|
|
16
16
|
yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util axios bitcoinjs-lib coininfo wif
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Documentation
|
|
20
|
+
|
|
21
|
+
### [`xchain doge`](http://docs.xchainjs.org/xchain-client/xchain-doge/)
|
|
22
|
+
[`How xchain-doge works`](http://docs.xchainjs.org/xchain-client/xchain-doge/how-it-works.html)\
|
|
23
|
+
[`How to use xchain-doge`](http://docs.xchainjs.org/xchain-client/xchain-doge/how-to-use.html)
|
|
24
|
+
|
|
25
|
+
|
|
19
26
|
## Service Providers
|
|
20
27
|
|
|
21
28
|
This package uses the following service providers:
|
|
@@ -32,42 +39,3 @@ This package uses the following service providers:
|
|
|
32
39
|
Sochain API rate limits: https://sochain.com/api#rate-limits (300 requests/minute)
|
|
33
40
|
|
|
34
41
|
BlockCypher API rate limits: https://api.blockcypher.com/v1/doge/main (5 requests/second)
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
Initialize client and use class methods:
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
import { Client, Network } from '../src/client'
|
|
42
|
-
|
|
43
|
-
// Create a new client interface
|
|
44
|
-
const dogeClient = new Client({ network: Network.Testnet })
|
|
45
|
-
|
|
46
|
-
// Set phrase
|
|
47
|
-
dogeClient.setPhrase('phrase here')
|
|
48
|
-
|
|
49
|
-
// Get address
|
|
50
|
-
const address = dogeClient.getAddress()
|
|
51
|
-
|
|
52
|
-
// Get balance
|
|
53
|
-
const balance = await dogeClient.getBalance()
|
|
54
|
-
|
|
55
|
-
// Transfer with feeRate
|
|
56
|
-
const txid = await dogeClient.transfer({ asset: AssetDoge, recipient: 'recipient address here', amount: baseAmount(100, DOGE_DECIMAL), feeRate: 1 })
|
|
57
|
-
|
|
58
|
-
// Transfer with default feeRate (default is `fast`)
|
|
59
|
-
const txid = await dogeClient.transfer({ asset: AssetDoge, recipient: 'recipient address here', amount: baseAmount(100, DOGE_DECIMAL) })
|
|
60
|
-
|
|
61
|
-
// Get fee estimations
|
|
62
|
-
const { fast, fastest, average } = await dogeClient.getFees()
|
|
63
|
-
|
|
64
|
-
// Get feeRate estimations
|
|
65
|
-
const { fast, fastest, average } = await dogeClient.getFeeRates()
|
|
66
|
-
|
|
67
|
-
// Search transactions
|
|
68
|
-
const transactions = await dogeClient.getTransactions({ address: 'address here', limit: 4 })
|
|
69
|
-
|
|
70
|
-
// Get a transaction with a given txId/hash
|
|
71
|
-
const txData = await dogeClient.getTransactionData('b660ee07167cfa32681e2623f3a29dc64a089cabd9a3a07dd17f9028ac956eb8')
|
|
72
|
-
|
|
73
|
-
```
|
package/lib/blockcypher-api.d.ts
CHANGED
package/lib/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Balance, Fee, FeeRate, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, UTXOClient, XChainClientParams } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Address } from '@xchainjs/xchain-util';
|
|
2
3
|
export declare type DogecoinClientParams = XChainClientParams & {
|
|
3
4
|
sochainUrl?: string;
|
|
4
5
|
blockcypherUrl?: string;
|
|
@@ -16,7 +17,7 @@ declare class Client extends UTXOClient {
|
|
|
16
17
|
*
|
|
17
18
|
* @param {DogecoinClientParams} params
|
|
18
19
|
*/
|
|
19
|
-
constructor({ network, sochainUrl, blockcypherUrl, phrase, rootDerivationPaths, }: DogecoinClientParams);
|
|
20
|
+
constructor({ network, feeBounds, sochainUrl, blockcypherUrl, phrase, rootDerivationPaths, }: DogecoinClientParams);
|
|
20
21
|
/**
|
|
21
22
|
* Set/Update the sochain url.
|
|
22
23
|
*
|
package/lib/const.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Network, standardFeeRates, calcFees, UTXOClient, TxType } from '@xchainjs/xchain-client';
|
|
1
|
+
import { Network, standardFeeRates, calcFees, UTXOClient, TxType, checkFeeBounds } from '@xchainjs/xchain-client';
|
|
2
2
|
import buffer from 'buffer';
|
|
3
3
|
import events from 'events';
|
|
4
4
|
import stream from 'stream';
|
|
@@ -61858,7 +61858,7 @@ var sha256$2 = createCommonjsModule(function (module, exports) {
|
|
|
61858
61858
|
* @param {string} phrase
|
|
61859
61859
|
* @returns {boolean} `true` or `false`
|
|
61860
61860
|
*/
|
|
61861
|
-
|
|
61861
|
+
const validatePhrase = (phrase) => {
|
|
61862
61862
|
return src_6(phrase);
|
|
61863
61863
|
};
|
|
61864
61864
|
/**
|
|
@@ -61869,7 +61869,7 @@ var validatePhrase = function (phrase) {
|
|
|
61869
61869
|
*
|
|
61870
61870
|
* @throws {"Invalid BIP39 phrase"} Thrown if phrase is an invalid one.
|
|
61871
61871
|
*/
|
|
61872
|
-
|
|
61872
|
+
const getSeed = (phrase) => {
|
|
61873
61873
|
if (!validatePhrase(phrase)) {
|
|
61874
61874
|
throw new Error('Invalid BIP39 phrase');
|
|
61875
61875
|
}
|
|
@@ -64796,14 +64796,14 @@ var bignumber$1 = createCommonjsModule$1(function (module) {
|
|
|
64796
64796
|
* @param {string | number | BigNumber.Instance} value
|
|
64797
64797
|
* @returns {BigNumber} The BigNumber interface from the given value.
|
|
64798
64798
|
*/
|
|
64799
|
-
|
|
64799
|
+
const bn$1 = (value) => new bignumber$1(value);
|
|
64800
64800
|
/**
|
|
64801
64801
|
* Helper to check whether a BigNumber is valid or not
|
|
64802
64802
|
*
|
|
64803
64803
|
* @param {BigNumber} value
|
|
64804
64804
|
* @returns {boolean} `true` or `false`.
|
|
64805
64805
|
* */
|
|
64806
|
-
|
|
64806
|
+
const isValidBN = (value) => !value.isNaN();
|
|
64807
64807
|
/**
|
|
64808
64808
|
* The enumuration for symbol position.
|
|
64809
64809
|
* `before` or `after`
|
|
@@ -64821,59 +64821,59 @@ var SymbolPosition;
|
|
|
64821
64821
|
* @param {number} decimalPlaces The decimal place. (optional)
|
|
64822
64822
|
* @returns {BigNumber} The BigNumber interface from the given value and decimal.
|
|
64823
64823
|
* */
|
|
64824
|
-
|
|
64825
|
-
|
|
64826
|
-
|
|
64827
|
-
var fixedBN = isValidBN(n) ? n.toFixed(decimalPlaces) : bn$1(0).toFixed(decimalPlaces);
|
|
64824
|
+
const fixedBN = (value, decimalPlaces = 2) => {
|
|
64825
|
+
const n = bn$1(value || 0);
|
|
64826
|
+
const fixedBN = isValidBN(n) ? n.toFixed(decimalPlaces) : bn$1(0).toFixed(decimalPlaces);
|
|
64828
64827
|
return bn$1(fixedBN);
|
|
64829
64828
|
};
|
|
64830
64829
|
|
|
64831
|
-
var _a;
|
|
64832
64830
|
var Chain;
|
|
64833
64831
|
(function (Chain) {
|
|
64832
|
+
Chain["Avalanche"] = "AVAX";
|
|
64834
64833
|
Chain["Binance"] = "BNB";
|
|
64835
64834
|
Chain["Bitcoin"] = "BTC";
|
|
64836
64835
|
Chain["Ethereum"] = "ETH";
|
|
64837
64836
|
Chain["THORChain"] = "THOR";
|
|
64838
64837
|
Chain["Cosmos"] = "GAIA";
|
|
64839
|
-
Chain["Polkadot"] = "POLKA";
|
|
64840
64838
|
Chain["BitcoinCash"] = "BCH";
|
|
64841
64839
|
Chain["Litecoin"] = "LTC";
|
|
64842
64840
|
Chain["Terra"] = "TERRA";
|
|
64843
64841
|
Chain["Doge"] = "DOGE";
|
|
64842
|
+
Chain["Avax"] = "AVAX";
|
|
64844
64843
|
})(Chain || (Chain = {}));
|
|
64845
|
-
|
|
64846
|
-
|
|
64847
|
-
|
|
64848
|
-
|
|
64849
|
-
|
|
64850
|
-
|
|
64851
|
-
|
|
64852
|
-
|
|
64853
|
-
|
|
64854
|
-
|
|
64844
|
+
const AvalancheChain = Chain.Avalanche;
|
|
64845
|
+
const BNBChain = Chain.Binance;
|
|
64846
|
+
const BTCChain = Chain.Bitcoin;
|
|
64847
|
+
const ETHChain = Chain.Ethereum;
|
|
64848
|
+
const THORChain = Chain.THORChain;
|
|
64849
|
+
const CosmosChain = Chain.Cosmos;
|
|
64850
|
+
const BCHChain = Chain.BitcoinCash;
|
|
64851
|
+
const LTCChain = Chain.Litecoin;
|
|
64852
|
+
const TerraChain = Chain.Terra;
|
|
64853
|
+
const DOGEChain = Chain.Doge;
|
|
64854
|
+
const AVAXChain = Chain.Avax;
|
|
64855
64855
|
/**
|
|
64856
64856
|
* Convert chain to string.
|
|
64857
64857
|
*
|
|
64858
64858
|
* @param {Chain} chainId.
|
|
64859
64859
|
* @returns {string} The string based on the given chain type.
|
|
64860
64860
|
*/
|
|
64861
|
-
|
|
64861
|
+
const chainToString = Object.assign((chainId) => {
|
|
64862
64862
|
if (!(chainId in chainToString))
|
|
64863
64863
|
return 'unknown chain';
|
|
64864
64864
|
return chainToString[chainId];
|
|
64865
|
-
},
|
|
64866
|
-
|
|
64867
|
-
|
|
64868
|
-
|
|
64869
|
-
|
|
64870
|
-
|
|
64871
|
-
|
|
64872
|
-
|
|
64873
|
-
|
|
64874
|
-
|
|
64875
|
-
|
|
64876
|
-
|
|
64865
|
+
}, {
|
|
64866
|
+
[Chain.Avalanche]: 'Avalanche',
|
|
64867
|
+
[Chain.THORChain]: 'Thorchain',
|
|
64868
|
+
[Chain.Bitcoin]: 'Bitcoin',
|
|
64869
|
+
[Chain.BitcoinCash]: 'Bitcoin Cash',
|
|
64870
|
+
[Chain.Litecoin]: 'Litecoin',
|
|
64871
|
+
[Chain.Ethereum]: 'Ethereum',
|
|
64872
|
+
[Chain.Binance]: 'Binance Chain',
|
|
64873
|
+
[Chain.Cosmos]: 'Cosmos',
|
|
64874
|
+
[Chain.Terra]: 'Terra',
|
|
64875
|
+
[Chain.Doge]: 'Dogecoin',
|
|
64876
|
+
});
|
|
64877
64877
|
|
|
64878
64878
|
var Denomination;
|
|
64879
64879
|
(function (Denomination) {
|
|
@@ -64893,12 +64893,10 @@ var Denomination;
|
|
|
64893
64893
|
* @param {unknown} v
|
|
64894
64894
|
* @returns {boolean} `true` or `false`.
|
|
64895
64895
|
* */
|
|
64896
|
-
|
|
64897
|
-
return typeof v === 'string' || typeof v === 'number' || v instanceof bignumber$1;
|
|
64898
|
-
};
|
|
64896
|
+
const isBigNumberValue = (v) => typeof v === 'string' || typeof v === 'number' || v instanceof bignumber$1;
|
|
64899
64897
|
/**
|
|
64900
64898
|
* Default number of asset decimals
|
|
64901
|
-
* For history reason and by starting the project on Binance chain assets, it's 8 decimal.
|
|
64899
|
+
* For history reason and by starting the project on Binance chain assets, it's 8 decimal.F
|
|
64902
64900
|
*
|
|
64903
64901
|
* For example:
|
|
64904
64902
|
* ```
|
|
@@ -64906,7 +64904,7 @@ var isBigNumberValue = function (v) {
|
|
|
64906
64904
|
* 0.00000001 RUNE == 1 ð (tor)
|
|
64907
64905
|
* ```
|
|
64908
64906
|
* */
|
|
64909
|
-
|
|
64907
|
+
const ASSET_DECIMAL = 8;
|
|
64910
64908
|
/**
|
|
64911
64909
|
* Factory to create values of assets (e.g. RUNE)
|
|
64912
64910
|
*
|
|
@@ -64915,34 +64913,21 @@ var ASSET_DECIMAL = 8;
|
|
|
64915
64913
|
* @returns {AssetAmount} The asset amount from the given value and decimal.
|
|
64916
64914
|
*
|
|
64917
64915
|
**/
|
|
64918
|
-
|
|
64919
|
-
|
|
64920
|
-
var amount = fixedBN(value, decimal);
|
|
64916
|
+
const assetAmount = (value, decimal = ASSET_DECIMAL) => {
|
|
64917
|
+
const amount = fixedBN(value, decimal);
|
|
64921
64918
|
return {
|
|
64922
64919
|
type: Denomination.Asset,
|
|
64923
|
-
amount:
|
|
64924
|
-
plus:
|
|
64925
|
-
|
|
64926
|
-
|
|
64927
|
-
|
|
64928
|
-
|
|
64929
|
-
|
|
64930
|
-
|
|
64931
|
-
|
|
64932
|
-
|
|
64933
|
-
|
|
64934
|
-
return assetAmount(amount.times(isBigNumberValue(v) ? v : v.amount()), d);
|
|
64935
|
-
},
|
|
64936
|
-
div: function (v, d) {
|
|
64937
|
-
if (d === void 0) { d = decimal; }
|
|
64938
|
-
return assetAmount(amount.div(isBigNumberValue(v) ? v : v.amount()), d);
|
|
64939
|
-
},
|
|
64940
|
-
lt: function (v) { return amount.lt(isBigNumberValue(v) ? v : v.amount()); },
|
|
64941
|
-
lte: function (v) { return amount.lte(isBigNumberValue(v) ? v : v.amount()); },
|
|
64942
|
-
gt: function (v) { return amount.gt(isBigNumberValue(v) ? v : v.amount()); },
|
|
64943
|
-
gte: function (v) { return amount.gte(isBigNumberValue(v) ? v : v.amount()); },
|
|
64944
|
-
eq: function (v) { return amount.eq(isBigNumberValue(v) ? v : v.amount()); },
|
|
64945
|
-
decimal: decimal,
|
|
64920
|
+
amount: () => amount,
|
|
64921
|
+
plus: (v, d = decimal) => assetAmount(amount.plus(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64922
|
+
minus: (v, d = decimal) => assetAmount(amount.minus(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64923
|
+
times: (v, d = decimal) => assetAmount(amount.times(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64924
|
+
div: (v, d = decimal) => assetAmount(amount.div(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64925
|
+
lt: (v) => amount.lt(isBigNumberValue(v) ? v : v.amount()),
|
|
64926
|
+
lte: (v) => amount.lte(isBigNumberValue(v) ? v : v.amount()),
|
|
64927
|
+
gt: (v) => amount.gt(isBigNumberValue(v) ? v : v.amount()),
|
|
64928
|
+
gte: (v) => amount.gte(isBigNumberValue(v) ? v : v.amount()),
|
|
64929
|
+
eq: (v) => amount.eq(isBigNumberValue(v) ? v : v.amount()),
|
|
64930
|
+
decimal,
|
|
64946
64931
|
};
|
|
64947
64932
|
};
|
|
64948
64933
|
/**
|
|
@@ -64952,34 +64937,21 @@ var assetAmount = function (value, decimal) {
|
|
|
64952
64937
|
* @param {number} decimal The decimal places of its associated AssetAmount. (optional)
|
|
64953
64938
|
* @returns {BaseAmount} The base amount from the given value and decimal.
|
|
64954
64939
|
**/
|
|
64955
|
-
|
|
64956
|
-
|
|
64957
|
-
var amount = fixedBN(value, 0);
|
|
64940
|
+
const baseAmount = (value, decimal = ASSET_DECIMAL) => {
|
|
64941
|
+
const amount = fixedBN(value, 0);
|
|
64958
64942
|
return {
|
|
64959
64943
|
type: Denomination.Base,
|
|
64960
|
-
amount:
|
|
64961
|
-
plus:
|
|
64962
|
-
|
|
64963
|
-
|
|
64964
|
-
|
|
64965
|
-
|
|
64966
|
-
|
|
64967
|
-
|
|
64968
|
-
|
|
64969
|
-
|
|
64970
|
-
|
|
64971
|
-
return baseAmount(amount.times(isBigNumberValue(v) ? v : v.amount()), d);
|
|
64972
|
-
},
|
|
64973
|
-
div: function (v, d) {
|
|
64974
|
-
if (d === void 0) { d = decimal; }
|
|
64975
|
-
return baseAmount(amount.div(isBigNumberValue(v) ? v : v.amount()).decimalPlaces(0, bignumber$1.ROUND_DOWN), d);
|
|
64976
|
-
},
|
|
64977
|
-
lt: function (v) { return amount.lt(isBigNumberValue(v) ? v : v.amount()); },
|
|
64978
|
-
lte: function (v) { return amount.lte(isBigNumberValue(v) ? v : v.amount()); },
|
|
64979
|
-
gt: function (v) { return amount.gt(isBigNumberValue(v) ? v : v.amount()); },
|
|
64980
|
-
gte: function (v) { return amount.gte(isBigNumberValue(v) ? v : v.amount()); },
|
|
64981
|
-
eq: function (v) { return amount.eq(isBigNumberValue(v) ? v : v.amount()); },
|
|
64982
|
-
decimal: decimal,
|
|
64944
|
+
amount: () => amount,
|
|
64945
|
+
plus: (v, d = decimal) => baseAmount(amount.plus(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64946
|
+
minus: (v, d = decimal) => baseAmount(amount.minus(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64947
|
+
times: (v, d = decimal) => baseAmount(amount.times(isBigNumberValue(v) ? v : v.amount()), d),
|
|
64948
|
+
div: (v, d = decimal) => baseAmount(amount.div(isBigNumberValue(v) ? v : v.amount()).decimalPlaces(0, bignumber$1.ROUND_DOWN), d),
|
|
64949
|
+
lt: (v) => amount.lt(isBigNumberValue(v) ? v : v.amount()),
|
|
64950
|
+
lte: (v) => amount.lte(isBigNumberValue(v) ? v : v.amount()),
|
|
64951
|
+
gt: (v) => amount.gt(isBigNumberValue(v) ? v : v.amount()),
|
|
64952
|
+
gte: (v) => amount.gte(isBigNumberValue(v) ? v : v.amount()),
|
|
64953
|
+
eq: (v) => amount.eq(isBigNumberValue(v) ? v : v.amount()),
|
|
64954
|
+
decimal,
|
|
64983
64955
|
};
|
|
64984
64956
|
};
|
|
64985
64957
|
/**
|
|
@@ -64988,91 +64960,90 @@ var baseAmount = function (value, decimal) {
|
|
|
64988
64960
|
* @param {AssetAmount} asset
|
|
64989
64961
|
* @returns {BaseAmount} The base amount from the given AssetAmount.
|
|
64990
64962
|
* */
|
|
64991
|
-
|
|
64992
|
-
|
|
64963
|
+
const assetToBase = (asset) => {
|
|
64964
|
+
const value = asset
|
|
64993
64965
|
.amount()
|
|
64994
64966
|
.multipliedBy(Math.pow(10, asset.decimal))
|
|
64995
64967
|
.integerValue();
|
|
64996
64968
|
return baseAmount(value, asset.decimal);
|
|
64997
64969
|
};
|
|
64970
|
+
/**
|
|
64971
|
+
* Base "chain" asset of Avalanche chain.
|
|
64972
|
+
*
|
|
64973
|
+
*/
|
|
64974
|
+
const AssetAVAX = { chain: Chain.Avalanche, symbol: 'AVAX', ticker: 'AVAX', synth: false };
|
|
64998
64975
|
/**
|
|
64999
64976
|
* Base "chain" asset of Binance chain.
|
|
65000
64977
|
*
|
|
65001
64978
|
* Based on definition in Thorchain `common`
|
|
65002
64979
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65003
64980
|
*/
|
|
65004
|
-
|
|
64981
|
+
const AssetBNB = { chain: Chain.Binance, symbol: 'BNB', ticker: 'BNB', synth: false };
|
|
65005
64982
|
/**
|
|
65006
64983
|
* Base "chain" asset on bitcoin main net.
|
|
65007
64984
|
*
|
|
65008
64985
|
* Based on definition in Thorchain `common`
|
|
65009
64986
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65010
64987
|
*/
|
|
65011
|
-
|
|
64988
|
+
const AssetBTC = { chain: Chain.Bitcoin, symbol: 'BTC', ticker: 'BTC', synth: false };
|
|
65012
64989
|
/**
|
|
65013
64990
|
* Base "chain" asset on bitcoin cash main net.
|
|
65014
64991
|
*
|
|
65015
64992
|
* Based on definition in Thorchain `common`
|
|
65016
64993
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65017
64994
|
*/
|
|
65018
|
-
|
|
64995
|
+
const AssetBCH = { chain: Chain.BitcoinCash, symbol: 'BCH', ticker: 'BCH', synth: false };
|
|
65019
64996
|
/**
|
|
65020
64997
|
* Base "chain" asset on litecoin main net.
|
|
65021
64998
|
*
|
|
65022
64999
|
* Based on definition in Thorchain `common`
|
|
65023
65000
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65024
65001
|
*/
|
|
65025
|
-
|
|
65002
|
+
const AssetLTC = { chain: Chain.Litecoin, symbol: 'LTC', ticker: 'LTC', synth: false };
|
|
65026
65003
|
/**
|
|
65027
65004
|
* Dogecoin asset
|
|
65028
65005
|
* Based on definition in Thorchain
|
|
65029
65006
|
* @see https://gitlab.com/thorchain/thornode/-/blob/781-add-doge-chain/common/asset.go#L24
|
|
65030
65007
|
*/
|
|
65031
|
-
|
|
65032
|
-
|
|
65033
|
-
* Luna asset
|
|
65034
|
-
* Based on definition in Thorchain
|
|
65035
|
-
* @see TBD
|
|
65036
|
-
*/
|
|
65037
|
-
var AssetLUNA = { chain: Chain.Terra, symbol: 'LUNA', ticker: 'LUNA', synth: false };
|
|
65038
|
-
var RUNE_TICKER = 'RUNE';
|
|
65008
|
+
const AssetDOGE = { chain: Chain.Doge, symbol: 'DOGE', ticker: 'DOGE', synth: false };
|
|
65009
|
+
const RUNE_TICKER = 'RUNE';
|
|
65039
65010
|
/**
|
|
65040
65011
|
* Base "chain" asset on ethereum main net.
|
|
65041
65012
|
*
|
|
65042
65013
|
* Based on definition in Thorchain `common`
|
|
65043
65014
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65044
65015
|
*/
|
|
65045
|
-
|
|
65016
|
+
const AssetETH = { chain: Chain.Ethereum, symbol: 'ETH', ticker: 'ETH', synth: false };
|
|
65046
65017
|
/**
|
|
65047
65018
|
* Base "chain" asset for RUNE-67C on Binance test net.
|
|
65048
65019
|
*
|
|
65049
65020
|
* Based on definition in Thorchain `common`
|
|
65050
65021
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65051
65022
|
*/
|
|
65052
|
-
|
|
65023
|
+
const AssetRune67C = { chain: Chain.Binance, symbol: 'RUNE-67C', ticker: RUNE_TICKER, synth: false };
|
|
65053
65024
|
/**
|
|
65054
65025
|
* Base "chain" asset for RUNE-B1A on Binance main net.
|
|
65055
65026
|
*
|
|
65056
65027
|
* Based on definition in Thorchain `common`
|
|
65057
65028
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65058
65029
|
*/
|
|
65059
|
-
|
|
65030
|
+
const AssetRuneB1A = { chain: Chain.Binance, symbol: 'RUNE-B1A', ticker: RUNE_TICKER, synth: false };
|
|
65060
65031
|
/**
|
|
65061
65032
|
* Base "chain" asset on thorchain main net.
|
|
65062
65033
|
*
|
|
65063
65034
|
* Based on definition in Thorchain `common`
|
|
65064
65035
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65065
65036
|
*/
|
|
65066
|
-
|
|
65037
|
+
const AssetRuneNative = { chain: Chain.THORChain, symbol: RUNE_TICKER, ticker: RUNE_TICKER, synth: false };
|
|
65067
65038
|
/**
|
|
65068
65039
|
* Base "chain" asset for RUNE on ethereum main net.
|
|
65069
65040
|
*
|
|
65070
65041
|
* Based on definition in Thorchain `common`
|
|
65071
65042
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65072
65043
|
*/
|
|
65073
|
-
|
|
65044
|
+
const AssetRuneERC20 = {
|
|
65074
65045
|
chain: Chain.Ethereum,
|
|
65075
|
-
symbol: RUNE_TICKER
|
|
65046
|
+
symbol: `${RUNE_TICKER}-0x3155ba85d5f96b2d030a4966af206230e46849cb`,
|
|
65076
65047
|
ticker: RUNE_TICKER,
|
|
65077
65048
|
synth: false,
|
|
65078
65049
|
};
|
|
@@ -65082,12 +65053,14 @@ var AssetRuneERC20 = {
|
|
|
65082
65053
|
* Based on definition in Thorchain `common`
|
|
65083
65054
|
* @see https://gitlab.com/thorchain/thornode/-/blob/master/common/asset.go#L12-24
|
|
65084
65055
|
*/
|
|
65085
|
-
|
|
65056
|
+
const AssetRuneERC20Testnet = {
|
|
65086
65057
|
chain: Chain.Ethereum,
|
|
65087
|
-
symbol: RUNE_TICKER
|
|
65058
|
+
symbol: `${RUNE_TICKER}-0xd601c6A3a36721320573885A8d8420746dA3d7A0`,
|
|
65088
65059
|
ticker: RUNE_TICKER,
|
|
65089
65060
|
synth: false,
|
|
65090
65061
|
};
|
|
65062
|
+
const AssetAtom = { chain: Chain.Cosmos, symbol: 'ATOM', ticker: 'ATOM', synth: false };
|
|
65063
|
+
const AssetLUNA = { chain: Chain.Terra, symbol: 'LUNA', ticker: 'LUNA', synth: false };
|
|
65091
65064
|
/**
|
|
65092
65065
|
* Currency symbols currently supported
|
|
65093
65066
|
*/
|
|
@@ -85101,7 +85074,9 @@ const getSendTxUrl = ({ blockcypherUrl, network }) => {
|
|
|
85101
85074
|
* @see https://github.com/dogecoin/dogecoin/blob/master/src/validation.h#L58
|
|
85102
85075
|
*/
|
|
85103
85076
|
const MIN_TX_FEE = 100000;
|
|
85104
|
-
const DOGE_DECIMAL = 8;
|
|
85077
|
+
const DOGE_DECIMAL = 8;
|
|
85078
|
+
const LOWER_FEE_BOUND = 40000;
|
|
85079
|
+
const UPPER_FEE_BOUND = 20000000;
|
|
85105
85080
|
|
|
85106
85081
|
const toSochainNetwork = (network) => {
|
|
85107
85082
|
switch (network) {
|
|
@@ -86831,12 +86806,15 @@ class Client extends UTXOClient {
|
|
|
86831
86806
|
*
|
|
86832
86807
|
* @param {DogecoinClientParams} params
|
|
86833
86808
|
*/
|
|
86834
|
-
constructor({ network = Network.Testnet,
|
|
86809
|
+
constructor({ network = Network.Testnet, feeBounds = {
|
|
86810
|
+
lower: LOWER_FEE_BOUND,
|
|
86811
|
+
upper: UPPER_FEE_BOUND,
|
|
86812
|
+
}, sochainUrl = 'https://sochain.com/api/v2', blockcypherUrl = 'https://api.blockcypher.com/v1', phrase, rootDerivationPaths = {
|
|
86835
86813
|
[Network.Mainnet]: `m/44'/3'/0'/0/`,
|
|
86836
86814
|
[Network.Stagenet]: `m/44'/3'/0'/0/`,
|
|
86837
86815
|
[Network.Testnet]: `m/44'/1'/0'/0/`,
|
|
86838
86816
|
}, }) {
|
|
86839
|
-
super(Chain.Doge, { network, rootDerivationPaths, phrase });
|
|
86817
|
+
super(Chain.Doge, { network, rootDerivationPaths, phrase, feeBounds });
|
|
86840
86818
|
this.sochainUrl = '';
|
|
86841
86819
|
this.blockcypherUrl = '';
|
|
86842
86820
|
this.setSochainUrl(sochainUrl);
|
|
@@ -87069,6 +87047,7 @@ class Client extends UTXOClient {
|
|
|
87069
87047
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87070
87048
|
const fromAddressIndex = (params === null || params === void 0 ? void 0 : params.walletIndex) || 0;
|
|
87071
87049
|
const feeRate = params.feeRate || (yield this.getSuggestedFeeRate());
|
|
87050
|
+
checkFeeBounds(this.feeBounds, feeRate);
|
|
87072
87051
|
const { psbt } = yield buildTx({
|
|
87073
87052
|
amount: params.amount,
|
|
87074
87053
|
recipient: params.recipient,
|
|
@@ -87116,5 +87095,5 @@ const createTxInfo = (params) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
87116
87095
|
};
|
|
87117
87096
|
});
|
|
87118
87097
|
|
|
87119
|
-
export { Client, DOGE_DECIMAL, MIN_TX_FEE, broadcastTx, buildTx, calcFee, createTxInfo, getDefaultFees, getDefaultFeesWithRates, getPrefix, getSendTxUrl, scanUTXOs, validateAddress };
|
|
87098
|
+
export { Client, DOGE_DECIMAL, LOWER_FEE_BOUND, MIN_TX_FEE, UPPER_FEE_BOUND, broadcastTx, buildTx, calcFee, createTxInfo, getDefaultFees, getDefaultFeesWithRates, getPrefix, getSendTxUrl, scanUTXOs, validateAddress };
|
|
87120
87099
|
//# sourceMappingURL=index.esm.js.map
|