Getting Started

To start developing with Typhon, install Typhon from here https://typhonwallet.ioopen in new window. Once installed, follow the in wallet steps to setup a wallet. Typhon will inject a global cardano.typhon object to allow interacting with dApps.

Reading API Object

Typhon injects a global API object into websites visited by user. This global API object can be accessed from window.cardano.typhon after window object is loaded.

If window.cardano.typhon isn't defined, User does not have Typhon Wallet extension installed or extension is disabled.

Example

var typhon;

window.onload = () => {
  typhon = window.cardano.typhon;

  if (!typhon) {
    alert("Typhon Extension is not installed !");
  }
};
1
2
3
4
5
6
7
8
9

Enable Access

Before using any methods from the API it is required to whitelist the site, This can be done by using enable method.

Example

async function enable() {
  const isEnabledResponse = await typhon.isEnabled();

  if (isEnabledResponse.data === true) {
    // site is already whitlisted, continue using APIs
  } else {
    const enableResponse = await typhon.enable();

    if (enableResponse.status === true) {
      // Site whitelisted
    } else {
      // User rejected the whitelisting permission
    }
  }
}
enable();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Visit API Reference to learn more.