Closed robdmoore closed 5 months ago
LGTM. We should get eyes on it from devrel before merging though mainly to keep them in the loop and make sure there's no objections.
@SilentRhetoric no need for line-by-line review, but general summary is
Thank you for your work on this! The consolidation of clients should make the library easier to use, investigate with Intellisense, teach, and maintain.
Agreed! This is the first of a number of pull requests to gracefully bring the new way of working with the library into being so expect a few more pull requests.
Inspired by #286, but a slightly different approach that starts to lay the foundation for deprecating the old way of using AlgoKit Utils in favour of the new approach using AlgorandClient.
This method allows us to keep this library in a releasable state while working on the deprecation bit by bit.
The patterns in this pull request help us guide users towards where we want and do proper deprecation of old vs new world, keep the documentation clear, keep the migration path clear and not have to do the migration all in a big bang.
Deprecates the following in favour of new
AlgorandClient
exposed functionality:algokit.multisigAccount
algokit.rekeyedAccount
algokit.transactionSignerAccount
algokit.randomAccount
algokit.mnemonicAccountFromEnvironment
algokit.getAccountAddressAsUint8Array
algokit.getAccountAddressAsString
algokit.getAccountInformation
algokit.getAccountAssetInformation
algokit.getAccount
algokit.getDispenserAccount
algokit.mnemonicAccount
algokit.getTestNetDispenserApiClient
algokit.getKmdWalletAccount
algokit.getKmdWalletAccount
algokit.getOrCreateKmdWalletAccount
algokit.isLocalNet
algokit.getConfigFromEnvOrDefaults
algokit.getAlgodConfigFromEnvironment
algokit.getIndexerConfigFromEnvironment
algokit.getAlgoNodeConfig
algokit.getDefaultLocalNetConfig
algokit.getAlgoClient
algokit.getAlgoIndexerClient
algokit.getAlgoKmdClient
algokit.isTestNet
algokit.isMainNet
algorandFixture(undefined, config)
override (now you can pass in clients or client configs to the first parameter ofalgorandFixture
)AccountConfig
intypes/account
Changes:
getTestAccount
to take anAlgorandClient
rather thanalgod
andkmd
(no change forgetTestAccount
method exposed fromalgorandFixture
though, which is the primary way of accessing it (outside of a tweak to the recently addedaccountGetter
parameter to also take anAlgorandClient
)algorandFixture().context
now has analgorand
property with anAlgorandClient
instancedispenser()
method inAccountManager
is now calleddispenserFromEnvironment()
to reflect the fact it loads environment variables and expects a Node.js environmentAdditions:
getAccountTransactionSigner
method exposed fromtypes/account-manager
(similar to previousgetSenderTransactionSigner
method)AccountManager
has akmd
property with an instance of the newKmdAccountManager
class, and arekeyed
method that tracks aTransactionSignerAccount
to a different senderKmdAccountManager
class withgetWalletAccount
,getOrCreateWalletAccount
andgetLocalNetDispenserAccount
methodsClientManager
has new instance methods fornetwork()
,isLocalNet()
,isTestNet()
andisMainNet()
and static methods forgetConfigFromEnvironmentOrLocalNet
,getAlgodConfigFromEnvironment
,getIndexerConfigFromEnvironment
,getAlgoNodeConfig
,getDefaultLocalNetConfig
,getAlgodClient
,getAlgodClientFromEnvironment
,getIndexerClient
,getIndexerClientFromEnvironment
,getKmdClient
, andgetKmdClientFromEnvironment