@reown/appkit-react-native 0.0.0-feat-multichain-20250514142632 → 0.0.0-feat-multichain-20250515131524
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/lib/commonjs/hooks/useAccount.js +3 -0
- package/lib/commonjs/hooks/useAccount.js.map +1 -1
- package/lib/commonjs/hooks/useAppKitEvents.js +4 -12
- package/lib/commonjs/hooks/useAppKitEvents.js.map +1 -1
- package/lib/commonjs/hooks/useWalletInfo.js +2 -6
- package/lib/commonjs/hooks/useWalletInfo.js.map +1 -1
- package/lib/module/hooks/useAccount.js +3 -0
- package/lib/module/hooks/useAccount.js.map +1 -1
- package/lib/module/hooks/useAppKitEvents.js +5 -13
- package/lib/module/hooks/useAppKitEvents.js.map +1 -1
- package/lib/module/hooks/useWalletInfo.js +3 -7
- package/lib/module/hooks/useWalletInfo.js.map +1 -1
- package/lib/typescript/hooks/useAccount.d.ts.map +1 -1
- package/lib/typescript/hooks/useAppKitEvents.d.ts.map +1 -1
- package/lib/typescript/hooks/useWalletInfo.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/hooks/useAccount.ts +3 -0
- package/src/hooks/useAppKitEvents.ts +3 -10
- package/src/hooks/useWalletInfo.ts +3 -6
|
@@ -6,7 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useAccount = useAccount;
|
|
7
7
|
var _valtio = require("valtio");
|
|
8
8
|
var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
|
|
9
|
+
var _useAppKit = require("./useAppKit");
|
|
9
10
|
function useAccount() {
|
|
11
|
+
(0, _useAppKit.useAppKit)(); // Use the hook for checks
|
|
12
|
+
|
|
10
13
|
const {
|
|
11
14
|
activeAddress: address,
|
|
12
15
|
activeNamespace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_valtio","require","_appkitCoreReactNative","useAccount","activeAddress","address","activeNamespace","connections","useSnapshot","ConnectionsController","state","connection","split","isConnected","chainId","activeChain"],"sourceRoot":"../../../src","sources":["hooks/useAccount.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_valtio","require","_appkitCoreReactNative","_useAppKit","useAccount","useAppKit","activeAddress","address","activeNamespace","connections","useSnapshot","ConnectionsController","state","connection","split","isConnected","chainId","activeChain"],"sourceRoot":"../../../src","sources":["hooks/useAccount.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,SAASG,UAAUA,CAAA,EAAG;EAC3B,IAAAC,oBAAS,EAAC,CAAC,CAAC,CAAC;;EAEb,MAAM;IACJC,aAAa,EAAEC,OAAO;IACtBC,eAAe;IACfC;EACF,CAAC,GAAG,IAAAC,mBAAW,EAACC,4CAAqB,CAACC,KAAK,CAAC;EAE5C,MAAMC,UAAU,GAAGJ,WAAW,CAACD,eAAe,IAAI,EAAE,CAAC;EAErD,OAAO;IACLD,OAAO,EAAEA,OAAO,EAAEO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC/BC,WAAW,EAAE,CAAC,CAACR,OAAO;IACtBS,OAAO,EAAEH,UAAU,EAAEI;EACvB,CAAC;AACH"}
|
|
@@ -8,17 +8,13 @@ exports.useAppKitEvents = useAppKitEvents;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _valtio = require("valtio");
|
|
10
10
|
var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
|
|
11
|
+
var _useAppKit = require("./useAppKit");
|
|
11
12
|
function useAppKitEvents(callback) {
|
|
12
|
-
|
|
13
|
-
projectId
|
|
14
|
-
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.OptionsController.state);
|
|
13
|
+
(0, _useAppKit.useAppKit)(); // Use the hook for checks
|
|
15
14
|
const {
|
|
16
15
|
data,
|
|
17
16
|
timestamp
|
|
18
17
|
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.EventsController.state);
|
|
19
|
-
if (!projectId) {
|
|
20
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEvents" hook');
|
|
21
|
-
}
|
|
22
18
|
(0, _react.useEffect)(() => {
|
|
23
19
|
const unsubscribe = _appkitCoreReactNative.EventsController.subscribe(newEvent => {
|
|
24
20
|
callback?.(newEvent);
|
|
@@ -33,12 +29,8 @@ function useAppKitEvents(callback) {
|
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
31
|
function useAppKitEventSubscription(event, callback) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.OptionsController.state);
|
|
39
|
-
if (!projectId) {
|
|
40
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEventSubscription" hook');
|
|
41
|
-
}
|
|
32
|
+
(0, _useAppKit.useAppKit)(); // Use the hook for checks
|
|
33
|
+
|
|
42
34
|
(0, _react.useEffect)(() => {
|
|
43
35
|
const unsubscribe = _appkitCoreReactNative.EventsController?.subscribeEvent(event, callback);
|
|
44
36
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_valtio","_appkitCoreReactNative","
|
|
1
|
+
{"version":3,"names":["_react","require","_valtio","_appkitCoreReactNative","_useAppKit","useAppKitEvents","callback","useAppKit","data","timestamp","useSnapshot","EventsController","state","useEffect","unsubscribe","subscribe","newEvent","useAppKitEventSubscription","event","subscribeEvent"],"sourceRoot":"../../../src","sources":["hooks/useAppKitEvents.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAEO,SAASI,eAAeA,CAACC,QAAoD,EAAE;EACpF,IAAAC,oBAAS,EAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEC,IAAI;IAAEC;EAAU,CAAC,GAAG,IAAAC,mBAAW,EAACC,uCAAgB,CAACC,KAAK,CAAC;EAE/D,IAAAC,gBAAS,EAAC,MAAM;IACd,MAAMC,WAAW,GAAGH,uCAAgB,CAACI,SAAS,CAACC,QAAQ,IAAI;MACzDV,QAAQ,GAAGU,QAAQ,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACR,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEE,IAAI;IAAEC;EAAU,CAAC;AAC5B;AAEO,SAASQ,0BAA0BA,CACxCC,KAAgB,EAChBZ,QAAmD,EACnD;EACA,IAAAC,oBAAS,EAAC,CAAC,CAAC,CAAC;;EAEb,IAAAM,gBAAS,EAAC,MAAM;IACd,MAAMC,WAAW,GAAGH,uCAAgB,EAAEQ,cAAc,CAACD,KAAK,EAAEZ,QAAQ,CAAC;IAErE,OAAO,MAAM;MACXQ,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACR,QAAQ,EAAEY,KAAK,CAAC,CAAC;AACvB"}
|
|
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useWalletInfo = useWalletInfo;
|
|
7
7
|
var _valtio = require("valtio");
|
|
8
8
|
var _appkitCoreReactNative = require("@reown/appkit-core-react-native");
|
|
9
|
+
var _useAppKit = require("./useAppKit");
|
|
9
10
|
function useWalletInfo() {
|
|
10
|
-
|
|
11
|
-
projectId
|
|
12
|
-
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.OptionsController.state);
|
|
11
|
+
(0, _useAppKit.useAppKit)(); // Use the hook for checks
|
|
13
12
|
const {
|
|
14
13
|
walletInfo
|
|
15
14
|
} = (0, _valtio.useSnapshot)(_appkitCoreReactNative.ConnectionsController.state);
|
|
16
|
-
if (!projectId) {
|
|
17
|
-
throw new Error('Please call "createAppKit" before using "useWalletInfo" hook');
|
|
18
|
-
}
|
|
19
15
|
return {
|
|
20
16
|
walletInfo
|
|
21
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_valtio","require","_appkitCoreReactNative","
|
|
1
|
+
{"version":3,"names":["_valtio","require","_appkitCoreReactNative","_useAppKit","useWalletInfo","useAppKit","walletInfo","useSnapshot","ConnectionsController","state"],"sourceRoot":"../../../src","sources":["hooks/useWalletInfo.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,SAASG,aAAaA,CAAA,EAAG;EAC9B,IAAAC,oBAAS,EAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEC;EAAW,CAAC,GAAG,IAAAC,mBAAW,EAACC,4CAAqB,CAACC,KAAK,CAAC;EAE/D,OAAO;IAAEH;EAAW,CAAC;AACvB"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
|
+
import { useAppKit } from './useAppKit';
|
|
3
4
|
export function useAccount() {
|
|
5
|
+
useAppKit(); // Use the hook for checks
|
|
6
|
+
|
|
4
7
|
const {
|
|
5
8
|
activeAddress: address,
|
|
6
9
|
activeNamespace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSnapshot","ConnectionsController","useAccount","activeAddress","address","activeNamespace","connections","state","connection","split","isConnected","chainId","activeChain"],"sourceRoot":"../../../src","sources":["hooks/useAccount.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,QAAQ,iCAAiC;
|
|
1
|
+
{"version":3,"names":["useSnapshot","ConnectionsController","useAppKit","useAccount","activeAddress","address","activeNamespace","connections","state","connection","split","isConnected","chainId","activeChain"],"sourceRoot":"../../../src","sources":["hooks/useAccount.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,UAAUA,CAAA,EAAG;EAC3BD,SAAS,CAAC,CAAC,CAAC,CAAC;;EAEb,MAAM;IACJE,aAAa,EAAEC,OAAO;IACtBC,eAAe;IACfC;EACF,CAAC,GAAGP,WAAW,CAACC,qBAAqB,CAACO,KAAK,CAAC;EAE5C,MAAMC,UAAU,GAAGF,WAAW,CAACD,eAAe,IAAI,EAAE,CAAC;EAErD,OAAO;IACLD,OAAO,EAAEA,OAAO,EAAEK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC/BC,WAAW,EAAE,CAAC,CAACN,OAAO;IACtBO,OAAO,EAAEH,UAAU,EAAEI;EACvB,CAAC;AACH"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
|
-
import { EventsController
|
|
3
|
+
import { EventsController } from '@reown/appkit-core-react-native';
|
|
4
|
+
import { useAppKit } from './useAppKit';
|
|
4
5
|
export function useAppKitEvents(callback) {
|
|
5
|
-
|
|
6
|
-
projectId
|
|
7
|
-
} = useSnapshot(OptionsController.state);
|
|
6
|
+
useAppKit(); // Use the hook for checks
|
|
8
7
|
const {
|
|
9
8
|
data,
|
|
10
9
|
timestamp
|
|
11
10
|
} = useSnapshot(EventsController.state);
|
|
12
|
-
if (!projectId) {
|
|
13
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEvents" hook');
|
|
14
|
-
}
|
|
15
11
|
useEffect(() => {
|
|
16
12
|
const unsubscribe = EventsController.subscribe(newEvent => {
|
|
17
13
|
callback?.(newEvent);
|
|
@@ -26,12 +22,8 @@ export function useAppKitEvents(callback) {
|
|
|
26
22
|
};
|
|
27
23
|
}
|
|
28
24
|
export function useAppKitEventSubscription(event, callback) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = useSnapshot(OptionsController.state);
|
|
32
|
-
if (!projectId) {
|
|
33
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEventSubscription" hook');
|
|
34
|
-
}
|
|
25
|
+
useAppKit(); // Use the hook for checks
|
|
26
|
+
|
|
35
27
|
useEffect(() => {
|
|
36
28
|
const unsubscribe = EventsController?.subscribeEvent(event, callback);
|
|
37
29
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useSnapshot","EventsController","
|
|
1
|
+
{"version":3,"names":["useEffect","useSnapshot","EventsController","useAppKit","useAppKitEvents","callback","data","timestamp","state","unsubscribe","subscribe","newEvent","useAppKitEventSubscription","event","subscribeEvent"],"sourceRoot":"../../../src","sources":["hooks/useAppKitEvents.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,WAAW,QAAQ,QAAQ;AACpC,SACEC,gBAAgB,QAGX,iCAAiC;AACxC,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,eAAeA,CAACC,QAAoD,EAAE;EACpFF,SAAS,CAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEG,IAAI;IAAEC;EAAU,CAAC,GAAGN,WAAW,CAACC,gBAAgB,CAACM,KAAK,CAAC;EAE/DR,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,CAACQ,SAAS,CAACC,QAAQ,IAAI;MACzDN,QAAQ,GAAGM,QAAQ,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,MAAM;MACXF,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,CAAC,CAAC;EAEd,OAAO;IAAEC,IAAI;IAAEC;EAAU,CAAC;AAC5B;AAEA,OAAO,SAASK,0BAA0BA,CACxCC,KAAgB,EAChBR,QAAmD,EACnD;EACAF,SAAS,CAAC,CAAC,CAAC,CAAC;;EAEbH,SAAS,CAAC,MAAM;IACd,MAAMS,WAAW,GAAGP,gBAAgB,EAAEY,cAAc,CAACD,KAAK,EAAER,QAAQ,CAAC;IAErE,OAAO,MAAM;MACXI,WAAW,GAAG,CAAC;IACjB,CAAC;EACH,CAAC,EAAE,CAACJ,QAAQ,EAAEQ,KAAK,CAAC,CAAC;AACvB"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { ConnectionsController
|
|
2
|
+
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
|
+
import { useAppKit } from './useAppKit';
|
|
3
4
|
export function useWalletInfo() {
|
|
4
|
-
|
|
5
|
-
projectId
|
|
6
|
-
} = useSnapshot(OptionsController.state);
|
|
5
|
+
useAppKit(); // Use the hook for checks
|
|
7
6
|
const {
|
|
8
7
|
walletInfo
|
|
9
8
|
} = useSnapshot(ConnectionsController.state);
|
|
10
|
-
if (!projectId) {
|
|
11
|
-
throw new Error('Please call "createAppKit" before using "useWalletInfo" hook');
|
|
12
|
-
}
|
|
13
9
|
return {
|
|
14
10
|
walletInfo
|
|
15
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSnapshot","ConnectionsController","
|
|
1
|
+
{"version":3,"names":["useSnapshot","ConnectionsController","useAppKit","useWalletInfo","walletInfo","state"],"sourceRoot":"../../../src","sources":["hooks/useWalletInfo.ts"],"mappings":"AAAA,SAASA,WAAW,QAAQ,QAAQ;AACpC,SAASC,qBAAqB,QAAQ,iCAAiC;AACvE,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC9BD,SAAS,CAAC,CAAC,CAAC,CAAC;EACb,MAAM;IAAEE;EAAW,CAAC,GAAGJ,WAAW,CAACC,qBAAqB,CAACI,KAAK,CAAC;EAE/D,OAAO;IAAED;EAAW,CAAC;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAccount.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAccount.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAccount.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU;;;;EAgBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppKitEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitEvents.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useAppKitEvents.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAppKitEvents.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC3B,MAAM,iCAAiC,CAAC;AAGzC,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAenF;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,QAWpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useWalletInfo.d.ts","sourceRoot":"","sources":["../../../src/hooks/useWalletInfo.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa;;;;;;;;;;;;;;EAK5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reown/appkit-react-native",
|
|
3
|
-
"version": "0.0.0-feat-multichain-
|
|
3
|
+
"version": "0.0.0-feat-multichain-20250515131524",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"types": "lib/typescript/index.d.ts",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-
|
|
41
|
-
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-
|
|
42
|
-
"@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-
|
|
43
|
-
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-
|
|
40
|
+
"@reown/appkit-common-react-native": "0.0.0-feat-multichain-20250515131524",
|
|
41
|
+
"@reown/appkit-core-react-native": "0.0.0-feat-multichain-20250515131524",
|
|
42
|
+
"@reown/appkit-siwe-react-native": "0.0.0-feat-multichain-20250515131524",
|
|
43
|
+
"@reown/appkit-ui-react-native": "0.0.0-feat-multichain-20250515131524",
|
|
44
44
|
"@walletconnect/universal-provider": "2.20.2",
|
|
45
45
|
"valtio": "^1.13.2"
|
|
46
46
|
},
|
package/src/hooks/useAccount.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
2
|
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
|
+
import { useAppKit } from './useAppKit';
|
|
3
4
|
|
|
4
5
|
export function useAccount() {
|
|
6
|
+
useAppKit(); // Use the hook for checks
|
|
7
|
+
|
|
5
8
|
const {
|
|
6
9
|
activeAddress: address,
|
|
7
10
|
activeNamespace,
|
|
@@ -2,19 +2,15 @@ import { useEffect } from 'react';
|
|
|
2
2
|
import { useSnapshot } from 'valtio';
|
|
3
3
|
import {
|
|
4
4
|
EventsController,
|
|
5
|
-
OptionsController,
|
|
6
5
|
type EventName,
|
|
7
6
|
type EventsControllerState
|
|
8
7
|
} from '@reown/appkit-core-react-native';
|
|
8
|
+
import { useAppKit } from './useAppKit';
|
|
9
9
|
|
|
10
10
|
export function useAppKitEvents(callback?: (newEvent: EventsControllerState) => void) {
|
|
11
|
-
|
|
11
|
+
useAppKit(); // Use the hook for checks
|
|
12
12
|
const { data, timestamp } = useSnapshot(EventsController.state);
|
|
13
13
|
|
|
14
|
-
if (!projectId) {
|
|
15
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEvents" hook');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
useEffect(() => {
|
|
19
15
|
const unsubscribe = EventsController.subscribe(newEvent => {
|
|
20
16
|
callback?.(newEvent);
|
|
@@ -32,10 +28,7 @@ export function useAppKitEventSubscription(
|
|
|
32
28
|
event: EventName,
|
|
33
29
|
callback: (newEvent: EventsControllerState) => void
|
|
34
30
|
) {
|
|
35
|
-
|
|
36
|
-
if (!projectId) {
|
|
37
|
-
throw new Error('Please call "createAppKit" before using "useAppKitEventSubscription" hook');
|
|
38
|
-
}
|
|
31
|
+
useAppKit(); // Use the hook for checks
|
|
39
32
|
|
|
40
33
|
useEffect(() => {
|
|
41
34
|
const unsubscribe = EventsController?.subscribeEvent(event, callback);
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { useSnapshot } from 'valtio';
|
|
2
|
-
import { ConnectionsController
|
|
2
|
+
import { ConnectionsController } from '@reown/appkit-core-react-native';
|
|
3
|
+
import { useAppKit } from './useAppKit';
|
|
3
4
|
|
|
4
5
|
export function useWalletInfo() {
|
|
5
|
-
|
|
6
|
+
useAppKit(); // Use the hook for checks
|
|
6
7
|
const { walletInfo } = useSnapshot(ConnectionsController.state);
|
|
7
8
|
|
|
8
|
-
if (!projectId) {
|
|
9
|
-
throw new Error('Please call "createAppKit" before using "useWalletInfo" hook');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
9
|
return { walletInfo };
|
|
13
10
|
}
|