@bit-buccaneers/wallet-abstraction 0.0.6 → 0.0.7
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/dev.js +20 -16
- package/dist/dev.jsx +20 -16
- package/dist/index.js +20 -16
- package/dist/index.jsx +20 -16
- package/dist/lib/connectors/shared/dapp-browser.d.ts +2 -6
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -257,11 +257,12 @@ var waitForValue = (getValue) => {
|
|
|
257
257
|
};
|
|
258
258
|
|
|
259
259
|
// src/lib/connectors/shared/dapp-browser.ts
|
|
260
|
-
var buildBrowseUrl = (
|
|
261
|
-
if (
|
|
262
|
-
|
|
260
|
+
var buildBrowseUrl = (config2) => {
|
|
261
|
+
if (config2.buildUrl) return config2.buildUrl();
|
|
262
|
+
if (config2.stripProtocol) {
|
|
263
|
+
return `${config2.browseUrl}/${window.location.host}${window.location.pathname}${window.location.search}`;
|
|
263
264
|
}
|
|
264
|
-
return `${
|
|
265
|
+
return `${config2.browseUrl}/${encodeURIComponent(window.location.href)}`;
|
|
265
266
|
};
|
|
266
267
|
var createDappBrowserSolanaConnector = (config2) => {
|
|
267
268
|
const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
|
|
@@ -275,7 +276,7 @@ var createDappBrowserSolanaConnector = (config2) => {
|
|
|
275
276
|
if (isInWallet() && window.solana) {
|
|
276
277
|
return connectSolanaInjected();
|
|
277
278
|
}
|
|
278
|
-
window.location.href = buildBrowseUrl(config2
|
|
279
|
+
window.location.href = buildBrowseUrl(config2);
|
|
279
280
|
return pendingResult();
|
|
280
281
|
},
|
|
281
282
|
disconnect: async () => {
|
|
@@ -922,30 +923,33 @@ var BINANCE_CONFIG = {
|
|
|
922
923
|
wcDeeplink: "bnc://app.binance.com/cedefi/wc",
|
|
923
924
|
injectedKey: "isBinance"
|
|
924
925
|
};
|
|
925
|
-
var
|
|
926
|
+
var buildBinanceBrowseUrl = () => `bnc://app.binance.com/cedefi/dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
926
927
|
var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
|
|
927
928
|
var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
|
|
928
929
|
var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
929
930
|
walletId: "binance",
|
|
930
|
-
|
|
931
|
-
|
|
931
|
+
injectedKey: "isBinance",
|
|
932
|
+
buildUrl: buildBinanceBrowseUrl
|
|
932
933
|
});
|
|
933
934
|
|
|
934
935
|
// src/lib/connectors/okx.ts
|
|
935
|
-
var
|
|
936
|
+
var buildOkxBrowseUrl = () => {
|
|
937
|
+
const dappUrl = window.location.href;
|
|
938
|
+
const deepLink = `okx://wallet/dapp/url?dappUrl=${encodeURIComponent(dappUrl)}`;
|
|
939
|
+
return `https://web3.okx.com/download?deeplink=${encodeURIComponent(deepLink)}`;
|
|
940
|
+
};
|
|
936
941
|
var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
937
942
|
walletId: "okx",
|
|
938
|
-
|
|
939
|
-
|
|
943
|
+
injectedKey: "isOkxWallet",
|
|
944
|
+
buildUrl: buildOkxBrowseUrl
|
|
940
945
|
});
|
|
941
946
|
|
|
942
947
|
// src/lib/connectors/coinbase.ts
|
|
943
|
-
var
|
|
948
|
+
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
944
949
|
var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
945
950
|
walletId: "coinbase",
|
|
946
|
-
browseUrl: COINBASE_BROWSE_URL,
|
|
947
951
|
injectedKey: "isCoinbaseWallet",
|
|
948
|
-
|
|
952
|
+
buildUrl: buildCoinbaseBrowseUrl
|
|
949
953
|
});
|
|
950
954
|
|
|
951
955
|
// src/lib/connectors/bitget.ts
|
|
@@ -969,7 +973,7 @@ var createWalletConnectEvmConnector = () => {
|
|
|
969
973
|
name: walletConfig.name,
|
|
970
974
|
icon: walletConfig.icon,
|
|
971
975
|
type: "evm",
|
|
972
|
-
installed:
|
|
976
|
+
installed: false,
|
|
973
977
|
wallet: {
|
|
974
978
|
_connector: null,
|
|
975
979
|
connect: async () => {
|
|
@@ -1003,7 +1007,7 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
1003
1007
|
name: walletConfig.name,
|
|
1004
1008
|
icon: walletConfig.icon,
|
|
1005
1009
|
type: "solana",
|
|
1006
|
-
installed:
|
|
1010
|
+
installed: false,
|
|
1007
1011
|
wallet: {
|
|
1008
1012
|
_provider: null,
|
|
1009
1013
|
connect: async () => {
|
package/dist/dev.jsx
CHANGED
|
@@ -255,11 +255,12 @@ var waitForValue = (getValue) => {
|
|
|
255
255
|
};
|
|
256
256
|
|
|
257
257
|
// src/lib/connectors/shared/dapp-browser.ts
|
|
258
|
-
var buildBrowseUrl = (
|
|
259
|
-
if (
|
|
260
|
-
|
|
258
|
+
var buildBrowseUrl = (config2) => {
|
|
259
|
+
if (config2.buildUrl) return config2.buildUrl();
|
|
260
|
+
if (config2.stripProtocol) {
|
|
261
|
+
return `${config2.browseUrl}/${window.location.host}${window.location.pathname}${window.location.search}`;
|
|
261
262
|
}
|
|
262
|
-
return `${
|
|
263
|
+
return `${config2.browseUrl}/${encodeURIComponent(window.location.href)}`;
|
|
263
264
|
};
|
|
264
265
|
var createDappBrowserSolanaConnector = (config2) => {
|
|
265
266
|
const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
|
|
@@ -273,7 +274,7 @@ var createDappBrowserSolanaConnector = (config2) => {
|
|
|
273
274
|
if (isInWallet() && window.solana) {
|
|
274
275
|
return connectSolanaInjected();
|
|
275
276
|
}
|
|
276
|
-
window.location.href = buildBrowseUrl(config2
|
|
277
|
+
window.location.href = buildBrowseUrl(config2);
|
|
277
278
|
return pendingResult();
|
|
278
279
|
},
|
|
279
280
|
disconnect: async () => {
|
|
@@ -930,30 +931,33 @@ var BINANCE_CONFIG = {
|
|
|
930
931
|
wcDeeplink: "bnc://app.binance.com/cedefi/wc",
|
|
931
932
|
injectedKey: "isBinance"
|
|
932
933
|
};
|
|
933
|
-
var
|
|
934
|
+
var buildBinanceBrowseUrl = () => `bnc://app.binance.com/cedefi/dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
934
935
|
var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
|
|
935
936
|
var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
|
|
936
937
|
var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
937
938
|
walletId: "binance",
|
|
938
|
-
|
|
939
|
-
|
|
939
|
+
injectedKey: "isBinance",
|
|
940
|
+
buildUrl: buildBinanceBrowseUrl
|
|
940
941
|
});
|
|
941
942
|
|
|
942
943
|
// src/lib/connectors/okx.ts
|
|
943
|
-
var
|
|
944
|
+
var buildOkxBrowseUrl = () => {
|
|
945
|
+
const dappUrl = window.location.href;
|
|
946
|
+
const deepLink = `okx://wallet/dapp/url?dappUrl=${encodeURIComponent(dappUrl)}`;
|
|
947
|
+
return `https://web3.okx.com/download?deeplink=${encodeURIComponent(deepLink)}`;
|
|
948
|
+
};
|
|
944
949
|
var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
945
950
|
walletId: "okx",
|
|
946
|
-
|
|
947
|
-
|
|
951
|
+
injectedKey: "isOkxWallet",
|
|
952
|
+
buildUrl: buildOkxBrowseUrl
|
|
948
953
|
});
|
|
949
954
|
|
|
950
955
|
// src/lib/connectors/coinbase.ts
|
|
951
|
-
var
|
|
956
|
+
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
952
957
|
var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
953
958
|
walletId: "coinbase",
|
|
954
|
-
browseUrl: COINBASE_BROWSE_URL,
|
|
955
959
|
injectedKey: "isCoinbaseWallet",
|
|
956
|
-
|
|
960
|
+
buildUrl: buildCoinbaseBrowseUrl
|
|
957
961
|
});
|
|
958
962
|
|
|
959
963
|
// src/lib/connectors/bitget.ts
|
|
@@ -980,7 +984,7 @@ var createWalletConnectEvmConnector = () => {
|
|
|
980
984
|
name: walletConfig.name,
|
|
981
985
|
icon: walletConfig.icon,
|
|
982
986
|
type: "evm",
|
|
983
|
-
installed:
|
|
987
|
+
installed: false,
|
|
984
988
|
wallet: {
|
|
985
989
|
_connector: null,
|
|
986
990
|
connect: async () => {
|
|
@@ -1014,7 +1018,7 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
1014
1018
|
name: walletConfig.name,
|
|
1015
1019
|
icon: walletConfig.icon,
|
|
1016
1020
|
type: "solana",
|
|
1017
|
-
installed:
|
|
1021
|
+
installed: false,
|
|
1018
1022
|
wallet: {
|
|
1019
1023
|
_provider: null,
|
|
1020
1024
|
connect: async () => {
|
package/dist/index.js
CHANGED
|
@@ -257,11 +257,12 @@ var waitForValue = (getValue) => {
|
|
|
257
257
|
};
|
|
258
258
|
|
|
259
259
|
// src/lib/connectors/shared/dapp-browser.ts
|
|
260
|
-
var buildBrowseUrl = (
|
|
261
|
-
if (
|
|
262
|
-
|
|
260
|
+
var buildBrowseUrl = (config2) => {
|
|
261
|
+
if (config2.buildUrl) return config2.buildUrl();
|
|
262
|
+
if (config2.stripProtocol) {
|
|
263
|
+
return `${config2.browseUrl}/${window.location.host}${window.location.pathname}${window.location.search}`;
|
|
263
264
|
}
|
|
264
|
-
return `${
|
|
265
|
+
return `${config2.browseUrl}/${encodeURIComponent(window.location.href)}`;
|
|
265
266
|
};
|
|
266
267
|
var createDappBrowserSolanaConnector = (config2) => {
|
|
267
268
|
const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
|
|
@@ -275,7 +276,7 @@ var createDappBrowserSolanaConnector = (config2) => {
|
|
|
275
276
|
if (isInWallet() && window.solana) {
|
|
276
277
|
return connectSolanaInjected();
|
|
277
278
|
}
|
|
278
|
-
window.location.href = buildBrowseUrl(config2
|
|
279
|
+
window.location.href = buildBrowseUrl(config2);
|
|
279
280
|
return pendingResult();
|
|
280
281
|
},
|
|
281
282
|
disconnect: async () => {
|
|
@@ -917,30 +918,33 @@ var BINANCE_CONFIG = {
|
|
|
917
918
|
wcDeeplink: "bnc://app.binance.com/cedefi/wc",
|
|
918
919
|
injectedKey: "isBinance"
|
|
919
920
|
};
|
|
920
|
-
var
|
|
921
|
+
var buildBinanceBrowseUrl = () => `bnc://app.binance.com/cedefi/dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
921
922
|
var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
|
|
922
923
|
var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
|
|
923
924
|
var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
924
925
|
walletId: "binance",
|
|
925
|
-
|
|
926
|
-
|
|
926
|
+
injectedKey: "isBinance",
|
|
927
|
+
buildUrl: buildBinanceBrowseUrl
|
|
927
928
|
});
|
|
928
929
|
|
|
929
930
|
// src/lib/connectors/okx.ts
|
|
930
|
-
var
|
|
931
|
+
var buildOkxBrowseUrl = () => {
|
|
932
|
+
const dappUrl = window.location.href;
|
|
933
|
+
const deepLink = `okx://wallet/dapp/url?dappUrl=${encodeURIComponent(dappUrl)}`;
|
|
934
|
+
return `https://web3.okx.com/download?deeplink=${encodeURIComponent(deepLink)}`;
|
|
935
|
+
};
|
|
931
936
|
var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
932
937
|
walletId: "okx",
|
|
933
|
-
|
|
934
|
-
|
|
938
|
+
injectedKey: "isOkxWallet",
|
|
939
|
+
buildUrl: buildOkxBrowseUrl
|
|
935
940
|
});
|
|
936
941
|
|
|
937
942
|
// src/lib/connectors/coinbase.ts
|
|
938
|
-
var
|
|
943
|
+
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
939
944
|
var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
940
945
|
walletId: "coinbase",
|
|
941
|
-
browseUrl: COINBASE_BROWSE_URL,
|
|
942
946
|
injectedKey: "isCoinbaseWallet",
|
|
943
|
-
|
|
947
|
+
buildUrl: buildCoinbaseBrowseUrl
|
|
944
948
|
});
|
|
945
949
|
|
|
946
950
|
// src/lib/connectors/bitget.ts
|
|
@@ -964,7 +968,7 @@ var createWalletConnectEvmConnector = () => {
|
|
|
964
968
|
name: walletConfig.name,
|
|
965
969
|
icon: walletConfig.icon,
|
|
966
970
|
type: "evm",
|
|
967
|
-
installed:
|
|
971
|
+
installed: false,
|
|
968
972
|
wallet: {
|
|
969
973
|
_connector: null,
|
|
970
974
|
connect: async () => {
|
|
@@ -998,7 +1002,7 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
998
1002
|
name: walletConfig.name,
|
|
999
1003
|
icon: walletConfig.icon,
|
|
1000
1004
|
type: "solana",
|
|
1001
|
-
installed:
|
|
1005
|
+
installed: false,
|
|
1002
1006
|
wallet: {
|
|
1003
1007
|
_provider: null,
|
|
1004
1008
|
connect: async () => {
|
package/dist/index.jsx
CHANGED
|
@@ -255,11 +255,12 @@ var waitForValue = (getValue) => {
|
|
|
255
255
|
};
|
|
256
256
|
|
|
257
257
|
// src/lib/connectors/shared/dapp-browser.ts
|
|
258
|
-
var buildBrowseUrl = (
|
|
259
|
-
if (
|
|
260
|
-
|
|
258
|
+
var buildBrowseUrl = (config2) => {
|
|
259
|
+
if (config2.buildUrl) return config2.buildUrl();
|
|
260
|
+
if (config2.stripProtocol) {
|
|
261
|
+
return `${config2.browseUrl}/${window.location.host}${window.location.pathname}${window.location.search}`;
|
|
261
262
|
}
|
|
262
|
-
return `${
|
|
263
|
+
return `${config2.browseUrl}/${encodeURIComponent(window.location.href)}`;
|
|
263
264
|
};
|
|
264
265
|
var createDappBrowserSolanaConnector = (config2) => {
|
|
265
266
|
const walletConfig2 = WALLETS.find((w) => w.id === config2.walletId);
|
|
@@ -273,7 +274,7 @@ var createDappBrowserSolanaConnector = (config2) => {
|
|
|
273
274
|
if (isInWallet() && window.solana) {
|
|
274
275
|
return connectSolanaInjected();
|
|
275
276
|
}
|
|
276
|
-
window.location.href = buildBrowseUrl(config2
|
|
277
|
+
window.location.href = buildBrowseUrl(config2);
|
|
277
278
|
return pendingResult();
|
|
278
279
|
},
|
|
279
280
|
disconnect: async () => {
|
|
@@ -925,30 +926,33 @@ var BINANCE_CONFIG = {
|
|
|
925
926
|
wcDeeplink: "bnc://app.binance.com/cedefi/wc",
|
|
926
927
|
injectedKey: "isBinance"
|
|
927
928
|
};
|
|
928
|
-
var
|
|
929
|
+
var buildBinanceBrowseUrl = () => `bnc://app.binance.com/cedefi/dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
929
930
|
var createBinanceEvmConnector = () => createWcEvmConnector(BINANCE_CONFIG);
|
|
930
931
|
var createBinanceSolanaConnector = () => createWcSolanaConnector(BINANCE_CONFIG);
|
|
931
932
|
var createBinanceSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
932
933
|
walletId: "binance",
|
|
933
|
-
|
|
934
|
-
|
|
934
|
+
injectedKey: "isBinance",
|
|
935
|
+
buildUrl: buildBinanceBrowseUrl
|
|
935
936
|
});
|
|
936
937
|
|
|
937
938
|
// src/lib/connectors/okx.ts
|
|
938
|
-
var
|
|
939
|
+
var buildOkxBrowseUrl = () => {
|
|
940
|
+
const dappUrl = window.location.href;
|
|
941
|
+
const deepLink = `okx://wallet/dapp/url?dappUrl=${encodeURIComponent(dappUrl)}`;
|
|
942
|
+
return `https://web3.okx.com/download?deeplink=${encodeURIComponent(deepLink)}`;
|
|
943
|
+
};
|
|
939
944
|
var createOkxSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
940
945
|
walletId: "okx",
|
|
941
|
-
|
|
942
|
-
|
|
946
|
+
injectedKey: "isOkxWallet",
|
|
947
|
+
buildUrl: buildOkxBrowseUrl
|
|
943
948
|
});
|
|
944
949
|
|
|
945
950
|
// src/lib/connectors/coinbase.ts
|
|
946
|
-
var
|
|
951
|
+
var buildCoinbaseBrowseUrl = () => `cbwallet://dapp?url=${encodeURIComponent(window.location.href)}`;
|
|
947
952
|
var createCoinbaseSolanaDappBrowserConnector = () => createDappBrowserSolanaConnector({
|
|
948
953
|
walletId: "coinbase",
|
|
949
|
-
browseUrl: COINBASE_BROWSE_URL,
|
|
950
954
|
injectedKey: "isCoinbaseWallet",
|
|
951
|
-
|
|
955
|
+
buildUrl: buildCoinbaseBrowseUrl
|
|
952
956
|
});
|
|
953
957
|
|
|
954
958
|
// src/lib/connectors/bitget.ts
|
|
@@ -975,7 +979,7 @@ var createWalletConnectEvmConnector = () => {
|
|
|
975
979
|
name: walletConfig.name,
|
|
976
980
|
icon: walletConfig.icon,
|
|
977
981
|
type: "evm",
|
|
978
|
-
installed:
|
|
982
|
+
installed: false,
|
|
979
983
|
wallet: {
|
|
980
984
|
_connector: null,
|
|
981
985
|
connect: async () => {
|
|
@@ -1009,7 +1013,7 @@ var createWalletConnectSolanaConnector = () => {
|
|
|
1009
1013
|
name: walletConfig.name,
|
|
1010
1014
|
icon: walletConfig.icon,
|
|
1011
1015
|
type: "solana",
|
|
1012
|
-
installed:
|
|
1016
|
+
installed: false,
|
|
1013
1017
|
wallet: {
|
|
1014
1018
|
_provider: null,
|
|
1015
1019
|
connect: async () => {
|
|
@@ -2,13 +2,9 @@ import type { SolanaWalletConnector } from '../../solana';
|
|
|
2
2
|
import { type WalletId } from '../../wallets';
|
|
3
3
|
export interface DappBrowserConfig {
|
|
4
4
|
walletId: WalletId;
|
|
5
|
-
browseUrl: string;
|
|
6
5
|
injectedKey: string;
|
|
7
|
-
|
|
6
|
+
browseUrl?: string;
|
|
8
7
|
stripProtocol?: boolean;
|
|
8
|
+
buildUrl?: () => string;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Create a Solana connector that opens the site in wallet's dApp browser.
|
|
12
|
-
* Inside the dApp browser, uses injected window.solana for connect/sign.
|
|
13
|
-
*/
|
|
14
10
|
export declare const createDappBrowserSolanaConnector: (config: DappBrowserConfig) => SolanaWalletConnector;
|