Skip to content

Commit

Permalink
Merge pull request #479 from cosmology-tech/pkg/upgrades
Browse files Browse the repository at this point in the history
Pkg/upgrades
  • Loading branch information
pyramation committed Jun 18, 2024
2 parents c9a1276 + e210e6d commit 23d531c
Show file tree
Hide file tree
Showing 37 changed files with 201 additions and 222 deletions.
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"url": "https://github.com/cosmology-tech/cosmos-kit/issues"
},
"dependencies": {
"@chain-registry/client": "^1.44.3",
"@chain-registry/keplr": "^1.64.2",
"@chain-registry/types": "^0.41.3",
"@chain-registry/client": "^1.48.1",
"@chain-registry/keplr": "^1.68.2",
"@chain-registry/types": "^0.45.1",
"@cosmjs/amino": "^0.32.3",
"@cosmjs/cosmwasm-stargate": "^0.32.3",
"@cosmjs/proto-signing": "^0.32.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@cosmos-kit/core": "^2.12.0",
"@cosmos-kit/react": "^2.15.0",
"@interchain-ui/react": "^1.23.13",
"chain-registry": "^1.59.4",
"chain-registry": "^1.63.2",
"cosmos-kit": "^2.17.0",
"fast-fuzzy": "^1.12.0",
"flexsearch": "^0.7.43",
Expand Down
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@web3modal/ui": "^2.0.0-rc.1",
"bignumber.js": "^9.1.1",
"bootstrap": "^5.3.2",
"chain-registry": "^1.59.4",
"chain-registry": "^1.63.2",
"class-variance-authority": "^0.6.1",
"clsx": "^1.2.1",
"cosmjs-types": ">=0.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function MyApp({ Component, pageProps }: AppProps) {
<ChainProvider
// chains={chains}
// assetLists={[...assets]}
chains={["cosmoshub", "secret"]}
chains={["cosmoshub", "secretnetwork"]}
assetLists={[]}
wallets={[
// ...wallets,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-lite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"jest-environment-jsdom": "29.7.0"
},
"dependencies": {
"@chain-registry/types": "^0.41.3",
"@chain-registry/types": "^0.45.1",
"@cosmos-kit/core": "^2.12.0",
"@dao-dao/cosmiframe": "^0.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@types/react-dom": "^18.2"
},
"dependencies": {
"@chain-registry/types": "^0.41.3",
"@chain-registry/types": "^0.45.1",
"@cosmos-kit/core": "^2.12.0",
"@cosmos-kit/react-lite": "^2.11.0",
"@react-icons/all-files": "^4.1.0"
Expand Down
2 changes: 1 addition & 1 deletion wallets/cdcwallet-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion wallets/coin98-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0",
"cosmjs-types": ">=0.9.0"
},
Expand Down
2 changes: 1 addition & 1 deletion wallets/compass-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion wallets/cosmos-extension-metamask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0",
"@cosmsnap/snapper": "^0.1.23",
"cosmjs-types": ">=0.9.0"
Expand Down
2 changes: 1 addition & 1 deletion wallets/cosmostation-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
]
},
"dependencies": {
"@chain-registry/cosmostation": "^1.62.4",
"@chain-registry/cosmostation": "^1.66.2",
"@cosmos-kit/core": "^2.12.0",
"cosmjs-types": "^0.9.0"
},
Expand Down
2 changes: 1 addition & 1 deletion wallets/cosmostation-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
]
},
"dependencies": {
"@chain-registry/cosmostation": "1.62.4",
"@chain-registry/cosmostation": "1.66.2",
"@cosmos-kit/core": "^2.12.0",
"@cosmos-kit/walletconnect": "^2.9.0"
},
Expand Down
2 changes: 1 addition & 1 deletion wallets/fin-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion wallets/galaxy-station-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
]
},
"dependencies": {
"@chain-registry/types": "0.41.3",
"@chain-registry/types": "0.45.1",
"@cosmos-kit/core": "^2.12.0",
"@hexxagon/feather.js": "^1.0.9-beta.8",
"@hexxagon/station-connector": "^1.0.17"
Expand Down
2 changes: 1 addition & 1 deletion wallets/initia-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0",
"@initia/initia-registry-types": "^0.0.17",
"@initia/initia.proto": "^0.1.33"
Expand Down
21 changes: 10 additions & 11 deletions wallets/keplr-extension/src/extension/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,15 @@ export class KeplrClient implements WalletClient {
async addChain(chainInfo: ChainRecord) {
// TODO later allow walletInfo getter to be available here
// make this more generic
const chainsAlreadyAdded = ExpiringLocalStorage.getItems('keplr/supported-chain')
const chainsAlreadyAdded = ExpiringLocalStorage.getItems(
'cosmos-kit@2:keplr/supported-chain'
);
if (chainsAlreadyAdded && chainsAlreadyAdded.length > 0) {
if (chainsAlreadyAdded.includes(chainInfo.name)) {
console.warn(
`${chainInfo.name} is already added. No need to call experimentalSuggestChain()`
);
return;
}
}



const suggestChain = chainRegistryChainToKeplr(
chainInfo.chain,
chainInfo.assetList ? [chainInfo.assetList] : []
Expand All @@ -154,13 +151,15 @@ export class KeplrClient implements WalletClient {

try {
await this.client.experimentalSuggestChain(suggestChain);
ExpiringLocalStorage.addItem('keplr/supported-chain', chainInfo.name, 1000 * 60)
ExpiringLocalStorage.addItem(
'cosmos-kit@2:keplr/supported-chain',
chainInfo.name,
1000 * 60
);
} catch (error) {
console.log('Error while adding chain', error)
throw error
console.log('Error while adding chain', error);
throw error;
}


}

async signAmino(
Expand Down
17 changes: 11 additions & 6 deletions wallets/keplr-extension/src/extension/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ export class ExpiringLocalStorage {
const validItems = [];

// Filter out expired items
for (let item of items) {
for (const item of items) {
if (now.getTime() <= item.expiry) {
validItems.push(item.value);
}
}

// Update local storage with only valid items
localStorage.setItem(key, JSON.stringify(validItems.map(value => ({
value,
expiry: items.find(item => item.value === value).expiry
}))));
localStorage.setItem(
key,
JSON.stringify(
validItems.map((value) => ({
value,
expiry: items.find((item) => item.value === value).expiry,
}))
)
);

return validItems;
}
Expand All @@ -74,7 +79,7 @@ export class ExpiringLocalStorage {
let items = JSON.parse(itemStr);

// Filter out the item to be removed
items = items.filter(item => item.value !== value);
items = items.filter((item) => item.value !== value);

// Update local storage with the remaining items
localStorage.setItem(key, JSON.stringify(items));
Expand Down
2 changes: 1 addition & 1 deletion wallets/keplr-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0",
"@cosmos-kit/keplr-extension": "^2.11.1",
"@cosmos-kit/walletconnect": "^2.9.0",
Expand Down
2 changes: 1 addition & 1 deletion wallets/leap-capsule-social-login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
]
},
"dependencies": {
"@chain-registry/keplr": "1.64.4",
"@chain-registry/keplr": "1.68.2",
"@cosmos-kit/core": "^2.12.0",
"@leapwallet/cosmos-social-login-capsule-provider": "0.0.39"
},
Expand Down
4 changes: 2 additions & 2 deletions wallets/leap-capsule-social-login/src/chain-wallet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChainRecord, ChainWalletBase,Wallet } from '@cosmos-kit/core'
import { ChainRecord, ChainWalletBase, Wallet } from '@cosmos-kit/core';

export class ChainCosmosSocial extends ChainWalletBase {
constructor(walletInfo: Wallet, chainInfo: ChainRecord) {
super(walletInfo, chainInfo)
super(walletInfo, chainInfo);
}
}
34 changes: 21 additions & 13 deletions wallets/leap-capsule-social-login/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF

import { StdSignDoc } from "@cosmjs/amino";
import { SignOptions, SignType } from "@cosmos-kit/core";
import { DirectSignDoc, WalletClient } from "@cosmos-kit/core";
import { CapsuleProvider } from "@leapwallet/cosmos-social-login-capsule-provider";
import { SignDoc } from "cosmjs-types/cosmos/tx/v1beta1/tx";
import { StdSignDoc } from '@cosmjs/amino';
import { SignOptions, SignType } from '@cosmos-kit/core';
import { DirectSignDoc, WalletClient } from '@cosmos-kit/core';
import { CapsuleProvider } from '@leapwallet/cosmos-social-login-capsule-provider';
import { SignDoc } from 'cosmjs-types/cosmos/tx/v1beta1/tx';

export class CosmosCapsuleClient implements WalletClient {
readonly loginProvider: CapsuleProvider;

constructor(options: { loginProvider: CapsuleProvider }) {
this.loginProvider = options.loginProvider
this.loginProvider = options.loginProvider;
}

async disconnect() {
Expand All @@ -20,7 +20,7 @@ export class CosmosCapsuleClient implements WalletClient {
async getSimpleAccount(chainId: string) {
const { address, username } = await this.getAccount(chainId);
return {
namespace: "cosmos",
namespace: 'cosmos',
chainId,
address,
username,
Expand All @@ -29,7 +29,7 @@ export class CosmosCapsuleClient implements WalletClient {

async enable() {
await this.handleConnect();
}
}

async handleConnect() {
await this.loginProvider.handleConnect();
Expand All @@ -40,7 +40,7 @@ export class CosmosCapsuleClient implements WalletClient {
}

getOfflineSigner(chainId: string, preferredSignType?: SignType) {
return this.loginProvider.getOfflineSigner(chainId, preferredSignType)
return this.loginProvider.getOfflineSigner(chainId, preferredSignType);
}

getOfflineSignerAmino(chainId: string): any {
Expand All @@ -55,12 +55,20 @@ export class CosmosCapsuleClient implements WalletClient {
chainId: string,
signer: string,
signDoc: StdSignDoc,
signOptions?: SignOptions,
signOptions?: SignOptions
) {
return this.loginProvider.signAmino(chainId, signer, signDoc, signOptions)
return this.loginProvider.signAmino(chainId, signer, signDoc, signOptions);
}

async signDirect(chainId: string, signer: string, signDoc: DirectSignDoc): Promise<any> {
return this.loginProvider.signDirect(chainId, signer, signDoc as unknown as SignDoc);
async signDirect(
chainId: string,
signer: string,
signDoc: DirectSignDoc
): Promise<any> {
return this.loginProvider.signDirect(
chainId,
signer,
signDoc as unknown as SignDoc
);
}
}
4 changes: 2 additions & 2 deletions wallets/leap-capsule-social-login/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * from './chain-wallet';
export * from './constant';
export * from './main-wallet';
export * from './client';
export * from './constant';
export * from './leap-social';
export * from './main-wallet';
5 changes: 3 additions & 2 deletions wallets/leap-capsule-social-login/src/leap-social.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LeapCapsuleInfo } from "@leapwallet/cosmos-social-login-capsule-provider";
import { LeapCapsuleWallet } from "./main-wallet";
import { LeapCapsuleInfo } from '@leapwallet/cosmos-social-login-capsule-provider';

import { LeapCapsuleWallet } from './main-wallet';

const leapSocial = new LeapCapsuleWallet(LeapCapsuleInfo);

Expand Down
1 change: 1 addition & 0 deletions wallets/leap-capsule-social-login/src/registry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Wallet } from '@cosmos-kit/core';

import { LEAP_SOCIAL_LOGIN_LOGO } from './constant';

export const LeapSocialLoginInfo: Wallet = {
Expand Down
Loading

0 comments on commit 23d531c

Please sign in to comment.