@tomo-inc/wallet-adaptor-base 0.0.17 → 0.0.18
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/dist/index.cjs +169 -34
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +168 -35
- package/package.json +2 -2
- package/src/__tests__/defaultConnectors.test.ts +110 -0
- package/src/__tests__/wallet-standard.test.ts +302 -0
- package/src/index.ts +21 -12
- package/src/utils/wallet-config.ts +85 -0
- package/src/wallet-api/connect.ts +10 -3
- package/src/wallets/defaultConnectors.ts +5 -10
- package/src/wallets/detector.ts +139 -4
- package/src/wallets/index.ts +11 -2
- package/src/wallets/wallet-walletconnect.ts +2 -3
package/src/wallets/index.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
import { WalletConfig } from "./Wallet";
|
|
2
|
+
|
|
3
|
+
export const walletBaseUrl = "https://web3-assets.tomo.inc";
|
|
4
|
+
|
|
5
|
+
let allWallets: WalletConfig[] = [];
|
|
1
6
|
export const getAllWallets = async (baseUrl?: string) => {
|
|
2
|
-
|
|
3
|
-
|
|
7
|
+
if (allWallets.length > 0) {
|
|
8
|
+
return allWallets;
|
|
9
|
+
}
|
|
10
|
+
const walletListResponse = await fetch((baseUrl || walletBaseUrl) + "/api/wallets");
|
|
11
|
+
const walletListData = await walletListResponse.json();
|
|
12
|
+
const walletList = (allWallets = walletListData?.data);
|
|
4
13
|
return walletList;
|
|
5
14
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NamespaceConfig } from "@tomo-inc/wallet-connect-protocol";
|
|
2
2
|
import { Connector, ProviderProtocol } from "../type";
|
|
3
|
+
import { walletBaseUrl } from "./index";
|
|
3
4
|
import { WalletConnectProvider } from "./providers/WalletConnectProvider";
|
|
4
5
|
import { WalletConnectSolanaProvider } from "./providers/WalletConnectSolanaProvider";
|
|
5
6
|
|
|
@@ -48,9 +49,7 @@ export async function walletConnectWallets(baseUrl?: string): Promise<Connector[
|
|
|
48
49
|
if (wcWallets.length > 0) {
|
|
49
50
|
return wcWallets.map((wallet: any) => convertWalletToConnector(wallet));
|
|
50
51
|
}
|
|
51
|
-
const walletListResponse = await fetch(
|
|
52
|
-
(baseUrl || "https://web3-assets.tomo.inc") + "/api/wallets?walletId=walletConnect",
|
|
53
|
-
);
|
|
52
|
+
const walletListResponse = await fetch((baseUrl || walletBaseUrl) + "/api/wallets?walletId=walletConnect");
|
|
54
53
|
const walletList = await walletListResponse.json();
|
|
55
54
|
if (walletList?.data?.length === 0) {
|
|
56
55
|
return [];
|