diff --git a/docs/code/classes/types_composer.default.md b/docs/code/classes/types_composer.default.md index b333aaec..98377f22 100644 --- a/docs/code/classes/types_composer.default.md +++ b/docs/code/classes/types_composer.default.md @@ -209,7 +209,7 @@ ___ ### txns -• `Private` **txns**: `Txn`[] = `[]` +• `Private` **txns**: [`Txn`](../modules/types_composer.md#txn)[] = `[]` Transactions that have not yet been composed @@ -1017,7 +1017,7 @@ Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` | Name | Type | | :------ | :------ | -| `txn` | `Txn` | +| `txn` | [`Txn`](../modules/types_composer.md#txn) | | `suggestedParams` | `SuggestedParams` | #### Returns @@ -1038,7 +1038,7 @@ ___ | Name | Type | | :------ | :------ | -| `txn` | `Txn` | +| `txn` | [`Txn`](../modules/types_composer.md#txn) | | `suggestedParams` | `SuggestedParams` | #### Returns diff --git a/docs/code/classes/types_dispenser_client.TestNetDispenserApiClient.md b/docs/code/classes/types_dispenser_client.TestNetDispenserApiClient.md index e283fecb..1676729e 100644 --- a/docs/code/classes/types_dispenser_client.TestNetDispenserApiClient.md +++ b/docs/code/classes/types_dispenser_client.TestNetDispenserApiClient.md @@ -78,7 +78,7 @@ If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the aut #### Defined in -[src/types/dispenser-client.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L69) +[src/types/dispenser-client.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L73) ## Properties @@ -88,7 +88,7 @@ If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the aut #### Defined in -[src/types/dispenser-client.ts:66](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L66) +[src/types/dispenser-client.ts:70](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L70) ___ @@ -98,7 +98,7 @@ ___ #### Defined in -[src/types/dispenser-client.ts:67](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L67) +[src/types/dispenser-client.ts:71](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L71) ## Accessors @@ -114,7 +114,7 @@ The authentication token used for API requests. #### Defined in -[src/types/dispenser-client.ts:85](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L85) +[src/types/dispenser-client.ts:89](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L89) ___ @@ -130,7 +130,7 @@ The timeout for API requests, in seconds. #### Defined in -[src/types/dispenser-client.ts:89](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L89) +[src/types/dispenser-client.ts:93](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L93) ## Methods @@ -155,7 +155,7 @@ DispenserFundResponse: An object containing the transaction ID and funded amount #### Defined in -[src/types/dispenser-client.ts:150](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L150) +[src/types/dispenser-client.ts:155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L155) ___ @@ -173,7 +173,7 @@ DispenserLimitResponse: An object containing the funding limit amount. #### Defined in -[src/types/dispenser-client.ts:176](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L176) +[src/types/dispenser-client.ts:181](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L181) ___ @@ -200,7 +200,7 @@ The API response. #### Defined in -[src/types/dispenser-client.ts:103](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L103) +[src/types/dispenser-client.ts:107](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L107) ___ @@ -222,4 +222,4 @@ Sends a refund request to the dispenser API for the specified refundTxnId. #### Defined in -[src/types/dispenser-client.ts:167](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L167) +[src/types/dispenser-client.ts:172](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L172) diff --git a/docs/code/classes/types_logic_error.LogicError.md b/docs/code/classes/types_logic_error.LogicError.md index df96e399..78a28a09 100644 --- a/docs/code/classes/types_logic_error.LogicError.md +++ b/docs/code/classes/types_logic_error.LogicError.md @@ -20,6 +20,7 @@ Wraps key functionality around processing logic errors ### Properties +- [cause](types_logic_error.LogicError.md#cause) - [led](types_logic_error.LogicError.md#led) - [lines](types_logic_error.LogicError.md#lines) - [message](types_logic_error.LogicError.md#message) @@ -65,6 +66,20 @@ Error.constructor ## Properties +### cause + +• `Optional` **cause**: `unknown` + +#### Inherited from + +Error.cause + +#### Defined in + +node_modules/typescript/lib/lib.es2022.error.d.ts:24 + +___ + ### led • **led**: [`LogicErrorDetails`](../interfaces/types_logic_error.LogicErrorDetails.md) diff --git a/docs/code/interfaces/types_dispenser_client.DispenserFundResponse.md b/docs/code/interfaces/types_dispenser_client.DispenserFundResponse.md index 5f516686..7e9564e8 100644 --- a/docs/code/interfaces/types_dispenser_client.DispenserFundResponse.md +++ b/docs/code/interfaces/types_dispenser_client.DispenserFundResponse.md @@ -23,7 +23,7 @@ The number of µAlgo that was funded. #### Defined in -[src/types/dispenser-client.ts:22](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L22) +[src/types/dispenser-client.ts:26](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L26) ___ @@ -35,4 +35,4 @@ The ID of the transaction that was issued to fund the account. #### Defined in -[src/types/dispenser-client.ts:20](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L20) +[src/types/dispenser-client.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L24) diff --git a/docs/code/interfaces/types_dispenser_client.DispenserLimitResponse.md b/docs/code/interfaces/types_dispenser_client.DispenserLimitResponse.md index 363ba75d..694c8f3e 100644 --- a/docs/code/interfaces/types_dispenser_client.DispenserLimitResponse.md +++ b/docs/code/interfaces/types_dispenser_client.DispenserLimitResponse.md @@ -22,4 +22,4 @@ The limit, in µAlgo, that you can currently fund. #### Defined in -[src/types/dispenser-client.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L28) +[src/types/dispenser-client.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L32) diff --git a/docs/code/interfaces/types_dispenser_client.TestNetDispenserApiClientParams.md b/docs/code/interfaces/types_dispenser_client.TestNetDispenserApiClientParams.md index 51b1fd92..3c7999e2 100644 --- a/docs/code/interfaces/types_dispenser_client.TestNetDispenserApiClientParams.md +++ b/docs/code/interfaces/types_dispenser_client.TestNetDispenserApiClientParams.md @@ -23,7 +23,7 @@ The API auth token #### Defined in -[src/types/dispenser-client.ts:34](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L34) +[src/types/dispenser-client.ts:38](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L38) ___ @@ -35,4 +35,4 @@ The request timeout in seconds #### Defined in -[src/types/dispenser-client.ts:36](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L36) +[src/types/dispenser-client.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/dispenser-client.ts#L40) diff --git a/docs/code/modules/index.md b/docs/code/modules/index.md index 11fa0cea..5ee7fb96 100644 --- a/docs/code/modules/index.md +++ b/docs/code/modules/index.md @@ -21,6 +21,7 @@ ### Type Aliases - [AccountInformation](index.md#accountinformation) +- [NumberConverter](index.md#numberconverter) ### Variables @@ -168,7 +169,7 @@ Re-exports [searchTransactions](index.indexer.md#searchtransactions) ### AccountInformation -Ƭ **AccountInformation**: `Omit`\<`NumberConverter`\<`AccountInformationModel`\>, ``"get_obj_for_encoding"``\> +Ƭ **AccountInformation**: `Omit`\<[`NumberConverter`](index.md#numberconverter)\<`AccountInformationModel`\>, ``"get_obj_for_encoding"``\> **`Deprecated`** @@ -178,6 +179,22 @@ Account information at a given round. [src/account/account.ts:135](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/account/account.ts#L135) +___ + +### NumberConverter + +Ƭ **NumberConverter**\<`T`\>: \{ [key in keyof T]: ToNumberIfExtends\ } + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends `AccountInformationModel` | + +#### Defined in + +[src/account/account.ts:132](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/account/account.ts#L132) + ## Variables ### Config @@ -2641,7 +2658,7 @@ This function persists the source maps for the given sources. #### Defined in -[src/debugging/debugging.ts:10](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/debugging/debugging.ts#L10) +[src/debugging/debugging.ts:8](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/debugging/debugging.ts#L8) ___ diff --git a/docs/code/modules/types_composer.md b/docs/code/modules/types_composer.md index e8eab40f..a7f2a457 100644 --- a/docs/code/modules/types_composer.md +++ b/docs/code/modules/types_composer.md @@ -38,6 +38,7 @@ - [OnlineKeyRegistrationParams](types_composer.md#onlinekeyregistrationparams) - [PaymentParams](types_composer.md#paymentparams) - [SimulateOptions](types_composer.md#simulateoptions) +- [Txn](types_composer.md#txn) ### Variables @@ -355,6 +356,16 @@ Options to control a simulate request [src/types/composer.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L24) +___ + +### Txn + +Ƭ **Txn**: [`PaymentParams`](types_composer.md#paymentparams) & \{ `type`: ``"pay"`` } \| [`AssetCreateParams`](types_composer.md#assetcreateparams) & \{ `type`: ``"assetCreate"`` } \| [`AssetConfigParams`](types_composer.md#assetconfigparams) & \{ `type`: ``"assetConfig"`` } \| [`AssetFreezeParams`](types_composer.md#assetfreezeparams) & \{ `type`: ``"assetFreeze"`` } \| [`AssetDestroyParams`](types_composer.md#assetdestroyparams) & \{ `type`: ``"assetDestroy"`` } \| [`AssetTransferParams`](types_composer.md#assettransferparams) & \{ `type`: ``"assetTransfer"`` } \| [`AssetOptInParams`](types_composer.md#assetoptinparams) & \{ `type`: ``"assetOptIn"`` } \| [`AssetOptOutParams`](types_composer.md#assetoptoutparams) & \{ `type`: ``"assetOptOut"`` } \| [`AppCallParams`](types_composer.md#appcallparams) \| [`AppCreateParams`](types_composer.md#appcreateparams) \| [`AppUpdateParams`](types_composer.md#appupdateparams) & \{ `type`: ``"appCall"`` } \| [`OnlineKeyRegistrationParams`](types_composer.md#onlinekeyregistrationparams) & \{ `type`: ``"keyReg"`` } \| `algosdk.TransactionWithSigner` & \{ `type`: ``"txnWithSigner"`` } \| \{ `atc`: `algosdk.AtomicTransactionComposer` ; `type`: ``"atc"`` } \| [`AppCallMethodCall`](types_composer.md#appcallmethodcall) \| [`AppCreateMethodCall`](types_composer.md#appcreatemethodcall) \| [`AppUpdateMethodCall`](types_composer.md#appupdatemethodcall) & \{ `type`: ``"methodCall"`` } + +#### Defined in + +[src/types/composer.ts:435](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L435) + ## Variables ### MAX\_TRANSACTION\_GROUP\_SIZE diff --git a/package-lock.json b/package-lock.json index 0df875ce..4dbe6bec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,10 +17,10 @@ "@commitlint/config-conventional": "^17.7.0", "@makerx/eslint-config": "^3.1.0", "@makerx/prettier-config": "^2.0.0", - "@makerx/ts-config": "^1.0.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.6", "@tsconfig/node18": "^18.2.2", + "@tsconfig/node20": "^20.1.4", "@types/jest": "^29.5.2", "@types/uuid": "^9.0.2", "algosdk": "^2.7.0", @@ -1852,13 +1852,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@makerx/ts-config": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@makerx/ts-config/-/ts-config-1.0.1.tgz", - "integrity": "sha512-JHvErK0IPjyWkukJ0Bu6uPq0w1/XBCAelNCo4cM/vm/ybNATve8gzJ8dZx4e+1ubnL3PQumwOyuKkLV3AEfYLg==", - "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", - "dev": true - }, "node_modules/@microsoft/tsdoc": { "version": "0.14.2", "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz", @@ -2800,6 +2793,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@tsconfig/node20": { + "version": "20.1.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.4.tgz", + "integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", diff --git a/package.json b/package.json index f8c31c83..008fa03f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "build:1-compile": "rollup -c --configPlugin typescript", "build:3-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json --custom-sections module main type types exports", "build:4-copy-readme": "cpy README.md dist", - "test": "dotenv -e .env -- jest --coverage --passWithNoTests", + "test": "dotenv -e .env -- jest --coverage --passWithNoTests --silent", "lint": "eslint ./src/ --ext .ts", "lint:fix": "eslint ./src/ --ext .ts --fix", "check-types": "tsc --noEmit", @@ -69,10 +69,10 @@ "@commitlint/config-conventional": "^17.7.0", "@makerx/eslint-config": "^3.1.0", "@makerx/prettier-config": "^2.0.0", - "@makerx/ts-config": "^1.0.1", "@rollup/plugin-node-resolve": "^15.2.3", "@rollup/plugin-typescript": "^11.1.6", "@tsconfig/node18": "^18.2.2", + "@tsconfig/node20": "^20.1.4", "@types/jest": "^29.5.2", "@types/uuid": "^9.0.2", "algosdk": "^2.7.0", diff --git a/src/account/account.ts b/src/account/account.ts index b59a4e6e..eb1d4841 100644 --- a/src/account/account.ts +++ b/src/account/account.ts @@ -129,7 +129,7 @@ export function getAccountAddressAsString(addressEncodedInB64: string): string { return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64')) } -type NumberConverter = { [key in keyof T]: ToNumberIfExtends } +export type NumberConverter = { [key in keyof T]: ToNumberIfExtends } type ToNumberIfExtends = K extends E ? number : K /** @deprecated Account information at a given round. */ export type AccountInformation = Omit, 'get_obj_for_encoding'> diff --git a/src/debugging/debugging.ts b/src/debugging/debugging.ts index 6208f016..4f05f6c1 100644 --- a/src/debugging/debugging.ts +++ b/src/debugging/debugging.ts @@ -3,8 +3,6 @@ * * This function persists the source maps for the given sources. * - * @param param0 The parameters to define the persistence - * * @returns A promise that resolves when the source maps have been persisted. */ export async function persistSourceMaps(_params: unknown): Promise { diff --git a/src/types/composer.ts b/src/types/composer.ts index 6c8b61f0..ac214bbf 100644 --- a/src/types/composer.ts +++ b/src/types/composer.ts @@ -432,7 +432,7 @@ export type AppMethodCall = Expand> & { )[] } -type Txn = +export type Txn = | (PaymentParams & { type: 'pay' }) | (AssetCreateParams & { type: 'assetCreate' }) | (AssetConfigParams & { type: 'assetConfig' }) diff --git a/src/types/dispenser-client.ts b/src/types/dispenser-client.ts index 2cfe66c4..e48992f7 100644 --- a/src/types/dispenser-client.ts +++ b/src/types/dispenser-client.ts @@ -2,6 +2,10 @@ const DISPENSER_BASE_URL = 'https://api.dispenser.algorandfoundation.tools' const DEFAULT_DISPENSER_REQUEST_TIMEOUT = 15 const DISPENSER_ACCESS_TOKEN_KEY = 'ALGOKIT_DISPENSER_ACCESS_TOKEN' +interface ErrorResponse { + code?: string +} + enum DispenserAssetName { Algo = 0, } @@ -128,10 +132,11 @@ export class TestNetDispenserApiClient { // suppress exception } - if (error_response && error_response.code) { - error_message = error_response.code + if (error_response && (error_response as ErrorResponse).code) { + error_message = (error_response as ErrorResponse).code! } else if (response.status === 400) { - error_message = (await response.json()).message + const errorResponse = (await response.json()) as { message: string } + error_message = errorResponse.message } throw new Error(error_message) @@ -155,7 +160,7 @@ export class TestNetDispenserApiClient { 'POST', ) - const content = await response.json() + const content = (await response.json()) as { txID: string; amount: number } return { txId: content.txID, amount: content.amount } } @@ -180,7 +185,7 @@ export class TestNetDispenserApiClient { null, 'GET', ) - const content = await response.json() + const content = (await response.json()) as { amount: number } return { amount: content.amount } } diff --git a/tsconfig.json b/tsconfig.json index b1eeb762..d719af6a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "@makerx/ts-config", + "extends": "@tsconfig/node20/tsconfig.json", "compilerOptions": { "module": "ESNext", "target": "ES2020",