AschPay is a Browser Extension for Asch NetWork.
It can be used to debug smart contract, or play DApps with browser.
- Install Node.js version 8.9.3 or later.
- Install local dependencies with
npm install
. - Build with development
npm run dev
. - Build for Publishing
npm run build
.
Uncompressed builds will found in ./build
When AschPay is installed, AschPay will inject a AschWeb object into current document, you can find it in window.aschPay.aschWeb
or window.aschWeb
.
Note that you can use like this to check AschPay environment
window.addEventListener('load', function() {
// Checking if the aschWeb has been injected
if (typeof aschPay !== 'undefined') {
aschWeb = aschPay.aschWeb || aschWeb
if (aschWeb.isAschPay && aschWeb.ready) {
// Now start you app & access aschWeb
}
} else {
console.log('No aschWeb? You should install AschPay!')
}
})
// chrome网上应用店
https://chrome.google.com/webstore/detail/asch-pay/gjdneabihbmcpobmfhcnljaojmgoihfk
// github
https://github.com/AschPlatform/asch-web
const aschWeb = window.aschWeb
const contract = await aschWeb.createContractFromName('crowdFundging_v1')
let result = await contract.call('getXXT', ['233'], 1000000, false)
console.log('testContract result:' + JSON.stringify(result))
contract.pay('XAS', '12345', contract.name, 1000000, false).
then(res => {
if (res.success) {
alert('调用成功')
//document.getElementById('result').innerHTML = JSON.stringify(res)
} else {
// alert(res.error)
console.error(res)
}
}).catch(err => {
alert(res.error)
console.error(err)
})
AschPay is MIT licensed# asch-pay