Intro

Paymasters are used to sponsor transactions and enable paying for gas with ERC20 Tokens.

This section will cover how to use Arka within the SDK, for a more detailed look at Arka and it’s API calls and how to send requests manually, you can check out this part of the docs.

How-to guide

  1. Import the ArkaPaymaster object.
import { ArkaPaymaster } from "@etherspot/prime-sdk";
  1. Initialise the object.

This takes the chainId, Arka API key, and Arka Paymaster URL as parameters.

const arka_api_key = 'arka_public_key';
const arka_url = 'https://arka.etherspot.io';
const arkaPaymaster = new ArkaPaymaster(11155111, arka_api_key, arka_url);
  1. Use arkaPaymaster to call functions.
console.log(await arkaPaymaster.metadata());
console.log(await arkaPaymaster.getTokenPaymasterAddress("USDC"))
console.log(await arkaPaymaster.addWhitelist(["0xB3aF6CFDDc444B948132753AD8214a20605692eF"]));
console.log(await arkaPaymaster.removeWhitelist(["0xB3aF6CFDDc444B948132753AD8214a20605692eF"]));
console.log(await arkaPaymaster.checkWhitelist("0xB3aF6CFDDc444B948132753AD8214a20605692eF"));
console.log(await arkaPaymaster.deposit(0.000000001));

Function list

Here is a list of the functions we can call and what they do.

metadata()

Returns information about the paymaster.

Example output:

{
  "sponsorAddress": "0xaeAF09795d8C0e6fA4bB5f89dc9c15EC02021567",
  "sponsorWalletBalance": { "type": "BigNumber", "hex": "0x1ed81fac4b400e4d" },
  "chainsSupported": [
         5,      114,
       420,    11155111,
     84531,   421613,
    534351, 11155111,
     84532
  ],
  "tokenPaymasters": {
    "1": { "USDC": "0x0000000000fABFA8079AB313D1D14Dcf4D15582a" },
    "10": { "USDC": "0x0000000000fce6614d3c6f679e48c9cdd09aa634" },
    "56": { "USDC": "0x0000000000db7995889f54d72dac9d36a9f7f467" },
  }
}

getTokenPaymasterAddress(“USDC”)

Accepts a string of a token ticker as input and outputs the address of the token paymaster if it is supported.

addWhitelist([“0xB3aF6CFDDc444B948132753AD8214a20605692eF”])

Accepts an array of strings (valid addresses) and whitelists them on the paymaster.

removeWhitelist([“0xB3aF6CFDDc444B948132753AD8214a20605692eF”])

Accepts an array of strings (valid addresses) and removes them from the whitelist.

checkWhitelist(“0xB3aF6CFDDc444B948132753AD8214a20605692eF”)

Accepts a valid address as a string and returns whether or not an address is whitelisted.

deposit(0.000000001)

Accepts a number and deposits this to the paymaster.