-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into caravan-descriptors
- Loading branch information
Showing
21 changed files
with
181 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@caravan/coordinator": minor | ||
--- | ||
|
||
Use @caravan/clients for client requests and revert to use blockstream as default. This is to avoid rate limiting issues with mempool.space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { Dispatch } from "react"; | ||
import { BlockchainClient, ClientType } from "@caravan/clients"; | ||
|
||
export const SET_CLIENT_TYPE = "SET_CLIENT_TYPE"; | ||
export const SET_CLIENT_URL = "SET_CLIENT_URL"; | ||
export const SET_CLIENT_USERNAME = "SET_CLIENT_USERNAME"; | ||
export const SET_CLIENT_PASSWORD = "SET_CLIENT_PASSWORD"; | ||
|
||
export const SET_CLIENT_URL_ERROR = "SET_CLIENT_URL_ERROR"; | ||
export const SET_CLIENT_USERNAME_ERROR = "SET_CLIENT_USERNAME_ERROR"; | ||
export const SET_CLIENT_PASSWORD_ERROR = "SET_CLIENT_PASSWORD_ERROR"; | ||
|
||
export const SET_BLOCKCHAIN_CLIENT = "SET_BLOCKCHAIN_CLIENT"; | ||
|
||
// TODO: use this to add more flexibility to client support | ||
// For example, this defaults to blockstream for public client | ||
// but can also support mempool.space as an option | ||
export const getBlockchainClientFromStore = async () => { | ||
return async ( | ||
dispatch: Dispatch<any>, | ||
getState: () => { settings: any; client: any }, | ||
) => { | ||
const { network } = getState().settings; | ||
const { client } = getState(); | ||
if (!client) return; | ||
let clientType: ClientType; | ||
|
||
switch (client.type) { | ||
case "public": | ||
clientType = ClientType.BLOCKSTREAM; | ||
break; | ||
case "private": | ||
clientType = ClientType.PRIVATE; | ||
break; | ||
default: | ||
// this allows us to support other clients in the future | ||
// like mempool.space | ||
clientType = client.type; | ||
} | ||
|
||
const blockchainClient = new BlockchainClient({ | ||
client, | ||
type: clientType, | ||
network, | ||
throttled: true, | ||
}); | ||
dispatch({ type: SET_BLOCKCHAIN_CLIENT, value: blockchainClient }); | ||
return blockchainClient; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.