getSessionsConfig function

SessionsDeploymentConfig getSessionsConfig(
  1. String network
)

The deployed sessions ids for network, so a caller does not transcribe them. Generated from the deploy manifest — see lib/src/deployments/. The returned object also carries SessionsSpotIds for the generated spot wrappers.

Throws if the network has no recorded deployment, rather than returning placeholder ids.

final sessions = SessionsContract(getSessionsConfig('testnet'));

Implementation

SessionsDeploymentConfig getSessionsConfig(String network) {
  if (network == 'testnet') return _testnetSessionsConfig;
  if (network == 'mainnet') return _mainnetSessionsConfig;
  throw ConfigurationError(
      "deepbook/sessions: no sessions deployment recorded for network "
      "'$network'. Sessions is recorded for testnet and mainnet; for your "
      'own deployment construct a SessionsConfig and pass it to '
      'SessionsContract directly.');
}