coinbase / coinbase/onchainkit

Feature Request: Fallback to multicall if not a cb smart wallet

Open
#1,108 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1k
Forks
520
Avg merge
32m
Merged PRs (30d)
2

Description

### Describe the solution you'd like

When executing a multiple transactions inside of one transaction component, I would like the behavior to remain unchanged for coinbase smart wallets (a batch tx) however, for EOAs and other wallets that do not support batched transactions, I would like the transaction component to automatically fallback to a multicall.

This would allow me as a developer to write the transaction button once and support multiple transactions for all wallets.

This example code will work for a coinbase smart wallet but not an EOA like metamask:
```typescript
export const Pay: FC = ({ split, id }) => {
const { address } = useAccount();

const contracts = [
{
address: USDC_ADDRESS,
abi: erc20Abi,
functionName: 'approve',
args: [SPLIT_IT_CONTRACT_ADDRESS, split.amountPerPerson],
},
{
address: SPLIT_IT_CONTRACT_ADDRESS,
abi: splitItAbi,
functionName: 'pay',
args: [
BigInt(id),
address,
address,
"test name",
"test comment"
],
},
];

return address ? (








) : (






);
}
```

### Describe alternatives you've considered.

To accomplish this today, I will need to detect if the user is not connected with a cb smart wallet and then write a new transaction component for the multicall. This means that if I make a change to how the transactions work, I will need to remember to update the logic in multiple places.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.