@xyo-network/react-wallet-service 4.4.11 → 5.0.0-rc.2
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/browser/index.mjs +3 -3
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +17 -15
- package/src/contexts/Provider.tsx +1 -1
- package/src/contexts/use.ts +2 -2
- /package/dist/{browser → types}/contexts/Context.d.ts +0 -0
- /package/dist/{browser → types}/contexts/Context.d.ts.map +0 -0
- /package/dist/{browser → types}/contexts/Provider.d.ts +0 -0
- /package/dist/{browser → types}/contexts/Provider.d.ts.map +0 -0
- /package/dist/{browser → types}/contexts/State.d.ts +0 -0
- /package/dist/{browser → types}/contexts/State.d.ts.map +0 -0
- /package/dist/{browser → types}/contexts/defaultState.d.ts +0 -0
- /package/dist/{browser → types}/contexts/defaultState.d.ts.map +0 -0
- /package/dist/{browser → types}/contexts/index.d.ts +0 -0
- /package/dist/{browser → types}/contexts/index.d.ts.map +0 -0
- /package/dist/{browser → types}/contexts/use.d.ts +0 -0
- /package/dist/{browser → types}/contexts/use.d.ts.map +0 -0
- /package/dist/{browser → types}/index.d.ts +0 -0
- /package/dist/{browser → types}/index.d.ts.map +0 -0
package/dist/browser/index.mjs
CHANGED
|
@@ -19,16 +19,16 @@ var defaultState = /* @__PURE__ */ __name(() => {
|
|
|
19
19
|
|
|
20
20
|
// src/contexts/Provider.tsx
|
|
21
21
|
var WalletServiceProvider = /* @__PURE__ */ __name(({ children }) => {
|
|
22
|
-
return /* @__PURE__ */ React.createElement(WalletServiceContext
|
|
22
|
+
return /* @__PURE__ */ React.createElement(WalletServiceContext, {
|
|
23
23
|
value: defaultState()
|
|
24
24
|
}, children);
|
|
25
25
|
}, "WalletServiceProvider");
|
|
26
26
|
|
|
27
27
|
// src/contexts/use.ts
|
|
28
28
|
import { assertEx } from "@xylabs/assert";
|
|
29
|
-
import {
|
|
29
|
+
import { use } from "react";
|
|
30
30
|
var useWalletService = /* @__PURE__ */ __name(() => {
|
|
31
|
-
const context =
|
|
31
|
+
const context = use(WalletServiceContext);
|
|
32
32
|
assertEx(context.metaMaskWallet, () => "WalletServiceContext not initialized");
|
|
33
33
|
return context;
|
|
34
34
|
}, "useWalletService");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/defaultState.ts","../../src/contexts/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { WalletServiceState } from './State.ts'\n\nexport const WalletServiceContext = createContextEx<WalletServiceState>()\n","import type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nimport { WalletServiceContext } from './Context.ts'\nimport { defaultState } from './defaultState.ts'\n\nexport const WalletServiceProvider: React.FC<PropsWithChildren> = ({ children }) => {\n return <WalletServiceContext
|
|
1
|
+
{"version":3,"sources":["../../src/contexts/Context.ts","../../src/contexts/Provider.tsx","../../src/contexts/defaultState.ts","../../src/contexts/use.ts"],"sourcesContent":["import { createContextEx } from '@xyo-network/react-shared'\n\nimport type { WalletServiceState } from './State.ts'\n\nexport const WalletServiceContext = createContextEx<WalletServiceState>()\n","import type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nimport { WalletServiceContext } from './Context.ts'\nimport { defaultState } from './defaultState.ts'\n\nexport const WalletServiceProvider: React.FC<PropsWithChildren> = ({ children }) => {\n return <WalletServiceContext value={defaultState()}>{children}</WalletServiceContext>\n}\n","import { MetaMaskConnector } from '@xyo-network/metamask-connector'\n\nimport type { WalletServiceState } from './State.ts'\n\nexport const defaultState = (): WalletServiceState => {\n return {\n metaMaskWallet: new MetaMaskConnector(),\n provided: true,\n }\n}\n","import { assertEx } from '@xylabs/assert'\nimport { use } from 'react'\n\nimport { WalletServiceContext } from './Context.ts'\n\nexport const useWalletService = () => {\n const context = use(WalletServiceContext)\n assertEx(context.metaMaskWallet, () => 'WalletServiceContext not initialized')\n // we do the cast to make the api non-optional\n return context\n}\n"],"mappings":";;;;AAAA,SAASA,uBAAuB;AAIzB,IAAMC,uBAAuBD,gBAAAA;;;ACHpC,OAAOE,WAAW;;;ACDlB,SAASC,yBAAyB;AAI3B,IAAMC,eAAe,6BAAA;AAC1B,SAAO;IACLC,gBAAgB,IAAIC,kBAAAA;IACpBC,UAAU;EACZ;AACF,GAL4B;;;ADErB,IAAMC,wBAAqD,wBAAC,EAAEC,SAAQ,MAAE;AAC7E,SAAO,sBAAA,cAACC,sBAAAA;IAAqBC,OAAOC,aAAAA;KAAiBH,QAAAA;AACvD,GAFkE;;;AENlE,SAASI,gBAAgB;AACzB,SAASC,WAAW;AAIb,IAAMC,mBAAmB,6BAAA;AAC9B,QAAMC,UAAUC,IAAIC,oBAAAA;AACpBC,WAASH,QAAQI,gBAAgB,MAAM,sCAAA;AAEvC,SAAOJ;AACT,GALgC;","names":["createContextEx","WalletServiceContext","React","MetaMaskConnector","defaultState","metaMaskWallet","MetaMaskConnector","provided","WalletServiceProvider","children","WalletServiceContext","value","defaultState","assertEx","use","useWalletService","context","use","WalletServiceContext","assertEx","metaMaskWallet"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-wallet-service",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
30
|
"browser": {
|
|
31
|
-
"types": "./dist/
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
32
32
|
"default": "./dist/browser/index.mjs"
|
|
33
33
|
},
|
|
34
|
-
"types": "./dist/
|
|
34
|
+
"types": "./dist/types/index.d.ts",
|
|
35
35
|
"default": "./dist/browser/index.mjs"
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
@@ -43,28 +43,30 @@
|
|
|
43
43
|
"lint-pkg": "npmPkgJsonLint ."
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xylabs/assert": "^4.5.
|
|
47
|
-
"@xyo-network/metamask-connector": "^3.9.
|
|
48
|
-
"@xyo-network/react-shared": "^
|
|
46
|
+
"@xylabs/assert": "^4.5.10",
|
|
47
|
+
"@xyo-network/metamask-connector": "^3.9.35",
|
|
48
|
+
"@xyo-network/react-shared": "^5.0.0-rc.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@mui/icons-material": "^6.4.
|
|
52
|
-
"@mui/material": "^6.4.
|
|
53
|
-
"@mui/styles": "^6.4.
|
|
54
|
-
"@
|
|
55
|
-
"
|
|
56
|
-
"react
|
|
51
|
+
"@mui/icons-material": "^6.4.7",
|
|
52
|
+
"@mui/material": "^6.4.7",
|
|
53
|
+
"@mui/styles": "^6.4.7",
|
|
54
|
+
"@types/react": "^19.0.10",
|
|
55
|
+
"@xylabs/ts-scripts-yarn3": "^6.0.3",
|
|
56
|
+
"react": "^19",
|
|
57
|
+
"react-dom": "^19",
|
|
57
58
|
"typescript": "^5.8.2"
|
|
58
59
|
},
|
|
59
60
|
"peerDependencies": {
|
|
60
61
|
"@mui/icons-material": "^6",
|
|
61
62
|
"@mui/material": "^6",
|
|
62
63
|
"@mui/styles": "^6",
|
|
63
|
-
"react": "^
|
|
64
|
-
"react-dom": "^
|
|
64
|
+
"react": "^19",
|
|
65
|
+
"react-dom": "^19"
|
|
65
66
|
},
|
|
66
67
|
"publishConfig": {
|
|
67
68
|
"access": "public"
|
|
68
69
|
},
|
|
69
|
-
"docs": "dist/docs.json"
|
|
70
|
+
"docs": "dist/docs.json",
|
|
71
|
+
"stableVersion": "4.4.11"
|
|
70
72
|
}
|
|
@@ -5,5 +5,5 @@ import { WalletServiceContext } from './Context.ts'
|
|
|
5
5
|
import { defaultState } from './defaultState.ts'
|
|
6
6
|
|
|
7
7
|
export const WalletServiceProvider: React.FC<PropsWithChildren> = ({ children }) => {
|
|
8
|
-
return <WalletServiceContext
|
|
8
|
+
return <WalletServiceContext value={defaultState()}>{children}</WalletServiceContext>
|
|
9
9
|
}
|
package/src/contexts/use.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
|
-
import {
|
|
2
|
+
import { use } from 'react'
|
|
3
3
|
|
|
4
4
|
import { WalletServiceContext } from './Context.ts'
|
|
5
5
|
|
|
6
6
|
export const useWalletService = () => {
|
|
7
|
-
const context =
|
|
7
|
+
const context = use(WalletServiceContext)
|
|
8
8
|
assertEx(context.metaMaskWallet, () => 'WalletServiceContext not initialized')
|
|
9
9
|
// we do the cast to make the api non-optional
|
|
10
10
|
return context
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|