Comment on page

Send transactions

Sending Web3 transactions has never been easier
Considering that the authentication part is done, you can start to send transactions. You'll just need to create the transaction and send it to the SDK.
Depending on the UX you want to provide, there are different ways of sending transactions.

Send a single transaction

You can build a transaction object containing the targeted contract address, the value of the transaction, and the associated data in the transaction. This payload can be passed to the sendTransaction method of the SDK. A promise is returned by the method to wait for the validation of the transaction.
If this is the first transaction of the wallet, this sendTransaction will automatically be converted to a multi-call doing 2 transactions in one: deploy the Safe smart wallet and send the transaction
const txValues = {
to: recipient,
value: "0x00",
data: "0x",
const txPending = await wallet.sendTransaction(txValues);
await txPending.wait();
var safeTxHash = await _wallet.SendTransaction(to, value, data);
var transactionReceipt = await _wallet.Wait(safeTxHash);
The user will have to sign before the transaction is sent.

Send a Gasless transaction

To enable that feature, please contact us by planning a meeting or on our Discord.
With Cometh Connect, you can pay the transaction gas fees of your users. You will need to add the contract address of your transaction as a sponsored address for your project. Remember, the contract address corresponds to the "to" field of your transaction.
Here is the API route to create the sponsored address:
After doing so, you'll be able to send gasless transactions.

Send transactions batches

With Cometh Connect, you can execute multiple actions in the same transaction. To do so you can call the sendBatchTransactions method.
const txValues = [{
to: targetAddress1,
value: "0x00",
data: "0x",
}, {
to: targetAddress2,
value: "0x00",
data: "0x",
const txPending = await wallet.sendBatchTransactions(txValues);
await txPending.wait();
coming soon
In the same way, you'll then be asked to validate the transaction.

Send a transaction using a contract interface

Another approach would be to use the provider offered by the SDK. You will need to instantiate the ComethProvider ( an Ethereum provider following EIP-1193 ), using the ComethWallet. You can then use your contract interface to directly call the contract methods. Checkout our Getting started for more details.
import {
} 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
const provider = new ComethProvider(wallet)
const nftContract = new ethers.Contract(
const tx = await nftContract.count()
const txResponse = await tx.wait()
Last modified 1mo ago