Skip to content

Commit f1b5883

Browse files
joe-pCopilot
andauthored
feat: use Address in transact and ReadableAddress in composer (#463)
* chore: use projectService * feat: use Address in transact and ReadableAddress in composer * fix: fix inverted equality checks Co-authored-by: Copilot <[email protected]> * chore: rm functions that were already in array.ts * chore: rm unecessary function and tweak comment * chore: update equality checks * test: fix zero address sender * chore: simpler getAddress * chore: rm unused import * chore: use transact TransactionSigner * fix: fix remaining issues that lead to test failures * chore: lint fix and docs * chore: move address and signer definitions to avoid circular deps * docs: generate docs * chore: re-export types in sdk/encoding/address.ts * chore: replace TransactionSignerAccount usage with AddressWithSigner --------- Co-authored-by: Copilot <[email protected]>
1 parent ac714e7 commit f1b5883

File tree

204 files changed

+5738
-8856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+5738
-8856
lines changed

algokit-configs/openapi-converter/specs/algod.oas3.json

Lines changed: 170 additions & 676 deletions
Large diffs are not rendered by default.

algokit-configs/openapi-converter/specs/indexer.oas3.json

Lines changed: 149 additions & 596 deletions
Large diffs are not rendered by default.

algokit-configs/openapi-converter/specs/kmd.oas3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1950,4 +1950,4 @@
19501950
}
19511951
},
19521952
"x-original-swagger-version": "2.0"
1953-
}
1953+
}

docs/code/classes/types_account_manager.AccountManager.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const accountManager = new AccountManager(clientManager)
8585

8686
#### Index signature
8787

88-
[address: `string`]: [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md)
88+
[address: `string`]: `AddressWithSigner`
8989

9090
#### Defined in
9191

@@ -191,7 +191,7 @@ ___
191191

192192
### dispenserFromEnvironment
193193

194-
**dispenserFromEnvironment**(): `Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
194+
**dispenserFromEnvironment**(): `Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
195195

196196
Returns an account (with private key loaded) that can act as a dispenser from
197197
environment variables, or against default LocalNet if no environment variables present.
@@ -203,7 +203,7 @@ process.env.DISPENSER_SENDER if it's a rekeyed account.
203203

204204
#### Returns
205205

206-
`Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
206+
`Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
207207

208208
The account
209209

@@ -357,7 +357,7 @@ ___
357357

358358
### fromEnvironment
359359

360-
**fromEnvironment**(`name`, `fundWith?`): `Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
360+
**fromEnvironment**(`name`, `fundWith?`): `Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
361361

362362
Tracks and returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.
363363

@@ -380,7 +380,7 @@ This allows you to write code that will work seamlessly in production and local
380380

381381
#### Returns
382382

383-
`Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
383+
`Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
384384

385385
The account
386386

@@ -402,7 +402,7 @@ ___
402402

403403
### fromKmd
404404

405-
**fromKmd**(`name`, `predicate?`, `sender?`): `Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
405+
**fromKmd**(`name`, `predicate?`, `sender?`): `Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
406406

407407
Tracks and returns an Algorand account with private key loaded from the given KMD wallet (identified by name).
408408

@@ -416,7 +416,7 @@ Tracks and returns an Algorand account with private key loaded from the given KM
416416

417417
#### Returns
418418

419-
`Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
419+
`Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
420420

421421
The account
422422

@@ -436,7 +436,7 @@ ___
436436

437437
### fromMnemonic
438438

439-
**fromMnemonic**(`mnemonicSecret`, `sender?`): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }
439+
**fromMnemonic**(`mnemonicSecret`, `sender?`): `Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }
440440

441441
Tracks and returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
442442

@@ -449,7 +449,7 @@ Tracks and returns an Algorand account with secret key loaded (i.e. that can sig
449449

450450
#### Returns
451451

452-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }
452+
`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }
453453

454454
The account
455455

