-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #385 from alleslabs/feat/cosmos-kit-upgrade
feat: upgrade cosmos kit version and replace hooks
- Loading branch information
Showing
68 changed files
with
2,222 additions
and
965 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useChain } from "@cosmos-kit/react"; | ||
|
||
import { useCelatoneApp } from "../contexts"; | ||
|
||
export const useCurrentChain = () => { | ||
const { | ||
chainConfig: { registryChainName }, | ||
} = useCelatoneApp(); | ||
return useChain(registryChainName); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import { useWallet } from "@cosmos-kit/react"; | ||
|
||
import { useCelatoneApp } from "../contexts"; | ||
|
||
import { useCurrentChain } from "./useCurrentChain"; | ||
|
||
export const useLCDEndpoint = () => { | ||
const { currentChainRecord } = useWallet(); | ||
const { chainWallet } = useCurrentChain(); | ||
const { chainConfig } = useCelatoneApp(); | ||
const restRecord = chainWallet?.chainRecord.preferredEndpoints?.rest?.[0]; | ||
const endpoint = | ||
typeof restRecord === "string" ? restRecord : restRecord?.url; | ||
|
||
return currentChainRecord?.preferredEndpoints?.rest?.[0] ?? chainConfig.lcd; | ||
return endpoint ?? chainConfig.lcd; | ||
}; |
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { useWallet } from "@cosmos-kit/react"; | ||
|
||
import { useCelatoneApp } from "../contexts"; | ||
|
||
import { useCurrentChain } from "./useCurrentChain"; | ||
|
||
export const useRPCEndpoint = () => { | ||
const { currentChainRecord } = useWallet(); | ||
const { chainWallet } = useCurrentChain(); | ||
const { chainConfig } = useCelatoneApp(); | ||
const rpcRecord = chainWallet?.chainRecord.preferredEndpoints?.rpc?.[0]; | ||
const endpoint = typeof rpcRecord === "string" ? rpcRecord : rpcRecord?.url; | ||
|
||
return currentChainRecord?.preferredEndpoints?.rpc?.[0] ?? chainConfig.rpc; | ||
return endpoint ?? chainConfig.rpc; | ||
}; |
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.