Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
widget.on("error", function (e) {
console.log("Wyre error", e);
});
widget.on("complete", function (e) {
console.log("Wyre complete", e );
});
widget.on('ready', function(e) {
console.log("Wyre ready", e );
});
widget.open();
break;
case 'ramp':
new RampInstantSDK(initParams)
.on('*', async (event) => {
let tokenDecimals = null;
let tokenAmount = null;
switch (event.type){
case 'PURCHASE_SUCCESSFUL':
// Update balance
this.props.getAccountBalance();
tokenDecimals = await this.props.getTokenDecimals();
tokenAmount = event.payload.purchase.tokenAmount;
tokenAmount = BNify(tokenAmount.toString()).div(BNify(Math.pow(10,parseInt(tokenDecimals)).toString())).toString();
// Toast message
window.toastProvider.addMessage(`Payment completed`, {const displayRampWidget = () => {
const widget = new RampInstantSDK({
hostAppName: 'AdExNetwork',
hostLogoUrl: 'https://www.adex.network/img/Adex-logo@2x.png',
variant: 'auto',
swapAsset: 'DAI',
userAddress: account.identity.address,
})
widget.domNodes.overlay.style.zIndex = 1000
widget.show()
}