@xyo-network/react-node 2.54.0 → 2.55.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/package.json CHANGED
@@ -14,24 +14,23 @@
14
14
  "@xylabs/react-async-effect": "^2.17.3",
15
15
  "@xylabs/react-flexbox": "^2.17.3",
16
16
  "@xylabs/react-shared": "^2.17.3",
17
- "@xyo-network/account-model": "^2.62.1",
18
- "@xyo-network/core": "^2.62.1",
19
- "@xyo-network/module": "^2.62.1",
20
- "@xyo-network/module-model": "^2.62.1",
21
- "@xyo-network/node": "^2.62.1",
22
- "@xyo-network/react-node-context": "^2.54.0",
23
- "@xyo-network/react-node-provider": "^2.54.0",
24
- "@xyo-network/react-wallet": "^2.54.0",
17
+ "@xyo-network/account-model": "^2.63.1",
18
+ "@xyo-network/core": "^2.63.1",
19
+ "@xyo-network/module": "^2.63.1",
20
+ "@xyo-network/module-model": "^2.63.1",
21
+ "@xyo-network/node": "^2.63.1",
22
+ "@xyo-network/react-node-context": "^2.55.0",
23
+ "@xyo-network/react-node-provider": "^2.55.0",
24
+ "@xyo-network/react-wallet": "^2.55.0",
25
25
  "lodash": "^4.17.21"
26
26
  },
27
27
  "devDependencies": {
28
- "@storybook/react": "^7.0.21",
28
+ "@storybook/react": "^7.0.23",
29
29
  "@types/lodash": "^4.14.195",
30
- "@xylabs/ts-scripts-yarn3": "^2.17.13",
31
- "@xylabs/tsconfig-react": "^2.17.13",
32
- "@xyo-network/account": "^2.62.1",
33
- "@xyo-network/react-storybook": "^2.54.0",
34
- "@xyo-network/react-wallet": "^2.54.0",
30
+ "@xylabs/ts-scripts-yarn3": "^2.17.17",
31
+ "@xylabs/tsconfig-react": "^2.17.17",
32
+ "@xyo-network/react-storybook": "^2.55.0",
33
+ "@xyo-network/react-wallet": "^2.55.0",
35
34
  "typescript": "^5.1.3"
36
35
  },
37
36
  "peerDependencies": {
@@ -86,5 +85,5 @@
86
85
  },
87
86
  "sideEffects": false,
88
87
  "types": "dist/types/index.d.ts",
89
- "version": "2.54.0"
88
+ "version": "2.55.0"
90
89
  }
@@ -1,17 +1,15 @@
1
1
  import { Decorator, Meta, StoryFn } from '@storybook/react'
2
2
  import { useAsyncEffect } from '@xylabs/react-async-effect'
3
3
  import { WithChildren } from '@xylabs/react-shared'
4
- import { HDWallet } from '@xyo-network/account'
5
4
  import { AbstractModule, Query } from '@xyo-network/module'
6
5
  import { MemoryNode, NodeConfigSchema, NodeWrapper } from '@xyo-network/node'
7
6
  import { MemoryNodeProvider } from '@xyo-network/react-node-provider'
8
7
  import { DefaultSeedPhrase } from '@xyo-network/react-storybook'
9
- import { WalletProvider } from '@xyo-network/react-wallet'
8
+ import { useAccount, WalletProvider } from '@xyo-network/react-wallet'
10
9
  import { useEffect, useState } from 'react'
11
10
 
12
11
  import { useModule, useProvidedNode } from '../hooks'
13
12
 
14
- const randomWallet = HDWallet.fromMnemonic(DefaultSeedPhrase)
15
13
  const TestModuleConfigSchema = 'network.xyo.test.module'
16
14
  class TestModule extends AbstractModule {
17
15
  static override configSchema: string = TestModuleConfigSchema
@@ -20,13 +18,12 @@ class TestModule extends AbstractModule {
20
18
  }
21
19
  }
22
20
  const TestModuleName = 'TestModule'
23
- const TestModuleAccount = randomWallet.derivePath('0')
24
-
25
- const account = randomWallet.derivePath('0')
26
21
 
27
22
  const MemoryNodeDecorator: Decorator = (Story, args) => {
23
+ const [account] = useAccount({ mnemonic: DefaultSeedPhrase })
24
+
28
25
  return (
29
- <WalletProvider defaultWallet={randomWallet}>
26
+ <WalletProvider defaultWallet={account}>
30
27
  <MemoryNodeProvider config={{ schema: NodeConfigSchema }}>
31
28
  <Story {...args} />
32
29
  </MemoryNodeProvider>
@@ -35,6 +32,7 @@ const MemoryNodeDecorator: Decorator = (Story, args) => {
35
32
  }
36
33
 
37
34
  const UseModuleTest: React.FC<WithChildren> = ({ children }) => {
35
+ const [account] = useAccount({ mnemonic: DefaultSeedPhrase, path: '0' })
38
36
  const [testModule] = useModule(TestModuleName, account)
39
37
 
40
38
  useEffect(() => {
@@ -56,12 +54,14 @@ const Template: StoryFn<React.FC> = (props) => {
56
54
  const [node] = useProvidedNode() as [MemoryNode]
57
55
  const [description, setDescription] = useState<string>()
58
56
 
57
+ const [account] = useAccount({ mnemonic: DefaultSeedPhrase, path: '0' })
58
+
59
59
  useAsyncEffect(
60
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
61
61
  async (mounted) => {
62
62
  if (node) {
63
63
  try {
64
- const mod = await TestModule.create({ account: TestModuleAccount, config: { name: TestModuleName, schema: TestModuleConfigSchema } })
64
+ const mod = await TestModule.create({ account, config: { name: TestModuleName, schema: TestModuleConfigSchema } })
65
65
  await node?.register(mod)
66
66
  await node?.attach(mod.address, true)
67
67
  const wrapper = NodeWrapper.wrap(node)
@@ -74,7 +74,7 @@ const Template: StoryFn<React.FC> = (props) => {
74
74
  }
75
75
  }
76
76
  },
77
- [node],
77
+ [node, account],
78
78
  )
79
79
 
80
80
  return (