The client to use. AvalancheCoreClient
The addresses and subnet ID GetStakeParameters
The stake amount. GetStakeReturnType
platform.getStake is deprecated in AvalancheGo, and AvalancheGo plans to remove it in an upcoming release. Calculate the stake with getCurrentValidators and getTx instead: add the stake outputs that the addresses own in each staker transaction. To get the delegator transaction IDs, call getCurrentValidators with one node ID in nodeIDs.
import { createAvalancheCoreClient } from '@avalanche-sdk/client'
import { avalanche } from '@avalanche-sdk/client/chains'
import { getStake } from '@avalanche-sdk/client/methods/pChain'
const client = createAvalancheCoreClient({
chain: avalanche,
transport: {
type: "http",
url: "<url>",
},
})
const stake = await getStake(client, {
addresses: ["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"],
subnetID: "11111111111111111111111111111111LpoYY"
})
Get the stake amount for a set of addresses.