@dvmkit/dvm-cli 0.1.4 → 0.2.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/README.md +14 -0
- package/dist/{_esm-M2HUAA3B.js → _esm-MN4BUYV6.js} +56 -54
- package/dist/{accounts-S747UW3A.js → accounts-2WZE4N5F.js} +5 -5
- package/dist/actions-LR65XILR.js +244 -0
- package/dist/{ccip-XZ5F5J6R.js → ccip-JXYJSXTW.js} +3 -3
- package/dist/{chains-PINFXYUE.js → chains-LJ7XK6H3.js} +8 -8
- package/dist/{chunk-YZUBKHHA.js → chunk-2VVVWBQA.js} +471 -471
- package/dist/chunk-3SWX5BQP.js +66 -0
- package/dist/chunk-4JXFXP4Y.js +757 -0
- package/dist/{chunk-GIDSTROG.js → chunk-4NWEJTAW.js} +160 -158
- package/dist/{chunk-UXQCP26E.js → chunk-65EY7CT4.js} +2 -2
- package/dist/{chunk-6UGZAFIR.js → chunk-6CC6JGEU.js} +348 -18
- package/dist/{chunk-PHZHPRQE.js → chunk-6O27TEXD.js} +173 -173
- package/dist/{chunk-HPRIQEJS.js → chunk-7OK7MBT6.js} +19 -19
- package/dist/{chunk-7UPZZGC5.js → chunk-BECPI5H5.js} +193 -193
- package/dist/chunk-CJTE5TS3.js +1298 -0
- package/dist/{chunk-RWBYCM47.js → chunk-ECEM3ZAS.js} +10 -10
- package/dist/{chunk-ACNNU5RY.js → chunk-ECK465AY.js} +694 -565
- package/dist/{chunk-XGABM4H5.js → chunk-EGY4KDBW.js} +3822 -2012
- package/dist/{chunk-SLDVIXCS.js → chunk-EVQERRCP.js} +12 -12
- package/dist/{chunk-4AQ4G7L5.js → chunk-EZHT2RLJ.js} +383 -383
- package/dist/{chunk-IC6OXFYW.js → chunk-F55NNH2F.js} +63 -63
- package/dist/chunk-G5C6E6PJ.js +9063 -0
- package/dist/{chunk-6AJ7H2VX.js → chunk-GZWKCIYN.js} +213 -1281
- package/dist/{chunk-ZGXCK43G.js → chunk-LH3QPVN6.js} +8499 -8498
- package/dist/{chunk-MMJR6N3J.js → chunk-MLDUKBU3.js} +1368 -1368
- package/dist/chunk-N3UJT2NJ.js +3 -0
- package/dist/chunk-N7MGIK2U.js +61408 -0
- package/dist/{chunk-BZNZWRBB.js → chunk-OWJZYYMG.js} +11 -15
- package/dist/chunk-ZJYO7OLO.js +514 -0
- package/dist/{client-D3XFLWOK.js → client-OWIOFBKS.js} +18 -16
- package/dist/{dist-7MMV3EZA.js → dist-2G3QBGID.js} +11 -10
- package/dist/dvm.js +27046 -4414
- package/dist/esm-RQLHAH2K.js +5183 -0
- package/dist/internal-JDG52DJH.js +1230 -0
- package/dist/payout-reporter-3UB5WRCV-XTVZFIAO.js +17 -0
- package/dist/{pocket-refill-GDYSTECR.js → pocket-refill-QJMMD6QN.js} +29 -30
- package/dist/revenue-reporter-JIKUPXOK-TYUBTF4P.js +11 -0
- package/dist/{secp256k1-4YWQEMGF.js → secp256k1-JLZEQ2H7.js} +2 -2
- package/dist/tempo-lifecycle-SQL3KLEZ-AATA2SKI.js +28 -0
- package/dist/{tempo-wallet-5FEOI4CF.js → tempo-wallet-QOLEIPCV-SWCXRBDS.js} +2 -4
- package/dist/{x402-VNFA3DBY.js → x402-FTG2GRAQ-UGAUMUL6.js} +13 -24
- package/package.json +2 -10
- package/skills/dvm/SKILL.md +2 -1
- package/dist/channel-store-GOV7TEDN.js +0 -62
- package/dist/chunk-3PPOU55E.js +0 -312
- package/dist/chunk-3TBULV3F.js +0 -551
- package/dist/chunk-5BUV73FO.js +0 -2351
- package/dist/chunk-EY5K4BM3.js +0 -1780
- package/dist/chunk-G3RLVJF5.js +0 -19
- package/dist/chunk-KC4UPK44.js +0 -113
- package/dist/chunk-MTBCEXJ6.js +0 -4602
- package/dist/chunk-ONQMRWY3.js +0 -83
- package/dist/chunk-TO47XRK7.js +0 -24890
- package/dist/chunk-U5TNSUYW.js +0 -1757
- package/dist/chunk-UU6QMSTQ.js +0 -171
- package/dist/chunk-ZELLQI7F.js +0 -248
- package/dist/lifecycle-5RLM5JMN.js +0 -29
- package/dist/tempo-lifecycle-DHZPQTSB.js +0 -31
- package/dist/wallet-G3VOUCL4.js +0 -30
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
toRpcList,
|
|
20
20
|
validate,
|
|
21
21
|
yParityToV
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-LH3QPVN6.js";
|
|
23
23
|
import {
|
|
24
24
|
BaseError,
|
|
25
25
|
concat,
|
|
@@ -27,20 +27,20 @@ import {
|
|
|
27
27
|
from,
|
|
28
28
|
from2,
|
|
29
29
|
fromArray,
|
|
30
|
-
fromBytes,
|
|
30
|
+
fromBytes2 as fromBytes,
|
|
31
31
|
fromHex,
|
|
32
|
-
fromNumber,
|
|
32
|
+
fromNumber2 as fromNumber,
|
|
33
33
|
fromString,
|
|
34
34
|
fromString2,
|
|
35
35
|
isEqual,
|
|
36
|
-
size,
|
|
37
|
-
|
|
36
|
+
size2 as size,
|
|
37
|
+
slice,
|
|
38
38
|
toBigInt,
|
|
39
39
|
toBigInt2,
|
|
40
|
-
toNumber,
|
|
41
|
-
|
|
42
|
-
trimLeft
|
|
43
|
-
} from "./chunk-
|
|
40
|
+
toNumber2 as toNumber,
|
|
41
|
+
toString,
|
|
42
|
+
trimLeft2 as trimLeft
|
|
43
|
+
} from "./chunk-F55NNH2F.js";
|
|
44
44
|
import {
|
|
45
45
|
__export
|
|
46
46
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -89,7 +89,7 @@ function fromHex2(value, options = {}) {
|
|
|
89
89
|
return fromBytes2(fromHex(value), options);
|
|
90
90
|
}
|
|
91
91
|
function fromString3(value, options = {}) {
|
|
92
|
-
return fromBytes2(
|
|
92
|
+
return fromBytes2(fromString(value), options);
|
|
93
93
|
}
|
|
94
94
|
function toBytes2(value) {
|
|
95
95
|
const base64 = value.replace(/=+$/, "");
|
|
@@ -112,139 +112,75 @@ function toString2(value) {
|
|
|
112
112
|
return toString(toBytes2(value));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// node_modules/ox/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
115
|
+
// node_modules/ox/node_modules/@noble/curves/esm/nist.js
|
|
116
|
+
var Fp256 = Field(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"));
|
|
117
|
+
var p256_a = Fp256.create(BigInt("-3"));
|
|
118
|
+
var p256_b = BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");
|
|
119
|
+
var p256 = createCurve({
|
|
120
|
+
a: p256_a,
|
|
121
|
+
b: p256_b,
|
|
122
|
+
Fp: Fp256,
|
|
123
|
+
n: BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),
|
|
124
|
+
Gx: BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),
|
|
125
|
+
Gy: BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),
|
|
126
|
+
h: BigInt(1),
|
|
127
|
+
lowS: false
|
|
128
|
+
}, sha256);
|
|
129
|
+
var Fp384 = Field(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"));
|
|
130
|
+
var p384_a = Fp384.create(BigInt("-3"));
|
|
131
|
+
var p384_b = BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");
|
|
132
|
+
var p384 = createCurve({
|
|
133
|
+
a: p384_a,
|
|
134
|
+
b: p384_b,
|
|
135
|
+
Fp: Fp384,
|
|
136
|
+
n: BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),
|
|
137
|
+
Gx: BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),
|
|
138
|
+
Gy: BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),
|
|
139
|
+
h: BigInt(1),
|
|
140
|
+
lowS: false
|
|
141
|
+
}, sha384);
|
|
142
|
+
var Fp521 = Field(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
143
|
+
var p521_a = Fp521.create(BigInt("-3"));
|
|
144
|
+
var p521_b = BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");
|
|
145
|
+
var p521 = createCurve({
|
|
146
|
+
a: p521_a,
|
|
147
|
+
b: p521_b,
|
|
148
|
+
Fp: Fp521,
|
|
149
|
+
n: BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),
|
|
150
|
+
Gx: BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),
|
|
151
|
+
Gy: BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),
|
|
152
|
+
h: BigInt(1),
|
|
153
|
+
lowS: false,
|
|
154
|
+
allowedPrivateKeyLengths: [130, 131, 132]
|
|
155
|
+
// P521 keys are variable-length. Normalize to 132b
|
|
156
|
+
}, sha512);
|
|
156
157
|
|
|
157
|
-
// node_modules/ox/
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
...signature
|
|
158
|
+
// node_modules/ox/node_modules/@noble/curves/esm/p256.js
|
|
159
|
+
var p2562 = p256;
|
|
160
|
+
var secp256r1 = p256;
|
|
161
|
+
|
|
162
|
+
// node_modules/ox/_esm/core/P256.js
|
|
163
|
+
function getPublicKey(options) {
|
|
164
|
+
const { privateKey } = options;
|
|
165
|
+
const point = secp256r1.ProjectivePoint.fromPrivateKey(typeof privateKey === "string" ? privateKey.slice(2) : fromBytes(privateKey).slice(2));
|
|
166
|
+
return from3(point);
|
|
167
|
+
}
|
|
168
|
+
function sign(options) {
|
|
169
|
+
const { extraEntropy: extraEntropy2 = extraEntropy, hash, payload, privateKey } = options;
|
|
170
|
+
const { r, s, recovery } = secp256r1.sign(payload instanceof Uint8Array ? payload : fromHex(payload), privateKey instanceof Uint8Array ? privateKey : fromHex(privateKey), {
|
|
171
|
+
extraEntropy: typeof extraEntropy2 === "boolean" ? extraEntropy2 : from2(extraEntropy2).slice(2),
|
|
172
|
+
lowS: true,
|
|
173
|
+
...hash ? { prehash: true } : {}
|
|
174
|
+
});
|
|
175
|
+
return {
|
|
176
|
+
r,
|
|
177
|
+
s,
|
|
178
|
+
yParity: recovery
|
|
179
179
|
};
|
|
180
|
-
transaction_.blockNumber = transaction.blockNumber ? BigInt(transaction.blockNumber) : null;
|
|
181
|
-
if ("blockTimestamp" in transaction)
|
|
182
|
-
transaction_.blockTimestamp = transaction.blockTimestamp ? BigInt(transaction.blockTimestamp) : transaction.blockTimestamp === null ? null : void 0;
|
|
183
|
-
transaction_.data = transaction.input;
|
|
184
|
-
transaction_.gas = BigInt(transaction.gas ?? 0n);
|
|
185
|
-
transaction_.nonce = BigInt(transaction.nonce ?? 0n);
|
|
186
|
-
transaction_.transactionIndex = transaction.transactionIndex ? Number(transaction.transactionIndex) : null;
|
|
187
|
-
transaction_.value = BigInt(transaction.value ?? 0n);
|
|
188
|
-
if (transaction.authorizationList)
|
|
189
|
-
transaction_.authorizationList = fromRpcList(transaction.authorizationList);
|
|
190
|
-
if (transaction.chainId)
|
|
191
|
-
transaction_.chainId = Number(transaction.chainId);
|
|
192
|
-
if (transaction.gasPrice)
|
|
193
|
-
transaction_.gasPrice = BigInt(transaction.gasPrice);
|
|
194
|
-
if (transaction.maxFeePerBlobGas)
|
|
195
|
-
transaction_.maxFeePerBlobGas = BigInt(transaction.maxFeePerBlobGas);
|
|
196
|
-
if (transaction.maxFeePerGas)
|
|
197
|
-
transaction_.maxFeePerGas = BigInt(transaction.maxFeePerGas);
|
|
198
|
-
if (transaction.maxPriorityFeePerGas)
|
|
199
|
-
transaction_.maxPriorityFeePerGas = BigInt(transaction.maxPriorityFeePerGas);
|
|
200
|
-
if (transaction.type)
|
|
201
|
-
transaction_.type = fromRpcType[transaction.type] ?? transaction.type;
|
|
202
|
-
if (signature)
|
|
203
|
-
transaction_.v = yParityToV(signature.yParity);
|
|
204
|
-
return transaction_;
|
|
205
180
|
}
|
|
206
|
-
function
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
rpc.blockNumber = typeof transaction.blockNumber === "bigint" ? fromNumber(transaction.blockNumber) : null;
|
|
210
|
-
if (typeof transaction.blockTimestamp === "bigint")
|
|
211
|
-
rpc.blockTimestamp = fromNumber(transaction.blockTimestamp);
|
|
212
|
-
else if (transaction.blockTimestamp === null)
|
|
213
|
-
rpc.blockTimestamp = null;
|
|
214
|
-
rpc.from = transaction.from;
|
|
215
|
-
rpc.gas = fromNumber(transaction.gas ?? 0n);
|
|
216
|
-
rpc.hash = transaction.hash;
|
|
217
|
-
rpc.input = transaction.input;
|
|
218
|
-
rpc.nonce = fromNumber(transaction.nonce ?? 0n);
|
|
219
|
-
rpc.to = transaction.to;
|
|
220
|
-
rpc.transactionIndex = transaction.transactionIndex ? fromNumber(transaction.transactionIndex) : null;
|
|
221
|
-
rpc.type = toRpcType[transaction.type] ?? transaction.type;
|
|
222
|
-
rpc.value = fromNumber(transaction.value ?? 0n);
|
|
223
|
-
if (transaction.accessList)
|
|
224
|
-
rpc.accessList = transaction.accessList;
|
|
225
|
-
if (transaction.authorizationList)
|
|
226
|
-
rpc.authorizationList = toRpcList(transaction.authorizationList);
|
|
227
|
-
if (transaction.blobVersionedHashes)
|
|
228
|
-
rpc.blobVersionedHashes = transaction.blobVersionedHashes;
|
|
229
|
-
if (transaction.chainId)
|
|
230
|
-
rpc.chainId = fromNumber(transaction.chainId);
|
|
231
|
-
if (typeof transaction.gasPrice === "bigint")
|
|
232
|
-
rpc.gasPrice = fromNumber(transaction.gasPrice);
|
|
233
|
-
if (typeof transaction.maxFeePerBlobGas === "bigint")
|
|
234
|
-
rpc.maxFeePerBlobGas = fromNumber(transaction.maxFeePerBlobGas);
|
|
235
|
-
if (typeof transaction.maxFeePerGas === "bigint")
|
|
236
|
-
rpc.maxFeePerGas = fromNumber(transaction.maxFeePerGas);
|
|
237
|
-
if (typeof transaction.maxPriorityFeePerGas === "bigint")
|
|
238
|
-
rpc.maxPriorityFeePerGas = fromNumber(transaction.maxPriorityFeePerGas);
|
|
239
|
-
if (typeof transaction.r === "bigint")
|
|
240
|
-
rpc.r = fromNumber(transaction.r, { size: 32 });
|
|
241
|
-
if (typeof transaction.s === "bigint")
|
|
242
|
-
rpc.s = fromNumber(transaction.s, { size: 32 });
|
|
243
|
-
if (typeof transaction.v === "number")
|
|
244
|
-
rpc.v = fromNumber(transaction.v, { size: 1 });
|
|
245
|
-
if (typeof transaction.yParity === "number")
|
|
246
|
-
rpc.yParity = transaction.yParity === 0 ? "0x0" : "0x1";
|
|
247
|
-
return rpc;
|
|
181
|
+
function verify(options) {
|
|
182
|
+
const { hash, payload, publicKey, signature } = options;
|
|
183
|
+
return secp256r1.verify(signature, payload instanceof Uint8Array ? payload : fromHex(payload), toHex(publicKey).substring(2), { lowS: true, ...hash ? { prehash: true } : {} });
|
|
248
184
|
}
|
|
249
185
|
|
|
250
186
|
// node_modules/ox/_esm/core/Cbor.js
|
|
@@ -523,7 +459,7 @@ function getEncodable(value) {
|
|
|
523
459
|
}
|
|
524
460
|
getEncodable2.number = number;
|
|
525
461
|
function string(value) {
|
|
526
|
-
const encoded =
|
|
462
|
+
const encoded = fromString(value);
|
|
527
463
|
const size2 = encoded.length;
|
|
528
464
|
if (size2 <= 23)
|
|
529
465
|
return {
|
|
@@ -1005,245 +941,26 @@ function fromPublicKey(publicKey) {
|
|
|
1005
941
|
]));
|
|
1006
942
|
}
|
|
1007
943
|
|
|
1008
|
-
// node_modules/ox/
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
var p256 = createCurve({
|
|
1013
|
-
a: p256_a,
|
|
1014
|
-
b: p256_b,
|
|
1015
|
-
Fp: Fp256,
|
|
1016
|
-
n: BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),
|
|
1017
|
-
Gx: BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),
|
|
1018
|
-
Gy: BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),
|
|
1019
|
-
h: BigInt(1),
|
|
1020
|
-
lowS: false
|
|
1021
|
-
}, sha256);
|
|
1022
|
-
var Fp384 = Field(BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"));
|
|
1023
|
-
var p384_a = Fp384.create(BigInt("-3"));
|
|
1024
|
-
var p384_b = BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef");
|
|
1025
|
-
var p384 = createCurve({
|
|
1026
|
-
a: p384_a,
|
|
1027
|
-
b: p384_b,
|
|
1028
|
-
Fp: Fp384,
|
|
1029
|
-
n: BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),
|
|
1030
|
-
Gx: BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),
|
|
1031
|
-
Gy: BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f"),
|
|
1032
|
-
h: BigInt(1),
|
|
1033
|
-
lowS: false
|
|
1034
|
-
}, sha384);
|
|
1035
|
-
var Fp521 = Field(BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"));
|
|
1036
|
-
var p521_a = Fp521.create(BigInt("-3"));
|
|
1037
|
-
var p521_b = BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00");
|
|
1038
|
-
var p521 = createCurve({
|
|
1039
|
-
a: p521_a,
|
|
1040
|
-
b: p521_b,
|
|
1041
|
-
Fp: Fp521,
|
|
1042
|
-
n: BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),
|
|
1043
|
-
Gx: BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),
|
|
1044
|
-
Gy: BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"),
|
|
1045
|
-
h: BigInt(1),
|
|
1046
|
-
lowS: false,
|
|
1047
|
-
allowedPrivateKeyLengths: [130, 131, 132]
|
|
1048
|
-
// P521 keys are variable-length. Normalize to 132b
|
|
1049
|
-
}, sha512);
|
|
1050
|
-
|
|
1051
|
-
// node_modules/ox/node_modules/@noble/curves/esm/p256.js
|
|
1052
|
-
var p2562 = p256;
|
|
1053
|
-
var secp256r1 = p256;
|
|
1054
|
-
|
|
1055
|
-
// node_modules/ox/_esm/core/P256.js
|
|
1056
|
-
function getPublicKey(options) {
|
|
1057
|
-
const { privateKey } = options;
|
|
1058
|
-
const point = secp256r1.ProjectivePoint.fromPrivateKey(typeof privateKey === "string" ? privateKey.slice(2) : fromBytes(privateKey).slice(2));
|
|
1059
|
-
return from3(point);
|
|
1060
|
-
}
|
|
1061
|
-
function sign(options) {
|
|
1062
|
-
const { extraEntropy: extraEntropy2 = extraEntropy, hash, payload, privateKey } = options;
|
|
1063
|
-
const { r, s, recovery } = secp256r1.sign(payload instanceof Uint8Array ? payload : fromHex(payload), privateKey instanceof Uint8Array ? privateKey : fromHex(privateKey), {
|
|
1064
|
-
extraEntropy: typeof extraEntropy2 === "boolean" ? extraEntropy2 : from(extraEntropy2).slice(2),
|
|
1065
|
-
lowS: true,
|
|
1066
|
-
...hash ? { prehash: true } : {}
|
|
1067
|
-
});
|
|
1068
|
-
return {
|
|
1069
|
-
r,
|
|
1070
|
-
s,
|
|
1071
|
-
yParity: recovery
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
function verify(options) {
|
|
1075
|
-
const { hash, payload, publicKey, signature } = options;
|
|
1076
|
-
return secp256r1.verify(signature, payload instanceof Uint8Array ? payload : fromHex(payload), toHex(publicKey).substring(2), { lowS: true, ...hash ? { prehash: true } : {} });
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
// node_modules/ox/_esm/core/TransactionRequest.js
|
|
1080
|
-
function fromRpc2(request) {
|
|
1081
|
-
const request_ = request;
|
|
1082
|
-
if (typeof request.authorizationList !== "undefined")
|
|
1083
|
-
request_.authorizationList = fromRpcList(request.authorizationList);
|
|
1084
|
-
if (typeof request.chainId !== "undefined")
|
|
1085
|
-
request_.chainId = toNumber(request.chainId);
|
|
1086
|
-
if (typeof request.gas !== "undefined")
|
|
1087
|
-
request_.gas = toBigInt(request.gas);
|
|
1088
|
-
if (typeof request.gasPrice !== "undefined")
|
|
1089
|
-
request_.gasPrice = toBigInt(request.gasPrice);
|
|
1090
|
-
if (typeof request.maxFeePerBlobGas !== "undefined")
|
|
1091
|
-
request_.maxFeePerBlobGas = toBigInt(request.maxFeePerBlobGas);
|
|
1092
|
-
if (typeof request.maxFeePerGas !== "undefined")
|
|
1093
|
-
request_.maxFeePerGas = toBigInt(request.maxFeePerGas);
|
|
1094
|
-
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1095
|
-
request_.maxPriorityFeePerGas = toBigInt(request.maxPriorityFeePerGas);
|
|
1096
|
-
if (typeof request.nonce !== "undefined")
|
|
1097
|
-
request_.nonce = toBigInt(request.nonce);
|
|
1098
|
-
if (typeof request.type !== "undefined")
|
|
1099
|
-
request_.type = fromRpcType[request.type] || request.type;
|
|
1100
|
-
if (typeof request.value !== "undefined")
|
|
1101
|
-
request_.value = toBigInt(request.value);
|
|
1102
|
-
return request_;
|
|
1103
|
-
}
|
|
1104
|
-
function toRpc2(request) {
|
|
1105
|
-
const request_rpc = {};
|
|
1106
|
-
if (typeof request.accessList !== "undefined")
|
|
1107
|
-
request_rpc.accessList = request.accessList;
|
|
1108
|
-
if (typeof request.authorizationList !== "undefined")
|
|
1109
|
-
request_rpc.authorizationList = toRpcList(request.authorizationList);
|
|
1110
|
-
if (typeof request.blobVersionedHashes !== "undefined")
|
|
1111
|
-
request_rpc.blobVersionedHashes = request.blobVersionedHashes;
|
|
1112
|
-
if (typeof request.blobs !== "undefined")
|
|
1113
|
-
request_rpc.blobs = request.blobs;
|
|
1114
|
-
if (typeof request.chainId !== "undefined")
|
|
1115
|
-
request_rpc.chainId = fromNumber(request.chainId);
|
|
1116
|
-
if (typeof request.data !== "undefined") {
|
|
1117
|
-
request_rpc.data = request.data;
|
|
1118
|
-
request_rpc.input = request.data;
|
|
1119
|
-
} else if (typeof request.input !== "undefined") {
|
|
1120
|
-
request_rpc.data = request.input;
|
|
1121
|
-
request_rpc.input = request.input;
|
|
1122
|
-
}
|
|
1123
|
-
if (typeof request.from !== "undefined")
|
|
1124
|
-
request_rpc.from = request.from;
|
|
1125
|
-
if (typeof request.gas !== "undefined")
|
|
1126
|
-
request_rpc.gas = fromNumber(request.gas);
|
|
1127
|
-
if (typeof request.gasPrice !== "undefined")
|
|
1128
|
-
request_rpc.gasPrice = fromNumber(request.gasPrice);
|
|
1129
|
-
if (typeof request.maxFeePerBlobGas !== "undefined")
|
|
1130
|
-
request_rpc.maxFeePerBlobGas = fromNumber(request.maxFeePerBlobGas);
|
|
1131
|
-
if (typeof request.maxFeePerGas !== "undefined")
|
|
1132
|
-
request_rpc.maxFeePerGas = fromNumber(request.maxFeePerGas);
|
|
1133
|
-
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1134
|
-
request_rpc.maxPriorityFeePerGas = fromNumber(request.maxPriorityFeePerGas);
|
|
1135
|
-
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1136
|
-
request_rpc.maxPriorityFeePerGas = fromNumber(request.maxPriorityFeePerGas);
|
|
1137
|
-
if (typeof request.nonce !== "undefined")
|
|
1138
|
-
request_rpc.nonce = fromNumber(request.nonce);
|
|
1139
|
-
if (typeof request.to !== "undefined")
|
|
1140
|
-
request_rpc.to = request.to;
|
|
1141
|
-
if (typeof request.type !== "undefined")
|
|
1142
|
-
request_rpc.type = toRpcType[request.type] || request.type;
|
|
1143
|
-
if (typeof request.value !== "undefined")
|
|
1144
|
-
request_rpc.value = fromNumber(request.value);
|
|
1145
|
-
return request_rpc;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
// node_modules/ox/_esm/core/Value.js
|
|
1149
|
-
var exponents = {
|
|
1150
|
-
wei: 0,
|
|
1151
|
-
gwei: 9,
|
|
1152
|
-
szabo: 12,
|
|
1153
|
-
finney: 15,
|
|
1154
|
-
ether: 18
|
|
1155
|
-
};
|
|
1156
|
-
function format(value, decimals = 0) {
|
|
1157
|
-
let display = value.toString();
|
|
1158
|
-
const negative = display.startsWith("-");
|
|
1159
|
-
if (negative)
|
|
1160
|
-
display = display.slice(1);
|
|
1161
|
-
display = display.padStart(decimals, "0");
|
|
1162
|
-
let [integer, fraction] = [
|
|
1163
|
-
display.slice(0, display.length - decimals),
|
|
1164
|
-
display.slice(display.length - decimals)
|
|
1165
|
-
];
|
|
1166
|
-
fraction = fraction.replace(/(0+)$/, "");
|
|
1167
|
-
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
1168
|
-
}
|
|
1169
|
-
function formatGwei(wei, unit = "wei") {
|
|
1170
|
-
return format(wei, exponents.gwei - exponents[unit]);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
// node_modules/ox/_esm/core/TxEnvelope.js
|
|
1174
|
-
var FeeCapTooHighError = class extends BaseError {
|
|
1175
|
-
constructor({ feeCap } = {}) {
|
|
1176
|
-
super(`The fee cap (\`maxFeePerGas\`/\`maxPriorityFeePerGas\`${feeCap ? ` = ${formatGwei(feeCap)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`);
|
|
1177
|
-
Object.defineProperty(this, "name", {
|
|
1178
|
-
enumerable: true,
|
|
1179
|
-
configurable: true,
|
|
1180
|
-
writable: true,
|
|
1181
|
-
value: "TransactionEnvelope.FeeCapTooHighError"
|
|
1182
|
-
});
|
|
1183
|
-
}
|
|
1184
|
-
};
|
|
1185
|
-
var InvalidChainIdError = class extends BaseError {
|
|
1186
|
-
constructor({ chainId }) {
|
|
1187
|
-
super(typeof chainId !== "undefined" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.");
|
|
1188
|
-
Object.defineProperty(this, "name", {
|
|
1189
|
-
enumerable: true,
|
|
1190
|
-
configurable: true,
|
|
1191
|
-
writable: true,
|
|
1192
|
-
value: "TransactionEnvelope.InvalidChainIdError"
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
};
|
|
1196
|
-
var InvalidSerializedError = class extends BaseError {
|
|
1197
|
-
constructor({ attributes, serialized, type }) {
|
|
1198
|
-
const missing = Object.entries(attributes).map(([key, value]) => typeof value === "undefined" ? key : void 0).filter(Boolean);
|
|
1199
|
-
super(`Invalid serialized transaction of type "${type}" was provided.`, {
|
|
1200
|
-
metaMessages: [
|
|
1201
|
-
`Serialized Transaction: "${serialized}"`,
|
|
1202
|
-
missing.length > 0 ? `Missing Attributes: ${missing.join(", ")}` : ""
|
|
1203
|
-
].filter(Boolean)
|
|
1204
|
-
});
|
|
1205
|
-
Object.defineProperty(this, "name", {
|
|
1206
|
-
enumerable: true,
|
|
1207
|
-
configurable: true,
|
|
1208
|
-
writable: true,
|
|
1209
|
-
value: "TransactionEnvelope.InvalidSerializedError"
|
|
1210
|
-
});
|
|
1211
|
-
}
|
|
1212
|
-
};
|
|
1213
|
-
var TipAboveFeeCapError = class extends BaseError {
|
|
1214
|
-
constructor({ maxPriorityFeePerGas, maxFeePerGas } = {}) {
|
|
1215
|
-
super([
|
|
1216
|
-
`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
|
|
1217
|
-
].join("\n"));
|
|
1218
|
-
Object.defineProperty(this, "name", {
|
|
1219
|
-
enumerable: true,
|
|
1220
|
-
configurable: true,
|
|
1221
|
-
writable: true,
|
|
1222
|
-
value: "TransactionEnvelope.TipAboveFeeCapError"
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
// node_modules/ox/_esm/core/internal/webauthn.js
|
|
1228
|
-
function parseAsn1Signature(bytes) {
|
|
1229
|
-
const sig = p2562.Signature.fromDER(bytes).normalizeS();
|
|
1230
|
-
return { r: sig.r, s: sig.s };
|
|
944
|
+
// node_modules/ox/_esm/core/internal/webauthn.js
|
|
945
|
+
function parseAsn1Signature(bytes) {
|
|
946
|
+
const sig = p2562.Signature.fromDER(bytes).normalizeS();
|
|
947
|
+
return { r: sig.r, s: sig.s };
|
|
1231
948
|
}
|
|
1232
949
|
|
|
1233
950
|
// node_modules/ox/_esm/webauthn/Authenticator.js
|
|
1234
951
|
function getAuthenticatorData(options = {}) {
|
|
1235
952
|
const { credential, flag = 5, rpId = window.location.hostname, signCount = 0 } = options;
|
|
1236
|
-
const rpIdHash = sha2562(
|
|
953
|
+
const rpIdHash = sha2562(fromString2(rpId));
|
|
1237
954
|
const flag_bytes = fromNumber(flag, { size: 1 });
|
|
1238
955
|
const signCount_bytes = fromNumber(signCount, { size: 4 });
|
|
1239
|
-
const base =
|
|
956
|
+
const base = concat2(rpIdHash, flag_bytes, signCount_bytes);
|
|
1240
957
|
if (!credential)
|
|
1241
958
|
return base;
|
|
1242
959
|
const aaguid = fromBytes(new Uint8Array(16));
|
|
1243
960
|
const credentialId = fromBytes(credential.id);
|
|
1244
961
|
const credIdLen = fromNumber(credential.id.length, { size: 2 });
|
|
1245
962
|
const coseKey = fromPublicKey(credential.publicKey);
|
|
1246
|
-
return
|
|
963
|
+
return concat2(base, aaguid, credIdLen, credentialId, coseKey);
|
|
1247
964
|
}
|
|
1248
965
|
function getClientDataJSON(options) {
|
|
1249
966
|
const { challenge, crossOrigin = false, extraClientData, origin = window.location.origin, type = "webauthn.get" } = options;
|
|
@@ -1292,7 +1009,7 @@ function getSignPayload(options) {
|
|
|
1292
1009
|
extraClientData,
|
|
1293
1010
|
origin
|
|
1294
1011
|
});
|
|
1295
|
-
const clientDataJSONHash = sha2562(
|
|
1012
|
+
const clientDataJSONHash = sha2562(fromString2(clientDataJSON));
|
|
1296
1013
|
const challengeIndex = clientDataJSON.indexOf('"challenge"');
|
|
1297
1014
|
const typeIndex = clientDataJSON.indexOf('"type"');
|
|
1298
1015
|
const metadata = {
|
|
@@ -1302,7 +1019,7 @@ function getSignPayload(options) {
|
|
|
1302
1019
|
typeIndex,
|
|
1303
1020
|
userVerificationRequired: userVerification === "required"
|
|
1304
1021
|
};
|
|
1305
|
-
const payload =
|
|
1022
|
+
const payload = concat2(authenticatorData, clientDataJSONHash);
|
|
1306
1023
|
return { metadata, payload };
|
|
1307
1024
|
}
|
|
1308
1025
|
async function sign2(options) {
|
|
@@ -1360,7 +1077,7 @@ function verify2(options) {
|
|
|
1360
1077
|
return false;
|
|
1361
1078
|
if (rpId !== void 0) {
|
|
1362
1079
|
const rpIdHash = authenticatorDataBytes.slice(0, 32);
|
|
1363
|
-
const expectedRpIdHash = sha2562(
|
|
1080
|
+
const expectedRpIdHash = sha2562(fromString2(rpId), { as: "Bytes" });
|
|
1364
1081
|
if (!isEqual(rpIdHash, expectedRpIdHash))
|
|
1365
1082
|
return false;
|
|
1366
1083
|
}
|
|
@@ -1381,10 +1098,10 @@ function verify2(options) {
|
|
|
1381
1098
|
if (!origins.includes(clientData.origin))
|
|
1382
1099
|
return false;
|
|
1383
1100
|
}
|
|
1384
|
-
const clientDataJSONHash = sha2562(
|
|
1101
|
+
const clientDataJSONHash = sha2562(fromString(clientDataJSON), {
|
|
1385
1102
|
as: "Bytes"
|
|
1386
1103
|
});
|
|
1387
|
-
const payload =
|
|
1104
|
+
const payload = concat(authenticatorDataBytes, clientDataJSONHash);
|
|
1388
1105
|
return verify({
|
|
1389
1106
|
hash: true,
|
|
1390
1107
|
payload,
|
|
@@ -1402,41 +1119,324 @@ function verify3(options) {
|
|
|
1402
1119
|
return verify2(options);
|
|
1403
1120
|
}
|
|
1404
1121
|
|
|
1122
|
+
// node_modules/ox/_esm/core/Transaction.js
|
|
1123
|
+
var toRpcType = {
|
|
1124
|
+
legacy: "0x0",
|
|
1125
|
+
eip2930: "0x1",
|
|
1126
|
+
eip1559: "0x2",
|
|
1127
|
+
eip4844: "0x3",
|
|
1128
|
+
eip7702: "0x4"
|
|
1129
|
+
};
|
|
1130
|
+
var fromRpcType = {
|
|
1131
|
+
"0x0": "legacy",
|
|
1132
|
+
"0x1": "eip2930",
|
|
1133
|
+
"0x2": "eip1559",
|
|
1134
|
+
"0x3": "eip4844",
|
|
1135
|
+
"0x4": "eip7702"
|
|
1136
|
+
};
|
|
1137
|
+
function fromRpc(transaction, _options = {}) {
|
|
1138
|
+
if (!transaction)
|
|
1139
|
+
return null;
|
|
1140
|
+
const signature = extract(transaction);
|
|
1141
|
+
const transaction_ = {
|
|
1142
|
+
...transaction,
|
|
1143
|
+
...signature
|
|
1144
|
+
};
|
|
1145
|
+
transaction_.blockNumber = transaction.blockNumber ? BigInt(transaction.blockNumber) : null;
|
|
1146
|
+
if ("blockTimestamp" in transaction)
|
|
1147
|
+
transaction_.blockTimestamp = transaction.blockTimestamp ? BigInt(transaction.blockTimestamp) : transaction.blockTimestamp === null ? null : void 0;
|
|
1148
|
+
transaction_.data = transaction.input;
|
|
1149
|
+
transaction_.gas = BigInt(transaction.gas ?? 0n);
|
|
1150
|
+
transaction_.nonce = BigInt(transaction.nonce ?? 0n);
|
|
1151
|
+
transaction_.transactionIndex = transaction.transactionIndex ? Number(transaction.transactionIndex) : null;
|
|
1152
|
+
transaction_.value = BigInt(transaction.value ?? 0n);
|
|
1153
|
+
if (transaction.authorizationList)
|
|
1154
|
+
transaction_.authorizationList = fromRpcList(transaction.authorizationList);
|
|
1155
|
+
if (transaction.chainId)
|
|
1156
|
+
transaction_.chainId = Number(transaction.chainId);
|
|
1157
|
+
if (transaction.gasPrice)
|
|
1158
|
+
transaction_.gasPrice = BigInt(transaction.gasPrice);
|
|
1159
|
+
if (transaction.maxFeePerBlobGas)
|
|
1160
|
+
transaction_.maxFeePerBlobGas = BigInt(transaction.maxFeePerBlobGas);
|
|
1161
|
+
if (transaction.maxFeePerGas)
|
|
1162
|
+
transaction_.maxFeePerGas = BigInt(transaction.maxFeePerGas);
|
|
1163
|
+
if (transaction.maxPriorityFeePerGas)
|
|
1164
|
+
transaction_.maxPriorityFeePerGas = BigInt(transaction.maxPriorityFeePerGas);
|
|
1165
|
+
if (transaction.type)
|
|
1166
|
+
transaction_.type = fromRpcType[transaction.type] ?? transaction.type;
|
|
1167
|
+
if (signature)
|
|
1168
|
+
transaction_.v = yParityToV(signature.yParity);
|
|
1169
|
+
return transaction_;
|
|
1170
|
+
}
|
|
1171
|
+
function toRpc(transaction, _options) {
|
|
1172
|
+
const rpc = {};
|
|
1173
|
+
rpc.blockHash = transaction.blockHash;
|
|
1174
|
+
rpc.blockNumber = typeof transaction.blockNumber === "bigint" ? fromNumber(transaction.blockNumber) : null;
|
|
1175
|
+
if (typeof transaction.blockTimestamp === "bigint")
|
|
1176
|
+
rpc.blockTimestamp = fromNumber(transaction.blockTimestamp);
|
|
1177
|
+
else if (transaction.blockTimestamp === null)
|
|
1178
|
+
rpc.blockTimestamp = null;
|
|
1179
|
+
rpc.from = transaction.from;
|
|
1180
|
+
rpc.gas = fromNumber(transaction.gas ?? 0n);
|
|
1181
|
+
rpc.hash = transaction.hash;
|
|
1182
|
+
rpc.input = transaction.input;
|
|
1183
|
+
rpc.nonce = fromNumber(transaction.nonce ?? 0n);
|
|
1184
|
+
rpc.to = transaction.to;
|
|
1185
|
+
rpc.transactionIndex = transaction.transactionIndex ? fromNumber(transaction.transactionIndex) : null;
|
|
1186
|
+
rpc.type = toRpcType[transaction.type] ?? transaction.type;
|
|
1187
|
+
rpc.value = fromNumber(transaction.value ?? 0n);
|
|
1188
|
+
if (transaction.accessList)
|
|
1189
|
+
rpc.accessList = transaction.accessList;
|
|
1190
|
+
if (transaction.authorizationList)
|
|
1191
|
+
rpc.authorizationList = toRpcList(transaction.authorizationList);
|
|
1192
|
+
if (transaction.blobVersionedHashes)
|
|
1193
|
+
rpc.blobVersionedHashes = transaction.blobVersionedHashes;
|
|
1194
|
+
if (transaction.chainId)
|
|
1195
|
+
rpc.chainId = fromNumber(transaction.chainId);
|
|
1196
|
+
if (typeof transaction.gasPrice === "bigint")
|
|
1197
|
+
rpc.gasPrice = fromNumber(transaction.gasPrice);
|
|
1198
|
+
if (typeof transaction.maxFeePerBlobGas === "bigint")
|
|
1199
|
+
rpc.maxFeePerBlobGas = fromNumber(transaction.maxFeePerBlobGas);
|
|
1200
|
+
if (typeof transaction.maxFeePerGas === "bigint")
|
|
1201
|
+
rpc.maxFeePerGas = fromNumber(transaction.maxFeePerGas);
|
|
1202
|
+
if (typeof transaction.maxPriorityFeePerGas === "bigint")
|
|
1203
|
+
rpc.maxPriorityFeePerGas = fromNumber(transaction.maxPriorityFeePerGas);
|
|
1204
|
+
if (typeof transaction.r === "bigint")
|
|
1205
|
+
rpc.r = fromNumber(transaction.r, { size: 32 });
|
|
1206
|
+
if (typeof transaction.s === "bigint")
|
|
1207
|
+
rpc.s = fromNumber(transaction.s, { size: 32 });
|
|
1208
|
+
if (typeof transaction.v === "number")
|
|
1209
|
+
rpc.v = fromNumber(transaction.v, { size: 1 });
|
|
1210
|
+
if (typeof transaction.yParity === "number")
|
|
1211
|
+
rpc.yParity = transaction.yParity === 0 ? "0x0" : "0x1";
|
|
1212
|
+
return rpc;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
// node_modules/ox/_esm/core/TransactionRequest.js
|
|
1216
|
+
function fromRpc2(request) {
|
|
1217
|
+
const request_ = request;
|
|
1218
|
+
if (typeof request.authorizationList !== "undefined")
|
|
1219
|
+
request_.authorizationList = fromRpcList(request.authorizationList);
|
|
1220
|
+
if (typeof request.chainId !== "undefined")
|
|
1221
|
+
request_.chainId = toNumber(request.chainId);
|
|
1222
|
+
if (typeof request.gas !== "undefined")
|
|
1223
|
+
request_.gas = toBigInt2(request.gas);
|
|
1224
|
+
if (typeof request.gasPrice !== "undefined")
|
|
1225
|
+
request_.gasPrice = toBigInt2(request.gasPrice);
|
|
1226
|
+
if (typeof request.maxFeePerBlobGas !== "undefined")
|
|
1227
|
+
request_.maxFeePerBlobGas = toBigInt2(request.maxFeePerBlobGas);
|
|
1228
|
+
if (typeof request.maxFeePerGas !== "undefined")
|
|
1229
|
+
request_.maxFeePerGas = toBigInt2(request.maxFeePerGas);
|
|
1230
|
+
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1231
|
+
request_.maxPriorityFeePerGas = toBigInt2(request.maxPriorityFeePerGas);
|
|
1232
|
+
if (typeof request.nonce !== "undefined")
|
|
1233
|
+
request_.nonce = toBigInt2(request.nonce);
|
|
1234
|
+
if (typeof request.type !== "undefined")
|
|
1235
|
+
request_.type = fromRpcType[request.type] || request.type;
|
|
1236
|
+
if (typeof request.value !== "undefined")
|
|
1237
|
+
request_.value = toBigInt2(request.value);
|
|
1238
|
+
return request_;
|
|
1239
|
+
}
|
|
1240
|
+
function toRpc2(request) {
|
|
1241
|
+
const request_rpc = {};
|
|
1242
|
+
if (typeof request.accessList !== "undefined")
|
|
1243
|
+
request_rpc.accessList = request.accessList;
|
|
1244
|
+
if (typeof request.authorizationList !== "undefined")
|
|
1245
|
+
request_rpc.authorizationList = toRpcList(request.authorizationList);
|
|
1246
|
+
if (typeof request.blobVersionedHashes !== "undefined")
|
|
1247
|
+
request_rpc.blobVersionedHashes = request.blobVersionedHashes;
|
|
1248
|
+
if (typeof request.blobs !== "undefined")
|
|
1249
|
+
request_rpc.blobs = request.blobs;
|
|
1250
|
+
if (typeof request.chainId !== "undefined")
|
|
1251
|
+
request_rpc.chainId = fromNumber(request.chainId);
|
|
1252
|
+
if (typeof request.data !== "undefined") {
|
|
1253
|
+
request_rpc.data = request.data;
|
|
1254
|
+
request_rpc.input = request.data;
|
|
1255
|
+
} else if (typeof request.input !== "undefined") {
|
|
1256
|
+
request_rpc.data = request.input;
|
|
1257
|
+
request_rpc.input = request.input;
|
|
1258
|
+
}
|
|
1259
|
+
if (typeof request.from !== "undefined")
|
|
1260
|
+
request_rpc.from = request.from;
|
|
1261
|
+
if (typeof request.gas !== "undefined")
|
|
1262
|
+
request_rpc.gas = fromNumber(request.gas);
|
|
1263
|
+
if (typeof request.gasPrice !== "undefined")
|
|
1264
|
+
request_rpc.gasPrice = fromNumber(request.gasPrice);
|
|
1265
|
+
if (typeof request.maxFeePerBlobGas !== "undefined")
|
|
1266
|
+
request_rpc.maxFeePerBlobGas = fromNumber(request.maxFeePerBlobGas);
|
|
1267
|
+
if (typeof request.maxFeePerGas !== "undefined")
|
|
1268
|
+
request_rpc.maxFeePerGas = fromNumber(request.maxFeePerGas);
|
|
1269
|
+
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1270
|
+
request_rpc.maxPriorityFeePerGas = fromNumber(request.maxPriorityFeePerGas);
|
|
1271
|
+
if (typeof request.maxPriorityFeePerGas !== "undefined")
|
|
1272
|
+
request_rpc.maxPriorityFeePerGas = fromNumber(request.maxPriorityFeePerGas);
|
|
1273
|
+
if (typeof request.nonce !== "undefined")
|
|
1274
|
+
request_rpc.nonce = fromNumber(request.nonce);
|
|
1275
|
+
if (typeof request.to !== "undefined")
|
|
1276
|
+
request_rpc.to = request.to;
|
|
1277
|
+
if (typeof request.type !== "undefined")
|
|
1278
|
+
request_rpc.type = toRpcType[request.type] || request.type;
|
|
1279
|
+
if (typeof request.value !== "undefined")
|
|
1280
|
+
request_rpc.value = fromNumber(request.value);
|
|
1281
|
+
return request_rpc;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
// node_modules/ox/_esm/core/AccessList.js
|
|
1285
|
+
function fromTupleList(accessList) {
|
|
1286
|
+
const list = [];
|
|
1287
|
+
for (let i = 0; i < accessList.length; i++) {
|
|
1288
|
+
const [address, storageKeys] = accessList[i];
|
|
1289
|
+
if (address)
|
|
1290
|
+
assert(address, { strict: false });
|
|
1291
|
+
list.push({
|
|
1292
|
+
address,
|
|
1293
|
+
storageKeys: storageKeys.map((key) => validate(key) ? key : trimLeft(key))
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
return list;
|
|
1297
|
+
}
|
|
1298
|
+
function toTupleList(accessList) {
|
|
1299
|
+
if (!accessList || accessList.length === 0)
|
|
1300
|
+
return [];
|
|
1301
|
+
const tuple = [];
|
|
1302
|
+
for (const { address, storageKeys } of accessList) {
|
|
1303
|
+
for (let j = 0; j < storageKeys.length; j++)
|
|
1304
|
+
if (size(storageKeys[j]) !== 32)
|
|
1305
|
+
throw new InvalidStorageKeySizeError({
|
|
1306
|
+
storageKey: storageKeys[j]
|
|
1307
|
+
});
|
|
1308
|
+
if (address)
|
|
1309
|
+
assert(address, { strict: false });
|
|
1310
|
+
tuple.push([address, storageKeys]);
|
|
1311
|
+
}
|
|
1312
|
+
return tuple;
|
|
1313
|
+
}
|
|
1314
|
+
var InvalidStorageKeySizeError = class extends BaseError {
|
|
1315
|
+
constructor({ storageKey }) {
|
|
1316
|
+
super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${size(storageKey)} bytes.`);
|
|
1317
|
+
Object.defineProperty(this, "name", {
|
|
1318
|
+
enumerable: true,
|
|
1319
|
+
configurable: true,
|
|
1320
|
+
writable: true,
|
|
1321
|
+
value: "AccessList.InvalidStorageKeySizeError"
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
};
|
|
1325
|
+
|
|
1326
|
+
// node_modules/ox/_esm/core/Value.js
|
|
1327
|
+
var exponents = {
|
|
1328
|
+
wei: 0,
|
|
1329
|
+
gwei: 9,
|
|
1330
|
+
szabo: 12,
|
|
1331
|
+
finney: 15,
|
|
1332
|
+
ether: 18
|
|
1333
|
+
};
|
|
1334
|
+
function format(value, decimals = 0) {
|
|
1335
|
+
let display = value.toString();
|
|
1336
|
+
const negative = display.startsWith("-");
|
|
1337
|
+
if (negative)
|
|
1338
|
+
display = display.slice(1);
|
|
1339
|
+
display = display.padStart(decimals, "0");
|
|
1340
|
+
let [integer, fraction] = [
|
|
1341
|
+
display.slice(0, display.length - decimals),
|
|
1342
|
+
display.slice(display.length - decimals)
|
|
1343
|
+
];
|
|
1344
|
+
fraction = fraction.replace(/(0+)$/, "");
|
|
1345
|
+
return `${negative ? "-" : ""}${integer || "0"}${fraction ? `.${fraction}` : ""}`;
|
|
1346
|
+
}
|
|
1347
|
+
function formatGwei(wei, unit = "wei") {
|
|
1348
|
+
return format(wei, exponents.gwei - exponents[unit]);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// node_modules/ox/_esm/core/TxEnvelope.js
|
|
1352
|
+
var FeeCapTooHighError = class extends BaseError {
|
|
1353
|
+
constructor({ feeCap } = {}) {
|
|
1354
|
+
super(`The fee cap (\`maxFeePerGas\`/\`maxPriorityFeePerGas\`${feeCap ? ` = ${formatGwei(feeCap)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`);
|
|
1355
|
+
Object.defineProperty(this, "name", {
|
|
1356
|
+
enumerable: true,
|
|
1357
|
+
configurable: true,
|
|
1358
|
+
writable: true,
|
|
1359
|
+
value: "TransactionEnvelope.FeeCapTooHighError"
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
var InvalidChainIdError = class extends BaseError {
|
|
1364
|
+
constructor({ chainId }) {
|
|
1365
|
+
super(typeof chainId !== "undefined" ? `Chain ID "${chainId}" is invalid.` : "Chain ID is invalid.");
|
|
1366
|
+
Object.defineProperty(this, "name", {
|
|
1367
|
+
enumerable: true,
|
|
1368
|
+
configurable: true,
|
|
1369
|
+
writable: true,
|
|
1370
|
+
value: "TransactionEnvelope.InvalidChainIdError"
|
|
1371
|
+
});
|
|
1372
|
+
}
|
|
1373
|
+
};
|
|
1374
|
+
var InvalidSerializedError = class extends BaseError {
|
|
1375
|
+
constructor({ attributes, serialized, type }) {
|
|
1376
|
+
const missing = Object.entries(attributes).map(([key, value]) => typeof value === "undefined" ? key : void 0).filter(Boolean);
|
|
1377
|
+
super(`Invalid serialized transaction of type "${type}" was provided.`, {
|
|
1378
|
+
metaMessages: [
|
|
1379
|
+
`Serialized Transaction: "${serialized}"`,
|
|
1380
|
+
missing.length > 0 ? `Missing Attributes: ${missing.join(", ")}` : ""
|
|
1381
|
+
].filter(Boolean)
|
|
1382
|
+
});
|
|
1383
|
+
Object.defineProperty(this, "name", {
|
|
1384
|
+
enumerable: true,
|
|
1385
|
+
configurable: true,
|
|
1386
|
+
writable: true,
|
|
1387
|
+
value: "TransactionEnvelope.InvalidSerializedError"
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
};
|
|
1391
|
+
var TipAboveFeeCapError = class extends BaseError {
|
|
1392
|
+
constructor({ maxPriorityFeePerGas, maxFeePerGas } = {}) {
|
|
1393
|
+
super([
|
|
1394
|
+
`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
|
|
1395
|
+
].join("\n"));
|
|
1396
|
+
Object.defineProperty(this, "name", {
|
|
1397
|
+
enumerable: true,
|
|
1398
|
+
configurable: true,
|
|
1399
|
+
writable: true,
|
|
1400
|
+
value: "TransactionEnvelope.TipAboveFeeCapError"
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
|
|
1405
1405
|
// node_modules/ox/_esm/core/WebCryptoP256.js
|
|
1406
1406
|
async function sign4(options) {
|
|
1407
1407
|
const { payload, privateKey } = options;
|
|
1408
1408
|
const signature = await globalThis.crypto.subtle.sign({
|
|
1409
1409
|
name: "ECDSA",
|
|
1410
1410
|
hash: "SHA-256"
|
|
1411
|
-
}, privateKey,
|
|
1411
|
+
}, privateKey, from(payload));
|
|
1412
1412
|
const signature_bytes = fromArray(new Uint8Array(signature));
|
|
1413
|
-
const r =
|
|
1414
|
-
let s =
|
|
1413
|
+
const r = toBigInt(slice(signature_bytes, 0, 32));
|
|
1414
|
+
let s = toBigInt(slice(signature_bytes, 32, 64));
|
|
1415
1415
|
if (s > p2562.CURVE.n / 2n)
|
|
1416
1416
|
s = p2562.CURVE.n - s;
|
|
1417
1417
|
return { r, s };
|
|
1418
1418
|
}
|
|
1419
1419
|
|
|
1420
1420
|
export {
|
|
1421
|
-
|
|
1422
|
-
|
|
1421
|
+
getPublicKey,
|
|
1422
|
+
sign,
|
|
1423
|
+
verify,
|
|
1423
1424
|
Base64_exports,
|
|
1425
|
+
getSignPayload2 as getSignPayload,
|
|
1426
|
+
sign3 as sign2,
|
|
1427
|
+
verify3 as verify2,
|
|
1424
1428
|
toRpcType,
|
|
1425
1429
|
fromRpcType,
|
|
1426
1430
|
fromRpc,
|
|
1427
1431
|
toRpc,
|
|
1428
|
-
getPublicKey,
|
|
1429
|
-
sign,
|
|
1430
|
-
verify,
|
|
1431
1432
|
fromRpc2,
|
|
1432
1433
|
toRpc2,
|
|
1434
|
+
fromTupleList,
|
|
1435
|
+
toTupleList,
|
|
1433
1436
|
FeeCapTooHighError,
|
|
1434
1437
|
InvalidChainIdError,
|
|
1435
1438
|
InvalidSerializedError,
|
|
1436
1439
|
TipAboveFeeCapError,
|
|
1437
|
-
getSignPayload2 as getSignPayload,
|
|
1438
|
-
sign3 as sign2,
|
|
1439
|
-
verify3 as verify2,
|
|
1440
1440
|
sign4 as sign3
|
|
1441
1441
|
};
|
|
1442
1442
|
/*! Bundled license information:
|