@ibearua/bitmask-core-dev 1.0.0-beta.11 → 1.0.0-beta.13

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/wallet.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.nextUtxo = exports.nextAddress = exports.checkWatcher = exports.destroyWatcher = exports.createWatcher = exports.destroyRecover = exports.recoverWatcher = void 0;
36
+ // RGB
37
+ const BMC = __importStar(require("./bitmask_core"));
38
+ const recoverWatcher = (nostrHexSk, request) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.recover_watcher(nostrHexSk, request)); });
39
+ exports.recoverWatcher = recoverWatcher;
40
+ const destroyRecover = (nostrHexSk) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.destroy_recover_watcher(nostrHexSk)); });
41
+ exports.destroyRecover = destroyRecover;
42
+ const createWatcher = (nostrHexSk, request) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.create_watcher(nostrHexSk, request)); });
43
+ exports.createWatcher = createWatcher;
44
+ const destroyWatcher = (nostrHexSk) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.destroy_watcher(nostrHexSk)); });
45
+ exports.destroyWatcher = destroyWatcher;
46
+ const checkWatcher = (nostrHexSk) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.check_watcher(nostrHexSk)); });
47
+ exports.checkWatcher = checkWatcher;
48
+ const nextAddress = (nostrHexSk, request) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.watcher_next_address(nostrHexSk, request)); });
49
+ exports.nextAddress = nextAddress;
50
+ const nextUtxo = (nostrHexSk, request) => __awaiter(void 0, void 0, void 0, function* () { return JSON.parse(yield BMC.watcher_next_utxo(nostrHexSk, request)); });
51
+ exports.nextUtxo = nextUtxo;
package/wallet.ts ADDED
@@ -0,0 +1,46 @@
1
+
2
+
3
+ // RGB
4
+ import * as BMC from "./bitmask_core";
5
+ import {NextAddressResponse, NextUtxoResponse, WatcherRequest, WatcherResponse, WatcherStatusResponse} from "./rgb";
6
+
7
+ export const recoverWatcher = async (
8
+ nostrHexSk: string,
9
+ request: WatcherRequest
10
+ ): Promise<WatcherResponse> =>
11
+ JSON.parse(await BMC.recover_watcher(nostrHexSk, request));
12
+
13
+ export const destroyRecover = async (
14
+ nostrHexSk: string,
15
+ ): Promise<WatcherResponse> =>
16
+ JSON.parse(await BMC.destroy_recover_watcher(nostrHexSk));
17
+
18
+ export const createWatcher = async (
19
+ nostrHexSk: string,
20
+ request: WatcherRequest
21
+ ): Promise<WatcherResponse> =>
22
+ JSON.parse(await BMC.create_watcher(nostrHexSk, request));
23
+
24
+ export const destroyWatcher = async (
25
+ nostrHexSk: string,
26
+ ): Promise<WatcherResponse> =>
27
+ JSON.parse(await BMC.destroy_watcher(nostrHexSk));
28
+
29
+
30
+
31
+ export const checkWatcher = async (
32
+ nostrHexSk: string,
33
+ ): Promise<WatcherStatusResponse> =>
34
+ JSON.parse(await BMC.check_watcher(nostrHexSk));
35
+
36
+ export const nextAddress = async (
37
+ nostrHexSk: string,
38
+ request: string
39
+ ): Promise<NextAddressResponse> =>
40
+ JSON.parse(await BMC.watcher_next_address(nostrHexSk, request));
41
+
42
+ export const nextUtxo = async (
43
+ nostrHexSk: string,
44
+ request: string
45
+ ): Promise<NextUtxoResponse> =>
46
+ JSON.parse(await BMC.watcher_next_utxo(nostrHexSk, request));