@jeansoon/mxw-api v0.0.4-20190214-1
mxw : object
MXW SDK module
Kind: global namespace
Version: 0.1
- mxw : object
- .events : object
- .main : object
- ~balance(address) ⇒ Promise
- ~transfer(privateKey, address) ⇒ Promise
- ~signTransfer(privateKey, address) ⇒ Promise
- .util : object
- ~getAddressByPrivateKey(privateKey) ⇒ string
- ~getAddressByPublicKey(publicKey) ⇒ string
- ~generateKeyPair() ⇒ object
- ~getAddressFromPublicKeyByteArray(byteArray) ⇒ string
- ~decodeTx(encoded) ⇒ object
- ~getSha256(str) ⇒ string
- ~getBlock(height) ⇒ Promise
- ~getTx(hash) ⇒ Promise
- ~getTxs(address) ⇒ Promise
- .alias : object
- ~setAlias(privateKey, alias) ⇒ Promise
- ~removeAlias(privateKey, alias) ⇒ Promise
- ~getAliasByAddress(address) ⇒ Promise
- ~getAddressByAlias(alias) ⇒ Promise
- .kyc : object
- ~requestWhitelist(privateKey, whitelistAddress) ⇒ Promise
- ~isWhitelisted(address) ⇒ Promise
- .faucet : object
- ~requestCoins(privateKey, address) ⇒ Promise
- .this.setBackend(be)
mxw.events : object
Events
Kind: static namespace of mxw
events~onTx(fnc)
Set the new transaction handler.
Kind: inner method of events
Param | Type | Description |
---|---|---|
fnc | function | Function that will be called on every new transaction (format: (data) => {}) |
events~onBlock(fnc)
Set the new block handler.
Kind: inner method of events
Param | Type | Description |
---|---|---|
fnc | function | Function that will be called on every new block (format: (data) => {}) |
events~removeHandler(type)
Removes a certain handler
Kind: inner method of events
Param | Type | Description | |
---|---|---|---|
type | string | Handler type ('tx' | 'block') |
mxw.main : object
Main
Kind: static namespace of mxw
- .main : object
- ~balance(address) ⇒ Promise
- ~transfer(privateKey, address) ⇒ Promise
- ~signTransfer(privateKey, address) ⇒ Promise
main~balance(address) ⇒ Promise
Returns the balance of the given address.
Kind: inner method of main
Returns: Promise - balance - Wallet balance
Param | Type | Description |
---|---|---|
address | string | Address of the wallet |
main~transfer(privateKey, address) ⇒ Promise
Transfer tokens from one address to another.
Kind: inner method of main
Returns: Promise - tx - Transaction result
Params: number amount - Amount of tokens
Param | Type | Description |
---|---|---|
privateKey | string | Private key of the wallet from which we're transfering tokens |
address | string | Address of the wallet to which we're transfering tokens |
main~signTransfer(privateKey, address) ⇒ Promise
Signs a transfer transaction without relaying it.
Kind: inner method of main
Returns: Promise - tx - Transaction signature
Params: number amount - Amount of tokens
Param | Type | Description |
---|---|---|
privateKey | string | Private key of the wallet from which we're transfering tokens |
address | string | Address of the wallet to which we're transfering tokens |
mxw.util : object
Utilities
Kind: static namespace of mxw
- .util : object
- ~getAddressByPrivateKey(privateKey) ⇒ string
- ~getAddressByPublicKey(publicKey) ⇒ string
- ~generateKeyPair() ⇒ object
- ~getAddressFromPublicKeyByteArray(byteArray) ⇒ string
- ~decodeTx(encoded) ⇒ object
- ~getSha256(str) ⇒ string
- ~getBlock(height) ⇒ Promise
- ~getTx(hash) ⇒ Promise
- ~getTxs(address) ⇒ Promise
util~getAddressByPrivateKey(privateKey) ⇒ string
Returns wallet address.
Kind: inner method of util
Returns: string - address - Wallet address
Param | Type | Description |
---|---|---|
privateKey | string | Wallet's private key |
util~getAddressByPublicKey(publicKey) ⇒ string
Returns wallet address.
Kind: inner method of util
Returns: string - address - Wallet address
Param | Type | Description |
---|---|---|
publicKey | string | Wallet's public key |
util~generateKeyPair() ⇒ object
Generates a new private/public key pair and a wallet address.
Kind: inner method of util
Returns: object - keyPair - Generated keypair
util~getAddressFromPublicKeyByteArray(byteArray) ⇒ string
Returns wallet address.
Kind: inner method of util
Returns: string - address - Wallet address
Param | Type | Description |
---|---|---|
byteArray | Buffer | Wallet's public key as a byte array |
util~decodeTx(encoded) ⇒ object
Decodes a tendermint transaction.
Kind: inner method of util
Returns: object - tx - Decoded transaction
Param | Type | Description |
---|---|---|
encoded | string | Base64 encoded transaction |
util~getSha256(str) ⇒ string
Get SHA256 hash of a given string.
Kind: inner method of util
Returns: string - hash - Hashed string
Param | Type | Description |
---|---|---|
str | string | Arbitrary string |
util~getBlock(height) ⇒ Promise
Get a block at given height.
Kind: inner method of util
Returns: Promise - block - Block data
Param | Type | Description |
---|---|---|
height | number | Block height |
util~getTx(hash) ⇒ Promise
Get a single transaction by hash.
Kind: inner method of util
Returns: Promise - tx - Transaction data
Param | Type | Description |
---|---|---|
hash | string | Transaction hash |
util~getTxs(address) ⇒ Promise
Get transactions by wallet address.
Kind: inner method of util
Returns: Promise - txs - Transactions
Param | Type | Description |
---|---|---|
address | string | Wallet address |
mxw.alias : object
Aliasing module
Kind: static namespace of mxw
- .alias : object
- ~setAlias(privateKey, alias) ⇒ Promise
- ~removeAlias(privateKey, alias) ⇒ Promise
- ~getAliasByAddress(address) ⇒ Promise
- ~getAddressByAlias(alias) ⇒ Promise
alias~setAlias(privateKey, alias) ⇒ Promise
Set an alias.
Kind: inner method of alias
Returns: Promise - tx - Transaction result
Param | Type | Description |
---|---|---|
privateKey | string | Wallet's private key |
alias | string | An alias |
alias~removeAlias(privateKey, alias) ⇒ Promise
Remove an alias.
Kind: inner method of alias
Returns: Promise - tx - Transaction result
Param | Type | Description |
---|---|---|
privateKey | string | Wallet's private key |
alias | string | An alias |
alias~getAliasByAddress(address) ⇒ Promise
Gets alias for a given address
Kind: inner method of alias
Returns: Promise - alias - Alias
Param | Type | Description |
---|---|---|
address | string | Address of a wallet |
alias~getAddressByAlias(alias) ⇒ Promise
Gets the address of an alias
Kind: inner method of alias
Returns: Promise - address - Wallet address
Param | Type | Description |
---|---|---|
alias | string | An alias |
mxw.kyc : object
KYC module
Kind: static namespace of mxw
- .kyc : object
- ~requestWhitelist(privateKey, whitelistAddress) ⇒ Promise
- ~isWhitelisted(address) ⇒ Promise
kyc~requestWhitelist(privateKey, whitelistAddress) ⇒ Promise
Allows users to request whitelisting from the mock KYC service.
Kind: inner method of kyc
Returns: Promise - tx - Transaction result
Param | Type | Description |
---|---|---|
privateKey | string | Private key of the KYC provider |
whitelistAddress | string | Address that we're whitelisting |
kyc~isWhitelisted(address) ⇒ Promise
Checks if the wallet address is whitelisted.
Kind: inner method of kyc
Returns: Promise - whitelist - Boolean
Param | Type | Description |
---|---|---|
address | string | Address of a wallet |
mxw.faucet : object
Faucet module
Kind: static namespace of mxw
faucet~requestCoins(privateKey, address) ⇒ Promise
Allows users to request coins from the faucet if they have less than 100 MXW.
Kind: inner method of faucet
Returns: Promise - tx - Transaction result
Param | Type | Description |
---|---|---|
privateKey | string | Private key of the wallet that's requesting tokens |
address | string | Address of the wallet that's receiving tokens (optional) |
mxw.this.setBackend(be)
Set the backend.
Kind: static method of mxw
Param | Type | Description | |
---|---|---|---|
be | string | Name of the backend ('lotion' | 'cosmos') |
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago