LYNC
DashboardSupport
  • 👋Introducing LYNC
  • Products
    • LYNC Account Abstraction SDK
    • LYNC Account Abstraction WebGL SDK
    • Metamask Wallet
    • LYNC Metamask PC SDK
    • OKX Wallet
    • LYNC In-Game Marketplace SDK
    • NFT Fetcher
    • No-Code Smart Contract Deployer
    • EVM Lootbox SDK
      • Getting Started
      • Using the SDK
        • Creating a new lootbox
        • Opening a lootbox
        • Claiming rewards
        • Whitelisting users using lootbox
        • Lootbox admin functions
        • Useful information functions from LyncLootBox class
        • Multicall : opening and claiming multiple lootboxes in a single transaction
      • Example Codes in React & TypeScript
        • Example code for creating a new lootbox
        • Example code for opening a lootbox
        • Example code for claiming a lootbox
    • Launch your products on Telegram
      • Configure Your Telegram Bot
      • Deploying Your Product on TG
  • APTOS
    • LYNC Paymaster - Supporting Aptos
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • Unity
        • API
        • JavaScript/ TypeScript
    • LYNC Unity Aptos SDK
    • Keyless Accounts
      • Configure Your OIDC Provider
      • Integrate Keyless in Unity
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
        • Send generic transactions on Aptos
    • LYNC Social Login SDK on Aptos
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Aptos Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
  • Movement Labs
    • 📇Indexer
      • How to run index custom data?
      • Example Queries
        • Get Token Info
        • Get Token Balances
        • Get NFTs Owned by an Account
    • NFT Deployer
    • LYNC Social Login SDK on Movement
      • Getting Started
      • Using the SDK
      • Example Codes in React & TypeScript
      • Types and Enums Used in the Methods Provided by the SDK
      • Other Specification
    • LYNC Unity Movement SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
    • LYNC Paymaster - Supporting Movement
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
  • Supra
    • LYNC Paymaster - Supporting Supra L1
      • How to Register on LYNC Dashboard
      • How to Create Paymaster
      • How to Fund the Paymaster
      • Module & Function Whitelist
      • How to Integrate Paymaster
        • JavaScript/ TypeScript
    • LYNC Unity SUPRA SDK
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • Fuel
    • LYNC Unity Fuel SDK
    • LYNC NFT Deployer
      • Introduction
      • Getting Started
      • Deploying Your NFTs
        • Launch Your Entire Collection
      • Troubleshooting and FAQs
    • LYNC Fuel Lootbox
      • Getting Started
      • Creating a Lootbox
      • Opening a Lootbox
      • Claiming the Rewards
      • Conclusion
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
    • Fuel Marketplace NPM SDK
      • Getting Started
      • Using the SDK
        • Using hooks to get the marketplace data
        • Using services provided by the SDK to list, buy, and manage tokens
        • Some useful functions provided by the SDK
        • Error codes for the SDK
        • Interfaces and Enums provided by the SDK
      • Support
  • Metis
    • Wallet Creation and Transaction APIs
      • Pre-requisites
      • Integration
        • API Overview
        • Create a new wallet
        • Get already created wallet
        • Mint NFT transactions
  • NPM Packages
    • Marketplace
      • Hook: useAllCollectionNFT
      • Hook: useAllBuyNFT
      • Hook: useAllOwnerNFT
      • Hook: useNFTDetails
      • Hook: useAllNFTForRent
Powered by GitBook
On this page
  • Install the SDK
  • Import the dependencies
  • Get API Keys from LYNC Dashboard
  • The performPaymasterTransaction function
  • Using the performPaymasterTransaction function
  1. Movement Labs
  2. LYNC Paymaster - Supporting Movement
  3. How to Integrate Paymaster

JavaScript/ TypeScript

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

PreviousHow to Integrate PaymasterNextLYNC Paymaster - Supporting Supra L1

Last updated 5 months ago

LYNC Paymaster SDK supporting movement on npmjs:

Install the SDK

npm install lync-paymaster-movement-sdk --save

Import the dependencies

import { performPaymasterTransaction } from "lync-paymaster-movement-sdk";
import { Network } from "@aptos-labs/ts-sdk";

Get API Keys from

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

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

The performPaymasterTransaction function

import { 
  CommittedTransactionResponse, 
  InputEntryFunctionData, 
  Network 
} from "@aptos-labs/ts-sdk";

/**
 * The data returned from a paymaster transaction.
 * @param {CommittedTransactionResponse} receipt - The transaction receipt.
 * @param {CommittedTransactionResponse} accountCreationReceipt - The account creation receipt.
 * @param {string} privateKey - The private key for the account.
 */
interface PaymasterTransactionReturnData {
  receipt: CommittedTransactionResponse;
  accountCreationReceipt: CommittedTransactionResponse;
  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;
}

/**
 * Performs a paymaster transaction using the LYNC paymaster API.
 *
 * @param {string} lyncAuthKey - The LYNC API key for authentication.
 * @param {Network} network - The network to perform the transaction on. Should be CUSTOM for movement networks.
 * @param {string} apiKey - The LYNC API key for authentication.
 * @param {InputEntryFunctionData} inputTransaction - The input data for the transaction.
 * @param {boolean} showLogs - Whether to show logs or not.
 * @param {"porto" | "suzuka"} movementNetwork - The movement network to use(optional). Required if network is CUSTOM.
 * @param {AccountInfo} accountData - The account data(privateKey and accountAddress) for the transaction(optional). If not provided, a new account will be generated.
 * @returns {Promise<PaymasterTransactionReturnData>} The data returned from a paymaster transaction.
 */
async function performPaymasterTransaction(
  lyncAuthKey: string,
  network: Network,
  apiKey: string,
  inputTransaction: InputEntryFunctionData,
  showLogs: boolean,
  movementNetwork?: "porto" | "suzuka",
  accountData?: AccountInfo,
): Promise<PaymasterTransactionReturnData> ;

Using the performPaymasterTransaction function

const accountData = {
  privateKey: "0x....",
  accountAddress: "0x...."
};

const data = await performPaymasterTransaction(
  lyncAuthKey,
  Network.CUSTOM, // For movement networks
  apiKey,
  {
    function: "0x1::aptos_account::transfer", // entry function
    functionArguments: [
      "0x587f66c999fed81c8872c5ddabed1e7049c790d750d2a796313a32702dcff962", // to address
      "100000000" // 1 APT = 100000000
    ]
  },
  false, // show logs or not
  "porto", // For porto movement testnet
  accountData // optional - will generate a new account if not provided
);

console.log(data);
https://www.npmjs.com/package/lync-paymaster-movement-sdk
LYNC Dashboard