Skip to content

Commit 3dbada6

Browse files
authored
Merge pull request #657 from EdgeApp/sam/ecs-updates
Extend onSubscribeAddresses to include checkpoints
2 parents 537451a + 6f31268 commit 3dbada6

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- changed: Extended `onSubscribeAddresses` callback to optionally include checkpoints.
56
- fixed: Disabling pin-login while in duress mode disables pin-login for the main login.
67
- fixed: `loginWithPassword` bug disabled duress mode when doing an online login.
78
- fixed: Properly fake duress mode settings while in duress mode.

src/core/currency/wallet/currency-wallet-callbacks.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,27 @@ export function makeCurrencyWalletCallbacks(
291291
})
292292
},
293293

294-
onSubscribeAddresses(addresses: string[]) {
294+
onSubscribeAddresses(
295+
paramsOrAddresses:
296+
| Array<{ address: string; checkpoint?: string }>
297+
| string[]
298+
) {
299+
const params = paramsOrAddresses.map(param =>
300+
typeof param === 'string'
301+
? {
302+
address: param,
303+
checkpoint: undefined
304+
}
305+
: param
306+
)
295307
const changeServiceSubscriptions =
296308
input.props.state.currency.wallets[walletId].changeServiceSubscriptions
297309
const subscriptions: ChangeServiceSubscription[] = [
298310
...changeServiceSubscriptions,
299-
...addresses.map(address => ({
311+
...params.map(({ address, checkpoint }) => ({
300312
address,
301-
status: 'subscribing' as const
313+
status: 'subscribing' as const,
314+
checkpoint
302315
}))
303316
]
304317
// TODO: We currently have no way to remove addresses from this list.

src/types/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,12 @@ export interface EdgeCurrencyEngineCallbacks {
918918
readonly onNewTokens: (tokenIds: string[]) => void
919919
readonly onSeenTxCheckpoint: (checkpoint: string) => void
920920
readonly onStakingStatusChanged: (status: EdgeStakingStatus) => void
921-
readonly onSubscribeAddresses: (addresses: string[]) => void
921+
readonly onSubscribeAddresses: (
922+
paramsOrAddresses:
923+
| Array<{ address: string; checkpoint?: string }>
924+
/** @deprecated Use the array of param objects instead. */
925+
| string[]
926+
) => void
922927
readonly onTokenBalanceChanged: (
923928
tokenId: EdgeTokenId,
924929
balance: string

0 commit comments

Comments
 (0)