commit
3d06d1474e
2 changed files with 44 additions and 22 deletions
27
dist/bundle.js
vendored
27
dist/bundle.js
vendored
|
@ -4138,12 +4138,10 @@ function doCheckAddressIsMine(address) {
|
|||
};
|
||||
}
|
||||
|
||||
function doSendDraftTransaction() {
|
||||
function doSendDraftTransaction(address, amount) {
|
||||
return function (dispatch, getState) {
|
||||
var state = getState();
|
||||
var draftTx = (0, _wallet.selectDraftTransaction)(state);
|
||||
var balance = (0, _wallet.selectBalance)(state);
|
||||
var amount = (0, _wallet.selectDraftTransactionAmount)(state);
|
||||
|
||||
if (balance - amount <= 0) {
|
||||
dispatch((0, _notifications.doNotify)({
|
||||
|
@ -4181,7 +4179,7 @@ function doSendDraftTransaction() {
|
|||
title: 'Transaction failed',
|
||||
message: 'Transaction failed',
|
||||
type: 'error',
|
||||
displayType: ['modal', 'toast']
|
||||
displayType: ['snackbar', 'toast']
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -4195,13 +4193,13 @@ function doSendDraftTransaction() {
|
|||
title: 'Transaction failed',
|
||||
message: 'Transaction failed',
|
||||
type: 'error',
|
||||
displayType: ['modal', 'toast']
|
||||
displayType: ['snackbar', 'toast']
|
||||
}));
|
||||
};
|
||||
|
||||
_lbry2.default.wallet_send({
|
||||
amount: draftTx.amount,
|
||||
address: draftTx.address
|
||||
amount: amount,
|
||||
address: address
|
||||
}).then(successCallback, errorCallback);
|
||||
};
|
||||
}
|
||||
|
@ -4235,6 +4233,19 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
return;
|
||||
}
|
||||
|
||||
var success = function success() {
|
||||
dispatch((0, _notifications.doNotify)({
|
||||
message: __('You sent ' + amount + ' LBC as support, Mahalo!'),
|
||||
linkText: __('History'),
|
||||
linkTarget: __('/wallet'),
|
||||
displayType: ['snackbar']
|
||||
}));
|
||||
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
};
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.SUPPORT_TRANSACTION_STARTED
|
||||
});
|
||||
|
@ -4242,7 +4253,7 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
_lbry2.default.wallet_send({
|
||||
claim_id: claimId,
|
||||
amount: amount
|
||||
}).then(successCallback, errorCallback);
|
||||
}).then(success, errorCallback);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import * as ACTIONS from 'constants/action_types';
|
||||
import Lbry from 'lbry';
|
||||
import { doNotify } from 'redux/actions/notifications';
|
||||
import {
|
||||
selectBalance,
|
||||
selectDraftTransaction,
|
||||
selectDraftTransactionAmount,
|
||||
} from 'redux/selectors/wallet';
|
||||
import { selectBalance } from 'redux/selectors/wallet';
|
||||
|
||||
export function doUpdateBalance() {
|
||||
return (dispatch, getState) => {
|
||||
const { wallet: { balance: balanceInStore } } = getState();
|
||||
const {
|
||||
wallet: { balance: balanceInStore },
|
||||
} = getState();
|
||||
Lbry.wallet_balance().then(balance => {
|
||||
if (balanceInStore !== balance) {
|
||||
dispatch({
|
||||
|
@ -90,12 +88,10 @@ export function doCheckAddressIsMine(address) {
|
|||
};
|
||||
}
|
||||
|
||||
export function doSendDraftTransaction() {
|
||||
export function doSendDraftTransaction(address, amount) {
|
||||
return (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const draftTx = selectDraftTransaction(state);
|
||||
const balance = selectBalance(state);
|
||||
const amount = selectDraftTransactionAmount(state);
|
||||
|
||||
if (balance - amount <= 0) {
|
||||
dispatch(
|
||||
|
@ -138,7 +134,7 @@ export function doSendDraftTransaction() {
|
|||
title: 'Transaction failed',
|
||||
message: 'Transaction failed',
|
||||
type: 'error',
|
||||
displayType: ['modal', 'toast'],
|
||||
displayType: ['snackbar', 'toast'],
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -154,14 +150,14 @@ export function doSendDraftTransaction() {
|
|||
title: 'Transaction failed',
|
||||
message: 'Transaction failed',
|
||||
type: 'error',
|
||||
displayType: ['modal', 'toast'],
|
||||
displayType: ['snackbar', 'toast'],
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
Lbry.wallet_send({
|
||||
amount: draftTx.amount,
|
||||
address: draftTx.address,
|
||||
amount,
|
||||
address,
|
||||
}).then(successCallback, errorCallback);
|
||||
};
|
||||
}
|
||||
|
@ -197,6 +193,21 @@ export function doSendSupport(amount, claimId, uri, successCallback, errorCallba
|
|||
return;
|
||||
}
|
||||
|
||||
const success = () => {
|
||||
dispatch(
|
||||
doNotify({
|
||||
message: __(`You sent ${amount} LBC as support, Mahalo!`),
|
||||
linkText: __('History'),
|
||||
linkTarget: __('/wallet'),
|
||||
displayType: ['snackbar'],
|
||||
})
|
||||
);
|
||||
|
||||
if (successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
};
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.SUPPORT_TRANSACTION_STARTED,
|
||||
});
|
||||
|
@ -204,6 +215,6 @@ export function doSendSupport(amount, claimId, uri, successCallback, errorCallba
|
|||
Lbry.wallet_send({
|
||||
claim_id: claimId,
|
||||
amount,
|
||||
}).then(successCallback, errorCallback);
|
||||
}).then(success, errorCallback);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue