2. About Us
Our team has been contributing with different projects in blockchain for a few years, building
APIs, SDKs and developer tools. Our goal is to continue to drive the crypto space forward by
investing intellectual capital into projects, participating actively to help shape the ecosystems
we believe in.
3. Harmony Marketplace SDK
It provides a collection of interfaces to interact with:
● HRC20
● HRC721
● HRC1155
● Any Smart Contracts that extends those standards.
This library is written in TypeScript and is based on @harmony-js.
4. Installing the library on a Node
> npm i harmony-marketplace-sdk
// JavaScript
const { HRC721 } = require('harmony-marketplace-sdk')
// TypeScript
import { HRC721 } from 'harmony-marketplace-sdk'
5. Installing the library on a Browser
Include the ESM module (harmony-marketplace-sdk.esm.js) and import using:
<script type="module">
import { HRC721 } from './harmony-marketplace-sdk.esm.js'
</script>
6. Setting up a Wallet
Harmony Marketplace SDK provides different implementations of Wallet which will help to create a
Signer from a private key or mnemonic effortless.
import { HttpProvider } from '@harmony-js/network'
import { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'
const wallet = new PrivateKey(new HttpProvider(HarmonyShards.SHARD_0),
'45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e')
7. Interacting with contracts
The BaseToken abstract class is an extension over a regular Contract which is Harmony's
recommendation to interact with smart contracts.
Classes that extend from BaseToken are:
● HRC20
● HRC721
● HRC1155
Note: The ABI of the contract is required to instantiate it.
8. Interacting with contracts
import { HttpProvider } from '@harmony-js/network'
import { PrivateKey, HarmonyShards, HRC20 } from 'harmony-marketplace-sdk'
import * as ABI from './abi.json'
const wallet = new PrivateKey(new HttpProvider(HarmonyShards.SHARD_0),
'45e497bd45a9049bcb649016594489ac67b9f052a6cdf5cb74ee2427a60bf25e')
const contract = new HRC20('0x...00', ABI, wallet)
9. Transfer
Once the contract is instantiated transfer tokens between accounts as simple as calling a
function a pass it the receiver address and the amount.
const transaction = await contract.transfer('0x...01', '1')