@multiplatform.one/web3 7.16.0 → 7.18.0
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/cjs/connectkit/components/Common/ConnectorList/index.cjs +33 -5
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js +38 -5
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectButton/index.cjs +5 -0
- package/dist/cjs/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/cjs/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.cjs +9 -4
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/cjs/connectkit/index.cjs +5 -0
- package/dist/cjs/connectkit/index.native.js +5 -0
- package/dist/cjs/connectkit/index.native.js.map +1 -1
- package/dist/cjs/connectkit/openConnector/context.cjs +146 -0
- package/dist/cjs/connectkit/openConnector/context.native.js +188 -0
- package/dist/cjs/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/device.cjs +42 -0
- package/dist/cjs/connectkit/openConnector/device.native.js +51 -0
- package/dist/cjs/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/index.cjs +35 -0
- package/dist/cjs/connectkit/openConnector/index.native.js +38 -0
- package/dist/cjs/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/launcher.cjs +133 -0
- package/dist/cjs/connectkit/openConnector/launcher.native.js +158 -0
- package/dist/cjs/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/cjs/connectkit/screens.cjs +1 -10
- package/dist/cjs/connectkit/screens.native.js +1 -12
- package/dist/cjs/connectkit/screens.native.js.map +1 -1
- package/dist/cjs/connectkit/siwe/connectIntent.cjs +9 -5
- package/dist/cjs/connectkit/siwe/connectIntent.native.js +10 -3
- package/dist/cjs/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/cjs/connectkit/useWeb3Modal.cjs +21 -0
- package/dist/cjs/connectkit/useWeb3Modal.native.js +22 -0
- package/dist/cjs/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/cjs/connectkit/web3Bridge.cjs +4 -1
- package/dist/cjs/connectkit/web3Bridge.native.js +4 -1
- package/dist/cjs/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/cjs/connectkit/web3Provider.native.js.map +1 -1
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs +34 -6
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js +39 -6
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectButton/index.mjs +5 -0
- package/dist/esm/connectkit/components/ConnectButton/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/esm/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +9 -4
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/esm/connectkit/index.mjs +3 -1
- package/dist/esm/connectkit/index.mjs.map +1 -1
- package/dist/esm/connectkit/index.native.js +3 -1
- package/dist/esm/connectkit/index.native.js.map +1 -1
- package/dist/esm/connectkit/openConnector/context.mjs +118 -0
- package/dist/esm/connectkit/openConnector/context.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/context.native.js +146 -0
- package/dist/esm/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/device.mjs +16 -0
- package/dist/esm/connectkit/openConnector/device.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/device.native.js +22 -0
- package/dist/esm/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/index.mjs +4 -0
- package/dist/esm/connectkit/openConnector/index.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/index.native.js +4 -0
- package/dist/esm/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/launcher.mjs +106 -0
- package/dist/esm/connectkit/openConnector/launcher.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/launcher.native.js +128 -0
- package/dist/esm/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/esm/connectkit/screens.mjs +2 -11
- package/dist/esm/connectkit/screens.mjs.map +1 -1
- package/dist/esm/connectkit/screens.native.js +2 -13
- package/dist/esm/connectkit/screens.native.js.map +1 -1
- package/dist/esm/connectkit/siwe/connectIntent.mjs +9 -6
- package/dist/esm/connectkit/siwe/connectIntent.mjs.map +1 -1
- package/dist/esm/connectkit/siwe/connectIntent.native.js +10 -4
- package/dist/esm/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/esm/connectkit/useWeb3Modal.mjs +22 -1
- package/dist/esm/connectkit/useWeb3Modal.mjs.map +1 -1
- package/dist/esm/connectkit/useWeb3Modal.native.js +23 -1
- package/dist/esm/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/esm/connectkit/web3Bridge.mjs +4 -1
- package/dist/esm/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/esm/connectkit/web3Bridge.native.js +4 -1
- package/dist/esm/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/esm/connectkit/web3Provider.mjs.map +1 -1
- package/dist/esm/connectkit/web3Provider.native.js.map +1 -1
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs +34 -6
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js +38 -5
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectButton/index.mjs +5 -0
- package/dist/jsx/connectkit/components/ConnectButton/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/jsx/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +9 -4
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/jsx/connectkit/index.mjs +3 -1
- package/dist/jsx/connectkit/index.mjs.map +1 -1
- package/dist/jsx/connectkit/index.native.js +5 -0
- package/dist/jsx/connectkit/index.native.js.map +1 -1
- package/dist/jsx/connectkit/openConnector/context.mjs +118 -0
- package/dist/jsx/connectkit/openConnector/context.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/context.native.js +188 -0
- package/dist/jsx/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/device.mjs +16 -0
- package/dist/jsx/connectkit/openConnector/device.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/device.native.js +51 -0
- package/dist/jsx/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/index.mjs +4 -0
- package/dist/jsx/connectkit/openConnector/index.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/index.native.js +38 -0
- package/dist/jsx/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/launcher.mjs +106 -0
- package/dist/jsx/connectkit/openConnector/launcher.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/launcher.native.js +158 -0
- package/dist/jsx/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/jsx/connectkit/screens.mjs +2 -11
- package/dist/jsx/connectkit/screens.mjs.map +1 -1
- package/dist/jsx/connectkit/screens.native.js +1 -12
- package/dist/jsx/connectkit/screens.native.js.map +1 -1
- package/dist/jsx/connectkit/siwe/connectIntent.mjs +9 -6
- package/dist/jsx/connectkit/siwe/connectIntent.mjs.map +1 -1
- package/dist/jsx/connectkit/siwe/connectIntent.native.js +10 -3
- package/dist/jsx/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/jsx/connectkit/useWeb3Modal.mjs +22 -1
- package/dist/jsx/connectkit/useWeb3Modal.mjs.map +1 -1
- package/dist/jsx/connectkit/useWeb3Modal.native.js +22 -0
- package/dist/jsx/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.mjs +4 -1
- package/dist/jsx/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.native.js +4 -1
- package/dist/jsx/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/jsx/connectkit/web3Provider.mjs.map +1 -1
- package/dist/jsx/connectkit/web3Provider.native.js.map +1 -1
- package/package.json +7 -6
- package/src/connectkit/components/Common/ConnectorList/index.tsx +30 -2
- package/src/connectkit/components/ConnectButton/index.tsx +5 -0
- package/src/connectkit/components/ConnectModal/ConnectWithInjector/index.tsx +13 -8
- package/src/connectkit/index.ts +8 -0
- package/src/connectkit/openConnector/context.tsx +176 -0
- package/src/connectkit/openConnector/device.spec.ts +86 -0
- package/src/connectkit/openConnector/device.ts +37 -0
- package/src/connectkit/openConnector/index.ts +18 -0
- package/src/connectkit/openConnector/launcher.spec.ts +325 -0
- package/src/connectkit/openConnector/launcher.ts +203 -0
- package/src/connectkit/openConnector/modal.spec.tsx +330 -0
- package/src/connectkit/screens.tsx +2 -11
- package/src/connectkit/siwe/connectIntent.spec.ts +90 -0
- package/src/connectkit/siwe/connectIntent.ts +19 -6
- package/src/connectkit/useWeb3Modal.ts +25 -1
- package/src/connectkit/web3Bridge.tsx +4 -1
- package/src/connectkit/web3Provider.tsx +4 -1
- package/types/connectkit/components/Common/ConnectorList/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectButton/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectModal/ConnectWithInjector/index.d.ts.map +1 -1
- package/types/connectkit/index.d.ts +2 -0
- package/types/connectkit/index.d.ts.map +1 -1
- package/types/connectkit/openConnector/context.d.ts +48 -0
- package/types/connectkit/openConnector/context.d.ts.map +1 -0
- package/types/connectkit/openConnector/device.d.ts +18 -0
- package/types/connectkit/openConnector/device.d.ts.map +1 -0
- package/types/connectkit/openConnector/index.d.ts +3 -0
- package/types/connectkit/openConnector/index.d.ts.map +1 -0
- package/types/connectkit/openConnector/launcher.d.ts +64 -0
- package/types/connectkit/openConnector/launcher.d.ts.map +1 -0
- package/types/connectkit/screens.d.ts.map +1 -1
- package/types/connectkit/siwe/connectIntent.d.ts +8 -3
- package/types/connectkit/siwe/connectIntent.d.ts.map +1 -1
- package/types/connectkit/useWeb3Modal.d.ts +16 -0
- package/types/connectkit/useWeb3Modal.d.ts.map +1 -1
- package/types/connectkit/web3Bridge.d.ts.map +1 -1
- package/types/connectkit/web3Provider.d.ts +4 -1
- package/types/connectkit/web3Provider.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["routes","useModal","useSIWE","useConnectCallback","useWeb3Modal","onConnect","onDisconnect","base","signIn","
|
|
1
|
+
{"version":3,"names":["routes","useModal","useModalState","useSIWE","useConnectCallback","useConnectorLauncher","useWeb3Modal","onConnect","onDisconnect","base","signIn","launcher","isConnected","connected","openConnector","id","options","openScreen","CONNECTORS","pendingConnector","openAbout","ABOUT","openOnboarding","ONBOARDING","openProfile","PROFILE","openSwitchNetworks","SWITCHNETWORKS","openSIWE","triggerSIWE","openPreferredConnector","SIGNINWITHETHEREUM","openGpg","SIGNINWITHGPG"],"sources":["../../../src/connectkit/useWeb3Modal.ts"],"sourcesContent":[null],"mappings":"AAAA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mB,sBAAA,CAAuB,GAAG;MACxDrB,IAAA,CAAKQ,UAAA,CAAWjB,MAAA,CAAO+B,kBAAkB;MACzC,IAAIF,WAAA,EAAanB,MAAA,CAAO;IAC1B;IAAA;IAEAsB,OAAA,EAASA,CAAA,KAAMvB,IAAA,CAAKQ,UAAA,CAAWjB,MAAA,CAAOiC,aAAa;EACrD;AACF","ignoreList":[]}
|
|
@@ -30,21 +30,42 @@ module.exports = __toCommonJS(useWeb3Modal_exports);
|
|
|
30
30
|
var import_connectkit = require("@multiplatform.one/connectkit");
|
|
31
31
|
var import_siwe = require("./siwe/index.native.js");
|
|
32
32
|
var import_useConnectCallback = require("./hooks/useConnectCallback.native.js");
|
|
33
|
+
var import_openConnector = require("./openConnector/index.native.js");
|
|
33
34
|
var useWeb3Modal = function useWeb3Modal2() {
|
|
34
35
|
var {
|
|
35
36
|
onConnect,
|
|
36
37
|
onDisconnect
|
|
37
38
|
} = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
39
|
+
var _ref;
|
|
38
40
|
var base = (0, import_connectkit.useModal)();
|
|
39
41
|
var {
|
|
40
42
|
signIn
|
|
41
43
|
} = (0, import_siwe.useSIWE)();
|
|
44
|
+
var launcher = (0, import_openConnector.useConnectorLauncher)();
|
|
45
|
+
var isConnected = !!(0, import_connectkit.useModalState)().connected;
|
|
42
46
|
(0, import_useConnectCallback.useConnectCallback)({
|
|
43
47
|
onConnect,
|
|
44
48
|
onDisconnect
|
|
45
49
|
});
|
|
46
50
|
return {
|
|
47
51
|
...base,
|
|
52
|
+
/**
|
|
53
|
+
* Connect one wallet straight from the caller's click, skipping the list.
|
|
54
|
+
* Call it synchronously inside the click handler. It starts wagmi's connect
|
|
55
|
+
* before it returns and before any UI change, and wagmi reaches the connector
|
|
56
|
+
* a few promise ticks later, still inside the click's task, so a phone's wallet
|
|
57
|
+
* deeplink keeps the tap's user activation. Shows the connecting screen, and
|
|
58
|
+
* the wallet list if the page stays in front for `fallbackMs` with the connect
|
|
59
|
+
* unanswered (no wallet app, or no answer after coming back from it) or the
|
|
60
|
+
* connect fails. Closing the modal or leaving the connecting screen stops that
|
|
61
|
+
* fallback. Calling it again while that connect is pending re-opens the
|
|
62
|
+
* pending request.
|
|
63
|
+
*/
|
|
64
|
+
openConnector: function openConnector(id, options) {
|
|
65
|
+
if (launcher) launcher.openConnector(id, options);else base.openScreen(import_connectkit.routes.CONNECTORS);
|
|
66
|
+
},
|
|
67
|
+
/** Wallet id `openConnector` is connecting, or null. */
|
|
68
|
+
pendingConnector: (_ref = launcher === null || launcher === void 0 ? void 0 : launcher.pendingConnector) !== null && _ref !== void 0 ? _ref : null,
|
|
48
69
|
// Disconnected routes
|
|
49
70
|
openAbout: function openAbout() {
|
|
50
71
|
return base.openScreen(import_connectkit.routes.ABOUT);
|
|
@@ -60,6 +81,7 @@ var useWeb3Modal = function useWeb3Modal2() {
|
|
|
60
81
|
return base.openScreen(import_connectkit.routes.SWITCHNETWORKS);
|
|
61
82
|
},
|
|
62
83
|
openSIWE: function openSIWE(triggerSIWE) {
|
|
84
|
+
if (!isConnected && (launcher === null || launcher === void 0 ? void 0 : launcher.openPreferredConnector())) return;
|
|
63
85
|
base.openScreen(import_connectkit.routes.SIGNINWITHETHEREUM);
|
|
64
86
|
if (triggerSIWE) signIn();
|
|
65
87
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","useWeb3Modal_exports","useWeb3Modal","module","exports"],"sources":["../../../src/connectkit/useWeb3Modal.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAe;AACxB,IAAAC,gBAAS,GAAAF,MAAA,CAAAG,wBAAmD;
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","useWeb3Modal_exports","useWeb3Modal","module","exports","import_connectkit","require","import_siwe","import_useConnectCallback","import_openConnector","useWeb3Modal2","onConnect","onDisconnect","arguments","length","_ref","base","useModal","signIn","useSIWE","launcher","useConnectorLauncher","isConnected","useModalState","connected","useConnectCallback"],"sources":["../../../src/connectkit/useWeb3Modal.ts"],"sourcesContent":[null],"mappings":"AAAA,YAAS;;AACT,IAAAA,SAAS,GAAAC,MAAA,CAAAC,cAAe;AACxB,IAAAC,gBAAS,GAAAF,MAAA,CAAAG,wBAAmD;AAC5D,IAAAC,iBAAS,GAAAJ,MAAA,CAAAK,mBAAuD;AAOzD,IAAAC,YAAM,GAAAN,MAAkB,CAAAO,SAAW,CAAAC,cAAa;AACrD,IAAAC,QAAM,GAAOA,CAAAC,MAAA,EAASC,GAAA;EACtB,SAAQC,IAAA,IAAOD,GAAI,EACnBZ,SAAM,CAAAW,MAAW,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAAA,CAAAC,IAAqB;IAAAE,UAAA;EAAA;AACtC;AAEA,IAAAC,WAAA,GAAAA,CAAAC,EAAmB,EAAEC,IAAA,EAAAC,MAAW,EAAAC,IAAA;EAEhC,IAAAF,IAAO,WAAAA,IAAA,wBAAAA,IAAA;IACL,KAAG,IAAAG,GAAA,IAAAhB,iBAAA,CAAAa,IAAA,QAAAX,YAAA,CAAAe,IAAA,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAAAnB,SAAA,CAAAiB,EAAA,EAAAI,GAAA;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAjB,gBAAA,CAAAe,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAAA;EAAA,OAAAE,EAAA;AAAA;AAAA,IAAAM,YAAA,GAAAC,GAAA,IAAAR,WAAA,CAAAhB,SAAA;EAAAyB,KAAA;AAAA,IAAAD,GAAA;AAAA,IAAAE,oBAAA;AAAAhB,QAAA,CAAAgB,oBAAA;EAAAC,YAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAN,YAAA,CAAAG,oBAAA;AAAA,IAAAI,iBAAA,GAAAC,OAAA;AAAA,IAaHC,WAAA,GAAAD,OAA4B;AAC1B,IAAAE,yBAAuB,GAAAF,OAAA,uCAAyB;AAAA,IAAAG,oBACtC,GAAWH,OAAO,kCAAU;AAAA,IACxCJ,YAAA,YAAAQ,cAAA;EAAA;IAAAC,SAAA;IAAAC;EAAA,IAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,iBAAAA,SAAA;EAAA,IAEAE,IAAA;EAAgD,IAAAC,IAAA,OAAAX,iBAAA,CAAAY,QAAA;EAAA,IAEhD;IAAAC;EAAW,MAAM,EAAAX,WAAK,CAAAY,OAAW,EAAO;EAAK,IAC7CC,QAAA,OAAgBX,oBAAW,CAAWY,oBAAiB;EAAA,IAAAC,WAAA,SAAAjB,iBAAA,CAAAkB,aAAA,IAAAC,SAAA;EAAA,EAEvD,EAAAhB,yBAAwB,CAAAiB,kBAAkB;IAC1Cd,SAAA;IACAC;EAGE;EACA;IACA,GAAAI,IAAI;IACN;AAAA;AAAA;AAEmD;AAEvD","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ import { clearConnectIntent, consumeConnectIntent } from "./siwe/connectIntent.m
|
|
|
10
10
|
import { SIWEContext } from "./siwe/SIWEContext.mjs";
|
|
11
11
|
import { GpgContext } from "@multiplatform.one/gpg";
|
|
12
12
|
import { useWallet } from "./wallets/useWallets.mjs";
|
|
13
|
+
import { ConnectorLauncherProvider } from "./openConnector/index.mjs";
|
|
13
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
15
|
const Web3ModalBridge = ({
|
|
15
16
|
children,
|
|
@@ -76,7 +77,9 @@ const Web3ModalBridge = ({
|
|
|
76
77
|
enabled: context.open,
|
|
77
78
|
children: [/* @__PURE__ */jsx(Web3ScreenRegistrar, {}), /* @__PURE__ */jsx(ModalStateProvider, {
|
|
78
79
|
value: modalState,
|
|
79
|
-
children
|
|
80
|
+
children: /* @__PURE__ */jsx(ConnectorLauncherProvider, {
|
|
81
|
+
children
|
|
82
|
+
})
|
|
80
83
|
})]
|
|
81
84
|
});
|
|
82
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","useReactContext","useEffect","useMemo","useAccount","useAccountEffect","useConfig","ModalStateProvider","routes","isWalletConnectConnector","Web3ContextProvider","Web3ScreenRegistrar","ensureWalletConnectors","useChainIsSupported","useConnectCallback","clearConnectIntent","consumeConnectIntent","SIWEContext","GpgContext","useWallet","jsx","jsxs","Web3ModalBridge","children","onConnect","onDisconnect","context","isConnected","chain","chainIsSupported","id","signInWithEthereum","enabled","signInWithGpg","isSignedIn","useSIWESignedIn","wallet","connector","useQrcode","getWalletConnectDeeplink","isInstalled","ckConfig","timers","map","d","setTimeout","forEach","t","clearTimeout","options","enforceSupportedChains","setOpen","setRoute","SWITCHNETWORKS","route","PROFILE","SIGNINWITHETHEREUM","SIGNINWITHGPG","disableSiweRedirect","modalState","connected","walletName","name","isWalletConnect","open","value","ctx","session","data","address"],"sources":["../../../src/connectkit/web3Bridge.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAgBA,UAAA,IAAcC,eAAA,EAAiBC,SAAA,EAAWC,OAAA,QAAe;AACzE,SAASC,UAAA,EAAYC,gBAAA,EAAkBC,SAAA,QAAiB;AAExD,SAEEC,kBAAA,EACAC,MAAA,EACAR,UAAA,EACAS,wBAAA,QACK;AACP,SAASC,mBAAA,QAA2B;AACpC,SAASC,mBAAA,QAA2B;AACpC,SAASC,sBAAA,QAA8B;AACvC,SAASC,mBAAA,QAA2B;AACpC,SAASC,kBAAA,QAAmD;AAC5D,SAASC,kBAAA,EAAoBC,oBAAA,QAA4B;AACzD,SAASC,WAAA,QAAmB;AAC5B,SAASC,UAAA,QAAkB;AAC3B,SAASC,SAAA,QAAiB;
|
|
1
|
+
{"version":3,"names":["useContext","useReactContext","useEffect","useMemo","useAccount","useAccountEffect","useConfig","ModalStateProvider","routes","isWalletConnectConnector","Web3ContextProvider","Web3ScreenRegistrar","ensureWalletConnectors","useChainIsSupported","useConnectCallback","clearConnectIntent","consumeConnectIntent","SIWEContext","GpgContext","useWallet","ConnectorLauncherProvider","jsx","jsxs","Web3ModalBridge","children","onConnect","onDisconnect","context","isConnected","chain","chainIsSupported","id","signInWithEthereum","enabled","signInWithGpg","isSignedIn","useSIWESignedIn","wallet","connector","useQrcode","getWalletConnectDeeplink","isInstalled","ckConfig","timers","map","d","setTimeout","forEach","t","clearTimeout","options","enforceSupportedChains","setOpen","setRoute","SWITCHNETWORKS","route","PROFILE","SIGNINWITHETHEREUM","SIGNINWITHGPG","disableSiweRedirect","modalState","connected","walletName","name","isWalletConnect","open","value","ctx","session","data","address"],"sources":["../../../src/connectkit/web3Bridge.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAgBA,UAAA,IAAcC,eAAA,EAAiBC,SAAA,EAAWC,OAAA,QAAe;AACzE,SAASC,UAAA,EAAYC,gBAAA,EAAkBC,SAAA,QAAiB;AAExD,SAEEC,kBAAA,EACAC,MAAA,EACAR,UAAA,EACAS,wBAAA,QACK;AACP,SAASC,mBAAA,QAA2B;AACpC,SAASC,mBAAA,QAA2B;AACpC,SAASC,sBAAA,QAA8B;AACvC,SAASC,mBAAA,QAA2B;AACpC,SAASC,kBAAA,QAAmD;AAC5D,SAASC,kBAAA,EAAoBC,oBAAA,QAA4B;AACzD,SAASC,WAAA,QAAmB;AAC5B,SAASC,UAAA,QAAkB;AAC3B,SAASC,SAAA,QAAiB;AAC1B,SAASC,yBAAA,QAAiC;AA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A,EAASN,OAAA,CAAQsC,IAAA;IACpCzC,QAAA,kBAAAH,GAAA,CAACV,mBAAA,IAAoB,GACrB,eAAAU,GAAA,CAACd,kBAAA;MAAmB2D,KAAA,EAAON,UAAA;MACzBpC,QAAA,iBAAAH,GAAA,CAACD,yBAAA;QAA2BI;MAAA,CAAS;IAAA,CACvC;EAAA,CACF;AAEJ;AAIA,SAASY,gBAAA,EAA2C;EAClD,MAAM+B,GAAA,GAAMlE,eAAA,CAAgBgB,WAAW;EACvC,OAAO;IAAEkB,UAAA,EAAY,CAAC,CAACgC,GAAA,EAAKC,OAAA,EAASC,IAAA,EAAMC;EAAQ;AACrD","ignoreList":[]}
|
|
@@ -51,6 +51,7 @@ var import_connectIntent = require("./siwe/connectIntent.native.js");
|
|
|
51
51
|
var import_SIWEContext = require("./siwe/SIWEContext.native.js");
|
|
52
52
|
var import_gpg = require("@multiplatform.one/gpg");
|
|
53
53
|
var import_useWallets = require("./wallets/useWallets.native.js");
|
|
54
|
+
var import_openConnector = require("./openConnector/index.native.js");
|
|
54
55
|
var Web3ModalBridge = function Web3ModalBridge2(param) {
|
|
55
56
|
var {
|
|
56
57
|
children,
|
|
@@ -138,7 +139,9 @@ var Web3ModalBridge = function Web3ModalBridge2(param) {
|
|
|
138
139
|
enabled: context.open,
|
|
139
140
|
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_screens.Web3ScreenRegistrar, {}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_connectkit.ModalStateProvider, {
|
|
140
141
|
value: modalState,
|
|
141
|
-
children
|
|
142
|
+
children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_openConnector.ConnectorLauncherProvider, {
|
|
143
|
+
children
|
|
144
|
+
})
|
|
142
145
|
})]
|
|
143
146
|
});
|
|
144
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","web3Bridge_exports","Web3ModalBridge","module","exports","import_jsx_runtime","require","import_react","import_wagmi","import_connectkit","import_web3","import_screens","import_ensureWalletConnectors","import_useChainIsSupported","import_useConnectCallback","import_connectIntent","import_SIWEContext","import_gpg","import_useWallets","Web3ModalBridge2","param","children","onConnect","onDisconnect","_ref","_ref1","_ref2","_useReactContext","_useReactContext1","_context_connector","context","useContext","useConnectCallback","isConnected","chain","useAccount","chainIsSupported","useChainIsSupported","id","signInWithEthereum","SIWEContext","enabled","signInWithGpg","GpgContext","isSignedIn","useSIWESignedIn","wallet","useWallet","connector","useQrcode","getWalletConnectDeeplink","isInstalled","ckConfig","useConfig","useEffect","ensureWalletConnectors","timers","map","d","setTimeout","forEach","t","clearTimeout","_context_options","options","enforceSupportedChains","setOpen","setRoute","routes","SWITCHNETWORKS"],"sources":["../../../src/connectkit/web3Bridge.tsx"],"sourcesContent":[null],"mappings":"AAAA,YAAgB;;AAChB,IAAAA,QAAS,GAAAC,MAAY,CAAAC,MAAA;AAErB,IAAAC,SAAA,GAAAF,MAAA,CAAAG,cAAA;AAAA,IAEEC,gBAAA,GAAAJ,MAAA,CAAAK,wBAAA;AAAA,IACAC,iBAAA,GAAAN,MAAA,CAAAO,mBAAA;AAAA,IACAC,YAAA,GAAAR,MAAA,CAAAS,cAAA;AAAA,IACAC,YAAA,GAAAV,MAAA,CAAAW,SAAA,CAAAC,cAAA;AAAA,IAAAC,QACK,GAAAA,CAAAC,MAAA,EAAAC,GAAA;EACP,SAASC,IAAA,IAAAD,GAAA,EACTb,SAAS,CAAAY,MAAA,EAAAE,IAAA;IAAAC,GAAA,EAAAF,GAA2B,CAAAC,IAAA;IAAAE,UAAA;EAAA;AACpC;AACA,IAAAC,WAAS,GAAAA,CAAAC,EAAA,EAAAC,IAAA,EAAAC,MAAA,EAA2BC,IAAA;EACpC,IAAAF,IAAS,WAAAA,IAAA,aAAmD,WAAAA,IAAA;IAC5D,KAAS,IAAAG,GAAA,IAAAlB,iBAAoB,CAAAe,IAAA,GAC7B,IAAS,CAAAX,YAAA,CAAAe,IAAmB,CAAAL,EAAA,EAAAI,GAAA,KAAAA,GAAA,KAAAF,MAAA,EAC5BpB,SAAS,CAAAkB,EAAA,EAAAI,GAAA,EAAkB;MAAAP,GAAA,EAAAA,CAAA,KAAAI,IAAA,CAAAG,GAAA;MAAAN,UAAA,IAAAK,IAAA,GAAAnB,gBAAA,CAAAiB,IAAA,EAAAG,GAAA,MAAAD,IAAA,CAAAL;IAAA;EAC3B;
|
|
1
|
+
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","web3Bridge_exports","Web3ModalBridge","module","exports","import_jsx_runtime","require","import_react","import_wagmi","import_connectkit","import_web3","import_screens","import_ensureWalletConnectors","import_useChainIsSupported","import_useConnectCallback","import_connectIntent","import_SIWEContext","import_gpg","import_useWallets","import_openConnector","Web3ModalBridge2","param","children","onConnect","onDisconnect","_ref","_ref1","_ref2","_useReactContext","_useReactContext1","_context_connector","context","useContext","useConnectCallback","isConnected","chain","useAccount","chainIsSupported","useChainIsSupported","id","signInWithEthereum","SIWEContext","enabled","signInWithGpg","GpgContext","isSignedIn","useSIWESignedIn","wallet","useWallet","connector","useQrcode","getWalletConnectDeeplink","isInstalled","ckConfig","useConfig","useEffect","ensureWalletConnectors","timers","map","d","setTimeout","forEach","t","clearTimeout","_context_options","options","enforceSupportedChains","setOpen","setRoute","routes","SWITCHNETWORKS"],"sources":["../../../src/connectkit/web3Bridge.tsx"],"sourcesContent":[null],"m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;MACA;IAAA;EACA,GACF,CACFT,QAAA,CAEA;EAEI,IAAA9C,YAAA,CAAAgD,SAAC,EACD;IAGF,IAAAS,gBAAA;IAEJ,IAAA9B,WAAA,MAAA8B,gBAAA,GAAAjC,OAAA,CAAAkC,OAAA,cAAAD,gBAAA,uBAAAA,gBAAA,CAAAE,sBAAA,MAAA7B,gBAAA;MAIAN,OAAS,CAAAoC,OAAA,KAA2C;MAC5CpC,OAAM,CAAAqC,QAAA,CAAA3D,iBAA2B,CAAA4D,MAAA,CAAAC,cAAA;IACvC;EACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ConnectKitProvider","BaseProvider","Web3ModalBridge","jsx","bridge","props"],"sources":["../../../src/connectkit/web3Provider.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,kBAAA,IAAsBC,YAAA,QAAoB;AACnD,SAASC,eAAA,QAAuB;
|
|
1
|
+
{"version":3,"names":["ConnectKitProvider","BaseProvider","Web3ModalBridge","jsx","bridge","props"],"sources":["../../../src/connectkit/web3Provider.tsx"],"sourcesContent":[null],"mappings":"AACA,SAASA,kBAAA,IAAsBC,YAAA,QAAoB;AACnD,SAASC,eAAA,QAAuB;AAY9B,SAAAC,GAAA;AADK,MAAMH,kBAAA,GAAsCA,CAAC;EAAEI,MAAA;EAAQ,GAAGC;AAAM,MACrE,eAAAF,GAAA,CAACF,YAAA;EAAaG,MAAA,EAAQA,MAAA,IAAUF,eAAA;EAAkB,GAAGG;AAAA,CAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor"],"sources":["../../../src/connectkit/web3Provider.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,QAAS,GAAAC,MAAA,CAAAC,MAAA;
|
|
1
|
+
{"version":3,"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor"],"sources":["../../../src/connectkit/web3Provider.tsx"],"sourcesContent":[null],"mappings":"AACA,YAAS;;AACT,IAAAA,QAAS,GAAAC,MAAA,CAAAC,MAAA;AAYP,IAAAC,SAAA,GAAAF,MAAA,CAAAG,cAAA;AADK,IAAAC,gBAAM,GAAAJ,MAAuC,CAAEK,wBACpD","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/web3",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.18.0",
|
|
4
4
|
"description": "Web3 wallet integration for multiplatform.one ecosystem with ConnectKit and wagmi",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"connectkit",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"@aave/account": "^0.2.0",
|
|
68
68
|
"@metamask/connect-evm": "^2.1.1",
|
|
69
69
|
"@metamask/sdk": "0.33.1",
|
|
70
|
-
"@multiplatform.one/connectkit": "7.
|
|
71
|
-
"@multiplatform.one/gpg": "7.
|
|
72
|
-
"@multiplatform.one/platform": "7.
|
|
73
|
-
"@multiplatform.one/theme": "7.
|
|
70
|
+
"@multiplatform.one/connectkit": "7.18.0",
|
|
71
|
+
"@multiplatform.one/gpg": "7.18.0",
|
|
72
|
+
"@multiplatform.one/platform": "7.18.0",
|
|
73
|
+
"@multiplatform.one/theme": "7.18.0",
|
|
74
74
|
"@noble/curves": "^1.9.7",
|
|
75
75
|
"@solana/wallet-adapter-base": "^0.9.27",
|
|
76
76
|
"@solana/wallet-adapter-react": "^0.15.39",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"wagmi": "^3.7.1"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@multiplatform.one/config": "7.
|
|
94
|
+
"@multiplatform.one/config": "7.18.0",
|
|
95
95
|
"@tamagui/build": "2.7.6",
|
|
96
96
|
"@tanstack/react-query": "^5.100.7",
|
|
97
97
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"@types/qrcode": "^1.4.2",
|
|
100
100
|
"@types/styled-components": "^5.1.25",
|
|
101
101
|
"@vitejs/plugin-react": "^6.0.1",
|
|
102
|
+
"happy-dom": "^20.9.0",
|
|
102
103
|
"react": "19.2.5",
|
|
103
104
|
"tamagui": "2.7.6",
|
|
104
105
|
"typescript": "~5.9.3",
|
|
@@ -10,6 +10,11 @@ import {
|
|
|
10
10
|
isMetaMaskConnector,
|
|
11
11
|
isPortoConnector,
|
|
12
12
|
isWalletConnectConnector,
|
|
13
|
+
resolveListEntries,
|
|
14
|
+
useModalState,
|
|
15
|
+
useScreenRegistry,
|
|
16
|
+
type ScreenDef,
|
|
17
|
+
type ScreenListEntry,
|
|
13
18
|
} from "@multiplatform.one/connectkit";
|
|
14
19
|
|
|
15
20
|
import {
|
|
@@ -51,6 +56,9 @@ const ConnectorList = () => {
|
|
|
51
56
|
const { lastConnectorId } = useLastConnector();
|
|
52
57
|
const aaveAccountConnector = useAaveAccountConnector();
|
|
53
58
|
const [expanded, setExpanded] = useState<string | null>(null);
|
|
59
|
+
const { screens } = useScreenRegistry();
|
|
60
|
+
const modalState = useModalState();
|
|
61
|
+
const screenEntries = resolveListEntries(screens, modalState);
|
|
54
62
|
|
|
55
63
|
const filteredWallets = wallets.filter((wallet) => wallet.id !== aaveAccountConnector?.id);
|
|
56
64
|
|
|
@@ -79,7 +87,7 @@ const ConnectorList = () => {
|
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
89
|
|
|
82
|
-
if (groups.length === 0) {
|
|
90
|
+
if (groups.length === 0 && screenEntries.length === 0) {
|
|
83
91
|
return (
|
|
84
92
|
<ScrollArea mobileDirection={"horizontal"}>
|
|
85
93
|
<Alert error>No connectors found in ConnectKit config.</Alert>
|
|
@@ -111,7 +119,7 @@ const ConnectorList = () => {
|
|
|
111
119
|
|
|
112
120
|
return (
|
|
113
121
|
<ScrollArea mobileDirection={"horizontal"}>
|
|
114
|
-
<ConnectorsContainer $mobile={isMobile} $totalResults={groups.length}>
|
|
122
|
+
<ConnectorsContainer $mobile={isMobile} $totalResults={groups.length + screenEntries.length}>
|
|
115
123
|
{groups.map((group) =>
|
|
116
124
|
group.members.length === 1 ? (
|
|
117
125
|
<ConnectorItem
|
|
@@ -128,6 +136,9 @@ const ConnectorList = () => {
|
|
|
128
136
|
/>
|
|
129
137
|
),
|
|
130
138
|
)}
|
|
139
|
+
{screenEntries.map((def) => (
|
|
140
|
+
<ScreenEntryItem key={def.id} def={def} />
|
|
141
|
+
))}
|
|
131
142
|
</ConnectorsContainer>
|
|
132
143
|
</ScrollArea>
|
|
133
144
|
);
|
|
@@ -135,6 +146,23 @@ const ConnectorList = () => {
|
|
|
135
146
|
|
|
136
147
|
export default ConnectorList;
|
|
137
148
|
|
|
149
|
+
// A registered screen offered in the list (GPG): tapping it routes to the screen.
|
|
150
|
+
const ScreenEntryItem = ({ def }: { def: ScreenDef & { listEntry: ScreenListEntry } }) => {
|
|
151
|
+
const context = useContext();
|
|
152
|
+
const { name, icon } = def.listEntry;
|
|
153
|
+
return (
|
|
154
|
+
<ConnectorButton
|
|
155
|
+
type="button"
|
|
156
|
+
data-screen-entry={def.id}
|
|
157
|
+
disabled={context.route !== routes.CONNECTORS}
|
|
158
|
+
onClick={() => context.setRoute(def.id)}
|
|
159
|
+
>
|
|
160
|
+
<ConnectorIcon data-shape="squircle">{icon}</ConnectorIcon>
|
|
161
|
+
<ConnectorLabel>{name}</ConnectorLabel>
|
|
162
|
+
</ConnectorButton>
|
|
163
|
+
);
|
|
164
|
+
};
|
|
165
|
+
|
|
138
166
|
// A collapsed multi-chain wallet row — clicking expands the chain picker.
|
|
139
167
|
const GroupItem = ({
|
|
140
168
|
group,
|
|
@@ -25,6 +25,7 @@ import { useSIWE } from "../../siwe";
|
|
|
25
25
|
import { Chain } from "viem";
|
|
26
26
|
import { useChainIsSupported } from "../../hooks/useChainIsSupported";
|
|
27
27
|
import { useEnsFallbackConfig } from "../../hooks/useEnsFallbackConfig";
|
|
28
|
+
import { useConnectorLauncher } from "../../openConnector";
|
|
28
29
|
|
|
29
30
|
const contentVariants: Variants = {
|
|
30
31
|
initial: {
|
|
@@ -123,6 +124,7 @@ const ConnectButtonRenderer: React.FC<ConnectButtonRendererProps> = ({ children
|
|
|
123
124
|
const isMounted = useIsMounted();
|
|
124
125
|
const context = useContext();
|
|
125
126
|
const { open, setOpen } = useModal();
|
|
127
|
+
const launcher = useConnectorLauncher();
|
|
126
128
|
|
|
127
129
|
const { address, isConnected, chain } = useAccount();
|
|
128
130
|
const isChainSupported = useChainIsSupported(chain?.id);
|
|
@@ -139,6 +141,7 @@ const ConnectButtonRenderer: React.FC<ConnectButtonRendererProps> = ({ children
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
function show() {
|
|
144
|
+
if (!isConnected && launcher?.openPreferredConnector()) return;
|
|
142
145
|
setOpen(true);
|
|
143
146
|
context.setRoute(isConnected ? routes.PROFILE : routes.CONNECTORS);
|
|
144
147
|
}
|
|
@@ -336,11 +339,13 @@ export function ConnectKitButton({
|
|
|
336
339
|
const isMounted = useIsMounted();
|
|
337
340
|
|
|
338
341
|
const context = useContext();
|
|
342
|
+
const launcher = useConnectorLauncher();
|
|
339
343
|
|
|
340
344
|
const { isConnected, address, chain } = useAccount();
|
|
341
345
|
const chainIsSupported = useChainIsSupported(chain?.id);
|
|
342
346
|
|
|
343
347
|
function show() {
|
|
348
|
+
if (!isConnected && launcher?.openPreferredConnector()) return;
|
|
344
349
|
context.setOpen(true);
|
|
345
350
|
context.setRoute(isConnected ? routes.PROFILE : routes.CONNECTORS);
|
|
346
351
|
}
|
|
@@ -38,6 +38,7 @@ import { useConnect } from "../../../hooks/useConnect";
|
|
|
38
38
|
import { useWallet } from "../../../wallets/useWallets";
|
|
39
39
|
import { setConnectIntent } from "../../../siwe/connectIntent";
|
|
40
40
|
import { isEmbeddedDesktopWebview } from "../../../connectors/embeddedDesktop";
|
|
41
|
+
import { useConnectorLauncher } from "../../../openConnector";
|
|
41
42
|
import CircleSpinner from "./CircleSpinner";
|
|
42
43
|
|
|
43
44
|
export const states = {
|
|
@@ -166,6 +167,12 @@ const ConnectWithInjector: React.FC<{
|
|
|
166
167
|
};
|
|
167
168
|
}, [wallet?.connector]);
|
|
168
169
|
|
|
170
|
+
// openConnector fires connect() inside the app's own tap, before this screen
|
|
171
|
+
// mounts, so the connector may have announced its deeplink already.
|
|
172
|
+
const launcher = useConnectorLauncher();
|
|
173
|
+
const launchedHere = !!wallet && launcher?.pending?.connector.uid === wallet.connector.uid;
|
|
174
|
+
const deeplink = sdkDeeplink ?? (launchedHere ? launcher?.pendingDeeplink : null) ?? undefined;
|
|
175
|
+
|
|
169
176
|
const expiryDefault = 9; // Starting at 10 causes layout shifting, better to start at 9
|
|
170
177
|
const [expiryTimer, setExpiryTimer] = useState<number>(expiryDefault);
|
|
171
178
|
|
|
@@ -176,7 +183,7 @@ const ConnectWithInjector: React.FC<{
|
|
|
176
183
|
const showEmbeddedDesktopMetaMaskQr =
|
|
177
184
|
!isMobile &&
|
|
178
185
|
isMetaMaskConnector(wallet?.connector.id) &&
|
|
179
|
-
!!
|
|
186
|
+
!!deeplink &&
|
|
180
187
|
isEmbeddedDesktopWebview();
|
|
181
188
|
|
|
182
189
|
const extensionUrl = wallet?.downloadUrls?.[browser];
|
|
@@ -221,6 +228,8 @@ const ConnectWithInjector: React.FC<{
|
|
|
221
228
|
// (ConnectorList shouldConnectImmediately); firing again here would queue a
|
|
222
229
|
// second SDK request / deeplink into the MetaMask app.
|
|
223
230
|
if (isMobile && isMetaMaskConnector(wallet?.connector.id)) return;
|
|
231
|
+
// Same when openConnector already fired it inside the app's tap.
|
|
232
|
+
if (launchedHere) return;
|
|
224
233
|
|
|
225
234
|
// UX: Give user time to see the UI before opening the extension
|
|
226
235
|
connectTimeout = setTimeout(runConnect, 600);
|
|
@@ -468,11 +477,7 @@ const ConnectWithInjector: React.FC<{
|
|
|
468
477
|
)}
|
|
469
478
|
</ModalContent>
|
|
470
479
|
{showEmbeddedDesktopMetaMaskQr && (
|
|
471
|
-
<CustomQRCode
|
|
472
|
-
value={sdkDeeplink}
|
|
473
|
-
image={walletInfo.icon}
|
|
474
|
-
imagePosition="center"
|
|
475
|
-
/>
|
|
480
|
+
<CustomQRCode value={deeplink} image={walletInfo.icon} imagePosition="center" />
|
|
476
481
|
)}
|
|
477
482
|
{/* The SDK auto-opens its deeplink, but browsers drop external-
|
|
478
483
|
protocol navigations whose user activation expired while the
|
|
@@ -485,8 +490,8 @@ const ConnectWithInjector: React.FC<{
|
|
|
485
490
|
ASWebAuthenticationSession). So once the SDK emits
|
|
486
491
|
display_uri we render it as a REAL anchor — same-tab,
|
|
487
492
|
because auth sheets can't open new tabs. */}
|
|
488
|
-
{isMobile && isMetaMaskConnector(wallet?.connector.id) &&
|
|
489
|
-
<Button href={
|
|
493
|
+
{isMobile && isMetaMaskConnector(wallet?.connector.id) && deeplink && (
|
|
494
|
+
<Button href={deeplink} target="_self">
|
|
490
495
|
Open {walletInfo.name}
|
|
491
496
|
</Button>
|
|
492
497
|
)}
|
package/src/connectkit/index.ts
CHANGED
|
@@ -8,6 +8,14 @@ export { wallets } from "./wallets";
|
|
|
8
8
|
// web3's wrapper (generic connectkit useModal + wallet/SIWE openers) keeps the
|
|
9
9
|
// consumer-facing `useModal` API. The agnostic base lives in ./hooks/useModal.
|
|
10
10
|
export { useWeb3Modal as useModal } from "./useWeb3Modal";
|
|
11
|
+
export {
|
|
12
|
+
DEFAULT_DESKTOP_OPEN_CONNECTOR_FALLBACK_MS,
|
|
13
|
+
DEFAULT_OPEN_CONNECTOR_FALLBACK_MS,
|
|
14
|
+
type MobileConnectOptions,
|
|
15
|
+
type OpenConnectorOptions,
|
|
16
|
+
type Web3ConnectKitOptions,
|
|
17
|
+
} from "./openConnector";
|
|
18
|
+
export { CONNECT_INTENT_TTL_MS } from "./siwe/connectIntent";
|
|
11
19
|
export { SIWEProvider, useSIWE, SIWE_NONCE_QUERY_KEY, SIWE_SESSION_QUERY_KEY } from "./siwe";
|
|
12
20
|
export type { SIWESession, SIWEConfig } from "./siwe";
|
|
13
21
|
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext as useReactContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useSyncExternalStore,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { useAccountEffect, type Connector } from "wagmi";
|
|
11
|
+
import {
|
|
12
|
+
routes,
|
|
13
|
+
useContext,
|
|
14
|
+
isMobile,
|
|
15
|
+
type ConnectKitOptions,
|
|
16
|
+
} from "@multiplatform.one/connectkit";
|
|
17
|
+
|
|
18
|
+
import { useConnect } from "../hooks/useConnect";
|
|
19
|
+
import { useConnectors } from "../hooks/useConnectors";
|
|
20
|
+
import { useWallets, type WalletProps } from "../wallets/useWallets";
|
|
21
|
+
import { clearConnectIntent, setConnectIntent } from "../siwe/connectIntent";
|
|
22
|
+
import { defaultOpenConnectorFallbackMs } from "./device";
|
|
23
|
+
import {
|
|
24
|
+
createConnectorLauncher,
|
|
25
|
+
type LauncherDeps,
|
|
26
|
+
type OpenConnectorOptions,
|
|
27
|
+
type PendingConnect,
|
|
28
|
+
} from "./launcher";
|
|
29
|
+
|
|
30
|
+
export type MobileConnectOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Connector id a phone connects straight to (e.g. `"metaMaskSDK"`): `openSIWE()`
|
|
33
|
+
* and the default ConnectKit button skip the wallet list for it. Desktop keeps
|
|
34
|
+
* the list. A phone here is what connectkit's `isMobile()` reads from the user
|
|
35
|
+
* agent, so iPadOS Safari and Android's "Desktop site", which both send a desktop
|
|
36
|
+
* one, keep the list too.
|
|
37
|
+
*/
|
|
38
|
+
preferredConnector?: string;
|
|
39
|
+
/** Passed to `openConnector` for the preferred connector. */
|
|
40
|
+
fallbackMs?: number;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** ConnectKit options as web3's ConnectKitProvider takes them. */
|
|
44
|
+
export type Web3ConnectKitOptions = ConnectKitOptions & {
|
|
45
|
+
mobile?: MobileConnectOptions;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ConnectorLauncherValue = {
|
|
49
|
+
openConnector: (id: string, options?: OpenConnectorOptions) => void;
|
|
50
|
+
/**
|
|
51
|
+
* On a phone with `mobile.preferredConnector` set, open that connector and
|
|
52
|
+
* return true. Otherwise do nothing and return false.
|
|
53
|
+
*/
|
|
54
|
+
openPreferredConnector: () => boolean;
|
|
55
|
+
/** Wallet id `openConnector` is connecting, or null. */
|
|
56
|
+
pendingConnector: string | null;
|
|
57
|
+
/** The pending connect's wallet deeplink, once the connector announced it. */
|
|
58
|
+
pendingDeeplink: string | null;
|
|
59
|
+
/** The pending connect, for screens that must not start a second one. */
|
|
60
|
+
pending: PendingConnect | null;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const ConnectorLauncherContext = createContext<ConnectorLauncherValue | null>(null);
|
|
64
|
+
|
|
65
|
+
/** The launcher, or null outside web3's ConnectKitProvider. */
|
|
66
|
+
export function useConnectorLauncher(): ConnectorLauncherValue | null {
|
|
67
|
+
return useReactContext(ConnectorLauncherContext);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function getMobileOptions(options?: ConnectKitOptions): MobileConnectOptions {
|
|
71
|
+
return (options as Web3ConnectKitOptions | undefined)?.mobile ?? {};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Find the list wallet for a connector id. The list hides the MetaMask SDK row
|
|
76
|
+
* behind an injected MetaMask (EIP-6963 `io.metamask`), so an id that is not in
|
|
77
|
+
* the list resolves through its connector's rdns.
|
|
78
|
+
*/
|
|
79
|
+
export function resolveWallet(
|
|
80
|
+
wallets: readonly WalletProps[],
|
|
81
|
+
connectors: readonly Connector[],
|
|
82
|
+
id: string,
|
|
83
|
+
): WalletProps | undefined {
|
|
84
|
+
const direct = wallets.find((wallet) => wallet.id === id);
|
|
85
|
+
if (direct) return direct;
|
|
86
|
+
const connector = connectors.find((c) => c.id === id);
|
|
87
|
+
if (!connector) return undefined;
|
|
88
|
+
const rdns = connector.rdns === undefined ? [] : [connector.rdns].flat();
|
|
89
|
+
return wallets.find((wallet) => rdns.includes(wallet.id));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const ConnectorLauncherProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
93
|
+
children,
|
|
94
|
+
}) => {
|
|
95
|
+
const context = useContext();
|
|
96
|
+
const wallets = useWallets();
|
|
97
|
+
const { connectAsync } = useConnect();
|
|
98
|
+
const connectors = useConnectors();
|
|
99
|
+
|
|
100
|
+
const depsRef = useRef<LauncherDeps>(null as unknown as LauncherDeps);
|
|
101
|
+
depsRef.current = {
|
|
102
|
+
connect: (connector) => connectAsync({ connector }),
|
|
103
|
+
showConnecting: (walletId) => {
|
|
104
|
+
context.setConnector({ id: walletId });
|
|
105
|
+
context.setRoute(routes.CONNECT);
|
|
106
|
+
context.setOpen(true);
|
|
107
|
+
},
|
|
108
|
+
showList: () => {
|
|
109
|
+
context.setRoute(routes.CONNECTORS);
|
|
110
|
+
context.setOpen(true);
|
|
111
|
+
},
|
|
112
|
+
onFailed: () => clearConnectIntent(),
|
|
113
|
+
};
|
|
114
|
+
const latest = useRef({ wallets, connectors, options: context.options });
|
|
115
|
+
latest.current = { wallets, connectors, options: context.options };
|
|
116
|
+
|
|
117
|
+
const launcher = useMemo(() => createConnectorLauncher(() => depsRef.current), []);
|
|
118
|
+
useEffect(() => () => launcher.cancel(), [launcher]);
|
|
119
|
+
const pending = useSyncExternalStore(launcher.subscribe, launcher.pending, launcher.pending);
|
|
120
|
+
|
|
121
|
+
// The session belongs to the connecting screen it opened. Once the user closes the
|
|
122
|
+
// modal or moves off that screen, a fallback must not pull the list back up.
|
|
123
|
+
const { open, route } = context;
|
|
124
|
+
const shownId = context.connector?.id;
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (!pending) return;
|
|
127
|
+
if (!open || route !== routes.CONNECT || shownId !== pending.walletId) launcher.cancel();
|
|
128
|
+
}, [launcher, pending, open, route, shownId]);
|
|
129
|
+
|
|
130
|
+
// Any wallet connecting ends the session, including one the user connected some
|
|
131
|
+
// other way while this connect never answered.
|
|
132
|
+
useAccountEffect({ onConnect: () => launcher.cancel() });
|
|
133
|
+
|
|
134
|
+
const openConnector = useCallback(
|
|
135
|
+
(id: string, options: OpenConnectorOptions = {}) => {
|
|
136
|
+
const { wallets, connectors } = latest.current;
|
|
137
|
+
const wallet = resolveWallet(wallets, connectors, id);
|
|
138
|
+
if (!wallet) {
|
|
139
|
+
context.log(`openConnector: no connector ${id}, showing the wallet list.`);
|
|
140
|
+
depsRef.current.showList();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
// A phone bounces out to the wallet app and often reloads this page on the
|
|
144
|
+
// way back; the intent is what carries the flow on into signing.
|
|
145
|
+
setConnectIntent();
|
|
146
|
+
launcher.open(wallet.id, wallet.connector, {
|
|
147
|
+
fallbackMs: options.fallbackMs ?? defaultOpenConnectorFallbackMs(),
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
// context.log is stable enough for a debug line; the rest is read through refs.
|
|
151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
+
[launcher],
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
const openPreferredConnector = useCallback(() => {
|
|
156
|
+
const mobile = getMobileOptions(latest.current.options);
|
|
157
|
+
if (!mobile.preferredConnector || !isMobile()) return false;
|
|
158
|
+
openConnector(mobile.preferredConnector, { fallbackMs: mobile.fallbackMs });
|
|
159
|
+
return true;
|
|
160
|
+
}, [openConnector]);
|
|
161
|
+
|
|
162
|
+
const value = useMemo<ConnectorLauncherValue>(
|
|
163
|
+
() => ({
|
|
164
|
+
openConnector,
|
|
165
|
+
openPreferredConnector,
|
|
166
|
+
pendingConnector: pending?.walletId ?? null,
|
|
167
|
+
pendingDeeplink: pending?.deeplink ?? null,
|
|
168
|
+
pending,
|
|
169
|
+
}),
|
|
170
|
+
[openConnector, openPreferredConnector, pending],
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<ConnectorLauncherContext.Provider value={value}>{children}</ConnectorLauncherContext.Provider>
|
|
175
|
+
);
|
|
176
|
+
};
|