From a8c06c04bee0318d9c1293d7dc5fe191a2aa2b18 Mon Sep 17 00:00:00 2001 From: besated <99624770+besated@users.noreply.github.com> Date: Sat, 13 May 2023 10:56:16 -0700 Subject: [PATCH] Use getOfflineSignerAuto when connecting wallet (#39) * Switch to getOfflineSignerAuto to support ledgers * Add changeset * Fix connect test --- .changeset/wise-rabbits-cough.md | 5 +++++ packages/core/src/lib/wallet/connect.spec.ts | 2 +- packages/core/src/lib/wallet/connect.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/wise-rabbits-cough.md diff --git a/.changeset/wise-rabbits-cough.md b/.changeset/wise-rabbits-cough.md new file mode 100644 index 00000000..29633bc8 --- /dev/null +++ b/.changeset/wise-rabbits-cough.md @@ -0,0 +1,5 @@ +--- +'@sei-js/core': patch +--- + +Use getOfflineSignerAuto when connecting wallet diff --git a/packages/core/src/lib/wallet/connect.spec.ts b/packages/core/src/lib/wallet/connect.spec.ts index dea075cf..bd004b4a 100644 --- a/packages/core/src/lib/wallet/connect.spec.ts +++ b/packages/core/src/lib/wallet/connect.spec.ts @@ -39,7 +39,7 @@ describe('connect', () => { const accounts = await offlineSigner.getAccounts(); windowSpy.mockImplementation(() => ({ keplr: { - getOfflineSigner: () => offlineSigner, + getOfflineSignerAuto: () => offlineSigner, experimentalSuggestChain: () => undefined, enable: () => undefined, }, diff --git a/packages/core/src/lib/wallet/connect.ts b/packages/core/src/lib/wallet/connect.ts index 7c5787fc..ee677eec 100644 --- a/packages/core/src/lib/wallet/connect.ts +++ b/packages/core/src/lib/wallet/connect.ts @@ -29,7 +29,7 @@ export const connect = async ( // Enable wallet before attempting to call any methods await walletProvider.enable(chainId); - const offlineSigner = await walletProvider.getOfflineSigner(chainId); + const offlineSigner = await walletProvider.getOfflineSignerAuto(chainId); const accounts = await offlineSigner.getAccounts(); return { offlineSigner, accounts };