Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: modify example to do a donut purchase contract call #3242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ import { useAccount } from 'wagmi'
import { useSendCalls } from 'wagmi/experimental'
import { useCallback, useMemo, useState } from 'react'
import { useChakraToast } from '../Toast'
import { parseGwei, type Address } from 'viem'
import { vitalikEthAddress } from '../../utils/DataUtil'
import { encodeFunctionData, parseEther } from 'viem'
import { abi as donutContractAbi, address as donutContractaddress } from '../../utils/DonutContract'
import { EIP_5792_RPC_METHODS, WALLET_CAPABILITIES } from '../../utils/EIP5792Utils'
import { useWagmiAvailableCapabilities } from '../../hooks/useWagmiActiveCapabilities'
import { useAppKitAccount } from '@reown/appkit/react'

const TEST_TX_1 = {
to: vitalikEthAddress as Address,
value: parseGwei('0.001')
}
const TEST_TX_2 = {
to: vitalikEthAddress as Address,
data: '0xdeadbeef' as `0x${string}`
const purchaseDonutCallData = encodeFunctionData({
abi: donutContractAbi,
functionName: 'purchase',
args: [1]
})

const TEST_TX = {
to: donutContractaddress as `0x${string}`,
value: parseEther('0.0001'),
data: purchaseDonutCallData
}

const BICONOMY_PAYMASTER_CONTEXT = {
Expand Down Expand Up @@ -132,7 +135,7 @@ function AvailableTestContent() {
throw Error('paymasterServiceUrl not set')
}
sendCalls({
calls: [TEST_TX_1, TEST_TX_2],
calls: [TEST_TX],
capabilities: {
paymasterService: {
url: paymasterServiceUrl,
Expand Down
42 changes: 16 additions & 26 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading