0.2.16 • Published 3 days ago

@mirage-protocol/sdk v0.2.16

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

Mirage Protocol sdk

A typescript sdk for interacting with the mirage protocol contracts.

Install

yarn add @mirage-protocol/sdk
yarn install

How to Use

You have to collect the resources for the sdk to parse yourself. You can use the exported APTOS_CLIENT to make the request. Some classes require the resources of the mirage protocol account itself. You can get these by using the exported MIRAGE_ADDRESS alongside the client.

Resources can be kept up to date through time and fed to the sdk to keep an updated protocol state, for example on a frontend.

import { Vault, Coin, MoveToken, aptosClient, MIRAGE_ADDRESS } from '@mirage-protocol/sdk'

// Get coin balance of a user account
const getUserAptosBalance = async (userAddr: string) => {
  // Get the resources for a user account
  const resources = await aptosClient().getAccountResources(userAddr)

  // Coin class contains useful functions
  const coin = new Coin(resources, 'APT')

  // Get the balance
  return coin.getUiBalance()
}

// get total collateral deposited in the APT / MUSD testnet vault
const getTotalTestnetCollateral = async () => {
  return new Vault(
    await aptosClient('testnet').getAccountResources(MIRAGE_ADDRESS),
    'APT',
    'mUSD'
  ).getUiTotalCollateral()
}
0.2.16

3 days ago

0.2.15

15 days ago

0.2.14

16 days ago

0.2.13

16 days ago

0.2.12

18 days ago

0.2.11

20 days ago

0.2.10

21 days ago

0.2.9

21 days ago

0.2.8

21 days ago

0.2.7

22 days ago

0.2.6

1 month ago

0.2.5

1 month ago

0.2.4

1 month ago

0.2.3

1 month ago

0.2.2

1 month ago

0.2.1

2 months ago

0.2.0

2 months ago

0.1.10

6 months ago

0.1.9

6 months ago

0.1.8

6 months ago

0.1.7

6 months ago

0.1.6

7 months ago

0.1.5

8 months ago

0.1.4

10 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

1.1.5

1 year ago