@xchainjs/xchain-doge 0.5.13 → 0.6.1
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/blockcypher-api.d.ts +13 -13
- package/lib/client.d.ts +86 -81
- package/lib/const.d.ts +39 -39
- package/lib/index.d.ts +5 -5
- package/lib/index.esm.js +359 -83982
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +402 -84009
- package/lib/index.js.map +1 -1
- package/lib/types/client-types.d.ts +16 -16
- package/lib/types/common.d.ts +6 -6
- package/lib/types/index.d.ts +3 -3
- package/lib/types/ledger.d.ts +14 -14
- package/lib/types/sochain-api-types.d.ts +81 -81
- package/lib/utils.d.ts +70 -70
- package/package.json +13 -14
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { FeeRate, Network } from '@xchainjs/xchain-client';
|
|
2
|
-
import { Address } from '@xchainjs/xchain-util';
|
|
3
|
-
export
|
|
4
|
-
addressTo: Address;
|
|
5
|
-
amount: number;
|
|
6
|
-
feeRate: FeeRate;
|
|
7
|
-
};
|
|
8
|
-
export
|
|
9
|
-
memo: string;
|
|
10
|
-
};
|
|
11
|
-
export
|
|
12
|
-
valueOut: number;
|
|
13
|
-
sochainUrl: string;
|
|
14
|
-
network: Network;
|
|
15
|
-
address: Address;
|
|
16
|
-
};
|
|
1
|
+
import { FeeRate, Network } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Address } from '@xchainjs/xchain-util';
|
|
3
|
+
export type NormalTxParams = {
|
|
4
|
+
addressTo: Address;
|
|
5
|
+
amount: number;
|
|
6
|
+
feeRate: FeeRate;
|
|
7
|
+
};
|
|
8
|
+
export type VaultTxParams = NormalTxParams & {
|
|
9
|
+
memo: string;
|
|
10
|
+
};
|
|
11
|
+
export type GetChangeParams = {
|
|
12
|
+
valueOut: number;
|
|
13
|
+
sochainUrl: string;
|
|
14
|
+
network: Network;
|
|
15
|
+
address: Address;
|
|
16
|
+
};
|
package/lib/types/common.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Network } from '@xchainjs/xchain-client';
|
|
2
|
-
export
|
|
3
|
-
network: Network;
|
|
4
|
-
txHex: string;
|
|
5
|
-
nodeUrl: string;
|
|
6
|
-
};
|
|
1
|
+
import { Network } from '@xchainjs/xchain-client';
|
|
2
|
+
export type BroadcastTxParams = {
|
|
3
|
+
network: Network;
|
|
4
|
+
txHex: string;
|
|
5
|
+
nodeUrl: string;
|
|
6
|
+
};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './client-types';
|
|
2
|
-
export * from './common';
|
|
3
|
-
export * from './ledger';
|
|
1
|
+
export * from './client-types';
|
|
2
|
+
export * from './common';
|
|
3
|
+
export * from './ledger';
|
package/lib/types/ledger.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { FeeRate, Network, TxParams, UTXO } from '@xchainjs/xchain-client';
|
|
2
|
-
import { Address } from '@xchainjs/xchain-util';
|
|
3
|
-
export
|
|
4
|
-
utxos: UTXO[];
|
|
5
|
-
newTxHex: string;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
feeRate: FeeRate;
|
|
9
|
-
sender: Address;
|
|
10
|
-
network: Network;
|
|
11
|
-
apiKey: string;
|
|
12
|
-
sochainUrl: string;
|
|
13
|
-
nodeApiKey: string;
|
|
14
|
-
};
|
|
1
|
+
import { FeeRate, Network, TxParams, UTXO } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Address } from '@xchainjs/xchain-util';
|
|
3
|
+
export type LedgerTxInfo = {
|
|
4
|
+
utxos: UTXO[];
|
|
5
|
+
newTxHex: string;
|
|
6
|
+
};
|
|
7
|
+
export type LedgerTxInfoParams = Pick<TxParams, 'amount' | 'recipient'> & {
|
|
8
|
+
feeRate: FeeRate;
|
|
9
|
+
sender: Address;
|
|
10
|
+
network: Network;
|
|
11
|
+
apiKey: string;
|
|
12
|
+
sochainUrl: string;
|
|
13
|
+
nodeApiKey: string;
|
|
14
|
+
};
|
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import { Network, TxHash } from '@xchainjs/xchain-client';
|
|
2
|
-
export
|
|
3
|
-
apiKey: string;
|
|
4
|
-
sochainUrl: string;
|
|
5
|
-
network: Network;
|
|
6
|
-
address: string;
|
|
7
|
-
page: number;
|
|
8
|
-
};
|
|
9
|
-
export
|
|
10
|
-
apiKey: string;
|
|
11
|
-
sochainUrl: string;
|
|
12
|
-
network: Network;
|
|
13
|
-
address: string;
|
|
14
|
-
};
|
|
15
|
-
export
|
|
16
|
-
apiKey: string;
|
|
17
|
-
sochainUrl: string;
|
|
18
|
-
network: Network;
|
|
19
|
-
hash: TxHash;
|
|
20
|
-
};
|
|
21
|
-
export
|
|
22
|
-
apiKey: string;
|
|
23
|
-
sochainUrl: string;
|
|
24
|
-
network: Network;
|
|
25
|
-
txHex: string;
|
|
26
|
-
};
|
|
27
|
-
export interface SochainResponse<T> {
|
|
28
|
-
data: T;
|
|
29
|
-
status: string;
|
|
30
|
-
}
|
|
31
|
-
export interface TxIO {
|
|
32
|
-
index: number;
|
|
33
|
-
value: string;
|
|
34
|
-
address: string;
|
|
35
|
-
type?: string;
|
|
36
|
-
script: string;
|
|
37
|
-
}
|
|
38
|
-
export interface Transaction {
|
|
39
|
-
network: string;
|
|
40
|
-
hash: string;
|
|
41
|
-
block_hash: string;
|
|
42
|
-
confirmations: number;
|
|
43
|
-
time: number;
|
|
44
|
-
inputs: TxIO[];
|
|
45
|
-
outputs: TxIO[];
|
|
46
|
-
}
|
|
47
|
-
export
|
|
48
|
-
hash: string;
|
|
49
|
-
index: number;
|
|
50
|
-
script: string;
|
|
51
|
-
address: string;
|
|
52
|
-
tx_hex: string;
|
|
53
|
-
value: string;
|
|
54
|
-
};
|
|
55
|
-
export
|
|
56
|
-
hash: string;
|
|
57
|
-
block: number;
|
|
58
|
-
time: number;
|
|
59
|
-
};
|
|
60
|
-
export
|
|
61
|
-
network: string;
|
|
62
|
-
address: string;
|
|
63
|
-
balance: string;
|
|
64
|
-
received_value: string;
|
|
65
|
-
pending_value: string;
|
|
66
|
-
total_txs: number;
|
|
67
|
-
};
|
|
68
|
-
export
|
|
69
|
-
transactions: DogeAddressTxDTO[];
|
|
70
|
-
};
|
|
71
|
-
export
|
|
72
|
-
confirmed: string;
|
|
73
|
-
unconfirmed: string;
|
|
74
|
-
};
|
|
75
|
-
export
|
|
76
|
-
outputs: DogeAddressUTXO[];
|
|
77
|
-
};
|
|
78
|
-
export
|
|
79
|
-
network: string;
|
|
80
|
-
txid: string;
|
|
81
|
-
};
|
|
1
|
+
import { Network, TxHash } from '@xchainjs/xchain-client';
|
|
2
|
+
export type AddressParams = {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
sochainUrl: string;
|
|
5
|
+
network: Network;
|
|
6
|
+
address: string;
|
|
7
|
+
page: number;
|
|
8
|
+
};
|
|
9
|
+
export type BalanceParams = {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
sochainUrl: string;
|
|
12
|
+
network: Network;
|
|
13
|
+
address: string;
|
|
14
|
+
};
|
|
15
|
+
export type TxHashParams = {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
sochainUrl: string;
|
|
18
|
+
network: Network;
|
|
19
|
+
hash: TxHash;
|
|
20
|
+
};
|
|
21
|
+
export type TxBroadcastParams = {
|
|
22
|
+
apiKey: string;
|
|
23
|
+
sochainUrl: string;
|
|
24
|
+
network: Network;
|
|
25
|
+
txHex: string;
|
|
26
|
+
};
|
|
27
|
+
export interface SochainResponse<T> {
|
|
28
|
+
data: T;
|
|
29
|
+
status: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TxIO {
|
|
32
|
+
index: number;
|
|
33
|
+
value: string;
|
|
34
|
+
address: string;
|
|
35
|
+
type?: string;
|
|
36
|
+
script: string;
|
|
37
|
+
}
|
|
38
|
+
export interface Transaction {
|
|
39
|
+
network: string;
|
|
40
|
+
hash: string;
|
|
41
|
+
block_hash: string;
|
|
42
|
+
confirmations: number;
|
|
43
|
+
time: number;
|
|
44
|
+
inputs: TxIO[];
|
|
45
|
+
outputs: TxIO[];
|
|
46
|
+
}
|
|
47
|
+
export type DogeAddressUTXO = {
|
|
48
|
+
hash: string;
|
|
49
|
+
index: number;
|
|
50
|
+
script: string;
|
|
51
|
+
address: string;
|
|
52
|
+
tx_hex: string;
|
|
53
|
+
value: string;
|
|
54
|
+
};
|
|
55
|
+
export type DogeAddressTxDTO = {
|
|
56
|
+
hash: string;
|
|
57
|
+
block: number;
|
|
58
|
+
time: number;
|
|
59
|
+
};
|
|
60
|
+
export type DogeAddressDTO = {
|
|
61
|
+
network: string;
|
|
62
|
+
address: string;
|
|
63
|
+
balance: string;
|
|
64
|
+
received_value: string;
|
|
65
|
+
pending_value: string;
|
|
66
|
+
total_txs: number;
|
|
67
|
+
};
|
|
68
|
+
export type DogeGetTxsDTO = {
|
|
69
|
+
transactions: DogeAddressTxDTO[];
|
|
70
|
+
};
|
|
71
|
+
export type DogeGetBalanceDTO = {
|
|
72
|
+
confirmed: string;
|
|
73
|
+
unconfirmed: string;
|
|
74
|
+
};
|
|
75
|
+
export type DogeUnspentTxsDTO = {
|
|
76
|
+
outputs: DogeAddressUTXO[];
|
|
77
|
+
};
|
|
78
|
+
export type DogeBroadcastTransfer = {
|
|
79
|
+
network: string;
|
|
80
|
+
txid: string;
|
|
81
|
+
};
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { FeeRate, Fees, FeesWithRates, Network, UTXO } from '@xchainjs/xchain-client';
|
|
3
|
-
import { Address, BaseAmount } from '@xchainjs/xchain-util';
|
|
4
|
-
import * as Dogecoin from 'bitcoinjs-lib';
|
|
5
|
-
/**
|
|
6
|
-
* Compile memo.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} memo The memo to be compiled.
|
|
9
|
-
* @returns {Buffer} The compiled memo.
|
|
10
|
-
*/
|
|
11
|
-
export declare const compileMemo: (memo: string) => Buffer;
|
|
12
|
-
/**
|
|
13
|
-
* Get the transaction fee.
|
|
14
|
-
*
|
|
15
|
-
* @param {UTXO[]} inputs The UTXOs.
|
|
16
|
-
* @param {FeeRate} feeRate The fee rate.
|
|
17
|
-
* @param {Buffer} data The compiled memo (Optional).
|
|
18
|
-
* @returns {number} The fee amount.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getFee(inputs: UTXO[], feeRate: FeeRate, data?: Buffer | null): number;
|
|
21
|
-
/**
|
|
22
|
-
* Get the average value of an array.
|
|
23
|
-
*
|
|
24
|
-
* @param {number[]} array
|
|
25
|
-
* @returns {number} The average value.
|
|
26
|
-
*/
|
|
27
|
-
export declare function arrayAverage(array: number[]): number;
|
|
28
|
-
/**
|
|
29
|
-
* Get Dogecoin network to be used with bitcoinjs.
|
|
30
|
-
*
|
|
31
|
-
* @param {Network} network
|
|
32
|
-
* @returns {Dogecoin.networks.Network} The Doge network.
|
|
33
|
-
*/
|
|
34
|
-
export declare const dogeNetwork: (network: Network) => Dogecoin.networks.Network;
|
|
35
|
-
/**
|
|
36
|
-
* Validate the Doge address.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} address
|
|
39
|
-
* @param {Network} network
|
|
40
|
-
* @returns {boolean} `true` or `false`.
|
|
41
|
-
*/
|
|
42
|
-
export declare const validateAddress: (address: Address, network: Network) => boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Calculate fees based on fee rate and memo.
|
|
45
|
-
*
|
|
46
|
-
* @param {FeeRate} feeRate
|
|
47
|
-
* @param {string} memo
|
|
48
|
-
* @returns {BaseAmount} The calculated fees based on fee rate and the memo.
|
|
49
|
-
*/
|
|
50
|
-
export declare const calcFee: (feeRate: FeeRate, memo?: string
|
|
51
|
-
/**
|
|
52
|
-
* Get the default fees with rates.
|
|
53
|
-
*
|
|
54
|
-
* @returns {FeesWithRates} The default fees and rates.
|
|
55
|
-
*/
|
|
56
|
-
export declare const getDefaultFeesWithRates: () => FeesWithRates;
|
|
57
|
-
/**
|
|
58
|
-
* Get the default fees.
|
|
59
|
-
*
|
|
60
|
-
* @returns {Fees} The default fees.
|
|
61
|
-
*/
|
|
62
|
-
export declare const getDefaultFees: () => Fees;
|
|
63
|
-
/**
|
|
64
|
-
* Get address prefix based on the network.
|
|
65
|
-
*
|
|
66
|
-
* @param {Network} network
|
|
67
|
-
* @returns {string} The address prefix based on the network.
|
|
68
|
-
*
|
|
69
|
-
**/
|
|
70
|
-
export declare const getPrefix: (network: Network) => "" | "n";
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { FeeRate, Fees, FeesWithRates, Network, UTXO } from '@xchainjs/xchain-client';
|
|
3
|
+
import { Address, BaseAmount } from '@xchainjs/xchain-util';
|
|
4
|
+
import * as Dogecoin from 'bitcoinjs-lib';
|
|
5
|
+
/**
|
|
6
|
+
* Compile memo.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} memo The memo to be compiled.
|
|
9
|
+
* @returns {Buffer} The compiled memo.
|
|
10
|
+
*/
|
|
11
|
+
export declare const compileMemo: (memo: string) => Buffer;
|
|
12
|
+
/**
|
|
13
|
+
* Get the transaction fee.
|
|
14
|
+
*
|
|
15
|
+
* @param {UTXO[]} inputs The UTXOs.
|
|
16
|
+
* @param {FeeRate} feeRate The fee rate.
|
|
17
|
+
* @param {Buffer} data The compiled memo (Optional).
|
|
18
|
+
* @returns {number} The fee amount.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFee(inputs: UTXO[], feeRate: FeeRate, data?: Buffer | null): number;
|
|
21
|
+
/**
|
|
22
|
+
* Get the average value of an array.
|
|
23
|
+
*
|
|
24
|
+
* @param {number[]} array
|
|
25
|
+
* @returns {number} The average value.
|
|
26
|
+
*/
|
|
27
|
+
export declare function arrayAverage(array: number[]): number;
|
|
28
|
+
/**
|
|
29
|
+
* Get Dogecoin network to be used with bitcoinjs.
|
|
30
|
+
*
|
|
31
|
+
* @param {Network} network
|
|
32
|
+
* @returns {Dogecoin.networks.Network} The Doge network.
|
|
33
|
+
*/
|
|
34
|
+
export declare const dogeNetwork: (network: Network) => Dogecoin.networks.Network;
|
|
35
|
+
/**
|
|
36
|
+
* Validate the Doge address.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} address
|
|
39
|
+
* @param {Network} network
|
|
40
|
+
* @returns {boolean} `true` or `false`.
|
|
41
|
+
*/
|
|
42
|
+
export declare const validateAddress: (address: Address, network: Network) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Calculate fees based on fee rate and memo.
|
|
45
|
+
*
|
|
46
|
+
* @param {FeeRate} feeRate
|
|
47
|
+
* @param {string} memo
|
|
48
|
+
* @returns {BaseAmount} The calculated fees based on fee rate and the memo.
|
|
49
|
+
*/
|
|
50
|
+
export declare const calcFee: (feeRate: FeeRate, memo?: string) => BaseAmount;
|
|
51
|
+
/**
|
|
52
|
+
* Get the default fees with rates.
|
|
53
|
+
*
|
|
54
|
+
* @returns {FeesWithRates} The default fees and rates.
|
|
55
|
+
*/
|
|
56
|
+
export declare const getDefaultFeesWithRates: () => FeesWithRates;
|
|
57
|
+
/**
|
|
58
|
+
* Get the default fees.
|
|
59
|
+
*
|
|
60
|
+
* @returns {Fees} The default fees.
|
|
61
|
+
*/
|
|
62
|
+
export declare const getDefaultFees: () => Fees;
|
|
63
|
+
/**
|
|
64
|
+
* Get address prefix based on the network.
|
|
65
|
+
*
|
|
66
|
+
* @param {Network} network
|
|
67
|
+
* @returns {string} The address prefix based on the network.
|
|
68
|
+
*
|
|
69
|
+
**/
|
|
70
|
+
export declare const getPrefix: (network: Network) => "" | "n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-doge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Custom Doge client and utilities used by XChain clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Xchain",
|
|
@@ -33,26 +33,25 @@
|
|
|
33
33
|
"postversion": "git push --follow-tags"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@xchainjs/xchain-client": "^0.
|
|
37
|
-
"@xchainjs/xchain-crypto": "^0.
|
|
38
|
-
"@xchainjs/xchain-util": "^0.
|
|
39
|
-
"@
|
|
40
|
-
"@xchainjs/xchain-utxo-providers": "^0.1.2",
|
|
36
|
+
"@xchainjs/xchain-client": "^0.14.1",
|
|
37
|
+
"@xchainjs/xchain-crypto": "^0.3.0",
|
|
38
|
+
"@xchainjs/xchain-util": "^0.13.0",
|
|
39
|
+
"@xchainjs/xchain-utxo-providers": "^0.2.1",
|
|
41
40
|
"@types/wif": "^2.0.2",
|
|
42
|
-
"axios": "^
|
|
41
|
+
"axios": "^1.3.6",
|
|
43
42
|
"axios-mock-adapter": "^1.20.0",
|
|
44
|
-
"bitcoinjs-lib": "
|
|
43
|
+
"bitcoinjs-lib": "5.2.0",
|
|
45
44
|
"coininfo": "5.1.0",
|
|
46
45
|
"coinselect": "3.1.12",
|
|
47
46
|
"wif": "^2.0.6"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
|
-
"@xchainjs/xchain-client": "^0.
|
|
51
|
-
"@xchainjs/xchain-crypto": "^0.
|
|
52
|
-
"@xchainjs/xchain-util": "^0.
|
|
53
|
-
"@xchainjs/xchain-utxo-providers": "^0.1
|
|
54
|
-
"axios": "^
|
|
55
|
-
"bitcoinjs-lib": "
|
|
49
|
+
"@xchainjs/xchain-client": "^0.14.1",
|
|
50
|
+
"@xchainjs/xchain-crypto": "^0.3.0",
|
|
51
|
+
"@xchainjs/xchain-util": "^0.13.0",
|
|
52
|
+
"@xchainjs/xchain-utxo-providers": "^0.2.1",
|
|
53
|
+
"axios": "^1.3.6",
|
|
54
|
+
"bitcoinjs-lib": "5.2.0",
|
|
56
55
|
"coininfo": "5.1.0",
|
|
57
56
|
"coinselect": "3.1.12",
|
|
58
57
|
"wif": "^2.0.6"
|