🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@matrix-labs/one-sync-sdk

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@matrix-labs/one-sync-sdk

### ERC721 related APIs

1.4.0
latest
npm
Version published
Maintainers
3
Created
Source

OnceSyncERC721

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]

FAQs

Package last updated on 28 Apr 2022

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