Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
VITE_ANVIL_FORK_URL=
VITE_ANVIL_FORK_URL_SEPOLIA=
VITE_ANVIL_FORK_URL_OPTIMISM=
VITE_ANVIL_FORK_URL_OPTIMISM_SEPOLIA=
VITE_ANVIL_FORK_URL_GOERLI=
VITE_ANVIL_FORK_URL_ZKSYNC=
VITE_BATCH_JSON_RPC=false
VITE_BATCH_MULTICALL=true
VITE_NETWORK_TRANSPORT_MODE=http

VITE_TEMPO_ENV=localnet # node environment. values: localnet|devnet|testnet
VITE_TEMPO_LOG=false # whether to enable logs, if VITE_TEMPO_ENV=localnet. values: true|debug|error|trace|warn|info
VITE_TEMPO_TAG=latest # docker image tag, if VITE_TEMPO_ENV=localnet.
VITE_TEMPO_HTTP_LOG=false # whether to enable logs on HTTP RPC requests. values: true|false
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"performance": {
"noBarrelFile": "error",
"noReExportAll": "error",
"noReExportAll": "off",
"noDelete": "off"
},
"style": {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,25 @@
"@ethereumjs/rlp": "^5.0.2",
"@paulmillr/trusted-setups": "^0.1.2",
"@pimlico/alto": "0.0.18",
"@remix-run/node-fetch-server": "^0.12.0",
"@size-limit/preset-big-lib": "^11.2.0",
"@types/bun": "^1.2.22",
"@types/node": "^24.5.2",
"@vitest/coverage-v8": "^4.0.10",
"@vitest/coverage-v8": "^4.0.15",
"bun": "^1.2.22",
"ethers": "^6.15.0",
"knip": "^5.64.0",
"micro-eth-signer": "^0.14.0",
"ox": "~0.10.0",
"permissionless": "^0.2.57",
"prool": "0.0.24",
"prool": "~0.2.1",
"publint": "^0.2.12",
"sherif": "^0.8.4",
"simple-git-hooks": "^2.13.1",
"size-limit": "^11.2.0",
"testcontainers": "^11.10.0",
"typescript": "catalog:",
"vitest": "^4.0.10"
"vitest": "^4.0.15"
},
"packageManager": "[email protected]",
"engines": {
Expand Down
627 changes: 545 additions & 82 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ minimumReleaseAgeExclude:
- '@vitest/*'
- glob
- hono
- ox
- prool
- vitest
- vocs
packages:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ export function toWebAuthnSignature({
{
authenticatorData: webauthn.authenticatorData,
clientDataJSON: stringToHex(webauthn.clientDataJSON),
challengeIndex: BigInt(webauthn.challengeIndex),
typeIndex: BigInt(webauthn.typeIndex),
challengeIndex: BigInt(webauthn.challengeIndex ?? 0n),
typeIndex: BigInt(webauthn.typeIndex ?? 0n),
r,
s,
},
Expand Down
2 changes: 1 addition & 1 deletion src/actions/public/multicall.bench-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ test('return type', () => {
},
],
})
attest.instantiations([96782, 'instantiations'])
attest.instantiations([46542, 'instantiations'])
attest<Promise<[bigint, bigint, string]>>(res)
})
2 changes: 1 addition & 1 deletion src/actions/public/readContract.bench-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ test('return type', () => {
functionName: 'balanceOf',
args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e'],
})
attest.instantiations([53192, 'instantiations'])
attest.instantiations([21379, 'instantiations'])
attest<Promise<bigint>>(res)
})
19 changes: 12 additions & 7 deletions src/actions/wallet/prepareTransactionRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import {
getTransactionType,
} from '../../utils/transaction/getTransactionType.js'
import {
type FillTransactionErrorType,
type FillTransactionParameters,
fillTransaction,
} from '../public/fillTransaction.js'
Expand Down Expand Up @@ -267,12 +268,12 @@ export async function prepareTransactionRequest<
>
> {
let request = args as PrepareTransactionRequestParameters
const {
account: account_ = client.account,
chain = client.chain,
nonceManager,
parameters = defaultParameters,
} = request

request.account ??= client.account
request.chain ??= client.chain
request.parameters ??= defaultParameters

const { account: account_, chain, nonceManager, parameters } = request

const prepareTransactionRequest = (() => {
if (typeof chain?.prepareTransactionRequest === 'function')
Expand Down Expand Up @@ -402,7 +403,10 @@ export async function prepareTransactionRequest<
}
})
.catch((e) => {
const error = e as BaseError & { cause: BaseError }
const error = e as FillTransactionErrorType

if (error.name !== 'TransactionExecutionError') return request

const unsupported = error.walk?.((e) => {
const error = e as BaseError
return (
Expand All @@ -411,6 +415,7 @@ export async function prepareTransactionRequest<
)
})
if (unsupported) supportsFillTransaction.set(client.uid, false)

return request
})
: request
Expand Down
19 changes: 19 additions & 0 deletions src/chains/definitions/tempoDevnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { chainConfig } from '../../tempo/chainConfig.js'
import { defineChain } from '../../utils/chain/defineChain.js'

