@xyo-network/xl1-network-model 1.25.33 → 1.26.1
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/neutral/index.mjs.map +1 -1
- package/dist/neutral/lib/Networks.d.ts.map +1 -1
- package/dist/neutral/models/Bootstrap.d.ts +2 -1
- package/dist/neutral/models/Bootstrap.d.ts.map +1 -1
- package/dist/neutral/models/NetworkId.d.ts +12 -0
- package/dist/neutral/models/NetworkId.d.ts.map +1 -0
- package/dist/neutral/models/index.d.ts +1 -0
- package/dist/neutral/models/index.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/lib/NetworkDataLakeUrls.ts +1 -1
- package/src/lib/Networks.ts +1 -2
- package/src/models/Bootstrap.ts +3 -1
- package/src/models/NetworkId.ts +6 -0
- package/src/models/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/icons/local/local.svg","../../src/icons/mainnet/mainnet.svg","../../src/icons/sequence/testnet.svg","../../src/lib/Networks.ts","../../src/models/Bootstrap.ts","../../src/lib/NetworkDataLakeUrls.ts","../../src/modules/node/getNetworkNode.ts","../../src/manifest/network.json","../../src/manifest/networkManifest.ts","../../src/modules/node/getNetworkNodes.ts","../../src/modules/node/initNetworkNode.ts"],"sourcesContent":["<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#f47f00;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f47f00;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#f47f00;\"/></svg>","<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#8d8fc6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#eb407a;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f27046;\"/><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#572aff;\"/></svg>","<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#579fd6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#579fd6;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#579fd6;\"/></svg>","import { asHex } from '@xylabs/sdk-js'\nimport type { NetworkId } from '@xyo-network/xl1-protocol'\n\nimport {\n LocalNetworkIconString, MainNetworkIconString, SequenceNetworkIconString,\n} from '../icons/index.ts'\nimport type { NetworkBootstrap } from '../models/index.ts'\nimport { NetworkBootstrapSchema } from '../models/index.ts'\n\n/** Bootstrap configuration for the XYO Layer 1 mainnet. */\nexport const MainNetwork: NetworkBootstrap = {\n chain: asHex('319e667ced10452a117472811130444ded357f26', true),\n description: 'Main Network for XYO Layer 1',\n icon: MainNetworkIconString,\n id: 'mainnet' as NetworkId,\n name: 'Mainnet',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://api.chain.xyo.network',\n explorerUrl: 'https://explore.xyo.network',\n}\n\n/** Bootstrap configuration for the XYO Layer 1 sequence (test) network. */\nexport const SequenceNetwork: NetworkBootstrap = {\n chain: asHex('4b43a753c8024c0e5000e8ac948ac0063ac624bc', true),\n description: 'Test Network for XYO Layer 1',\n icon: SequenceNetworkIconString,\n id: 'sequence' as NetworkId,\n name: 'Sequence',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://beta.api.chain.xyo.network',\n explorerUrl: 'https://beta.explore.xyo.network',\n}\n\n/** Bootstrap configuration for a local development network. */\nexport const LocalNetwork: NetworkBootstrap = {\n description: 'Local Node',\n icon: LocalNetworkIconString,\n id: 'local' as NetworkId,\n name: 'Local',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'http://localhost:8080',\n explorerUrl: 'http://localhost:3000',\n}\n\n/** Default set of available XYO Layer 1 networks (mainnet, sequence, local). */\nexport const DefaultNetworks: NetworkBootstrap[] = [MainNetwork, SequenceNetwork, LocalNetwork]\n","import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload } from '@xyo-network/sdk-js'\nimport { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'\nimport type { ChainId, NetworkId } from '@xyo-network/xl1-protocol'\n\n/** Connection details for accessing a chain endpoint. */\nexport interface ChainConnection {\n /** Chain Identifier - can be a hex (eth contract address) or a string */\n chain?: ChainId\n /** Name of the chain */\n name: string\n /** Url for accessing the network */\n url: string\n}\n\n/** Schema identifier for network bootstrap payloads. */\nexport const NetworkBootstrapSchema = asSchema('network.xyo.network.bootstrap', true)\n/** Schema type for network bootstrap payloads. */\nexport type NetworkBootstrapSchema = typeof NetworkBootstrapSchema\n\n/** Fields describing a chain fork origin. */\nexport interface ChainForkFields {\n /** Block Number at which the chain was forked from */\n forkedAtLastBlockNumber?: string\n /** Hash in the last block the chain was forked from */\n forkedAtLastHash?: string\n /** Address of the forked chain */\n forkedChainId?: Address\n}\n\n/** Core fields describing an XYO network. */\nexport interface NetworkFields {\n /** Description of the network */\n description: string\n /** Url for accessing the network explorer */\n explorerUrl?: string\n /** string representation of the icon (svg) */\n icon?: string\n /** Machine-readable identifier */\n id: NetworkId\n schema: NetworkBootstrapSchema\n /** Symbol of the network */\n symbol?: string\n}\n\n/** Optional Properties can be found walking the chain to the genesis block */\nexport interface NetworkBootstrapFields extends NetworkFields, ChainForkFields, ChainConnection {}\n\n/** A network bootstrap extended with a flag indicating whether it is a custom network. */\nexport interface Network extends NetworkBootstrap {\n custom: boolean\n}\n\n/** Payload type containing all network bootstrap configuration fields. */\nexport type NetworkBootstrap = Payload<NetworkBootstrapFields, NetworkBootstrapSchema>\n\n/** Type guard that checks whether a payload is a NetworkBootstrap. */\nexport const isNetworkBootstrap = isPayloadOfSchemaType<NetworkBootstrap>(NetworkBootstrapSchema)\n\n/** Optionally casts a value to a Network if it is a valid NetworkBootstrap. */\nexport const asOptionalNetwork = AsObjectFactory.createOptional(isNetworkBootstrap)\n","import type { GatewayName } from '@xyo-network/xl1-protocol'\n\nimport {\n LocalNetwork, MainNetwork, SequenceNetwork,\n} from './Networks.ts'\n\n/** Map of network IDs to their corresponding Data Lake API URLs. */\nexport const NetworkDataLakeUrls = {\n [MainNetwork.id]: 'https://api.archivist.xyo.network/dataLake',\n [SequenceNetwork.id]: 'https://beta.api.archivist.xyo.network/dataLake',\n [LocalNetwork.id]: 'http://localhost:8080/dataLake',\n} as const satisfies Record<GatewayName, string>\n","import type { WalletInstance } from '@xyo-network/sdk-js'\nimport { ManifestWrapper, ModuleFactoryLocator } from '@xyo-network/sdk-js'\n\nimport { NetworkNodeManifest } from '../../manifest/index.ts'\n\n/** Creates a network node from the network manifest using the provided wallet. */\nexport const getNetworkNode = async (wallet: WalletInstance) => {\n const wrapper = new ManifestWrapper(NetworkNodeManifest, wallet, new ModuleFactoryLocator())\n const [node] = await wrapper.loadNodes()\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"Network\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}","import type { PackageManifestPayload } from '@xyo-network/sdk-js'\n\nimport node from './network.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NetworkNodeManifest = node as unknown as PackageManifestPayload\n","import type { AttachableNodeInstance } from '@xyo-network/sdk-js'\n\nconst networkNodeMap = new Map<string, AttachableNodeInstance>()\n\n/** Returns the global map of network URL to node instance. */\nexport const getNetworkNodes = () => {\n return networkNodeMap\n}\n","import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\n\nimport type { NetworkBootstrap } from '../../models/index.ts'\nimport { getNetworkNode } from './getNetworkNode.ts'\nimport { getNetworkNodes } from './getNetworkNodes.ts'\n\n/** Initializes or retrieves a cached network node for the given network and wallet. */\nexport const initNetworkNode = async (activeNetwork: NetworkBootstrap, wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const networkNodeMap = getNetworkNodes()\n if (networkNodeMap.has(activeNetwork.url)) return networkNodeMap.get(activeNetwork.url)!\n\n const activeNetworkNode = await getNetworkNode(wallet)\n networkNodeMap.set(activeNetwork.url, activeNetworkNode)\n\n return activeNetworkNode\n}\n"],"mappings":";AAAA;;;ACAA;;;ACAA;;;ACAA,SAAS,aAAa;;;ACCtB,SAAS,uBAAuB;AAEhC,SAAS,UAAU,6BAA6B;AAczC,IAAM,yBAAyB,SAAS,iCAAiC,IAAI;AAyC7E,IAAM,qBAAqB,sBAAwC,sBAAsB;AAGzF,IAAM,oBAAoB,gBAAgB,eAAe,kBAAkB;;;ADnD3E,IAAM,cAAgC;AAAA,EAC3C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAoC;AAAA,EAC/C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,eAAiC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAsC,CAAC,aAAa,iBAAiB,YAAY;;;AEzCvF,IAAM,sBAAsB;AAAA,EACjC,CAAC,YAAY,EAAE,GAAG;AAAA,EAClB,CAAC,gBAAgB,EAAE,GAAG;AAAA,EACtB,CAAC,aAAa,EAAE,GAAG;AACrB;;;ACVA,SAAS,iBAAiB,4BAA4B;;;ACDtD;AAAA,EACE,SAAW;AAAA,EACX,OAAS;AAAA,IACP;AAAA,MACE,QAAU;AAAA,QACR,aAAe;AAAA,QACf,MAAQ;AAAA,QACR,QAAU;AAAA,MACZ;AAAA,MACA,SAAW;AAAA,QACT,SAAW,CAAC;AAAA,QACZ,QAAU,CAAC;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,QAAU;AACZ;;;ACTO,IAAM,sBAAsB;;;AFD5B,IAAM,iBAAiB,OAAO,WAA2B;AAC9D,QAAM,UAAU,IAAI,gBAAgB,qBAAqB,QAAQ,IAAI,qBAAqB,CAAC;AAC3F,QAAM,CAAC,IAAI,IAAI,MAAM,QAAQ,UAAU;AACvC,SAAO;AACT;;;AGRA,IAAM,iBAAiB,oBAAI,IAAoC;AAGxD,IAAM,kBAAkB,MAAM;AACnC,SAAO;AACT;;;ACAO,IAAM,kBAAkB,OAAO,eAAiC,WAA4D;AACjI,QAAMA,kBAAiB,gBAAgB;AACvC,MAAIA,gBAAe,IAAI,cAAc,GAAG,EAAG,QAAOA,gBAAe,IAAI,cAAc,GAAG;AAEtF,QAAM,oBAAoB,MAAM,eAAe,MAAM;AACrD,EAAAA,gBAAe,IAAI,cAAc,KAAK,iBAAiB;AAEvD,SAAO;AACT;","names":["networkNodeMap"]}
|
|
1
|
+
{"version":3,"sources":["../../src/icons/local/local.svg","../../src/icons/mainnet/mainnet.svg","../../src/icons/sequence/testnet.svg","../../src/lib/Networks.ts","../../src/models/Bootstrap.ts","../../src/lib/NetworkDataLakeUrls.ts","../../src/modules/node/getNetworkNode.ts","../../src/manifest/network.json","../../src/manifest/networkManifest.ts","../../src/modules/node/getNetworkNodes.ts","../../src/modules/node/initNetworkNode.ts"],"sourcesContent":["<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#f47f00;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#f47f00;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f47f00;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#f47f00;\"/></svg>","<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#8d8fc6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#eb407a;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#f27046;\"/><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#572aff;\"/></svg>","<svg id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><g style=\"opacity:.5;\"><path d=\"M154.71,97c.46,2.59,2.5,4.62,5.1,5.05l14.05,2.34,31.71-46.17c4.57-6.65-3.62-14.62-10.14-9.87l-43.68,31.83,2.97,16.82Z\" style=\"fill:#579fd6;\"/><path d=\"M173.86,151.62l-14.05,2.34c-2.6.43-4.64,2.45-5.1,5.05l-2.97,16.82,43.68,31.83c6.52,4.75,14.71-3.21,10.14-9.87l-31.71-46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M82.14,104.38l14.05-2.34c2.6-.43,4.64-2.45,5.1-5.05l2.97-16.82-43.68-31.83c-6.52-4.75-14.71,3.21-10.14,9.87l31.71,46.17Z\" style=\"fill:#579fd6;\"/><path d=\"M101.29,159c-.46-2.59-2.5-4.62-5.1-5.05l-14.05-2.34-31.71,46.17c-4.57,6.65,3.62,14.62,10.14,9.87l43.68-31.83-2.97-16.82Z\" style=\"fill:#579fd6;\"/></g><path d=\"M107.33,104l15.94-90.32c.93-5.3,8.53-5.3,9.47,0l15.94,90.32c.35,2.01,1.94,3.57,3.95,3.91l92.24,15.35c5.36.89,5.36,8.59,0,9.49l-92.24,15.35c-2.01.33-3.59,1.9-3.95,3.91l-15.94,90.32c-.93,5.3-8.53,5.3-9.47,0l-15.94-90.32c-.35-2.01-1.94-3.57-3.95-3.91l-92.24-15.35c-5.36-.89-5.36-8.59,0-9.49l92.24-15.35c2.01-.33,3.59-1.9,3.95-3.91Z\" style=\"fill:#579fd6;\"/></svg>","import { asHex } from '@xylabs/sdk-js'\n\nimport {\n LocalNetworkIconString, MainNetworkIconString, SequenceNetworkIconString,\n} from '../icons/index.ts'\nimport type { NetworkBootstrap, NetworkId } from '../models/index.ts'\nimport { NetworkBootstrapSchema } from '../models/index.ts'\n\n/** Bootstrap configuration for the XYO Layer 1 mainnet. */\nexport const MainNetwork: NetworkBootstrap = {\n chain: asHex('319e667ced10452a117472811130444ded357f26', true),\n description: 'Main Network for XYO Layer 1',\n icon: MainNetworkIconString,\n id: 'mainnet' as NetworkId,\n name: 'Mainnet',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://api.chain.xyo.network',\n explorerUrl: 'https://explore.xyo.network',\n}\n\n/** Bootstrap configuration for the XYO Layer 1 sequence (test) network. */\nexport const SequenceNetwork: NetworkBootstrap = {\n chain: asHex('4b43a753c8024c0e5000e8ac948ac0063ac624bc', true),\n description: 'Test Network for XYO Layer 1',\n icon: SequenceNetworkIconString,\n id: 'sequence' as NetworkId,\n name: 'Sequence',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'https://beta.api.chain.xyo.network',\n explorerUrl: 'https://beta.explore.xyo.network',\n}\n\n/** Bootstrap configuration for a local development network. */\nexport const LocalNetwork: NetworkBootstrap = {\n description: 'Local Node',\n icon: LocalNetworkIconString,\n id: 'local' as NetworkId,\n name: 'Local',\n schema: NetworkBootstrapSchema,\n symbol: 'XL1',\n url: 'http://localhost:8080',\n explorerUrl: 'http://localhost:3000',\n}\n\n/** Default set of available XYO Layer 1 networks (mainnet, sequence, local). */\nexport const DefaultNetworks: NetworkBootstrap[] = [MainNetwork, SequenceNetwork, LocalNetwork]\n","import type { Address } from '@xylabs/sdk-js'\nimport { AsObjectFactory } from '@xylabs/sdk-js'\nimport type { Payload } from '@xyo-network/sdk-js'\nimport { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'\nimport type { ChainId } from '@xyo-network/xl1-protocol-lib'\n\nimport type { NetworkId } from './NetworkId.ts'\n\n/** Connection details for accessing a chain endpoint. */\nexport interface ChainConnection {\n /** Chain Identifier - can be a hex (eth contract address) or a string */\n chain?: ChainId\n /** Name of the chain */\n name: string\n /** Url for accessing the network */\n url: string\n}\n\n/** Schema identifier for network bootstrap payloads. */\nexport const NetworkBootstrapSchema = asSchema('network.xyo.network.bootstrap', true)\n/** Schema type for network bootstrap payloads. */\nexport type NetworkBootstrapSchema = typeof NetworkBootstrapSchema\n\n/** Fields describing a chain fork origin. */\nexport interface ChainForkFields {\n /** Block Number at which the chain was forked from */\n forkedAtLastBlockNumber?: string\n /** Hash in the last block the chain was forked from */\n forkedAtLastHash?: string\n /** Address of the forked chain */\n forkedChainId?: Address\n}\n\n/** Core fields describing an XYO network. */\nexport interface NetworkFields {\n /** Description of the network */\n description: string\n /** Url for accessing the network explorer */\n explorerUrl?: string\n /** string representation of the icon (svg) */\n icon?: string\n /** Machine-readable identifier */\n id: NetworkId\n schema: NetworkBootstrapSchema\n /** Symbol of the network */\n symbol?: string\n}\n\n/** Optional Properties can be found walking the chain to the genesis block */\nexport interface NetworkBootstrapFields extends NetworkFields, ChainForkFields, ChainConnection {}\n\n/** A network bootstrap extended with a flag indicating whether it is a custom network. */\nexport interface Network extends NetworkBootstrap {\n custom: boolean\n}\n\n/** Payload type containing all network bootstrap configuration fields. */\nexport type NetworkBootstrap = Payload<NetworkBootstrapFields, NetworkBootstrapSchema>\n\n/** Type guard that checks whether a payload is a NetworkBootstrap. */\nexport const isNetworkBootstrap = isPayloadOfSchemaType<NetworkBootstrap>(NetworkBootstrapSchema)\n\n/** Optionally casts a value to a Network if it is a valid NetworkBootstrap. */\nexport const asOptionalNetwork = AsObjectFactory.createOptional(isNetworkBootstrap)\n","import type { GatewayName } from '@xyo-network/xl1-protocol-lib'\n\nimport {\n LocalNetwork, MainNetwork, SequenceNetwork,\n} from './Networks.ts'\n\n/** Map of network IDs to their corresponding Data Lake API URLs. */\nexport const NetworkDataLakeUrls = {\n [MainNetwork.id]: 'https://api.archivist.xyo.network/dataLake',\n [SequenceNetwork.id]: 'https://beta.api.archivist.xyo.network/dataLake',\n [LocalNetwork.id]: 'http://localhost:8080/dataLake',\n} as const satisfies Record<GatewayName, string>\n","import type { WalletInstance } from '@xyo-network/sdk-js'\nimport { ManifestWrapper, ModuleFactoryLocator } from '@xyo-network/sdk-js'\n\nimport { NetworkNodeManifest } from '../../manifest/index.ts'\n\n/** Creates a network node from the network manifest using the provided wallet. */\nexport const getNetworkNode = async (wallet: WalletInstance) => {\n const wrapper = new ManifestWrapper(NetworkNodeManifest, wallet, new ModuleFactoryLocator())\n const [node] = await wrapper.loadNodes()\n return node\n}\n","{\n \"$schema\": \"https://raw.githubusercontent.com/XYOracleNetwork/sdk-xyo-client-js/main/packages/manifest/src/schema.json\",\n \"nodes\": [\n {\n \"config\": {\n \"accountPath\": \"44'/60'/1\",\n \"name\": \"Network\",\n \"schema\": \"network.xyo.node.config\"\n },\n \"modules\": {\n \"private\": [],\n \"public\": []\n }\n }\n ],\n \"schema\": \"network.xyo.manifest\"\n}","import type { PackageManifestPayload } from '@xyo-network/sdk-js'\n\nimport node from './network.json' with { type: 'json' }\n\n/**\n * Root Node Manifest\n */\nexport const NetworkNodeManifest = node as unknown as PackageManifestPayload\n","import type { AttachableNodeInstance } from '@xyo-network/sdk-js'\n\nconst networkNodeMap = new Map<string, AttachableNodeInstance>()\n\n/** Returns the global map of network URL to node instance. */\nexport const getNetworkNodes = () => {\n return networkNodeMap\n}\n","import type { AttachableNodeInstance, WalletInstance } from '@xyo-network/sdk-js'\n\nimport type { NetworkBootstrap } from '../../models/index.ts'\nimport { getNetworkNode } from './getNetworkNode.ts'\nimport { getNetworkNodes } from './getNetworkNodes.ts'\n\n/** Initializes or retrieves a cached network node for the given network and wallet. */\nexport const initNetworkNode = async (activeNetwork: NetworkBootstrap, wallet: WalletInstance): Promise<AttachableNodeInstance> => {\n const networkNodeMap = getNetworkNodes()\n if (networkNodeMap.has(activeNetwork.url)) return networkNodeMap.get(activeNetwork.url)!\n\n const activeNetworkNode = await getNetworkNode(wallet)\n networkNodeMap.set(activeNetwork.url, activeNetworkNode)\n\n return activeNetworkNode\n}\n"],"mappings":";AAAA;;;ACAA;;;ACAA;;;ACAA,SAAS,aAAa;;;ACCtB,SAAS,uBAAuB;AAEhC,SAAS,UAAU,6BAA6B;AAgBzC,IAAM,yBAAyB,SAAS,iCAAiC,IAAI;AAyC7E,IAAM,qBAAqB,sBAAwC,sBAAsB;AAGzF,IAAM,oBAAoB,gBAAgB,eAAe,kBAAkB;;;ADtD3E,IAAM,cAAgC;AAAA,EAC3C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAoC;AAAA,EAC/C,OAAO,MAAM,4CAA4C,IAAI;AAAA,EAC7D,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,eAAiC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,aAAa;AACf;AAGO,IAAM,kBAAsC,CAAC,aAAa,iBAAiB,YAAY;;;AExCvF,IAAM,sBAAsB;AAAA,EACjC,CAAC,YAAY,EAAE,GAAG;AAAA,EAClB,CAAC,gBAAgB,EAAE,GAAG;AAAA,EACtB,CAAC,aAAa,EAAE,GAAG;AACrB;;;ACVA,SAAS,iBAAiB,4BAA4B;;;ACDtD;AAAA,EACE,SAAW;AAAA,EACX,OAAS;AAAA,IACP;AAAA,MACE,QAAU;AAAA,QACR,aAAe;AAAA,QACf,MAAQ;AAAA,QACR,QAAU;AAAA,MACZ;AAAA,MACA,SAAW;AAAA,QACT,SAAW,CAAC;AAAA,QACZ,QAAU,CAAC;AAAA,MACb;AAAA,IACF;AAAA,EACF;AAAA,EACA,QAAU;AACZ;;;ACTO,IAAM,sBAAsB;;;AFD5B,IAAM,iBAAiB,OAAO,WAA2B;AAC9D,QAAM,UAAU,IAAI,gBAAgB,qBAAqB,QAAQ,IAAI,qBAAqB,CAAC;AAC3F,QAAM,CAAC,IAAI,IAAI,MAAM,QAAQ,UAAU;AACvC,SAAO;AACT;;;AGRA,IAAM,iBAAiB,oBAAI,IAAoC;AAGxD,IAAM,kBAAkB,MAAM;AACnC,SAAO;AACT;;;ACAO,IAAM,kBAAkB,OAAO,eAAiC,WAA4D;AACjI,QAAMA,kBAAiB,gBAAgB;AACvC,MAAIA,gBAAe,IAAI,cAAc,GAAG,EAAG,QAAOA,gBAAe,IAAI,cAAc,GAAG;AAEtF,QAAM,oBAAoB,MAAM,eAAe,MAAM;AACrD,EAAAA,gBAAe,IAAI,cAAc,KAAK,iBAAiB;AAEvD,SAAO;AACT;","names":["networkNodeMap"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Networks.d.ts","sourceRoot":"","sources":["../../../src/lib/Networks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Networks.d.ts","sourceRoot":"","sources":["../../../src/lib/Networks.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,oBAAoB,CAAA;AAGrE,2DAA2D;AAC3D,eAAO,MAAM,WAAW,EAAE,gBAUzB,CAAA;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe,EAAE,gBAU7B,CAAA;AAED,+DAA+D;AAC/D,eAAO,MAAM,YAAY,EAAE,gBAS1B,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,eAAe,EAAE,gBAAgB,EAAiD,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address } from '@xylabs/sdk-js';
|
|
2
2
|
import type { Payload } from '@xyo-network/sdk-js';
|
|
3
|
-
import type { ChainId
|
|
3
|
+
import type { ChainId } from '@xyo-network/xl1-protocol-lib';
|
|
4
|
+
import type { NetworkId } from './NetworkId.ts';
|
|
4
5
|
/** Connection details for accessing a chain endpoint. */
|
|
5
6
|
export interface ChainConnection {
|
|
6
7
|
/** Chain Identifier - can be a hex (eth contract address) or a string */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bootstrap.d.ts","sourceRoot":"","sources":["../../../src/models/Bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Bootstrap.d.ts","sourceRoot":"","sources":["../../../src/models/Bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,yEAAyE;IACzE,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,wDAAwD;AACxD,eAAO,MAAM,sBAAsB;;CAAkD,CAAA;AACrF,kDAAkD;AAClD,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAA;AAElE,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kCAAkC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,6CAA6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,EAAE,EAAE,SAAS,CAAA;IACb,MAAM,EAAE,sBAAsB,CAAA;IAC9B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,8EAA8E;AAC9E,MAAM,WAAW,sBAAuB,SAAQ,aAAa,EAAE,eAAe,EAAE,eAAe;CAAG;AAElG,0FAA0F;AAC1F,MAAM,WAAW,OAAQ,SAAQ,gBAAgB;IAC/C,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,0EAA0E;AAC1E,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,EAAE,sBAAsB,CAAC,CAAA;AAEtF,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,+CAAkE,CAAA;AAEjG,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,kFAAqD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GatewayName } from '@xyo-network/xl1-protocol-lib';
|
|
2
|
+
/** Default network identifiers for mainnet, sequence, and local environments. */
|
|
3
|
+
export type DefaultNetworkIds = ('mainnet' & {
|
|
4
|
+
__gatewayName: true;
|
|
5
|
+
}) | ('sequence' & {
|
|
6
|
+
__gatewayName: true;
|
|
7
|
+
}) | ('local' & {
|
|
8
|
+
__gatewayName: true;
|
|
9
|
+
});
|
|
10
|
+
/** A network identifier, either a custom gateway name or one of the default network IDs. */
|
|
11
|
+
export type NetworkId<T extends GatewayName | void = void> = T extends void ? DefaultNetworkIds : T | DefaultNetworkIds;
|
|
12
|
+
//# sourceMappingURL=NetworkId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkId.d.ts","sourceRoot":"","sources":["../../../src/models/NetworkId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAEhE,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GAAG,CAAC,SAAS,GAAG;IAAE,aAAa,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG,CAAC,UAAU,GAAG;IAAE,aAAa,EAAE,IAAI,CAAA;CAAE,CAAC,GAAG,CAAC,OAAO,GAAG;IAAE,aAAa,EAAE,IAAI,CAAA;CAAE,CAAC,CAAA;AACpJ,4FAA4F;AAC5F,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,IAAI,GAAG,IAAI,IAAM,CAAC,SAAS,IAAI,GAAG,iBAAiB,GAAG,CAAC,GAAG,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "http://json.schemastore.org/package.json",
|
|
3
2
|
"name": "@xyo-network/xl1-network-model",
|
|
4
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.1",
|
|
5
4
|
"description": "XYO Layer One API",
|
|
6
5
|
"homepage": "https://xylabs.com",
|
|
7
6
|
"bugs": {
|
|
@@ -49,9 +48,10 @@
|
|
|
49
48
|
"!**/*.test.*"
|
|
50
49
|
],
|
|
51
50
|
"dependencies": {
|
|
52
|
-
"@xyo-network/xl1-protocol": "~1.
|
|
51
|
+
"@xyo-network/xl1-protocol-lib": "~1.26.1"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
54
|
+
"@opentelemetry/api": "^1.9.0",
|
|
55
55
|
"@types/node": "^25.5.0",
|
|
56
56
|
"@xylabs/sdk-js": "^5.0.86",
|
|
57
57
|
"@xylabs/ts-scripts-yarn3": "~7.4.25",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"zod": "~4.3.6"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
+
"@opentelemetry/api": "^1",
|
|
66
67
|
"@xylabs/sdk-js": "^5",
|
|
67
68
|
"@xyo-network/sdk-js": "^5",
|
|
68
69
|
"zod": "^4"
|
package/src/lib/Networks.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { asHex } from '@xylabs/sdk-js'
|
|
2
|
-
import type { NetworkId } from '@xyo-network/xl1-protocol'
|
|
3
2
|
|
|
4
3
|
import {
|
|
5
4
|
LocalNetworkIconString, MainNetworkIconString, SequenceNetworkIconString,
|
|
6
5
|
} from '../icons/index.ts'
|
|
7
|
-
import type { NetworkBootstrap } from '../models/index.ts'
|
|
6
|
+
import type { NetworkBootstrap, NetworkId } from '../models/index.ts'
|
|
8
7
|
import { NetworkBootstrapSchema } from '../models/index.ts'
|
|
9
8
|
|
|
10
9
|
/** Bootstrap configuration for the XYO Layer 1 mainnet. */
|
package/src/models/Bootstrap.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { Address } from '@xylabs/sdk-js'
|
|
|
2
2
|
import { AsObjectFactory } from '@xylabs/sdk-js'
|
|
3
3
|
import type { Payload } from '@xyo-network/sdk-js'
|
|
4
4
|
import { asSchema, isPayloadOfSchemaType } from '@xyo-network/sdk-js'
|
|
5
|
-
import type { ChainId
|
|
5
|
+
import type { ChainId } from '@xyo-network/xl1-protocol-lib'
|
|
6
|
+
|
|
7
|
+
import type { NetworkId } from './NetworkId.ts'
|
|
6
8
|
|
|
7
9
|
/** Connection details for accessing a chain endpoint. */
|
|
8
10
|
export interface ChainConnection {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GatewayName } from '@xyo-network/xl1-protocol-lib'
|
|
2
|
+
|
|
3
|
+
/** Default network identifiers for mainnet, sequence, and local environments. */
|
|
4
|
+
export type DefaultNetworkIds = ('mainnet' & { __gatewayName: true }) | ('sequence' & { __gatewayName: true }) | ('local' & { __gatewayName: true })
|
|
5
|
+
/** A network identifier, either a custom gateway name or one of the default network IDs. */
|
|
6
|
+
export type NetworkId<T extends GatewayName | void = void> = | T extends void ? DefaultNetworkIds : T | DefaultNetworkIds
|
package/src/models/index.ts
CHANGED