mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-26 10:46:23 -05:00
feat(gui): Specify stub testnet provider via VITE_TESTNET_STUB_PROVIDER_ADDRESS environment variable (#99)
This commit is contained in:
parent
97510a8619
commit
21608ce4f7
2 changed files with 10 additions and 4 deletions
2
src-gui/.env.development
Normal file
2
src-gui/.env.development
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
# You can configure the address of a locally running testnet asb. It'll displayed in the GUI. This is useful for testing
|
||||||
|
# VITE_TESTNET_STUB_PROVIDER_ADDRESS=/ip4/127.0.0.1/tcp/9939/p2p/12D3KooWLaHSfwTW99GpqBZntLodmrFyzockGSVbL6grbN7HXo8x
|
||||||
|
|
@ -6,11 +6,15 @@ export const isTestnet = () => true;
|
||||||
export const isDevelopment = true;
|
export const isDevelopment = true;
|
||||||
|
|
||||||
export function getStubTestnetProvider(): ExtendedProviderStatus | null {
|
export function getStubTestnetProvider(): ExtendedProviderStatus | null {
|
||||||
const stubProviderAddress = process.env.TESTNET_STUB_PROVIDER_ADDRESS;
|
const stubProviderAddress = import.meta.env
|
||||||
|
.VITE_TESTNET_STUB_PROVIDER_ADDRESS;
|
||||||
|
|
||||||
if(stubProviderAddress != null) {
|
console.log(import.meta.env);
|
||||||
|
|
||||||
|
if (stubProviderAddress != null) {
|
||||||
try {
|
try {
|
||||||
const [multiAddr, peerId] = splitPeerIdFromMultiAddress(stubProviderAddress);
|
const [multiAddr, peerId] =
|
||||||
|
splitPeerIdFromMultiAddress(stubProviderAddress);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
multiAddr,
|
multiAddr,
|
||||||
|
|
@ -20,7 +24,7 @@ export function getStubTestnetProvider(): ExtendedProviderStatus | null {
|
||||||
minSwapAmount: 0,
|
minSwapAmount: 0,
|
||||||
price: 0,
|
price: 0,
|
||||||
};
|
};
|
||||||
}catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue