Integrate Gasless SDK
Only for Third-party wallets
The Arcana Gasless (Standalone) SDK is meant for use only in case where an app requires to enable gasless transactions in third-party browser based wallets. To enable gasless transactions in the Arcana wallet, you must install and integrate with the Arcana Auth SDK and use its built-in gasless feature.
Pre-requisites
-
Make sure the app is registered and a unique Client ID assigned to it.
-
Set up gas tanks on one or more supported networks and deposit funds.
Integrate
Initialize the Arcana Gasless (Standalone) SDK using the unique app identifier obtained via the Arcana Developer Dashboard after registering the app. You need to also provide the browser-based wallet EIP-1193 Ethereum provider for enabling gasless operations in that wallet.
During initialization, the gasless SDK creates an SCW account associated with the EoA account corresponding to the provider window.ethereum
. All gasless transactions use this SCW account address.
import { scw } from @arcana/scw;
const scw = new arcana.scw.SCW();
await scw.init("<app_id>", window.ethereum);
After the init
call, you can all other methods of the SCW object. Use the getSCWAddress
to get the logged-in user's smart contract address (SCW Address). Use getPaymasterBalance
to check if the gas tank that is supposed to pay the gas fees for the logged-in user's transactions, is adequately funded.
const erc20abi = [...];
let amount = 0.1;
const erc20Address = "0x2d7aC0907961c7.......45f981Ed8373b5dF86";
const toAddress = "0x723455665060698....87689dA78E25";
const Erc20Interface = new ethers.utils.Interface(erc20abi);
const encodedData = Erc20Interface.encodeFunctionData("transfer", [
toAddress,
ethers.utils.parseEther(amount + ""),
]);
console.log("Address: " + scw.getSCWAddress());
// Check balance
console.log("Paymaster Balance: " + (await scw.getPaymasterBalance()) / 1e18);
What's Next?
After integrating the Arcana Gasless (Standalone) SDK, add code to allow authenticated users to perform gasless transactions via the third-party wallets.
See also
- 'Gasless' integration example:
sample-gasless-metamask-only
submodule in Auth Examples - Configure Gasless Settings
- Arcana Gasless (Standalone) SDK Quick Start Guide
- Arcana Gasless (Standalone) SDK Usage Guide
- Gasless Error Messages