AnsClient constructor

AnsClient(
  1. Network network, {
  2. String? fullNodeEndpoint,
  3. String? indexerEndpoint,
})

Implementation

AnsClient(this.network,{String? fullNodeEndpoint, String? indexerEndpoint}) {
  switch (network) {
    case Network.mainnet:
      contractAddress = ansContractsMap.mainnet;
      aptosClient = AptosClient(fullNodeEndpoint ?? Constants.mainnetAPI);
      indexerClient = IndexerClient(indexerEndpoint ?? Constants.mainnetIndexer);
      break;
    case Network.testnet:
      contractAddress = ansContractsMap.testnet;
      aptosClient = AptosClient(fullNodeEndpoint ?? Constants.testnetAPI);
      indexerClient = IndexerClient(indexerEndpoint ?? Constants.testnetIndexer);
      break;
    case Network.devnet:
      contractAddress = ansContractsMap.testnet;
      aptosClient = AptosClient(fullNodeEndpoint ?? Constants.devnetAPI);
      indexerClient = IndexerClient(indexerEndpoint ?? Constants.devnetIndexer);
      break;
    default:
      throw ArgumentError("Undefined network type $network");
  }
}