ox 0.14.55 → 0.14.57
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 +48 -0
- package/_cjs/tempo/{MultisigConfig.js → AccountConfig.js} +32 -9
- package/_cjs/tempo/AccountConfig.js.map +1 -0
- package/_cjs/tempo/{MultisigOperation.js → AccountOperation.js} +29 -29
- package/_cjs/tempo/AccountOperation.js.map +1 -0
- package/_cjs/tempo/{MultisigSimulation.js → AccountSimulation.js} +22 -13
- package/_cjs/tempo/AccountSimulation.js.map +1 -0
- package/_cjs/tempo/KeyAuthorization.js +10 -18
- package/_cjs/tempo/KeyAuthorization.js.map +1 -1
- package/_cjs/tempo/SignatureEnvelope.js +64 -64
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
- package/_cjs/tempo/TransactionRequest.js +15 -10
- package/_cjs/tempo/TransactionRequest.js.map +1 -1
- package/_cjs/tempo/index.js +4 -4
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/tempo/{MultisigConfig.js → AccountConfig.js} +161 -64
- package/_esm/tempo/AccountConfig.js.map +1 -0
- package/_esm/tempo/{MultisigOperation.js → AccountOperation.js} +64 -64
- package/_esm/tempo/AccountOperation.js.map +1 -0
- package/_esm/tempo/{MultisigSimulation.js → AccountSimulation.js} +35 -25
- package/_esm/tempo/AccountSimulation.js.map +1 -0
- package/_esm/tempo/KeyAuthorization.js +16 -19
- package/_esm/tempo/KeyAuthorization.js.map +1 -1
- package/_esm/tempo/SignatureEnvelope.js +71 -71
- package/_esm/tempo/SignatureEnvelope.js.map +1 -1
- package/_esm/tempo/TransactionRequest.js +15 -10
- package/_esm/tempo/TransactionRequest.js.map +1 -1
- package/_esm/tempo/index.js +50 -48
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/tempo/{MultisigConfig.d.ts → AccountConfig.d.ts} +156 -66
- package/_types/tempo/AccountConfig.d.ts.map +1 -0
- package/_types/tempo/{MultisigOperation.d.ts → AccountOperation.d.ts} +62 -62
- package/_types/tempo/AccountOperation.d.ts.map +1 -0
- package/_types/tempo/{MultisigSimulation.d.ts → AccountSimulation.d.ts} +25 -21
- package/_types/tempo/AccountSimulation.d.ts.map +1 -0
- package/_types/tempo/KeyAuthorization.d.ts +28 -23
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
- package/_types/tempo/RpcSchemaTempo.d.ts +13 -13
- package/_types/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/_types/tempo/SignatureEnvelope.d.ts +36 -33
- package/_types/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/_types/tempo/TransactionRequest.d.ts +11 -9
- package/_types/tempo/TransactionRequest.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +50 -48
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/package.json +31 -31
- package/tempo/AccountConfig/package.json +6 -0
- package/tempo/AccountConfig.test-d/package.json +6 -0
- package/tempo/AccountConfig.test-d.ts +72 -0
- package/tempo/AccountConfig.test.ts +642 -0
- package/tempo/{MultisigConfig.ts → AccountConfig.ts} +212 -75
- package/tempo/AccountOperation/package.json +6 -0
- package/tempo/AccountOperation.test-d/package.json +6 -0
- package/tempo/AccountOperation.test-d.ts +71 -0
- package/tempo/{MultisigOperation.test.ts → AccountOperation.test.ts} +129 -129
- package/tempo/{MultisigOperation.ts → AccountOperation.ts} +95 -97
- package/tempo/AccountSimulation/package.json +6 -0
- package/tempo/AccountSimulation.test-d/package.json +6 -0
- package/tempo/{MultisigSimulation.test-d.ts → AccountSimulation.test-d.ts} +7 -9
- package/tempo/{MultisigSimulation.test.ts → AccountSimulation.test.ts} +73 -29
- package/tempo/{MultisigSimulation.ts → AccountSimulation.ts} +47 -35
- package/tempo/KeyAuthorization.test-d.ts +19 -29
- package/tempo/KeyAuthorization.test.ts +151 -74
- package/tempo/KeyAuthorization.ts +40 -61
- package/tempo/RpcSchemaTempo.test-d.ts +20 -20
- package/tempo/RpcSchemaTempo.ts +13 -13
- package/tempo/SignatureEnvelope.test-d.ts +7 -7
- package/tempo/SignatureEnvelope.test.ts +34 -34
- package/tempo/SignatureEnvelope.ts +107 -103
- package/tempo/Transaction.test.ts +4 -4
- package/tempo/TransactionRequest.test-d.ts +17 -8
- package/tempo/TransactionRequest.test.ts +31 -21
- package/tempo/TransactionRequest.ts +29 -20
- package/tempo/{multisig.e2e.test.ts → configurableAccounts.e2e.test.ts} +16 -16
- package/tempo/index.ts +50 -48
- package/version.ts +1 -1
- package/_cjs/tempo/MultisigConfig.js.map +0 -1
- package/_cjs/tempo/MultisigOperation.js.map +0 -1
- package/_cjs/tempo/MultisigSimulation.js.map +0 -1
- package/_esm/tempo/MultisigConfig.js.map +0 -1
- package/_esm/tempo/MultisigOperation.js.map +0 -1
- package/_esm/tempo/MultisigSimulation.js.map +0 -1
- package/_types/tempo/MultisigConfig.d.ts.map +0 -1
- package/_types/tempo/MultisigOperation.d.ts.map +0 -1
- package/_types/tempo/MultisigSimulation.d.ts.map +0 -1
- package/tempo/MultisigConfig/package.json +0 -6
- package/tempo/MultisigConfig.test-d/package.json +0 -6
- package/tempo/MultisigConfig.test-d.ts +0 -52
- package/tempo/MultisigConfig.test.ts +0 -391
- package/tempo/MultisigOperation/package.json +0 -6
- package/tempo/MultisigOperation.test-d/package.json +0 -6
- package/tempo/MultisigOperation.test-d.ts +0 -71
- package/tempo/MultisigSimulation/package.json +0 -6
- package/tempo/MultisigSimulation.test-d/package.json +0 -6
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
WebCryptoP256,
|
|
11
11
|
} from 'ox'
|
|
12
12
|
import { describe, expect, test } from 'vitest'
|
|
13
|
-
import * as
|
|
13
|
+
import * as AccountConfig from './AccountConfig.js'
|
|
14
14
|
import * as SignatureEnvelope from './SignatureEnvelope.js'
|
|
15
15
|
|
|
16
16
|
const publicKey = PublicKey.from({
|
|
@@ -514,7 +514,7 @@ describe('deserialize', () => {
|
|
|
514
514
|
SignatureEnvelope.deserialize('0xdeadbeef'),
|
|
515
515
|
).toThrowErrorMatchingInlineSnapshot(
|
|
516
516
|
`
|
|
517
|
-
[SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xde. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (
|
|
517
|
+
[SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xde. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Configurable)
|
|
518
518
|
|
|
519
519
|
Serialized: 0xdeadbeef]
|
|
520
520
|
`,
|
|
@@ -674,7 +674,7 @@ describe('deserialize', () => {
|
|
|
674
674
|
SignatureEnvelope.deserialize(unknownType),
|
|
675
675
|
).toThrowErrorMatchingInlineSnapshot(
|
|
676
676
|
`
|
|
677
|
-
[SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xff. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (
|
|
677
|
+
[SignatureEnvelope.InvalidSerializedError: Unable to deserialize signature envelope: Unknown signature type identifier: 0xff. Expected 0x01 (P256), 0x02 (WebAuthn), 0x03 (Keychain V1), 0x04 (Keychain V2), or 0x05 (Configurable)
|
|
678
678
|
|
|
679
679
|
Serialized: 0xff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000]
|
|
680
680
|
`,
|
|
@@ -1099,7 +1099,7 @@ describe('from', () => {
|
|
|
1099
1099
|
})
|
|
1100
1100
|
})
|
|
1101
1101
|
|
|
1102
|
-
describe('
|
|
1102
|
+
describe('configurable', () => {
|
|
1103
1103
|
test('normalizes the current config', () => {
|
|
1104
1104
|
const envelope = SignatureEnvelope.from({
|
|
1105
1105
|
account: '0x2222222222222222222222222222222222222222',
|
|
@@ -1726,7 +1726,7 @@ describe('serialize', () => {
|
|
|
1726
1726
|
})
|
|
1727
1727
|
})
|
|
1728
1728
|
|
|
1729
|
-
describe('
|
|
1729
|
+
describe('sortApprovals', () => {
|
|
1730
1730
|
// Build owner key pairs first so we can construct a real genesis config
|
|
1731
1731
|
// whose owner set matches the keys that produce the approvals below.
|
|
1732
1732
|
const ownerKeys = Array.from({ length: 3 }, () => {
|
|
@@ -1740,16 +1740,16 @@ describe('sortMultisigApprovals', () => {
|
|
|
1740
1740
|
Hex.toBigInt(a.address) < Hex.toBigInt(b.address) ? -1 : 1,
|
|
1741
1741
|
)
|
|
1742
1742
|
|
|
1743
|
-
const genesisConfig =
|
|
1743
|
+
const genesisConfig = AccountConfig.from({
|
|
1744
1744
|
threshold: 2,
|
|
1745
1745
|
owners: ascendingOwners.map((o) => ({ owner: o.address, weight: 1 })),
|
|
1746
1746
|
})
|
|
1747
1747
|
const payload = `0x${'42'.repeat(32)}` as const
|
|
1748
|
-
const account =
|
|
1748
|
+
const account = AccountConfig.getAddress(genesisConfig, {
|
|
1749
1749
|
factory: '0x7171717171717171717171717171717171717171',
|
|
1750
1750
|
})
|
|
1751
1751
|
const version = 3n
|
|
1752
|
-
const digest =
|
|
1752
|
+
const digest = AccountConfig.getSignPayload({
|
|
1753
1753
|
payload,
|
|
1754
1754
|
account,
|
|
1755
1755
|
config: { version },
|
|
@@ -1767,7 +1767,7 @@ describe('sortMultisigApprovals', () => {
|
|
|
1767
1767
|
}))
|
|
1768
1768
|
|
|
1769
1769
|
test('behavior: orders approvals ascending by recovered owner address', () => {
|
|
1770
|
-
const ordered = SignatureEnvelope.
|
|
1770
|
+
const ordered = SignatureEnvelope.sortApprovals({
|
|
1771
1771
|
account,
|
|
1772
1772
|
config: { version },
|
|
1773
1773
|
payload,
|
|
@@ -1780,7 +1780,7 @@ describe('sortMultisigApprovals', () => {
|
|
|
1780
1780
|
test('behavior: already-sorted input is unchanged', () => {
|
|
1781
1781
|
const signatures = ascending.map((owner) => owner.signature)
|
|
1782
1782
|
expect(
|
|
1783
|
-
SignatureEnvelope.
|
|
1783
|
+
SignatureEnvelope.sortApprovals({
|
|
1784
1784
|
account,
|
|
1785
1785
|
config: { version },
|
|
1786
1786
|
payload,
|
|
@@ -1790,7 +1790,7 @@ describe('sortMultisigApprovals', () => {
|
|
|
1790
1790
|
})
|
|
1791
1791
|
|
|
1792
1792
|
test('behavior: recovered order matches the config owner order', () => {
|
|
1793
|
-
const ordered = SignatureEnvelope.
|
|
1793
|
+
const ordered = SignatureEnvelope.sortApprovals({
|
|
1794
1794
|
account,
|
|
1795
1795
|
config: { version },
|
|
1796
1796
|
payload,
|
|
@@ -2804,9 +2804,9 @@ describe('CoercionError', () => {
|
|
|
2804
2804
|
})
|
|
2805
2805
|
})
|
|
2806
2806
|
|
|
2807
|
-
describe('
|
|
2807
|
+
describe('configurable', () => {
|
|
2808
2808
|
const account = '0x2222222222222222222222222222222222222222'
|
|
2809
|
-
const config =
|
|
2809
|
+
const config = AccountConfig.from({
|
|
2810
2810
|
threshold: 1,
|
|
2811
2811
|
owners: [
|
|
2812
2812
|
{ owner: '0x1111111111111111111111111111111111111111', weight: 1 },
|
|
@@ -2825,7 +2825,7 @@ describe('multisig', () => {
|
|
|
2825
2825
|
expect(Rlp.toHex(Hex.slice(serialized, 1))).toEqual([
|
|
2826
2826
|
account,
|
|
2827
2827
|
[
|
|
2828
|
-
|
|
2828
|
+
AccountConfig.zeroSalt,
|
|
2829
2829
|
'0x',
|
|
2830
2830
|
'0x01',
|
|
2831
2831
|
[['0x1111111111111111111111111111111111111111', '0x01']],
|
|
@@ -2866,7 +2866,7 @@ describe('multisig', () => {
|
|
|
2866
2866
|
})
|
|
2867
2867
|
|
|
2868
2868
|
test('rejects old wire and RPC shapes', () => {
|
|
2869
|
-
for (const first of [account,
|
|
2869
|
+
for (const first of [account, AccountConfig.toTuple(config)] as const)
|
|
2870
2870
|
expect(() =>
|
|
2871
2871
|
SignatureEnvelope.deserialize(
|
|
2872
2872
|
Hex.concat(
|
|
@@ -2881,7 +2881,7 @@ describe('multisig', () => {
|
|
|
2881
2881
|
})
|
|
2882
2882
|
|
|
2883
2883
|
test('rejects malformed configs', () => {
|
|
2884
|
-
const valid =
|
|
2884
|
+
const valid = AccountConfig.toTuple(config)
|
|
2885
2885
|
for (const tuple of [
|
|
2886
2886
|
['0x00', ...valid.slice(1)],
|
|
2887
2887
|
[valid[0], '0x00', valid[2], valid[3]],
|
|
@@ -2901,7 +2901,7 @@ describe('multisig', () => {
|
|
|
2901
2901
|
]),
|
|
2902
2902
|
),
|
|
2903
2903
|
),
|
|
2904
|
-
).toThrowError(
|
|
2904
|
+
).toThrowError(AccountConfig.InvalidConfigError)
|
|
2905
2905
|
})
|
|
2906
2906
|
|
|
2907
2907
|
test('rejects invalid accounts, missing configs, and invalid approval counts', () => {
|
|
@@ -2927,7 +2927,7 @@ describe('multisig', () => {
|
|
|
2927
2927
|
config: { ...config, owners: [{ owner: account, weight: 1 }] },
|
|
2928
2928
|
} as const
|
|
2929
2929
|
expect(() => SignatureEnvelope.assert(self)).toThrowError(
|
|
2930
|
-
SignatureEnvelope.
|
|
2930
|
+
SignatureEnvelope.InvalidApprovalError,
|
|
2931
2931
|
)
|
|
2932
2932
|
expect(() =>
|
|
2933
2933
|
SignatureEnvelope.assert({
|
|
@@ -2944,12 +2944,12 @@ describe('multisig', () => {
|
|
|
2944
2944
|
...envelope,
|
|
2945
2945
|
signatures: [signature],
|
|
2946
2946
|
} as never),
|
|
2947
|
-
).toThrowError(SignatureEnvelope.
|
|
2947
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
2948
2948
|
const wire = Hex.concat(
|
|
2949
2949
|
'0x05',
|
|
2950
2950
|
Rlp.fromHex([
|
|
2951
2951
|
account,
|
|
2952
|
-
|
|
2952
|
+
AccountConfig.toTuple(config),
|
|
2953
2953
|
[SignatureEnvelope.serialize(signature)],
|
|
2954
2954
|
]),
|
|
2955
2955
|
)
|
|
@@ -2969,9 +2969,9 @@ describe('multisig', () => {
|
|
|
2969
2969
|
}
|
|
2970
2970
|
expect(() =>
|
|
2971
2971
|
SignatureEnvelope.assert({ ...envelope, signatures: [oversized] }),
|
|
2972
|
-
).toThrowError(SignatureEnvelope.
|
|
2972
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
2973
2973
|
})
|
|
2974
|
-
test('requires keychain V2 for
|
|
2974
|
+
test('requires keychain V2 for configurable delegates', () => {
|
|
2975
2975
|
const keychain = SignatureEnvelope.from({
|
|
2976
2976
|
userAddress: account,
|
|
2977
2977
|
version: 'v2',
|
|
@@ -2981,12 +2981,12 @@ describe('multisig', () => {
|
|
|
2981
2981
|
expect(SignatureEnvelope.deserialize(serialized)).toEqual(keychain)
|
|
2982
2982
|
expect(() =>
|
|
2983
2983
|
SignatureEnvelope.serialize({ ...keychain, version: 'v1' }),
|
|
2984
|
-
).toThrowError(SignatureEnvelope.
|
|
2984
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
2985
2985
|
expect(() =>
|
|
2986
2986
|
SignatureEnvelope.deserialize(
|
|
2987
2987
|
Hex.concat('0x03', Hex.slice(serialized, 1)),
|
|
2988
2988
|
),
|
|
2989
|
-
).toThrowError(SignatureEnvelope.
|
|
2989
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
2990
2990
|
expect(() =>
|
|
2991
2991
|
SignatureEnvelope.fromRpc({
|
|
2992
2992
|
type: 'keychain',
|
|
@@ -2994,9 +2994,9 @@ describe('multisig', () => {
|
|
|
2994
2994
|
version: 'v1',
|
|
2995
2995
|
signature: SignatureEnvelope.toRpc(envelope),
|
|
2996
2996
|
}),
|
|
2997
|
-
).toThrowError(SignatureEnvelope.
|
|
2997
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
2998
2998
|
})
|
|
2999
|
-
test('rejects V1 wrappers around recursively nested
|
|
2999
|
+
test('rejects V1 wrappers around recursively nested configurable delegates', () => {
|
|
3000
3000
|
let inner: SignatureEnvelope.SignatureEnvelope = envelope
|
|
3001
3001
|
for (let depth = 0; depth < 3; depth++) {
|
|
3002
3002
|
inner = { inner, type: 'keychain', userAddress: account, version: 'v2' }
|
|
@@ -3010,10 +3010,10 @@ describe('multisig', () => {
|
|
|
3010
3010
|
expect(SignatureEnvelope.validate(valid)).toBe(true)
|
|
3011
3011
|
expect(SignatureEnvelope.validate(invalid)).toBe(false)
|
|
3012
3012
|
expect(() => SignatureEnvelope.serialize(invalid)).toThrowError(
|
|
3013
|
-
SignatureEnvelope.
|
|
3013
|
+
SignatureEnvelope.InvalidApprovalError,
|
|
3014
3014
|
)
|
|
3015
3015
|
expect(() => SignatureEnvelope.toRpc(invalid)).toThrowError(
|
|
3016
|
-
SignatureEnvelope.
|
|
3016
|
+
SignatureEnvelope.InvalidApprovalError,
|
|
3017
3017
|
)
|
|
3018
3018
|
expect(() =>
|
|
3019
3019
|
SignatureEnvelope.fromRpc({
|
|
@@ -3022,15 +3022,15 @@ describe('multisig', () => {
|
|
|
3022
3022
|
version: 'v1',
|
|
3023
3023
|
signature: SignatureEnvelope.toRpc(inner),
|
|
3024
3024
|
}),
|
|
3025
|
-
).toThrowError(SignatureEnvelope.
|
|
3025
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
3026
3026
|
expect(() =>
|
|
3027
3027
|
SignatureEnvelope.deserialize(
|
|
3028
3028
|
Hex.concat('0x03', account, SignatureEnvelope.serialize(inner)),
|
|
3029
3029
|
),
|
|
3030
|
-
).toThrowError(SignatureEnvelope.
|
|
3030
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
3031
3031
|
expect(() =>
|
|
3032
3032
|
SignatureEnvelope.serialize({ ...valid, inner: invalid }),
|
|
3033
|
-
).toThrowError(SignatureEnvelope.
|
|
3033
|
+
).toThrowError(SignatureEnvelope.InvalidApprovalError)
|
|
3034
3034
|
}
|
|
3035
3035
|
expect(
|
|
3036
3036
|
SignatureEnvelope.validate({
|
|
@@ -3072,7 +3072,7 @@ describe('multisig', () => {
|
|
|
3072
3072
|
})
|
|
3073
3073
|
})
|
|
3074
3074
|
|
|
3075
|
-
describe('
|
|
3075
|
+
describe('configurable vectors', () => {
|
|
3076
3076
|
const initial =
|
|
3077
3077
|
'0x05f89794c4a590afa7337e5cd5eb3aa60cacf91c5400044bf83ba000000000000000000000000000000000000000000000000000000000000000008001d7d6947e5f4552091a69125d5dfcb7b8c2659029395bdf01f843b841869437e01f64bebeb78a8a6b30bfd3a993819c8cad82c807515d9b9e9b36f98535dfaa5eebc597715d05f6ce4927747f14fa4cd2acc717fdcd3877146437f8f41b' as const
|
|
3078
3078
|
const current =
|
|
@@ -3105,7 +3105,7 @@ describe('multisig vectors', () => {
|
|
|
3105
3105
|
"type": "secp256k1",
|
|
3106
3106
|
},
|
|
3107
3107
|
],
|
|
3108
|
-
"type": "
|
|
3108
|
+
"type": "configurable",
|
|
3109
3109
|
}
|
|
3110
3110
|
`)
|
|
3111
3111
|
expect(SignatureEnvelope.serialize(envelope)).toBe(initial)
|
|
@@ -3138,7 +3138,7 @@ describe('multisig vectors', () => {
|
|
|
3138
3138
|
"type": "secp256k1",
|
|
3139
3139
|
},
|
|
3140
3140
|
],
|
|
3141
|
-
"type": "
|
|
3141
|
+
"type": "configurable",
|
|
3142
3142
|
}
|
|
3143
3143
|
`)
|
|
3144
3144
|
expect(SignatureEnvelope.serialize(envelope)).toBe(current)
|