Constructor
new SubstrateBasedCrypto(app, ticker, endpoint, info)
Construct SubstrateBasedCrypto
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | Saito Application Context |
ticker |
String | Ticker symbol of underlying Cryptocurrency |
endpoint |
String | URI of Substrate Endpoint location |
info |
String | Option info about this module |
- Source:
Example
class Polkadot extends SubstrateBasedCrypto {
constructor(app) {
super(app, 'DOT', saitoEndpoint, "Polkadot's Existential Deposit is 1 DOT, be sure not to send less than 1 DOT or leave less than 1 DOT in your wallet.");
this.name = 'Polkadot';
this.description = 'Polkadot application layer for in-browser Polkadot applications. Install this module to make Polkadot your default in-browser cryptocurrency';
this.categories = "Cryptocurrency";
}
...
Extends
Methods
activate()
isActivated is an optional flag that allows users to enable a crypto module.
This is needed to accomodate UX in the case that a particular module might
require significant resources.
- Overrides:
- Source:
(async) formatBalance()
Returns balance as a formatted string
- Overrides:
- Source:
(async) getApi(app)
async getter for Endpoint API
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | Saito Application Context |
- Source:
getFormattedAddress(address, format)
Forces input address into the desired format.
Input address can be any format, DOT, KSM, or Substrate.
https://polkadot.js.org/docs/api/start/create
Parameters:
Name | Type | Default | Description |
---|---|---|---|
address |
String | An address in any subtrate format. See: https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) | |
format |
String | polkadot | The desired output format. format ∈ {"polkadot","kusama","substrateRaw"} |
hasPayment()
overrides AbstractCryptoModule hasPayment
Only looks in the last 100 payments due to a restriction on subscan's API. This could be extended by repeating the request for past pages.
- Overrides:
- Source:
initialize(app)
Initialize Endpoint API connection and keyring
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | Saito Application Context |
- Overrides:
- Source:
installModule(app)
installModule runs when a node initialized a module for the first time
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | Saito Application Context |
- Source:
load()
load state of this module from local storage
- Overrides:
- Source:
(abstract) renderModalSelectCrypto() → {Number}
Abstract method which should get balance from underlying crypto endpoint
- Overrides:
- Source:
Returns:
- Type
- Number
returnAddress()
overrides AbstractCryptoModule returnAddress
- Overrides:
- Source:
(async) returnBalance()
overrides AbstractCryptoModule returnBalance
- Overrides:
- Source:
returnIsActivated()
Returns a crypto modules activated status.
isActivated is an optional flag that allows users to enable a crypto module.
- Overrides:
- Source:
returnPrivateKey()
overrides AbstractCryptoModule returnPrivateKey
- Overrides:
- Source:
save()
save state of this module to local storage
- Overrides:
- Source:
(async) transfer()
overrides AbstractCryptoModule transfer.
Substrate-based coins have existential deposit (ED) to prevent dust accounts from bloating state. If an account drops below the ED, it will be reaped,
Polkadot's ED is 1 DOT, while Kusama's is 0.0016666 KSM.
- Overrides:
- Source: