PapayaBySigInteraction

Class for using writable methods of Papaya Contract


constructor

description

"rpcUrl" is an address of your rpc

constructor({chainId: number, papayaAddress: string, tokenAddress: string, provider?: JsonRpcProvider, secretKey?: string})

parameters

  • chainId(number) - id of selected blockchain

  • papayaAddress(`0x{string}`) - smart-contract address

  • tokenAddress(`0x{string}`) - token address

  • provider( JsonRpcProvider ) - jsonRpc blockchain provider from ethers.js

  • secretKey(string) - wallet private key

secretKey and rpcUrl are mostly made for the NodeJS environment. It is not recommended to use them in browser.

usage

import { PapayaBySigInteraction } from "@papaya-metaverse/papaya-sdk"

const papayaBySigInteraction = new PapayaBySigInteraction({
    chainId: 1,
    papayaAddress: "0x1c3E45F2D9Dd65ceb6a644A646337015119952ff",
    tokenAddress: "0x1234567890123456789012345678901234567890",
    provider:  new JsonRpcProvider("https://polygon.infura.io/v3/${INFURA_API_KEY}"),
    //secretKey: "<WALLET_PRIVATE_KEY>" - only when there is no way to allow users to connect their wallets
})

bySigDeposit

description

async bySigDeposit(amount, deadline, isPermit2 = false)

parameters

  • amount(number) - amount of funds

  • deadline(number) -

  • isPermit2(boolean) - a flag indicating the specificity of the token


permitAndDeposit

description

async permitAndDeposit(amount, deadline)

parameters

  • amount(number) - amount of funds

  • deadline(number) -


bySigDepositFor

description

async bySigDepositFor(to, amount, deadline, isPermit2 = false)

parameters

  • to(`0x{string}`) -

  • amount(number) - amount of funds

  • deadline(number) -

  • isPermit2(boolean) - a flag indicating the specificity of the token


permitAndBySigDepositFor

description

async permitAndBySigDepositFor(to, amount, deadline, isPermit2 = false)

parameters

  • to(`0x{string}`) -

  • amount(number) - amount of funds

  • deadline(number) -

  • isPermit2(boolean) - a flag indicating the specificity of the token


bySigWithdraw

description

async bySigWithdraw(amount, deadline)

parameters

  • amount (number) - amount of funds

  • deadline(number) -


bySigWithdrawTo

description

async bySigWithdrawTo(to, amount, deadline)

parameters

  • to(`0x{string}`) -

  • amount(number) - amount of funds

  • deadline(number) -


bySigPay

description

async bySigPay(to, amount, deadline)

parameters

  • to(`0x{string}`) -

  • amount(number) - amount of funds

  • deadline(number) -


bySigSubscribe

description

async bySigSubscribe(author, subscriptionRate, projectId, deadline)

parameters

  • author(`0x{string}`) -

  • subscriptionRate(number) -

  • projectId(number) -

  • deadline(number) -


bySigUnsubscribe

description

async bySigUnsubscribe(author, deadline)

parameters

  • author(`0x{string}`) -

  • deadline(number) -


bySigLiquidate

description

async bySigLiquidate(account, deadline)

parameters

  • account(`0x{string}`) -

  • deadline(number) -


buildBySigTraits

description

async buildBySigTraits({ nonceType = 0n, deadline = 0n, relayer = constants.ZERO_ADDRESS.toString(), nonce = 0n, })

parameters

  • nonceType(`BigInt`) -

  • subscriptionRate(number) -

  • relayer(`0x{string}`) -

  • deadline(BigInt) -

Last updated