ox 1.7.2 → 1.7.4
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 +27 -0
- package/dist/tempo/KeyAuthorization.d.ts +1 -1
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/MultisigOperation.d.ts +42 -26
- package/dist/tempo/MultisigOperation.d.ts.map +1 -1
- package/dist/tempo/MultisigOperation.js +78 -48
- package/dist/tempo/MultisigOperation.js.map +1 -1
- package/dist/tempo/MultisigSimulation.d.ts +132 -0
- package/dist/tempo/MultisigSimulation.d.ts.map +1 -0
- package/dist/tempo/MultisigSimulation.js +140 -0
- package/dist/tempo/MultisigSimulation.js.map +1 -0
- package/dist/tempo/RpcSchemaTempo.d.ts +20 -10
- package/dist/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +9 -20
- package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/tempo/SignatureEnvelope.js +12 -18
- package/dist/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/tempo/TransactionRequest.d.ts +6 -6
- package/dist/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/tempo/TransactionRequest.js +7 -7
- package/dist/tempo/TransactionRequest.js.map +1 -1
- package/dist/tempo/index.d.ts +4 -4
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +4 -4
- package/dist/tempo/index.js.map +1 -1
- package/dist/zod/tempo/AuthorizationTempo.d.ts +10 -130
- package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
- package/dist/zod/tempo/KeyAuthorization.d.ts +5 -65
- package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/zod/tempo/MultisigOperation.d.ts +0 -10
- package/dist/zod/tempo/MultisigOperation.d.ts.map +1 -1
- package/dist/zod/tempo/MultisigOperation.js +0 -3
- package/dist/zod/tempo/MultisigOperation.js.map +1 -1
- package/dist/zod/tempo/{MultisigWitness.d.ts → MultisigSimulation.d.ts} +17 -49
- package/dist/zod/tempo/MultisigSimulation.d.ts.map +1 -0
- package/dist/zod/tempo/{MultisigWitness.js → MultisigSimulation.js} +26 -24
- package/dist/zod/tempo/MultisigSimulation.js.map +1 -0
- package/dist/zod/tempo/RpcSchemaTempo.d.ts +83 -204
- package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/dist/zod/tempo/RpcSchemaTempo.js +19 -10
- package/dist/zod/tempo/RpcSchemaTempo.js.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.d.ts +3 -39
- package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.js +4 -14
- package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/zod/tempo/Transaction.d.ts +18 -234
- package/dist/zod/tempo/Transaction.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.d.ts +36 -192
- package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.js +10 -10
- package/dist/zod/tempo/TransactionRequest.js.map +1 -1
- package/dist/zod/tempo/z.d.ts +1 -1
- package/dist/zod/tempo/z.d.ts.map +1 -1
- package/dist/zod/tempo/z.js +1 -1
- package/dist/zod/tempo/z.js.map +1 -1
- package/package.json +9 -9
- package/src/tempo/AuthorizationTempo.test.ts +4 -0
- package/src/tempo/KeyAuthorization.test-d.ts +1 -12
- package/src/tempo/KeyAuthorization.test.ts +44 -3
- package/src/tempo/KeyAuthorization.ts +3 -3
- package/src/tempo/MultisigOperation.test-d.ts +8 -6
- package/src/tempo/MultisigOperation.test.ts +236 -169
- package/src/tempo/MultisigOperation.ts +122 -83
- package/src/tempo/MultisigSimulation.test-d.ts +33 -0
- package/src/tempo/MultisigSimulation.test.ts +283 -0
- package/src/tempo/MultisigSimulation.ts +266 -0
- package/src/tempo/RpcSchemaTempo.test-d.ts +45 -10
- package/src/tempo/RpcSchemaTempo.ts +15 -6
- package/src/tempo/SignatureEnvelope.test-d.ts +3 -59
- package/src/tempo/SignatureEnvelope.test.ts +61 -51
- package/src/tempo/SignatureEnvelope.ts +27 -44
- package/src/tempo/Transaction.test.ts +61 -0
- package/src/tempo/TransactionRequest.test-d.ts +7 -7
- package/src/tempo/TransactionRequest.test.ts +129 -208
- package/src/tempo/TransactionRequest.ts +16 -12
- package/src/tempo/index.ts +4 -4
- package/src/tempo/multisig.e2e.test.ts +51 -1
- package/src/version.ts +1 -1
- package/src/zod/tempo/MultisigOperation.ts +0 -3
- package/src/zod/tempo/{MultisigWitness.ts → MultisigSimulation.ts} +39 -42
- package/src/zod/tempo/RpcSchemaTempo.ts +20 -10
- package/src/zod/tempo/SignatureEnvelope.ts +11 -35
- package/src/zod/tempo/TransactionRequest.ts +14 -14
- package/src/zod/tempo/_test/KeyAuthorization.test.ts +2 -15
- package/src/zod/tempo/_test/MultisigOperation.test.ts +0 -2
- package/src/zod/tempo/_test/MultisigSimulation.test-d.ts +13 -0
- package/src/zod/tempo/_test/MultisigSimulation.test.ts +78 -0
- package/src/zod/tempo/_test/RpcSchemaTempo.test-d.ts +19 -2
- package/src/zod/tempo/_test/RpcSchemaTempo.test.ts +46 -4
- package/src/zod/tempo/_test/SignatureEnvelope.test.ts +58 -112
- package/src/zod/tempo/_test/TransactionRequest.test.ts +19 -160
- package/src/zod/tempo/z.ts +1 -1
- package/dist/tempo/MultisigWitness.d.ts +0 -106
- package/dist/tempo/MultisigWitness.d.ts.map +0 -1
- package/dist/tempo/MultisigWitness.js +0 -118
- package/dist/tempo/MultisigWitness.js.map +0 -1
- package/dist/zod/tempo/MultisigWitness.d.ts.map +0 -1
- package/dist/zod/tempo/MultisigWitness.js.map +0 -1
- package/src/tempo/MultisigWitness.test-d.ts +0 -42
- package/src/tempo/MultisigWitness.test.ts +0 -288
- package/src/tempo/MultisigWitness.ts +0 -210
- package/src/zod/tempo/_test/MultisigWitness.test-d.ts +0 -13
- package/src/zod/tempo/_test/MultisigWitness.test.ts +0 -149
package/dist/zod/tempo/z.js
CHANGED
|
@@ -3,7 +3,7 @@ export * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
|
3
3
|
export * as KeyAuthorization from './KeyAuthorization.js';
|
|
4
4
|
export * as MultisigConfig from './MultisigConfig.js';
|
|
5
5
|
export * as MultisigOperation from './MultisigOperation.js';
|
|
6
|
-
export * as
|
|
6
|
+
export * as MultisigSimulation from './MultisigSimulation.js';
|
|
7
7
|
export * as PoolId from './PoolId.js';
|
|
8
8
|
export * as RpcSchemaTempo from './RpcSchemaTempo.js';
|
|
9
9
|
export * as SignatureEnvelope from './SignatureEnvelope.js';
|
package/dist/zod/tempo/z.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"z.js","sourceRoot":"","sources":["../../../src/zod/tempo/z.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"z.js","sourceRoot":"","sources":["../../../src/zod/tempo/z.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ox",
|
|
3
3
|
"description": "Ethereum Standard Library",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.7.
|
|
5
|
+
"version": "1.7.4",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"license": "MIT",
|
|
@@ -604,10 +604,10 @@
|
|
|
604
604
|
"types": "./dist/tempo/MultisigOperation.d.ts",
|
|
605
605
|
"default": "./dist/tempo/MultisigOperation.js"
|
|
606
606
|
},
|
|
607
|
-
"./tempo/
|
|
608
|
-
"src": "./src/tempo/
|
|
609
|
-
"types": "./dist/tempo/
|
|
610
|
-
"default": "./dist/tempo/
|
|
607
|
+
"./tempo/MultisigSimulation": {
|
|
608
|
+
"src": "./src/tempo/MultisigSimulation.ts",
|
|
609
|
+
"types": "./dist/tempo/MultisigSimulation.d.ts",
|
|
610
|
+
"default": "./dist/tempo/MultisigSimulation.js"
|
|
611
611
|
},
|
|
612
612
|
"./tempo/Period": {
|
|
613
613
|
"src": "./src/tempo/Period.ts",
|
|
@@ -1029,10 +1029,10 @@
|
|
|
1029
1029
|
"types": "./dist/zod/tempo/MultisigOperation.d.ts",
|
|
1030
1030
|
"default": "./dist/zod/tempo/MultisigOperation.js"
|
|
1031
1031
|
},
|
|
1032
|
-
"./zod/tempo/
|
|
1033
|
-
"src": "./src/zod/tempo/
|
|
1034
|
-
"types": "./dist/zod/tempo/
|
|
1035
|
-
"default": "./dist/zod/tempo/
|
|
1032
|
+
"./zod/tempo/MultisigSimulation": {
|
|
1033
|
+
"src": "./src/zod/tempo/MultisigSimulation.ts",
|
|
1034
|
+
"types": "./dist/zod/tempo/MultisigSimulation.d.ts",
|
|
1035
|
+
"default": "./dist/zod/tempo/MultisigSimulation.js"
|
|
1036
1036
|
},
|
|
1037
1037
|
"./zod/tempo/PoolId": {
|
|
1038
1038
|
"src": "./src/zod/tempo/PoolId.ts",
|
|
@@ -348,6 +348,7 @@ describe('fromRpc', () => {
|
|
|
348
348
|
type: 'p256',
|
|
349
349
|
},
|
|
350
350
|
})
|
|
351
|
+
if (typeof result.signature === 'string') throw new Error('unreachable')
|
|
351
352
|
expect(result.signature.type).toBe('p256')
|
|
352
353
|
expect(result.signature).toHaveProperty('prehash', true)
|
|
353
354
|
expect(result.signature).toHaveProperty('publicKey')
|
|
@@ -370,6 +371,7 @@ describe('fromRpc', () => {
|
|
|
370
371
|
'0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d976305000000007b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22222c226f726967696e223a2268747470733a2f2f6578616d706c652e636f6d222c2263726f73734f726967696e223a66616c73657d',
|
|
371
372
|
},
|
|
372
373
|
})
|
|
374
|
+
if (typeof result.signature === 'string') throw new Error('unreachable')
|
|
373
375
|
expect(result.signature.type).toBe('webAuthn')
|
|
374
376
|
expect(result.signature).toHaveProperty('metadata')
|
|
375
377
|
expect(result.signature).toHaveProperty('publicKey')
|
|
@@ -994,6 +996,7 @@ describe('toRpc', () => {
|
|
|
994
996
|
type: 'p256',
|
|
995
997
|
},
|
|
996
998
|
})
|
|
999
|
+
if (typeof result.signature === 'string') throw new Error('unreachable')
|
|
997
1000
|
expect(result.signature.type).toBe('p256')
|
|
998
1001
|
})
|
|
999
1002
|
|
|
@@ -1019,6 +1022,7 @@ describe('toRpc', () => {
|
|
|
1019
1022
|
type: 'webAuthn',
|
|
1020
1023
|
},
|
|
1021
1024
|
})
|
|
1025
|
+
if (typeof result.signature === 'string') throw new Error('unreachable')
|
|
1022
1026
|
expect(result.signature.type).toBe('webAuthn')
|
|
1023
1027
|
})
|
|
1024
1028
|
})
|
|
@@ -55,18 +55,7 @@ test('accepts multisig signatures', () => {
|
|
|
55
55
|
KeyAuthorization.Signed['signature']
|
|
56
56
|
>()
|
|
57
57
|
|
|
58
|
-
const multisigRpc =
|
|
59
|
-
account: multisig.account,
|
|
60
|
-
config: MultisigConfig.toRpc(multisig.config),
|
|
61
|
-
signatures: [
|
|
62
|
-
{
|
|
63
|
-
r: '0x01',
|
|
64
|
-
s: '0x02',
|
|
65
|
-
type: 'secp256k1',
|
|
66
|
-
yParity: '0x0',
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
} as const satisfies SignatureEnvelope.MultisigRpc
|
|
58
|
+
const multisigRpc = '0xf8' as const satisfies SignatureEnvelope.MultisigRpc
|
|
70
59
|
|
|
71
60
|
const rpc: KeyAuthorization.Rpc = {
|
|
72
61
|
chainId: '0x1',
|
|
@@ -69,6 +69,8 @@ const signature_multisig = {
|
|
|
69
69
|
signatures: [SignatureEnvelope.from(signature_secp256k1)],
|
|
70
70
|
type: 'multisig',
|
|
71
71
|
} as const satisfies SignatureEnvelope.Multisig
|
|
72
|
+
const signature_multisig_rpc =
|
|
73
|
+
'0xf89794be95c3f554e9fc85ec51be69a3d807a0d55bcf2cf83ba000000000000000000000000000000000000000000000000000000000000000000101d7d694f39fd6e51aad88f6f4ce6ab8827279cfffb9226601f843b841fa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d01c' as const
|
|
72
74
|
|
|
73
75
|
const signature_keychain = {
|
|
74
76
|
inner: SignatureEnvelope.from(signature_secp256k1),
|
|
@@ -502,16 +504,42 @@ describe('from', () => {
|
|
|
502
504
|
})
|
|
503
505
|
|
|
504
506
|
describe('fromRpc', () => {
|
|
505
|
-
test('multisig', () => {
|
|
507
|
+
test('behavior: multisig', () => {
|
|
506
508
|
const authorization = KeyAuthorization.fromRpc({
|
|
507
509
|
chainId: '0x1',
|
|
508
510
|
expiry: null,
|
|
509
511
|
keyId: address,
|
|
510
512
|
keyType: 'secp256k1',
|
|
511
|
-
signature:
|
|
513
|
+
signature: signature_multisig_rpc,
|
|
512
514
|
})
|
|
513
515
|
|
|
514
|
-
expect(authorization.signature).
|
|
516
|
+
expect(authorization.signature).toMatchInlineSnapshot(`
|
|
517
|
+
{
|
|
518
|
+
"account": "0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c",
|
|
519
|
+
"config": {
|
|
520
|
+
"owners": [
|
|
521
|
+
{
|
|
522
|
+
"owner": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
|
|
523
|
+
"weight": 1,
|
|
524
|
+
},
|
|
525
|
+
],
|
|
526
|
+
"salt": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
527
|
+
"threshold": 1,
|
|
528
|
+
"version": 1n,
|
|
529
|
+
},
|
|
530
|
+
"signatures": [
|
|
531
|
+
{
|
|
532
|
+
"signature": {
|
|
533
|
+
"r": "0xfa78c5905fb0b9d6066ef531f962a62bc6ef0d5eb59ecb134056d206f75aaed7",
|
|
534
|
+
"s": "0x780926ff2601a935c2c79707d9e1799948c9f19dcdde1e090e903b19a07923d0",
|
|
535
|
+
"yParity": 1,
|
|
536
|
+
},
|
|
537
|
+
"type": "secp256k1",
|
|
538
|
+
},
|
|
539
|
+
],
|
|
540
|
+
"type": "multisig",
|
|
541
|
+
}
|
|
542
|
+
`)
|
|
515
543
|
})
|
|
516
544
|
|
|
517
545
|
test('rejects a keychain signature', () => {
|
|
@@ -1306,6 +1334,19 @@ describe('serialize', () => {
|
|
|
1306
1334
|
})
|
|
1307
1335
|
|
|
1308
1336
|
describe('toRpc', () => {
|
|
1337
|
+
test('behavior: multisig', () => {
|
|
1338
|
+
const authorization = KeyAuthorization.toRpc({
|
|
1339
|
+
address,
|
|
1340
|
+
chainId: 1n,
|
|
1341
|
+
signature: signature_multisig,
|
|
1342
|
+
type: 'secp256k1',
|
|
1343
|
+
})
|
|
1344
|
+
|
|
1345
|
+
expect(authorization.signature).toMatchInlineSnapshot(
|
|
1346
|
+
`"${signature_multisig_rpc}"`,
|
|
1347
|
+
)
|
|
1348
|
+
})
|
|
1349
|
+
|
|
1309
1350
|
test('secp256k1', () => {
|
|
1310
1351
|
const authorization = KeyAuthorization.from({
|
|
1311
1352
|
address,
|
|
@@ -90,9 +90,9 @@ export type Signature<numberType = number> = OneOf<
|
|
|
90
90
|
>
|
|
91
91
|
|
|
92
92
|
/** RPC-formatted signature that can authorize an access key. */
|
|
93
|
-
export type SignatureRpc =
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
export type SignatureRpc =
|
|
94
|
+
| SignatureEnvelope.MultisigRpc
|
|
95
|
+
| SignatureEnvelope.PrimitiveRpc
|
|
96
96
|
|
|
97
97
|
/** Input type for a Key Authorization. */
|
|
98
98
|
export type Input = KeyAuthorization<false, bigint, number>
|
|
@@ -11,6 +11,8 @@ declare const operation: MultisigOperation.Operation
|
|
|
11
11
|
declare const operationRpc: MultisigOperation.Rpc
|
|
12
12
|
declare const getHashOptions: MultisigOperation.getHash.Options
|
|
13
13
|
declare const selectApprovalsOptions: MultisigOperation.selectApprovals.Options
|
|
14
|
+
declare const serializedKeyAuthorization: Hex.Hex
|
|
15
|
+
declare const serializeKeyAuthorizationOptions: MultisigOperation.serializeKeyAuthorization.Options
|
|
14
16
|
declare const serializeTransactionOptions: MultisigOperation.serializeTransaction.Options
|
|
15
17
|
|
|
16
18
|
test('preserves operation kinds during validation', () => {
|
|
@@ -50,15 +52,9 @@ test('uses JSON-RPC quantities only in RPC operations', () => {
|
|
|
50
52
|
expectTypeOf<
|
|
51
53
|
MultisigOperation.Operation['config']['version']
|
|
52
54
|
>().toEqualTypeOf<bigint>()
|
|
53
|
-
expectTypeOf<
|
|
54
|
-
MultisigOperation.Operation['configVersion']
|
|
55
|
-
>().toEqualTypeOf<bigint>()
|
|
56
55
|
expectTypeOf<
|
|
57
56
|
MultisigOperation.Rpc['config']['version']
|
|
58
57
|
>().toEqualTypeOf<Hex.Hex>()
|
|
59
|
-
expectTypeOf<
|
|
60
|
-
MultisigOperation.Rpc['configVersion']
|
|
61
|
-
>().toEqualTypeOf<Hex.Hex>()
|
|
62
58
|
})
|
|
63
59
|
|
|
64
60
|
test('operation helpers return narrow types', async () => {
|
|
@@ -68,6 +64,12 @@ test('operation helpers return narrow types', async () => {
|
|
|
68
64
|
expectTypeOf(
|
|
69
65
|
await MultisigOperation.selectApprovals(selectApprovalsOptions),
|
|
70
66
|
).toEqualTypeOf<MultisigOperation.selectApprovals.ReturnValue>()
|
|
67
|
+
expectTypeOf(
|
|
68
|
+
MultisigOperation.serializeKeyAuthorization(
|
|
69
|
+
serializedKeyAuthorization,
|
|
70
|
+
serializeKeyAuthorizationOptions,
|
|
71
|
+
),
|
|
72
|
+
).toEqualTypeOf<Hex.Hex>()
|
|
71
73
|
expectTypeOf(
|
|
72
74
|
MultisigOperation.serializeTransaction(
|
|
73
75
|
transaction,
|