@xchainjs/xchain-dash 2.0.5 → 2.0.6
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/client.d.ts +1 -3
- package/lib/index.esm.js +24 -24
- package/lib/index.js +24 -24
- package/lib/utils.d.ts +2 -4
- package/package.json +6 -6
package/lib/client.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { AssetInfo, FeeRate, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
4
2
|
import { Address } from '@xchainjs/xchain-util';
|
|
5
3
|
import { Balance, Client as UTXOClient, Tx, TxParams, TxsPage, UTXO, UtxoClientParams } from '@xchainjs/xchain-utxo';
|
|
@@ -22,7 +20,7 @@ declare abstract class Client extends UTXOClient {
|
|
|
22
20
|
dataProviders: import("@xchainjs/xchain-utxo/lib/types/types").UtxoOnlineDataProviders[];
|
|
23
21
|
} & {
|
|
24
22
|
nodeUrls: NodeUrls;
|
|
25
|
-
nodeAuth?: NodeAuth
|
|
23
|
+
nodeAuth?: NodeAuth;
|
|
26
24
|
});
|
|
27
25
|
/**
|
|
28
26
|
* Get the asset info for DASH.
|
package/lib/index.esm.js
CHANGED
|
@@ -3879,19 +3879,19 @@ const getRawTx = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
3879
3879
|
* Object containing the sizes (in bytes) of various components in a Dash transaction.
|
|
3880
3880
|
*/
|
|
3881
3881
|
const TransactionBytes = {
|
|
3882
|
-
Version: 2,
|
|
3883
|
-
Type: 2,
|
|
3884
|
-
InputCount: 1,
|
|
3885
|
-
OutputCount: 1,
|
|
3886
|
-
LockTime: 4,
|
|
3887
|
-
InputPrevOutputHash: 32,
|
|
3888
|
-
InputPrevOutputIndex: 4,
|
|
3889
|
-
InputScriptLength: 1,
|
|
3890
|
-
InputSequence: 4,
|
|
3891
|
-
InputPubkeyHash: 107,
|
|
3892
|
-
OutputPubkeyHash: 25,
|
|
3893
|
-
OutputValue: 8,
|
|
3894
|
-
OutputOpReturn: 1,
|
|
3882
|
+
Version: 2, // Size of transaction version
|
|
3883
|
+
Type: 2, // Size of transaction type
|
|
3884
|
+
InputCount: 1, // Size of input count
|
|
3885
|
+
OutputCount: 1, // Size of output count
|
|
3886
|
+
LockTime: 4, // Size of lock time
|
|
3887
|
+
InputPrevOutputHash: 32, // Size of input previous output hash
|
|
3888
|
+
InputPrevOutputIndex: 4, // Size of input previous output index
|
|
3889
|
+
InputScriptLength: 1, // Size of input script length
|
|
3890
|
+
InputSequence: 4, // Size of input sequence
|
|
3891
|
+
InputPubkeyHash: 107, // Size of input pubkey hash
|
|
3892
|
+
OutputPubkeyHash: 25, // Size of output pubkey hash
|
|
3893
|
+
OutputValue: 8, // Size of output value
|
|
3894
|
+
OutputOpReturn: 1, // Size of output OP_RETURN
|
|
3895
3895
|
OutputScriptLength: 1, // Size of output script length
|
|
3896
3896
|
};
|
|
3897
3897
|
/**
|
|
@@ -3936,7 +3936,7 @@ const validateAddress = (address, network) => {
|
|
|
3936
3936
|
* @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
|
|
3937
3937
|
* @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
|
|
3938
3938
|
*/
|
|
3939
|
-
const buildTx = (
|
|
3939
|
+
const buildTx = (_a) => __awaiter(void 0, [_a], void 0, function* ({ amount, recipient, memo, feeRate, sender, network, }) {
|
|
3940
3940
|
// Validate recipient address
|
|
3941
3941
|
if (!validateAddress(recipient, network))
|
|
3942
3942
|
throw new Error('Invalid address');
|
|
@@ -4091,8 +4091,8 @@ class Client extends Client$1 {
|
|
|
4091
4091
|
* @returns {Promise<TxsPage>} A promise resolving to a page of transactions.
|
|
4092
4092
|
*/
|
|
4093
4093
|
getTransactions(params) {
|
|
4094
|
-
var _a;
|
|
4095
4094
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4095
|
+
var _a;
|
|
4096
4096
|
// Extract offset and limit from parameters or set default values
|
|
4097
4097
|
const offset = (_a = params === null || params === void 0 ? void 0 : params.offset) !== null && _a !== void 0 ? _a : 0;
|
|
4098
4098
|
const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
|
|
@@ -4186,8 +4186,8 @@ class Client extends Client$1 {
|
|
|
4186
4186
|
* @param {TxParams&Address&FeeRate} params - Parameters for the transaction preparation.
|
|
4187
4187
|
* @returns {string} A promise resolving to the prepared transaction data.
|
|
4188
4188
|
*/
|
|
4189
|
-
prepareTx(
|
|
4190
|
-
return __awaiter(this,
|
|
4189
|
+
prepareTx(_a) {
|
|
4190
|
+
return __awaiter(this, arguments, void 0, function* ({ sender, memo, amount, recipient, feeRate, }) {
|
|
4191
4191
|
// Build the transaction using provided parameters
|
|
4192
4192
|
const { tx, utxos, inputs } = yield buildTx({
|
|
4193
4193
|
sender,
|
|
@@ -4260,10 +4260,10 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
4260
4260
|
const response = (yield axios.post(`${params.nodeUrl}/tx/send`, // URL endpoint for broadcasting the transaction.
|
|
4261
4261
|
{
|
|
4262
4262
|
jsonrpc: '2.0',
|
|
4263
|
-
rawtx: [params.txHex],
|
|
4263
|
+
rawtx: [params.txHex], // Include the hexadecimal transaction in the request body.
|
|
4264
4264
|
id: uniqueId,
|
|
4265
4265
|
}, {
|
|
4266
|
-
auth: params.auth,
|
|
4266
|
+
auth: params.auth, // Include authentication credentials if provided.
|
|
4267
4267
|
timeout: 30 * 1000, // Set a timeout for the request.
|
|
4268
4268
|
})).data;
|
|
4269
4269
|
if (response.error) {
|
|
@@ -4313,8 +4313,8 @@ class ClientKeystore extends Client {
|
|
|
4313
4313
|
* @param {number} index The index of the address.
|
|
4314
4314
|
* @returns {Promise<string>} A promise resolving to the DASH address.
|
|
4315
4315
|
*/
|
|
4316
|
-
getAddressAsync(
|
|
4317
|
-
return __awaiter(this,
|
|
4316
|
+
getAddressAsync() {
|
|
4317
|
+
return __awaiter(this, arguments, void 0, function* (index = 0) {
|
|
4318
4318
|
return this.getAddress(index);
|
|
4319
4319
|
});
|
|
4320
4320
|
}
|
|
@@ -4340,8 +4340,8 @@ class ClientKeystore extends Client {
|
|
|
4340
4340
|
* @returns {Promise<TxHash>} A promise resolving to the transaction hash.
|
|
4341
4341
|
*/
|
|
4342
4342
|
transfer(params) {
|
|
4343
|
-
var _a;
|
|
4344
4343
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4344
|
+
var _a;
|
|
4345
4345
|
const feeRate = params.feeRate || (yield this.getFeeRates())[FeeOption.Average];
|
|
4346
4346
|
checkFeeBounds(this.feeBounds, feeRate);
|
|
4347
4347
|
const fromAddressIndex = params.walletIndex || 0;
|
|
@@ -4404,8 +4404,8 @@ class ClientLedger extends Client {
|
|
|
4404
4404
|
throw Error('Sync method not supported for Ledger');
|
|
4405
4405
|
}
|
|
4406
4406
|
// Get the current address asynchronously
|
|
4407
|
-
getAddressAsync(
|
|
4408
|
-
return __awaiter(this,
|
|
4407
|
+
getAddressAsync() {
|
|
4408
|
+
return __awaiter(this, arguments, void 0, function* (index = 0, verify = false) {
|
|
4409
4409
|
const app = yield this.getApp();
|
|
4410
4410
|
const result = yield app.getWalletPublicKey(this.getFullDerivationPath(index), {
|
|
4411
4411
|
format: 'legacy',
|
package/lib/index.js
CHANGED
|
@@ -3906,19 +3906,19 @@ const getRawTx = (p) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
3906
3906
|
* Object containing the sizes (in bytes) of various components in a Dash transaction.
|
|
3907
3907
|
*/
|
|
3908
3908
|
const TransactionBytes = {
|
|
3909
|
-
Version: 2,
|
|
3910
|
-
Type: 2,
|
|
3911
|
-
InputCount: 1,
|
|
3912
|
-
OutputCount: 1,
|
|
3913
|
-
LockTime: 4,
|
|
3914
|
-
InputPrevOutputHash: 32,
|
|
3915
|
-
InputPrevOutputIndex: 4,
|
|
3916
|
-
InputScriptLength: 1,
|
|
3917
|
-
InputSequence: 4,
|
|
3918
|
-
InputPubkeyHash: 107,
|
|
3919
|
-
OutputPubkeyHash: 25,
|
|
3920
|
-
OutputValue: 8,
|
|
3921
|
-
OutputOpReturn: 1,
|
|
3909
|
+
Version: 2, // Size of transaction version
|
|
3910
|
+
Type: 2, // Size of transaction type
|
|
3911
|
+
InputCount: 1, // Size of input count
|
|
3912
|
+
OutputCount: 1, // Size of output count
|
|
3913
|
+
LockTime: 4, // Size of lock time
|
|
3914
|
+
InputPrevOutputHash: 32, // Size of input previous output hash
|
|
3915
|
+
InputPrevOutputIndex: 4, // Size of input previous output index
|
|
3916
|
+
InputScriptLength: 1, // Size of input script length
|
|
3917
|
+
InputSequence: 4, // Size of input sequence
|
|
3918
|
+
InputPubkeyHash: 107, // Size of input pubkey hash
|
|
3919
|
+
OutputPubkeyHash: 25, // Size of output pubkey hash
|
|
3920
|
+
OutputValue: 8, // Size of output value
|
|
3921
|
+
OutputOpReturn: 1, // Size of output OP_RETURN
|
|
3922
3922
|
OutputScriptLength: 1, // Size of output script length
|
|
3923
3923
|
};
|
|
3924
3924
|
/**
|
|
@@ -3963,7 +3963,7 @@ const validateAddress = (address, network) => {
|
|
|
3963
3963
|
* @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
|
|
3964
3964
|
* @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
|
|
3965
3965
|
*/
|
|
3966
|
-
const buildTx = (
|
|
3966
|
+
const buildTx = (_a) => __awaiter(void 0, [_a], void 0, function* ({ amount, recipient, memo, feeRate, sender, network, }) {
|
|
3967
3967
|
// Validate recipient address
|
|
3968
3968
|
if (!validateAddress(recipient, network))
|
|
3969
3969
|
throw new Error('Invalid address');
|
|
@@ -4118,8 +4118,8 @@ class Client extends xchainUtxo.Client {
|
|
|
4118
4118
|
* @returns {Promise<TxsPage>} A promise resolving to a page of transactions.
|
|
4119
4119
|
*/
|
|
4120
4120
|
getTransactions(params) {
|
|
4121
|
-
var _a;
|
|
4122
4121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4122
|
+
var _a;
|
|
4123
4123
|
// Extract offset and limit from parameters or set default values
|
|
4124
4124
|
const offset = (_a = params === null || params === void 0 ? void 0 : params.offset) !== null && _a !== void 0 ? _a : 0;
|
|
4125
4125
|
const limit = (params === null || params === void 0 ? void 0 : params.limit) || 10;
|
|
@@ -4213,8 +4213,8 @@ class Client extends xchainUtxo.Client {
|
|
|
4213
4213
|
* @param {TxParams&Address&FeeRate} params - Parameters for the transaction preparation.
|
|
4214
4214
|
* @returns {string} A promise resolving to the prepared transaction data.
|
|
4215
4215
|
*/
|
|
4216
|
-
prepareTx(
|
|
4217
|
-
return __awaiter(this,
|
|
4216
|
+
prepareTx(_a) {
|
|
4217
|
+
return __awaiter(this, arguments, void 0, function* ({ sender, memo, amount, recipient, feeRate, }) {
|
|
4218
4218
|
// Build the transaction using provided parameters
|
|
4219
4219
|
const { tx, utxos, inputs } = yield buildTx({
|
|
4220
4220
|
sender,
|
|
@@ -4287,10 +4287,10 @@ const broadcastTx = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
4287
4287
|
const response = (yield axios.post(`${params.nodeUrl}/tx/send`, // URL endpoint for broadcasting the transaction.
|
|
4288
4288
|
{
|
|
4289
4289
|
jsonrpc: '2.0',
|
|
4290
|
-
rawtx: [params.txHex],
|
|
4290
|
+
rawtx: [params.txHex], // Include the hexadecimal transaction in the request body.
|
|
4291
4291
|
id: uniqueId,
|
|
4292
4292
|
}, {
|
|
4293
|
-
auth: params.auth,
|
|
4293
|
+
auth: params.auth, // Include authentication credentials if provided.
|
|
4294
4294
|
timeout: 30 * 1000, // Set a timeout for the request.
|
|
4295
4295
|
})).data;
|
|
4296
4296
|
if (response.error) {
|
|
@@ -4340,8 +4340,8 @@ class ClientKeystore extends Client {
|
|
|
4340
4340
|
* @param {number} index The index of the address.
|
|
4341
4341
|
* @returns {Promise<string>} A promise resolving to the DASH address.
|
|
4342
4342
|
*/
|
|
4343
|
-
getAddressAsync(
|
|
4344
|
-
return __awaiter(this,
|
|
4343
|
+
getAddressAsync() {
|
|
4344
|
+
return __awaiter(this, arguments, void 0, function* (index = 0) {
|
|
4345
4345
|
return this.getAddress(index);
|
|
4346
4346
|
});
|
|
4347
4347
|
}
|
|
@@ -4367,8 +4367,8 @@ class ClientKeystore extends Client {
|
|
|
4367
4367
|
* @returns {Promise<TxHash>} A promise resolving to the transaction hash.
|
|
4368
4368
|
*/
|
|
4369
4369
|
transfer(params) {
|
|
4370
|
-
var _a;
|
|
4371
4370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4371
|
+
var _a;
|
|
4372
4372
|
const feeRate = params.feeRate || (yield this.getFeeRates())[xchainClient.FeeOption.Average];
|
|
4373
4373
|
xchainClient.checkFeeBounds(this.feeBounds, feeRate);
|
|
4374
4374
|
const fromAddressIndex = params.walletIndex || 0;
|
|
@@ -4431,8 +4431,8 @@ class ClientLedger extends Client {
|
|
|
4431
4431
|
throw Error('Sync method not supported for Ledger');
|
|
4432
4432
|
}
|
|
4433
4433
|
// Get the current address asynchronously
|
|
4434
|
-
getAddressAsync(
|
|
4435
|
-
return __awaiter(this,
|
|
4434
|
+
getAddressAsync() {
|
|
4435
|
+
return __awaiter(this, arguments, void 0, function* (index = 0, verify = false) {
|
|
4436
4436
|
const app = yield this.getApp();
|
|
4437
4437
|
const result = yield app.getWalletPublicKey(this.getFullDerivationPath(index), {
|
|
4438
4438
|
format: 'legacy',
|
package/lib/utils.d.ts
CHANGED
|
@@ -48,13 +48,11 @@ export declare const validateAddress: (address: Address, network: Network) => bo
|
|
|
48
48
|
* @param {TxParams} params Transaction parameters including amount, recipient, memo, fee rate, sender, and network.
|
|
49
49
|
* @returns {Promise<{ tx: Transaction; utxos: UTXO[] }>} Promise that resolves with the built transaction and its UTXOs.
|
|
50
50
|
*/
|
|
51
|
-
export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }:
|
|
52
|
-
asset?: import("@xchainjs/xchain-util").Asset | undefined;
|
|
53
|
-
} & {
|
|
51
|
+
export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }: TxParams & {
|
|
54
52
|
feeRate: FeeRate;
|
|
55
53
|
sender: Address;
|
|
56
54
|
network: Network;
|
|
57
|
-
withTxHex?: boolean
|
|
55
|
+
withTxHex?: boolean;
|
|
58
56
|
}) => Promise<{
|
|
59
57
|
tx: Transaction;
|
|
60
58
|
utxos: UTXO[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-dash",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Custom Dash client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"XChain",
|
|
@@ -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.6",
|
|
41
|
+
"@xchainjs/xchain-crypto": "1.0.4",
|
|
42
|
+
"@xchainjs/xchain-util": "2.0.4",
|
|
43
|
+
"@xchainjs/xchain-utxo": "2.0.6",
|
|
44
|
+
"@xchainjs/xchain-utxo-providers": "2.0.6",
|
|
45
45
|
"bitcoinjs-lib": "^6.1.7",
|
|
46
46
|
"coinselect": "3.1.12",
|
|
47
47
|
"ecpair": "2.1.0"
|