@rango-dev/provider-walletconnect-2 0.1.1-next.3 → 0.1.1-next.5

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.1.1-next.3",
3
+ "version": "0.1.1-next.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -20,11 +20,16 @@
20
20
  "lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
21
21
  },
22
22
  "dependencies": {
23
+ "@cosmjs/launchpad": "^0.27.1",
24
+ "@keplr-wallet/cosmos": "^0.9.12",
23
25
  "@keplr-wallet/simple-fetch": "^0.12.14",
26
+ "@rango-dev/signer-cosmos": "^0.8.1-next.3",
24
27
  "@rango-dev/signer-evm": "^0.8.1-next.4",
28
+ "@rango-dev/signer-solana": "^0.8.1-next.1",
25
29
  "@rango-dev/wallets-shared": "^0.8.1-next.7",
30
+ "@solana/web3.js": "^1.67.2",
26
31
  "@walletconnect/encoding": "^1.0.2",
27
- "@walletconnect/sign-client": "^2.8.1",
32
+ "@walletconnect/sign-client": "^2.9.1",
28
33
  "@walletconnect/utils": "^2.9.1",
29
34
  "@web3modal/standalone": "^2.4.3",
30
35
  "bs58": "^5.0.0",
@@ -33,7 +38,7 @@
33
38
  "rango-types": "^0.1.47"
34
39
  },
35
40
  "devDependencies": {
36
- "@walletconnect/types": "^2.8.1"
41
+ "@walletconnect/types": "^2.9.1"
37
42
  },
38
43
  "publishConfig": {
39
44
  "access": "public"
package/src/helpers.ts CHANGED
@@ -89,29 +89,26 @@ export function generateOptionalNamespace(
89
89
  ): FinalNamespaces | undefined {
90
90
  const evm = evmBlockchains(meta);
91
91
  const cosmos = cosmosBlockchains(meta);
92
+ const evmChains = evm.map((chain) => {
93
+ return new ChainId({
94
+ namespace: NAMESPACES.ETHEREUM,
95
+ reference: String(parseInt(chain.chainId)),
96
+ }).toString();
97
+ });
98
+ const cosmosChains = cosmos
99
+ .filter((chain): chain is CosmosMeta => !!chain.chainId)
100
+ .map((chain) => {
101
+ return new ChainId({
102
+ namespace: NAMESPACES.COSMOS,
103
+ reference: chain.chainId,
104
+ }).toString();
105
+ });
92
106
 
93
- return {
107
+ const namespaces: FinalNamespaces = {
94
108
  [NAMESPACES.ETHEREUM]: {
95
109
  methods: DEFAULT_ETHEREUM_METHODS,
96
110
  events: DEFAULT_ETHEREUM_EVENTS,
97
- chains: evm.map((chain) => {
98
- return new ChainId({
99
- namespace: NAMESPACES.ETHEREUM,
100
- reference: String(parseInt(chain.chainId)),
101
- }).toString();
102
- }),
103
- },
104
- [NAMESPACES.COSMOS]: {
105
- methods: DEFAULT_COSMOS_METHODS,
106
- events: [],
107
- chains: cosmos
108
- .filter((chain): chain is CosmosMeta => !!chain.chainId)
109
- .map((chain) => {
110
- return new ChainId({
111
- namespace: NAMESPACES.COSMOS,
112
- reference: chain.chainId,
113
- }).toString();
114
- }),
111
+ chains: evmChains,
115
112
  },
116
113
  [NAMESPACES.SOLANA]: {
117
114
  methods: DEFAULT_SOLANA_METHODS,
@@ -119,6 +116,16 @@ export function generateOptionalNamespace(
119
116
  chains: [`solana:${DEFAULT_SOLANA_CHAIN_ID}`],
120
117
  },
121
118
  };
119
+
120
+ if (cosmosChains.length) {
121
+ namespaces[NAMESPACES.COSMOS] = {
122
+ methods: DEFAULT_COSMOS_METHODS,
123
+ events: [],
124
+ chains: cosmosChains,
125
+ };
126
+ }
127
+
128
+ return namespaces;
122
129
  }
123
130
 
124
131
  export function solanaChainIdToNetworkName(chainId: string): string {
package/src/index.ts CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  WalletConfig,
10
10
  WalletInfo,
11
11
  } from '@rango-dev/wallets-shared';
12
- import { SignerFactory, BlockchainMeta } from 'rango-types';
12
+ import { SignerFactory, BlockchainMeta, evmBlockchains } from 'rango-types';
13
13
  import type { ISignClient } from '@walletconnect/types';
14
14
  import Client from '@walletconnect/sign-client';
15
15
 
@@ -181,12 +181,13 @@ export const getSigners: (provider: WCInstance) => SignerFactory = signer;
181
181
  export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
182
182
  allBlockChains
183
183
  ) => {
184
+ const evms = evmBlockchains(allBlockChains);
184
185
  return {
185
186
  name: 'WalletConnect',
186
187
  img: 'https://raw.githubusercontent.com/rango-exchange/rango-types/main/assets/icons/wallets/walletconnect.svg',
187
188
  installLink: '',
188
189
  color: '#b2dbff',
189
- supportedChains: allBlockChains,
190
+ supportedChains: evms,
190
191
  showOnMobile: true,
191
192
  mobileWallet: true,
192
193
  };