getAccountConfig function

AccountConfig getAccountConfig(
  1. String network
)

The deployed account ids for network, so a caller does not transcribe them. Generated from the deploy manifest — see lib/src/deployments/.

Throws if the network has no recorded deployment, rather than returning placeholder ids that would fail as a confusing on-chain abort.

final account = AccountContract(getAccountConfig('testnet'));

Implementation

AccountConfig getAccountConfig(String network) {
  if (network == 'testnet') return testnetAccount;
  if (network == 'mainnet') return mainnetAccount;
  throw ConfigurationError(
      "deepbook/account: no account deployment recorded for network "
      "'$network'. The account primitive is recorded for testnet and "
      'mainnet; for your own deployment pass AccountConfig('
      'accountPackageId: ..., accountRegistry: ...) to AccountContract '
      'directly.');
}