@@ -468,30 +468,30 @@ ___
468468

469469
### getAccount
470470

471-
**getAccount**(`sender`): [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md)
471+
**getAccount**(`sender`): `AddressWithSigner`
472472

473-
Returns the `TransactionSignerAccount` for the given sender address.
473+
Returns the `AddressWithSigner` for the given sender address.
474474

475475
If no signer has been registered for that address then an error is thrown.
476476

477477
#### Parameters
478478

479479
| Name | Type | Description |
480480
| :------ | :------ | :------ |
481-
| `sender` | `string` \| `Address` | The sender address |
481+
| `sender` | `ReadableAddress` | The sender address |
482482

483483
#### Returns
484484

485-
[`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md)
485+
`AddressWithSigner`
486486

487-
The `TransactionSignerAccount` or throws an error if not found
487+
The `AddressWithSigner` or throws an error if not found
488488

489489
**`Example`**
490490

491491
```typescript
492492
const sender = accountManager.random()
493493
// ...
494-
// Returns the `TransactionSignerAccount` for `sender` that has previously been registered
494+
// Returns the `AddressWithSigner` for `sender` that has previously been registered
495495
const account = accountManager.getAccount(sender)
496496
```
497497

@@ -513,7 +513,7 @@ Returns the given sender account's current status, balance and spendable amounts
513513

514514
| Name | Type | Description |
515515
| :------ | :------ | :------ |
516-
| `sender` | `string` \| `Address` | The account / address to look up |
516+
| `sender` | `ReadableAddress` | The account / address to look up |
517517

518518
#### Returns
519519

@@ -547,7 +547,7 @@ if not then an error is thrown.
547547

548548
| Name | Type | Description |
549549
| :------ | :------ | :------ |
550-
| `sender` | `string` \| `Address` | The sender address |
550+
| `sender` | `ReadableAddress` | The sender address |
551551

552552
#### Returns
553553

@@ -569,13 +569,13 @@ ___
569569

570570
### localNetDispenser
571571

572-
**localNetDispenser**(): `Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
572+
**localNetDispenser**(): `Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
573573

574574
Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts).
575575

576576
#### Returns
577577

578-
`Promise`\<`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
578+
`Promise`\<`Address` & `AddressWithSigner` & \{ `account`: [`SigningAccount`](types_account.SigningAccount.md) }\>
579579

580580
The account
581581

@@ -593,7 +593,7 @@ ___
593593

594594
### logicsig
595595

596-
**logicsig**(`program`, `args?`): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `LogicSigAccount` }
596+
**logicsig**(`program`, `args?`): `Address` & `AddressWithSigner` & \{ `account`: `LogicSigAccount` }
597597

598598
Tracks and returns an account that represents a logic signature.
599599

@@ -606,7 +606,7 @@ Tracks and returns an account that represents a logic signature.
606606

607607
#### Returns
608608

609-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `LogicSigAccount` }
609+
`Address` & `AddressWithSigner` & \{ `account`: `LogicSigAccount` }
610610

611611
A logic signature account wrapper
612612

@@ -624,7 +624,7 @@ ___
624624

625625
### multisig
626626

627-
**multisig**(`multisigParams`, `signingAccounts`): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`MultisigAccount`](types_account.MultisigAccount.md) }
627+
**multisig**(`multisigParams`, `signingAccounts`): `Address` & `AddressWithSigner` & \{ `account`: [`MultisigAccount`](types_account.MultisigAccount.md) }
628628

629629
Tracks and returns an account that supports partial or full multisig signing.
630630

@@ -637,7 +637,7 @@ Tracks and returns an account that supports partial or full multisig signing.
637637

638638
#### Returns
639639

640-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: [`MultisigAccount`](types_account.MultisigAccount.md) }
640+
`Address` & `AddressWithSigner` & \{ `account`: [`MultisigAccount`](types_account.MultisigAccount.md) }
641641

