0.1.0 • Published 1 year ago

wherify-sdk v0.1.0

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

Wherify SDK

Setup

yarn
yarn build

open test/test.html in your browser to test your changes.

Usage

Browser

<!-- include lib once before the end of body tag: -->
<script defer src="https://unpkg.com/wherify-sdk@0.1.0/dist/umd/wherify.js"></script>

<!--
  add the following data-attributes to your `<img>`, `<picture>` and `<figure>` tags.
  `data-chain` is optional, supported values:
    - chainId (e.g. 1 for Ethereum mainnet)
    - or network code (e.g 'eth', 'eth_goerli', 'polygon', 'polygon_mumbai' - see all below)
-->
<img alt="" src="https://placekitten.com/500/500"
  data-token-id="636"
  data-owner="0x40D93ce96C7a4E7B0d750cA8FD06D27233A10021"
  data-contract="0x340700450f0303791529789793909C703730926f"
  data-chain="eth" />

<picture
  data-token-id="636"
  data-owner="0x40D93ce96C7a4E7B0d750cA8FD06D27233A10021"
  data-contract="0x340700450f0303791529789793909C703730926f"
  data-chain="eth">
  <source [...] />
  <source [...] />
  <img [...] />
</picture>

<figure
  data-token-id="636"
  data-owner="0x40D93ce96C7a4E7B0d750cA8FD06D27233A10021"
  data-contract="0x340700450f0303791529789793909C703730926f"
  data-chain="eth">
  <img [...] />
</figure>

CommonJS / ESM

// init library
const wherify = new Wherify()

// check non-verified images. call on page load or when loading new images into the DOM
wherify.check()

Supported networks

The Wherify API supports many different EVM-based blockchain networks. Use the keys below to specify the network your NFT is deployed to:

  • eth (chainId 1) -> default if not supplied
  • eth_goerli (chainId 5)
  • eth_sepolia (chainId 11155111)
  • eth_ropsten (chainId 3) -> deprecated
  • eth_rinkeby (chainId 4) -> deprecated
  • polygon (chainId 137)
  • polygon_test (chainId 80001)
  • avalanche (chainId 43114)
  • avalanche_test (chainId 43113)
  • bsc (chainId 56)
  • bsc_test (chainId 97)
  • fantom (chainId 250)
  • fantom_test (chainId 4002)
  • optimism (chainId 10)
  • optimism_test (chainId 420)
  • arbitrum (chainId 42161)
  • arbitrum_nova (chainId 42170)
  • arbitrum_test (chainId 421613)
  • klaytn (chainId 8217)
  • klaytn_test (chainId 1001)

Publish lib

  • sign up and get access token from npmjs
  • add NPM_TOKEN to Github Actions secrets
  • add annotated tag to branch:
git tag -a v0.1.2 -m "release 0.1.2"
  • push all tags