This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
// Define units of measurement | |
[<Measure>] type USD | |
[<Measure>] type BTC | |
[<Measure>] type percent | |
let btcUsdRate = 62500m<USD/BTC> | |
// Money type alias |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define types | |
type Result<'T> = | |
| Success of 'T | |
| Error of string | |
type LogState = { Logs: string list } | |
type ResultLog<'T> = Result<'T> * LogState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MEMORY_MANAGER_H | |
#define MEMORY_MANAGER_H | |
#define HEAP_SIZE (10 * 1024 * 1024) | |
#include <stdlib.h> | |
typedef struct memory_manager_malloc_t { | |
void *ptr; | |
} memory_manager_malloc_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"/earth/me/me/kittery-point/03905", | |
"/earth/me/me", | |
"/earth/us/me", | |
"/earth/me/me/kittery", | |
"/earth/us/me/south-eliot", | |
"/earth/us/co", | |
"/earth/us/ca/huntington-beach/92647", | |
"/earth/us/ca/huntington-beach/92648", | |
"/earth/us/ca/huntington-beach/92646", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var blockcast = require("blockcast"); | |
document.getElementById("scan-address").addEventListener("click", function(event) { | |
getTransaction = function(txHash, callback) { | |
xhr("https://www.blockai.com/chain/testnet/tx/" + txHash, function(err, res, body) { | |
var rawTx = JSON.parse(body); | |
var rawOutputs = rawTx.outputs; | |
var rawInputs = rawTx.inputs; | |
var outputs = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var openpublish = require("openpublish"); | |
document.getElementById("open-publish-file").addEventListener("click", function(event) { | |
getUnspentOutputs(function(err, unspentOutputs) { | |
openpublish.register({ | |
file: file, | |
uri: uri, | |
address: address, | |
unspentOutputs: unspentOutputs, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById("sign-and-post-transaction").addEventListener("click", function(event) { | |
signedTx = wallet.signWith(newTx, [address]); | |
signedTxHex = signedTx.toHex(); | |
xhr({ | |
uri: '/chain/:blockchainType/transactions/send', | |
method: 'POST', | |
json: { | |
transactionHex: signedTxHex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById("create-transaction").addEventListener("click", function(event) { | |
newTx = wallet.createTx(bitstoreDepositAddress, 100000, 1000, address); | |
newTxJSON = JSON.stringify({ | |
inputCount: newTx.ins.length, | |
outputCount: newTx.outs.length, | |
txHash: newTx.getId() | |
}, null, 4); | |
document.getElementById("new-tx-json").innerHTML = newTxJSON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getElementById("get-unspents").addEventListener("click", function(event) { | |
getUnspentOutputs = function(callback) { | |
xhr("https://www.blockai.com/chain/testnet/addresses/" + address + "/unspents", function(err, res, body) { | |
var unspentOutputs = JSON.parse(body); | |
unspentOutputs.forEach(function(utxo) { | |
utxo.txHash = utxo.hash; | |
utxo.index = utxo.outputIndex; | |
}); | |
callback(err, unspentOutputs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = require('xhr'); | |
document.getElementById("get-wallet").addEventListener("click", function(event) { | |
xhr("https://www.blockai.com/chain/testnet/addresses/" + address, function(err, res, body) { | |
var data = JSON.parse(body); | |
var balance = data.balance; | |
document.getElementById("balance").innerHTML = balance; | |
}); | |
NewerOlder