ox 0.8.9 → 0.9.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 +19 -0
- package/_cjs/core/AbiEvent.js +1 -1
- package/_cjs/core/AbiEvent.js.map +1 -1
- package/_cjs/core/AbiItem.js +1 -1
- package/_cjs/core/AbiItem.js.map +1 -1
- package/_cjs/core/AbiParameters.js +4 -4
- package/_cjs/core/AbiParameters.js.map +1 -1
- package/_cjs/core/Authorization.js.map +1 -1
- package/_cjs/core/Blobs.js +1 -1
- package/_cjs/core/Blobs.js.map +1 -1
- package/_cjs/core/Block.js.map +1 -1
- package/_cjs/core/Bytes.js +1 -1
- package/_cjs/core/Bytes.js.map +1 -1
- package/_cjs/core/ContractAddress.js.map +1 -1
- package/_cjs/core/HdKey.js.map +1 -1
- package/_cjs/core/Hex.js +1 -1
- package/_cjs/core/Hex.js.map +1 -1
- package/_cjs/core/Keystore.js.map +1 -1
- package/_cjs/core/Mnemonic.js +2 -2
- package/_cjs/core/Mnemonic.js.map +1 -1
- package/_cjs/core/P256.js +1 -1
- package/_cjs/core/P256.js.map +1 -1
- package/_cjs/core/Provider.js.map +1 -1
- package/_cjs/core/PublicKey.js +1 -1
- package/_cjs/core/PublicKey.js.map +1 -1
- package/_cjs/core/RpcTransport.js +1 -1
- package/_cjs/core/RpcTransport.js.map +1 -1
- package/_cjs/core/Secp256k1.js +1 -1
- package/_cjs/core/Secp256k1.js.map +1 -1
- package/_cjs/core/Signature.js.map +1 -1
- package/_cjs/core/Siwe.js +4 -4
- package/_cjs/core/Siwe.js.map +1 -1
- package/_cjs/core/Transaction.js.map +1 -1
- package/_cjs/core/TransactionEnvelope.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip1559.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip2930.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip4844.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip7702.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeLegacy.js.map +1 -1
- package/_cjs/core/TransactionReceipt.js.map +1 -1
- package/_cjs/core/TypedData.js +3 -3
- package/_cjs/core/TypedData.js.map +1 -1
- package/_cjs/core/WebAuthnP256.js +1 -1
- package/_cjs/core/WebAuthnP256.js.map +1 -1
- package/_cjs/core/WebCryptoP256.js.map +1 -1
- package/_cjs/core/internal/abiParameters.js +4 -4
- package/_cjs/core/internal/abiParameters.js.map +1 -1
- package/_cjs/core/internal/promise.js.map +1 -1
- package/_cjs/erc4337/UserOperation.js.map +1 -1
- package/_cjs/erc6492/{WrappedSignature.js → SignatureErc6492.js} +9 -11
- package/_cjs/erc6492/SignatureErc6492.js.map +1 -0
- package/_cjs/erc6492/index.js +2 -2
- package/_cjs/erc8010/SignatureErc8010.js +93 -0
- package/_cjs/erc8010/SignatureErc8010.js.map +1 -0
- package/_cjs/erc8010/index.js +5 -0
- package/_cjs/erc8010/index.js.map +1 -0
- package/_cjs/index.docs.js +1 -0
- package/_cjs/index.docs.js.map +1 -1
- package/_cjs/index.js +6 -6
- package/_cjs/index.js.map +1 -1
- package/_cjs/trusted-setups/internal/paths.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/core/AbiEvent.js +1 -1
- package/_esm/core/AbiEvent.js.map +1 -1
- package/_esm/core/AbiItem.js +1 -1
- package/_esm/core/AbiItem.js.map +1 -1
- package/_esm/core/AbiParameters.js +4 -4
- package/_esm/core/AbiParameters.js.map +1 -1
- package/_esm/core/Authorization.js.map +1 -1
- package/_esm/core/Blobs.js +1 -1
- package/_esm/core/Blobs.js.map +1 -1
- package/_esm/core/Block.js.map +1 -1
- package/_esm/core/Bytes.js +1 -1
- package/_esm/core/Bytes.js.map +1 -1
- package/_esm/core/ContractAddress.js.map +1 -1
- package/_esm/core/HdKey.js.map +1 -1
- package/_esm/core/Hex.js +1 -1
- package/_esm/core/Hex.js.map +1 -1
- package/_esm/core/Keystore.js +3 -2
- package/_esm/core/Keystore.js.map +1 -1
- package/_esm/core/Mnemonic.js +1 -1
- package/_esm/core/Mnemonic.js.map +1 -1
- package/_esm/core/P256.js +1 -1
- package/_esm/core/P256.js.map +1 -1
- package/_esm/core/Provider.js.map +1 -1
- package/_esm/core/PublicKey.js +1 -1
- package/_esm/core/PublicKey.js.map +1 -1
- package/_esm/core/RpcTransport.js +1 -1
- package/_esm/core/RpcTransport.js.map +1 -1
- package/_esm/core/Secp256k1.js +1 -1
- package/_esm/core/Secp256k1.js.map +1 -1
- package/_esm/core/Signature.js.map +1 -1
- package/_esm/core/Siwe.js +4 -4
- package/_esm/core/Siwe.js.map +1 -1
- package/_esm/core/Transaction.js.map +1 -1
- package/_esm/core/TransactionEnvelope.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip1559.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip2930.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip4844.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip7702.js.map +1 -1
- package/_esm/core/TransactionEnvelopeLegacy.js.map +1 -1
- package/_esm/core/TransactionReceipt.js.map +1 -1
- package/_esm/core/TypedData.js +3 -3
- package/_esm/core/TypedData.js.map +1 -1
- package/_esm/core/WebAuthnP256.js +1 -1
- package/_esm/core/WebAuthnP256.js.map +1 -1
- package/_esm/core/WebCryptoP256.js.map +1 -1
- package/_esm/core/internal/abiParameters.js +4 -4
- package/_esm/core/internal/abiParameters.js.map +1 -1
- package/_esm/core/internal/promise.js.map +1 -1
- package/_esm/erc4337/UserOperation.js.map +1 -1
- package/_esm/erc6492/{WrappedSignature.js → SignatureErc6492.js} +18 -20
- package/_esm/erc6492/SignatureErc6492.js.map +1 -0
- package/_esm/erc6492/index.js +3 -3
- package/_esm/erc8010/SignatureErc8010.js +182 -0
- package/_esm/erc8010/SignatureErc8010.js.map +1 -0
- package/_esm/erc8010/index.js +40 -0
- package/_esm/erc8010/index.js.map +1 -0
- package/_esm/index.docs.js +2 -0
- package/_esm/index.docs.js.map +1 -1
- package/_esm/index.js +236 -236
- package/_esm/index.js.map +1 -1
- package/_esm/trusted-setups/internal/paths.js +1 -0
- package/_esm/trusted-setups/internal/paths.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/core/AbiEvent.d.ts +1 -2
- package/_types/core/AbiEvent.d.ts.map +1 -1
- package/_types/core/AbiParameters.d.ts.map +1 -1
- package/_types/core/Authorization.d.ts +1 -1
- package/_types/core/Authorization.d.ts.map +1 -1
- package/_types/core/Blobs.d.ts +1 -1
- package/_types/core/Blobs.d.ts.map +1 -1
- package/_types/core/Block.d.ts +1 -1
- package/_types/core/Block.d.ts.map +1 -1
- package/_types/core/Bytes.d.ts.map +1 -1
- package/_types/core/ContractAddress.d.ts +1 -1
- package/_types/core/ContractAddress.d.ts.map +1 -1
- package/_types/core/HdKey.d.ts +1 -1
- package/_types/core/HdKey.d.ts.map +1 -1
- package/_types/core/Hex.d.ts.map +1 -1
- package/_types/core/Keystore.d.ts.map +1 -1
- package/_types/core/Mnemonic.d.ts +1 -1
- package/_types/core/Mnemonic.d.ts.map +1 -1
- package/_types/core/P256.d.ts.map +1 -1
- package/_types/core/Provider.d.ts +2 -2
- package/_types/core/Provider.d.ts.map +1 -1
- package/_types/core/PublicKey.d.ts.map +1 -1
- package/_types/core/RpcRequest.d.ts +1 -1
- package/_types/core/RpcRequest.d.ts.map +1 -1
- package/_types/core/RpcTransport.d.ts +2 -2
- package/_types/core/RpcTransport.d.ts.map +1 -1
- package/_types/core/Secp256k1.d.ts +1 -1
- package/_types/core/Secp256k1.d.ts.map +1 -1
- package/_types/core/Signature.d.ts.map +1 -1
- package/_types/core/Siwe.d.ts.map +1 -1
- package/_types/core/Transaction.d.ts +1 -2
- package/_types/core/Transaction.d.ts.map +1 -1
- package/_types/core/TransactionEnvelope.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip1559.d.ts +1 -1
- package/_types/core/TransactionEnvelopeEip1559.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip2930.d.ts +1 -1
- package/_types/core/TransactionEnvelopeEip2930.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip4844.d.ts +1 -1
- package/_types/core/TransactionEnvelopeEip4844.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip7702.d.ts +1 -3
- package/_types/core/TransactionEnvelopeEip7702.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeLegacy.d.ts +1 -1
- package/_types/core/TransactionEnvelopeLegacy.d.ts.map +1 -1
- package/_types/core/TransactionReceipt.d.ts +1 -1
- package/_types/core/TransactionReceipt.d.ts.map +1 -1
- package/_types/core/TypedData.d.ts +1 -1
- package/_types/core/TypedData.d.ts.map +1 -1
- package/_types/core/WebAuthnP256.d.ts +2 -2
- package/_types/core/WebAuthnP256.d.ts.map +1 -1
- package/_types/core/WebCryptoP256.d.ts +1 -1
- package/_types/core/WebCryptoP256.d.ts.map +1 -1
- package/_types/core/internal/abiParameters.d.ts +1 -1
- package/_types/core/internal/abiParameters.d.ts.map +1 -1
- package/_types/core/internal/promise.d.ts.map +1 -1
- package/_types/core/internal/register.d.ts +1 -2
- package/_types/core/internal/register.d.ts.map +1 -1
- package/_types/erc4337/UserOperation.d.ts +1 -1
- package/_types/erc4337/UserOperation.d.ts.map +1 -1
- package/_types/erc6492/{WrappedSignature.d.ts → SignatureErc6492.d.ts} +28 -26
- package/_types/erc6492/SignatureErc6492.d.ts.map +1 -0
- package/_types/erc6492/index.d.ts +3 -3
- package/_types/erc8010/SignatureErc8010.d.ts +138 -0
- package/_types/erc8010/SignatureErc8010.d.ts.map +1 -0
- package/_types/erc8010/index.d.ts +42 -0
- package/_types/erc8010/index.d.ts.map +1 -0
- package/_types/index.d.ts +237 -237
- package/_types/index.d.ts.map +1 -1
- package/_types/index.docs.d.ts +1 -0
- package/_types/index.docs.d.ts.map +1 -1
- package/_types/trusted-setups/internal/paths.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/core/AbiEvent.ts +3 -4
- package/core/AbiItem.ts +1 -1
- package/core/AbiParameters.ts +4 -4
- package/core/Authorization.ts +1 -1
- package/core/Blobs.ts +1 -1
- package/core/Block.ts +1 -1
- package/core/Bytes.ts +1 -1
- package/core/ContractAddress.ts +1 -1
- package/core/HdKey.ts +1 -1
- package/core/Hex.ts +1 -1
- package/core/Keystore.ts +3 -2
- package/core/Mnemonic.ts +1 -1
- package/core/P256.ts +1 -1
- package/core/Provider.ts +2 -2
- package/core/PublicKey.ts +2 -2
- package/core/RpcRequest.ts +1 -1
- package/core/RpcTransport.ts +3 -3
- package/core/Secp256k1.ts +2 -2
- package/core/Signature.ts +1 -1
- package/core/Siwe.ts +4 -5
- package/core/Transaction.ts +1 -2
- package/core/TransactionEnvelope.ts +1 -1
- package/core/TransactionEnvelopeEip1559.ts +3 -3
- package/core/TransactionEnvelopeEip2930.ts +3 -3
- package/core/TransactionEnvelopeEip4844.ts +5 -5
- package/core/TransactionEnvelopeEip7702.ts +6 -5
- package/core/TransactionEnvelopeLegacy.ts +3 -3
- package/core/TransactionReceipt.ts +1 -1
- package/core/TypedData.ts +4 -4
- package/core/WebAuthnP256.ts +2 -2
- package/core/WebCryptoP256.ts +1 -1
- package/core/internal/abiParameters.ts +5 -5
- package/core/internal/promise.ts +3 -1
- package/core/internal/register.ts +1 -2
- package/erc4337/UserOperation.ts +1 -1
- package/erc6492/SignatureErc6492/package.json +6 -0
- package/erc6492/{WrappedSignature.ts → SignatureErc6492.ts} +31 -30
- package/erc6492/index.ts +3 -3
- package/erc8010/SignatureErc8010/package.json +6 -0
- package/erc8010/SignatureErc8010.ts +227 -0
- package/erc8010/index.ts +43 -0
- package/erc8010/package.json +6 -0
- package/index.docs.ts +2 -0
- package/index.ts +237 -261
- package/package.json +15 -5
- package/trusted-setups/internal/paths.ts +1 -0
- package/version.ts +1 -1
- package/_cjs/erc6492/WrappedSignature.js.map +0 -1
- package/_esm/erc6492/WrappedSignature.js.map +0 -1
- package/_types/erc6492/WrappedSignature.d.ts.map +0 -1
- package/erc6492/WrappedSignature/package.json +0 -6
|
@@ -2,16 +2,18 @@ import * as AbiParameters from '../core/AbiParameters.js';
|
|
|
2
2
|
import type * as Address from '../core/Address.js';
|
|
3
3
|
import * as Errors from '../core/Errors.js';
|
|
4
4
|
import * as Hex from '../core/Hex.js';
|
|
5
|
-
import * as Signature from '../core/Signature.js';
|
|
6
|
-
/** ERC-6492
|
|
7
|
-
export type
|
|
5
|
+
import type * as Signature from '../core/Signature.js';
|
|
6
|
+
/** Unwrapped ERC-6492 signature. */
|
|
7
|
+
export type Unwrapped = {
|
|
8
8
|
/** Calldata to pass to the target address for counterfactual verification. */
|
|
9
9
|
data: Hex.Hex;
|
|
10
10
|
/** The original signature. */
|
|
11
|
-
signature:
|
|
11
|
+
signature: Hex.Hex;
|
|
12
12
|
/** The target address to use for counterfactual verification. */
|
|
13
13
|
to: Address.Address;
|
|
14
14
|
};
|
|
15
|
+
/** Wrapped ERC-6492 signature. */
|
|
16
|
+
export type Wrapped = Hex.Hex;
|
|
15
17
|
/**
|
|
16
18
|
* Magic bytes used to identify ERC-6492 wrapped signatures.
|
|
17
19
|
*/
|
|
@@ -61,15 +63,15 @@ export declare const universalSignatureValidatorAbi: readonly [{
|
|
|
61
63
|
*
|
|
62
64
|
* @example
|
|
63
65
|
* ```ts twoslash
|
|
64
|
-
* import {
|
|
66
|
+
* import { SignatureErc6492 } from 'ox/erc6492'
|
|
65
67
|
*
|
|
66
|
-
*
|
|
68
|
+
* SignatureErc6492.assert('0xdeadbeef')
|
|
67
69
|
* // @error: InvalidWrappedSignatureError: Value `0xdeadbeef` is an invalid ERC-6492 wrapped signature.
|
|
68
70
|
* ```
|
|
69
71
|
*
|
|
70
72
|
* @param wrapped - The wrapped signature to assert.
|
|
71
73
|
*/
|
|
72
|
-
export declare function assert(wrapped:
|
|
74
|
+
export declare function assert(wrapped: Wrapped): void;
|
|
73
75
|
export declare namespace assert {
|
|
74
76
|
type ErrorType = InvalidWrappedSignatureError | Hex.slice.ErrorType | Errors.GlobalErrorType;
|
|
75
77
|
}
|
|
@@ -80,7 +82,7 @@ export declare namespace assert {
|
|
|
80
82
|
* ```ts twoslash
|
|
81
83
|
* // @noErrors
|
|
82
84
|
* import { Secp256k1 } from 'ox'
|
|
83
|
-
* import {
|
|
85
|
+
* import { SignatureErc6492 } from 'ox/erc6492' // [!code focus]
|
|
84
86
|
*
|
|
85
87
|
* const signature = Secp256k1.sign({
|
|
86
88
|
* payload: '0x...',
|
|
@@ -88,11 +90,11 @@ export declare namespace assert {
|
|
|
88
90
|
* })
|
|
89
91
|
*
|
|
90
92
|
* // Instantiate from serialized format. // [!code focus]
|
|
91
|
-
* const wrapped =
|
|
93
|
+
* const wrapped = SignatureErc6492.from('0x...') // [!code focus]
|
|
92
94
|
* // @log: { data: '0x...', signature: { ... }, to: '0x...', } // [!code focus]
|
|
93
95
|
*
|
|
94
96
|
* // Instantiate from constituent parts. // [!code focus]
|
|
95
|
-
* const wrapped =
|
|
97
|
+
* const wrapped = SignatureErc6492.from({ // [!code focus]
|
|
96
98
|
* data: '0x...', // [!code focus]
|
|
97
99
|
* signature, // [!code focus]
|
|
98
100
|
* to: '0x...', // [!code focus]
|
|
@@ -103,9 +105,9 @@ export declare namespace assert {
|
|
|
103
105
|
* @param wrapped - Wrapped signature to parse.
|
|
104
106
|
* @returns Wrapped signature.
|
|
105
107
|
*/
|
|
106
|
-
export declare function from(wrapped:
|
|
108
|
+
export declare function from(wrapped: Unwrapped | Wrapped): Unwrapped;
|
|
107
109
|
export declare namespace from {
|
|
108
|
-
type ReturnType =
|
|
110
|
+
type ReturnType = Unwrapped;
|
|
109
111
|
type ErrorType = AbiParameters.from.ErrorType | AbiParameters.decode.ErrorType | Signature.fromHex.ErrorType | Errors.GlobalErrorType;
|
|
110
112
|
}
|
|
111
113
|
/**
|
|
@@ -113,16 +115,16 @@ export declare namespace from {
|
|
|
113
115
|
*
|
|
114
116
|
* @example
|
|
115
117
|
* ```ts twoslash
|
|
116
|
-
* import {
|
|
118
|
+
* import { SignatureErc6492 } from 'ox/erc6492'
|
|
117
119
|
*
|
|
118
|
-
* const { data, signature, to } =
|
|
120
|
+
* const { data, signature, to } = SignatureErc6492.unwrap('0x...')
|
|
119
121
|
* ```
|
|
120
122
|
*
|
|
121
123
|
* @param wrapped - Wrapped signature to parse.
|
|
122
124
|
* @returns Wrapped signature.
|
|
123
125
|
*/
|
|
124
|
-
export declare function
|
|
125
|
-
export declare namespace
|
|
126
|
+
export declare function unwrap(wrapped: Wrapped): Unwrapped;
|
|
127
|
+
export declare namespace unwrap {
|
|
126
128
|
type ErrorType = AbiParameters.from.ErrorType | AbiParameters.decode.ErrorType | Signature.fromHex.ErrorType | Errors.GlobalErrorType;
|
|
127
129
|
}
|
|
128
130
|
/**
|
|
@@ -131,14 +133,14 @@ export declare namespace fromHex {
|
|
|
131
133
|
* @example
|
|
132
134
|
* ```ts twoslash
|
|
133
135
|
* import { Secp256k1 } from 'ox'
|
|
134
|
-
* import {
|
|
136
|
+
* import { SignatureErc6492 } from 'ox/erc6492' // [!code focus]
|
|
135
137
|
*
|
|
136
138
|
* const signature = Secp256k1.sign({
|
|
137
139
|
* payload: '0x...',
|
|
138
140
|
* privateKey: '0x...',
|
|
139
141
|
* })
|
|
140
142
|
*
|
|
141
|
-
* const wrapped =
|
|
143
|
+
* const wrapped = SignatureErc6492.wrap({ // [!code focus]
|
|
142
144
|
* data: '0xdeadbeef', // [!code focus]
|
|
143
145
|
* signature, // [!code focus]
|
|
144
146
|
* to: '0x00000000219ab540356cBB839Cbe05303d7705Fa', // [!code focus]
|
|
@@ -148,8 +150,8 @@ export declare namespace fromHex {
|
|
|
148
150
|
* @param value - Wrapped signature to serialize.
|
|
149
151
|
* @returns Serialized wrapped signature.
|
|
150
152
|
*/
|
|
151
|
-
export declare function
|
|
152
|
-
export declare namespace
|
|
153
|
+
export declare function wrap(value: Unwrapped): Wrapped;
|
|
154
|
+
export declare namespace wrap {
|
|
153
155
|
type ErrorType = AbiParameters.encode.ErrorType | Hex.concat.ErrorType | Signature.toHex.ErrorType | Errors.GlobalErrorType;
|
|
154
156
|
}
|
|
155
157
|
/**
|
|
@@ -157,22 +159,22 @@ export declare namespace toHex {
|
|
|
157
159
|
*
|
|
158
160
|
* @example
|
|
159
161
|
* ```ts twoslash
|
|
160
|
-
* import {
|
|
162
|
+
* import { SignatureErc6492 } from 'ox/erc6492'
|
|
161
163
|
*
|
|
162
|
-
* const valid =
|
|
164
|
+
* const valid = SignatureErc6492.validate('0xdeadbeef')
|
|
163
165
|
* // @log: false
|
|
164
166
|
* ```
|
|
165
167
|
*
|
|
166
168
|
* @param wrapped - The wrapped signature to validate.
|
|
167
169
|
* @returns `true` if the wrapped signature is valid, `false` otherwise.
|
|
168
170
|
*/
|
|
169
|
-
export declare function validate(wrapped:
|
|
171
|
+
export declare function validate(wrapped: Wrapped): boolean;
|
|
170
172
|
export declare namespace validate {
|
|
171
173
|
type ErrorType = Errors.GlobalErrorType;
|
|
172
174
|
}
|
|
173
175
|
/** Thrown when the ERC-6492 wrapped signature is invalid. */
|
|
174
176
|
export declare class InvalidWrappedSignatureError extends Errors.BaseError {
|
|
175
|
-
readonly name = "
|
|
176
|
-
constructor(wrapped:
|
|
177
|
+
readonly name = "SignatureErc6492.InvalidWrappedSignatureError";
|
|
178
|
+
constructor(wrapped: Wrapped);
|
|
177
179
|
}
|
|
178
|
-
//# sourceMappingURL=
|
|
180
|
+
//# sourceMappingURL=SignatureErc6492.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignatureErc6492.d.ts","sourceRoot":"","sources":["../../erc6492/SignatureErc6492.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,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,MAAM,CAAC;IAC9B,KAAK,SAAS,GACV,aAAa,CAAC,IAAI,CAAC,SAAS,GAC5B,aAAa,CAAC,MAAM,CAAC,SAAS,GAC9B,SAAS,CAAC,OAAO,CAAC,SAAS,GAC3B,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAW9C;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAK,SAAS,GACV,aAAa,CAAC,MAAM,CAAC,SAAS,GAC9B,GAAG,CAAC,MAAM,CAAC,SAAS,GACpB,SAAS,CAAC,KAAK,CAAC,SAAS,GACzB,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAOlD;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC;AAED,6DAA6D;AAC7D,qBAAa,4BAA6B,SAAQ,MAAM,CAAC,SAAS;IAChE,SAAkB,IAAI,mDAAkD;gBAE5D,OAAO,EAAE,OAAO;CAG7B"}
|
|
@@ -6,14 +6,14 @@ export type {};
|
|
|
6
6
|
* @example
|
|
7
7
|
* ```ts twoslash
|
|
8
8
|
* import { Secp256k1, PersonalMessage } from 'ox'
|
|
9
|
-
* import {
|
|
9
|
+
* import { SignatureErc6492 } from 'ox/erc6492' // [!code focus]
|
|
10
10
|
*
|
|
11
11
|
* const signature = Secp256k1.sign({
|
|
12
12
|
* payload: PersonalMessage.getSignPayload('0xdeadbeef'),
|
|
13
13
|
* privateKey: '0x...',
|
|
14
14
|
* })
|
|
15
15
|
*
|
|
16
|
-
* const wrapped =
|
|
16
|
+
* const wrapped = SignatureErc6492.wrap({ // [!code focus]
|
|
17
17
|
* data: '0xcafebabe', // [!code focus]
|
|
18
18
|
* signature, // [!code focus]
|
|
19
19
|
* to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code focus]
|
|
@@ -23,5 +23,5 @@ export type {};
|
|
|
23
23
|
*
|
|
24
24
|
* @category ERC-6492
|
|
25
25
|
*/
|
|
26
|
-
export * as
|
|
26
|
+
export * as SignatureErc6492 from './SignatureErc6492.js';
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import * as Authorization from '../core/Authorization.js';
|
|
2
|
+
import * as Errors from '../core/Errors.js';
|
|
3
|
+
import * as Hex from '../core/Hex.js';
|
|
4
|
+
/** Unwrapped ERC-8010 signature. */
|
|
5
|
+
export type Unwrapped = {
|
|
6
|
+
/** Authorization signed by the delegatee. */
|
|
7
|
+
authorization: Authorization.Authorization<true>;
|
|
8
|
+
/** Data to initialize the delegation. */
|
|
9
|
+
data?: Hex.Hex | undefined;
|
|
10
|
+
/** The original signature. */
|
|
11
|
+
signature: Hex.Hex;
|
|
12
|
+
};
|
|
13
|
+
/** Wrapped ERC-8010 signature. */
|
|
14
|
+
export type Wrapped = Hex.Hex;
|
|
15
|
+
/**
|
|
16
|
+
* Magic bytes used to identify ERC-8010 wrapped signatures.
|
|
17
|
+
*/
|
|
18
|
+
export declare const magicBytes: "0x8010801080108010801080108010801080108010801080108010801080108010";
|
|
19
|
+
/**
|
|
20
|
+
* Asserts that the wrapped signature is valid.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts twoslash
|
|
24
|
+
* import { SignatureErc8010 } from 'ox/erc8010'
|
|
25
|
+
*
|
|
26
|
+
* SignatureErc8010.assert('0xdeadbeef')
|
|
27
|
+
* // @error: InvalidWrappedSignatureError: Value `0xdeadbeef` is an invalid ERC-8010 wrapped signature.
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param value - The value to assert.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assert(value: Unwrapped | Wrapped): void;
|
|
33
|
+
export declare namespace assert {
|
|
34
|
+
type ErrorType = InvalidWrappedSignatureError | Hex.slice.ErrorType | Errors.GlobalErrorType;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parses an [ERC-8010 wrapped signature](https://github.com/jxom/ERCs/blob/16f7e3891fff2e1e9c25dea0485497739db8a816/ERCS/erc-8010.md) into its constituent parts.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts twoslash
|
|
41
|
+
* // @noErrors
|
|
42
|
+
* import { Secp256k1 } from 'ox'
|
|
43
|
+
* import { SignatureErc8010 } from 'ox/erc8010' // [!code focus]
|
|
44
|
+
*
|
|
45
|
+
* const signature = Secp256k1.sign({
|
|
46
|
+
* payload: '0x...',
|
|
47
|
+
* privateKey: '0x...',
|
|
48
|
+
* })
|
|
49
|
+
*
|
|
50
|
+
* // Instantiate from serialized format. // [!code focus]
|
|
51
|
+
* const wrapped = SignatureErc8010.from('0x...') // [!code focus]
|
|
52
|
+
* // @log: { authorization: { ... }, data: '0x...', signature: { ... } } // [!code focus]
|
|
53
|
+
*
|
|
54
|
+
* // Instantiate from constituent parts. // [!code focus]
|
|
55
|
+
* const wrapped = SignatureErc8010.from({ // [!code focus]
|
|
56
|
+
* authorization: { ... }, // [!code focus]
|
|
57
|
+
* data: '0x...', // [!code focus]
|
|
58
|
+
* signature, // [!code focus]
|
|
59
|
+
* })
|
|
60
|
+
* // @log: { authorization: { ... }, data: '0x...', signature: { ... } }
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param value - Value to parse.
|
|
64
|
+
* @returns Parsed value.
|
|
65
|
+
*/
|
|
66
|
+
export declare function from(value: Unwrapped | Wrapped): Unwrapped;
|
|
67
|
+
export declare namespace from {
|
|
68
|
+
type ErrorType = unwrap.ErrorType | Errors.GlobalErrorType;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Unwraps an [ERC-8010 wrapped signature](https://github.com/jxom/ERCs/blob/16f7e3891fff2e1e9c25dea0485497739db8a816/ERCS/erc-8010.md) into its constituent parts.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts twoslash
|
|
75
|
+
* import { SignatureErc8010 } from 'ox/erc8010'
|
|
76
|
+
*
|
|
77
|
+
* const { authorization, data, signature } = SignatureErc8010.unwrap('0x...')
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param wrapped - Wrapped signature to unwrap.
|
|
81
|
+
* @returns Unwrapped signature.
|
|
82
|
+
*/
|
|
83
|
+
export declare function unwrap(wrapped: Wrapped): Unwrapped;
|
|
84
|
+
export declare namespace unwrap {
|
|
85
|
+
type ErrorType = assert.ErrorType | Errors.GlobalErrorType;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Wraps a signature into [ERC-8010 format](https://github.com/jxom/ERCs/blob/16f7e3891fff2e1e9c25dea0485497739db8a816/ERCS/erc-8010.md).
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts twoslash
|
|
92
|
+
* // @noErrors
|
|
93
|
+
* import { Secp256k1 } from 'ox'
|
|
94
|
+
* import { SignatureErc8010 } from 'ox/erc8010' // [!code focus]
|
|
95
|
+
*
|
|
96
|
+
* const signature = Secp256k1.sign({
|
|
97
|
+
* payload: '0x...',
|
|
98
|
+
* privateKey: '0x...',
|
|
99
|
+
* })
|
|
100
|
+
*
|
|
101
|
+
* const wrapped = SignatureErc8010.wrap({ // [!code focus]
|
|
102
|
+
* authorization: { ... }, // [!code focus]
|
|
103
|
+
* data: '0xdeadbeef', // [!code focus]
|
|
104
|
+
* signature, // [!code focus]
|
|
105
|
+
* }) // [!code focus]
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @param value - Values to wrap.
|
|
109
|
+
* @returns Wrapped signature.
|
|
110
|
+
*/
|
|
111
|
+
export declare function wrap(value: Unwrapped): Wrapped;
|
|
112
|
+
export declare namespace wrap {
|
|
113
|
+
type ErrorType = Errors.GlobalErrorType;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Validates a wrapped signature. Returns `true` if the wrapped signature is valid, `false` otherwise.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts twoslash
|
|
120
|
+
* import { SignatureErc8010 } from 'ox/erc8010'
|
|
121
|
+
*
|
|
122
|
+
* const valid = SignatureErc8010.validate('0xdeadbeef')
|
|
123
|
+
* // @log: false
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @param value - The value to validate.
|
|
127
|
+
* @returns `true` if the value is valid, `false` otherwise.
|
|
128
|
+
*/
|
|
129
|
+
export declare function validate(value: Unwrapped | Wrapped): boolean;
|
|
130
|
+
export declare namespace validate {
|
|
131
|
+
type ErrorType = Errors.GlobalErrorType;
|
|
132
|
+
}
|
|
133
|
+
/** Thrown when the ERC-8010 wrapped signature is invalid. */
|
|
134
|
+
export declare class InvalidWrappedSignatureError extends Errors.BaseError {
|
|
135
|
+
readonly name = "SignatureErc8010.InvalidWrappedSignatureError";
|
|
136
|
+
constructor(wrapped: Wrapped);
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=SignatureErc8010.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignatureErc8010.d.ts","sourceRoot":"","sources":["../../erc8010/SignatureErc8010.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAGrC,oCAAoC;AACpC,MAAM,MAAM,SAAS,GAAG;IACtB,6CAA6C;IAC7C,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;IAChD,yCAAyC;IACzC,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,SAAS,CAAA;IAC1B,8BAA8B;IAC9B,SA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Ae,CAAA;CACxC;AAED,6DAA6D;AAC7D,qBAAa,4BAA6B,SAAQ,MAAM,CAAC,SAAS;IAChE,SAAkB,IAAI,mDAAkD;gBAE5D,OAAO,EAAE,OAAO;CAG7B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/** @entrypointCategory ERCs */
|
|
2
|
+
export type {};
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions for working with [ERC-8010 wrapped signatures](https://eips.ethereum.org/EIPS/eip-8010#specification).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts twoslash
|
|
8
|
+
* import { Authorization, Secp256k1, PersonalMessage } from 'ox'
|
|
9
|
+
* import { SignatureErc8010 } from 'ox/erc8010' // [!code focus]
|
|
10
|
+
*
|
|
11
|
+
* const authorization = Authorization.from({
|
|
12
|
+
* address: '0x1234567890abcdef1234567890abcdef12345678',
|
|
13
|
+
* chainId: 1,
|
|
14
|
+
* nonce: 69n,
|
|
15
|
+
* })
|
|
16
|
+
*
|
|
17
|
+
* const authorizationSignature = Secp256k1.sign({
|
|
18
|
+
* payload: Authorization.getSignPayload(authorization),
|
|
19
|
+
* privateKey: '0x...',
|
|
20
|
+
* })
|
|
21
|
+
*
|
|
22
|
+
* const authorizationSigned = Authorization.from(authorization, {
|
|
23
|
+
* signature: authorizationSignature,
|
|
24
|
+
* })
|
|
25
|
+
*
|
|
26
|
+
* const signature = Secp256k1.sign({
|
|
27
|
+
* payload: PersonalMessage.getSignPayload('0xdeadbeef'),
|
|
28
|
+
* privateKey: '0x...',
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* const wrapped = SignatureErc8010.wrap({ // [!code focus]
|
|
32
|
+
* authorization: authorizationSigned, // [!code focus]
|
|
33
|
+
* data: '0xcafebabe', // [!code focus]
|
|
34
|
+
* signature, // [!code focus]
|
|
35
|
+
* }) // [!code focus]
|
|
36
|
+
* // @log: '0x000000000000000000000000cafebabecafebabecafebabecafebabecafebabe000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041fa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d01c000000000000000000000000000000000000000000000000000000000000008010801080108010801080108010801080108010801080108010801080108010'
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @category ERC-8010
|
|
40
|
+
*/
|
|
41
|
+
export * as SignatureErc8010 from './SignatureErc8010.js';
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../erc8010/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,YAAY,EAAE,CAAA;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA"}
|