@hashgraph/sdk
Version:
3 lines (2 loc) • 1.27 kB
JavaScript
import e from"./client/NodeClient.js";import t from"./account/AccountBalanceQuery.js";import n from"./account/AccountInfoQuery.js";import r from"./account/AccountRecordsQuery.js";import c from"./transaction/TransactionReceiptQuery.js";class o{constructor(t={}){if(null==t||null==t.client){if(null==process.env.HEDERA_NETWORK)throw new Error("LocalProvider requires the `HEDERA_NETWORK` environment variable to be set");this._client=e.forName(process.env.HEDERA_NETWORK)}else this._client=t.client}static fromClient(e){return new o({client:e})}getLedgerId(){return this._client.ledgerId}getNetwork(){return this._client.network}getMirrorNetwork(){return this._client.mirrorNetwork}getAccountBalance(e){return(new t).setAccountId(e).execute(this._client)}getAccountInfo(e){return(new n).setAccountId(e).execute(this._client)}getAccountRecords(e){return(new r).setAccountId(e).execute(this._client)}getTransactionReceipt(e){return(new c).setTransactionId(e).execute(this._client)}waitForReceipt(e){return(new c).setNodeAccountIds([e.nodeId]).setTransactionId(e.transactionId).execute(this._client)}call(e){return e.execute(this._client)}close(){this._client.close()}setLogger(e){this._client.setLogger(e)}}export{o as default};
//# sourceMappingURL=LocalProvider.js.map