From 1fb191b7aed751bb2774be9a74c3505f97e8e49a Mon Sep 17 00:00:00 2001 From: fernandomg Date: Tue, 14 Jul 2020 16:01:00 -0300 Subject: [PATCH] fix `valueInWei` so its always a string --- src/logic/safe/utils/upgradeSafe.ts | 2 +- src/routes/safe/components/Apps/sendTransactions.ts | 2 +- .../components/Settings/ManageOwners/AddOwnerModal/index.tsx | 2 +- .../Settings/ManageOwners/RemoveOwnerModal/index.tsx | 2 +- .../Settings/ManageOwners/ReplaceOwnerModal/index.tsx | 2 +- .../safe/components/Settings/ThresholdSettings/index.tsx | 2 +- .../Transactions/TxsTable/ExpandedTx/RejectTxModal/index.tsx | 2 +- src/routes/safe/store/actions/createTransaction.ts | 4 ++-- src/routes/safe/store/models/types/transaction.ts | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/logic/safe/utils/upgradeSafe.ts b/src/logic/safe/utils/upgradeSafe.ts index c9224562..90b01ee7 100644 --- a/src/logic/safe/utils/upgradeSafe.ts +++ b/src/logic/safe/utils/upgradeSafe.ts @@ -15,7 +15,7 @@ export const upgradeSafeToLatestVersion = async (safeAddress, createTransaction) createTransaction({ safeAddress, to: MULTI_SEND_ADDRESS, - valueInWei: 0, + valueInWei: '0', txData: encodeMultiSendCallData, notifiedTransaction: 'STANDARD_TX', enqueueSnackbar: () => {}, diff --git a/src/routes/safe/components/Apps/sendTransactions.ts b/src/routes/safe/components/Apps/sendTransactions.ts index 5bbe4781..f4bee5a5 100644 --- a/src/routes/safe/components/Apps/sendTransactions.ts +++ b/src/routes/safe/components/Apps/sendTransactions.ts @@ -37,7 +37,7 @@ const sendTransactions = (dispatch, safeAddress, txs, enqueueSnackbar, closeSnac createTransaction({ safeAddress, to: multiSendAddress, - valueInWei: 0, + valueInWei: '0', txData: encodeMultiSendCallData, notifiedTransaction: 'STANDARD_TX', enqueueSnackbar, diff --git a/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.tsx b/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.tsx index 0d6f477d..6e984338 100644 --- a/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.tsx +++ b/src/routes/safe/components/Settings/ManageOwners/AddOwnerModal/index.tsx @@ -34,7 +34,7 @@ export const sendAddOwner = async (values, safeAddress, ownersOld, enqueueSnackb createTransaction({ safeAddress, to: safeAddress, - valueInWei: 0, + valueInWei: '0', txData, notifiedTransaction: TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX, enqueueSnackbar, diff --git a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.tsx b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.tsx index 3cbd926e..fed7cd23 100644 --- a/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.tsx +++ b/src/routes/safe/components/Settings/ManageOwners/RemoveOwnerModal/index.tsx @@ -53,7 +53,7 @@ export const sendRemoveOwner = async ( createTransaction({ safeAddress, to: safeAddress, - valueInWei: 0, + valueInWei: '0', txData, notifiedTransaction: TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX, enqueueSnackbar, diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.tsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.tsx index ceb43cf8..8162efab 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.tsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/index.tsx @@ -47,7 +47,7 @@ export const sendReplaceOwner = async ( createTransaction({ safeAddress, to: safeAddress, - valueInWei: 0, + valueInWei: '0', txData, notifiedTransaction: TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX, enqueueSnackbar, diff --git a/src/routes/safe/components/Settings/ThresholdSettings/index.tsx b/src/routes/safe/components/Settings/ThresholdSettings/index.tsx index 72b0dfcb..d7fda083 100644 --- a/src/routes/safe/components/Settings/ThresholdSettings/index.tsx +++ b/src/routes/safe/components/Settings/ThresholdSettings/index.tsx @@ -43,7 +43,7 @@ const ThresholdSettings = ({ classes, closeSnackbar, enqueueSnackbar }) => { createTransaction({ safeAddress, to: safeAddress, - valueInWei: 0, + valueInWei: '0', txData, notifiedTransaction: TX_NOTIFICATION_TYPES.SETTINGS_CHANGE_TX, enqueueSnackbar, diff --git a/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/RejectTxModal/index.tsx b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/RejectTxModal/index.tsx index 92a52001..b63f00ab 100644 --- a/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/RejectTxModal/index.tsx +++ b/src/routes/safe/components/Transactions/TxsTable/ExpandedTx/RejectTxModal/index.tsx @@ -53,7 +53,7 @@ const RejectTxModal = ({ classes, closeSnackbar, enqueueSnackbar, isOpen, onClos createTransaction({ safeAddress, to: safeAddress, - valueInWei: 0, + valueInWei: '0', notifiedTransaction: TX_NOTIFICATION_TYPES.CANCELLATION_TX, enqueueSnackbar, closeSnackbar, diff --git a/src/routes/safe/store/actions/createTransaction.ts b/src/routes/safe/store/actions/createTransaction.ts index 2513acf1..6217c89d 100644 --- a/src/routes/safe/store/actions/createTransaction.ts +++ b/src/routes/safe/store/actions/createTransaction.ts @@ -91,7 +91,7 @@ interface CreateTransaction extends WithSnackbarProps { to: string txData?: string txNonce?: number | string - valueInWei: number | string + valueInWei: string } const createTransaction = ({ @@ -187,7 +187,7 @@ const createTransaction = ({ const txToMock: TxToMock = { ...txArgs, confirmations: [], // this is used to determine if a tx is pending or not. See `calculateTransactionStatus` helper - value: `${txArgs.valueInWei}`, + value: txArgs.valueInWei, safeTxHash: generateSafeTxHash(safeAddress, txArgs), } const mockedTx = await mockTransaction(txToMock, safeAddress, state) diff --git a/src/routes/safe/store/models/types/transaction.ts b/src/routes/safe/store/models/types/transaction.ts index e0e8a8d5..83815f60 100644 --- a/src/routes/safe/store/models/types/transaction.ts +++ b/src/routes/safe/store/models/types/transaction.ts @@ -93,5 +93,5 @@ export type TxArgs = { sender?: string sigs: string to: string - valueInWei: number | string + valueInWei: string }