diff --git a/raiden-ts/CHANGELOG.md b/raiden-ts/CHANGELOG.md index 7281a23cfc..56e039c38b 100644 --- a/raiden-ts/CHANGELOG.md +++ b/raiden-ts/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] ### Added +- [#614] Implement state upgrades and migration - [#613] Implement waiting for confirmation blocks on on-chain transactions (configurable) ### Changed diff --git a/raiden-ts/src/index.ts b/raiden-ts/src/index.ts index d4f4ed7f81..1f242c3e67 100644 --- a/raiden-ts/src/index.ts +++ b/raiden-ts/src/index.ts @@ -1,6 +1,6 @@ /* istanbul ignore file */ export { Raiden } from './raiden'; -export { RaidenState } from './state'; +export { RaidenState, encodeRaidenState } from './state'; export { RaidenEvent, RaidenAction } from './actions'; export { ShutdownReason } from './constants'; export { RaidenSentTransfer, RaidenSentTransferStatus } from './transfers/state'; diff --git a/raiden-ts/src/raiden.ts b/raiden-ts/src/raiden.ts index 2c97e629b1..e4950c186d 100644 --- a/raiden-ts/src/raiden.ts +++ b/raiden-ts/src/raiden.ts @@ -262,9 +262,9 @@ export class Raiden { *
  • number index of a remote account loaded in provider * (e.g. 0 for Metamask's loaded account)
  • * - * @param storageOrState - Storage/localStorage-like synchronous object where to load and store - * current state or initial RaidenState-like object instead. In this case, user must listen - * state$ changes and update them on whichever persistency option is used + * @param storageOrState - Storage/localStorage-like object from where to load and store current + * state, initial RaidenState-like object, or a { storage; state? } object containing both. + * If a storage isn't provided, user must listen state$ changes on ensure it's persisted. * @param contracts - Contracts deployment info * @param config - Raiden configuration * @param subkey - Whether to use a derived subkey or not @@ -361,7 +361,12 @@ export class Raiden { this.store.dispatch(raidenShutdown({ reason: ShutdownReason.STOP })); } - private get state(): RaidenState { + /** + * Get current RaidenState object. Can be serialized safely with [[encodeRaidenState]] + * + * @returns Current Raiden state + */ + public get state(): RaidenState { return this.store.getState(); }