Mynth Accounts

Introduction to Mynth AccountsCopied!

Mynth offers liquid staking of MNT, MyUSD, and Chameleons, allowing users to earn staking rewards while maintaining full custody of their assets. There are no smart contract risks or lockups involved; simply having these assets in your wallet is enough to start earning rewards. Rewards are distributed at the end of each epoch.

To facilitate these interactions, Mynth provides several API endpoints for managing user accounts:

  1. Retrieve Balances: Users can retrieve their current balances for MNT, MyUSD, and Chameleons, giving them a clear view of their holdings. This is useful for keeping track of assets and understanding your staking potential.

  2. Estimate Staking Rewards: The API allows users to estimate their staking rewards based on their current asset holdings. This helps in planning and maximizing your staking strategy by providing insights into potential earnings.

  3. Withdraw Staking Rewards: Users can easily withdraw their earned staking rewards through the API. This feature ensures that you can access and utilize your rewards without any hassle.

Getting Account BalanceCopied!

To retrieve a user's account balance, Mynth provides the get-api-accounts-balances endpoint. This endpoint allows you to obtain the current balances for MNT, MyUSD, and Chameleons associated with a specific address. By using Restish, you can easily make this API request from the terminal.

Here’s how you can get a user's account balance:

restish mynth get-api-accounts-balances --address addr1q93y2hlw6uxszt5eaxz989d9evnhyp8g5lvm06qx5qud09gjnx6fmkvkmq94ptgze7f02fw26cwjzvdxdxye5n7f2rcst0rtrn -rf body.contents
  • --address flag: This specifies the address of the user whose account balance you want to retrieve.

In this example, replace the address

addr1q93y2hlw6uxszt5eaxz989d9evnhyp8g5lvm06qx5qud09gjnx6fmkvkmq94ptgze7f02fw26cwjzvdxdxye5n7f2rcst0rtrn

with the actual address you want to query.

By executing this command, you will receive the balances of MNT, MyUSD, and Chameleons for the specified address, providing a clear view of the user's holdings.

The -rf body.contents option is used to format the output, making it easier to read the contents of the response body. For example, to get the amount of MNT available to claim, you can run:

restish mynth get-api-accounts-balances --address addr1q93y2hlw6uxszt5eaxz989d9evnhyp8g5lvm06qx5qud09gjnx6fmkvkmq94ptgze7f02fw26cwjzvdxdxye5n7f2rcst0rtrn -rf body.contents.balances.claimable.MNT

Serializing Your Wallet’s UTxOsCopied!

Many of Mynth’s API endpoints requires wallet UTxOs to be passed in a serialized format. If you have access directly to the wallet, you can serialize them yourself. For convenience, the get-api-accounts-utxos endpoint is available to retrieve a wallet’s UTxOs in correct serialized form:

restish mynth get-api-accounts-utxos \
  --address addr1q93y2hlw6uxszt5eaxz989d9evnhyp8g5lvm06qx5qud09gjnx6fmkvkmq94ptgze7f02fw26cwjzvdxdxye5n7f2rcst0rtrn \
  -rf body.contents.utxos \
  > utxos.json

By running this, you can save your wallet’s UTxOs in a file called utxos.json.

Claiming RewardsCopied!

To claim rewards, you can use the post-api-accounts-claim endpoint. You’ll need to pass in your wallet address, your wallet’s serialized UTxOs, and the amount of MNT to be charged as a fee. The fee amount is configurable for service providers to charge an additional amount for using their frontend. You can set any amount for the fee above Mynth’s defined minimum (currently 5 MNT).

restish mynth post-api-accounts-claim '
  address: addr1q93y2hlw6uxszt5eaxz989d9evnhyp8g5lvm06qx5qud09gjnx6fmkvkmq94ptgze7f02fw26cwjzvdxdxye5n7f2rcst0rtrn,
  fee.amount: 5000000,
  utxos: @utxos.json
' -rf body.contents.tx

By running this command, you’ll receive CBOR for a transaction to claim rewards for the account. This CBOR can be passed into wallet such as Eternl (Send tab, click Options, Import Transaction, then paste in the CBOR).