Adding Balance to a Subnet
Required Imports
import SkyMainBrowser from "@decloudlabs/skynet/lib/services/SkyMainBrowser";
import { ethers } from "ethers";
import { SETTLER_CALLTYPE } from "path/to/utils/skynetHelper"; // Import from your project's utilsSubnet Balance Interface
export interface SubnetBalance {
subnetId: string;
subnetName: string;
balance: number; // Balance in USD
hasBalance: boolean;
}Helper Functions
Convert Ether to Wei
export const etherToWei = (ether: number, decimal: number): number => {
if (decimal === 6) {
return (Math.floor(ether * 1e6));
}
return (Math.floor(ether * 1e18));
};Convert Big Intergers to Bytes
Getting Subnet Balance
Adding Balance to a Subnet
Example Usage
Adding Balance Before Deployment
Last updated