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

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' } });

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