Skip to content

Commit

Permalink
Follow up the new Cosmos v0.36.0+ REST spec (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Youngjoon Lee authored Oct 30, 2020
1 parent 2923cda commit 936063a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ export default class Account {

// TODO @youngjoon-lee: to be type-safe
constructor(data: Record<string, any> = {}) {
// eslint-disable-next-line no-param-reassign
if (data.value) data = data.value; // In case that the data is from getAccount request
// In case that the data is from getAccount request
if (data.value) { // for old cosmos-sdk
data = data.value;
} else if (data.result) { // for new cosmos-sdk
data = data.result.value;
}

this.sequence = +data.sequence || 0;
this.account_number = data.account_number
Expand Down

0 comments on commit 936063a

Please sign in to comment.