@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
|
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('ethers'),require('@polkadot/api')):typeof define==='function'&&define.amd?define(['exports','ethers','@polkadot/api'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.EthereumUtils={},g.ethers,g.api));})(this,(function(exports,ethers,api){'use strict';/** @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$1 = xglobal.crypto;
|
|
3904
|
+
}const crypto$1 = xglobal.crypto;
|
|
4098
3905
|
function getRandomValues(arr) {
|
|
4099
3906
|
return crypto$1.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]}`;
|
|
@@ -10865,8 +10676,15 @@ function assert(condition, message) {
|
|
|
10865
10676
|
},
|
|
10866
10677
|
],
|
|
10867
10678
|
};
|
|
10868
|
-
// using
|
|
10869
|
-
const
|
|
10679
|
+
// using 2091 for mainnet
|
|
10680
|
+
const EIP712_DOMAIN_MAINNET = {
|
|
10681
|
+
name: 'Frequency',
|
|
10682
|
+
version: '1',
|
|
10683
|
+
chainId: '0x082B',
|
|
10684
|
+
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
10685
|
+
};
|
|
10686
|
+
// using pallet_revive test chain ID for testnet/dev
|
|
10687
|
+
const EIP712_DOMAIN_TESTNET = {
|
|
10870
10688
|
name: 'Frequency',
|
|
10871
10689
|
version: '1',
|
|
10872
10690
|
chainId: '0x190f1b44',
|
|
@@ -11024,22 +10842,21 @@ const SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION = {
|
|
|
11024
10842
|
type: 'string',
|
|
11025
10843
|
},
|
|
11026
10844
|
],
|
|
11027
|
-
};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,
|
|
10845
|
+
};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});/**
|
|
11028
10846
|
* Signing EIP-712 or ERC-191 compatible signature based on payload
|
|
11029
10847
|
* @param secretKey
|
|
11030
10848
|
* @param payload
|
|
11031
10849
|
* @param chain
|
|
11032
10850
|
*/
|
|
11033
|
-
async function sign(secretKey, payload, chain
|
|
10851
|
+
async function sign(secretKey, payload, chain) {
|
|
11034
10852
|
const signatureType = getSignatureType(payload.type);
|
|
11035
10853
|
const normalizedPayload = normalizePayload(payload);
|
|
11036
10854
|
const wallet = new ethers.ethers.Wallet(secretKey);
|
|
11037
10855
|
let signature;
|
|
11038
10856
|
switch (signatureType) {
|
|
11039
10857
|
case 'EIP-712':
|
|
11040
|
-
// TODO: use correct chainID for different networks
|
|
11041
10858
|
// TODO: use correct contract address for different payloads
|
|
11042
|
-
signature = await wallet.signTypedData(
|
|
10859
|
+
signature = await wallet.signTypedData(chain === 'Mainnet-Frequency' ? EIP712_DOMAIN_MAINNET : EIP712_DOMAIN_TESTNET, getTypesFor(payload.type), normalizedPayload);
|
|
11043
10860
|
break;
|
|
11044
10861
|
case 'EIP-191':
|
|
11045
10862
|
signature = await wallet.signMessage(payload.message);
|
|
@@ -11056,15 +10873,14 @@ async function sign(secretKey, payload, chain = 'Mainnet-Frequency') {
|
|
|
11056
10873
|
* @param payload
|
|
11057
10874
|
* @param chain
|
|
11058
10875
|
*/
|
|
11059
|
-
function verifySignature(ethereumAddress, signature, payload, chain
|
|
10876
|
+
function verifySignature(ethereumAddress, signature, payload, chain) {
|
|
11060
10877
|
const signatureType = getSignatureType(payload.type);
|
|
11061
10878
|
const normalizedPayload = normalizePayload(payload);
|
|
11062
10879
|
let recoveredAddress;
|
|
11063
10880
|
switch (signatureType) {
|
|
11064
10881
|
case 'EIP-712':
|
|
11065
|
-
// TODO: use correct chainID for different networks
|
|
11066
10882
|
// TODO: use correct contract address for different payloads
|
|
11067
|
-
recoveredAddress = ethers.ethers.verifyTypedData(
|
|
10883
|
+
recoveredAddress = ethers.ethers.verifyTypedData(chain === 'Mainnet-Frequency' ? EIP712_DOMAIN_MAINNET : EIP712_DOMAIN_TESTNET, getTypesFor(payload.type), normalizedPayload, signature);
|
|
11068
10884
|
break;
|
|
11069
10885
|
case 'EIP-191':
|
|
11070
10886
|
recoveredAddress = ethers.ethers.verifyMessage(payload.message, signature);
|
|
@@ -11337,7 +11153,7 @@ function createSiwfLoginRequestPayload(message) {
|
|
|
11337
11153
|
* @param expirationBlock Block number after which this payload is invalid
|
|
11338
11154
|
* @param domain
|
|
11339
11155
|
*/
|
|
11340
|
-
function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock, domain =
|
|
11156
|
+
function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
11341
11157
|
const message = createAddKeyData(msaId, newPublicKey, expirationBlock);
|
|
11342
11158
|
const normalized = normalizePayload(message);
|
|
11343
11159
|
return createEip712Payload(ADD_KEY_DATA_DEFINITION, message.type, domain, normalized);
|
|
@@ -11350,7 +11166,7 @@ function getEip712BrowserRequestAddKeyData(msaId, newPublicKey, expirationBlock,
|
|
|
11350
11166
|
* @param expirationBlock Block number after which this payload is invalid
|
|
11351
11167
|
* @param domain
|
|
11352
11168
|
*/
|
|
11353
|
-
function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock, domain =
|
|
11169
|
+
function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
11354
11170
|
const message = createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock);
|
|
11355
11171
|
const normalized = normalizePayload(message);
|
|
11356
11172
|
return createEip712Payload(AUTHORIZED_KEY_DATA_DEFINITION, message.type, domain, normalized);
|
|
@@ -11363,7 +11179,7 @@ function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, ex
|
|
|
11363
11179
|
* @param expirationBlock Block number after which this payload is invalid
|
|
11364
11180
|
* @param domain
|
|
11365
11181
|
*/
|
|
11366
|
-
function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain =
|
|
11182
|
+
function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
11367
11183
|
const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
|
|
11368
11184
|
const normalized = normalizePayload(message);
|
|
11369
11185
|
return createEip712Payload(ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
|
|
@@ -11378,7 +11194,7 @@ function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirati
|
|
|
11378
11194
|
* @param payload HexString or Uint8Array data to upsert
|
|
11379
11195
|
* @param domain
|
|
11380
11196
|
*/
|
|
11381
|
-
function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload, domain =
|
|
11197
|
+
function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload, domain = EIP712_DOMAIN_MAINNET) {
|
|
11382
11198
|
const message = createPaginatedUpsertSignaturePayloadV2(schemaId, pageId, targetHash, expiration, payload);
|
|
11383
11199
|
const normalized = normalizePayload(message);
|
|
11384
11200
|
return createEip712Payload(PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -11392,7 +11208,7 @@ function getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId, page
|
|
|
11392
11208
|
* @param expiration uint32 expiration block
|
|
11393
11209
|
* @param domain
|
|
11394
11210
|
*/
|
|
11395
|
-
function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration, domain =
|
|
11211
|
+
function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration, domain = EIP712_DOMAIN_MAINNET) {
|
|
11396
11212
|
const message = createPaginatedDeleteSignaturePayloadV2(schemaId, pageId, targetHash, expiration);
|
|
11397
11213
|
const normalized = normalizePayload(message);
|
|
11398
11214
|
return createEip712Payload(PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -11406,7 +11222,7 @@ function getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId, page
|
|
|
11406
11222
|
* @param actions Array of Add/Delete itemized actions
|
|
11407
11223
|
* @param domain
|
|
11408
11224
|
*/
|
|
11409
|
-
function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions, domain =
|
|
11225
|
+
function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions, domain = EIP712_DOMAIN_MAINNET) {
|
|
11410
11226
|
const message = createItemizedSignaturePayloadV2(schemaId, targetHash, expiration, actions);
|
|
11411
11227
|
const normalized = normalizePayload(message);
|
|
11412
11228
|
return createEip712Payload(ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2, message.type, domain, normalized);
|
|
@@ -11418,7 +11234,7 @@ function getEip712BrowserRequestItemizedSignaturePayloadV2(schemaId, targetHash,
|
|
|
11418
11234
|
* @param expirationBlock Block number after which this payload is invalid
|
|
11419
11235
|
* @param domain
|
|
11420
11236
|
*/
|
|
11421
|
-
function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, domain =
|
|
11237
|
+
function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
|
|
11422
11238
|
const message = createClaimHandlePayload(handle, expirationBlock);
|
|
11423
11239
|
const normalized = normalizePayload(message);
|
|
11424
11240
|
return createEip712Payload(CLAIM_HANDLE_PAYLOAD_DEFINITION, message.type, domain, normalized);
|
|
@@ -11429,7 +11245,7 @@ function getEip712BrowserRequestClaimHandlePayload(handle, expirationBlock, doma
|
|
|
11429
11245
|
* @param publicKey The passkey’s public key (hex string or raw bytes)
|
|
11430
11246
|
* @param domain
|
|
11431
11247
|
*/
|
|
11432
|
-
function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain =
|
|
11248
|
+
function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain = EIP712_DOMAIN_MAINNET) {
|
|
11433
11249
|
const message = createPasskeyPublicKey(publicKey);
|
|
11434
11250
|
const normalized = normalizePayload(message);
|
|
11435
11251
|
return createEip712Payload(PASSKEY_PUBLIC_KEY_DEFINITION, message.type, domain, normalized);
|
|
@@ -11442,7 +11258,7 @@ function getEip712BrowserRequestPasskeyPublicKey(publicKey, domain = EIP712_DOMA
|
|
|
11442
11258
|
* @param userIdentifierAdminUrl Only used for custom integration situations.
|
|
11443
11259
|
* @param domain
|
|
11444
11260
|
*/
|
|
11445
|
-
function getEip712BrowserRequestSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl, domain =
|
|
11261
|
+
function getEip712BrowserRequestSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl, domain = EIP712_DOMAIN_MAINNET) {
|
|
11446
11262
|
const message = createSiwfSignedRequestPayload(callback, permissions, userIdentifierAdminUrl);
|
|
11447
11263
|
const normalized = normalizePayload(message);
|
|
11448
11264
|
return createEip712Payload(SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION, message.type, domain, normalized);
|
|
@@ -11503,4 +11319,4 @@ function prefixEthereumTags(hexPayload) {
|
|
|
11503
11319
|
const wrapped = `\x19Ethereum Signed Message:\n${hexPayload.length}${hexPayload}`;
|
|
11504
11320
|
const buffer = Buffer.from(wrapped, 'utf-8');
|
|
11505
11321
|
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
|
|
11506
|
-
}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 };exports.ADD_KEY_DATA_DEFINITION=ADD_KEY_DATA_DEFINITION;exports.ADD_PROVIDER_DEFINITION=ADD_PROVIDER_DEFINITION;exports.AUTHORIZED_KEY_DATA_DEFINITION=AUTHORIZED_KEY_DATA_DEFINITION;exports.CLAIM_HANDLE_PAYLOAD_DEFINITION=CLAIM_HANDLE_PAYLOAD_DEFINITION;exports.
|
|
11322
|
+
}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 };exports.ADD_KEY_DATA_DEFINITION=ADD_KEY_DATA_DEFINITION;exports.ADD_PROVIDER_DEFINITION=ADD_PROVIDER_DEFINITION;exports.AUTHORIZED_KEY_DATA_DEFINITION=AUTHORIZED_KEY_DATA_DEFINITION;exports.CLAIM_HANDLE_PAYLOAD_DEFINITION=CLAIM_HANDLE_PAYLOAD_DEFINITION;exports.EIP712_DOMAIN_DEFINITION=EIP712_DOMAIN_DEFINITION;exports.EIP712_DOMAIN_MAINNET=EIP712_DOMAIN_MAINNET;exports.EIP712_DOMAIN_TESTNET=EIP712_DOMAIN_TESTNET;exports.ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2=ITEMIZED_SIGNATURE_PAYLOAD_DEFINITION_V2;exports.PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2=PAGINATED_DELETE_SIGNATURE_PAYLOAD_DEFINITION_V2;exports.PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2=PAGINATED_UPSERT_SIGNATURE_PAYLOAD_DEFINITION_V2;exports.PASSKEY_PUBLIC_KEY_DEFINITION=PASSKEY_PUBLIC_KEY_DEFINITION;exports.SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION=SIWF_SIGNED_REQUEST_PAYLOAD_DEFINITION;exports.createAddKeyData=createAddKeyData;exports.createAddProvider=createAddProvider;exports.createAuthorizedKeyData=createAuthorizedKeyData;exports.createClaimHandlePayload=createClaimHandlePayload;exports.createItemizedAddAction=createItemizedAddAction;exports.createItemizedDeleteAction=createItemizedDeleteAction;exports.createItemizedSignaturePayloadV2=createItemizedSignaturePayloadV2;exports.createPaginatedDeleteSignaturePayloadV2=createPaginatedDeleteSignaturePayloadV2;exports.createPaginatedUpsertSignaturePayloadV2=createPaginatedUpsertSignaturePayloadV2;exports.createPasskeyPublicKey=createPasskeyPublicKey;exports.createRandomKey=createRandomKey;exports.createSiwfLoginRequestPayload=createSiwfLoginRequestPayload;exports.createSiwfSignedRequestPayload=createSiwfSignedRequestPayload;exports.default=index;exports.ethereumAddressToKeyringPair=ethereumAddressToKeyringPair;exports.getAccountId20MultiAddress=getAccountId20MultiAddress;exports.getEip712BrowserRequestAddKeyData=getEip712BrowserRequestAddKeyData;exports.getEip712BrowserRequestAddProvider=getEip712BrowserRequestAddProvider;exports.getEip712BrowserRequestAuthorizedKeyData=getEip712BrowserRequestAuthorizedKeyData;exports.getEip712BrowserRequestClaimHandlePayload=getEip712BrowserRequestClaimHandlePayload;exports.getEip712BrowserRequestItemizedSignaturePayloadV2=getEip712BrowserRequestItemizedSignaturePayloadV2;exports.getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2=getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2;exports.getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2=getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2;exports.getEip712BrowserRequestPasskeyPublicKey=getEip712BrowserRequestPasskeyPublicKey;exports.getEip712BrowserRequestSiwfSignedRequestPayload=getEip712BrowserRequestSiwfSignedRequestPayload;exports.getEthereumMessageSigner=getEthereumMessageSigner;exports.getEthereumRegularSigner=getEthereumRegularSigner;exports.getKeyringPairFromSecp256k1PrivateKey=getKeyringPairFromSecp256k1PrivateKey;exports.getSS58AccountFromEthereumAccount=getSS58AccountFromEthereumAccount;exports.getUnifiedAddress=getUnifiedAddress;exports.getUnifiedPublicKey=getUnifiedPublicKey;exports.reverseUnifiedAddressToEthereumAddress=reverseUnifiedAddressToEthereumAddress;exports.sign=sign;exports.verifySignature=verifySignature;Object.defineProperty(exports,'__esModule',{value:true});}));
|