-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
529 additions
and
30 deletions.
There are no files selected for viewing
File renamed without changes.
41 changes: 41 additions & 0 deletions
41
packages/register-tests/vue/src/useTransactionReceipt.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { config } from '@wagmi/test' | ||
import { useTransactionReceipt } from '@wagmi/vue' | ||
import { zkSync } from '@wagmi/vue/chains' | ||
import { type ZkSyncL2ToL1Log, type ZkSyncLog } from 'viem/zksync' | ||
import { expectTypeOf, test } from 'vitest' | ||
|
||
test('chain formatters', () => { | ||
const result = useTransactionReceipt() | ||
|
||
if (result.data?.value?.chainId === zkSync.id) { | ||
expectTypeOf(result.data.value.l1BatchNumber).toEqualTypeOf<bigint | null>() | ||
expectTypeOf(result.data.value.l1BatchTxIndex).toEqualTypeOf< | ||
bigint | null | ||
>() | ||
expectTypeOf(result.data.value.logs).toEqualTypeOf<ZkSyncLog[]>() | ||
expectTypeOf(result.data.value.l2ToL1Logs).toEqualTypeOf< | ||
ZkSyncL2ToL1Log[] | ||
>() | ||
} | ||
|
||
const result2 = useTransactionReceipt({ chainId: zkSync.id }) | ||
if (result2.data.value) { | ||
expectTypeOf(result2.data.value.l1BatchNumber).toEqualTypeOf< | ||
bigint | null | ||
>() | ||
expectTypeOf(result2.data.value.l1BatchTxIndex).toEqualTypeOf< | ||
bigint | null | ||
>() | ||
expectTypeOf(result2.data.value.logs).toEqualTypeOf<ZkSyncLog[]>() | ||
expectTypeOf(result2.data.value.l2ToL1Logs).toEqualTypeOf< | ||
ZkSyncL2ToL1Log[] | ||
>() | ||
} | ||
}) | ||
|
||
test('parameters: config', async () => { | ||
const result = useTransactionReceipt({ config }) | ||
|
||
if (result.data && 'l1BatchNumber' in result.data) | ||
expectTypeOf(result.data.l1BatchNumber).toEqualTypeOf<unknown>() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
packages/vue/src/composables/useTransactionReceipt.test-d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { expectTypeOf, test } from 'vitest' | ||
|
||
import { useTransactionReceipt } from './useTransactionReceipt.js' | ||
|
||
test('select data', () => { | ||
const result = useTransactionReceipt({ | ||
query: { | ||
select(data) { | ||
return data?.blockNumber | ||
}, | ||
}, | ||
}) | ||
expectTypeOf(result.data.value).toEqualTypeOf<bigint | undefined>() | ||
}) |
Oops, something went wrong.