export const tempoDevnet = /*#__PURE__*/ defineChain({
...chainConfig,
id: 1337,
name: 'Tempo Devnet',
nativeCurrency: {
name: 'USD',
symbol: 'USD',
decimals: 6,
},
rpcUrls: {
default: {
http: ['https://rpc.devnet.tempo.xyz'],
webSocket: ['wss://rpc.devnet.tempo.xyz'],
},
},
})
16 changes: 16 additions & 0 deletions src/chains/definitions/tempoLocalnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { chainConfig } from '../../tempo/chainConfig.js'
import { defineChain } from '../../utils/chain/defineChain.js'

export const tempoLocalnet = /*#__PURE__*/ defineChain({
...chainConfig,
id: 1337,
name: 'Tempo',
nativeCurrency: {
name: 'USD',
symbol: 'USD',
decimals: 6,
},
rpcUrls: {
default: { http: ['http://localhost:8545'] },
},
})
25 changes: 25 additions & 0 deletions src/chains/definitions/tempoTestnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { chainConfig } from '../../tempo/chainConfig.js'
import { defineChain } from '../../utils/chain/defineChain.js'

export const tempoTestnet = /*#__PURE__*/ defineChain({
...chainConfig,
id: 42429,
blockExplorers: {
default: {
name: 'Tempo Explorer',
url: 'https://explore.tempo.xyz',
},
},
name: 'Tempo Testnet',
nativeCurrency: {
name: 'USD',
symbol: 'USD',
decimals: 6,
},
rpcUrls: {
default: {
http: ['https://rpc.testnet.tempo.xyz'],
webSocket: ['wss://rpc.testnet.tempo.xyz'],
},
},
})
3 changes: 3 additions & 0 deletions src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ export { teaSepolia } from './definitions/teaSepolia.js'
export { telcoinTestnet } from './definitions/telcoinTestnet.js'
export { telos } from './definitions/telos.js'
export { telosTestnet } from './definitions/telosTestnet.js'
export { tempoDevnet } from './definitions/tempoDevnet.js'
export { tempoLocalnet } from './definitions/tempoLocalnet.js'
export { tempoTestnet } from './definitions/tempoTestnet.js'
export { tenet } from './definitions/tenet.js'
export { ternoa } from './definitions/ternoa.js'
export { thaiChain } from './definitions/thaiChain.js'
Expand Down
4 changes: 2 additions & 2 deletions src/clients/createPublicClient.bench-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ test('createPublicClient', () => {
createPublicClient({
transport: http('https://cloudflare-eth.com'),
})
attest.instantiations([18000, 'instantiations'])
attest.instantiations([15172, 'instantiations'])
})

test('createClient.extend + publicActions', () => {
createClient({
transport: http('https://cloudflare-eth.com'),
}).extend(publicActions)
attest.instantiations([328328, 'instantiations'])
attest.instantiations([60082, 'instantiations'])
})
4 changes: 2 additions & 2 deletions src/clients/createTestClient.bench-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ test('createTestClient', () => {
mode: 'anvil',
transport: http('https://cloudflare-eth.com'),
})
attest.instantiations([3155, 'instantiations'])
attest.instantiations([2823, 'instantiations'])
})

test('createClient.extend + testActions', () => {
createClient({
transport: http('https://cloudflare-eth.com'),
}).extend(testActions({ mode: 'anvil' }))
attest.instantiations([9142, 'instantiations'])
attest.instantiations([6071, 'instantiations'])
})
4 changes: 2 additions & 2 deletions src/clients/createWalletClient.bench-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ test('createWalletClient', () => {
createWalletClient({
transport: http('https://cloudflare-eth.com'),
})
attest.instantiations([3000, 'instantiations'])
attest.instantiations([3042, 'instantiations'])
})

test('createClient.extend + walletActions', () => {
createClient({
transport: http('https://cloudflare-eth.com'),
}).extend(walletActions)
attest.instantiations([179759, 'instantiations'])
attest.instantiations([115528, 'instantiations'])
})
4 changes: 2 additions & 2 deletions src/clients/transports/ipc.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { anvil } from 'prool/instances'
import { Instance } from 'prool'
import { afterAll, assertType, beforeAll, describe, expect, test } from 'vitest'

import { anvilMainnet } from '~test/anvil.js'
Expand All @@ -15,7 +15,7 @@ const client = createClient({
transport: http('http://127.0.0.1:6967'),
}).extend(() => ({ mode: 'anvil' }))

const instance = anvil({
const instance = Instance.anvil({
chainId: anvilMainnet.chain.id,
port: 6967,
ipc: anvilMainnet.rpcUrl.ipc,
Expand Down
2 changes: 1 addition & 1 deletion src/errors/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type ExecutionRevertedErrorType = ExecutionRevertedError & {
}
export class ExecutionRevertedError extends BaseError {
static code = 3
static nodeMessage = /execution reverted/
static nodeMessage = /execution reverted|gas required exceeds allowance/

constructor({
cause,
Expand Down
1 change: 0 additions & 1 deletion src/op-stack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ export {

export { chainConfig } from './chainConfig.js'

// biome-ignore lint/performance/noReExportAll: intentionally re-exporting
export * from './chains.js'

export {
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
"@scure/bip39": "1.6.0",
"abitype": "1.1.0",
"isows": "1.0.7",
"ox": "0.9.6",
"ox": "0.10.0",
"ws": "8.18.3"
},
"license": "MIT",
Expand Down
Loading
Loading