rps-project/scripts/utils.ts

15 lines
601 B
TypeScript
Raw Normal View History

2024-09-10 11:46:05 +03:00
import { Address, Cell, toNano } from "@ton/core";
import { MainBalance } from "../wrappers/MainBalance";
import { hex } from "../build/MainBalance.compiled.json";
import { NetworkProvider } from "@ton/blueprint";
import contractConfig from "../config/contract.config";
export async function getMainBalanceContract(provider:NetworkProvider) {
const codeCell = Cell.fromBoc(Buffer.from(hex, "hex"))[0];
return provider.open(MainBalance.createFromConfig(contractConfig.init, codeCell));
}
export function calcPercent(amount:number, percent:number = 1) {
return (amount / 100) * percent;
}