getPublicClient
Using public client to make read calls
PublicClient
Public clients are used to make read
calls.
You can access the public client for a specific network
by calling getPublicClient
on the network
object.
example.ts
import { mintclub } from 'mint.club-v2-sdk'
const publicClient = await mintclub.network('base').getPublicClient()
Using this public client, you could make read calls to non-mint.club contracts as well.
example.ts
import { mintclub } from 'mint.club-v2-sdk'
const publicClient = await mintclub.network('base').getPublicClient()
const const block: {
number: bigint;
nonce: `0x${string}`;
hash: `0x${string}`;
logsBloom: `0x${string}`;
baseFeePerGas: bigint | null;
blobGasUsed: bigint;
difficulty: bigint;
excessBlobGas: bigint;
extraData: Hex;
... 17 more ...;
transactions: `0x${string}`[];
}block = await publicClient.getBlock();
Viem Documentation
For more information on how to use the public client more effectively, you can refer to the Viem's documentation