@@ -19,11 +19,41 @@ import {
1919 IndexerTokenHeader ,
2020} from '../../urlTokenBaseHTTPClient' ;
2121
22+ /**
23+ * The Indexer provides a REST API interface of API calls to support searching the Algorand Blockchain.
24+ *
25+ * The Indexer REST APIs retrieve the blockchain data from a PostgreSQL compatible database that must be populated.
26+ *
27+ * This database is populated using the same indexer instance or a separate instance of the indexer which must connect to the algod process of a running Algorand node to read block data.
28+ *
29+ * This node must also be an Archival node to make searching the entire blockchain possible.
30+ *
31+ * #### Relevant Information
32+ * [Learn more about Indexer](https://developer.algorand.org/docs/get-details/indexer/)
33+ *
34+ * [Run Indexer in Postman OAS3](https://developer.algorand.org/docs/rest-apis/restendpoints/#algod-indexer-and-kmd-rest-endpoints)
35+ */
2236export default class IndexerClient extends ServiceClient {
2337 /**
2438 * Create an IndexerClient from
2539 * * either a token, baseServer, port, and optional headers
2640 * * or a base client server for interoperability with external dApp wallets
41+ *
42+ * #### Example
43+ * ```typescript
44+ * const token = "";
45+ * const server = "http://localhost";
46+ * const port = 8980;
47+ * const indexerClient = new algosdk.Indexer(token, server, port);
48+ * ```
49+ * @remarks
50+ * The above configuration is for a sandbox private network.
51+ * For applications on production, you are encouraged to run your own node with indexer, or use an Algorand REST API provider with a dedicated API key.
52+ *
53+ * @param tokenOrBaseClient - The API token for the Indexer API
54+ * @param baseServer - REST endpoint
55+ * @param port - Port number if specifically configured by the server
56+ * @param headers - Optional headers
2757 */
2858 constructor (
2959 tokenOrBaseClient :
@@ -40,106 +70,228 @@ export default class IndexerClient extends ServiceClient {
4070
4171 /**
4272 * Returns the health object for the service.
73+ * Returns 200 if healthy.
74+ *
75+ * #### Example
76+ * ```typescript
77+ * const health = await indexerClient.makeHealthCheck().do();
78+ * ```
79+ *
80+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-health)
81+ * @category GET
4382 */
4483 makeHealthCheck ( ) {
4584 return new MakeHealthCheck ( this . c , this . intDecoding ) ;
4685 }
4786
4887 /**
49- * Returns holder balances for the given asset.
88+ * Returns the list of accounts who hold the given asset and their balance.
89+ *
90+ * #### Example
91+ * ```typescript
92+ * const assetId = 163650;
93+ * const assetBalances = await indexerClient.lookupAssetBalances(assetId).do();
94+ * ```
95+ *
96+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idbalances)
5097 * @param index - The asset ID to look up.
98+ * @category GET
5199 */
52100 lookupAssetBalances ( index : number ) {
53101 return new LookupAssetBalances ( this . c , this . intDecoding , index ) ;
54102 }
55103
56104 /**
57105 * Returns transactions relating to the given asset.
106+ *
107+ * #### Example
108+ * ```typescript
109+ * const assetId = 163650;
110+ * const assetTxns = await indexerClient.lookupAssetTransactions(assetId).do();
111+ * ```
112+ *
113+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-idtransactions)
58114 * @param index - The asset ID to look up.
115+ * @category GET
59116 */
60117 lookupAssetTransactions ( index : number ) {
61118 return new LookupAssetTransactions ( this . c , this . intDecoding , index ) ;
62119 }
63120
64121 /**
65122 * Returns transactions relating to the given account.
123+ *
124+ * #### Example
125+ * ```typescript
126+ * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
127+ * const accountTxns = await indexerClient.lookupAccountTransactions(address).do();
128+ * ```
129+ *
130+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-idtransactions)
66131 * @param account - The address of the account.
132+ * @category GET
67133 */
68134 lookupAccountTransactions ( account : string ) {
69135 return new LookupAccountTransactions ( this . c , this . intDecoding , account ) ;
70136 }
71137
72138 /**
73139 * Returns the block for the passed round.
140+ *
141+ * #### Example
142+ * ```typescript
143+ * const targetBlock = 18309917;
144+ * const blockInfo = await indexerClient.lookupBlock(targetBlock).do();
145+ * ```
146+ *
147+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2blocksround-number)
74148 * @param round - The number of the round to look up.
149+ * @category GET
75150 */
76151 lookupBlock ( round : number ) {
77152 return new LookupBlock ( this . c , this . intDecoding , round ) ;
78153 }
79154
80155 /**
81156 * Returns information about the given transaction.
157+ *
158+ * #### Example
159+ * ```typescript
160+ * const txnId = "MEUOC4RQJB23CQZRFRKYEI6WBO73VTTPST5A7B3S5OKBUY6LFUDA";
161+ * const txnInfo = await indexerClient.lookupTransactionByID(txnId).do();
162+ * ```
163+ *
164+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactionstxid)
82165 * @param txID - The ID of the transaction to look up.
166+ * @category GET
83167 */
84168 lookupTransactionByID ( txID : string ) {
85169 return new LookupTransactionByID ( this . c , this . intDecoding , txID ) ;
86170 }
87171
88172 /**
89173 * Returns information about the given account.
174+ *
175+ * #### Example
176+ * ```typescript
177+ * const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
178+ * const accountInfo = await indexerClient.lookupAccountByID(address).do();
179+ * ```
180+ *
181+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accountsaccount-id)
90182 * @param account - The address of the account to look up.
183+ * @category GET
91184 */
92185 lookupAccountByID ( account : string ) {
93186 return new LookupAccountByID ( this . c , this . intDecoding , account ) ;
94187 }
95188
96189 /**
97190 * Returns information about the passed asset.
191+ *
192+ * #### Example
193+ * ```typescript
194+ * const assetId = 163650;
195+ * const assetInfo = await indexerClient.lookupAssetByID(assetId).do();
196+ * ```
197+ *
198+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assetsasset-id)
98199 * @param index - The ID of the asset ot look up.
200+ * @category GET
99201 */
100202 lookupAssetByID ( index : number ) {
101203 return new LookupAssetByID ( this . c , this . intDecoding , index ) ;
102204 }
103205
104206 /**
105207 * Returns information about the passed application.
208+ *
209+ * #### Example
210+ * ```typescript
211+ * const appId = 60553466;
212+ * const appInfo = await indexerClient.lookupApplications(appId).do();
213+ * ```
214+ *
215+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-id)
106216 * @param index - The ID of the application to look up.
217+ * @category GET
107218 */
108219 lookupApplications ( index : number ) {
109220 return new LookupApplications ( this . c , this . intDecoding , index ) ;
110221 }
111222
112223 /**
113224 * Returns log messages generated by the passed in application.
225+ *
226+ * #### Example
227+ * ```typescript
228+ * const appId = 60553466;
229+ * const appLogs = await indexerClient.lookupApplicationLogs(appId).do();
230+ * ```
231+ *
232+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applicationsapplication-idlogs)
114233 * @param appID - The ID of the application which generated the logs.
234+ * @category GET
115235 */
116236 lookupApplicationLogs ( appID : number ) {
117237 return new LookupApplicationLogs ( this . c , this . intDecoding , appID ) ;
118238 }
119239
120240 /**
121241 * Returns information about indexed accounts.
242+ *
243+ * #### Example
244+ * ```typescript
245+ * const accounts = await indexerClient.searchAccounts().do();
246+ * ```
247+ *
248+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2accounts)
249+ * @category GET
122250 */
123251 searchAccounts ( ) {
124252 return new SearchAccounts ( this . c , this . intDecoding ) ;
125253 }
126254
127255 /**
128256 * Returns information about indexed transactions.
257+ *
258+ * #### Example
259+ * ```typescript
260+ * const txns = await indexerClient.searchForTransactions().do();
261+ * ```
262+ *
263+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2transactions)
264+ * @category GET
129265 */
130266 searchForTransactions ( ) {
131267 return new SearchForTransactions ( this . c , this . intDecoding ) ;
132268 }
133269
134270 /**
135271 * Returns information about indexed assets.
272+ *
273+ * #### Example
274+ * ```typescript
275+ * const assets = await indexerClient.searchForAssets().do();
276+ * ```
277+ *
278+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2assets)
279+ * @category GET
136280 */
137281 searchForAssets ( ) {
138282 return new SearchForAssets ( this . c , this . intDecoding ) ;
139283 }
140284
141285 /**
142286 * Returns information about indexed applications.
287+ *
288+ * #### Example
289+ * ```typescript
290+ * const apps = await indexerClient.searchForApplications().do();
291+ * ```
292+ *
293+ * [Response data schema details](https://developer.algorand.org/docs/rest-apis/indexer/#get-v2applications)
294+ * @category GET
143295 */
144296 searchForApplications ( ) {
145297 return new SearchForApplications ( this . c , this . intDecoding ) ;
0 commit comments