Skip to content

Commit

Permalink
CUDOS-1208 migrate to cudosjs getOfflineSigner
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaghettiOverload committed Jul 20, 2023
1 parent 00acc06 commit b8ff0d8
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 122 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "cudos-multisig-v2",
"license": "MIT",
"private": true,
"version": "0.0.0",
"version": "1.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
Expand All @@ -12,7 +13,6 @@
"dependencies": {
"@apollo/client": "^3.6.9",
"@babel/core": "^7.0.0-0",
"@cosmostation/cosmos-client": "^0.0.1",
"@cosmostation/extension-client": "^0.1.7",
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
Expand All @@ -25,7 +25,7 @@
"bignumber.js": "^9.0.2",
"buffer": "^6.0.3",
"csstype": "^3.0.10",
"cudosjs": "^1.2.7",
"cudosjs": "1.3.4",
"firebase": "^9.9.1",
"goober": "^2.1.1",
"graphql": "^16.5.0",
Expand Down
18 changes: 2 additions & 16 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isExtensionEnabled, OfflineSigner, StargateClient, SUPPORTED_WALLET } from "cudosjs";
import { getOfflineSignerByType, isExtensionEnabled, OfflineSigner, StargateClient, SUPPORTED_WALLET } from "cudosjs";
import { SigningStargateClient } from "cudosjs";
import { getOfflineSigner as cosmostationSigner } from "@cosmostation/cosmos-client";
import { CHAIN_ID, FIREBASE_ADDRESS_BOOK_COLLECTION, RPC_ADDRESS } from "./constants";
import { userState } from "store/user";
import { connectKeplrLedger } from "ledgers/KeplrLedger";
Expand All @@ -14,22 +13,9 @@ export const queryClient = (async (): Promise<StargateClient> => {
return client
})()

const getOfflineSignerByType = async (walletName: SUPPORTED_WALLET): Promise<OfflineSigner | undefined> => {

if (walletName === SUPPORTED_WALLET.Keplr) {
return window.getOfflineSigner!(CHAIN_ID)
}

if (walletName === SUPPORTED_WALLET.Cosmostation) {
return cosmostationSigner(CHAIN_ID)
}

return undefined
}

export const getSigningClient = async (walletName: SUPPORTED_WALLET): Promise<SigningStargateClient> => {

const offlineSigner = await getOfflineSignerByType(walletName)
const offlineSigner = await getOfflineSignerByType(walletName, CHAIN_ID)

if (isExtensionEnabled(walletName)) {
window.keplr.defaultOptions = {
Expand Down
Loading

0 comments on commit b8ff0d8

Please sign in to comment.