Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccountCallBuilder : add two methods for query filter #474

Merged
merged 3 commits into from
Jan 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/account_call_builder.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Asset } from "stellar-base";
import { CallBuilder } from "./call_builder";
import { ServerApi } from "./server_api";

Expand Down Expand Up @@ -29,4 +30,27 @@ export class AccountCallBuilder extends CallBuilder<ServerApi.AccountRecord> {
this.filter.push(["accounts", id]);
return this;
}

/**
* This endpoint filters accounts by signer account.
* @see [Accounts](https://www.stellar.org/developers/horizon/reference/endpoints/accounts.html)
* @param {string} value For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
* @returns {AccountCallBuilder} current AccountCallBuilder instance
*/
public forSigner(id: string) {
this.url.setQuery("signer", id);
return this;
}

/**
* This endpoint filters all accounts who are trustees to an asset.
* @see [Accounts](https://www.stellar.org/developers/horizon/reference/endpoints/accounts.html)
* @see Asset
* @param {Asset} value For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
* @returns {AccountCallBuilder} current AccountCallBuilder instance
*/
public forAsset(asset: Asset) {
this.url.setQuery("asset", `${asset}`);
return this;
}
}
Loading