Intro

Arka is Etherspot’s implementation of a paymaster.

In short, the paymaster component let’s us implement gasless transactions. This means we can let the user pay with ERC-20 tokens, or pay for specific user transactions ourselves.

Using Arka

When estimating a transaction with the SDK we can pass in paymaster values and choose one of two modes:

  1. sponsor
  2. erc20
  3. multitoken

For either mode we need to pass in a url as non optional parameters. In this url we include the url of the Arka instance, the apiKey, and the chainId.

We can create the arguements like so:

const arka_api_key = 'arka_public_key';
const arka_url = 'https://arka.etherspot.io';
const queryString = `?apiKey=${arka_api_key}&chainId=1`;

Then we can use this in either sponsor or erc20 mode.

mode: ‘sponsor’

This works by having Arka pay for the transaction fee.

await primeSdk.estimate({ url: `${arka_url}${queryString}`,
context: { mode: 'sponsor' } });

validUntil / validAfter

validUntil and validAfter are relevant only with mode: sponsor transactions and not for mode: erc20.

validUntil and validAfter are optional defaults to 10 mins of expiry from send call and should be passed in terms of milliseconds. For example purpose, the valid is fixed as expiring in 100 mins once the paymaster data is generated.

await primeSdk.estimate({ url: `${arka_url}${queryString}`, 
context: { mode: 'sponsor', validAfter: new Date().valueOf(), validUntil: new Date().valueOf() + 6000000 } });

mode: ‘erc20’

This works by having the gas fee paid with whatever token is specified.

await primeSdk.estimate({ url: `${arka_url}${queryString}`,
context: { token: "USDC", mode: 'erc20' } });

mode: ‘multitoken’

This works by having the gas fees paid with whatever token is specified but unlike erc20, each chain would have the same paymaster address across different tokens supported on that contract.

await primeSdk.estimate({ url: `${arka_url}${queryString}`,
context: { token: "0x453478E2E0c846c069e544405d5877086960BEf2", mode: 'multitoken' } });

Please note that the above token is from Ancient8 testnet(28122024) which is available on arka_public_key apiKey. Request 0x453478E2E0c846c069e544405d5877086960BEf2 tokens if you unable to fetch it on discord

Please get in touch if you wish to get an api key for development.