@solana/web3.js 1.94.0 → 1.95.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/lib/index.browser.cjs.js +21 -2
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +21 -2
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +21 -2
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +9 -1
- package/lib/index.esm.js +21 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +142 -151
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +7 -7
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +21 -2
- package/lib/index.native.js.map +1 -1
- package/package.json +5 -5
- package/src/connection.ts +42 -5
- package/src/validator-info.ts +3 -0
package/lib/index.iife.js
CHANGED
|
@@ -2842,9 +2842,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
2842
2842
|
// This is OK: `abstract` directory does not use noble-hashes.
|
|
2843
2843
|
// User may opt-in into using different hashing library. This way, noble-hashes
|
|
2844
2844
|
// won't be included into their bundle.
|
|
2845
|
-
const _0n$5 = BigInt(0);
|
|
2846
|
-
const _1n$7 = BigInt(1);
|
|
2847
|
-
const _2n$5 = BigInt(2);
|
|
2845
|
+
const _0n$5 = /* @__PURE__ */ BigInt(0);
|
|
2846
|
+
const _1n$7 = /* @__PURE__ */ BigInt(1);
|
|
2847
|
+
const _2n$5 = /* @__PURE__ */ BigInt(2);
|
|
2848
2848
|
function isBytes(a) {
|
|
2849
2849
|
return (a instanceof Uint8Array ||
|
|
2850
2850
|
(a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array'));
|
|
@@ -3156,7 +3156,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
3156
3156
|
// prettier-ignore
|
|
3157
3157
|
const _0n$4 = BigInt(0), _1n$6 = BigInt(1), _2n$4 = BigInt(2), _3n$1 = BigInt(3);
|
|
3158
3158
|
// prettier-ignore
|
|
3159
|
-
const _4n = BigInt(4), _5n$1 = BigInt(5), _8n$
|
|
3159
|
+
const _4n = BigInt(4), _5n$1 = BigInt(5), _8n$2 = BigInt(8);
|
|
3160
3160
|
// prettier-ignore
|
|
3161
3161
|
BigInt(9); BigInt(16);
|
|
3162
3162
|
// Calculates a modulo b
|
|
@@ -3302,8 +3302,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
3302
3302
|
};
|
|
3303
3303
|
}
|
|
3304
3304
|
// Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10)
|
|
3305
|
-
if (P % _8n$
|
|
3306
|
-
const c1 = (P - _5n$1) / _8n$
|
|
3305
|
+
if (P % _8n$2 === _5n$1) {
|
|
3306
|
+
const c1 = (P - _5n$1) / _8n$2;
|
|
3307
3307
|
return function sqrt5mod8(Fp, n) {
|
|
3308
3308
|
const n2 = Fp.mul(n, _2n$4);
|
|
3309
3309
|
const v = Fp.pow(n2, c1);
|
|
@@ -3456,12 +3456,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
3456
3456
|
});
|
|
3457
3457
|
return Object.freeze(f);
|
|
3458
3458
|
}
|
|
3459
|
-
function FpSqrtEven(Fp, elm) {
|
|
3460
|
-
if (!Fp.isOdd)
|
|
3461
|
-
throw new Error(`Field doesn't have isOdd`);
|
|
3462
|
-
const root = Fp.sqrt(elm);
|
|
3463
|
-
return Fp.isOdd(root) ? Fp.neg(root) : root;
|
|
3464
|
-
}
|
|
3465
3459
|
/**
|
|
3466
3460
|
* Returns total number of bytes consumed by the field element.
|
|
3467
3461
|
* For example, 32 bytes for usual 256-bit weierstrass curve.
|
|
@@ -3669,7 +3663,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
3669
3663
|
// Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y²
|
|
3670
3664
|
// Be friendly to bad ECMAScript parsers by not using bigint literals
|
|
3671
3665
|
// prettier-ignore
|
|
3672
|
-
const _0n$2 = BigInt(0), _1n$4 = BigInt(1), _2n$3 = BigInt(2), _8n = BigInt(8);
|
|
3666
|
+
const _0n$2 = BigInt(0), _1n$4 = BigInt(1), _2n$3 = BigInt(2), _8n$1 = BigInt(8);
|
|
3673
3667
|
// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex:
|
|
3674
3668
|
const VERIFY_DEFAULT = { zip215: true };
|
|
3675
3669
|
function validateOpts$1(curve) {
|
|
@@ -3918,7 +3912,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
3918
3912
|
const { ex: x, ey: y, ez: z } = this;
|
|
3919
3913
|
const is0 = this.is0();
|
|
3920
3914
|
if (iz == null)
|
|
3921
|
-
iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily
|
|
3915
|
+
iz = is0 ? _8n$1 : Fp.inv(z); // 8 was chosen arbitrarily
|
|
3922
3916
|
const ax = modP(x * iz);
|
|
3923
3917
|
const ay = modP(y * iz);
|
|
3924
3918
|
const zz = modP(z * iz);
|
|
@@ -4093,12 +4087,14 @@ var solanaWeb3 = (function (exports) {
|
|
|
4093
4087
|
*/
|
|
4094
4088
|
const ED25519_P = BigInt('57896044618658097711785492504343953926634992332820282019728792003956564819949');
|
|
4095
4089
|
// √(-1) aka √(a) aka 2^((p-1)/4)
|
|
4096
|
-
const ED25519_SQRT_M1 = BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');
|
|
4090
|
+
const ED25519_SQRT_M1 = /* @__PURE__ */ BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');
|
|
4097
4091
|
// prettier-ignore
|
|
4098
|
-
BigInt(0); const _1n$3 = BigInt(1), _2n$2 = BigInt(2)
|
|
4092
|
+
BigInt(0); const _1n$3 = BigInt(1), _2n$2 = BigInt(2); BigInt(3);
|
|
4099
4093
|
// prettier-ignore
|
|
4100
|
-
const
|
|
4094
|
+
const _5n = BigInt(5), _8n = BigInt(8);
|
|
4101
4095
|
function ed25519_pow_2_252_3(x) {
|
|
4096
|
+
// prettier-ignore
|
|
4097
|
+
const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);
|
|
4102
4098
|
const P = ED25519_P;
|
|
4103
4099
|
const x2 = (x * x) % P;
|
|
4104
4100
|
const b2 = (x2 * x) % P; // x^3, 11
|
|
@@ -4147,8 +4143,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
4147
4143
|
x = mod(-x, P);
|
|
4148
4144
|
return { isValid: useRoot1 || useRoot2, value: x };
|
|
4149
4145
|
}
|
|
4150
|
-
const Fp$1 = Field(ED25519_P, undefined, true);
|
|
4151
|
-
const ed25519Defaults = {
|
|
4146
|
+
const Fp$1 = /* @__PURE__ */ (() => Field(ED25519_P, undefined, true))();
|
|
4147
|
+
const ed25519Defaults = /* @__PURE__ */ (() => ({
|
|
4152
4148
|
// Param: a
|
|
4153
4149
|
a: BigInt(-1), // Fp.create(-1) is proper; our way still works and is faster
|
|
4154
4150
|
// d is equal to -121665/121666 over finite field.
|
|
@@ -4160,7 +4156,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
4160
4156
|
// 2n**252n + 27742317777372353535851937790883648493n;
|
|
4161
4157
|
n: BigInt('7237005577332262213973186563042994240857116359379907606001950938285454250989'),
|
|
4162
4158
|
// Cofactor
|
|
4163
|
-
h:
|
|
4159
|
+
h: _8n,
|
|
4164
4160
|
// Base point (x, y) aka generator point
|
|
4165
4161
|
Gx: BigInt('15112221349535400772501151409588531511454012693041857206046113283949847762202'),
|
|
4166
4162
|
Gy: BigInt('46316835694926478169428394003475163141307993866256225615783033603165251855960'),
|
|
@@ -4171,40 +4167,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
4171
4167
|
// Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.
|
|
4172
4168
|
// Constant-time, u/√v
|
|
4173
4169
|
uvRatio,
|
|
4174
|
-
};
|
|
4175
|
-
const ed25519 = /* @__PURE__ */ twistedEdwards(ed25519Defaults);
|
|
4176
|
-
function ed25519_domain(data, ctx, phflag) {
|
|
4177
|
-
if (ctx.length > 255)
|
|
4178
|
-
throw new Error('Context is too big');
|
|
4179
|
-
return concatBytes$1(utf8ToBytes$1('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);
|
|
4180
|
-
}
|
|
4181
|
-
/* @__PURE__ */ twistedEdwards({
|
|
4182
|
-
...ed25519Defaults,
|
|
4183
|
-
domain: ed25519_domain,
|
|
4184
|
-
});
|
|
4185
|
-
/* @__PURE__ */ twistedEdwards({
|
|
4186
|
-
...ed25519Defaults,
|
|
4187
|
-
domain: ed25519_domain,
|
|
4188
|
-
prehash: sha512,
|
|
4189
|
-
});
|
|
4190
|
-
// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)
|
|
4191
|
-
// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since
|
|
4192
|
-
// SageMath returns different root first and everything falls apart
|
|
4193
|
-
const ELL2_C1 = (Fp$1.ORDER + BigInt(3)) / BigInt(8); // 1. c1 = (q + 3) / 8 # Integer arithmetic
|
|
4194
|
-
Fp$1.pow(_2n$2, ELL2_C1); // 2. c2 = 2^c1
|
|
4195
|
-
Fp$1.sqrt(Fp$1.neg(Fp$1.ONE)); // 3. c3 = sqrt(-1)
|
|
4196
|
-
(Fp$1.ORDER - BigInt(5)) / BigInt(8); // 4. c4 = (q - 5) / 8 # Integer arithmetic
|
|
4197
|
-
BigInt(486662);
|
|
4198
|
-
FpSqrtEven(Fp$1, Fp$1.neg(BigInt(486664))); // sgn0(c1) MUST equal 0
|
|
4199
|
-
// √(ad - 1)
|
|
4200
|
-
BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');
|
|
4201
|
-
// 1 / √(a-d)
|
|
4202
|
-
BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');
|
|
4203
|
-
// 1-d²
|
|
4204
|
-
BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');
|
|
4205
|
-
// (d-1)²
|
|
4206
|
-
BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');
|
|
4207
|
-
BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
|
|
4170
|
+
}))();
|
|
4171
|
+
const ed25519 = /* @__PURE__ */ (() => twistedEdwards(ed25519Defaults))();
|
|
4208
4172
|
|
|
4209
4173
|
/**
|
|
4210
4174
|
* A 64 byte secret key, the first 32 bytes of which is the
|
|
@@ -14776,6 +14740,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
14776
14740
|
function isObject(x) {
|
|
14777
14741
|
return typeof x === 'object' && x != null;
|
|
14778
14742
|
}
|
|
14743
|
+
/**
|
|
14744
|
+
* Check if a value is a non-array object.
|
|
14745
|
+
*/
|
|
14746
|
+
function isNonArrayObject(x) {
|
|
14747
|
+
return isObject(x) && !Array.isArray(x);
|
|
14748
|
+
}
|
|
14779
14749
|
/**
|
|
14780
14750
|
* Return a value as a printable string.
|
|
14781
14751
|
*/
|
|
@@ -14840,20 +14810,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
14840
14810
|
*/
|
|
14841
14811
|
function* run(value, struct, options = {}) {
|
|
14842
14812
|
const { path = [], branch = [value], coerce = false, mask = false } = options;
|
|
14843
|
-
const ctx = { path, branch };
|
|
14813
|
+
const ctx = { path, branch, mask };
|
|
14844
14814
|
if (coerce) {
|
|
14845
14815
|
value = struct.coercer(value, ctx);
|
|
14846
|
-
if (mask &&
|
|
14847
|
-
struct.type !== 'type' &&
|
|
14848
|
-
isObject(struct.schema) &&
|
|
14849
|
-
isObject(value) &&
|
|
14850
|
-
!Array.isArray(value)) {
|
|
14851
|
-
for (const key in value) {
|
|
14852
|
-
if (struct.schema[key] === undefined) {
|
|
14853
|
-
delete value[key];
|
|
14854
|
-
}
|
|
14855
|
-
}
|
|
14856
|
-
}
|
|
14857
14816
|
}
|
|
14858
14817
|
let status = 'valid';
|
|
14859
14818
|
for (const failure of struct.validator(value, ctx)) {
|
|
@@ -14955,7 +14914,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
14955
14914
|
}
|
|
14956
14915
|
/**
|
|
14957
14916
|
* Mask a value, coercing and validating it, but returning only the subset of
|
|
14958
|
-
* properties defined by the struct's schema.
|
|
14917
|
+
* properties defined by the struct's schema. Masking applies recursively to
|
|
14918
|
+
* props of `object` structs only.
|
|
14959
14919
|
*/
|
|
14960
14920
|
mask(value, message) {
|
|
14961
14921
|
return mask(value, this, message);
|
|
@@ -14964,9 +14924,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14964
14924
|
* Validate a value with the struct's validation logic, returning a tuple
|
|
14965
14925
|
* representing the result.
|
|
14966
14926
|
*
|
|
14967
|
-
* You may optionally pass `true` for the `
|
|
14927
|
+
* You may optionally pass `true` for the `coerce` argument to coerce
|
|
14968
14928
|
* the value before attempting to validate it. If you do, the result will
|
|
14969
|
-
* contain the coerced result when successful.
|
|
14929
|
+
* contain the coerced result when successful. Also, `mask` will turn on
|
|
14930
|
+
* masking of the unknown `object` props recursively if passed.
|
|
14970
14931
|
*/
|
|
14971
14932
|
validate(value, options = {}) {
|
|
14972
14933
|
return validate$1(value, this, options);
|
|
@@ -15151,7 +15112,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
15151
15112
|
}
|
|
15152
15113
|
},
|
|
15153
15114
|
validator(value) {
|
|
15154
|
-
return (
|
|
15115
|
+
return (isNonArrayObject(value) ||
|
|
15116
|
+
`Expected an object, but received: ${print(value)}`);
|
|
15117
|
+
},
|
|
15118
|
+
coercer(value) {
|
|
15119
|
+
return isNonArrayObject(value) ? { ...value } : value;
|
|
15155
15120
|
},
|
|
15156
15121
|
});
|
|
15157
15122
|
}
|
|
@@ -15185,6 +15150,9 @@ var solanaWeb3 = (function (exports) {
|
|
|
15185
15150
|
return (Array.isArray(value) ||
|
|
15186
15151
|
`Expected an array, but received: ${print(value)}`);
|
|
15187
15152
|
},
|
|
15153
|
+
coercer(value) {
|
|
15154
|
+
return Array.isArray(value) ? value.slice() : value;
|
|
15155
|
+
},
|
|
15188
15156
|
});
|
|
15189
15157
|
}
|
|
15190
15158
|
/**
|
|
@@ -15206,10 +15174,11 @@ var solanaWeb3 = (function (exports) {
|
|
|
15206
15174
|
}
|
|
15207
15175
|
},
|
|
15208
15176
|
validator(value) {
|
|
15209
|
-
return (
|
|
15177
|
+
return (isNonArrayObject(value) ||
|
|
15178
|
+
`Expected an object, but received: ${print(value)}`);
|
|
15210
15179
|
},
|
|
15211
15180
|
coercer(value) {
|
|
15212
|
-
return
|
|
15181
|
+
return isNonArrayObject(value) ? { ...value } : value;
|
|
15213
15182
|
},
|
|
15214
15183
|
});
|
|
15215
15184
|
}
|
|
@@ -15221,9 +15190,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
15221
15190
|
return new Struct({
|
|
15222
15191
|
type: 'union',
|
|
15223
15192
|
schema: null,
|
|
15224
|
-
coercer(value) {
|
|
15193
|
+
coercer(value, ctx) {
|
|
15225
15194
|
for (const S of Structs) {
|
|
15226
|
-
const [error, coerced] = S.validate(value, {
|
|
15195
|
+
const [error, coerced] = S.validate(value, {
|
|
15196
|
+
coerce: true,
|
|
15197
|
+
mask: ctx.mask,
|
|
15198
|
+
});
|
|
15227
15199
|
if (!error) {
|
|
15228
15200
|
return coerced;
|
|
15229
15201
|
}
|
|
@@ -17140,6 +17112,19 @@ var solanaWeb3 = (function (exports) {
|
|
|
17140
17112
|
};
|
|
17141
17113
|
}
|
|
17142
17114
|
|
|
17115
|
+
/**
|
|
17116
|
+
* @internal
|
|
17117
|
+
*/
|
|
17118
|
+
function applyDefaultMemcmpEncodingToFilters(filters) {
|
|
17119
|
+
return filters.map(filter => 'memcmp' in filter ? {
|
|
17120
|
+
...filter,
|
|
17121
|
+
memcmp: {
|
|
17122
|
+
...filter.memcmp,
|
|
17123
|
+
encoding: filter.memcmp.encoding ?? 'base58'
|
|
17124
|
+
}
|
|
17125
|
+
} : filter);
|
|
17126
|
+
}
|
|
17127
|
+
|
|
17143
17128
|
/**
|
|
17144
17129
|
* @internal
|
|
17145
17130
|
*/
|
|
@@ -19047,7 +19032,12 @@ var solanaWeb3 = (function (exports) {
|
|
|
19047
19032
|
encoding,
|
|
19048
19033
|
...configWithoutEncoding
|
|
19049
19034
|
} = config || {};
|
|
19050
|
-
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64',
|
|
19035
|
+
const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', {
|
|
19036
|
+
...configWithoutEncoding,
|
|
19037
|
+
...(configWithoutEncoding.filters ? {
|
|
19038
|
+
filters: applyDefaultMemcmpEncodingToFilters(configWithoutEncoding.filters)
|
|
19039
|
+
} : null)
|
|
19040
|
+
});
|
|
19051
19041
|
const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
|
|
19052
19042
|
const baseSchema = array(KeyedAccountInfoResult);
|
|
19053
19043
|
const res = configWithoutEncoding.withContext === true ? create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : create(unsafeRes, jsonRpcResult(baseSchema));
|
|
@@ -21196,7 +21186,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
21196
21186
|
const args = this._buildArgs([programId.toBase58()], commitment || this._commitment || 'finalized',
|
|
21197
21187
|
// Apply connection/server default.
|
|
21198
21188
|
'base64' /* encoding */, config ? config : maybeFilters ? {
|
|
21199
|
-
filters: maybeFilters
|
|
21189
|
+
filters: applyDefaultMemcmpEncodingToFilters(maybeFilters)
|
|
21200
21190
|
} : undefined /* extra */);
|
|
21201
21191
|
return this._makeSubscription({
|
|
21202
21192
|
callback,
|
|
@@ -22332,6 +22322,81 @@ var solanaWeb3 = (function (exports) {
|
|
|
22332
22322
|
*/
|
|
22333
22323
|
const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
|
|
22334
22324
|
|
|
22325
|
+
// HMAC (RFC 2104)
|
|
22326
|
+
class HMAC extends Hash {
|
|
22327
|
+
constructor(hash$1, _key) {
|
|
22328
|
+
super();
|
|
22329
|
+
this.finished = false;
|
|
22330
|
+
this.destroyed = false;
|
|
22331
|
+
hash(hash$1);
|
|
22332
|
+
const key = toBytes(_key);
|
|
22333
|
+
this.iHash = hash$1.create();
|
|
22334
|
+
if (typeof this.iHash.update !== 'function')
|
|
22335
|
+
throw new Error('Expected instance of class which extends utils.Hash');
|
|
22336
|
+
this.blockLen = this.iHash.blockLen;
|
|
22337
|
+
this.outputLen = this.iHash.outputLen;
|
|
22338
|
+
const blockLen = this.blockLen;
|
|
22339
|
+
const pad = new Uint8Array(blockLen);
|
|
22340
|
+
// blockLen can be bigger than outputLen
|
|
22341
|
+
pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
|
|
22342
|
+
for (let i = 0; i < pad.length; i++)
|
|
22343
|
+
pad[i] ^= 0x36;
|
|
22344
|
+
this.iHash.update(pad);
|
|
22345
|
+
// By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
|
|
22346
|
+
this.oHash = hash$1.create();
|
|
22347
|
+
// Undo internal XOR && apply outer XOR
|
|
22348
|
+
for (let i = 0; i < pad.length; i++)
|
|
22349
|
+
pad[i] ^= 0x36 ^ 0x5c;
|
|
22350
|
+
this.oHash.update(pad);
|
|
22351
|
+
pad.fill(0);
|
|
22352
|
+
}
|
|
22353
|
+
update(buf) {
|
|
22354
|
+
exists(this);
|
|
22355
|
+
this.iHash.update(buf);
|
|
22356
|
+
return this;
|
|
22357
|
+
}
|
|
22358
|
+
digestInto(out) {
|
|
22359
|
+
exists(this);
|
|
22360
|
+
bytes(out, this.outputLen);
|
|
22361
|
+
this.finished = true;
|
|
22362
|
+
this.iHash.digestInto(out);
|
|
22363
|
+
this.oHash.update(out);
|
|
22364
|
+
this.oHash.digestInto(out);
|
|
22365
|
+
this.destroy();
|
|
22366
|
+
}
|
|
22367
|
+
digest() {
|
|
22368
|
+
const out = new Uint8Array(this.oHash.outputLen);
|
|
22369
|
+
this.digestInto(out);
|
|
22370
|
+
return out;
|
|
22371
|
+
}
|
|
22372
|
+
_cloneInto(to) {
|
|
22373
|
+
// Create new instance without calling constructor since key already in state and we don't know it.
|
|
22374
|
+
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
22375
|
+
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
22376
|
+
to = to;
|
|
22377
|
+
to.finished = finished;
|
|
22378
|
+
to.destroyed = destroyed;
|
|
22379
|
+
to.blockLen = blockLen;
|
|
22380
|
+
to.outputLen = outputLen;
|
|
22381
|
+
to.oHash = oHash._cloneInto(to.oHash);
|
|
22382
|
+
to.iHash = iHash._cloneInto(to.iHash);
|
|
22383
|
+
return to;
|
|
22384
|
+
}
|
|
22385
|
+
destroy() {
|
|
22386
|
+
this.destroyed = true;
|
|
22387
|
+
this.oHash.destroy();
|
|
22388
|
+
this.iHash.destroy();
|
|
22389
|
+
}
|
|
22390
|
+
}
|
|
22391
|
+
/**
|
|
22392
|
+
* HMAC: RFC2104 message authentication code.
|
|
22393
|
+
* @param hash - function that would be used e.g. sha256
|
|
22394
|
+
* @param key - message key
|
|
22395
|
+
* @param message - message data
|
|
22396
|
+
*/
|
|
22397
|
+
const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
|
22398
|
+
hmac.create = (hash, key) => new HMAC(hash, key);
|
|
22399
|
+
|
|
22335
22400
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
22336
22401
|
// Short Weierstrass curve. The formula is: y² = x³ + ax + b
|
|
22337
22402
|
function validatePointOpts(curve) {
|
|
@@ -23268,81 +23333,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
23268
23333
|
};
|
|
23269
23334
|
}
|
|
23270
23335
|
|
|
23271
|
-
// HMAC (RFC 2104)
|
|
23272
|
-
class HMAC extends Hash {
|
|
23273
|
-
constructor(hash$1, _key) {
|
|
23274
|
-
super();
|
|
23275
|
-
this.finished = false;
|
|
23276
|
-
this.destroyed = false;
|
|
23277
|
-
hash(hash$1);
|
|
23278
|
-
const key = toBytes(_key);
|
|
23279
|
-
this.iHash = hash$1.create();
|
|
23280
|
-
if (typeof this.iHash.update !== 'function')
|
|
23281
|
-
throw new Error('Expected instance of class which extends utils.Hash');
|
|
23282
|
-
this.blockLen = this.iHash.blockLen;
|
|
23283
|
-
this.outputLen = this.iHash.outputLen;
|
|
23284
|
-
const blockLen = this.blockLen;
|
|
23285
|
-
const pad = new Uint8Array(blockLen);
|
|
23286
|
-
// blockLen can be bigger than outputLen
|
|
23287
|
-
pad.set(key.length > blockLen ? hash$1.create().update(key).digest() : key);
|
|
23288
|
-
for (let i = 0; i < pad.length; i++)
|
|
23289
|
-
pad[i] ^= 0x36;
|
|
23290
|
-
this.iHash.update(pad);
|
|
23291
|
-
// By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone
|
|
23292
|
-
this.oHash = hash$1.create();
|
|
23293
|
-
// Undo internal XOR && apply outer XOR
|
|
23294
|
-
for (let i = 0; i < pad.length; i++)
|
|
23295
|
-
pad[i] ^= 0x36 ^ 0x5c;
|
|
23296
|
-
this.oHash.update(pad);
|
|
23297
|
-
pad.fill(0);
|
|
23298
|
-
}
|
|
23299
|
-
update(buf) {
|
|
23300
|
-
exists(this);
|
|
23301
|
-
this.iHash.update(buf);
|
|
23302
|
-
return this;
|
|
23303
|
-
}
|
|
23304
|
-
digestInto(out) {
|
|
23305
|
-
exists(this);
|
|
23306
|
-
bytes(out, this.outputLen);
|
|
23307
|
-
this.finished = true;
|
|
23308
|
-
this.iHash.digestInto(out);
|
|
23309
|
-
this.oHash.update(out);
|
|
23310
|
-
this.oHash.digestInto(out);
|
|
23311
|
-
this.destroy();
|
|
23312
|
-
}
|
|
23313
|
-
digest() {
|
|
23314
|
-
const out = new Uint8Array(this.oHash.outputLen);
|
|
23315
|
-
this.digestInto(out);
|
|
23316
|
-
return out;
|
|
23317
|
-
}
|
|
23318
|
-
_cloneInto(to) {
|
|
23319
|
-
// Create new instance without calling constructor since key already in state and we don't know it.
|
|
23320
|
-
to || (to = Object.create(Object.getPrototypeOf(this), {}));
|
|
23321
|
-
const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
|
|
23322
|
-
to = to;
|
|
23323
|
-
to.finished = finished;
|
|
23324
|
-
to.destroyed = destroyed;
|
|
23325
|
-
to.blockLen = blockLen;
|
|
23326
|
-
to.outputLen = outputLen;
|
|
23327
|
-
to.oHash = oHash._cloneInto(to.oHash);
|
|
23328
|
-
to.iHash = iHash._cloneInto(to.iHash);
|
|
23329
|
-
return to;
|
|
23330
|
-
}
|
|
23331
|
-
destroy() {
|
|
23332
|
-
this.destroyed = true;
|
|
23333
|
-
this.oHash.destroy();
|
|
23334
|
-
this.iHash.destroy();
|
|
23335
|
-
}
|
|
23336
|
-
}
|
|
23337
|
-
/**
|
|
23338
|
-
* HMAC: RFC2104 message authentication code.
|
|
23339
|
-
* @param hash - function that would be used e.g. sha256
|
|
23340
|
-
* @param key - message key
|
|
23341
|
-
* @param message - message data
|
|
23342
|
-
*/
|
|
23343
|
-
const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();
|
|
23344
|
-
hmac.create = (hash, key) => new HMAC(hash, key);
|
|
23345
|
-
|
|
23346
23336
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
23347
23337
|
// connects noble-curves to noble-hashes
|
|
23348
23338
|
function getHash(hash) {
|
|
@@ -24851,6 +24841,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
24851
24841
|
name: string(),
|
|
24852
24842
|
website: optional(string()),
|
|
24853
24843
|
details: optional(string()),
|
|
24844
|
+
iconUrl: optional(string()),
|
|
24854
24845
|
keybaseUsername: optional(string())
|
|
24855
24846
|
});
|
|
24856
24847
|
|