BuildGenesisParameters The network ID and genesis data
The genesis bytes. BuildGenesisReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const genesis = await client.xChain.buildGenesis({
networkID: 16,
genesisData: {
asset1: {
name: "myFixedCapAsset",
symbol: "MFCA",
initialState: {
fixedCap: [
{
amount: 100000,
address: "avax13ery2kvdrkd2nkquvs892gl8hg7mq4a6ufnrn6"
}
]
}
}
}
})
Get the balances of all assets controlled by given addresses.
GetAllBalancesParameters The addresses to get balances for
The balances of all assets. GetAllBalancesReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const balances = await client.xChain.getAllBalances({
addresses: ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]
})
Get information about an asset.
GetAssetDescriptionParameters The asset ID
The asset description. GetAssetDescriptionReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const asset = await client.xChain.getAssetDescription({
assetID: "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
})
Get the balance of an asset controlled by given addresses.
GetBalanceParameters The addresses and asset ID
The balance of the asset. GetBalanceReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const balance = await client.xChain.getBalance({
addresses: ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
assetID: "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
})
Get a block by its ID.
GetBlockParameters The block ID and encoding format
The block data. GetBlockReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const block = await client.xChain.getBlock({
blockID: "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
encoding: "hex"
})
Get a block by its height.
GetBlockByHeightParameters The block height and encoding format
The block data. GetBlockByHeightReturnType
Get the height of the last accepted block.
The current height. GetHeightReturnType
Get a transaction by its ID.
GetTxParameters The transaction ID and encoding
The transaction data. GetTxReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const tx = await client.xChain.getTx({
txID: "11111111111111111111111111111111LpoYY",
encoding: "hex"
})
Get the transaction fee for this node.
The transaction fee. GetTxFeeReturnType
Get the status of a transaction.
GetTxStatusParameters The transaction ID
The transaction status. GetTxStatusReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const status = await client.xChain.getTxStatus({
txID: "11111111111111111111111111111111LpoYY"
})
Get the UTXOs for a set of addresses.
GetUTXOsParameters The addresses and source chain
The UTXOs. GetUTXOsReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const utxos = await client.xChain.getUTXOs({
addresses: ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
sourceChain: "P"
})
Send a signed transaction to the network.
IssueTxParameters The transaction bytes and encoding
The transaction ID. IssueTxReturnType
import { createAvalancheClient} from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const client = createAvalancheClient({
chain: avalanche,
transport: {
type: "http",
},
})
const txID = await client.xChain.issueTx({
tx: "0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",
encoding: "hex"
})
Given a JSON representation of this Virtual Machine's genesis state, create the byte representation of that state.