@rango-dev/provider-walletconnect-2 0.8.1-next.1 → 0.8.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/provider-walletconnect-2",
3
- "version": "0.8.1-next.1",
3
+ "version": "0.8.1-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {
2
- WalletTypes,
1
+ import type { WCInstance } from './types';
2
+ import type {
3
3
  CanSwitchNetwork,
4
4
  Connect,
5
5
  Disconnect,
@@ -9,19 +9,13 @@ import {
9
9
  WalletConfig,
10
10
  WalletInfo,
11
11
  } from '@rango-dev/wallets-shared';
12
- import { SignerFactory, BlockchainMeta, evmBlockchains } from 'rango-types';
13
12
  import type { ISignClient } from '@walletconnect/types';
13
+ import type { BlockchainMeta, SignerFactory } from 'rango-types';
14
+
15
+ import { WalletTypes } from '@rango-dev/wallets-shared';
14
16
  import Client from '@walletconnect/sign-client';
17
+ import { evmBlockchains } from 'rango-types';
15
18
 
16
- import signer from './signer';
17
- import {
18
- disconnectSessions,
19
- cleanupSingleSession,
20
- getAccountsFromEvent,
21
- getAccountsFromSession,
22
- tryConnect,
23
- trySwitchByCreatingNewSession,
24
- } from './session';
25
19
  import {
26
20
  DEFAULT_APP_METADATA,
27
21
  DEFAULT_NETWORK,
@@ -29,7 +23,15 @@ import {
29
23
  RELAY_URL,
30
24
  } from './constants';
31
25
  import { createModalInstance, simulateRequest } from './helpers';
32
- import type { WCInstance } from './types';
26
+ import {
27
+ cleanupSingleSession,
28
+ disconnectSessions,
29
+ getAccountsFromEvent,
30
+ getAccountsFromSession,
31
+ tryConnect,
32
+ trySwitchByCreatingNewSession,
33
+ } from './session';
34
+ import signer from './signer';
33
35
 
34
36
  const WALLET = WalletTypes.WALLET_CONNECT_2;
35
37
 
@@ -55,9 +57,9 @@ export const getInstance: GetInstance = async (options) => {
55
57
  const { currentProvider, getState, meta } = options;
56
58
 
57
59
  /*
58
- Create a new pair, if exists use the pair,
59
- Or use the already created one.
60
- */
60
+ *Create a new pair, if exists use the pair,
61
+ *Or use the already created one.
62
+ */
61
63
  let provider: ISignClient;
62
64
  if (!currentProvider) {
63
65
  if (!envs.WC_PROJECT_ID) {
@@ -78,7 +80,8 @@ export const getInstance: GetInstance = async (options) => {
78
80
  return {
79
81
  client: provider,
80
82
  session: null,
81
- request: (params: any) => simulateRequest(params, provider, meta, getState),
83
+ request: async (params: any) =>
84
+ simulateRequest(params, provider, meta, getState),
82
85
  };
83
86
  };
84
87
 
@@ -137,7 +140,7 @@ export const subscribe: Subscribe = ({
137
140
 
138
141
  client.on('session_delete', async (event) => {
139
142
  console.log('[WC2] your wallet has requested to delete session.', event);
140
- cleanupSingleSession(client, event.topic);
143
+ void cleanupSingleSession(client, event.topic);
141
144
  disconnect();
142
145
  });
143
146
  };
@@ -172,7 +175,7 @@ export const disconnect: Disconnect = async ({ instance }) => {
172
175
  const { client } = instance as WCInstance;
173
176
 
174
177
  if (client) {
175
- disconnectSessions(client);
178
+ void disconnectSessions(client);
176
179
  }
177
180
  };
178
181
 
@@ -184,7 +187,7 @@ export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
184
187
  const evms = evmBlockchains(allBlockChains);
185
188
  return {
186
189
  name: 'WalletConnect',
187
- img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/walletconnect.svg',
190
+ img: 'https://raw.githubusercontent.com/rango-exchange/rango-assets/main/wallets/walletconnect/icon.svg',
188
191
  installLink: '',
189
192
  color: '#b2dbff',
190
193
  supportedChains: evms,