@xchainjs/xchain-dash 2.0.3 → 2.0.4
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/lib/index.esm.js +7 -6
- package/lib/index.js +6 -6
- package/lib/types/index.d.ts +1 -1
- package/package.json +7 -7
package/lib/index.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ExplorerProvider, Network, TxType, FeeOption, checkFeeBounds } from '@x
|
|
|
2
2
|
import { AssetType, baseAmount, assetToBase, assetAmount } from '@xchainjs/xchain-util';
|
|
3
3
|
import { BlockcypherProvider, BlockcypherNetwork, BitgoProvider } from '@xchainjs/xchain-utxo-providers';
|
|
4
4
|
import * as dashcore from '@dashevo/dashcore-lib';
|
|
5
|
+
import dashcore__default from '@dashevo/dashcore-lib';
|
|
5
6
|
import { toBitcoinJS, Client as Client$1 } from '@xchainjs/xchain-utxo';
|
|
6
7
|
import * as Dash from 'bitcoinjs-lib';
|
|
7
8
|
import accumulative from 'coinselect/accumulative';
|
|
@@ -3900,7 +3901,7 @@ const TX_MIN_FEE = 1000;
|
|
|
3900
3901
|
/**
|
|
3901
3902
|
* Threshold value for dust amount in Dash transactions.
|
|
3902
3903
|
*/
|
|
3903
|
-
|
|
3904
|
+
dashcore__default.Transaction.DUST_AMOUNT;
|
|
3904
3905
|
/**
|
|
3905
3906
|
* Function to determine the Dash network based on the provided network type.
|
|
3906
3907
|
* @param {Network} network The network type (Mainnet, Testnet, or Stagenet).
|
|
@@ -3964,7 +3965,7 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
3964
3965
|
if (!inputs || !outputs)
|
|
3965
3966
|
throw new Error('Insufficient balance for transaction');
|
|
3966
3967
|
// Initialize new Dash transaction
|
|
3967
|
-
const tx = new
|
|
3968
|
+
const tx = new dashcore__default.Transaction().to(recipient, amount.amount().toNumber());
|
|
3968
3969
|
// Add inputs to the transaction
|
|
3969
3970
|
inputs.forEach((utxo) => {
|
|
3970
3971
|
const insightUtxo = insightUtxos.find((x) => x.txid === utxo.hash && x.vout == utxo.index);
|
|
@@ -3972,12 +3973,12 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
3972
3973
|
throw new Error('Unable to match accumulative inputs with insight UTXOs');
|
|
3973
3974
|
}
|
|
3974
3975
|
const scriptBuffer = Buffer.from(insightUtxo.scriptPubKey, 'hex');
|
|
3975
|
-
const script = new
|
|
3976
|
-
const input = new
|
|
3976
|
+
const script = new dashcore__default.Script(scriptBuffer);
|
|
3977
|
+
const input = new dashcore__default.Transaction.Input.PublicKeyHash({
|
|
3977
3978
|
prevTxId: Buffer.from(insightUtxo.txid, 'hex'),
|
|
3978
3979
|
outputIndex: insightUtxo.vout,
|
|
3979
3980
|
script: '',
|
|
3980
|
-
output: new
|
|
3981
|
+
output: new dashcore__default.Transaction.Output({
|
|
3981
3982
|
satoshis: utxo.value,
|
|
3982
3983
|
script,
|
|
3983
3984
|
}),
|
|
@@ -3985,7 +3986,7 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
3985
3986
|
tx.uncheckedAddInput(input);
|
|
3986
3987
|
});
|
|
3987
3988
|
// Define sender address
|
|
3988
|
-
const senderAddress =
|
|
3989
|
+
const senderAddress = dashcore__default.Address.fromString(sender, network);
|
|
3989
3990
|
tx.change(senderAddress);
|
|
3990
3991
|
// Add memo to the transaction if provided
|
|
3991
3992
|
if (memo) {
|
package/lib/index.js
CHANGED
|
@@ -3928,7 +3928,7 @@ const TX_MIN_FEE = 1000;
|
|
|
3928
3928
|
/**
|
|
3929
3929
|
* Threshold value for dust amount in Dash transactions.
|
|
3930
3930
|
*/
|
|
3931
|
-
dashcore__namespace.Transaction.DUST_AMOUNT;
|
|
3931
|
+
dashcore__namespace.default.Transaction.DUST_AMOUNT;
|
|
3932
3932
|
/**
|
|
3933
3933
|
* Function to determine the Dash network based on the provided network type.
|
|
3934
3934
|
* @param {Network} network The network type (Mainnet, Testnet, or Stagenet).
|
|
@@ -3992,7 +3992,7 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
3992
3992
|
if (!inputs || !outputs)
|
|
3993
3993
|
throw new Error('Insufficient balance for transaction');
|
|
3994
3994
|
// Initialize new Dash transaction
|
|
3995
|
-
const tx = new dashcore__namespace.Transaction().to(recipient, amount.amount().toNumber());
|
|
3995
|
+
const tx = new dashcore__namespace.default.Transaction().to(recipient, amount.amount().toNumber());
|
|
3996
3996
|
// Add inputs to the transaction
|
|
3997
3997
|
inputs.forEach((utxo) => {
|
|
3998
3998
|
const insightUtxo = insightUtxos.find((x) => x.txid === utxo.hash && x.vout == utxo.index);
|
|
@@ -4000,12 +4000,12 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
4000
4000
|
throw new Error('Unable to match accumulative inputs with insight UTXOs');
|
|
4001
4001
|
}
|
|
4002
4002
|
const scriptBuffer = Buffer.from(insightUtxo.scriptPubKey, 'hex');
|
|
4003
|
-
const script = new dashcore__namespace.Script(scriptBuffer);
|
|
4004
|
-
const input = new dashcore__namespace.Transaction.Input.PublicKeyHash({
|
|
4003
|
+
const script = new dashcore__namespace.default.Script(scriptBuffer);
|
|
4004
|
+
const input = new dashcore__namespace.default.Transaction.Input.PublicKeyHash({
|
|
4005
4005
|
prevTxId: Buffer.from(insightUtxo.txid, 'hex'),
|
|
4006
4006
|
outputIndex: insightUtxo.vout,
|
|
4007
4007
|
script: '',
|
|
4008
|
-
output: new dashcore__namespace.Transaction.Output({
|
|
4008
|
+
output: new dashcore__namespace.default.Transaction.Output({
|
|
4009
4009
|
satoshis: utxo.value,
|
|
4010
4010
|
script,
|
|
4011
4011
|
}),
|
|
@@ -4013,7 +4013,7 @@ const buildTx = ({ amount, recipient, memo, feeRate, sender, network, }) => __aw
|
|
|
4013
4013
|
tx.uncheckedAddInput(input);
|
|
4014
4014
|
});
|
|
4015
4015
|
// Define sender address
|
|
4016
|
-
const senderAddress = dashcore__namespace.Address.fromString(sender, network);
|
|
4016
|
+
const senderAddress = dashcore__namespace.default.Address.fromString(sender, network);
|
|
4017
4017
|
tx.change(senderAddress);
|
|
4018
4018
|
// Add memo to the transaction if provided
|
|
4019
4019
|
if (memo) {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DashPreparedTx, NodeAuth, NodeUrls } from './client-types';
|
|
1
|
+
export type { DashPreparedTx, NodeAuth, NodeUrls } from './client-types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-dash",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Custom Dash client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"XChain",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "yarn clean && rollup -c --bundleConfigAsCjs",
|
|
29
29
|
"build:release": "yarn exec rm -rf release && yarn pack && yarn exec \"mkdir release && tar zxvf package.tgz --directory release && rm package.tgz\"",
|
|
30
30
|
"test": "jest",
|
|
31
|
-
"e2e": "jest --config jest.config.e2e.
|
|
31
|
+
"e2e": "jest --config jest.config.e2e.mjs",
|
|
32
32
|
"lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
33
33
|
"postversion": "git push --follow-tags"
|
|
34
34
|
},
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@dashevo/dashcore-lib": "^0.25.0",
|
|
38
38
|
"@ledgerhq/hw-app-btc": "10.9.0",
|
|
39
39
|
"@scure/bip32": "^1.7.0",
|
|
40
|
-
"@xchainjs/xchain-client": "2.0.
|
|
41
|
-
"@xchainjs/xchain-crypto": "1.0.
|
|
42
|
-
"@xchainjs/xchain-util": "2.0.
|
|
43
|
-
"@xchainjs/xchain-utxo": "2.0.
|
|
44
|
-
"@xchainjs/xchain-utxo-providers": "2.0.
|
|
40
|
+
"@xchainjs/xchain-client": "2.0.4",
|
|
41
|
+
"@xchainjs/xchain-crypto": "1.0.2",
|
|
42
|
+
"@xchainjs/xchain-util": "2.0.3",
|
|
43
|
+
"@xchainjs/xchain-utxo": "2.0.4",
|
|
44
|
+
"@xchainjs/xchain-utxo-providers": "2.0.4",
|
|
45
45
|
"bitcoinjs-lib": "^6.1.7",
|
|
46
46
|
"coinselect": "3.1.12",
|
|
47
47
|
"ecpair": "2.1.0"
|