Skip to content

Commit

Permalink
Make AccountResponse conform to the StellarBase.Account interface. (#655
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Shaptic committed Jun 1, 2021
1 parent fad208d commit 428a5c5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,9 @@ A breaking change will get clearly marked in this log.

## Unreleased

### Fix
- Fixes a breaking bug introduced in v8.2.0 in which `AccountResponse` no longer conformed to the `StellarBase.Account` interface, which was updated in [stellar-base@v5.2.0](https://github.com/stellar/js-stellar-base/releases/tag/v5.2.0) [(#655)](https://github.com/stellar/js-stellar-sdk/pull/655).


## [v8.2.1](https://github.com/stellar/js-stellar-sdk/compare/v8.2.0...v8.2.1)

Expand Down
6 changes: 5 additions & 1 deletion src/account_response.ts
@@ -1,7 +1,7 @@
/* tslint:disable:variable-name */

import forIn from "lodash/forIn";
import { Account as BaseAccount } from "stellar-base";
import { Account as BaseAccount, MuxedAccount } from "stellar-base";
import { Horizon } from "./horizon_api";
import { ServerApi } from "./server_api";

Expand Down Expand Up @@ -83,4 +83,8 @@ export class AccountResponse {
this._baseAccount.incrementSequenceNumber();
this.sequence = this._baseAccount.sequenceNumber();
}

public createSubaccount(id: string): MuxedAccount {
return this._baseAccount.createSubaccount(id);
}
}
8 changes: 6 additions & 2 deletions src/server.ts
Expand Up @@ -655,9 +655,13 @@ export class Server {
}

/**
* Fetches an account's most current state in the ledger and then creates and returns an {@link Account} object.
* Fetches an account's most current state in the ledger, then creates and
* returns an {@link AccountResponse} object.
*
* @param {string} accountId - The account to load.
* @returns {Promise} Returns a promise to the {@link AccountResponse} object with populated sequence number.
*
* @returns {Promise} Returns a promise to the {@link AccountResponse} object
* with populated sequence number.
*/
public async loadAccount(accountId: string): Promise<AccountResponse> {
const res = await this.accounts()
Expand Down

0 comments on commit 428a5c5

Please sign in to comment.