diff --git a/.github/workflows/release_to_github.yml b/.github/workflows/release_to_github.yml new file mode 100644 index 00000000..b4ebfba6 --- /dev/null +++ b/.github/workflows/release_to_github.yml @@ -0,0 +1,105 @@ +name: Publish + +on: + push: + branches: + - algokit-core + workflow_dispatch: + +concurrency: release_to_github + +permissions: + contents: write + issues: read + +jobs: + ci: + name: Continuous Integration + uses: makerxstudio/shared-config/.github/workflows/node-ci.yml@main + with: + node-version: 20.x + run-commit-lint: true + pre-test-script: | + pipx install algokit + algokit localnet start + npx --yes wait-on tcp:4001 -t 30000 + audit-script: | + npm run audit + secrets: + npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }} + + check_docs: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: 'https://npm.pkg.github.com' + cache: 'npm' + cache-dependency-path: ./package-lock.json + + - name: Check docs are up to date + shell: bash + run: | + npm ci --ignore-scripts + npm run generate:code-docs + # Add untracked files as empty so they come up in diff + git add -N . + # Print changed files and error out if there are changes after generating docs + git diff --exit-code + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + + build: + name: Build + uses: makerxstudio/shared-config/.github/workflows/node-build-zip.yml@main + needs: + - ci + - check_docs + with: + node-version: 20.x + build-path: dist + artifact-name: package + + release: + name: Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + # semantic-release needs node 20 + - name: Use Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Download built package + uses: actions/download-artifact@v4 + with: + name: package + path: artifacts + + - name: Unzip package + shell: bash + run: | + mkdir -p dist + unzip -q "artifacts/package.zip" -d dist + + - name: Install dependencies to get semantic release components and plugins + run: npm ci --ignore-scripts + + # - name: 'Semantic release' + # run: npx semantic-release + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/code/README.md b/docs/code/README.md index 1383595d..0fed40e5 100644 --- a/docs/code/README.md +++ b/docs/code/README.md @@ -12,6 +12,7 @@ - [types/account-manager](modules/types_account_manager.md) - [types/account-manager.spec](modules/types_account_manager_spec.md) - [types/algo-http-client-with-retry](modules/types_algo_http_client_with_retry.md) +- [types/algokit-core-bridge](modules/types_algokit_core_bridge.md) - [types/algorand-client](modules/types_algorand_client.md) - [types/algorand-client-transaction-creator](modules/types_algorand_client_transaction_creator.md) - [types/algorand-client-transaction-sender](modules/types_algorand_client_transaction_sender.md) diff --git a/docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md b/docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md index 810320b9..0de37d46 100644 --- a/docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md +++ b/docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md @@ -20,6 +20,7 @@ A HTTP Client that wraps the Algorand SDK HTTP Client with retries ### Properties +- [\_algoKitCoreAlgod](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#_algokitcorealgod) - [MAX\_BACKOFF\_MS](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#max_backoff_ms) - [MAX\_TRIES](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#max_tries) - [RETRY\_ERROR\_CODES](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#retry_error_codes) @@ -27,6 +28,7 @@ A HTTP Client that wraps the Algorand SDK HTTP Client with retries ### Methods +- [buildBaseServerUrl](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#buildbaseserverurl) - [callWithRetry](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#callwithretry) - [delete](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#delete) - [get](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md#get) @@ -51,23 +53,33 @@ A HTTP Client that wraps the Algorand SDK HTTP Client with retries [`AlgoHttpClientWithRetry`](types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md) -#### Inherited from +#### Overrides URLTokenBaseHTTPClient.constructor #### Defined in -node_modules/algosdk/dist/types/client/urlTokenBaseHTTPClient.d.ts:27 +[src/types/algo-http-client-with-retry.ts:21](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L21) ## Properties +### \_algoKitCoreAlgod + +• `Private` **\_algoKitCoreAlgod**: `PromiseAlgodApi` + +#### Defined in + +[src/types/algo-http-client-with-retry.ts:18](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L18) + +___ + ### MAX\_BACKOFF\_MS ▪ `Static` `Private` `Readonly` **MAX\_BACKOFF\_MS**: ``10000`` #### Defined in -[src/types/algo-http-client-with-retry.ts:8](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L8) +[src/types/algo-http-client-with-retry.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L28) ___ @@ -77,7 +89,7 @@ ___ #### Defined in -[src/types/algo-http-client-with-retry.ts:7](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L7) +[src/types/algo-http-client-with-retry.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L27) ___ @@ -87,7 +99,7 @@ ___ #### Defined in -[src/types/algo-http-client-with-retry.ts:13](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L13) +[src/types/algo-http-client-with-retry.ts:33](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L33) ___ @@ -97,10 +109,31 @@ ___ #### Defined in -[src/types/algo-http-client-with-retry.ts:12](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L12) +[src/types/algo-http-client-with-retry.ts:32](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L32) ## Methods +### buildBaseServerUrl + +▸ **buildBaseServerUrl**(`baseServer`, `port?`): `URL` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `baseServer` | `string` | +| `port?` | `string` \| `number` | + +#### Returns + +`URL` + +#### Defined in + +[src/types/algo-http-client-with-retry.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L45) + +___ + ### callWithRetry ▸ **callWithRetry**(`func`): `Promise`\<`BaseHTTPClientResponse`\> @@ -117,7 +150,7 @@ ___ #### Defined in -[src/types/algo-http-client-with-retry.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L25) +[src/types/algo-http-client-with-retry.ts:60](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L60) ___ @@ -144,7 +177,7 @@ URLTokenBaseHTTPClient.delete #### Defined in -[src/types/algo-http-client-with-retry.ts:100](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L100) +[src/types/algo-http-client-with-retry.ts:206](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L206) ___ @@ -170,7 +203,7 @@ URLTokenBaseHTTPClient.get #### Defined in -[src/types/algo-http-client-with-retry.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L57) +[src/types/algo-http-client-with-retry.ts:93](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L93) ___ @@ -197,4 +230,4 @@ URLTokenBaseHTTPClient.post #### Defined in -[src/types/algo-http-client-with-retry.ts:91](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L91) +[src/types/algo-http-client-with-retry.ts:145](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algo-http-client-with-retry.ts#L145) diff --git a/docs/code/classes/types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md b/docs/code/classes/types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md new file mode 100644 index 00000000..9655e40a --- /dev/null +++ b/docs/code/classes/types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md @@ -0,0 +1,107 @@ +[@algorandfoundation/algokit-utils](../README.md) / [types/algokit-core-bridge](../modules/types_algokit_core_bridge.md) / TokenHeaderAuthenticationMethod + +# Class: TokenHeaderAuthenticationMethod + +[types/algokit-core-bridge](../modules/types_algokit_core_bridge.md).TokenHeaderAuthenticationMethod + +## Implements + +- `SecurityAuthentication` + +## Table of contents + +### Constructors + +- [constructor](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md#constructor) + +### Properties + +- [\_header](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md#_header) +- [\_key](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md#_key) + +### Methods + +- [applySecurityAuthentication](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md#applysecurityauthentication) +- [getName](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md#getname) + +## Constructors + +### constructor + +• **new TokenHeaderAuthenticationMethod**(`tokenHeader`): [`TokenHeaderAuthenticationMethod`](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md) + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `tokenHeader` | `TokenHeader` | + +#### Returns + +[`TokenHeaderAuthenticationMethod`](types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md) + +#### Defined in + +[src/types/algokit-core-bridge.ts:59](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L59) + +## Properties + +### \_header + +• `Private` **\_header**: `string` + +#### Defined in + +[src/types/algokit-core-bridge.ts:56](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L56) + +___ + +### \_key + +• `Private` **\_key**: `string` + +#### Defined in + +[src/types/algokit-core-bridge.ts:57](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L57) + +## Methods + +### applySecurityAuthentication + +▸ **applySecurityAuthentication**(`context`): `void` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `context` | `RequestContext` | + +#### Returns + +`void` + +#### Implementation of + +algodApi.SecurityAuthentication.applySecurityAuthentication + +#### Defined in + +[src/types/algokit-core-bridge.ts:73](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L73) + +___ + +### getName + +▸ **getName**(): `string` + +#### Returns + +`string` + +#### Implementation of + +algodApi.SecurityAuthentication.getName + +#### Defined in + +[src/types/algokit-core-bridge.ts:69](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L69) diff --git a/docs/code/classes/types_composer.TransactionComposer.md b/docs/code/classes/types_composer.TransactionComposer.md index a7a1281c..b0928d8a 100644 --- a/docs/code/classes/types_composer.TransactionComposer.md +++ b/docs/code/classes/types_composer.TransactionComposer.md @@ -94,7 +94,7 @@ The `TransactionComposer` instance #### Defined in -[src/types/composer.ts:608](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L608) +[src/types/composer.ts:609](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L609) ## Properties @@ -106,7 +106,7 @@ The algod client used by the composer. #### Defined in -[src/types/composer.ts:563](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L563) +[src/types/composer.ts:564](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L564) ___ @@ -116,7 +116,7 @@ ___ #### Defined in -[src/types/composer.ts:577](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L577) +[src/types/composer.ts:578](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L578) ___ @@ -128,7 +128,7 @@ The ATC used to compose the group #### Defined in -[src/types/composer.ts:552](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L552) +[src/types/composer.ts:553](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L553) ___ @@ -140,7 +140,7 @@ The default transaction validity window #### Defined in -[src/types/composer.ts:572](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L572) +[src/types/composer.ts:573](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L573) ___ @@ -152,7 +152,7 @@ Whether the validity window was explicitly set on construction #### Defined in -[src/types/composer.ts:575](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L575) +[src/types/composer.ts:576](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L576) ___ @@ -162,7 +162,7 @@ ___ #### Defined in -[src/types/composer.ts:579](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L579) +[src/types/composer.ts:580](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L580) ___ @@ -188,7 +188,7 @@ A function that takes in an address and return a signer function for that addres #### Defined in -[src/types/composer.ts:569](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L569) +[src/types/composer.ts:570](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L570) ___ @@ -208,7 +208,7 @@ An async function that will return suggested params for the transaction. #### Defined in -[src/types/composer.ts:566](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L566) +[src/types/composer.ts:567](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L567) ___ @@ -221,7 +221,7 @@ This is set using the value of either maxFee or staticFee. #### Defined in -[src/types/composer.ts:557](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L557) +[src/types/composer.ts:558](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L558) ___ @@ -233,7 +233,7 @@ Transactions that have not yet been composed #### Defined in -[src/types/composer.ts:560](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L560) +[src/types/composer.ts:561](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L561) ___ @@ -245,7 +245,7 @@ Signer used to represent a lack of signer #### Defined in -[src/types/composer.ts:549](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L549) +[src/types/composer.ts:550](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L550) ## Methods @@ -303,7 +303,7 @@ composer.addAppCall({ #### Defined in -[src/types/composer.ts:1106](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1106) +[src/types/composer.ts:1107](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1107) ___ @@ -371,7 +371,7 @@ composer.addAppCallMethodCall({ #### Defined in -[src/types/composer.ts:1318](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1318) +[src/types/composer.ts:1319](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1319) ___ @@ -467,7 +467,7 @@ composer.addAppCreate({ #### Defined in -[src/types/composer.ts:985](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L985) +[src/types/composer.ts:986](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L986) ___ @@ -544,7 +544,7 @@ composer.addAppCreateMethodCall({ #### Defined in -[src/types/composer.ts:1166](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1166) +[src/types/composer.ts:1167](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1167) ___ @@ -600,7 +600,7 @@ composer.addAppDelete({ #### Defined in -[src/types/composer.ts:1065](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1065) +[src/types/composer.ts:1066](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1066) ___ @@ -668,7 +668,7 @@ composer.addAppDeleteMethodCall({ #### Defined in -[src/types/composer.ts:1268](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1268) +[src/types/composer.ts:1269](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1269) ___ @@ -746,7 +746,7 @@ composer.addAppUpdate({ #### Defined in -[src/types/composer.ts:1026](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1026) +[src/types/composer.ts:1027](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1027) ___ @@ -816,7 +816,7 @@ composer.addAppUpdateMethodCall({ #### Defined in -[src/types/composer.ts:1218](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1218) +[src/types/composer.ts:1219](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1219) ___ @@ -868,7 +868,7 @@ composer.addAssetConfig({ #### Defined in -[src/types/composer.ts:758](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L758) +[src/types/composer.ts:759](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L759) ___ @@ -926,7 +926,7 @@ composer.addAssetCreate({ #### Defined in -[src/types/composer.ts:723](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L723) +[src/types/composer.ts:724](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L724) ___ @@ -975,7 +975,7 @@ composer.addAssetDestroy({ #### Defined in -[src/types/composer.ts:824](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L824) +[src/types/composer.ts:825](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L825) ___ @@ -1026,7 +1026,7 @@ composer.addAssetFreeze({ #### Defined in -[src/types/composer.ts:792](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L792) +[src/types/composer.ts:793](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L793) ___ @@ -1075,7 +1075,7 @@ composer.addAssetOptIn({ #### Defined in -[src/types/composer.ts:893](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L893) +[src/types/composer.ts:894](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L894) ___ @@ -1132,7 +1132,7 @@ composer.addAssetOptOut({ #### Defined in -[src/types/composer.ts:931](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L931) +[src/types/composer.ts:932](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L932) ___ @@ -1186,7 +1186,7 @@ composer.addAssetTransfer({ #### Defined in -[src/types/composer.ts:861](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L861) +[src/types/composer.ts:862](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L862) ___ @@ -1218,7 +1218,7 @@ composer.addAtc(atc) #### Defined in -[src/types/composer.ts:1416](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1416) +[src/types/composer.ts:1417](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1417) ___ @@ -1270,7 +1270,7 @@ composer.addOfflineKeyRegistration({ #### Defined in -[src/types/composer.ts:1399](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1399) +[src/types/composer.ts:1400](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1400) ___ @@ -1334,7 +1334,7 @@ composer.addOnlineKeyRegistration({ #### Defined in -[src/types/composer.ts:1364](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1364) +[src/types/composer.ts:1365](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1365) ___ @@ -1390,7 +1390,7 @@ composer.addPayment({ #### Defined in -[src/types/composer.ts:682](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L682) +[src/types/composer.ts:683](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L683) ___ @@ -1421,7 +1421,7 @@ composer.addTransaction(txn) #### Defined in -[src/types/composer.ts:639](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L639) +[src/types/composer.ts:640](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L640) ___ @@ -1450,7 +1450,7 @@ const { atc, transactions, methodCalls } = await composer.build() #### Defined in -[src/types/composer.ts:1946](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1946) +[src/types/composer.ts:1947](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1947) ___ @@ -1471,7 +1471,7 @@ ___ #### Defined in -[src/types/composer.ts:1755](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1755) +[src/types/composer.ts:1756](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1756) ___ @@ -1492,7 +1492,7 @@ ___ #### Defined in -[src/types/composer.ts:1712](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1712) +[src/types/composer.ts:1713](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1713) ___ @@ -1513,7 +1513,7 @@ ___ #### Defined in -[src/types/composer.ts:1694](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1694) +[src/types/composer.ts:1695](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1695) ___ @@ -1534,7 +1534,7 @@ ___ #### Defined in -[src/types/composer.ts:1725](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1725) +[src/types/composer.ts:1726](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1726) ___ @@ -1555,7 +1555,7 @@ ___ #### Defined in -[src/types/composer.ts:1733](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1733) +[src/types/composer.ts:1734](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1734) ___ @@ -1576,7 +1576,7 @@ ___ #### Defined in -[src/types/composer.ts:1743](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1743) +[src/types/composer.ts:1744](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1744) ___ @@ -1598,7 +1598,7 @@ Build an ATC and return transactions ready to be incorporated into a broader set #### Defined in -[src/types/composer.ts:1422](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1422) +[src/types/composer.ts:1423](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1423) ___ @@ -1619,7 +1619,7 @@ ___ #### Defined in -[src/types/composer.ts:1806](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1806) +[src/types/composer.ts:1807](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1807) ___ @@ -1643,7 +1643,7 @@ Builds an ABI method call transaction and any other associated transactions repr #### Defined in -[src/types/composer.ts:1502](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1502) +[src/types/composer.ts:1503](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1503) ___ @@ -1664,7 +1664,7 @@ ___ #### Defined in -[src/types/composer.ts:1684](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1684) +[src/types/composer.ts:1685](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1685) ___ @@ -1688,7 +1688,7 @@ const { transactions, methodCalls, signers } = await composer.buildTransactions( #### Defined in -[src/types/composer.ts:1888](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1888) +[src/types/composer.ts:1889](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1889) ___ @@ -1711,7 +1711,7 @@ Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` #### Defined in -[src/types/composer.ts:1829](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1829) +[src/types/composer.ts:1830](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1830) ___ @@ -1732,7 +1732,7 @@ ___ #### Defined in -[src/types/composer.ts:1856](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1856) +[src/types/composer.ts:1857](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1857) ___ @@ -1760,7 +1760,7 @@ ___ #### Defined in -[src/types/composer.ts:1444](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1444) +[src/types/composer.ts:1445](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1445) ___ @@ -1778,7 +1778,7 @@ The number of transactions currently added to this composer #### Defined in -[src/types/composer.ts:1929](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1929) +[src/types/composer.ts:1930](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1930) ___ @@ -1808,7 +1808,7 @@ An alias for `composer.send(params)`. #### Defined in -[src/types/composer.ts:2044](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2044) +[src/types/composer.ts:2045](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2045) ___ @@ -1833,7 +1833,7 @@ const { atc, transactions, methodCalls } = await composer.rebuild() #### Defined in -[src/types/composer.ts:1985](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1985) +[src/types/composer.ts:1986](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1986) ___ @@ -1857,7 +1857,7 @@ The composer so you can chain method calls #### Defined in -[src/types/composer.ts:624](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L624) +[src/types/composer.ts:625](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L625) ___ @@ -1887,7 +1887,7 @@ const result = await composer.send() #### Defined in -[src/types/composer.ts:1999](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L1999) +[src/types/composer.ts:2000](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2000) ___ @@ -1911,7 +1911,7 @@ const result = await composer.simulate() #### Defined in -[src/types/composer.ts:2056](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2056) +[src/types/composer.ts:2057](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2057) ▸ **simulate**(`options`): `Promise`\<[`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & \{ `simulateResponse`: `SimulateResponse` }\> @@ -1945,7 +1945,7 @@ const result = await composer.simulate({ #### Defined in -[src/types/composer.ts:2067](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2067) +[src/types/composer.ts:2068](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2068) ▸ **simulate**(`options`): `Promise`\<[`SendAtomicTransactionComposerResults`](../interfaces/types_transaction.SendAtomicTransactionComposerResults.md) & \{ `simulateResponse`: `SimulateResponse` }\> @@ -1980,7 +1980,7 @@ const result = await composer.simulate({ #### Defined in -[src/types/composer.ts:2080](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2080) +[src/types/composer.ts:2081](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2081) ___ @@ -2000,7 +2000,7 @@ ___ #### Defined in -[src/types/composer.ts:581](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L581) +[src/types/composer.ts:582](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L582) ___ @@ -2026,4 +2026,4 @@ The binary encoded transaction note #### Defined in -[src/types/composer.ts:2155](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2155) +[src/types/composer.ts:2156](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L2156) diff --git a/docs/code/interfaces/types_composer.BuiltTransactions.md b/docs/code/interfaces/types_composer.BuiltTransactions.md index cfbddff7..cb8f03b9 100644 --- a/docs/code/interfaces/types_composer.BuiltTransactions.md +++ b/docs/code/interfaces/types_composer.BuiltTransactions.md @@ -24,7 +24,7 @@ Any `ABIMethod` objects associated with any of the transactions in a map keyed b #### Defined in -[src/types/composer.ts:541](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L541) +[src/types/composer.ts:542](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L542) ___ @@ -36,7 +36,7 @@ Any `TransactionSigner` objects associated with any of the transactions in a map #### Defined in -[src/types/composer.ts:543](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L543) +[src/types/composer.ts:544](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L544) ___ @@ -48,4 +48,4 @@ The built transactions #### Defined in -[src/types/composer.ts:539](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L539) +[src/types/composer.ts:540](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L540) diff --git a/docs/code/modules/types_algokit_core_bridge.md b/docs/code/modules/types_algokit_core_bridge.md new file mode 100644 index 00000000..a8cd3870 --- /dev/null +++ b/docs/code/modules/types_algokit_core_bridge.md @@ -0,0 +1,55 @@ +[@algorandfoundation/algokit-utils](../README.md) / types/algokit-core-bridge + +# Module: types/algokit-core-bridge + +## Table of contents + +### Classes + +- [TokenHeaderAuthenticationMethod](../classes/types_algokit_core_bridge.TokenHeaderAuthenticationMethod.md) + +### Functions + +- [buildAlgoKitCoreAlgodClient](types_algokit_core_bridge.md#buildalgokitcorealgodclient) +- [buildPayment](types_algokit_core_bridge.md#buildpayment) + +## Functions + +### buildAlgoKitCoreAlgodClient + +▸ **buildAlgoKitCoreAlgodClient**(`baseUrl`, `tokenHeader`): `algodApi.AlgodApi` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `baseUrl` | `URL` | +| `tokenHeader` | `TokenHeader` | + +#### Returns + +`algodApi.AlgodApi` + +#### Defined in + +[src/types/algokit-core-bridge.ts:78](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L78) + +___ + +### buildPayment + +▸ **buildPayment**(`«destructured»`): `Transaction` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `PaymentTransactionParams` & `CommonTransactionParams` | + +#### Returns + +`Transaction` + +#### Defined in + +[src/types/algokit-core-bridge.ts:10](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/algokit-core-bridge.ts#L10) diff --git a/docs/code/modules/types_composer.md b/docs/code/modules/types_composer.md index eaee1812..7dbcd565 100644 --- a/docs/code/modules/types_composer.md +++ b/docs/code/modules/types_composer.md @@ -58,7 +58,7 @@ Parameters to define an ABI method call transaction. #### Defined in -[src/types/composer.ts:426](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L426) +[src/types/composer.ts:427](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L427) ___ @@ -70,7 +70,7 @@ Parameters to define an application call transaction. #### Defined in -[src/types/composer.ts:402](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L402) +[src/types/composer.ts:403](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L403) ___ @@ -82,7 +82,7 @@ Parameters to define an ABI method call create transaction. #### Defined in -[src/types/composer.ts:420](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L420) +[src/types/composer.ts:421](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L421) ___ @@ -94,7 +94,7 @@ Parameters to define an app create transaction #### Defined in -[src/types/composer.ts:365](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L365) +[src/types/composer.ts:366](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L366) ___ @@ -106,7 +106,7 @@ Parameters to define an ABI method call delete transaction. #### Defined in -[src/types/composer.ts:424](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L424) +[src/types/composer.ts:425](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L425) ___ @@ -118,7 +118,7 @@ Parameters to define an application delete call transaction. #### Defined in -[src/types/composer.ts:415](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L415) +[src/types/composer.ts:416](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L416) ___ @@ -136,7 +136,7 @@ Parameters to define an ABI method call. #### Defined in -[src/types/composer.ts:439](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L439) +[src/types/composer.ts:440](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L440) ___ @@ -148,7 +148,7 @@ Common parameters to define an ABI method call transaction. #### Defined in -[src/types/composer.ts:407](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L407) +[src/types/composer.ts:408](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L408) ___ @@ -160,7 +160,7 @@ Types that can be used to define a transaction argument for an ABI call transact #### Defined in -[src/types/composer.ts:429](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L429) +[src/types/composer.ts:430](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L430) ___ @@ -172,7 +172,7 @@ Parameters to define an ABI method call update transaction. #### Defined in -[src/types/composer.ts:422](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L422) +[src/types/composer.ts:423](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L423) ___ @@ -184,7 +184,7 @@ Parameters to define an app update transaction #### Defined in -[src/types/composer.ts:391](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L391) +[src/types/composer.ts:392](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L392) ___ @@ -200,7 +200,7 @@ all fields are immutable from that point forward. #### Defined in -[src/types/composer.ts:218](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L218) +[src/types/composer.ts:219](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L219) ___ @@ -214,7 +214,7 @@ The account that sends this transaction will automatically be opted in to the as #### Defined in -[src/types/composer.ts:102](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L102) +[src/types/composer.ts:103](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L103) ___ @@ -228,7 +228,7 @@ Created assets can be destroyed only by the asset manager account. All of the as #### Defined in -[src/types/composer.ts:276](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L276) +[src/types/composer.ts:277](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L277) ___ @@ -240,7 +240,7 @@ Parameters to define an asset freeze transaction. #### Defined in -[src/types/composer.ts:263](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L263) +[src/types/composer.ts:264](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L264) ___ @@ -252,7 +252,7 @@ Parameters to define an asset opt-in transaction. #### Defined in -[src/types/composer.ts:304](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L304) +[src/types/composer.ts:305](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L305) ___ @@ -264,7 +264,7 @@ Parameters to define an asset opt-out transaction. #### Defined in -[src/types/composer.ts:310](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L310) +[src/types/composer.ts:311](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L311) ___ @@ -276,7 +276,7 @@ Parameters to define an asset transfer transaction. #### Defined in -[src/types/composer.ts:282](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L282) +[src/types/composer.ts:283](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L283) ___ @@ -288,7 +288,7 @@ Common parameters for defining an application call transaction. #### Defined in -[src/types/composer.ts:343](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L343) +[src/types/composer.ts:344](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L344) ___ @@ -316,7 +316,7 @@ Common parameters for defining a transaction. #### Defined in -[src/types/composer.ts:45](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L45) +[src/types/composer.ts:46](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L46) ___ @@ -345,7 +345,7 @@ and return the input error if it cannot or should not transform it. #### Defined in -[src/types/composer.ts:484](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L484) +[src/types/composer.ts:485](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L485) ___ @@ -357,7 +357,7 @@ Parameters to define an offline key registration transaction. #### Defined in -[src/types/composer.ts:337](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L337) +[src/types/composer.ts:338](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L338) ___ @@ -369,7 +369,7 @@ Parameters to define an online key registration transaction. #### Defined in -[src/types/composer.ts:321](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L321) +[src/types/composer.ts:322](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L322) ___ @@ -381,7 +381,7 @@ Parameters to define a payment transaction. #### Defined in -[src/types/composer.ts:86](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L86) +[src/types/composer.ts:87](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L87) ___ @@ -394,7 +394,7 @@ See algod API docs for more information: https://dev.algorand.co/reference/rest- #### Defined in -[src/types/composer.ts:39](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L39) +[src/types/composer.ts:40](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L40) ___ @@ -406,7 +406,7 @@ All options to control a simulate request #### Defined in -[src/types/composer.ts:42](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L42) +[src/types/composer.ts:43](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L43) ___ @@ -418,7 +418,7 @@ Options to control a simulate request, that does not require transaction signing #### Defined in -[src/types/composer.ts:27](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L27) +[src/types/composer.ts:28](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L28) ___ @@ -441,7 +441,7 @@ Parameters to create an `TransactionComposer`. #### Defined in -[src/types/composer.ts:499](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L499) +[src/types/composer.ts:500](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L500) ___ @@ -451,7 +451,7 @@ ___ #### Defined in -[src/types/composer.ts:463](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L463) +[src/types/composer.ts:464](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L464) ## Variables @@ -461,4 +461,4 @@ ___ #### Defined in -[src/types/composer.ts:24](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L24) +[src/types/composer.ts:25](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/src/types/composer.ts#L25) diff --git a/package-lock.json b/package-lock.json index 045449c2..f88bc735 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "version": "0.1.0", "license": "MIT", "dependencies": { + "@algorandfoundation/algokit-algod-api": "1.0.0-alpha.3", + "@algorandfoundation/algokit-transact": "1.0.0-alpha.5", "@algorandfoundation/tealscript": "^0.106.3", "buffer": "^6.0.3" }, @@ -65,6 +67,20 @@ "node": ">=0.10.0" } }, + "node_modules/@algorandfoundation/algokit-algod-api": { + "version": "1.0.0-alpha.3", + "resolved": "https://npm.pkg.github.com/download/@algorandfoundation/algokit-algod-api/1.0.0-alpha.3/b08d441ed396d7fa26d7896ca593ab730fd4a76b", + "integrity": "sha512-ZFGs2P/2ZHcOchYxZw6Zny8aTt3nBQ1WsbLUdaV5ILUbKHc+q5npONp9B4Lm//flWmzRSRT0ya8i1H2RY/599g==", + "dependencies": { + "es6-promise": "^4.2.4", + "whatwg-fetch": "^3.0.0" + } + }, + "node_modules/@algorandfoundation/algokit-transact": { + "version": "1.0.0-alpha.5", + "resolved": "https://npm.pkg.github.com/download/@algorandfoundation/algokit-transact/1.0.0-alpha.5/f0ea805b48258d270aad57bce6c186c606dd9069", + "integrity": "sha512-iPc9bkWEizoACs2ikQqp2oqm6d4QBwDBUsx3x557AI75hcFZIOkYdmkNZMEsVUnMzg+m7jOfTTTif/19I5OaIg==" + }, "node_modules/@algorandfoundation/tealscript": { "version": "0.106.3", "resolved": "https://registry.npmjs.org/@algorandfoundation/tealscript/-/tealscript-0.106.3.tgz", @@ -4576,6 +4592,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, "node_modules/esbuild": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", @@ -12468,6 +12489,11 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", diff --git a/package.json b/package.json index 7dd773e5..d922cf7b 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,8 @@ "esbuild": "0.25.0" }, "dependencies": { + "@algorandfoundation/algokit-algod-api": "1.0.0-alpha.3", + "@algorandfoundation/algokit-transact": "1.0.0-alpha.5", "@algorandfoundation/tealscript": "^0.106.3", "buffer": "^6.0.3" }, @@ -112,6 +114,10 @@ }, { "name": "release" + }, + { + "name": "algokit-core", + "prerelease": "future" } ], "plugins": [ diff --git a/src/transaction/transaction.spec.ts b/src/transaction/transaction.spec.ts index f17eaf6f..8e385921 100644 --- a/src/transaction/transaction.spec.ts +++ b/src/transaction/transaction.spec.ts @@ -1,16 +1,18 @@ import algosdk, { ABIMethod, ABIType, Account, Address } from 'algosdk' import invariant from 'tiny-invariant' -import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest' +import { afterAll, beforeAll, beforeEach, describe, expect, test, vi } from 'vitest' import { APP_SPEC as nestedContractAppSpec } from '../../tests/example-contracts/client/TestContractClient' import innerFeeContract from '../../tests/example-contracts/inner-fee/application.json' import externalARC32 from '../../tests/example-contracts/resource-packer/artifacts/ExternalApp.arc32.json' import v8ARC32 from '../../tests/example-contracts/resource-packer/artifacts/ResourcePackerv8.arc32.json' import v9ARC32 from '../../tests/example-contracts/resource-packer/artifacts/ResourcePackerv9.arc32.json' -import { algo, microAlgo } from '../amount' +import { algo, algos, microAlgo } from '../amount' import { Config } from '../config' -import { algorandFixture } from '../testing' +import { algorandFixture, getTestAccount } from '../testing' +import { AlgorandClient } from '../types/algorand-client' import { AlgoAmount } from '../types/amount' import { AppClient } from '../types/app-client' +import { ClientManager } from '../types/client-manager' import { PaymentParams, TransactionComposer } from '../types/composer' import { Arc2TransactionNote } from '../types/transaction' import { getABIReturnValue, waitForConfirmation } from './transaction' @@ -1157,3 +1159,37 @@ describe('abi return', () => { ]) }) }) + +describe('When create algorand client with config from environment', () => { + test('payment transactions are sent and waited for by algokit core algod client', async () => { + const algorandClient = AlgorandClient.fromConfig(ClientManager.getConfigFromEnvironmentOrLocalNet()) + + const sendRawTransactionWithAlgoKitCoreAlgod = vi.spyOn( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (algorandClient.client.algod.c as any).bc._algoKitCoreAlgod, + 'rawTransactionResponse', + ) + + const sendPendingTransactionInformationResponseWithAlgoKitCoreAlgod = vi.spyOn( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (algorandClient.client.algod.c as any).bc._algoKitCoreAlgod, + 'pendingTransactionInformationResponse', + ) + + const testAccount = await getTestAccount({ initialFunds: algos(10), suppressLog: true }, algorandClient) + algorandClient.setSignerFromAccount(testAccount) + + const testPayTransaction = { + sender: testAccount, + receiver: testAccount, + amount: (1).microAlgo(), + } as PaymentParams + + const fee = (1).algo() + const { confirmation } = await algorandClient.send.payment({ ...testPayTransaction, staticFee: fee }) + + expect(sendRawTransactionWithAlgoKitCoreAlgod).toBeCalledTimes(2) + expect(sendPendingTransactionInformationResponseWithAlgoKitCoreAlgod).toBeCalled() + expect(confirmation.txn.txn.fee).toBe(fee.microAlgo) + }) +}) diff --git a/src/types/algo-http-client-with-retry.ts b/src/types/algo-http-client-with-retry.ts index 214e194d..4c9f7c00 100644 --- a/src/types/algo-http-client-with-retry.ts +++ b/src/types/algo-http-client-with-retry.ts @@ -1,9 +1,29 @@ -import { IntDecoding, parseJSON, stringifyJSON } from 'algosdk' +import { AlgodApi } from '@algorandfoundation/algokit-algod-api' +import { + BaseHTTPClientError, + decodeSignedTransaction, + IntDecoding, + parseJSON, + SignedTransaction, + stringifyJSON, + TokenHeader, + TransactionType, +} from 'algosdk' import { BaseHTTPClientResponse, Query, URLTokenBaseHTTPClient } from 'algosdk/client' import { Config } from '../config' +import { buildAlgoKitCoreAlgodClient } from './algokit-core-bridge' /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { + private _algoKitCoreAlgod: AlgodApi + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + constructor(tokenHeader: TokenHeader, baseServer: string, port?: string | number, defaultHeaders?: Record) { + super(tokenHeader, baseServer, port, defaultHeaders) + + this._algoKitCoreAlgod = buildAlgoKitCoreAlgodClient(this.buildBaseServerUrl(baseServer, port), tokenHeader) + } + private static readonly MAX_TRIES = 5 private static readonly MAX_BACKOFF_MS = 10000 @@ -22,6 +42,21 @@ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { 'EPROTO', // We get this intermittently with AlgoNode API ] + private buildBaseServerUrl(baseServer: string, port?: string | number) { + // This logic is copied from algosdk to make sure that we have the same base server config + + // Append a trailing slash so we can use relative paths. Without the trailing + // slash, the last path segment will be replaced by the relative path. See + // usage in `addressWithPath`. + const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/` + const baseServerURL = new URL(fixedBaseServer) + if (typeof port !== 'undefined') { + baseServerURL.port = port.toString() + } + + return baseServerURL + } + private async callWithRetry(func: () => Promise): Promise { let response: BaseHTTPClientResponse | undefined let numTries = 1 @@ -33,6 +68,7 @@ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { if (numTries >= AlgoHttpClientWithRetry.MAX_TRIES) { throw err } + // Only retry for one of the hardcoded conditions if ( !( @@ -55,6 +91,24 @@ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { } async get(relativePath: string, query?: Query, requestHeaders: Record = {}): Promise { + if (relativePath.startsWith('/v2/transactions/pending/')) { + const possibleTxnId = relativePath.replace('/v2/transactions/pending/', '').replace(/\/+$/, '') + // TODO: test for possibleTxnId + if (possibleTxnId) { + return await this.callWithRetry(async () => { + const httpInfo = await this._algoKitCoreAlgod.pendingTransactionInformationResponse(possibleTxnId, 'msgpack') + const binary = await httpInfo.body.binary() + const arrayBuffer = await binary.arrayBuffer() + const uint8Array = new Uint8Array(arrayBuffer) + return { + status: httpInfo.httpStatusCode, + headers: httpInfo.headers, + body: uint8Array, + } + }) + } + } + const response = await this.callWithRetry(() => super.get(relativePath, query, requestHeaders)) if ( relativePath.startsWith('/v2/accounts/') && @@ -94,6 +148,58 @@ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { query?: Query, requestHeaders: Record = {}, ): Promise { + if (relativePath.startsWith('/v2/transactions')) { + let signedTxn: SignedTransaction | undefined = undefined + try { + // Try to decode the data into a single transaction + // This will fail when sending a transaction group, in that case, we will ignore the error + signedTxn = decodeSignedTransaction(data) + } catch { + // Ignore errors here + } + if (signedTxn && signedTxn.txn.type === TransactionType.pay) { + return await this.callWithRetry(async () => { + const responseContext = await this._algoKitCoreAlgod.rawTransactionResponse(new File([data], '')) + + const binary = await responseContext.body.binary() + const arrayBuffer = await binary.arrayBuffer() + const uint8Array = new Uint8Array(arrayBuffer) + + if (responseContext.httpStatusCode !== 200) { + // This logic is copied from algosdk to make sure that we produce the same errors + let bodyErrorMessage: string | undefined + + try { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const decoded: Record = JSON.parse(new TextDecoder().decode(uint8Array)) + if (decoded.message) { + bodyErrorMessage = decoded.message + } + } catch { + // ignore any error that happened while we are parsing the error response + } + + let message = `Network request error. Received status ${responseContext.httpStatusCode} (${responseContext.httpStatusText})` + if (bodyErrorMessage) { + message += `: ${bodyErrorMessage}` + } + + throw new URLTokenBaseHTTPError(message, { + body: uint8Array, + status: responseContext.httpStatusCode, + headers: responseContext.headers, + }) + } + + return { + status: responseContext.httpStatusCode, + statusText: responseContext.httpStatusText, + headers: responseContext.headers, + body: uint8Array, + } + }) + } + } return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders)) } @@ -106,3 +212,15 @@ export class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient { return await this.callWithRetry(() => super.delete(relativePath, data, query, requestHeaders)) } } + +// This is a copy of URLTokenBaseHTTPError from algosdk +class URLTokenBaseHTTPError extends Error implements BaseHTTPClientError { + constructor( + message: string, + public response: BaseHTTPClientResponse, + ) { + super(message) + this.name = 'URLTokenBaseHTTPError' + this.response = response + } +} diff --git a/src/types/algokit-core-bridge.ts b/src/types/algokit-core-bridge.ts new file mode 100644 index 00000000..8ddb3879 --- /dev/null +++ b/src/types/algokit-core-bridge.ts @@ -0,0 +1,97 @@ +import * as algodApi from '@algorandfoundation/algokit-algod-api' +import { addressFromString, Transaction as AlgokitCoreTransaction, encodeTransactionRaw } from '@algorandfoundation/algokit-transact' +import algosdk, { Address, TokenHeader } from 'algosdk' + +function getAlgokitCoreAddress(address: string | Address) { + return addressFromString(typeof address === 'string' ? address : address.toString()) +} + +// Experimental feature to build algosdk payment transactions with algokit-core +export function buildPayment({ + sender, + receiver, + amount, + closeRemainderTo, + rekeyTo, + note, + lease, + suggestedParams, +}: algosdk.PaymentTransactionParams & algosdk.CommonTransactionParams) { + const txnModel: AlgokitCoreTransaction = { + sender: getAlgokitCoreAddress(sender), + transactionType: 'Payment', + fee: BigInt(suggestedParams.fee), + firstValid: BigInt(suggestedParams.firstValid), + lastValid: BigInt(suggestedParams.lastValid), + genesisHash: suggestedParams.genesisHash, + genesisId: suggestedParams.genesisID, + rekeyTo: rekeyTo ? getAlgokitCoreAddress(rekeyTo) : undefined, + note: note, + lease: lease, + payment: { + amount: BigInt(amount), + receiver: getAlgokitCoreAddress(receiver), + closeRemainderTo: closeRemainderTo ? getAlgokitCoreAddress(closeRemainderTo) : undefined, + }, + } + + let fee = BigInt(suggestedParams.fee) + if (!suggestedParams.flatFee) { + const minFee = BigInt(suggestedParams.minFee) + const numAddlBytesAfterSigning = 75 + const estimateTxnSize = encodeTransactionRaw(txnModel).length + numAddlBytesAfterSigning + + fee *= BigInt(estimateTxnSize) + // If suggested fee too small and will be rejected, set to min tx fee + if (fee < minFee) { + fee = minFee + } + } + txnModel.fee = fee + + return algosdk.decodeUnsignedTransaction(encodeTransactionRaw(txnModel)) +} + +export class TokenHeaderAuthenticationMethod implements algodApi.SecurityAuthentication { + private _header: string + private _key: string + + public constructor(tokenHeader: TokenHeader) { + if (Object.entries(tokenHeader).length === 0) { + throw new Error('Cannot construct empty token header auth') + } + + const [header, key] = Object.entries(tokenHeader)[0] + this._header = header + this._key = key + } + + public getName(): string { + return 'custom_header' + } + + public applySecurityAuthentication(context: algodApi.RequestContext) { + context.setHeaderParam(this._header, this._key) + } +} + +export function buildAlgoKitCoreAlgodClient(baseUrl: URL, tokenHeader: TokenHeader): algodApi.AlgodApi { + const authMethodConfig = Object.entries(tokenHeader).length > 0 ? new TokenHeaderAuthenticationMethod(tokenHeader) : undefined + const authConfig: algodApi.AuthMethodsConfiguration = { + default: authMethodConfig, + } + + // Create configuration parameter object + const fixedBaseUrl = baseUrl.toString().replace(/\/+$/, '') + const serverConfig = new algodApi.ServerConfiguration(fixedBaseUrl, {}) + const configurationParameters = { + httpApi: new algodApi.IsomorphicFetchHttpLibrary(), + baseServer: serverConfig, + authMethods: authConfig, + promiseMiddleware: [], + } + + // Convert to actual configuration + const config = algodApi.createConfiguration(configurationParameters) + return new algodApi.AlgodApi(config) +} diff --git a/src/types/composer.ts b/src/types/composer.ts index d7eaf0a7..083a0b80 100644 --- a/src/types/composer.ts +++ b/src/types/composer.ts @@ -3,6 +3,7 @@ import { Config } from '../config' import { encodeLease, getABIReturnValue, sendAtomicTransactionComposer } from '../transaction/transaction' import { asJson, calculateExtraProgramPages } from '../util' import { TransactionSignerAccount } from './account' +import { buildPayment as buildPaymentWithAlgoKitCore } from './algokit-core-bridge' import { AlgoAmount } from './amount' import { AppManager, BoxIdentifier, BoxReference } from './app-manager' import { Expand } from './expand' @@ -1682,7 +1683,7 @@ export class TransactionComposer { } private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) { - return this.commonTxnBuildStep(algosdk.makePaymentTxnWithSuggestedParamsFromObject, params, { + return this.commonTxnBuildStep(buildPaymentWithAlgoKitCore, params, { sender: params.sender, receiver: params.receiver, amount: params.amount.microAlgo,