From 79126edffffc160b5b9e2619b9d413e54e2d14df Mon Sep 17 00:00:00 2001 From: Bojan Angjelkoski Date: Wed, 19 Jan 2022 12:23:15 +0100 Subject: [PATCH] feat: experimental keplr wallet add with data --- packages/cosmos-ts/CHANGELOG.md | 11 +++++++++++ packages/cosmos-ts/package.json | 2 +- packages/cosmos-ts/src/Keplr/KeplrWallet.ts | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/cosmos-ts/CHANGELOG.md b/packages/cosmos-ts/CHANGELOG.md index 18f542455..dc3390697 100644 --- a/packages/cosmos-ts/CHANGELOG.md +++ b/packages/cosmos-ts/CHANGELOG.md @@ -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 diff --git a/packages/cosmos-ts/package.json b/packages/cosmos-ts/package.json index 5e6f074c8..f87a35406 100644 --- a/packages/cosmos-ts/package.json +++ b/packages/cosmos-ts/package.json @@ -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", diff --git a/packages/cosmos-ts/src/Keplr/KeplrWallet.ts b/packages/cosmos-ts/src/Keplr/KeplrWallet.ts index 7ddce7cb4..3ce0844de 100644 --- a/packages/cosmos-ts/src/Keplr/KeplrWallet.ts +++ b/packages/cosmos-ts/src/Keplr/KeplrWallet.ts @@ -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