Skip to content
Merged
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
22 changes: 18 additions & 4 deletions examples/cli/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { execSync } from 'node:child_process'
import { basename, dirname } from 'node:path'
import * as p from '@clack/prompts'
import { getChain } from '@filoz/synapse-core/chains'
import { createPublicClient, createWalletClient, type Hex, http } from 'viem'
import { type Chain, getChain } from '@filoz/synapse-core/chains'
import {
createPublicClient,
createWalletClient,
type Hex,
type HttpTransport,
http,
type PrivateKeyAccount,
type PublicClient,
type WalletClient,
} from 'viem'
import { privateKeyToAccount } from 'viem/accounts'
import config from './config.ts'

Expand Down Expand Up @@ -37,7 +46,10 @@ function privateKeyFromConfig() {
}
}

export function privateKeyClient(chainId: number) {
export function privateKeyClient(chainId: number): {
client: WalletClient<HttpTransport, Chain, PrivateKeyAccount>
chain: Chain
} {
const chain = getChain(chainId)

const privateKey = privateKeyFromConfig()
Expand All @@ -54,7 +66,9 @@ export function privateKeyClient(chainId: number) {
}
}

export function publicClient(chainId: number) {
export function publicClient(
chainId: number
): PublicClient<HttpTransport, Chain> {
const chain = getChain(chainId)
const publicClient = createPublicClient({
chain,
Expand Down
3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ trustPolicyExclude:
# Last 4.x (Dec 2024) predates chokidar adopting trusted publishing at 5.0.0.
# Permanent while anything depends on chokidar@^4.
- chokidar@4.0.3
# 3.3.1 (Jan 2025) predates langium adopting trusted publishing at 4.x.
# Exact-pinned by @mermaid-js/parser; permanent while mermaid pins langium@3.
- langium@3.3.1