Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"request": {
"method": "POST",
"url": "https://rates3.edge.app/v3/rates",
"body": "{\"targetFiat\":\"USD\",\"crypto\":[{\"isoDate\":\"2022-06-01T04:00:00.000Z\",\"asset\":{\"pluginId\":\"bitcoin\",\"tokenId\":null}},{\"isoDate\":\"2022-06-02T04:00:00.000Z\",\"asset\":{\"pluginId\":\"ethereum\",\"tokenId\":null}},{\"isoDate\":\"2022-06-03T04:00:00.000Z\",\"asset\":{\"pluginId\":\"monero\",\"tokenId\":null}},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"asset\":{\"pluginId\":\"bitcoin\",\"tokenId\":null}},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"asset\":{\"pluginId\":\"dogecoin\",\"tokenId\":null}}],\"fiat\":[{\"isoDate\":\"2022-06-01T04:00:00.000Z\",\"fiatCode\":\"USD\"},{\"isoDate\":\"2022-06-02T04:00:00.000Z\",\"fiatCode\":\"USD\"},{\"isoDate\":\"2022-06-03T04:00:00.000Z\",\"fiatCode\":\"EUR\"},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"fiatCode\":\"PHP\"},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"fiatCode\":\"MXN\"}]}",
"headers": [
[
"accept",
"*/*"
],
[
"accept-encoding",
"gzip,deflate"
],
[
"connection",
"close"
],
[
"content-length",
"746"
],
[
"content-type",
"application/json"
],
[
"host",
"127.0.0.1:8087"
],
[
"user-agent",
"node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
]
],
"cookies": []
},
"response": {
"status": 200,
"statusText": "OK",
"body": "{\"targetFiat\":\"USD\",\"crypto\":[{\"isoDate\":\"2022-06-01T04:00:00.000Z\",\"asset\":{\"pluginId\":\"bitcoin\"},\"rate\":31865.749621173167},{\"isoDate\":\"2022-06-02T04:00:00.000Z\",\"asset\":{\"pluginId\":\"ethereum\"},\"rate\":1828.8926546074292},{\"isoDate\":\"2022-06-03T04:00:00.000Z\",\"asset\":{\"pluginId\":\"monero\"},\"rate\":193.59642765955266},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"asset\":{\"pluginId\":\"bitcoin\"},\"rate\":29836.29247906769},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"asset\":{\"pluginId\":\"dogecoin\"},\"rate\":0.08186741002113526}],\"fiat\":[{\"isoDate\":\"2022-06-01T04:00:00.000Z\",\"fiatCode\":\"USD\",\"rate\":1},{\"isoDate\":\"2022-06-02T04:00:00.000Z\",\"fiatCode\":\"USD\",\"rate\":1},{\"isoDate\":\"2022-06-03T04:00:00.000Z\",\"fiatCode\":\"EUR\",\"rate\":1.071983},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"fiatCode\":\"PHP\",\"rate\":0.0189},{\"isoDate\":\"2022-06-04T04:00:00.000Z\",\"fiatCode\":\"MXN\",\"rate\":0.051164}]}",
"headers": [
[
"connection",
"close"
],
[
"content-length",
"865"
],
[
"content-type",
"application/json; charset=utf-8"
],
[
"date",
"Fri, 15 Aug 2025 06:17:36 GMT"
],
[
"etag",
"W/\"361-NyuozaijAY3BRKA3B5FAo6hJHXM\""
],
[
"x-powered-by",
"Express"
]
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ exports[`ExchangeQuote should render with loading props 1`] = `
]
}
>
0.00000001 BTC (<0.01 EUR)
0 BTC (<0.01 EUR)
</Text>
</View>
</View>
Expand Down
106 changes: 64 additions & 42 deletions src/__tests__/exchangeRates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
closestRateForTimestamp,
type ExchangeRateCache
} from '../actions/ExchangeRateActions'
import { getHistoricalRate } from '../util/exchangeRates'
import { getHistoricalCryptoRate } from '../util/exchangeRates'
import { mswServer } from '../util/mswServer'
import { snooze } from '../util/utils'

Expand All @@ -29,138 +29,160 @@ it('get bulk rates', async () => {
// async function main(): Promise<void> {
const promises: Array<Promise<unknown>> = []
promises.push(
getHistoricalRate(
'BTC_iso:USD',
getHistoricalCryptoRate(
'bitcoin',
null,
'iso:USD',
'2022-06-01T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`31616 === ${Math.floor(v)}`)
expect(31616).toEqual(Math.floor(v))
console.log(`31865 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(31865)
})
)

