Balance Query
To query balance, use the get
method from the LocalRPCSubscriber
class and pass an associated BalanceQuery
query
import { Sheet, SheetProxy } from "@okcontract/cells";
import {
MultiChainRPC,
LocalRPCSubscriber,
Address,
type EVMAddress,
nativeAddrEVM,
} from "@okcontract/multichain";
const sheet = new Sheet();
const proxy = new SheetProxy(sheet);
const multi = new MultiChainRPC(proxy);
const local = new LocalRPCSubscriber(proxy, multi);
const native = proxy.new<EVMAddress<"evm">>({
addr: nativeAddrEVM,
chain: "ethereum",
ty: "c",
});
const owner = proxy.new(
new Address("0xa889C78f474a98ce667Db5206f35A9a14e3e027a")
);
const result = rpc.get(
proxy,
proxy.map([native, owner], (_native_, _owner) => [
_native_?.chain,
BalanceQuery(_owner),
])
);