Avalanche SDK Client
    Preparing search index...

    Type Alias XChainActions

    type XChainActions = {
        buildGenesis: (args: BuildGenesisParameters) => Promise<BuildGenesisReturnType>;
        getAllBalances: (args: GetAllBalancesParameters) => Promise<GetAllBalancesReturnType>;
        getAssetDescription: (args: GetAssetDescriptionParameters) => Promise<GetAssetDescriptionReturnType>;
        getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>;
        getBlock: (args: GetBlockParameters) => Promise<GetBlockReturnType>;
        getBlockByHeight: (args: GetBlockByHeightParameters) => Promise<GetBlockByHeightReturnType>;
        getHeight: () => Promise<GetHeightReturnType>;
        getTx: (args: GetTxParameters) => Promise<GetTxReturnType>;
        getTxFee: () => Promise<GetTxFeeReturnType>;
        getTxStatus: (args: GetTxStatusParameters) => Promise<GetTxStatusReturnType>;
        getUTXOs: (args: GetUTXOsParameters) => Promise<GetUTXOsReturnType>;
        issueTx: (args: IssueTxParameters) => Promise<IssueTxReturnType>;
    }
    Index

    Properties

    buildGenesis: (args: BuildGenesisParameters) => Promise<BuildGenesisReturnType>

    Given a JSON representation of this Virtual Machine's genesis state, create the byte representation of that state.

    Type declaration

    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"
    }
    ]
    }
    }
    }
    })
    getAllBalances: (args: GetAllBalancesParameters) => Promise<GetAllBalancesReturnType>

    Get the balances of all assets controlled by given addresses.

    Type declaration

    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"]
    })
    getAssetDescription: (args: GetAssetDescriptionParameters) => Promise<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"
    })
    getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>

    Get the balance of an asset controlled by given addresses.

    Type declaration

    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"
    })
    getBlock: (args: GetBlockParameters) => Promise<GetBlockReturnType>

    Type declaration

    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"
    })
    getBlockByHeight: (args: GetBlockByHeightParameters) => Promise<GetBlockByHeightReturnType>

    Type declaration

    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.getBlockByHeight({
    height: 1000001,
    encoding: "hex"
    })
    getHeight: () => Promise<GetHeightReturnType>

    Get the height of the last accepted block.

    Type declaration

    import { createAvalancheClient} from '@avalanche-sdk/client'
    import { avalanche } from '@avalanche-sdk/client/chains'

    const client = createAvalancheClient({
    chain: avalanche,
    transport: {
    type: "http",
    },
    })

    const height = await client.xChain.getHeight()
    getTx: (args: GetTxParameters) => Promise<GetTxReturnType>

    Type declaration

    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"
    })
    getTxFee: () => Promise<GetTxFeeReturnType>

    Get the transaction fee for this node.

    Type declaration

    import { createAvalancheClient} from '@avalanche-sdk/client'
    import { avalanche } from '@avalanche-sdk/client/chains'

    const client = createAvalancheClient({
    chain: avalanche,
    transport: {
    type: "http",
    },
    })

    const txFee = await client.xChain.getTxFee()
    getTxStatus: (args: GetTxStatusParameters) => Promise<GetTxStatusReturnType>

    Type declaration

    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"
    })
    getUTXOs: (args: GetUTXOsParameters) => Promise<GetUTXOsReturnType>

    Type declaration

    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"
    })
    issueTx: (args: IssueTxParameters) => Promise<IssueTxReturnType>

    Send a signed transaction to the network.

    Type declaration

    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"
    })