@meshsdk/wallet 2.0.0-beta.4 → 2.0.0-beta.5
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/index.js +631 -78
- package/package.json +2 -2
- package/dist/index.d.cts +0 -518
package/dist/index.js
CHANGED
|
@@ -4,13 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
-
}) : x)(function(x) {
|
|
10
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
-
});
|
|
13
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
14
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
9
|
};
|
|
16
10
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -30,14 +24,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
24
|
mod
|
|
31
25
|
));
|
|
32
26
|
|
|
33
|
-
// node_modules/@noble/hashes/
|
|
34
|
-
var
|
|
35
|
-
"node_modules/@noble/hashes/
|
|
27
|
+
// node_modules/@noble/hashes/crypto.js
|
|
28
|
+
var require_crypto = __commonJS({
|
|
29
|
+
"node_modules/@noble/hashes/crypto.js"(exports) {
|
|
36
30
|
"use strict";
|
|
37
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
32
|
exports.crypto = void 0;
|
|
39
|
-
|
|
40
|
-
exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
|
33
|
+
exports.crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
41
34
|
}
|
|
42
35
|
});
|
|
43
36
|
|
|
@@ -74,7 +67,7 @@ var require_utils = __commonJS({
|
|
|
74
67
|
exports.createOptHasher = createOptHasher;
|
|
75
68
|
exports.createXOFer = createXOFer;
|
|
76
69
|
exports.randomBytes = randomBytes;
|
|
77
|
-
var crypto_1 =
|
|
70
|
+
var crypto_1 = require_crypto();
|
|
78
71
|
function isBytes2(a) {
|
|
79
72
|
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
80
73
|
}
|
|
@@ -22185,122 +22178,682 @@ var require_nanoassert = __commonJS({
|
|
|
22185
22178
|
}
|
|
22186
22179
|
});
|
|
22187
22180
|
|
|
22188
|
-
// node_modules/b4a/
|
|
22189
|
-
var
|
|
22190
|
-
"node_modules/b4a/
|
|
22181
|
+
// node_modules/b4a/lib/ascii.js
|
|
22182
|
+
var require_ascii = __commonJS({
|
|
22183
|
+
"node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
22184
|
+
function byteLength(string) {
|
|
22185
|
+
return string.length;
|
|
22186
|
+
}
|
|
22187
|
+
function toString(buffer) {
|
|
22188
|
+
const len = buffer.byteLength;
|
|
22189
|
+
let result = "";
|
|
22190
|
+
for (let i = 0; i < len; i++) {
|
|
22191
|
+
result += String.fromCharCode(buffer[i]);
|
|
22192
|
+
}
|
|
22193
|
+
return result;
|
|
22194
|
+
}
|
|
22195
|
+
function write(buffer, string) {
|
|
22196
|
+
const len = buffer.byteLength;
|
|
22197
|
+
for (let i = 0; i < len; i++) {
|
|
22198
|
+
buffer[i] = string.charCodeAt(i);
|
|
22199
|
+
}
|
|
22200
|
+
return len;
|
|
22201
|
+
}
|
|
22202
|
+
module.exports = {
|
|
22203
|
+
byteLength,
|
|
22204
|
+
toString,
|
|
22205
|
+
write
|
|
22206
|
+
};
|
|
22207
|
+
}
|
|
22208
|
+
});
|
|
22209
|
+
|
|
22210
|
+
// node_modules/b4a/lib/base64.js
|
|
22211
|
+
var require_base64 = __commonJS({
|
|
22212
|
+
"node_modules/b4a/lib/base64.js"(exports, module) {
|
|
22213
|
+
var alphabet2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
22214
|
+
var codes = new Uint8Array(256);
|
|
22215
|
+
for (let i = 0; i < alphabet2.length; i++) {
|
|
22216
|
+
codes[alphabet2.charCodeAt(i)] = i;
|
|
22217
|
+
}
|
|
22218
|
+
codes[
|
|
22219
|
+
/* - */
|
|
22220
|
+
45
|
|
22221
|
+
] = 62;
|
|
22222
|
+
codes[
|
|
22223
|
+
/* _ */
|
|
22224
|
+
95
|
|
22225
|
+
] = 63;
|
|
22226
|
+
function byteLength(string) {
|
|
22227
|
+
let len = string.length;
|
|
22228
|
+
if (string.charCodeAt(len - 1) === 61) len--;
|
|
22229
|
+
if (len > 1 && string.charCodeAt(len - 1) === 61) len--;
|
|
22230
|
+
return len * 3 >>> 2;
|
|
22231
|
+
}
|
|
22232
|
+
function toString(buffer) {
|
|
22233
|
+
const len = buffer.byteLength;
|
|
22234
|
+
let result = "";
|
|
22235
|
+
for (let i = 0; i < len; i += 3) {
|
|
22236
|
+
result += alphabet2[buffer[i] >> 2] + alphabet2[(buffer[i] & 3) << 4 | buffer[i + 1] >> 4] + alphabet2[(buffer[i + 1] & 15) << 2 | buffer[i + 2] >> 6] + alphabet2[buffer[i + 2] & 63];
|
|
22237
|
+
}
|
|
22238
|
+
if (len % 3 === 2) {
|
|
22239
|
+
result = result.substring(0, result.length - 1) + "=";
|
|
22240
|
+
} else if (len % 3 === 1) {
|
|
22241
|
+
result = result.substring(0, result.length - 2) + "==";
|
|
22242
|
+
}
|
|
22243
|
+
return result;
|
|
22244
|
+
}
|
|
22245
|
+
function write(buffer, string) {
|
|
22246
|
+
const len = buffer.byteLength;
|
|
22247
|
+
for (let i = 0, j = 0; j < len; i += 4) {
|
|
22248
|
+
const a = codes[string.charCodeAt(i)];
|
|
22249
|
+
const b = codes[string.charCodeAt(i + 1)];
|
|
22250
|
+
const c = codes[string.charCodeAt(i + 2)];
|
|
22251
|
+
const d = codes[string.charCodeAt(i + 3)];
|
|
22252
|
+
buffer[j++] = a << 2 | b >> 4;
|
|
22253
|
+
buffer[j++] = (b & 15) << 4 | c >> 2;
|
|
22254
|
+
buffer[j++] = (c & 3) << 6 | d & 63;
|
|
22255
|
+
}
|
|
22256
|
+
return len;
|
|
22257
|
+
}
|
|
22258
|
+
module.exports = {
|
|
22259
|
+
byteLength,
|
|
22260
|
+
toString,
|
|
22261
|
+
write
|
|
22262
|
+
};
|
|
22263
|
+
}
|
|
22264
|
+
});
|
|
22265
|
+
|
|
22266
|
+
// node_modules/b4a/lib/hex.js
|
|
22267
|
+
var require_hex = __commonJS({
|
|
22268
|
+
"node_modules/b4a/lib/hex.js"(exports, module) {
|
|
22269
|
+
function byteLength(string) {
|
|
22270
|
+
return string.length >>> 1;
|
|
22271
|
+
}
|
|
22272
|
+
function toString(buffer) {
|
|
22273
|
+
const len = buffer.byteLength;
|
|
22274
|
+
buffer = new DataView(buffer.buffer, buffer.byteOffset, len);
|
|
22275
|
+
let result = "";
|
|
22276
|
+
let i = 0;
|
|
22277
|
+
for (let n = len - len % 4; i < n; i += 4) {
|
|
22278
|
+
result += buffer.getUint32(i).toString(16).padStart(8, "0");
|
|
22279
|
+
}
|
|
22280
|
+
for (; i < len; i++) {
|
|
22281
|
+
result += buffer.getUint8(i).toString(16).padStart(2, "0");
|
|
22282
|
+
}
|
|
22283
|
+
return result;
|
|
22284
|
+
}
|
|
22285
|
+
function write(buffer, string) {
|
|
22286
|
+
const len = buffer.byteLength;
|
|
22287
|
+
for (let i = 0; i < len; i++) {
|
|
22288
|
+
const a = hexValue(string.charCodeAt(i * 2));
|
|
22289
|
+
const b = hexValue(string.charCodeAt(i * 2 + 1));
|
|
22290
|
+
if (a === void 0 || b === void 0) {
|
|
22291
|
+
return buffer.subarray(0, i);
|
|
22292
|
+
}
|
|
22293
|
+
buffer[i] = a << 4 | b;
|
|
22294
|
+
}
|
|
22295
|
+
return len;
|
|
22296
|
+
}
|
|
22297
|
+
module.exports = {
|
|
22298
|
+
byteLength,
|
|
22299
|
+
toString,
|
|
22300
|
+
write
|
|
22301
|
+
};
|
|
22302
|
+
function hexValue(char) {
|
|
22303
|
+
if (char >= 48 && char <= 57) return char - 48;
|
|
22304
|
+
if (char >= 65 && char <= 70) return char - 65 + 10;
|
|
22305
|
+
if (char >= 97 && char <= 102) return char - 97 + 10;
|
|
22306
|
+
}
|
|
22307
|
+
}
|
|
22308
|
+
});
|
|
22309
|
+
|
|
22310
|
+
// node_modules/b4a/lib/utf8.js
|
|
22311
|
+
var require_utf8 = __commonJS({
|
|
22312
|
+
"node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
22313
|
+
function byteLength(string) {
|
|
22314
|
+
let length = 0;
|
|
22315
|
+
for (let i = 0, n = string.length; i < n; i++) {
|
|
22316
|
+
const code = string.charCodeAt(i);
|
|
22317
|
+
if (code >= 55296 && code <= 56319 && i + 1 < n) {
|
|
22318
|
+
const code2 = string.charCodeAt(i + 1);
|
|
22319
|
+
if (code2 >= 56320 && code2 <= 57343) {
|
|
22320
|
+
length += 4;
|
|
22321
|
+
i++;
|
|
22322
|
+
continue;
|
|
22323
|
+
}
|
|
22324
|
+
}
|
|
22325
|
+
if (code <= 127) length += 1;
|
|
22326
|
+
else if (code <= 2047) length += 2;
|
|
22327
|
+
else length += 3;
|
|
22328
|
+
}
|
|
22329
|
+
return length;
|
|
22330
|
+
}
|
|
22331
|
+
var toString;
|
|
22332
|
+
if (typeof TextDecoder !== "undefined") {
|
|
22333
|
+
const decoder = new TextDecoder();
|
|
22334
|
+
toString = function toString2(buffer) {
|
|
22335
|
+
return decoder.decode(buffer);
|
|
22336
|
+
};
|
|
22337
|
+
} else {
|
|
22338
|
+
toString = function toString2(buffer) {
|
|
22339
|
+
const len = buffer.byteLength;
|
|
22340
|
+
let output = "";
|
|
22341
|
+
let i = 0;
|
|
22342
|
+
while (i < len) {
|
|
22343
|
+
let byte = buffer[i];
|
|
22344
|
+
if (byte <= 127) {
|
|
22345
|
+
output += String.fromCharCode(byte);
|
|
22346
|
+
i++;
|
|
22347
|
+
continue;
|
|
22348
|
+
}
|
|
22349
|
+
let bytesNeeded = 0;
|
|
22350
|
+
let codePoint = 0;
|
|
22351
|
+
if (byte <= 223) {
|
|
22352
|
+
bytesNeeded = 1;
|
|
22353
|
+
codePoint = byte & 31;
|
|
22354
|
+
} else if (byte <= 239) {
|
|
22355
|
+
bytesNeeded = 2;
|
|
22356
|
+
codePoint = byte & 15;
|
|
22357
|
+
} else if (byte <= 244) {
|
|
22358
|
+
bytesNeeded = 3;
|
|
22359
|
+
codePoint = byte & 7;
|
|
22360
|
+
}
|
|
22361
|
+
if (len - i - bytesNeeded > 0) {
|
|
22362
|
+
let k = 0;
|
|
22363
|
+
while (k < bytesNeeded) {
|
|
22364
|
+
byte = buffer[i + k + 1];
|
|
22365
|
+
codePoint = codePoint << 6 | byte & 63;
|
|
22366
|
+
k += 1;
|
|
22367
|
+
}
|
|
22368
|
+
} else {
|
|
22369
|
+
codePoint = 65533;
|
|
22370
|
+
bytesNeeded = len - i;
|
|
22371
|
+
}
|
|
22372
|
+
output += String.fromCodePoint(codePoint);
|
|
22373
|
+
i += bytesNeeded + 1;
|
|
22374
|
+
}
|
|
22375
|
+
return output;
|
|
22376
|
+
};
|
|
22377
|
+
}
|
|
22378
|
+
var write;
|
|
22379
|
+
if (typeof TextEncoder !== "undefined") {
|
|
22380
|
+
const encoder = new TextEncoder();
|
|
22381
|
+
write = function write2(buffer, string) {
|
|
22382
|
+
return encoder.encodeInto(string, buffer).written;
|
|
22383
|
+
};
|
|
22384
|
+
} else {
|
|
22385
|
+
write = function write2(buffer, string) {
|
|
22386
|
+
const len = buffer.byteLength;
|
|
22387
|
+
let i = 0;
|
|
22388
|
+
let j = 0;
|
|
22389
|
+
while (i < string.length) {
|
|
22390
|
+
const code = string.codePointAt(i);
|
|
22391
|
+
if (code <= 127) {
|
|
22392
|
+
buffer[j++] = code;
|
|
22393
|
+
i++;
|
|
22394
|
+
continue;
|
|
22395
|
+
}
|
|
22396
|
+
let count = 0;
|
|
22397
|
+
let bits = 0;
|
|
22398
|
+
if (code <= 2047) {
|
|
22399
|
+
count = 6;
|
|
22400
|
+
bits = 192;
|
|
22401
|
+
} else if (code <= 65535) {
|
|
22402
|
+
count = 12;
|
|
22403
|
+
bits = 224;
|
|
22404
|
+
} else if (code <= 2097151) {
|
|
22405
|
+
count = 18;
|
|
22406
|
+
bits = 240;
|
|
22407
|
+
}
|
|
22408
|
+
buffer[j++] = bits | code >> count;
|
|
22409
|
+
count -= 6;
|
|
22410
|
+
while (count >= 0) {
|
|
22411
|
+
buffer[j++] = 128 | code >> count & 63;
|
|
22412
|
+
count -= 6;
|
|
22413
|
+
}
|
|
22414
|
+
i += code >= 65536 ? 2 : 1;
|
|
22415
|
+
}
|
|
22416
|
+
return len;
|
|
22417
|
+
};
|
|
22418
|
+
}
|
|
22419
|
+
module.exports = {
|
|
22420
|
+
byteLength,
|
|
22421
|
+
toString,
|
|
22422
|
+
write
|
|
22423
|
+
};
|
|
22424
|
+
}
|
|
22425
|
+
});
|
|
22426
|
+
|
|
22427
|
+
// node_modules/b4a/lib/utf16le.js
|
|
22428
|
+
var require_utf16le = __commonJS({
|
|
22429
|
+
"node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
22430
|
+
function byteLength(string) {
|
|
22431
|
+
return string.length * 2;
|
|
22432
|
+
}
|
|
22433
|
+
function toString(buffer) {
|
|
22434
|
+
const len = buffer.byteLength;
|
|
22435
|
+
let result = "";
|
|
22436
|
+
for (let i = 0; i < len - 1; i += 2) {
|
|
22437
|
+
result += String.fromCharCode(buffer[i] + buffer[i + 1] * 256);
|
|
22438
|
+
}
|
|
22439
|
+
return result;
|
|
22440
|
+
}
|
|
22441
|
+
function write(buffer, string) {
|
|
22442
|
+
const len = buffer.byteLength;
|
|
22443
|
+
let units = len;
|
|
22444
|
+
for (let i = 0; i < string.length; ++i) {
|
|
22445
|
+
if ((units -= 2) < 0) break;
|
|
22446
|
+
const c = string.charCodeAt(i);
|
|
22447
|
+
const hi = c >> 8;
|
|
22448
|
+
const lo = c % 256;
|
|
22449
|
+
buffer[i * 2] = lo;
|
|
22450
|
+
buffer[i * 2 + 1] = hi;
|
|
22451
|
+
}
|
|
22452
|
+
return len;
|
|
22453
|
+
}
|
|
22454
|
+
module.exports = {
|
|
22455
|
+
byteLength,
|
|
22456
|
+
toString,
|
|
22457
|
+
write
|
|
22458
|
+
};
|
|
22459
|
+
}
|
|
22460
|
+
});
|
|
22461
|
+
|
|
22462
|
+
// node_modules/b4a/browser.js
|
|
22463
|
+
var require_browser = __commonJS({
|
|
22464
|
+
"node_modules/b4a/browser.js"(exports, module) {
|
|
22465
|
+
var ascii = require_ascii();
|
|
22466
|
+
var base64 = require_base64();
|
|
22467
|
+
var hex = require_hex();
|
|
22468
|
+
var utf8 = require_utf8();
|
|
22469
|
+
var utf16le = require_utf16le();
|
|
22470
|
+
var LE = new Uint8Array(Uint16Array.of(255).buffer)[0] === 255;
|
|
22471
|
+
function codecFor(encoding) {
|
|
22472
|
+
switch (encoding) {
|
|
22473
|
+
case "ascii":
|
|
22474
|
+
return ascii;
|
|
22475
|
+
case "base64":
|
|
22476
|
+
return base64;
|
|
22477
|
+
case "hex":
|
|
22478
|
+
return hex;
|
|
22479
|
+
case "utf8":
|
|
22480
|
+
case "utf-8":
|
|
22481
|
+
case void 0:
|
|
22482
|
+
case null:
|
|
22483
|
+
return utf8;
|
|
22484
|
+
case "ucs2":
|
|
22485
|
+
case "ucs-2":
|
|
22486
|
+
case "utf16le":
|
|
22487
|
+
case "utf-16le":
|
|
22488
|
+
return utf16le;
|
|
22489
|
+
default:
|
|
22490
|
+
throw new Error(`Unknown encoding '${encoding}'`);
|
|
22491
|
+
}
|
|
22492
|
+
}
|
|
22191
22493
|
function isBuffer(value) {
|
|
22192
|
-
return
|
|
22494
|
+
return value instanceof Uint8Array;
|
|
22193
22495
|
}
|
|
22194
22496
|
function isEncoding(encoding) {
|
|
22195
|
-
|
|
22497
|
+
try {
|
|
22498
|
+
codecFor(encoding);
|
|
22499
|
+
return true;
|
|
22500
|
+
} catch {
|
|
22501
|
+
return false;
|
|
22502
|
+
}
|
|
22196
22503
|
}
|
|
22197
22504
|
function alloc(size, fill2, encoding) {
|
|
22198
|
-
|
|
22505
|
+
const buffer = new Uint8Array(size);
|
|
22506
|
+
if (fill2 !== void 0) {
|
|
22507
|
+
exports.fill(buffer, fill2, 0, buffer.byteLength, encoding);
|
|
22508
|
+
}
|
|
22509
|
+
return buffer;
|
|
22199
22510
|
}
|
|
22200
22511
|
function allocUnsafe(size) {
|
|
22201
|
-
return
|
|
22512
|
+
return new Uint8Array(size);
|
|
22202
22513
|
}
|
|
22203
22514
|
function allocUnsafeSlow(size) {
|
|
22204
|
-
return
|
|
22515
|
+
return new Uint8Array(size);
|
|
22205
22516
|
}
|
|
22206
22517
|
function byteLength(string, encoding) {
|
|
22207
|
-
return
|
|
22518
|
+
return codecFor(encoding).byteLength(string);
|
|
22208
22519
|
}
|
|
22209
22520
|
function compare(a, b) {
|
|
22210
|
-
|
|
22521
|
+
if (a === b) return 0;
|
|
22522
|
+
const len = Math.min(a.byteLength, b.byteLength);
|
|
22523
|
+
a = new DataView(a.buffer, a.byteOffset, a.byteLength);
|
|
22524
|
+
b = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
|
22525
|
+
let i = 0;
|
|
22526
|
+
for (let n = len - len % 4; i < n; i += 4) {
|
|
22527
|
+
const x = a.getUint32(i, LE);
|
|
22528
|
+
const y = b.getUint32(i, LE);
|
|
22529
|
+
if (x !== y) break;
|
|
22530
|
+
}
|
|
22531
|
+
for (; i < len; i++) {
|
|
22532
|
+
const x = a.getUint8(i);
|
|
22533
|
+
const y = b.getUint8(i);
|
|
22534
|
+
if (x < y) return -1;
|
|
22535
|
+
if (x > y) return 1;
|
|
22536
|
+
}
|
|
22537
|
+
return a.byteLength > b.byteLength ? 1 : a.byteLength < b.byteLength ? -1 : 0;
|
|
22211
22538
|
}
|
|
22212
|
-
function concat(buffers,
|
|
22213
|
-
|
|
22539
|
+
function concat(buffers, length) {
|
|
22540
|
+
if (length === void 0) {
|
|
22541
|
+
length = buffers.reduce((len, buffer) => len + buffer.byteLength, 0);
|
|
22542
|
+
}
|
|
22543
|
+
const result = new Uint8Array(length);
|
|
22544
|
+
let offset = 0;
|
|
22545
|
+
for (const buffer of buffers) {
|
|
22546
|
+
if (offset + buffer.byteLength > result.byteLength) {
|
|
22547
|
+
result.set(buffer.subarray(0, result.byteLength - offset), offset);
|
|
22548
|
+
return result;
|
|
22549
|
+
}
|
|
22550
|
+
result.set(buffer, offset);
|
|
22551
|
+
offset += buffer.byteLength;
|
|
22552
|
+
}
|
|
22553
|
+
return result;
|
|
22214
22554
|
}
|
|
22215
|
-
function copy(source, target, targetStart,
|
|
22216
|
-
|
|
22555
|
+
function copy(source, target, targetStart = 0, sourceStart = 0, sourceEnd = source.byteLength) {
|
|
22556
|
+
if (targetStart < 0) targetStart = 0;
|
|
22557
|
+
if (targetStart >= target.byteLength) return 0;
|
|
22558
|
+
const targetLength = target.byteLength - targetStart;
|
|
22559
|
+
if (sourceStart < 0) sourceStart = 0;
|
|
22560
|
+
if (sourceStart >= source.byteLength) return 0;
|
|
22561
|
+
if (sourceEnd <= sourceStart) return 0;
|
|
22562
|
+
if (sourceEnd > source.byteLength) sourceEnd = source.byteLength;
|
|
22563
|
+
if (sourceEnd - sourceStart > targetLength) {
|
|
22564
|
+
sourceEnd = sourceStart + targetLength;
|
|
22565
|
+
}
|
|
22566
|
+
const sourceLength = sourceEnd - sourceStart;
|
|
22567
|
+
if (source === target) {
|
|
22568
|
+
target.copyWithin(targetStart, sourceStart, sourceEnd);
|
|
22569
|
+
} else {
|
|
22570
|
+
if (sourceStart !== 0 || sourceEnd !== source.byteLength) {
|
|
22571
|
+
source = source.subarray(sourceStart, sourceEnd);
|
|
22572
|
+
}
|
|
22573
|
+
target.set(source, targetStart);
|
|
22574
|
+
}
|
|
22575
|
+
return sourceLength;
|
|
22217
22576
|
}
|
|
22218
22577
|
function equals(a, b) {
|
|
22219
|
-
|
|
22578
|
+
if (a === b) return true;
|
|
22579
|
+
if (a.byteLength !== b.byteLength) return false;
|
|
22580
|
+
return compare(a, b) === 0;
|
|
22220
22581
|
}
|
|
22221
|
-
function fill(buffer, value, offset, end, encoding) {
|
|
22222
|
-
|
|
22582
|
+
function fill(buffer, value, offset = 0, end = buffer.byteLength, encoding = "utf8") {
|
|
22583
|
+
if (typeof value === "string") {
|
|
22584
|
+
if (typeof offset === "string") {
|
|
22585
|
+
encoding = offset;
|
|
22586
|
+
offset = 0;
|
|
22587
|
+
end = buffer.byteLength;
|
|
22588
|
+
} else if (typeof end === "string") {
|
|
22589
|
+
encoding = end;
|
|
22590
|
+
end = buffer.byteLength;
|
|
22591
|
+
}
|
|
22592
|
+
} else if (typeof value === "number") {
|
|
22593
|
+
value = value & 255;
|
|
22594
|
+
} else if (typeof value === "boolean") {
|
|
22595
|
+
value = +value;
|
|
22596
|
+
}
|
|
22597
|
+
if (offset < 0) offset = 0;
|
|
22598
|
+
if (offset >= buffer.byteLength) return buffer;
|
|
22599
|
+
if (end <= offset) return buffer;
|
|
22600
|
+
if (end > buffer.byteLength) end = buffer.byteLength;
|
|
22601
|
+
if (typeof value === "number") return buffer.fill(value, offset, end);
|
|
22602
|
+
if (typeof value === "string") value = exports.from(value, encoding);
|
|
22603
|
+
const len = value.byteLength;
|
|
22604
|
+
for (let i = 0, n = end - offset; i < n; ++i) {
|
|
22605
|
+
buffer[i + offset] = value[i % len];
|
|
22606
|
+
}
|
|
22607
|
+
return buffer;
|
|
22223
22608
|
}
|
|
22224
22609
|
function from(value, encodingOrOffset, length) {
|
|
22225
|
-
return
|
|
22610
|
+
if (typeof value === "string") return fromString(value, encodingOrOffset);
|
|
22611
|
+
if (Array.isArray(value)) return fromArray(value);
|
|
22612
|
+
if (ArrayBuffer.isView(value)) return fromBuffer(value);
|
|
22613
|
+
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
22614
|
+
}
|
|
22615
|
+
function fromString(string, encoding) {
|
|
22616
|
+
const codec = codecFor(encoding);
|
|
22617
|
+
const buffer = new Uint8Array(codec.byteLength(string));
|
|
22618
|
+
codec.write(buffer, string);
|
|
22619
|
+
return buffer;
|
|
22620
|
+
}
|
|
22621
|
+
function fromArray(array) {
|
|
22622
|
+
const buffer = new Uint8Array(array.length);
|
|
22623
|
+
buffer.set(array);
|
|
22624
|
+
return buffer;
|
|
22625
|
+
}
|
|
22626
|
+
function fromBuffer(buffer) {
|
|
22627
|
+
const copy2 = new Uint8Array(buffer.byteLength);
|
|
22628
|
+
copy2.set(buffer);
|
|
22629
|
+
return copy2;
|
|
22630
|
+
}
|
|
22631
|
+
function fromArrayBuffer(arrayBuffer, byteOffset, length) {
|
|
22632
|
+
return new Uint8Array(arrayBuffer, byteOffset, length);
|
|
22226
22633
|
}
|
|
22227
22634
|
function includes(buffer, value, byteOffset, encoding) {
|
|
22228
|
-
return
|
|
22635
|
+
return indexOf(buffer, value, byteOffset, encoding) !== -1;
|
|
22229
22636
|
}
|
|
22230
|
-
function indexOf(buffer, value,
|
|
22231
|
-
return
|
|
22637
|
+
function indexOf(buffer, value, byteOffset, encoding) {
|
|
22638
|
+
return bidirectionalIndexOf(
|
|
22639
|
+
buffer,
|
|
22640
|
+
value,
|
|
22641
|
+
byteOffset,
|
|
22642
|
+
encoding,
|
|
22643
|
+
true
|
|
22644
|
+
/* first */
|
|
22645
|
+
);
|
|
22232
22646
|
}
|
|
22233
22647
|
function lastIndexOf(buffer, value, byteOffset, encoding) {
|
|
22234
|
-
return
|
|
22648
|
+
return bidirectionalIndexOf(
|
|
22649
|
+
buffer,
|
|
22650
|
+
value,
|
|
22651
|
+
byteOffset,
|
|
22652
|
+
encoding,
|
|
22653
|
+
false
|
|
22654
|
+
/* last */
|
|
22655
|
+
);
|
|
22656
|
+
}
|
|
22657
|
+
function bidirectionalIndexOf(buffer, value, byteOffset, encoding, first) {
|
|
22658
|
+
if (buffer.byteLength === 0) return -1;
|
|
22659
|
+
if (typeof byteOffset === "string") {
|
|
22660
|
+
encoding = byteOffset;
|
|
22661
|
+
byteOffset = 0;
|
|
22662
|
+
} else if (byteOffset === void 0) {
|
|
22663
|
+
byteOffset = first ? 0 : buffer.length - 1;
|
|
22664
|
+
} else if (byteOffset < 0) {
|
|
22665
|
+
byteOffset += buffer.byteLength;
|
|
22666
|
+
}
|
|
22667
|
+
if (byteOffset >= buffer.byteLength) {
|
|
22668
|
+
if (first) return -1;
|
|
22669
|
+
else byteOffset = buffer.byteLength - 1;
|
|
22670
|
+
} else if (byteOffset < 0) {
|
|
22671
|
+
if (first) byteOffset = 0;
|
|
22672
|
+
else return -1;
|
|
22673
|
+
}
|
|
22674
|
+
if (typeof value === "string") {
|
|
22675
|
+
value = from(value, encoding);
|
|
22676
|
+
} else if (typeof value === "number") {
|
|
22677
|
+
value = value & 255;
|
|
22678
|
+
if (first) {
|
|
22679
|
+
return buffer.indexOf(value, byteOffset);
|
|
22680
|
+
} else {
|
|
22681
|
+
return buffer.lastIndexOf(value, byteOffset);
|
|
22682
|
+
}
|
|
22683
|
+
}
|
|
22684
|
+
if (value.byteLength === 0) return -1;
|
|
22685
|
+
if (first) {
|
|
22686
|
+
let foundIndex = -1;
|
|
22687
|
+
for (let i = byteOffset; i < buffer.byteLength; i++) {
|
|
22688
|
+
if (buffer[i] === value[foundIndex === -1 ? 0 : i - foundIndex]) {
|
|
22689
|
+
if (foundIndex === -1) foundIndex = i;
|
|
22690
|
+
if (i - foundIndex + 1 === value.byteLength) return foundIndex;
|
|
22691
|
+
} else {
|
|
22692
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
|
22693
|
+
foundIndex = -1;
|
|
22694
|
+
}
|
|
22695
|
+
}
|
|
22696
|
+
} else {
|
|
22697
|
+
if (byteOffset + value.byteLength > buffer.byteLength) {
|
|
22698
|
+
byteOffset = buffer.byteLength - value.byteLength;
|
|
22699
|
+
}
|
|
22700
|
+
for (let i = byteOffset; i >= 0; i--) {
|
|
22701
|
+
let found = true;
|
|
22702
|
+
for (let j = 0; j < value.byteLength; j++) {
|
|
22703
|
+
if (buffer[i + j] !== value[j]) {
|
|
22704
|
+
found = false;
|
|
22705
|
+
break;
|
|
22706
|
+
}
|
|
22707
|
+
}
|
|
22708
|
+
if (found) return i;
|
|
22709
|
+
}
|
|
22710
|
+
}
|
|
22711
|
+
return -1;
|
|
22712
|
+
}
|
|
22713
|
+
function swap(buffer, n, m) {
|
|
22714
|
+
const i = buffer[n];
|
|
22715
|
+
buffer[n] = buffer[m];
|
|
22716
|
+
buffer[m] = i;
|
|
22235
22717
|
}
|
|
22236
22718
|
function swap16(buffer) {
|
|
22237
|
-
|
|
22719
|
+
const len = buffer.byteLength;
|
|
22720
|
+
if (len % 2 !== 0)
|
|
22721
|
+
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
22722
|
+
for (let i = 0; i < len; i += 2) swap(buffer, i, i + 1);
|
|
22723
|
+
return buffer;
|
|
22238
22724
|
}
|
|
22239
22725
|
function swap32(buffer) {
|
|
22240
|
-
|
|
22726
|
+
const len = buffer.byteLength;
|
|
22727
|
+
if (len % 4 !== 0)
|
|
22728
|
+
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
22729
|
+
for (let i = 0; i < len; i += 4) {
|
|
22730
|
+
swap(buffer, i, i + 3);
|
|
22731
|
+
swap(buffer, i + 1, i + 2);
|
|
22732
|
+
}
|
|
22733
|
+
return buffer;
|
|
22241
22734
|
}
|
|
22242
22735
|
function swap64(buffer) {
|
|
22243
|
-
|
|
22736
|
+
const len = buffer.byteLength;
|
|
22737
|
+
if (len % 8 !== 0)
|
|
22738
|
+
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
22739
|
+
for (let i = 0; i < len; i += 8) {
|
|
22740
|
+
swap(buffer, i, i + 7);
|
|
22741
|
+
swap(buffer, i + 1, i + 6);
|
|
22742
|
+
swap(buffer, i + 2, i + 5);
|
|
22743
|
+
swap(buffer, i + 3, i + 4);
|
|
22744
|
+
}
|
|
22745
|
+
return buffer;
|
|
22244
22746
|
}
|
|
22245
22747
|
function toBuffer(buffer) {
|
|
22246
|
-
|
|
22247
|
-
return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22748
|
+
return buffer;
|
|
22248
22749
|
}
|
|
22249
|
-
function toString(buffer, encoding, start, end) {
|
|
22250
|
-
|
|
22750
|
+
function toString(buffer, encoding = "utf8", start = 0, end = buffer.byteLength) {
|
|
22751
|
+
if (arguments.length === 1) return utf8.toString(buffer);
|
|
22752
|
+
if (arguments.length === 2) return codecFor(encoding).toString(buffer);
|
|
22753
|
+
if (start < 0) start = 0;
|
|
22754
|
+
if (start >= buffer.byteLength) return "";
|
|
22755
|
+
if (end <= start) return "";
|
|
22756
|
+
if (end > buffer.byteLength) end = buffer.byteLength;
|
|
22757
|
+
if (start !== 0 || end !== buffer.byteLength) {
|
|
22758
|
+
buffer = buffer.subarray(start, end);
|
|
22759
|
+
}
|
|
22760
|
+
return codecFor(encoding).toString(buffer);
|
|
22251
22761
|
}
|
|
22252
22762
|
function write(buffer, string, offset, length, encoding) {
|
|
22253
|
-
|
|
22763
|
+
if (arguments.length === 2) return utf8.write(buffer, string);
|
|
22764
|
+
if (typeof offset === "string") {
|
|
22765
|
+
encoding = offset;
|
|
22766
|
+
offset = 0;
|
|
22767
|
+
length = buffer.byteLength;
|
|
22768
|
+
} else if (typeof length === "string") {
|
|
22769
|
+
encoding = length;
|
|
22770
|
+
length = buffer.byteLength - offset;
|
|
22771
|
+
}
|
|
22772
|
+
length = Math.min(length, exports.byteLength(string, encoding));
|
|
22773
|
+
let start = offset;
|
|
22774
|
+
if (start < 0) start = 0;
|
|
22775
|
+
if (start >= buffer.byteLength) return 0;
|
|
22776
|
+
let end = offset + length;
|
|
22777
|
+
if (end <= start) return 0;
|
|
22778
|
+
if (end > buffer.byteLength) end = buffer.byteLength;
|
|
22779
|
+
if (start !== 0 || end !== buffer.byteLength) {
|
|
22780
|
+
buffer = buffer.subarray(start, end);
|
|
22781
|
+
}
|
|
22782
|
+
return codecFor(encoding).write(buffer, string);
|
|
22254
22783
|
}
|
|
22255
|
-
function readDoubleBE(buffer, offset) {
|
|
22256
|
-
|
|
22784
|
+
function readDoubleBE(buffer, offset = 0) {
|
|
22785
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22786
|
+
return view.getFloat64(offset, false);
|
|
22257
22787
|
}
|
|
22258
|
-
function readDoubleLE(buffer, offset) {
|
|
22259
|
-
|
|
22788
|
+
function readDoubleLE(buffer, offset = 0) {
|
|
22789
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22790
|
+
return view.getFloat64(offset, true);
|
|
22260
22791
|
}
|
|
22261
|
-
function readFloatBE(buffer, offset) {
|
|
22262
|
-
|
|
22792
|
+
function readFloatBE(buffer, offset = 0) {
|
|
22793
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22794
|
+
return view.getFloat32(offset, false);
|
|
22263
22795
|
}
|
|
22264
|
-
function readFloatLE(buffer, offset) {
|
|
22265
|
-
|
|
22796
|
+
function readFloatLE(buffer, offset = 0) {
|
|
22797
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22798
|
+
return view.getFloat32(offset, true);
|
|
22266
22799
|
}
|
|
22267
|
-
function readInt32BE(buffer, offset) {
|
|
22268
|
-
|
|
22800
|
+
function readInt32BE(buffer, offset = 0) {
|
|
22801
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22802
|
+
return view.getInt32(offset, false);
|
|
22269
22803
|
}
|
|
22270
|
-
function readInt32LE(buffer, offset) {
|
|
22271
|
-
|
|
22804
|
+
function readInt32LE(buffer, offset = 0) {
|
|
22805
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22806
|
+
return view.getInt32(offset, true);
|
|
22272
22807
|
}
|
|
22273
|
-
function readUInt32BE(buffer, offset) {
|
|
22274
|
-
|
|
22808
|
+
function readUInt32BE(buffer, offset = 0) {
|
|
22809
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22810
|
+
return view.getUint32(offset, false);
|
|
22275
22811
|
}
|
|
22276
|
-
function readUInt32LE(buffer, offset) {
|
|
22277
|
-
|
|
22812
|
+
function readUInt32LE(buffer, offset = 0) {
|
|
22813
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22814
|
+
return view.getUint32(offset, true);
|
|
22278
22815
|
}
|
|
22279
|
-
function writeDoubleBE(buffer, value, offset) {
|
|
22280
|
-
|
|
22816
|
+
function writeDoubleBE(buffer, value, offset = 0) {
|
|
22817
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22818
|
+
view.setFloat64(offset, value, false);
|
|
22819
|
+
return offset + 8;
|
|
22281
22820
|
}
|
|
22282
|
-
function writeDoubleLE(buffer, value, offset) {
|
|
22283
|
-
|
|
22821
|
+
function writeDoubleLE(buffer, value, offset = 0) {
|
|
22822
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22823
|
+
view.setFloat64(offset, value, true);
|
|
22824
|
+
return offset + 8;
|
|
22284
22825
|
}
|
|
22285
|
-
function writeFloatBE(buffer, value, offset) {
|
|
22286
|
-
|
|
22826
|
+
function writeFloatBE(buffer, value, offset = 0) {
|
|
22827
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22828
|
+
view.setFloat32(offset, value, false);
|
|
22829
|
+
return offset + 4;
|
|
22287
22830
|
}
|
|
22288
|
-
function writeFloatLE(buffer, value, offset) {
|
|
22289
|
-
|
|
22831
|
+
function writeFloatLE(buffer, value, offset = 0) {
|
|
22832
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22833
|
+
view.setFloat32(offset, value, true);
|
|
22834
|
+
return offset + 4;
|
|
22290
22835
|
}
|
|
22291
|
-
function writeInt32BE(buffer, value, offset) {
|
|
22292
|
-
|
|
22836
|
+
function writeInt32BE(buffer, value, offset = 0) {
|
|
22837
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22838
|
+
view.setInt32(offset, value, false);
|
|
22839
|
+
return offset + 4;
|
|
22293
22840
|
}
|
|
22294
|
-
function writeInt32LE(buffer, value, offset) {
|
|
22295
|
-
|
|
22841
|
+
function writeInt32LE(buffer, value, offset = 0) {
|
|
22842
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22843
|
+
view.setInt32(offset, value, true);
|
|
22844
|
+
return offset + 4;
|
|
22296
22845
|
}
|
|
22297
|
-
function writeUInt32BE(buffer, value, offset) {
|
|
22298
|
-
|
|
22846
|
+
function writeUInt32BE(buffer, value, offset = 0) {
|
|
22847
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22848
|
+
view.setUint32(offset, value, false);
|
|
22849
|
+
return offset + 4;
|
|
22299
22850
|
}
|
|
22300
|
-
function writeUInt32LE(buffer, value, offset) {
|
|
22301
|
-
|
|
22851
|
+
function writeUInt32LE(buffer, value, offset = 0) {
|
|
22852
|
+
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
22853
|
+
view.setUint32(offset, value, true);
|
|
22854
|
+
return offset + 4;
|
|
22302
22855
|
}
|
|
22303
|
-
module.exports = {
|
|
22856
|
+
module.exports = exports = {
|
|
22304
22857
|
isBuffer,
|
|
22305
22858
|
isEncoding,
|
|
22306
22859
|
alloc,
|
|
@@ -22345,7 +22898,7 @@ var require_b4a = __commonJS({
|
|
|
22345
22898
|
// node_modules/blake2b-wasm/blake2b.js
|
|
22346
22899
|
var require_blake2b = __commonJS({
|
|
22347
22900
|
"node_modules/blake2b-wasm/blake2b.js"(exports, module) {
|
|
22348
|
-
var __commonJS2 = (cb, mod) => function
|
|
22901
|
+
var __commonJS2 = (cb, mod) => function __require() {
|
|
22349
22902
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
22350
22903
|
};
|
|
22351
22904
|
var __toBinary = /* @__PURE__ */ (() => {
|
|
@@ -22382,7 +22935,7 @@ var require_blake2b = __commonJS({
|
|
|
22382
22935
|
var require_blake2b_wasm = __commonJS({
|
|
22383
22936
|
"node_modules/blake2b-wasm/index.js"(exports, module) {
|
|
22384
22937
|
var assert = require_nanoassert();
|
|
22385
|
-
var b4a =
|
|
22938
|
+
var b4a = require_browser();
|
|
22386
22939
|
var wasm = null;
|
|
22387
22940
|
var wasmPromise = typeof WebAssembly !== "undefined" && require_blake2b()().then((mod) => {
|
|
22388
22941
|
wasm = mod;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshsdk/wallet",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.5",
|
|
4
4
|
"description": "Wallets - https://meshjs.dev/apis/wallets",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"browser": "./dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dist/**"
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
|
-
"build": "tsup
|
|
21
|
+
"build": "tsup",
|
|
22
22
|
"build:demo": "tsup demo/src/main.ts --format esm --outDir demo/dist --clean",
|
|
23
23
|
"dev:demo": "tsup demo/src/main.ts --format esm --outDir demo/dist --watch",
|
|
24
24
|
"preview:demo": "npx serve demo -p 5173",
|
package/dist/index.d.cts
DELETED
|
@@ -1,518 +0,0 @@
|
|
|
1
|
-
import { DataSignature, Extension as Extension$1, UTxO, Asset, IFetcher, ISubmitter } from '@meshsdk/common';
|
|
2
|
-
|
|
3
|
-
interface ISigner {
|
|
4
|
-
getPublicKey(): Promise<string>;
|
|
5
|
-
getPublicKeyHash(): Promise<string>;
|
|
6
|
-
sign(data: string): Promise<string>;
|
|
7
|
-
verify(data: string, signature: string): Promise<boolean>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type DerivationPath = number[] | string;
|
|
11
|
-
interface ISecretManager {
|
|
12
|
-
getPublicKey(derivationPath: DerivationPath): Promise<string>;
|
|
13
|
-
getSigner(derivationPath: DerivationPath): Promise<ISigner>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare class InMemoryBip32 implements ISecretManager {
|
|
17
|
-
private bip32PrivateKey;
|
|
18
|
-
private constructor();
|
|
19
|
-
static fromMnemonic(mnemonic: string[], password?: string): Promise<InMemoryBip32>;
|
|
20
|
-
static fromEntropy(entropy: string, password?: string): Promise<InMemoryBip32>;
|
|
21
|
-
static fromKeyHex(keyHex: string): InMemoryBip32;
|
|
22
|
-
static fromBech32(bech32: string): InMemoryBip32;
|
|
23
|
-
/**
|
|
24
|
-
* Get the Bip32 public key in hex format.
|
|
25
|
-
* @returns {Promise<string>} A promise that resolves to the public key in hex format.
|
|
26
|
-
*/
|
|
27
|
-
getPublicKey(): Promise<string>;
|
|
28
|
-
/**
|
|
29
|
-
* Get an ISigner instance initialized with the current Bip32 private key.
|
|
30
|
-
* @returns {Promise<ISigner>} A promise that resolves to an ISigner instance initialized with the current Bip32 private key.
|
|
31
|
-
*/
|
|
32
|
-
getSigner(derivationPath: DerivationPath): Promise<ISigner>;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* BaseSigner provides functionalities to sign and verify data using Ed25519 keys.
|
|
37
|
-
* It supports construction from both extended and normal private key hex formats.
|
|
38
|
-
*/
|
|
39
|
-
declare class BaseSigner implements ISigner {
|
|
40
|
-
private ed25519PrivateKey;
|
|
41
|
-
private constructor();
|
|
42
|
-
/**
|
|
43
|
-
* Create a BaseSigner instance from an Ed25519 private key in extended hex format.
|
|
44
|
-
* @param keyHex Ed25519 private key in extended hex format
|
|
45
|
-
* @returns {BaseSigner} A BaseSigner instance
|
|
46
|
-
*/
|
|
47
|
-
static fromExtendedKeyHex(keyHex: string): BaseSigner;
|
|
48
|
-
/**
|
|
49
|
-
* Create a BaseSigner instance from an Ed25519 private key in normal hex format.
|
|
50
|
-
* @param keyHex Ed25519 private key in normal hex format
|
|
51
|
-
* @returns {BaseSigner} A BaseSigner instance
|
|
52
|
-
*/
|
|
53
|
-
static fromNormalKeyHex(keyHex: string): BaseSigner;
|
|
54
|
-
static fromKeyHex(keyHex: string): BaseSigner;
|
|
55
|
-
/**
|
|
56
|
-
* Get the Ed25519 public key in hex format.
|
|
57
|
-
* @returns {Promise<string>} A promise that resolves to the public key in hex format.
|
|
58
|
-
*/
|
|
59
|
-
getPublicKey(): Promise<string>;
|
|
60
|
-
/**
|
|
61
|
-
* Get the Ed25519 public key hash in hex format.
|
|
62
|
-
* @returns {Promise<string>} A promise that resolves to the public key hash in hex format.
|
|
63
|
-
*/
|
|
64
|
-
getPublicKeyHash(): Promise<string>;
|
|
65
|
-
/**
|
|
66
|
-
* Sign data using the Ed25519 private key.
|
|
67
|
-
* @param data data to be signed in hex format
|
|
68
|
-
* @returns {Promise<string>} A promise that resolves to the signature in hex format.
|
|
69
|
-
*/
|
|
70
|
-
sign(data: string): Promise<string>;
|
|
71
|
-
/**
|
|
72
|
-
* Verify a signature using the Ed25519 public key.
|
|
73
|
-
* @param data The original data in hex format.
|
|
74
|
-
* @param signature The signature to verify in hex format.
|
|
75
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the signature is valid, false otherwise.
|
|
76
|
-
*/
|
|
77
|
-
verify(data: string, signature: string): Promise<boolean>;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
declare enum CredentialType {
|
|
81
|
-
KeyHash = 0,
|
|
82
|
-
ScriptHash = 1
|
|
83
|
-
}
|
|
84
|
-
type Credential = {
|
|
85
|
-
type: CredentialType;
|
|
86
|
-
hash: string;
|
|
87
|
-
};
|
|
88
|
-
declare enum AddressType {
|
|
89
|
-
Enterprise = 0,
|
|
90
|
-
Base = 1,
|
|
91
|
-
Reward = 2
|
|
92
|
-
}
|
|
93
|
-
declare class CardanoAddress {
|
|
94
|
-
addressType: AddressType;
|
|
95
|
-
networkId: number;
|
|
96
|
-
paymentCredential: Credential;
|
|
97
|
-
stakeCredential?: Credential;
|
|
98
|
-
constructor(addressType: AddressType, networkId: number, paymentCredential: Credential, stakeCredential?: Credential);
|
|
99
|
-
getAddressBech32(): string;
|
|
100
|
-
getAddressHex(): string;
|
|
101
|
-
private getEnterpriseAddressBech32;
|
|
102
|
-
private getEnterpriseAddressHex;
|
|
103
|
-
private getBaseAddressBech32;
|
|
104
|
-
private getBaseAddressHex;
|
|
105
|
-
private getRewardAddressBech32;
|
|
106
|
-
private getRewardAddressHex;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
interface ICardanoWallet {
|
|
110
|
-
getExtensions(): Promise<{
|
|
111
|
-
cip: number;
|
|
112
|
-
}[]>;
|
|
113
|
-
getNetworkId(): Promise<number>;
|
|
114
|
-
getUtxos(): Promise<string[]>;
|
|
115
|
-
getCollateral(): Promise<string[]>;
|
|
116
|
-
getBalance(): Promise<string>;
|
|
117
|
-
getUsedAddresses(): Promise<string[]>;
|
|
118
|
-
getUnusedAddresses(): Promise<string[]>;
|
|
119
|
-
getRewardAddresses(): Promise<string[]>;
|
|
120
|
-
getChangeAddress(): Promise<string>;
|
|
121
|
-
signTx(data: string, partialSign: boolean): Promise<string>;
|
|
122
|
-
signData(addressHex: string, data: string): Promise<DataSignature>;
|
|
123
|
-
submitTx(tx: string): Promise<string>;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
type Wallet = {
|
|
127
|
-
id: string;
|
|
128
|
-
name: string;
|
|
129
|
-
icon: string;
|
|
130
|
-
version: string;
|
|
131
|
-
};
|
|
132
|
-
type Cardano = {
|
|
133
|
-
[key: string]: {
|
|
134
|
-
name: string;
|
|
135
|
-
icon: string;
|
|
136
|
-
apiVersion: string;
|
|
137
|
-
enable: (extensions?: {
|
|
138
|
-
extensions: {
|
|
139
|
-
cip: number;
|
|
140
|
-
}[];
|
|
141
|
-
}) => Promise<ICardanoWallet>;
|
|
142
|
-
supportedExtensions?: {
|
|
143
|
-
cip: number;
|
|
144
|
-
}[];
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
type Extension = {
|
|
148
|
-
cip: number;
|
|
149
|
-
};
|
|
150
|
-
declare class CardanoBrowserWallet implements ICardanoWallet {
|
|
151
|
-
walletInstance: ICardanoWallet;
|
|
152
|
-
constructor(walletInstance: ICardanoWallet);
|
|
153
|
-
getExtensions(): Promise<{
|
|
154
|
-
cip: number;
|
|
155
|
-
}[]>;
|
|
156
|
-
getNetworkId(): Promise<number>;
|
|
157
|
-
getUtxos(): Promise<string[]>;
|
|
158
|
-
getCollateral(): Promise<string[]>;
|
|
159
|
-
getBalance(): Promise<string>;
|
|
160
|
-
getUsedAddresses(): Promise<string[]>;
|
|
161
|
-
getUnusedAddresses(): Promise<string[]>;
|
|
162
|
-
getRewardAddresses(): Promise<string[]>;
|
|
163
|
-
getChangeAddress(): Promise<string>;
|
|
164
|
-
signTx(data: string, partialSign: boolean): Promise<string>;
|
|
165
|
-
signData(addressBech32: string, data: string): Promise<DataSignature>;
|
|
166
|
-
submitTx(tx: string): Promise<string>;
|
|
167
|
-
/**
|
|
168
|
-
* Returns a list of wallets installed on user's device. Each wallet is an object with the following properties:
|
|
169
|
-
* - A name is provided to display wallet's name on the user interface.
|
|
170
|
-
* - A version is provided to display wallet's version on the user interface.
|
|
171
|
-
* - An icon is provided to display wallet's icon on the user interface.
|
|
172
|
-
*
|
|
173
|
-
* @returns a list of wallet names
|
|
174
|
-
*/
|
|
175
|
-
static getInstalledWallets(): Wallet[];
|
|
176
|
-
/**
|
|
177
|
-
* This is the entrypoint to start communication with the user's wallet. The wallet should request the user's permission to connect the web page to the user's wallet, and if permission has been granted, the wallet will be returned and exposing the full API for the app to use.
|
|
178
|
-
*
|
|
179
|
-
* Query BrowserWallet.getInstalledWallets() to get a list of available wallets, then provide the wallet name for which wallet the user would like to connect with.
|
|
180
|
-
*
|
|
181
|
-
* @param walletName - the name of the wallet to enable (e.g. "eternl", "begin")
|
|
182
|
-
* @param extensions - optional, a list of CIPs that the wallet should support
|
|
183
|
-
* @returns WalletInstance
|
|
184
|
-
*/
|
|
185
|
-
static enable(walletName: string, extensions?: Extension[]): Promise<ICardanoWallet>;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
declare class MeshCardanoBrowserWallet extends CardanoBrowserWallet {
|
|
189
|
-
constructor(walletInstance: ICardanoWallet);
|
|
190
|
-
static enable(walletName: string, extensions?: Extension$1[]): Promise<MeshCardanoBrowserWallet>;
|
|
191
|
-
getUtxosMesh(): Promise<UTxO[]>;
|
|
192
|
-
getCollateralMesh(): Promise<UTxO[]>;
|
|
193
|
-
getBalanceMesh(): Promise<Asset[]>;
|
|
194
|
-
getUsedAddressesBech32(): Promise<string[]>;
|
|
195
|
-
getUnusedAddressesBech32(): Promise<string[]>;
|
|
196
|
-
getChangeAddressBech32(): Promise<string>;
|
|
197
|
-
getRewardAddressesBech32(): Promise<string[]>;
|
|
198
|
-
signTxReturnFullTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
type CredentialSource = {
|
|
202
|
-
type: "signer";
|
|
203
|
-
signer: ISigner;
|
|
204
|
-
} | {
|
|
205
|
-
type: "scriptHash";
|
|
206
|
-
scriptHash: string;
|
|
207
|
-
};
|
|
208
|
-
interface AddressManagerConfig {
|
|
209
|
-
addressSource: AddressSource;
|
|
210
|
-
networkId: number;
|
|
211
|
-
}
|
|
212
|
-
type AddressSource = {
|
|
213
|
-
type: "secretManager";
|
|
214
|
-
secretManager: ISecretManager;
|
|
215
|
-
} | {
|
|
216
|
-
type: "credentials";
|
|
217
|
-
paymentCredential: CredentialSource;
|
|
218
|
-
stakeCredential?: CredentialSource;
|
|
219
|
-
drepCredential?: CredentialSource;
|
|
220
|
-
};
|
|
221
|
-
declare class AddressManager {
|
|
222
|
-
private readonly paymentCredential;
|
|
223
|
-
private readonly stakeCredential;
|
|
224
|
-
private readonly drepCredential;
|
|
225
|
-
private readonly paymentSigner;
|
|
226
|
-
private readonly stakeSigner?;
|
|
227
|
-
private readonly drepSigner?;
|
|
228
|
-
private readonly networkId;
|
|
229
|
-
static create(config: AddressManagerConfig): Promise<AddressManager>;
|
|
230
|
-
private constructor();
|
|
231
|
-
getNextAddress(addressType: AddressType): Promise<CardanoAddress>;
|
|
232
|
-
getChangeAddress(addressType: AddressType): Promise<CardanoAddress>;
|
|
233
|
-
getRewardAccount(): Promise<CardanoAddress>;
|
|
234
|
-
asyncGetAllUsedAddresses(): Promise<CardanoAddress[]>;
|
|
235
|
-
getCredentialsSigners(pubkeyHashes: Set<string>): Promise<Map<string, ISigner>>;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
type WalletAddressType = AddressType.Base | AddressType.Enterprise;
|
|
239
|
-
/**
|
|
240
|
-
* Configuration for creating a CardanoHeadlessWallet instance.
|
|
241
|
-
*/
|
|
242
|
-
interface CardanoHeadlessWalletConfig {
|
|
243
|
-
/**
|
|
244
|
-
* The source for wallet's signing keys and addresses. Could either be a secret manager or explicit credentials.
|
|
245
|
-
*/
|
|
246
|
-
addressSource: AddressSource;
|
|
247
|
-
/**
|
|
248
|
-
* The network ID (0 for testnet, 1 for mainnet).
|
|
249
|
-
*/
|
|
250
|
-
networkId: number;
|
|
251
|
-
/**
|
|
252
|
-
* The type of wallet address to use (Base or Enterprise).
|
|
253
|
-
* Base addresses include staking capabilities, while Enterprise addresses do not.
|
|
254
|
-
*/
|
|
255
|
-
walletAddressType: WalletAddressType;
|
|
256
|
-
/**
|
|
257
|
-
* Optional fetcher instance for querying blockchain data (UTxOs, protocol parameters, etc.).
|
|
258
|
-
*/
|
|
259
|
-
fetcher?: IFetcher;
|
|
260
|
-
/**
|
|
261
|
-
* Optional submitter instance for submitting transactions to the blockchain.
|
|
262
|
-
*/
|
|
263
|
-
submitter?: ISubmitter;
|
|
264
|
-
}
|
|
265
|
-
declare class CardanoHeadlessWallet implements ICardanoWallet {
|
|
266
|
-
protected networkId: number;
|
|
267
|
-
protected addressManager: AddressManager;
|
|
268
|
-
protected fetcher?: IFetcher;
|
|
269
|
-
protected submitter?: ISubmitter;
|
|
270
|
-
protected walletAddressType: WalletAddressType;
|
|
271
|
-
protected constructor(networkId: number, addressManager: AddressManager, walletAddressType: WalletAddressType, fetcher?: IFetcher, submitter?: ISubmitter);
|
|
272
|
-
static create(config: CardanoHeadlessWalletConfig): Promise<CardanoHeadlessWallet>;
|
|
273
|
-
/**
|
|
274
|
-
* Create a CardanoHeadlessWallet instance from a Bip32 root in Bech32 format.
|
|
275
|
-
* @param config The configuration object
|
|
276
|
-
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
277
|
-
*/
|
|
278
|
-
static fromBip32Root(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
279
|
-
bech32: string;
|
|
280
|
-
}): Promise<CardanoHeadlessWallet>;
|
|
281
|
-
/**
|
|
282
|
-
* Create a CardanoHeadlessWallet instance from a Bip32 root in hex format.
|
|
283
|
-
* @param config The configuration object
|
|
284
|
-
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
285
|
-
*/
|
|
286
|
-
static fromBip32RootHex(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
287
|
-
hex: string;
|
|
288
|
-
}): Promise<CardanoHeadlessWallet>;
|
|
289
|
-
/**
|
|
290
|
-
* Create a CardanoHeadlessWallet instance from a mnemonic phrase.
|
|
291
|
-
* @param config The configuration object
|
|
292
|
-
* @returns {Promise<CardanoHeadlessWallet>} A promise that resolves to a CardanoHeadlessWallet instance
|
|
293
|
-
*/
|
|
294
|
-
static fromMnemonic(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
295
|
-
mnemonic: string[];
|
|
296
|
-
password?: string;
|
|
297
|
-
}): Promise<CardanoHeadlessWallet>;
|
|
298
|
-
static fromCredentialSources(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
299
|
-
paymentCredentialSource: CredentialSource;
|
|
300
|
-
stakeCredentialSource?: CredentialSource;
|
|
301
|
-
drepCredentialSource?: CredentialSource;
|
|
302
|
-
}): Promise<CardanoHeadlessWallet>;
|
|
303
|
-
/**
|
|
304
|
-
* Submit a transaction to the network, using the submitter instance.
|
|
305
|
-
* @param tx The transaction in CBOR hex format
|
|
306
|
-
* @returns {Promise<string>} A promise that resolves to the transaction ID
|
|
307
|
-
*/
|
|
308
|
-
submitTx(tx: string): Promise<string>;
|
|
309
|
-
/**
|
|
310
|
-
* Get the list of extensions enabled for this wallet.
|
|
311
|
-
* @returns {Promise<{ cip: number }[]>} A promise that resolves to an array of enabled extensions
|
|
312
|
-
*/
|
|
313
|
-
getExtensions(): Promise<{
|
|
314
|
-
cip: number;
|
|
315
|
-
}[]>;
|
|
316
|
-
/**
|
|
317
|
-
* Get the network ID.
|
|
318
|
-
* @returns {number} The network ID
|
|
319
|
-
*/
|
|
320
|
-
getNetworkId(): Promise<number>;
|
|
321
|
-
/**
|
|
322
|
-
* Get the UTxOs for the wallet.
|
|
323
|
-
*
|
|
324
|
-
* NOTE: This method is only an approximation to CIP-30 getUtxos, as this wallet is completely
|
|
325
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
326
|
-
* will be overlap between getUtxos() and getCollateral() results. This can result in the collateral being
|
|
327
|
-
* spent between transactions.
|
|
328
|
-
*
|
|
329
|
-
* The method also does not perform pagination, nor is there a coin selection mechanism.
|
|
330
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of UTxOs in CBOR hex format
|
|
331
|
-
*/
|
|
332
|
-
getUtxos(): Promise<string[]>;
|
|
333
|
-
/**
|
|
334
|
-
* Get the collateral UTxOs for the wallet.
|
|
335
|
-
*
|
|
336
|
-
* NOTE: This method is only an approximation to CIP-30 getCollateral, as this wallet is completely
|
|
337
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
338
|
-
* will be overlap between getUtxos() and getCollateral() results.
|
|
339
|
-
*
|
|
340
|
-
* The basic strategy is to return the smallest pure ADA UTxO that is at least 5 ADA belonging to the wallet.
|
|
341
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of UTxOs in CBOR hex format
|
|
342
|
-
*/
|
|
343
|
-
getCollateral(): Promise<string[]>;
|
|
344
|
-
/**
|
|
345
|
-
* Get the balance of the wallet.
|
|
346
|
-
*
|
|
347
|
-
* NOTE: This method is only an approximation to CIP-30 getBalance, as this wallet is completely
|
|
348
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means the balance
|
|
349
|
-
* returned includes all UTxOs, including those that may be used as collateral.
|
|
350
|
-
* @returns {Promise<string>} A promise that resolves to the balance in CBOR hex format
|
|
351
|
-
*/
|
|
352
|
-
getBalance(): Promise<string>;
|
|
353
|
-
/**
|
|
354
|
-
* Get the used addresses for the wallet.
|
|
355
|
-
*
|
|
356
|
-
* NOTE: This method completely deviates from CIP-30 getUsedAddresses, as this wallet is stateless
|
|
357
|
-
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
358
|
-
*
|
|
359
|
-
* It will be effective to be used as a single address wallet.
|
|
360
|
-
*
|
|
361
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of used addresses in hex format
|
|
362
|
-
*/
|
|
363
|
-
getUsedAddresses(): Promise<string[]>;
|
|
364
|
-
/**
|
|
365
|
-
* Get the unused addresses for the wallet.
|
|
366
|
-
*
|
|
367
|
-
* NOTE: This method completely deviates from CIP-30 getUnusedAddresses, as this wallet is stateless
|
|
368
|
-
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
369
|
-
*
|
|
370
|
-
* It will be effective to be used as a single address wallet.
|
|
371
|
-
*
|
|
372
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of unused addresses in hex format
|
|
373
|
-
*/
|
|
374
|
-
getUnusedAddresses(): Promise<string[]>;
|
|
375
|
-
/**
|
|
376
|
-
* Get the change address for the wallet.
|
|
377
|
-
* NOTE: This method deviates from CIP-30 getChangeAddress, as this wallet is stateless
|
|
378
|
-
* it does not track which addresses has been previously used as change address. This method simply
|
|
379
|
-
* returns the wallet's main address.
|
|
380
|
-
*
|
|
381
|
-
* It will be effective to be used as a single address wallet.
|
|
382
|
-
*
|
|
383
|
-
* @returns {Promise<string>} A promise that resolves to the change address in hex format
|
|
384
|
-
*/
|
|
385
|
-
getChangeAddress(): Promise<string>;
|
|
386
|
-
/**
|
|
387
|
-
* Get the reward address for the wallet.
|
|
388
|
-
*
|
|
389
|
-
* @returns {Promise<string[]>} A promise that resolves an array of reward addresses in hex format
|
|
390
|
-
*/
|
|
391
|
-
getRewardAddresses(): Promise<string[]>;
|
|
392
|
-
/**
|
|
393
|
-
* Sign a transaction with the wallet.
|
|
394
|
-
*
|
|
395
|
-
* NOTE: This method requires a fetcher to resolve input UTxOs for determining required signers.
|
|
396
|
-
*
|
|
397
|
-
* It is also only an approximation to CIP-30 signTx, as this wallet is stateless and does not repeatedly
|
|
398
|
-
* derive keys, it is unable to sign for multiple derived key indexes.
|
|
399
|
-
*
|
|
400
|
-
* It will be effective to be used as a single address wallet.
|
|
401
|
-
*
|
|
402
|
-
* @param tx The transaction in CBOR hex format
|
|
403
|
-
* @returns A promise that resolves to a witness set with the signatures in CBOR hex format
|
|
404
|
-
*/
|
|
405
|
-
signTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
406
|
-
signData(addressBech32: string, data: string): Promise<DataSignature>;
|
|
407
|
-
fetchAccountUtxos(): Promise<UTxO[]>;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* MeshCardanoHeadlessWallet provides additional convenience methods on top of CardanoHeadlessWallet,
|
|
412
|
-
* such as returning results in Mesh-compatible formats and Bech32 addresses.
|
|
413
|
-
*/
|
|
414
|
-
declare class MeshCardanoHeadlessWallet extends CardanoHeadlessWallet {
|
|
415
|
-
static create(config: CardanoHeadlessWalletConfig): Promise<MeshCardanoHeadlessWallet>;
|
|
416
|
-
static fromMnemonic(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
417
|
-
mnemonic: string[];
|
|
418
|
-
password?: string;
|
|
419
|
-
}): Promise<MeshCardanoHeadlessWallet>;
|
|
420
|
-
static fromBip32Root(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
421
|
-
bech32: string;
|
|
422
|
-
}): Promise<MeshCardanoHeadlessWallet>;
|
|
423
|
-
static fromBip32RootHex(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
424
|
-
hex: string;
|
|
425
|
-
}): Promise<MeshCardanoHeadlessWallet>;
|
|
426
|
-
static fromCredentialSources(config: Omit<CardanoHeadlessWalletConfig, "addressSource"> & {
|
|
427
|
-
paymentCredentialSource: CredentialSource;
|
|
428
|
-
stakeCredentialSource?: CredentialSource;
|
|
429
|
-
drepCredentialSource?: CredentialSource;
|
|
430
|
-
}): Promise<MeshCardanoHeadlessWallet>;
|
|
431
|
-
/**
|
|
432
|
-
* Get the UTxOs for the wallet.
|
|
433
|
-
*
|
|
434
|
-
* NOTE: This method is only an approximation to CIP-30 getUtxos, as this wallet is completely
|
|
435
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
436
|
-
* will be overlap between getUtxos() and getCollateral() results. This can result in the collateral being
|
|
437
|
-
* spent between transactions.
|
|
438
|
-
*
|
|
439
|
-
* The method also does not perform pagination, nor is there a coin selection mechanism.
|
|
440
|
-
* @returns {Promise<UTxO[]>} A promise that resolves to an array of UTxOs in the Mesh UTxO format
|
|
441
|
-
*/
|
|
442
|
-
getUtxosMesh(): Promise<UTxO[]>;
|
|
443
|
-
/**
|
|
444
|
-
* Get the collateral UTxOs for the wallet.
|
|
445
|
-
*
|
|
446
|
-
* NOTE: This method is only an approximation to CIP-30 getCollateral, as this wallet is completely
|
|
447
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means that there
|
|
448
|
-
* will be overlap between getUtxos() and getCollateral() results.
|
|
449
|
-
*
|
|
450
|
-
* The basic strategy is to return the smallest pure ADA UTxO that is at least 5 ADA belonging to the wallet.
|
|
451
|
-
* @returns {Promise<UTxO[]>} A promise that resolves to an array of UTxOs in the Mesh UTxO format
|
|
452
|
-
*/
|
|
453
|
-
getCollateralMesh(): Promise<UTxO[]>;
|
|
454
|
-
/**
|
|
455
|
-
* Get the balance of the wallet.
|
|
456
|
-
*
|
|
457
|
-
* NOTE: This method is only an approximation to CIP-30 getBalance, as this wallet is completely
|
|
458
|
-
* stateless and does not track which UTxOs are specifically set as collateral. Which means the balance
|
|
459
|
-
* returned includes all UTxOs, including those that may be used as collateral.
|
|
460
|
-
* @returns {Promise<Asset[]>} A promise that resolves to the balance in the Mesh Asset format
|
|
461
|
-
*/
|
|
462
|
-
getBalanceMesh(): Promise<Asset[]>;
|
|
463
|
-
/**
|
|
464
|
-
* Get the used addresses for the wallet.
|
|
465
|
-
*
|
|
466
|
-
* NOTE: This method completely deviates from CIP-30 getUsedAddresses, as this wallet is stateless
|
|
467
|
-
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
468
|
-
*
|
|
469
|
-
* It will be effective to be used as a single address wallet.
|
|
470
|
-
*
|
|
471
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of used addresses in Bech32 format
|
|
472
|
-
*/
|
|
473
|
-
getUsedAddressesBech32(): Promise<string[]>;
|
|
474
|
-
/**
|
|
475
|
-
* Get the unused addresses for the wallet.
|
|
476
|
-
*
|
|
477
|
-
* NOTE: This method completely deviates from CIP-30 getUnusedAddresses, as this wallet is stateless
|
|
478
|
-
* it is impossible to track which addresses have been used. This method simply returns the wallet's main address.
|
|
479
|
-
*
|
|
480
|
-
* It will be effective to be used as a single address wallet.
|
|
481
|
-
*
|
|
482
|
-
* @returns {Promise<string[]>} A promise that resolves to an array of unused addresses in Bech32 format
|
|
483
|
-
*/
|
|
484
|
-
getUnusedAddressesBech32(): Promise<string[]>;
|
|
485
|
-
/**
|
|
486
|
-
* Get the change address for the wallet.
|
|
487
|
-
* NOTE: This method deviates from CIP-30 getChangeAddress, as this wallet is stateless
|
|
488
|
-
* it does not track which addresses has been previously used as change address. This method simply
|
|
489
|
-
* returns the wallet's main address.
|
|
490
|
-
*
|
|
491
|
-
* It will be effective to be used as a single address wallet.
|
|
492
|
-
*
|
|
493
|
-
* @returns {Promise<string>} A promise that resolves to the change address in Bech32 format
|
|
494
|
-
*/
|
|
495
|
-
getChangeAddressBech32(): Promise<string>;
|
|
496
|
-
/**
|
|
497
|
-
* Get the reward address for the wallet.
|
|
498
|
-
* @returns {Promise<string[]>} A promise that resolves an array of reward addresses in Bech32 format
|
|
499
|
-
*/
|
|
500
|
-
getRewardAddressesBech32(): Promise<string[]>;
|
|
501
|
-
/**
|
|
502
|
-
* Sign a transaction with the wallet.
|
|
503
|
-
*
|
|
504
|
-
* NOTE: This method requires a fetcher to resolve input UTxOs for determining required signers.
|
|
505
|
-
*
|
|
506
|
-
* It is also only an approximation to CIP-30 signTx, as this wallet is stateless and does not repeatedly
|
|
507
|
-
* derive keys, it is unable to sign for multiple derived key indexes.
|
|
508
|
-
*
|
|
509
|
-
* It will be effective to be used as a single address wallet.
|
|
510
|
-
*
|
|
511
|
-
* @param tx The transaction in CBOR hex format
|
|
512
|
-
* @returns A promise that resolves to a full transaction with extra vkey witnesses added from the wallet
|
|
513
|
-
* to the witness set in CBOR hex format
|
|
514
|
-
*/
|
|
515
|
-
signTxReturnFullTx(tx: string, partialSign?: boolean): Promise<string>;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
export { AddressType, BaseSigner, type Cardano, CardanoAddress, CardanoBrowserWallet, CardanoHeadlessWallet, type CardanoHeadlessWalletConfig, type Credential, type CredentialSource, CredentialType, type ICardanoWallet, InMemoryBip32, MeshCardanoBrowserWallet, MeshCardanoHeadlessWallet, type WalletAddressType };
|