|
|
@ -2,7 +2,7 @@ import BN from "bn.js"; |
|
|
|
import {Cell, beginCell, Address, Slice, TonClient} from "ton"; |
|
|
|
import {Cell, beginCell, Address, Slice, TonClient} from "ton"; |
|
|
|
import {SmartContract} from "ton-contract-executor"; |
|
|
|
import {SmartContract} from "ton-contract-executor"; |
|
|
|
import { |
|
|
|
import { |
|
|
|
AdnlAddress, |
|
|
|
AdnlAddress, bytesToBase64, |
|
|
|
categoryToBN, |
|
|
|
categoryToBN, |
|
|
|
decodeOffChainContent, |
|
|
|
decodeOffChainContent, |
|
|
|
encodeOffChainContent, |
|
|
|
encodeOffChainContent, |
|
|
@ -148,6 +148,14 @@ export async function getRecords(tonclient: TonClient, address: Address) { |
|
|
|
return {wallet, site, uri}; |
|
|
|
return {wallet, site, uri}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export async function getPrice(tonclient: TonClient, address: Address, subdomain: string) { |
|
|
|
|
|
|
|
let price = (await tonclient.callGetMethod(address, 'get_price', |
|
|
|
|
|
|
|
[["tvm.Slice", bytesToBase64(beginCell().storeBuffer(Buffer.from(subdomain)).endCell().toBoc())]])); |
|
|
|
|
|
|
|
// like "0x1dcd6500". Need to convert it to number
|
|
|
|
|
|
|
|
let price_hex = price.stack[0][1]; |
|
|
|
|
|
|
|
return parseInt(price_hex.slice(2), 16); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setContractBalance(contract: SmartContract, balance: number, address?: Address) { |
|
|
|
export function setContractBalance(contract: SmartContract, balance: number, address?: Address) { |
|
|
|
if (address == undefined) { |
|
|
|
if (address == undefined) { |
|
|
|