ox 0.14.2 → 0.14.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 +12 -0
- package/_cjs/tempo/TempoAddress.js +9 -84
- package/_cjs/tempo/TempoAddress.js.map +1 -1
- package/_cjs/tempo/TxEnvelopeTempo.js +9 -2
- package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/tempo/AuthorizationTempo.js +17 -17
- package/_esm/tempo/TempoAddress.js +18 -118
- package/_esm/tempo/TempoAddress.js.map +1 -1
- package/_esm/tempo/TxEnvelopeTempo.js +24 -14
- package/_esm/tempo/TxEnvelopeTempo.js.map +1 -1
- package/_esm/tempo/index.js +12 -14
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/tempo/AuthorizationTempo.d.ts +17 -17
- package/_types/tempo/TempoAddress.d.ts +14 -69
- package/_types/tempo/TempoAddress.d.ts.map +1 -1
- package/_types/tempo/TxEnvelopeTempo.d.ts +12 -12
- package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -1
- package/_types/tempo/index.d.ts +12 -14
- 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 +1 -1
- package/tempo/AuthorizationTempo.ts +17 -17
- package/tempo/KeyAuthorization.test.ts +2 -2
- package/tempo/PoolId.test.ts +2 -2
- package/tempo/TempoAddress.test.ts +22 -191
- package/tempo/TempoAddress.ts +21 -139
- package/tempo/TokenId.test.ts +3 -3
- package/tempo/TxEnvelopeTempo.test.ts +44 -4
- package/tempo/TxEnvelopeTempo.ts +25 -14
- package/tempo/index.ts +12 -14
- package/version.ts +1 -1
package/tempo/TxEnvelopeTempo.ts
CHANGED
|
@@ -155,7 +155,7 @@ export type Type = typeof type
|
|
|
155
155
|
* import { TxEnvelopeTempo } from 'ox/tempo'
|
|
156
156
|
*
|
|
157
157
|
* TxEnvelopeTempo.assert({
|
|
158
|
-
* calls: [{ to: '
|
|
158
|
+
* calls: [{ to: 'tempox0x0000000000000000000000000000000000000000', value: 0n }],
|
|
159
159
|
* chainId: 1,
|
|
160
160
|
* maxFeePerGas: 1000000000n,
|
|
161
161
|
* })
|
|
@@ -414,7 +414,7 @@ export declare namespace deserialize {
|
|
|
414
414
|
* chainId: 1, // [!code focus]
|
|
415
415
|
* calls: [{ // [!code focus]
|
|
416
416
|
* data: '0xdeadbeef', // [!code focus]
|
|
417
|
-
* to: '
|
|
417
|
+
* to: 'tempox0x0000000000000000000000000000000000000000', // [!code focus]
|
|
418
418
|
* }], // [!code focus]
|
|
419
419
|
* maxFeePerGas: Value.fromGwei('10'), // [!code focus]
|
|
420
420
|
* maxPriorityFeePerGas: Value.fromGwei('1'), // [!code focus]
|
|
@@ -435,7 +435,7 @@ export declare namespace deserialize {
|
|
|
435
435
|
* chainId: 1,
|
|
436
436
|
* calls: [{
|
|
437
437
|
* data: '0xdeadbeef',
|
|
438
|
-
* to: '
|
|
438
|
+
* to: 'tempox0x0000000000000000000000000000000000000000',
|
|
439
439
|
* }],
|
|
440
440
|
* maxFeePerGas: Value.fromGwei('10'),
|
|
441
441
|
* maxPriorityFeePerGas: Value.fromGwei('1'),
|
|
@@ -573,7 +573,7 @@ export declare namespace from {
|
|
|
573
573
|
* chainId: 1,
|
|
574
574
|
* calls: [{
|
|
575
575
|
* data: '0xdeadbeef',
|
|
576
|
-
* to: '
|
|
576
|
+
* to: 'tempox0x0000000000000000000000000000000000000000',
|
|
577
577
|
* }],
|
|
578
578
|
* maxFeePerGas: Value.fromGwei('10'),
|
|
579
579
|
* })
|
|
@@ -595,7 +595,7 @@ export declare namespace from {
|
|
|
595
595
|
* chainId: 1,
|
|
596
596
|
* calls: [{
|
|
597
597
|
* data: '0xdeadbeef',
|
|
598
|
-
* to: '
|
|
598
|
+
* to: 'tempox0x0000000000000000000000000000000000000000',
|
|
599
599
|
* }],
|
|
600
600
|
* maxFeePerGas: Value.fromGwei('10'),
|
|
601
601
|
* })
|
|
@@ -651,6 +651,7 @@ export function serialize(
|
|
|
651
651
|
call.data ?? '0x',
|
|
652
652
|
])
|
|
653
653
|
|
|
654
|
+
let skipFeeToken = false
|
|
654
655
|
const feePayerSignatureOrSender = (() => {
|
|
655
656
|
// Explicit sender address provided — use as-is.
|
|
656
657
|
if (options.sender) return options.sender
|
|
@@ -680,7 +681,11 @@ export function serialize(
|
|
|
680
681
|
: envelope.feePayerSignature
|
|
681
682
|
// `null` indicates the envelope is intended to be signed by a fee payer
|
|
682
683
|
// but hasn't been signed yet — encode as a single zero byte marker.
|
|
683
|
-
|
|
684
|
+
// The sender does not commit to feeToken, so skip it.
|
|
685
|
+
if (feePayerSignature === null) {
|
|
686
|
+
skipFeeToken = true
|
|
687
|
+
return '0x00'
|
|
688
|
+
}
|
|
684
689
|
// No fee payer involvement — omit from the envelope.
|
|
685
690
|
if (!feePayerSignature) return '0x'
|
|
686
691
|
// Fee payer has signed — encode the signature as an RLP tuple.
|
|
@@ -698,7 +703,8 @@ export function serialize(
|
|
|
698
703
|
nonce ? Hex.fromNumber(nonce) : '0x',
|
|
699
704
|
typeof validBefore === 'number' ? Hex.fromNumber(validBefore) : '0x',
|
|
700
705
|
typeof validAfter === 'number' ? Hex.fromNumber(validAfter) : '0x',
|
|
701
|
-
|
|
706
|
+
!skipFeeToken &&
|
|
707
|
+
(typeof feeToken === 'bigint' || typeof feeToken === 'string')
|
|
702
708
|
? TokenId.toAddress(feeToken)
|
|
703
709
|
: '0x',
|
|
704
710
|
feePayerSignatureOrSender,
|
|
@@ -780,7 +786,7 @@ export declare namespace serialize {
|
|
|
780
786
|
* chainId: 1,
|
|
781
787
|
* calls: [{
|
|
782
788
|
* data: '0xdeadbeef',
|
|
783
|
-
* to: '
|
|
789
|
+
* to: 'tempox0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
784
790
|
* }],
|
|
785
791
|
* nonce: 0n,
|
|
786
792
|
* maxFeePerGas: 1000000000n,
|
|
@@ -810,7 +816,7 @@ export declare namespace serialize {
|
|
|
810
816
|
* chainId: 1,
|
|
811
817
|
* calls: [{
|
|
812
818
|
* data: '0xdeadbeef',
|
|
813
|
-
* to: '
|
|
819
|
+
* to: 'tempox0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
814
820
|
* }],
|
|
815
821
|
* nonce: 0n,
|
|
816
822
|
* maxFeePerGas: 1000000000n,
|
|
@@ -874,7 +880,7 @@ export declare namespace getSignPayload {
|
|
|
874
880
|
* chainId: 1,
|
|
875
881
|
* calls: [{
|
|
876
882
|
* data: '0xdeadbeef',
|
|
877
|
-
* to: '
|
|
883
|
+
* to: 'tempox0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
878
884
|
* }],
|
|
879
885
|
* nonce: 0n,
|
|
880
886
|
* maxFeePerGas: 1000000000n,
|
|
@@ -904,6 +910,11 @@ export function hash<presign extends boolean = false>(
|
|
|
904
910
|
...(options.presign
|
|
905
911
|
? {
|
|
906
912
|
signature: undefined,
|
|
913
|
+
// When a fee payer signature is present, normalize to `null`
|
|
914
|
+
// (the presign marker).
|
|
915
|
+
...(envelope.feePayerSignature !== undefined
|
|
916
|
+
? { feePayerSignature: null }
|
|
917
|
+
: {}),
|
|
907
918
|
}
|
|
908
919
|
: {}),
|
|
909
920
|
})
|
|
@@ -948,7 +959,7 @@ export declare namespace hash {
|
|
|
948
959
|
* chainId: 1,
|
|
949
960
|
* calls: [{
|
|
950
961
|
* data: '0xdeadbeef',
|
|
951
|
-
* to: '
|
|
962
|
+
* to: 'tempox0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
952
963
|
* }],
|
|
953
964
|
* nonce: 0n,
|
|
954
965
|
* maxFeePerGas: 1000000000n,
|
|
@@ -956,7 +967,7 @@ export declare namespace hash {
|
|
|
956
967
|
* })
|
|
957
968
|
*
|
|
958
969
|
* const payload = TxEnvelopeTempo.getFeePayerSignPayload(envelope, {
|
|
959
|
-
* sender: '
|
|
970
|
+
* sender: 'tempox0xd8da6bf26964af9d7eed9e03e53415d37aa96045'
|
|
960
971
|
* }) // [!code focus]
|
|
961
972
|
* // @log: '0x...'
|
|
962
973
|
*
|
|
@@ -1005,7 +1016,7 @@ export declare namespace getFeePayerSignPayload {
|
|
|
1005
1016
|
* const valid = TxEnvelopeTempo.validate({
|
|
1006
1017
|
* calls: [{
|
|
1007
1018
|
* data: '0xdeadbeef',
|
|
1008
|
-
* to: '
|
|
1019
|
+
* to: 'tempox0x0000000000000000000000000000000000000000',
|
|
1009
1020
|
* }],
|
|
1010
1021
|
* chainId: 1,
|
|
1011
1022
|
* maxFeePerGas: 1000000000n,
|
|
@@ -1057,7 +1068,7 @@ export class CallsEmptyError extends Errors.BaseError {
|
|
|
1057
1068
|
* import { TxEnvelopeTempo } from 'ox/tempo'
|
|
1058
1069
|
*
|
|
1059
1070
|
* TxEnvelopeTempo.assert({
|
|
1060
|
-
* calls: [{ to: '
|
|
1071
|
+
* calls: [{ to: 'tempox0x0000000000000000000000000000000000000000' }],
|
|
1061
1072
|
* chainId: 1,
|
|
1062
1073
|
* validBefore: 100,
|
|
1063
1074
|
* validAfter: 200,
|
package/tempo/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type {}
|
|
|
17
17
|
* import { AuthorizationTempo } from 'ox/tempo'
|
|
18
18
|
*
|
|
19
19
|
* const authorization = AuthorizationTempo.from({
|
|
20
|
-
* address: '
|
|
20
|
+
* address: 'tempox0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
|
|
21
21
|
* chainId: 1,
|
|
22
22
|
* nonce: 40n,
|
|
23
23
|
* })
|
|
@@ -59,7 +59,7 @@ export * as AuthorizationTempo from './AuthorizationTempo.js'
|
|
|
59
59
|
* expiry: 1234567890,
|
|
60
60
|
* type: 'p256',
|
|
61
61
|
* limits: [{
|
|
62
|
-
* token: '
|
|
62
|
+
* token: 'tempox0x20c0000000000000000000000000000000000001',
|
|
63
63
|
* limit: Value.from('10', 6),
|
|
64
64
|
* }],
|
|
65
65
|
* })
|
|
@@ -125,19 +125,17 @@ export * as SignatureEnvelope from './SignatureEnvelope.js'
|
|
|
125
125
|
/**
|
|
126
126
|
* Tempo address encoding/decoding utilities for human-readable addresses.
|
|
127
127
|
*
|
|
128
|
-
* Tempo addresses use a
|
|
129
|
-
* and `tempoz1` prefix for zone addresses. Includes CompactSize zone ID encoding
|
|
130
|
-
* and double-SHA256 checksumming.
|
|
128
|
+
* Tempo addresses use a simple `tempox` prefix before the hex address.
|
|
131
129
|
*
|
|
132
130
|
* @example
|
|
133
131
|
* ```ts twoslash
|
|
134
132
|
* import { TempoAddress } from 'ox/tempo'
|
|
135
133
|
*
|
|
136
134
|
* const encoded = TempoAddress.format('0x742d35Cc6634C0532925a3b844Bc9e7595f2bD28')
|
|
137
|
-
* // @log: '
|
|
135
|
+
* // @log: 'tempox0x742d35cc6634c0532925a3b844bc9e7595f2bd28'
|
|
138
136
|
*
|
|
139
|
-
* const { address
|
|
140
|
-
* // @log: { address: '0x742d35CC6634c0532925a3B844bc9e7595F2Bd28'
|
|
137
|
+
* const { address } = TempoAddress.parse(encoded)
|
|
138
|
+
* // @log: { address: '0x742d35CC6634c0532925a3B844bc9e7595F2Bd28' }
|
|
141
139
|
* ```
|
|
142
140
|
*
|
|
143
141
|
* @category Reference
|
|
@@ -180,7 +178,7 @@ export * as Tick from './Tick.js'
|
|
|
180
178
|
*
|
|
181
179
|
* const tokenId = TokenId.from(1n)
|
|
182
180
|
* const address = TokenId.toAddress(1n)
|
|
183
|
-
* // '
|
|
181
|
+
* // 'tempox0x20c0000000000000000000000000000000000001'
|
|
184
182
|
* ```
|
|
185
183
|
*
|
|
186
184
|
* @category Reference
|
|
@@ -232,7 +230,7 @@ export * as TokenRole from './TokenRole.js'
|
|
|
232
230
|
* value: '0x9b6e64a8ec60000',
|
|
233
231
|
* },
|
|
234
232
|
* ],
|
|
235
|
-
* feeToken: '
|
|
233
|
+
* feeToken: 'tempox0x20c0000000000000000000000000000000000000',
|
|
236
234
|
* transactionIndex: '0x2',
|
|
237
235
|
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
238
236
|
* value: '0x9b6e64a8ec60000',
|
|
@@ -271,7 +269,7 @@ export * as Transaction from './Transaction.js'
|
|
|
271
269
|
* const receipt = TransactionReceipt.fromRpc({
|
|
272
270
|
* status: '0x1',
|
|
273
271
|
* feePayer: '0x...',
|
|
274
|
-
* feeToken: '
|
|
272
|
+
* feeToken: 'tempox0x20c0000000000000000000000000000000000001',
|
|
275
273
|
* // ... other fields
|
|
276
274
|
* } as any)
|
|
277
275
|
* ```
|
|
@@ -292,8 +290,8 @@ export * as TransactionReceipt from './TransactionReceipt.js'
|
|
|
292
290
|
* import { TransactionRequest } from 'ox/tempo'
|
|
293
291
|
*
|
|
294
292
|
* const request = TransactionRequest.toRpc({
|
|
295
|
-
* calls: [{ to: '
|
|
296
|
-
* feeToken: '
|
|
293
|
+
* calls: [{ to: 'tempox0xcafebabecafebabecafebabecafebabecafebabe', data: '0xdeadbeef' }],
|
|
294
|
+
* feeToken: 'tempox0x20c0000000000000000000000000000000000000',
|
|
297
295
|
* })
|
|
298
296
|
* ```
|
|
299
297
|
*
|
|
@@ -315,7 +313,7 @@ export * as TransactionRequest from './TransactionRequest.js'
|
|
|
315
313
|
*
|
|
316
314
|
* const envelope = TxEnvelopeTempo.from({
|
|
317
315
|
* chainId: 1,
|
|
318
|
-
* calls: [{ to: '
|
|
316
|
+
* calls: [{ to: 'tempox0x0000000000000000000000000000000000000000', data: '0xdeadbeef' }],
|
|
319
317
|
* maxFeePerGas: Value.fromGwei('10'),
|
|
320
318
|
* })
|
|
321
319
|
*
|
package/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '0.14.
|
|
2
|
+
export const version = '0.14.4'
|