Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
peachbits committed Jan 13, 2023
2 parents 51cae64 + 21528e7 commit 4564a86
Show file tree
Hide file tree
Showing 44 changed files with 717 additions and 512 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# edge-react-gui

## 3.1.0 (2023-01-13)

- Add Bech32 address support
- Add support for non-segwit DGB and LTC
- Thorchain Savers: Show estimate fees and estimate break-even time
- Show current APR on Earn button
- Split swap providers into centralized and decentralized (DEX) groups
- Allow user to prefer provider type
- Show error when attempting to unstake small (lower than tx fee) amounts
- Show staked amounts to the wallet transaction history scene
- Add shortcut to Exchange Settings by tapping on Powered By logo
- Deprecate Wyre
- Upgrade edge-core-js to v0.19.37
- added: Always-enabled tokens. The currency engine checks these for balances and transactions, but they do not appear in the per-wallet enabled token lists.
- EdgeCurrencyConfig.alwaysEnabledTokenIds
- EdgeCurrencyConfig.changeAlwaysEnabledTokenIds
- added: EdgeCurrencyTools.checkPublicKey, which provides a mechanism for currency plugins to refresh their cached public keys if necessary.
- added: EdgeSwapInfo.isDex and EdgeSwapRequestOptions.preferType, to always prefer DEX swaps over centralized swaps.
- changed: Always select the "transfer" plugin if it returns a quote, regardless of price.
- added: Accelerate Transaction API
- Upgrade edge-currency-plugins to v1.3.5
- Fixed: Incorrect types path in package.json
- Added: Support bech32 addresses as segwitAddress for EdgeFreshAddress
- Added: RBF flags for Bitcoin and Litecoin
- Upgrade edge-exchange-plugins to v0.16.17
- Add: isDex and swapPlugType to plugins and quotes

## 3.0.0 (2023-01-06)

