Skip to content

Commit

Permalink
Merge pull request #53 from CudoVentures/cudos-dev
Browse files Browse the repository at this point in the history
Cudos dev
  • Loading branch information
maptuhec authored Dec 6, 2022
2 parents 975f47b + 4c063cc commit 40d3622
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/ledgers/CosmostationLedger.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { cosmos, InstallError } from "@cosmostation/extension-client"

import {
API_ADDRESS,
CHAIN_ID,
CHAIN_NAME,
CURRENCY_DISPLAY_NAME,
GAS_PRICE,
NATIVE_TOKEN_DENOM
import {
API_ADDRESS,
CHAIN_ID,
CHAIN_NAME,
CURRENCY_DISPLAY_NAME,
GAS_PRICE,
NATIVE_TOKEN_DENOM
} from "utils/constants"

export const connectCosmostationLedger = async (): Promise<{ address: string; accountName: string; }> => {
Expand All @@ -16,9 +16,9 @@ export const connectCosmostationLedger = async (): Promise<{ address: string; ac

try {
const provider = await cosmos()
const activatedChains = await provider.getActivatedChains()
const activatedChains = await provider.getActivatedChainIds()

if (!activatedChains.includes(CHAIN_NAME.toLowerCase())) {
if (!activatedChains.includes(CHAIN_ID.toLowerCase())) {
await provider.addChain({
chainId: CHAIN_ID,
chainName: CHAIN_NAME,
Expand All @@ -36,7 +36,8 @@ export const connectCosmostationLedger = async (): Promise<{ address: string; ac
})
}

const acccount = await provider.requestAccount(CHAIN_NAME)
// Although the method suggests CHAIN_NAME as parameter only, it can work with CHAIN_ID too!
const acccount = await provider.requestAccount(CHAIN_ID)
userAccountAddress = acccount.address
userAccountName = acccount.name

Expand Down

0 comments on commit 40d3622

Please sign in to comment.