StacksNetworkName
A string union type representing the four pre-configured Stacks network names.
Usage
import { StacksNetworkName } from '@stacks/network';
function getExplorerUrl(network: StacksNetworkName): string {
switch (network) {
case 'mainnet':
return 'https://explorer.hiro.so';
case 'testnet':
return 'https://explorer.hiro.so/?chain=testnet';
default:
return 'http://localhost:3999';
}
}Most @stacks/transactions builder functions accept StacksNetworkName directly for the network property:
import { makeSTXTokenTransfer } from '@stacks/transactions';
const tx = await makeSTXTokenTransfer({
// ...
network: 'testnet', // StacksNetworkName
});Definition
Values
Value
Description
'mainnet'
Stacks mainnet — resolves to STACKS_MAINNET
'testnet'
Stacks testnet — resolves to STACKS_TESTNET
'devnet'
Local devnet (e.g. Clarinet) — resolves to STACKS_DEVNET
'mocknet'
Mocknet — resolves to STACKS_MOCKNET
Last updated
Was this helpful?