@multiplechain/bitcoin 0.4.5 → 0.4.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/dist/assets/Coin.d.ts +10 -10
- package/dist/browser/Wallet.d.ts +21 -22
- package/dist/index.cjs +39 -39
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +9580 -9549
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +30 -30
- package/dist/index.umd.js.map +1 -1
- package/dist/models/CoinTransaction.d.ts +7 -7
- package/dist/models/Transaction.d.ts +14 -14
- package/dist/services/Provider.d.ts +12 -15
- package/dist/services/TransactionListener.d.ts +11 -19
- package/dist/services/TransactionSigner.d.ts +7 -7
- package/package.json +4 -2
|
@@ -3,22 +3,22 @@ import { Transaction } from './Transaction';
|
|
|
3
3
|
|
|
4
4
|
export declare class CoinTransaction extends Transaction implements CoinTransactionInterface {
|
|
5
5
|
/**
|
|
6
|
-
* @returns
|
|
6
|
+
* @returns Wallet address of the receiver of transaction
|
|
7
7
|
*/
|
|
8
8
|
getReceiver(): Promise<WalletAddress>;
|
|
9
9
|
/**
|
|
10
|
-
* @returns
|
|
10
|
+
* @returns Wallet address of the sender of transaction
|
|
11
11
|
*/
|
|
12
12
|
getSender(): Promise<WalletAddress>;
|
|
13
13
|
/**
|
|
14
|
-
* @returns
|
|
14
|
+
* @returns Amount of coin that will be transferred
|
|
15
15
|
*/
|
|
16
16
|
getAmount(): Promise<TransferAmount>;
|
|
17
17
|
/**
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @returns
|
|
18
|
+
* @param direction - Direction of the transaction (asset)
|
|
19
|
+
* @param address - Wallet address of the receiver or sender of the transaction, dependant on direction
|
|
20
|
+
* @param amount Amount of assets that will be transferred
|
|
21
|
+
* @returns Status of the transaction
|
|
22
22
|
*/
|
|
23
23
|
verifyTransfer(direction: AssetDirectionEnum, address: WalletAddress, amount: TransferAmount): Promise<TransactionStatusEnum>;
|
|
24
24
|
}
|
|
@@ -54,53 +54,53 @@ export declare class Transaction implements TransactionInterface<TransactionData
|
|
|
54
54
|
*/
|
|
55
55
|
data: TransactionData | null;
|
|
56
56
|
/**
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
57
|
+
* @param id Transaction id
|
|
58
|
+
* @param provider Blockchain network provider
|
|
59
59
|
*/
|
|
60
60
|
constructor(id: TransactionId, provider?: Provider);
|
|
61
61
|
/**
|
|
62
|
-
* @returns
|
|
62
|
+
* @returns Transaction data
|
|
63
63
|
*/
|
|
64
64
|
getData(): Promise<TransactionData | null>;
|
|
65
65
|
/**
|
|
66
|
-
* @param
|
|
67
|
-
* @returns
|
|
66
|
+
* @param ms - Milliseconds to wait for the transaction to be confirmed. Default is 4000ms
|
|
67
|
+
* @returns Status of the transaction
|
|
68
68
|
*/
|
|
69
69
|
wait(ms?: number): Promise<TransactionStatusEnum>;
|
|
70
70
|
/**
|
|
71
|
-
* @returns
|
|
71
|
+
* @returns Transaction ID
|
|
72
72
|
*/
|
|
73
73
|
getId(): TransactionId;
|
|
74
74
|
/**
|
|
75
|
-
* @returns
|
|
75
|
+
* @returns Transaction type
|
|
76
76
|
*/
|
|
77
77
|
getType(): Promise<TransactionTypeEnum>;
|
|
78
78
|
/**
|
|
79
|
-
* @returns
|
|
79
|
+
* @returns Transaction URL
|
|
80
80
|
*/
|
|
81
81
|
getUrl(): string;
|
|
82
82
|
/**
|
|
83
|
-
* @returns
|
|
83
|
+
* @returns Wallet address of the sender of transaction
|
|
84
84
|
*/
|
|
85
85
|
getSigner(): Promise<WalletAddress>;
|
|
86
86
|
/**
|
|
87
|
-
* @returns
|
|
87
|
+
* @returns Transaction fee
|
|
88
88
|
*/
|
|
89
89
|
getFee(): Promise<TransactionFee>;
|
|
90
90
|
/**
|
|
91
|
-
* @returns
|
|
91
|
+
* @returns Block number that transaction
|
|
92
92
|
*/
|
|
93
93
|
getBlockNumber(): Promise<BlockNumber>;
|
|
94
94
|
/**
|
|
95
|
-
* @returns
|
|
95
|
+
* @returns Block timestamp that transaction
|
|
96
96
|
*/
|
|
97
97
|
getBlockTimestamp(): Promise<BlockTimestamp>;
|
|
98
98
|
/**
|
|
99
|
-
* @returns
|
|
99
|
+
* @returns Confirmation count of the block
|
|
100
100
|
*/
|
|
101
101
|
getBlockConfirmationCount(): Promise<BlockConfirmationCount>;
|
|
102
102
|
/**
|
|
103
|
-
* @returns
|
|
103
|
+
* @returns Status of the transaction
|
|
104
104
|
*/
|
|
105
105
|
getStatus(): Promise<TransactionStatusEnum>;
|
|
106
106
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { ProviderInterface } from '@multiplechain/types';
|
|
1
|
+
import { NetworkConfigInterface, ProviderInterface } from '@multiplechain/types';
|
|
2
2
|
|
|
3
|
-
export interface BitcoinNetworkConfigInterface {
|
|
4
|
-
testnet: boolean;
|
|
3
|
+
export interface BitcoinNetworkConfigInterface extends NetworkConfigInterface {
|
|
5
4
|
blockCypherToken?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare class Provider implements ProviderInterface<BitcoinNetworkConfigInterface> {
|
|
@@ -39,42 +38,40 @@ export declare class Provider implements ProviderInterface<BitcoinNetworkConfigI
|
|
|
39
38
|
constructor(network: BitcoinNetworkConfigInterface);
|
|
40
39
|
/**
|
|
41
40
|
* Get the static instance of the provider
|
|
42
|
-
* @returns
|
|
41
|
+
* @returns Provider
|
|
43
42
|
*/
|
|
44
43
|
static get instance(): Provider;
|
|
45
44
|
/**
|
|
46
45
|
* Initialize the static instance of the provider
|
|
47
|
-
* @param
|
|
48
|
-
* @returns {void}
|
|
46
|
+
* @param network - Network configuration of the provider
|
|
49
47
|
*/
|
|
50
48
|
static initialize(network: BitcoinNetworkConfigInterface): void;
|
|
51
49
|
/**
|
|
52
50
|
* Check RPC connection
|
|
53
|
-
* @param
|
|
54
|
-
* @returns
|
|
51
|
+
* @param url - RPC URL
|
|
52
|
+
* @returns Connection status
|
|
55
53
|
*/
|
|
56
54
|
checkRpcConnection(url?: string): Promise<boolean | Error>;
|
|
57
55
|
/**
|
|
58
56
|
* Check WS connection
|
|
59
|
-
* @param
|
|
60
|
-
* @returns
|
|
57
|
+
* @param url - Websocket URL
|
|
58
|
+
* @returns Connection status
|
|
61
59
|
*/
|
|
62
60
|
checkWsConnection(url?: string): Promise<boolean | Error>;
|
|
63
61
|
/**
|
|
64
62
|
* Update network configuration of the provider
|
|
65
|
-
* @param
|
|
66
|
-
* @returns {void}
|
|
63
|
+
* @param network - Network configuration
|
|
67
64
|
*/
|
|
68
65
|
update(network: BitcoinNetworkConfigInterface): void;
|
|
69
66
|
/**
|
|
70
67
|
* Create a new endpoint
|
|
71
|
-
* @param
|
|
72
|
-
* @returns
|
|
68
|
+
* @param endpoint - Endpoint
|
|
69
|
+
* @returns Endpoint
|
|
73
70
|
*/
|
|
74
71
|
createEndpoint(endpoint: string): string;
|
|
75
72
|
/**
|
|
76
73
|
* Get the current network configuration is testnet or not
|
|
77
|
-
* @returns
|
|
74
|
+
* @returns Testnet or not
|
|
78
75
|
*/
|
|
79
76
|
isTestnet(): boolean;
|
|
80
77
|
}
|
|
@@ -46,74 +46,66 @@ export declare class TransactionListener<T extends TransactionTypeEnum, DTransac
|
|
|
46
46
|
*/
|
|
47
47
|
dynamicStop: () => void;
|
|
48
48
|
/**
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
49
|
+
* @param type - Transaction type
|
|
50
|
+
* @param filter - Transaction listener filter
|
|
51
|
+
* @param provider - Provider
|
|
52
52
|
*/
|
|
53
53
|
constructor(type: T, filter?: DynamicTransactionListenerFilterType<T>, provider?: Provider);
|
|
54
54
|
/**
|
|
55
55
|
* Close the listener
|
|
56
|
-
* @returns {void}
|
|
57
56
|
*/
|
|
58
57
|
stop(): void;
|
|
59
58
|
/**
|
|
60
59
|
* Start the listener
|
|
61
|
-
* @returns {void}
|
|
62
60
|
*/
|
|
63
61
|
start(): void;
|
|
64
62
|
/**
|
|
65
63
|
* Get the listener status
|
|
66
|
-
* @returns
|
|
64
|
+
* @returns Listener status
|
|
67
65
|
*/
|
|
68
66
|
getStatus(): boolean;
|
|
69
67
|
/**
|
|
70
68
|
* Listen to the transaction events
|
|
71
|
-
* @param
|
|
72
|
-
* @returns
|
|
69
|
+
* @param callback - Transaction listener callback
|
|
70
|
+
* @returns Connection status
|
|
73
71
|
*/
|
|
74
72
|
on(callback: CallBackType): Promise<boolean>;
|
|
75
73
|
/**
|
|
76
74
|
* Trigger the event when a transaction is detected
|
|
77
|
-
* @param
|
|
78
|
-
* @returns {void}
|
|
75
|
+
* @param transaction - Transaction data
|
|
79
76
|
*/
|
|
80
77
|
trigger<T extends TransactionTypeEnum>(transaction: TransactionListenerTriggerType<T>): void;
|
|
81
78
|
isBlockCypherProcess(): boolean;
|
|
82
79
|
/**
|
|
83
80
|
* Create message for the listener
|
|
84
|
-
* @param
|
|
85
|
-
* @returns
|
|
81
|
+
* @param receiver - Receiver address
|
|
82
|
+
* @returns Message
|
|
86
83
|
*/
|
|
87
84
|
createMessage(receiver?: string): string;
|
|
88
85
|
/**
|
|
89
86
|
* Parse the data
|
|
90
|
-
* @param
|
|
91
|
-
* @returns
|
|
87
|
+
* @param data - Data
|
|
88
|
+
* @returns Parsed data
|
|
92
89
|
*/
|
|
93
90
|
getValues(data: any): Values;
|
|
94
91
|
/**
|
|
95
92
|
* General transaction process
|
|
96
|
-
* @returns {void}
|
|
97
93
|
*/
|
|
98
94
|
generalProcess(): void;
|
|
99
95
|
/**
|
|
100
96
|
* Contract transaction process
|
|
101
|
-
* @returns {void}
|
|
102
97
|
*/
|
|
103
98
|
contractProcess(): void;
|
|
104
99
|
/**
|
|
105
100
|
* Coin transaction process
|
|
106
|
-
* @returns {void}
|
|
107
101
|
*/
|
|
108
102
|
coinProcess(): void;
|
|
109
103
|
/**
|
|
110
104
|
* Token transaction process
|
|
111
|
-
* @returns {void}
|
|
112
105
|
*/
|
|
113
106
|
tokenProcess(): void;
|
|
114
107
|
/**
|
|
115
108
|
* NFT transaction process
|
|
116
|
-
* @returns {void}
|
|
117
109
|
*/
|
|
118
110
|
nftProcess(): void;
|
|
119
111
|
}
|
|
@@ -22,29 +22,29 @@ export declare class TransactionSigner implements TransactionSignerInterface<Tra
|
|
|
22
22
|
*/
|
|
23
23
|
provider: Provider;
|
|
24
24
|
/**
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
25
|
+
* @param rawData - Transaction data
|
|
26
|
+
* @param provider - Blockchain network provider
|
|
27
27
|
*/
|
|
28
28
|
constructor(rawData: TransactionData, provider?: Provider);
|
|
29
29
|
/**
|
|
30
30
|
* Sign the transaction
|
|
31
|
-
* @param
|
|
32
|
-
* @returns
|
|
31
|
+
* @param privateKey - Transaction data
|
|
32
|
+
* @returns Signed transaction data
|
|
33
33
|
*/
|
|
34
34
|
sign(privateKey: PrivateKey): Promise<this>;
|
|
35
35
|
/**
|
|
36
36
|
* Send the transaction to the blockchain network
|
|
37
|
-
* @returns
|
|
37
|
+
* @returns Transaction ID
|
|
38
38
|
*/
|
|
39
39
|
send(): Promise<TransactionId>;
|
|
40
40
|
/**
|
|
41
41
|
* Get the raw transaction data
|
|
42
|
-
* @returns
|
|
42
|
+
* @returns Transaction data
|
|
43
43
|
*/
|
|
44
44
|
getRawData(): TransactionData;
|
|
45
45
|
/**
|
|
46
46
|
* Get the signed transaction data
|
|
47
|
-
* @returns
|
|
47
|
+
* @returns Signed transaction data
|
|
48
48
|
*/
|
|
49
49
|
getSignedData(): string;
|
|
50
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplechain/bitcoin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -72,15 +72,17 @@
|
|
|
72
72
|
"url": "https://github.com/MultipleChain/js/issues"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@multiplechain/types": "^0.1.
|
|
75
|
+
"@multiplechain/types": "^0.1.68",
|
|
76
76
|
"@multiplechain/utils": "^0.1.21",
|
|
77
77
|
"axios": "^1.6.8",
|
|
78
78
|
"bitcore-lib": "^10.0.28",
|
|
79
|
+
"lodash": "^4.17.21",
|
|
79
80
|
"sats-connect": "^2.3.1",
|
|
80
81
|
"ws": "^8.17.0"
|
|
81
82
|
},
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@types/bitcore-lib": "^0.15.6",
|
|
85
|
+
"@types/lodash": "^4.17.7",
|
|
84
86
|
"@types/ws": "^8.5.10"
|
|
85
87
|
}
|
|
86
88
|
}
|