Skip to content

Commit

Permalink
Add ability to add Provider to ProviderList for easier local developm…
Browse files Browse the repository at this point in the history
…ent via environment variable
  • Loading branch information
binarybaron committed Nov 1, 2022
1 parent 68da77c commit 9995427
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/models/cliModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ export interface CliLogBtcTxFound extends CliLog {
};
}

export function isCliLogBtcTxFound(
log: CliLog
): log is CliLogBtcTxFound {
export function isCliLogBtcTxFound(log: CliLog): log is CliLogBtcTxFound {
return log.fields.message === 'Found relevant Bitcoin transaction';
}

Expand Down
17 changes: 17 additions & 0 deletions src/store/features/providersSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ export const providersSlice = createSlice({
initialState,
reducers: {
setProviders(slice, action: PayloadAction<ExtendedProviderStatus[]>) {
if (
process.env.STUB_TESTNET_PROVIDER_MULTIADDR &&
process.env.STUB_TESTNET_PROVIDER_PEER_ID
) {
action.payload.push({
multiAddr: process.env.STUB_TESTNET_PROVIDER_MULTIADDR,
peerId: process.env.STUB_TESTNET_PROVIDER_PEER_ID,
testnet: true,
age: 0,
maxSwapAmount: 10000000,
minSwapAmount: 100000,
price: 700000,
relevancy: 1,
uptime: 1,
});
}

const providers = sortProviderList(action.payload).filter(
(provider) => provider.testnet === isTestnet()
);
Expand Down

0 comments on commit 9995427

Please sign in to comment.