@pooflabs/web 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/providers/transaction-utils.d.ts +10 -0
- package/dist/{index-Bt89WhpV.esm.js → index-7_nqSSXr.esm.js} +124 -43
- package/dist/index-7_nqSSXr.esm.js.map +1 -0
- package/dist/{index-BU0jcnYK.esm.js → index-B4o54izZ.esm.js} +185 -21
- package/dist/index-B4o54izZ.esm.js.map +1 -0
- package/dist/{index-D15hrtDJ.js → index-BCpgjKea.js} +124 -43
- package/dist/index-BCpgjKea.js.map +1 -0
- package/dist/{index-DzGrm7WK.js → index-C2cjjAWD.js} +185 -21
- package/dist/index-C2cjjAWD.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/index-BU0jcnYK.esm.js.map +0 -1
- package/dist/index-Bt89WhpV.esm.js.map +0 -1
- package/dist/index-D15hrtDJ.js.map +0 -1
- package/dist/index-DzGrm7WK.js.map +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var globalAxios = require('axios');
|
|
5
|
-
var index = require('./index-
|
|
5
|
+
var index = require('./index-BCpgjKea.js');
|
|
6
6
|
var web3_js = require('@solana/web3.js');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
require('@coral-xyz/anchor');
|
|
@@ -3167,7 +3167,7 @@ function stringToBase64url(str) {
|
|
|
3167
3167
|
/**
|
|
3168
3168
|
* The current version of Ethers.
|
|
3169
3169
|
*/
|
|
3170
|
-
const version = "6.
|
|
3170
|
+
const version = "6.16.0";
|
|
3171
3171
|
|
|
3172
3172
|
/**
|
|
3173
3173
|
* Property helper functions.
|
|
@@ -3374,7 +3374,8 @@ function _getBytes(value, name, copy) {
|
|
|
3374
3374
|
}
|
|
3375
3375
|
return value;
|
|
3376
3376
|
}
|
|
3377
|
-
if (typeof (value) === "string" && value.
|
|
3377
|
+
if (typeof (value) === "string" && (value.length % 2) === 0 &&
|
|
3378
|
+
value.match(/^0x[0-9a-f]*$/i)) {
|
|
3378
3379
|
const result = new Uint8Array((value.length - 2) / 2);
|
|
3379
3380
|
let offset = 2;
|
|
3380
3381
|
for (let i = 0; i < result.length; i++) {
|
|
@@ -3571,6 +3572,10 @@ function toBeHex(_value, _width) {
|
|
|
3571
3572
|
let result = value.toString(16);
|
|
3572
3573
|
{
|
|
3573
3574
|
const width = getNumber(_width, "width");
|
|
3575
|
+
// Special case when both value and width are 0 (see: #5025)
|
|
3576
|
+
if (width === 0 && value === BN_0$3) {
|
|
3577
|
+
return "0x";
|
|
3578
|
+
}
|
|
3574
3579
|
assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", {
|
|
3575
3580
|
operation: "toBeHex",
|
|
3576
3581
|
fault: "overflow",
|
|
@@ -3586,10 +3591,11 @@ function toBeHex(_value, _width) {
|
|
|
3586
3591
|
/**
|
|
3587
3592
|
* Converts %%value%% to a Big Endian Uint8Array.
|
|
3588
3593
|
*/
|
|
3589
|
-
function toBeArray(_value) {
|
|
3594
|
+
function toBeArray(_value, _width) {
|
|
3590
3595
|
const value = getUint(_value, "value");
|
|
3591
3596
|
if (value === BN_0$3) {
|
|
3592
|
-
|
|
3597
|
+
const width = 0;
|
|
3598
|
+
return new Uint8Array(width);
|
|
3593
3599
|
}
|
|
3594
3600
|
let hex = value.toString(16);
|
|
3595
3601
|
if (hex.length % 2) {
|
|
@@ -6485,6 +6491,9 @@ const BN_2$1 = BigInt(2);
|
|
|
6485
6491
|
const BN_27$1 = BigInt(27);
|
|
6486
6492
|
const BN_28$1 = BigInt(28);
|
|
6487
6493
|
const BN_35$1 = BigInt(35);
|
|
6494
|
+
const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
|
6495
|
+
const BN_N_2 = BN_N / BN_2$1; // Must be integer (floor) division; do NOT shifts
|
|
6496
|
+
const inspect$1 = Symbol.for("nodejs.util.inspect.custom");
|
|
6488
6497
|
const _guard = {};
|
|
6489
6498
|
function toUint256(value) {
|
|
6490
6499
|
return zeroPadValue(toBeArray(value), 32);
|
|
@@ -6535,7 +6544,8 @@ class Signature {
|
|
|
6535
6544
|
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
|
|
6536
6545
|
*/
|
|
6537
6546
|
isValid() {
|
|
6538
|
-
|
|
6547
|
+
const s = BigInt(this.#s);
|
|
6548
|
+
return (s <= BN_N_2);
|
|
6539
6549
|
}
|
|
6540
6550
|
/**
|
|
6541
6551
|
* The ``v`` value for a signature.
|
|
@@ -6611,8 +6621,26 @@ class Signature {
|
|
|
6611
6621
|
this.#v = v;
|
|
6612
6622
|
this.#networkV = null;
|
|
6613
6623
|
}
|
|
6614
|
-
|
|
6615
|
-
|
|
6624
|
+
/**
|
|
6625
|
+
* Returns the canonical signature.
|
|
6626
|
+
*
|
|
6627
|
+
* This is only necessary when dealing with legacy transaction which
|
|
6628
|
+
* did not enforce canonical S values (i.e. [[link-eip-2]]. Most
|
|
6629
|
+
* developers should never require this.
|
|
6630
|
+
*/
|
|
6631
|
+
getCanonical() {
|
|
6632
|
+
if (this.isValid()) {
|
|
6633
|
+
return this;
|
|
6634
|
+
}
|
|
6635
|
+
// Compute the canonical signature; s' = N - s, v = !v
|
|
6636
|
+
const s = BN_N - BigInt(this._s);
|
|
6637
|
+
const v = (55 - this.v);
|
|
6638
|
+
const result = new Signature(_guard, this.r, toUint256(s), v);
|
|
6639
|
+
// Populate the networkV if necessary
|
|
6640
|
+
if (this.networkV) {
|
|
6641
|
+
result.#networkV = this.networkV;
|
|
6642
|
+
}
|
|
6643
|
+
return result;
|
|
6616
6644
|
}
|
|
6617
6645
|
/**
|
|
6618
6646
|
* Returns a new identical [[Signature]].
|
|
@@ -6635,6 +6663,15 @@ class Signature {
|
|
|
6635
6663
|
r: this.r, s: this._s, v: this.v,
|
|
6636
6664
|
};
|
|
6637
6665
|
}
|
|
6666
|
+
[inspect$1]() {
|
|
6667
|
+
return this.toString();
|
|
6668
|
+
}
|
|
6669
|
+
toString() {
|
|
6670
|
+
if (this.isValid()) {
|
|
6671
|
+
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`;
|
|
6672
|
+
}
|
|
6673
|
+
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`;
|
|
6674
|
+
}
|
|
6638
6675
|
/**
|
|
6639
6676
|
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
|
6640
6677
|
*
|
|
@@ -7152,7 +7189,9 @@ const BN_27 = BigInt(27);
|
|
|
7152
7189
|
const BN_28 = BigInt(28);
|
|
7153
7190
|
const BN_35 = BigInt(35);
|
|
7154
7191
|
const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
|
7192
|
+
const inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
7155
7193
|
const BLOB_SIZE = 4096 * 32;
|
|
7194
|
+
const CELL_COUNT = 128;
|
|
7156
7195
|
function getKzgLibrary(kzg) {
|
|
7157
7196
|
const blobToKzgCommitment = (blob) => {
|
|
7158
7197
|
if ("computeBlobProof" in kzg) {
|
|
@@ -7276,7 +7315,7 @@ function formatAuthorizationList(value) {
|
|
|
7276
7315
|
formatNumber(a.nonce, "nonce"),
|
|
7277
7316
|
formatNumber(a.signature.yParity, "yParity"),
|
|
7278
7317
|
toBeArray(a.signature.r),
|
|
7279
|
-
toBeArray(a.signature.
|
|
7318
|
+
toBeArray(a.signature._s)
|
|
7280
7319
|
];
|
|
7281
7320
|
});
|
|
7282
7321
|
}
|
|
@@ -7377,7 +7416,7 @@ function _serializeLegacy(tx, sig) {
|
|
|
7377
7416
|
// Add the signature
|
|
7378
7417
|
fields.push(toBeArray(v));
|
|
7379
7418
|
fields.push(toBeArray(sig.r));
|
|
7380
|
-
fields.push(toBeArray(sig.
|
|
7419
|
+
fields.push(toBeArray(sig._s));
|
|
7381
7420
|
return encodeRlp(fields);
|
|
7382
7421
|
}
|
|
7383
7422
|
function _parseEipSignature(tx, fields) {
|
|
@@ -7482,9 +7521,11 @@ function _serializeEip2930(tx, sig) {
|
|
|
7482
7521
|
function _parseEip4844(data) {
|
|
7483
7522
|
let fields = decodeRlp(getBytes(data).slice(1));
|
|
7484
7523
|
let typeName = "3";
|
|
7524
|
+
let blobWrapperVersion = null;
|
|
7485
7525
|
let blobs = null;
|
|
7486
7526
|
// Parse the network format
|
|
7487
7527
|
if (fields.length === 4 && Array.isArray(fields[0])) {
|
|
7528
|
+
// EIP-4844 format with sidecar
|
|
7488
7529
|
typeName = "3 (network format)";
|
|
7489
7530
|
const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3];
|
|
7490
7531
|
assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs);
|
|
@@ -7502,6 +7543,31 @@ function _parseEip4844(data) {
|
|
|
7502
7543
|
}
|
|
7503
7544
|
fields = fields[0];
|
|
7504
7545
|
}
|
|
7546
|
+
else if (fields.length === 5 && Array.isArray(fields[0])) {
|
|
7547
|
+
// EIP-7594 format with sidecar
|
|
7548
|
+
typeName = "3 (EIP-7594 network format)";
|
|
7549
|
+
blobWrapperVersion = getNumber(fields[1]);
|
|
7550
|
+
const fBlobs = fields[2], fCommits = fields[3], fProofs = fields[4];
|
|
7551
|
+
assertArgument(blobWrapperVersion === 1, `unsupported EIP-7594 network format version: ${blobWrapperVersion}`, "fields[1]", blobWrapperVersion);
|
|
7552
|
+
assertArgument(Array.isArray(fBlobs), "invalid EIP-7594 network format: blobs not an array", "fields[2]", fBlobs);
|
|
7553
|
+
assertArgument(Array.isArray(fCommits), "invalid EIP-7594 network format: commitments not an array", "fields[3]", fCommits);
|
|
7554
|
+
assertArgument(Array.isArray(fProofs), "invalid EIP-7594 network format: proofs not an array", "fields[4]", fProofs);
|
|
7555
|
+
assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields);
|
|
7556
|
+
assertArgument(fBlobs.length * CELL_COUNT === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields);
|
|
7557
|
+
blobs = [];
|
|
7558
|
+
for (let i = 0; i < fBlobs.length; i++) {
|
|
7559
|
+
const proof = [];
|
|
7560
|
+
for (let j = 0; j < CELL_COUNT; j++) {
|
|
7561
|
+
proof.push(fProofs[(i * CELL_COUNT) + j]);
|
|
7562
|
+
}
|
|
7563
|
+
blobs.push({
|
|
7564
|
+
data: fBlobs[i],
|
|
7565
|
+
commitment: fCommits[i],
|
|
7566
|
+
proof: concat(proof)
|
|
7567
|
+
});
|
|
7568
|
+
}
|
|
7569
|
+
fields = fields[0];
|
|
7570
|
+
}
|
|
7505
7571
|
assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data));
|
|
7506
7572
|
const tx = {
|
|
7507
7573
|
type: 3,
|
|
@@ -7516,7 +7582,8 @@ function _parseEip4844(data) {
|
|
|
7516
7582
|
data: hexlify(fields[7]),
|
|
7517
7583
|
accessList: handleAccessList(fields[8], "accessList"),
|
|
7518
7584
|
maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"),
|
|
7519
|
-
blobVersionedHashes: fields[10]
|
|
7585
|
+
blobVersionedHashes: fields[10],
|
|
7586
|
+
blobWrapperVersion
|
|
7520
7587
|
};
|
|
7521
7588
|
if (blobs) {
|
|
7522
7589
|
tx.blobs = blobs;
|
|
@@ -7556,6 +7623,29 @@ function _serializeEip4844(tx, sig, blobs) {
|
|
|
7556
7623
|
fields.push(toBeArray(sig.s));
|
|
7557
7624
|
// We have blobs; return the network wrapped format
|
|
7558
7625
|
if (blobs) {
|
|
7626
|
+
// Use EIP-7594
|
|
7627
|
+
if (tx.blobWrapperVersion != null) {
|
|
7628
|
+
const wrapperVersion = toBeArray(tx.blobWrapperVersion);
|
|
7629
|
+
const cellProofs = [];
|
|
7630
|
+
for (const { proof } of blobs) {
|
|
7631
|
+
const p = getBytes(proof);
|
|
7632
|
+
const cellSize = p.length / CELL_COUNT;
|
|
7633
|
+
for (let i = 0; i < p.length; i += cellSize) {
|
|
7634
|
+
cellProofs.push(p.subarray(i, i + cellSize));
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
return concat([
|
|
7638
|
+
"0x03",
|
|
7639
|
+
encodeRlp([
|
|
7640
|
+
fields,
|
|
7641
|
+
wrapperVersion,
|
|
7642
|
+
blobs.map((b) => b.data),
|
|
7643
|
+
blobs.map((b) => b.commitment),
|
|
7644
|
+
cellProofs
|
|
7645
|
+
])
|
|
7646
|
+
]);
|
|
7647
|
+
}
|
|
7648
|
+
// Fall back onto classic EIP-4844 behavior
|
|
7559
7649
|
return concat([
|
|
7560
7650
|
"0x03",
|
|
7561
7651
|
encodeRlp([
|
|
@@ -7644,6 +7734,7 @@ class Transaction {
|
|
|
7644
7734
|
#kzg;
|
|
7645
7735
|
#blobs;
|
|
7646
7736
|
#auths;
|
|
7737
|
+
#blobWrapperVersion;
|
|
7647
7738
|
/**
|
|
7648
7739
|
* The transaction type.
|
|
7649
7740
|
*
|
|
@@ -7796,6 +7887,21 @@ class Transaction {
|
|
|
7796
7887
|
set signature(value) {
|
|
7797
7888
|
this.#sig = (value == null) ? null : Signature.from(value);
|
|
7798
7889
|
}
|
|
7890
|
+
isValid() {
|
|
7891
|
+
const sig = this.signature;
|
|
7892
|
+
if (sig && !sig.isValid()) {
|
|
7893
|
+
return false;
|
|
7894
|
+
}
|
|
7895
|
+
const auths = this.authorizationList;
|
|
7896
|
+
if (auths) {
|
|
7897
|
+
for (const auth of auths) {
|
|
7898
|
+
if (!auth.signature.isValid()) {
|
|
7899
|
+
return false;
|
|
7900
|
+
}
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
return true;
|
|
7904
|
+
}
|
|
7799
7905
|
/**
|
|
7800
7906
|
* The access list.
|
|
7801
7907
|
*
|
|
@@ -7931,13 +8037,11 @@ class Transaction {
|
|
|
7931
8037
|
versionedHashes.push(getVersionedHash(1, commit));
|
|
7932
8038
|
}
|
|
7933
8039
|
else {
|
|
7934
|
-
const
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
});
|
|
7940
|
-
versionedHashes.push(getVersionedHash(1, commit));
|
|
8040
|
+
const data = hexlify(blob.data);
|
|
8041
|
+
const commitment = hexlify(blob.commitment);
|
|
8042
|
+
const proof = hexlify(blob.proof);
|
|
8043
|
+
blobs.push({ data, commitment, proof });
|
|
8044
|
+
versionedHashes.push(getVersionedHash(1, commitment));
|
|
7941
8045
|
}
|
|
7942
8046
|
}
|
|
7943
8047
|
this.#blobs = blobs;
|
|
@@ -7952,6 +8056,12 @@ class Transaction {
|
|
|
7952
8056
|
this.#kzg = getKzgLibrary(kzg);
|
|
7953
8057
|
}
|
|
7954
8058
|
}
|
|
8059
|
+
get blobWrapperVersion() {
|
|
8060
|
+
return this.#blobWrapperVersion;
|
|
8061
|
+
}
|
|
8062
|
+
set blobWrapperVersion(value) {
|
|
8063
|
+
this.#blobWrapperVersion = value;
|
|
8064
|
+
}
|
|
7955
8065
|
/**
|
|
7956
8066
|
* Creates a new Transaction with default values.
|
|
7957
8067
|
*/
|
|
@@ -7973,6 +8083,7 @@ class Transaction {
|
|
|
7973
8083
|
this.#kzg = null;
|
|
7974
8084
|
this.#blobs = null;
|
|
7975
8085
|
this.#auths = null;
|
|
8086
|
+
this.#blobWrapperVersion = null;
|
|
7976
8087
|
}
|
|
7977
8088
|
/**
|
|
7978
8089
|
* The transaction hash, if signed. Otherwise, ``null``.
|
|
@@ -7999,7 +8110,7 @@ class Transaction {
|
|
|
7999
8110
|
if (this.signature == null) {
|
|
8000
8111
|
return null;
|
|
8001
8112
|
}
|
|
8002
|
-
return recoverAddress(this.unsignedHash, this.signature);
|
|
8113
|
+
return recoverAddress(this.unsignedHash, this.signature.getCanonical());
|
|
8003
8114
|
}
|
|
8004
8115
|
/**
|
|
8005
8116
|
* The public key of the sender, if signed. Otherwise, ``null``.
|
|
@@ -8008,7 +8119,7 @@ class Transaction {
|
|
|
8008
8119
|
if (this.signature == null) {
|
|
8009
8120
|
return null;
|
|
8010
8121
|
}
|
|
8011
|
-
return SigningKey.recoverPublicKey(this.unsignedHash, this.signature);
|
|
8122
|
+
return SigningKey.recoverPublicKey(this.unsignedHash, this.signature.getCanonical());
|
|
8012
8123
|
}
|
|
8013
8124
|
/**
|
|
8014
8125
|
* Returns true if signed.
|
|
@@ -8195,6 +8306,56 @@ class Transaction {
|
|
|
8195
8306
|
accessList: this.accessList
|
|
8196
8307
|
};
|
|
8197
8308
|
}
|
|
8309
|
+
[inspect]() {
|
|
8310
|
+
return this.toString();
|
|
8311
|
+
}
|
|
8312
|
+
toString() {
|
|
8313
|
+
const output = [];
|
|
8314
|
+
const add = (key) => {
|
|
8315
|
+
let value = this[key];
|
|
8316
|
+
if (typeof (value) === "string") {
|
|
8317
|
+
value = JSON.stringify(value);
|
|
8318
|
+
}
|
|
8319
|
+
output.push(`${key}: ${value}`);
|
|
8320
|
+
};
|
|
8321
|
+
if (this.type) {
|
|
8322
|
+
add("type");
|
|
8323
|
+
}
|
|
8324
|
+
add("to");
|
|
8325
|
+
add("data");
|
|
8326
|
+
add("nonce");
|
|
8327
|
+
add("gasLimit");
|
|
8328
|
+
add("value");
|
|
8329
|
+
if (this.chainId != null) {
|
|
8330
|
+
add("chainId");
|
|
8331
|
+
}
|
|
8332
|
+
if (this.signature) {
|
|
8333
|
+
add("from");
|
|
8334
|
+
output.push(`signature: ${this.signature.toString()}`);
|
|
8335
|
+
}
|
|
8336
|
+
// @TODO: accessList
|
|
8337
|
+
// @TODO: blobs (might make output huge; maybe just include a flag?)
|
|
8338
|
+
const auths = this.authorizationList;
|
|
8339
|
+
if (auths) {
|
|
8340
|
+
const outputAuths = [];
|
|
8341
|
+
for (const auth of auths) {
|
|
8342
|
+
const o = [];
|
|
8343
|
+
o.push(`address: ${JSON.stringify(auth.address)}`);
|
|
8344
|
+
if (auth.nonce != null) {
|
|
8345
|
+
o.push(`nonce: ${auth.nonce}`);
|
|
8346
|
+
}
|
|
8347
|
+
if (auth.chainId != null) {
|
|
8348
|
+
o.push(`chainId: ${auth.chainId}`);
|
|
8349
|
+
}
|
|
8350
|
+
if (auth.signature) {
|
|
8351
|
+
o.push(`signature: ${auth.signature.toString()}`);
|
|
8352
|
+
}
|
|
8353
|
+
outputAuths.push(`Authorization { ${o.join(", ")} }`);
|
|
8354
|
+
}
|
|
8355
|
+
output.push(`authorizations: [ ${outputAuths.join(", ")} ]`);
|
|
8356
|
+
}
|
|
8357
|
+
return `Transaction { ${output.join(", ")} }`;
|
|
8358
|
+
}
|
|
8198
8359
|
/**
|
|
8199
8360
|
* Create a **Transaction** from a serialized transaction or a
|
|
8200
8361
|
* Transaction-like object.
|
|
@@ -8268,6 +8429,9 @@ class Transaction {
|
|
|
8268
8429
|
if (tx.kzg != null) {
|
|
8269
8430
|
result.kzg = tx.kzg;
|
|
8270
8431
|
}
|
|
8432
|
+
if (tx.blobWrapperVersion != null) {
|
|
8433
|
+
result.blobWrapperVersion = tx.blobWrapperVersion;
|
|
8434
|
+
}
|
|
8271
8435
|
if (tx.blobs != null) {
|
|
8272
8436
|
result.blobs = tx.blobs;
|
|
8273
8437
|
}
|
|
@@ -15410,4 +15574,4 @@ exports.useModal = useModal;
|
|
|
15410
15574
|
exports.usePhantom = usePhantom;
|
|
15411
15575
|
exports.useSolana = useSolana;
|
|
15412
15576
|
exports.useTheme = useTheme;
|
|
15413
|
-
//# sourceMappingURL=index-
|
|
15577
|
+
//# sourceMappingURL=index-C2cjjAWD.js.map
|