@frequency-chain/ethereum-utils 1.17.0-rc6 → 1.17.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/browser/frequency-ethereum-utils.esm.min.js +135 -305
- package/browser/frequency-ethereum-utils.umd.min.js +109 -293
- package/cjs/signature.definitions.js +10 -3
- package/cjs/signature.js +13 -15
- package/esm/signature.definitions.js +9 -2
- package/esm/signature.js +14 -16
- package/index.d.ts +4 -3
- package/package.json +5 -5
- package/signature.d.ts +2 -2
- package/signature.definitions.d.ts +2 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {Keyring}from'@polkadot/api';/** @internal Last-resort "this", if it gets here it probably would fail anyway */
|
|
2
|
-
function evaluateThis
|
|
2
|
+
function evaluateThis(fn) {
|
|
3
3
|
return fn('return this');
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
6
|
* A cross-environment implementation for globalThis
|
|
7
7
|
*/
|
|
8
|
-
const xglobal
|
|
8
|
+
const xglobal = (typeof globalThis !== 'undefined'
|
|
9
9
|
? globalThis
|
|
10
10
|
: typeof global !== 'undefined'
|
|
11
11
|
? global
|
|
@@ -13,19 +13,31 @@ const xglobal$3 = (typeof globalThis !== 'undefined'
|
|
|
13
13
|
? self
|
|
14
14
|
: typeof window !== 'undefined'
|
|
15
15
|
? window
|
|
16
|
-
: evaluateThis
|
|
16
|
+
: evaluateThis(Function));
|
|
17
17
|
/**
|
|
18
18
|
* Extracts a known global from the environment, applying a fallback if not found
|
|
19
19
|
*/
|
|
20
|
-
function extractGlobal
|
|
20
|
+
function extractGlobal(name, fallback) {
|
|
21
21
|
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
|
|
22
22
|
// (as of now) as to why this looks like an "any" when we do cast it to a T
|
|
23
23
|
//
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
25
|
-
return typeof xglobal
|
|
25
|
+
return typeof xglobal[name] === 'undefined'
|
|
26
26
|
? fallback
|
|
27
|
-
: xglobal
|
|
28
|
-
}let
|
|
27
|
+
: xglobal[name];
|
|
28
|
+
}let TextDecoder$1=class TextDecoder {
|
|
29
|
+
__encoding;
|
|
30
|
+
constructor(encoding) {
|
|
31
|
+
this.__encoding = encoding;
|
|
32
|
+
}
|
|
33
|
+
decode(value) {
|
|
34
|
+
let result = '';
|
|
35
|
+
for (let i = 0, count = value.length; i < count; i++) {
|
|
36
|
+
result += String.fromCharCode(value[i]);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
};const TextDecoder = /*#__PURE__*/ extractGlobal('TextDecoder', TextDecoder$1);let TextEncoder$2=class TextEncoder {
|
|
29
41
|
encode(value) {
|
|
30
42
|
const count = value.length;
|
|
31
43
|
const u8a = new Uint8Array(count);
|
|
@@ -34,7 +46,7 @@ function extractGlobal$2(name, fallback) {
|
|
|
34
46
|
}
|
|
35
47
|
return u8a;
|
|
36
48
|
}
|
|
37
|
-
};const TextEncoder$
|
|
49
|
+
};const TextEncoder$1 = /*#__PURE__*/ extractGlobal('TextEncoder', TextEncoder$2);/**
|
|
38
50
|
* @name isFunction
|
|
39
51
|
* @summary Tests for a `function`.
|
|
40
52
|
* @description
|
|
@@ -63,19 +75,19 @@ function isFunction(value) {
|
|
|
63
75
|
function invalidFallback() {
|
|
64
76
|
return Number.NaN;
|
|
65
77
|
}
|
|
66
|
-
const BigInt$1 = /*#__PURE__*/ extractGlobal
|
|
67
|
-
const U8$
|
|
68
|
-
const U16$
|
|
69
|
-
for (let i = 0, count = CHR$
|
|
70
|
-
U8$
|
|
78
|
+
const BigInt$1 = /*#__PURE__*/ extractGlobal('BigInt', invalidFallback);const CHR$1 = '0123456789abcdef';
|
|
79
|
+
const U8$1 = new Uint8Array(256);
|
|
80
|
+
const U16$1 = new Uint8Array(256 * 256);
|
|
81
|
+
for (let i = 0, count = CHR$1.length; i < count; i++) {
|
|
82
|
+
U8$1[CHR$1[i].charCodeAt(0) | 0] = i | 0;
|
|
71
83
|
if (i > 9) {
|
|
72
|
-
U8$
|
|
84
|
+
U8$1[CHR$1[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
|
|
73
85
|
}
|
|
74
86
|
}
|
|
75
87
|
for (let i = 0; i < 256; i++) {
|
|
76
88
|
const s = i << 8;
|
|
77
89
|
for (let j = 0; j < 256; j++) {
|
|
78
|
-
U16$
|
|
90
|
+
U16$1[s | j] = (U8$1[i] << 4) | U8$1[j];
|
|
79
91
|
}
|
|
80
92
|
}
|
|
81
93
|
/**
|
|
@@ -93,7 +105,7 @@ for (let i = 0; i < 256; i++) {
|
|
|
93
105
|
* hexToU8a('0x80001f', 32); // Uint8Array([0x00, 0x80, 0x00, 0x1f])
|
|
94
106
|
* ```
|
|
95
107
|
*/
|
|
96
|
-
function hexToU8a
|
|
108
|
+
function hexToU8a(value, bitLength = -1) {
|
|
97
109
|
if (!value) {
|
|
98
110
|
return new Uint8Array();
|
|
99
111
|
}
|
|
@@ -113,7 +125,7 @@ function hexToU8a$1(value, bitLength = -1) {
|
|
|
113
125
|
// HEX_TO_U16[value.substring()] we get an 10x slowdown. In the
|
|
114
126
|
// same vein using charCodeAt (as opposed to value[s] or value.charAt(s)) is
|
|
115
127
|
// also the faster operation by at least 2x with the character map above
|
|
116
|
-
result[i] = U16$
|
|
128
|
+
result[i] = U16$1[(value.charCodeAt(s) << 8) | value.charCodeAt(s + 1)];
|
|
117
129
|
}
|
|
118
130
|
return result;
|
|
119
131
|
}function getDefaultExportFromCjs (x) {
|
|
@@ -125,7 +137,11 @@ function getAugmentedNamespace(n) {
|
|
|
125
137
|
var f = n.default;
|
|
126
138
|
if (typeof f == "function") {
|
|
127
139
|
var a = function a () {
|
|
128
|
-
|
|
140
|
+
var isInstance = false;
|
|
141
|
+
try {
|
|
142
|
+
isInstance = this instanceof a;
|
|
143
|
+
} catch {}
|
|
144
|
+
if (isInstance) {
|
|
129
145
|
return Reflect.construct(f, arguments, this.constructor);
|
|
130
146
|
}
|
|
131
147
|
return f.apply(this, arguments);
|
|
@@ -3548,9 +3564,9 @@ function isObject(value) {
|
|
|
3548
3564
|
}const isToBigInt = /*#__PURE__*/ isOn('toBigInt');const isToBn = /*#__PURE__*/ isOn('toBn');/** true if the environment has proper BigInt support */
|
|
3549
3565
|
const hasBigInt = typeof BigInt$1 === 'function' && typeof BigInt$1.asIntN === 'function';
|
|
3550
3566
|
/** true if the environment has support for Buffer (typically Node.js) */
|
|
3551
|
-
const hasBuffer = typeof xglobal
|
|
3567
|
+
const hasBuffer = typeof xglobal.Buffer === 'function' && typeof xglobal.Buffer.isBuffer === 'function';
|
|
3552
3568
|
/** true if the environment has process available (typically Node.js) */
|
|
3553
|
-
typeof xglobal
|
|
3569
|
+
typeof xglobal.process === 'object';/**
|
|
3554
3570
|
* @name isBuffer
|
|
3555
3571
|
* @summary Tests for a `Buffer` object instance.
|
|
3556
3572
|
* @description
|
|
@@ -3566,7 +3582,7 @@ typeof xglobal$3.process === 'object';/**
|
|
|
3566
3582
|
*/
|
|
3567
3583
|
function isBuffer(value) {
|
|
3568
3584
|
// we do check a function first, since it is slightly faster than isBuffer itself
|
|
3569
|
-
return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal
|
|
3585
|
+
return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
|
|
3570
3586
|
}/**
|
|
3571
3587
|
* @name isU8a
|
|
3572
3588
|
* @summary Tests for a `Uint8Array` object instance.
|
|
@@ -3586,7 +3602,7 @@ function isU8a(value) {
|
|
|
3586
3602
|
// slower than just checking the constrctor (direct instances)
|
|
3587
3603
|
return (((value && value.constructor) === Uint8Array) ||
|
|
3588
3604
|
value instanceof Uint8Array);
|
|
3589
|
-
}const encoder
|
|
3605
|
+
}const encoder = new TextEncoder$1();
|
|
3590
3606
|
/**
|
|
3591
3607
|
* @name stringToU8a
|
|
3592
3608
|
* @summary Creates a Uint8Array object from a utf-8 string.
|
|
@@ -3601,15 +3617,17 @@ function isU8a(value) {
|
|
|
3601
3617
|
* stringToU8a('hello'); // [0x68, 0x65, 0x6c, 0x6c, 0x6f]
|
|
3602
3618
|
* ```
|
|
3603
3619
|
*/
|
|
3604
|
-
function stringToU8a
|
|
3620
|
+
function stringToU8a(value) {
|
|
3605
3621
|
return value
|
|
3606
|
-
? encoder
|
|
3622
|
+
? encoder.encode(value.toString())
|
|
3607
3623
|
: new Uint8Array();
|
|
3608
3624
|
}/**
|
|
3609
3625
|
* @name u8aToU8a
|
|
3610
3626
|
* @summary Creates a Uint8Array value from a Uint8Array, Buffer, string or hex input.
|
|
3611
3627
|
* @description
|
|
3612
3628
|
* `null` or `undefined` inputs returns a `[]` result, Uint8Array values returns the value, hex strings returns a Uint8Array representation.
|
|
3629
|
+
* If `strict` is true, `null` or `undefined` will throw an error instead of returning an empty array.
|
|
3630
|
+
* Supports input types: Uint8Array, Buffer, hex string, string, or number array.
|
|
3613
3631
|
* @example
|
|
3614
3632
|
* <BR>
|
|
3615
3633
|
*
|
|
@@ -3620,7 +3638,10 @@ function stringToU8a$1(value) {
|
|
|
3620
3638
|
* u8aToU8a(0x1234); // => Uint8Array([0x12, 0x34])
|
|
3621
3639
|
* ```
|
|
3622
3640
|
*/
|
|
3623
|
-
function u8aToU8a(value) {
|
|
3641
|
+
function u8aToU8a(value, strict = false) {
|
|
3642
|
+
if (strict && (value === null || value === undefined)) {
|
|
3643
|
+
throw new Error('u8aToU8a: Expected non-null, non-undefined value');
|
|
3644
|
+
}
|
|
3624
3645
|
return isU8a(value)
|
|
3625
3646
|
// NOTE isBuffer needs to go here since it actually extends
|
|
3626
3647
|
// Uint8Array on Node.js environments, so all Buffer are Uint8Array,
|
|
@@ -3629,10 +3650,10 @@ function u8aToU8a(value) {
|
|
|
3629
3650
|
? new Uint8Array(value)
|
|
3630
3651
|
: value
|
|
3631
3652
|
: isHex(value)
|
|
3632
|
-
? hexToU8a
|
|
3653
|
+
? hexToU8a(value)
|
|
3633
3654
|
: Array.isArray(value)
|
|
3634
3655
|
? new Uint8Array(value)
|
|
3635
|
-
: stringToU8a
|
|
3656
|
+
: stringToU8a(value);
|
|
3636
3657
|
}/**
|
|
3637
3658
|
* @name u8aConcat
|
|
3638
3659
|
* @summary Creates a concatenated Uint8Array from the inputs.
|
|
@@ -3678,26 +3699,26 @@ function u8aConcatStrict(u8as, length = 0) {
|
|
|
3678
3699
|
offset += u8as[i].length;
|
|
3679
3700
|
}
|
|
3680
3701
|
return result;
|
|
3681
|
-
}const U8
|
|
3682
|
-
const U16
|
|
3702
|
+
}const U8 = new Array(256);
|
|
3703
|
+
const U16 = new Array(256 * 256);
|
|
3683
3704
|
for (let n = 0; n < 256; n++) {
|
|
3684
|
-
U8
|
|
3705
|
+
U8[n] = n.toString(16).padStart(2, '0');
|
|
3685
3706
|
}
|
|
3686
3707
|
for (let i = 0; i < 256; i++) {
|
|
3687
3708
|
const s = i << 8;
|
|
3688
3709
|
for (let j = 0; j < 256; j++) {
|
|
3689
|
-
U16
|
|
3710
|
+
U16[s | j] = U8[i] + U8[j];
|
|
3690
3711
|
}
|
|
3691
3712
|
}
|
|
3692
3713
|
/** @internal */
|
|
3693
|
-
function hex
|
|
3714
|
+
function hex(value, result) {
|
|
3694
3715
|
const mod = (value.length % 2) | 0;
|
|
3695
3716
|
const length = (value.length - mod) | 0;
|
|
3696
3717
|
for (let i = 0; i < length; i += 2) {
|
|
3697
|
-
result += U16
|
|
3718
|
+
result += U16[(value[i] << 8) | value[i + 1]];
|
|
3698
3719
|
}
|
|
3699
3720
|
if (mod) {
|
|
3700
|
-
result += U8
|
|
3721
|
+
result += U8[value[length] | 0];
|
|
3701
3722
|
}
|
|
3702
3723
|
return result;
|
|
3703
3724
|
}
|
|
@@ -3715,7 +3736,7 @@ function hex$1(value, result) {
|
|
|
3715
3736
|
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
|
|
3716
3737
|
* ```
|
|
3717
3738
|
*/
|
|
3718
|
-
function u8aToHex
|
|
3739
|
+
function u8aToHex(value, bitLength = -1, isPrefixed = true) {
|
|
3719
3740
|
// this is not 100% correct sinmce we support isPrefixed = false....
|
|
3720
3741
|
const empty = isPrefixed
|
|
3721
3742
|
? '0x'
|
|
@@ -3726,10 +3747,29 @@ function u8aToHex$1(value, bitLength = -1, isPrefixed = true) {
|
|
|
3726
3747
|
else if (bitLength > 0) {
|
|
3727
3748
|
const length = Math.ceil(bitLength / 8);
|
|
3728
3749
|
if (value.length > length) {
|
|
3729
|
-
return `${hex
|
|
3750
|
+
return `${hex(value.subarray(0, length / 2), empty)}…${hex(value.subarray(value.length - length / 2), '')}`;
|
|
3730
3751
|
}
|
|
3731
3752
|
}
|
|
3732
|
-
return hex
|
|
3753
|
+
return hex(value, empty);
|
|
3754
|
+
}const decoder = new TextDecoder('utf-8');
|
|
3755
|
+
/**
|
|
3756
|
+
* @name u8aToString
|
|
3757
|
+
* @summary Creates a utf-8 string from a Uint8Array object.
|
|
3758
|
+
* @description
|
|
3759
|
+
* `UInt8Array` input values return the actual decoded utf-8 string. `null` or `undefined` values returns an empty string.
|
|
3760
|
+
* @example
|
|
3761
|
+
* <BR>
|
|
3762
|
+
*
|
|
3763
|
+
* ```javascript
|
|
3764
|
+
* import { u8aToString } from '@polkadot/util';
|
|
3765
|
+
*
|
|
3766
|
+
* u8aToString(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f])); // hello
|
|
3767
|
+
* ```
|
|
3768
|
+
*/
|
|
3769
|
+
function u8aToString(value) {
|
|
3770
|
+
return value
|
|
3771
|
+
? decoder.decode(value)
|
|
3772
|
+
: '';
|
|
3733
3773
|
}/**
|
|
3734
3774
|
* @name hexStripPrefix
|
|
3735
3775
|
* @summary Strips any leading `0x` prefix.
|
|
@@ -3861,240 +3901,7 @@ function bnToU8a(value, { bitLength = -1, isLe = true, isNegative = false } = DE
|
|
|
3861
3901
|
: valueBn;
|
|
3862
3902
|
output.set(bn.toArray(isLe ? 'le' : 'be', byteLength), 0);
|
|
3863
3903
|
return output;
|
|
3864
|
-
}
|
|
3865
|
-
function evaluateThis$2(fn) {
|
|
3866
|
-
return fn('return this');
|
|
3867
|
-
}
|
|
3868
|
-
/**
|
|
3869
|
-
* A cross-environment implementation for globalThis
|
|
3870
|
-
*/
|
|
3871
|
-
const xglobal$2 = (typeof globalThis !== 'undefined'
|
|
3872
|
-
? globalThis
|
|
3873
|
-
: typeof global !== 'undefined'
|
|
3874
|
-
? global
|
|
3875
|
-
: typeof self !== 'undefined'
|
|
3876
|
-
? self
|
|
3877
|
-
: typeof window !== 'undefined'
|
|
3878
|
-
? window
|
|
3879
|
-
: evaluateThis$2(Function));
|
|
3880
|
-
/**
|
|
3881
|
-
* Extracts a known global from the environment, applying a fallback if not found
|
|
3882
|
-
*/
|
|
3883
|
-
function extractGlobal$1(name, fallback) {
|
|
3884
|
-
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
|
|
3885
|
-
// (as of now) as to why this looks like an "any" when we do cast it to a T
|
|
3886
|
-
//
|
|
3887
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
3888
|
-
return typeof xglobal$2[name] === 'undefined'
|
|
3889
|
-
? fallback
|
|
3890
|
-
: xglobal$2[name];
|
|
3891
|
-
}let TextDecoder$1=class TextDecoder {
|
|
3892
|
-
__encoding;
|
|
3893
|
-
constructor(encoding) {
|
|
3894
|
-
this.__encoding = encoding;
|
|
3895
|
-
}
|
|
3896
|
-
decode(value) {
|
|
3897
|
-
let result = '';
|
|
3898
|
-
for (let i = 0, count = value.length; i < count; i++) {
|
|
3899
|
-
result += String.fromCharCode(value[i]);
|
|
3900
|
-
}
|
|
3901
|
-
return result;
|
|
3902
|
-
}
|
|
3903
|
-
};const TextDecoder = /*#__PURE__*/ extractGlobal$1('TextDecoder', TextDecoder$1);/** @internal Last-resort "this", if it gets here it probably would fail anyway */
|
|
3904
|
-
function evaluateThis$1(fn) {
|
|
3905
|
-
return fn('return this');
|
|
3906
|
-
}
|
|
3907
|
-
/**
|
|
3908
|
-
* A cross-environment implementation for globalThis
|
|
3909
|
-
*/
|
|
3910
|
-
const xglobal$1 = (typeof globalThis !== 'undefined'
|
|
3911
|
-
? globalThis
|
|
3912
|
-
: typeof global !== 'undefined'
|
|
3913
|
-
? global
|
|
3914
|
-
: typeof self !== 'undefined'
|
|
3915
|
-
? self
|
|
3916
|
-
: typeof window !== 'undefined'
|
|
3917
|
-
? window
|
|
3918
|
-
: evaluateThis$1(Function));
|
|
3919
|
-
/**
|
|
3920
|
-
* Extracts a known global from the environment, applying a fallback if not found
|
|
3921
|
-
*/
|
|
3922
|
-
function extractGlobal(name, fallback) {
|
|
3923
|
-
// Not quite sure why this is here - snuck in with TS 4.7.2 with no real idea
|
|
3924
|
-
// (as of now) as to why this looks like an "any" when we do cast it to a T
|
|
3925
|
-
//
|
|
3926
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
3927
|
-
return typeof xglobal$1[name] === 'undefined'
|
|
3928
|
-
? fallback
|
|
3929
|
-
: xglobal$1[name];
|
|
3930
|
-
}let TextEncoder$2=class TextEncoder {
|
|
3931
|
-
encode(value) {
|
|
3932
|
-
const count = value.length;
|
|
3933
|
-
const u8a = new Uint8Array(count);
|
|
3934
|
-
for (let i = 0; i < count; i++) {
|
|
3935
|
-
u8a[i] = value.charCodeAt(i);
|
|
3936
|
-
}
|
|
3937
|
-
return u8a;
|
|
3938
|
-
}
|
|
3939
|
-
};const TextEncoder$1 = /*#__PURE__*/ extractGlobal('TextEncoder', TextEncoder$2);const CHR$1 = '0123456789abcdef';
|
|
3940
|
-
const U8$1 = new Uint8Array(256);
|
|
3941
|
-
const U16$1 = new Uint8Array(256 * 256);
|
|
3942
|
-
for (let i = 0, count = CHR$1.length; i < count; i++) {
|
|
3943
|
-
U8$1[CHR$1[i].charCodeAt(0) | 0] = i | 0;
|
|
3944
|
-
if (i > 9) {
|
|
3945
|
-
U8$1[CHR$1[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
|
|
3946
|
-
}
|
|
3947
|
-
}
|
|
3948
|
-
for (let i = 0; i < 256; i++) {
|
|
3949
|
-
const s = i << 8;
|
|
3950
|
-
for (let j = 0; j < 256; j++) {
|
|
3951
|
-
U16$1[s | j] = (U8$1[i] << 4) | U8$1[j];
|
|
3952
|
-
}
|
|
3953
|
-
}
|
|
3954
|
-
/**
|
|
3955
|
-
* @name hexToU8a
|
|
3956
|
-
* @summary Creates a Uint8Array object from a hex string.
|
|
3957
|
-
* @description
|
|
3958
|
-
* `null` inputs returns an empty `Uint8Array` result. Hex input values return the actual bytes value converted to a Uint8Array. Anything that is not a hex string (including the `0x` prefix) throws an error.
|
|
3959
|
-
* @example
|
|
3960
|
-
* <BR>
|
|
3961
|
-
*
|
|
3962
|
-
* ```javascript
|
|
3963
|
-
* import { hexToU8a } from '@polkadot/util';
|
|
3964
|
-
*
|
|
3965
|
-
* hexToU8a('0x80001f'); // Uint8Array([0x80, 0x00, 0x1f])
|
|
3966
|
-
* hexToU8a('0x80001f', 32); // Uint8Array([0x00, 0x80, 0x00, 0x1f])
|
|
3967
|
-
* ```
|
|
3968
|
-
*/
|
|
3969
|
-
function hexToU8a(value, bitLength = -1) {
|
|
3970
|
-
if (!value) {
|
|
3971
|
-
return new Uint8Array();
|
|
3972
|
-
}
|
|
3973
|
-
let s = value.startsWith('0x')
|
|
3974
|
-
? 2
|
|
3975
|
-
: 0;
|
|
3976
|
-
const decLength = Math.ceil((value.length - s) / 2);
|
|
3977
|
-
const endLength = Math.ceil(bitLength === -1
|
|
3978
|
-
? decLength
|
|
3979
|
-
: bitLength / 8);
|
|
3980
|
-
const result = new Uint8Array(endLength);
|
|
3981
|
-
const offset = endLength > decLength
|
|
3982
|
-
? endLength - decLength
|
|
3983
|
-
: 0;
|
|
3984
|
-
for (let i = offset; i < endLength; i++, s += 2) {
|
|
3985
|
-
// The big factor here is actually the string lookups. If we do
|
|
3986
|
-
// HEX_TO_U16[value.substring()] we get an 10x slowdown. In the
|
|
3987
|
-
// same vein using charCodeAt (as opposed to value[s] or value.charAt(s)) is
|
|
3988
|
-
// also the faster operation by at least 2x with the character map above
|
|
3989
|
-
result[i] = U16$1[(value.charCodeAt(s) << 8) | value.charCodeAt(s + 1)];
|
|
3990
|
-
}
|
|
3991
|
-
return result;
|
|
3992
|
-
}const encoder = new TextEncoder$1();
|
|
3993
|
-
/**
|
|
3994
|
-
* @name stringToU8a
|
|
3995
|
-
* @summary Creates a Uint8Array object from a utf-8 string.
|
|
3996
|
-
* @description
|
|
3997
|
-
* String input values return the actual encoded `UInt8Array`. `null` or `undefined` values returns an empty encoded array.
|
|
3998
|
-
* @example
|
|
3999
|
-
* <BR>
|
|
4000
|
-
*
|
|
4001
|
-
* ```javascript
|
|
4002
|
-
* import { stringToU8a } from '@polkadot/util';
|
|
4003
|
-
*
|
|
4004
|
-
* stringToU8a('hello'); // [0x68, 0x65, 0x6c, 0x6c, 0x6f]
|
|
4005
|
-
* ```
|
|
4006
|
-
*/
|
|
4007
|
-
function stringToU8a(value) {
|
|
4008
|
-
return value
|
|
4009
|
-
? encoder.encode(value.toString())
|
|
4010
|
-
: new Uint8Array();
|
|
4011
|
-
}const U8 = new Array(256);
|
|
4012
|
-
const U16 = new Array(256 * 256);
|
|
4013
|
-
for (let n = 0; n < 256; n++) {
|
|
4014
|
-
U8[n] = n.toString(16).padStart(2, '0');
|
|
4015
|
-
}
|
|
4016
|
-
for (let i = 0; i < 256; i++) {
|
|
4017
|
-
const s = i << 8;
|
|
4018
|
-
for (let j = 0; j < 256; j++) {
|
|
4019
|
-
U16[s | j] = U8[i] + U8[j];
|
|
4020
|
-
}
|
|
4021
|
-
}
|
|
4022
|
-
/** @internal */
|
|
4023
|
-
function hex(value, result) {
|
|
4024
|
-
const mod = (value.length % 2) | 0;
|
|
4025
|
-
const length = (value.length - mod) | 0;
|
|
4026
|
-
for (let i = 0; i < length; i += 2) {
|
|
4027
|
-
result += U16[(value[i] << 8) | value[i + 1]];
|
|
4028
|
-
}
|
|
4029
|
-
if (mod) {
|
|
4030
|
-
result += U8[value[length] | 0];
|
|
4031
|
-
}
|
|
4032
|
-
return result;
|
|
4033
|
-
}
|
|
4034
|
-
/**
|
|
4035
|
-
* @name u8aToHex
|
|
4036
|
-
* @summary Creates a hex string from a Uint8Array object.
|
|
4037
|
-
* @description
|
|
4038
|
-
* `UInt8Array` input values return the actual hex string. `null` or `undefined` values returns an `0x` string.
|
|
4039
|
-
* @example
|
|
4040
|
-
* <BR>
|
|
4041
|
-
*
|
|
4042
|
-
* ```javascript
|
|
4043
|
-
* import { u8aToHex } from '@polkadot/util';
|
|
4044
|
-
*
|
|
4045
|
-
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
|
|
4046
|
-
* ```
|
|
4047
|
-
*/
|
|
4048
|
-
function u8aToHex(value, bitLength = -1, isPrefixed = true) {
|
|
4049
|
-
// this is not 100% correct sinmce we support isPrefixed = false....
|
|
4050
|
-
const empty = isPrefixed
|
|
4051
|
-
? '0x'
|
|
4052
|
-
: '';
|
|
4053
|
-
if (!value?.length) {
|
|
4054
|
-
return empty;
|
|
4055
|
-
}
|
|
4056
|
-
else if (bitLength > 0) {
|
|
4057
|
-
const length = Math.ceil(bitLength / 8);
|
|
4058
|
-
if (value.length > length) {
|
|
4059
|
-
return `${hex(value.subarray(0, length / 2), empty)}…${hex(value.subarray(value.length - length / 2), '')}`;
|
|
4060
|
-
}
|
|
4061
|
-
}
|
|
4062
|
-
return hex(value, empty);
|
|
4063
|
-
}const decoder = new TextDecoder('utf-8');
|
|
4064
|
-
/**
|
|
4065
|
-
* @name u8aToString
|
|
4066
|
-
* @summary Creates a utf-8 string from a Uint8Array object.
|
|
4067
|
-
* @description
|
|
4068
|
-
* `UInt8Array` input values return the actual decoded utf-8 string. `null` or `undefined` values returns an empty string.
|
|
4069
|
-
* @example
|
|
4070
|
-
* <BR>
|
|
4071
|
-
*
|
|
4072
|
-
* ```javascript
|
|
4073
|
-
* import { u8aToString } from '@polkadot/util';
|
|
4074
|
-
*
|
|
4075
|
-
* u8aToString(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0x6f])); // hello
|
|
4076
|
-
* ```
|
|
4077
|
-
*/
|
|
4078
|
-
function u8aToString(value) {
|
|
4079
|
-
return value
|
|
4080
|
-
? decoder.decode(value)
|
|
4081
|
-
: '';
|
|
4082
|
-
}/** @internal Last-resort "this", if it gets here it probably would fail anyway */
|
|
4083
|
-
function evaluateThis(fn) {
|
|
4084
|
-
return fn('return this');
|
|
4085
|
-
}
|
|
4086
|
-
/**
|
|
4087
|
-
* A cross-environment implementation for globalThis
|
|
4088
|
-
*/
|
|
4089
|
-
const xglobal = (typeof globalThis !== 'undefined'
|
|
4090
|
-
? globalThis
|
|
4091
|
-
: typeof global !== 'undefined'
|
|
4092
|
-
? global
|
|
4093
|
-
: typeof self !== 'undefined'
|
|
4094
|
-
? self
|
|
4095
|
-
: typeof window !== 'undefined'
|
|
4096
|
-
? window
|
|
4097
|
-
: evaluateThis(Function));const crypto$3 = xglobal.crypto;
|
|
3904
|
+
}const crypto$3 = xglobal.crypto;
|
|
4098
3905
|
function getRandomValues(arr) {
|
|
4099
3906
|
return crypto$3.getRandomValues(arr);
|
|
4100
3907
|
}const DEFAULT_CRYPTO = { getRandomValues };
|
|
@@ -5767,7 +5574,7 @@ function blake2AsU8a(data, bitLength = 256, key, onlyJs) {
|
|
|
5767
5574
|
: key
|
|
5768
5575
|
? blake2b(u8a, { dkLen: byteLength, key })
|
|
5769
5576
|
: blake2b(u8a, { dkLen: byteLength });
|
|
5770
|
-
}const SS58_PREFIX = stringToU8a
|
|
5577
|
+
}const SS58_PREFIX = stringToU8a('SS58PRE');
|
|
5771
5578
|
function sshash(key) {
|
|
5772
5579
|
return blake2AsU8a(u8aConcat(SS58_PREFIX, key), 512);
|
|
5773
5580
|
}function checkAddressChecksum(decoded) {
|
|
@@ -7791,6 +7598,9 @@ var knownSubstrate = [
|
|
|
7791
7598
|
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
|
|
7792
7599
|
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf' // Kusama CC1
|
|
7793
7600
|
],
|
|
7601
|
+
liberland: [
|
|
7602
|
+
'0x6bd89e052d67a45bb60a9a23e8581053d5e0d619f15cb9865946937e690c42d6'
|
|
7603
|
+
],
|
|
7794
7604
|
matrixchain: [
|
|
7795
7605
|
'0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615'
|
|
7796
7606
|
],
|
|
@@ -7917,6 +7727,7 @@ var knownSubstrate = [
|
|
|
7917
7727
|
karura: 0x000002ae,
|
|
7918
7728
|
khala: 0x000001b2,
|
|
7919
7729
|
kusama: 0x000001b2,
|
|
7730
|
+
liberland: 0x000002ff,
|
|
7920
7731
|
matrixchain: 0x00000483,
|
|
7921
7732
|
nodle: 0x000003eb,
|
|
7922
7733
|
origintrail: 0x00000162,
|
|
@@ -10698,8 +10509,8 @@ function ethereumEncode(addressOrPublic) {
|
|
|
10698
10509
|
if (![20, 32, 33, 65].includes(u8aAddress.length)) {
|
|
10699
10510
|
throw new Error(`Invalid address or publicKey provided, received ${u8aAddress.length} bytes input`);
|
|
10700
10511
|
}
|
|
10701
|
-
const address = u8aToHex
|
|
10702
|
-
const hash = u8aToHex
|
|
10512
|
+
const address = u8aToHex(getH160(u8aAddress), -1, false);
|
|
10513
|
+
const hash = u8aToHex(keccakAsU8a(address), -1, false);
|
|
10703
10514
|
let result = '';
|
|
10704
10515
|
for (let i = 0; i < 40; i++) {
|
|
10705
10516
|
result = `${result}${parseInt(hash[i], 16) > 7 ? address[i].toUpperCase() : address[i]}`;
|
|
@@ -10709,7 +10520,7 @@ function ethereumEncode(addressOrPublic) {
|
|
|
10709
10520
|
/**
|
|
10710
10521
|
* The current version of Ethers.
|
|
10711
10522
|
*/
|
|
10712
|
-
const version = "6.
|
|
10523
|
+
const version = "6.15.0";/**
|
|
10713
10524
|
* Property helper functions.
|
|
10714
10525
|
*
|
|
10715
10526
|
* @_subsection api/utils:Properties [about-properties]
|
|
@@ -14888,12 +14699,28 @@ class Signature {
|
|
|
14888
14699
|
/**
|
|
14889
14700
|
* The ``s`` value for a signature.
|
|
14890
14701
|
*/
|
|
14891
|
-
get s() {
|
|
14702
|
+
get s() {
|
|
14703
|
+
assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s);
|
|
14704
|
+
return this.#s;
|
|
14705
|
+
}
|
|
14892
14706
|
set s(_value) {
|
|
14893
14707
|
assertArgument(dataLength(_value) === 32, "invalid s", "value", _value);
|
|
14894
|
-
|
|
14895
|
-
|
|
14896
|
-
|
|
14708
|
+
this.#s = hexlify(_value);
|
|
14709
|
+
}
|
|
14710
|
+
/**
|
|
14711
|
+
* Return the s value, unchecked for EIP-2 compliance.
|
|
14712
|
+
*
|
|
14713
|
+
* This should generally not be used and is for situations where
|
|
14714
|
+
* a non-canonical S value might be relevant, such as Frontier blocks
|
|
14715
|
+
* that were mined prior to EIP-2 or invalid Authorization List
|
|
14716
|
+
* signatures.
|
|
14717
|
+
*/
|
|
14718
|
+
get _s() { return this.#s; }
|
|
14719
|
+
/**
|
|
14720
|
+
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
|
|
14721
|
+
*/
|
|
14722
|
+
isValid() {
|
|
14723
|
+
return (parseInt(this.#s.substring(0, 3)) < 8);
|
|
14897
14724
|
}
|
|
14898
14725
|
/**
|
|
14899
14726
|
* The ``v`` value for a signature.
|
|
@@ -14970,13 +14797,13 @@ class Signature {
|
|
|
14970
14797
|
this.#networkV = null;
|
|
14971
14798
|
}
|
|
14972
14799
|
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
14973
|
-
return `Signature { r: "${this.r}", s: "${this.
|
|
14800
|
+
return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`;
|
|
14974
14801
|
}
|
|
14975
14802
|
/**
|
|
14976
14803
|
* Returns a new identical [[Signature]].
|
|
14977
14804
|
*/
|
|
14978
14805
|
clone() {
|
|
14979
|
-
const clone = new Signature(_guard$2, this.r, this.
|
|
14806
|
+
const clone = new Signature(_guard$2, this.r, this._s, this.v);
|
|
14980
14807
|
if (this.networkV) {
|
|
14981
14808
|
clone.#networkV = this.networkV;
|
|
14982
14809
|
}
|
|
@@ -14990,7 +14817,7 @@ class Signature {
|
|
|
14990
14817
|
return {
|
|
14991
14818
|
_type: "signature",
|
|
14992
14819
|
networkV: ((networkV != null) ? networkV.toString() : null),
|
|
14993
|
-
r: this.r, s: this.
|
|
14820
|
+
r: this.r, s: this._s, v: this.v,
|
|
14994
14821
|
};
|
|
14995
14822
|
}
|
|
14996
14823
|
/**
|
|
@@ -15089,10 +14916,9 @@ class Signature {
|
|
|
15089
14916
|
}
|
|
15090
14917
|
if (bytes.length === 65) {
|
|
15091
14918
|
const r = hexlify(bytes.slice(0, 32));
|
|
15092
|
-
const s = bytes.slice(32, 64);
|
|
15093
|
-
assertError((s[0] & 0x80) === 0, "non-canonical s");
|
|
14919
|
+
const s = hexlify(bytes.slice(32, 64));
|
|
15094
14920
|
const v = Signature.getNormalizedV(bytes[64]);
|
|
15095
|
-
return new Signature(_guard$2, r,
|
|
14921
|
+
return new Signature(_guard$2, r, s, v);
|
|
15096
14922
|
}
|
|
15097
14923
|
assertError(false, "invalid raw signature length");
|
|
15098
14924
|
}
|
|
@@ -15116,7 +14942,6 @@ class Signature {
|
|
|
15116
14942
|
}
|
|
15117
14943
|
assertError(false, "missing s");
|
|
15118
14944
|
})(sig.s, sig.yParityAndS);
|
|
15119
|
-
assertError((getBytes(s)[0] & 0x80) == 0, "non-canonical s");
|
|
15120
14945
|
// Get v; by any means necessary (we check consistency below)
|
|
15121
14946
|
const { networkV, v } = (function (_v, yParityAndS, yParity) {
|
|
15122
14947
|
if (_v != null) {
|
|
@@ -19605,8 +19430,15 @@ function assert(condition, message) {
|
|
|
19605
19430
|
},
|
|
19606
19431
|
],
|
|
19607
19432
|
};
|
|
19608
|
-
// using
|
|
19609
|
-
const
|
|
19433
|
+
// using 2091 for mainnet
|
|
19434
|
+
const EIP712_DOMAIN_MAINNET = {
|
|
19435
|
+
name: 'Frequency',
|
|
19436
|
+
version: '1',
|
|
19437
|
+
chainId: '0x082B',
|
|
19438
|
+
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
19439
|
+
};
|
|
19440
|
+
// using pallet_revive test chain ID for testnet/dev
|
|
19441
|
+
const EIP712_DOMAIN_TESTNET = {
|
|
19610
19442
|
name: 'Frequency',
|
|
19611
19443
|
version: '1',
|
|
19612
19444
|
chainId: '0x190f1b44',
|
|
@@ -19764,22 +19596,21 @@ const SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION = {
|
|
|
19764
19596
|
type: 'string',
|
|
19765
19597
|
},
|
|
19766
19598
|
],
|
|
19767
|
-
};var signatureDefinitions=/*#__PURE__*/Object.freeze({__proto__:null,ADD_KEY_DATA_DEFINITION:ADD_KEY_DATA_DEFINITION,ADD_PROVIDER_DEFINITION:ADD_PROVIDER_DEFINITION,AUTHORIZED_KEY_DATA_DEFINITION:AUTHORIZED_KEY_DATA_DEFINITION,CLAIM_HANDLE_PAYLOAD_DEFINITION:CLAIM_HANDLE_PAYLOAD_DEFINITION,
|
|
19599
|
+
};var signatureDefinitions=/*#__PURE__*/Object.freeze({__proto__:null,ADD_KEY_DATA_DEFINITION:ADD_KEY_DATA_DEFINITION,ADD_PROVIDER_DEFINITION:ADD_PROVIDER_DEFINITION,AUTHORIZED_KEY_DATA_DEFINITION:AUTHORIZED_KEY_DATA_DEFINITION,CLAIM_HANDLE_PAYLOAD_DEFINITION:CLAIM_HANDLE_PAYLOAD_DEFINITION,EIP712_DOMAIN_DEFINITION:EIP712_DOMAIN_DEFINITION,EIP712_DOMAIN_MAINNET:EIP712_DOMAIN_MAINNET,EIP712_DOMAIN_TESTNET:EIP712_DOMAIN_TESTNET,ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2:ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2,PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2:PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2,PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2:PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2,PASSKEY_PUBLIC_KEY_DEFINITION:PASSKEY_PUBLIC_KEY_DEFINITION,SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION:SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION});/**
|
|
19768
19600
|
* Signing EIP-712 or ERC-191 compatible signature based on payload
|
|
19769
19601
|
* @param secretKey
|
|
19770
19602
|
* @param payload
|
|
19771
19603
|
* @param chain
|
|
19772
19604
|
*/
|
|
19773
|
-
async function sign(secretKey, payload, chain
|
|
19605
|
+
async function sign(secretKey, payload, chain) {
|
|
19774
19606
|
const signatureType = getSignatureType(payload.type);
|
|
19775
19607
|
const normalizedPayload = normalizePayload(payload);
|
|
19776
19608
|
const wallet = new Wallet(secretKey);
|
|
19777
19609
|
let signature;
|
|
19778
19610
|
switch (signatureType) {
|
|
19779
19611
|
case 'EIP-712':
|
|
19780
|
-
// TODO: use correct chainID for different networks
|
|
19781
19612
|
// TODO: use correct contract address for different payloads
|
|
19782
|
-
signature = await wallet.signTypedData(
|
|
19613
|
+
signature = await wallet.signTypedData(chain === 'Mainnet-Frequency' ? EIP712_DOMAIN_MAINNET : EIP712_DOMAIN_TESTNET, getTypesFor(payload.type), normalizedPayload);
|
|
19783
19614
|
break;
|
|
19784
19615
|
case 'EIP-191':
|
|
19785
19616
|
signature = await wallet.signMessage(payload.message);
|
|
@@ -19796,15 +19627,14 @@ async function sign(secretKey, payload, chain = 'Mainnet-Frequency') {
|
|
|
19796
19627
|
* @param payload
|
|
19797
19628
|
* @param chain
|
|
19798
19629
|
*/
|
|
19799
|
-
function verifySignature(ethereumAddress, signature, payload, chain
|
|
19630
|
+
function verifySignature(ethereumAddress, signature, payload, chain) {
|
|
19800
19631
|
const signatureType = getSignatureType(payload.type);
|
|
19801
19632
|
const normalizedPayload = normalizePayload(payload);
|
|
19802
19633
|
let recoveredAddress;
|
|
19803
19634
|
switch (signatureType) {
|
|
19804
19635
|
case 'EIP-712':
|
|
19805
|
-
// TODO: use correct chainID for different networks
|
|
19806
19636
|
// TODO: use correct contract address for different payloads
|
|
19807
|
-
recoveredAddress = verifyTypedData(
|
|
19637
|
+
recoveredAddress = verifyTypedData(chain === 'Mainnet-Frequency' ? EIP712_DOMAIN_MAINNET : EIP712_DOMAIN_TESTNET, getTypesFor(payload.type), normalizedPayload, signature);
|
|
19808
19638
|
break;
|
|
19809
19639
|
case 'EIP-191':
|
|
19810
19640
|
recoveredAddress = verifyMessage(payload.message, signature);
|
|
@@ -20077,7 +19907,7 @@ function createSiwfLoginRequestPayload(message) {
|
|
|
20077
19907
|
* @param expirationBlock Block number after which this payload is invalid
|
|
20078
19908
|
* @param domain
|
|
20079
19909
|
*/
|
|
20080
|
-
function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock, domain =
|
|
19910
|
+
function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
20081
19911
|
const message = createAddKeyData(msaId, newPublicKey, expirationBlock);
|
|
20082
19912
|
const normalized = normalizePayload(message);
|
|
20083
19913
|
return createEip712Payload(ADD_KEY_DATA_DEFINITION, message.type, domain, normalized);
|
|
@@ -20090,7 +19920,7 @@ function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock,
|
|
|
20090
19920
|
* @param expirationBlock Block number after which this payload is invalid
|
|
20091
19921
|
* @param domain
|
|
20092
19922
|
*/
|
|
20093
|
-
function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock, domain =
|
|
19923
|
+
function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
20094
19924
|
const message = createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock);
|
|
20095
19925
|
const normalized = normalizePayload(message);
|
|
20096
19926
|
return createEip712Payload(AUTHORIZED_KEY_DATA_DEFINITION, message.type, domain, normalized);
|
|
@@ -20103,7 +19933,7 @@ function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, ex
|
|
|
20103
19933
|
* @param expirationBlock Block number after which this payload is invalid
|
|
20104
19934
|
* @param domain
|
|
20105
19935
|
*/
|
|
20106
|
-
function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain =
|
|
19936
|
+
function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
20107
19937
|
const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
|
|
20108
19938
|
const normalized = normalizePayload(message);
|
|
20109
19939
|
return createEip712Payload(ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
|
|
@@ -20118,7 +19948,7 @@ function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirati
|
|
|
20118
19948
|
* @param payload HexString or Uint8Array data to upsert
|
|
20119
19949
|
* @param domain
|
|
20120
19950
|
*/
|
|
20121
|
-
function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload, domain =
|
|
19951
|
+
function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload, domain = EIP712_DOMAIN_MAINNET) {
|
|
20122
19952
|
const message = createPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload);
|
|
20123
19953
|
const normalized = normalizePayload(message);
|
|
20124
19954
|
return createEip712Payload(PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -20132,7 +19962,7 @@ function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, page
|
|
|
20132
19962
|
* @param expiration uint32 expiration block
|
|
20133
19963
|
* @param domain
|
|
20134
19964
|
*/
|
|
20135
|
-
function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration, domain =
|
|
19965
|
+
function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration, domain = EIP712_DOMAIN_MAINNET) {
|
|
20136
19966
|
const message = createPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration);
|
|
20137
19967
|
const normalized = normalizePayload(message);
|
|
20138
19968
|
return createEip712Payload(PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -20146,7 +19976,7 @@ function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, page
|
|
|
20146
19976
|
* @param actions Array of Add/Delete itemized actions
|
|
20147
19977
|
* @param domain
|
|
20148
19978
|
*/
|
|
20149
|
-
function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions, domain =
|
|
19979
|
+
function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions, domain = EIP712_DOMAIN_MAINNET) {
|
|
20150
19980
|
const message = createItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions);
|
|
20151
19981
|
const normalized = normalizePayload(message);
|
|
20152
19982
|
return createEip712Payload(ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -20158,7 +19988,7 @@ function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash,
|
|
|
20158
19988
|
* @param expirationBlock Block number after which this payload is invalid
|
|
20159
19989
|
* @param domain
|
|
20160
19990
|
*/
|
|
20161
|
-
function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, domain =
|
|
19991
|
+
function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
20162
19992
|
const message = createClaimHandlePayload(handle, expirationBlock);
|
|
20163
19993
|
const normalized = normalizePayload(message);
|
|
20164
19994
|
return createEip712Payload(CLAIM_HANDLE_PAYLOAD_DEFINITION, message.type, domain, normalized);
|
|
@@ -20169,7 +19999,7 @@ function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, doma
|
|
|
20169
19999
|
* @param publicKey The passkey’s public key (hex string or raw bytes)
|
|
20170
20000
|
* @param domain
|
|
20171
20001
|
*/
|
|
20172
|
-
function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain =
|
|
20002
|
+
function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain = EIP712_DOMAIN_MAINNET) {
|
|
20173
20003
|
const message = createPasskeyPublicKey(publicKey);
|
|
20174
20004
|
const normalized = normalizePayload(message);
|
|
20175
20005
|
return createEip712Payload(PASSKEY_PUBLIC_KEY_DEFINITION, message.type, domain, normalized);
|
|
@@ -20182,7 +20012,7 @@ function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain = EIP712_DOMA
|
|
|
20182
20012
|
* @param userIdentifierAdminUrl Only used for custom integration situations.
|
|
20183
20013
|
* @param domain
|
|
20184
20014
|
*/
|
|
20185
|
-
function getEip712BrowserRequestSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl, domain =
|
|
20015
|
+
function getEip712BrowserRequestSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl, domain = EIP712_DOMAIN_MAINNET) {
|
|
20186
20016
|
const message = createSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl);
|
|
20187
20017
|
const normalized = normalizePayload(message);
|
|
20188
20018
|
return createEip712Payload(SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION, message.type, domain, normalized);
|
|
@@ -20243,4 +20073,4 @@ function prefixEthereumTags(hexPayload) {
|
|
|
20243
20073
|
const wrapped = `\x19Ethereum Signed Message:\n${hexPayload.length}${hexPayload}`;
|
|
20244
20074
|
const buffer = Buffer.from(wrapped, 'utf-8');
|
|
20245
20075
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
|
|
20246
|
-
}var signature=/*#__PURE__*/Object.freeze({__proto__:null,createAddKeyData:createAddKeyData,createAddProvider:createAddProvider,createAuthorizedKeyData:createAuthorizedKeyData,createClaimHandlePayload:createClaimHandlePayload,createItemizedAddAction:createItemizedAddAction,createItemizedDeleteAction:createItemizedDeleteAction,createItemizedSignaturePayloadV2:createItemizedSignaturePayloadV2,createPaginatedDeleteSignaturePayloadV2:createPaginatedDeleteSignaturePayloadV2,createPaginatedUpsertSignaturePayloadV2:createPaginatedUpsertSignaturePayloadV2,createPasskeyPublicKey:createPasskeyPublicKey,createSiwfLoginRequestPayload:createSiwfLoginRequestPayload,createSiwfSignedRequestPayload:createSiwfSignedRequestPayload,getEip712BrowserRequestAddKeyData:getEip712BrowserRequestAddKeyData,getEip712BrowserRequestAddProvider:getEip712BrowserRequestAddProvider,getEip712BrowserRequestAuthorizedKeyData:getEip712BrowserRequestAuthorizedKeyData,getEip712BrowserRequestClaimHandlePayload:getEip712BrowserRequestClaimHandlePayload,getEip712BrowserRequestItemizedSignaturePayloadV2:getEip712BrowserRequestItemizedSignaturePayloadV2,getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2:getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2,getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2:getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2,getEip712BrowserRequestPasskeyPublicKey:getEip712BrowserRequestPasskeyPublicKey,getEip712BrowserRequestSiwfSignedRequestPayload:getEip712BrowserRequestSiwfSignedRequestPayload,getEthereumMessageSigner:getEthereumMessageSigner,getEthereumRegularSigner:getEthereumRegularSigner,sign:sign,verifySignature:verifySignature});var index = { ...payloads, ...address, ...signatureDefinitions, ...signature };export{ADD_KEY_DATA_DEFINITION,ADD_PROVIDER_DEFINITION,AUTHORIZED_KEY_DATA_DEFINITION,CLAIM_HANDLE_PAYLOAD_DEFINITION,
|
|
20076
|
+
}var signature=/*#__PURE__*/Object.freeze({__proto__:null,createAddKeyData:createAddKeyData,createAddProvider:createAddProvider,createAuthorizedKeyData:createAuthorizedKeyData,createClaimHandlePayload:createClaimHandlePayload,createItemizedAddAction:createItemizedAddAction,createItemizedDeleteAction:createItemizedDeleteAction,createItemizedSignaturePayloadV2:createItemizedSignaturePayloadV2,createPaginatedDeleteSignaturePayloadV2:createPaginatedDeleteSignaturePayloadV2,createPaginatedUpsertSignaturePayloadV2:createPaginatedUpsertSignaturePayloadV2,createPasskeyPublicKey:createPasskeyPublicKey,createSiwfLoginRequestPayload:createSiwfLoginRequestPayload,createSiwfSignedRequestPayload:createSiwfSignedRequestPayload,getEip712BrowserRequestAddKeyData:getEip712BrowserRequestAddKeyData,getEip712BrowserRequestAddProvider:getEip712BrowserRequestAddProvider,getEip712BrowserRequestAuthorizedKeyData:getEip712BrowserRequestAuthorizedKeyData,getEip712BrowserRequestClaimHandlePayload:getEip712BrowserRequestClaimHandlePayload,getEip712BrowserRequestItemizedSignaturePayloadV2:getEip712BrowserRequestItemizedSignaturePayloadV2,getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2:getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2,getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2:getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2,getEip712BrowserRequestPasskeyPublicKey:getEip712BrowserRequestPasskeyPublicKey,getEip712BrowserRequestSiwfSignedRequestPayload:getEip712BrowserRequestSiwfSignedRequestPayload,getEthereumMessageSigner:getEthereumMessageSigner,getEthereumRegularSigner:getEthereumRegularSigner,sign:sign,verifySignature:verifySignature});var index = { ...payloads, ...address, ...signatureDefinitions, ...signature };export{ADD_KEY_DATA_DEFINITION,ADD_PROVIDER_DEFINITION,AUTHORIZED_KEY_DATA_DEFINITION,CLAIM_HANDLE_PAYLOAD_DEFINITION,EIP712_DOMAIN_DEFINITION,EIP712_DOMAIN_MAINNET,EIP712_DOMAIN_TESTNET,ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2,PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2,PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2,PASSKEY_PUBLIC_KEY_DEFINITION,SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION,createAddKeyData,createAddProvider,createAuthorizedKeyData,createClaimHandlePayload,createItemizedAddAction,createItemizedDeleteAction,createItemizedSignaturePayloadV2,createPaginatedDeleteSignaturePayloadV2,createPaginatedUpsertSignaturePayloadV2,createPasskeyPublicKey,createRandomKey,createSiwfLoginRequestPayload,createSiwfSignedRequestPayload,index as default,ethereumAddressToKeyringPair,getAccountId20MultiAddress,getEip712BrowserRequestAddKeyData,getEip712BrowserRequestAddProvider,getEip712BrowserRequestAuthorizedKeyData,getEip712BrowserRequestClaimHandlePayload,getEip712BrowserRequestItemizedSignaturePayloadV2,getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2,getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2,getEip712BrowserRequestPasskeyPublicKey,getEip712BrowserRequestSiwfSignedRequestPayload,getEthereumMessageSigner,getEthereumRegularSigner,getKeyringPairFromSecp256k1PrivateKey,getSS58AccountFromEthereumAccount,getUnifiedAddress,getUnifiedPublicKey,reverseUnifiedAddressToEthereumAddress,sign,verifySignature};
|