Browse Source

Create libcoreSyncAccount command

master
meriadec 7 years ago
parent
commit
b463e4bf53
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 37
      src/commands/libcoreSyncAccount.js

37
src/commands/libcoreSyncAccount.js

@ -0,0 +1,37 @@
// @flow
import type { AccountRaw } from '@ledgerhq/live-common/lib/types'
import { createCommand, Command } from 'helpers/ipc'
import { Observable } from 'rxjs'
import { syncAccount } from 'helpers/libcore'
type Input = {
rawAccount: AccountRaw,
}
type Result = AccountRaw
const cmd: Command<Input, Result> = createCommand(
'accounts',
'libcoreSyncAccount',
({ rawAccount }) =>
Observable.create(o => {
// TODO scanAccountsOnDevice should directly return a Observable so we just have to pass-in
syncAccount({ rawAccount }).then(
() => {
o.complete()
},
e => {
o.error(e)
},
)
function unsubscribe() {
// FIXME not implemented
}
return unsubscribe
}),
)
export default cmd
Loading…
Cancel
Save