Skip to content

Commit

Permalink
Use /accounts/id/offers in offer().forAccount(). (#553)
Browse files Browse the repository at this point in the history
This allows streaming offers for a given account. Trying to stream
through `/offers` is not supported at the moment.

Fix #552
  • Loading branch information
abuiles authored May 26, 2020
1 parent d92e0ad commit 70f54dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/offer_call_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export class OfferCallBuilder extends CallBuilder<
* @returns {OfferCallBuilder} current OfferCallBuilder instance
*/
public forAccount(id: string): this {
this.url.setQuery("seller", id);
this.filter.push(["accounts", id, "offers"]);
return this;
}

/**
* Returns all offers buying an asset.
* @see [Offers](https://www.stellar.org/developers/horizon/reference/endpoints/offers.html)
* @see [Offers](https://www.stellar.org/developers/horizon/reference/endpoints/offers-for-account.html)
* @see Asset
* @param {Asset} value For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
* @returns {OfferCallBuilder} current OfferCallBuilder instance
Expand Down
2 changes: 1 addition & 1 deletion test/unit/server_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ describe('server.js non-transaction tests', function() {
.expects('get')
.withArgs(
sinon.match(
'https://horizon-live.stellar.org:1337/offers?seller=GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K&order=asc'
'https://horizon-live.stellar.org:1337/accounts/GBS43BF24ENNS3KPACUZVKK2VYPOZVBQO2CISGZ777RYGOPYC2FT6S3K/offers?order=asc'
)
)
.returns(Promise.resolve({ data: offersResponse }));
Expand Down

0 comments on commit 70f54dd

Please sign in to comment.