@xyo-network/react-standard-node 7.5.8 → 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.
@@ -1,24 +0,0 @@
1
- import { RootStorageArchivist } from './ModuleNames.ts'
2
-
3
- export const GlobalNodeOffsetPath = '15'
4
-
5
- export const RemoteNodeOffsetPaths: Record<string, string> = {
6
- Kerplunk: '112',
7
- Local: '111',
8
- Main: '113',
9
- }
10
-
11
- export const RemoteNodeArchivistOffsetPaths: Record<string, Record<string, string>> = {
12
- Kerplunk: {
13
- MemoryNode: '117',
14
- [RootStorageArchivist]: '119',
15
- },
16
- Local: {
17
- MemoryNode: '114',
18
- [RootStorageArchivist]: '116',
19
- },
20
- Main: {
21
- MemoryNode: '120',
22
- [RootStorageArchivist]: '122',
23
- },
24
- }
@@ -1,3 +0,0 @@
1
- export const GlobalNode = 'GlobalNode'
2
-
3
- export const RootStorageArchivist = 'RootStorageArchivist'
@@ -1,47 +0,0 @@
1
- import { assertDefinedEx } from '@xylabs/sdk-js'
2
- import type { MemoryNode } from '@xyo-network/node-memory'
3
- import { defaultNetworkConfigs } from '@xyo-network/react-network'
4
- import type { WalletInstance } from '@xyo-network/wallet-model'
5
-
6
- import { MemoryNodeBuilder } from './Builders/index.ts'
7
- import { RemoteNodeArchivistOffsetPaths, RemoteNodeOffsetPaths } from './ModuleAccountPaths.ts'
8
- import { RootStorageArchivist } from './ModuleNames.ts'
9
-
10
- const knownRemoteNodes = (): { apiDomain: string; name: string }[] => {
11
- const networkNames = defaultNetworkConfigs.map(config => config.name)
12
- return networkNames.map((networkName) => {
13
- const name = assertDefinedEx<string>(networkName, () => 'missing name in network config')
14
- const uri = defaultNetworkConfigs.find(config => config.name === networkName)?.nodes?.find(node => node.type === 'archivist')?.uri
15
- const apiDomain = assertDefinedEx<string>(uri, () => 'missing node type "archivist" in network config')
16
- return {
17
- apiDomain,
18
- name,
19
- }
20
- })
21
- }
22
-
23
- export const BuildStandardNodes = async (wallet: WalletInstance, onNodeBuilt?: (node: MemoryNode) => void): Promise<MemoryNode[]> => {
24
- try {
25
- return await Promise.all(
26
- knownRemoteNodes().map(async ({ apiDomain, name }) => {
27
- const remoteNodeOffset = RemoteNodeOffsetPaths[name]
28
- const remoteNodeWallet = await wallet.derivePath?.(remoteNodeOffset)
29
-
30
- const memoryNodeBuilder = await MemoryNodeBuilder.create({ name }, await remoteNodeWallet.derivePath?.('0'))
31
- await memoryNodeBuilder.addBridge(apiDomain)
32
-
33
- const rootArchivistPath = `${remoteNodeOffset}/${RemoteNodeArchivistOffsetPaths[name][RootStorageArchivist]}`
34
- const rootArchivistAccount = await wallet.derivePath?.(rootArchivistPath)
35
- await memoryNodeBuilder.addArchivistStorage(rootArchivistAccount, RootStorageArchivist, 'root')
36
-
37
- const { node } = memoryNodeBuilder
38
- assertDefinedEx(node, () => 'Memory Node was not built successfully')
39
- onNodeBuilt?.(node)
40
-
41
- return node
42
- }),
43
- )
44
- } catch (e) {
45
- throw new Error(`Error Creating Known Remote Nodes: ${e}`)
46
- }
47
- }
package/src/lib/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './Builders/index.ts'
2
- export * from './buildNodes.ts'
3
- export * from './ModuleAccountPaths.ts'
4
- export * from './ModuleNames.ts'