Skip to content

Commit

Permalink
Merge pull request #235 from skalenetwork/update-public-client-types
Browse files Browse the repository at this point in the history
Update public client types
  • Loading branch information
dmytrotkk authored Dec 27, 2024
2 parents 38a7cc8 + 1a52833 commit ed54047
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions typescript/viem/src/skaleContracts.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { Account, Chain, PublicClient, RpcSchema, Transport } from 'viem';
import { ViemAdapter, ViemContract } from './viemAdapter';
import {
Instance as BaseInstance
} from "@skalenetwork/skale-contracts/lib/instance";
import {
SkaleContracts as BaseSkaleContracts
} from "@skalenetwork/skale-contracts";
import { PublicClient } from 'viem';


export type Instance = BaseInstance<ViemContract>;

export class SkaleContracts extends BaseSkaleContracts<ViemContract> {
getNetworkByProvider(client: PublicClient) {
getNetworkByProvider(
client: PublicClient<Transport, Chain, Account, RpcSchema>
) {
return this.getNetworkByAdapter(new ViemAdapter(client));
}
}
Expand Down
8 changes: 6 additions & 2 deletions typescript/viem/src/viemAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Abi, Adapter, ContractData, FunctionCall } from '@skalenetwork/skale-contracts';
import {
Account,
Address,
Chain,
GetContractReturnType,
PublicClient,
RpcSchema,
Transport,
Abi as ViemAbi,
getContract as getContractViem,
isAddress
Expand All @@ -11,9 +15,9 @@ import {
export type ViemContract = GetContractReturnType<ViemAbi, { public: PublicClient }, Address>;

export class ViemAdapter implements Adapter<ViemContract> {
client: PublicClient;
client: PublicClient<Transport, Chain, Account, RpcSchema>;

constructor(client: PublicClient) {
constructor(client: PublicClient<Transport, Chain, Account, RpcSchema>) {
this.client = client;
}

Expand Down

0 comments on commit ed54047

Please sign in to comment.