@ibearua/bitmask-core-dev 1.0.0-beta.10 → 1.0.0-beta.12
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/bitcoin.d.ts +140 -0
- package/bitcoin.js +154 -0
- package/bitcoin.ts +317 -0
- package/bitmask_core.js +4 -4
- package/bitmask_core_bg.wasm +0 -0
- package/bp.d.ts +28 -0
- package/bp.js +51 -0
- package/bp.ts +72 -0
- package/carbonado.d.ts +12 -0
- package/carbonado.js +52 -0
- package/carbonado.ts +34 -0
- package/constants.d.ts +16 -0
- package/constants.js +133 -0
- package/constants.ts +112 -0
- package/index.d.ts +30 -0
- package/index.js +56 -0
- package/index.ts +33 -0
- package/lightning.d.ts +101 -0
- package/lightning.js +56 -0
- package/lightning.ts +165 -0
- package/nostr.d.ts +6 -0
- package/nostr.js +42 -0
- package/nostr.ts +19 -0
- package/package.json +29 -2
- package/rgb.d.ts +363 -0
- package/rgb.js +120 -0
- package/rgb.ts +710 -0
- package/wallet.d.ts +9 -0
- package/wallet.js +51 -0
- package/wallet.ts +46 -0
package/rgb.ts
ADDED
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
// Methods meant to work with RGB contracts defined within the web::rgb module from bitmask-core:
|
|
2
|
+
// https://github.com/diba-io/bitmask-core/blob/development/src/web.rs
|
|
3
|
+
|
|
4
|
+
import * as BMC from "./bitmask_core";
|
|
5
|
+
|
|
6
|
+
export const getVersion = (): string => JSON.parse(BMC.get_rgb_version());
|
|
7
|
+
|
|
8
|
+
export const getContract = async (
|
|
9
|
+
nostrHexSk: string,
|
|
10
|
+
request: string
|
|
11
|
+
): Promise<ContractResponse> =>
|
|
12
|
+
JSON.parse(await BMC.get_contract(nostrHexSk, request));
|
|
13
|
+
|
|
14
|
+
export const listContracts = async (
|
|
15
|
+
nostrHexSk: string,
|
|
16
|
+
hidden: boolean
|
|
17
|
+
): Promise<ContractResponse[]> =>
|
|
18
|
+
JSON.parse(await BMC.list_contracts(nostrHexSk, hidden));
|
|
19
|
+
|
|
20
|
+
export const importContract = async (
|
|
21
|
+
nostrHexSk: string,
|
|
22
|
+
request: string
|
|
23
|
+
): Promise<ContractResponse> =>
|
|
24
|
+
JSON.parse(await BMC.import_contract(nostrHexSk, request));
|
|
25
|
+
|
|
26
|
+
export const issueContract = async (
|
|
27
|
+
nostrHexSk: string,
|
|
28
|
+
request: IssueRequest
|
|
29
|
+
): Promise<IssueResponse> => JSON.parse(await BMC.issue_contract_proxy(nostrHexSk, request));
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export const createInvoice = async (
|
|
33
|
+
nostrHexSk: string,
|
|
34
|
+
request: RgbInvoiceRequest
|
|
35
|
+
): Promise<RgbInvoiceResponse> => JSON.parse(await BMC.create_rgb_invoice(nostrHexSk, request));
|
|
36
|
+
|
|
37
|
+
export const canCreateTransfer = async (
|
|
38
|
+
nostrHexSk: string,
|
|
39
|
+
request: RgbTransferRequest
|
|
40
|
+
): Promise<RgbValidationResponse> =>
|
|
41
|
+
JSON.parse(await BMC.can_create_transfer_contract(nostrHexSk, request));
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
export const createTransfer = async (
|
|
45
|
+
nostrHexSk: string,
|
|
46
|
+
request: RgbTransferRequest
|
|
47
|
+
): Promise<RgbTransferResponse> => JSON.parse(await BMC.create_rgb_transfer(nostrHexSk, request));
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export const createAndPublishTransfer = async (
|
|
51
|
+
nostrHexSk: string,
|
|
52
|
+
request: RgbTransferRequest,
|
|
53
|
+
secrets: string[]
|
|
54
|
+
): Promise<RgbTransferResponse> => JSON.parse(await BMC.create_and_publish_rgb_transfer(nostrHexSk, request, secrets));
|
|
55
|
+
|
|
56
|
+
export const acceptTransfer = async (
|
|
57
|
+
nostrHexSk: string,
|
|
58
|
+
request: AcceptRequest
|
|
59
|
+
): Promise<AcceptResponse> => JSON.parse(await BMC.accept_transfer(nostrHexSk, request));
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
export const removeInvoice = async (
|
|
63
|
+
nostrHexSk: string,
|
|
64
|
+
request: string
|
|
65
|
+
): Promise<void> => {
|
|
66
|
+
await BMC.remove_rgb_invoice(nostrHexSk, request);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const listInvoices = async (
|
|
70
|
+
nostrHexSk: string,
|
|
71
|
+
): Promise<RgbInvoiceStatusResponse[]> => JSON.parse(await BMC.list_rgb_invoices(nostrHexSk));
|
|
72
|
+
|
|
73
|
+
export const saveTransfer = async (
|
|
74
|
+
nostrHexSk: string,
|
|
75
|
+
request: SaveTransferRequest
|
|
76
|
+
): Promise<RgbTransferItem> => JSON.parse(await BMC.save_transfer(nostrHexSk, request));
|
|
77
|
+
|
|
78
|
+
export const listTransfers = async (
|
|
79
|
+
nostrHexSk: string,
|
|
80
|
+
): Promise<RgbTransferItem[]> => JSON.parse(await BMC.list_transfers(nostrHexSk));
|
|
81
|
+
|
|
82
|
+
export const verifyTransfers = async (
|
|
83
|
+
nostrHexSk: string
|
|
84
|
+
): Promise<RgbTransferItem[]> =>
|
|
85
|
+
JSON.parse(await BMC.verify_transfers(nostrHexSk));
|
|
86
|
+
|
|
87
|
+
export const listOffers = async (
|
|
88
|
+
nostrHexSk: string,
|
|
89
|
+
): Promise<RgbOfferResponse[]> => JSON.parse(await BMC.list_offers(nostrHexSk));
|
|
90
|
+
|
|
91
|
+
export const offers = async (
|
|
92
|
+
nostrHexSk: string,
|
|
93
|
+
): Promise<RgbOfferResponse[]> => JSON.parse(await BMC.offers(nostrHexSk));
|
|
94
|
+
|
|
95
|
+
export const bids = async (
|
|
96
|
+
nostrHexSk: string,
|
|
97
|
+
): Promise<WatcherWalletResponse> => JSON.parse(await BMC.bids(nostrHexSk));
|
|
98
|
+
|
|
99
|
+
export const offerSwapSuppl = async (
|
|
100
|
+
nostrHexSk: string,
|
|
101
|
+
offerId: string,
|
|
102
|
+
): Promise<SwapSupplement> => JSON.parse(await BMC.offer_swap_suppl(nostrHexSk, offerId));
|
|
103
|
+
|
|
104
|
+
export const bidSwapSuppl = async (
|
|
105
|
+
nostrHexSk: string,
|
|
106
|
+
bidId: string,
|
|
107
|
+
): Promise<SwapSupplement> => JSON.parse(await BMC.bid_swap_suppl(nostrHexSk, bidId));
|
|
108
|
+
|
|
109
|
+
export const canCreateOffer = async (
|
|
110
|
+
nostrHexSk: string,
|
|
111
|
+
request: RgbOfferRequest,
|
|
112
|
+
secrets: string[],
|
|
113
|
+
): Promise<RgbValidationResponse> => JSON.parse(await BMC.can_create_offer(nostrHexSk, request, secrets));
|
|
114
|
+
|
|
115
|
+
export const createOffer = async (
|
|
116
|
+
nostrHexSk: string,
|
|
117
|
+
request: RgbOfferRequest,
|
|
118
|
+
secrets: string[],
|
|
119
|
+
): Promise<RgbOfferResponse> => JSON.parse(await BMC.create_offer(nostrHexSk, request, secrets));
|
|
120
|
+
|
|
121
|
+
export const cancelOffer = async (
|
|
122
|
+
nostrHexSk: string,
|
|
123
|
+
request: RgbCancelOffersRequest,
|
|
124
|
+
): Promise<RgbSwapCancelResponse> => JSON.parse(await BMC.cancel_offer(nostrHexSk, request));
|
|
125
|
+
|
|
126
|
+
export const canCreateBid = async (
|
|
127
|
+
nostrHexSk: string,
|
|
128
|
+
request: RgbBidRequest,
|
|
129
|
+
secrets: string[],
|
|
130
|
+
): Promise<RgbValidationResponse> => JSON.parse(await BMC.can_create_bid(nostrHexSk, request, secrets));
|
|
131
|
+
|
|
132
|
+
export const createBid = async (
|
|
133
|
+
nostrHexSk: string,
|
|
134
|
+
request: RgbBidRequest,
|
|
135
|
+
secrets: string[],
|
|
136
|
+
): Promise<RgbBidResponse> => JSON.parse(await BMC.create_bid(nostrHexSk, request, secrets));
|
|
137
|
+
|
|
138
|
+
export const cancelBid = async (
|
|
139
|
+
nostrHexSk: string,
|
|
140
|
+
request: RgbCancelBidsRequest,
|
|
141
|
+
): Promise<RgbSwapCancelResponse> => JSON.parse(await BMC.cancel_bid(nostrHexSk, request));
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
// BITCOIN
|
|
145
|
+
export const backupWallet = async (
|
|
146
|
+
nostrHexSk: string,
|
|
147
|
+
): Promise<boolean> => JSON.parse(await BMC.backup_rgb_data(nostrHexSk));
|
|
148
|
+
|
|
149
|
+
export const restoreWallet = async (
|
|
150
|
+
nostrHexSk: string,
|
|
151
|
+
): Promise<boolean> => JSON.parse(await BMC.restore_rgb_data(nostrHexSk));
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
export const getRgbWallet = async (
|
|
155
|
+
nostrHexSk: string,
|
|
156
|
+
): Promise<WatcherWalletResponse> => JSON.parse(await BMC.get_rgb_wallet(nostrHexSk));
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
export const decodeInvoice = async (
|
|
160
|
+
invoice: string
|
|
161
|
+
): Promise<RgbInvoiceDecoded> => JSON.parse(await BMC.decode_rgb_invoice(invoice));
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
export const psbtPublishFile = async (
|
|
165
|
+
request: PublishPsbtRequest
|
|
166
|
+
): Promise<SignedPsbtResponse> =>
|
|
167
|
+
JSON.parse(await BMC.psbt_publish_file(request));
|
|
168
|
+
|
|
169
|
+
export const psbtSignAndPublishFile = async (
|
|
170
|
+
_nostrHexSk: string,
|
|
171
|
+
request: SignPsbtRequest
|
|
172
|
+
): Promise<PublishedPsbtResponse> =>
|
|
173
|
+
JSON.parse(await BMC.psbt_sign_and_publish_file(request));
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
export const toContractAmountRaw = (
|
|
177
|
+
decimal: string,
|
|
178
|
+
precision: number
|
|
179
|
+
): string => JSON.parse(BMC.convert_contract_amount_raw(decimal, precision));
|
|
180
|
+
|
|
181
|
+
export const toContractAmountStr = (
|
|
182
|
+
amount: bigint,
|
|
183
|
+
precision: number
|
|
184
|
+
): string => JSON.parse(BMC.convert_contract_amount_string(amount, precision));
|
|
185
|
+
|
|
186
|
+
export const toContractAmount = (amount: string): ContractAmount =>
|
|
187
|
+
JSON.parse(BMC.parse_contract_amount(amount));
|
|
188
|
+
|
|
189
|
+
export const toContractPrecision = (
|
|
190
|
+
amount: string,
|
|
191
|
+
precision: number
|
|
192
|
+
): string => JSON.parse(BMC.parse_contract_amount_precision(amount, precision));
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
// Core type interfaces based on structs defined within the bitmask-core Rust crate:
|
|
197
|
+
// https://github.com/diba-io/bitmask-core/blob/development/src/structs.rs
|
|
198
|
+
|
|
199
|
+
export interface RgbContainer {
|
|
200
|
+
rgbStock?: string;
|
|
201
|
+
rgbAccount?: string;
|
|
202
|
+
rgbTransfers?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface IssueRequest {
|
|
206
|
+
/// The ticker of the asset
|
|
207
|
+
ticker: string;
|
|
208
|
+
/// Name of the asset
|
|
209
|
+
name: string;
|
|
210
|
+
/// The name of the iface (ex: RGB20)
|
|
211
|
+
iface: string;
|
|
212
|
+
/// Description of the asset
|
|
213
|
+
description: string;
|
|
214
|
+
/// Amount of the asset
|
|
215
|
+
supply: string;
|
|
216
|
+
/// Precision of the asset
|
|
217
|
+
precision: number;
|
|
218
|
+
/// Seal of the initial owner
|
|
219
|
+
seal: string;
|
|
220
|
+
/// Chain Target
|
|
221
|
+
/// enum ChainTarget {
|
|
222
|
+
/// "bitcoin"
|
|
223
|
+
/// }
|
|
224
|
+
chain: string;
|
|
225
|
+
/// contract metadata (only RGB21/UDA)
|
|
226
|
+
meta?: IssueMedia;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export type ChainFee = {
|
|
230
|
+
value?: bigint;
|
|
231
|
+
feeRate?: number;
|
|
232
|
+
none?: string;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export interface IssueMedia {
|
|
236
|
+
/// Preview of the uda
|
|
237
|
+
preview?: MediaData;
|
|
238
|
+
/// Media of the uda
|
|
239
|
+
media?: MediaData;
|
|
240
|
+
/// Attachments of the uda
|
|
241
|
+
attachments: MediaData[];
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface MediaData {
|
|
245
|
+
/// Mime Type of the media
|
|
246
|
+
type: string;
|
|
247
|
+
/// Source (aka. hyperlink) of the media
|
|
248
|
+
uri: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export type ContractResponse = IssueResponse;
|
|
252
|
+
|
|
253
|
+
export interface IssueResponse {
|
|
254
|
+
/// The contract id
|
|
255
|
+
contractId: string;
|
|
256
|
+
/// The contract interface
|
|
257
|
+
iface: string;
|
|
258
|
+
/// The Issue Utxo
|
|
259
|
+
issueUtxo: string;
|
|
260
|
+
/// The ticker of the asset
|
|
261
|
+
ticker: string;
|
|
262
|
+
/// Name of the asset
|
|
263
|
+
name: string;
|
|
264
|
+
/// creation date (timestamp)
|
|
265
|
+
created: bigint;
|
|
266
|
+
/// Description of the asset
|
|
267
|
+
description: string;
|
|
268
|
+
/// Amount of the asset
|
|
269
|
+
supply: bigint;
|
|
270
|
+
/// Precision of the asset
|
|
271
|
+
precision: number;
|
|
272
|
+
/// Amount of the asset
|
|
273
|
+
balance: ContractValue;
|
|
274
|
+
/// The contract state (multiple formats)
|
|
275
|
+
contract: string;
|
|
276
|
+
/// The contract allocations
|
|
277
|
+
allocations: ContractAllocation[];
|
|
278
|
+
/// attachments and media (only RGB21/UDA)
|
|
279
|
+
meta?: UDAItem;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export type ContractValue = {
|
|
283
|
+
value?: bigint;
|
|
284
|
+
uda?: UDAValue;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export interface UDAValue {
|
|
288
|
+
tokenIndex: number;
|
|
289
|
+
fraction: bigint;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface ContractAllocation {
|
|
293
|
+
/// Anchored UTXO
|
|
294
|
+
utxo: string;
|
|
295
|
+
/// Asset Value
|
|
296
|
+
value: ContractValue;
|
|
297
|
+
/// Derivation Path
|
|
298
|
+
derivation: string;
|
|
299
|
+
/// Derivation Path
|
|
300
|
+
isMine: boolean;
|
|
301
|
+
/// Allocation spent?
|
|
302
|
+
isSpent: boolean;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface UDAItem {
|
|
306
|
+
tokenIndex: number;
|
|
307
|
+
media: IssueMedia;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export interface RgbInvoiceRequest {
|
|
311
|
+
/// The contract id
|
|
312
|
+
contractId?: string;
|
|
313
|
+
/// The contract interface
|
|
314
|
+
iface?: string;
|
|
315
|
+
/// Amount of the asset (set to "0" for blinded invoices when the sender will provide amount at transfer time)
|
|
316
|
+
amount: RgbInvoiceValue;
|
|
317
|
+
/// Seal Selection
|
|
318
|
+
seal: RgbSelection;
|
|
319
|
+
/// Invoice Experation Date
|
|
320
|
+
expireAt?: number;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface RgbSelection {
|
|
324
|
+
/// Chain UTXO
|
|
325
|
+
next_utxo?: string;
|
|
326
|
+
/// Chain UTXO
|
|
327
|
+
next_address?: string;
|
|
328
|
+
/// Chain UTXO
|
|
329
|
+
utxo?: string;
|
|
330
|
+
/// Chain Address
|
|
331
|
+
address?: string;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export interface RgbInvoiceValue {
|
|
335
|
+
/// Decimal representation
|
|
336
|
+
value?: string;
|
|
337
|
+
// Allocation representation
|
|
338
|
+
uda?: UDAValue;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export interface RgbInvoiceResponse {
|
|
342
|
+
/// Invoice encoded in Baid58
|
|
343
|
+
invoice: string;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface RgbInvoiceStatusResponse {
|
|
347
|
+
/// Asset Name
|
|
348
|
+
assetName: String,
|
|
349
|
+
/// Asset Ticker
|
|
350
|
+
assetTicker: String,
|
|
351
|
+
/// ContractID
|
|
352
|
+
contractId: String,
|
|
353
|
+
/// Invoice Amount
|
|
354
|
+
amount: RgbInvoiceValue,
|
|
355
|
+
/// Invoice Status
|
|
356
|
+
status: RgbInvoiceStatus,
|
|
357
|
+
/// Invoice Encoded
|
|
358
|
+
invoice: String,
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
export type RgbInvoiceStatusItem = RgbInvoiceStatusResponse;
|
|
363
|
+
|
|
364
|
+
export interface RgbInvoiceStatus {
|
|
365
|
+
opened?: string;
|
|
366
|
+
payed?: string;
|
|
367
|
+
canceled?: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
export interface RgbTransferRequest {
|
|
372
|
+
/// The contract id
|
|
373
|
+
contractId: string;
|
|
374
|
+
/// The contract interface
|
|
375
|
+
iface: string;
|
|
376
|
+
/// RGB Invoice
|
|
377
|
+
invoice: string;
|
|
378
|
+
/// Optional amount provided by the sender for blinded invoices (ignored if invoice carries amount/allocation)
|
|
379
|
+
senderAmount?: RgbInvoiceValue;
|
|
380
|
+
/// Chain Target
|
|
381
|
+
/// enum ChainTarget {
|
|
382
|
+
/// "bitcoin"
|
|
383
|
+
/// }
|
|
384
|
+
chain: string;
|
|
385
|
+
/// Bitcoin Fee
|
|
386
|
+
chainFee: ChainFee;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface RgbTransferResponse {
|
|
390
|
+
/// Consignment ID (in base58)
|
|
391
|
+
consigId: string;
|
|
392
|
+
/// Consignment encoded (in armored)
|
|
393
|
+
consig: string;
|
|
394
|
+
/// Transfer Bitcoin L1 transaction id
|
|
395
|
+
txid: string;
|
|
396
|
+
/// PSBT File (in base64)
|
|
397
|
+
psbt: string;
|
|
398
|
+
/// Tapret Commitment
|
|
399
|
+
commit?: string;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface AcceptRequest {
|
|
403
|
+
/// Consignment encoded in base58
|
|
404
|
+
consignment: string;
|
|
405
|
+
/// Force Consignment accept
|
|
406
|
+
force: boolean;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface SaveTransferRequest {
|
|
410
|
+
/// Consignment encoded in base58
|
|
411
|
+
consignment: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface AcceptResponse {
|
|
415
|
+
/// Transfer ID
|
|
416
|
+
transferId: string;
|
|
417
|
+
/// Contract ID
|
|
418
|
+
contractId: string;
|
|
419
|
+
/// Transfer accept status
|
|
420
|
+
valid: boolean;
|
|
421
|
+
/// Anchor Bitcoin transaction id
|
|
422
|
+
txid: string;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface RgbTransferItem {
|
|
426
|
+
contractId: String;
|
|
427
|
+
iface: String;
|
|
428
|
+
direction: Direction
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface Direction {
|
|
432
|
+
in?: TransferIn;
|
|
433
|
+
out?: TransferOut;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface TransferIn {
|
|
437
|
+
txId: String;
|
|
438
|
+
txStatus: TxStatus;
|
|
439
|
+
invoice: String;
|
|
440
|
+
transfer?: TransferItem;
|
|
441
|
+
amount?: ContractAmount;
|
|
442
|
+
// RGB21 (UDA) display value (tokenIndex/fraction)
|
|
443
|
+
uda?: UDAValue;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export interface TransferOut {
|
|
447
|
+
txId: String;
|
|
448
|
+
txStatus: TxStatus;
|
|
449
|
+
invoice: String;
|
|
450
|
+
transfer: TransferItem;
|
|
451
|
+
amount?: ContractAmount;
|
|
452
|
+
// RGB21 (UDA) display value (tokenIndex/fraction)
|
|
453
|
+
uda?: UDAValue;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export interface TransferItem{
|
|
457
|
+
transferId: String;
|
|
458
|
+
transfer: String;
|
|
459
|
+
isAccept: boolean;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface SignPsbtRequest {
|
|
463
|
+
/// PSBT encoded in Base64
|
|
464
|
+
psbt: string;
|
|
465
|
+
/// Descriptors to Sign
|
|
466
|
+
descriptors: string[];
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export interface SignedPsbtResponse {
|
|
470
|
+
/// PSBT is signed?
|
|
471
|
+
sign: boolean;
|
|
472
|
+
/// PSBT signed
|
|
473
|
+
psbt: string;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
export interface PublishPsbtRequest {
|
|
477
|
+
/// PSBT encoded in Base64
|
|
478
|
+
psbt: string;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
export interface PublishedPsbtResponse {
|
|
482
|
+
/// PSBT is signed?
|
|
483
|
+
sign: boolean;
|
|
484
|
+
/// TX id
|
|
485
|
+
txid: string;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface WatcherRequest {
|
|
489
|
+
/// The watcher name
|
|
490
|
+
name: string;
|
|
491
|
+
/// The xpub will be watch
|
|
492
|
+
btcXpub: string;
|
|
493
|
+
/// The xpub will be watch
|
|
494
|
+
rgbXpub: string;
|
|
495
|
+
/// Recover mode
|
|
496
|
+
recover: boolean;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
export interface WatcherResponse {
|
|
500
|
+
/// The watcher name
|
|
501
|
+
name: string;
|
|
502
|
+
/// network
|
|
503
|
+
network: string;
|
|
504
|
+
/// migrate?
|
|
505
|
+
migrate: boolean;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export interface WatcherStatusResponse {
|
|
509
|
+
/// The watcher name
|
|
510
|
+
name: string;
|
|
511
|
+
/// migrate?
|
|
512
|
+
created: boolean;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface WatcherStatusResponse {
|
|
516
|
+
/// The watcher name
|
|
517
|
+
name: string;
|
|
518
|
+
/// migrate?
|
|
519
|
+
created: boolean;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
export interface WatcherWalletResponse {
|
|
523
|
+
nextUtxo?: string;
|
|
524
|
+
nextUtxoValue?: number;
|
|
525
|
+
nextAddress?: string;
|
|
526
|
+
listContracts: ContractResponse[];
|
|
527
|
+
transfers: RgbTransferItem[];
|
|
528
|
+
invoices: RgbInvoiceStatusItem[];
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export interface NextUtxoResponse {
|
|
532
|
+
utxo?: string;
|
|
533
|
+
value?: number;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export interface NextAddressResponse {
|
|
537
|
+
address: string;
|
|
538
|
+
network: string;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface TxStatus {
|
|
542
|
+
notFound?: any;
|
|
543
|
+
error?: string;
|
|
544
|
+
mempool?: any;
|
|
545
|
+
block?: {
|
|
546
|
+
height: number;
|
|
547
|
+
timestamp: number;
|
|
548
|
+
};
|
|
549
|
+
confirmed?: string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export interface RgbInvoiceDecoded {
|
|
553
|
+
contractId: string;
|
|
554
|
+
amount: RgbInvoiceValue;
|
|
555
|
+
expiry?: number;
|
|
556
|
+
endpoints?: string[];
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
export interface ContractAmount {
|
|
560
|
+
int: number;
|
|
561
|
+
fract: number;
|
|
562
|
+
precision: number;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export interface RgbOfferRequest {
|
|
566
|
+
/// The Offer Strategy
|
|
567
|
+
strategy: RgbSwap,
|
|
568
|
+
/// Offers
|
|
569
|
+
offers: RgbOfferItem[],
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export enum RgbSwap {
|
|
573
|
+
auction = "auction",
|
|
574
|
+
p2p = "p2p",
|
|
575
|
+
hotSwap = "hotswap",
|
|
576
|
+
airdrop = "airdrop"
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
export interface RgbOfferItem {
|
|
580
|
+
/// The Contract ID
|
|
581
|
+
contractId: string,
|
|
582
|
+
/// Contract Amount
|
|
583
|
+
contractAmount: string,
|
|
584
|
+
/// Bitcoin Price (in sats)
|
|
585
|
+
counterParty: OrderValue,
|
|
586
|
+
/// Offer Expire Date
|
|
587
|
+
expireAt?: number
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
export interface RgbOfferResponse {
|
|
591
|
+
/// The Order ID
|
|
592
|
+
id: string,
|
|
593
|
+
/// Order Status
|
|
594
|
+
status: string,
|
|
595
|
+
/// The Contract Kit
|
|
596
|
+
contract: ContractKit,
|
|
597
|
+
/// Contract Amount
|
|
598
|
+
amount: ContractAmount,
|
|
599
|
+
/// Counterparty
|
|
600
|
+
counterParty: OrderValue
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export interface RgbBidRequest {
|
|
604
|
+
/// The Offer ID
|
|
605
|
+
offerId: string,
|
|
606
|
+
/// Order Status
|
|
607
|
+
assetPrice: OrderValue,
|
|
608
|
+
/// L1 Fee
|
|
609
|
+
fee: ChainFee,
|
|
610
|
+
/// Counterparty
|
|
611
|
+
bundle?: string,
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export interface RgbBidResponse {
|
|
615
|
+
/// The Order ID
|
|
616
|
+
id: string,
|
|
617
|
+
/// The Offer ID
|
|
618
|
+
offerId: string,
|
|
619
|
+
/// Order Status
|
|
620
|
+
status: string,
|
|
621
|
+
/// The Asset Kit
|
|
622
|
+
asset: AssetKit,
|
|
623
|
+
/// Order Amount
|
|
624
|
+
amount: ContractAmount,
|
|
625
|
+
/// Counterparty
|
|
626
|
+
counterParty: OrderValue,
|
|
627
|
+
/// Anchor Bitcoin transaction id (non-optional; present on successful bid)
|
|
628
|
+
txid: string,
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export interface RgbAuctionCloseRequest {
|
|
632
|
+
/// Bundle ID
|
|
633
|
+
bundleId: string
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
export interface RgbSwapRequest {
|
|
637
|
+
/// The Offer ID
|
|
638
|
+
offerId: string,
|
|
639
|
+
/// The Bid ID
|
|
640
|
+
bidId: string,
|
|
641
|
+
/// The Share Key
|
|
642
|
+
sharedKey: string
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export interface RgbSwapResponse {
|
|
646
|
+
/// Consignment ID (in base58)
|
|
647
|
+
consigId: string,
|
|
648
|
+
/// Consignment (in armored)
|
|
649
|
+
consig: string,
|
|
650
|
+
/// L1 Transaction ID
|
|
651
|
+
txid: string,
|
|
652
|
+
/// PSBT File (in base64)
|
|
653
|
+
psbt: string
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
export interface RgbCancelOffersRequest {
|
|
657
|
+
offers: string[],
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
export interface RgbCancelBidsRequest {
|
|
661
|
+
bids: string[],
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
export interface RgbSwapCancelResponse {
|
|
665
|
+
records: number,
|
|
666
|
+
offers: string[],
|
|
667
|
+
bids: string[],
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
export interface RgbValidationResponse {
|
|
671
|
+
valid: boolean,
|
|
672
|
+
message: string,
|
|
673
|
+
warnings: string[],
|
|
674
|
+
failures:string[],
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
export interface ContractKit {
|
|
678
|
+
info: ContractInfo,
|
|
679
|
+
armored: string
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
export interface ContractInfo {
|
|
683
|
+
contractId: string,
|
|
684
|
+
contractType: string,
|
|
685
|
+
name: string,
|
|
686
|
+
ticker: string,
|
|
687
|
+
precision: number,
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
export interface AssetKit {
|
|
691
|
+
bitcoin?: string,
|
|
692
|
+
contract?: ContractKit,
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
export interface OrderValue {
|
|
696
|
+
bitcoin?: BigInt,
|
|
697
|
+
contract?: ContractCounterParty,
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export interface ContractCounterParty {
|
|
701
|
+
kit: ContractKit,
|
|
702
|
+
amount: ContractAmount
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export interface SwapSupplement {
|
|
706
|
+
transferId: string,
|
|
707
|
+
transfer: string,
|
|
708
|
+
tapret: string,
|
|
709
|
+
psbt: string,
|
|
710
|
+
}
|
package/wallet.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NextAddressResponse, NextUtxoResponse, WatcherRequest, WatcherResponse, WatcherStatusResponse } from "./rgb";
|
|
2
|
+
export declare const recoverWatcher: (nostrHexSk: string, request: WatcherRequest) => Promise<WatcherResponse>;
|
|
3
|
+
export declare const destroyRecover: (nostrHexSk: string) => Promise<WatcherResponse>;
|
|
4
|
+
export declare const createWatcher: (nostrHexSk: string, request: WatcherRequest) => Promise<WatcherResponse>;
|
|
5
|
+
export declare const destroyWatcher: (nostrHexSk: string) => Promise<WatcherResponse>;
|
|
6
|
+
export declare const checkWatcher: (nostrHexSk: string) => Promise<WatcherStatusResponse>;
|
|
7
|
+
export declare const nextAddress: (nostrHexSk: string, request: string) => Promise<NextAddressResponse>;
|
|
8
|
+
export declare const nextUtxo: (nostrHexSk: string, request: string) => Promise<NextUtxoResponse>;
|
|
9
|
+
//# sourceMappingURL=wallet.d.ts.map
|