Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mirrorworld/evm.token-claim

Package Overview
Dependencies
Maintainers
5
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mirrorworld/evm.token-claim

Air Droper Contract SDK

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

@usemirrorworld/evm.token-claim Client SDK

This SDK contains the client side methods for the Token Claim EVM Smart Contract

Installation

🚨 Please make sure to add this NPM token in your .npmrc file: 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

yarn add @usemirrorworld/evm.token-claim

Usage

Import the TokenClaimLib instance into your client for using the Token Claim Smart Contract. It expects a contractAddress and provider instance.

import { TokenClaimLib} from "@mirrorworld/evm.token-claim";

const RPC = "http://localhost:8500";
let provider = new ethers.providers.JsonRpcProvider(RPC);

let tokenClaimLib: TokenClaimLib = new TokenClaimLib(tokenClaim.address, provider);

Demo

Example: You can see example project in this is here

Initialize Claim Config

For setup up the claim pool call the "initializeClaimConfig" method

let tx = await tokenClaimLib.createInitializeClaimConfigTransactionRequest(caller.address, claimPoolName, ercTokenAddress, poolOwnerAddress, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

const txRe = await sentTx.wait();

Update Claim Config

For setting the enable or disable the claim pool, airdrop and claim call the "updateClaimConfig" method

let tx = await tokenClaimLib.createUpdateClaimConfigTransactionRequest(caller.address, claimPoolName, isEnable, isClaimEnable, isAirdropEnable, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

Add Pool Supply

For top up the pool supply for claim and airdrop call the "addPoolSupply" method, but before calling this method caller must call of this method must call the ERC20 approve for this Token Claim contract address as spender and amount which need to added in the supply

let tx = await tokenClaimLib.createAddPoolSupplyTransactionRequest(caller.address, claimPoolName, amount, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

Withdraw Pool Supply

For withdraw the pool supply call the "withdrawPoolSupply" method

let tx = await tokenClaimLib.createWithdrawPoolSupplyTransactionRequest(caller.address, claimPoolName, amount, receiver, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

Airdrop

For airdrop the token to the user call the "airdrop" method

let tx = await tokenClaimLib.createAirdropTransactionRequest(caller.address, claimPoolName, amount, user, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

Claim

For user to claim the token claim pool owner need to sign the payload with "claim ID (season ID)" and create the transaction which user send to the network

let claimMsg = tokenClaimLib.getClaimMessage(claimPoolName, caller.address, BigNumber.from(amount), claimId)
let claimSig = await tokenClaimLib.signMessage(ownerWallet, claimMsg)

let tx = await tokenClaimLib.createClaimTransactionRequest(caller.address, claimPoolName, amount, claimId, claimSig, gasPrice, gasLimit);

const sigTx = await caller.signTransaction(tx);

const sentTx = await provider.sendTransaction(sigTx);

const txRe = await sentTx.wait();

Keywords

FAQs

Package last updated on 01 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc