Skip to content

Instantly share code, notes, and snippets.

// Initialize cargo using the development network. This will
// tell Cargo to use it's contracts on the Rinkeby network.
const cargo = new Cargo({
network: 'development',
});
const run = async () => {
// This will fetch Cargo contract information
// so we can begin interacting with those contracts when we are ready.
await cargo.init();
const CRATE_ID = '98';
// Initialize cargo using the development network. This will
// tell Cargo to use it's contracts on the Rinkeby network.
const cargo = new Cargo({
network: 'development',
});
const getResaleItems = async () => {
// Get all the vendors in your crate. The creator of the crate (you) is
const CRATE_ID = '98';
// Initialize cargo using the development network. This will
// tell Cargo to use it's contracts on the Rinkeby network.
const cargo = new Cargo({
network: 'development',
});
const run = async () => {
// This will fetch Cargo contract information
// Update this with your crate ID
const CRATE_ID = '98';
// Initialize cargo using the development network. This will
// tell Cargo to use it's contracts on the Rinkeby network.
const cargo = new Cargo({
network: 'development',
});
const run = async () => {
@pizzarob
pizzarob / xhr.js
Created August 21, 2016 18:45
Helper Functions for Making XHR Requests in JavaScript
function post(url, data) {
return new Promise((resolve, reject) => {
let xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
xhr.addEventListener('load', () => {
let { response, status } = xhr;
let res = JSON.parse(response);
if(status >= 200 && status < 400){