promises.push(
getHistoricalRate(
'ETH_iso:USD',
getHistoricalCryptoRate(
'ethereum',
null,
'iso:USD',
'2022-06-02T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1814 === ${Math.floor(v)}`)
expect(1814).toEqual(Math.floor(v))
console.log(`1828 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(1828)
})
)

promises.push(
getHistoricalRate(
'XMR_iso:EUR',
getHistoricalCryptoRate(
'monero',
null,
'iso:EUR',
'2022-06-03T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`184 === ${Math.floor(v)}`)
expect(184).toEqual(Math.floor(v))
console.log(`180 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(180)
})
)

promises.push(
getHistoricalRate(
'BTC_iso:PHP',
getHistoricalCryptoRate(
'bitcoin',
null,
'iso:PHP',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1553326 === ${Math.floor(v)}`)
expect(1553326).toEqual(Math.floor(v))
console.log(`1578639 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(1578639)
})
)

promises.push(
getHistoricalRate(
'DOGE_iso:MXN',
getHistoricalCryptoRate(
'dogecoin',
null,
'iso:MXN',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1 === ${Math.floor(v)}`)
expect(1).toEqual(Math.floor(v))
expect(Math.floor(v)).toEqual(1)
})
)

await snooze(2000)

promises.push(
getHistoricalRate(
'BTC_iso:PHP',
getHistoricalCryptoRate(
'bitcoin',
null,
'iso:PHP',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1553326 === ${Math.floor(v)}`)
expect(1553326).toEqual(Math.floor(v))
console.log(`1578639 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(1578639)
})
)

promises.push(
getHistoricalRate(
'DOGE_iso:MXN',
getHistoricalCryptoRate(
'dogecoin',
null,
'iso:MXN',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1 === ${Math.floor(v)}`)
expect(1).toEqual(Math.floor(v))
expect(Math.floor(v)).toEqual(1)
})
)

await snooze(1000)

promises.push(
getHistoricalRate(
'ETH_iso:USD',
getHistoricalCryptoRate(
'ethereum',
null,
'iso:USD',
'2022-06-02T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1814 === ${Math.floor(v)}`)
expect(1814).toEqual(Math.floor(v))
console.log(`1828 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(1828)
})
)

promises.push(
getHistoricalRate(
'XMR_iso:EUR',
getHistoricalCryptoRate(
'monero',
null,
'iso:EUR',
'2022-06-03T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`184 === ${Math.floor(v)}`)
expect(184).toEqual(Math.floor(v))
console.log(`180 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(180)
})
)

promises.push(
getHistoricalRate(
'BTC_iso:PHP',
getHistoricalCryptoRate(
'bitcoin',
null,
'iso:PHP',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1553326 === ${Math.floor(v)}`)
expect(1553326).toEqual(Math.floor(v))
console.log(`1578639 === ${Math.floor(v)}`)
expect(Math.floor(v)).toEqual(1578639)
})
)

promises.push(
getHistoricalRate(
'DOGE_iso:MXN',
getHistoricalCryptoRate(
'dogecoin',
null,
'iso:MXN',
'2022-06-04T04:00:00.000Z',
TEST_MAX_QUERY_SIZE,
fetch
).then(v => {
console.log(`1 === ${Math.floor(v)}`)
expect(1).toEqual(Math.floor(v))
expect(Math.floor(v)).toEqual(1)
})
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
]
}
>
0.00000001 BTC (&lt;0.01 EUR)
0 BTC (&lt;0.01 EUR)
</Text>
</View>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -984,28 +984,7 @@ exports[`TransactionDetailsScene should render 1`] = `
]
}
>
1230.00
</Text>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"color": "#77C513",
},
null,
]
}
>
(0%)
0.00
</Text>
</View>
</View>
Expand Down Expand Up @@ -3812,7 +3791,7 @@ exports[`TransactionDetailsScene should render with negative nativeAmount and fi
]
}
>
1230.00
0.00
</Text>
<Text
adjustsFontSizeToFit={true}
Expand All @@ -3833,7 +3812,7 @@ exports[`TransactionDetailsScene should render with negative nativeAmount and fi
]
}
>
(-80.75%)
(-,100%)
</Text>
</View>
</View>
Expand Down
Loading
Loading