Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!isValid) return;
let data = this.getData();
if (!data) return;
data.tokens = hathorLib.tokens.filterTokens(this.state.txTokens, hathorLib.constants.HATHOR_TOKEN_CONFIG).map((token) => token.uid);
this.setState({ errorMessage: '', loading: true });
try {
const promise = hathorLib.transaction.sendTransaction(data, this.state.pin);
promise.then(() => {
// Must update the shared address, in case we have used one for the change
wallet.updateSharedAddress();
this.props.history.push('/wallet/');
}, (message) => {
this.setState({ errorMessage: message, loading: false });
});
} catch(e) {
if (e instanceof hathorLib.errors.AddressError || e instanceof hathorLib.errors.OutputValueError) {
this.setState({ errorMessage: e.message, loading: false });
} else {
// Unhandled error
throw e;
}
}
}