{"id":19319683,"url":"https://github.com/blockcoders/harmony-marketplace-sdk","last_synced_at":"2025-04-22T17:32:02.583Z","repository":{"id":37088812,"uuid":"446574406","full_name":"blockcoders/harmony-marketplace-sdk","owner":"blockcoders","description":"Harmony Marketplace SDK provides a collection of interfaces to interact with HRC721, HRC1155 and any Smart Contracts that extends those standards.","archived":false,"fork":false,"pushed_at":"2022-11-01T17:41:58.000Z","size":965,"stargazers_count":9,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-02T02:22:32.405Z","etag":null,"topics":["blockchain","harmony","harmony-one","harmony-sdk","hrc1155","hrc721","marketplace","nft","nft-marketplace","one"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blockcoders.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-10T20:37:57.000Z","updated_at":"2023-03-03T10:24:42.000Z","dependencies_parsed_at":"2023-01-21T03:16:23.936Z","dependency_job_id":null,"html_url":"https://github.com/blockcoders/harmony-marketplace-sdk","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fharmony-marketplace-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fharmony-marketplace-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fharmony-marketplace-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blockcoders%2Fharmony-marketplace-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blockcoders","download_url":"https://codeload.github.com/blockcoders/harmony-marketplace-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250287662,"owners_count":21405657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","harmony","harmony-one","harmony-sdk","hrc1155","hrc721","marketplace","nft","nft-marketplace","one"],"created_at":"2024-11-10T01:24:48.893Z","updated_at":"2025-04-22T17:32:02.202Z","avatar_url":"https://github.com/blockcoders.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Harmony Marketplace SDK\n=================\n\n[![npm](https://img.shields.io/npm/v/harmony-marketplace-sdk)](https://www.npmjs.com/package/harmony-marketplace-sdk)\n[![CircleCI](https://circleci.com/gh/blockcoders/harmony-marketplace-sdk/tree/main.svg?style=svg)](https://circleci.com/gh/blockcoders/harmony-marketplace-sdk/tree/main)\n[![Coverage Status](https://coveralls.io/repos/github/blockcoders/harmony-marketplace-sdk/badge.svg?branch=main)](https://coveralls.io/github/blockcoders/harmony-marketplace-sdk?branch=main)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/943e9d8d050d4f129d2a2c63afdd419b)](https://www.codacy.com/gh/blockcoders/harmony-marketplace-sdk/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=blockcoders/harmony-marketplace-sdk\u0026amp;utm_campaign=Badge_Grade)\n[![vulnerabilities](https://img.shields.io/snyk/vulnerabilities/npm/harmony-marketplace-sdk)](https://snyk.io/test/github/blockcoders/harmony-marketplace-sdk)\n[![License](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![BCH compliance](https://bettercodehub.com/edge/badge/blockcoders/harmony-marketplace-sdk?branch=main)](https://bettercodehub.com/)\n[![CodeQL](https://github.com/blockcoders/harmony-marketplace-sdk/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/blockcoders/harmony-marketplace-sdk/actions/workflows/codeql-analysis.yml)\n\nHarmony Marketplace SDK provides a collection of interfaces to interact with HRC721, HRC1155 and any Smart Contracts that extends those standards. This library was based on [@harmony-js](https://github.com/harmony-one/sdk)\n\n## Install\n\n```sh\nnpm i harmony-marketplace-sdk\n```\n\n## Usage\n\n### Node\n\n```typescript\n// JavaScript\nconst { HRC721 } = require('harmony-marketplace-sdk')\n\n// TypeScript\nimport { HRC721 } from 'harmony-marketplace-sdk'\n```\n\n### Browser\n\nInclude the ESM module (harmony-marketplace-sdk.esm.js) and import using:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { HRC721 } from './harmony-marketplace-sdk.esm.js'\n\u003c/script\u003e\n```\n\n## Wallet\n\nHarmony Marketplace SDK provides three implementations of [Wallet](https://github.com/harmony-one/sdk/blob/master/packages/harmony-account/src/wallet.ts#L14) which help to create a Signer from a private key or mnemonic effortless.\n\n### Private Key\n\nImplementation of the Wallet that uses a private key.\n\n```ts\nimport { HttpProvider, WSProvider } from '@harmony-js/network'\nimport { PrivateKey, HarmonyShards, HARMONY_RPC_SHARD_0_URL, HARMONY_RPC_WS } from 'harmony-marketplace-sdk'\n\nconst privateKey = '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n\n// Using a HttpProvider with a string url.\nconst pk = new PrivateKey(new HttpProvider('https://api.harmony.one'), privateKey)\n\n// Using a HttpProvider with a const from Harmony Marketplace SDK.\nconst pk = new PrivateKey(new HttpProvider(HARMONY_RPC_SHARD_0_URL), privateKey)\n\n// Using a WSProvider with a string url.\nconst pk = new PrivateKey(new WSProvider('wss://ws.s0.t.hmny.io'), privateKey)\n\n// Using a WSProvider with a const from Harmony Marketplace SDK.\nconst pk = new PrivateKey(new WSProvider(HARMONY_RPC_WS), privateKey)\n\n// Using a provider with a pre-configuration from Harmony Marketplace SDK.\nconst pk = new PrivateKey(HarmonyShards.SHARD_0, privateKey)\n```\n\n### Mnemonic Key\n\nImplementation of the Wallet that uses a list of words for the mnemonic key.\n\n```ts\nimport { HttpProvider, WSProvider } from '@harmony-js/network'\nimport { MnemonicKey, HarmonyShards, HARMONY_RPC_SHARD_0_URL, HARMONY_RPC_WS } from 'harmony-marketplace-sdk'\n\nconst mnemonic = 'glory seat canal seven erosion asset guilt perfect fluid dice floor unfold'\n\n// Using a HttpProvider with a string url.\nconst mnemonicKey = new MnemonicKey(new HttpProvider('https://api.harmony.one'), { mnemonic })\n\n// Using a HttpProvider with a const from Harmony Marketplace SDK.\nconst mnemonicKey = new MnemonicKey(new HttpProvider(HARMONY_RPC_SHARD_0_URL), { mnemonic })\n\n// Using a WSProvider with a string url.\nconst mnemonicKey = new MnemonicKey(new WSProvider('wss://ws.s0.t.hmny.io'), { mnemonic })\n\n// Using a WSProvider with a const from Harmony Marketplace SDK.\nconst mnemonicKey = new MnemonicKey(new WSProvider(HARMONY_RPC_WS), { mnemonic })\n\n// Using a provider with a pre-configuration from Harmony Marketplace SDK.\nconst mnemonicKey = new MnemonicKey(HarmonyShards.SHARD_0, { mnemonic })\n```\n\n### Simple Key\n\nImplementation of the Wallet that does not use any pk or mnemonic.\n\n```ts\nimport { HttpProvider, WSProvider } from '@harmony-js/network'\nimport { Key, HarmonyShards, HARMONY_RPC_SHARD_0_URL, HARMONY_RPC_WS } from 'harmony-marketplace-sdk'\n\n// Using a HttpProvider with a string url.\nconst key = new Key(new HttpProvider('https://api.harmony.one'))\n\n// Using a HttpProvider with a const from Harmony Marketplace SDK.\nconst key = new Key(new HttpProvider(HARMONY_RPC_SHARD_0_URL))\n\n// Using a WSProvider with a string url.\nconst key = new Key(new WSProvider('wss://ws.s0.t.hmny.io'))\n\n// Using a WSProvider with a const from Harmony Marketplace SDK.\nconst key = new Key(new WSProvider(HARMONY_RPC_WS))\n\n// Using a provider with a pre-configuration from Harmony Marketplace SDK.\nconst key = new Key(HarmonyShards.SHARD_0)\n\n// Add Private key manually\nkey.addByPrivateKey('45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e')\n```\n\n### HD Key\n\nImplementation of a hierarchical deterministic (HD) wallet that uses a mnemonic to generate the derivative addresses.\n\n```ts\nimport { HttpProvider, WSProvider } from '@harmony-js/network'\nimport { HDKey, HarmonyShards, HARMONY_RPC_SHARD_0_URL, HARMONY_RPC_WS } from 'harmony-marketplace-sdk'\n\nconst options = {\n  mnemonic: 'glory seat canal seven erosion asset guilt perfect fluid dice floor unfold',\n  index: 0,\n  numberOfAddresses: 1,\n  shardId: 0,\n  gasLimit: '1000000',\n  gasPrice: '2000000000',\n}\n\n// Using a HttpProvider with a string url.\nconst key = new HDKey(new HttpProvider('https://api.harmony.one'), options)\n\n// Using a HttpProvider with a const from Harmony Marketplace SDK.\nconst key = new HDKey(new HttpProvider(HARMONY_RPC_SHARD_0_URL), options)\n\n// Using a WSProvider with a string url.\nconst key = new HDKey(new WSProvider('wss://ws.s0.t.hmny.io'), options)\n\n// Using a WSProvider with a const from Harmony Marketplace SDK.\nconst key = new HDKey(new WSProvider(HARMONY_RPC_WS), options)\n\n// Using a provider with a pre-configuration from Harmony Marketplace SDK.\nconst key = new HDKey(HarmonyShards.SHARD_0, options)\n```\n\n## Metamask Provider\n\nImplementation a subclass of HttpProvider that takes window.ethereum as a parameter, each method of HttpProvider is implemented by this subclass by cascading the request appropriately to window.ethereum\n\n```ts\nimport detectEthereumProvider from '@metamask/detect-provider'\nimport { MetamaskProvider } from 'harmony-marketplace-sdk'\n\nconst provider = await detectEthereumProvider()\n\n// Using a MetamaskProvider with window or a detected provider.\nconst key = new Key(new MetamaskProvider(window.ethereum || provider))\n\n```\n\n## Base Token\n\nThe `BaseToken` is an extension over a regular [Contract](https://github.com/harmony-one/sdk/tree/master/packages/harmony-contract) which is the Harmony recomendation for interact with smart contracts. This abstract class contains the core functionality for interact with Harmony Smart Contracts.\n\n## HRC20 API\n\nThe `HRC20` implements the abstract class [Base Token](#base-token).\n\n**NOTE**: The harmony [explorer](https://explorer.harmony.one/hrc20) will look for a specific list of functions and events to identify HRC20 tokens. You can validate if the bytecode of your HRC20 is valid [here](https://explorer.harmony.one/tools/checkHrc).\n\nExpected Methods:\n| Method | Description |\n| ------------- | ------------- |\n| totalSupply | Total amount of tokens stored by the contract. |\n| balanceOf | Returns the amount of tokens owned by account. |\n| transfer | Moves amount tokens from the caller’s account to another account. |\n| allowance | Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom |\n| approve | Sets amount as the allowance of spender over the caller’s tokens. |\n| transferFrom | Moves amount tokens from an account to another account using the allowance mechanism. |\n| symbol | Returns the symbol of the token. |\n| name | Returns the name of the token. |\n| decimals | Returns the decimals places of the token. |\n| mint | Creates amount tokens and assigns them to account. |\n| burn | Destroys amount tokens from account. |\n| burnFrom | Destroys amount tokens from an account. |\n\n\nExpected Events\n| Event | Description |\n| ------------- | ------------- |\n| Transfer | Emitted when a token id is transferred from an address to another. |\n| Approval | Emitted when owner enables approved to manage the tokenId token. |\n\nYou can find an example of [HRC20](./src/tests/contracts/BlockcodersHRC20.sol) in this address [0x...0a0a](https://explorer.ps.hmny.io/address/0x35305d505a884ccfaba7b7d5f533ef29ad57254b?activeTab=7).\n\n### Initializing\n\n```typescript\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// A contract instance with options\nconst contract = new HRC20('0x...00', ABI, wallet, {\n  data: '0x',\n  shardID: 0,\n  address: '0x...00',\n  defaultAccount: wallet.getAccount('0x...00'),\n  defaultBlock: 'lastest',\n  defaultGas: '21000',\n  defaultGasPrice: '1',\n  transactionBlockTimeout: 2000,\n  transactionConfirmationBlocks: '10',\n  transactionPollingTimeout: 200,\n})\n```\n\n### Methods\n\n#### totalSupply(txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the amount of tokens in existence.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns the totalSupply as a BN instance\nconst totalSupply = await contract.totalSupply()\n```\n\n#### balanceOf(address: string, txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the number of tokens owned by \u003ccode\u003eaddress\u003c/code\u003e.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a BN instance.\nconst balance = await contract.balanceOf('0x...01')\n```\n\n#### transfer(to: string, amount: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eMoves \u003ccode\u003eamount\u003c/code\u003e tokens from the caller’s account to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.transfer('0x...01', '1')\n```\n\n#### allowance(owner: string, spender: string, txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the remaining number of tokens that \u003ccode\u003espender\u003c/code\u003e will be allowed to spend on behalf of \u003ccode\u003eowner\u003c/code\u003e through transferFrom. This is zero by default.\u003c/p\u003e\n\u003cp\u003eThis value changes when \u003ccode\u003eapprove\u003c/code\u003e or \u003ccode\u003etransferFrom\u003c/code\u003e are called.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a BN instance.\nconst tx = await contract.allowance('0x...01', '0x...02')\n```\n\n#### approve(spender: string, amount: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eSets \u003ccode\u003eamount\u003c/code\u003e as the allowance of \u003ccode\u003espender\u003c/code\u003e over the caller’s tokens. \u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eApproval\u003c/code\u003e event.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.approve('0x...01', 100)\n```\n\n#### transferFrom(from: string, to: string, amount: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eMoves \u003ccode\u003eamount\u003c/code\u003e tokens from \u003ccode\u003efrom\u003c/code\u003e account to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.transferFrom('0x...01', '0x...02', 100)\n```\n\n#### symbol(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token symbol.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a string value.\nconst symbol = await contract.symbol()\n```\n\n#### name(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token name.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a string value.\nconst name = await contract.name()\n```\n\n#### decimals(txOptions?: ITransactionOptions): Promise\u0026lt;number\u0026gt;\n\n\u003cp\u003eReturns the decimals places of the token.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a number value.\nconst name = await contract.decimals() // 18\n```\n#### mint(account: string, amount: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eMints an \u003ccode\u003eamount\u003c/code\u003e of tokens and transfers them to the \u003ccode\u003eaccount\u003c/code\u003e increasing the total supply.\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransfer\u003c/code\u003e event with from set to the zero address.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003eaccount\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.mint('0x...01', 10)\n```\n\n#### burn(amount: number, txOptions?: ITransactionOptions)\n\n\u003cp\u003eDestroys an \u003ccode\u003eamount\u003c/code\u003e of tokens from the caller wallet, reducing the total supply.\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransfer\u003c/code\u003e event with to set to the zero address.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003eaccount cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003eaccount must have at least \u003ccode\u003eamount\u003c/code\u003e tokens.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.burn(10)\n```\n\n#### burnFrom(account: string, amount: number, txOptions?: ITransactionOptions)\n\n\u003cp\u003eDestroys \u003ccode\u003eamount\u003c/code\u003e tokens from \u003ccode\u003eaccount\u003c/code\u003e, deducting from the caller’s allowance.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003ethe caller must have allowance for \u003ccode\u003eaccounts\u003c/code\u003e's tokens of at least \u003ccode\u003eamount\u003c/code\u003e.\u003c/li\u003e    \n  \u003c/ul\u003e\n\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC20('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.burnFrom('0x...01', 10)\n```\n\n## HRC721 API\n\nThe `HRC721` implements the abstract class [Base Token](#base-token).\n\n**NOTE**: The harmony [explorer](https://explorer.harmony.one/hrc721) will look for a specific list of functions and events to identify HRC721 tokens. You can validate if the bytecode of your HRC71 is valid [here](https://explorer.harmony.one/tools/checkHrc).\n\nExpected Methods:\n| Method | Description |\n| ------------- | ------------- |\n| balanceOf | The number of tokens in owner's account. |\n| ownerOf | The owner of a token. |\n| safeTransferFrom | Safely transfers a token from an address to another. |\n| transferFrom | Transfers a token from an address to another address. |\n| approve | Gives permission to an account to transfer a token to another account. |\n| getApproved | Returns the account approved for a token. |\n| setApprovalForAll | Approve or remove operator as an operator for the caller. |\n| isApprovedForAll | Returns if the operator is allowed to manage all of the assets of an account. |\n| totalSupply | Total amount of tokens stored by the contract. |\n| tokenURI | The Uniform Resource Identifier (URI) for a token. |\n| symbol | The token collection symbol. |\n| name | The token collection name. |\n| mint | Mints a token with the given id and transfers it to an address. |\n| safeMint | Safely mints a token and transfers it to an address. |\n| burn | Destroys a token |\n\nExpected Events\n| Event | Description |\n| ------------- | ------------- |\n| Transfer | Emitted when a token id is transferred from an address to another. |\n| Approval | Emitted when an account enables another account to manage a token. |\n\nYou can find an example of [HRC721](./src/tests/contracts/BlockcodersHRC721.sol) in this address [0x...0a0a](https://explorer.pops.one/address/0xbba5d03304318b8fe765d977081eb392eb170a0a?activeTab=0).\n\n### Initializing\n\n```typescript\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// A contract instance with options\nconst contract = new HRC721('0x...00', ABI, wallet, {\n  data: '0x',\n  shardID: 0,\n  address: '0x...00',\n  defaultAccount: wallet.getAccount('0x...00'),\n  defaultBlock: 'lastest',\n  defaultGas: '21000',\n  defaultGasPrice: '1',\n  transactionBlockTimeout: 2000,\n  transactionConfirmationBlocks: '10',\n  transactionPollingTimeout: 200,\n})\n```\n\n### Methods\n\n#### balanceOf(address: string, txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the number of tokens in \u003ccode\u003eaddress\u003c/code\u003e's account.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a BN instance.\nconst balance = await contract.balanceOf('0x...01')\n```\n\n#### ownerOf(tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the owner of the \u003ccode\u003etokenId\u003c/code\u003e token.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must exist.\u003c/li\u003e    \n  \u003c/ul\u003e\n\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns an address.\nconst owner = await contract.ownerOf('1')\n```\n\n#### safeTransferFrom(from: string, to: string, tokenId: BNish, data?: any, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eSafely transfers \u003ccode\u003etokenId\u003c/code\u003e token from \u003ccode\u003efrom\u003c/code\u003e to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003efrom\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003eto\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e token must exist and be owned by \u003ccode\u003efrom\u003c/code\u003e.\u003c/li\u003e\n    \u003cli\u003eIf the caller is not \u003ccode\u003efrom\u003c/code\u003e, it must be approved to move this token by either \u003ccode\u003eapprove\u003c/code\u003e or \u003ccode\u003esetApprovalForAll\u003c/code\u003e.\u003c/li\u003e\n    \u003cli\u003eIf \u003ccode\u003eto\u003c/code\u003e refers to a smart contract, it must implement \u003ccode\u003eIERC721Receiver.onERC721Received\u003c/code\u003e, which is called upon a safe transfer.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransfer\u003c/code\u003e event.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.safeTransferFrom('0x...01', '0x...02', '1')\n```\n\n#### transferFrom(from: string, to: string, tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eTransfers \u003ccode\u003etokenId\u003c/code\u003e token from \u003ccode\u003efrom\u003c/code\u003e to \u003ccode\u003eto\u003c/code\u003e. Usage of this method is discouraged, use \u003ccode\u003esafeTransferFrom\u003c/code\u003e whenever possible.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003efrom\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003eto\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e token must exist and be owned by \u003ccode\u003efrom\u003c/code\u003e.\u003c/li\u003e\n    \u003cli\u003eIf the caller is not \u003ccode\u003efrom\u003c/code\u003e, it must be approved to move this token by either \u003ccode\u003eapprove\u003c/code\u003e or \u003ccode\u003esetApprovalForAll\u003c/code\u003e.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransfer\u003c/code\u003e event.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.transferFrom('0x...01', '0x...02', '1')\n```\n\n#### approve(to: string, tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eGives permission to \u003ccode\u003eto\u003c/code\u003e to transfer \u003ccode\u003etokenId\u003c/code\u003e token to another account. The approval is cleared when the token is transferred.\u003c/p\u003e\n\u003cp\u003eOnly a single account can be approved at a time, so approving the zero address clears previous approvals.\u003c/p\u003e\n\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003eThe caller must own the token or be an approved operator.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must exist.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eApproval\u003c/code\u003e event.\u003c/p\u003e\n  \n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.approve('0x...01', '1')\n```\n\n#### getApproved(tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the account approved for \u003ccode\u003etokenId\u003c/code\u003e token.\u003cp\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must exist.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n  \n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns an address.\nconst address = await contract.getApproved('1')\n```\n\n#### setApprovalForAll(addressOperator: string, approved: boolean, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eApprove or remove \u003ccode\u003eaddressOperator\u003c/code\u003e as an operator for the caller. Operators can call \u003ccode\u003etransferFrom\u003c/code\u003e or \u003ccode\u003esafeTransferFrom\u003c/code\u003e for any token owned by the caller.\u003cp\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003eThe \u003ccode\u003eaddressOperator\u003c/code\u003e cannot be the caller.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eApprovalForAll\u003c/code\u003e event.\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.setApprovalForAll('0x...01', true)\n```\n\n#### isApprovedForAll(owner: string, operator: string, txOptions?: ITransactionOptions): Promise\u0026lt;boolean\u0026gt;\n\n\u003cp\u003eReturns if the \u003ccode\u003eoperator\u003c/code\u003e is allowed to manage all of the assets of \u003ccode\u003eowner\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eSee \u003ccode\u003esetApprovalForAll\u003c/code\u003e\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a boolean\nconst isApproved = await contract.isApprovedForAll('0x...01', '0x...02')\n```\n  \n####  totalSupply(txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the total amount of tokens stored by the contract.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a number value.\nconst supply = await contract.totalSupply()\n```\n\n#### tokenURI(tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the Uniform Resource Identifier (URI) for \u003ccode\u003etokenId\u003c/code\u003e token.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a string value.\nconst uri = await contract.tokenURI('10')\n\n\n#### symbol(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token collection symbol.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a string value.\nconst symbol = await contract.symbol() \n```\n\n#### name(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token collection name.\u003c/p\u003e\n\n```ts\n\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a string value.\nconst name = await contract.name()\n```\n\n#### mint(account: string, tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eMints a token with \u003ccode\u003etokenId\u003c/code\u003e and transfers it to the \u003ccode\u003eaccount\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eUsage of this method is discouraged, use \u003ccode\u003esafeMint\u003c/code\u003e whenever possible\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must not exist.\u003c/li\u003e\n    \u003cli\u003e\u003ccode\u003eaccount\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eTransfer\u003c/code\u003e event.\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.mint('0x...01', '1')\n```\n\n#### safeMint(to: string, tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eSafely mints a token with \u003ccode\u003etokenId\u003c/code\u003e and transfers it to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must not exist.\u003c/li\u003e\n    \u003cli\u003eIf \u003ccode\u003eto\u003c/code\u003e refers to a smart contract, it must implement \u003ccode\u003eIERC721Receiver.onERC721Received\u003c/code\u003e, which is called upon a safe transfer.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eTransfer\u003c/code\u003e event.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.mint('0x...01', '1')\n```\n\n#### burn(tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eDestroys \u003ccode\u003etokenId\u003c/code\u003e. The caller must own \u003ccode\u003etokenId\u003c/code\u003e or be an approved operator.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenId\u003c/code\u003e must exist.\u003c/li\u003e    \n  \u003c/ul\u003e\n\u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eTransfer\u003c/code\u003e event.\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC721 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC721('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.burn('1')\n```\n\n## HRC1155 API\n\nThe `HRC1155` implements the abstract class [Base Token](#base-token).\n\n**NOTE**: The harmony [explorer](https://explorer.harmony.one/hrc1155) will look for a specific list of functions and events to identify HRC1155 tokens. You can validate if the bytecode of your HRC1155 is valid [here](https://explorer.harmony.one/tools/checkHrc).\n\nExpected Methods:\n| Method | Description |\n| ------------- | ------------- |\n| balanceOf | Returns the amount of tokens of a token type (id) owned by an account. |\n| balanceOfBatch | Batched version of balanceOf. |\n| safeTransferFrom | Transfers the amount of tokens of a token type (id) from an address to another address. |\n| safeBatchTransferFrom | Batched version of safeTransferFrom. |\n| setApprovalForAll | Grants or revokes permission to an operator to transfer the caller’s tokens. |\n| isApprovedForAll | Returns true if an operator is approved to transfer the tokens of an account. |\n| owner | Returns the address of the current contract owner. |\n| tokenURIPrefix | Returns the token URI prefix |\n| contractURI | Returns a URL for the storefront-level metadata for your contract. |\n| tokenURI | Returns the Uniform Resource Identifier (URI) for a token. |\n| totalSupply | Total amount of tokens with a given token id |\n| symbol | Returns the token collection symbol. |\n| name | Returns the token collection name. |\n| mint | Creates the amount of tokens of a token type (id), and assigns them to an account. |\n| mintBatch | Batched version of mint |\n\nExpected Events\n| Event | Description |\n| ------------- | ------------- |\n| TransferSingle | Emitted when a token id are transferred from an address to another by operator. |\n| TransferBatch | Emitted when a token ids are transferred from an address to another by operator. |\n\nYou can find an example of [HRC1155](./src/tests/contracts/BlockcodersHRC1155.sol) in this address [0x...b264](https://explorer.pops.one/address/0x16703afb468e4ba88380c2a2fda1aa4c5ec7b264).\n\n### Initializing\n\n```typescript\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// A contract instance with options\nconst contract = new HRC1155('0x...00', ABI, wallet, {\n  data: '0x',\n  shardID: 0,\n  address: '0x...00',\n  defaultAccount: wallet.getAccount('0x...00'),\n  defaultBlock: 'lastest',\n  defaultGas: '21000',\n  defaultGasPrice: '1',\n  transactionBlockTimeout: 2000,\n  transactionConfirmationBlocks: '10',\n  transactionPollingTimeout: 200,\n})\n```\n\n### Methods\n\n#### balanceOf(address: string, id: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eReturns the amount of tokens of token type (id) \u003ccode\u003eid\u003c/code\u003e owned by \u003ccode\u003eaddress\u003c/code\u003e.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a BN instance.\nconst balance = await contract.balanceOf('0x...01', '1')\n```\n\n#### balanceOfBatch(accounts: string[], ids: BNish[], txOptions?: ITransactionOptions): Promise\u0026lt;BN[]\u0026gt;\n\n\u003cp\u003eBatched version of \u003ccode\u003ebalanceOf\u003c/code\u003e.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns an array of BN instance.\nconst balances = await contract.balanceOfBatch(['0x...01', '0x...02'], ['1', '2'])\n```\n\n#### safeTransferFrom(from: string, to: string, id: BNish, amount: BNish, data: any, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eTransfers \u003ccode\u003eamount\u003c/code\u003e tokens of token type (id) \u003ccode\u003eid\u003c/code\u003e from \u003ccode\u003efrom\u003c/code\u003e to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.safeTransferFrom('0x...01', '0x...02', '1', '1', [])\n```\n\n#### safeBatchTransferFrom(from: string, to: string, ids: BNish[], amounts: BNish[], data: any, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eBatched version of \u003ccode\u003esafeTransferFrom\u003c/code\u003e.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.safeBatchTransferFrom('0x...01', '0x...02', ['1', '2'], ['1', '1'], [])\n```\n\n#### setApprovalForAll(addressOperator: string, approved: boolean, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eGrants or revokes permission to \u003ccode\u003eoperator\u003c/code\u003e to transfer the caller’s tokens, according to \u003ccode\u003eapproved\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eEmits an \u003ccode\u003eApprovalForAll\u003c/code\u003e event.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003eoperator\u003c/code\u003e cannot be the caller.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.setApprovalForAll('0x...01', true)\n```\n\n#### isApprovedForAll(owner: string, operator: string, txOptions?: ITransactionOptions): Promise\u0026lt;boolean\u0026gt;\n\n\u003cp\u003eReturns true if \u003ccode\u003eoperator\u003c/code\u003e is approved to transfer \u003ccode\u003eaccount\u003c/code\u003e's tokens.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns an boolean value.\nconst isApproved = await contract.isApprovedForAll('0x...01', '0x...02')\n```\n\n#### owner(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the address of the current owner.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns an address.\nconst owner = await contract.owner()\n```\n\n#### tokenURIPrefix(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token URI prefix.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns an string value.\nconst uri = await contract.tokenURIPrefix()\n```\n\n#### contractURI(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003ereturns a URL for the storefront-level metadata for your contract.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns an string value.\nconst uri = await contract.contractURI()\n```\n\n\n#### totalSupply(id: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;BN\u0026gt;\n\n\u003cp\u003eTotal amount of tokens with a given token \u003ccode\u003eid\u003c/code\u003e.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a number value.\nconst total = await contract.totalSupply('1')\n```\n\n#### tokenURI(tokenId: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the Uniform Resource Identifier (URI) for \u003ccode\u003etokenId\u003c/code\u003e token.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a string value.\nconst uri = await contract.tokenURI('1')\n```\n\n\n#### symbol(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token collection symbol.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a string value.\nconst symbol = await contract.symbol()\n```\n\n#### name(txOptions?: ITransactionOptions): Promise\u0026lt;string\u0026gt;\n\n\u003cp\u003eReturns the token collection name.\u003c/p\u003e\n\n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a string value.\nconst name = await contract.name()\n```\n\n#### mint(account: string, tokenId: BNish, amount: BNish, txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eCreates \u003ccode\u003eamount\u003c/code\u003e tokens of token type (id) \u003ccode\u003etokenId\u003c/code\u003e, and assigns them to \u003ccode\u003eto\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransferSingle\u003c/code\u003e event.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003eto\u003c/code\u003e cannot be the zero address.\u003c/li\u003e\n    \u003cli\u003eIf \u003ccode\u003eto\u003c/code\u003e refers to a smart contract, it must implement \u003ccode\u003eIERC1155Receiver.onERC1155Received\u003c/code\u003e and return the acceptance magic value.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.mint('0x...01', '1', '10')\n```\n\n#### mintBatch(account: string, tokenIds: BNish[], amounts: BNish[], txOptions?: ITransactionOptions): Promise\u0026lt;Transaction\u0026gt;\n\n\u003cp\u003eBatched version of \u003ccode\u003emint\u003c/code\u003e.\u003cp\u003e\n\u003cp\u003eEmits a \u003ccode\u003eTransferBatch\u003c/code\u003e event.\u003c/p\u003e\n\u003cp\u003eRequirements\n  \u003cul\u003e\n    \u003cli\u003e\u003ccode\u003etokenIds\u003c/code\u003e and \u003ccode\u003eamounts\u003c/code\u003e must have the same length.\u003c/li\u003e\n    \u003cli\u003eIf \u003ccode\u003eto\u003c/code\u003e refers to a smart contract, it must implement \u003ccode\u003eIERC1155Receiver.onERC1155Received\u003c/code\u003e and return the acceptance magic value.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/p\u003e\n  \n```ts\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst wallet = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\n\n// A contract instance\nconst contract = new HRC1155('0x...00', ABI, wallet)\n\n// returns a Harmony Transaction instance.\nconst tx = await contract.mintBatch('0x...01', ['1', '2', '3'], ['10', '5', '20'])\n```\n\n## BridgeToken API\n\nHarmony -\u003e Ethereum way bridge \n\n### Initializing\n\n```typescript\nimport { PrivateKey, HarmonyShards, HRC1155 } from 'harmony-marketplace-sdk'\nimport * as ABI from './abi.json'\n\nconst ethOwner = new Wallet(\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e',\n  new EtherscanProvider(\n    { chainId: 1 },\n    API_KEY,\n  )\n) \nconst hmyOwner = new PrivateKey(\n  HarmonyShards.SHARD_0,\n  '45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e'\n)\nconst bridge = new BridgeHRC20Token(hmyOwner, ethOwner)\nconst token = new HRC20('0x...00', ABI, hmyOwner)\nconst sender =  hmyOwner.accounts[0].toLowerCase()\nconst recipient =  ethOwner.address.toLowerCase()\nconst tokenInfo = { amount: 1000000000 }\n\n// Send tokens from Harmony to Ethereum\nconst { addr, receiptId } = await bridge.sendToken(\n  BridgeType.HMY_TO_ETH,\n  sender,\n  recipient,\n  token,\n  tokenInfo,\n)\n\n// Send tokens from Ethereum to Harmony\nconst { addr, receiptId } = await bridge.sendToken(\n  BridgeType.ETH_TO_HMY,\n  sender,\n  recipient,\n  token,\n  tokenInfo,\n)\n```\n\n## Development\n\nInstall all the dependencies:\n\n```sh\nnpmn ci\n```\n\nCopy the `.env.sample` file to `.env`\n\n```sh\ncp .env.sample .env\n```\n\n### Configure the environment variables\n\n```sh\n# An Etherscan API key. This is need it for use the bridge contracts.\nAPI_KEY=\n# A private key\nTEST_PK_1=\n# A private key\nTEST_PK_2=\n# A private key for the end 2 end test\nMASTER_PRIVATE_KEY=\n# A private key for the end 2 end test\nOWNER_PRIVATE_KEY=\n# A test seed for the unit test\nTEST_SEED=\"pablo diego jose francisco de paula juan nepomuceno maria ruiz y picasso\"\n```\n\nIn the project directory, you can run:\n\n### `npm run test`\n\nRunning the unit tests.\n\n### `npm run test:cov`\n\nRunning the test coverage.\n\n### `npm run test:e2e`\n\nRunning the end to end test.\n\n### `npm run test:lint`\n\nRunning the lint.\n\n## Change Log\n\nSee [Changelog](CHANGELOG.md) for more information.\n\n## Contributing\n\nContributions welcome! See [Contributing](CONTRIBUTING.md).\n\n## Collaborators\n\n- [**Jose Ramirez**](https://github.com/0xslipk)\n- [**Brian Zuker**](https://github.com/bzuker)\n- [**Ana Riera**](https://github.com/AnnRiera)\n- [**Fernando Sirni**](https://github.com/fersirni)\n\n## Acknowledgements\n\nThis project was kindly sponsored by [Harmony](https://www.harmony.one/).\n\n## License\n\nLicensed under the MIT - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockcoders%2Fharmony-marketplace-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblockcoders%2Fharmony-marketplace-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblockcoders%2Fharmony-marketplace-sdk/lists"}