-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
567 lines (565 loc) · 26 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
/**
* Represents a coin on the Chia blockchain.
*
* @property {Buffer} parentCoinInfo - Parent coin name/id.
* @property {Buffer} puzzleHash - Puzzle hash.
* @property {BigInt} amount - Coin amount.
*/
export interface Coin {
parentCoinInfo: Buffer
puzzleHash: Buffer
amount: bigint
}
/**
* Represents a full coin state on the Chia blockchain.
*
* @property {Coin} coin - The coin.
* @property {Buffer} spentHeight - The height the coin was spent at, if it was spent.
* @property {Buffer} createdHeight - The height the coin was created at.
*/
export interface CoinState {
coin: Coin
spentHeight?: bigint
createdHeight?: bigint
}
/**
* Represents a coin spend on the Chia blockchain.
*
* @property {Coin} coin - The coin being spent.
* @property {Buffer} puzzleReveal - The puzzle of the coin being spent.
* @property {Buffer} solution - The solution.
*/
export interface CoinSpend {
coin: Coin
puzzleReveal: Buffer
solution: Buffer
}
/**
* Represents a lineage proof that can be used to spend a singleton.
*
* @property {Buffer} parentParentCoinInfo - Parent coin's parent coin info/name/ID.
* @property {Buffer} parentInnerPuzzleHash - Parent coin's inner puzzle hash.
* @property {BigInt} parentAmount - Parent coin's amount.
*/
export interface LineageProof {
parentParentCoinInfo: Buffer
parentInnerPuzzleHash: Buffer
parentAmount: bigint
}
/**
* Represents an eve proof that can be used to spend a singleton. Parent coin is the singleton launcher.
*
* @property {Buffer} parentParentCoinInfo - Parent coin's name.
* @property {BigInt} parentAmount - Parent coin's amount.
*/
export interface EveProof {
parentParentCoinInfo: Buffer
parentAmount: bigint
}
/**
* Represents a proof (either eve or lineage) that can be used to spend a singleton. Use `new_lineage_proof` or `new_eve_proof` to create a new proof.
*
* @property {Option<LineageProof>} lineageProof - The lineage proof, if this is a lineage proof.
* @property {Option<EveProof>} eveProof - The eve proof, if this is an eve proof.
*/
export interface Proof {
lineageProof?: LineageProof
eveProof?: EveProof
}
/**
* Represents a mirror coin with a potentially morphed launcher id.
*
* @property {Coin} coin - The coin.
* @property {Buffer} p2PuzzleHash - The puzzle hash that owns the server coin.
* @property {Array<string>} memoUrls - The memo URLs that serve the data store being mirrored.
*/
export interface ServerCoin {
coin: Coin
p2PuzzleHash: Buffer
memoUrls: Array<string>
}
/**
* Creates a new lineage proof.
*
* @param {LineageProof} lineageProof - The lineage proof.
* @returns {Proof} The new proof.
*/
export declare function newLineageProof(lineageProof: LineageProof): Proof
/**
* Creates a new eve proof.
*
* @param {EveProof} eveProof - The eve proof.
* @returns {Proof} The new proof.
*/
export declare function newEveProof(eveProof: EveProof): Proof
/**
* Represents metadata for a data store.
*
* @property {Buffer} rootHash - Root hash.
* @property {Option<String>} label - Label (optional).
* @property {Option<String>} description - Description (optional).
* @property {Option<BigInt>} bytes - Size of the store in bytes (optional).
*/
export interface DataStoreMetadata {
rootHash: Buffer
label?: string
description?: string
bytes?: bigint
}
/**
* Represents information about a delegated puzzle. Note that this struct can represent all three types of delegated puzzles, but only represents one at a time.
*
* @property {Option<Buffer>} adminInnerPuzzleHash - Admin inner puzzle hash, if this is an admin delegated puzzle.
* @property {Option<Buffer>} writerInnerPuzzleHash - Writer inner puzzle hash, if this is a writer delegated puzzle.
* @property {Option<Buffer>} oraclePaymentPuzzleHash - Oracle payment puzzle hash, if this is an oracle delegated puzzle.
* @property {Option<BigInt>} oracleFee - Oracle fee, if this is an oracle delegated puzzle.
*/
export interface DelegatedPuzzle {
adminInnerPuzzleHash?: Buffer
writerInnerPuzzleHash?: Buffer
oraclePaymentPuzzleHash?: Buffer
oracleFee?: bigint
}
/**
* Represents information about a data store. This information can be used to spend the store. It is recommended that this struct is stored in a database to avoid syncing it every time.
*
* @property {Coin} coin - The coin associated with the data store.
* @property {Buffer} launcherId - The store's launcher/singleton ID.
* @property {Proof} proof - Proof that can be used to spend this store.
* @property {DataStoreMetadata} metadata - This store's metadata.
* @property {Buffer} ownerPuzzleHash - The puzzle hash of the owner puzzle.
* @property {Vec<DelegatedPuzzle>} delegatedPuzzles - This store's delegated puzzles. An empty list usually indicates a 'vanilla' store.
*/
export interface DataStore {
coin: Coin
launcherId: Buffer
proof: Proof
metadata: DataStoreMetadata
ownerPuzzleHash: Buffer
delegatedPuzzles: Array<DelegatedPuzzle>
}
/**
*
* @property {Vec<CoinSpend>} coinSpends - Coin spends that can be used to spend the provided store.
* @property {DataStore} newStore - New data store information after the spend is confirmed.
*/
export interface SuccessResponse {
coinSpends: Array<CoinSpend>
newStore: DataStore
}
/**
* Represents a response from synchronizing a store.
*
* @property {DataStore} latestStore - Latest data store information.
* @property {Option<Vec<Buffer>>} rootHashes - When synced with whistory, this list will contain all of the store's previous root hashes. Otherwise null.
* @property {Option<Vec<BigInt>>} rootHashesTimestamps - Timestamps of the root hashes (see `rootHashes`).
* @property {u32} latestHeight - Latest sync height.
*/
export interface SyncStoreResponse {
latestStore: DataStore
rootHashes?: Array<Buffer>
rootHashesTimestamps?: Array<bigint>
latestHeight: number
}
/**
* Represents a response containing unspent coins.
*
* @property {Vec<Coin>} coins - Unspent coins.
* @property {u32} lastHeight - Last height.
* @property {Buffer} lastHeaderHash - Last header hash.
*/
export interface UnspentCoinsResponse {
coins: Array<Coin>
lastHeight: number
lastHeaderHash: Buffer
}
/**
* Represents a response containing possible launcher ids for datastores.
*
* @property {Vec<Buffer>} launcher_ids - Launcher ids of coins that might be datastores.
* @property {u32} lastHeight - Last height.
* @property {Buffer} lastHeaderHash - Last header hash.
*/
export interface PossibleLaunchersResponse {
launcherIds: Array<Buffer>
lastHeight: number
lastHeaderHash: Buffer
}
/**
* Selects coins using the knapsack algorithm.
*
* @param {Vec<Coin>} allCoins - Array of available coins (coins to select from).
* @param {BigInt} totalAmount - Amount needed for the transaction, including fee.
* @returns {Vec<Coin>} Array of selected coins.
*/
export declare function selectCoins(allCoins: Array<Coin>, totalAmount: bigint): Array<Coin>
/** An output puzzle hash and amount. */
export interface Output {
puzzleHash: Buffer
amount: bigint
memos: Array<Buffer>
}
/**
* Sends XCH to a given set of puzzle hashes.
*
* @param {Buffer} syntheticKey - The synthetic key used by the wallet.
* @param {Vec<Coin>} selectedCoins - Coins to be spent, as retured by `select_coins`.
* @param {Vec<Output>} outputs - The output amounts to create.
* @param {BigInt} fee - The fee to use for the transaction.
*/
export declare function sendXch(syntheticKey: Buffer, selectedCoins: Array<Coin>, outputs: Array<Output>, fee: bigint): Array<CoinSpend>
/**
* Adds an offset to a launcher id to make it deterministically unique from the original.
*
* @param {Buffer} launcherId - The original launcher id.
* @param {BigInt} offset - The offset to add.
*/
export declare function morphLauncherId(launcherId: Buffer, offset: bigint): Buffer
/** The new server coin and coin spends to create it. */
export interface NewServerCoin {
serverCoin: ServerCoin
coinSpends: Array<CoinSpend>
}
/**
* Creates a new mirror coin with the given URLs.
*
* @param {Buffer} syntheticKey - The synthetic key used by the wallet.
* @param {Vec<Coin>} selectedCoins - Coins to be used for minting, as retured by `select_coins`. Note that, besides the fee, 1 mojo will be used to create the mirror coin.
* @param {Buffer} hint - The hint for the mirror coin, usually the original or morphed launcher id.
* @param {Vec<String>} uris - The URIs of the mirrors.
* @param {BigInt} amount - The amount to use for the created coin.
* @param {BigInt} fee - The fee to use for the transaction.
*/
export declare function createServerCoin(syntheticKey: Buffer, selectedCoins: Array<Coin>, hint: Buffer, uris: Array<string>, amount: bigint, fee: bigint): NewServerCoin
/**
* Mints a new datastore.
*
* @param {Buffer} minterSyntheticKey - Minter synthetic key.
* @param {Vec<Coin>} selectedCoins - Coins to be used for minting, as retured by `select_coins`. Note that, besides the fee, 1 mojo will be used to create the new store.
* @param {Buffer} rootHash - Root hash of the store.
* @param {Option<String>} label - Store label (optional).
* @param {Option<String>} description - Store description (optional).
* @param {Option<BigInt>} bytes - Store size in bytes (optional).
* @param {Buffer} ownerPuzzleHash - Owner puzzle hash.
* @param {Vec<DelegatedPuzzle>} delegatedPuzzles - Delegated puzzles.
* @param {BigInt} fee - Fee to use for the transaction. Total amount - 1 - fee will be sent back to the minter.
* @returns {SuccessResponse} The success response, which includes coin spends and information about the new datastore.
*/
export declare function mintStore(minterSyntheticKey: Buffer, selectedCoins: Array<Coin>, rootHash: Buffer, label: string | undefined | null, description: string | undefined | null, bytes: bigint | undefined | null, ownerPuzzleHash: Buffer, delegatedPuzzles: Array<DelegatedPuzzle>, fee: bigint): SuccessResponse
/**
* Spends a store in oracle mode.
*
* @param {Buffer} spenderSyntheticKey - Spender synthetic key.
* @param {Vec<Coin>} selectedCoins - Selected coins, as returned by `select_coins`.
* @param {DataStore} store - Up-to-daye store information.
* @param {BigInt} fee - Transaction fee to use.
* @returns {SuccessResponse} The success response, which includes coin spends and information about the new datastore.
*/
export declare function oracleSpend(spenderSyntheticKey: Buffer, selectedCoins: Array<Coin>, store: DataStore, fee: bigint): SuccessResponse
/**
* Adds a fee to any transaction. Change will be sent to spender.
*
* @param {Buffer} spenderSyntheticKey - Synthetic key of spender.
* @param {Vec<Coin>} selectedCoins - Selected coins, as returned by `select_coins`.
* @param {Vec<Buffer>} assertCoinIds - IDs of coins that need to be spent for the fee to be paid. Usually all coin ids in the original transaction.
* @param {BigInt} fee - Fee to add.
* @returns {Vec<CoinSpend>} The coin spends to be added to the original transaction.
*/
export declare function addFee(spenderSyntheticKey: Buffer, selectedCoins: Array<Coin>, assertCoinIds: Array<Buffer>, fee: bigint): Array<CoinSpend>
/**
* Converts a master public key to a wallet synthetic key.
*
* @param {Buffer} publicKey - Master public key.
* @returns {Buffer} The (first) wallet synthetic key.
*/
export declare function masterPublicKeyToWalletSyntheticKey(publicKey: Buffer): Buffer
/**
* Converts a master public key to the first puzzle hash.
*
* @param {Buffer} publicKey - Master public key.
* @returns {Buffer} The first wallet puzzle hash.
*/
export declare function masterPublicKeyToFirstPuzzleHash(publicKey: Buffer): Buffer
/**
* Converts a master secret key to a wallet synthetic secret key.
*
* @param {Buffer} secretKey - Master secret key.
* @returns {Buffer} The (first) wallet synthetic secret key.
*/
export declare function masterSecretKeyToWalletSyntheticSecretKey(secretKey: Buffer): Buffer
/**
* Converts a secret key to its corresponding public key.
*
* @param {Buffer} secretKey - The secret key.
* @returns {Buffer} The public key.
*/
export declare function secretKeyToPublicKey(secretKey: Buffer): Buffer
/**
* Converts a puzzle hash to an address by encoding it using bech32m.
*
* @param {Buffer} puzzleHash - The puzzle hash.
* @param {String} prefix - Address prefix (e.g., 'txch').
* @returns {Promise<String>} The converted address.
*/
export declare function puzzleHashToAddress(puzzleHash: Buffer, prefix: string): string
/**
* Converts an address to a puzzle hash using bech32m.
*
* @param {String} address - The address.
* @returns {Promise<Buffer>} The puzzle hash.
*/
export declare function addressToPuzzleHash(address: string): Buffer
/**
* Creates an admin delegated puzzle for a given key.
*
* @param {Buffer} syntheticKey - Synthetic key.
* @returns {Promise<DelegatedPuzzle>} The delegated puzzle.
*/
export declare function adminDelegatedPuzzleFromKey(syntheticKey: Buffer): DelegatedPuzzle
/**
* Creates a writer delegated puzzle from a given key.
*
* @param {Buffer} syntheticKey - Synthetic key.
* /// @returns {Promise<DelegatedPuzzle>} The delegated puzzle.
*/
export declare function writerDelegatedPuzzleFromKey(syntheticKey: Buffer): DelegatedPuzzle
/**
*
* @param {Buffer} oraclePuzzleHash - The oracle puzzle hash (corresponding to the wallet where fees should be paid).
* @param {BigInt} oracleFee - The oracle fee (i.e., XCH amount to be paid for every oracle spend). This amount MUST be even.
* @returns {Promise<DelegatedPuzzle>} The delegated puzzle.
*/
export declare function oracleDelegatedPuzzle(oraclePuzzleHash: Buffer, oracleFee: bigint): DelegatedPuzzle
/**
* Partially or fully signs coin spends using a list of keys.
*
* @param {Vec<CoinSpend>} coinSpends - The coin spends to sign.
* @param {Vec<Buffer>} privateKeys - The private/secret keys to be used for signing.
* @param {Buffer} forTestnet - Set to true to sign spends for testnet11, false for mainnet.
* @returns {Promise<Buffer>} The signature.
*/
export declare function signCoinSpends(coinSpends: Array<CoinSpend>, privateKeys: Array<Buffer>, forTestnet: boolean): Buffer
/**
* Computes the ID (name) of a coin.
*
* @param {Coin} coin - The coin.
* @returns {Buffer} The coin ID.
*/
export declare function getCoinId(coin: Coin): Buffer
/**
* Updates the metadata of a store. Either the owner, admin, or writer public key must be provided.
*
* @param {DataStore} store - Current store information.
* @param {Buffer} newRootHash - New root hash.
* @param {Option<String>} newLabel - New label (optional).
* @param {Option<String>} newDescription - New description (optional).
* @param {Option<BigInt>} newBytes - New size in bytes (optional).
* @param {Option<Buffer>} ownerPublicKey - Owner public key.
* @param {Option<Buffer>} adminPublicKey - Admin public key.
* @param {Option<Buffer>} writerPublicKey - Writer public key.
* @returns {SuccessResponse} The success response, which includes coin spends and information about the new datastore.
*/
export declare function updateStoreMetadata(store: DataStore, newRootHash: Buffer, newLabel?: string | undefined | null, newDescription?: string | undefined | null, newBytes?: bigint | undefined | null, ownerPublicKey?: Buffer | undefined | null, adminPublicKey?: Buffer | undefined | null, writerPublicKey?: Buffer | undefined | null): SuccessResponse
/**
* Updates the ownership of a store. Either the admin or owner public key must be provided.
*
* @param {DataStore} store - Store information.
* @param {Option<Buffer>} newOwnerPuzzleHash - New owner puzzle hash.
* @param {Vec<DelegatedPuzzle>} newDelegatedPuzzles - New delegated puzzles.
* @param {Option<Buffer>} ownerPublicKey - Owner public key.
* @param {Option<Buffer>} adminPublicKey - Admin public key.
* @returns {SuccessResponse} The success response, which includes coin spends and information about the new datastore.
*/
export declare function updateStoreOwnership(store: DataStore, newOwnerPuzzleHash: Buffer | undefined | null, newDelegatedPuzzles: Array<DelegatedPuzzle>, ownerPublicKey?: Buffer | undefined | null, adminPublicKey?: Buffer | undefined | null): SuccessResponse
/**
* Melts a store. The 1 mojo change will be used as a fee.
*
* @param {DataStore} store - Store information.
* @param {Buffer} ownerPublicKey - Owner's public key.
* @returns {Vec<CoinSpend>} The coin spends that the owner can sign to melt the store.
*/
export declare function meltStore(store: DataStore, ownerPublicKey: Buffer): Array<CoinSpend>
/**
* Signs a message using the provided private key.
*
* @param {Buffer} message - Message to sign, as bytes. "Chia Signed Message" will be prepended automatically, as per CHIP-2 - no need to add it before calling this function.
* @param {Buffer} private_key - Private key to sign the message with. No derivation is done.
* @returns {Buffer} The signature.
*/
export declare function signMessage(message: Buffer, privateKey: Buffer): Buffer
/**
* Verifies a signed message using the provided public key.
*
* @param {Buffer} signature - Th signature to be verified.
* @param {Buffer} public_key - Public key corresponding to the private key that was used to sign the message.
* @param {Buffer} message - Message that was signed, as bytes. "Chia Signed Message" will be prepended automatically, as per CHIP-2 - no need to add it before calling this function.
* @returns {Buffer} Boolean - true indicates that the signature is valid, while false indicates that it is not.
*/
export declare function verifySignedMessage(signature: Buffer, publicKey: Buffer, message: Buffer): boolean
/**
* Converts a synthetic key to its corresponding standard puzzle hash.
*
* @param {Buffer} syntheticKey - Synthetic key.
* @returns {Buffer} The standard puzzle (puzzle) hash.
*/
export declare function syntheticKeyToPuzzleHash(syntheticKey: Buffer): Buffer
/**
* Calculates the total cost of a given array of coin spends/
*
* @param {Vec<CoinSpend>} CoinSpend - Coin spends.
* @returns {BigInt} The cost of the coin spends.
*/
export declare function getCost(coinSpends: Array<CoinSpend>): bigint
/**
* Returns the mainnet genesis challenge.
*
* @returns {Buffer} The mainnet genesis challenge.
*/
export declare function getMainnetGenesisChallenge(): Buffer
/**
* Returns the testnet11 genesis challenge.
*
* @returns {Buffer} The testnet11 genesis challenge.
*/
export declare function getTestnet11GenesisChallenge(): Buffer
export declare class Tls {
/**
* Creates a new TLS connector.
*
* @param {String} certPath - Path to the certificate file (usually '~/.chia/mainnet/config/ssl/wallet/wallet_node.crt').
* @param {String} keyPath - Path to the key file (usually '~/.chia/mainnet/config/ssl/wallet/wallet_node.key').
*/
constructor(certPath: string, keyPath: string)
}
export declare class Peer {
/**
* Creates a new Peer instance.
*
* @param {String} nodeUri - URI of the node (e.g., '127.0.0.1:58444').
* @param {bool} testnet - True for connecting to testnet11, false for mainnet.
* @param {Tls} tls - TLS connector.
* @returns {Promise<Peer>} A new Peer instance.
*/
static new(nodeUri: string, tesntet: boolean, tls: Tls): Promise<Peer>
/**
* Retrieves all coins that are unspent on the chain. Note that coins part of spend bundles that are pending in the mempool will also be included.
*
* @param {Buffer} puzzleHash - Puzzle hash of the wallet.
* @param {Option<u32>} previousHeight - Previous height that was spent. If null, sync will be done from the genesis block.
* @param {Buffer} previousHeaderHash - Header hash corresponding to the previous height. If previousHeight is null, this should be the genesis challenge of the current chain.
* @returns {Promise<UnspentCoinsResponse>} The unspent coins response.
*/
getAllUnspentCoins(puzzleHash: Buffer, previousHeight: number | undefined | null, previousHeaderHash: Buffer): Promise<UnspentCoinsResponse>
/**
* Retrieves all hinted coin states that are unspent on the chain. Note that coins part of spend bundles that are pending in the mempool will also be included.
*
* @param {Buffer} puzzleHash - Puzzle hash to lookup hinted coins for.
* @param {bool} forTestnet - True for testnet, false for mainnet.
* @returns {Promise<Vec<Coin>>} The unspent coins response.
*/
getHintedCoinStates(puzzleHash: Buffer, forTestnet: boolean): Promise<Array<CoinState>>
/**
* Fetches the server coin from a given coin state.
*
* @param {CoinState} coinState - The coin state.
* @param {BigInt} maxCost - The maximum cost to use when parsing the coin. For example, `11_000_000_000`.
* @returns {Promise<ServerCoin>} The server coin.
*/
fetchServerCoin(coinState: CoinState, maxCost: bigint): Promise<ServerCoin>
/**
* Synchronizes a datastore.
*
* @param {DataStore} store - Data store.
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} lastHeaderHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @param {bool} withHistory - Whether to return the root hash history of the store.
* @returns {Promise<SyncStoreResponse>} The sync store response.
*/
syncStore(store: DataStore, lastHeight: number | undefined | null, lastHeaderHash: Buffer, withHistory: boolean): Promise<SyncStoreResponse>
/**
* Synchronizes a store using its launcher ID.
*
* @param {Buffer} launcherId - The store's launcher/singleton ID.
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} lastHeaderHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @param {bool} withHistory - Whether to return the root hash history of the store.
* @returns {Promise<SyncStoreResponse>} The sync store response.
*/
syncStoreFromLauncherId(launcherId: Buffer, lastHeight: number | undefined | null, lastHeaderHash: Buffer, withHistory: boolean): Promise<SyncStoreResponse>
/**
* Fetch a store's creation height.
*
* @param {Buffer} launcherId - The store's launcher/singleton ID.
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} lastHeaderHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @returns {Promise<BigInt>} The store's creation height.
*/
getStoreCreationHeight(launcherId: Buffer, lastHeight: number | undefined | null, lastHeaderHash: Buffer): Promise<bigint>
/**
* Broadcasts a spend bundle to the mempool.
*
* @param {Vec<CoinSpend>} coinSpends - The coin spends to be included in the bundle.
* @param {Vec<Buffer>} sigs - The signatures to be aggregated and included in the bundle.
* @returns {Promise<String>} The broadcast error. If '', the broadcast was successful.
*/
broadcastSpend(coinSpends: Array<CoinSpend>, sigs: Array<Buffer>): Promise<string>
/**
* Checks if a coin is spent on-chain.
*
* @param {Buffer} coinId - The coin ID.
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @returns {Promise<bool>} Whether the coin is spent on-chain.
*/
isCoinSpent(coinId: Buffer, lastHeight: number | undefined | null, headerHash: Buffer): Promise<boolean>
/**
* Retrieves the current header hash corresponding to a given height.
*
* @param {u32} height - The height.
* @returns {Promise<Buffer>} The header hash.
*/
getHeaderHash(height: number): Promise<Buffer>
/**
* Retrieves the fee estimate for a given target time.
*
* @param {Peer} peer - The peer connection to the Chia node.
* @param {BigInt} targetTimeSeconds - Time delta: The target time in seconds from the current time for the fee estimate.
* @returns {Promise<BigInt>} The estimated fee in mojos per CLVM cost.
*/
getFeeEstimate(targetTimeSeconds: bigint): Promise<bigint>
/**
* Retrieves the peer's peak.
*
* @returns {Option<u32>} A tuple consiting of the latest synced block's height, as reported by the peer. Null if the peer has not yet reported a peak.
*/
getPeak(): Promise<number | null>
/**
* Spends the mirror coins to make them unusable in the future.
*
* @param {Buffer} syntheticKey - The synthetic key used by the wallet.
* @param {Vec<Coin>} selectedCoins - Coins to be used for minting, as retured by `select_coins`. Note that the server coins will count towards the fee.
* @param {BigInt} fee - The fee to use for the transaction.
* @param {bool} forTestnet - True for testnet, false for mainnet.
*/
lookupAndSpendServerCoins(syntheticKey: Buffer, selectedCoins: Array<Coin>, fee: bigint, forTestnet: boolean): Promise<Array<CoinSpend>>
/**
* Looks up possible datastore launchers by searching for singleton launchers created with a DL-specific hint.
*
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @returns {Promise<PossibleLaunchersResponse>} Possible launcher ids for datastores, as well as a height + header hash combo to use for the next call.
*/
lookUpPossibleLaunchers(lastHeight: number | undefined | null, headerHash: Buffer): Promise<PossibleLaunchersResponse>
/**
* Waits for a coin to be spent on-chain.
*
* @param {Buffer} coin_id - Id of coin to track.
* @param {Option<u32>} lastHeight - Min. height to search records from. If null, sync will be done from the genesis block.
* @param {Buffer} headerHash - Header hash corresponding to `lastHeight`. If null, this should be the genesis challenge of the current chain.
* @returns {Promise<Buffer>} Promise that resolves when the coin is spent (returning the coin id).
*/
waitForCoinToBeSpent(coinId: Buffer, lastHeight: number | undefined | null, headerHash: Buffer): Promise<Buffer>
}