JavaScript/ TypeScript

Easily integrate in your JS/TS application using the sdk.

LYNC Paymaster SDK supporting supra on npmjs: https://www.npmjs.com/package/lync-paymaster-supra-sdk

Install the SDK

npm install lync-paymaster-supra-sdk --save

Import the dependencies

import { performPaymasterTransaction } from "lync-paymaster-supra-sdk";
import { BCS } from "supra-l1-sdk";

Get API Keys from LYNC Dashboard

// From LYNC Dashboard
const apiKey = "LYNC API KEY Dashboard";

// Get this from LYNC
const lyncAuthKey = "Get this from LYNC Support";

The performPaymasterTransaction function

import {
  TxnBuilderTypes,
  TransactionResponse
} from "supra-l1-sdk";

interface PaymasterTransactionReturnData {
  receipt: TransactionResponse;
  accountCreationReceipt: TransactionResponse;
  privateKey: string;
}

/**
 * The account information.
 * @param {string} privateKey - The private key for the account.
 * @param {string} accountAddress - The account address.
 */
interface AccountInfo {
  privateKey: string;
  accountAddress: string;
}

function performPaymasterTransaction(
  lyncAuthKey: string,
  supraNetwork: "testnet_supra" | "mainnet_supra",
  apiKey: string,
  inputTransaction: {
    entryFnStr: `0x${string}::${string}::${string}`;
    entryFnTypeArgs?: TxnBuilderTypes.TypeTag[];
    entryFnArgs: Uint8Array[];
  },
  showLogs: boolean,
  accountData?: AccountInfo,
): Promise<PaymasterTransactionReturnData>;

Using the performPaymasterTransaction function

Last updated