@taquito/signer 24.3.0 → 25.0.0-beta.1
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/lib/version.js +2 -2
- package/dist/taquito-signer.es6.js +583 -137
- package/dist/taquito-signer.es6.js.map +1 -1
- package/dist/taquito-signer.umd.js +583 -137
- package/dist/taquito-signer.umd.js.map +1 -1
- package/dist/types/node_modules/@scure/base/index.d.ts +286 -24
- package/package.json +9 -9
|
@@ -1,12 +1,74 @@
|
|
|
1
1
|
/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
/** Transforms values between two representations. */
|
|
2
3
|
export interface Coder<F, T> {
|
|
4
|
+
/**
|
|
5
|
+
* Converts a value from the input representation to the output representation.
|
|
6
|
+
* @param from - Value in the source representation.
|
|
7
|
+
* @returns Converted value.
|
|
8
|
+
*/
|
|
3
9
|
encode(from: F): T;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a value from the output representation back to the input representation.
|
|
12
|
+
* @param to - Value in the target representation.
|
|
13
|
+
* @returns Converted value.
|
|
14
|
+
*/
|
|
4
15
|
decode(to: T): F;
|
|
5
16
|
}
|
|
17
|
+
/** Coder that works with byte arrays and strings. */
|
|
6
18
|
export interface BytesCoder extends Coder<Uint8Array, string> {
|
|
19
|
+
/**
|
|
20
|
+
* Encodes bytes into a string representation.
|
|
21
|
+
* @param data - Bytes to encode.
|
|
22
|
+
* @returns Encoded string.
|
|
23
|
+
*/
|
|
7
24
|
encode: (data: Uint8Array) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Decodes a string representation into raw bytes.
|
|
27
|
+
* @param str - Encoded string.
|
|
28
|
+
* @returns Decoded bytes.
|
|
29
|
+
*/
|
|
8
30
|
decode: (str: string) => Uint8Array;
|
|
9
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Bytes API type helpers for old + new TypeScript.
|
|
34
|
+
*
|
|
35
|
+
* TS 5.6 has `Uint8Array`, while TS 5.9+ made it generic `Uint8Array<ArrayBuffer>`.
|
|
36
|
+
* We can't use specific return type, because TS 5.6 will error.
|
|
37
|
+
* We can't use generic return type, because most TS 5.9 software will expect specific type.
|
|
38
|
+
*
|
|
39
|
+
* Maps typed-array input leaves to broad forms.
|
|
40
|
+
* These are compatibility adapters, not ownership guarantees.
|
|
41
|
+
*
|
|
42
|
+
* - `TArg` keeps byte inputs broad.
|
|
43
|
+
* - `TRet` marks byte outputs for TS 5.6 and TS 5.9+ compatibility.
|
|
44
|
+
*/
|
|
45
|
+
export type TypedArg<T> = T extends BigInt64Array ? BigInt64Array : T extends BigUint64Array ? BigUint64Array : T extends Float32Array ? Float32Array : T extends Float64Array ? Float64Array : T extends Int16Array ? Int16Array : T extends Int32Array ? Int32Array : T extends Int8Array ? Int8Array : T extends Uint16Array ? Uint16Array : T extends Uint32Array ? Uint32Array : T extends Uint8ClampedArray ? Uint8ClampedArray : T extends Uint8Array ? Uint8Array : never;
|
|
46
|
+
/** Maps typed-array output leaves to narrow TS-compatible forms. */
|
|
47
|
+
export type TypedRet<T> = T extends BigInt64Array ? ReturnType<typeof BigInt64Array.of> : T extends BigUint64Array ? ReturnType<typeof BigUint64Array.of> : T extends Float32Array ? ReturnType<typeof Float32Array.of> : T extends Float64Array ? ReturnType<typeof Float64Array.of> : T extends Int16Array ? ReturnType<typeof Int16Array.of> : T extends Int32Array ? ReturnType<typeof Int32Array.of> : T extends Int8Array ? ReturnType<typeof Int8Array.of> : T extends Uint16Array ? ReturnType<typeof Uint16Array.of> : T extends Uint32Array ? ReturnType<typeof Uint32Array.of> : T extends Uint8ClampedArray ? ReturnType<typeof Uint8ClampedArray.of> : T extends Uint8Array ? ReturnType<typeof Uint8Array.of> : never;
|
|
48
|
+
/** Recursively adapts byte-carrying API input types. See {@link TypedArg}. */
|
|
49
|
+
export type TArg<T> = T | ([TypedArg<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
50
|
+
[K in keyof A]: TRet<A[K]>;
|
|
51
|
+
}) => TArg<R>) & {
|
|
52
|
+
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TArg<T[K]>;
|
|
53
|
+
} : T extends [infer A, ...infer R] ? [TArg<A>, ...{
|
|
54
|
+
[K in keyof R]: TArg<R[K]>;
|
|
55
|
+
}] : T extends readonly [infer A, ...infer R] ? readonly [TArg<A>, ...{
|
|
56
|
+
[K in keyof R]: TArg<R[K]>;
|
|
57
|
+
}] : T extends (infer A)[] ? TArg<A>[] : T extends readonly (infer A)[] ? readonly TArg<A>[] : T extends Promise<infer A> ? Promise<TArg<A>> : T extends object ? {
|
|
58
|
+
[K in keyof T]: TArg<T[K]>;
|
|
59
|
+
} : T : TypedArg<T>);
|
|
60
|
+
/** Recursively adapts byte-carrying API output types. See {@link TypedArg}. */
|
|
61
|
+
export type TRet<T> = T extends unknown ? T & ([TypedRet<T>] extends [never] ? T extends (...args: infer A) => infer R ? ((...args: {
|
|
62
|
+
[K in keyof A]: TArg<A[K]>;
|
|
63
|
+
}) => TRet<R>) & {
|
|
64
|
+
[K in keyof T]: T[K] extends (...args: any) => any ? T[K] : TRet<T[K]>;
|
|
65
|
+
} : T extends [infer A, ...infer R] ? [TRet<A>, ...{
|
|
66
|
+
[K in keyof R]: TRet<R[K]>;
|
|
67
|
+
}] : T extends readonly [infer A, ...infer R] ? readonly [TRet<A>, ...{
|
|
68
|
+
[K in keyof R]: TRet<R[K]>;
|
|
69
|
+
}] : T extends (infer A)[] ? TRet<A>[] : T extends readonly (infer A)[] ? readonly TRet<A>[] : T extends Promise<infer A> ? Promise<TRet<A>> : T extends object ? {
|
|
70
|
+
[K in keyof T]: TRet<T[K]>;
|
|
71
|
+
} : T : TypedRet<T>) : never;
|
|
10
72
|
type Chain = [Coder<any, any>, ...Coder<any, any>[]];
|
|
11
73
|
type Input<F> = F extends Coder<infer T, any> ? T : never;
|
|
12
74
|
type Output<F> = F extends Coder<any, infer T> ? T : never;
|
|
@@ -46,14 +108,24 @@ declare function convertRadix2(data: number[], from: number, to: number, padding
|
|
|
46
108
|
/**
|
|
47
109
|
* @__NO_SIDE_EFFECTS__
|
|
48
110
|
*/
|
|
49
|
-
declare function radix(num: number): Coder<Uint8Array, number[]
|
|
111
|
+
declare function radix(num: number): TRet<Coder<Uint8Array, number[]>>;
|
|
50
112
|
/**
|
|
51
113
|
* If both bases are power of same number (like `2**8 <-> 2**64`),
|
|
52
114
|
* there is a linear algorithm. For now we have implementation for power-of-two bases only.
|
|
53
115
|
* @__NO_SIDE_EFFECTS__
|
|
54
116
|
*/
|
|
55
|
-
declare function radix2(bits: number, revPadding?: boolean): Coder<Uint8Array, number[]
|
|
56
|
-
|
|
117
|
+
declare function radix2(bits: number, revPadding?: boolean): TRet<Coder<Uint8Array, number[]>>;
|
|
118
|
+
type BytesFn = (data: TArg<Uint8Array>) => TRet<Uint8Array>;
|
|
119
|
+
declare function checksum(len: number, fn: TArg<BytesFn>): TRet<Coder<Uint8Array, Uint8Array>>;
|
|
120
|
+
/**
|
|
121
|
+
* Low-level building blocks used by the exported codecs.
|
|
122
|
+
* @example
|
|
123
|
+
* Build a radix-32 coder from the low-level helpers.
|
|
124
|
+
* ```ts
|
|
125
|
+
* import { utils } from '@scure/base';
|
|
126
|
+
* utils.radix2(5).encode(Uint8Array.from([1, 2, 3]));
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
57
129
|
export declare const utils: {
|
|
58
130
|
alphabet: typeof alphabet;
|
|
59
131
|
chain: typeof chain;
|
|
@@ -67,6 +139,9 @@ export declare const utils: {
|
|
|
67
139
|
};
|
|
68
140
|
/**
|
|
69
141
|
* base16 encoding from RFC 4648.
|
|
142
|
+
* This codec uses RFC 4648 Table 5's uppercase alphabet directly.
|
|
143
|
+
* RFC 4648 §8 calls base16 "case-insensitive hex encoding", but we intentionally do not case-fold decode input here.
|
|
144
|
+
* Use `hex` for case-insensitive hex decoding.
|
|
70
145
|
* @example
|
|
71
146
|
* ```js
|
|
72
147
|
* base16.encode(Uint8Array.from([0x12, 0xab]));
|
|
@@ -76,6 +151,8 @@ export declare const utils: {
|
|
|
76
151
|
export declare const base16: BytesCoder;
|
|
77
152
|
/**
|
|
78
153
|
* base32 encoding from RFC 4648. Has padding.
|
|
154
|
+
* RFC 4648 §6 Table 3 uses uppercase letters, and RFC 4648 §3.4 allows applications to choose
|
|
155
|
+
* upper- or lowercase alphabets. We keep the published uppercase table and do not case-fold decode input.
|
|
79
156
|
* Use `base32nopad` for unpadded version.
|
|
80
157
|
* Also check out `base32hex`, `base32hexnopad`, `base32crockford`.
|
|
81
158
|
* @example
|
|
@@ -89,6 +166,7 @@ export declare const base16: BytesCoder;
|
|
|
89
166
|
export declare const base32: BytesCoder;
|
|
90
167
|
/**
|
|
91
168
|
* base32 encoding from RFC 4648. No padding.
|
|
169
|
+
* This variant inherits RFC 4648 base32's uppercase table and intentionally does not case-fold decode input.
|
|
92
170
|
* Use `base32` for padded version.
|
|
93
171
|
* Also check out `base32hex`, `base32hexnopad`, `base32crockford`.
|
|
94
172
|
* @example
|
|
@@ -102,6 +180,7 @@ export declare const base32: BytesCoder;
|
|
|
102
180
|
export declare const base32nopad: BytesCoder;
|
|
103
181
|
/**
|
|
104
182
|
* base32 encoding from RFC 4648. Padded. Compared to ordinary `base32`, slightly different alphabet.
|
|
183
|
+
* RFC 4648 §7 Table 4 uses uppercase letters, and we intentionally keep that table without case-folding decode input.
|
|
105
184
|
* Use `base32hexnopad` for unpadded version.
|
|
106
185
|
* @example
|
|
107
186
|
* ```js
|
|
@@ -114,6 +193,7 @@ export declare const base32nopad: BytesCoder;
|
|
|
114
193
|
export declare const base32hex: BytesCoder;
|
|
115
194
|
/**
|
|
116
195
|
* base32 encoding from RFC 4648. No padding. Compared to ordinary `base32`, slightly different alphabet.
|
|
196
|
+
* This variant inherits RFC 4648 base32hex's uppercase table and intentionally does not case-fold decode input.
|
|
117
197
|
* Use `base32hex` for padded version.
|
|
118
198
|
* @example
|
|
119
199
|
* ```js
|
|
@@ -126,7 +206,7 @@ export declare const base32hex: BytesCoder;
|
|
|
126
206
|
export declare const base32hexnopad: BytesCoder;
|
|
127
207
|
/**
|
|
128
208
|
* base32 encoding from RFC 4648. Doug Crockford's version.
|
|
129
|
-
* https://www.crockford.com/base32.html
|
|
209
|
+
* See {@link https://www.crockford.com/base32.html | Douglas Crockford's Base32}.
|
|
130
210
|
* @example
|
|
131
211
|
* ```js
|
|
132
212
|
* base32crockford.encode(Uint8Array.from([0x12, 0xab]));
|
|
@@ -192,69 +272,195 @@ export declare const base64urlnopad: BytesCoder;
|
|
|
192
272
|
* Quadratic (O(n^2)) - so, can't be used on large inputs.
|
|
193
273
|
* @example
|
|
194
274
|
* ```js
|
|
195
|
-
* base58.
|
|
196
|
-
*
|
|
275
|
+
* const text = base58.encode(Uint8Array.from([0, 1, 2]));
|
|
276
|
+
* base58.decode(text);
|
|
277
|
+
* // => Uint8Array.from([0, 1, 2])
|
|
197
278
|
* ```
|
|
198
279
|
*/
|
|
199
280
|
export declare const base58: BytesCoder;
|
|
200
281
|
/**
|
|
201
282
|
* base58: flickr version. Check out `base58`.
|
|
283
|
+
* @example
|
|
284
|
+
* Round-trip bytes with the Flickr alphabet.
|
|
285
|
+
* ```ts
|
|
286
|
+
* const text = base58flickr.encode(Uint8Array.from([0, 1, 2]));
|
|
287
|
+
* base58flickr.decode(text);
|
|
288
|
+
* ```
|
|
202
289
|
*/
|
|
203
290
|
export declare const base58flickr: BytesCoder;
|
|
204
291
|
/**
|
|
205
292
|
* base58: XRP version. Check out `base58`.
|
|
293
|
+
* @example
|
|
294
|
+
* Round-trip bytes with the XRP alphabet.
|
|
295
|
+
* ```ts
|
|
296
|
+
* const text = base58xrp.encode(Uint8Array.from([0, 1, 2]));
|
|
297
|
+
* base58xrp.decode(text);
|
|
298
|
+
* ```
|
|
206
299
|
*/
|
|
207
300
|
export declare const base58xrp: BytesCoder;
|
|
208
301
|
/**
|
|
209
302
|
* base58: XMR version. Check out `base58`.
|
|
210
303
|
* Done in 8-byte blocks (which equals 11 chars in decoding). Last (non-full) block padded with '1' to size in XMR_BLOCK_LEN.
|
|
211
304
|
* Block encoding significantly reduces quadratic complexity of base58.
|
|
305
|
+
* @example
|
|
306
|
+
* Round-trip bytes with the Monero block codec.
|
|
307
|
+
* ```ts
|
|
308
|
+
* const text = base58xmr.encode(Uint8Array.from([0, 1, 2]));
|
|
309
|
+
* base58xmr.decode(text);
|
|
310
|
+
* ```
|
|
212
311
|
*/
|
|
213
312
|
export declare const base58xmr: BytesCoder;
|
|
214
313
|
/**
|
|
215
314
|
* Method, which creates base58check encoder.
|
|
216
315
|
* Requires function, calculating sha256.
|
|
316
|
+
* Callers must include any version bytes in `data`; this helper only applies the
|
|
317
|
+
* 4-byte double-SHA256 checksum used by Bitcoin Base58Check.
|
|
318
|
+
* @param sha256 - Function used to calculate the checksum hash.
|
|
319
|
+
* @returns base58check codec using 4 checksum bytes.
|
|
320
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
321
|
+
* @example
|
|
322
|
+
* Create a base58check codec from a SHA-256 implementation.
|
|
323
|
+
* ```ts
|
|
324
|
+
* import { createBase58check } from '@scure/base';
|
|
325
|
+
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
326
|
+
* const coder = createBase58check(sha256);
|
|
327
|
+
* coder.encode(Uint8Array.from([1, 2, 3]));
|
|
328
|
+
* ```
|
|
217
329
|
*/
|
|
218
|
-
export declare const createBase58check: (sha256:
|
|
330
|
+
export declare const createBase58check: (sha256: TArg<BytesFn>) => BytesCoder;
|
|
219
331
|
/**
|
|
220
332
|
* Use `createBase58check` instead.
|
|
221
|
-
* @deprecated
|
|
333
|
+
* @deprecated Use {@link createBase58check} instead.
|
|
334
|
+
* Callers must include any version bytes in `data`; this alias keeps the same
|
|
335
|
+
* 4-byte double-SHA256 checksum behavior as `createBase58check`.
|
|
336
|
+
* @param sha256 - Function used to calculate the checksum hash.
|
|
337
|
+
* @returns base58check codec using 4 checksum bytes.
|
|
338
|
+
* @example
|
|
339
|
+
* Create a base58check codec with the deprecated alias.
|
|
340
|
+
* ```ts
|
|
341
|
+
* import { base58check } from '@scure/base';
|
|
342
|
+
* import { sha256 } from '@noble/hashes/sha2.js';
|
|
343
|
+
* const coder = base58check(sha256);
|
|
344
|
+
* coder.encode(Uint8Array.from([1, 2, 3]));
|
|
345
|
+
* ```
|
|
222
346
|
*/
|
|
223
|
-
export declare const base58check: (sha256:
|
|
347
|
+
export declare const base58check: (sha256: TArg<BytesFn>) => BytesCoder;
|
|
348
|
+
/** Result of bech32 decoding. */
|
|
224
349
|
export interface Bech32Decoded<Prefix extends string = string> {
|
|
350
|
+
/** Human-readable bech32 prefix. */
|
|
225
351
|
prefix: Prefix;
|
|
352
|
+
/** Decoded 5-bit word payload. */
|
|
226
353
|
words: number[];
|
|
227
354
|
}
|
|
355
|
+
/** Result of bech32 decoding with original bytes attached. */
|
|
228
356
|
export interface Bech32DecodedWithArray<Prefix extends string = string> {
|
|
357
|
+
/** Human-readable bech32 prefix. */
|
|
229
358
|
prefix: Prefix;
|
|
359
|
+
/** Decoded 5-bit word payload. */
|
|
230
360
|
words: number[];
|
|
361
|
+
/** Decoded payload converted back into raw bytes. */
|
|
231
362
|
bytes: Uint8Array;
|
|
232
363
|
}
|
|
364
|
+
/** bech32 codec surface. */
|
|
233
365
|
export interface Bech32 {
|
|
366
|
+
/**
|
|
367
|
+
* Encodes a human-readable prefix and 5-bit words into a bech32 string.
|
|
368
|
+
* @param prefix - Human-readable prefix.
|
|
369
|
+
* @param words - 5-bit words or raw bytes.
|
|
370
|
+
* @param limit - Maximum accepted output length, or `false` to disable the limit.
|
|
371
|
+
* @returns Encoded bech32 string.
|
|
372
|
+
*/
|
|
234
373
|
encode<Prefix extends string>(prefix: Prefix, words: number[] | Uint8Array, limit?: number | false): `${Lowercase<Prefix>}1${string}`;
|
|
374
|
+
/**
|
|
375
|
+
* Decodes a bech32 string into prefix and words.
|
|
376
|
+
* @param str - Encoded bech32 string.
|
|
377
|
+
* @param limit - Maximum accepted input length, or `false` to disable the limit.
|
|
378
|
+
* @returns Decoded prefix and 5-bit words.
|
|
379
|
+
*/
|
|
235
380
|
decode<Prefix extends string>(str: `${Prefix}1${string}`, limit?: number | false): Bech32Decoded<Prefix>;
|
|
381
|
+
decode(str: string, limit?: number | false): Bech32Decoded;
|
|
382
|
+
/**
|
|
383
|
+
* Encodes raw bytes by first converting them to 5-bit words.
|
|
384
|
+
* @param prefix - Human-readable prefix.
|
|
385
|
+
* @param bytes - Raw bytes to encode.
|
|
386
|
+
* @returns Encoded bech32 string.
|
|
387
|
+
*/
|
|
236
388
|
encodeFromBytes(prefix: string, bytes: Uint8Array): string;
|
|
389
|
+
/**
|
|
390
|
+
* Decodes a bech32 string and converts the payload back into bytes.
|
|
391
|
+
* @param str - Encoded bech32 string.
|
|
392
|
+
* @returns Decoded prefix, words, and bytes.
|
|
393
|
+
*/
|
|
237
394
|
decodeToBytes(str: string): Bech32DecodedWithArray;
|
|
395
|
+
/**
|
|
396
|
+
* Decodes a bech32 string, returning `undefined` instead of throwing on invalid input.
|
|
397
|
+
* @param str - Encoded bech32 string.
|
|
398
|
+
* @param limit - Maximum accepted input length, or `false` to disable the limit.
|
|
399
|
+
* @returns Decoded prefix and words, or `undefined` for invalid input.
|
|
400
|
+
*/
|
|
238
401
|
decodeUnsafe(str: string, limit?: number | false): void | Bech32Decoded<string>;
|
|
402
|
+
/**
|
|
403
|
+
* Converts 5-bit words back into raw bytes.
|
|
404
|
+
* @param to - 5-bit words to decode.
|
|
405
|
+
* @returns Decoded bytes.
|
|
406
|
+
*/
|
|
239
407
|
fromWords(to: number[]): Uint8Array;
|
|
408
|
+
/**
|
|
409
|
+
* Converts 5-bit words back into raw bytes, returning `undefined` instead of throwing.
|
|
410
|
+
* @param to - 5-bit words to decode.
|
|
411
|
+
* @returns Decoded bytes, or `undefined` for invalid input.
|
|
412
|
+
*/
|
|
240
413
|
fromWordsUnsafe(to: number[]): void | Uint8Array;
|
|
414
|
+
/**
|
|
415
|
+
* Converts raw bytes into 5-bit words for bech32 encoding.
|
|
416
|
+
* @param from - Raw bytes to convert.
|
|
417
|
+
* @returns 5-bit words.
|
|
418
|
+
*/
|
|
241
419
|
toWords(from: Uint8Array): number[];
|
|
242
420
|
}
|
|
243
421
|
/**
|
|
244
422
|
* bech32 from BIP 173. Operates on words.
|
|
245
|
-
* For high-level, check out scure-btc-signer
|
|
246
|
-
*
|
|
423
|
+
* For high-level helpers, check out {@link https://github.com/paulmillr/scure-btc-signer | scure-btc-signer}.
|
|
424
|
+
* @example
|
|
425
|
+
* Convert bytes to words, encode them, then decode back.
|
|
426
|
+
* ```ts
|
|
427
|
+
* const words = bech32.toWords(Uint8Array.from([1, 2, 3]));
|
|
428
|
+
* const text = bech32.encode('bc', words);
|
|
429
|
+
* bech32.decode(text);
|
|
430
|
+
* ```
|
|
247
431
|
*/
|
|
248
|
-
export declare const bech32: Bech32
|
|
432
|
+
export declare const bech32: TRet<Bech32>;
|
|
249
433
|
/**
|
|
250
434
|
* bech32m from BIP 350. Operates on words.
|
|
251
435
|
* It was to mitigate `bech32` weaknesses.
|
|
252
|
-
* For high-level, check out scure-btc-signer
|
|
253
|
-
*
|
|
436
|
+
* For high-level helpers, check out {@link https://github.com/paulmillr/scure-btc-signer | scure-btc-signer}.
|
|
437
|
+
* @example
|
|
438
|
+
* Convert bytes to words, encode them with bech32m, then decode back.
|
|
439
|
+
* ```ts
|
|
440
|
+
* const words = bech32m.toWords(Uint8Array.from([1, 2, 3]));
|
|
441
|
+
* const text = bech32m.encode('bc', words);
|
|
442
|
+
* bech32m.decode(text);
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
export declare const bech32m: TRet<Bech32>;
|
|
446
|
+
/**
|
|
447
|
+
* ASCII-to-byte decoder. Rejects non-ASCII text and bytes instead of doing UTF-8 replacement.
|
|
448
|
+
* Method names follow `BytesCoder`, so `encode(bytes)` returns a string and `decode(string)` returns bytes.
|
|
449
|
+
* @example
|
|
450
|
+
* ```js
|
|
451
|
+
* const b = ascii.decode("ABC"); // => new Uint8Array([ 65, 66, 67 ])
|
|
452
|
+
* const str = ascii.encode(b); // "ABC"
|
|
453
|
+
* ```
|
|
254
454
|
*/
|
|
255
|
-
export declare const
|
|
455
|
+
export declare const ascii: TRet<BytesCoder>;
|
|
256
456
|
/**
|
|
257
|
-
* UTF-8-to-byte decoder. Uses built-in TextDecoder / TextEncoder.
|
|
457
|
+
* Strict UTF-8-to-byte decoder. Uses built-in TextDecoder / TextEncoder when available.
|
|
458
|
+
* Method names follow `BytesCoder`, so `encode(bytes)` returns a string and
|
|
459
|
+
* `decode(string)` returns bytes.
|
|
460
|
+
* `encode(bytes)` requires Uint8Array input, preserves an explicit leading BOM, and
|
|
461
|
+
* throws on invalid UTF-8 bytes.
|
|
462
|
+
* `decode(string)` requires a primitive string and throws on malformed UTF-16 strings with
|
|
463
|
+
* lone surrogates.
|
|
258
464
|
* @example
|
|
259
465
|
* ```js
|
|
260
466
|
* const b = utf8.decode("hey"); // => new Uint8Array([ 104, 101, 121 ])
|
|
@@ -262,8 +468,13 @@ export declare const bech32m: Bech32;
|
|
|
262
468
|
* ```
|
|
263
469
|
*/
|
|
264
470
|
export declare const utf8: BytesCoder;
|
|
471
|
+
export declare const __TESTS: {
|
|
472
|
+
utf8Fallback: BytesCoder;
|
|
473
|
+
_isWellFormedShim: (str: string) => boolean;
|
|
474
|
+
};
|
|
265
475
|
/**
|
|
266
476
|
* hex string decoder. Uses built-in function, when available.
|
|
477
|
+
* Lowercase codec; unlike `base16`, this variant accepts either hex case and emits lowercase.
|
|
267
478
|
* @example
|
|
268
479
|
* ```js
|
|
269
480
|
* const b = hex.decode("0102ff"); // => new Uint8Array([ 1, 2, 255 ])
|
|
@@ -271,23 +482,74 @@ export declare const utf8: BytesCoder;
|
|
|
271
482
|
* ```
|
|
272
483
|
*/
|
|
273
484
|
export declare const hex: BytesCoder;
|
|
485
|
+
/** Built-in codecs exposed through the deprecated string conversion helpers. */
|
|
274
486
|
export type SomeCoders = {
|
|
487
|
+
/** UTF-8 string codec. */
|
|
275
488
|
utf8: BytesCoder;
|
|
489
|
+
/** Hex codec. */
|
|
276
490
|
hex: BytesCoder;
|
|
491
|
+
/** Uppercase RFC 4648 base16 codec. */
|
|
277
492
|
base16: BytesCoder;
|
|
493
|
+
/** RFC 4648 base32 codec with padding. */
|
|
278
494
|
base32: BytesCoder;
|
|
495
|
+
/** RFC 4648 base64 codec with padding. */
|
|
279
496
|
base64: BytesCoder;
|
|
497
|
+
/** URL-safe base64 codec without `+` or `/`. */
|
|
280
498
|
base64url: BytesCoder;
|
|
499
|
+
/** Bitcoin-style base58 codec. */
|
|
281
500
|
base58: BytesCoder;
|
|
501
|
+
/** Monero-style base58 codec. */
|
|
282
502
|
base58xmr: BytesCoder;
|
|
283
503
|
};
|
|
284
504
|
type CoderType = keyof SomeCoders;
|
|
285
|
-
/**
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
505
|
+
/**
|
|
506
|
+
* Encodes bytes with one of the built-in codecs.
|
|
507
|
+
* @deprecated Use the codec directly, for example `hex.encode(bytes)`.
|
|
508
|
+
* @param type - Codec name.
|
|
509
|
+
* @param bytes - Bytes to encode.
|
|
510
|
+
* @returns Encoded string.
|
|
511
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
512
|
+
* @example
|
|
513
|
+
* ```ts
|
|
514
|
+
* bytesToString('hex', Uint8Array.from([1, 2, 255]));
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
517
|
+
export declare const bytesToString: (type: CoderType, bytes: TArg<Uint8Array>) => string;
|
|
518
|
+
/**
|
|
519
|
+
* Alias for `bytesToString`.
|
|
520
|
+
* @deprecated Use {@link bytesToString} or the codec directly instead.
|
|
521
|
+
* @param type - Codec name.
|
|
522
|
+
* @param bytes - Bytes to encode.
|
|
523
|
+
* @returns Encoded string.
|
|
524
|
+
* @example
|
|
525
|
+
* ```ts
|
|
526
|
+
* str('hex', Uint8Array.from([1, 2, 255]));
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
export declare const str: (type: CoderType, bytes: TArg<Uint8Array>) => string;
|
|
530
|
+
/**
|
|
531
|
+
* Decodes a string with one of the built-in codecs.
|
|
532
|
+
* @deprecated Use the codec directly, for example `hex.decode(text)`.
|
|
533
|
+
* @param type - Codec name.
|
|
534
|
+
* @param str - Encoded string.
|
|
535
|
+
* @returns Decoded bytes.
|
|
536
|
+
* @throws On wrong argument types. {@link TypeError}
|
|
537
|
+
* @example
|
|
538
|
+
* ```ts
|
|
539
|
+
* stringToBytes('hex', '0102ff');
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
export declare const stringToBytes: (type: CoderType, str: string) => TRet<Uint8Array>;
|
|
543
|
+
/**
|
|
544
|
+
* Alias for `stringToBytes`.
|
|
545
|
+
* @deprecated Use {@link stringToBytes} or the codec directly instead.
|
|
546
|
+
* @param type - Codec name.
|
|
547
|
+
* @param str - Encoded string.
|
|
548
|
+
* @returns Decoded bytes.
|
|
549
|
+
* @example
|
|
550
|
+
* ```ts
|
|
551
|
+
* bytes('hex', '0102ff');
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
export declare const bytes: (type: CoderType, str: string) => TRet<Uint8Array>;
|
|
293
555
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/signer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0-beta.1",
|
|
4
4
|
"description": "Software signer implementations and signing utilities for Taquito.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"taquito",
|
|
@@ -57,20 +57,20 @@
|
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@noble/curves": "^1.9.7",
|
|
60
|
-
"@scure/bip39": "^2.0
|
|
61
|
-
"@noble/hashes": "^2.0
|
|
60
|
+
"@scure/bip39": "^2.2.0",
|
|
61
|
+
"@noble/hashes": "^2.2.0",
|
|
62
62
|
"@stablelib/nacl": "^1.0.4",
|
|
63
|
-
"@taquito/core": "^
|
|
64
|
-
"@taquito/utils": "^
|
|
63
|
+
"@taquito/core": "^25.0.0-beta.1",
|
|
64
|
+
"@taquito/utils": "^25.0.0-beta.1",
|
|
65
65
|
"@types/bn.js": "^5.1.5",
|
|
66
66
|
"bn.js": "^5.2.2",
|
|
67
67
|
"typedarray-to-buffer": "^4.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@rollup/plugin-commonjs": "^29.0.
|
|
70
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
71
71
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
72
72
|
"@types/bluebird": "^3.5.42",
|
|
73
|
-
"@types/node": "^22.
|
|
73
|
+
"@types/node": "^22.20.0",
|
|
74
74
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
75
75
|
"@typescript-eslint/parser": "^6.21.0",
|
|
76
76
|
"colors": "^1.4.0",
|
|
@@ -78,11 +78,11 @@
|
|
|
78
78
|
"eslint": "^8.57.0",
|
|
79
79
|
"lint-staged": "^15.2.7",
|
|
80
80
|
"lodash.camelcase": "^4.3.0",
|
|
81
|
-
"prettier": "^3.
|
|
81
|
+
"prettier": "^3.8.4",
|
|
82
82
|
"prompt": "^1.3.0",
|
|
83
83
|
"replace-in-file": "^8.1.0",
|
|
84
84
|
"rimraf": "^6.0.1",
|
|
85
|
-
"rollup": "^4.
|
|
85
|
+
"rollup": "^4.62.2",
|
|
86
86
|
"rollup-plugin-json": "^4.0.0",
|
|
87
87
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
88
88
|
"rollup-plugin-typescript2": "^0.37.0",
|