mirror of
https://github.com/stxer/stxer-sdk.git
synced 2026-01-12 15:34:01 +08:00
feat: auto-switch to testnet endpoints based on network option
When network is set to 'testnet', the default API endpoints now automatically use: - apiEndpoint: https://testnet-api.stxer.xyz - stacksNodeAPI: https://api.testnet.hiro.so 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -126,9 +126,13 @@ export class SimulationBuilder {
|
||||
private network: StacksNetworkName | string;
|
||||
|
||||
private constructor(options: SimulationBuilderOptions = {}) {
|
||||
this.apiEndpoint = options.apiEndpoint ?? 'https://api.stxer.xyz';
|
||||
this.stacksNodeAPI = options.stacksNodeAPI ?? 'https://api.hiro.so';
|
||||
this.network = options.network ?? 'mainnet';
|
||||
const isTestnet = this.network === 'testnet';
|
||||
|
||||
this.apiEndpoint = options.apiEndpoint ??
|
||||
(isTestnet ? 'https://testnet-api.stxer.xyz' : 'https://api.stxer.xyz');
|
||||
this.stacksNodeAPI = options.stacksNodeAPI ??
|
||||
(isTestnet ? 'https://api.testnet.hiro.so' : 'https://api.hiro.so');
|
||||
}
|
||||
|
||||
public static new(options?: SimulationBuilderOptions) {
|
||||
|
||||
Reference in New Issue
Block a user