The API MiniMask uses is similar to the MDS system Minima dapps use.
Once the MiniMask extension is loaded.. you will have a MINIMASK object to call.
The function are split intoi 2 categories..
There is an Account section that allows you to send and sign from the Users MiniMask account
These calls all start with MINIMASK.account..
Here is a balance check call :
MINIMASK.account.balance(function(balanceresp){
console.log(JSON.stringify(balanceresp));
});
And a SEND from the User account would be :
//Set up some state vars
var state = {};
state[0] = "123.98"
state[1] = "0xFFEEDD"
MINIMASK.account.send("0.0001",
"MxG085BNJVTBB60KPG6FMVEV2D1EAY78JR11YGBQCE5UH213H6CBQYN48VNQQB5",
"0x00", state, function(resp){
console.log("SEND : "+JSON.stringify(resp,null,2));
});
There is a MEG ( Minima Enterprise Gateway ) section which is lower level functions that give the same calls as the Minima MEG server.
MEG calls do not cause Pending actions as private keys must be specified by you.
The current API calls are
var MINIMASK = {
/**
* MINIMASK Startup call.. Use to initialise MiniMask.
*
* The callback is for when Pending Transaction are accepted.
*/
init : function(callback)
/**
* Access the Users MiniMask Account
*/
account : {
/**
* Get the balance of all tokens for this address
*/
balance : function(callback)
/**
* Get all coins for this address
*/
coins : function(callback)
/**
* Get the address for the logged in account
*/
getAddress : function(callback)
/**
* Get the public key for the logged in account
*/
getPublicKey : function(callback)
/**
* Send funds from this account (Causes a Pending)
*/
send : function(amount, address, tokenid, state, callback)
/**
* Sign a transaction created with MINIMASK.meg.rawtxn (Causes a Pending)
*
* Do you post as well as Sign ?
*/
sign : function(txndata, post, callback)
},
/**
* Call MEG functions
*/
meg : {
/**
* Create a new Minima account, address, public key, private key etc.
*/
create : function(callback)
/*
* Get the Balance of an address
*/
balance : function(address, callback)
/*
* Send funds from a created Minima account.
*
* Note that you must use a different keysuses every time.
* Start with 0 and increment.
*/
send : function(amount, toaddress, tokenid,
fromaddress, privatekey, script, keyuses, callback)
/*
* Create a Raw unsigned transaction with
* any inputs, outpus and state variables.
*
* For example :
*
* // A JSON array of CoinIDs
* var inputs = ["0xF7FB71DDECEE8A39821D8700BCDDCF9D80C842F5F836651CB3F6E41D80527918",
* "0x6148D011DBB8BCC4DF9449565BF8CB527FBA8EBB72243343FFBEB6CDD9388F77"]
*
* //A JSON array of JSON coins
* var outputs = [{"address":"0x6A3A060CE9D8E876E9B12DBE5D8F6A6864183BA1A63EA8CBCC14D668B5BECACF",
* "amount":"40","storestate":true,"tokenid":"0x00"}]
*
* //A JSON array of all the scripts used
* var scripts = ["RETURN SIGNEDBY(0x3C986F919AD66B2F1724675449FFD6A2D1FA6C8A8DAD9723991EA68E35C2D950)"]
*
* //A JSON state
* state = {"0":"98","1":"[MESSAGE]"}
*
*/
rawtxn : function(inputs, outputs, scripts, state, callback)
/*
* Sign a transaction created with rawtxn
*
* Do you post as well as Sign ?
*/
signtxn : function(txndata, privatekey, keyuses, post, callback)
/*
* Post a transaction created with rawtxn and signed with signtxn
*/
posttxn : function(txndata, callback)
/*
* Convert a data transaction into a human readable JSON
*/
viewtxn : function(txndata, callback)
/*
* Get the current block
*/
block : function(callback)
/*
* Return all blocks and transactions offset from the chain tip.
* Max depth 32.
*/
scanchain : function(offset, depth, callback)
/*
* Get a TxPoW
*/
gettxpow : function(txpowid, callback)
/*
* Check if a TxPoW is on chain
*/
checktxpow : function(txpowid, callback)
/*
* List coins for a certain address.
* Use blank tokenid and state for all coins and states.
*/
listcoins : function(address, tokenid, state, callback)
/*
* Get a secure random number
*/
random : function(callback)
}