642642
A multisig account wrapper
643643

@@ -656,13 +656,13 @@ ___
656656

657657
### random
658658

659-
**random**(): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `default` }
659+
**random**(): `Address` & `AddressWithSigner` & \{ `account`: `default` }
660660

661661
Tracks and returns a new, random Algorand account with secret key loaded.
662662

663663
#### Returns
664664

665-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `default` }
665+
`Address` & `AddressWithSigner` & \{ `account`: `default` }
666666

667667
The account
668668

@@ -691,7 +691,7 @@ Rekey an account to a new address.
691691
| Name | Type | Description |
692692
| :------ | :------ | :------ |
693693
| `account` | `string` \| `Address` | The account to rekey |
694-
| `rekeyTo` | `string` \| `Address` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | The account address or signing account of the account that will be used to authorise transactions for the rekeyed account going forward. If a signing account is provided that will now be tracked as the signer for `account` in this `AccountManager` |
694+
| `rekeyTo` | `string` \| `Address` \| `AddressWithSigner` | The account address or signing account of the account that will be used to authorise transactions for the rekeyed account going forward. If a signing account is provided that will now be tracked as the signer for `account` in this `AccountManager` |
695695
| `options?` | `Omit`\<[`CommonTransactionParams`](../modules/types_composer.md#commontransactionparams), ``"sender"``\> & [`SendParams`](../interfaces/types_transaction.SendParams.md) | Any parameters to control the transaction or execution of the transaction |
696696

697697
#### Returns
@@ -740,7 +740,7 @@ ___
740740

741741
### rekeyed
742742

743-
**rekeyed**(`sender`, `account`): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: \{ `addr`: `Address` ; `signer`: `TransactionSigner` = account.signer } }
743+
**rekeyed**(`sender`, `account`): `Address` & `AddressWithSigner` & \{ `account`: \{ `addr`: `Address` ; `signer`: `TransactionSigner` = account.signer } }
744744

745745
Tracks and returns an Algorand account that is a rekeyed version of the given account to a new sender.
746746

@@ -749,11 +749,11 @@ Tracks and returns an Algorand account that is a rekeyed version of the given ac
749749
| Name | Type | Description |
750750
| :------ | :------ | :------ |
751751
| `sender` | `string` \| `Address` | The sender address to use as the new sender |
752-
| `account` | [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | The account to use as the signer for this new rekeyed account |
752+
| `account` | `AddressWithSigner` | The account to use as the signer for this new rekeyed account |
753753

754754
#### Returns
755755

756-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: \{ `addr`: `Address` ; `signer`: `TransactionSigner` = account.signer } }
756+
`Address` & `AddressWithSigner` & \{ `account`: \{ `addr`: `Address` ; `signer`: `TransactionSigner` = account.signer } }
757757

758758
The account
759759

@@ -783,7 +783,7 @@ then an error will be thrown from `getSigner` / `getAccount`.
783783

784784
| Name | Type | Description |
785785
| :------ | :------ | :------ |
786-
| `signer` | `TransactionSigner` \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | The signer to use, either a `TransactionSigner` or a `TransactionSignerAccount` |
786+
| `signer` | `AddressWithSigner` \| `TransactionSigner` | The signer to use, either a `TransactionSigner` or a `AddressWithSigner` |
787787

788788
#### Returns
789789

@@ -794,7 +794,7 @@ The `AccountManager` so method calls can be chained
794794
**`Example`**
795795

