Skip to content

Commit 3636579

Browse files
challetabuiles
authored andcommitted
AccountCallBuilder : add two methods for query filter (#474)
* add two methods for query filter * add real data in test cases * restore unrelated test case server paths
1 parent 1c88d05 commit 3636579

File tree

2 files changed

+328
-56
lines changed

2 files changed

+328
-56
lines changed

src/account_call_builder.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Asset } from "stellar-base";
12
import { CallBuilder } from "./call_builder";
23
import { ServerApi } from "./server_api";
34

@@ -29,4 +30,27 @@ export class AccountCallBuilder extends CallBuilder<ServerApi.AccountRecord> {
2930
this.filter.push(["accounts", id]);
3031
return this;
3132
}
33+
34+
/**
35+
* This endpoint filters accounts by signer account.
36+
* @see [Accounts](https://www.stellar.org/developers/horizon/reference/endpoints/accounts.html)
37+
* @param {string} value For example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD`
38+
* @returns {AccountCallBuilder} current AccountCallBuilder instance
39+
*/
40+
public forSigner(id: string) {
41+
this.url.setQuery("signer", id);
42+
return this;
43+
}
44+
45+
/**
46+
* This endpoint filters all accounts who are trustees to an asset.
47+
* @see [Accounts](https://www.stellar.org/developers/horizon/reference/endpoints/accounts.html)
48+
* @see Asset
49+
* @param {Asset} value For example: `new Asset('USD','GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD')`
50+
* @returns {AccountCallBuilder} current AccountCallBuilder instance
51+
*/
52+
public forAsset(asset: Asset) {
53+
this.url.setQuery("asset", `${asset}`);
54+
return this;
55+
}
3256
}

0 commit comments

Comments
 (0)