🇺🇲
Protocolink
  • 🔮Overview
  • 🌟Why Protocolink?
  • 💡Use Cases
    • Flash Loans
    • Permit2 Amplifier
    • Zap-in & Zap-out
    • Position Management
    • Multi-Action Bundling
  • 📋Networks & Protocols
  • 🛡️Security & Audits
  • 💎Fees
  • ❓FAQ
  • Protocolink API
    • 🔮Overview
      • Swap & Supply (Example)
    • 📗Swagger
      • Request Protocols
      • Request Tokens
      • Request Quote
      • Estimate Logics Result
      • Request Transaction Data
  • Protocolink SDK
    • 🔮Overview
    • 1️⃣Install SDK
    • 2️⃣Build Logics
    • 3️⃣Estimate Router Data
    • 4️⃣Send Router Transaction
    • ⚒️API SDK Interfaces
      • Global Types
      • FlashLoan Logic
      • Aave V2
      • Aave V3
      • Balancer V2
      • Compound V3
      • Iolend
      • Magicsea
      • Morphoblue
      • OpenOcean V2
      • ParaSwap V5
      • Permit2
      • Spark
      • Stargate
      • Stargate V2
      • SyncSwap
      • Uniswap V3
      • Utility
      • Wagmi
      • ZeroEx V4
    • ⚒️Common SDK Interfaces
      • Constants
      • Network
      • Token
      • Web3Toolkit
      • Utility Functions
  • Lending SDK
    • 🔮Overview
    • ✳️SDK
      • Open By Collateral
      • Open By Debt
      • Close
      • Leverage By Collateral
      • Leverage By Debt
      • Deleverage
      • Collateral swap
      • Debt swap
      • Zap supply
      • Zap withdraw
      • Zap repay
      • Zap borrow
  • Smart Contract
    • 🔮Overview
      • Router
      • Agent
      • Callback
      • Fees
      • Utility
      • Data Type
      • ERC721/ERC1155 Support
    • 📑Deployment Addresses
    • 🧑‍💻Security Review Details
  • COMPOUND KIT
    • 🔮Overview
    • ✳️SDK
      • Leverage
      • Deleverage
      • Collateral Swap
      • Zap Supply
      • Zap Withdraw
      • Zap Repay
      • Zap Borrow
    • 📗API
  • Video Tutorials
    • 1. Introducing Protocolink
    • 2. Lending SDK
    • 3. Protocolink Q&A
  • Social medias
    • Twitter
  • Support
Powered by GitBook
On this page
  • PullToken
  • Types
  • Functions
  • Example Code
  1. Protocolink SDK
  2. API SDK Interfaces

Permit2

In this section, we will introduce the Permit2 SDK interface, which provides developers with a convenient and efficient way to interact with the Permit2 protocol. These interfaces are related to pull token and are designed to be used easily and flexibly.

The following section will introduce the interfaces related to the Permit2 protocol, which can be accessed through the api.protocols.permit2. prefix.

PullToken

The following code defines interfaces and functions related to the Permit2 pull token logic:

Types

  • PullTokenFields: A type that represents the fields required for the Permit2 pull token logic.

interface PullTokenFields {
  input: {
    token: {
      chainId: number;
      address: string;
      decimals: number;
      symbol: string;
      name: string;
    };
    amount: string;
  };
}
  • PullTokenLogic: An interface that extends the Logic interface and represents the Permit2 pull token logic. It includes the rid, and fields properties.

interface PullTokenLogic {
  rid: string;
  fields: PullTokenFields;
}

Functions

  • getPullTokenTokenList(chainId: number): An asynchronous function that retrieves the list of tokens supported by the Permit2 pull token logic on the specified chainId.

  • newPullTokenLogic(fields: PullTokenFields): A function that creates the Permit2 pull token logic data with the given fields object.

Example Code

import * as api from '@protocolink/api';
import * as logics from '@protocolink/logics';

const chainId = 1;

const tokenList = await api.protocols.permit2.getPullTokenTokenList(chainId);
const asset = tokenList[0];

const pullTokenLogic = await api.protocols.permit2.newPullTokenLogic({
  input: {
    token: asset,
    amount: '10',
  },
});
PreviousParaSwap V5NextSpark

Last updated 1 year ago

⚒️