π Quick start
Starting guide on how to quickly integrate the @txfusion/txsync-viemπ
π₯ Installation & setup
Install the @txfusion/txsync-viem package
# Install via NPM
npm install @txfusion/txsync-viem# Install via Yarn
yarn add @txfusion/txsync-viemGet your paymaster object
import { getPaymaster, createRestriction } from "@txfusion/txsync-viem";
import { createWalletClient, custom } from 'viem';
import { zkSync } from 'viem/chains';
import { eip712WalletActions } from 'viem/zksync';
// Get the account
const [account] = await window.ethereum!.request({ method: "eth_requestAccounts" });
// Create walletClient object
const walletClient = createWalletClient({
account,
chain: zkSync,
transport: custom(window.ethereum),
}).extend(eip712WalletActions());
// Create publicClient object
const publicClient = createPublicClient({
chain: zkSync,
transport: http(),
});
// Get paymaster object
const paymaster = await getPaymaster(
paymasterAddress,
walletClient,
publicClient
);
console.log(`PaymasterType: ${paymaster.paymasterType}`);
console.log(`Token Address: ${paymaster.token}`);Using paymaster methods
Last updated