diff --git a/docs/code/modules/index.md b/docs/code/modules/index.md index 6f35952e..73b88825 100644 --- a/docs/code/modules/index.md +++ b/docs/code/modules/index.md @@ -1016,17 +1016,34 @@ Create a new ApplicationClient instance **`Example`** ```ts -const client = algokit.getAppClientById( +Resolve by creator and name +const client = algokit.getAppClient( { + resolveBy: 'creatorAndName', app: {appSpec}, sender: {account}, - id: {id}, - resolveBy: 'id' + creatorAddress: {creator}, + findExistingUsing: indexerClient, }, - algod, + algodClient, ) ``` +**`Example`** + +```ts +Resolve by id: +const client = algokit.getAppClient( + { + resolveBy: 'id', + app: {appSpec}, + sender: {account}, + id: {id}, + }, + algodClient, +) +``` + #### Parameters | Name | Type | Description | @@ -1042,7 +1059,7 @@ The application client #### Defined in -[src/app-client.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L20) +[src/app-client.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L34) ___ @@ -1060,9 +1077,9 @@ const client = algokit.getAppClientByCreatorAndName( app: {appSpec}, sender: {account}, creatorAddress: {account.addr}, - findExistingUsing: {indexer}, + findExistingUsing: {indexerClient}, }, - algod, + algodClient, ) ``` @@ -1081,7 +1098,7 @@ The application client #### Defined in -[src/app-client.ts:63](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L63) +[src/app-client.ts:77](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L77) ___ @@ -1100,7 +1117,7 @@ const client = algokit.getAppClientById( sender: {account}, id: {id}, }, - algod, + algodClient, ) ``` @@ -1119,7 +1136,7 @@ The application client #### Defined in -[src/app-client.ts:41](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L41) +[src/app-client.ts:55](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/app-client.ts#L55) ___ diff --git a/src/app-client.ts b/src/app-client.ts index 0c1f4bc0..41d984ce 100644 --- a/src/app-client.ts +++ b/src/app-client.ts @@ -5,17 +5,31 @@ import { AppSpecAppDetails, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetails * Create a new ApplicationClient instance * @param appDetails The details of the app * @param algod An algod instance - * @returns The application client - * @example - * const client = algokit.getAppClientById( + * + * @example Resolve by creator and name + * const client = algokit.getAppClient( * { + * resolveBy: 'creatorAndName', * app: {appSpec}, * sender: {account}, - * id: {id}, - * resolveBy: 'id' + * creatorAddress: {creator}, + * findExistingUsing: indexerClient, * }, - * algod, + * algodClient, * ) + * + * @example Resolve by id: + * const client = algokit.getAppClient( + * { + * resolveBy: 'id', + * app: {appSpec}, + * sender: {account}, + * id: {id}, + * }, + * algodClient, + * ) + * + * @returns The application client */ export function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) { return new ApplicationClient(appDetails, algod) @@ -33,7 +47,7 @@ export function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) { * sender: {account}, * id: {id}, * }, - * algod, + * algodClient, * ) * * @returns The application client @@ -53,9 +67,9 @@ export function getAppClientById(appDetails: AppSpecAppDetailsById, algod: Algod * app: {appSpec}, * sender: {account}, * creatorAddress: {account.addr}, - * findExistingUsing: {indexer}, + * findExistingUsing: {indexerClient}, * }, - * algod, + * algodClient, * ) * * @returns The application client