CoinSwap: websocket + multi-coin

- For the active swap, switch from polling to websocket. The returned data is now the Charge data from the commerce, so some parsing will be required.

- Only save the 'chargeCode' to the wallet. The other data can be repopulated from this.
This commit is contained in:
infiinte-persistence 2021-04-07 14:27:57 +08:00 committed by Sean Yesmunt
parent 8335c9d2de
commit 5f3a40a420
4 changed files with 35 additions and 35 deletions

8
dist/bundle.es.js vendored
View file

@ -1752,13 +1752,13 @@ function extractUserState(rawObj) {
following,
tags,
blocked,
coin_swaps,
coin_swap_codes,
settings,
app_welcome_version,
sharing_3P
} = rawObj.value;
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 _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swap_codes ? { coin_swap_codes } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {});
}
return {};
@ -1771,7 +1771,7 @@ function doPopulateSharedUserState(sharedSettings) {
following,
tags,
blocked,
coin_swaps,
coin_swap_codes,
settings,
app_welcome_version,
sharing_3P
@ -1783,7 +1783,7 @@ function doPopulateSharedUserState(sharedSettings) {
following,
tags,
blocked,
coinSwaps: coin_swaps,
coinSwapCodes: coin_swap_codes,
settings,
welcomeVersion: app_welcome_version,
allowAnalytics: sharing_3P

View file

@ -1,28 +1,28 @@
declare type CoinSwapInfo = {
coin: string,
sendAddress: string,
sendAmount: number,
chargeCode: string,
coins: Array<string>,
sendAddresses: { [string]: string},
sendAmounts: { [string]: number },
lbcAmount: number,
status?: {
status: string,
receipt_txid: string,
lbc_txid: string,
},
}
declare type CoinSwapState = {
coinSwaps: Array<CoinSwapInfo>
coinSwaps: Array<CoinSwapInfo>,
};
declare type CoinSwapAction = {
declare type CoinSwapAddAction = {
type: string,
data: {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
},
data: CoinSwapInfo,
};
declare type CoinSwapRemoveAction = {
type: string,
data: {
sendAddress: string,
chargeCode: string,
},
};

View file

@ -1,28 +1,28 @@
declare type CoinSwapInfo = {
coin: string,
sendAddress: string,
sendAmount: number,
chargeCode: string,
coins: Array<string>,
sendAddresses: { [string]: string},
sendAmounts: { [string]: number },
lbcAmount: number,
status?: {
status: string,
receipt_txid: string,
lbc_txid: string,
},
}
declare type CoinSwapState = {
coinSwaps: Array<CoinSwapInfo>
coinSwaps: Array<CoinSwapInfo>,
};
declare type CoinSwapAction = {
declare type CoinSwapAddAction = {
type: string,
data: {
coin: string,
sendAddress: string,
sendAmount: number,
lbcAmount: number,
},
data: CoinSwapInfo,
};
declare type CoinSwapRemoveAction = {
type: string,
data: {
sendAddress: string,
chargeCode: string,
},
};

View file

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