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

Language:

JavaScript SDK API Reference

On this page you will find the full JavaScript API reference for the JavaScript SDK. It covers the following topics:

For the integration guide please visit this page For the

Configuration Options | JS API Reference

For the JS SDK configuration options, please visit the configuration page

Authentication | JS API Reference

Solana | JS API Reference

All Solana service APIs on the Mirror World Smart SDK.


import { MirrorWorld, Solana } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_API_KEY",
chainConfig: Solana("mainnet-beta"),
})
// Or dynamically set the chainConfig
mirrorworld.chainConfig = Solana("mainnet-beta")
// Access the Solana service APIs
mirrorworld.Solana.Asset.buyNFT(/* ... */)

Solana.Asset | API Reference

Solana.Wallet | API Reference

Solana.Metadata | API Reference

Polygon | JS API Reference

All Polygon service APIs on the Mirror World Smart SDK.


import { MirrorWorld, Polygon } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_API_KEY",
chainConfig: Polygon("mumbai-mainnet"),
})
// Or dynamically set the chainConfig
mirrorworld.chainConfig = Polygon("mumbai-mainnet")
// Access the Polygon service APIs
mirrorworld.Polygon.Asset.buyNFT(/* ... */)

Polygon.Asset | API Reference

Polygon.Wallet | API Reference

Polygon.Metadata | API Reference

BNBChain | JS API Reference

All BNBChain service APIs on the Mirror World Smart SDK.


import { MirrorWorld, BNBChain } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_API_KEY",
chainConfig: BNBChain("bnb-mainnet"),
})
// Or dynamically set the chainConfig
mirrorworld.chainConfig = BNBChain("bnb-mainnet")
// Access the BNBChain service APIs
mirrorworld.BNBChain.Asset.buyNFT(/* ... */)

BNBChain.Asset | API Reference

BNBChain.Wallet | API Reference

BNBChain.Metadata | API Reference

Ethereum | JS API Reference

All Ethereum service APIs on the Mirror World Smart SDK.


import { MirrorWorld, Ethereum } from "@usemirrorworld/web3.js"
const mirrorworld = new MirrorWorld({
apiKey: "YOUR_API_KEY",
chainConfig: Ethereum("mainnet"),
})
// Or dynamically set the
mirrorworld.chainConfig = Ethereum("mainnet")
// Access the Ethereum service APIs
mirrorworld.Ethereum.Asset.buyNFT(/* ... */)

Ethereum.Asset | API Reference

Ethereum.Wallet | API Reference

Ethereum.Metadata | API Reference

Accessors | JS

Events | JS

The SDK also emits events when specific events happen in the SDK


export type MirrorWorldEvents = {
"login:email": UserWithWallet
login: unknown
logout: unknown
ready: undefined
"auth:refreshToken"?: string
"update:user"?: undefined
}

You can listen to these events using the on() method. For example, To listen to the login:email event, we invoke the following event:


mirrorworld.on("login:email", (user) => {
console.log("Logged in User", user)
})

Edit this page on GitHub

Copyright © Mirror World, Inc. 2023
On this page

Home

Integration

Guides

API Reference