Skip to content

Commit 84e3afe

Browse files
committed
chore: tweaks
1 parent 48b26e0 commit 84e3afe

File tree

7 files changed

+52
-66
lines changed

7 files changed

+52
-66
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"ethers": "^6.15.0",
6464
"knip": "^5.64.0",
6565
"micro-eth-signer": "^0.14.0",
66-
"ox": "~0.10.6",
66+
"ox": "~0.11.0",
6767
"permissionless": "^0.2.57",
6868
"prool": "~0.2.1",
6969
"publint": "^0.2.12",

pnpm-lock.yaml

Lines changed: 17 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
"@scure/bip39": "1.6.0",
219219
"abitype": "1.2.3",
220220
"isows": "1.0.7",
221-
"ox": "0.10.6",
221+
"ox": "0.11.0",
222222
"ws": "8.18.3"
223223
},
224224
"license": "MIT",

src/tempo/Formatters.ts

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -126,31 +126,15 @@ export function formatTransactionRequest(
126126
? account.accessKeyAddress
127127
: undefined
128128
const keyAuthorization = rpc.keyAuthorization
129-
? (() => {
130-
const keyAuthorization = {
131-
...rpc.keyAuthorization,
132-
// FIXME(ox): chainId not serialized in nested object
133-
chainId:
134-
rpc.keyAuthorization.chainId === '0x' ||
135-
rpc.keyAuthorization.chainId === '0x0'
136-
? 0
137-
: parseInt(rpc.keyAuthorization.chainId || '0x0', 16),
138-
}
139-
// FIXME(ox): expects `preHash` not `prehash`
140-
if (
141-
keyAuthorization.signature &&
142-
keyAuthorization.signature.type === 'p256' &&
143-
'prehash' in keyAuthorization.signature
144-
) {
145-
const { prehash, ...rest } = keyAuthorization.signature
146-
keyAuthorization.signature = {
147-
...rest,
148-
// @ts-expect-error
149-
preHash: prehash,
150-
}
151-
}
152-
return keyAuthorization
153-
})()
129+
? {
130+
...rpc.keyAuthorization,
131+
// FIXME(ox): remove once https://github.com/tempoxyz/tempo/pull/1683 is deployed.
132+
chainId:
133+
rpc.keyAuthorization.chainId === '0x' ||
134+
rpc.keyAuthorization.chainId === '0x0'
135+
? 0
136+
: parseInt(rpc.keyAuthorization.chainId || '0x0', 16),
137+
}
154138
: undefined
155139

156140
return {

src/tempo/actions/fee.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ afterEach(async () => {
2222
describe('getUserToken', () => {
2323
test('default', async () => {
2424
// Fund accounts
25-
await fundAddress(client, { address: account2.address, sequential: true })
26-
await fundAddress(client, { address: account3.address, sequential: true })
25+
await fundAddress(client, { address: account2.address })
26+
await fundAddress(client, { address: account3.address })
2727

2828
// Set token (address)
2929
await actions.fee.setUserTokenSync(client, {

src/tempo/e2e.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ describe('sendTransaction', () => {
427427
)
428428

429429
// fund account
430-
await fundAddress(client, { address: account.address, sequential: true })
430+
await fundAddress(client, { address: account.address })
431431

432432
const receipt = await sendTransactionSync(client, {
433433
account,
@@ -501,7 +501,7 @@ describe('sendTransaction', () => {
501501
)
502502

503503
// fund account
504-
await fundAddress(client, { address: account.address, sequential: true })
504+
await fundAddress(client, { address: account.address })
505505

506506
const receipt = await sendTransactionSync(client, {
507507
account,
@@ -709,7 +709,7 @@ describe('sendTransaction', () => {
709709
const account = Account.fromWebCryptoP256(keyPair)
710710

711711
// fund account
712-
await fundAddress(client, { address: account.address, sequential: true })
712+
await fundAddress(client, { address: account.address })
713713

714714
const receipt = await sendTransactionSync(client, {
715715
account,
@@ -781,7 +781,7 @@ describe('sendTransaction', () => {
781781
const account = Account.fromWebCryptoP256(keyPair)
782782

783783
// fund account
784-
await fundAddress(client, { address: account.address, sequential: true })
784+
await fundAddress(client, { address: account.address })
785785

786786
const receipt = await sendTransactionSync(client, {
787787
account,
@@ -879,7 +879,7 @@ describe('sendTransaction', () => {
879879
})
880880

881881
// fund account
882-
await fundAddress(client, { address: account.address, sequential: true })
882+
await fundAddress(client, { address: account.address })
883883

884884
const keyAuthorization = await account.signKeyAuthorization(accessKey)
885885

@@ -912,7 +912,7 @@ describe('sendTransaction', () => {
912912
)
913913

914914
// fund account
915-
await fundAddress(client, { address: account.address, sequential: true })
915+
await fundAddress(client, { address: account.address })
916916

917917
const receipt = await sendTransactionSync(client, {
918918
account,
@@ -990,7 +990,7 @@ describe('sendTransaction', () => {
990990
)
991991

992992
// fund account
993-
await fundAddress(client, { address: account.address, sequential: true })
993+
await fundAddress(client, { address: account.address })
994994

995995
const receipt = await sendTransactionSync(client, {
996996
account,
@@ -1151,7 +1151,7 @@ describe('sendTransaction', () => {
11511151
})
11521152

11531153
// fund account
1154-
await fundAddress(client, { address: account.address, sequential: true })
1154+
await fundAddress(client, { address: account.address })
11551155

11561156
const keyAuthorization = await account.signKeyAuthorization(accessKey)
11571157

test/src/tempo/config.ts

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -264,34 +264,28 @@ export async function fundAddress(
264264
client: Client<Transport, Chain>,
265265
parameters: fundAddress.Parameters,
266266
) {
267-
const { address, sequential } = parameters
267+
const { address } = parameters
268268
const account = accounts.at(0)!
269269
if (account.address === address) return
270-
271-
const tokens = [0n, 1n]
272-
const shared = {
273-
account,
274-
amount: parseUnits('10000', 6),
275-
to: address,
276-
}
277-
278-
if (sequential)
279-
for (const token of tokens)
280-
await Actions.token.transferSync(client, { ...shared, token: token })
281-
else
282-
await Promise.all(
283-
tokens.map((token) =>
284-
Actions.token.transferSync(client, { ...shared, token }),
285-
),
286-
)
270+
await Promise.all(
271+
// fund pathUSD, alphaUSD
272+
[0n, 1n].map((feeToken) =>
273+
Actions.token.transferSync(client, {
274+
account,
275+
amount: parseUnits('10000', 6),
276+
// TODO: remove once `eth_fillTransaction` supports nonce keys.
277+
gas: 100_000n,
278+
to: address,
279+
token: feeToken,
280+
}),
281+
),
282+
)
287283
}
288284

289285
export declare namespace fundAddress {
290286
export type Parameters = {
291287
/** Account to fund. */
292288
address: Address
293-
/** Run transfers sequentially to avoid 2D nonce gas costs. */
294-
sequential?: boolean | undefined
295289
}
296290
}
297291

0 commit comments

Comments
 (0)