@xchainjs/xchain-dash 0.1.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.
@@ -0,0 +1,97 @@
1
+ import { Network } from '@xchainjs/xchain-client';
2
+ export type InsightAddressParams = {
3
+ network: Network;
4
+ address: string;
5
+ pageNum?: number;
6
+ };
7
+ export type InsightAddressResponse = {
8
+ addrStr: string;
9
+ balance: number;
10
+ balanceSat: number;
11
+ totalReceived: number;
12
+ totalReceivedSat: number;
13
+ totalSent: number;
14
+ totalSentSat: number;
15
+ txAppearances: number;
16
+ txApperances: number;
17
+ unconfirmedAppearances: number;
18
+ unconfirmedBalance: number;
19
+ unconfirmedBalanceSat: number;
20
+ unconfirmedTxApperances: number;
21
+ };
22
+ export type InsightTransactionParams = {
23
+ network: Network;
24
+ txid: string;
25
+ };
26
+ export type InsightTxResponse = {
27
+ blockhash: string;
28
+ blockheight: number;
29
+ blocktime: number;
30
+ cbTx: {
31
+ height: number;
32
+ merkleRootMNList: string;
33
+ merkleRootQuorums: string;
34
+ version: number;
35
+ };
36
+ confirmations: number;
37
+ extraPayload: string;
38
+ extraPayloadSize: number;
39
+ isCoinBase: boolean;
40
+ locktime: number;
41
+ size: number;
42
+ time: number;
43
+ txid: string;
44
+ txlock: boolean;
45
+ type: number;
46
+ valueOut: number;
47
+ version: number;
48
+ vin: [
49
+ {
50
+ addr: string;
51
+ doubleSpentTxID: string;
52
+ n: number;
53
+ scriptSig: {
54
+ asm: string;
55
+ hex: string;
56
+ };
57
+ sequence: number;
58
+ txid: number;
59
+ value: number;
60
+ valueSat: number;
61
+ }
62
+ ];
63
+ vout: [
64
+ {
65
+ n: number;
66
+ scriptPubKey: {
67
+ addresses: string[];
68
+ asm: string;
69
+ hex: string;
70
+ type: string;
71
+ };
72
+ spentHeight: number;
73
+ spentIndex: number;
74
+ spentTxId: string;
75
+ value: string;
76
+ }
77
+ ];
78
+ };
79
+ export type InsightRawTx = string;
80
+ export type InsightUtxoResponse = {
81
+ address: string;
82
+ txid: string;
83
+ vout: number;
84
+ scriptPubKey: string;
85
+ amount: number;
86
+ satoshis: number;
87
+ height: number;
88
+ confirmations: number;
89
+ };
90
+ export declare const getAddress: (p: InsightAddressParams) => Promise<InsightAddressResponse>;
91
+ export declare const getAddressTxs: (p: InsightAddressParams) => Promise<{
92
+ txs: InsightTxResponse[];
93
+ pagesTotal: number;
94
+ }>;
95
+ export declare const getAddressUtxos: (p: InsightAddressParams) => Promise<InsightUtxoResponse[]>;
96
+ export declare const getTx: (p: InsightTransactionParams) => Promise<InsightTxResponse>;
97
+ export declare const getRawTx: (p: InsightTransactionParams) => Promise<InsightRawTx>;
@@ -0,0 +1 @@
1
+ declare module 'coinselect/accumulative';
@@ -0,0 +1,8 @@
1
+ import { TxHash } from '@xchainjs/xchain-client';
2
+ import { NodeAuth } from '@xchainjs/xchain-dash/src/client';
3
+ export type BroadcastTxParams = {
4
+ txHex: string;
5
+ nodeUrl: string;
6
+ auth?: NodeAuth;
7
+ };
8
+ export declare const broadcastTx: (params: BroadcastTxParams) => Promise<TxHash>;
package/lib/utils.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" />
2
+ import { Transaction } from '@dashevo/dashcore-lib/typings/transaction/Transaction';
3
+ import { FeeRate, Fees, FeesWithRates, Network, TxParams } from '@xchainjs/xchain-client';
4
+ import { Address, BaseAmount } from '@xchainjs/xchain-util';
5
+ import * as Dash from 'bitcoinjs-lib';
6
+ export type UTXO = {
7
+ hash: string;
8
+ index: number;
9
+ value: number;
10
+ txHex?: string;
11
+ };
12
+ export declare const TX_MIN_FEE = 1000;
13
+ export declare const TX_DUST_THRESHOLD: any;
14
+ export declare function getFee(inputCount: number, feeRate: FeeRate, data?: Buffer | null): number;
15
+ export declare const dashNetwork: (network: Network) => Dash.Network;
16
+ export declare const validateAddress: (address: Address, network: Network) => boolean;
17
+ export declare const buildTx: ({ amount, recipient, memo, feeRate, sender, network, }: TxParams & {
18
+ feeRate: FeeRate;
19
+ sender: Address;
20
+ network: Network;
21
+ withTxHex?: boolean | undefined;
22
+ }) => Promise<{
23
+ tx: Transaction;
24
+ utxos: UTXO[];
25
+ }>;
26
+ export declare const calcFee: (feeRate: FeeRate, memo?: string, utxos?: UTXO[]) => BaseAmount;
27
+ export declare const getDefaultFeesWithRates: () => FeesWithRates;
28
+ export declare const getDefaultFees: () => Fees;
29
+ export declare const getPrefix: (network: Network) => "X" | "y";
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@xchainjs/xchain-dash",
3
+ "version": "0.1.0",
4
+ "description": "Custom Dash client and utilities used by XChainJS clients",
5
+ "keywords": [
6
+ "XChain",
7
+ "Dash"
8
+ ],
9
+ "author": "XChainJS",
10
+ "homepage": "https://github.com/xchainjs/xchainjs-lib",
11
+ "license": "MIT",
12
+ "main": "lib/index.js",
13
+ "module": "lib/index.esm.js",
14
+ "typings": "lib/index.d.ts",
15
+ "directories": {
16
+ "lib": "lib",
17
+ "test": "__tests__"
18
+ },
19
+ "files": [
20
+ "lib"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git@github.com:xchainjs/xchainjs-lib.git"
25
+ },
26
+ "scripts": {
27
+ "clean": "rimraf lib/**",
28
+ "build": "yarn clean && rollup -c",
29
+ "test": "jest",
30
+ "e2e": "jest --config jest.config.e2e.js",
31
+ "lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
32
+ "prepublishOnly": "yarn build",
33
+ "postversion": "git push --follow-tags"
34
+ },
35
+ "devDependencies": {
36
+ "@types/bitcoinjs-lib": "^5.0.0",
37
+ "@types/wif": "^2.0.2",
38
+ "@xchainjs/xchain-client": "^0.14.1",
39
+ "@xchainjs/xchain-crypto": "^0.3.0",
40
+ "@xchainjs/xchain-util": "^0.13.0",
41
+ "@xchainjs/xchain-utxo-providers": "^0.2.1",
42
+ "coinselect": "^3.1.12",
43
+ "axios": "^1.3.6",
44
+ "axios-mock-adapter": "^1.20.0",
45
+ "bitcoinjs-lib": "^5.2.0",
46
+ "coininfo": "^5.1.0",
47
+ "wif": "^2.0.6"
48
+ },
49
+ "peerDependencies": {
50
+ "@xchainjs/xchain-client": "^0.14.1",
51
+ "@xchainjs/xchain-crypto": "^0.3.0",
52
+ "@xchainjs/xchain-util": "^0.13.0",
53
+ "@xchainjs/xchain-utxo-providers": "^0.2.1",
54
+ "coinselect": "^3.1.12",
55
+ "axios": "^1.3.6",
56
+ "bitcoinjs-lib": "^5.2.0",
57
+ "coininfo": "^5.1.0",
58
+ "wif": "^2.0.6"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "dependencies": {
64
+ "@dashevo/dashcore-lib": "^0.19.41"
65
+ }
66
+ }