Skip to content

Instantly share code, notes, and snippets.

@gavxin
Created May 26, 2018 17:06
Show Gist options
  • Save gavxin/b069280655141bdba9bec699437ad4a9 to your computer and use it in GitHub Desktop.
Save gavxin/b069280655141bdba9bec699437ad4a9 to your computer and use it in GitHub Desktop.
Nebulas helpers
function QueryContract(addr) {
var headers = new Headers();
headers.append('Content-Type', 'application/json')
fetch("https://mainnet.nebulas.io/v1/user/getTransactionByContract", {
method: 'POST',
headers: headers,
body: '{"address":"' + addr + '"}'
}).then(resp => {
return resp.json();
}).then(json => {
// console.log(json);
console.log("Contract txhash is:" + json.result.hash);
window.open("https://explorer.nebulas.io/#/tx/" + json.result.hash);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment