diff --git a/lib/machine-loader.js b/lib/machine-loader.js index f49d57cf..dcaa78b6 100644 --- a/lib/machine-loader.js +++ b/lib/machine-loader.js @@ -129,8 +129,6 @@ function getMachineNames (config) { .then(([rawMachines, pings, events, config, heartbeat, performance]) => { const mergeByDeviceId = (x, y) => _.values(_.merge(_.keyBy('deviceId', x), _.keyBy('deviceId', y))) const machines = mergeByDeviceId(mergeByDeviceId(rawMachines, heartbeat), performance) - console.log('machines', machines) - console.log(machines.map(addName(pings, events, config))) return machines.map(addName(pings, events, config)) }) diff --git a/lib/new-admin/filters.js b/lib/new-admin/filters.js index 89d67434..4eb5dda7 100644 --- a/lib/new-admin/filters.js +++ b/lib/new-admin/filters.js @@ -4,30 +4,29 @@ const { CASH_OUT_TRANSACTION_STATES } = require('../cash-out/cash-out-helper') function transaction () { const sql = `SELECT DISTINCT * FROM ( - SELECT 'type' AS type, 'Cash In' AS value UNION - SELECT 'type' AS type, 'Cash Out' AS value UNION - SELECT 'machine' AS type, name AS value FROM devices d INNER JOIN cash_in_txs t ON d.device_id = t.device_id UNION - SELECT 'machine' AS type, name AS value FROM devices d INNER JOIN cash_out_txs t ON d.device_id = t.device_id UNION - SELECT 'customer' AS type, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') AS value + SELECT 'type' AS type, NULL AS label, 'Cash In' AS value UNION + SELECT 'type' AS type, NULL AS label, 'Cash Out' AS value UNION + SELECT 'machine' AS type, name AS label, d.device_id AS value FROM devices d INNER JOIN cash_in_txs t ON d.device_id = t.device_id UNION + SELECT 'machine' AS type, name AS label, d.device_id AS value FROM devices d INNER JOIN cash_out_txs t ON d.device_id = t.device_id UNION + SELECT 'customer' AS type, NULL AS label, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') AS value FROM customers c INNER JOIN cash_in_txs t ON c.id = t.customer_id WHERE c.id_card_data::json->>'firstName' IS NOT NULL or c.id_card_data::json->>'lastName' IS NOT NULL UNION - SELECT 'customer' AS type, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') AS value + SELECT 'customer' AS type, NULL AS label, concat(id_card_data::json->>'firstName', ' ', id_card_data::json->>'lastName') AS value FROM customers c INNER JOIN cash_out_txs t ON c.id = t.customer_id WHERE c.id_card_data::json->>'firstName' IS NOT NULL or c.id_card_data::json->>'lastName' IS NOT NULL UNION - SELECT 'fiat' AS type, fiat_code AS value FROM cash_in_txs UNION - SELECT 'fiat' AS type, fiat_code AS value FROM cash_out_txs UNION - SELECT 'crypto' AS type, crypto_code AS value FROM cash_in_txs UNION - SELECT 'crypto' AS type, crypto_code AS value FROM cash_out_txs UNION - SELECT 'address' AS type, to_address AS value FROM cash_in_txs UNION - SELECT 'address' AS type, to_address AS value FROM cash_out_txs UNION - SELECT 'status' AS type, ${cashInTx.TRANSACTION_STATES} AS value FROM cash_in_txs UNION - SELECT 'status' AS type, ${CASH_OUT_TRANSACTION_STATES} AS value FROM cash_out_txs UNION - SELECT 'sweep status' AS type, CASE WHEN swept THEN 'Swept' WHEN NOT swept THEN 'Unswept' END AS value FROM cash_out_txs + SELECT 'fiat' AS type, NULL AS label, fiat_code AS value FROM cash_in_txs UNION + SELECT 'fiat' AS type, NULL AS label, fiat_code AS value FROM cash_out_txs UNION + SELECT 'crypto' AS type, NULL AS label, crypto_code AS value FROM cash_in_txs UNION + SELECT 'crypto' AS type, NULL AS label, crypto_code AS value FROM cash_out_txs UNION + SELECT 'address' AS type, NULL AS label, to_address AS value FROM cash_in_txs UNION + SELECT 'address' AS type, NULL AS label, to_address AS value FROM cash_out_txs UNION + SELECT 'status' AS type, NULL AS label, ${cashInTx.TRANSACTION_STATES} AS value FROM cash_in_txs UNION + SELECT 'status' AS type, NULL AS label, ${CASH_OUT_TRANSACTION_STATES} AS value FROM cash_out_txs UNION + SELECT 'sweep status' AS type, NULL AS label, CASE WHEN swept THEN 'Swept' WHEN NOT swept THEN 'Unswept' END AS value FROM cash_out_txs ) f` return db.any(sql) } - function customer () { const sql = `SELECT DISTINCT * FROM ( SELECT 'phone' AS type, phone AS value FROM customers WHERE phone IS NOT NULL UNION diff --git a/lib/new-admin/graphql/resolvers/transaction.resolver.js b/lib/new-admin/graphql/resolvers/transaction.resolver.js index 9005805c..f262517a 100644 --- a/lib/new-admin/graphql/resolvers/transaction.resolver.js +++ b/lib/new-admin/graphql/resolvers/transaction.resolver.js @@ -19,10 +19,10 @@ const resolvers = { isAnonymous: parent => (parent.customerId === anonymous.uuid) }, Query: { - transactions: (...[, { from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers }]) => - transactions.batch(from, until, limit, offset, deviceId, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers), - transactionsCsv: (...[, { from, until, limit, offset, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, timezone, excludeTestingCustomers, simplified }]) => - transactions.batch(from, until, limit, offset, null, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers, simplified) + transactions: (...[, { from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers }]) => + transactions.batch(from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers), + transactionsCsv: (...[, { from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, timezone, excludeTestingCustomers, simplified }]) => + transactions.batch(from, until, limit, offset, null, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept, excludeTestingCustomers, simplified) .then(data => parseAsync(logDateFormat(timezone, data, ['created', 'sendTime', 'publishedAt']))), transactionCsv: (...[, { id, txClass, timezone }]) => transactions.getTx(id, txClass).then(data => diff --git a/lib/new-admin/graphql/types/transaction.type.js b/lib/new-admin/graphql/types/transaction.type.js index ae57a365..e964512b 100644 --- a/lib/new-admin/graphql/types/transaction.type.js +++ b/lib/new-admin/graphql/types/transaction.type.js @@ -56,11 +56,12 @@ const typeDef = gql` type Filter { type: String value: String + label: String } type Query { - transactions(from: Date, until: Date, limit: Int, offset: Int, deviceId: ID, txClass: String, machineName: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, excludeTestingCustomers: Boolean): [Transaction] @auth - transactionsCsv(from: Date, until: Date, limit: Int, offset: Int, txClass: String, machineName: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, timezone: String, excludeTestingCustomers: Boolean, simplified: Boolean): String @auth + transactions(from: Date, until: Date, limit: Int, offset: Int, txClass: String, deviceId: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, excludeTestingCustomers: Boolean): [Transaction] @auth + transactionsCsv(from: Date, until: Date, limit: Int, offset: Int, txClass: String, deviceId: String, customerName: String, fiatCode: String, cryptoCode: String, toAddress: String, status: String, swept: Boolean, timezone: String, excludeTestingCustomers: Boolean, simplified: Boolean): String @auth transactionCsv(id: ID, txClass: String, timezone: String): String @auth txAssociatedDataCsv(id: ID, txClass: String, timezone: String): String @auth transactionFilters: [Filter] @auth diff --git a/lib/new-admin/services/transactions.js b/lib/new-admin/services/transactions.js index 8a838b64..8806d954 100644 --- a/lib/new-admin/services/transactions.js +++ b/lib/new-admin/services/transactions.js @@ -11,19 +11,6 @@ const { REDEEMABLE_AGE, CASH_OUT_TRANSACTION_STATES } = require('../../cash-out/ const NUM_RESULTS = 1000 -function addNames (txs) { - return machineLoader.getMachineNames() - .then(machines => { - const addName = tx => { - const machine = _.find(['deviceId', tx.deviceId], machines) - const name = machine ? machine.name : 'Unpaired' - return _.set('machineName', name, tx) - } - - return _.map(addName, txs) - }) -} - function addProfits (txs) { return _.map(it => { const profit = getProfit(it).toString() @@ -33,14 +20,31 @@ function addProfits (txs) { const camelize = _.mapKeys(_.camelCase) +const DEVICE_NAME_QUERY = ` + CASE + WHEN ud.name IS NOT NULL THEN ud.name || ' (unpaired)' + WHEN d.name IS NOT NULL THEN d.name + ELSE 'Unpaired' + END AS machine_name +` + + const DEVICE_NAME_JOINS = ` + LEFT JOIN devices d ON txs.device_id = d.device_id + LEFT JOIN ( + SELECT device_id, name, unpaired, paired + FROM unpaired_devices + ) ud ON txs.device_id = ud.device_id + AND ud.unpaired >= txs.created + AND (txs.created >= ud.paired) + ` + function batch ( from = new Date(0).toISOString(), until = new Date().toISOString(), limit = null, offset = 0, - id = null, txClass = null, - machineName = null, + deviceId = null, customerName = null, fiatCode = null, cryptoCode = null, @@ -61,8 +65,7 @@ function batch ( k ) )), - addProfits, - addNames + addProfits ) const cashInSql = `SELECT 'cashIn' AS tx_class, txs.*, @@ -77,21 +80,20 @@ function batch ( txs.tx_customer_photo_at AS tx_customer_photo_at, txs.tx_customer_photo_path AS tx_customer_photo_path, ((NOT txs.send_confirmed) AND (txs.created <= now() - interval $1)) AS expired, - tb.error_message AS batch_error + tb.error_message AS batch_error, + ${DEVICE_NAME_QUERY} FROM (SELECT *, ${cashInTx.TRANSACTION_STATES} AS txStatus FROM cash_in_txs) AS txs LEFT OUTER JOIN customers c ON txs.customer_id = c.id - LEFT JOIN devices d ON txs.device_id = d.device_id + ${DEVICE_NAME_JOINS} LEFT OUTER JOIN transaction_batches tb ON txs.batch_id = tb.id - WHERE txs.created >= $2 AND txs.created <= $3 ${ - id !== null ? `AND txs.device_id = $6` : `` -} - AND ($7 is null or $7 = 'Cash In') - AND ($8 is null or d.name = $8) - AND ($9 is null or concat(c.id_card_data::json->>'firstName', ' ', c.id_card_data::json->>'lastName') = $9) - AND ($10 is null or txs.fiat_code = $10) - AND ($11 is null or txs.crypto_code = $11) - AND ($12 is null or txs.to_address = $12) - AND ($13 is null or txs.txStatus = $13) + WHERE txs.created >= $2 AND txs.created <= $3 + AND ($6 is null or $6 = 'Cash In') + AND ($7 is null or txs.device_id = $7) + AND ($8 is null or concat(c.id_card_data::json->>'firstName', ' ', c.id_card_data::json->>'lastName') = $8) + AND ($9 is null or txs.fiat_code = $9) + AND ($10 is null or txs.crypto_code = $10) + AND ($11 is null or txs.to_address = $11) + AND ($12 is null or txs.txStatus = $12) ${excludeTestingCustomers ? `AND c.is_test_customer is false` : ``} ${isCsvExport && !simplified ? '' : 'AND (error IS NOT null OR tb.error_message IS NOT null OR fiat > 0)'} ORDER BY created DESC limit $4 offset $5` @@ -109,23 +111,22 @@ function batch ( c.id_card_photo_path AS customer_id_card_photo_path, txs.tx_customer_photo_at AS tx_customer_photo_at, txs.tx_customer_photo_path AS tx_customer_photo_path, - (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $1) AS expired + (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $1) AS expired, + ${DEVICE_NAME_QUERY} FROM (SELECT *, ${CASH_OUT_TRANSACTION_STATES} AS txStatus FROM cash_out_txs) txs INNER JOIN cash_out_actions actions ON txs.id = actions.tx_id AND actions.action = 'provisionAddress' LEFT OUTER JOIN customers c ON txs.customer_id = c.id - LEFT JOIN devices d ON txs.device_id = d.device_id - WHERE txs.created >= $2 AND txs.created <= $3 ${ - id !== null ? `AND txs.device_id = $6` : `` -} - AND ($7 is null or $7 = 'Cash Out') - AND ($8 is null or d.name = $8) - AND ($9 is null or concat(c.id_card_data::json->>'firstName', ' ', c.id_card_data::json->>'lastName') = $9) - AND ($10 is null or txs.fiat_code = $10) - AND ($11 is null or txs.crypto_code = $11) - AND ($12 is null or txs.to_address = $12) - AND ($13 is null or txs.txStatus = $13) - AND ($14 is null or txs.swept = $14) + ${DEVICE_NAME_JOINS} + WHERE txs.created >= $2 AND txs.created <= $3 + AND ($6 is null or $6 = 'Cash Out') + AND ($7 is null or txs.device_id = $7) + AND ($8 is null or concat(c.id_card_data::json->>'firstName', ' ', c.id_card_data::json->>'lastName') = $8) + AND ($9 is null or txs.fiat_code = $9) + AND ($10 is null or txs.crypto_code = $10) + AND ($11 is null or txs.to_address = $11) + AND ($12 is null or txs.txStatus = $12) + AND ($13 is null or txs.swept = $13) ${excludeTestingCustomers ? `AND c.is_test_customer is false` : ``} ${isCsvExport ? '' : 'AND fiat > 0'} ORDER BY created DESC limit $4 offset $5` @@ -141,13 +142,13 @@ function batch ( } if (hasCashInOnlyFilters) { - promises = [db.any(cashInSql, [cashInTx.PENDING_INTERVAL, from, until, limit, offset, id, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status])] + promises = [db.any(cashInSql, [cashInTx.PENDING_INTERVAL, from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status])] } else if (hasCashOutOnlyFilters) { - promises = [db.any(cashOutSql, [REDEEMABLE_AGE, from, until, limit, offset, id, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept])] + promises = [db.any(cashOutSql, [REDEEMABLE_AGE, from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept])] } else { promises = [ - db.any(cashInSql, [cashInTx.PENDING_INTERVAL, from, until, limit, offset, id, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status]), - db.any(cashOutSql, [REDEEMABLE_AGE, from, until, limit, offset, id, txClass, machineName, customerName, fiatCode, cryptoCode, toAddress, status, swept]) + db.any(cashInSql, [cashInTx.PENDING_INTERVAL, from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status]), + db.any(cashOutSql, [REDEEMABLE_AGE, from, until, limit, offset, txClass, deviceId, customerName, fiatCode, cryptoCode, toAddress, status, swept]) ] } @@ -249,7 +250,7 @@ const getStatus = it => { function getCustomerTransactionsBatch (ids) { const packager = _.flow(it => { return it - }, _.flatten, _.orderBy(_.property('created'), ['desc']), _.map(camelize), addNames) + }, _.flatten, _.orderBy(_.property('created'), ['desc']), _.map(camelize)) const cashInSql = `SELECT 'cashIn' AS tx_class, txs.*, c.phone AS customer_phone, @@ -261,9 +262,11 @@ function getCustomerTransactionsBatch (ids) { c.front_camera_path AS customer_front_camera_path, c.id_card_photo_path AS customer_id_card_photo_path, ((NOT txs.send_confirmed) AND (txs.created <= now() - interval $2)) AS expired, - tb.error_message AS batch_error + tb.error_message AS batch_error, + ${DEVICE_NAME_QUERY} FROM cash_in_txs AS txs LEFT OUTER JOIN customers c ON txs.customer_id = c.id + ${DEVICE_NAME_JOINS} LEFT OUTER JOIN transaction_batches tb ON txs.batch_id = tb.id WHERE c.id IN ($1^) ORDER BY created DESC limit $3` @@ -279,11 +282,13 @@ function getCustomerTransactionsBatch (ids) { c.name AS customer_name, c.front_camera_path AS customer_front_camera_path, c.id_card_photo_path AS customer_id_card_photo_path, - (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $3) AS expired + (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $3) AS expired, + ${DEVICE_NAME_QUERY} FROM cash_out_txs txs INNER JOIN cash_out_actions actions ON txs.id = actions.tx_id AND actions.action = 'provisionAddress' LEFT OUTER JOIN customers c ON txs.customer_id = c.id + ${DEVICE_NAME_JOINS} WHERE c.id IN ($1^) ORDER BY created DESC limit $2` return Promise.all([ @@ -297,7 +302,7 @@ function getCustomerTransactionsBatch (ids) { } function single (txId) { - const packager = _.flow(_.compact, _.map(camelize), addNames) + const packager = _.flow(_.compact, _.map(camelize)) const cashInSql = `SELECT 'cashIn' AS tx_class, txs.*, c.phone AS customer_phone, @@ -309,9 +314,11 @@ function single (txId) { c.front_camera_path AS customer_front_camera_path, c.id_card_photo_path AS customer_id_card_photo_path, ((NOT txs.send_confirmed) AND (txs.created <= now() - interval $1)) AS expired, - tb.error_message AS batch_error + tb.error_message AS batch_error, + ${DEVICE_NAME_QUERY} FROM cash_in_txs AS txs LEFT OUTER JOIN customers c ON txs.customer_id = c.id + ${DEVICE_NAME_JOINS} LEFT OUTER JOIN transaction_batches tb ON txs.batch_id = tb.id WHERE id=$2` @@ -325,13 +332,14 @@ function single (txId) { c.id_card_data AS customer_id_card_data, c.name AS customer_name, c.front_camera_path AS customer_front_camera_path, - c.id_card_photo_path AS customer_id_card_photo_path, - (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $2) AS expired + (NOT txs.dispense AND extract(epoch FROM (now() - greatest(txs.created, txs.confirmed_at))) >= $2) AS expired, + ${DEVICE_NAME_QUERY} FROM cash_out_txs txs INNER JOIN cash_out_actions actions ON txs.id = actions.tx_id AND actions.action = 'provisionAddress' LEFT OUTER JOIN customers c ON txs.customer_id = c.id + ${DEVICE_NAME_JOINS} WHERE id=$1` return Promise.all([ diff --git a/new-lamassu-admin/src/components/SearchBox.jsx b/new-lamassu-admin/src/components/SearchBox.jsx index b4974123..08219a96 100644 --- a/new-lamassu-admin/src/components/SearchBox.jsx +++ b/new-lamassu-admin/src/components/SearchBox.jsx @@ -38,10 +38,10 @@ const SearchBox = memo( classes={{ option: classes.autocomplete }} value={filters} options={options} - getOptionLabel={it => it.value} + getOptionLabel={it => it.label || it.value} renderOption={it => (
-

{it.value}

+

{it.label || it.value}

{it.type}

)} diff --git a/new-lamassu-admin/src/components/SearchFilter.jsx b/new-lamassu-admin/src/components/SearchFilter.jsx index c3195d1d..c35b4a71 100644 --- a/new-lamassu-admin/src/components/SearchFilter.jsx +++ b/new-lamassu-admin/src/components/SearchFilter.jsx @@ -32,7 +32,7 @@ const SearchFilter = ({ onFilterDelete(f)} deleteIcon={} /> diff --git a/new-lamassu-admin/src/components/machineActions/DiagnosticsModal.jsx b/new-lamassu-admin/src/components/machineActions/DiagnosticsModal.jsx index a56ffb73..d87a5620 100644 --- a/new-lamassu-admin/src/components/machineActions/DiagnosticsModal.jsx +++ b/new-lamassu-admin/src/components/machineActions/DiagnosticsModal.jsx @@ -52,7 +52,6 @@ const MACHINE_LOGS = gql` ` const createCsv = async ({ machineLogsCsv }) => { - console.log(machineLogsCsv) const machineLogs = new Blob([machineLogsCsv], { type: 'text/plain;charset=utf-8' }) diff --git a/new-lamassu-admin/src/pages/Machines/MachineComponents/Transactions/Transactions.jsx b/new-lamassu-admin/src/pages/Machines/MachineComponents/Transactions/Transactions.jsx index be6b0d99..3ba9dd33 100644 --- a/new-lamassu-admin/src/pages/Machines/MachineComponents/Transactions/Transactions.jsx +++ b/new-lamassu-admin/src/pages/Machines/MachineComponents/Transactions/Transactions.jsx @@ -20,7 +20,7 @@ const useStyles = makeStyles(mainStyles) const NUM_LOG_RESULTS = 5 const GET_TRANSACTIONS = gql` - query transactions($limit: Int, $from: Date, $until: Date, $deviceId: ID) { + query transactions($limit: Int, $from: Date, $until: Date, $deviceId: String) { transactions( limit: $limit from: $from diff --git a/new-lamassu-admin/src/pages/Transactions/Transactions.jsx b/new-lamassu-admin/src/pages/Transactions/Transactions.jsx index b8afa09a..73879bd2 100644 --- a/new-lamassu-admin/src/pages/Transactions/Transactions.jsx +++ b/new-lamassu-admin/src/pages/Transactions/Transactions.jsx @@ -61,6 +61,7 @@ const GET_TRANSACTION_FILTERS = gql` transactionFilters { type value + label } } ` @@ -71,7 +72,7 @@ const GET_TRANSACTIONS = gql` $from: Date $until: Date $txClass: String - $machineName: String + $deviceId: String $customerName: String $fiatCode: String $cryptoCode: String @@ -84,7 +85,7 @@ const GET_TRANSACTIONS = gql` from: $from until: $until txClass: $txClass - machineName: $machineName + deviceId: $deviceId customerName: $customerName fiatCode: $fiatCode cryptoCode: $cryptoCode @@ -265,13 +266,13 @@ const Transactions = () => { setVariables({ limit: NUM_LOG_RESULTS, txClass: filtersObject.type, - machineName: filtersObject.machine, + deviceId: filtersObject.machine, customerName: filtersObject.customer, fiatCode: filtersObject.fiat, cryptoCode: filtersObject.crypto, toAddress: filtersObject.address, status: filtersObject.status, - swept: filtersObject.swept === 'Swept' + swept: filtersObject.swept && filtersObject.swept === 'Swept' }) refetch && refetch() @@ -289,13 +290,13 @@ const Transactions = () => { setVariables({ limit: NUM_LOG_RESULTS, txClass: filtersObject.type, - machineName: filtersObject.machine, + deviceId: filtersObject.machine, customerName: filtersObject.customer, fiatCode: filtersObject.fiat, cryptoCode: filtersObject.crypto, toAddress: filtersObject.address, status: filtersObject.status, - swept: filtersObject.swept === 'Swept' + swept: filtersObject.swept && filtersObject.swept === 'Swept' }) refetch && refetch() @@ -308,13 +309,13 @@ const Transactions = () => { setVariables({ limit: NUM_LOG_RESULTS, txClass: filtersObject.type, - machineName: filtersObject.machine, + deviceId: filtersObject.machine, customerName: filtersObject.customer, fiatCode: filtersObject.fiat, cryptoCode: filtersObject.crypto, toAddress: filtersObject.address, status: filtersObject.status, - swept: filtersObject.swept === 'Swept' + swept: filtersObject.swept && filtersObject.swept === 'Swept' }) refetch && refetch()