@xyo-network/xl1-providers 4.0.7 → 4.0.8

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.
@@ -24,7 +24,7 @@ async function buildSimpleXyoSigner(context, account) {
24
24
  var buildSimpleXyoSignerV2 = buildSimpleXyoSigner;
25
25
 
26
26
  // src/creators/createRestDataLake.ts
27
- import { RestDataLakeRunner as RestDataLakeRunner3, RestDataLakeViewer as RestDataLakeViewer4 } from "@xyo-network/xl1-protocol-sdk";
27
+ import { RestDataLakeRunner as RestDataLakeRunner3, RestDataLakeViewer as RestDataLakeViewer5 } from "@xyo-network/xl1-protocol-sdk";
28
28
 
29
29
  // src/locators/baseConfigFactoryLocator.ts
30
30
  import {
@@ -186,6 +186,13 @@ import {
186
186
  SimpleXyoGatewayRunner,
187
187
  SimpleXyoRunner
188
188
  } from "@xyo-network/xl1-protocol-sdk";
189
+ import {
190
+ RestBlockViewer,
191
+ RestChainContractViewer,
192
+ RestChainStateViewer,
193
+ RestFinalizationViewer,
194
+ RestIndexViewer
195
+ } from "@xyo-network/xl1-rest-block-viewer";
189
196
  import {
190
197
  JsonRpcAccountBalanceViewer,
191
198
  JsonRpcBlockViewer,
@@ -1393,8 +1400,13 @@ var PROVIDER_IMPLEMENTATIONS = [
1393
1400
  JsonRpcXyoRunner,
1394
1401
  JsonRpcXyoSigner,
1395
1402
  JsonRpcXyoViewer,
1403
+ RestBlockViewer,
1404
+ RestChainContractViewer,
1405
+ RestChainStateViewer,
1396
1406
  RestDataLakeRunner,
1397
1407
  RestDataLakeViewer,
1408
+ RestFinalizationViewer,
1409
+ RestIndexViewer,
1398
1410
  SimpleAccountBalanceViewer,
1399
1411
  SimpleBlockRewardViewer,
1400
1412
  SimpleBlockValidationViewer,
@@ -1563,6 +1575,84 @@ async function basicRemoteRunnerLocator(name, rpcConnection, signerTransport, da
1563
1575
  return locator;
1564
1576
  }
1565
1577
 
1578
+ // src/locators/basicRestViewerLocator.ts
1579
+ import { isDefined as isDefined4 } from "@ariestools/sdk";
1580
+ import { MemoryMap } from "@xyo-network/xl1-driver-memory";
1581
+ import {
1582
+ ActorConfigZod as ActorConfigZod2,
1583
+ RestDataLakeViewer as RestDataLakeViewer4,
1584
+ SimpleAccountBalanceViewer as SimpleAccountBalanceViewer2,
1585
+ SimpleStakeEventsViewer as SimpleStakeEventsViewer3,
1586
+ SimpleXyoGateway as SimpleXyoGateway3,
1587
+ synthesizeMemoryViewerBindings
1588
+ } from "@xyo-network/xl1-protocol-sdk";
1589
+ import {
1590
+ RestBlockViewer as RestBlockViewer2,
1591
+ RestChainContractViewer as RestChainContractViewer2,
1592
+ RestChainStateViewer as RestChainStateViewer2,
1593
+ RestIndexViewer as RestIndexViewer2
1594
+ } from "@xyo-network/xl1-rest-block-viewer";
1595
+ async function basicRestViewerLocator(name, restConfig, dataLakeEndpoint, options) {
1596
+ const connections = {
1597
+ "rest-blocks": restConfig.blocks,
1598
+ "memory": { type: "memory" }
1599
+ };
1600
+ const providerBindings = {
1601
+ BlockViewer: { connection: "rest-blocks" },
1602
+ ChainContractViewer: { connection: "rest-blocks" },
1603
+ ChainStateViewer: { connection: "rest-blocks" },
1604
+ FinalizationViewer: { connection: "rest-blocks" },
1605
+ ...synthesizeMemoryViewerBindings()
1606
+ };
1607
+ if (isDefined4(restConfig.chainState)) {
1608
+ connections["rest-chain-state"] = restConfig.chainState;
1609
+ providerBindings.ChainStateViewer = { connection: "rest-chain-state" };
1610
+ }
1611
+ if (isDefined4(restConfig.index)) {
1612
+ connections["rest-index"] = restConfig.index;
1613
+ providerBindings.IndexViewer = { connection: "rest-index" };
1614
+ }
1615
+ const config = ActorConfigZod2.parse({
1616
+ name,
1617
+ connections,
1618
+ providerBindings
1619
+ });
1620
+ const locator = locatorFromAdaptedConfig({
1621
+ config,
1622
+ context: { singletons: {}, caches: {} }
1623
+ });
1624
+ locator.registerMany([
1625
+ SimpleXyoGateway3.factory(SimpleXyoGateway3.dependencies, {}),
1626
+ SimpleXyoConnectionViewer.factory(SimpleXyoConnectionViewer.dependencies, {}),
1627
+ SimpleStakeEventsViewer3.factory(SimpleStakeEventsViewer3.dependencies, { positions: [] }),
1628
+ SimpleAccountBalanceViewer2.factory(SimpleAccountBalanceViewer2.dependencies, {
1629
+ balancesSummaryMap: new MemoryMap(),
1630
+ transfersSummaryMap: new MemoryMap()
1631
+ })
1632
+ ]);
1633
+ const fetchFn = options?.fetchFn;
1634
+ if (isDefined4(fetchFn)) {
1635
+ const chainStateBaseUrl = (restConfig.chainState ?? restConfig.blocks).baseUrl;
1636
+ locator.registerMany([
1637
+ RestBlockViewer2.factory(RestBlockViewer2.dependencies, { fetchFn, finalizedBaseUrl: restConfig.blocks.baseUrl }),
1638
+ RestChainStateViewer2.factory(RestChainStateViewer2.dependencies, { chainStateBaseUrl, fetchFn }),
1639
+ RestChainContractViewer2.factory(RestChainContractViewer2.dependencies, { contractBaseUrl: restConfig.blocks.baseUrl, fetchFn })
1640
+ ]);
1641
+ if (isDefined4(restConfig.index)) {
1642
+ locator.register(
1643
+ RestIndexViewer2.factory(RestIndexViewer2.dependencies, { fetchFn, indexBaseUrl: restConfig.index.baseUrl })
1644
+ );
1645
+ }
1646
+ }
1647
+ const endpoint = dataLakeEndpoint ?? options?.dataLakeEndpoint;
1648
+ if (isDefined4(endpoint)) {
1649
+ const dataLakeViewerParams = { endpoint };
1650
+ locator.register(RestDataLakeViewer4.factory(RestDataLakeViewer4.dependencies, dataLakeViewerParams));
1651
+ }
1652
+ locator.freeze();
1653
+ return locator;
1654
+ }
1655
+
1566
1656
  // src/locators/rootLocatorFromConfig.ts
1567
1657
  import { assertEx as assertEx5 } from "@ariestools/sdk";
1568
1658
  async function rootLocatorFromConfig(context, validateDepsOnRegister = false, validators) {
@@ -1578,9 +1668,9 @@ async function rootLocatorFromConfig(context, validateDepsOnRegister = false, va
1578
1668
  async function createRestDataLakeViewer(dataLakeEndpoint) {
1579
1669
  const locator = await baseConfigFactoryLocator();
1580
1670
  const dataLakeViewerParams = { endpoint: dataLakeEndpoint };
1581
- locator.register(RestDataLakeViewer4.factory(RestDataLakeViewer4.dependencies, dataLakeViewerParams));
1671
+ locator.register(RestDataLakeViewer5.factory(RestDataLakeViewer5.dependencies, dataLakeViewerParams));
1582
1672
  locator.freeze();
1583
- return await locator.getInstance(RestDataLakeViewer4.defaultMoniker);
1673
+ return await locator.getInstance(RestDataLakeViewer5.defaultMoniker);
1584
1674
  }
1585
1675
  async function createRestDataLakeRunner(dataLakeEndpoint) {
1586
1676
  const locator = await baseConfigFactoryLocator();
@@ -1592,16 +1682,16 @@ async function createRestDataLakeRunner(dataLakeEndpoint) {
1592
1682
 
1593
1683
  // src/registerHelpers.ts
1594
1684
  import {
1595
- SimpleStakeEventsViewer as SimpleStakeEventsViewer3,
1685
+ SimpleStakeEventsViewer as SimpleStakeEventsViewer4,
1596
1686
  SimpleStakeViewer as SimpleStakeViewer2,
1597
- SimpleXyoGateway as SimpleXyoGateway3,
1687
+ SimpleXyoGateway as SimpleXyoGateway4,
1598
1688
  SimpleXyoGatewayRunner as SimpleXyoGatewayRunner3,
1599
1689
  SimpleXyoSigner as SimpleXyoSigner2
1600
1690
  } from "@xyo-network/xl1-protocol-sdk";
1601
1691
  var registerGatewayWithLocator = (locator, account) => {
1602
1692
  locator.registerMany([
1603
1693
  SimpleXyoConnectionRunner.factory(SimpleXyoConnectionRunner.dependencies, {}),
1604
- SimpleXyoGateway3.factory(SimpleXyoGateway3.dependencies, {})
1694
+ SimpleXyoGateway4.factory(SimpleXyoGateway4.dependencies, {})
1605
1695
  ]);
1606
1696
  if (account) {
1607
1697
  locator.registerMany([
@@ -1614,7 +1704,7 @@ var registerGatewayWithLocator = (locator, account) => {
1614
1704
  var registerSimpleStakeViewerWithLocator = (locator, positions) => {
1615
1705
  locator.registerMany([
1616
1706
  SimpleStakeViewer2.factory(SimpleStakeViewer2.dependencies, { positions }),
1617
- SimpleStakeEventsViewer3.factory(SimpleStakeEventsViewer3.dependencies, { positions })
1707
+ SimpleStakeEventsViewer4.factory(SimpleStakeEventsViewer4.dependencies, { positions })
1618
1708
  ]);
1619
1709
  return locator;
1620
1710
  };
@@ -1635,6 +1725,7 @@ export {
1635
1725
  baseConfigFactoryLocator,
1636
1726
  basicRemoteRunnerLocator,
1637
1727
  basicRemoteViewerLocator,
1728
+ basicRestViewerLocator,
1638
1729
  buildSimpleXyoSigner,
1639
1730
  buildSimpleXyoSignerV2,
1640
1731
  createRestDataLakeRunner,