Account
Overview
@orderly.network/hooks
provides the following hooks for handling account-related logic:
- useAccount: Retrieves the current account info and status. With this hook you can also create an account and create an
orderlyKey
- useAccountInfo - Fetches account information
- useAccountInstance - Returns
Account
singleton - useWalletConnector - Handles wallet connection
- useWalletSubscription - Subscribe to wallet transactionsvia WebSocket
- useLeverage - Retrieves the current account leverage
- useMarginRatio - Margin information
- useSettleSubscription - Subscribe to PnL settlement via WebSocket
- useDaily - Retrieving daily user volume
How to integrate wallet?
Since @orderly.network/hooks
only focus on processing the Orderly business logic, the hooks don’t include the function of connecting to the wallet, but they can be easily integrated with third-party wallet connection libraries.
Here are two examples:
web3-onboard
Web3-Onboard is the quickest and easiest way to add multi-wallet and multi-chain support to your project. more
TODO
WalletConnect
WalletConnect provides developer toolkits empowering you to build engaging web3 experiences. more
TODO
Get and edit account leverage
Here is a small example of how to get current account leverage and how to edit max allowed leverage.