- Updated dark mode theme:
Expand Down
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PODS:
- disklet (0.5.2):
- React
- DoubleConversion (1.1.6)
- edge-core-js (0.19.35):
- edge-core-js (0.19.37):
- React-Core
- edge-login-ui-rn (0.10.17):
- React
Expand Down Expand Up @@ -1054,7 +1054,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
disklet: e7ed3e673ccad9d175a1675f9f3589ffbf69a5fd
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
edge-core-js: 09f9923bd19525fad89189786a1552f4e1cd4ed6
edge-core-js: 64ce764c9466db018b22ce103998081bcb75537a
edge-login-ui-rn: b61a9e79902bf149e274f7d27bf8c359e6d89072
FBLazyVector: d2db9d00883282819d03bbd401b2ad4360d47580
FBReactNativeSpec: 94da4d84ba3b1acf459103320882daa481a2b62d
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "edge-react-gui",
"version": "3.0.0",
"version": "3.1.0",
"private": true,
"description": "Edge Wallet React GUI",
"homepage": "https://edge.app",
Expand Down Expand Up @@ -106,11 +106,11 @@
"dateformat": "^3.0.3",
"detect-bundler": "^1.1.0",
"disklet": "^0.5.2",
"edge-core-js": "^0.19.35",
"edge-core-js": "^0.19.37",
"edge-currency-accountbased": "^0.21.0",
"edge-currency-monero": "^0.5.4",
"edge-currency-plugins": "^1.3.3",
"edge-exchange-plugins": "^0.16.16",
"edge-currency-plugins": "^1.3.5",
"edge-exchange-plugins": "^0.16.17",
"edge-login-ui-rn": "^0.10.17",
"edge-plugin-bity": "https://github.com/EdgeApp/edge-plugin-bity.git#2a52e6cb86512b98f69f8f5dd3105cdf6d0c2d8a",
"edge-plugin-simplex": "https://github.com/EdgeApp/edge-plugin-simplex.git#b11def82d84f2735b91f4b8104a9e0d3e8c3600d",
Expand Down
38 changes: 0 additions & 38 deletions src/__tests__/__snapshots__/GuiPlugins.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -181,25 +181,6 @@ Settlement: 10 - 30 minutes",
"pluginId": "creditcard",
"title": "Credit and Debit Card",
},
Object {
"cryptoCodes": Array [
"BTC",
"ETH",
"DAI",
"USDC",
],
"deepPath": "",
"deepQuery": Object {},
"description": "Fee: 1-2%
Settlement: 1 - 5 days",
"partnerIconPath": "wyre-logo-square-small.png",
"paymentTypeLogoKey": "bank",
"paymentTypes": Array [
"bank",
],
"pluginId": "wyre",
"title": "ACH (deprecated)",
},
Object {
"cryptoCodes": Array [
"BTC",
Expand Down Expand Up @@ -254,25 +235,6 @@ Array [
"pluginId": "moonpay",
"title": "ACH Bank Transfer",
},
Object {
"cryptoCodes": Array [
"BTC",
"ETH",
"DAI",
"USDC",
],
"deepPath": "",
"deepQuery": Object {},
"description": "Fee: 1% / Settlement: 1 - 5 days
Monthly Limit: $150000",
"partnerIconPath": "wyre-logo-square-small.png",
"paymentTypeLogoKey": "bank",
"paymentTypes": Array [
"bank",
],
"pluginId": "wyre",
"title": "ACH (deprecated)",
},
Object {
"cryptoCodes": Array [
"BTC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ Object {
"fioAddressesLoading": false,
"fioDomains": Array [],
},
"requestType": Object {
"uniqueLegacyAddress": false,
"useLegacyAddress": false,
},
"sendConfirmation": Object {
"address": "",
"authRequired": "none",
Expand Down Expand Up @@ -228,6 +224,7 @@ Object {
},
"pinLoginEnabled": false,
"preferredSwapPluginId": "",
"preferredSwapPluginType": undefined,
"spamFilterOn": true,
"spendingLimits": Object {
"transaction": Object {
Expand Down
13 changes: 0 additions & 13 deletions src/__tests__/reducers/requestTypeReducer.test.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/__tests__/reducers/scenesReducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ test('initialState', () => {
fioAddressesLoading: false,
fioDomains: []
},
requestType: {
useLegacyAddress: false,
uniqueLegacyAddress: false
},
sendConfirmation: SendConfirmationInitialState,
transactionDetails: {
subcategories: []
Expand Down
10 changes: 10 additions & 0 deletions src/__tests__/scenes/CryptoExchangeQuoteScene.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { describe, expect, it } from '@jest/globals'
import { EdgeSwapInfo } from 'edge-core-js'
import * as React from 'react'
import { createRenderer } from 'react-test-renderer/shallow'

import { CryptoExchangeQuoteScreenComponent } from '../../components/scenes/CryptoExchangeQuoteScene'
import { getTheme } from '../../components/services/ThemeContext'
import { GuiSwapInfo } from '../../types/types'
import { fakeNavigation } from '../../util/fake/fakeNavigation'

const dummySwapInfo: EdgeSwapInfo = {
pluginId: '',
displayName: '',
supportEmail: ''
}

describe('CryptoExchangeQuoteScreenComponent', () => {
it('should render with loading props', () => {
Expand Down Expand Up @@ -36,6 +44,7 @@ describe('CryptoExchangeQuoteScreenComponent', () => {

const swapInfo: GuiSwapInfo = {
quote: {
swapInfo: dummySwapInfo,
request: fakeRequest,
isEstimate: true,
fromNativeAmount: '10000',
Expand Down Expand Up @@ -80,6 +89,7 @@ describe('CryptoExchangeQuoteScreenComponent', () => {

const actual = renderer.render(
<CryptoExchangeQuoteScreenComponent
navigation={fakeNavigation}
route={{
name: 'exchangeQuote',
params: { swapInfo, onApprove: () => undefined }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { createRenderer } from 'react-test-renderer/shallow'

import { RequestComponent } from '../../components/scenes/RequestScene'
import { RequestSceneComponent } from '../../components/scenes/RequestScene'
import { getTheme } from '../../components/services/ThemeContext'
import { fakeNavigation } from '../../util/fake/fakeNavigation'

Expand All @@ -11,15 +11,14 @@ describe('Request', () => {
const renderer = createRenderer()

const actual = renderer.render(
<RequestComponent
<RequestSceneComponent
navigation={fakeNavigation}
isConnected={false}
currencyCode={null as any}
wallet={null as any}
exchangeSecondaryToPrimaryRatio={null as any}
primaryCurrencyInfo={null as any}
secondaryCurrencyInfo={null as any}
useLegacyAddress={null as any}
theme={getTheme()}
refreshAllFioAddresses={() => undefined}
onSelectWallet={(walletId, currencyCode) => undefined}
Expand All @@ -38,15 +37,14 @@ describe('Request', () => {
}

const actual = renderer.render(
<RequestComponent
<RequestSceneComponent
navigation={fakeNavigation}
isConnected={false}
currencyCode="BTC"
wallet={fakeWallet}
exchangeSecondaryToPrimaryRatio={{} as any}
primaryCurrencyInfo={{ displayDenomination: { multiplier: '100000000' }, exchangeDenomination: { multiplier: '100000000' } } as any}
secondaryCurrencyInfo={{} as any}
useLegacyAddress={false}
theme={getTheme()}
refreshAllFioAddresses={() => undefined}
onSelectWallet={(walletId, currencyCode) => undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ exports[`CryptoExchangeQuoteScreenComponent should render with loading props 1`]
fiatCurrencyCode="USD"
walletName=""
/>
<View
<TouchableOpacity
onPress={[Function]}
style={
Object {
"alignItems": "center",
Expand Down Expand Up @@ -92,7 +93,13 @@ exports[`CryptoExchangeQuoteScreenComponent should render with loading props 1`]
>
ChangeNow
</WithTheme(EdgeTextComponent)>
</View>
<Icon
allowFontScaling={false}
color="#00f1a2"
name="chevron-forward"
size={22}
/>
</TouchableOpacity>
<Alert
marginRem={
Array [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ exports[`Request should render with loaded props 1`] = `
</TouchableOpacity>
</View>
</InputAccessoryView>
<QrCode
onPress={[Function]}
<Carousel
items={Array []}
keyExtractor={[Function]}
onChangeItem={[Function]}
renderItem={[Function]}
/>
<TouchableOpacity
onPress={[Function]}
Expand All @@ -179,7 +182,7 @@ exports[`Request should render with loaded props 1`] = `
}
>
<WithTheme(EdgeTextComponent)>
Your Receiving Wallet Address
Your Wallet Address
</WithTheme(EdgeTextComponent)>
<Icon
allowFontScaling={false}
Expand All @@ -195,7 +198,7 @@ exports[`Request should render with loaded props 1`] = `
}
}
>
Loading…
</WithTheme(EdgeTextComponent)>
</TouchableOpacity>
</View>
Expand Down
2 changes: 2 additions & 0 deletions src/actions/CryptoExchangeActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export function exchangeMax(): ThunkAction<Promise<void>> {

async function fetchSwapQuote(state: RootState, request: EdgeSwapRequest): Promise<GuiSwapInfo> {
const { account } = state.core
const { preferredSwapPluginType } = state.ui.settings

// Find preferred swap provider:
const activePlugins = bestOfPlugins(state.account.referralCache.accountPlugins, state.account.accountReferral, state.ui.settings.preferredSwapPluginId)
Expand All @@ -181,6 +182,7 @@ async function fetchSwapQuote(state: RootState, request: EdgeSwapRequest): Promi
// Get the quote:
const quote: EdgeSwapQuote = await account.fetchSwapQuote(request, {
preferPluginId,
preferType: preferredSwapPluginType,
disabled: activePlugins.disabled,
promoCodes: activePlugins.promoCodes
})
Expand Down
1 change: 1 addition & 0 deletions src/actions/LoginActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export function initializeAccount(account: EdgeAccount, touchIdInfo: GuiTouchIdI
passwordReminder: passwordReminderInitialState,
pinLoginEnabled: false,
preferredSwapPluginId: undefined,
preferredSwapPluginType: undefined,
spendingLimits: { transaction: { isEnabled: false, amount: 0 } },
touchIdInfo,
walletId: '',
Expand Down
18 changes: 17 additions & 1 deletion src/actions/SettingsActions.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EdgeAccount, EdgeDenomination } from 'edge-core-js'
import { EdgeAccount, EdgeDenomination, EdgeSwapPluginType } from 'edge-core-js'
import { disableTouchId, enableTouchId } from 'edge-login-ui-rn'
import * as React from 'react'

Expand All @@ -11,6 +11,7 @@ import {
setDenominationKeyRequest as setDenominationKeyRequestAccountSettings,
setDeveloperModeOn as setDeveloperModeOnAccountSettings,
setPreferredSwapPluginId as setPreferredSwapPluginIdAccountSettings,
setPreferredSwapPluginType as setPreferredSwapPluginTypeAccountSettings,
setSpamFilterOn as setSpamFilterOnAccountSettings,
setSpendingLimits as setSpendingLimitsAccountSettings
} from '../modules/Core/Account/settings'
Expand Down Expand Up @@ -118,6 +119,21 @@ export function setPreferredSwapPluginId(pluginId: string | undefined): ThunkAct
}
}

export function setPreferredSwapPluginType(swapPluginType: EdgeSwapPluginType | undefined): ThunkAction<void> {
return (dispatch, getState) => {
const state = getState()
const { account } = state.core
setPreferredSwapPluginTypeAccountSettings(account, swapPluginType)
.then(() =>
dispatch({
type: 'UI/SETTINGS/SET_PREFERRED_SWAP_PLUGIN_TYPE',
data: swapPluginType
})
)
.catch(showError)
}
}

// Denominations
export function setDenominationKeyRequest(pluginId: string, currencyCode: string, denomination: EdgeDenomination): ThunkAction<Promise<unknown>> {
return async (dispatch, getState) => {
Expand Down
3 changes: 0 additions & 3 deletions src/actions/WalletActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ export function selectWallet(walletId: string, currencyCode: string, alwaysActiv
type: 'UI/WALLETS/SELECT_WALLET',
data: { walletId, currencyCode }
})
const wallet: EdgeCurrencyWallet = currencyWallets[walletId]
const receiveAddress = await wallet.getReceiveAddress({ currencyCode })
dispatch({ type: 'NEW_RECEIVE_ADDRESS', data: { receiveAddress } })
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Main.ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import { NotificationScene } from './scenes/NotificationScene'
import { OtpRepairScene } from './scenes/OtpRepairScene'
import { OtpSettingsScene } from './scenes/OtpSettingsScene'
import { ChangeRecoveryScene } from './scenes/PasswordRecoveryScene'
import { Request } from './scenes/RequestScene'
import { RequestScene } from './scenes/RequestScene'
import { SecurityAlertsScene } from './scenes/SecurityAlertsScene'
import { SendScene } from './scenes/SendScene'
import { SendScene2 } from './scenes/SendScene2'
Expand Down Expand Up @@ -484,7 +484,7 @@ export class MainComponent extends React.Component<Props> {
<Stack key="request" hideTabBar>
<Scene
key="request"
component={withNavigation(ifLoggedIn(Request))}
component={withNavigation(ifLoggedIn(RequestScene))}
navTransparent
// @ts-expect-error
renderLeftButton={<BackButton onPress={this.handleBack} />}
Expand Down
Loading

0 comments on commit 4564a86

Please sign in to comment.