@getpara/solana-wallet-connectors 2.0.0-alpha.18 → 2.0.0-alpha.20
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/providers/SolanaExternalWalletContext.js +4 -6
- package/dist/types/Wallet.d.ts +1 -3
- package/dist/wallets/connectors/backpack/backpack.js +30 -1
- package/dist/wallets/connectors/glow/glow.js +2 -1
- package/dist/wallets/connectors/phantom/phantom.js +30 -1
- package/dist/wallets/connectors/solflare/solflare.js +30 -1
- package/package.json +4 -4
|
@@ -38,7 +38,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
import { jsx } from "react/jsx-runtime";
|
|
39
39
|
import { createContext, useEffect, useMemo, useRef } from "react";
|
|
40
40
|
import { useWallet } from "@solana/wallet-adapter-react";
|
|
41
|
-
import { WalletReadyState } from "@solana/wallet-adapter-base";
|
|
41
|
+
import { isIosAndRedirectable, WalletReadyState } from "@solana/wallet-adapter-base";
|
|
42
42
|
import bs58 from "bs58";
|
|
43
43
|
const defaultSolanaExternalWallet = {
|
|
44
44
|
wallets: [],
|
|
@@ -63,7 +63,6 @@ function SolanaExternalWalletProvider({
|
|
|
63
63
|
publicKey: solanaAddress,
|
|
64
64
|
wallet,
|
|
65
65
|
connecting,
|
|
66
|
-
connected,
|
|
67
66
|
signMessage: solanaSignMessage
|
|
68
67
|
} = useWallet();
|
|
69
68
|
const verificationMessage = useRef();
|
|
@@ -145,6 +144,9 @@ function SolanaExternalWalletProvider({
|
|
|
145
144
|
return signature;
|
|
146
145
|
});
|
|
147
146
|
const connect = (adapter) => __async(this, null, function* () {
|
|
147
|
+
if (isIosAndRedirectable()) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
148
150
|
yield _disconnect();
|
|
149
151
|
if (!adapter) {
|
|
150
152
|
return { error: "Adapter not found." };
|
|
@@ -194,16 +196,12 @@ function SolanaExternalWalletProvider({
|
|
|
194
196
|
return __spreadValues({
|
|
195
197
|
connect: () => connect(adapter),
|
|
196
198
|
connectMobile: () => connect(adapter),
|
|
197
|
-
getQrUri: () => "",
|
|
198
199
|
type: "SOLANA",
|
|
199
200
|
installed: adapter && ((adapter == null ? void 0 : adapter.readyState) === WalletReadyState.Installed || (adapter == null ? void 0 : adapter.readyState) === WalletReadyState.Loadable)
|
|
200
201
|
}, metaData);
|
|
201
202
|
});
|
|
202
203
|
const disconnect = () => __async(this, null, function* () {
|
|
203
204
|
yield _disconnect();
|
|
204
|
-
if (connected) {
|
|
205
|
-
typeof window !== void 0 && (window == null ? void 0 : window.location.reload());
|
|
206
|
-
}
|
|
207
205
|
});
|
|
208
206
|
return /* @__PURE__ */ jsx(
|
|
209
207
|
SolanaExternalWalletContext.Provider,
|
package/dist/types/Wallet.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type WalletMetadata } from '@getpara/react-common';
|
|
2
|
-
export type Wallet =
|
|
3
|
-
getUri?: (uri: string) => string;
|
|
4
|
-
} & WalletMetadata;
|
|
2
|
+
export type Wallet = WalletMetadata;
|
|
5
3
|
export type CreateWalletFn = () => Wallet;
|
|
6
4
|
export type WalletList = CreateWalletFn[];
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __async = (__this, __arguments, generator) => {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
var fulfilled = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
} catch (e) {
|
|
8
|
+
reject(e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var rejected = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
step(generator.throw(value));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
import { isIosAndRedirectable } from "@solana/wallet-adapter-base";
|
|
2
23
|
import { icon } from "./backpackIcon.js";
|
|
3
24
|
const backpackWallet = () => {
|
|
4
25
|
return {
|
|
@@ -7,7 +28,15 @@ const backpackWallet = () => {
|
|
|
7
28
|
iconUrl: icon,
|
|
8
29
|
isExtension: true,
|
|
9
30
|
isMobile: true,
|
|
10
|
-
|
|
31
|
+
hasIosSafariExtension: false,
|
|
32
|
+
getQrUri: () => __async(void 0, null, function* () {
|
|
33
|
+
if (typeof window !== "undefined" && isIosAndRedirectable()) {
|
|
34
|
+
const url = encodeURIComponent(window.location.href);
|
|
35
|
+
const ref = encodeURIComponent(window.location.origin);
|
|
36
|
+
return `https://backpack.app/ul/v1/browse/${url}?ref=${ref}`;
|
|
37
|
+
}
|
|
38
|
+
return "";
|
|
39
|
+
}),
|
|
11
40
|
downloadUrl: "https://backpack.app/download"
|
|
12
41
|
};
|
|
13
42
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { icon } from "./glowIcon.js";
|
|
3
|
+
import { isIosAndRedirectable } from "@solana/wallet-adapter-base";
|
|
3
4
|
const glowWallet = () => {
|
|
4
5
|
return {
|
|
5
6
|
id: "glow",
|
|
@@ -7,7 +8,7 @@ const glowWallet = () => {
|
|
|
7
8
|
iconUrl: icon,
|
|
8
9
|
isExtension: true,
|
|
9
10
|
isMobile: true,
|
|
10
|
-
|
|
11
|
+
hasIosSafariExtension: isIosAndRedirectable(),
|
|
11
12
|
downloadUrl: "https://glow.app"
|
|
12
13
|
};
|
|
13
14
|
};
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __async = (__this, __arguments, generator) => {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
var fulfilled = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
} catch (e) {
|
|
8
|
+
reject(e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var rejected = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
step(generator.throw(value));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
import { isIosAndRedirectable } from "@solana/wallet-adapter-base";
|
|
2
23
|
import { icon } from "./phantomIcon.js";
|
|
3
24
|
const phantomWallet = () => {
|
|
4
25
|
return {
|
|
@@ -7,7 +28,15 @@ const phantomWallet = () => {
|
|
|
7
28
|
iconUrl: icon,
|
|
8
29
|
isExtension: true,
|
|
9
30
|
isMobile: true,
|
|
10
|
-
|
|
31
|
+
hasIosSafariExtension: false,
|
|
32
|
+
getQrUri: () => __async(void 0, null, function* () {
|
|
33
|
+
if (typeof window !== "undefined" && isIosAndRedirectable()) {
|
|
34
|
+
const url = encodeURIComponent(window.location.href);
|
|
35
|
+
const ref = encodeURIComponent(window.location.origin);
|
|
36
|
+
return `https://phantom.app/ul/browse/${url}?ref=${ref}`;
|
|
37
|
+
}
|
|
38
|
+
return "";
|
|
39
|
+
}),
|
|
11
40
|
downloadUrl: "https://phantom.app/download"
|
|
12
41
|
};
|
|
13
42
|
};
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
var __async = (__this, __arguments, generator) => {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
var fulfilled = (value) => {
|
|
5
|
+
try {
|
|
6
|
+
step(generator.next(value));
|
|
7
|
+
} catch (e) {
|
|
8
|
+
reject(e);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var rejected = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
step(generator.throw(value));
|
|
14
|
+
} catch (e) {
|
|
15
|
+
reject(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
19
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
import { isIosAndRedirectable } from "@solana/wallet-adapter-base";
|
|
2
23
|
import { icon } from "./solflareIcon.js";
|
|
3
24
|
const solflareWallet = () => {
|
|
4
25
|
return {
|
|
@@ -7,7 +28,15 @@ const solflareWallet = () => {
|
|
|
7
28
|
iconUrl: icon,
|
|
8
29
|
isExtension: true,
|
|
9
30
|
isMobile: true,
|
|
10
|
-
|
|
31
|
+
hasIosSafariExtension: false,
|
|
32
|
+
getQrUri: () => __async(void 0, null, function* () {
|
|
33
|
+
if (typeof window !== "undefined" && isIosAndRedirectable()) {
|
|
34
|
+
const url = encodeURIComponent(window.location.href);
|
|
35
|
+
const ref = encodeURIComponent(window.location.origin);
|
|
36
|
+
return `https://solflare.com/ul/v1/browse/${url}?ref=${ref}`;
|
|
37
|
+
}
|
|
38
|
+
return "";
|
|
39
|
+
}),
|
|
11
40
|
downloadUrl: "https://www.solflare.com/download/"
|
|
12
41
|
};
|
|
13
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/solana-wallet-connectors",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test": "vitest run --coverage"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
17
|
+
"@getpara/web-sdk": "2.0.0-alpha.20",
|
|
18
18
|
"@solana-mobile/wallet-adapter-mobile": "2.1.3",
|
|
19
19
|
"@solana/wallet-adapter-base": "0.9.23",
|
|
20
20
|
"@solana/wallet-adapter-react": "0.15.35",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"bs58": "6.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@getpara/react-common": "2.0.0-alpha.
|
|
25
|
+
"@getpara/react-common": "2.0.0-alpha.20",
|
|
26
26
|
"@types/react": "^18.0.31",
|
|
27
27
|
"@types/react-dom": "^18.2.7",
|
|
28
28
|
"typescript": "^5.4.3"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"dist",
|
|
36
36
|
"package.json"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "4c8d918b9fc387476968bfc08524fe1a8b6ec83b"
|
|
39
39
|
}
|