Skip to main content
BETA
HomeIntegration BuilderAPI ReferenceGuides
View Mirror World on Github
Join the Discord server

Language:

JavaScript/TypeScript Integration Guide

This guide will walk you through the setup process for the Mirror World Smart SDK on JavaScript/TypeScript.

1. Create a Developer Account

Create a developer account on the Developer dashboard. Create project and create an API Key. If you already have an API Key, you may skip this step and proceed to the next one.

2. Install the JS Mirror World SDK

The Mirror World SDK for JavaScript implements a TypeScript-compatible client that can be used for both in the browser and Node.js. Install it with the package manager of your choice:

install.sh
Copy

# With Yarn
yarn add @usemirrorworld/web3.js
# With npm
npm install @usemirrorworld/web3.js
# With pnpm
pnpm install @usemirrorworld/web3.js

3. Import the SDK

You can now import the Mirror World SDK into your project. Also import the Chain Configuration you will be using. For this example, we shall use Solana.

To see other chain configurations, please see the API reference

install.sh
main.ts
Copy

import { MirrorWorld, Solana } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_SECRET_API_KEY",
chainConfig: Solana("mainnet-beta"),
})
async function main() {
const { user } = await mirrorworld.login()
const tokens = await mirrorworld.Solana.Wallet.fetchTokens()
const nfts = await mirrorworld.Solana.Asset.fetchNFTsByOwnerAddresses({ owners: [user.wallet.sol_address ]})
}
main()

4. Initialize SDK with API Key

With your API Key, you can now initialize the SDK in your project.

install.sh
main.ts
Copy

import { MirrorWorld, Solana } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_SECRET_API_KEY",
chainConfig: Solana("mainnet-beta"),
})
async function main() {
const { user } = await mirrorworld.login()
const tokens = await mirrorworld.Solana.Wallet.fetchTokens()
const nfts = await mirrorworld.Solana.Asset.fetchNFTsByOwnerAddresses({ owners: [user.wallet.sol_address ]})
}
main()

5. Start building!

You can start invoking the various methods on the MirrorWorld instance. Enjoy!

install.sh
main.ts
Copy

import { MirrorWorld, Solana } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_SECRET_API_KEY",
chainConfig: Solana("mainnet-beta"),
})
async function main() {
const { user } = await mirrorworld.login()
const tokens = await mirrorworld.Solana.Wallet.fetchTokens()
const nfts = await mirrorworld.Solana.Asset.fetchNFTsByOwnerAddresses({ owners: [user.wallet.sol_address ]})
}
main()

Going Further

Great! At this point you're pretty much ready to start doing building with the JavaScript SDK for Mirror World. There are a few things you can do to proceed from here:

Getting Support

If you're stuck or just looking for support, you may also schedule a support call with our team.

JavaScript/TypeScript Integration Guide

This guide will walk you through the setup process for the Mirror World Smart SDK on JavaScript/TypeScript.

1. Create a Developer Account

Create a developer account on the Developer dashboard. Create project and create an API Key. If you already have an API Key, you may skip this step and proceed to the next one.

2. Install the JS Mirror World SDK

The Mirror World SDK for JavaScript implements a TypeScript-compatible client that can be used for both in the browser and Node.js. Install it with the package manager of your choice:

3. Import the SDK

You can now import the Mirror World SDK into your project. Also import the Chain Configuration you will be using. For this example, we shall use Solana.

To see other chain configurations, please see the API reference

4. Initialize SDK with API Key

With your API Key, you can now initialize the SDK in your project.

5. Start building!

You can start invoking the various methods on the MirrorWorld instance. Enjoy!

Going Further

Great! At this point you're pretty much ready to start doing building with the JavaScript SDK for Mirror World. There are a few things you can do to proceed from here:

Getting Support

If you're stuck or just looking for support, you may also schedule a support call with our team.

install.sh
CopyExpandClose

# With Yarn
yarn add @usemirrorworld/web3.js
# With npm
npm install @usemirrorworld/web3.js
# With pnpm
pnpm install @usemirrorworld/web3.js

Edit this page on GitHub

Copyright © Mirror World, Inc. 2023

Home

Integration

Guides

API Reference