-
Notifications
You must be signed in to change notification settings - Fork 53
API
Debug Powinna być możliwość uruchomienia trybu developerskiego, który umożliwiałby otwarcie inspectora z consolą js a także przeładowanie całej hiveappki bo samo “reload” nie działa jak trzeba.
Security Czy appki są sandboxowane tak jak extensions w chromie? N
Specification
- Sending bitcoins
bitcoin.sendCoins(hash, amount, callback); bitcoin.sendCoinsForAddress(hash, amount, callback);
hash - string value of hash address where coins should be sent amount - float value in BTC how much should there be sent
callback - function that takes two parameters - success flag and hash id of commited transaction if successful
requestCoinsAndAddress:
callback - function that takes three parameters - success flag and hash id of commited transaction if successful and address dictionary (if successful)
Example:
bitcoin.sendCoins('mhGajXr3Yve6aRkAyL9twVWXfw8qoakyZS', 10.0, function(success, hash) { alert('Finished with success ' + success + ' and hash ' + hash); });
- Requesting an unknown amount of bitcoins (user to specify)
bitcoin.requestCoins(hash, callback) bitcoin.requestCoinsAndAddress(hash, callback);
hash - string value of hash address where coins should be sent
requestCoins:
callback - function that takes two parameters - success flag and hash id of commited transaction if successful
requestCoinsAndAddress:
callback - function that takes three parameters - success flag and hash id of commited transaction if successful and address dictionary (if successful)
Example:
bitcoin.requestCoins('mhGajXr3Yve6aRkAyL9twVWXfw8qoakyZS', function(success, hash) { alert('Finished with success ' + success + ' and hash ' + hash); });
- Requesting transaction details (all data about given transaction info)
bitcoin.getTransaction(hash, callback)
hash - txid of the transaction we want info about callback - function that takes one parameter - transaction object (dictionary)
Transaction dictionary contains following keys: amount - float value of amount of the transaction (negative value if sent by the client, positive otherwise) txid - hash id of the transaction confirmations - number of confirmations for given transaction (so far) address - hash address where money has been sent to or received from category - category of the transaction: send, receive or generate time - time of the transaction
Example:
bitcoin.requestCoins('mhGajXr3Yve6aRkAyL9twVWXfw8qoakyZS', function(success, hash) { bitcoin.getTransaction(hash, function(trans) { alert('Transaction is for amount: ' + trans['amount']); }); });
- Requesting client information
bitcoin.getClientInfo(callback)
callback - Function that takes one parameter - object of the client info dictionary
Dicitonary contains following keys: firstname - obvious lastname - obvious again email - …right address - wallet address street - street name zipcode - … city - … county - … country - …
Example:
bitcoin.getClientInfo(function(info) { alert('Finished with ' + info['firstname'] + ' ' + info['lastname']); });
- Registering BTC/mBTC curency change within the app
bitcoin.setCurrencyChangeCallback(callback);
callback - takes one parameter - boolean value. If true - currenty is BTC. false - mBTC.
callback is automatically triggered once upon registration with current status. Whenever Hive will change the currency, callback will be triggered once again.
Example:
bitcoin.setCurrencyChangeCallback(function(btc) { alert('Hive uses BTC’ + btc); });