ox 1.2.0 → 1.3.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/CHANGELOG.md +34 -0
- package/dist/core/AbiFunction.d.ts +1 -1
- package/dist/core/AbiFunction.d.ts.map +1 -1
- package/dist/core/AbiFunction.js +6 -2
- package/dist/core/AbiFunction.js.map +1 -1
- package/dist/core/AbiParameters.d.ts +1 -1
- package/dist/core/AbiParameters.d.ts.map +1 -1
- package/dist/core/AbiParameters.js +1 -13
- package/dist/core/AbiParameters.js.map +1 -1
- package/dist/core/AesGcm.d.ts +36 -1
- package/dist/core/AesGcm.d.ts.map +1 -1
- package/dist/core/AesGcm.js +44 -0
- package/dist/core/AesGcm.js.map +1 -1
- package/dist/core/Ed25519.d.ts +46 -1
- package/dist/core/Ed25519.d.ts.map +1 -1
- package/dist/core/Ed25519.js +43 -0
- package/dist/core/Ed25519.js.map +1 -1
- package/dist/core/Engine.d.ts +1 -1
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Hash.d.ts +164 -1
- package/dist/core/Hash.d.ts.map +1 -1
- package/dist/core/Hash.js +172 -0
- package/dist/core/Hash.js.map +1 -1
- package/dist/core/Hex.d.ts.map +1 -1
- package/dist/core/Hex.js +1 -4
- package/dist/core/Hex.js.map +1 -1
- package/dist/core/Rlp.d.ts +32 -0
- package/dist/core/Rlp.d.ts.map +1 -1
- package/dist/core/Rlp.js +146 -0
- package/dist/core/Rlp.js.map +1 -1
- package/dist/core/Secp256k1.d.ts +46 -1
- package/dist/core/Secp256k1.d.ts.map +1 -1
- package/dist/core/Secp256k1.js +48 -0
- package/dist/core/Secp256k1.js.map +1 -1
- package/dist/core/WebAuthn.d.ts +224 -0
- package/dist/core/WebAuthn.d.ts.map +1 -0
- package/dist/core/WebAuthn.js +343 -0
- package/dist/core/WebAuthn.js.map +1 -0
- package/dist/core/WebAuthnP256.d.ts +46 -50
- package/dist/core/WebAuthnP256.d.ts.map +1 -1
- package/dist/core/WebAuthnP256.js +44 -50
- package/dist/core/WebAuthnP256.js.map +1 -1
- package/dist/core/internal/abiParameters.d.ts +7 -87
- package/dist/core/internal/abiParameters.d.ts.map +1 -1
- package/dist/core/internal/abiParameters.js +339 -194
- package/dist/core/internal/abiParameters.js.map +1 -1
- package/dist/core/internal/engine.d.ts +35 -2
- package/dist/core/internal/engine.d.ts.map +1 -1
- package/dist/core/internal/engine.js +12 -1
- package/dist/core/internal/engine.js.map +1 -1
- package/dist/core/internal/hash.d.ts +10 -0
- package/dist/core/internal/hash.d.ts.map +1 -1
- package/dist/core/internal/hash.js +26 -1
- package/dist/core/internal/hash.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/node/Engine.d.ts +1 -1
- package/dist/node/Engine.d.ts.map +1 -1
- package/dist/node/Engine.js.map +1 -1
- package/dist/node/Hash.d.ts +6 -4
- package/dist/node/Hash.d.ts.map +1 -1
- package/dist/node/Hash.js +35 -3
- package/dist/node/Hash.js.map +1 -1
- package/dist/tempo/AuthorizationTempo.d.ts +6 -6
- package/dist/tempo/AuthorizationTempo.js +6 -6
- package/dist/tempo/KeyAuthorization.d.ts +3 -8
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorization.js +3 -8
- package/dist/tempo/KeyAuthorization.js.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +8 -8
- package/dist/tempo/SignatureEnvelope.js +8 -8
- package/dist/wasm/Engine.d.ts +1 -1
- package/dist/wasm/Engine.d.ts.map +1 -1
- package/dist/wasm/Engine.js.map +1 -1
- package/dist/wasm/Hash.d.ts +1 -1
- package/dist/wasm/Hash.d.ts.map +1 -1
- package/dist/wasm/Hash.js +5 -0
- package/dist/wasm/Hash.js.map +1 -1
- package/dist/wasm/internal/blake3.d.ts +10 -1
- package/dist/wasm/internal/blake3.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.js +12 -1
- package/dist/wasm/internal/blake3.js.map +1 -1
- package/dist/wasm/internal/blake3.wasm.d.ts +3 -1
- package/dist/wasm/internal/blake3.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.wasm.js +3 -1
- package/dist/wasm/internal/blake3.wasm.js.map +1 -1
- package/dist/wasm/internal/hash.d.ts +9 -0
- package/dist/wasm/internal/hash.d.ts.map +1 -1
- package/dist/wasm/internal/hash.js +13 -1
- package/dist/wasm/internal/hash.js.map +1 -1
- package/dist/wasm/internal/hashState.d.ts +25 -0
- package/dist/wasm/internal/hashState.d.ts.map +1 -0
- package/dist/wasm/internal/hashState.js +105 -0
- package/dist/wasm/internal/hashState.js.map +1 -0
- package/dist/wasm/internal/hashes.d.ts +12 -1
- package/dist/wasm/internal/hashes.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.js +18 -1
- package/dist/wasm/internal/hashes.js.map +1 -1
- package/dist/wasm/internal/hashes.wasm.d.ts +11 -3
- package/dist/wasm/internal/hashes.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.wasm.js +11 -3
- package/dist/wasm/internal/hashes.wasm.js.map +1 -1
- package/dist/webauthn/Authentication.d.ts +2 -0
- package/dist/webauthn/Authentication.d.ts.map +1 -1
- package/dist/webauthn/Authentication.js +2 -1
- package/dist/webauthn/Authentication.js.map +1 -1
- package/dist/webauthn/Registration.d.ts.map +1 -1
- package/dist/webauthn/Registration.js +2 -1
- package/dist/webauthn/Registration.js.map +1 -1
- package/dist/webauthn/Types.d.ts +27 -6
- package/dist/webauthn/Types.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.js +35 -9
- package/dist/webauthn/internal/utils.js.map +1 -1
- package/dist/zod/TypedData.d.ts +2 -2
- package/package.json +9 -1
- package/src/benchmarks/Ox.bench.ts +6 -0
- package/src/benchmarks/OxNode.bench.ts +8 -0
- package/src/benchmarks/OxV0.bench.ts +4 -0
- package/src/benchmarks/OxWasm.bench.ts +22 -0
- package/src/core/AbiFunction.ts +5 -5
- package/src/core/AbiParameters.ts +8 -20
- package/src/core/AesGcm.ts +86 -1
- package/src/core/Ed25519.ts +87 -1
- package/src/core/Engine.ts +1 -0
- package/src/core/Hash.ts +262 -1
- package/src/core/Hex.ts +1 -4
- package/src/core/Rlp.ts +172 -5
- package/src/core/Secp256k1.ts +92 -1
- package/src/core/WebAuthn.ts +579 -0
- package/src/core/WebAuthnP256.ts +47 -50
- package/src/core/_test/AbiFunction.test.ts +9 -0
- package/src/core/_test/AbiParameters.differential.fuzz.ts +156 -0
- package/src/core/_test/AbiParameters.encode.test.ts +22 -0
- package/src/core/_test/AbiParameters.fuzz.ts +4 -0
- package/src/core/_test/AesGcm.test.ts +76 -0
- package/src/core/_test/Ed25519.test-d.ts +13 -1
- package/src/core/_test/Ed25519.test.ts +120 -1
- package/src/core/_test/Engine.test-d.ts +9 -0
- package/src/core/_test/Engine.test.ts +1 -1
- package/src/core/_test/Hash.test-d.ts +23 -0
- package/src/core/_test/Hash.test.ts +179 -1
- package/src/core/_test/Hex.test.ts +2 -0
- package/src/core/_test/Rlp.test-d.ts +18 -0
- package/src/core/_test/Rlp.test.ts +109 -0
- package/src/core/_test/Secp256k1.test-d.ts +14 -0
- package/src/core/_test/Secp256k1.test.ts +91 -1
- package/src/core/_test/WebAuthn.test-d.ts +142 -0
- package/src/core/_test/WebAuthn.test.ts +766 -0
- package/src/core/_test/index.test.ts +1 -0
- package/src/core/internal/abiParameters.ts +466 -326
- package/src/core/internal/engine.ts +47 -2
- package/src/core/internal/hash.ts +53 -1
- package/src/index.ts +24 -14
- package/src/node/Engine.ts +1 -0
- package/src/node/Hash.ts +43 -6
- package/src/node/_test/Engine.test-d.ts +1 -0
- package/src/node/_test/Engine.test.ts +2 -0
- package/src/node/_test/Hash.test-d.ts +10 -0
- package/src/node/_test/Hash.test.ts +46 -0
- package/src/tempo/AuthorizationTempo.ts +6 -6
- package/src/tempo/KeyAuthorization.ts +3 -8
- package/src/tempo/SignatureEnvelope.ts +8 -8
- package/src/version.ts +1 -1
- package/src/wasm/Engine.ts +1 -0
- package/src/wasm/Hash.ts +10 -0
- package/src/wasm/_test/Engine.test-d.ts +1 -0
- package/src/wasm/_test/Engine.test.ts +5 -0
- package/src/wasm/_test/Hash.browser.test.ts +28 -0
- package/src/wasm/_test/Hash.test-d.ts +16 -0
- package/src/wasm/_test/Hash.test.ts +250 -1
- package/src/wasm/internal/blake3.ts +23 -2
- package/src/wasm/internal/blake3.wasm.ts +4 -1
- package/src/wasm/internal/hash.ts +27 -1
- package/src/wasm/internal/hashState.ts +154 -0
- package/src/wasm/internal/hashes.ts +56 -15
- package/src/wasm/internal/hashes.wasm.ts +15 -3
- package/src/webauthn/Authentication.ts +4 -0
- package/src/webauthn/Registration.ts +2 -0
- package/src/webauthn/Types.ts +32 -2
- package/src/webauthn/_test/Authentication.test.ts +123 -1
- package/src/webauthn/_test/Registration.test.ts +26 -6
- package/src/webauthn/_test/WebAuthn.browser.test.ts +28 -0
- package/src/webauthn/internal/utils.ts +41 -8
|
@@ -7,9 +7,9 @@ export const createChallenge = Registration.createChallenge;
|
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts twoslash
|
|
10
|
-
* import {
|
|
10
|
+
* import { WebAuthn } from 'ox'
|
|
11
11
|
*
|
|
12
|
-
* const credential = await
|
|
12
|
+
* const credential = await WebAuthn.createCredential({
|
|
13
13
|
* name: 'Example'
|
|
14
14
|
* }) // [!code focus]
|
|
15
15
|
* // @log: {
|
|
@@ -18,7 +18,7 @@ export const createChallenge = Registration.createChallenge;
|
|
|
18
18
|
* // @log: raw: PublicKeyCredential {},
|
|
19
19
|
* // @log: }
|
|
20
20
|
*
|
|
21
|
-
* const { metadata, signature } = await
|
|
21
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
22
22
|
* credentialId: credential.id,
|
|
23
23
|
* challenge: '0xdeadbeef'
|
|
24
24
|
* })
|
|
@@ -32,27 +32,25 @@ export async function createCredential(options) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Gets the authenticator data which contains information about the
|
|
35
|
-
* processing of an authenticator request (ie. from `
|
|
35
|
+
* processing of an authenticator request (ie. from `WebAuthn.sign`).
|
|
36
36
|
*
|
|
37
37
|
* :::warning
|
|
38
38
|
*
|
|
39
39
|
* This function is mainly for testing purposes or for manually constructing
|
|
40
40
|
* autenticator data. In most cases you will not need this function.
|
|
41
41
|
* `authenticatorData` is typically returned as part of the
|
|
42
|
-
* {@link ox#
|
|
42
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
43
43
|
*
|
|
44
44
|
* :::
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```ts twoslash
|
|
48
|
-
* import {
|
|
48
|
+
* import { WebAuthn } from 'ox'
|
|
49
49
|
*
|
|
50
|
-
* const authenticatorData =
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* }
|
|
55
|
-
* )
|
|
50
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
51
|
+
* rpId: 'example.com',
|
|
52
|
+
* signCount: 420
|
|
53
|
+
* })
|
|
56
54
|
* // @log: "0xa379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce194705000001a4"
|
|
57
55
|
* ```
|
|
58
56
|
*
|
|
@@ -62,20 +60,18 @@ export async function createCredential(options) {
|
|
|
62
60
|
* Include a credential ID and public key in the authenticator data (for registration responses):
|
|
63
61
|
*
|
|
64
62
|
* ```ts twoslash
|
|
65
|
-
* import { P256,
|
|
63
|
+
* import { P256, WebAuthn } from 'ox'
|
|
66
64
|
*
|
|
67
65
|
* const { publicKey } = P256.createKeyPair()
|
|
68
66
|
*
|
|
69
|
-
* const authenticatorData =
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* publicKey
|
|
76
|
-
* }
|
|
67
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
68
|
+
* rpId: 'example.com',
|
|
69
|
+
* flag: 0x41, // UP + AT
|
|
70
|
+
* credential: {
|
|
71
|
+
* id: new Uint8Array(32),
|
|
72
|
+
* publicKey
|
|
77
73
|
* }
|
|
78
|
-
* )
|
|
74
|
+
* })
|
|
79
75
|
* ```
|
|
80
76
|
*
|
|
81
77
|
* @param options - Options to construct the authenticator data.
|
|
@@ -84,22 +80,22 @@ export async function createCredential(options) {
|
|
|
84
80
|
export const getAuthenticatorData = Authenticator.getAuthenticatorData;
|
|
85
81
|
/**
|
|
86
82
|
* Constructs the Client Data in stringified JSON format which represents client data that
|
|
87
|
-
* was passed to `credentials.get()` in {@link ox#
|
|
83
|
+
* was passed to `credentials.get()` in {@link ox#WebAuthn.(sign:function)}.
|
|
88
84
|
*
|
|
89
85
|
* :::warning
|
|
90
86
|
*
|
|
91
87
|
* This function is mainly for testing purposes or for manually constructing
|
|
92
88
|
* client data. In most cases you will not need this function.
|
|
93
89
|
* `clientDataJSON` is typically returned as part of the
|
|
94
|
-
* {@link ox#
|
|
90
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
95
91
|
*
|
|
96
92
|
* :::
|
|
97
93
|
*
|
|
98
94
|
* @example
|
|
99
95
|
* ```ts twoslash
|
|
100
|
-
* import {
|
|
96
|
+
* import { WebAuthn } from 'ox'
|
|
101
97
|
*
|
|
102
|
-
* const clientDataJSON =
|
|
98
|
+
* const clientDataJSON = WebAuthn.getClientDataJSON({
|
|
103
99
|
* challenge: '0xdeadbeef',
|
|
104
100
|
* origin: 'https://example.com'
|
|
105
101
|
* })
|
|
@@ -123,19 +119,17 @@ export const getClientDataJSON = Authenticator.getClientDataJSON;
|
|
|
123
119
|
*
|
|
124
120
|
* @example
|
|
125
121
|
* ```ts twoslash
|
|
126
|
-
* import { P256,
|
|
122
|
+
* import { P256, WebAuthn } from 'ox'
|
|
127
123
|
*
|
|
128
124
|
* const { publicKey } = P256.createKeyPair()
|
|
129
125
|
*
|
|
130
|
-
* const attestationObject =
|
|
131
|
-
* {
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* }
|
|
138
|
-
* )
|
|
126
|
+
* const attestationObject = WebAuthn.getAttestationObject({
|
|
127
|
+
* authData: WebAuthn.getAuthenticatorData({
|
|
128
|
+
* rpId: 'example.com',
|
|
129
|
+
* flag: 0x41,
|
|
130
|
+
* credential: { id: new Uint8Array(32), publicKey }
|
|
131
|
+
* })
|
|
132
|
+
* })
|
|
139
133
|
* ```
|
|
140
134
|
*
|
|
141
135
|
* @param options - Options to construct the attestation object.
|
|
@@ -148,9 +142,9 @@ export const getAttestationObject = Authenticator.getAttestationObject;
|
|
|
148
142
|
*
|
|
149
143
|
* @example
|
|
150
144
|
* ```ts twoslash
|
|
151
|
-
* import {
|
|
145
|
+
* import { WebAuthn } from 'ox'
|
|
152
146
|
*
|
|
153
|
-
* const options =
|
|
147
|
+
* const options = WebAuthn.getCredentialCreationOptions({
|
|
154
148
|
* name: 'Example'
|
|
155
149
|
* })
|
|
156
150
|
*
|
|
@@ -167,9 +161,9 @@ export const getCredentialCreationOptions = Registration.getOptions;
|
|
|
167
161
|
*
|
|
168
162
|
* @example
|
|
169
163
|
* ```ts twoslash
|
|
170
|
-
* import {
|
|
164
|
+
* import { WebAuthn } from 'ox'
|
|
171
165
|
*
|
|
172
|
-
* const options =
|
|
166
|
+
* const options = WebAuthn.getCredentialRequestOptions({
|
|
173
167
|
* challenge: '0xdeadbeef'
|
|
174
168
|
* })
|
|
175
169
|
*
|
|
@@ -191,15 +185,15 @@ export const getCredentialRequestOptions = Authentication.getOptions;
|
|
|
191
185
|
*
|
|
192
186
|
* This function is mainly for testing purposes or for manually constructing
|
|
193
187
|
* signing payloads. In most cases you will not need this function and
|
|
194
|
-
* instead use {@link ox#
|
|
188
|
+
* instead use {@link ox#WebAuthn.(sign:function)}.
|
|
195
189
|
*
|
|
196
190
|
* :::
|
|
197
191
|
*
|
|
198
192
|
* @example
|
|
199
193
|
* ```ts twoslash
|
|
200
|
-
* import {
|
|
194
|
+
* import { WebAuthn, WebCryptoP256 } from 'ox'
|
|
201
195
|
*
|
|
202
|
-
* const { metadata, payload } =
|
|
196
|
+
* const { metadata, payload } = WebAuthn.getSignPayload({
|
|
203
197
|
* // [!code focus]
|
|
204
198
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
205
199
|
* }) // [!code focus]
|
|
@@ -234,13 +228,13 @@ export const getSignPayload = Authentication.getSignPayload;
|
|
|
234
228
|
*
|
|
235
229
|
* @example
|
|
236
230
|
* ```ts twoslash
|
|
237
|
-
* import {
|
|
231
|
+
* import { WebAuthn } from 'ox'
|
|
238
232
|
*
|
|
239
|
-
* const credential = await
|
|
233
|
+
* const credential = await WebAuthn.createCredential({
|
|
240
234
|
* name: 'Example'
|
|
241
235
|
* })
|
|
242
236
|
*
|
|
243
|
-
* const { metadata, signature } = await
|
|
237
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
244
238
|
* // [!code focus]
|
|
245
239
|
* credentialId: credential.id, // [!code focus]
|
|
246
240
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
@@ -268,18 +262,18 @@ export async function sign(options) {
|
|
|
268
262
|
*
|
|
269
263
|
* @example
|
|
270
264
|
* ```ts twoslash
|
|
271
|
-
* import {
|
|
265
|
+
* import { WebAuthn } from 'ox'
|
|
272
266
|
*
|
|
273
|
-
* const credential = await
|
|
267
|
+
* const credential = await WebAuthn.createCredential({
|
|
274
268
|
* name: 'Example'
|
|
275
269
|
* })
|
|
276
270
|
*
|
|
277
|
-
* const { metadata, signature } = await
|
|
271
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
278
272
|
* credentialId: credential.id,
|
|
279
273
|
* challenge: '0xdeadbeef'
|
|
280
274
|
* })
|
|
281
275
|
*
|
|
282
|
-
* const result = await
|
|
276
|
+
* const result = await WebAuthn.verify({
|
|
283
277
|
* // [!code focus]
|
|
284
278
|
* metadata, // [!code focus]
|
|
285
279
|
* challenge: '0xdeadbeef', // [!code focus]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAuthnP256.js","sourceRoot":"","sources":["../../src/core/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAQ3D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAiC;IAEjC,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC;AAOD
|
|
1
|
+
{"version":3,"file":"WebAuthnP256.js","sourceRoot":"","sources":["../../src/core/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAQ3D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAiC;IAEjC,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAA;AAQtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,iBAAiB,CAAA;AAQhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,oBAAoB,CAAA;AAQtE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC,UAAU,CAAA;AAQnE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,cAAc,CAAC,UAAU,CAAA;AAOpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,CAAC,cAAc,CAAA;AAU3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAqB;IAC9C,OAAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,MAAM,CAAC,OAAuB;IAC5C,OAAO,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -12,11 +12,6 @@ export type ParameterToPrimitiveType<abiParameter extends AbiParameter | {
|
|
|
12
12
|
type: unknown;
|
|
13
13
|
}, abiParameterKind extends AbiParameterKind = AbiParameterKind> = AbiParameterToPrimitiveType<abiParameter, abiParameterKind>;
|
|
14
14
|
/** @internal */
|
|
15
|
-
export type PreparedParameter = {
|
|
16
|
-
dynamic: boolean;
|
|
17
|
-
encoded: Hex.Hex;
|
|
18
|
-
};
|
|
19
|
-
/** @internal */
|
|
20
15
|
export type ToObject<parameters extends readonly AbiParameter[], kind extends AbiParameterKind = AbiParameterKind> = IsNarrowable<parameters, AbiParameters.AbiParameters> extends true ? Compute<UnionToIntersection<{
|
|
21
16
|
[index in keyof parameters]: parameters[index] extends {
|
|
22
17
|
name: infer name extends string;
|
|
@@ -91,88 +86,13 @@ export declare namespace decodeString {
|
|
|
91
86
|
type ErrorType = Bytes.toNumber.ErrorType | Bytes.toString.ErrorType | Errors.GlobalErrorType;
|
|
92
87
|
}
|
|
93
88
|
/** @internal */
|
|
94
|
-
export declare function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
type ErrorType = prepareParameter.ErrorType | Errors.GlobalErrorType;
|
|
102
|
-
}
|
|
103
|
-
/** @internal */
|
|
104
|
-
export declare function prepareParameter<const parameter extends AbiParameters.Parameter>({ checksumAddress, parameter: parameter_, value, }: {
|
|
105
|
-
parameter: parameter;
|
|
106
|
-
value: parameter extends AbiParameters.Parameter ? ParameterToPrimitiveType<parameter> : never;
|
|
107
|
-
checksumAddress?: boolean | undefined;
|
|
108
|
-
}): PreparedParameter;
|
|
109
|
-
/** @internal */
|
|
110
|
-
export declare namespace prepareParameter {
|
|
111
|
-
type ErrorType = encodeArray.ErrorType | encodeTuple.ErrorType | encodeAddress.ErrorType | encodeBoolean.ErrorType | encodeBytes.ErrorType | encodeString.ErrorType | AbiParameters.InvalidTypeError | Errors.GlobalErrorType;
|
|
112
|
-
}
|
|
113
|
-
/** @internal */
|
|
114
|
-
export declare function encode(preparedParameters: PreparedParameter[]): Hex.Hex;
|
|
115
|
-
/** @internal */
|
|
116
|
-
export declare namespace encode {
|
|
117
|
-
type ErrorType = Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Hex.size.ErrorType | Errors.GlobalErrorType;
|
|
118
|
-
}
|
|
119
|
-
/** @internal */
|
|
120
|
-
export declare function encodeAddress(value: Hex.Hex, options: {
|
|
121
|
-
checksum: boolean;
|
|
122
|
-
}): PreparedParameter;
|
|
123
|
-
/** @internal */
|
|
124
|
-
export declare namespace encodeAddress {
|
|
125
|
-
type ErrorType = Address.assert.ErrorType | Hex.padLeft.ErrorType | Errors.GlobalErrorType;
|
|
126
|
-
}
|
|
127
|
-
/** @internal */
|
|
128
|
-
export declare function encodeArray<const parameter extends AbiParameters.Parameter>(value: ParameterToPrimitiveType<parameter>, options: {
|
|
129
|
-
checksumAddress?: boolean | undefined;
|
|
130
|
-
length: number | null;
|
|
131
|
-
parameter: parameter;
|
|
132
|
-
}): PreparedParameter;
|
|
133
|
-
/** @internal */
|
|
134
|
-
export declare namespace encodeArray {
|
|
135
|
-
type ErrorType = AbiParameters.InvalidArrayError | AbiParameters.ArrayLengthMismatchError | Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
136
|
-
}
|
|
137
|
-
/** @internal */
|
|
138
|
-
export declare function encodeBytes(value: Hex.Hex, { type }: {
|
|
139
|
-
type: string;
|
|
140
|
-
}): PreparedParameter;
|
|
141
|
-
/** @internal */
|
|
142
|
-
export declare namespace encodeBytes {
|
|
143
|
-
type ErrorType = Hex.padLeft.ErrorType | Hex.padRight.ErrorType | Hex.fromNumber.ErrorType | Hex.slice.ErrorType | Errors.GlobalErrorType;
|
|
144
|
-
}
|
|
145
|
-
/** @internal */
|
|
146
|
-
export declare function encodeBoolean(value: boolean): PreparedParameter;
|
|
147
|
-
/** @internal */
|
|
148
|
-
export declare namespace encodeBoolean {
|
|
149
|
-
type ErrorType = Hex.padLeft.ErrorType | Hex.fromBoolean.ErrorType | Errors.GlobalErrorType;
|
|
150
|
-
}
|
|
151
|
-
/** @internal */
|
|
152
|
-
export declare function encodeNumber(value: number, { signed, size }: {
|
|
153
|
-
signed: boolean;
|
|
154
|
-
size: number;
|
|
155
|
-
}): PreparedParameter;
|
|
156
|
-
/** @internal */
|
|
157
|
-
export declare namespace encodeNumber {
|
|
158
|
-
type ErrorType = Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
159
|
-
}
|
|
160
|
-
/** @internal */
|
|
161
|
-
export declare function encodeString(value: string): PreparedParameter;
|
|
162
|
-
/** @internal */
|
|
163
|
-
export declare namespace encodeString {
|
|
164
|
-
type ErrorType = Hex.fromNumber.ErrorType | Hex.padRight.ErrorType | Hex.slice.ErrorType | Hex.size.ErrorType | Errors.GlobalErrorType;
|
|
165
|
-
}
|
|
166
|
-
/** @internal */
|
|
167
|
-
export declare function encodeTuple<const parameter extends AbiParameters.Parameter & {
|
|
168
|
-
components: readonly AbiParameters.Parameter[];
|
|
169
|
-
}>(value: ParameterToPrimitiveType<parameter>, options: {
|
|
170
|
-
checksumAddress?: boolean | undefined;
|
|
171
|
-
parameter: parameter;
|
|
172
|
-
}): PreparedParameter;
|
|
173
|
-
/** @internal */
|
|
174
|
-
export declare namespace encodeTuple {
|
|
175
|
-
type ErrorType = Hex.concat.ErrorType | Errors.GlobalErrorType;
|
|
89
|
+
export declare function encodeParameters(parameters: readonly AbiParameters.Parameter[], values: readonly unknown[], options?: encodeParameters.Options): Hex.Hex;
|
|
90
|
+
export declare namespace encodeParameters {
|
|
91
|
+
type Options = {
|
|
92
|
+
checksumAddress?: boolean | undefined;
|
|
93
|
+
prefix?: Hex.Hex | undefined;
|
|
94
|
+
};
|
|
95
|
+
type ErrorType = AbiParameters.LengthMismatchError | AbiParameters.InvalidArrayError | AbiParameters.ArrayLengthMismatchError | AbiParameters.BytesSizeMismatchError | AbiParameters.InvalidTypeError | Address.assert.ErrorType | Hex.IntegerOutOfRangeError | Hex.fromBytes.ErrorType | Errors.GlobalErrorType;
|
|
176
96
|
}
|
|
177
97
|
/** @internal */
|
|
178
98
|
export declare function getArrayComponents(type: string): [length: number | null, innerType: string] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abiParameters.d.ts","sourceRoot":"","sources":["../../../src/core/internal/abiParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAChB,OAAO,K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