💳Account Handling
A brief explanation of how Amity handles wallets
Last updated
A brief explanation of how Amity handles wallets
Last updated
To access the bot, a user must first execute the command, "/register", when this is done, a database is filled in with the users discord ID along with a corresponding encrypted private key and address generated by eth_accounts.
As an alternative to "/register," you can do "/import" to import an external private key into the wallet; this will go through essentially the same process as register but with a chosen private key. After a user executes the import command, they will be prompted in a DM to provide a private key~ this should not be the key of a primary wallet, but instead a secondary wallet used purely for side-usage such as Amity. Keys of primary wallets should never leave your possession. Import is helpful for potentially bridging wallets over from another bot, or using a secondary MetaMask wallet. Import will overwrite any previous account.
Once the user is registered, each command found under the "General Usage" category of commands loads the database entries relevant to the user and fetches the required information attached to the sender's discord ID.
Through this, web3 commands can be done on behalf of the user's account. Allowing personal balances, transactions, etc. all attached to the wallet binded to the discord account though still allowing for the wallet to have complete autonomy outside of Amity.
After accounts are created and loaded using the above methodology, user's can execute /balance
and by default, view their current amount of the default coin for whatever network they may be connected to. For example, if I register and am connected to Harmony, it will fetch my ONE balance with the balanceOf
function. Additionally, tokens can be included in this balance display with corresponding commands /addtoken
and /deltoken
. Similar to metamask, Amity has no way to fetch the tokens present on a specific wallet, so instead it relies on the user to essentially tell Amity what tokens to look for via. either contract address or token shortcut.