turboviem
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

turboviem

Installation

bun install turboviem

Usage

import {
  getCapabilities,
  getTransactionStatus,
  sendTransaction,
} from 'turboviem/actions'
import { createWalletClient, custom, http } from 'viem'
import { base } from 'viem/chains'

// create wallet client
export const walletClient = createWalletClient({
  chain: base,
  transport: custom(window.ethereum),
})

// get capabilities
const capabilities = await getCapabilities(walletClient)

// send transaction
const transactionId = await sendTransaction(walletClient, {
  chainId: 84532,
  sender: address,
  capabilities: { paymasterService: { url: 'https://paymaster.base.org' } },
  calls: [
    {
      target: usdc,
      data: encodeFunctionData({
        abi: erc20Abi,
        functionName: 'approve',
        args: [swapper, parseUnits('10', 6)],
      }),
    },
    {
      target: swapper,
      data: encodeFunctionData({
        abi: swapperAbi,
        functionName: 'swap',
        args: [parseUnits('10', 6), parseUnits('0.1', 18)],
      }),
    },
  ],
})

// get transaction status
const transactionStatus = await getTransactionStatus(walletClient, {
  transactionId,
})

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.40latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.40
0.0.30
0.0.20
0.0.10

Package Sidebar

Install

npm i turboviem

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

40.6 kB

Total Files

53

Last publish

Collaborators

  • lukasrosario