@xyo-network/react-sentinel 7.5.7 → 7.5.11
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/contexts/Provider.d.ts.map +1 -1
- package/dist/browser/contexts/use.d.ts +4 -4
- package/dist/browser/index.mjs +147 -177
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +152 -50
- package/src/components/Card/Card.stories.tsx +0 -139
- package/src/components/Card/Card.tsx +0 -35
- package/src/components/Card/CardActions.tsx +0 -23
- package/src/components/Card/CardContent.tsx +0 -28
- package/src/components/Card/CardHeader.tsx +0 -11
- package/src/components/Card/NftSentinel.json +0 -214
- package/src/components/Card/index.ts +0 -3
- package/src/components/Card/manifest.ts +0 -1
- package/src/components/index.ts +0 -1
- package/src/contexts/Context.ts +0 -5
- package/src/contexts/Provider.tsx +0 -131
- package/src/contexts/State.ts +0 -40
- package/src/contexts/index.ts +0 -4
- package/src/contexts/use.ts +0 -12
- package/src/hooks/index.ts +0 -1
- package/src/hooks/node/index.ts +0 -4
- package/src/hooks/node/useSentinelFromNode.tsx +0 -18
- package/src/hooks/node/useSentinelsFromNode.tsx +0 -27
- package/src/hooks/node/useWeakSentinelFromNode.tsx +0 -11
- package/src/hooks/node/useWeakSentinelsFromNode.tsx +0 -27
- package/src/index.ts +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-sentinel",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,65 +36,167 @@
|
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/browser/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"
|
|
41
|
+
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@xylabs/react-shared": "~7.1.17",
|
|
51
|
-
"@xylabs/sdk-js": "~5.0.90",
|
|
52
|
-
"@xyo-network/account-model": "~5.3.17",
|
|
53
|
-
"@xyo-network/archivist-model": "~5.3.17",
|
|
54
|
-
"@xyo-network/boundwitness-model": "~5.3.17",
|
|
55
|
-
"@xyo-network/module-model": "~5.3.17",
|
|
56
|
-
"@xyo-network/payload-model": "~5.3.17",
|
|
57
|
-
"@xyo-network/react-module": "7.5.7",
|
|
58
|
-
"@xyo-network/react-node": "7.5.7",
|
|
59
|
-
"@xyo-network/react-payload-raw-info": "7.5.7",
|
|
60
|
-
"@xyo-network/react-witness": "7.5.7",
|
|
61
|
-
"@xyo-network/sentinel-memory": "~5.3.17",
|
|
62
|
-
"@xyo-network/sentinel-model": "~5.3.17",
|
|
63
|
-
"@xyo-network/witness-model": "~5.3.17"
|
|
44
|
+
"@xyo-network/react-node": "~7.5.11",
|
|
45
|
+
"@xyo-network/react-payload-raw-info": "~7.5.11",
|
|
46
|
+
"@xyo-network/react-module": "~7.5.11",
|
|
47
|
+
"@xyo-network/react-witness": "~7.5.11"
|
|
64
48
|
},
|
|
65
49
|
"devDependencies": {
|
|
66
|
-
"@
|
|
67
|
-
"@emotion/
|
|
68
|
-
"@
|
|
69
|
-
"@mui/material": "
|
|
70
|
-
"@
|
|
50
|
+
"@bitauth/libauth": "~3.0.0",
|
|
51
|
+
"@emotion/react": "^11.14.0",
|
|
52
|
+
"@emotion/styled": "^11.14.1",
|
|
53
|
+
"@mui/icons-material": "^7.3.10",
|
|
54
|
+
"@mui/material": "^7.3.10",
|
|
55
|
+
"@mui/system": "^7.3.10",
|
|
56
|
+
"@mui/x-tree-view": "~8.27.2",
|
|
57
|
+
"@opentelemetry/api": "^1.9.1",
|
|
58
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
59
|
+
"@scure/base": "~2.2.0",
|
|
60
|
+
"@scure/bip39": "~2.2.0",
|
|
61
|
+
"@storybook/react-vite": "~10.3.5",
|
|
62
|
+
"@textea/json-viewer": "~4.0.1",
|
|
63
|
+
"@types/node": "~25.6.0",
|
|
71
64
|
"@types/react": "^19.2.14",
|
|
72
|
-
"@xylabs/
|
|
73
|
-
"@xylabs/
|
|
74
|
-
"@xylabs/
|
|
75
|
-
"@xylabs/
|
|
76
|
-
"@xylabs/
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"react": "
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
65
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
66
|
+
"@xylabs/react-button": "~7.1.20",
|
|
67
|
+
"@xylabs/react-crypto": "~7.1.20",
|
|
68
|
+
"@xylabs/react-dialogs": "~7.1.20",
|
|
69
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
70
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
71
|
+
"@xylabs/react-identicon": "~7.1.20",
|
|
72
|
+
"@xylabs/react-link": "~7.1.20",
|
|
73
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
74
|
+
"@xylabs/react-quick-tip-button": "~7.1.20",
|
|
75
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
76
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
77
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
78
|
+
"@xylabs/threads": "~5.0.100",
|
|
79
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
80
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
81
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
82
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
83
|
+
"@xylabs/zod": "~5.0.100",
|
|
84
|
+
"@xyo-network/account": "~5.5.1",
|
|
85
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
86
|
+
"@xyo-network/archivist-model": "^5.5.5",
|
|
87
|
+
"@xyo-network/boundwitness-builder": "^5.5.1",
|
|
88
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
89
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
90
|
+
"@xyo-network/boundwitness-wrapper": "~5.5.1",
|
|
91
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
92
|
+
"@xyo-network/diviner-abstract": "^5.5.5",
|
|
93
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
94
|
+
"@xyo-network/evm-call-witness": "~5.4.9",
|
|
95
|
+
"@xyo-network/manifest": "~5.5.1",
|
|
96
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
97
|
+
"@xyo-network/module-abstract": "^5.5.5",
|
|
98
|
+
"@xyo-network/module-factory-locator": "~5.5.5",
|
|
99
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
100
|
+
"@xyo-network/node-memory": "~5.5.5",
|
|
101
|
+
"@xyo-network/node-model": "^5.5.5",
|
|
102
|
+
"@xyo-network/open-zeppelin-typechain": "^4.1.3",
|
|
103
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
104
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
105
|
+
"@xyo-network/payload-wrapper": "~5.5.1",
|
|
106
|
+
"@xyo-network/query-payload-plugin": "~5.5.1",
|
|
107
|
+
"@xyo-network/sentinel-memory": "^5.5.5",
|
|
108
|
+
"@xyo-network/sentinel-model": "^5.5.5",
|
|
109
|
+
"@xyo-network/wallet": "~5.5.1",
|
|
110
|
+
"@xyo-network/wallet-model": "^5.5.1",
|
|
111
|
+
"@xyo-network/witness-evm-abstract": "^5.5.5",
|
|
112
|
+
"@xyo-network/witness-model": "^5.5.5",
|
|
113
|
+
"async-mutex": "^0.5.0",
|
|
114
|
+
"axios": "^1.15.2",
|
|
115
|
+
"bn.js": "^5.2.3",
|
|
116
|
+
"bowser": "^2.14.1",
|
|
117
|
+
"buffer": "^6.0.3",
|
|
118
|
+
"chalk": "^5.6.2",
|
|
119
|
+
"debug": "~4.4.3",
|
|
120
|
+
"esbuild": "~0.28.0",
|
|
121
|
+
"eslint": "^10.2.1",
|
|
122
|
+
"ethers": "^6.16.0",
|
|
123
|
+
"fast-deep-equal": "~3.1.3",
|
|
124
|
+
"hash-wasm": "~4.12.0",
|
|
125
|
+
"js-cookie": "~3.0.5",
|
|
126
|
+
"lru-cache": "^11.3.5",
|
|
127
|
+
"observable-fns": "~0.6.1",
|
|
128
|
+
"pako": "^2.1.0",
|
|
129
|
+
"react": "^19.2.5",
|
|
130
|
+
"react-dom": "^19.2.5",
|
|
131
|
+
"react-router-dom": "^7.14.2",
|
|
132
|
+
"spark-md5": "~3.0.2",
|
|
133
|
+
"storybook": "^10.3.5",
|
|
87
134
|
"typescript": "^5.9.3",
|
|
88
|
-
"vite": "
|
|
135
|
+
"vite": "^8.0.10",
|
|
136
|
+
"wasm-feature-detect": "~1.8.0",
|
|
89
137
|
"zod": "^4.3.6"
|
|
90
138
|
},
|
|
91
139
|
"peerDependencies": {
|
|
92
|
-
"@
|
|
93
|
-
"@
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
140
|
+
"@emotion/react": "^11.14.0",
|
|
141
|
+
"@emotion/styled": "^11.14.1",
|
|
142
|
+
"@mui/icons-material": "^7.3.10",
|
|
143
|
+
"@mui/material": "^7.3.10",
|
|
144
|
+
"@mui/system": "^7.3.10",
|
|
145
|
+
"@mui/x-tree-view": "~8.27.2",
|
|
146
|
+
"@opentelemetry/api": "^1.9.1",
|
|
147
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
148
|
+
"@scure/base": "~2.2.0",
|
|
149
|
+
"@textea/json-viewer": "~4.0.1",
|
|
150
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
151
|
+
"@xylabs/react-button": "~7.1.20",
|
|
152
|
+
"@xylabs/react-crypto": "~7.1.20",
|
|
153
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
154
|
+
"@xylabs/react-hooks": "~7.1.20",
|
|
155
|
+
"@xylabs/react-identicon": "~7.1.20",
|
|
156
|
+
"@xylabs/react-link": "~7.1.20",
|
|
157
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
158
|
+
"@xylabs/react-quick-tip-button": "~7.1.20",
|
|
159
|
+
"@xylabs/react-shared": "~7.1.20",
|
|
160
|
+
"@xylabs/react-theme": "~7.1.20",
|
|
161
|
+
"@xylabs/sdk-js": "^5.0.100",
|
|
162
|
+
"@xylabs/zod": "~5.0.100",
|
|
163
|
+
"@xyo-network/account": "~5.5.1",
|
|
164
|
+
"@xyo-network/account-model": "^5.5.1",
|
|
165
|
+
"@xyo-network/archivist-model": "^5.5.5",
|
|
166
|
+
"@xyo-network/boundwitness-builder": "^5.5.1",
|
|
167
|
+
"@xyo-network/boundwitness-model": "^5.5.1",
|
|
168
|
+
"@xyo-network/boundwitness-validator": "^5.5.1",
|
|
169
|
+
"@xyo-network/boundwitness-wrapper": "~5.5.1",
|
|
170
|
+
"@xyo-network/config-payload-plugin": "~5.5.1",
|
|
171
|
+
"@xyo-network/diviner-model": "^5.5.5",
|
|
172
|
+
"@xyo-network/manifest-model": "~5.5.1",
|
|
173
|
+
"@xyo-network/module-abstract": "^5.5.5",
|
|
174
|
+
"@xyo-network/module-model": "^5.5.5",
|
|
175
|
+
"@xyo-network/node-memory": "~5.5.5",
|
|
176
|
+
"@xyo-network/node-model": "^5.5.5",
|
|
177
|
+
"@xyo-network/payload-builder": "^5.5.1",
|
|
178
|
+
"@xyo-network/payload-model": "^5.5.1",
|
|
179
|
+
"@xyo-network/query-payload-plugin": "~5.5.1",
|
|
180
|
+
"@xyo-network/sentinel-memory": "^5.5.5",
|
|
181
|
+
"@xyo-network/sentinel-model": "^5.5.5",
|
|
182
|
+
"@xyo-network/wallet-model": "^5.5.1",
|
|
183
|
+
"@xyo-network/witness-model": "^5.5.5",
|
|
184
|
+
"async-mutex": "^0.5.0",
|
|
185
|
+
"axios": "^1.15.2",
|
|
186
|
+
"bn.js": "^5.2.3",
|
|
187
|
+
"bowser": "^2.14.1",
|
|
188
|
+
"buffer": "^6.0.3",
|
|
189
|
+
"chalk": "^5.6.2",
|
|
190
|
+
"ethers": "^6.16.0",
|
|
191
|
+
"fast-deep-equal": "~3.1.3",
|
|
192
|
+
"js-cookie": "~3.0.5",
|
|
193
|
+
"lru-cache": "^11.3.5",
|
|
194
|
+
"pako": "^2.1.0",
|
|
195
|
+
"react": "^19.2.5",
|
|
196
|
+
"react-dom": "^19.2.5",
|
|
197
|
+
"react-router-dom": "^7.14.2",
|
|
198
|
+
"spark-md5": "~3.0.2",
|
|
199
|
+
"zod": "^4.3.6"
|
|
98
200
|
},
|
|
99
201
|
"peerDependenciesMeta": {
|
|
100
202
|
"ethers": {
|
|
@@ -105,4 +207,4 @@
|
|
|
105
207
|
"access": "public"
|
|
106
208
|
},
|
|
107
209
|
"docs": "dist/docs.json"
|
|
108
|
-
}
|
|
210
|
+
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import { FlexCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import { usePromise } from '@xylabs/react-promise'
|
|
4
|
-
import type { EvmCallWitnessParams } from '@xyo-network/evm-call-witness'
|
|
5
|
-
import {
|
|
6
|
-
EvmCallDiviner, EvmCallWitness, EvmCallWitnessConfigSchema,
|
|
7
|
-
} from '@xyo-network/evm-call-witness'
|
|
8
|
-
import type { PackageManifestPayload } from '@xyo-network/manifest'
|
|
9
|
-
import { ManifestWrapper } from '@xyo-network/manifest'
|
|
10
|
-
import { ModuleFactoryLocator } from '@xyo-network/module-factory-locator'
|
|
11
|
-
import { ModuleFactory } from '@xyo-network/module-model'
|
|
12
|
-
import type { ReportEndEventArgs } from '@xyo-network/sentinel-model'
|
|
13
|
-
import { asSentinelInstance } from '@xyo-network/sentinel-model'
|
|
14
|
-
import { HDWallet } from '@xyo-network/wallet'
|
|
15
|
-
import { InfuraProvider } from 'ethers'
|
|
16
|
-
import React from 'react'
|
|
17
|
-
|
|
18
|
-
import { SentinelCard } from './Card.tsx'
|
|
19
|
-
import { NftSentinelManifest } from './manifest.ts'
|
|
20
|
-
|
|
21
|
-
const loadFromManifest = async () => {
|
|
22
|
-
const mnemonic = 'later puppy sound rebuild rebuild noise ozone amazing hope broccoli crystal grief'
|
|
23
|
-
const wallet = await HDWallet.fromPhrase(mnemonic)
|
|
24
|
-
const provider = new InfuraProvider('homestead', process.env.STORYBOOK_INFURA_PROJECT_ID)
|
|
25
|
-
|
|
26
|
-
const locator = new ModuleFactoryLocator()
|
|
27
|
-
locator.register(EvmCallDiviner.factory())
|
|
28
|
-
|
|
29
|
-
locator.register(
|
|
30
|
-
new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
|
|
31
|
-
{ 'network.xyo.evm.interface': 'Erc721' },
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
locator.register(
|
|
35
|
-
new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
|
|
36
|
-
{ 'network.xyo.evm.interface': 'Erc721Enumerable' },
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
locator.register(
|
|
40
|
-
new ModuleFactory(EvmCallWitness, { providers: () => [provider] } as Partial<EvmCallWitnessParams>),
|
|
41
|
-
{ 'network.xyo.evm.interface': 'Erc1155' },
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
const manifest = new ManifestWrapper(NftSentinelManifest as unknown as PackageManifestPayload, wallet, locator)
|
|
45
|
-
const node = await manifest.loadNodeFromIndex(0)
|
|
46
|
-
console.log(`node: ${(await node.resolve()).length}`)
|
|
47
|
-
return node
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const StorybookEntry = {
|
|
51
|
-
component: SentinelCard,
|
|
52
|
-
parameters: { docs: { page: null } },
|
|
53
|
-
title: 'modules/sentinel/SentinelCard',
|
|
54
|
-
} as Meta<typeof SentinelCard>
|
|
55
|
-
|
|
56
|
-
const NftSentinelTemplate: StoryFn<typeof SentinelCard> = () => {
|
|
57
|
-
const [node] = usePromise(async () => await loadFromManifest(), [])
|
|
58
|
-
const [sentinel] = usePromise(async () => {
|
|
59
|
-
if (node) {
|
|
60
|
-
const sentinel = asSentinelInstance(await node.resolve('NftInfoSentinel'))
|
|
61
|
-
sentinel?.on('reportEnd', (args) => {
|
|
62
|
-
const { inPayloads, outPayloads } = args as ReportEndEventArgs
|
|
63
|
-
console.log(`inPayloads: ${inPayloads?.length}`)
|
|
64
|
-
console.log(`outPayloads: ${outPayloads?.length}`)
|
|
65
|
-
})
|
|
66
|
-
return sentinel
|
|
67
|
-
}
|
|
68
|
-
}, [node])
|
|
69
|
-
|
|
70
|
-
const inPayloads = [
|
|
71
|
-
{
|
|
72
|
-
address: '0x562fC2927c77cB975680088566ADa1dC6cB8b5Ea', // Random ERC721
|
|
73
|
-
schema: EvmCallWitnessConfigSchema,
|
|
74
|
-
},
|
|
75
|
-
]
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<FlexCol gap={2}>
|
|
79
|
-
<SentinelCard mod={sentinel} inPayloads={inPayloads} />
|
|
80
|
-
</FlexCol>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const NftSentinelCard = NftSentinelTemplate.bind({})
|
|
85
|
-
|
|
86
|
-
const NftTokensSentinelTemplate: StoryFn<typeof SentinelCard> = () => {
|
|
87
|
-
const [node] = usePromise(async () => await loadFromManifest(), [])
|
|
88
|
-
|
|
89
|
-
const [tokensSentinel] = usePromise(async () => {
|
|
90
|
-
if (node) {
|
|
91
|
-
const sentinel = asSentinelInstance(await node.resolve('NftTokenInfoSentinel'))
|
|
92
|
-
sentinel?.on('reportEnd', (args) => {
|
|
93
|
-
const { inPayloads, outPayloads } = args as ReportEndEventArgs
|
|
94
|
-
console.log(`tokensSentinelInPayloads: ${inPayloads?.length}`)
|
|
95
|
-
console.log(`tokensSentinelOutPayloads: ${outPayloads?.length}`)
|
|
96
|
-
console.log(`tokens: ${JSON.stringify(outPayloads, null, 2)}`)
|
|
97
|
-
})
|
|
98
|
-
return sentinel
|
|
99
|
-
}
|
|
100
|
-
}, [node])
|
|
101
|
-
|
|
102
|
-
const [contractSentinel] = usePromise(async () => {
|
|
103
|
-
if (node) {
|
|
104
|
-
const sentinel = asSentinelInstance(await node.resolve('NftInfoSentinel'))
|
|
105
|
-
sentinel?.on('reportEnd', async (args) => {
|
|
106
|
-
const { inPayloads, outPayloads } = args as ReportEndEventArgs
|
|
107
|
-
console.log(`inPayloads: ${inPayloads?.length}`)
|
|
108
|
-
console.log(`outPayloads: ${outPayloads?.length}`)
|
|
109
|
-
const calls = Array(1000).map((_, index) => ({
|
|
110
|
-
address: '0x562fC2927c77cB975680088566ADa1dC6cB8b5Ea', // Random ERC721
|
|
111
|
-
params: [index],
|
|
112
|
-
schema: EvmCallWitnessConfigSchema,
|
|
113
|
-
}))
|
|
114
|
-
await tokensSentinel?.report(calls)
|
|
115
|
-
})
|
|
116
|
-
return sentinel
|
|
117
|
-
}
|
|
118
|
-
}, [node, tokensSentinel])
|
|
119
|
-
|
|
120
|
-
const inPayloads = [
|
|
121
|
-
{
|
|
122
|
-
address: '0x562fC2927c77cB975680088566ADa1dC6cB8b5Ea', // Random ERC721
|
|
123
|
-
schema: EvmCallWitnessConfigSchema,
|
|
124
|
-
},
|
|
125
|
-
]
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<FlexCol gap={2}>
|
|
129
|
-
<SentinelCard mod={contractSentinel} inPayloads={inPayloads} />
|
|
130
|
-
{/* tokens ? <JsonViewerEx value={tokens} /> : null */}
|
|
131
|
-
</FlexCol>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const NftTokensSentinelCard = NftTokensSentinelTemplate.bind({})
|
|
136
|
-
|
|
137
|
-
export { NftSentinelCard, NftTokensSentinelCard }
|
|
138
|
-
|
|
139
|
-
export default StorybookEntry
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { CardProps } from '@mui/material'
|
|
2
|
-
import { Card } from '@mui/material'
|
|
3
|
-
import { usePromise } from '@xylabs/react-promise'
|
|
4
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
5
|
-
import type { ModuleRenderProps } from '@xyo-network/react-module'
|
|
6
|
-
import type { SentinelInstance } from '@xyo-network/sentinel-model'
|
|
7
|
-
import React, { useState } from 'react'
|
|
8
|
-
|
|
9
|
-
import { SentinelCardActions } from './CardActions.tsx'
|
|
10
|
-
import { SentinelCardContent } from './CardContent.tsx'
|
|
11
|
-
import { SentinelCardHeader } from './CardHeader.tsx'
|
|
12
|
-
|
|
13
|
-
export type SentinelCardProps = CardProps
|
|
14
|
-
& ModuleRenderProps<SentinelInstance> & {
|
|
15
|
-
inPayloads?: Payload[]
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const SentinelCard: React.FC<SentinelCardProps> = ({
|
|
19
|
-
children, inPayloads, mod, ...props
|
|
20
|
-
}) => {
|
|
21
|
-
const [retry, setRetry] = useState(-1)
|
|
22
|
-
const [report] = usePromise(async () => {
|
|
23
|
-
if (retry >= 0) {
|
|
24
|
-
return await mod?.report(inPayloads)
|
|
25
|
-
}
|
|
26
|
-
}, [mod, retry, inPayloads])
|
|
27
|
-
return (
|
|
28
|
-
<Card {...props}>
|
|
29
|
-
<SentinelCardHeader mod={mod} />
|
|
30
|
-
<SentinelCardContent mod={mod} report={report} />
|
|
31
|
-
{children}
|
|
32
|
-
<SentinelCardActions mod={mod} onReport={() => setRetry(retry + 1)} />
|
|
33
|
-
</Card>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { CardActionsProps } from '@mui/material'
|
|
2
|
-
import { ButtonEx } from '@xylabs/react-button'
|
|
3
|
-
import type { ModuleRenderProps } from '@xyo-network/react-module'
|
|
4
|
-
import { ModuleCardActions } from '@xyo-network/react-module'
|
|
5
|
-
import type { SentinelInstance } from '@xyo-network/sentinel-model'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
export type SentinelCardActionsProps = ModuleRenderProps<SentinelInstance>
|
|
9
|
-
& CardActionsProps & {
|
|
10
|
-
onReport?: (mod?: SentinelInstance) => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const SentinelCardActions: React.FC<SentinelCardActionsProps> = ({
|
|
14
|
-
onReport, mod, ...props
|
|
15
|
-
}) => {
|
|
16
|
-
return (
|
|
17
|
-
<ModuleCardActions mod={mod} {...props}>
|
|
18
|
-
<ButtonEx onClick={() => onReport?.(mod)} size="small" variant="outlined">
|
|
19
|
-
Report
|
|
20
|
-
</ButtonEx>
|
|
21
|
-
</ModuleCardActions>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { CardContentProps } from '@mui/material'
|
|
2
|
-
import { FlexGrowRow } from '@xylabs/react-flexbox'
|
|
3
|
-
import type { Payload } from '@xyo-network/payload-model'
|
|
4
|
-
import type { ModuleRenderProps } from '@xyo-network/react-module'
|
|
5
|
-
import { ModuleCardContent } from '@xyo-network/react-module'
|
|
6
|
-
import { JsonViewerEx } from '@xyo-network/react-payload-raw-info'
|
|
7
|
-
import type { SentinelInstance } from '@xyo-network/sentinel-model'
|
|
8
|
-
import React from 'react'
|
|
9
|
-
|
|
10
|
-
export type SentinelCardContentProps = ModuleRenderProps<SentinelInstance>
|
|
11
|
-
& CardContentProps & {
|
|
12
|
-
report?: Payload[]
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const SentinelCardContent: React.FC<SentinelCardContentProps> = ({
|
|
16
|
-
children, report, mod, ...props
|
|
17
|
-
}) => {
|
|
18
|
-
return (
|
|
19
|
-
<ModuleCardContent mod={mod} {...props}>
|
|
20
|
-
<FlexGrowRow flexWrap="wrap" justifyContent="start" gap={2}>
|
|
21
|
-
{report
|
|
22
|
-
? <JsonViewerEx value={report} />
|
|
23
|
-
: null}
|
|
24
|
-
{children}
|
|
25
|
-
</FlexGrowRow>
|
|
26
|
-
</ModuleCardContent>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CardHeaderProps } from '@mui/material'
|
|
2
|
-
import type { ModuleRenderProps } from '@xyo-network/react-module'
|
|
3
|
-
import { ModuleCardHeader } from '@xyo-network/react-module'
|
|
4
|
-
import type { SentinelInstance } from '@xyo-network/sentinel-model'
|
|
5
|
-
import React from 'react'
|
|
6
|
-
|
|
7
|
-
export const SentinelCardHeader: React.FC<ModuleRenderProps<SentinelInstance> & CardHeaderProps> = ({
|
|
8
|
-
title, mod, ...props
|
|
9
|
-
}) => {
|
|
10
|
-
return <ModuleCardHeader mod={mod} title={title ?? mod?.config.name ?? 'Sentinel'} {...props} />
|
|
11
|
-
}
|