Build on Magi
This page contains the resources you need to build your application on Magi.
GraphQL API
Section titled “GraphQL API”The Magi GraphQL API can be used to retrieve various kinds of information about the Magi network. It is the core building block when it comes to creating applications on top of Magi.
The documentation may be found in the GraphQL sandbox accessible through Magi nodes.
Public mainnet nodes
Section titled “Public mainnet nodes”| API endpoint | Operator | Sandbox |
|---|---|---|
| https://api.vsc.eco/api/v1/graphql | Magi Team | Sandbox |
| https://vsc.techcoderx.com/api/v1/graphql | @techcoderx | Sandbox |
| https://vsc.atexoras.com:2087/api/v1/graphql | @forkyishere | Sandbox |
Magi JS
Section titled “Magi JS”Magi JS is JavaScript/TypeScript library for interacting with Magi with wallet interoperability features.
It may be installed through NPM:
pnpm i @aioha/magi @aioha/aioha viemUsage example
Section titled “Usage example”import { Magi, Wallet, Asset } from '@aioha/magi'import { createWalletClient, http } from 'viem'import { initAioha } from '@aioha/aioha'
const magi = new Magi()
// Set optionsmagi.setApi('https://magi-test.techcoderx.com/api/v1/graphql', [])magi.setNetId('vsc-testnet')
// Ethereum walletconst viemClient = createWalletClient({ account: '0x2540009A1027e5c6aa0274db4fEF2622aC2B200C', transport: http('http://127.0.0.1:1248')})magi.setViem(viemClient)
// Hive walletconst aioha = initAioha()magi.setAioha(aioha)
// Set wallet type to usemagi.setWallet(Wallet.Ethereum)
// Transfer 1 HBDconst xfer = await magi.transfer('did:pkh:eip155:1:0xrecipient', 1, Asset.hbd, '')
// Call contractconst dumpEnv = await magi.call('vsc1contractid', 'method', 'payload', 200, [])
// Sign and broadcast multi-op transactionconst call = await magi.signAndBroadcastTx([ { type: 'call', payload: { contract_id: 'vsc1BX9RbKJYAqSSZZzrGeBWyBZkG3ojTVPRoo', action: 'dumpEnv', payload: '', rc_limit: 300, intents: [] } }])This library is part of Aioha. Refer to the docs here for more usage details.