)
+}
+```
+
+### `useWeb3Contract()`
+
+📋 Runs on-chain functions. Requires active Web3 Provider.
+
+**Options**:
+- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value Eth.
+- `functionName` (required): The function name
+- `contractAddress` (required): A smart contract address
+- `abi` (required): contract or function ABI(should be provided as an array)
+- `params` (optional): Parameters needed for your specific function
+
+**Example**:
+```jsx
+const ShowUniswapObserveValues = () => {
+ const { runContractFunction, contractResponse, error, isLoading } = useWeb3Contract({
+ abi: usdcEthPoolAbi,
+ contractAddress: usdcEthPoolAddress,
+ functionName: "observe",
+ params: {
+ secondsAgos: [0, 10],
+ },
+ });
+
+ return (
)
+}
+```
+
### `useERC20Balance()`
### `useERC20Transfers()`
From bed9ced4b1e90d41e99f7892f01a0413fdf8ab87 Mon Sep 17 00:00:00 2001
From: Dmitry Kapeliushnyi <78314301+Y0moo@users.noreply.github.com>
Date: Sat, 30 Oct 2021 13:24:42 +0200
Subject: [PATCH 8/9] Update README.md
---
README.md | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 2387ed1d..fb1e8fca 100644
--- a/README.md
+++ b/README.md
@@ -246,7 +246,7 @@ const ShowUniswapTotalSupplyLP = () => {
**Example**:
```jsx
const ShowUniswapObserveValues = () => {
- const { runContractFunction, contractResponse, error, isLoading } = useWeb3Contract({
+ const { runContractFunction, contractResponse, error, isRunning, isLoading } = useWeb3Contract({
abi: usdcEthPoolAbi,
contractAddress: usdcEthPoolAddress,
functionName: "observe",
@@ -270,16 +270,49 @@ const ShowUniswapObserveValues = () => {
### `useERC20Balance()`
+💰 Gets all token balances of a current user or specified address.
+
+**Options**:
+- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value: current chain.
+- `address` (optional): A user address (i.e. 0x1a2b3x...). If specified, the user attached to the query is ignored and the address will be used instead.
+- `to_block` (optional): The block number on which the balances should be checked
+
+**Returns** (Object) : number of tokens and the array of token objects
+
+```jsx
+const { fetchERC20Balance, assets } = useERC20Balance({ chain : "eth" });
+```
+
### `useERC20Transfers()`
### `useNativeBalance()`
+💰 Gets native balance for a specific address. The `nativeName` from `useNativeBalance()` shows name of chain(Example: "BNB", "ETH", ...)
+
+**Options**:
+- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value: current chain.
+- `address` (optional): A user address (i.e. 0x1a2b3x...). If specified, the user attached to the query is ignored and the address will be used instead.
+- `to_block` (optional): The block number on which the balances should be checked
+
+**Returns** (Object) : { inWei: balance in Wei , formatted: balance in Eth style }
+
+**Example**:
+```jsx
+
+function NativeBalance() {
+ const { getBalance, balance, nativeName, error, isLoading } = useNativeBalance({ chain : "eth" });
+ return (
+
{`${balance.formatted} ${nativeName}`}
+ );
+}
+```
+
### `useNativeTransactions()`
Gets the transactions from the current user or address. Returns an object with the number of transactions and the array of native transactions
**Options**:
-- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value Eth.
+- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value: current chain.
- `address` (optional): A user address (i.e. 0x1a2b3x...). If specified, the user attached to the query is ignored and the address will be used instead.
- `from_date` (optional): The date from where to get the transactions (any format that is accepted by momentjs). Provide the param 'from_block' or 'from_date' If 'from_date' and 'from_block' are provided, 'from_block' will be used.
- `to_date` (optional): Get the transactions to this date (any format that is accepted by momentjs). Provide the param 'to_block' or 'to_date' If 'to_date' and 'to_block' are provided, 'to_block' will be used.
From 6af5631d1e1ba77da6b06ec9c6243b437ee3019d Mon Sep 17 00:00:00 2001
From: Dmitry Kapeliushnyi <78314301+Y0moo@users.noreply.github.com>
Date: Sat, 30 Oct 2021 13:26:25 +0200
Subject: [PATCH 9/9] Update README.md
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index fb1e8fca..9c10e29a 100644
--- a/README.md
+++ b/README.md
@@ -287,7 +287,7 @@ const { fetchERC20Balance, assets } = useERC20Balance({ chain : "eth" });
### `useNativeBalance()`
-💰 Gets native balance for a specific address. The `nativeName` from `useNativeBalance()` shows name of chain(Example: "BNB", "ETH", ...)
+💰 Gets native balance for a current user or specified address. The `nativeName` from `useNativeBalance()` shows name of chain(Example: "BNB", "ETH", ...)
**Options**:
- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value: current chain.
@@ -309,7 +309,7 @@ function NativeBalance() {
### `useNativeTransactions()`
-Gets the transactions from the current user or address. Returns an object with the number of transactions and the array of native transactions
+Gets the transactions from the current user or specified address. Returns an object with the number of transactions and the array of native transactions
**Options**:
- `chain` (optional): The blockchain to get data from. Valid values are listed on the intro page in the Transactions and Balances section. Default value: current chain.