796796
```typescript
797-
const signer = accountManager.random() // Can be anything that returns a `algosdk.TransactionSigner` or `TransactionSignerAccount`
797+
const signer = accountManager.random() // Can be anything that returns a `TransactionSigner` or `AddressWithSigner`
798798
accountManager.setDefaultSigner(signer)
799799

800800
// When signing a transaction, if there is no signer registered for the sender then the default signer will be used
@@ -811,14 +811,14 @@ ___
811811

812812
**setSigner**(`sender`, `signer`): [`AccountManager`](types_account_manager.AccountManager.md)
813813

814-
Tracks the given `algosdk.TransactionSigner` against the given sender address for later signing.
814+
Tracks the given `TransactionSigner` against the given sender address for later signing.
815815

816816
#### Parameters
817817

818818
| Name | Type | Description |
819819
| :------ | :------ | :------ |
820820
| `sender` | `string` \| `Address` | The sender address to use this signer for |
821-
| `signer` | `TransactionSigner` | The `algosdk.TransactionSigner` to sign transactions with for the given sender |
821+
| `signer` | `TransactionSigner` | The `TransactionSigner` to sign transactions with for the given sender |
822822

823823
#### Returns
824824

@@ -852,7 +852,7 @@ Note: If you are generating accounts via the various methods on `AccountManager`
852852

853853
| Name | Type | Description |
854854
| :------ | :------ | :------ |
855-
| `account` | `default` \| `LogicSigAccount` \| [`MultisigAccount`](types_account.MultisigAccount.md) \| [`SigningAccount`](types_account.SigningAccount.md) \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) | The account to register, which can be a `TransactionSignerAccount` or a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount` |
855+
| `account` | `AddressWithSigner` \| `default` \| `LogicSigAccount` \| [`MultisigAccount`](types_account.MultisigAccount.md) \| [`SigningAccount`](types_account.SigningAccount.md) | The account to register, which can be a `AddressWithSigner` or a `algosdk.Account`, `algosdk.LogicSigAccount`, `SigningAccount` or `MultisigAccount` |
856856

857857
#### Returns
858858

@@ -912,16 +912,16 @@ ___
912912

913913
### signerAccount
914914

915-
**signerAccount**\<`T`\>(`account`): `Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `T` }
915+
**signerAccount**\<`T`\>(`account`): `Address` & `AddressWithSigner` & \{ `account`: `T` }
916916

917917
Records the given account (that can sign) against the address of the provided account for later
918-
retrieval and returns a `TransactionSignerAccount` along with the original account in an `account` property.
918+
retrieval and returns a `AddressWithSigner` along with the original account in an `account` property.
919919

920920
#### Type parameters
921921

922922
| Name | Type |
923923
| :------ | :------ |
924-
| `T` | extends `default` \| `LogicSigAccount` \| [`MultisigAccount`](types_account.MultisigAccount.md) \| [`SigningAccount`](types_account.SigningAccount.md) \| [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) |
924+
| `T` | extends `AddressWithSigner` \| `default` \| `LogicSigAccount` \| [`MultisigAccount`](types_account.MultisigAccount.md) \| [`SigningAccount`](types_account.SigningAccount.md) |
925925

926926
#### Parameters
927927

@@ -931,7 +931,7 @@ retrieval and returns a `TransactionSignerAccount` along with the original accou
931931

932932
#### Returns
933933

934-
`Address` & [`TransactionSignerAccount`](../interfaces/types_account.TransactionSignerAccount.md) & \{ `account`: `T` }
934+
`Address` & `AddressWithSigner` & \{ `account`: `T` }
935935

936936
#### Defined in
937937

docs/code/classes/types_algo_http_client_with_retry.AlgoHttpClientWithRetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ URLTokenBaseHTTPClient.constructor
5757

5858
#### Defined in
5959

60-
[packages/sdk/src/client/urlTokenBaseHTTPClient.ts:53](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/packages/sdk/src/client/urlTokenBaseHTTPClient.ts#L53)
60+
[packages/sdk/src/client/urlTokenBaseHTTPClient.ts:44](https://github.com/algorandfoundation/algokit-utils-ts/blob/main/packages/sdk/src/client/urlTokenBaseHTTPClient.ts#L44)
6161

6262
## Properties
6363

0 commit comments

Comments
 (0)