Skip to content

Commit

Permalink
Upgrade core and exch-plugins
Browse files Browse the repository at this point in the history
edge-core-js to 2.0.0
edge-exchange-plugins to 2.0.0
  • Loading branch information
paullinator committed Jan 5, 2024
1 parent f7a86ca commit 93c95c9
Show file tree
Hide file tree
Showing 171 changed files with 1,041 additions and 795 deletions.
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ PODS:
- disklet (0.5.2):
- React
- DoubleConversion (1.1.6)
- edge-core-js (1.14.0):
- edge-core-js (2.0.0):
- React-Core
- edge-currency-accountbased (2.18.8):
- React-Core
- edge-exchange-plugins (1.3.0):
- edge-exchange-plugins (2.0.0):
- React-Core
- edge-login-ui-rn (2.20.0):
- React
Expand Down Expand Up @@ -1266,9 +1266,9 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
disklet: e7ed3e673ccad9d175a1675f9f3589ffbf69a5fd
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
edge-core-js: e13715f9addd8f181edec0306169bc172f41065c
edge-core-js: 9c9b75bf90e628968a9ae34cf8ee93a066b6be51
edge-currency-accountbased: 3b43dcfa1f97746bd537e48ef124b8929cdf2855
edge-exchange-plugins: 37158221eba37ad789238089f4ba2cb0ef8d24a4
edge-exchange-plugins: 81379538938c0767658cf693236e177dfdfe7f6e
edge-login-ui-rn: 7b78901664d8cb2dc41c76d1bd07c7e4cb77bd2a
EXApplication: d8f53a7eee90a870a75656280e8d4b85726ea903
EXConstants: f348da07e21b23d2b085e270d7b74f282df1a7d9
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@
"deepmerge": "^4.3.1",
"detect-bundler": "^1.1.0",
"disklet": "^0.5.2",
"edge-core-js": "^1.14.0",
"edge-core-js": "^2.0.0",
"edge-currency-accountbased": "^2.18.8",
"edge-currency-monero": "^1.1.1",
"edge-currency-plugins": "^2.5.1",
"edge-exchange-plugins": "^1.3.0",
"edge-exchange-plugins": "^2.0.0",
"edge-info-server": "^1.2.0",
"edge-login-ui-rn": "^2.20.0",
"ethers": "^5.7.2",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/components/BuyCrypto.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('BuyCrypto', () => {

const renderer = TestRenderer.create(
<FakeProviders initialState={mockState}>
<BuyCrypto wallet={fakeWallet} tokenId={undefined} navigation={fakeNavigation} />
<BuyCrypto wallet={fakeWallet} tokenId={null} navigation={fakeNavigation} />
</FakeProviders>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('WalletListRow', () => {

const renderer = TestRenderer.create(
<FakeProviders initialState={mockState}>
<CreateWalletSelectCryptoRow pluginId={pluginId} walletName={walletName} onPress={onPress} rightSide={rightSide} />
<CreateWalletSelectCryptoRow pluginId={pluginId} tokenId={null} walletName={walletName} onPress={onPress} rightSide={rightSide} />
</FakeProviders>
)

Expand Down
1 change: 0 additions & 1 deletion src/__tests__/components/TransactionListRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('TransactionListRow', () => {
<TransactionListRow
navigation={fakeNavigation}
wallet={fakeWallet}
currencyCode="BTC"
transaction={{
blockHeight: 10,
currencyCode: 'BTC',
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/components/TransactionListTop.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('TransactionListTop', () => {
}

const fakeWallet: any = {
balances: { BTC: '123123' },
balanceMap: new Map([[null, '123123']]),
blockHeight: 12345,
currencyConfig: fakeCurrencyConfig,
currencyInfo,
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('TransactionListTop', () => {
isEmpty={false}
navigation={fakeNavigation}
searching={false}
tokenId={undefined}
tokenId={null}
wallet={fakeWallet}
onSearchingChange={() => undefined}
onSearchTextChange={() => undefined}
Expand All @@ -89,7 +89,7 @@ describe('TransactionListTop', () => {
isEmpty={false}
navigation={fakeNavigation}
searching={false}
tokenId={undefined}
tokenId={null}
wallet={fakeWallet}
onSearchingChange={() => undefined}
onSearchTextChange={() => undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/components/WalletListSortableRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('WalletListSortableRow', () => {
const fakeWallet: any = {
currencyInfo: fakeCurrencyInfo,
name: 'Test wallet',
balances: {}
balanceMap: new Map()
}

const renderer = TestRenderer.create(
Expand Down
24 changes: 14 additions & 10 deletions src/__tests__/edgeProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ describe('upgradeExtendedCurrencyCodes', () => {
// As well, BSC is not an actual currencyCode so it won't be included either. BSC can only be specified using object
// params with pluginId = binancesmartchain
const result = upgradeExtendedCurrencyCodes(currencyConfig, undefined, ['BTC', 'ETH', 'MATIC', 'BNB', 'DOGE', 'BSC'])
expect(result).toEqual([{ pluginId: 'bitcoin' }, { pluginId: 'ethereum' }, { pluginId: 'dogecoin' }])
expect(result).toEqual([
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'ethereum', tokenId: null },
{ pluginId: 'dogecoin', tokenId: null }
])
})
test('single code tokens', () => {
const result = upgradeExtendedCurrencyCodes(currencyConfig, undefined, ['BTC', 'USDC', 'REP', 'USDT'])
expect(result).toEqual([
{ pluginId: 'bitcoin' },
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'ethereum', tokenId: 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' },
{ pluginId: 'ethereum', tokenId: '1985365e9f78359a9b6ad760e32412f4a445e862' },
{ pluginId: 'ethereum', tokenId: 'dac17f958d2ee523a2206206994597c13d831ec7' }
Expand All @@ -37,22 +41,22 @@ describe('upgradeExtendedCurrencyCodes', () => {
test('double code tokens', () => {
const result = upgradeExtendedCurrencyCodes(currencyConfig, undefined, ['BTC', 'MATIC-USDC', 'ETH-REP', 'ETH-USDT'])
expect(result).toEqual([
{ pluginId: 'bitcoin' },
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'polygon', tokenId: '2791bca1f2de4661ed88a30c99a7a9449aa84174' },
{ pluginId: 'ethereum', tokenId: '1985365e9f78359a9b6ad760e32412f4a445e862' },
{ pluginId: 'ethereum', tokenId: 'dac17f958d2ee523a2206206994597c13d831ec7' }
])
})
test('object list', () => {
const result = upgradeExtendedCurrencyCodes(currencyConfig, undefined, [
{ pluginId: 'bitcoin', tokenId: undefined, currencyCode: undefined },
{ pluginId: 'polygon', tokenId: undefined, currencyCode: 'USDC' },
{ pluginId: 'ethereum', tokenId: undefined, currencyCode: 'REP' },
{ pluginId: 'ethereum', tokenId: undefined, currencyCode: 'USDT' },
{ pluginId: 'ethereum', tokenId: undefined, currencyCode: 'MATIC' }
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'polygon', currencyCode: 'USDC' },
{ pluginId: 'ethereum', currencyCode: 'REP' },
{ pluginId: 'ethereum', currencyCode: 'USDT' },
{ pluginId: 'ethereum', currencyCode: 'MATIC' }
])
expect(result).toEqual([
{ pluginId: 'bitcoin' },
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'polygon', tokenId: '2791bca1f2de4661ed88a30c99a7a9449aa84174' },
{ pluginId: 'ethereum', tokenId: '1985365e9f78359a9b6ad760e32412f4a445e862' },
{ pluginId: 'ethereum', tokenId: 'dac17f958d2ee523a2206206994597c13d831ec7' },
Expand All @@ -66,7 +70,7 @@ describe('upgradeExtendedCurrencyCodes', () => {
['BTC', 'USDC', 'REP', 'USDTERC20']
)
expect(result).toEqual([
{ pluginId: 'bitcoin' },
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'ethereum', tokenId: 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' },
{ pluginId: 'ethereum', tokenId: '1985365e9f78359a9b6ad760e32412f4a445e862' },
{ pluginId: 'ethereum', tokenId: 'dac17f958d2ee523a2206206994597c13d831ec7' }
Expand Down
18 changes: 12 additions & 6 deletions src/__tests__/modals/WalletListModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,30 @@ describe('WalletListModal', () => {

it("Should upgrade currency codes to token ID's", () => {
const data: { [code: string]: EdgeAsset[] } = {
ETH: [{ pluginId: 'ethereum' }],
BNB: [{ pluginId: 'binance' }, { pluginId: 'ethereum', tokenId: '1234abcd' }]
ETH: [{ pluginId: 'ethereum', tokenId: null }],
BNB: [
{ pluginId: 'binance', tokenId: null },
{ pluginId: 'ethereum', tokenId: '1234abcd' }
]
}
function lookup(currencyCode: string): EdgeAsset[] {
return data[currencyCode.toUpperCase()] ?? []
}

// Check ambiguous currency codes:
expect(upgradeCurrencyCodes(lookup, ['ETH', 'BNB'])).toEqual([
{ pluginId: 'ethereum' },
{ pluginId: 'binance' },
{ pluginId: 'ethereum', tokenId: null },
{ pluginId: 'binance', tokenId: null },
{ pluginId: 'ethereum', tokenId: '1234abcd' }
])

// Check scoped currency codes:
expect(upgradeCurrencyCodes(lookup, ['ETH', 'ETH-BNB'])).toEqual([{ pluginId: 'ethereum' }, { pluginId: 'ethereum', tokenId: '1234abcd' }])
expect(upgradeCurrencyCodes(lookup, ['ETH', 'ETH-BNB'])).toEqual([
{ pluginId: 'ethereum', tokenId: null },
{ pluginId: 'ethereum', tokenId: '1234abcd' }
])

// Check missing currency codes:
expect(upgradeCurrencyCodes(lookup, ['ETH', 'LOL'])).toEqual([{ pluginId: 'ethereum' }])
expect(upgradeCurrencyCodes(lookup, ['ETH', 'LOL'])).toEqual([{ pluginId: 'ethereum', tokenId: null }])
})
})
4 changes: 2 additions & 2 deletions src/__tests__/reducers/__snapshots__/RootReducer.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports[`initialState 1`] = `
"multiplier": "1",
"name": "",
},
"tokenId": undefined,
"tokenId": null,
"walletId": "",
},
"genericShapeShiftError": null,
Expand All @@ -70,7 +70,7 @@ exports[`initialState 1`] = `
"multiplier": "1",
"name": "",
},
"tokenId": undefined,
"tokenId": null,
"walletId": "",
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`initialState 1`] = `
"multiplier": "1",
"name": "",
},
"tokenId": undefined,
"tokenId": null,
"walletId": "",
},
"genericShapeShiftError": null,
Expand All @@ -40,7 +40,7 @@ exports[`initialState 1`] = `
"multiplier": "1",
"name": "",
},
"tokenId": undefined,
"tokenId": null,
"walletId": "",
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('CreateWalletAccountSelect', () => {
selectedWalletType: {
currencyName: 'bitcoin',
walletType: 'wallet:bitcoin',
pluginId: 'bitcoin',
currencyCode: 'BTC'
} as any,
isReactivation: true,
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/scenes/CreateWalletImportScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('CreateWalletImportScene', () => {
currencyCode: 'BTC',
displayName: 'Bitcoin',
pluginId: 'bitcoin',
tokenId: null,
walletType: 'wallet:bitcoin-bip49'
}
],
Expand Down
10 changes: 9 additions & 1 deletion src/__tests__/scenes/CreateWalletSelectFiatScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ describe('CreateWalletSelectFiatComponent', () => {
currencyCode: 'BTC',
displayName: 'Bitcoin (no Segwit)',
pluginId: 'bitcoin',
tokenId: null,
walletType: 'wallet:bitcoin-bip44'
},
{ key: 'create-wallet:ethereum-ethereum', currencyCode: 'ETH', displayName: 'Ethereum', pluginId: 'ethereum', walletType: 'wallet:ethereum' },
{
key: 'create-wallet:ethereum-ethereum',
currencyCode: 'ETH',
displayName: 'Ethereum',
pluginId: 'ethereum',
tokenId: null,
walletType: 'wallet:ethereum'
},
{
key: 'create-ethereum-9992ec3cf6a55b00978cddf2b27bc6882d88d1ec',
currencyCode: 'POLY',
Expand Down
3 changes: 2 additions & 1 deletion src/__tests__/scenes/CryptoExchangeScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ describe('CryptoExchangeComponent', () => {
account={fakeAccount}
exchangeInfo={initialState}
fromWalletId=""
fromWalletBalances={[''] as any}
fromTokenId={null}
fromWalletBalanceMap={new Map()}
fromWalletName="BTC Wallet"
fromExchangeAmount="1000"
fromWalletPrimaryInfo={
Expand Down
6 changes: 2 additions & 4 deletions src/__tests__/scenes/RequestScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('Request', () => {
const actual = renderer.render(
<RequestSceneComponent
{...fakeSceneProps('request', {})}
account={null as any}
isConnected={false}
currencyCode={null as any}
wallet={null as any}
Expand All @@ -35,18 +34,17 @@ describe('Request', () => {

const fakeWallet: any = {
currencyInfo: { pluginId: 'bitcoin', displayName: 'Bitcoin' },
balances: { BTC: '1234' }
balanceMap: new Map([[null, '1234']])
}

const actual = renderer.render(
<RequestSceneComponent
{...fakeSceneProps('request', {})}
account={null as any}
isConnected={false}
currencyCode="BTC"
wallet={fakeWallet}
exchangeSecondaryToPrimaryRatio={{} as any}
primaryCurrencyInfo={{ displayDenomination: { multiplier: '100000000' }, exchangeDenomination: { multiplier: '100000000' } } as any}
primaryCurrencyInfo={{ tokenId: null, displayDenomination: { multiplier: '100000000' }, exchangeDenomination: { multiplier: '100000000' } } as any}
theme={getTheme()}
refreshAllFioAddresses={async () => {}}
onSelectWallet={async (walletId, currencyCode) => {}}
Expand Down
11 changes: 11 additions & 0 deletions src/__tests__/scenes/SendScene2.ui.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ describe('SendScene2', () => {
<SendScene2
{...fakeSceneProps('send2', {
walletId: btcWallet.id,
tokenId: null,
doCheckAndShowGetCryptoModal: false
})}
/>
Expand All @@ -107,7 +108,9 @@ describe('SendScene2', () => {
<SendScene2
{...fakeSceneProps('send2', {
walletId: btcWallet.id,
tokenId: null,
spendInfo: {
tokenId: null,
spendTargets: [{ publicAddress: 'some pub address', nativeAmount: '1234' }]
},
doCheckAndShowGetCryptoModal: false
Expand All @@ -133,7 +136,9 @@ describe('SendScene2', () => {
{ label: 'info tile label 2', value: 'info tile value 2' }
],
walletId: btcWallet.id,
tokenId: null,
spendInfo: {
tokenId: null,
spendTargets: [{ publicAddress: 'some pub address', nativeAmount: '1234' }]
},
doCheckAndShowGetCryptoModal: false
Expand All @@ -155,7 +160,9 @@ describe('SendScene2', () => {
<SendScene2
{...fakeSceneProps('send2', {
walletId: btcWallet.id,
tokenId: null,
spendInfo: {
tokenId: null,
spendTargets: [
{ publicAddress: 'some pub address', nativeAmount: '1234' },
{ publicAddress: 'some pub address 2', nativeAmount: '12345' }
Expand All @@ -179,7 +186,9 @@ describe('SendScene2', () => {
const params: SendScene2Params = {
hiddenFeaturesMap: { address: true },
walletId: btcWallet.id,
tokenId: null,
spendInfo: {
tokenId: null,
spendTargets: [
{ publicAddress: 'some pub address', nativeAmount: '1234' },
{ publicAddress: 'some pub address 2', nativeAmount: '12345' }
Expand Down Expand Up @@ -222,7 +231,9 @@ describe('SendScene2', () => {
const params: SendScene2Params = {
lockTilesMap: { address: true },
walletId: btcWallet.id,
tokenId: null,
spendInfo: {
tokenId: null,
spendTargets: [
{ publicAddress: 'some pub address', nativeAmount: '1234' },
{ publicAddress: 'some pub address 2', nativeAmount: '12345' }
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/scenes/TransactionDetailsScene.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const fakeCurrencyConfig: any = {
}

const fakeCoreWallet: any = {
balances: { BTC: '123123' },
balanceMap: new Map([[null, '123123']]),
blockHeight: 12345,
currencyConfig: fakeCurrencyConfig,
currencyInfo,
Expand Down
Loading

0 comments on commit 93c95c9

Please sign in to comment.