ox 0.3.1 → 0.4.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/CHANGELOG.md +18 -0
- package/_cjs/core/Block.js.map +1 -1
- package/_cjs/core/Signature.js +1 -1
- package/_cjs/core/Signature.js.map +1 -1
- package/_cjs/core/internal/abiParameters.js +19 -2
- package/_cjs/core/internal/abiParameters.js.map +1 -1
- package/_cjs/core/internal/entropy.js +1 -0
- package/_cjs/core/internal/entropy.js.map +1 -1
- package/_cjs/erc6492/WrappedSignature.js +58 -0
- package/_cjs/erc6492/WrappedSignature.js.map +1 -0
- package/_cjs/erc6492/index.js +5 -0
- package/_cjs/erc6492/index.js.map +1 -0
- package/_cjs/index.docs.js +6 -0
- package/_cjs/index.docs.js.map +1 -0
- package/_cjs/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/core/Block.js.map +1 -1
- package/_esm/core/Signature.js +1 -1
- package/_esm/core/Signature.js.map +1 -1
- package/_esm/core/internal/abiParameters.js +19 -2
- package/_esm/core/internal/abiParameters.js.map +1 -1
- package/_esm/core/internal/entropy.js +1 -1
- package/_esm/core/internal/entropy.js.map +1 -1
- package/_esm/erc6492/WrappedSignature.js +146 -0
- package/_esm/erc6492/WrappedSignature.js.map +1 -0
- package/_esm/erc6492/index.js +25 -0
- package/_esm/erc6492/index.js.map +1 -0
- package/_esm/index.docs.js +5 -0
- package/_esm/index.docs.js.map +1 -0
- package/_esm/index.js +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/core/Block.d.ts +12 -1
- package/_types/core/Block.d.ts.map +1 -1
- package/_types/core/internal/abiParameters.d.ts +2 -1
- package/_types/core/internal/abiParameters.d.ts.map +1 -1
- package/_types/core/internal/entropy.d.ts.map +1 -1
- package/_types/core/internal/rpcSchemas/eth.d.ts +9 -9
- package/_types/core/internal/rpcSchemas/eth.d.ts.map +1 -1
- package/_types/erc6492/WrappedSignature.d.ts +138 -0
- package/_types/erc6492/WrappedSignature.d.ts.map +1 -0
- package/_types/erc6492/index.d.ts +27 -0
- package/_types/erc6492/index.d.ts.map +1 -0
- package/_types/index.d.ts +3 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/index.docs.d.ts +4 -0
- package/_types/index.docs.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/core/Block.ts +16 -1
- package/core/Signature.ts +1 -1
- package/core/internal/abiParameters.ts +19 -2
- package/core/internal/entropy.ts +1 -1
- package/core/internal/rpcSchemas/eth.ts +45 -9
- package/erc6492/WrappedSignature/package.json +6 -0
- package/erc6492/WrappedSignature.ts +205 -0
- package/erc6492/index.ts +28 -0
- package/erc6492/package.json +6 -0
- package/index.docs/package.json +6 -0
- package/index.docs.ts +4 -0
- package/index.ts +5 -1
- package/package.json +16 -1
- package/version.ts +1 -1
- package/trusted-setups/Paths.test.ts +0 -10
- package/trusted-setups/index.test.ts +0 -10
package/_types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** @entrypointCategory Core */
|
|
2
|
+
export type {};
|
|
1
3
|
/**
|
|
2
4
|
* Utilities & types for working with [Application Binary Interfaces (ABIs)](https://docs.soliditylang.org/en/latest/abi-spec.html)
|
|
3
5
|
*
|
|
@@ -973,7 +975,7 @@ export * as Block from './core/Block.js';
|
|
|
973
975
|
*/
|
|
974
976
|
export * as Bloom from './core/Bloom.js';
|
|
975
977
|
/**
|
|
976
|
-
* Utility functions for [BLS12-381](https://hackmd.io
|
|
978
|
+
* Utility functions for [BLS12-381](https://hackmd.io/\@benjaminion/bls12-381) cryptography.
|
|
977
979
|
*
|
|
978
980
|
* :::info
|
|
979
981
|
*
|
package/_types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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":"index.docs.d.ts","sourceRoot":"","sources":["../index.docs.ts"],"names":[],"mappings":"AACA,2FAA2F;AAC3F,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA"}
|
package/_types/version.d.ts
CHANGED
package/core/Block.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type * as Errors from './Errors.js'
|
|
|
3
3
|
import * as Hex from './Hex.js'
|
|
4
4
|
import * as Transaction from './Transaction.js'
|
|
5
5
|
import * as Withdrawal from './Withdrawal.js'
|
|
6
|
-
import type { Compute } from './internal/types.js'
|
|
6
|
+
import type { Compute, OneOf } from './internal/types.js'
|
|
7
7
|
|
|
8
8
|
/** A Block as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/block.yaml). */
|
|
9
9
|
export type Block<
|
|
@@ -78,6 +78,21 @@ export type Block<
|
|
|
78
78
|
/** A Block hash. */
|
|
79
79
|
export type Hash = Hex.Hex
|
|
80
80
|
|
|
81
|
+
/** A Block identifier. */
|
|
82
|
+
export type Identifier<bigintType = bigint> = {
|
|
83
|
+
/** Whether or not to throw an error if the block is not in the canonical chain as described below. Only allowed in conjunction with the blockHash tag. Defaults to false. */
|
|
84
|
+
requireCanonical?: boolean | undefined
|
|
85
|
+
} & OneOf<
|
|
86
|
+
| {
|
|
87
|
+
/** The block in the canonical chain with this number */
|
|
88
|
+
blockNumber: Number<bigintType>
|
|
89
|
+
}
|
|
90
|
+
| {
|
|
91
|
+
/** The block uniquely identified by this hash. The `blockNumber` and `blockHash` properties are mutually exclusive; exactly one of them must be set. */
|
|
92
|
+
blockHash: Hash
|
|
93
|
+
}
|
|
94
|
+
>
|
|
95
|
+
|
|
81
96
|
/** A Block number. */
|
|
82
97
|
export type Number<bigintType = bigint> = bigintType
|
|
83
98
|
|
package/core/Signature.ts
CHANGED
|
@@ -527,7 +527,7 @@ export function toHex(signature: Signature<boolean>): Hex.Hex {
|
|
|
527
527
|
Hex.fromNumber(s, { size: 32 }),
|
|
528
528
|
// If the signature is recovered, add the recovery byte to the signature.
|
|
529
529
|
typeof signature.yParity === 'number'
|
|
530
|
-
? Hex.fromNumber(signature.yParity, { size: 1 })
|
|
530
|
+
? Hex.fromNumber(yParityToV(signature.yParity), { size: 1 })
|
|
531
531
|
: '0x',
|
|
532
532
|
)
|
|
533
533
|
|
|
@@ -9,6 +9,7 @@ import * as Address from '../Address.js'
|
|
|
9
9
|
import * as Bytes from '../Bytes.js'
|
|
10
10
|
import * as Errors from '../Errors.js'
|
|
11
11
|
import * as Hex from '../Hex.js'
|
|
12
|
+
import { integerRegex } from '../Solidity.js'
|
|
12
13
|
import type * as Cursor from './cursor.js'
|
|
13
14
|
import type { Compute, IsNarrowable, UnionToIntersection } from './types.js'
|
|
14
15
|
|
|
@@ -433,7 +434,11 @@ export function prepareParameter<
|
|
|
433
434
|
}
|
|
434
435
|
if (parameter.type.startsWith('uint') || parameter.type.startsWith('int')) {
|
|
435
436
|
const signed = parameter.type.startsWith('int')
|
|
436
|
-
|
|
437
|
+
const [, , size = '256'] = integerRegex.exec(parameter.type) ?? []
|
|
438
|
+
return encodeNumber(value as unknown as number, {
|
|
439
|
+
signed,
|
|
440
|
+
size: Number(size),
|
|
441
|
+
})
|
|
437
442
|
}
|
|
438
443
|
if (parameter.type.startsWith('bytes')) {
|
|
439
444
|
return encodeBytes(value as unknown as Hex.Hex, { type: parameter.type })
|
|
@@ -630,8 +635,20 @@ export declare namespace encodeBoolean {
|
|
|
630
635
|
/** @internal */
|
|
631
636
|
export function encodeNumber(
|
|
632
637
|
value: number,
|
|
633
|
-
{ signed }: { signed: boolean },
|
|
638
|
+
{ signed, size }: { signed: boolean; size: number },
|
|
634
639
|
): PreparedParameter {
|
|
640
|
+
if (typeof size === 'number') {
|
|
641
|
+
const max = 2n ** (BigInt(size) - (signed ? 1n : 0n)) - 1n
|
|
642
|
+
const min = signed ? -max - 1n : 0n
|
|
643
|
+
if (value > max || value < min)
|
|
644
|
+
throw new Hex.IntegerOutOfRangeError({
|
|
645
|
+
max: max.toString(),
|
|
646
|
+
min: min.toString(),
|
|
647
|
+
signed,
|
|
648
|
+
size: size / 8,
|
|
649
|
+
value: value.toString(),
|
|
650
|
+
})
|
|
651
|
+
}
|
|
635
652
|
return {
|
|
636
653
|
dynamic: false,
|
|
637
654
|
encoded: Hex.fromNumber(value, {
|
package/core/internal/entropy.ts
CHANGED
|
@@ -98,11 +98,19 @@ export type Eth = RpcSchema.From<
|
|
|
98
98
|
| [transaction: TransactionRequest.Rpc]
|
|
99
99
|
| [
|
|
100
100
|
transaction: TransactionRequest.Rpc,
|
|
101
|
-
block:
|
|
101
|
+
block:
|
|
102
|
+
| Block.Number<Hex.Hex>
|
|
103
|
+
| Block.Tag
|
|
104
|
+
| Block.Hash
|
|
105
|
+
| Block.Identifier,
|
|
102
106
|
]
|
|
103
107
|
| [
|
|
104
108
|
transaction: TransactionRequest.Rpc,
|
|
105
|
-
block:
|
|
109
|
+
block:
|
|
110
|
+
| Block.Number<Hex.Hex>
|
|
111
|
+
| Block.Tag
|
|
112
|
+
| Block.Hash
|
|
113
|
+
| Block.Identifier,
|
|
106
114
|
// TODO: add type
|
|
107
115
|
stateOverride: unknown,
|
|
108
116
|
]
|
|
@@ -160,11 +168,19 @@ export type Eth = RpcSchema.From<
|
|
|
160
168
|
| [transaction: TransactionRequest.Rpc]
|
|
161
169
|
| [
|
|
162
170
|
transaction: TransactionRequest.Rpc,
|
|
163
|
-
block:
|
|
171
|
+
block:
|
|
172
|
+
| Block.Number<Hex.Hex>
|
|
173
|
+
| Block.Tag
|
|
174
|
+
| Block.Hash
|
|
175
|
+
| Block.Identifier,
|
|
164
176
|
]
|
|
165
177
|
| [
|
|
166
178
|
transaction: TransactionRequest.Rpc,
|
|
167
|
-
block:
|
|
179
|
+
block:
|
|
180
|
+
| Block.Number<Hex.Hex>
|
|
181
|
+
| Block.Tag
|
|
182
|
+
| Block.Hash
|
|
183
|
+
| Block.Identifier,
|
|
168
184
|
// TODO: add type
|
|
169
185
|
stateOverride: unknown,
|
|
170
186
|
]
|
|
@@ -230,7 +246,11 @@ export type Eth = RpcSchema.From<
|
|
|
230
246
|
method: 'eth_getBalance'
|
|
231
247
|
params: [
|
|
232
248
|
address: Address.Address,
|
|
233
|
-
block:
|
|
249
|
+
block:
|
|
250
|
+
| Block.Number<Hex.Hex>
|
|
251
|
+
| Block.Tag
|
|
252
|
+
| Block.Hash
|
|
253
|
+
| Block.Identifier,
|
|
234
254
|
]
|
|
235
255
|
}
|
|
236
256
|
ReturnType: Hex.Hex
|
|
@@ -330,7 +350,11 @@ export type Eth = RpcSchema.From<
|
|
|
330
350
|
method: 'eth_getCode'
|
|
331
351
|
params: [
|
|
332
352
|
address: Address.Address,
|
|
333
|
-
block:
|
|
353
|
+
block:
|
|
354
|
+
| Block.Number<Hex.Hex>
|
|
355
|
+
| Block.Tag
|
|
356
|
+
| Block.Hash
|
|
357
|
+
| Block.Identifier,
|
|
334
358
|
]
|
|
335
359
|
}
|
|
336
360
|
ReturnType: Hex.Hex
|
|
@@ -403,7 +427,11 @@ export type Eth = RpcSchema.From<
|
|
|
403
427
|
/** An array of storage-keys that should be proofed and included. */
|
|
404
428
|
storageKeys: Hex.Hex[],
|
|
405
429
|
/** Block identifier to pull the proof from. */
|
|
406
|
-
block:
|
|
430
|
+
block:
|
|
431
|
+
| Block.Number<Hex.Hex>
|
|
432
|
+
| Block.Tag
|
|
433
|
+
| Block.Hash
|
|
434
|
+
| Block.Identifier,
|
|
407
435
|
]
|
|
408
436
|
}
|
|
409
437
|
ReturnType: AccountProof.Rpc
|
|
@@ -423,7 +451,11 @@ export type Eth = RpcSchema.From<
|
|
|
423
451
|
params: [
|
|
424
452
|
address: Address.Address,
|
|
425
453
|
index: Hex.Hex,
|
|
426
|
-
block:
|
|
454
|
+
block:
|
|
455
|
+
| Block.Number<Hex.Hex>
|
|
456
|
+
| Block.Tag
|
|
457
|
+
| Block.Hash
|
|
458
|
+
| Block.Identifier,
|
|
427
459
|
]
|
|
428
460
|
}
|
|
429
461
|
ReturnType: Hex.Hex
|
|
@@ -490,7 +522,11 @@ export type Eth = RpcSchema.From<
|
|
|
490
522
|
method: 'eth_getTransactionCount'
|
|
491
523
|
params: [
|
|
492
524
|
address: Address.Address,
|
|
493
|
-
block:
|
|
525
|
+
block:
|
|
526
|
+
| Block.Number<Hex.Hex>
|
|
527
|
+
| Block.Tag
|
|
528
|
+
| Block.Hash
|
|
529
|
+
| Block.Identifier,
|
|
494
530
|
]
|
|
495
531
|
}
|
|
496
532
|
ReturnType: Hex.Hex
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import * as AbiParameters from '../core/AbiParameters.js'
|
|
2
|
+
import type * as Address from '../core/Address.js'
|
|
3
|
+
import * as Errors from '../core/Errors.js'
|
|
4
|
+
import * as Hex from '../core/Hex.js'
|
|
5
|
+
import * as Signature from '../core/Signature.js'
|
|
6
|
+
|
|
7
|
+
/** ERC-6492 Wrapped Signature. */
|
|
8
|
+
export type WrappedSignature = {
|
|
9
|
+
/** Calldata to pass to the target address for counterfactual verification. */
|
|
10
|
+
data: Hex.Hex
|
|
11
|
+
/** The original signature. */
|
|
12
|
+
signature: Signature.Signature
|
|
13
|
+
/** The target address to use for counterfactual verification. */
|
|
14
|
+
to: Address.Address
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Magic bytes used to identify ERC-6492 wrapped signatures.
|
|
19
|
+
*/
|
|
20
|
+
export const magicBytes =
|
|
21
|
+
'0x6492649264926492649264926492649264926492649264926492649264926492' as const
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Asserts that the wrapped signature is valid.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts twoslash
|
|
28
|
+
* import { WrappedSignature } from 'ox/erc6492'
|
|
29
|
+
*
|
|
30
|
+
* WrappedSignature.assert('0xdeadbeef')
|
|
31
|
+
* // @error: InvalidWrappedSignatureError: Value `0xdeadbeef` is an invalid ERC-6492 wrapped signature.
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param wrapped - The wrapped signature to assert.
|
|
35
|
+
*/
|
|
36
|
+
export function assert(wrapped: Hex.Hex) {
|
|
37
|
+
if (Hex.slice(wrapped, -32) !== magicBytes)
|
|
38
|
+
throw new InvalidWrappedSignatureError(wrapped)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare namespace assert {
|
|
42
|
+
type ErrorType =
|
|
43
|
+
| InvalidWrappedSignatureError
|
|
44
|
+
| Hex.slice.ErrorType
|
|
45
|
+
| Errors.GlobalErrorType
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Parses an [ERC-6492 wrapped signature](https://eips.ethereum.org/EIPS/eip-6492#specification) into its constituent parts.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts twoslash
|
|
53
|
+
* // @noErrors
|
|
54
|
+
* import { Secp256k1 } from 'ox'
|
|
55
|
+
* import { WrappedSignature } from 'ox/erc6492' // [!code focus]
|
|
56
|
+
*
|
|
57
|
+
* const signature = Secp256k1.sign({
|
|
58
|
+
* payload: '0x...',
|
|
59
|
+
* privateKey: '0x...',
|
|
60
|
+
* })
|
|
61
|
+
*
|
|
62
|
+
* // Instantiate from serialized format. // [!code focus]
|
|
63
|
+
* const wrapped = WrappedSignature.from('0x...') // [!code focus]
|
|
64
|
+
* // @log: { data: '0x...', signature: { ... }, to: '0x...', } // [!code focus]
|
|
65
|
+
*
|
|
66
|
+
* // Instantiate from constituent parts. // [!code focus]
|
|
67
|
+
* const wrapped = WrappedSignature.from({ // [!code focus]
|
|
68
|
+
* data: '0x...', // [!code focus]
|
|
69
|
+
* signature, // [!code focus]
|
|
70
|
+
* to: '0x...', // [!code focus]
|
|
71
|
+
* })
|
|
72
|
+
* // @log: { data: '0x...', signature: { ... }, to: '0x...', }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @param wrapped - Wrapped signature to parse.
|
|
76
|
+
* @returns Wrapped signature.
|
|
77
|
+
*/
|
|
78
|
+
export function from(wrapped: WrappedSignature | Hex.Hex): WrappedSignature {
|
|
79
|
+
if (typeof wrapped === 'string') return fromHex(wrapped)
|
|
80
|
+
return wrapped
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export declare namespace from {
|
|
84
|
+
type ReturnType = WrappedSignature
|
|
85
|
+
|
|
86
|
+
type ErrorType =
|
|
87
|
+
| AbiParameters.from.ErrorType
|
|
88
|
+
| AbiParameters.decode.ErrorType
|
|
89
|
+
| Signature.fromHex.ErrorType
|
|
90
|
+
| Errors.GlobalErrorType
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Parses an [ERC-6492 wrapped signature](https://eips.ethereum.org/EIPS/eip-6492#specification) into its constituent parts.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts twoslash
|
|
98
|
+
* import { WrappedSignature } from 'ox/erc6492'
|
|
99
|
+
*
|
|
100
|
+
* const { data, signature, to } = WrappedSignature.fromHex('0x...')
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* @param wrapped - Wrapped signature to parse.
|
|
104
|
+
* @returns Wrapped signature.
|
|
105
|
+
*/
|
|
106
|
+
export function fromHex(wrapped: Hex.Hex): WrappedSignature {
|
|
107
|
+
assert(wrapped)
|
|
108
|
+
|
|
109
|
+
const [to, data, signature_hex] = AbiParameters.decode(
|
|
110
|
+
AbiParameters.from('address, bytes, bytes'),
|
|
111
|
+
wrapped,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
const signature = Signature.fromHex(signature_hex)
|
|
115
|
+
|
|
116
|
+
return { data, signature, to }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export declare namespace fromHex {
|
|
120
|
+
type ErrorType =
|
|
121
|
+
| AbiParameters.from.ErrorType
|
|
122
|
+
| AbiParameters.decode.ErrorType
|
|
123
|
+
| Signature.fromHex.ErrorType
|
|
124
|
+
| Errors.GlobalErrorType
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Serializes an [ERC-6492 wrapped signature](https://eips.ethereum.org/EIPS/eip-6492#specification).
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts twoslash
|
|
132
|
+
* import { Secp256k1 } from 'ox'
|
|
133
|
+
* import { WrappedSignature } from 'ox/erc6492' // [!code focus]
|
|
134
|
+
*
|
|
135
|
+
* const signature = Secp256k1.sign({
|
|
136
|
+
* payload: '0x...',
|
|
137
|
+
* privateKey: '0x...',
|
|
138
|
+
* })
|
|
139
|
+
*
|
|
140
|
+
* const wrapped = WrappedSignature.toHex({ // [!code focus]
|
|
141
|
+
* data: '0xdeadbeef', // [!code focus]
|
|
142
|
+
* signature, // [!code focus]
|
|
143
|
+
* to: '0x00000000219ab540356cBB839Cbe05303d7705Fa', // [!code focus]
|
|
144
|
+
* }) // [!code focus]
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @param value - Wrapped signature to serialize.
|
|
148
|
+
* @returns Serialized wrapped signature.
|
|
149
|
+
*/
|
|
150
|
+
export function toHex(value: WrappedSignature): Hex.Hex {
|
|
151
|
+
const { data, signature, to } = value
|
|
152
|
+
|
|
153
|
+
return Hex.concat(
|
|
154
|
+
AbiParameters.encode(AbiParameters.from('address, bytes, bytes'), [
|
|
155
|
+
to,
|
|
156
|
+
data,
|
|
157
|
+
Signature.toHex(signature),
|
|
158
|
+
]),
|
|
159
|
+
magicBytes,
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export declare namespace toHex {
|
|
164
|
+
type ErrorType =
|
|
165
|
+
| AbiParameters.encode.ErrorType
|
|
166
|
+
| Hex.concat.ErrorType
|
|
167
|
+
| Signature.toHex.ErrorType
|
|
168
|
+
| Errors.GlobalErrorType
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Validates a wrapped signature. Returns `true` if the wrapped signature is valid, `false` otherwise.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts twoslash
|
|
176
|
+
* import { WrappedSignature } from 'ox/erc6492'
|
|
177
|
+
*
|
|
178
|
+
* const valid = WrappedSignature.validate('0xdeadbeef')
|
|
179
|
+
* // @log: false
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @param wrapped - The wrapped signature to validate.
|
|
183
|
+
* @returns `true` if the wrapped signature is valid, `false` otherwise.
|
|
184
|
+
*/
|
|
185
|
+
export function validate(wrapped: Hex.Hex): boolean {
|
|
186
|
+
try {
|
|
187
|
+
assert(wrapped)
|
|
188
|
+
return true
|
|
189
|
+
} catch {
|
|
190
|
+
return false
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export declare namespace validate {
|
|
195
|
+
type ErrorType = Errors.GlobalErrorType
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** Thrown when the ERC-6492 wrapped signature is invalid. */
|
|
199
|
+
export class InvalidWrappedSignatureError extends Errors.BaseError {
|
|
200
|
+
override readonly name = 'WrappedSignature.InvalidWrappedSignatureError'
|
|
201
|
+
|
|
202
|
+
constructor(wrapped: Hex.Hex) {
|
|
203
|
+
super(`Value \`${wrapped}\` is an invalid ERC-6492 wrapped signature.`)
|
|
204
|
+
}
|
|
205
|
+
}
|
package/erc6492/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @entrypointCategory ERCs */
|
|
2
|
+
// biome-ignore lint/complexity/noUselessEmptyExport: tsdoc
|
|
3
|
+
export type {}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Utility functions for working with [ERC-6492 wrapped signatures](https://eips.ethereum.org/EIPS/eip-6492#specification).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts twoslash
|
|
10
|
+
* import { Secp256k1, PersonalMessage } from 'ox'
|
|
11
|
+
* import { WrappedSignature } from 'ox/erc6492' // [!code focus]
|
|
12
|
+
*
|
|
13
|
+
* const signature = Secp256k1.sign({
|
|
14
|
+
* payload: PersonalMessage.getSignPayload('0xdeadbeef'),
|
|
15
|
+
* privateKey: '0x...',
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* const wrapped = WrappedSignature.toHex({ // [!code focus]
|
|
19
|
+
* data: '0xcafebabe', // [!code focus]
|
|
20
|
+
* signature, // [!code focus]
|
|
21
|
+
* to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code focus]
|
|
22
|
+
* }) // [!code focus]
|
|
23
|
+
* // @log: '0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041fa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d01c000000000000000000000000000000000000000000000000000000000000006492649264926492649264926492649264926492649264926492649264926492'
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @category ERC-6492
|
|
27
|
+
*/
|
|
28
|
+
export * as WrappedSignature from './WrappedSignature.js'
|
package/index.docs.ts
ADDED
package/index.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** @entrypointCategory Core */
|
|
2
|
+
// biome-ignore lint/complexity/noUselessEmptyExport: tsdoc
|
|
3
|
+
export type {}
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Utilities & types for working with [Application Binary Interfaces (ABIs)](https://docs.soliditylang.org/en/latest/abi-spec.html)
|
|
3
7
|
*
|
|
@@ -990,7 +994,7 @@ export * as Block from './core/Block.js'
|
|
|
990
994
|
export * as Bloom from './core/Bloom.js'
|
|
991
995
|
|
|
992
996
|
/**
|
|
993
|
-
* Utility functions for [BLS12-381](https://hackmd.io
|
|
997
|
+
* Utility functions for [BLS12-381](https://hackmd.io/\@benjaminion/bls12-381) cryptography.
|
|
994
998
|
*
|
|
995
999
|
* :::info
|
|
996
1000
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ox",
|
|
3
3
|
"description": "Ethereum Standard Library",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"main": "./_cjs/index.js",
|
|
6
6
|
"module": "./_esm/index.js",
|
|
7
7
|
"types": "./_types/index.d.ts",
|
|
@@ -357,6 +357,21 @@
|
|
|
357
357
|
"import": "./_esm/core/Withdrawal.js",
|
|
358
358
|
"default": "./_cjs/core/Withdrawal.js"
|
|
359
359
|
},
|
|
360
|
+
"./erc6492/WrappedSignature": {
|
|
361
|
+
"types": "./_types/erc6492/WrappedSignature.d.ts",
|
|
362
|
+
"import": "./_esm/erc6492/WrappedSignature.js",
|
|
363
|
+
"default": "./_cjs/erc6492/WrappedSignature.js"
|
|
364
|
+
},
|
|
365
|
+
"./erc6492": {
|
|
366
|
+
"types": "./_types/erc6492/index.d.ts",
|
|
367
|
+
"import": "./_esm/erc6492/index.js",
|
|
368
|
+
"default": "./_cjs/erc6492/index.js"
|
|
369
|
+
},
|
|
370
|
+
"./index.docs": {
|
|
371
|
+
"types": "./_types/index.docs.d.ts",
|
|
372
|
+
"import": "./_esm/index.docs.js",
|
|
373
|
+
"default": "./_cjs/index.docs.js"
|
|
374
|
+
},
|
|
360
375
|
".": {
|
|
361
376
|
"types": "./_types/index.d.ts",
|
|
362
377
|
"import": "./_esm/index.js",
|
package/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '0.
|
|
2
|
+
export const version = '0.4.1'
|