
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@cometh/connect-sdk-viem
Advanced tools
Cometh Connect Viem SDK allows developers to onboard their users with a seedless, gasless experience familiar to Web2 using Biometrics and web2 logins.
Account Abstraction (AA) improves transaction user experience by using smart contract wallets as primary accounts.
If you need more information on how to use the SDK check our documentation
Before being able to use the connect custom viem client, we'll need to create a connect instance and call the connect function:
To get an API key please Contact us
import {
ComethWallet,
ConnectAdaptor,
SupportedNetworks
} from '@cometh/connect-sdk'
const walletAdaptor = new ConnectAdaptor({
chainId: SupportedNetworks.POLYGON,
apiKey: API_KEY
})
const wallet = new ComethWallet({
authAdapter: walletAdaptor,
apiKey: API_KEY,
rpcUrl: RPC_URL
})
await wallet.connect()
This function create a new wallet and connect to the API.
You can also connect to a previously created wallet. You'll have to provide the wallet address of the previously created wallet.
await wallet.connect(walletAddress)
After creating (or reconnecting) to a connect wallet, you can now create a connectViemClient:
import {
ComethWallet,
ConnectAdaptor,
SupportedNetworks
} from '@cometh/connect-sdk'
import { getConnectViemClient } from '@cometh/connect-sdk-viem'
const walletAdaptor = new ConnectAdaptor({
chainId: SupportedNetworks.POLYGON,
apiKey: API_KEY
})
const wallet = new ComethWallet({
authAdapter: walletAdaptor,
apiKey: API_KEY,
rpcUrl: RPC_URL
})
await wallet.connect()
const connectViemClient = getConnectViemClient({ wallet })
All Public actions available through a Public Viem Client are available. (see viem docs)
On top of that, we added 2 custom functions that you can call throught the connectViemClient:
import { encodeFunctionData } from 'viem'
const txCallData = encodeFunctionData({
abi: CONTRACT_ABI,
functionName: CONTRACT_METHOD
})
const tx = { to: DESTINATION, value: VALUE, data: txCallData }
const txHash = await connectViemClient.sendTransaction(tx)
This function relays the transaction data to the target address. The transaction fees can be sponsored.
const txBatch = [
{ to: DESTINATION, value: VALUE, data: txCallData },
{ to: DESTINATION, value: VALUE, data: txCallData }
]
const txHash = await connectViemClient.sendBatchTransactions(tx)
This function relays a batch of transaction data to the targeted addresses. The transaction fees can be sponsored as well.
import {
ComethWallet,
ConnectAdaptor,
SupportedNetworks
} from '@cometh/connect-sdk'
import { getConnectViemAccount } from '@cometh/connect-sdk-viem'
const walletAdaptor = new ConnectAdaptor({
chainId: SupportedNetworks.POLYGON,
apiKey: API_KEY
})
const wallet = new ComethWallet({
authAdapter: walletAdaptor,
apiKey: API_KEY,
rpcUrl: RPC_URL
})
await wallet.connect()
const connectViemAccount = getConnectViemAccount(wallet)
const signature = await connectViemAccount.signMessage({ message: 'hello' })
Sign the given message using the EOA, owner of the smart wallet.
const tx = { to: DESTINATION, value: VALUE, data: txCallData }
const signature = await connectViemAccount.signTransaction(tx)
Sign the given message using the EOA, owner of the smart wallet.
FAQs
Viem SDK Cometh Connect
We found that @cometh/connect-sdk-viem demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.