ox 0.14.44 → 0.14.45
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 +6 -0
- package/_cjs/tempo/KeyAuthorization.js +43 -10
- package/_cjs/tempo/KeyAuthorization.js.map +1 -1
- package/_cjs/tempo/MultisigConfig.js +33 -11
- package/_cjs/tempo/MultisigConfig.js.map +1 -1
- package/_cjs/tempo/MultisigOperation.js +18 -94
- package/_cjs/tempo/MultisigOperation.js.map +1 -1
- package/_cjs/tempo/MultisigSimulation.js +18 -46
- package/_cjs/tempo/MultisigSimulation.js.map +1 -1
- package/_cjs/tempo/SignatureEnvelope.js +72 -109
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
- package/_cjs/tempo/TransactionRequest.js +5 -1
- package/_cjs/tempo/TransactionRequest.js.map +1 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/tempo/KeyAuthorization.js +42 -9
- package/_esm/tempo/KeyAuthorization.js.map +1 -1
- package/_esm/tempo/MultisigConfig.js +41 -22
- package/_esm/tempo/MultisigConfig.js.map +1 -1
- package/_esm/tempo/MultisigOperation.js +20 -100
- package/_esm/tempo/MultisigOperation.js.map +1 -1
- package/_esm/tempo/MultisigSimulation.js +18 -46
- package/_esm/tempo/MultisigSimulation.js.map +1 -1
- package/_esm/tempo/SignatureEnvelope.js +107 -169
- package/_esm/tempo/SignatureEnvelope.js.map +1 -1
- package/_esm/tempo/TransactionRequest.js +5 -1
- package/_esm/tempo/TransactionRequest.js.map +1 -1
- package/_esm/tempo/index.js +3 -1
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/tempo/KeyAuthorization.d.ts +48 -38
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
- package/_types/tempo/MultisigConfig.d.ts +15 -14
- package/_types/tempo/MultisigConfig.d.ts.map +1 -1
- package/_types/tempo/MultisigOperation.d.ts +3 -2
- package/_types/tempo/MultisigOperation.d.ts.map +1 -1
- package/_types/tempo/MultisigSimulation.d.ts +2 -49
- package/_types/tempo/MultisigSimulation.d.ts.map +1 -1
- package/_types/tempo/SignatureEnvelope.d.ts +69 -128
- package/_types/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/_types/tempo/TransactionRequest.d.ts +5 -2
- package/_types/tempo/TransactionRequest.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +3 -1
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/package.json +1 -1
- package/tempo/AuthorizationTempo.test.ts +8 -4
- package/tempo/KeyAuthorization.test-d.ts +68 -33
- package/tempo/KeyAuthorization.test.ts +89 -8
- package/tempo/KeyAuthorization.ts +124 -61
- package/tempo/MultisigConfig.test.ts +34 -26
- package/tempo/MultisigConfig.ts +54 -24
- package/tempo/MultisigOperation.test.ts +79 -550
- package/tempo/MultisigOperation.ts +31 -146
- package/tempo/MultisigSimulation.test-d.ts +2 -2
- package/tempo/MultisigSimulation.test.ts +21 -110
- package/tempo/MultisigSimulation.ts +25 -99
- package/tempo/SignatureEnvelope.test-d.ts +29 -67
- package/tempo/SignatureEnvelope.test.ts +301 -568
- package/tempo/SignatureEnvelope.ts +156 -274
- package/tempo/TransactionRequest.test-d.ts +6 -5
- package/tempo/TransactionRequest.test.ts +17 -80
- package/tempo/TransactionRequest.ts +23 -3
- package/tempo/index.ts +3 -1
- package/tempo/multisig.e2e.test.ts +322 -861
- package/version.ts +1 -1
|
@@ -1,78 +1,40 @@
|
|
|
1
1
|
import { expectTypeOf, test } from 'vitest'
|
|
2
|
-
import * as
|
|
2
|
+
import type * as Hex from '../core/Hex.js'
|
|
3
3
|
import * as SignatureEnvelope from './SignatureEnvelope.js'
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r: 1n,
|
|
15
|
-
s: 2n,
|
|
16
|
-
yParity: 0,
|
|
5
|
+
const primitive = SignatureEnvelope.from({ r: 1n, s: 2n, yParity: 0 })
|
|
6
|
+
const envelope = SignatureEnvelope.from({
|
|
7
|
+
account: '0x2222222222222222222222222222222222222222',
|
|
8
|
+
config: {
|
|
9
|
+
threshold: 1,
|
|
10
|
+
version: 0n,
|
|
11
|
+
owners: [
|
|
12
|
+
{ owner: '0x1111111111111111111111111111111111111111', weight: 1 },
|
|
13
|
+
],
|
|
17
14
|
},
|
|
18
|
-
|
|
19
|
-
} as const satisfies SignatureEnvelope.Secp256k1
|
|
20
|
-
|
|
21
|
-
const config = MultisigConfig.from({
|
|
22
|
-
owners: [
|
|
23
|
-
{
|
|
24
|
-
owner: '0x1111111111111111111111111111111111111111',
|
|
25
|
-
weight: 1,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
threshold: 1,
|
|
15
|
+
signatures: [primitive],
|
|
29
16
|
})
|
|
30
17
|
|
|
31
|
-
test('
|
|
18
|
+
test('preserves primitive and multisig RPC types', () => {
|
|
32
19
|
expectTypeOf(
|
|
33
|
-
SignatureEnvelope.toRpc(
|
|
20
|
+
SignatureEnvelope.toRpc(primitive),
|
|
34
21
|
).toEqualTypeOf<SignatureEnvelope.Secp256k1Rpc>()
|
|
22
|
+
expectTypeOf(SignatureEnvelope.toRpc(envelope)).toEqualTypeOf<Hex.Hex>()
|
|
23
|
+
expectTypeOf<
|
|
24
|
+
SignatureEnvelope.GetType<typeof envelope>
|
|
25
|
+
>().toEqualTypeOf<'multisig'>()
|
|
26
|
+
expectTypeOf(envelope).toMatchTypeOf<SignatureEnvelope.Multisig>()
|
|
35
27
|
})
|
|
36
28
|
|
|
37
|
-
test('
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
expectTypeOf(multisig).toMatchTypeOf<SignatureEnvelope.Multisig>()
|
|
50
|
-
expectTypeOf(multisig.config.version).toEqualTypeOf<bigint>()
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
test('from requires an account for a current config', () => {
|
|
54
|
-
// @ts-expect-error Current configurations require an explicit account.
|
|
55
|
-
SignatureEnvelope.from({
|
|
56
|
-
config: { ...config, version: 1 },
|
|
57
|
-
signatures: [signature],
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const multisig = SignatureEnvelope.from({
|
|
61
|
-
account: '0x2222222222222222222222222222222222222222',
|
|
62
|
-
config: { ...config, version: 1 },
|
|
63
|
-
signatures: [signature],
|
|
64
|
-
})
|
|
65
|
-
expectTypeOf(multisig).toMatchTypeOf<SignatureEnvelope.Multisig>()
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
test('MultisigRpc rejects structured signatures', () => {
|
|
69
|
-
const structured = {
|
|
70
|
-
account: '0x1111111111111111111111111111111111111111',
|
|
71
|
-
config: { ...config, version: 0 },
|
|
72
|
-
signatures: [signatureRpc],
|
|
73
|
-
} as const
|
|
74
|
-
// @ts-expect-error Multisig RPC signatures are serialized hex.
|
|
75
|
-
const rpc: SignatureEnvelope.MultisigRpc = structured
|
|
76
|
-
|
|
77
|
-
expectTypeOf(rpc).toEqualTypeOf<SignatureEnvelope.MultisigRpc>()
|
|
29
|
+
test('requires config and primitive approvals', () => {
|
|
30
|
+
// @ts-expect-error Every multisig signature carries its current config.
|
|
31
|
+
SignatureEnvelope.from({ account: envelope.account, signatures: [primitive] })
|
|
32
|
+
// @ts-expect-error Multisig owners cannot recursively approve with multisigs.
|
|
33
|
+
SignatureEnvelope.from({ ...envelope, signatures: [envelope] })
|
|
34
|
+
// @ts-expect-error Multisig RPC signatures are hex-encoded RLP.
|
|
35
|
+
const rpc: SignatureEnvelope.MultisigRpc = {
|
|
36
|
+
account: envelope.account,
|
|
37
|
+
signatures: [],
|
|
38
|
+
}
|
|
39
|
+
expectTypeOf(rpc).toEqualTypeOf<Hex.Hex>()
|
|
78
40
|
})
|