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
// 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(); |
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
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 |
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
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 |
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
// 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 () => { |
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
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){ |
OlderNewer