@bitgo/wasm-utxo 1.35.0 → 1.37.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/cjs/js/bip32.d.ts +19 -0
- package/dist/cjs/js/bip32.js +29 -0
- package/dist/cjs/js/index.d.ts +7 -2
- package/dist/cjs/js/index.js +2 -2
- package/dist/cjs/js/message.d.ts +36 -0
- package/dist/cjs/js/message.js +47 -0
- package/dist/cjs/js/testutils/descriptor/descriptors.d.ts +27 -0
- package/dist/cjs/js/testutils/descriptor/descriptors.js +163 -0
- package/dist/cjs/js/testutils/descriptor/index.d.ts +2 -0
- package/dist/cjs/js/testutils/descriptor/index.js +18 -0
- package/dist/cjs/js/testutils/descriptor/mockPsbt.d.ts +41 -0
- package/dist/cjs/js/testutils/descriptor/mockPsbt.js +62 -0
- package/dist/cjs/js/testutils/fixtures.d.ts +35 -0
- package/dist/cjs/js/testutils/fixtures.js +244 -0
- package/dist/cjs/js/testutils/index.d.ts +2 -0
- package/dist/cjs/js/testutils/index.js +25 -0
- package/dist/cjs/js/wasm/wasm_utxo.d.ts +33 -0
- package/dist/cjs/js/wasm/wasm_utxo.js +112 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/cjs/js/wasm/wasm_utxo_bg.wasm.d.ts +103 -98
- package/dist/esm/js/bip32.d.ts +19 -0
- package/dist/esm/js/bip32.js +29 -0
- package/dist/esm/js/index.d.ts +7 -2
- package/dist/esm/js/index.js +1 -1
- package/dist/esm/js/message.d.ts +36 -0
- package/dist/esm/js/message.js +43 -0
- package/dist/esm/js/testutils/descriptor/descriptors.d.ts +27 -0
- package/dist/esm/js/testutils/descriptor/descriptors.js +150 -0
- package/dist/esm/js/testutils/descriptor/index.d.ts +2 -0
- package/dist/esm/js/testutils/descriptor/index.js +2 -0
- package/dist/esm/js/testutils/descriptor/mockPsbt.d.ts +41 -0
- package/dist/esm/js/testutils/descriptor/mockPsbt.js +56 -0
- package/dist/esm/js/testutils/fixtures.d.ts +35 -0
- package/dist/esm/js/testutils/fixtures.js +205 -0
- package/dist/esm/js/testutils/index.d.ts +2 -0
- package/dist/esm/js/testutils/index.js +2 -0
- package/dist/esm/js/wasm/wasm_utxo.d.ts +33 -0
- package/dist/esm/js/wasm/wasm_utxo.js +1 -1
- package/dist/esm/js/wasm/wasm_utxo_bg.js +111 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm +0 -0
- package/dist/esm/js/wasm/wasm_utxo_bg.wasm.d.ts +103 -98
- package/package.json +11 -1
|
@@ -0,0 +1,244 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getFixture = getFixture;
|
|
37
|
+
exports.jsonNormalize = jsonNormalize;
|
|
38
|
+
exports.matchPath = matchPath;
|
|
39
|
+
exports.toPlainObject = toPlainObject;
|
|
40
|
+
/// <reference types="node" />
|
|
41
|
+
/**
|
|
42
|
+
* Generic test fixture and serialization utilities.
|
|
43
|
+
* Ported from @bitgo/utxo-core/testutil/fixtures.utils.ts
|
|
44
|
+
* and @bitgo/utxo-core/testutil/toPlainObject.utils.ts.
|
|
45
|
+
*
|
|
46
|
+
* NOTE: getFixture requires Node.js (fs, process.env).
|
|
47
|
+
* The toPlainObject / jsonNormalize utilities are platform-independent.
|
|
48
|
+
*/
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const mpath = __importStar(require("path"));
|
|
51
|
+
function isNodeJsError(e) {
|
|
52
|
+
return e instanceof Error && typeof e.code === "string";
|
|
53
|
+
}
|
|
54
|
+
function fixtureEncoding(path) {
|
|
55
|
+
if (path.endsWith(".json")) {
|
|
56
|
+
return "json";
|
|
57
|
+
}
|
|
58
|
+
if (path.endsWith(".hex")) {
|
|
59
|
+
return "hex";
|
|
60
|
+
}
|
|
61
|
+
if (path.endsWith(".txt")) {
|
|
62
|
+
return "txt";
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`unknown fixture encoding for ${path}`);
|
|
65
|
+
}
|
|
66
|
+
function hexToBytes(hex) {
|
|
67
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
68
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
69
|
+
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
70
|
+
}
|
|
71
|
+
return bytes;
|
|
72
|
+
}
|
|
73
|
+
function bytesToHex(bytes) {
|
|
74
|
+
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
75
|
+
}
|
|
76
|
+
function decodeFixture(raw, encoding) {
|
|
77
|
+
switch (encoding) {
|
|
78
|
+
case "json":
|
|
79
|
+
return JSON.parse(raw);
|
|
80
|
+
case "hex":
|
|
81
|
+
return hexToBytes(raw);
|
|
82
|
+
case "txt":
|
|
83
|
+
return raw;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function encodeFixture(value, encoding) {
|
|
87
|
+
switch (encoding) {
|
|
88
|
+
case "json":
|
|
89
|
+
return JSON.stringify(value, null, 2) + "\n";
|
|
90
|
+
case "hex":
|
|
91
|
+
if (!(value instanceof Uint8Array)) {
|
|
92
|
+
throw new Error(`expected Uint8Array, got ${typeof value}`);
|
|
93
|
+
}
|
|
94
|
+
return bytesToHex(value);
|
|
95
|
+
case "txt":
|
|
96
|
+
if (typeof value !== "string") {
|
|
97
|
+
throw new Error(`expected string, got ${typeof value}`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Return fixture described in `path`.
|
|
104
|
+
*
|
|
105
|
+
* If the file does not exist and `defaultValue` is provided,
|
|
106
|
+
* writes defaultValue to `path` and throws an error prompting
|
|
107
|
+
* the developer to inspect and re-run.
|
|
108
|
+
*
|
|
109
|
+
* @param path - Path to the fixture file (.json, .hex, or .txt)
|
|
110
|
+
* @param defaultValue - Default value to write if fixture is missing
|
|
111
|
+
* @returns The fixture content
|
|
112
|
+
*/
|
|
113
|
+
async function getFixture(path, defaultValue) {
|
|
114
|
+
try {
|
|
115
|
+
await fs.promises.stat(mpath.dirname(path));
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
if (isNodeJsError(e) && e.code === "ENOENT") {
|
|
119
|
+
throw new Error(`fixture directory ${mpath.dirname(path)} not found, please create it first`);
|
|
120
|
+
}
|
|
121
|
+
throw e;
|
|
122
|
+
}
|
|
123
|
+
const encoding = fixtureEncoding(path);
|
|
124
|
+
try {
|
|
125
|
+
return decodeFixture(await fs.promises.readFile(path, "utf8"), encoding);
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
if (isNodeJsError(e) && e.code === "ENOENT") {
|
|
129
|
+
// eslint-disable-next-line no-restricted-globals
|
|
130
|
+
if (process.env.WRITE_FIXTURES === "0") {
|
|
131
|
+
throw new Error(`fixture ${path} not found, WRITE_FIXTURES=0`);
|
|
132
|
+
}
|
|
133
|
+
if (defaultValue === undefined) {
|
|
134
|
+
throw new Error(`fixture ${path} not found and no default value given`);
|
|
135
|
+
}
|
|
136
|
+
if (typeof defaultValue === "function") {
|
|
137
|
+
defaultValue = await defaultValue();
|
|
138
|
+
}
|
|
139
|
+
await fs.promises.writeFile(path, encodeFixture(defaultValue, encoding));
|
|
140
|
+
throw new Error(`wrote default value for ${path}, please inspect and restart test`);
|
|
141
|
+
}
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* JSON round-trip normalization.
|
|
147
|
+
* Converts a value to JSON and back, stripping non-serializable properties
|
|
148
|
+
* and normalizing types (e.g. undefined -> null in arrays).
|
|
149
|
+
*/
|
|
150
|
+
function jsonNormalize(v) {
|
|
151
|
+
return JSON.parse(JSON.stringify(v));
|
|
152
|
+
}
|
|
153
|
+
function matchPath(a, b) {
|
|
154
|
+
return a.length === b.length && a.every((e, i) => e === b[i]);
|
|
155
|
+
}
|
|
156
|
+
function includePath(opts, path) {
|
|
157
|
+
if (!opts.ignorePaths) {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
if (typeof opts.ignorePaths === "function") {
|
|
161
|
+
return !opts.ignorePaths(path);
|
|
162
|
+
}
|
|
163
|
+
return !opts.ignorePaths.some((ignorePath) => matchPath(path, ignorePath.split(".")));
|
|
164
|
+
}
|
|
165
|
+
function toPlainEntries(key, value, opts, path) {
|
|
166
|
+
if (!includePath(opts, [...path, key])) {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
169
|
+
if (value === undefined && (opts.skipUndefinedValues ?? true)) {
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
172
|
+
return [[key, toPlainObject(value, opts, [...path, key])]];
|
|
173
|
+
}
|
|
174
|
+
function getAllPropertyDescriptors(v) {
|
|
175
|
+
if (v === null || typeof v !== "object") {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
const descriptors = Object.getOwnPropertyDescriptors(v);
|
|
179
|
+
const proto = Object.getPrototypeOf(v);
|
|
180
|
+
if (proto) {
|
|
181
|
+
Object.assign(descriptors, getAllPropertyDescriptors(proto));
|
|
182
|
+
}
|
|
183
|
+
return descriptors;
|
|
184
|
+
}
|
|
185
|
+
function toPlainObjectFromPropertyDescriptors(v, opts, path) {
|
|
186
|
+
const descriptors = getAllPropertyDescriptors(v);
|
|
187
|
+
return Object.fromEntries(Object.entries(descriptors).flatMap(([key, descriptor]) => {
|
|
188
|
+
if (typeof descriptor.value === "function") {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
if (descriptor.value !== undefined) {
|
|
192
|
+
return toPlainEntries(key, descriptor.value, opts, path);
|
|
193
|
+
}
|
|
194
|
+
if (typeof descriptor.get === "function") {
|
|
195
|
+
return toPlainEntries(key, descriptor.get.call(v), opts, path);
|
|
196
|
+
}
|
|
197
|
+
return [];
|
|
198
|
+
}));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Recursively convert a value to a plain JSON-serializable object.
|
|
202
|
+
* Handles Uint8Array (to hex), bigint (to string), Buffer, and more.
|
|
203
|
+
*
|
|
204
|
+
* @param v - The value to convert
|
|
205
|
+
* @param opts - Options for customizing the conversion
|
|
206
|
+
* @param path - Current property path (used for ignorePaths)
|
|
207
|
+
*/
|
|
208
|
+
function toPlainObject(v, opts = {}, path = []) {
|
|
209
|
+
if (opts.apply) {
|
|
210
|
+
const result = opts.apply(v, path);
|
|
211
|
+
if (result !== undefined) {
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
switch (typeof v) {
|
|
216
|
+
case "string":
|
|
217
|
+
case "number":
|
|
218
|
+
case "boolean":
|
|
219
|
+
case "undefined":
|
|
220
|
+
return v;
|
|
221
|
+
case "bigint":
|
|
222
|
+
return v.toString();
|
|
223
|
+
case "function":
|
|
224
|
+
case "symbol":
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
if (v === null) {
|
|
228
|
+
return v;
|
|
229
|
+
}
|
|
230
|
+
if (v instanceof Uint8Array) {
|
|
231
|
+
return Array.from(v, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
232
|
+
}
|
|
233
|
+
if (Array.isArray(v)) {
|
|
234
|
+
return v.map((e, i) => toPlainObject(e, opts, [...path, i]));
|
|
235
|
+
}
|
|
236
|
+
if (typeof v === "object") {
|
|
237
|
+
const result = Object.fromEntries(Object.entries(v).flatMap(([key, value]) => toPlainEntries(key, value, opts, path)));
|
|
238
|
+
if (opts.propertyDescriptors) {
|
|
239
|
+
Object.assign(result, toPlainObjectFromPropertyDescriptors(v, opts, path));
|
|
240
|
+
}
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
throw new Error(`unknown v ${typeof v}`);
|
|
244
|
+
}
|
|
@@ -10,9 +10,34 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
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
|
+
});
|
|
13
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
20
|
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
16
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.descriptor = void 0;
|
|
17
40
|
__exportStar(require("./keys.js"), exports);
|
|
18
41
|
__exportStar(require("./AcidTest.js"), exports);
|
|
42
|
+
__exportStar(require("./fixtures.js"), exports);
|
|
43
|
+
exports.descriptor = __importStar(require("./descriptor/index.js"));
|
|
@@ -784,6 +784,26 @@ export class InscriptionsNamespace {
|
|
|
784
784
|
static sign_reveal_transaction(private_key: Uint8Array, tap_leaf_script: any, commit_tx: WasmTransaction, commit_output_script: Uint8Array, recipient_output_script: Uint8Array, output_value_sats: bigint): Uint8Array;
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
+
export class MessageNamespace {
|
|
788
|
+
private constructor();
|
|
789
|
+
free(): void;
|
|
790
|
+
[Symbol.dispose](): void;
|
|
791
|
+
/**
|
|
792
|
+
* Sign a message using Bitcoin message signing (BIP-137)
|
|
793
|
+
*
|
|
794
|
+
* Returns 65-byte signature (1-byte header + 64-byte signature).
|
|
795
|
+
* The key must have a private key (cannot sign with public key only).
|
|
796
|
+
*/
|
|
797
|
+
static sign_message(key: WasmECPair, message_str: string): Uint8Array;
|
|
798
|
+
/**
|
|
799
|
+
* Verify a Bitcoin message signature (BIP-137)
|
|
800
|
+
*
|
|
801
|
+
* Signature must be 65 bytes (1-byte header + 64-byte signature).
|
|
802
|
+
* Returns true if the signature is valid for this key.
|
|
803
|
+
*/
|
|
804
|
+
static verify_message(key: WasmECPair, message_str: string, signature: Uint8Array): boolean;
|
|
805
|
+
}
|
|
806
|
+
|
|
787
807
|
export class UtxolibCompatNamespace {
|
|
788
808
|
private constructor();
|
|
789
809
|
free(): void;
|
|
@@ -828,6 +848,12 @@ export class WasmBIP32 {
|
|
|
828
848
|
* Derive a key using a derivation path (e.g., "0/1/2" or "m/0/1/2")
|
|
829
849
|
*/
|
|
830
850
|
derive_path(path: string): WasmBIP32;
|
|
851
|
+
/**
|
|
852
|
+
* Check equality with another WasmBIP32 key.
|
|
853
|
+
* Two keys are equal if they have the same type (public/private) and identical
|
|
854
|
+
* BIP32 metadata (depth, parent fingerprint, child index, chain code, key data).
|
|
855
|
+
*/
|
|
856
|
+
equals(other: WasmBIP32): boolean;
|
|
831
857
|
/**
|
|
832
858
|
* Create a BIP32 key from a base58 string (xpub/xprv/tpub/tprv)
|
|
833
859
|
*/
|
|
@@ -1334,6 +1360,13 @@ export class WrapPsbt {
|
|
|
1334
1360
|
* for each output. This is useful for introspecting the PSBT structure.
|
|
1335
1361
|
*/
|
|
1336
1362
|
getOutputs(): any;
|
|
1363
|
+
/**
|
|
1364
|
+
* Get all PSBT outputs with resolved address strings.
|
|
1365
|
+
*
|
|
1366
|
+
* Like `getOutputs()` but each element also includes an `address` field
|
|
1367
|
+
* derived from the output script using the given coin name (e.g. "btc", "tbtc").
|
|
1368
|
+
*/
|
|
1369
|
+
getOutputsWithAddress(coin: string): any;
|
|
1337
1370
|
/**
|
|
1338
1371
|
* Get partial signatures for an input
|
|
1339
1372
|
* Returns array of { pubkey: Uint8Array, signature: Uint8Array }
|
|
@@ -2012,6 +2012,78 @@ class InscriptionsNamespace {
|
|
|
2012
2012
|
if (Symbol.dispose) InscriptionsNamespace.prototype[Symbol.dispose] = InscriptionsNamespace.prototype.free;
|
|
2013
2013
|
exports.InscriptionsNamespace = InscriptionsNamespace;
|
|
2014
2014
|
|
|
2015
|
+
class MessageNamespace {
|
|
2016
|
+
__destroy_into_raw() {
|
|
2017
|
+
const ptr = this.__wbg_ptr;
|
|
2018
|
+
this.__wbg_ptr = 0;
|
|
2019
|
+
MessageNamespaceFinalization.unregister(this);
|
|
2020
|
+
return ptr;
|
|
2021
|
+
}
|
|
2022
|
+
free() {
|
|
2023
|
+
const ptr = this.__destroy_into_raw();
|
|
2024
|
+
wasm.__wbg_messagenamespace_free(ptr, 0);
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Sign a message using Bitcoin message signing (BIP-137)
|
|
2028
|
+
*
|
|
2029
|
+
* Returns 65-byte signature (1-byte header + 64-byte signature).
|
|
2030
|
+
* The key must have a private key (cannot sign with public key only).
|
|
2031
|
+
* @param {WasmECPair} key
|
|
2032
|
+
* @param {string} message_str
|
|
2033
|
+
* @returns {Uint8Array}
|
|
2034
|
+
*/
|
|
2035
|
+
static sign_message(key, message_str) {
|
|
2036
|
+
try {
|
|
2037
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2038
|
+
_assertClass(key, WasmECPair);
|
|
2039
|
+
const ptr0 = passStringToWasm0(message_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2040
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2041
|
+
wasm.messagenamespace_sign_message(retptr, key.__wbg_ptr, ptr0, len0);
|
|
2042
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2043
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2044
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2045
|
+
if (r2) {
|
|
2046
|
+
throw takeObject(r1);
|
|
2047
|
+
}
|
|
2048
|
+
return takeObject(r0);
|
|
2049
|
+
} finally {
|
|
2050
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Verify a Bitcoin message signature (BIP-137)
|
|
2055
|
+
*
|
|
2056
|
+
* Signature must be 65 bytes (1-byte header + 64-byte signature).
|
|
2057
|
+
* Returns true if the signature is valid for this key.
|
|
2058
|
+
* @param {WasmECPair} key
|
|
2059
|
+
* @param {string} message_str
|
|
2060
|
+
* @param {Uint8Array} signature
|
|
2061
|
+
* @returns {boolean}
|
|
2062
|
+
*/
|
|
2063
|
+
static verify_message(key, message_str, signature) {
|
|
2064
|
+
try {
|
|
2065
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
2066
|
+
_assertClass(key, WasmECPair);
|
|
2067
|
+
const ptr0 = passStringToWasm0(message_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
2068
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2069
|
+
const ptr1 = passArray8ToWasm0(signature, wasm.__wbindgen_export);
|
|
2070
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2071
|
+
wasm.messagenamespace_verify_message(retptr, key.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2072
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
2073
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
2074
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
2075
|
+
if (r2) {
|
|
2076
|
+
throw takeObject(r1);
|
|
2077
|
+
}
|
|
2078
|
+
return r0 !== 0;
|
|
2079
|
+
} finally {
|
|
2080
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
if (Symbol.dispose) MessageNamespace.prototype[Symbol.dispose] = MessageNamespace.prototype.free;
|
|
2085
|
+
exports.MessageNamespace = MessageNamespace;
|
|
2086
|
+
|
|
2015
2087
|
class UtxolibCompatNamespace {
|
|
2016
2088
|
__destroy_into_raw() {
|
|
2017
2089
|
const ptr = this.__wbg_ptr;
|
|
@@ -2201,6 +2273,18 @@ class WasmBIP32 {
|
|
|
2201
2273
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
2202
2274
|
}
|
|
2203
2275
|
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Check equality with another WasmBIP32 key.
|
|
2278
|
+
* Two keys are equal if they have the same type (public/private) and identical
|
|
2279
|
+
* BIP32 metadata (depth, parent fingerprint, child index, chain code, key data).
|
|
2280
|
+
* @param {WasmBIP32} other
|
|
2281
|
+
* @returns {boolean}
|
|
2282
|
+
*/
|
|
2283
|
+
equals(other) {
|
|
2284
|
+
_assertClass(other, WasmBIP32);
|
|
2285
|
+
const ret = wasm.wasmbip32_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
2286
|
+
return ret !== 0;
|
|
2287
|
+
}
|
|
2204
2288
|
/**
|
|
2205
2289
|
* Get the fingerprint as a Uint8Array
|
|
2206
2290
|
* @returns {Uint8Array}
|
|
@@ -4146,6 +4230,31 @@ class WrapPsbt {
|
|
|
4146
4230
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4147
4231
|
}
|
|
4148
4232
|
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Get all PSBT outputs with resolved address strings.
|
|
4235
|
+
*
|
|
4236
|
+
* Like `getOutputs()` but each element also includes an `address` field
|
|
4237
|
+
* derived from the output script using the given coin name (e.g. "btc", "tbtc").
|
|
4238
|
+
* @param {string} coin
|
|
4239
|
+
* @returns {any}
|
|
4240
|
+
*/
|
|
4241
|
+
getOutputsWithAddress(coin) {
|
|
4242
|
+
try {
|
|
4243
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
4244
|
+
const ptr0 = passStringToWasm0(coin, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
4245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4246
|
+
wasm.wrappsbt_getOutputsWithAddress(retptr, this.__wbg_ptr, ptr0, len0);
|
|
4247
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
4248
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
4249
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
4250
|
+
if (r2) {
|
|
4251
|
+
throw takeObject(r1);
|
|
4252
|
+
}
|
|
4253
|
+
return takeObject(r0);
|
|
4254
|
+
} finally {
|
|
4255
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
4256
|
+
}
|
|
4257
|
+
}
|
|
4149
4258
|
/**
|
|
4150
4259
|
* Get partial signatures for an input
|
|
4151
4260
|
* Returns array of { pubkey: Uint8Array, signature: Uint8Array }
|
|
@@ -4709,6 +4818,9 @@ const FixedScriptWalletNamespaceFinalization = (typeof FinalizationRegistry ===
|
|
|
4709
4818
|
const InscriptionsNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4710
4819
|
? { register: () => {}, unregister: () => {} }
|
|
4711
4820
|
: new FinalizationRegistry(ptr => wasm.__wbg_inscriptionsnamespace_free(ptr >>> 0, 1));
|
|
4821
|
+
const MessageNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4822
|
+
? { register: () => {}, unregister: () => {} }
|
|
4823
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_messagenamespace_free(ptr >>> 0, 1));
|
|
4712
4824
|
const UtxolibCompatNamespaceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
4713
4825
|
? { register: () => {}, unregister: () => {} }
|
|
4714
4826
|
: new FinalizationRegistry(ptr => wasm.__wbg_utxolibcompatnamespace_free(ptr >>> 0, 1));
|
|
Binary file
|