@ibearua/bitmask-core-dev 1.0.0-beta.11 → 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/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 +28 -1
- 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/lightning.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Methods meant to work with LNDHubX defined within the web::lightning module from bitmask-core:
|
|
3
|
+
// https://github.com/diba-io/bitmask-core/blob/development/src/web.rs
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.swapLnBtc = exports.swapBtcLn = exports.checkPayment = exports.payInvoice = exports.getTxs = exports.getBalance = exports.createInvoice = exports.auth = exports.createWallet = void 0;
|
|
38
|
+
const BMC = __importStar(require("./bitmask_core"));
|
|
39
|
+
const createWallet = (username, password) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.create_wallet(username, password)); });
|
|
40
|
+
exports.createWallet = createWallet;
|
|
41
|
+
const auth = (username, password) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.auth(username, password)); });
|
|
42
|
+
exports.auth = auth;
|
|
43
|
+
const createInvoice = (description, amount, token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.ln_create_invoice(description, amount, token)); });
|
|
44
|
+
exports.createInvoice = createInvoice;
|
|
45
|
+
const getBalance = (token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.get_balance(token)); });
|
|
46
|
+
exports.getBalance = getBalance;
|
|
47
|
+
const getTxs = (token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.get_txs(token)); });
|
|
48
|
+
exports.getTxs = getTxs;
|
|
49
|
+
const payInvoice = (paymentRequest, token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.pay_invoice(paymentRequest, token)); });
|
|
50
|
+
exports.payInvoice = payInvoice;
|
|
51
|
+
const checkPayment = (paymentHash) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.check_payment(paymentHash)); });
|
|
52
|
+
exports.checkPayment = checkPayment;
|
|
53
|
+
const swapBtcLn = (token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.swap_btc_ln(token)); });
|
|
54
|
+
exports.swapBtcLn = swapBtcLn;
|
|
55
|
+
const swapLnBtc = (address, amount, token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.swap_ln_btc(address, amount, token)); });
|
|
56
|
+
exports.swapLnBtc = swapLnBtc;
|
package/lightning.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Methods meant to work with LNDHubX defined within the web::lightning 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 createWallet = async (
|
|
7
|
+
username: string,
|
|
8
|
+
password: string
|
|
9
|
+
): Promise<CreateWalletResponse> =>
|
|
10
|
+
JSON.parse(await BMC.create_wallet(username, password));
|
|
11
|
+
|
|
12
|
+
export const auth = async (
|
|
13
|
+
username: string,
|
|
14
|
+
password: string
|
|
15
|
+
): Promise<AuthResponse> => JSON.parse(await BMC.auth(username, password));
|
|
16
|
+
|
|
17
|
+
export const createInvoice = async (
|
|
18
|
+
description: string,
|
|
19
|
+
amount: number,
|
|
20
|
+
token: string
|
|
21
|
+
): Promise<AddInvoiceResponse> =>
|
|
22
|
+
JSON.parse(await BMC.ln_create_invoice(description, amount, token));
|
|
23
|
+
|
|
24
|
+
export const getBalance = async (token: string): Promise<Account> =>
|
|
25
|
+
JSON.parse(await BMC.get_balance(token));
|
|
26
|
+
|
|
27
|
+
export const getTxs = async (token: string): Promise<LnTransaction[]> =>
|
|
28
|
+
JSON.parse(await BMC.get_txs(token));
|
|
29
|
+
|
|
30
|
+
export const payInvoice = async (
|
|
31
|
+
paymentRequest: string,
|
|
32
|
+
token: string
|
|
33
|
+
): Promise<PayInvoiceResponse> =>
|
|
34
|
+
JSON.parse(await BMC.pay_invoice(paymentRequest, token));
|
|
35
|
+
|
|
36
|
+
export const checkPayment = async (
|
|
37
|
+
paymentHash: string
|
|
38
|
+
): Promise<CheckPaymentResponse> =>
|
|
39
|
+
JSON.parse(await BMC.check_payment(paymentHash));
|
|
40
|
+
|
|
41
|
+
export const swapBtcLn = async (token: string): Promise<SwapBtcLnResponse> =>
|
|
42
|
+
JSON.parse(await BMC.swap_btc_ln(token));
|
|
43
|
+
|
|
44
|
+
export const swapLnBtc = async (
|
|
45
|
+
address: string,
|
|
46
|
+
amount: bigint,
|
|
47
|
+
token: string
|
|
48
|
+
): Promise<SwapLnBtcResponse> =>
|
|
49
|
+
JSON.parse(await BMC.swap_ln_btc(address, amount, token));
|
|
50
|
+
|
|
51
|
+
// Core type interfaces based on structs defined within the bitmask-core Rust crate:
|
|
52
|
+
// https://github.com/diba-io/bitmask-core/blob/development/src/structs.rs
|
|
53
|
+
|
|
54
|
+
export interface LnCredentials {
|
|
55
|
+
login: string;
|
|
56
|
+
password: string;
|
|
57
|
+
refreshToken: string;
|
|
58
|
+
accessToken: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Lndhubx Create wallet endpoint response
|
|
62
|
+
export interface CreateWalletResponse {
|
|
63
|
+
username?: string;
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// lndhubx Auth response
|
|
68
|
+
export type AuthResponse = ErrorResponse | AuthResponseOk;
|
|
69
|
+
|
|
70
|
+
export interface AuthResponseOk {
|
|
71
|
+
refresh: string;
|
|
72
|
+
token: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface ErrorResponse {
|
|
76
|
+
error: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// User Account
|
|
80
|
+
export interface Account {
|
|
81
|
+
account_id: string;
|
|
82
|
+
balance: string;
|
|
83
|
+
currency: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Amount and currency
|
|
87
|
+
export interface Money {
|
|
88
|
+
value: string;
|
|
89
|
+
currency: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Lndhubx Add invoice endpoint response
|
|
93
|
+
export interface AddInvoiceResponse {
|
|
94
|
+
req_id: string;
|
|
95
|
+
uid: number;
|
|
96
|
+
payment_request: string;
|
|
97
|
+
meta: string;
|
|
98
|
+
metadata: string;
|
|
99
|
+
amount: Money;
|
|
100
|
+
rate: string;
|
|
101
|
+
currency: string;
|
|
102
|
+
target_account_currency: string;
|
|
103
|
+
account_id: string;
|
|
104
|
+
error: string;
|
|
105
|
+
fees: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Lndhubx lightning transaction
|
|
109
|
+
export interface LnTransaction {
|
|
110
|
+
txid: string;
|
|
111
|
+
fee_txid: string;
|
|
112
|
+
outbound_txid: string;
|
|
113
|
+
inbound_txid: string;
|
|
114
|
+
created_at: bigint;
|
|
115
|
+
date: number;
|
|
116
|
+
outbound_amount: string;
|
|
117
|
+
inbound_amount: string;
|
|
118
|
+
outbound_account_id: string;
|
|
119
|
+
inbound_account_id: string;
|
|
120
|
+
outbound_uid: number;
|
|
121
|
+
inbound_uid: number;
|
|
122
|
+
outbound_currency: string;
|
|
123
|
+
inbound_currency: string;
|
|
124
|
+
exchange_rate: string;
|
|
125
|
+
tx_type: string;
|
|
126
|
+
fees: string;
|
|
127
|
+
reference: string;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface LnWalletData {
|
|
131
|
+
balance: Account;
|
|
132
|
+
transactions: LnTransaction[];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Lndhubx Pay invoice response
|
|
136
|
+
export interface PayInvoiceResponse {
|
|
137
|
+
payment_hash: string;
|
|
138
|
+
uid: number;
|
|
139
|
+
success: boolean;
|
|
140
|
+
currency: string;
|
|
141
|
+
payment_request: string;
|
|
142
|
+
amount: Money;
|
|
143
|
+
fees: Money;
|
|
144
|
+
error: string;
|
|
145
|
+
payment_preimage: string;
|
|
146
|
+
destination: string;
|
|
147
|
+
description: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Lndhubx Check payment response
|
|
151
|
+
export interface CheckPaymentResponse {
|
|
152
|
+
paid: boolean;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface SwapBtcLnResponse {
|
|
156
|
+
address: string;
|
|
157
|
+
commitment: string;
|
|
158
|
+
signature: string;
|
|
159
|
+
secret_access_key: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface SwapLnBtcResponse {
|
|
163
|
+
bolt11_invoice: string;
|
|
164
|
+
fee_sats: number;
|
|
165
|
+
}
|
package/nostr.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface Response {
|
|
2
|
+
status: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const newNostrPubkey: (pubkey: string, token: string) => Promise<Response>;
|
|
5
|
+
export declare const updateNostrPubkey: (pubkey: string, token: string) => Promise<Response>;
|
|
6
|
+
//# sourceMappingURL=nostr.d.ts.map
|
package/nostr.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Methods meant to work with LNDHubX defined within the web::nostr module from bitmask-core:
|
|
3
|
+
// https://github.com/diba-io/bitmask-core/blob/development/src/web.rs
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
21
|
+
if (mod && mod.__esModule) return mod;
|
|
22
|
+
var result = {};
|
|
23
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
24
|
+
__setModuleDefault(result, mod);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
28
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
29
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
30
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
31
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
32
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
33
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.updateNostrPubkey = exports.newNostrPubkey = void 0;
|
|
38
|
+
const BMC = __importStar(require("./bitmask_core"));
|
|
39
|
+
const newNostrPubkey = (pubkey, token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.new_nostr_pubkey(pubkey, token)); });
|
|
40
|
+
exports.newNostrPubkey = newNostrPubkey;
|
|
41
|
+
const updateNostrPubkey = (pubkey, token) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.update_nostr_pubkey(pubkey, token)); });
|
|
42
|
+
exports.updateNostrPubkey = updateNostrPubkey;
|
package/nostr.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Methods meant to work with LNDHubX defined within the web::nostr 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 interface Response {
|
|
7
|
+
status: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const newNostrPubkey = async (
|
|
11
|
+
pubkey: string,
|
|
12
|
+
token: string
|
|
13
|
+
): Promise<Response> => JSON.parse(await BMC.new_nostr_pubkey(pubkey, token));
|
|
14
|
+
|
|
15
|
+
export const updateNostrPubkey = async (
|
|
16
|
+
pubkey: string,
|
|
17
|
+
token: string
|
|
18
|
+
): Promise<Response> =>
|
|
19
|
+
JSON.parse(await BMC.update_nostr_pubkey(pubkey, token));
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"Stanley Arua <stanarua@aol.com>"
|
|
11
11
|
],
|
|
12
12
|
"description": "Core functionality for the BitMask wallet",
|
|
13
|
-
"version": "1.0.0-beta.
|
|
13
|
+
"version": "1.0.0-beta.12",
|
|
14
14
|
"license": "MIT/Apache-2.0",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
@@ -20,6 +20,33 @@
|
|
|
20
20
|
"bitmask_core_bg.wasm",
|
|
21
21
|
"bitmask_core.js",
|
|
22
22
|
"bitmask_core.d.ts",
|
|
23
|
+
"bitcoin.d.ts",
|
|
24
|
+
"bitcoin.js",
|
|
25
|
+
"bitcoin.ts",
|
|
26
|
+
"bp.d.ts",
|
|
27
|
+
"bp.js",
|
|
28
|
+
"bp.ts",
|
|
29
|
+
"carbonado.d.ts",
|
|
30
|
+
"carbonado.js",
|
|
31
|
+
"carbonado.ts",
|
|
32
|
+
"constants.d.ts",
|
|
33
|
+
"constants.js",
|
|
34
|
+
"constants.ts",
|
|
35
|
+
"index.d.ts",
|
|
36
|
+
"index.js",
|
|
37
|
+
"index.ts",
|
|
38
|
+
"lightning.d.ts",
|
|
39
|
+
"lightning.js",
|
|
40
|
+
"lightning.ts",
|
|
41
|
+
"nostr.d.ts",
|
|
42
|
+
"nostr.js",
|
|
43
|
+
"nostr.ts",
|
|
44
|
+
"rgb.d.ts",
|
|
45
|
+
"rgb.js",
|
|
46
|
+
"rgb.ts",
|
|
47
|
+
"wallet.d.ts",
|
|
48
|
+
"wallet.js",
|
|
49
|
+
"wallet.ts",
|
|
23
50
|
"LICENSE-MIT",
|
|
24
51
|
"LICENSE-APACHE"
|
|
25
52
|
],
|
package/rgb.d.ts
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
export declare const getVersion: () => string;
|
|
2
|
+
export declare const getContract: (nostrHexSk: string, request: string) => Promise<ContractResponse>;
|
|
3
|
+
export declare const listContracts: (nostrHexSk: string, hidden: boolean) => Promise<ContractResponse[]>;
|
|
4
|
+
export declare const importContract: (nostrHexSk: string, request: string) => Promise<ContractResponse>;
|
|
5
|
+
export declare const issueContract: (nostrHexSk: string, request: IssueRequest) => Promise<IssueResponse>;
|
|
6
|
+
export declare const createInvoice: (nostrHexSk: string, request: RgbInvoiceRequest) => Promise<RgbInvoiceResponse>;
|
|
7
|
+
export declare const canCreateTransfer: (nostrHexSk: string, request: RgbTransferRequest) => Promise<RgbValidationResponse>;
|
|
8
|
+
export declare const createTransfer: (nostrHexSk: string, request: RgbTransferRequest) => Promise<RgbTransferResponse>;
|
|
9
|
+
export declare const createAndPublishTransfer: (nostrHexSk: string, request: RgbTransferRequest, secrets: string[]) => Promise<RgbTransferResponse>;
|
|
10
|
+
export declare const acceptTransfer: (nostrHexSk: string, request: AcceptRequest) => Promise<AcceptResponse>;
|
|
11
|
+
export declare const removeInvoice: (nostrHexSk: string, request: string) => Promise<void>;
|
|
12
|
+
export declare const listInvoices: (nostrHexSk: string) => Promise<RgbInvoiceStatusResponse[]>;
|
|
13
|
+
export declare const saveTransfer: (nostrHexSk: string, request: SaveTransferRequest) => Promise<RgbTransferItem>;
|
|
14
|
+
export declare const listTransfers: (nostrHexSk: string) => Promise<RgbTransferItem[]>;
|
|
15
|
+
export declare const verifyTransfers: (nostrHexSk: string) => Promise<RgbTransferItem[]>;
|
|
16
|
+
export declare const listOffers: (nostrHexSk: string) => Promise<RgbOfferResponse[]>;
|
|
17
|
+
export declare const offers: (nostrHexSk: string) => Promise<RgbOfferResponse[]>;
|
|
18
|
+
export declare const bids: (nostrHexSk: string) => Promise<WatcherWalletResponse>;
|
|
19
|
+
export declare const offerSwapSuppl: (nostrHexSk: string, offerId: string) => Promise<SwapSupplement>;
|
|
20
|
+
export declare const bidSwapSuppl: (nostrHexSk: string, bidId: string) => Promise<SwapSupplement>;
|
|
21
|
+
export declare const canCreateOffer: (nostrHexSk: string, request: RgbOfferRequest, secrets: string[]) => Promise<RgbValidationResponse>;
|
|
22
|
+
export declare const createOffer: (nostrHexSk: string, request: RgbOfferRequest, secrets: string[]) => Promise<RgbOfferResponse>;
|
|
23
|
+
export declare const cancelOffer: (nostrHexSk: string, request: RgbCancelOffersRequest) => Promise<RgbSwapCancelResponse>;
|
|
24
|
+
export declare const canCreateBid: (nostrHexSk: string, request: RgbBidRequest, secrets: string[]) => Promise<RgbValidationResponse>;
|
|
25
|
+
export declare const createBid: (nostrHexSk: string, request: RgbBidRequest, secrets: string[]) => Promise<RgbBidResponse>;
|
|
26
|
+
export declare const cancelBid: (nostrHexSk: string, request: RgbCancelBidsRequest) => Promise<RgbSwapCancelResponse>;
|
|
27
|
+
export declare const backupWallet: (nostrHexSk: string) => Promise<boolean>;
|
|
28
|
+
export declare const restoreWallet: (nostrHexSk: string) => Promise<boolean>;
|
|
29
|
+
export declare const getRgbWallet: (nostrHexSk: string) => Promise<WatcherWalletResponse>;
|
|
30
|
+
export declare const decodeInvoice: (invoice: string) => Promise<RgbInvoiceDecoded>;
|
|
31
|
+
export declare const psbtPublishFile: (request: PublishPsbtRequest) => Promise<SignedPsbtResponse>;
|
|
32
|
+
export declare const psbtSignAndPublishFile: (_nostrHexSk: string, request: SignPsbtRequest) => Promise<PublishedPsbtResponse>;
|
|
33
|
+
export declare const toContractAmountRaw: (decimal: string, precision: number) => string;
|
|
34
|
+
export declare const toContractAmountStr: (amount: bigint, precision: number) => string;
|
|
35
|
+
export declare const toContractAmount: (amount: string) => ContractAmount;
|
|
36
|
+
export declare const toContractPrecision: (amount: string, precision: number) => string;
|
|
37
|
+
export interface RgbContainer {
|
|
38
|
+
rgbStock?: string;
|
|
39
|
+
rgbAccount?: string;
|
|
40
|
+
rgbTransfers?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface IssueRequest {
|
|
43
|
+
ticker: string;
|
|
44
|
+
name: string;
|
|
45
|
+
iface: string;
|
|
46
|
+
description: string;
|
|
47
|
+
supply: string;
|
|
48
|
+
precision: number;
|
|
49
|
+
seal: string;
|
|
50
|
+
chain: string;
|
|
51
|
+
meta?: IssueMedia;
|
|
52
|
+
}
|
|
53
|
+
export type ChainFee = {
|
|
54
|
+
value?: bigint;
|
|
55
|
+
feeRate?: number;
|
|
56
|
+
none?: string;
|
|
57
|
+
};
|
|
58
|
+
export interface IssueMedia {
|
|
59
|
+
preview?: MediaData;
|
|
60
|
+
media?: MediaData;
|
|
61
|
+
attachments: MediaData[];
|
|
62
|
+
}
|
|
63
|
+
export interface MediaData {
|
|
64
|
+
type: string;
|
|
65
|
+
uri: string;
|
|
66
|
+
}
|
|
67
|
+
export type ContractResponse = IssueResponse;
|
|
68
|
+
export interface IssueResponse {
|
|
69
|
+
contractId: string;
|
|
70
|
+
iface: string;
|
|
71
|
+
issueUtxo: string;
|
|
72
|
+
ticker: string;
|
|
73
|
+
name: string;
|
|
74
|
+
created: bigint;
|
|
75
|
+
description: string;
|
|
76
|
+
supply: bigint;
|
|
77
|
+
precision: number;
|
|
78
|
+
balance: ContractValue;
|
|
79
|
+
contract: string;
|
|
80
|
+
allocations: ContractAllocation[];
|
|
81
|
+
meta?: UDAItem;
|
|
82
|
+
}
|
|
83
|
+
export type ContractValue = {
|
|
84
|
+
value?: bigint;
|
|
85
|
+
uda?: UDAValue;
|
|
86
|
+
};
|
|
87
|
+
export interface UDAValue {
|
|
88
|
+
tokenIndex: number;
|
|
89
|
+
fraction: bigint;
|
|
90
|
+
}
|
|
91
|
+
export interface ContractAllocation {
|
|
92
|
+
utxo: string;
|
|
93
|
+
value: ContractValue;
|
|
94
|
+
derivation: string;
|
|
95
|
+
isMine: boolean;
|
|
96
|
+
isSpent: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface UDAItem {
|
|
99
|
+
tokenIndex: number;
|
|
100
|
+
media: IssueMedia;
|
|
101
|
+
}
|
|
102
|
+
export interface RgbInvoiceRequest {
|
|
103
|
+
contractId?: string;
|
|
104
|
+
iface?: string;
|
|
105
|
+
amount: RgbInvoiceValue;
|
|
106
|
+
seal: RgbSelection;
|
|
107
|
+
expireAt?: number;
|
|
108
|
+
}
|
|
109
|
+
export interface RgbSelection {
|
|
110
|
+
next_utxo?: string;
|
|
111
|
+
next_address?: string;
|
|
112
|
+
utxo?: string;
|
|
113
|
+
address?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface RgbInvoiceValue {
|
|
116
|
+
value?: string;
|
|
117
|
+
uda?: UDAValue;
|
|
118
|
+
}
|
|
119
|
+
export interface RgbInvoiceResponse {
|
|
120
|
+
invoice: string;
|
|
121
|
+
}
|
|
122
|
+
export interface RgbInvoiceStatusResponse {
|
|
123
|
+
assetName: String;
|
|
124
|
+
assetTicker: String;
|
|
125
|
+
contractId: String;
|
|
126
|
+
amount: RgbInvoiceValue;
|
|
127
|
+
status: RgbInvoiceStatus;
|
|
128
|
+
invoice: String;
|
|
129
|
+
}
|
|
130
|
+
export type RgbInvoiceStatusItem = RgbInvoiceStatusResponse;
|
|
131
|
+
export interface RgbInvoiceStatus {
|
|
132
|
+
opened?: string;
|
|
133
|
+
payed?: string;
|
|
134
|
+
canceled?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface RgbTransferRequest {
|
|
137
|
+
contractId: string;
|
|
138
|
+
iface: string;
|
|
139
|
+
invoice: string;
|
|
140
|
+
senderAmount?: RgbInvoiceValue;
|
|
141
|
+
chain: string;
|
|
142
|
+
chainFee: ChainFee;
|
|
143
|
+
}
|
|
144
|
+
export interface RgbTransferResponse {
|
|
145
|
+
consigId: string;
|
|
146
|
+
consig: string;
|
|
147
|
+
txid: string;
|
|
148
|
+
psbt: string;
|
|
149
|
+
commit?: string;
|
|
150
|
+
}
|
|
151
|
+
export interface AcceptRequest {
|
|
152
|
+
consignment: string;
|
|
153
|
+
force: boolean;
|
|
154
|
+
}
|
|
155
|
+
export interface SaveTransferRequest {
|
|
156
|
+
consignment: string;
|
|
157
|
+
}
|
|
158
|
+
export interface AcceptResponse {
|
|
159
|
+
transferId: string;
|
|
160
|
+
contractId: string;
|
|
161
|
+
valid: boolean;
|
|
162
|
+
txid: string;
|
|
163
|
+
}
|
|
164
|
+
export interface RgbTransferItem {
|
|
165
|
+
contractId: String;
|
|
166
|
+
iface: String;
|
|
167
|
+
direction: Direction;
|
|
168
|
+
}
|
|
169
|
+
export interface Direction {
|
|
170
|
+
in?: TransferIn;
|
|
171
|
+
out?: TransferOut;
|
|
172
|
+
}
|
|
173
|
+
export interface TransferIn {
|
|
174
|
+
txId: String;
|
|
175
|
+
txStatus: TxStatus;
|
|
176
|
+
invoice: String;
|
|
177
|
+
transfer?: TransferItem;
|
|
178
|
+
amount?: ContractAmount;
|
|
179
|
+
uda?: UDAValue;
|
|
180
|
+
}
|
|
181
|
+
export interface TransferOut {
|
|
182
|
+
txId: String;
|
|
183
|
+
txStatus: TxStatus;
|
|
184
|
+
invoice: String;
|
|
185
|
+
transfer: TransferItem;
|
|
186
|
+
amount?: ContractAmount;
|
|
187
|
+
uda?: UDAValue;
|
|
188
|
+
}
|
|
189
|
+
export interface TransferItem {
|
|
190
|
+
transferId: String;
|
|
191
|
+
transfer: String;
|
|
192
|
+
isAccept: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface SignPsbtRequest {
|
|
195
|
+
psbt: string;
|
|
196
|
+
descriptors: string[];
|
|
197
|
+
}
|
|
198
|
+
export interface SignedPsbtResponse {
|
|
199
|
+
sign: boolean;
|
|
200
|
+
psbt: string;
|
|
201
|
+
}
|
|
202
|
+
export interface PublishPsbtRequest {
|
|
203
|
+
psbt: string;
|
|
204
|
+
}
|
|
205
|
+
export interface PublishedPsbtResponse {
|
|
206
|
+
sign: boolean;
|
|
207
|
+
txid: string;
|
|
208
|
+
}
|
|
209
|
+
export interface WatcherRequest {
|
|
210
|
+
name: string;
|
|
211
|
+
btcXpub: string;
|
|
212
|
+
rgbXpub: string;
|
|
213
|
+
recover: boolean;
|
|
214
|
+
}
|
|
215
|
+
export interface WatcherResponse {
|
|
216
|
+
name: string;
|
|
217
|
+
network: string;
|
|
218
|
+
migrate: boolean;
|
|
219
|
+
}
|
|
220
|
+
export interface WatcherStatusResponse {
|
|
221
|
+
name: string;
|
|
222
|
+
created: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface WatcherStatusResponse {
|
|
225
|
+
name: string;
|
|
226
|
+
created: boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface WatcherWalletResponse {
|
|
229
|
+
nextUtxo?: string;
|
|
230
|
+
nextUtxoValue?: number;
|
|
231
|
+
nextAddress?: string;
|
|
232
|
+
listContracts: ContractResponse[];
|
|
233
|
+
transfers: RgbTransferItem[];
|
|
234
|
+
invoices: RgbInvoiceStatusItem[];
|
|
235
|
+
}
|
|
236
|
+
export interface NextUtxoResponse {
|
|
237
|
+
utxo?: string;
|
|
238
|
+
value?: number;
|
|
239
|
+
}
|
|
240
|
+
export interface NextAddressResponse {
|
|
241
|
+
address: string;
|
|
242
|
+
network: string;
|
|
243
|
+
}
|
|
244
|
+
export interface TxStatus {
|
|
245
|
+
notFound?: any;
|
|
246
|
+
error?: string;
|
|
247
|
+
mempool?: any;
|
|
248
|
+
block?: {
|
|
249
|
+
height: number;
|
|
250
|
+
timestamp: number;
|
|
251
|
+
};
|
|
252
|
+
confirmed?: string;
|
|
253
|
+
}
|
|
254
|
+
export interface RgbInvoiceDecoded {
|
|
255
|
+
contractId: string;
|
|
256
|
+
amount: RgbInvoiceValue;
|
|
257
|
+
expiry?: number;
|
|
258
|
+
endpoints?: string[];
|
|
259
|
+
}
|
|
260
|
+
export interface ContractAmount {
|
|
261
|
+
int: number;
|
|
262
|
+
fract: number;
|
|
263
|
+
precision: number;
|
|
264
|
+
}
|
|
265
|
+
export interface RgbOfferRequest {
|
|
266
|
+
strategy: RgbSwap;
|
|
267
|
+
offers: RgbOfferItem[];
|
|
268
|
+
}
|
|
269
|
+
export declare enum RgbSwap {
|
|
270
|
+
auction = "auction",
|
|
271
|
+
p2p = "p2p",
|
|
272
|
+
hotSwap = "hotswap",
|
|
273
|
+
airdrop = "airdrop"
|
|
274
|
+
}
|
|
275
|
+
export interface RgbOfferItem {
|
|
276
|
+
contractId: string;
|
|
277
|
+
contractAmount: string;
|
|
278
|
+
counterParty: OrderValue;
|
|
279
|
+
expireAt?: number;
|
|
280
|
+
}
|
|
281
|
+
export interface RgbOfferResponse {
|
|
282
|
+
id: string;
|
|
283
|
+
status: string;
|
|
284
|
+
contract: ContractKit;
|
|
285
|
+
amount: ContractAmount;
|
|
286
|
+
counterParty: OrderValue;
|
|
287
|
+
}
|
|
288
|
+
export interface RgbBidRequest {
|
|
289
|
+
offerId: string;
|
|
290
|
+
assetPrice: OrderValue;
|
|
291
|
+
fee: ChainFee;
|
|
292
|
+
bundle?: string;
|
|
293
|
+
}
|
|
294
|
+
export interface RgbBidResponse {
|
|
295
|
+
id: string;
|
|
296
|
+
offerId: string;
|
|
297
|
+
status: string;
|
|
298
|
+
asset: AssetKit;
|
|
299
|
+
amount: ContractAmount;
|
|
300
|
+
counterParty: OrderValue;
|
|
301
|
+
txid: string;
|
|
302
|
+
}
|
|
303
|
+
export interface RgbAuctionCloseRequest {
|
|
304
|
+
bundleId: string;
|
|
305
|
+
}
|
|
306
|
+
export interface RgbSwapRequest {
|
|
307
|
+
offerId: string;
|
|
308
|
+
bidId: string;
|
|
309
|
+
sharedKey: string;
|
|
310
|
+
}
|
|
311
|
+
export interface RgbSwapResponse {
|
|
312
|
+
consigId: string;
|
|
313
|
+
consig: string;
|
|
314
|
+
txid: string;
|
|
315
|
+
psbt: string;
|
|
316
|
+
}
|
|
317
|
+
export interface RgbCancelOffersRequest {
|
|
318
|
+
offers: string[];
|
|
319
|
+
}
|
|
320
|
+
export interface RgbCancelBidsRequest {
|
|
321
|
+
bids: string[];
|
|
322
|
+
}
|
|
323
|
+
export interface RgbSwapCancelResponse {
|
|
324
|
+
records: number;
|
|
325
|
+
offers: string[];
|
|
326
|
+
bids: string[];
|
|
327
|
+
}
|
|
328
|
+
export interface RgbValidationResponse {
|
|
329
|
+
valid: boolean;
|
|
330
|
+
message: string;
|
|
331
|
+
warnings: string[];
|
|
332
|
+
failures: string[];
|
|
333
|
+
}
|
|
334
|
+
export interface ContractKit {
|
|
335
|
+
info: ContractInfo;
|
|
336
|
+
armored: string;
|
|
337
|
+
}
|
|
338
|
+
export interface ContractInfo {
|
|
339
|
+
contractId: string;
|
|
340
|
+
contractType: string;
|
|
341
|
+
name: string;
|
|
342
|
+
ticker: string;
|
|
343
|
+
precision: number;
|
|
344
|
+
}
|
|
345
|
+
export interface AssetKit {
|
|
346
|
+
bitcoin?: string;
|
|
347
|
+
contract?: ContractKit;
|
|
348
|
+
}
|
|
349
|
+
export interface OrderValue {
|
|
350
|
+
bitcoin?: BigInt;
|
|
351
|
+
contract?: ContractCounterParty;
|
|
352
|
+
}
|
|
353
|
+
export interface ContractCounterParty {
|
|
354
|
+
kit: ContractKit;
|
|
355
|
+
amount: ContractAmount;
|
|
356
|
+
}
|
|
357
|
+
export interface SwapSupplement {
|
|
358
|
+
transferId: string;
|
|
359
|
+
transfer: string;
|
|
360
|
+
tapret: string;
|
|
361
|
+
psbt: string;
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=rgb.d.ts.map
|