UNPKG

@avalanche-sdk/client

Version:

A TypeScript SDK for interacting with the Avalanche network through JSON-RPC APIs. This SDK provides a comprehensive set of tools to interact with all Avalanche chains (P-Chain, X-Chain, C-Chain) and various APIs, including wallet functionality for transa

2 lines (1 loc) 3.7 kB
"use strict";exports.getBalance=async function(t,e){const a=await t.request({method:"platform.getBalance",params:e});return{...a,balance:BigInt(a.balance),unlocked:BigInt(a.unlocked),lockedNotStakeable:BigInt(a.lockedNotStakeable),lockedStakeable:BigInt(a.lockedStakeable)}},exports.getBlock=async function(t,e){return t.request({method:"platform.getBlock",params:e})},exports.getBlockByHeight=async function(t,e){return t.request({method:"platform.getBlockByHeight",params:e})},exports.getBlockchainStatus=async function(t,e){return t.request({method:"platform.getBlockchainStatus",params:e})},exports.getBlockchains=async function(t){return t.request({method:"platform.getBlockchains",params:{}})},exports.getCurrentSupply=async function(t,e){const a=await t.request({method:"platform.getCurrentSupply",params:e});return{supply:BigInt(a.supply)}},exports.getCurrentValidators=async function(t,e){return t.request({method:"platform.getCurrentValidators",params:e})},exports.getFeeConfig=async function(t){const e=await t.request({method:"platform.getFeeConfig",params:{}});return{...e,maxCapacity:BigInt(e.maxCapacity),maxPerSecond:BigInt(e.maxPerSecond),minPrice:BigInt(e.minPrice),targetPerSecond:BigInt(e.targetPerSecond),excessConversionConstant:BigInt(e.excessConversionConstant)}},exports.getFeeState=async function(t){const e=await t.request({method:"platform.getFeeState",params:{}});return{...e,capacity:BigInt(e.capacity),excess:BigInt(e.excess),price:BigInt(e.price)}},exports.getHeight=async function(t){return t.request({method:"platform.getHeight",params:{}})},exports.getL1Validator=async function(t,e){const a=await t.request({method:"platform.getL1Validator",params:e});return{...a,startTime:BigInt(a.startTime),weight:BigInt(a.weight),...a.minNonce&&{minNonce:BigInt(a.minNonce)},...a.balance&&{balance:BigInt(a.balance)},...a.height&&{height:BigInt(a.height)}}},exports.getMinStake=async function(t,e){const a=await t.request({method:"platform.getMinStake",params:e});return{minDelegatorStake:BigInt(a.minDelegatorStake),minValidatorStake:BigInt(a.minValidatorStake)}},exports.getProposedHeight=async function(t){return t.request({method:"platform.getProposedHeight",params:{}})},exports.getRewardUTXOs=async function(t,e){return t.request({method:"platform.getRewardUTXOs",params:e})},exports.getStake=async function(t,e){return t.request({method:"platform.getStake",params:e})},exports.getStakingAssetID=async function(t,e){return t.request({method:"platform.getStakingAssetID",params:e})},exports.getSubnet=async function(t,e){return t.request({method:"platform.getSubnet",params:e})},exports.getSubnets=async function(t,e){return t.request({method:"platform.getSubnets",params:e})},exports.getTimestamp=async function(t){return t.request({method:"platform.getTimestamp",params:{}})},exports.getTotalStake=async function(t,e){return t.request({method:"platform.getTotalStake",params:e})},exports.getTx=async function(t,e){return t.request({method:"platform.getTx",params:e})},exports.getTxStatus=async function(t,e){return t.request({method:"platform.getTxStatus",params:e})},exports.getUTXOs=async function(t,e){return t.request({method:"platform.getUTXOs",params:e})},exports.getValidatorsAt=async function(t,e){return t.request({method:"platform.getValidatorsAt",params:e})},exports.issueTx=async function(t,e){return t.request({method:"platform.issueTx",params:e})},exports.sampleValidators=async function(t,e){return t.request({method:"platform.sampleValidators",params:e})},exports.validatedBy=async function(t,e){return t.request({method:"platform.validatedBy",params:e})},exports.validates=async function(t,e){return t.request({method:"platform.validates",params:e})};