-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"viem": patch | ||
--- | ||
|
||
Improved `.extend` performance with `publicActions` and other large types. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { bench } from '@arktype/attest' | ||
|
||
import { | ||
baycContractConfig, | ||
usdcContractConfig, | ||
} from '../../../test/src/abis.js' | ||
Check failure on line 6 in src/actions/public/mulitcall.bench-d.ts
|
||
import { anvil } from '../../chains/index.js' | ||
import { createClient } from '../../clients/createClient.js' | ||
import { http } from '../../clients/transports/http.js' | ||
import { multicall } from './multicall.js' | ||
|
||
bench('multicall return type', async () => { | ||
const client = createClient({ chain: anvil, transport: http() }) | ||
const res = multicall(client, { | ||
allowFailure: false, | ||
contracts: [ | ||
{ | ||
...usdcContractConfig, | ||
functionName: 'totalSupply', | ||
}, | ||
{ | ||
...usdcContractConfig, | ||
functionName: 'balanceOf', | ||
args: ['0x...'], | ||
}, | ||
{ | ||
...baycContractConfig, | ||
functionName: 'name', | ||
}, | ||
], | ||
}) | ||
return {} as typeof res | ||
}).types([192503, 'instantiations']) |
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,17 @@ | ||
import { bench } from '@arktype/attest' | ||
|
||
import { usdcContractConfig } from '../../../test/src/abis.js' | ||
import { anvil } from '../../chains/index.js' | ||
import { createClient } from '../../clients/createClient.js' | ||
import { http } from '../../clients/transports/http.js' | ||
import { readContract } from './readContract.js' | ||
|
||
bench('readContract return type', async () => { | ||
const client = createClient({ chain: anvil, transport: http() }) | ||
const res = readContract(client, { | ||
...usdcContractConfig, | ||
functionName: 'balanceOf', | ||
args: ['0x...'], | ||
}) | ||
return {} as typeof res | ||
}).types([152288, 'instantiations']) |
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,18 @@ | ||
import { bench } from '@arktype/attest' | ||
|
||
import { createClient } from './createClient.js' | ||
import { createTestClient } from './createTestClient.js' | ||
import { testActions } from './decorators/test.js' | ||
import { http } from './transports/http.js' | ||
|
||
bench('createTestClient', () => { | ||
const client = createTestClient({ mode: 'anvil', transport: http() }) | ||
return {} as typeof client | ||
}).types([668, 'instantiations']) | ||
|
||
bench('createClient.extend + testActions', () => { | ||
const client = createClient({ transport: http() }).extend( | ||
testActions({ mode: 'anvil' }), | ||
) | ||
return {} as typeof client | ||
}).types([6275, 'instantiations']) |