A promise that resolves to the account's public key. GetAccountPubKeyReturnType
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
// You can pass a local account otherwise a custom provider can be used
const account = privateKeyToAvalancheAccount("0x...")
const walletClient = createAvalancheWalletClient({
account,
chain: avalanche,
transport: { type: "http" },
})
const pubKey = await walletClient.getAccountPubKey()
// Or you can use a custom provider (e.g. window.avalanche, window.ethereum, etc.)
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "custom", provider: window.avalanche! },
})
const pubKey = await walletClient.getAccountPubKey()
Sends tokens from the source chain to the destination chain.
The parameters for the transaction. SendParameters
The hashes of the transactions. SendReturnType
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "http" },
})
const result = await walletClient.send({
amount: 1,
to: "0x0000000000000000000000000000000000000000",
Sends an XP transaction to the network.
The parameters for sending the transaction. SendXPTransactionParameters
A promise that resolves to the transaction result. SendXPTransactionReturnType
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
// You can pass a local account otherwise a custom provider can be used
const account = privateKeyToAvalancheAccount("0x...")
const walletClient = createAvalancheWalletClient({
account,
chain: avalanche,
transport: { type: "http" },
})
const result = await walletClient.sendXPTransaction({
amount: "1000000000",
to: "X-avax1...",
assetID: "AVAX"
})
// Or you can use a custom provider (e.g. window.avalanche, window.ethereum, etc.)
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "custom", provider: window.avalanche! },
})
const result = await walletClient.sendXPTransaction({
amount: "1000000000",
to: "X-avax1...",
assetID: "AVAX"
})
Signs a message using the wallet's private key.
The parameters for signing the message. SignXPMessageParameters
A promise that resolves to the signed message. SignXPMessageReturnType
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
// You can pass a local account otherwise a custom provider can be used
const account = privateKeyToAvalancheAccount("0x...")
const walletClient = createAvalancheWalletClient({
account,
chain: avalanche,
transport: { type: "http" },
})
const signedMessage = await walletClient.signXPMessage({
message: "Hello Avalanche",
address: "X-avax1..."
})
// Or you can use a custom provider (e.g. window.avalanche, window.ethereum, etc.)
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "custom", provider: window.avalanche! },
})
const signedMessage = await walletClient.signXPMessage({
message: "Hello Avalanche",
address: "X-avax1..."
})
Signs an XP transaction using the wallet's private key.
The parameters for signing the transaction. SignXPTransactionParameters
A promise that resolves to the signed transaction. SignXPTransactionReturnType
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
// You can pass a local account otherwise a custom provider can be used
const account = privateKeyToAvalancheAccount("0x...")
const walletClient = createAvalancheWalletClient({
account,
chain: avalanche,
transport: { type: "http" },
})
const signedTx = await walletClient.signXPTransaction({
tx: "0x...",
address: "X-avax1..."
})
// Or you can use a custom provider (e.g. window.avalanche, window.ethereum, etc.)
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "custom", provider: window.avalanche! },
})
const signedTx = await walletClient.signXPTransaction({
tx: "0x...",
address: "X-avax1..."
})
Waits for a transaction to be confirmed on the network.
The parameters for waiting for the transaction. WaitForTxnParameters
A promise that resolves when the transaction is confirmed.
import { createAvalancheWalletClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
const walletClient = createAvalancheWalletClient({
chain: avalanche,
transport: { type: "http" },
})
const result = await walletClient.waitForTxn({
txID: "0x...",
chainAlias: "P"
})
Gets the public key associated with the wallet account.