ox 0.14.28 → 0.14.29
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/MultisigConfig.js +11 -3
- package/_cjs/tempo/MultisigConfig.js.map +1 -1
- package/_cjs/tempo/SignatureEnvelope.js +39 -18
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/tempo/MultisigConfig.js +62 -11
- package/_esm/tempo/MultisigConfig.js.map +1 -1
- package/_esm/tempo/SignatureEnvelope.js +93 -26
- package/_esm/tempo/SignatureEnvelope.js.map +1 -1
- package/_esm/tempo/index.js +2 -2
- package/_esm/version.js +1 -1
- package/_types/tempo/MultisigConfig.d.ts +72 -16
- package/_types/tempo/MultisigConfig.d.ts.map +1 -1
- package/_types/tempo/SignatureEnvelope.d.ts +77 -15
- package/_types/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +2 -2
- package/_types/version.d.ts +1 -1
- package/package.json +1 -1
- package/tempo/MultisigConfig.test.ts +21 -12
- package/tempo/MultisigConfig.ts +96 -18
- package/tempo/SignatureEnvelope.test.ts +124 -26
- package/tempo/SignatureEnvelope.ts +144 -44
- package/tempo/e2e.test.ts +20 -36
- package/tempo/index.ts +2 -2
- package/version.ts +1 -1
package/tempo/e2e.test.ts
CHANGED
|
@@ -3015,7 +3015,7 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3015
3015
|
return { address, privateKey } as const
|
|
3016
3016
|
})
|
|
3017
3017
|
|
|
3018
|
-
const
|
|
3018
|
+
const genesisConfig = MultisigConfig.from({
|
|
3019
3019
|
// A fresh random salt yields a distinct account each run, exercising the
|
|
3020
3020
|
// salt-inclusive config-ID derivation against the node.
|
|
3021
3021
|
salt: Hex.random(32),
|
|
@@ -3025,10 +3025,9 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3025
3025
|
weight: 1,
|
|
3026
3026
|
})),
|
|
3027
3027
|
})
|
|
3028
|
-
const
|
|
3029
|
-
const account = MultisigConfig.getAddress({ configId })
|
|
3028
|
+
const account = MultisigConfig.getAddress(genesisConfig)
|
|
3030
3029
|
|
|
3031
|
-
return { account,
|
|
3030
|
+
return { account, genesisConfig, ownerKeys } as const
|
|
3032
3031
|
}
|
|
3033
3032
|
|
|
3034
3033
|
// Signs the multisig owner digest with the provided owner keys, returning
|
|
@@ -3036,32 +3035,26 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3036
3035
|
// address (required by the node: "recovered owners must be strictly
|
|
3037
3036
|
// ascending").
|
|
3038
3037
|
function approve(parameters: {
|
|
3039
|
-
|
|
3040
|
-
configId: Hex.Hex
|
|
3038
|
+
genesisConfig: MultisigConfig.Config
|
|
3041
3039
|
payload: Hex.Hex
|
|
3042
3040
|
signers: readonly { privateKey: Hex.Hex }[]
|
|
3043
3041
|
}) {
|
|
3044
|
-
const {
|
|
3045
|
-
const digest = MultisigConfig.getSignPayload({
|
|
3046
|
-
account,
|
|
3047
|
-
configId,
|
|
3048
|
-
payload,
|
|
3049
|
-
})
|
|
3042
|
+
const { genesisConfig, payload, signers } = parameters
|
|
3043
|
+
const digest = MultisigConfig.getSignPayload({ payload, genesisConfig })
|
|
3050
3044
|
const signatures = signers.map((signer) =>
|
|
3051
3045
|
SignatureEnvelope.from(
|
|
3052
3046
|
Secp256k1.sign({ payload: digest, privateKey: signer.privateKey }),
|
|
3053
3047
|
),
|
|
3054
3048
|
)
|
|
3055
3049
|
return SignatureEnvelope.sortMultisigApprovals({
|
|
3056
|
-
|
|
3057
|
-
configId,
|
|
3050
|
+
genesisConfig,
|
|
3058
3051
|
payload,
|
|
3059
3052
|
signatures,
|
|
3060
3053
|
})
|
|
3061
3054
|
}
|
|
3062
3055
|
|
|
3063
3056
|
test('behavior: bootstrap + spend (2-of-3 secp256k1)', async () => {
|
|
3064
|
-
const { account,
|
|
3057
|
+
const { account, genesisConfig, ownerKeys } = setup({
|
|
3065
3058
|
count: 3,
|
|
3066
3059
|
threshold: 2,
|
|
3067
3060
|
})
|
|
@@ -3083,15 +3076,12 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3083
3076
|
|
|
3084
3077
|
const bootstrap_signed = TxEnvelopeTempo.serialize(bootstrap, {
|
|
3085
3078
|
signature: SignatureEnvelope.from({
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
// The bootstrap config is carried by the signature `init`.
|
|
3090
|
-
init: config,
|
|
3079
|
+
genesisConfig,
|
|
3080
|
+
// Initialize multisig.
|
|
3081
|
+
init: true,
|
|
3091
3082
|
// Approve with 2 of the 3 owners to satisfy the threshold.
|
|
3092
3083
|
signatures: approve({
|
|
3093
|
-
|
|
3094
|
-
configId,
|
|
3084
|
+
genesisConfig,
|
|
3095
3085
|
payload: TxEnvelopeTempo.getSignPayload(bootstrap),
|
|
3096
3086
|
signers: [ownerKeys[0]!, ownerKeys[1]!],
|
|
3097
3087
|
}),
|
|
@@ -3121,7 +3111,7 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3121
3111
|
// The bootstrap config is carried by the multisig signature `init`.
|
|
3122
3112
|
expect(
|
|
3123
3113
|
(response.signature as SignatureEnvelope.Multisig | undefined)?.init,
|
|
3124
|
-
).toEqual(
|
|
3114
|
+
).toEqual(genesisConfig)
|
|
3125
3115
|
}
|
|
3126
3116
|
|
|
3127
3117
|
// Spend (subsequent transaction): no signature `init`, nonce 1, uses the
|
|
@@ -3143,13 +3133,10 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3143
3133
|
|
|
3144
3134
|
const spend_signed = TxEnvelopeTempo.serialize(spend, {
|
|
3145
3135
|
signature: SignatureEnvelope.from({
|
|
3146
|
-
|
|
3147
|
-
account,
|
|
3148
|
-
configId,
|
|
3136
|
+
genesisConfig,
|
|
3149
3137
|
// A different 2-of-3 subset still authorizes the transaction.
|
|
3150
3138
|
signatures: approve({
|
|
3151
|
-
|
|
3152
|
-
configId,
|
|
3139
|
+
genesisConfig,
|
|
3153
3140
|
payload: TxEnvelopeTempo.getSignPayload(spend),
|
|
3154
3141
|
signers: [ownerKeys[1]!, ownerKeys[2]!],
|
|
3155
3142
|
}),
|
|
@@ -3168,7 +3155,7 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3168
3155
|
})
|
|
3169
3156
|
|
|
3170
3157
|
test('behavior: rejects below-threshold approvals', async () => {
|
|
3171
|
-
const { account,
|
|
3158
|
+
const { account, genesisConfig, ownerKeys } = setup({
|
|
3172
3159
|
count: 3,
|
|
3173
3160
|
threshold: 2,
|
|
3174
3161
|
})
|
|
@@ -3187,15 +3174,12 @@ describe.skip('behavior: multisig (TIP-1061)', () => {
|
|
|
3187
3174
|
|
|
3188
3175
|
const serialized_signed = TxEnvelopeTempo.serialize(bootstrap, {
|
|
3189
3176
|
signature: SignatureEnvelope.from({
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
// The bootstrap config is carried by the signature `init`.
|
|
3194
|
-
init: config,
|
|
3177
|
+
genesisConfig,
|
|
3178
|
+
// Opt into bootstrap: writes `genesisConfig` into the signature `init`.
|
|
3179
|
+
init: true,
|
|
3195
3180
|
// Only one approval — below the threshold of 2.
|
|
3196
3181
|
signatures: approve({
|
|
3197
|
-
|
|
3198
|
-
configId,
|
|
3182
|
+
genesisConfig,
|
|
3199
3183
|
payload: TxEnvelopeTempo.getSignPayload(bootstrap),
|
|
3200
3184
|
signers: [ownerKeys[0]!],
|
|
3201
3185
|
}),
|
package/tempo/index.ts
CHANGED
|
@@ -114,7 +114,7 @@ export * as KeyAuthorization from './KeyAuthorization.js'
|
|
|
114
114
|
* ```ts twoslash
|
|
115
115
|
* import { MultisigConfig } from 'ox/tempo'
|
|
116
116
|
*
|
|
117
|
-
* const
|
|
117
|
+
* const genesisConfig = MultisigConfig.from({
|
|
118
118
|
* threshold: 2,
|
|
119
119
|
* owners: [
|
|
120
120
|
* { owner: '0x1111111111111111111111111111111111111111', weight: 1 },
|
|
@@ -122,7 +122,7 @@ export * as KeyAuthorization from './KeyAuthorization.js'
|
|
|
122
122
|
* ],
|
|
123
123
|
* })
|
|
124
124
|
*
|
|
125
|
-
* const account = MultisigConfig.getAddress(
|
|
125
|
+
* const account = MultisigConfig.getAddress(genesisConfig)
|
|
126
126
|
* ```
|
|
127
127
|
*
|
|
128
128
|
* @category Reference
|
package/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '0.14.
|
|
2
|
+
export const version = '0.14.29'
|