Skip to content

Commit

Permalink
feat: experimental keplr wallet add with data
Browse files Browse the repository at this point in the history
  • Loading branch information
bangjelkoski committed Jan 19, 2022
1 parent 39b4146 commit 79126ed
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/cosmos-ts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.0.46](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/cosmos-ts@0.0.45...@injectivelabs/cosmos-ts@0.0.46) (2022-01-19)


### Features

* experimental keplr wallet add with data ([363134b](https://github.com/InjectiveLabs/injective-ts/commit/363134bc9bf1581df1d651d1ef8df11a97cec0a5))





## [0.0.45](https://github.com/InjectiveLabs/injective-ts/compare/@injectivelabs/cosmos-ts@0.0.44...@injectivelabs/cosmos-ts@0.0.45) (2022-01-18)

**Note:** Version bump only for package @injectivelabs/cosmos-ts
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmos-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@injectivelabs/cosmos-ts",
"description": "Cosmos related wrappers.",
"version": "0.0.45",
"version": "0.0.46",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
16 changes: 16 additions & 0 deletions packages/cosmos-ts/src/Keplr/KeplrWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ export class KeplrWallet {
this.window = window as KeplrWindow
}

static async experimentalSuggestChainWithChainData(chainData: any) {
if (!window) {
throw new Error('Please install Keplr extension')
}

if (!window.keplr) {
throw new Error('Please install Keplr extension')
}

try {
await window.keplr.experimentalSuggestChain(chainData)
} catch (e: any) {
throw new Error(e.message)
}
}

async getKeplrWallet() {
const { window, chainId } = this

Expand Down

0 comments on commit 79126ed

Please sign in to comment.