Skip to content

Commit 0e589b2

Browse files
jenpafftmmjxom
authored
fix: tempo e2e (#4188)
* Update devnet url * Add keyId and keyAuthorization fields for gas estimation with access keys * Add keyId field for gas estimation with access keys * chore: changeset * fix: key * chore: tweaks * test: fund sequential * chore: bump size * chore: tweaks * chore: lockfile * chore: tweaks * chore: tweaks * chore: tweaks --------- Co-authored-by: Tom Meagher <[email protected]> Co-authored-by: jxom <[email protected]>
1 parent 53f280a commit 0e589b2

File tree

9 files changed

+90
-166
lines changed

9 files changed

+90
-166
lines changed

.changeset/clever-cars-press.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"viem": patch
3+
---
4+
5+
Fixed tempo formatter for access keys

package.json

Lines changed: 2 additions & 2 deletions
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",
@@ -200,7 +200,7 @@
200200
{
201201
"name": "import { tempoTestnet } from 'viem/chains'",
202202
"path": "./src/_esm/chains/index.js",
203-
"limit": "54 kB",
203+
"limit": "55 kB",
204204
"import": "{ tempoTestnet }"
205205
},
206206
{

pnpm-lock.yaml

Lines changed: 30 additions & 14 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: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,16 @@ export function formatTransactionRequest(
121121
return [undefined, undefined]
122122
})()
123123

124+
const keyId =
125+
account && 'accessKeyAddress' in account
126+
? account.accessKeyAddress
127+
: undefined
128+
124129
return {
125130
...rpc,
126-
...(keyType ? { keyType } : {}),
127131
...(keyData ? { keyData } : {}),
132+
...(keyId ? { keyId } : {}),
133+
...(keyType ? { keyType } : {}),
128134
...(request.feePayer
129135
? {
130136
feePayer:

src/tempo/actions/nonce.test.ts

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,6 @@ describe('getNonce', () => {
8181
})
8282
})
8383

84-
describe('getNonceKeyCount', () => {
85-
test('default', async () => {
86-
// Get active nonce key count for a fresh account
87-
const count = await actions.nonce.getNonceKeyCount(client, {
88-
account: accounts.at(10)!.address,
89-
})
90-
91-
// Fresh account should have 0 active nonce keys
92-
expect(count).toBe(0n)
93-
})
94-
95-
test('behavior: different accounts are independent', async () => {
96-
const count1 = await actions.nonce.getNonceKeyCount(client, {
97-
account: accounts.at(10)!.address,
98-
})
99-
const count2 = await actions.nonce.getNonceKeyCount(client, {
100-
account: accounts.at(11)!.address,
101-
})
102-
103-
// Both should be 0 for fresh accounts
104-
expect(count1).toBe(0n)
105-
expect(count2).toBe(0n)
106-
})
107-
})
108-
10984
describe('watchNonceIncremented', () => {
11085
test('default', async () => {
11186
const events: Array<{
@@ -153,52 +128,3 @@ describe('watchNonceIncremented', () => {
153128
}
154129
})
155130
})
156-
157-
describe('watchActiveKeyCountChanged', () => {
158-
test('default', async () => {
159-
const events: Array<{
160-
args: actions.nonce.watchActiveKeyCountChanged.Args
161-
log: actions.nonce.watchActiveKeyCountChanged.Log
162-
}> = []
163-
164-
const unwatch = actions.nonce.watchActiveKeyCountChanged(client, {
165-
onActiveKeyCountChanged: (args, log) => {
166-
events.push({ args, log })
167-
},
168-
})
169-
170-
const priorKeyCount = await actions.nonce.getNonceKeyCount(client, {
171-
account: account.address,
172-
})
173-
174-
try {
175-
// First use of nonceKey 10 should increment active key count
176-
await actions.token.transferSync(client, {
177-
to: account2.address,
178-
amount: 1n,
179-
token: 1n,
180-
nonceKey: 10n,
181-
nonce: 0,
182-
})
183-
184-
// First use of nonceKey 11 should increment again
185-
await actions.token.transferSync(client, {
186-
to: account2.address,
187-
amount: 1n,
188-
token: 1n,
189-
nonceKey: 11n,
190-
nonce: 0,
191-
})
192-
193-
await setTimeout(1000)
194-
195-
expect(events).toHaveLength(2)
196-
expect(events[0]!.args.account).toBe(account.address)
197-
// Assert the number of new active keys
198-
expect(events[0]!.args.newCount - priorKeyCount).toBe(1n)
199-
expect(events[1]!.args.newCount - priorKeyCount).toBe(2n)
200-
} finally {
201-
unwatch()
202-
}
203-
})
204-
})

src/tempo/actions/nonce.ts

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,7 @@ export namespace getNonce {
111111
}
112112

113113
/**
114-
* Gets the number of active nonce keys for an account.
115-
*
116-
* @example
117-
* ```ts
118-
* import { createClient, http } from 'viem'
119-
* import { tempo } from 'tempo.ts/chains'
120-
* import { Actions } from 'tempo.ts/viem'
121-
*
122-
* const client = createClient({
123-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
124-
* transport: http(),
125-
* })
126-
*
127-
* const count = await Actions.nonce.getNonceKeyCount(client, {
128-
* account: '0x...',
129-
* })
130-
* ```
131-
*
132-
* @param client - Client.
133-
* @param parameters - Parameters.
134-
* @returns The number of active nonce keys.
114+
* @deprecated This function has been deprecated post-AllegroModerato. It will be removed in a future version.
135115
*/
136116
export async function getNonceKeyCount<
137117
chain extends Chain | undefined,
@@ -203,29 +183,7 @@ export namespace getNonceKeyCount {
203183
}
204184

205185
/**
206-
* Watches for nonce incremented events.
207-
*
208-
* @example
209-
* ```ts
210-
* import { createClient, http } from 'viem'
211-
* import { tempo } from 'tempo.ts/chains'
212-
* import { Actions } from 'tempo.ts/viem'
213-
*
214-
* const client = createClient({
215-
* chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
216-
* transport: http(),
217-
* })
218-
*
219-
* const unwatch = Actions.nonce.watchNonceIncremented(client, {
220-
* onNonceIncremented: (args, log) => {
221-
* console.log('Nonce incremented:', args)
222-
* },
223-
* })
224-
* ```
225-
*
226-
* @param client - Client.
227-
* @param parameters - Parameters.
228-
* @returns A function to unsubscribe from the event.
186+
* @deprecated This function has been deprecated post-AllegroModerato. It will be removed in a future version.
229187
*/
230188
export function watchNonceIncremented<
231189
chain extends Chain | undefined,

0 commit comments

Comments
 (0)