Skip to content

Commit

Permalink
🎨 Fix typechecking
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az committed Jul 2, 2023
1 parent cce1b4b commit 6656020
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
21 changes: 0 additions & 21 deletions packages/core/abi/IERC20.ts

This file was deleted.

24 changes: 23 additions & 1 deletion packages/core/abi/balances-of.ts → packages/core/abi/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const abi = <const>[
export const BALANCES_OF_ABI = <const>[
{
stateMutability: 'payable',
type: 'fallback',
Expand Down Expand Up @@ -32,3 +32,25 @@ export const abi = <const>[
type: 'receive',
},
]

export const ERC20_ABI = <const>[
{
inputs: [
{
internalType: 'address',
name: 'account',
type: 'address',
},
],
name: 'balanceOf',
outputs: [
{
internalType: 'uint256',
name: '',
type: 'uint256',
},
],
stateMutability: 'view',
type: 'function',
},
]
2 changes: 1 addition & 1 deletion packages/core/example/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { getAddress, http } from 'viem'
import { mainnet } from 'viem/chains'
import { createPublicClient } from 'viem'
import { abi as BALANCES_OF_ABI } from '../abi/balances-of'
import { BALANCES_OF_ABI } from '../abi'

main()
.then(console.log)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/scripts/json-to-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function run() {
for (const filename of await fs.readdir(`./out/${directory}`)) {
if (filename.endsWith('.json')) {
const file = await fs.readFile(`./out/${directory}/${filename}`, { encoding: 'utf8' })
const json = JSON.parse(file) as { abi: unknown }
const json = JSON.parse(file.toString()) as { abi: unknown }
const text = `export const abi = <const>${JSON.stringify(json.abi, undefined, 2)}`
const abiFilename = filename.replace('.json', '')
// check if directory exists and create it if not
Expand Down
3 changes: 1 addition & 2 deletions packages/core/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isAddress, type Address, getAddress } from 'viem'
import { abi as BALANCES_OF_ABI } from '../abi/balances-of'
import { abi as ERC20_ABI } from '../abi/ierc20'
import { ERC20_ABI, BALANCES_OF_ABI } from '../abi'
import { it, expect, describe } from 'bun:test'
import { repeatArray } from './utilities'
import { type Chain, publicClient, walletClient } from './client'
Expand Down

0 comments on commit 6656020

Please sign in to comment.