Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClick = () => {
const { scrollContainer } = this.props.getGrowScroll()
if (scrollContainer) {
// $FlowFixMe seems to be missing in flow
scrollContainer.scrollTo({ top: 0, behavior: 'smooth' })
track('ScrollBackToTop')
}
}
const bridge = getAccountBridge(account, parentAccount)
if (!device) {
handleTransactionError(new DisconnectedDevice())
transitionTo('confirmation')
return
}
invariant(account && transaction && bridge, 'signTransaction invalid conditions')
const eventProps = {
currencyName: mainAccount.currency.name,
derivationMode: mainAccount.derivationMode,
freshAddressPath: mainAccount.freshAddressPath,
operationsLength: mainAccount.operations.length,
}
track('SendTransactionStart', eventProps)
signTransactionSubRef.current = bridge
.signAndBroadcast(mainAccount, transaction, device.path)
.subscribe({
next: e => {
switch (e.type) {
case 'signed': {
track('SendTransactionSigned', eventProps)
setSigned(true)
transitionTo('confirmation')
break
}
case 'broadcasted': {
track('SendTransactionBroadcasted', eventProps)
handleOperationBroadcasted(e.operation)
break
}
error: err => {
if (err.statusCode === 0x6985) {
track('SendTransactionRefused', eventProps)
handleTransactionError(new UserRefusedOnDevice())
transitionTo('refused')
} else {
track('SendTransactionError', eventProps)
handleTransactionError(err)
transitionTo('confirmation')
}
},
})
fetchMoreOperations = () => {
track('FetchMoreOperations')
this.setState({ nbToShow: this.state.nbToShow + 20 })
}
next: e => {
switch (e.type) {
case 'signed': {
track('SendTransactionSigned', eventProps)
setSigned(true)
transitionTo('confirmation')
break
}
case 'broadcasted': {
track('SendTransactionBroadcasted', eventProps)
handleOperationBroadcasted(e.operation)
break
}
default:
}
},
error: err => {
export const openURL = (
url: string,
customEventName: string = 'OpenURL',
extraParams: Object = {},
) => {
track(customEventName, { ...extraParams, url })
shell && shell.openExternal(url)
}
onClick = () => {
this.props.cvPoll()
this.props.setSyncBehavior({ type: 'SYNC_ALL_ACCOUNTS', priority: 5 })
this.setState({ lastClickTime: Date.now() })
track('SyncRefreshClick')
}
handleClickQrCode = () => {
const { qrReaderOpened } = this.state
this.setState(prev => ({
qrReaderOpened: !prev.qrReaderOpened,
}))
!qrReaderOpened ? track('Send Flow QR Code Opened') : track('Send Flow QR Code Closed')
}
const onClickHandler = e => {
if (onClick) {
if (event) {
track(event, eventProperties)
}
onClick(e)
}
}
return (