Skip to content

Commit

Permalink
testing - adding console logs for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mikozet committed Apr 19, 2023
1 parent fefe72a commit 4189afc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
41 changes: 1 addition & 40 deletions src/store/token/actions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { tcToCrc } from '@circles/timecircles';
import { DateTime } from 'luxon';

Expand All @@ -10,8 +9,6 @@ import ActionTypes from '~/store/token/types';
import { PATHFINDER_HOPS_DEFAULT, ZERO_ADDRESS } from '~/utils/constants';
import logError from '~/utils/debug';
import { isTokenDeployed, waitAndRetryOnFail } from '~/utils/stateChecks';
import translate from '~/services/locale';
import notify, { NotificationsTypes } from '~/store/notifications/actions';

const { ActivityTypes } = core.activity;
const { ErrorCodes, TransferError } = core.errors;
Expand Down Expand Up @@ -307,28 +304,20 @@ export function transfer(
attempts = PATHFINDER_HOPS_DEFAULT + 1,
) {
return async (dispatch, getState) => {
console.log('transfer function we dispatch ActionTypes.TOKEN_TRANSFER');
dispatch({
type: ActionTypes.TOKEN_TRANSFER,
});

const { safe } = getState();
const from = safe.currentAccount;

console.log('tranfer function here');

try {
const value = new web3.utils.BN(
core.utils.toFreckles(tcToCrc(Date.now(), Number(amount))),
);
let txHash;
console.log('tranfer function value const', value);

if (process.env.PATHFINDER_TYPE === 'cli') {
console.log(
'tranfer function process.env.PATHFINDER_TYPE === cli is true',
);

txHash = await loopTransfer(
from,
to,
Expand All @@ -338,32 +327,10 @@ export function transfer(
attempts,
);
} else {
console.log(
'tranfer functionprocess.env.PATHFINDER_TYPE === cli is false',
);
// try {
txHash = await core.token.transfer(from, to, value, paymentNote);
console.log('transfer function txHash1', txHash);
// } catch (error) {
// console.log('transfer function core.token.transfer error here');
// dispatch({
// type: ActionTypes.TOKEN_TRANSFER_ERROR,
// });

// throw error;
// }
}

if (txHash !== null) {
console.log('txHash is valid! Transaction went through');

console.log(
'transfer function we add it as pendingActivity ActivityTypes.HUB_TRANSFER',
);

console.log(
'transfer function we dispatch ActionTypes.TOKEN_TRANSFER_SUCCESS',
);
dispatch(
addPendingActivity({
txHash,
Expand All @@ -380,16 +347,10 @@ export function transfer(
type: ActionTypes.TOKEN_TRANSFER_SUCCESS,
});
} else {
// "TransactionServiceException: execution reverted" as an example coming from core.token.transfer
throw new TransferError();
// dispatch(
// notify({
// text: translate('SendConfirm.errorMessageTransferUnknown'),
// type: NotificationsTypes.ERROR,
// }),
// );
}
} catch (error) {
console.log('transfer function error here');
dispatch({
type: ActionTypes.TOKEN_TRANSFER_ERROR,
});
Expand Down
1 change: 0 additions & 1 deletion src/views/SendConfirm.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
import { Container, Grid } from '@mui/material';
import qs from 'qs';
import React, { Fragment, useEffect, useState } from 'react';
Expand Down

0 comments on commit 4189afc

Please sign in to comment.