1.0.0 • Published 1 year ago

qn-go-plus-js v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

GoPlus JS SDK

A thin JS wrapper to interact with GoPlus, a gift from QuickNode.com. We recommend you save time and just use this via the relevant QuickNode marketplace add-on with Ethers.js or Web3.js.

Install it with: npm install qn-go-plus-js

How to use

Importing / requiring.

const {
  AccessToken,
  MaliciousAddress,
  NFTSecurity,
  TokenSecurity,
  ApprovalSecurity,
  PhishingSecurity,
} = require('qn-go-plus-js');

// or 
import {
  AccessToken,
  MaliciousAddress,
  NFTSecurity,
  TokenSecurity,
  ApprovalSecurity,
  PhishingSecurity,
} from 'qn-go-plus-js';

Getting an access token - make sure you have APP_KEY and APP_SECRET in a .env file.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET);
token.renew().then(console.log);

Checking an address for malicious activity.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET);
token.renew().then(async (refreshed_data) => {
  let address = MaliciousAddress.init(refreshed_data.token, CHAIN_ID_HERE);
  console.log(await address.check('ANY ADDRESS HERE'));
});

Checking an nft for security analysis.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET);
token.renew().then(async (refreshed_data) => {
  let nft = NFTSecurity.init(refreshed_data.token, CHAIN_ID_HERE);
  console.log(await nft.check('NFT CONTRACT ADDRESS HERE'));
});

Checking a token for security analysis.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET)
token.renew().then(async (refreshed_data) => {
  let token = TokenSecurity.init(refreshed_data.token, CHAIN_ID_HERE);
  console.log(await token.check('ERC20 TOKEN ADDRESS HERE'));
});

Checking what an approval may do.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET)
token.renew().then(async (refreshed_data) => {
  let approval = ApprovalSecurity.init(refreshed_data.approval, CHAIN_ID_HERE);
  console.log(await approval.check('ANY ADDRESS ASKING FOR APPROVAL HERE'));
});

Checking a website URL for known phishing activity.

let token = new AccessToken(process.env.APP_KEY, process.env.APP_SECRET)
token.renew().then(async (refreshed_data) => {
  let website = PhishingSecurity.init(refreshed_data.approval, null);
  console.log(await website.check('A URL STARTING WITH HTTP'));
});