File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -1866,22 +1866,27 @@ async function preorder(_network: CLINetworkAdapter, args: string[]): Promise<st
1866
1866
} ) ;
1867
1867
}
1868
1868
1869
- function faucetCall ( _ : CLINetworkAdapter , args : string [ ] ) : Promise < string > {
1869
+ function faucetCall ( network : CLINetworkAdapter , args : string [ ] ) : Promise < string > {
1870
1870
const address = args [ 0 ] ;
1871
1871
// console.log(address);
1872
1872
1873
+ // Use network configuration if available, otherwise default to testnet
1874
+ // Since faucets only exist on testnets, we default to testnet if no custom URL is provided
1875
+ const basePath = network . nodeAPIUrl || HIRO_TESTNET_URL ;
1876
+
1873
1877
const apiConfig = new Configuration ( {
1874
- basePath : 'https://api.testnet.hiro.so' ,
1878
+ basePath,
1875
1879
} ) ;
1876
1880
1877
1881
const faucets = new FaucetsApi ( apiConfig ) ;
1882
+ const stacksNetwork = getStacksNetwork ( network ) ;
1878
1883
1879
1884
return faucets
1880
1885
. runFaucetStx ( { address } )
1881
1886
. then ( ( faucetTx : any ) => {
1882
1887
return JSONStringify ( {
1883
1888
txid : faucetTx . txId ! ,
1884
- transaction : generateExplorerTxPageUrl ( faucetTx . txId ! . replace ( / ^ 0 x / , '' ) , STACKS_TESTNET ) ,
1889
+ transaction : generateExplorerTxPageUrl ( faucetTx . txId ! . replace ( / ^ 0 x / , '' ) , stacksNetwork ) ,
1885
1890
} ) ;
1886
1891
} )
1887
1892
. catch ( ( error : any ) => error . toString ( ) ) ;
You can’t perform that action at this time.
0 commit comments