@xyo-network/xl1-protocol-sdk 1.16.9 → 1.16.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/neutral/SignedBigInt.d.ts +1 -1
- package/dist/neutral/SignedBigInt.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/allHashesPresent.d.ts +1 -1
- package/dist/neutral/block/hydrate/allHashesPresent.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts +1 -1
- package/dist/neutral/block/hydrate/hydrateBlock.d.ts.map +1 -1
- package/dist/neutral/block/hydrate/tryHydrateBlock.d.ts +1 -1
- package/dist/neutral/block/hydrate/tryHydrateBlock.d.ts.map +1 -1
- package/dist/neutral/block/primitives/frames/calculateFramesFromRange.d.ts.map +1 -1
- package/dist/neutral/block/primitives/hashFromBlockNumber.d.ts +1 -1
- package/dist/neutral/block/primitives/hashFromBlockNumber.d.ts.map +1 -1
- package/dist/neutral/block/primitives/payloads/ChainWindow.d.ts +1 -1
- package/dist/neutral/block/primitives/payloads/ChainWindow.d.ts.map +1 -1
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts +1 -1
- package/dist/neutral/block/primitives/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/config/Config.d.ts +3 -15
- package/dist/neutral/config/Config.d.ts.map +1 -1
- package/dist/neutral/config/Producer.d.ts +1 -5
- package/dist/neutral/config/Producer.d.ts.map +1 -1
- package/dist/neutral/config/Validation.d.ts +2 -10
- package/dist/neutral/config/Validation.d.ts.map +1 -1
- package/dist/neutral/eip-712/Payloads/EIP712Data.d.ts +1 -1
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts +2 -2
- package/dist/neutral/eip-712/Payloads/EIP712Signature.d.ts.map +1 -1
- package/dist/neutral/eip-712/verify.d.ts.map +1 -1
- package/dist/neutral/index.mjs +320 -103
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/instances/Address.d.ts +1 -2
- package/dist/neutral/instances/Address.d.ts.map +1 -1
- package/dist/neutral/instances/Object.d.ts +1 -1
- package/dist/neutral/instances/Signature.d.ts +1 -1
- package/dist/neutral/instances/Signature.d.ts.map +1 -1
- package/dist/neutral/instances/modifiers/BlockWindowInstance.d.ts +1 -1
- package/dist/neutral/instances/modifiers/BlockWindowInstance.d.ts.map +1 -1
- package/dist/neutral/instances/modifiers/Validatable.d.ts +1 -1
- package/dist/neutral/instances/modifiers/Validatable.d.ts.map +1 -1
- package/dist/neutral/instances/transaction/TransactionFields.d.ts +1 -1
- package/dist/neutral/instances/transaction/TransactionFields.d.ts.map +1 -1
- package/dist/neutral/map/AsynchronousMap.d.ts +1 -1
- package/dist/neutral/map/AsynchronousMap.d.ts.map +1 -1
- package/dist/neutral/model/ChainContext/ChainContext.d.ts +1 -1
- package/dist/neutral/model/ChainContext/ChainStakeContext.d.ts +4 -5
- package/dist/neutral/model/ChainContext/ChainStakeContext.d.ts.map +1 -1
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts +1 -2
- package/dist/neutral/model/ChainContext/ChainStateContext.d.ts.map +1 -1
- package/dist/neutral/model/ChainFork/ChainForkStatic.d.ts +1 -1
- package/dist/neutral/model/ChainFork/ChainForkStatic.d.ts.map +1 -1
- package/dist/neutral/model/PayloadMap.d.ts +1 -1
- package/dist/neutral/model/PayloadMap.d.ts.map +1 -1
- package/dist/neutral/model/Position.d.ts +1 -1
- package/dist/neutral/model/Position.d.ts.map +1 -1
- package/dist/neutral/model/index.d.ts +0 -2
- package/dist/neutral/model/index.d.ts.map +1 -1
- package/dist/neutral/payloads/AddressPairPayload.d.ts +2 -2
- package/dist/neutral/payloads/AddressPairPayload.d.ts.map +1 -1
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts +2 -4
- package/dist/neutral/payloads/netBalancesForPayloads.d.ts.map +1 -1
- package/dist/neutral/payloads/netTransfersForPayloads.d.ts +1 -1
- package/dist/neutral/payloads/netTransfersForPayloads.d.ts.map +1 -1
- package/dist/neutral/payloads/summary/BalancesStepSummary.d.ts +3 -3
- package/dist/neutral/payloads/summary/BalancesStepSummary.d.ts.map +1 -1
- package/dist/neutral/payloads/summary/StepSummary.d.ts +1 -2
- package/dist/neutral/payloads/summary/StepSummary.d.ts.map +1 -1
- package/dist/neutral/payloads/summary/TransfersSummary.d.ts +3 -3
- package/dist/neutral/payloads/summary/TransfersSummary.d.ts.map +1 -1
- package/dist/neutral/primitives/step/completedStepRewardAddress.d.ts +1 -1
- package/dist/neutral/primitives/step/completedStepRewardAddress.d.ts.map +1 -1
- package/dist/neutral/primitives/step/derivedReceiveAddress.d.ts +1 -1
- package/dist/neutral/primitives/step/derivedReceiveAddress.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/balances/balancesSummary.d.ts +1 -1
- package/dist/neutral/primitives/summary/balances/balancesSummary.d.ts.map +1 -1
- package/dist/neutral/primitives/summary/transfers/transfersSummary.d.ts +1 -1
- package/dist/neutral/primitives/summary/transfers/transfersSummary.d.ts.map +1 -1
- package/dist/neutral/primitives/timeBudget.d.ts +1 -1
- package/dist/neutral/provider/DataLake.d.ts +1 -1
- package/dist/neutral/provider/DataLake.d.ts.map +1 -1
- package/dist/neutral/provider/TransactionSubmitter.d.ts +1 -2
- package/dist/neutral/provider/TransactionSubmitter.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGateway.d.ts +1 -1
- package/dist/neutral/provider/XyoGateway.d.ts.map +1 -1
- package/dist/neutral/provider/XyoGatewayRunner.d.ts +1 -2
- package/dist/neutral/provider/XyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/provider/XyoNetwork.d.ts +1 -1
- package/dist/neutral/provider/XyoNetwork.d.ts.map +1 -1
- package/dist/neutral/provider/XyoRunner.d.ts +1 -2
- package/dist/neutral/provider/XyoRunner.d.ts.map +1 -1
- package/dist/neutral/provider/XyoWallet.d.ts +1 -2
- package/dist/neutral/provider/XyoWallet.d.ts.map +1 -1
- package/dist/neutral/provider/permissions/InvokerPermission.d.ts +1 -1
- package/dist/neutral/provider/signer/XyoSigner.d.ts +1 -2
- package/dist/neutral/provider/signer/XyoSigner.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/NetworkStakeViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/NetworkStakeViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStakerViewer.d.ts +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/ByStakerViewer.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Options.d.ts +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/Options.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.d.ts +1 -1
- package/dist/neutral/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.d.ts.map +1 -1
- package/dist/neutral/provider/viewer/StepViewer.d.ts +1 -2
- package/dist/neutral/provider/viewer/StepViewer.d.ts.map +1 -1
- package/dist/neutral/services/AccountTransfersService.d.ts +1 -2
- package/dist/neutral/services/AccountTransfersService.d.ts.map +1 -1
- package/dist/neutral/services/BlockRewardService.d.ts +1 -1
- package/dist/neutral/services/BlockRewardService.d.ts.map +1 -1
- package/dist/neutral/services/BlockRewardServiceV2.d.ts +1 -1
- package/dist/neutral/services/BlockRewardServiceV2.d.ts.map +1 -1
- package/dist/neutral/services/Chain/ChainHeadService.d.ts +1 -1
- package/dist/neutral/services/Chain/ChainHeadService.d.ts.map +1 -1
- package/dist/neutral/services/ChainIterator/ChainIteratorService.d.ts +1 -3
- package/dist/neutral/services/ChainIterator/ChainIteratorService.d.ts.map +1 -1
- package/dist/neutral/services/ChainIterator/ChainIteratorServiceEventData.d.ts +1 -1
- package/dist/neutral/services/Election.d.ts +1 -1
- package/dist/neutral/services/Election.d.ts.map +1 -1
- package/dist/neutral/services/Params.d.ts +1 -1
- package/dist/neutral/services/Params.d.ts.map +1 -1
- package/dist/neutral/services/PendingTransactionsService.d.ts +1 -1
- package/dist/neutral/services/PendingTransactionsService.d.ts.map +1 -1
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts +3 -4
- package/dist/neutral/services/StakeIntentService/ChainIndexingServiceStateSchema.d.ts.map +1 -1
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts +1 -1
- package/dist/neutral/services/StakeIntentService/StakeIntentService.d.ts.map +1 -1
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +17 -0
- package/dist/neutral/simple/accountBalance/SimpleAccountBalanceViewer.d.ts.map +1 -0
- package/dist/neutral/simple/accountBalance/index.d.ts +2 -0
- package/dist/neutral/simple/accountBalance/index.d.ts.map +1 -0
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts +1 -1
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts.map +1 -1
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts +1 -1
- package/dist/neutral/simple/datalake/SimpleDataLakeViewer.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGateway.d.ts.map +1 -1
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts +5 -5
- package/dist/neutral/simple/gateway/SimpleXyoGatewayRunner.d.ts.map +1 -1
- package/dist/neutral/simple/index.d.ts +2 -0
- package/dist/neutral/simple/index.d.ts.map +1 -1
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts +1 -1
- package/dist/neutral/simple/runner/SimpleXyoRunner.d.ts.map +1 -1
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts +1 -2
- package/dist/neutral/simple/signer/SimpleXyoSigner.d.ts.map +1 -1
- package/dist/neutral/simple/timesync/SimpleTimeSyncViewer.d.ts +14 -0
- package/dist/neutral/simple/timesync/SimpleTimeSyncViewer.d.ts.map +1 -0
- package/dist/neutral/simple/timesync/index.d.ts +2 -0
- package/dist/neutral/simple/timesync/index.d.ts.map +1 -0
- package/dist/neutral/transaction/buildTransaction.d.ts +1 -1
- package/dist/neutral/transaction/buildTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts +1 -1
- package/dist/neutral/transaction/buildUnsignedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts +1 -1
- package/dist/neutral/transaction/confirmSubmittedTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/hydrateTransaction.d.ts +1 -1
- package/dist/neutral/transaction/hydrateTransaction.d.ts.map +1 -1
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts +1 -1
- package/dist/neutral/transaction/primitives/transactionElevatedPayloads.d.ts.map +1 -1
- package/dist/neutral/transaction/script.d.ts +1 -1
- package/dist/neutral/transaction/script.d.ts.map +1 -1
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts +1 -1
- package/dist/neutral/validation/block/BlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts +1 -1
- package/dist/neutral/validation/block/HydratedBlockStateValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts +1 -1
- package/dist/neutral/validation/block/HydratedBlockValidationFunction.d.ts.map +1 -1
- package/dist/neutral/validation/block/error.d.ts +1 -1
- package/dist/neutral/validation/block/error.d.ts.map +1 -1
- package/dist/neutral/viewers/AccountBalance.d.ts +5 -10
- package/dist/neutral/viewers/AccountBalance.d.ts.map +1 -1
- package/dist/neutral/viewers/Block.d.ts +6 -5
- package/dist/neutral/viewers/Block.d.ts.map +1 -1
- package/dist/neutral/viewers/Chain.d.ts +1 -1
- package/dist/neutral/viewers/Chain.d.ts.map +1 -1
- package/dist/neutral/viewers/ChainContract.d.ts +1 -1
- package/dist/neutral/viewers/ChainContract.d.ts.map +1 -1
- package/dist/neutral/viewers/Fork.d.ts +1 -1
- package/dist/neutral/viewers/Fork.d.ts.map +1 -1
- package/dist/neutral/viewers/NetworkStakeStepReward.d.ts +1 -2
- package/dist/neutral/viewers/NetworkStakeStepReward.d.ts.map +1 -1
- package/dist/neutral/viewers/Stake.d.ts +22 -3
- package/dist/neutral/viewers/Stake.d.ts.map +1 -1
- package/dist/neutral/{model → viewers}/StakeEvents.d.ts +2 -4
- package/dist/neutral/viewers/StakeEvents.d.ts.map +1 -0
- package/dist/neutral/viewers/StakeTotals.d.ts +1 -2
- package/dist/neutral/viewers/StakeTotals.d.ts.map +1 -1
- package/dist/neutral/viewers/StepStake.d.ts +1 -2
- package/dist/neutral/viewers/StepStake.d.ts.map +1 -1
- package/dist/neutral/viewers/TimeSync.d.ts +2 -3
- package/dist/neutral/viewers/TimeSync.d.ts.map +1 -1
- package/dist/neutral/viewers/Transaction.d.ts +1 -2
- package/dist/neutral/viewers/Transaction.d.ts.map +1 -1
- package/dist/neutral/viewers/TransferBalance.d.ts +1 -2
- package/dist/neutral/viewers/TransferBalance.d.ts.map +1 -1
- package/dist/neutral/viewers/index.d.ts +1 -0
- package/dist/neutral/viewers/index.d.ts.map +1 -1
- package/package.json +16 -27
- package/src/SignedBigInt.ts +2 -2
- package/src/block/hydrate/allHashesPresent.ts +1 -1
- package/src/block/hydrate/blockPayloadsFromHydratedBlock.ts +1 -1
- package/src/block/hydrate/hydrateBlock.ts +2 -2
- package/src/block/hydrate/transactionsFromHydratedBlock.ts +1 -1
- package/src/block/hydrate/tryHydrateBlock.ts +2 -2
- package/src/block/primitives/blockFromBlockNumber.ts +3 -3
- package/src/block/primitives/frames/calculateFramesFromRange.ts +3 -2
- package/src/block/primitives/hashFromBlockNumber.ts +1 -1
- package/src/block/primitives/payloads/ChainWindow.ts +1 -1
- package/src/block/primitives/transfers/transfersStepSummaryFromRange.ts +2 -2
- package/src/block/primitives/transfers/transfersSummary.ts +6 -4
- package/src/config/Log.ts +2 -2
- package/src/config/Producer.ts +1 -1
- package/src/config/Validation.ts +1 -1
- package/src/config/storage/driver/Mongo.ts +1 -1
- package/src/driver/memory/MemoryMap.ts +1 -1
- package/src/eip-712/Payloads/EIP712Data.ts +1 -1
- package/src/eip-712/Payloads/EIP712Signature.ts +1 -2
- package/src/eip-712/verify.ts +1 -2
- package/src/instances/Address.ts +1 -2
- package/src/instances/Object.ts +1 -1
- package/src/instances/Signature.ts +1 -1
- package/src/instances/modifiers/BlockWindowInstance.ts +1 -1
- package/src/instances/modifiers/Validatable.ts +1 -1
- package/src/instances/transaction/TransactionFields.ts +1 -1
- package/src/map/AsynchronousMap.ts +1 -1
- package/src/model/ChainContext/ChainContext.ts +2 -2
- package/src/model/ChainContext/ChainStakeContext.ts +6 -5
- package/src/model/ChainContext/ChainStateContext.ts +1 -2
- package/src/model/ChainFork/ChainForkStatic.ts +1 -1
- package/src/model/PayloadMap.ts +1 -1
- package/src/model/Position.ts +1 -1
- package/src/model/index.ts +0 -2
- package/src/payloads/AddressPairPayload.ts +2 -2
- package/src/payloads/netBalancesForPayloads.ts +1 -1
- package/src/payloads/netTransfersForPayloads.ts +1 -1
- package/src/payloads/summary/BalancesStepSummary.ts +2 -2
- package/src/payloads/summary/StepSummary.ts +1 -2
- package/src/payloads/summary/TransfersSummary.ts +2 -2
- package/src/primitives/readPayloadMapFromStore.ts +2 -2
- package/src/primitives/step/completedStepRewardAddress.ts +1 -1
- package/src/primitives/step/derivedReceiveAddress.ts +2 -2
- package/src/primitives/step/stepBlockRange.ts +1 -1
- package/src/primitives/step/stepTransferIndex.ts +2 -2
- package/src/primitives/summary/balances/balancesStepSummaryFromRange.ts +2 -2
- package/src/primitives/summary/balances/balancesSummary.ts +6 -4
- package/src/primitives/summary/transfers/transfersStepSummaryFromRange.ts +2 -2
- package/src/primitives/summary/transfers/transfersSummary.ts +6 -4
- package/src/primitives/timeBudget.ts +1 -1
- package/src/provider/DataLake.ts +1 -1
- package/src/provider/TransactionSubmitter.ts +3 -2
- package/src/provider/XyoGateway.ts +1 -1
- package/src/provider/XyoGatewayRunner.ts +2 -3
- package/src/provider/XyoNetwork.ts +1 -1
- package/src/provider/XyoRunner.ts +1 -2
- package/src/provider/XyoWallet.ts +1 -2
- package/src/provider/permissions/InvokerPermission.ts +1 -1
- package/src/provider/signer/XyoSigner.ts +1 -2
- package/src/provider/viewer/NetworkStake/NetworkStakeViewer.ts +1 -1
- package/src/provider/viewer/NetworkStake/Rewards/ByStakerViewer.ts +1 -1
- package/src/provider/viewer/NetworkStake/Rewards/Options.ts +1 -1
- package/src/provider/viewer/NetworkStake/Rewards/templates/MethodsTemplate.ts +1 -1
- package/src/provider/viewer/StepViewer.ts +1 -2
- package/src/services/AccountTransfersService.ts +3 -2
- package/src/services/BlockRewardService.ts +1 -1
- package/src/services/BlockRewardServiceV2.ts +1 -1
- package/src/services/Chain/ChainHeadService.ts +1 -1
- package/src/services/ChainIterator/ChainIteratorService.ts +3 -3
- package/src/services/ChainIterator/ChainIteratorServiceEventData.ts +1 -1
- package/src/services/Election.ts +1 -1
- package/src/services/Params.ts +1 -1
- package/src/services/PendingTransactionsService.ts +1 -1
- package/src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts +2 -3
- package/src/services/StakeIntentService/StakeIntentService.ts +1 -1
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +124 -0
- package/src/simple/accountBalance/index.ts +1 -0
- package/src/simple/datalake/SimpleDataLakeRunner.ts +1 -1
- package/src/simple/datalake/SimpleDataLakeViewer.ts +1 -1
- package/src/simple/gateway/SimpleXyoGateway.ts +1 -1
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +19 -21
- package/src/simple/index.ts +2 -0
- package/src/simple/network/SimpleXyoNetwork.ts +1 -1
- package/src/simple/permissions/SimpleXyoPermissions.ts +1 -1
- package/src/simple/permissions/store/MemoryPermissions.ts +1 -1
- package/src/simple/runner/SimpleXyoRunner.ts +1 -1
- package/src/simple/signer/SimpleXyoSigner.ts +1 -2
- package/src/simple/timesync/SimpleTimeSyncViewer.ts +93 -0
- package/src/simple/timesync/index.ts +1 -0
- package/src/time/primitives/xl1BlockNumberToEthBlockNumber.ts +1 -1
- package/src/transaction/buildTransaction.ts +2 -3
- package/src/transaction/buildUnsignedTransaction.ts +2 -2
- package/src/transaction/confirmSubmittedTransaction.ts +2 -3
- package/src/transaction/hydrateTransaction.ts +2 -2
- package/src/transaction/primitives/spec/transactionBlockByteCount.spec.ts +1 -1
- package/src/transaction/primitives/transactionElevatedPayloads.ts +1 -1
- package/src/transaction/script.ts +2 -3
- package/src/transaction/signTransaction.ts +3 -3
- package/src/validation/block/BlockValidationFunction.ts +1 -1
- package/src/validation/block/HydratedBlockStateValidationFunction.ts +1 -1
- package/src/validation/block/HydratedBlockValidationFunction.ts +1 -1
- package/src/validation/block/error.spec.ts +1 -1
- package/src/validation/block/error.ts +1 -1
- package/src/viewers/AccountBalance.ts +7 -10
- package/src/viewers/Block.ts +6 -5
- package/src/viewers/Chain.ts +1 -1
- package/src/viewers/ChainContract.ts +1 -1
- package/src/viewers/Fork.ts +1 -1
- package/src/viewers/NetworkStakeStepReward.ts +1 -2
- package/src/viewers/Stake.ts +25 -4
- package/src/{model → viewers}/StakeEvents.ts +4 -4
- package/src/viewers/StakeTotals.ts +1 -2
- package/src/viewers/StepStake.ts +1 -2
- package/src/viewers/TimeSync.ts +2 -3
- package/src/viewers/Transaction.ts +1 -2
- package/src/viewers/TransferBalance.ts +1 -2
- package/src/viewers/index.ts +1 -0
- package/src/wallet/spec/paths.spec.ts +1 -1
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts +0 -17
- package/dist/neutral/model/ChainStake/ChainStakeRead.d.ts.map +0 -1
- package/dist/neutral/model/ChainStake/ChainStakeStatic.d.ts +0 -7
- package/dist/neutral/model/ChainStake/ChainStakeStatic.d.ts.map +0 -1
- package/dist/neutral/model/ChainStake/ChainStakeWrite.d.ts +0 -6
- package/dist/neutral/model/ChainStake/ChainStakeWrite.d.ts.map +0 -1
- package/dist/neutral/model/ChainStake/index.d.ts +0 -4
- package/dist/neutral/model/ChainStake/index.d.ts.map +0 -1
- package/dist/neutral/model/StakeEvents.d.ts.map +0 -1
- package/src/model/ChainStake/ChainStakeRead.ts +0 -18
- package/src/model/ChainStake/ChainStakeStatic.ts +0 -7
- package/src/model/ChainStake/ChainStakeWrite.ts +0 -5
- package/src/model/ChainStake/index.ts +0 -3
package/dist/neutral/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ function allHashesPresent(hashes, payloads) {
|
|
|
9
9
|
__name(allHashesPresent, "allHashesPresent");
|
|
10
10
|
|
|
11
11
|
// src/block/hydrate/blockPayloadsFromHydratedBlock.ts
|
|
12
|
-
import { assertEx } from "@xylabs/
|
|
12
|
+
import { assertEx } from "@xylabs/sdk-js";
|
|
13
13
|
import { isTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
14
14
|
var blockPayloadsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
15
15
|
return block[0].payload_hashes.map((hash) => assertEx(block[1].find((p) => p._hash === hash), () => `missing payload ${hash}`)).filter((x) => !isTransactionBoundWitnessWithStorageMeta(x));
|
|
@@ -28,7 +28,7 @@ var flattenHydratedBlock = /* @__PURE__ */ __name((hydratedBlock) => {
|
|
|
28
28
|
var flattenHydratedBlocks = /* @__PURE__ */ __name((hydratedBlocks) => hydratedBlocks.flatMap((blk) => flattenHydratedBlock(blk)), "flattenHydratedBlocks");
|
|
29
29
|
|
|
30
30
|
// src/block/hydrate/hydrateBlock.ts
|
|
31
|
-
import { assertEx as assertEx2 } from "@xylabs/
|
|
31
|
+
import { assertEx as assertEx2 } from "@xylabs/sdk-js";
|
|
32
32
|
import { asBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta2 } from "@xyo-network/xl1-protocol";
|
|
33
33
|
var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth = 1, minDepth = maxDepth) => {
|
|
34
34
|
assertEx2(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
@@ -67,14 +67,14 @@ var hydrateBlock = /* @__PURE__ */ __name(async ({ chainMap }, hash, maxDepth =
|
|
|
67
67
|
}, "hydrateBlock");
|
|
68
68
|
|
|
69
69
|
// src/block/hydrate/transactionsFromHydratedBlock.ts
|
|
70
|
-
import { filterAs } from "@xylabs/
|
|
70
|
+
import { filterAs } from "@xylabs/sdk-js";
|
|
71
71
|
import { asTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
72
72
|
var transactionsFromHydratedBlock = /* @__PURE__ */ __name((block) => {
|
|
73
73
|
return filterAs(block[1], asTransactionBoundWitnessWithStorageMeta);
|
|
74
74
|
}, "transactionsFromHydratedBlock");
|
|
75
75
|
|
|
76
76
|
// src/block/hydrate/tryHydrateBlock.ts
|
|
77
|
-
import { assertEx as assertEx3 } from "@xylabs/
|
|
77
|
+
import { assertEx as assertEx3 } from "@xylabs/sdk-js";
|
|
78
78
|
import { isBlockBoundWitnessWithStorageMeta, isTransactionBoundWitnessWithStorageMeta as isTransactionBoundWitnessWithStorageMeta3 } from "@xyo-network/xl1-protocol";
|
|
79
79
|
var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth = 1) => {
|
|
80
80
|
assertEx3(maxDepth >= 0, () => "maxDepth must be greater than or equal to 0");
|
|
@@ -109,12 +109,12 @@ var tryHydrateBlock = /* @__PURE__ */ __name(async (archivist, hash, maxDepth =
|
|
|
109
109
|
}, "tryHydrateBlock");
|
|
110
110
|
|
|
111
111
|
// src/block/primitives/blockFromBlockNumber.ts
|
|
112
|
-
import { asHash } from "@xylabs/
|
|
113
|
-
import { toSafeJsonString } from "@xylabs/
|
|
112
|
+
import { asHash } from "@xylabs/sdk-js";
|
|
113
|
+
import { toSafeJsonString } from "@xylabs/sdk-js";
|
|
114
114
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta2, StepSizes } from "@xyo-network/xl1-protocol";
|
|
115
115
|
|
|
116
116
|
// src/model/ChainContext/ChainContext.ts
|
|
117
|
-
import { isDefined as isDefined2, isUndefined } from "@xylabs/
|
|
117
|
+
import { isDefined as isDefined2, isUndefined } from "@xylabs/sdk-js";
|
|
118
118
|
|
|
119
119
|
// src/driver/cache/LruCacheMap.ts
|
|
120
120
|
import { LRUCache } from "lru-cache";
|
|
@@ -161,7 +161,7 @@ var LruCacheMap = class {
|
|
|
161
161
|
};
|
|
162
162
|
|
|
163
163
|
// src/driver/memory/MemoryMap.ts
|
|
164
|
-
import { isDefined } from "@xylabs/
|
|
164
|
+
import { isDefined } from "@xylabs/sdk-js";
|
|
165
165
|
var MemoryMap = class {
|
|
166
166
|
static {
|
|
167
167
|
__name(this, "MemoryMap");
|
|
@@ -227,13 +227,6 @@ async function withContextCacheResponse(context, name, key, func, options) {
|
|
|
227
227
|
}
|
|
228
228
|
__name(withContextCacheResponse, "withContextCacheResponse");
|
|
229
229
|
|
|
230
|
-
// src/model/StakeEvents.ts
|
|
231
|
-
var StakeEventNames = [
|
|
232
|
-
"StakeAdded",
|
|
233
|
-
"StakeRemoved",
|
|
234
|
-
"StakeWithdrawn"
|
|
235
|
-
];
|
|
236
|
-
|
|
237
230
|
// src/block/primitives/blockFromBlockNumber.ts
|
|
238
231
|
async function blockFromBlockNumber(context, blockNumber) {
|
|
239
232
|
const cacheKey = `${blockNumber}`;
|
|
@@ -244,7 +237,7 @@ async function blockFromBlockNumber(context, blockNumber) {
|
|
|
244
237
|
required: true
|
|
245
238
|
});
|
|
246
239
|
if (currentBlock.block < blockNumber) {
|
|
247
|
-
throw new Error(`
|
|
240
|
+
throw new Error(`Block number ${blockNumber} is greater than head ${currentBlock.block}.`);
|
|
248
241
|
}
|
|
249
242
|
while (currentBlock.block > blockNumber) {
|
|
250
243
|
let jumpHash = currentBlock.previous;
|
|
@@ -289,12 +282,18 @@ function calculateFramesFromRange(range, step) {
|
|
|
289
282
|
for (let i = start; i <= range[1]; i += size) {
|
|
290
283
|
if (i + size - 1 <= range[1]) {
|
|
291
284
|
fitted.push([
|
|
292
|
-
asXL1BlockNumber(i,
|
|
293
|
-
|
|
285
|
+
asXL1BlockNumber(i, {
|
|
286
|
+
name: "calculateFramesFromRange A"
|
|
287
|
+
}),
|
|
288
|
+
asXL1BlockNumber(Math.min(i + size - 1, range[1]), {
|
|
289
|
+
name: "calculateFramesFromRange B"
|
|
290
|
+
})
|
|
294
291
|
]);
|
|
295
292
|
} else {
|
|
296
293
|
remaining.push([
|
|
297
|
-
asXL1BlockNumber(i,
|
|
294
|
+
asXL1BlockNumber(i, {
|
|
295
|
+
name: "calculateFramesFromRange C"
|
|
296
|
+
}),
|
|
298
297
|
range[1]
|
|
299
298
|
]);
|
|
300
299
|
}
|
|
@@ -361,13 +360,13 @@ function toStepIdentityString({ block, step }) {
|
|
|
361
360
|
__name(toStepIdentityString, "toStepIdentityString");
|
|
362
361
|
|
|
363
362
|
// src/block/primitives/transfers/transfersStepSummaryFromRange.ts
|
|
364
|
-
import { assertEx as assertEx4 } from "@xylabs/
|
|
363
|
+
import { assertEx as assertEx4 } from "@xylabs/sdk-js";
|
|
365
364
|
import { PayloadBuilder } from "@xyo-network/payload-builder";
|
|
366
365
|
import { isAnyPayload } from "@xyo-network/payload-model";
|
|
367
366
|
import { StepSizes as StepSizes3 } from "@xyo-network/xl1-protocol";
|
|
368
367
|
|
|
369
368
|
// src/payloads/AddressPairPayload.ts
|
|
370
|
-
import { AsObjectFactory } from "@xylabs/
|
|
369
|
+
import { AsObjectFactory } from "@xylabs/sdk-js";
|
|
371
370
|
import { isPayloadOfSchemaType } from "@xyo-network/payload-model";
|
|
372
371
|
var AddressPairSchema = "network.xyo.address.pair";
|
|
373
372
|
var isAddressPairPayload = isPayloadOfSchemaType(AddressPairSchema);
|
|
@@ -375,7 +374,7 @@ var asAddressPairPayload = AsObjectFactory.create(isAddressPairPayload);
|
|
|
375
374
|
var asOptionalAddressPairPayload = AsObjectFactory.createOptional(isAddressPairPayload);
|
|
376
375
|
|
|
377
376
|
// src/payloads/netBalancesForPayloads.ts
|
|
378
|
-
import { hexToBigInt, toAddress } from "@xylabs/
|
|
377
|
+
import { hexToBigInt, toAddress } from "@xylabs/sdk-js";
|
|
379
378
|
import { span } from "@xylabs/telemetry";
|
|
380
379
|
import { isTransfer } from "@xyo-network/xl1-protocol";
|
|
381
380
|
var netBalancesForPayloads = /* @__PURE__ */ __name((payloads) => {
|
|
@@ -395,7 +394,7 @@ var netBalancesForPayloads = /* @__PURE__ */ __name((payloads) => {
|
|
|
395
394
|
}, "netBalancesForPayloads");
|
|
396
395
|
|
|
397
396
|
// src/payloads/netTransfersForPayloads.ts
|
|
398
|
-
import { hexToBigInt as hexToBigInt2 } from "@xylabs/
|
|
397
|
+
import { hexToBigInt as hexToBigInt2 } from "@xylabs/sdk-js";
|
|
399
398
|
import { span as span2 } from "@xylabs/telemetry";
|
|
400
399
|
import { isTransfer as isTransfer2 } from "@xyo-network/xl1-protocol";
|
|
401
400
|
function netTransfersForPayloads(payloads) {
|
|
@@ -418,7 +417,7 @@ function netTransfersForPayloads(payloads) {
|
|
|
418
417
|
__name(netTransfersForPayloads, "netTransfersForPayloads");
|
|
419
418
|
|
|
420
419
|
// src/payloads/summary/BalancesStepSummary.ts
|
|
421
|
-
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/
|
|
420
|
+
import { AsObjectFactory as AsObjectFactory2 } from "@xylabs/sdk-js";
|
|
422
421
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType2, isStorageMeta } from "@xyo-network/payload-model";
|
|
423
422
|
var BalancesStepSummarySchema = "network.xyo.step.summary.balances";
|
|
424
423
|
var isBalancesStepSummary = isPayloadOfSchemaType2(BalancesStepSummarySchema);
|
|
@@ -432,7 +431,7 @@ var asBalancesStepSummaryWithStorageMeta = AsObjectFactory2.create(isBalancesSte
|
|
|
432
431
|
var StepSummarySchema = "network.xyo.step.summary";
|
|
433
432
|
|
|
434
433
|
// src/payloads/summary/TransfersSummary.ts
|
|
435
|
-
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/
|
|
434
|
+
import { AsObjectFactory as AsObjectFactory3 } from "@xylabs/sdk-js";
|
|
436
435
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType3, isStorageMeta as isStorageMeta2 } from "@xyo-network/payload-model";
|
|
437
436
|
var TransfersStepSummarySchema = "network.xyo.step.summary.transfer";
|
|
438
437
|
var isTransfersStepSummary = isPayloadOfSchemaType3(TransfersStepSummarySchema);
|
|
@@ -443,8 +442,8 @@ var isTransfersStepSummaryWithStorageMeta = /* @__PURE__ */ __name((value) => {
|
|
|
443
442
|
var asTransfersStepSummaryWithStorageMeta = AsObjectFactory3.create(isTransfersStepSummaryWithStorageMeta);
|
|
444
443
|
|
|
445
444
|
// src/SignedBigInt.ts
|
|
446
|
-
import { hexToBigInt as hexToBigInt3, toHex } from "@xylabs/
|
|
447
|
-
import { isObject } from "@xylabs/
|
|
445
|
+
import { hexToBigInt as hexToBigInt3, toHex } from "@xylabs/sdk-js";
|
|
446
|
+
import { isObject } from "@xylabs/sdk-js";
|
|
448
447
|
var isNegativeBigInt = /* @__PURE__ */ __name((value) => {
|
|
449
448
|
return isObject(value) && "negative" in value && typeof value.negative === "string";
|
|
450
449
|
}, "isNegativeBigInt");
|
|
@@ -487,9 +486,8 @@ var toPositiveBigInt = /* @__PURE__ */ __name((value) => {
|
|
|
487
486
|
}, "toPositiveBigInt");
|
|
488
487
|
|
|
489
488
|
// src/block/primitives/transfers/transfersSummary.ts
|
|
490
|
-
import { asAddress } from "@xylabs/
|
|
489
|
+
import { asAddress, isDefined as isDefined3 } from "@xylabs/sdk-js";
|
|
491
490
|
import { spanRootAsync } from "@xylabs/telemetry";
|
|
492
|
-
import { isDefined as isDefined3 } from "@xylabs/typeof";
|
|
493
491
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta3, asXL1BlockNumber as asXL1BlockNumber2, asXL1BlockRange } from "@xyo-network/xl1-protocol";
|
|
494
492
|
async function transfersSummary(transferContext) {
|
|
495
493
|
return await spanRootAsync("transferSummary", async () => {
|
|
@@ -502,7 +500,9 @@ async function transfersSummary(transferContext) {
|
|
|
502
500
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange([
|
|
503
501
|
rangeStart,
|
|
504
502
|
headBoundWitness.block
|
|
505
|
-
],
|
|
503
|
+
], {
|
|
504
|
+
name: "transfersSummary"
|
|
505
|
+
}));
|
|
506
506
|
const summaries = await Promise.all(ranges.map((range) => transfersStepSummaryFromRange(transferContext, range)));
|
|
507
507
|
const transfers = {};
|
|
508
508
|
for (let summary of summaries) {
|
|
@@ -768,7 +768,7 @@ var EvmConfigZod = z6.object({
|
|
|
768
768
|
});
|
|
769
769
|
|
|
770
770
|
// src/config/Log.ts
|
|
771
|
-
import { LogLevel } from "@xylabs/
|
|
771
|
+
import { LogLevel } from "@xylabs/sdk-js";
|
|
772
772
|
import { globalRegistry as globalRegistry6 } from "zod";
|
|
773
773
|
import * as z7 from "zod";
|
|
774
774
|
var LogLevels = Object.keys(LogLevel);
|
|
@@ -838,7 +838,7 @@ var MempoolConfigZod = z8.object({
|
|
|
838
838
|
});
|
|
839
839
|
|
|
840
840
|
// src/config/Producer.ts
|
|
841
|
-
import { AddressZod, asAddress as asAddress2 } from "@xylabs/
|
|
841
|
+
import { AddressZod, asAddress as asAddress2 } from "@xylabs/sdk-js";
|
|
842
842
|
import { globalRegistry as globalRegistry8 } from "zod";
|
|
843
843
|
import * as z9 from "zod";
|
|
844
844
|
var ProducerConfigZod = z9.object({
|
|
@@ -924,7 +924,7 @@ var RewardRedemptionApiConfigZod = z10.object({
|
|
|
924
924
|
});
|
|
925
925
|
|
|
926
926
|
// src/config/storage/driver/Mongo.ts
|
|
927
|
-
import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/
|
|
927
|
+
import { isDefined as isDefined4, isUndefined as isUndefined2 } from "@xylabs/sdk-js";
|
|
928
928
|
import { globalRegistry as globalRegistry10 } from "zod";
|
|
929
929
|
import * as z11 from "zod";
|
|
930
930
|
var hasMongoConfig = /* @__PURE__ */ __name((config) => {
|
|
@@ -989,7 +989,7 @@ var TelemetryConfigZod = z13.object({
|
|
|
989
989
|
}).describe("Telemetry configuration options");
|
|
990
990
|
|
|
991
991
|
// src/config/Validation.ts
|
|
992
|
-
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/
|
|
992
|
+
import { AddressZod as AddressZod2, asAddress as asAddress3 } from "@xylabs/sdk-js";
|
|
993
993
|
import { globalRegistry as globalRegistry13 } from "zod";
|
|
994
994
|
import * as z14 from "zod";
|
|
995
995
|
var ValidationConfigZod = z14.object({
|
|
@@ -1077,7 +1077,7 @@ var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_EPOCH = 1760572800;
|
|
|
1077
1077
|
var XL1_NETWORK_STAKING_GENESIS_PERIOD_END_XL1_BLOCK = 107496;
|
|
1078
1078
|
|
|
1079
1079
|
// src/eip-712/Payloads/EIP712Data.ts
|
|
1080
|
-
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/
|
|
1080
|
+
import { AsObjectFactory as AsObjectFactory4 } from "@xylabs/sdk-js";
|
|
1081
1081
|
import { isPayloadOfZodType } from "@xyo-network/payload-model";
|
|
1082
1082
|
import z18 from "zod";
|
|
1083
1083
|
|
|
@@ -1115,8 +1115,7 @@ var isEIP712DataPayload = isPayloadOfZodType(EIP712DataPayloadFieldsZod, EIP712D
|
|
|
1115
1115
|
var asEIP712DataPayload = AsObjectFactory4.create(isEIP712DataPayload);
|
|
1116
1116
|
|
|
1117
1117
|
// src/eip-712/Payloads/EIP712Signature.ts
|
|
1118
|
-
import { HashZod } from "@xylabs/
|
|
1119
|
-
import { AsObjectFactory as AsObjectFactory5 } from "@xylabs/object";
|
|
1118
|
+
import { AsObjectFactory as AsObjectFactory5, HashZod } from "@xylabs/sdk-js";
|
|
1120
1119
|
import { isPayloadOfZodType as isPayloadOfZodType2 } from "@xyo-network/payload-model";
|
|
1121
1120
|
import z19 from "zod";
|
|
1122
1121
|
var EIP712SignaturePayloadFieldsZod = z19.object({
|
|
@@ -1144,8 +1143,7 @@ var signEIP712Message = /* @__PURE__ */ __name(async (signer, data) => {
|
|
|
1144
1143
|
}, "signEIP712Message");
|
|
1145
1144
|
|
|
1146
1145
|
// src/eip-712/verify.ts
|
|
1147
|
-
import { asHash as asHash2 } from "@xylabs/
|
|
1148
|
-
import { isUndefined as isUndefined3 } from "@xylabs/typeof";
|
|
1146
|
+
import { asHash as asHash2, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
|
|
1149
1147
|
import { PayloadBuilder as PayloadBuilder3 } from "@xyo-network/payload-builder";
|
|
1150
1148
|
import { verifyTypedData } from "ethers/hash";
|
|
1151
1149
|
var verifyEIP712Message = /* @__PURE__ */ __name(async (data, sig) => {
|
|
@@ -1170,7 +1168,7 @@ var RewardMultipliers = {
|
|
|
1170
1168
|
};
|
|
1171
1169
|
|
|
1172
1170
|
// src/primitives/readPayloadMapFromStore.ts
|
|
1173
|
-
import { isDefined as isDefined5 } from "@xylabs/
|
|
1171
|
+
import { isDefined as isDefined5 } from "@xylabs/sdk-js";
|
|
1174
1172
|
function readPayloadMapFromStore(store) {
|
|
1175
1173
|
if (isReadArchivist(store)) {
|
|
1176
1174
|
return {
|
|
@@ -1194,7 +1192,7 @@ function readPayloadMapFromStore(store) {
|
|
|
1194
1192
|
__name(readPayloadMapFromStore, "readPayloadMapFromStore");
|
|
1195
1193
|
|
|
1196
1194
|
// src/primitives/step/completedStepRewardAddress.ts
|
|
1197
|
-
import { toAddress as toAddress2 } from "@xylabs/
|
|
1195
|
+
import { toAddress as toAddress2 } from "@xylabs/sdk-js";
|
|
1198
1196
|
import { StepSizes as StepSizes4 } from "@xyo-network/xl1-protocol";
|
|
1199
1197
|
import { keccak256 } from "ethers";
|
|
1200
1198
|
function completedStepRewardAddress({ block, step }) {
|
|
@@ -1207,8 +1205,8 @@ function completedStepRewardAddress({ block, step }) {
|
|
|
1207
1205
|
__name(completedStepRewardAddress, "completedStepRewardAddress");
|
|
1208
1206
|
|
|
1209
1207
|
// src/primitives/step/derivedReceiveAddress.ts
|
|
1210
|
-
import { toAddress as toAddress3 } from "@xylabs/
|
|
1211
|
-
import { isDefined as isDefined6 } from "@xylabs/
|
|
1208
|
+
import { toAddress as toAddress3 } from "@xylabs/sdk-js";
|
|
1209
|
+
import { isDefined as isDefined6 } from "@xylabs/sdk-js";
|
|
1212
1210
|
import { keccak256 as keccak2562 } from "ethers";
|
|
1213
1211
|
function derivedReceiveAddress(address, scope) {
|
|
1214
1212
|
const addressKey = new TextEncoder().encode(isDefined6(scope) ? `${scope}|${address}` : address);
|
|
@@ -1226,12 +1224,14 @@ function stepBlockRange({ block, step }) {
|
|
|
1226
1224
|
return asXL1BlockRange2([
|
|
1227
1225
|
start,
|
|
1228
1226
|
start + stepSize2 - 1
|
|
1229
|
-
],
|
|
1227
|
+
], {
|
|
1228
|
+
name: "stepBlockRange"
|
|
1229
|
+
});
|
|
1230
1230
|
}
|
|
1231
1231
|
__name(stepBlockRange, "stepBlockRange");
|
|
1232
1232
|
|
|
1233
1233
|
// src/primitives/step/stepTransferIndex.ts
|
|
1234
|
-
import { assertEx as assertEx5 } from "@xylabs/
|
|
1234
|
+
import { assertEx as assertEx5 } from "@xylabs/sdk-js";
|
|
1235
1235
|
import { StepSizes as StepSizes6 } from "@xyo-network/xl1-protocol";
|
|
1236
1236
|
function stepTransferIndex(block, step) {
|
|
1237
1237
|
let rewardTransferCount = 0;
|
|
@@ -1245,7 +1245,7 @@ function stepTransferIndex(block, step) {
|
|
|
1245
1245
|
rewardTransferCount++;
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
|
-
assertEx5(rewardTransferIndex >= 0, () => `
|
|
1248
|
+
assertEx5(rewardTransferIndex >= 0, () => `Could not find step size for step ${step} at block ${block}`);
|
|
1249
1249
|
return [
|
|
1250
1250
|
rewardTransferIndex,
|
|
1251
1251
|
rewardTransferCount
|
|
@@ -1254,7 +1254,7 @@ function stepTransferIndex(block, step) {
|
|
|
1254
1254
|
__name(stepTransferIndex, "stepTransferIndex");
|
|
1255
1255
|
|
|
1256
1256
|
// src/primitives/summary/balances/balancesStepSummaryFromRange.ts
|
|
1257
|
-
import { assertEx as assertEx6 } from "@xylabs/
|
|
1257
|
+
import { assertEx as assertEx6 } from "@xylabs/sdk-js";
|
|
1258
1258
|
import { PayloadBuilder as PayloadBuilder4 } from "@xyo-network/payload-builder";
|
|
1259
1259
|
import { isAnyPayload as isAnyPayload2 } from "@xyo-network/payload-model";
|
|
1260
1260
|
import { StepSizes as StepSizes7 } from "@xyo-network/xl1-protocol";
|
|
@@ -1316,9 +1316,8 @@ async function balancesStepSummaryFromRange(context, range) {
|
|
|
1316
1316
|
__name(balancesStepSummaryFromRange, "balancesStepSummaryFromRange");
|
|
1317
1317
|
|
|
1318
1318
|
// src/primitives/summary/balances/balancesSummary.ts
|
|
1319
|
-
import { asAddress as asAddress4 } from "@xylabs/
|
|
1319
|
+
import { asAddress as asAddress4, isDefined as isDefined7 } from "@xylabs/sdk-js";
|
|
1320
1320
|
import { spanRootAsync as spanRootAsync2 } from "@xylabs/telemetry";
|
|
1321
|
-
import { isDefined as isDefined7 } from "@xylabs/typeof";
|
|
1322
1321
|
import { asBlockBoundWitnessWithStorageMeta as asBlockBoundWitnessWithStorageMeta4, asXL1BlockNumber as asXL1BlockNumber3, asXL1BlockRange as asXL1BlockRange3 } from "@xyo-network/xl1-protocol";
|
|
1323
1322
|
async function balancesSummary(context) {
|
|
1324
1323
|
return await spanRootAsync2("balanceSummary", async () => {
|
|
@@ -1331,7 +1330,9 @@ async function balancesSummary(context) {
|
|
|
1331
1330
|
const ranges = deepCalculateFramesFromRange(asXL1BlockRange3([
|
|
1332
1331
|
rangeStart,
|
|
1333
1332
|
headBoundWitness.block
|
|
1334
|
-
],
|
|
1333
|
+
], {
|
|
1334
|
+
name: "balancesSummary"
|
|
1335
|
+
}));
|
|
1335
1336
|
const summaries = await Promise.all(ranges.map((range) => balancesStepSummaryFromRange(context, range)));
|
|
1336
1337
|
const balances = {};
|
|
1337
1338
|
for (let summary of summaries) {
|
|
@@ -1380,7 +1381,7 @@ function elevatedPayloads([tx, payloads]) {
|
|
|
1380
1381
|
__name(elevatedPayloads, "elevatedPayloads");
|
|
1381
1382
|
|
|
1382
1383
|
// src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts
|
|
1383
|
-
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/
|
|
1384
|
+
import { AsObjectFactory as AsObjectFactory6 } from "@xylabs/sdk-js";
|
|
1384
1385
|
import { isPayloadOfSchemaType as isPayloadOfSchemaType4, isStorageMeta as isStorageMeta3 } from "@xyo-network/payload-model";
|
|
1385
1386
|
var ChainIndexingServiceStateSchema = "network.xyo.chain.indexing.service.state";
|
|
1386
1387
|
var isChainIndexingServiceState = /* @__PURE__ */ __name((payload) => {
|
|
@@ -1390,6 +1391,117 @@ var asChainIndexingServiceState = AsObjectFactory6.create(isChainIndexingService
|
|
|
1390
1391
|
var isChainIndexingServiceStateWithStorageMeta = /* @__PURE__ */ __name((value) => isChainIndexingServiceState(value) && isStorageMeta3(value), "isChainIndexingServiceStateWithStorageMeta");
|
|
1391
1392
|
var asChainIndexingServiceStateWithStorageMeta = AsObjectFactory6.create(isChainIndexingServiceStateWithStorageMeta);
|
|
1392
1393
|
|
|
1394
|
+
// src/simple/accountBalance/SimpleAccountBalanceViewer.ts
|
|
1395
|
+
import { assertEx as assertEx7, exists, isDefined as isDefined8 } from "@xylabs/sdk-js";
|
|
1396
|
+
import { spanRootAsync as spanRootAsync3 } from "@xylabs/telemetry";
|
|
1397
|
+
import { asRange, asXL1BlockNumber as asXL1BlockNumber4, asXL1BlockRange as asXL1BlockRange4, AttoXL1, StepSizes as StepSizes8, TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1398
|
+
var SimpleAccountBalanceViewer = class {
|
|
1399
|
+
static {
|
|
1400
|
+
__name(this, "SimpleAccountBalanceViewer");
|
|
1401
|
+
}
|
|
1402
|
+
blockViewer;
|
|
1403
|
+
context;
|
|
1404
|
+
transferContext;
|
|
1405
|
+
constructor(context, transferContext, blockViewer) {
|
|
1406
|
+
this.context = context;
|
|
1407
|
+
this.transferContext = transferContext;
|
|
1408
|
+
this.blockViewer = blockViewer;
|
|
1409
|
+
}
|
|
1410
|
+
async accountBalance(address, headOrRange) {
|
|
1411
|
+
const balances = await this.accountBalances([
|
|
1412
|
+
address
|
|
1413
|
+
], headOrRange);
|
|
1414
|
+
return balances[address] ?? AttoXL1(0n);
|
|
1415
|
+
}
|
|
1416
|
+
async accountBalanceHistory(address, headOrRange) {
|
|
1417
|
+
const range = asRange(headOrRange);
|
|
1418
|
+
const startingRange = asXL1BlockRange4(range ?? [
|
|
1419
|
+
0,
|
|
1420
|
+
await this.blockViewer.currentBlockNumber()
|
|
1421
|
+
], true);
|
|
1422
|
+
const blockNumbers = await this.distillTransferHistory(address, startingRange);
|
|
1423
|
+
const blocks = (await Promise.all(blockNumbers.map(async (bn) => await this.blockViewer.blockByNumber(bn)))).filter(exists);
|
|
1424
|
+
const result = [];
|
|
1425
|
+
for (const block of blocks) {
|
|
1426
|
+
const transferIndexes = block[0].payload_schemas.map((schema, index) => schema === TransferSchema ? index : void 0).filter(exists);
|
|
1427
|
+
const transfers = transferIndexes.map((index) => {
|
|
1428
|
+
const hash = block[0].payload_hashes[index];
|
|
1429
|
+
return assertEx7(block[1].find((p) => p._hash === hash), () => `Error: Could not find Transfer with hash ${hash} in block ${block[0]._hash}`);
|
|
1430
|
+
}).filter(exists).filter((t) => t.from === address || isDefined8(t.transfers[address]));
|
|
1431
|
+
if (transfers.length === 0) {
|
|
1432
|
+
continue;
|
|
1433
|
+
}
|
|
1434
|
+
const pairs = transfers.map((transfer) => {
|
|
1435
|
+
return [
|
|
1436
|
+
block[0],
|
|
1437
|
+
transfer
|
|
1438
|
+
];
|
|
1439
|
+
});
|
|
1440
|
+
result.push(...pairs.map(([block2, transfer]) => [
|
|
1441
|
+
block2,
|
|
1442
|
+
null,
|
|
1443
|
+
transfer
|
|
1444
|
+
]));
|
|
1445
|
+
}
|
|
1446
|
+
return result;
|
|
1447
|
+
}
|
|
1448
|
+
async accountBalances(address, _headOrRange) {
|
|
1449
|
+
return await spanRootAsync3("balances", async () => {
|
|
1450
|
+
const summary = await balancesSummary(this.context);
|
|
1451
|
+
const result = {};
|
|
1452
|
+
for (const addr of address) {
|
|
1453
|
+
const summaryBalance = summary[addr] ?? 0n;
|
|
1454
|
+
result[addr] = AttoXL1(summaryBalance < 0n ? 0n : summaryBalance);
|
|
1455
|
+
}
|
|
1456
|
+
return result;
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
accountBalancesHistories(_addresses, _rangeOrHash) {
|
|
1460
|
+
throw new Error("Method not implemented.");
|
|
1461
|
+
}
|
|
1462
|
+
async distillTransferHistory(address, range, max = 50) {
|
|
1463
|
+
if (range[1] - range[0] <= StepSizes8[0] || max <= 1) {
|
|
1464
|
+
return Array.from({
|
|
1465
|
+
length: range[1] - range[0] + 1
|
|
1466
|
+
}, (_, i) => range[1] - i).slice(0, max).map((n) => asXL1BlockNumber4(n, true));
|
|
1467
|
+
}
|
|
1468
|
+
const frames = deepCalculateFramesFromRange(asXL1BlockRange4(range, true));
|
|
1469
|
+
const transferSummaryPairs = await Promise.all(frames.map(async (frame) => {
|
|
1470
|
+
return [
|
|
1471
|
+
frame,
|
|
1472
|
+
await transfersStepSummaryFromRange(this.transferContext, frame)
|
|
1473
|
+
];
|
|
1474
|
+
}));
|
|
1475
|
+
const filteredTransferSummaryPairs = transferSummaryPairs.filter(([_, summary]) => Object.keys(summary.transfers).includes(address));
|
|
1476
|
+
const sortedTransferSummaryPairs = filteredTransferSummaryPairs.toSorted((a, b) => {
|
|
1477
|
+
return b[0][1] - a[0][1];
|
|
1478
|
+
});
|
|
1479
|
+
const resultBlockNumbers = /* @__PURE__ */ new Set();
|
|
1480
|
+
for (const [frame] of sortedTransferSummaryPairs) {
|
|
1481
|
+
if (frame[1] - frame[0] + 1 > StepSizes8[0]) {
|
|
1482
|
+
const values = await this.distillTransferHistory(address, asXL1BlockRange4([
|
|
1483
|
+
frame[0],
|
|
1484
|
+
frame[1] - 1
|
|
1485
|
+
], true), max - resultBlockNumbers.size);
|
|
1486
|
+
for (const value of values) {
|
|
1487
|
+
resultBlockNumbers.add(value);
|
|
1488
|
+
}
|
|
1489
|
+
resultBlockNumbers.add(frame[1]);
|
|
1490
|
+
} else {
|
|
1491
|
+
for (let i = frame[0]; i <= frame[1]; i++) {
|
|
1492
|
+
resultBlockNumbers.add(i);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
if (resultBlockNumbers.size >= max) {
|
|
1496
|
+
break;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
return [
|
|
1500
|
+
...resultBlockNumbers
|
|
1501
|
+
].toSorted((a, b) => b - a).slice(0, max);
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1393
1505
|
// src/simple/client/SimpleXyoClient.ts
|
|
1394
1506
|
var SimpleXyoClient = class {
|
|
1395
1507
|
static {
|
|
@@ -1508,15 +1620,12 @@ var SimpleXyoGateway = class {
|
|
|
1508
1620
|
};
|
|
1509
1621
|
|
|
1510
1622
|
// src/simple/gateway/SimpleXyoGatewayRunner.ts
|
|
1511
|
-
import { assertEx as
|
|
1512
|
-
import { BigIntToJsonZod } from "@xylabs/hex";
|
|
1513
|
-
import { isDefined as isDefined9 } from "@xylabs/typeof";
|
|
1623
|
+
import { assertEx as assertEx12, BigIntToJsonZod, isDefined as isDefined10 } from "@xylabs/sdk-js";
|
|
1514
1624
|
import { PayloadBuilder as PayloadBuilder10 } from "@xyo-network/payload-builder";
|
|
1515
|
-
import { TransferSchema } from "@xyo-network/xl1-protocol";
|
|
1625
|
+
import { TransferSchema as TransferSchema2 } from "@xyo-network/xl1-protocol";
|
|
1516
1626
|
|
|
1517
1627
|
// src/transaction/buildTransaction.ts
|
|
1518
|
-
import { assertEx as
|
|
1519
|
-
import { toHex as toHex2 } from "@xylabs/hex";
|
|
1628
|
+
import { assertEx as assertEx8, toHex as toHex2 } from "@xylabs/sdk-js";
|
|
1520
1629
|
import { BoundWitnessBuilder } from "@xyo-network/boundwitness-builder";
|
|
1521
1630
|
import { PayloadBuilder as PayloadBuilder5 } from "@xyo-network/payload-builder";
|
|
1522
1631
|
import { defaultTransactionFees } from "@xyo-network/xl1-protocol";
|
|
@@ -1542,7 +1651,7 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
1542
1651
|
}
|
|
1543
1652
|
const fields = {
|
|
1544
1653
|
...txBoundWitnessFields,
|
|
1545
|
-
from: from ?? (Array.isArray(signer) ?
|
|
1654
|
+
from: from ?? (Array.isArray(signer) ? assertEx8(signer.at(0)?.address) : signer.address)
|
|
1546
1655
|
};
|
|
1547
1656
|
if (script.length > 0) {
|
|
1548
1657
|
fields.script = script;
|
|
@@ -1563,7 +1672,7 @@ async function buildTransaction(chain, onChainPayloads, offChainPayloads, signer
|
|
|
1563
1672
|
__name(buildTransaction, "buildTransaction");
|
|
1564
1673
|
|
|
1565
1674
|
// src/transaction/buildUnsignedTransaction.ts
|
|
1566
|
-
import { toHex as toHex3 } from "@xylabs/
|
|
1675
|
+
import { toHex as toHex3 } from "@xylabs/sdk-js";
|
|
1567
1676
|
import { BoundWitnessBuilder as BoundWitnessBuilder2 } from "@xyo-network/boundwitness-builder";
|
|
1568
1677
|
import { PayloadBuilder as PayloadBuilder6 } from "@xyo-network/payload-builder";
|
|
1569
1678
|
import { defaultTransactionFees as defaultTransactionFees2 } from "@xyo-network/xl1-protocol";
|
|
@@ -1605,8 +1714,7 @@ async function buildUnsignedTransaction(chain, onChainPayloads, offChainPayloads
|
|
|
1605
1714
|
__name(buildUnsignedTransaction, "buildUnsignedTransaction");
|
|
1606
1715
|
|
|
1607
1716
|
// src/transaction/confirmSubmittedTransaction.ts
|
|
1608
|
-
import { delay } from "@xylabs/
|
|
1609
|
-
import { isDefined as isDefined8 } from "@xylabs/typeof";
|
|
1717
|
+
import { delay, isDefined as isDefined9 } from "@xylabs/sdk-js";
|
|
1610
1718
|
import { PayloadBuilder as PayloadBuilder7 } from "@xyo-network/payload-builder";
|
|
1611
1719
|
var DEFAULT_CONFIRMATION_ATTEMPTS = 20;
|
|
1612
1720
|
var DEFAULT_DELAY_BETWEEN_ATTEMPTS = 1e3;
|
|
@@ -1617,7 +1725,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1617
1725
|
let attempts = 0;
|
|
1618
1726
|
while (true) {
|
|
1619
1727
|
const tx = await viewer.transactionByHash(txBWHash) ?? void 0;
|
|
1620
|
-
if (
|
|
1728
|
+
if (isDefined9(tx)) {
|
|
1621
1729
|
options?.logger?.log("\u2705 Transaction confirmed:", txBWHash, "\n");
|
|
1622
1730
|
return tx;
|
|
1623
1731
|
} else {
|
|
@@ -1634,7 +1742,7 @@ var confirmSubmittedTransaction = /* @__PURE__ */ __name(async (viewer, transact
|
|
|
1634
1742
|
}, "confirmSubmittedTransaction");
|
|
1635
1743
|
|
|
1636
1744
|
// src/transaction/hydrateTransaction.ts
|
|
1637
|
-
import { assertEx as
|
|
1745
|
+
import { assertEx as assertEx9 } from "@xylabs/sdk-js";
|
|
1638
1746
|
import { hydrateTypedBoundWitness, tryHydrateTypedBoundWitness } from "@xyo-network/archivist-model";
|
|
1639
1747
|
import { isAllowedBlockPayload as isAllowedBlockPayload2, isSignedTransactionBoundWitnessWithStorageMeta } from "@xyo-network/xl1-protocol";
|
|
1640
1748
|
var tryHydrateTransaction = /* @__PURE__ */ __name(async ({ chainMap }, hash) => {
|
|
@@ -1693,7 +1801,7 @@ var tryHydrateElevatedTransaction = /* @__PURE__ */ __name(async ({ chainMap },
|
|
|
1693
1801
|
return void 0;
|
|
1694
1802
|
}, "tryHydrateElevatedTransaction");
|
|
1695
1803
|
var hydrateElevatedTransaction = /* @__PURE__ */ __name(async (context, hash) => {
|
|
1696
|
-
return
|
|
1804
|
+
return assertEx9(await tryHydrateElevatedTransaction(context, hash), () => "Hydration failed");
|
|
1697
1805
|
}, "hydrateElevatedTransaction");
|
|
1698
1806
|
|
|
1699
1807
|
// src/transaction/primitives/transactionBlockByteCount.ts
|
|
@@ -1707,7 +1815,7 @@ function transactionBlockByteCount([transaction, payloads]) {
|
|
|
1707
1815
|
__name(transactionBlockByteCount, "transactionBlockByteCount");
|
|
1708
1816
|
|
|
1709
1817
|
// src/transaction/primitives/transactionElevatedPayloads.ts
|
|
1710
|
-
import { asHash as asHash3 } from "@xylabs/
|
|
1818
|
+
import { asHash as asHash3 } from "@xylabs/sdk-js";
|
|
1711
1819
|
|
|
1712
1820
|
// src/transaction/primitives/transactionOperations.ts
|
|
1713
1821
|
function crackOperation(operation) {
|
|
@@ -1740,27 +1848,26 @@ function transactionElevatedPayloads([transaction, payloads]) {
|
|
|
1740
1848
|
__name(transactionElevatedPayloads, "transactionElevatedPayloads");
|
|
1741
1849
|
|
|
1742
1850
|
// src/transaction/primitives/transactionRequiredGas.ts
|
|
1743
|
-
import { AttoXL1, TransactionGasCosts } from "@xyo-network/xl1-protocol";
|
|
1851
|
+
import { AttoXL1 as AttoXL12, TransactionGasCosts } from "@xyo-network/xl1-protocol";
|
|
1744
1852
|
function transactionBytesRequiredGas([transaction, payloads]) {
|
|
1745
1853
|
const transactionBlockBytes = transactionBlockByteCount([
|
|
1746
1854
|
transaction,
|
|
1747
1855
|
payloads
|
|
1748
1856
|
]);
|
|
1749
|
-
return
|
|
1857
|
+
return AttoXL12(TransactionGasCosts.characterStorage * BigInt(transactionBlockBytes));
|
|
1750
1858
|
}
|
|
1751
1859
|
__name(transactionBytesRequiredGas, "transactionBytesRequiredGas");
|
|
1752
1860
|
function transactionRequiredGas(hydratedTransaction) {
|
|
1753
1861
|
const elevatedPayloads2 = transactionElevatedPayloads(hydratedTransaction);
|
|
1754
1862
|
const hashes = elevatedPayloads2.length + 1;
|
|
1755
1863
|
const signatures = hydratedTransaction[0].addresses.length;
|
|
1756
|
-
return
|
|
1864
|
+
return AttoXL12(transactionBytesRequiredGas(hydratedTransaction) + TransactionGasCosts.hashValidation * BigInt(hashes) + TransactionGasCosts.signatureValidation * BigInt(signatures) + TransactionGasCosts.payloadValidation * BigInt(elevatedPayloads2.length));
|
|
1757
1865
|
}
|
|
1758
1866
|
__name(transactionRequiredGas, "transactionRequiredGas");
|
|
1759
1867
|
|
|
1760
1868
|
// src/transaction/script.ts
|
|
1761
|
-
import {
|
|
1762
|
-
import { assertEx as
|
|
1763
|
-
import { asHash as asHash4 } from "@xylabs/hex";
|
|
1869
|
+
import { asHash as asHash4 } from "@xylabs/sdk-js";
|
|
1870
|
+
import { assertEx as assertEx10, filterAs as filterAs2 } from "@xylabs/sdk-js";
|
|
1764
1871
|
import { isAllowedBlockPayloadWithHashMeta } from "@xyo-network/xl1-protocol";
|
|
1765
1872
|
var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1766
1873
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
@@ -1769,7 +1876,7 @@ var tryExtractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
|
1769
1876
|
var extractElevatedHashesFromScript = /* @__PURE__ */ __name((strings) => {
|
|
1770
1877
|
const hashes = strings.filter((str) => str.startsWith("elevate|")).map((str) => str.split("|")[1]);
|
|
1771
1878
|
const filtered = filterAs2(hashes, (h) => asHash4(h));
|
|
1772
|
-
|
|
1879
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1773
1880
|
return filtered;
|
|
1774
1881
|
}, "extractElevatedHashesFromScript");
|
|
1775
1882
|
var tryExtractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
@@ -1783,17 +1890,15 @@ var extractElevatedHashes = /* @__PURE__ */ __name((tx) => {
|
|
|
1783
1890
|
const { script } = bw;
|
|
1784
1891
|
const hashes = script ? tryExtractElevatedHashesFromScript(script) : [];
|
|
1785
1892
|
const filtered = payloads.filter((p) => hashes.includes(p._hash)).filter(isAllowedBlockPayloadWithHashMeta);
|
|
1786
|
-
|
|
1893
|
+
assertEx10(filtered.length === hashes.length, () => "Invalid elevated hashes");
|
|
1787
1894
|
return filtered;
|
|
1788
1895
|
}, "extractElevatedHashes");
|
|
1789
1896
|
|
|
1790
1897
|
// src/transaction/signTransaction.ts
|
|
1791
|
-
import { toArrayBuffer } from "@xylabs/
|
|
1792
|
-
import { assertEx as assertEx10 } from "@xylabs/assert";
|
|
1793
|
-
import { hexFromArrayBuffer } from "@xylabs/hex";
|
|
1898
|
+
import { assertEx as assertEx11, hexFromArrayBuffer, toArrayBuffer } from "@xylabs/sdk-js";
|
|
1794
1899
|
import { PayloadBuilder as PayloadBuilder9 } from "@xyo-network/payload-builder";
|
|
1795
1900
|
async function signTransaction(tx, account) {
|
|
1796
|
-
|
|
1901
|
+
assertEx11(tx.from === account.address, () => "Signer address does not match transaction from address");
|
|
1797
1902
|
const signedTx = structuredClone(tx);
|
|
1798
1903
|
signedTx.addresses = [
|
|
1799
1904
|
account.address
|
|
@@ -1816,53 +1921,55 @@ var SimpleXyoGatewayRunner = class {
|
|
|
1816
1921
|
static {
|
|
1817
1922
|
__name(this, "SimpleXyoGatewayRunner");
|
|
1818
1923
|
}
|
|
1819
|
-
|
|
1924
|
+
_connection;
|
|
1820
1925
|
_dataLakes;
|
|
1821
|
-
|
|
1822
|
-
|
|
1926
|
+
_signer;
|
|
1927
|
+
constructor(connection, signer, dataLakes = []) {
|
|
1928
|
+
this._connection = connection;
|
|
1823
1929
|
this._dataLakes = [
|
|
1824
1930
|
...dataLakes
|
|
1825
1931
|
];
|
|
1932
|
+
this._signer = signer;
|
|
1826
1933
|
}
|
|
1827
1934
|
get connectionInstance() {
|
|
1828
|
-
return this.
|
|
1935
|
+
return this._connection;
|
|
1829
1936
|
}
|
|
1830
1937
|
get dataLakes() {
|
|
1831
1938
|
throw new Error("Method not implemented.");
|
|
1832
1939
|
}
|
|
1833
1940
|
get signerInstance() {
|
|
1834
|
-
return this.
|
|
1941
|
+
return this._signer;
|
|
1835
1942
|
}
|
|
1836
1943
|
addDataLake(dataLake) {
|
|
1837
1944
|
this._dataLakes.push(dataLake);
|
|
1838
1945
|
return this._dataLakes.length - 1;
|
|
1839
1946
|
}
|
|
1840
1947
|
async addPayloadsToChain(onChain, offChain, options) {
|
|
1841
|
-
const viewer =
|
|
1948
|
+
const viewer = assertEx12(this.connectionInstance.viewer, () => "No viewer available on connection");
|
|
1842
1949
|
const { nbf, exp, chain, fees } = options ?? {};
|
|
1843
|
-
const resolvedChainId =
|
|
1844
|
-
const resolvedNbf =
|
|
1845
|
-
const resolvedExp =
|
|
1950
|
+
const resolvedChainId = isDefined10(chain) ? chain : await viewer.chainId();
|
|
1951
|
+
const resolvedNbf = isDefined10(nbf) ? nbf : await viewer?.currentBlockNumber();
|
|
1952
|
+
const resolvedExp = isDefined10(exp) ? exp : resolvedNbf + 10;
|
|
1846
1953
|
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await (await this.signer()).address(), fees);
|
|
1847
1954
|
return await this.addTransactionToChain(tx);
|
|
1848
1955
|
}
|
|
1849
1956
|
async addTransactionToChain(tx) {
|
|
1850
|
-
const connection =
|
|
1851
|
-
const signer =
|
|
1852
|
-
const runner =
|
|
1957
|
+
const connection = this.connectionInstance;
|
|
1958
|
+
const signer = this.signerInstance;
|
|
1959
|
+
const runner = assertEx12(connection.runner, () => "No runner available on connection");
|
|
1853
1960
|
const signedTx = await signer.signTransaction(tx);
|
|
1854
1961
|
await this.addPayloadsToDataLakes(signedTx[1]);
|
|
1855
1962
|
return [
|
|
1856
1963
|
await runner.broadcastTransaction([
|
|
1857
|
-
|
|
1858
|
-
|
|
1964
|
+
signedTx[0],
|
|
1965
|
+
signedTx[1]
|
|
1859
1966
|
]),
|
|
1860
1967
|
signedTx
|
|
1861
1968
|
];
|
|
1862
1969
|
}
|
|
1863
1970
|
/** @deprecated use connectionInstance instead */
|
|
1864
1971
|
connection() {
|
|
1865
|
-
return this.
|
|
1972
|
+
return this.connectionInstance;
|
|
1866
1973
|
}
|
|
1867
1974
|
removeDataLake(index) {
|
|
1868
1975
|
this._dataLakes[index] = null;
|
|
@@ -1879,7 +1986,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
1879
1986
|
BigIntToJsonZod.parse(amount)
|
|
1880
1987
|
]));
|
|
1881
1988
|
const transfer = new PayloadBuilder10({
|
|
1882
|
-
schema:
|
|
1989
|
+
schema: TransferSchema2
|
|
1883
1990
|
}).fields({
|
|
1884
1991
|
from,
|
|
1885
1992
|
transfers: hexTransfers,
|
|
@@ -1892,7 +1999,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
1892
1999
|
}
|
|
1893
2000
|
/** @deprecated use signerInstance instead */
|
|
1894
2001
|
signer() {
|
|
1895
|
-
return this.
|
|
2002
|
+
return this.signerInstance;
|
|
1896
2003
|
}
|
|
1897
2004
|
async addPayloadsToDataLakes(payloads) {
|
|
1898
2005
|
await Promise.all(this._dataLakes.map(async (dataLake) => {
|
|
@@ -1904,7 +2011,7 @@ var SimpleXyoGatewayRunner = class {
|
|
|
1904
2011
|
};
|
|
1905
2012
|
|
|
1906
2013
|
// src/simple/network/SimpleXyoNetwork.ts
|
|
1907
|
-
import { isUndefined as isUndefined4 } from "@xylabs/
|
|
2014
|
+
import { isUndefined as isUndefined4 } from "@xylabs/sdk-js";
|
|
1908
2015
|
import { isNetworkStatus } from "@xyo-network/xl1-protocol";
|
|
1909
2016
|
import axios from "axios";
|
|
1910
2017
|
|
|
@@ -1976,7 +2083,7 @@ var SimpleXyoNetwork = class {
|
|
|
1976
2083
|
};
|
|
1977
2084
|
|
|
1978
2085
|
// src/simple/permissions/SimpleXyoPermissions.ts
|
|
1979
|
-
import { assertEx as
|
|
2086
|
+
import { assertEx as assertEx13 } from "@xylabs/sdk-js";
|
|
1980
2087
|
var SimpleXyoPermissions = class {
|
|
1981
2088
|
static {
|
|
1982
2089
|
__name(this, "SimpleXyoPermissions");
|
|
@@ -1988,7 +2095,7 @@ var SimpleXyoPermissions = class {
|
|
|
1988
2095
|
this.invoker = store.invoker;
|
|
1989
2096
|
}
|
|
1990
2097
|
get store() {
|
|
1991
|
-
return
|
|
2098
|
+
return assertEx13(this._store, () => "Store must be defined to get permissions");
|
|
1992
2099
|
}
|
|
1993
2100
|
async getPermissions() {
|
|
1994
2101
|
return await this.store.getPermissions();
|
|
@@ -2046,7 +2153,7 @@ var SimpleXyoPermissions = class {
|
|
|
2046
2153
|
};
|
|
2047
2154
|
|
|
2048
2155
|
// src/simple/permissions/store/MemoryPermissions.ts
|
|
2049
|
-
import { assertEx as
|
|
2156
|
+
import { assertEx as assertEx14 } from "@xylabs/sdk-js";
|
|
2050
2157
|
var MemoryPermissionsStore = class {
|
|
2051
2158
|
static {
|
|
2052
2159
|
__name(this, "MemoryPermissionsStore");
|
|
@@ -2057,7 +2164,7 @@ var MemoryPermissionsStore = class {
|
|
|
2057
2164
|
this._invoker = invoker;
|
|
2058
2165
|
}
|
|
2059
2166
|
get invoker() {
|
|
2060
|
-
return
|
|
2167
|
+
return assertEx14(this._invoker, () => "Invoker must be defined to get permissions");
|
|
2061
2168
|
}
|
|
2062
2169
|
async getPermissions() {
|
|
2063
2170
|
await Promise.resolve();
|
|
@@ -2122,19 +2229,127 @@ var SimpleXyoSigner = class {
|
|
|
2122
2229
|
}
|
|
2123
2230
|
};
|
|
2124
2231
|
|
|
2232
|
+
// src/simple/timesync/SimpleTimeSyncViewer.ts
|
|
2233
|
+
import { asHash as asHash5, assertEx as assertEx15, isDefined as isDefined11 } from "@xylabs/sdk-js";
|
|
2234
|
+
import { asTimePayload, asXL1BlockNumber as asXL1BlockNumber5, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
2235
|
+
var SimpleTimeSyncViewer = class {
|
|
2236
|
+
static {
|
|
2237
|
+
__name(this, "SimpleTimeSyncViewer");
|
|
2238
|
+
}
|
|
2239
|
+
blockViewer;
|
|
2240
|
+
ethProvider;
|
|
2241
|
+
constructor(blockViewer, ethProvider) {
|
|
2242
|
+
this.blockViewer = blockViewer;
|
|
2243
|
+
this.ethProvider = ethProvider;
|
|
2244
|
+
}
|
|
2245
|
+
async convertTime(fromDomain, toDomain, from) {
|
|
2246
|
+
switch (fromDomain) {
|
|
2247
|
+
case "xl1": {
|
|
2248
|
+
const [block, payloads] = assertEx15(await this.blockViewer.blockByNumber(asXL1BlockNumber5(from, true)), () => "Block not found");
|
|
2249
|
+
const timeSchemaIndex = block.payload_schemas.indexOf(TimeSchema);
|
|
2250
|
+
const hash = timeSchemaIndex === -1 ? void 0 : block.payload_hashes[timeSchemaIndex];
|
|
2251
|
+
const timePayload = asTimePayload(isDefined11(hash) ? payloads.find((p) => p._hash === hash) : void 0);
|
|
2252
|
+
if (timePayload === void 0) return 0;
|
|
2253
|
+
switch (toDomain) {
|
|
2254
|
+
case "xl1": {
|
|
2255
|
+
return timePayload.xl1 ?? 0;
|
|
2256
|
+
}
|
|
2257
|
+
case "epoch": {
|
|
2258
|
+
return timePayload.epoch ?? 0;
|
|
2259
|
+
}
|
|
2260
|
+
case "ethereum": {
|
|
2261
|
+
return timePayload.ethereum ?? 0;
|
|
2262
|
+
}
|
|
2263
|
+
default: {
|
|
2264
|
+
throw new Error(`Unsupported to toDomain: ${toDomain}`);
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
default: {
|
|
2269
|
+
throw new Error(`Unsupported from fromDomain: ${fromDomain}`);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
async currentTime(domain) {
|
|
2274
|
+
switch (domain) {
|
|
2275
|
+
case "xl1": {
|
|
2276
|
+
return [
|
|
2277
|
+
"xl1",
|
|
2278
|
+
(await this.blockViewer.currentBlock())?.[0].block ?? -1
|
|
2279
|
+
];
|
|
2280
|
+
}
|
|
2281
|
+
case "epoch": {
|
|
2282
|
+
return [
|
|
2283
|
+
"epoch",
|
|
2284
|
+
Date.now()
|
|
2285
|
+
];
|
|
2286
|
+
}
|
|
2287
|
+
case "ethereum": {
|
|
2288
|
+
return [
|
|
2289
|
+
"ethereum",
|
|
2290
|
+
await this.ethProvider?.getBlockNumber() ?? 0
|
|
2291
|
+
];
|
|
2292
|
+
}
|
|
2293
|
+
default: {
|
|
2294
|
+
throw new Error(`Unknown time domain: ${domain}`);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
async currentTimeAndHash(domain) {
|
|
2299
|
+
switch (domain) {
|
|
2300
|
+
case "xl1": {
|
|
2301
|
+
const [head] = await this.blockViewer.currentBlock();
|
|
2302
|
+
return [
|
|
2303
|
+
head.block,
|
|
2304
|
+
head._hash
|
|
2305
|
+
];
|
|
2306
|
+
}
|
|
2307
|
+
case "epoch": {
|
|
2308
|
+
return [
|
|
2309
|
+
Date.now(),
|
|
2310
|
+
null
|
|
2311
|
+
];
|
|
2312
|
+
}
|
|
2313
|
+
case "ethereum": {
|
|
2314
|
+
const provider = assertEx15(this.ethProvider, () => "Ethereum provider not configured");
|
|
2315
|
+
const blockNumber = await provider.getBlockNumber() ?? 0;
|
|
2316
|
+
const block = await provider.getBlock(blockNumber);
|
|
2317
|
+
const blockHash = asHash5(assertEx15(block?.hash, () => "Block hash not found"), true);
|
|
2318
|
+
return [
|
|
2319
|
+
blockNumber,
|
|
2320
|
+
blockHash
|
|
2321
|
+
];
|
|
2322
|
+
}
|
|
2323
|
+
default: {
|
|
2324
|
+
throw new Error(`Unknown time domain: ${domain}`);
|
|
2325
|
+
}
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
currentTimePayload() {
|
|
2329
|
+
throw new Error("Method not implemented.");
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
|
|
2125
2333
|
// src/time/primitives/xl1BlockNumberToEthBlockNumber.ts
|
|
2126
|
-
import { assertEx as
|
|
2127
|
-
import { asTimePayload, TimeSchema } from "@xyo-network/xl1-protocol";
|
|
2334
|
+
import { assertEx as assertEx16 } from "@xylabs/sdk-js";
|
|
2335
|
+
import { asTimePayload as asTimePayload2, TimeSchema as TimeSchema2 } from "@xyo-network/xl1-protocol";
|
|
2128
2336
|
async function xl1BlockNumberToEthBlockNumber(context, xl1BlockNumber) {
|
|
2129
2337
|
const blockHash = await hashFromBlockNumber(context, xl1BlockNumber);
|
|
2130
2338
|
const hydratedBlock = await hydrateBlock(context.store, blockHash);
|
|
2131
|
-
const timePayload =
|
|
2339
|
+
const timePayload = asTimePayload2(hydratedBlock[1].find((p) => p.schema === TimeSchema2), {
|
|
2132
2340
|
required: true
|
|
2133
2341
|
});
|
|
2134
|
-
return
|
|
2342
|
+
return assertEx16(timePayload.ethereum, () => "No ethereum timestamp found on block");
|
|
2135
2343
|
}
|
|
2136
2344
|
__name(xl1BlockNumberToEthBlockNumber, "xl1BlockNumberToEthBlockNumber");
|
|
2137
2345
|
|
|
2346
|
+
// src/viewers/StakeEvents.ts
|
|
2347
|
+
var StakeEventNames = [
|
|
2348
|
+
"StakeAdded",
|
|
2349
|
+
"StakeRemoved",
|
|
2350
|
+
"StakeWithdrawn"
|
|
2351
|
+
];
|
|
2352
|
+
|
|
2138
2353
|
// src/wallet/generateXyoBaseWalletFromPhrase.ts
|
|
2139
2354
|
import { HDWallet } from "@xyo-network/wallet";
|
|
2140
2355
|
|
|
@@ -2186,8 +2401,10 @@ export {
|
|
|
2186
2401
|
MemoryPermissionsStore,
|
|
2187
2402
|
MnemonicStringZod,
|
|
2188
2403
|
RewardMultipliers,
|
|
2404
|
+
SimpleAccountBalanceViewer,
|
|
2189
2405
|
SimpleDataLakeRunner,
|
|
2190
2406
|
SimpleDataLakeViewer,
|
|
2407
|
+
SimpleTimeSyncViewer,
|
|
2191
2408
|
SimpleXyoClient,
|
|
2192
2409
|
SimpleXyoGateway,
|
|
2193
2410
|
SimpleXyoGatewayRunner,
|