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
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
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.
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.
Last updated