mainnet-js 2.6.6 → 2.7.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.
- package/dist/index.html +1 -1
- package/dist/{mainnet-2.6.6.js → mainnet-2.7.0.js} +446 -156
- package/dist/module/cli.js +0 -4
- package/dist/module/cli.js.map +1 -1
- package/dist/module/index.d.ts +1 -3
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +1 -3
- package/dist/module/index.js.map +1 -1
- package/dist/module/network/ElectrumNetworkProvider.d.ts +21 -27
- package/dist/module/network/ElectrumNetworkProvider.d.ts.map +1 -1
- package/dist/module/network/ElectrumNetworkProvider.js +92 -102
- package/dist/module/network/ElectrumNetworkProvider.js.map +1 -1
- package/dist/module/network/NetworkProvider.d.ts +9 -22
- package/dist/module/network/NetworkProvider.d.ts.map +1 -1
- package/dist/module/network/constant.d.ts +0 -21
- package/dist/module/network/constant.d.ts.map +1 -1
- package/dist/module/network/constant.js +0 -21
- package/dist/module/network/constant.js.map +1 -1
- package/dist/module/network/default.d.ts +2 -2
- package/dist/module/network/default.d.ts.map +1 -1
- package/dist/module/network/default.js +15 -45
- package/dist/module/network/default.js.map +1 -1
- package/dist/module/network/interface.d.ts +2 -8
- package/dist/module/network/interface.d.ts.map +1 -1
- package/dist/module/network/util.d.ts.map +1 -1
- package/dist/module/network/util.js +4 -5
- package/dist/module/network/util.js.map +1 -1
- package/dist/module/rate/ExchangeRate.js +2 -1
- package/dist/module/rate/ExchangeRate.js.map +1 -1
- package/dist/module/transaction/Wif.d.ts.map +1 -1
- package/dist/module/transaction/Wif.js +1 -1
- package/dist/module/transaction/Wif.js.map +1 -1
- package/dist/module/wallet/Base.d.ts +282 -88
- package/dist/module/wallet/Base.d.ts.map +1 -1
- package/dist/module/wallet/Base.js +1058 -215
- package/dist/module/wallet/Base.js.map +1 -1
- package/dist/module/wallet/Util.d.ts +7 -54
- package/dist/module/wallet/Util.d.ts.map +1 -1
- package/dist/module/wallet/Util.js +12 -79
- package/dist/module/wallet/Util.js.map +1 -1
- package/dist/module/wallet/Wif.d.ts +46 -251
- package/dist/module/wallet/Wif.d.ts.map +1 -1
- package/dist/module/wallet/Wif.js +126 -1026
- package/dist/module/wallet/Wif.js.map +1 -1
- package/dist/module/wallet/createWallet.d.ts +2 -1
- package/dist/module/wallet/createWallet.d.ts.map +1 -1
- package/dist/module/wallet/createWallet.js +2 -3
- package/dist/module/wallet/createWallet.js.map +1 -1
- package/dist/module/wallet/interface.d.ts +2 -4
- package/dist/module/wallet/interface.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -12
- package/src/cli.ts +0 -4
- package/src/index.ts +1 -5
- package/src/network/ElectrumNetworkProvider.ts +133 -188
- package/src/network/NetworkProvider.ts +9 -30
- package/src/network/Rpc.test.ts +14 -5
- package/src/network/constant.ts +0 -23
- package/src/network/default.ts +26 -66
- package/src/network/electrum.test.ts +2 -4
- package/src/network/interface.ts +2 -9
- package/src/network/util.ts +6 -7
- package/src/rate/ExchangeRate.test.ts +1 -1
- package/src/rate/ExchangeRate.ts +2 -1
- package/{polyfill/json.js → src/test/json.test.ts} +7 -1
- package/src/transaction/Wif.ts +2 -1
- package/src/wallet/Base.ts +1520 -273
- package/src/wallet/Cashtokens.test.headless.js +1 -1
- package/src/wallet/Cashtokens.test.ts +7 -8
- package/src/wallet/Util.ts +20 -102
- package/src/wallet/Wif.bip39.test.ts +3 -3
- package/src/wallet/Wif.test.ts +31 -25
- package/src/wallet/Wif.ts +174 -1493
- package/src/wallet/Wif.watchOnly.test.ts +5 -5
- package/src/wallet/createWallet.ts +11 -10
- package/src/wallet/interface.ts +3 -4
- package/webpack.config.cjs +4 -55
- package/dist/module/qr/Qr.d.ts +0 -9
- package/dist/module/qr/Qr.d.ts.map +0 -1
- package/dist/module/qr/Qr.js +0 -22
- package/dist/module/qr/Qr.js.map +0 -1
- package/dist/module/qr/interface.d.ts +0 -6
- package/dist/module/qr/interface.d.ts.map +0 -1
- package/dist/module/qr/interface.js +0 -2
- package/dist/module/qr/interface.js.map +0 -1
- package/dist/module/util/eventsource.d.ts +0 -3
- package/dist/module/util/eventsource.d.ts.map +0 -1
- package/dist/module/util/eventsource.js +0 -11
- package/dist/module/util/eventsource.js.map +0 -1
- package/polyfill/README.md +0 -1
- package/polyfill/eventsource.js +0 -6
- package/polyfill/support/types.js +0 -286
- package/polyfill/util.cjs +0 -249
- package/src/network/default.test.ts +0 -37
- package/src/qr/Qr.test.ts +0 -14
- package/src/qr/Qr.ts +0 -24
- package/src/qr/interface.ts +0 -5
- package/src/util/eventsource.ts +0 -12
|
@@ -1,67 +1,43 @@
|
|
|
1
1
|
import { CashAddressNetworkPrefix } from "@bitauth/libauth";
|
|
2
|
-
import { NetworkType
|
|
3
|
-
import { Network, HexHeaderI, TxI } from "../interface.js";
|
|
4
|
-
import { UtxoI } from "../interface.js";
|
|
5
|
-
import { BaseWallet } from "./Base.js";
|
|
2
|
+
import { NetworkType } from "../enum.js";
|
|
6
3
|
import { WalletTypeEnum } from "./enum.js";
|
|
7
|
-
import {
|
|
8
|
-
import { OpReturnData, SendRequest, SendRequestArray,
|
|
9
|
-
import { BalanceResponse } from "../util/balanceObjectFromSatoshi.js";
|
|
10
|
-
import { ElectrumRawTransaction } from "../network/interface.js";
|
|
11
|
-
import { RegTestUtil, RegTestWatchUtil, RegTestWifUtil, TestNetUtil, TestNetWatchUtil, TestNetWifUtil, Util, WatchUtil, WifUtil } from "./Util.js";
|
|
4
|
+
import { MnemonicI, SendRequestOptionsI, WalletInfoI } from "./interface.js";
|
|
5
|
+
import { OpReturnData, SendRequest, SendRequestArray, SendResponse, SourceOutput, TokenSendRequest } from "./model.js";
|
|
12
6
|
import { SignedMessageI } from "../message/index.js";
|
|
13
7
|
import ElectrumNetworkProvider from "../network/ElectrumNetworkProvider.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { TransactionHistoryItem } from "../history/interface.js";
|
|
8
|
+
import { BalanceResponse } from "../util/balanceObjectFromSatoshi.js";
|
|
9
|
+
import { BaseWallet } from "./Base.js";
|
|
17
10
|
/**
|
|
18
11
|
* Class to manage a bitcoin cash wallet.
|
|
19
12
|
*/
|
|
20
13
|
export declare class Wallet extends BaseWallet {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tokenaddr?: string;
|
|
14
|
+
provider: ElectrumNetworkProvider;
|
|
15
|
+
cashaddr: string;
|
|
16
|
+
tokenaddr: string;
|
|
25
17
|
derivationPath: string;
|
|
26
18
|
parentDerivationPath: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
_util?: Util;
|
|
19
|
+
mnemonic: string;
|
|
20
|
+
parentXPubKey: string;
|
|
21
|
+
privateKey: Uint8Array;
|
|
22
|
+
publicKeyCompressed: Uint8Array;
|
|
23
|
+
privateKeyWif: string;
|
|
24
|
+
publicKey: Uint8Array;
|
|
25
|
+
publicKeyHash: Uint8Array;
|
|
26
|
+
name: string;
|
|
36
27
|
static signedMessage: SignedMessageI;
|
|
37
|
-
|
|
38
|
-
static get util(): typeof Util;
|
|
39
|
-
slpSemiAware(value?: boolean): Wallet;
|
|
40
|
-
getNetworkProvider(network?: Network): import("../network/NetworkProvider.js").default;
|
|
41
|
-
/**
|
|
42
|
-
* getTokenDepositAddress - get a cashtoken aware wallet deposit address
|
|
43
|
-
*
|
|
44
|
-
* @returns The cashtoken aware deposit address as a string
|
|
45
|
-
*/
|
|
46
|
-
getTokenDepositAddress(): string;
|
|
47
|
-
/**
|
|
48
|
-
* getDepositQr - get an address qrcode, encoded for display on the web
|
|
49
|
-
*
|
|
50
|
-
* @returns The qrcode for the token aware address
|
|
51
|
-
*/
|
|
52
|
-
getTokenDepositQr(): ImageI;
|
|
53
|
-
/**
|
|
54
|
-
* explorerUrl Web url to a transaction on a block explorer
|
|
55
|
-
*
|
|
56
|
-
* @param txId transaction Id
|
|
57
|
-
* @returns Url string
|
|
58
|
-
*/
|
|
59
|
-
explorerUrl(txId: string): string;
|
|
28
|
+
getSeed(): MnemonicI;
|
|
60
29
|
getInfo(): WalletInfoI;
|
|
61
30
|
getPublicKey(hex?: boolean): string | Uint8Array;
|
|
62
31
|
getPublicKeyCompressed(hex?: boolean): string | Uint8Array;
|
|
63
|
-
getPublicKeyHash(hex?: boolean): string | Uint8Array;
|
|
64
32
|
constructor(name?: string, network?: NetworkType, walletType?: WalletTypeEnum);
|
|
33
|
+
/**
|
|
34
|
+
* fromId - create a wallet from encoded walletId string
|
|
35
|
+
*
|
|
36
|
+
* @param walletId walletId options to steer the creation process
|
|
37
|
+
*
|
|
38
|
+
* @returns wallet instantiated accordingly to the walletId rules
|
|
39
|
+
*/
|
|
40
|
+
static fromId<T extends typeof Wallet>(this: T, walletId: string): Promise<InstanceType<T>>;
|
|
65
41
|
/**
|
|
66
42
|
* fromWIF - create a wallet using the private key supplied in `Wallet Import Format`
|
|
67
43
|
*
|
|
@@ -71,27 +47,28 @@ export declare class Wallet extends BaseWallet {
|
|
|
71
47
|
*/
|
|
72
48
|
static fromWIF<T extends typeof Wallet>(this: T, wif: string): Promise<InstanceType<T>>;
|
|
73
49
|
/**
|
|
74
|
-
*
|
|
50
|
+
* fromSeed - create a wallet using the seed phrase and derivation path
|
|
75
51
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
52
|
+
* unless specified the derivation path m/44'/245'/0'/0/0 will be userd
|
|
53
|
+
* this derivation path is standard for Electron Cash SLP and other SLP enabled wallets
|
|
78
54
|
*
|
|
79
|
-
* @param
|
|
55
|
+
* @param seed BIP39 12 word seed phrase
|
|
56
|
+
* @param derivationPath BIP44 HD wallet derivation path to get a single the private key from hierarchy
|
|
80
57
|
*
|
|
81
58
|
* @returns instantiated wallet
|
|
82
59
|
*/
|
|
83
|
-
static
|
|
60
|
+
static fromSeed<T extends typeof Wallet>(this: T, seed: string, derivationPath?: string): Promise<InstanceType<T>>;
|
|
84
61
|
/**
|
|
85
|
-
*
|
|
62
|
+
* newRandom - create a random wallet
|
|
86
63
|
*
|
|
87
|
-
*
|
|
88
|
-
* however it still allows to use many utility functions such as getting and watching balance, etc.
|
|
64
|
+
* if `name` parameter is specified, the wallet will also be persisted to DB
|
|
89
65
|
*
|
|
90
|
-
* @param
|
|
66
|
+
* @param name user friendly wallet alias
|
|
67
|
+
* @param dbName name under which the wallet will be stored in the database
|
|
91
68
|
*
|
|
92
69
|
* @returns instantiated wallet
|
|
93
70
|
*/
|
|
94
|
-
static
|
|
71
|
+
static newRandom<T extends typeof Wallet>(this: T, name?: string, dbName?: string): Promise<InstanceType<T>>;
|
|
95
72
|
protected generate(): Promise<this>;
|
|
96
73
|
private _generateWif;
|
|
97
74
|
private _generateMnemonic;
|
|
@@ -99,46 +76,25 @@ export declare class Wallet extends BaseWallet {
|
|
|
99
76
|
getXPubKeys(paths?: any): Promise<any[]>;
|
|
100
77
|
protected fromSeed(mnemonic: string, derivationPath?: string): Promise<this>;
|
|
101
78
|
deriveHdPaths(hdPaths: string[]): Promise<any[]>;
|
|
102
|
-
protected watchOnly(address: string): Promise<this>;
|
|
103
79
|
protected fromWIF(secret: string): Promise<this>;
|
|
80
|
+
/**
|
|
81
|
+
* newRandom (internal) if the wallet is named, get or create it; otherwise create a random
|
|
82
|
+
* unnamed wallet
|
|
83
|
+
* @param {string} name name of the wallet
|
|
84
|
+
* @param {string} dbName database name the wallet is stored in
|
|
85
|
+
*/
|
|
104
86
|
protected newRandom(name: string, dbName?: string): Promise<this>;
|
|
105
|
-
protected named(name: string, dbName?: string, forceNew?: boolean): Promise<this>;
|
|
106
|
-
protected replaceNamed(name: string, walletId: string, dbName?: string): Promise<this>;
|
|
107
|
-
protected namedExists(name: string, dbName?: string): Promise<boolean>;
|
|
108
87
|
toString(): string;
|
|
109
|
-
toDbString(): string;
|
|
110
|
-
getAddressUtxos(address?: string): Promise<UtxoI[]>;
|
|
111
88
|
/**
|
|
112
|
-
*
|
|
89
|
+
* toDbString - store the serialized version of the wallet in the database, not just the name
|
|
113
90
|
*
|
|
91
|
+
* @throws {Error} if called on BaseWallet
|
|
114
92
|
*/
|
|
115
|
-
|
|
116
|
-
getBalance(rawUnit?: string, priceCache?: boolean): Promise<BalanceResponse | number>;
|
|
117
|
-
getBalanceFromUtxos(): Promise<number>;
|
|
118
|
-
getBalanceFromProvider(): Promise<number>;
|
|
119
|
-
watchAddress(callback: (txHash: string) => void): CancelWatchFn;
|
|
120
|
-
watchAddressTransactions(callback: (tx: ElectrumRawTransaction) => void): CancelWatchFn;
|
|
121
|
-
watchAddressTokenTransactions(callback: (tx: ElectrumRawTransaction) => void): CancelWatchFn;
|
|
122
|
-
watchBalance(callback: (balance: BalanceResponse) => void): CancelWatchFn;
|
|
123
|
-
watchBalanceUsd(callback: (balance: BalanceResponse) => void, usdPriceRefreshInterval?: number): CancelWatchFn;
|
|
124
|
-
waitForBalance(value: number, rawUnit?: UnitEnum): Promise<BalanceResponse>;
|
|
125
|
-
watchTokenBalance(tokenId: string, callback: (balance: bigint) => void): CancelWatchFn;
|
|
126
|
-
waitForTokenBalance(tokenId: string, amount: bigint): Promise<bigint>;
|
|
127
|
-
getTokenInfo(tokenId: string): Promise<IdentitySnapshot | undefined>;
|
|
128
|
-
private _getMaxAmountToSend;
|
|
93
|
+
toDbString(): string;
|
|
129
94
|
getMaxAmountToSend(params?: {
|
|
130
95
|
outputCount?: number;
|
|
131
96
|
options?: SendRequestOptionsI;
|
|
132
97
|
}): Promise<BalanceResponse>;
|
|
133
|
-
/**
|
|
134
|
-
* send Send some amount to an address
|
|
135
|
-
* this function processes the send requests, encodes the transaction, sends it to the network
|
|
136
|
-
* @returns (depending on the options parameter) the transaction id, new address balance and a link to the transaction on the blockchain explorer
|
|
137
|
-
*
|
|
138
|
-
* This is a first class function with REST analog, maintainers should strive to keep backward-compatibility
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
141
|
-
send(requests: SendRequest | TokenSendRequest | OpReturnData | Array<SendRequest | TokenSendRequest | OpReturnData> | SendRequestArray[], options?: SendRequestOptionsI): Promise<SendResponse>;
|
|
142
98
|
/**
|
|
143
99
|
* sendMax Send all available funds to a destination cash address
|
|
144
100
|
*
|
|
@@ -148,149 +104,20 @@ export declare class Wallet extends BaseWallet {
|
|
|
148
104
|
* @returns (depending on the options parameter) the transaction id, new address balance and a link to the transaction on the blockchain explorer
|
|
149
105
|
*/
|
|
150
106
|
sendMax(cashaddr: string, options?: SendRequestOptionsI): Promise<SendResponse>;
|
|
151
|
-
/**
|
|
152
|
-
* sendMaxRaw (internal) Send all available funds to a destination cash address
|
|
153
|
-
*
|
|
154
|
-
* @param {string} cashaddr destination cash address
|
|
155
|
-
* @param {SendRequestOptionsI} options Options of the send requests
|
|
156
|
-
*
|
|
157
|
-
* @returns the transaction id sent to the network
|
|
158
|
-
*/
|
|
159
|
-
private sendMaxRaw;
|
|
160
107
|
/**
|
|
161
108
|
* encodeTransaction Encode and sign a transaction given a list of sendRequests, options and estimate fees.
|
|
162
109
|
* @param {SendRequest[]} sendRequests SendRequests
|
|
163
110
|
* @param {boolean} discardChange=false
|
|
164
111
|
* @param {SendRequestOptionsI} options Options of the send requests
|
|
165
112
|
*/
|
|
166
|
-
encodeTransaction(requests: SendRequest | TokenSendRequest | OpReturnData | Array<SendRequest | TokenSendRequest | OpReturnData> | SendRequestArray[], discardChange?: boolean, options?: SendRequestOptionsI): Promise<{
|
|
113
|
+
encodeTransaction(requests: SendRequest | TokenSendRequest | OpReturnData | Array<SendRequest | TokenSendRequest | OpReturnData> | SendRequestArray[], discardChange?: boolean, options?: SendRequestOptionsI, privateKey?: Uint8Array): Promise<{
|
|
167
114
|
encodedTransaction: Uint8Array;
|
|
168
115
|
tokenIds: string[];
|
|
169
116
|
sourceOutputs: any[];
|
|
170
117
|
}>;
|
|
171
118
|
signUnsignedTransaction(transaction: Uint8Array | string, sourceOutputs: SourceOutput[]): Promise<Uint8Array>;
|
|
172
|
-
submitTransaction(transaction: Uint8Array, awaitPropagation?: boolean): Promise<string>;
|
|
173
|
-
getRawHistory(fromHeight?: number, toHeight?: number): Promise<TxI[]>;
|
|
174
|
-
/**
|
|
175
|
-
* getHistory gets transaction history of this wallet with most data decoded and ready to present to user
|
|
176
|
-
* @note balance calculations are valid only if querying to the blockchain tip (`toHeight` === -1, `count` === -1)
|
|
177
|
-
* @note this method is heavy on network calls, if invoked in browser use of cache is advised, @see `Config.UseLocalStorageCache`
|
|
178
|
-
* @note this method tries to recreate the history tab view of Electron Cash wallet, however, it may not be 100% accurate if the tnransaction value changes are the same in the same block (ordering)
|
|
179
|
-
*
|
|
180
|
-
* @param unit optional, BCH or currency unit to present balance and balance changes. If unit is currency like USD or EUR, balances will be subject to possible rounding errors. Default 0
|
|
181
|
-
* @param fromHeight optional, if set, history will be limited. Default 0
|
|
182
|
-
* @param toHeight optional, if set, history will be limited. Default -1, meaning that all history items will be returned, including mempool
|
|
183
|
-
* @param start optional, if set, the result set will be paginated with offset `start`
|
|
184
|
-
* @param count optional, if set, the result set will be paginated with `count`. Default -1, meaning that all history items will be returned
|
|
185
|
-
*
|
|
186
|
-
* @returns an array of transaction history items, with input values and addresses encoded in cashaddress format. @see `TransactionHistoryItem` type
|
|
187
|
-
*/
|
|
188
|
-
getHistory({ unit, fromHeight, toHeight, start, count, }: {
|
|
189
|
-
unit?: UnitEnum;
|
|
190
|
-
fromHeight?: number;
|
|
191
|
-
toHeight?: number;
|
|
192
|
-
start?: number;
|
|
193
|
-
count?: number;
|
|
194
|
-
}): Promise<TransactionHistoryItem[]>;
|
|
195
|
-
getLastTransaction(confirmedOnly?: boolean): Promise<ElectrumRawTransaction | null>;
|
|
196
|
-
waitForTransaction(options?: WaitForTransactionOptions): Promise<WaitForTransactionResponse>;
|
|
197
|
-
/**
|
|
198
|
-
* watchBlocks Watch network blocks
|
|
199
|
-
*
|
|
200
|
-
* @param callback callback with a block header object
|
|
201
|
-
* @param skipCurrentHeight if set, the notification about current block will not arrive
|
|
202
|
-
*
|
|
203
|
-
* @returns a function which will cancel watching upon evaluation
|
|
204
|
-
*/
|
|
205
|
-
watchBlocks(callback: (header: HexHeaderI) => void, skipCurrentHeight?: boolean): CancelWatchFn;
|
|
206
|
-
/**
|
|
207
|
-
* waitForBlock Wait for a network block
|
|
208
|
-
*
|
|
209
|
-
* @param height if specified waits for this exact blockchain height, otherwise resolves with the next block
|
|
210
|
-
*
|
|
211
|
-
*/
|
|
212
|
-
waitForBlock(height?: number): Promise<HexHeaderI>;
|
|
213
119
|
private deriveInfo;
|
|
214
120
|
sign(message: string): Promise<import("../message/interface.js").SignedMessageResponseI>;
|
|
215
|
-
verify(message: string, sig: string, publicKey?: Uint8Array): Promise<import("../message/interface.js").VerifyMessageResponseI>;
|
|
216
|
-
/**
|
|
217
|
-
* Create new cashtoken, both funglible and/or non-fungible (NFT)
|
|
218
|
-
* Refer to spec https://github.com/bitjson/cashtokens
|
|
219
|
-
* @param {number} genesisRequest.amount amount of *fungible* tokens to create
|
|
220
|
-
* @param {NFTCapability?} genesisRequest.capability capability of new NFT
|
|
221
|
-
* @param {string?} genesisRequest.commitment NFT commitment message
|
|
222
|
-
* @param {string?} genesisRequest.cashaddr cash address to send the created token UTXO to; if undefined will default to your address
|
|
223
|
-
* @param {number?} genesisRequest.value satoshi value to send alongside with tokens; if undefined will default to 1000 satoshi
|
|
224
|
-
* @param {SendRequestType | SendRequestType[]} sendRequests single or an array of extra send requests (OP_RETURN, value transfer, etc.) to include in genesis transaction
|
|
225
|
-
* @param {SendRequestOptionsI} options Options of the send requests
|
|
226
|
-
*/
|
|
227
|
-
tokenGenesis(genesisRequest: TokenGenesisRequest, sendRequests?: SendRequestType | SendRequestType[], options?: SendRequestOptionsI): Promise<SendResponse>;
|
|
228
|
-
/**
|
|
229
|
-
* Mint new NFT cashtokens using an existing minting token
|
|
230
|
-
* Refer to spec https://github.com/bitjson/cashtokens
|
|
231
|
-
* @param {string} tokenId tokenId of an NFT to mint
|
|
232
|
-
* @param {TokenMintRequest | TokenMintRequest[]} mintRequests mint requests with new token properties and recipients
|
|
233
|
-
* @param {NFTCapability?} mintRequest.capability capability of new NFT
|
|
234
|
-
* @param {string?} mintRequest.commitment NFT commitment message
|
|
235
|
-
* @param {string?} mintRequest.cashaddr cash address to send the created token UTXO to; if undefined will default to your address
|
|
236
|
-
* @param {number?} mintRequest.value satoshi value to send alongside with tokens; if undefined will default to 1000 satoshi
|
|
237
|
-
* @param {boolean?} deductTokenAmount if minting token contains fungible amount, deduct from it by amount of minted tokens
|
|
238
|
-
* @param {SendRequestOptionsI} options Options of the send requests
|
|
239
|
-
*/
|
|
240
|
-
tokenMint(tokenId: string, mintRequests: TokenMintRequest | Array<TokenMintRequest>, deductTokenAmount?: boolean, options?: SendRequestOptionsI): Promise<SendResponse>;
|
|
241
|
-
/**
|
|
242
|
-
* Perform an explicit token burning by spending a token utxo to an OP_RETURN
|
|
243
|
-
*
|
|
244
|
-
* Behaves differently for fungible and non-fungible tokens:
|
|
245
|
-
* * NFTs are always "destroyed"
|
|
246
|
-
* * FTs' amount is reduced by the amount specified, if 0 FT amount is left and no NFT present, the token is "destroyed"
|
|
247
|
-
*
|
|
248
|
-
* Refer to spec https://github.com/bitjson/cashtokens
|
|
249
|
-
* @param {string} burnRequest.tokenId tokenId of a token to burn
|
|
250
|
-
* @param {NFTCapability} burnRequest.capability capability of the NFT token to select, optional
|
|
251
|
-
* @param {string?} burnRequest.commitment commitment of the NFT token to select, optional
|
|
252
|
-
* @param {number?} burnRequest.amount amount of fungible tokens to burn, optional
|
|
253
|
-
* @param {string?} burnRequest.cashaddr address to return token and satoshi change to
|
|
254
|
-
* @param {string?} message optional message to include in OP_RETURN
|
|
255
|
-
* @param {SendRequestOptionsI} options Options of the send requests
|
|
256
|
-
*/
|
|
257
|
-
tokenBurn(burnRequest: TokenBurnRequest, message?: string, options?: SendRequestOptionsI): Promise<SendResponse>;
|
|
258
|
-
/**
|
|
259
|
-
* getTokenUtxos Get unspent token outputs for the wallet
|
|
260
|
-
* will return utxos only for the specified token if `tokenId` provided
|
|
261
|
-
* @param {string?} tokenId tokenId (category) to filter utxos by, if not set will return utxos from all tokens
|
|
262
|
-
* @returns {UtxoI[]} token utxos
|
|
263
|
-
*/
|
|
264
|
-
getTokenUtxos(tokenId?: string): Promise<UtxoI[]>;
|
|
265
|
-
/**
|
|
266
|
-
* getTokenBalance Gets fungible token balance
|
|
267
|
-
* for NFT token balance see @ref getNftTokenBalance
|
|
268
|
-
* @param {string} tokenId tokenId to get balance for
|
|
269
|
-
* @returns {bigint} fungible token balance
|
|
270
|
-
*/
|
|
271
|
-
getTokenBalance(tokenId: string): Promise<bigint>;
|
|
272
|
-
/**
|
|
273
|
-
* getNftTokenBalance Gets non-fungible token (NFT) balance for a particular tokenId
|
|
274
|
-
* disregards fungible token balances
|
|
275
|
-
* for fungible token balance see @ref getTokenBalance
|
|
276
|
-
* @param {string} tokenId tokenId to get balance for
|
|
277
|
-
* @returns {number} non-fungible token balance
|
|
278
|
-
*/
|
|
279
|
-
getNftTokenBalance(tokenId: string): Promise<number>;
|
|
280
|
-
/**
|
|
281
|
-
* getAllTokenBalances Gets all fungible token balances in this wallet
|
|
282
|
-
* @returns {Object} a map [tokenId => balance] for all tokens in this wallet
|
|
283
|
-
*/
|
|
284
|
-
getAllTokenBalances(): Promise<{
|
|
285
|
-
[tokenId: string]: bigint;
|
|
286
|
-
}>;
|
|
287
|
-
/**
|
|
288
|
-
* getAllNftTokenBalances Gets all non-fungible token (NFT) balances in this wallet
|
|
289
|
-
* @returns {Object} a map [tokenId => balance] for all NFTs in this wallet
|
|
290
|
-
*/
|
|
291
|
-
getAllNftTokenBalances(): Promise<{
|
|
292
|
-
[tokenId: string]: number;
|
|
293
|
-
}>;
|
|
294
121
|
}
|
|
295
122
|
/**
|
|
296
123
|
* Class to manage a testnet wallet.
|
|
@@ -299,7 +126,6 @@ export declare class TestNetWallet extends Wallet {
|
|
|
299
126
|
static networkPrefix: CashAddressNetworkPrefix;
|
|
300
127
|
static faucetServer: string;
|
|
301
128
|
constructor(name?: string);
|
|
302
|
-
static get util(): typeof TestNetUtil;
|
|
303
129
|
}
|
|
304
130
|
/**
|
|
305
131
|
* Class to manage a regtest wallet.
|
|
@@ -307,7 +133,6 @@ export declare class TestNetWallet extends Wallet {
|
|
|
307
133
|
export declare class RegTestWallet extends Wallet {
|
|
308
134
|
static networkPrefix: CashAddressNetworkPrefix;
|
|
309
135
|
constructor(name?: string);
|
|
310
|
-
static get util(): typeof RegTestUtil;
|
|
311
136
|
}
|
|
312
137
|
/**
|
|
313
138
|
* Class to manage a bitcoin cash wif wallet.
|
|
@@ -316,7 +141,6 @@ export declare class WifWallet extends Wallet {
|
|
|
316
141
|
static networkPrefix: CashAddressNetworkPrefix;
|
|
317
142
|
static walletType: WalletTypeEnum;
|
|
318
143
|
constructor(name?: string);
|
|
319
|
-
static get util(): typeof WifUtil;
|
|
320
144
|
}
|
|
321
145
|
/**
|
|
322
146
|
* Class to manage a testnet wif wallet.
|
|
@@ -325,7 +149,6 @@ export declare class TestNetWifWallet extends Wallet {
|
|
|
325
149
|
static networkPrefix: CashAddressNetworkPrefix;
|
|
326
150
|
static walletType: WalletTypeEnum;
|
|
327
151
|
constructor(name?: string);
|
|
328
|
-
static get util(): typeof TestNetWifUtil;
|
|
329
152
|
}
|
|
330
153
|
/**
|
|
331
154
|
* Class to manage a regtest wif wallet.
|
|
@@ -334,33 +157,5 @@ export declare class RegTestWifWallet extends Wallet {
|
|
|
334
157
|
static networkPrefix: CashAddressNetworkPrefix;
|
|
335
158
|
static walletType: WalletTypeEnum;
|
|
336
159
|
constructor(name?: string);
|
|
337
|
-
static get util(): typeof RegTestWifUtil;
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Class to manage a bitcoin cash watch wallet.
|
|
341
|
-
*/
|
|
342
|
-
export declare class WatchWallet extends Wallet {
|
|
343
|
-
static networkPrefix: CashAddressNetworkPrefix;
|
|
344
|
-
static walletType: WalletTypeEnum;
|
|
345
|
-
constructor(name?: string);
|
|
346
|
-
static get util(): typeof WatchUtil;
|
|
347
|
-
}
|
|
348
|
-
/**
|
|
349
|
-
* Class to manage a testnet watch wallet.
|
|
350
|
-
*/
|
|
351
|
-
export declare class TestNetWatchWallet extends Wallet {
|
|
352
|
-
static networkPrefix: CashAddressNetworkPrefix;
|
|
353
|
-
static walletType: WalletTypeEnum;
|
|
354
|
-
constructor(name?: string);
|
|
355
|
-
static get util(): typeof TestNetWatchUtil;
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Class to manage a regtest watch wallet.
|
|
359
|
-
*/
|
|
360
|
-
export declare class RegTestWatchWallet extends Wallet {
|
|
361
|
-
static networkPrefix: CashAddressNetworkPrefix;
|
|
362
|
-
static walletType: WalletTypeEnum;
|
|
363
|
-
constructor(name?: string);
|
|
364
|
-
static get util(): typeof RegTestWatchUtil;
|
|
365
160
|
}
|
|
366
161
|
//# sourceMappingURL=Wif.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wif.d.ts","sourceRoot":"","sources":["../../../src/wallet/Wif.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Wif.d.ts","sourceRoot":"","sources":["../../../src/wallet/Wif.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,wBAAwB,EAOzB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAiB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,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