Save CoinSwapInfo instead of just the swap address.

User should be able to retrieve the expected send/receive amount, otherwise they might be sending insufficient amounts.

This change also includes the coin type, as we might be supporting other coins beyond BTC.
This commit is contained in:
infiinte-persistence 2021-04-04 13:58:12 +08:00 committed by Sean Yesmunt
parent 9f7902aa0b
commit 8335c9d2de
4 changed files with 65 additions and 9 deletions

8
dist/bundle.es.js vendored
View file

@ -1752,13 +1752,13 @@ function extractUserState(rawObj) {
following,
tags,
blocked,
btc_addresses,
coin_swaps,
settings,
app_welcome_version,
sharing_3P
} = rawObj.value;
return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, btc_addresses ? { btc_addresses } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {});
return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swaps ? { coin_swaps } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {});
}
return {};
@ -1771,7 +1771,7 @@ function doPopulateSharedUserState(sharedSettings) {
following,
tags,
blocked,
btc_addresses,
coin_swaps,
settings,
app_welcome_version,
sharing_3P
@ -1783,7 +1783,7 @@ function doPopulateSharedUserState(sharedSettings) {
following,
tags,
blocked,
btcAddresses: btc_addresses,
coinSwaps: coin_swaps,
settings,
welcomeVersion: app_welcome_version,
allowAnalytics: sharing_3P

28
dist/flow-typed/CoinSwap.js vendored Normal file
View file

@ -0,0 +1,28 @@
declare type CoinSwapInfo = {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
}
declare type CoinSwapState = {
coinSwaps: Array<CoinSwapInfo>
};
declare type CoinSwapAction = {
type: string,
data: {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
},
};
declare type CoinSwapRemoveAction = {
type: string,
data: {
sendAddress: string,
},
};

28
flow-typed/CoinSwap.js vendored Normal file
View file

@ -0,0 +1,28 @@
declare type CoinSwapInfo = {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
}
declare type CoinSwapState = {
coinSwaps: Array<CoinSwapInfo>
};
declare type CoinSwapAction = {
type: string,
data: {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
},
};
declare type CoinSwapRemoveAction = {
type: string,
data: {
sendAddress: string,
},
};

View file

@ -9,7 +9,7 @@ type SharedData = {
following?: Array<{ uri: string, notificationsDisabled: boolean }>,
tags?: Array<string>,
blocked?: Array<string>,
btc_addresses?: Array<string>,
coin_swaps?: Array<CoinSwapInfo>,
settings?: any,
app_welcome_version?: number,
sharing_3P?: boolean,
@ -23,7 +23,7 @@ function extractUserState(rawObj: SharedData) {
following,
tags,
blocked,
btc_addresses,
coin_swaps,
settings,
app_welcome_version,
sharing_3P,
@ -34,7 +34,7 @@ function extractUserState(rawObj: SharedData) {
...(following ? { following } : {}),
...(tags ? { tags } : {}),
...(blocked ? { blocked } : {}),
...(btc_addresses ? { btc_addresses } : {}),
...(coin_swaps ? { coin_swaps } : {}),
...(settings ? { settings } : {}),
...(app_welcome_version ? { app_welcome_version } : {}),
...(sharing_3P ? { sharing_3P } : {}),
@ -51,7 +51,7 @@ export function doPopulateSharedUserState(sharedSettings: any) {
following,
tags,
blocked,
btc_addresses,
coin_swaps,
settings,
app_welcome_version,
sharing_3P,
@ -63,7 +63,7 @@ export function doPopulateSharedUserState(sharedSettings: any) {
following,
tags,
blocked,
btcAddresses: btc_addresses,
coinSwaps: coin_swaps,
settings,
welcomeVersion: app_welcome_version,
allowAnalytics: sharing_3P,