Local Provider
LocalProvider is a quality of life implementation that creates a provider using the HEDERA_NETWORK environment variable.
The LocalProvider() requires the following variable to be defined in the .env file. The .env file is located in the root directory of the project.
HEDERA_NETWORKThe network the wallet submits transactions to
//Example .env file
HEDERA_NETWORK= previewnet/testnet/mainnet (select one network)class LocalProvider implements Wallet
Constructor
new LocalProvider()
()Instantiates the LocalProvider object. The local provider is built using HEDERA_NETWORK network specified in the .env file.
Methods
<LocalProvider>.getAccountBalance()** -> Promise <AccountBalance>**
<LocalProvider>.getAccountBalance()** -> Promise <AccountBalance>**Returns the account balance of the account in the local wallet.
<LocalProvider>.getAccountInfo()** -> Promise <AccountInfo>**
<LocalProvider>.getAccountInfo()** -> Promise <AccountInfo>**Returns the account information of the account in the local wallet.
<LocalProvider>.getAccountRecords()** -> Promise <AccountInfo>**
<LocalProvider>.getAccountRecords()** -> Promise <AccountInfo>**Returns the last transaction records for this account using TransactionRecordQuery.
<LocalProvider>.getLedgerId()->** LedgerId**
<LocalProvider>.getLedgerId()->** LedgerId**Returns the ledger ID (previewnet, testnet, or mainnet).
<LocalProvider>.getMirrorNetwork()->** string**
<LocalProvider>.getMirrorNetwork()->** string**The mirror network the wallet is connected to.
<LocalProvider>.getNetwork()->** [key: string]: string | **** AccountId**
<LocalProvider>.getNetwork()->** [key: string]: string | **** AccountId**Returns the network map information.
<LocalProvider>.getTransactionReceipt()-> Promise<TransactionReceipt>
<LocalProvider>.getTransactionReceipt()-> Promise<TransactionReceipt>Returns the transaction receipt.
<LocalProvider>.waitForReceipt()-> Promise<TransactionReceipt>
<LocalProvider>.waitForReceipt()-> Promise<TransactionReceipt>Wait for the receipt for a transaction response.
<LocalProvider>.call(<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>)->** Promise <Output>**
Sign and send a request using the wallet.
Local Wallet Example:
Sign with Local Wallet Example:
Last updated