npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@matrix-labs/one-sync-sdk

v1.4.0

Published

### ERC721 related APIs

Downloads

5

Readme

OnceSyncERC721

ERC721 related APIs

https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721

export interface OneSyncERC721Client extends ERC721Client {
  connectProvider(
    address: string,
    provider: Provider
  ): Promise<OneSyncERC721Client>;

  connectSigner(signer: Signer): OneSyncERC721Client;

  setWaitConfirmations(num: number): void;

  /**
   * Get the owner/admin of the token
   *
   * @param {CallOverrides} [config] - Override the default contract call config
   * @return {Promise<string>} - The owner of the collection
   */
  owner(config?: CallOverrides): Promise<string>;

  /**
   * Get contract implementation version
   *
   * @param {CallOverrides} [config] - Override the default contract call config
   * @return {Promise<string>} - The contract implementation version
   */
  implementationVersion(config?: CallOverrides): Promise<string>;

  /**
   * Get latest token Version (tokenVersion + 1 after unlock and lock)
   *
   * @param {BigNumber} tokenId - The token id
   * @param {CallOverrides} [config] - Override the default contract call config
   * @return {Promise<string>} - The contract implementation version
   */
  tokenVersion(tokenId: BigNumber, config?: CallOverrides): Promise<BigNumber>;

  /**
   * Check if the token is locked
   *
   * @param {BigNumber} tokenId - The token id
   * @param {CallOverrides} [config] - Override the default contract call config
   * @return {Promise<string>} - The contract implementation version
   */
  locked(tokenId: BigNumber, config?: CallOverrides): Promise<boolean>;

  /**
   * Lock the token
   *
   * @param {BigNumber} tokenId - The token id
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  lock(tokenId: BigNumber, config?: PayableOverrides): Promise<ContractReceipt>;

  /**
   * Unlock the token
   *
   * @param {BigNumber} tokenId - The token id
   * @param {BigNumber} version - The current version of the token
   * @param {string} signature - The signature of the transaction
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  unLock(
    tokenId: BigNumber,
    version: BigNumber,
    signature: string,
    config?: PayableOverrides
  ): Promise<ContractReceipt>;

  /**
   * Mint token with the given signature
   *
   * @param {string} to - The address of token recipient
   * @param {BigNumber} tokenId - The token id
   * @param isLocked - Mint with locked status or not
   * @param nonce
   * @param {string} signature - The signature received from the service
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  mintWithSignature(
    to: string,
    tokenId: BigNumber,
    isLocked: boolean,
    nonce: string,
    signature: string,
    config?: PayableOverrides
  ): Promise<ContractReceipt>;

  /**
   * Mint batch tokens with the given signature
   *
   * @param {string} to - The address of token recipient
   * @param {Array<BigNumber>} tokenIds - The token id list
   * @param nonce
   * @param isLocked - Mint with locked status or not
   * @param {string} signature - The signature received from the service
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  mintBatchWithSignature(
    to: string,
    tokenIds: Array<BigNumber>,
    isLocked: boolean,
    nonce: string,
    signature: string,
    config?: PayableOverrides
  ): Promise<ContractReceipt>;

  /**
   * Burn the token
   * NOTICE: the token should not at the status of locked
   *
   * @param {BigNumber} tokenId - The token id
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  burn(tokenId: BigNumber, config?: PayableOverrides): Promise<ContractReceipt>;

  /**
   * Burn the token with the given signature
   *
   * @param {Array<BigNumber>} tokenIds - The token id list
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  burnBatch(tokenIds: Array<BigNumber>, config?: PayableOverrides): Promise<ContractReceipt>;

  /**
   * Burn the token with the given signature
   *
   * @param {Array<BigNumber>} tokenIds - The token id list
   * @param nonce
   * @param {string} signature - The signature received from the service
   * @param config
   * @return {Promise<ContractReceipt>} - The contract receipt
   */
  burnBatchWithSignature(
    tokenIds: Array<BigNumber>,
    nonce: string,
    signature: string,
    config?: PayableOverrides
  ): Promise<ContractReceipt>;
}

Usage:

Browser:

// setup client
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
await web3Provider.current.send('eth_requestAccounts', []);
const signer = ethProvider.current.getSigner();
const contractAddress = '0x......';
const nftClient = EtherOneSyncERC721Client();
await nftClient.connectProvider(contractAddress, web3Provider);
nftClient.connectSigner(signer);
nftClient.setWaitConfirmations(1); // 1 for testnet, 5 for mainnet
// const result = await nftClient.[ERC721 + OnceSync APIs]