@xyo-network/xl1-protocol-sdk 1.26.12 → 1.26.13
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/simple/accountBalance/SimpleAccountBalanceViewer.d.ts +2 -2
- package/dist/neutral/simple/block/SimpleBlockViewer.d.ts +2 -2
- package/dist/neutral/simple/datalake/SimpleDataLakeRunner.d.ts +1 -1
- package/dist/neutral/simple/finalization/SimpleFinalizationViewer.d.ts +1 -1
- package/dist/neutral/simple/windowedBlock/SimpleWindowedBlockViewer.d.ts +10 -10
- package/dist/neutral/transaction/TransactionBuilder.d.ts +4 -4
- package/dist/neutral/transaction/signTransaction.d.ts +1 -1
- package/package.json +24 -14
- package/src/ChainContextHelpers.ts +0 -50
- package/src/CreatableProvider/AbstractCreatableProvider.ts +0 -97
- package/src/CreatableProvider/CreatableProvider.ts +0 -102
- package/src/CreatableProvider/CreatableProviderRegistry.ts +0 -94
- package/src/CreatableProvider/GetInstanceOptions.ts +0 -11
- package/src/CreatableProvider/LabeledCreatableProviderFactory.ts +0 -24
- package/src/CreatableProvider/ProviderFactory.ts +0 -138
- package/src/CreatableProvider/ProviderFactoryLocator.ts +0 -170
- package/src/CreatableProvider/ProviderFactoryLocatorInstance.ts +0 -70
- package/src/CreatableProvider/index.ts +0 -8
- package/src/SignedBigInt.ts +0 -59
- package/src/_internal/context/getTestProviderContext.ts +0 -13
- package/src/_internal/context/index.ts +0 -1
- package/src/_internal/index.ts +0 -2
- package/src/actor/ActorV3.ts +0 -177
- package/src/actor/index.ts +0 -1
- package/src/amount/ShiftedBigInt.ts +0 -73
- package/src/amount/XL1Amount.ts +0 -103
- package/src/amount/index.ts +0 -4
- package/src/amount/splitOnDecimal.ts +0 -6
- package/src/amount/splitOnDecimalToString.ts +0 -40
- package/src/block/hydrate/allHashesPresent.ts +0 -8
- package/src/block/hydrate/blockPayloadsFromHydratedBlock.ts +0 -12
- package/src/block/hydrate/flattenHydratedBlock.ts +0 -28
- package/src/block/hydrate/flattenHydratedBlocks.ts +0 -7
- package/src/block/hydrate/hydrateBlock.ts +0 -43
- package/src/block/hydrate/index.ts +0 -7
- package/src/block/hydrate/transactionsFromHydratedBlock.ts +0 -7
- package/src/block/hydrate/tryHydrateBlock.ts +0 -26
- package/src/block/index.ts +0 -2
- package/src/block/primitives/blockFromBlockNumber.ts +0 -69
- package/src/block/primitives/frames/calculateFramesFromRange.ts +0 -30
- package/src/block/primitives/frames/deepCalculateFramesFromRange.ts +0 -28
- package/src/block/primitives/frames/index.ts +0 -2
- package/src/block/primitives/hashFromBlockNumber.ts +0 -9
- package/src/block/primitives/index.ts +0 -7
- package/src/block/primitives/model.ts +0 -18
- package/src/block/primitives/payloads/ChainWindow.ts +0 -7
- package/src/block/primitives/payloads/index.ts +0 -1
- package/src/block/primitives/toStepIdentityString.ts +0 -6
- package/src/block/primitives/validateTransactionOpcodes.ts +0 -45
- package/src/config/Actor.ts +0 -32
- package/src/config/Actors.ts +0 -9
- package/src/config/Base.ts +0 -27
- package/src/config/Chain.ts +0 -23
- package/src/config/Config.ts +0 -24
- package/src/config/DataLake/DataLake.ts +0 -12
- package/src/config/DataLake/DataLakeRemoteConfig.ts +0 -11
- package/src/config/DataLake/RestDataLakeConfig.ts +0 -18
- package/src/config/DataLake/RouterDataLakeConfig.ts +0 -22
- package/src/config/DataLake/index.ts +0 -4
- package/src/config/DeepPartial.ts +0 -4
- package/src/config/Evm.ts +0 -38
- package/src/config/HostActor.ts +0 -32
- package/src/config/Log.ts +0 -25
- package/src/config/Provider.ts +0 -20
- package/src/config/Providers.ts +0 -9
- package/src/config/Remote.ts +0 -59
- package/src/config/Telemetry.ts +0 -49
- package/src/config/UsageMeta.ts +0 -46
- package/src/config/Validation.ts +0 -29
- package/src/config/index.ts +0 -12
- package/src/config/storage/Storage.ts +0 -16
- package/src/config/storage/driver/Mongo.ts +0 -53
- package/src/config/storage/driver/index.ts +0 -1
- package/src/config/storage/index.ts +0 -2
- package/src/constants.ts +0 -4
- package/src/context/Actor.ts +0 -20
- package/src/context/HostActor.ts +0 -20
- package/src/context/getEmptyProviderContext.ts +0 -19
- package/src/context/index.ts +0 -3
- package/src/createDeclarationPayload.ts +0 -15
- package/src/createTransferPayload.ts +0 -16
- package/src/driver/cache/LruCacheMap.ts +0 -48
- package/src/driver/cache/index.ts +0 -1
- package/src/driver/index.ts +0 -2
- package/src/driver/memory/MemoryMap.ts +0 -48
- package/src/driver/memory/index.ts +0 -1
- package/src/eip-712/Payloads/EIP712Data.ts +0 -35
- package/src/eip-712/Payloads/EIP712Signature.ts +0 -32
- package/src/eip-712/Payloads/index.ts +0 -2
- package/src/eip-712/Types.ts +0 -41
- package/src/eip-712/index.ts +0 -4
- package/src/eip-712/sign.ts +0 -19
- package/src/eip-712/spec/fixtures.ts +0 -27
- package/src/eip-712/verify.ts +0 -20
- package/src/getFileConfig.ts +0 -36
- package/src/index.ts +0 -27
- package/src/instances/Address.ts +0 -16
- package/src/instances/BoundWitness.ts +0 -13
- package/src/instances/Data.ts +0 -4
- package/src/instances/Fees.ts +0 -9
- package/src/instances/HydratedBoundWitness.ts +0 -16
- package/src/instances/Object.ts +0 -6
- package/src/instances/Payload.ts +0 -7
- package/src/instances/Signature.ts +0 -12
- package/src/instances/block/BlockFields.ts +0 -18
- package/src/instances/block/HydratedBlock.ts +0 -10
- package/src/instances/block/index.ts +0 -1
- package/src/instances/index.ts +0 -10
- package/src/instances/modifiers/BlockWindowInstance.ts +0 -8
- package/src/instances/modifiers/BlockWindowState.ts +0 -6
- package/src/instances/modifiers/Signed.ts +0 -9
- package/src/instances/modifiers/Validatable.ts +0 -6
- package/src/instances/modifiers/index.ts +0 -4
- package/src/instances/transaction/HydratedTransaction.ts +0 -9
- package/src/instances/transaction/TransactionFields.ts +0 -22
- package/src/instances/transaction/index.ts +0 -1
- package/src/isInternetAvailable.ts +0 -11
- package/src/model/ChainFork/ChainForkStatic.ts +0 -9
- package/src/model/ChainFork/index.ts +0 -1
- package/src/model/ChainIdentity.ts +0 -6
- package/src/model/ChainStore.ts +0 -16
- package/src/model/CreatableProviderContext.ts +0 -6
- package/src/model/CreatableProviderContext.zod.ts +0 -55
- package/src/model/PayloadBundle/bundledPayloadToHydratedBlock.ts +0 -15
- package/src/model/PayloadBundle/bundledPayloadToHydratedTransaction.ts +0 -15
- package/src/model/PayloadBundle/hydratedBlockToPayloadBundle.ts +0 -19
- package/src/model/PayloadBundle/hydratedTransactionToPayloadBundle.ts +0 -19
- package/src/model/PayloadBundle/index.ts +0 -4
- package/src/model/index.ts +0 -6
- package/src/multipliers.ts +0 -18
- package/src/payloads/AddressPairPayload.ts +0 -27
- package/src/payloads/index.ts +0 -4
- package/src/payloads/netBalancesForPayloads.ts +0 -24
- package/src/payloads/netSchemasForPayloads.ts +0 -24
- package/src/payloads/netTransfersForPayloads.ts +0 -27
- package/src/primitives/block/index.ts +0 -2
- package/src/primitives/block/range/blockRangeSteps.ts +0 -23
- package/src/primitives/block/range/index.ts +0 -1
- package/src/primitives/block/rate/blockRate.ts +0 -77
- package/src/primitives/block/rate/index.ts +0 -4
- package/src/primitives/block/rate/stepRate.ts +0 -37
- package/src/primitives/block/rate/timeHelpers.ts +0 -61
- package/src/primitives/block/rate/timeRate.ts +0 -121
- package/src/primitives/chain/getWindowedChain.ts +0 -50
- package/src/primitives/chain/index.ts +0 -3
- package/src/primitives/chain/step/chainStepRewardAddress.ts +0 -30
- package/src/primitives/chain/step/index.ts +0 -4
- package/src/primitives/chain/step/stepRewardBlock.ts +0 -13
- package/src/primitives/chain/step/stepRewardTotal.ts +0 -46
- package/src/primitives/chain/step/stepsRewardTotal.ts +0 -37
- package/src/primitives/chain/time/externalBlockNumberFromXL1BlockNumber.ts +0 -32
- package/src/primitives/chain/time/externalBlockRangeFromStep.ts +0 -21
- package/src/primitives/chain/time/externalBlockRangeFromXL1BlockRange.ts +0 -17
- package/src/primitives/chain/time/index.ts +0 -3
- package/src/primitives/datalake/addDataLakePayloads.ts +0 -18
- package/src/primitives/datalake/addDataLakePayloadsToPayloads.ts +0 -24
- package/src/primitives/datalake/index.ts +0 -2
- package/src/primitives/index.ts +0 -13
- package/src/primitives/mapToMapType.ts +0 -35
- package/src/primitives/payload/index.ts +0 -1
- package/src/primitives/payload/mergeTransfers.ts +0 -16
- package/src/primitives/readPayloadMapFromStore.ts +0 -58
- package/src/primitives/rewardFromBlockNumber.ts +0 -19
- package/src/primitives/rewards/index.ts +0 -1
- package/src/primitives/rewards/networkStakeStepRewardPositionWeight.ts +0 -26
- package/src/primitives/stake/activeStakeAtTimeByAddress.ts +0 -27
- package/src/primitives/stake/activeStakeAtTimeByPosition.ts +0 -25
- package/src/primitives/stake/allStakersForRange.ts +0 -32
- package/src/primitives/stake/allStakersForStep.ts +0 -24
- package/src/primitives/stake/index.ts +0 -6
- package/src/primitives/stake/mergedAddRemoveStakeEventsByPosition.ts +0 -15
- package/src/primitives/stake/mergedAddRemoveStakeEventsByStaker.ts +0 -17
- package/src/primitives/stake/weightedStakeForRangeByPosition.ts +0 -69
- package/src/primitives/state/findMostRecentBlock.ts +0 -44
- package/src/primitives/state/hydratedBlockByNumber.ts +0 -25
- package/src/primitives/state/index.ts +0 -2
- package/src/primitives/step/completedStepRewardAddress.ts +0 -10
- package/src/primitives/step/derivedReceiveAddress.ts +0 -9
- package/src/primitives/step/index.ts +0 -4
- package/src/primitives/step/stepBlockRange.ts +0 -9
- package/src/primitives/step/stepTransferIndex.ts +0 -19
- package/src/primitives/transaction/elevatedPayloads.ts +0 -24
- package/src/primitives/transaction/index.ts +0 -1
- package/src/primitives/uncle/findBestUncle.ts +0 -9
- package/src/primitives/uncle/findUncles.ts +0 -75
- package/src/primitives/uncle/index.ts +0 -3
- package/src/primitives/uncle/scoreUncle.ts +0 -7
- package/src/services/AccountTransfersService.ts +0 -13
- package/src/services/BlockProducerService.ts +0 -11
- package/src/services/Chain/BaseChainService.ts +0 -4
- package/src/services/Chain/ChainHeadService.ts +0 -8
- package/src/services/Chain/ChainService.ts +0 -6
- package/src/services/Chain/index.ts +0 -3
- package/src/services/Election.ts +0 -14
- package/src/services/NetworkStakeService.ts +0 -4
- package/src/services/Params.ts +0 -13
- package/src/services/PendingTransactionsService.ts +0 -7
- package/src/services/SchemasService.ts +0 -11
- package/src/services/StakeIntentService/ChainIndexingServiceStateSchema.ts +0 -50
- package/src/services/StakeIntentService/StakeIntentService.ts +0 -35
- package/src/services/StakeIntentService/index.ts +0 -2
- package/src/services/index.ts +0 -8
- package/src/simple/StakeEventsViewer/SimpleStakeEventsViewer.ts +0 -93
- package/src/simple/StakeEventsViewer/index.ts +0 -1
- package/src/simple/StakeTotalsViewer/SimpleStakeTotalsViewer.ts +0 -116
- package/src/simple/StakeTotalsViewer/index.ts +0 -1
- package/src/simple/StakeViewer/SimpleStakeViewer.ts +0 -164
- package/src/simple/StakeViewer/index.ts +0 -1
- package/src/simple/TransactionViewer/SimpleTransactionViewer.ts +0 -100
- package/src/simple/TransactionViewer/index.ts +0 -1
- package/src/simple/accountBalance/SimpleAccountBalanceViewer.ts +0 -271
- package/src/simple/accountBalance/index.ts +0 -1
- package/src/simple/block/SimpleBlockViewer.ts +0 -231
- package/src/simple/block/index.ts +0 -1
- package/src/simple/blockInvalidation/SimpleBlockInvalidationViewer.ts +0 -197
- package/src/simple/blockInvalidation/index.ts +0 -1
- package/src/simple/blockReward/SimpleBlockRewardViewer.ts +0 -27
- package/src/simple/blockReward/index.ts +0 -1
- package/src/simple/blockValidation/SimpleBlockValidationViewer.ts +0 -194
- package/src/simple/blockValidation/index.ts +0 -1
- package/src/simple/chainContractViewer/SimpleChainContractViewer.ts +0 -92
- package/src/simple/chainContractViewer/index.ts +0 -1
- package/src/simple/client/SimpleXyoClient.ts +0 -14
- package/src/simple/client/index.ts +0 -1
- package/src/simple/datalake/AbstractRestDataLake.ts +0 -70
- package/src/simple/datalake/AbstractSimpleDataLake.ts +0 -62
- package/src/simple/datalake/RestDataLakeRunner.ts +0 -54
- package/src/simple/datalake/RestDataLakeViewer.ts +0 -22
- package/src/simple/datalake/SimpleDataLakeRunner.ts +0 -44
- package/src/simple/datalake/SimpleDataLakeViewer.ts +0 -24
- package/src/simple/datalake/index.ts +0 -4
- package/src/simple/finalization/SimpleFinalizationRunner.ts +0 -45
- package/src/simple/finalization/SimpleFinalizationViewer.ts +0 -123
- package/src/simple/finalization/index.ts +0 -2
- package/src/simple/gateway/SimpleXyoGateway.ts +0 -30
- package/src/simple/gateway/SimpleXyoGatewayRunner.ts +0 -137
- package/src/simple/gateway/index.ts +0 -2
- package/src/simple/index.ts +0 -22
- package/src/simple/mempool/SimpleMempoolRunner.ts +0 -390
- package/src/simple/mempool/SimpleMempoolViewer.ts +0 -215
- package/src/simple/mempool/index.ts +0 -2
- package/src/simple/network/SimpleXyoNetwork.ts +0 -48
- package/src/simple/network/index.ts +0 -1
- package/src/simple/network/lib/FailedNetworkStatusPayloads.ts +0 -16
- package/src/simple/network/lib/StatusNetworks.ts +0 -32
- package/src/simple/network/lib/index.ts +0 -2
- package/src/simple/permissions/SimpleXyoPermissions.ts +0 -82
- package/src/simple/permissions/index.ts +0 -2
- package/src/simple/permissions/store/MemoryPermissions.ts +0 -32
- package/src/simple/permissions/store/PermissionsStore.ts +0 -17
- package/src/simple/permissions/store/index.ts +0 -2
- package/src/simple/runner/SimpleXyoRunner.ts +0 -41
- package/src/simple/runner/index.ts +0 -1
- package/src/simple/signer/SimpleXyoSigner.ts +0 -78
- package/src/simple/signer/index.ts +0 -1
- package/src/simple/timeSync2/SimpleTimeSyncViewer.ts +0 -132
- package/src/simple/timeSync2/index.ts +0 -1
- package/src/simple/transactionInvalidation/SimpleTransactionInvalidationViewer.ts +0 -197
- package/src/simple/transactionInvalidation/index.ts +0 -1
- package/src/simple/transactionValidation/SimpleTransactionValidationViewer.ts +0 -173
- package/src/simple/transactionValidation/index.ts +0 -1
- package/src/simple/windowedBlock/SimpleWindowedBlockViewer.ts +0 -207
- package/src/simple/windowedBlock/index.ts +0 -1
- package/src/status/RuntimeStatusMonitor.ts +0 -120
- package/src/status/ServiceStatus.ts +0 -21
- package/src/status/index.ts +0 -2
- package/src/summary/index.ts +0 -2
- package/src/summary/model/BalancesStepSummary.ts +0 -35
- package/src/summary/model/SchemasStepSummary.ts +0 -33
- package/src/summary/model/StepSummary.ts +0 -20
- package/src/summary/model/TransfersSummary.ts +0 -36
- package/src/summary/model/index.ts +0 -4
- package/src/summary/primitives/balances/balancesStepSummaryFromRange.ts +0 -94
- package/src/summary/primitives/balances/balancesSummary.ts +0 -48
- package/src/summary/primitives/balances/index.ts +0 -2
- package/src/summary/primitives/index.ts +0 -3
- package/src/summary/primitives/schemas/index.ts +0 -2
- package/src/summary/primitives/schemas/schemasStepSummaryFromRange.ts +0 -86
- package/src/summary/primitives/schemas/schemasSummary.ts +0 -44
- package/src/summary/primitives/transfers/index.ts +0 -2
- package/src/summary/primitives/transfers/transfersStepSummaryFromRange.ts +0 -109
- package/src/summary/primitives/transfers/transfersSummary.ts +0 -52
- package/src/test/BuildBlockOptions.ts +0 -81
- package/src/test/buildBlock.ts +0 -105
- package/src/test/buildGenesisBlock.ts +0 -29
- package/src/test/buildNextBlock.ts +0 -37
- package/src/test/buildRandomChain.ts +0 -92
- package/src/test/buildRandomGenesisBlock.ts +0 -47
- package/src/test/createGenesisBlock.ts +0 -41
- package/src/test/createProducerChainStakeIntentTransaction.ts +0 -48
- package/src/test/getSimpleBlockViewerLocator.ts +0 -41
- package/src/test/getTestProviderContext.ts +0 -8
- package/src/test/index.ts +0 -2
- package/src/time/index.ts +0 -1
- package/src/time/primitives/index.ts +0 -1
- package/src/time/primitives/xl1BlockNumberToEthBlockNumber.ts +0 -13
- package/src/transaction/TransactionBuilder.ts +0 -164
- package/src/transaction/buildRandomTransaction.ts +0 -38
- package/src/transaction/buildTransaction.ts +0 -68
- package/src/transaction/buildUnsignedTransaction.ts +0 -56
- package/src/transaction/confirmSubmittedTransaction.ts +0 -42
- package/src/transaction/hydrateTransaction.ts +0 -117
- package/src/transaction/index.ts +0 -9
- package/src/transaction/primitives/index.ts +0 -4
- package/src/transaction/primitives/transactionBlockByteCount.ts +0 -10
- package/src/transaction/primitives/transactionElevatedPayloads.ts +0 -18
- package/src/transaction/primitives/transactionOperations.ts +0 -13
- package/src/transaction/primitives/transactionRequiredGas.ts +0 -22
- package/src/transaction/script.ts +0 -48
- package/src/transaction/signTransaction.ts +0 -32
- package/src/utils/HydratedCache.ts +0 -39
- package/src/utils/index.ts +0 -2
- package/src/utils/isZodError.ts +0 -11
- package/src/validation/index.ts +0 -2
- package/src/validation/lib/getUrl.ts +0 -7
- package/src/validation/lib/index.ts +0 -2
- package/src/validation/lib/isLocalhost.ts +0 -9
- package/src/validation/schema/Address.ts +0 -2
- package/src/validation/schema/Mnemonic.ts +0 -21
- package/src/validation/schema/index.ts +0 -2
- package/src/wallet/generateXyoBaseWalletFromPhrase.ts +0 -13
- package/src/wallet/index.ts +0 -2
- package/src/wallet/paths.ts +0 -17
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertEx, BrandedHash, exists, type Hash,
|
|
3
|
-
Promisable,
|
|
4
|
-
PromisableArray,
|
|
5
|
-
} from '@xylabs/sdk-js'
|
|
6
|
-
import { isAnyPayload, PayloadZodLoose } from '@xyo-network/sdk-js'
|
|
7
|
-
import {
|
|
8
|
-
DataLakeData,
|
|
9
|
-
DataLakeRunner,
|
|
10
|
-
DataLakeRunnerMoniker,
|
|
11
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
12
|
-
import { AxiosResponse } from 'axios'
|
|
13
|
-
import z from 'zod'
|
|
14
|
-
|
|
15
|
-
import { creatableProvider } from '../../CreatableProvider/index.ts'
|
|
16
|
-
import { AbstractRestDataLake } from './AbstractRestDataLake.ts'
|
|
17
|
-
import { RestDataLakeViewerParams } from './RestDataLakeViewer.ts'
|
|
18
|
-
|
|
19
|
-
/** Parameters for RestDataLakeRunner. */
|
|
20
|
-
export interface RestDataLakeRunnerParams extends RestDataLakeViewerParams {}
|
|
21
|
-
|
|
22
|
-
/** RestDataLakeRunner implementation. */
|
|
23
|
-
@creatableProvider()
|
|
24
|
-
export class RestDataLakeRunner<TParams extends RestDataLakeRunnerParams> extends
|
|
25
|
-
AbstractRestDataLake<TParams> implements DataLakeRunner {
|
|
26
|
-
static readonly defaultMoniker = DataLakeRunnerMoniker
|
|
27
|
-
static readonly dependencies = []
|
|
28
|
-
static readonly monikers = [DataLakeRunnerMoniker]
|
|
29
|
-
moniker = RestDataLakeRunner.defaultMoniker
|
|
30
|
-
|
|
31
|
-
clear(): Promisable<void> {
|
|
32
|
-
throw new Error('Method not implemented.')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
delete(_hashes: BrandedHash[]): PromisableArray<DataLakeData> {
|
|
36
|
-
throw new Error('Method not implemented.')
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async insert(items: DataLakeData[]): Promise<DataLakeData[]> {
|
|
40
|
-
const allowedItems = items.map((item) => {
|
|
41
|
-
if (isAnyPayload(item) && this.isAllowed(item)) {
|
|
42
|
-
assertEx(typeof item === 'object' && item !== null, () => 'Data must be an object')
|
|
43
|
-
return item
|
|
44
|
-
}
|
|
45
|
-
return null
|
|
46
|
-
}).filter(exists)
|
|
47
|
-
if (allowedItems.length > 0) {
|
|
48
|
-
const result = await this.axios.post<DataLakeData[], AxiosResponse<Hash[]>>(`${this.params.endpoint}/insert`, allowedItems)
|
|
49
|
-
return z.array(PayloadZodLoose).parse(result.data)
|
|
50
|
-
} else {
|
|
51
|
-
return []
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DataLakeViewer,
|
|
3
|
-
DataLakeViewerMoniker,
|
|
4
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
5
|
-
|
|
6
|
-
import { creatableProvider } from '../../CreatableProvider/index.ts'
|
|
7
|
-
import { AbstractRestDataLake, AbstractRestDataLakeParams } from './AbstractRestDataLake.ts'
|
|
8
|
-
|
|
9
|
-
/** Parameters for RestDataLakeViewer. */
|
|
10
|
-
export interface RestDataLakeViewerParams extends
|
|
11
|
-
AbstractRestDataLakeParams {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** RestDataLakeViewer implementation. */
|
|
15
|
-
@creatableProvider()
|
|
16
|
-
export class RestDataLakeViewer<TParams extends RestDataLakeViewerParams = RestDataLakeViewerParams>
|
|
17
|
-
extends AbstractRestDataLake<TParams> implements DataLakeViewer {
|
|
18
|
-
static readonly defaultMoniker = DataLakeViewerMoniker
|
|
19
|
-
static readonly dependencies = []
|
|
20
|
-
static readonly monikers = [DataLakeViewerMoniker]
|
|
21
|
-
moniker = RestDataLakeViewer.defaultMoniker
|
|
22
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { exists, type Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import { isAnyPayload, PayloadBuilder } from '@xyo-network/sdk-js'
|
|
3
|
-
import {
|
|
4
|
-
DataLakeData,
|
|
5
|
-
DataLakeRunner,
|
|
6
|
-
DataLakeRunnerMoniker, MapType,
|
|
7
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
8
|
-
|
|
9
|
-
import { creatableProvider } from '../../CreatableProvider/index.ts'
|
|
10
|
-
import { AbstractSimpleDataLake } from './AbstractSimpleDataLake.ts'
|
|
11
|
-
import { SimpleDataLakeViewerParams } from './SimpleDataLakeViewer.ts'
|
|
12
|
-
|
|
13
|
-
/** Parameters for SimpleDataLakeRunner. */
|
|
14
|
-
export interface SimpleDataLakeRunnerParams extends SimpleDataLakeViewerParams<MapType<Hash, DataLakeData>> {}
|
|
15
|
-
|
|
16
|
-
/** SimpleDataLakeRunner implementation. */
|
|
17
|
-
@creatableProvider()
|
|
18
|
-
export class SimpleDataLakeRunner<TParams extends SimpleDataLakeRunnerParams> extends
|
|
19
|
-
AbstractSimpleDataLake<TParams> implements DataLakeRunner {
|
|
20
|
-
static readonly defaultMoniker = DataLakeRunnerMoniker
|
|
21
|
-
static readonly dependencies = []
|
|
22
|
-
static readonly monikers = [DataLakeRunnerMoniker]
|
|
23
|
-
moniker = SimpleDataLakeRunner.defaultMoniker
|
|
24
|
-
|
|
25
|
-
async clear(): Promise<void> {
|
|
26
|
-
await this.map.clear()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async delete(hashes: Hash[]) {
|
|
30
|
-
return (await Promise.all(hashes.map(async (hash) => {
|
|
31
|
-
const payload = await this.map.get(hash)
|
|
32
|
-
return (await this.map.delete(hash)) ? payload : undefined
|
|
33
|
-
}))).filter(exists)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async insert(items: DataLakeData[]) {
|
|
37
|
-
const payloads = items.filter(isAnyPayload).filter(i => this.isAllowed(i))
|
|
38
|
-
const hashPairs = await PayloadBuilder.hashPairs(payloads)
|
|
39
|
-
for (const [payload, hash] of hashPairs) {
|
|
40
|
-
await this.map.set(hash, payload)
|
|
41
|
-
}
|
|
42
|
-
return hashPairs.map(([payload]) => payload)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import {
|
|
3
|
-
DataLakeData,
|
|
4
|
-
DataLakeViewer,
|
|
5
|
-
DataLakeViewerMoniker, MapTypeRead,
|
|
6
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
7
|
-
|
|
8
|
-
import { creatableProvider } from '../../CreatableProvider/index.ts'
|
|
9
|
-
import { AbstractSimpleDataLake, AbstractSimpleDataLakeParams } from './AbstractSimpleDataLake.ts'
|
|
10
|
-
|
|
11
|
-
/** Parameters for SimpleDataLakeViewer. */
|
|
12
|
-
export interface SimpleDataLakeViewerParams<TMap extends MapTypeRead<Hash, DataLakeData> = MapTypeRead<Hash, DataLakeData>> extends
|
|
13
|
-
AbstractSimpleDataLakeParams<TMap> {
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** SimpleDataLakeViewer implementation. */
|
|
17
|
-
@creatableProvider()
|
|
18
|
-
export class SimpleDataLakeViewer<TParams extends SimpleDataLakeViewerParams = SimpleDataLakeViewerParams>
|
|
19
|
-
extends AbstractSimpleDataLake<TParams> implements DataLakeViewer {
|
|
20
|
-
static readonly defaultMoniker = DataLakeViewerMoniker
|
|
21
|
-
static readonly dependencies = []
|
|
22
|
-
static readonly monikers = [DataLakeViewerMoniker]
|
|
23
|
-
moniker = SimpleDataLakeViewer.defaultMoniker
|
|
24
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type Hash } from '@xylabs/sdk-js'
|
|
2
|
-
import type { ArchivistInstance } from '@xyo-network/sdk-js'
|
|
3
|
-
import { type SignedHydratedBlockWithHashMeta } from '@xyo-network/xl1-protocol-lib'
|
|
4
|
-
import { FinalizationRunner, FinalizationRunnerMoniker } from '@xyo-network/xl1-protocol-lib'
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
AbstractCreatableProvider, creatableProvider, CreatableProviderParams,
|
|
8
|
-
} from '../../CreatableProvider/index.ts'
|
|
9
|
-
import { ChainStoreWrite } from '../../model/index.ts'
|
|
10
|
-
|
|
11
|
-
/** Parameters for SimpleFinalizationRunner. */
|
|
12
|
-
export interface SimpleFinalizationRunnerParams extends CreatableProviderParams {
|
|
13
|
-
finalizedArchivist: ArchivistInstance
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** SimpleFinalizationRunner implementation. */
|
|
17
|
-
@creatableProvider()
|
|
18
|
-
export class SimpleFinalizationRunner extends AbstractCreatableProvider<SimpleFinalizationRunnerParams> implements FinalizationRunner {
|
|
19
|
-
static readonly defaultMoniker = FinalizationRunnerMoniker
|
|
20
|
-
static readonly dependencies = []
|
|
21
|
-
static readonly monikers = [FinalizationRunnerMoniker]
|
|
22
|
-
moniker = SimpleFinalizationRunner.defaultMoniker
|
|
23
|
-
|
|
24
|
-
protected _store: ChainStoreWrite | undefined
|
|
25
|
-
|
|
26
|
-
protected get store() {
|
|
27
|
-
return this._store!
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
override async createHandler() {
|
|
31
|
-
await super.createHandler()
|
|
32
|
-
this._store = { chainMap: this.params.finalizedArchivist }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async finalizeBlock(block: SignedHydratedBlockWithHashMeta): Promise<Hash> {
|
|
36
|
-
return (await this.finalizeBlocks([block]))[0]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async finalizeBlocks(blocks: SignedHydratedBlockWithHashMeta[]): Promise<Hash[]> {
|
|
40
|
-
const sortedBlocks = blocks.toSorted((a, b) => a[0].block - b[0].block)
|
|
41
|
-
const payloads = sortedBlocks.flatMap(block => [...block[1], block[0]])
|
|
42
|
-
await this.store.chainMap.insert(payloads)
|
|
43
|
-
return sortedBlocks.map(b => b[0]._hash)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
assertEx,
|
|
3
|
-
Hash,
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
import type { ReadArchivist } from '@xyo-network/sdk-js'
|
|
6
|
-
import {
|
|
7
|
-
asSignedHydratedBlockWithStorageMeta, BlockContextRead, ChainContextRead, ChainContractViewerMoniker, ChainId, FinalizationViewer,
|
|
8
|
-
FinalizationViewerMoniker, type SignedBlockBoundWitnessWithHashMeta, type SignedHydratedBlockWithHashMeta,
|
|
9
|
-
SignedHydratedBlockWithStorageMeta,
|
|
10
|
-
XL1BlockNumber,
|
|
11
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
12
|
-
|
|
13
|
-
import { hydrateBlock } from '../../block/index.ts'
|
|
14
|
-
import {
|
|
15
|
-
AbstractCreatableProvider, creatableProvider, CreatableProviderParams,
|
|
16
|
-
} from '../../CreatableProvider/index.ts'
|
|
17
|
-
import { ChainStoreRead } from '../../model/index.ts'
|
|
18
|
-
import { findMostRecentBlock } from '../../primitives/index.ts'
|
|
19
|
-
import { HydratedCache } from '../../utils/index.ts'
|
|
20
|
-
|
|
21
|
-
/** Parameters for SimpleFinalizationViewer. */
|
|
22
|
-
export interface SimpleFinalizationViewerParams extends CreatableProviderParams {
|
|
23
|
-
finalizedArchivist: ReadArchivist
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** SimpleFinalizationViewer implementation. */
|
|
27
|
-
@creatableProvider()
|
|
28
|
-
export class SimpleFinalizationViewer extends AbstractCreatableProvider<SimpleFinalizationViewerParams> implements FinalizationViewer {
|
|
29
|
-
static readonly defaultMoniker = FinalizationViewerMoniker
|
|
30
|
-
static readonly dependencies = [ChainContractViewerMoniker]
|
|
31
|
-
static readonly monikers = [FinalizationViewerMoniker]
|
|
32
|
-
moniker = SimpleFinalizationViewer.defaultMoniker
|
|
33
|
-
|
|
34
|
-
protected _chainId!: ChainId
|
|
35
|
-
protected _store: ChainStoreRead | undefined
|
|
36
|
-
|
|
37
|
-
private _signedHydratedBlockCache: HydratedCache<SignedHydratedBlockWithStorageMeta> | undefined
|
|
38
|
-
|
|
39
|
-
protected get finalizedArchivist() {
|
|
40
|
-
return this.params.finalizedArchivist
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
protected get hydratedBlockCache(): HydratedCache<SignedHydratedBlockWithStorageMeta> {
|
|
44
|
-
if (this._signedHydratedBlockCache) return this._signedHydratedBlockCache
|
|
45
|
-
const context = this.getBlockContextRead()
|
|
46
|
-
this._signedHydratedBlockCache = new HydratedCache<SignedHydratedBlockWithStorageMeta>(context, async (
|
|
47
|
-
store: ChainStoreRead,
|
|
48
|
-
hash: Hash,
|
|
49
|
-
maxDepth?: number,
|
|
50
|
-
minDepth?: number,
|
|
51
|
-
) => {
|
|
52
|
-
const result = await hydrateBlock(context, hash, maxDepth, minDepth)
|
|
53
|
-
return asSignedHydratedBlockWithStorageMeta(result, true)
|
|
54
|
-
}, 200)
|
|
55
|
-
return this._signedHydratedBlockCache
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
protected get store() {
|
|
59
|
-
return this._store!
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static override async paramsHandler(params: Partial<SimpleFinalizationViewerParams>) {
|
|
63
|
-
return {
|
|
64
|
-
...await super.paramsHandler(params),
|
|
65
|
-
finalizedArchivist: assertEx(params.finalizedArchivist, () => 'finalizedArchivist is required'),
|
|
66
|
-
} satisfies SimpleFinalizationViewerParams
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
chainId() {
|
|
70
|
-
return this._chainId
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
override async createHandler() {
|
|
74
|
-
await super.createHandler()
|
|
75
|
-
this._chainId = assertEx(this.config.chain.id ?? (await findMostRecentBlock(this.params.finalizedArchivist))?.chain, () => 'chain.id is required if empty archivist')
|
|
76
|
-
this._store = { chainMap: this.params.finalizedArchivist }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async head(): Promise<SignedHydratedBlockWithHashMeta> {
|
|
80
|
-
return await this.spanAsync('head', async () => {
|
|
81
|
-
const currentHead = assertEx(await this.getCurrentHead(), () => 'Could not find most recent block [currentBlock]')
|
|
82
|
-
const cache = this.hydratedBlockCache
|
|
83
|
-
const block = await cache.get(currentHead._hash)
|
|
84
|
-
if (!block) {
|
|
85
|
-
console.log(`Could not find current block with hash ${currentHead!._hash}`)
|
|
86
|
-
}
|
|
87
|
-
return assertEx(block, () => 'Could not find current block')
|
|
88
|
-
}, this.context)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async headBlock(): Promise<SignedBlockBoundWitnessWithHashMeta> {
|
|
92
|
-
return (await this.head())[0]
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async headHash(): Promise<Hash> {
|
|
96
|
-
return (await this.headBlock())._hash
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async headNumber(): Promise<XL1BlockNumber> {
|
|
100
|
-
return (await this.headBlock()).block
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
protected getBlockContextRead(): BlockContextRead {
|
|
104
|
-
return {
|
|
105
|
-
...this.context,
|
|
106
|
-
chainMap: this.store.chainMap,
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
protected async getChainContextRead(): Promise<ChainContextRead> {
|
|
111
|
-
return {
|
|
112
|
-
...this.getBlockContextRead(),
|
|
113
|
-
head: (await this.head())[0],
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
protected async getCurrentHead() {
|
|
118
|
-
const chainArchivist = this.finalizedArchivist
|
|
119
|
-
const result = assertEx(await findMostRecentBlock(chainArchivist), () => 'Could not find most recent block [getCurrentHead]')
|
|
120
|
-
assertEx(result?.chain === this._chainId, () => 'Chain ID does not match head block chain ID')
|
|
121
|
-
return result
|
|
122
|
-
}
|
|
123
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
XyoConnection,
|
|
3
|
-
XyoGateway,
|
|
4
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
5
|
-
import { XyoConnectionMoniker, XyoGatewayMoniker } from '@xyo-network/xl1-protocol-lib'
|
|
6
|
-
|
|
7
|
-
import type { CreatableProviderParams } from '../../CreatableProvider/index.ts'
|
|
8
|
-
import { AbstractCreatableProvider } from '../../CreatableProvider/index.ts'
|
|
9
|
-
|
|
10
|
-
/** Parameters for SimpleXyoGateway. */
|
|
11
|
-
export interface SimpleXyoGatewayParams extends CreatableProviderParams {}
|
|
12
|
-
|
|
13
|
-
/** SimpleXyoGateway implementation. */
|
|
14
|
-
export class SimpleXyoGateway extends AbstractCreatableProvider<SimpleXyoGatewayParams> implements XyoGateway {
|
|
15
|
-
static readonly defaultMoniker = XyoGatewayMoniker
|
|
16
|
-
static readonly dependencies = [XyoConnectionMoniker]
|
|
17
|
-
static readonly monikers = [XyoGatewayMoniker]
|
|
18
|
-
moniker = SimpleXyoGateway.defaultMoniker
|
|
19
|
-
|
|
20
|
-
private _connection!: XyoConnection
|
|
21
|
-
|
|
22
|
-
get connection(): XyoConnection {
|
|
23
|
-
return this._connection
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
override async createHandler() {
|
|
27
|
-
await super.createHandler()
|
|
28
|
-
this._connection = await this.locator.getInstance<XyoConnection>(XyoConnectionMoniker)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Address, Hash, Hex,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
4
|
-
import {
|
|
5
|
-
assertEx, BigIntToJsonZod, isDefined,
|
|
6
|
-
} from '@xylabs/sdk-js'
|
|
7
|
-
import { type Payload, type WithHashMeta } from '@xyo-network/sdk-js'
|
|
8
|
-
import { PayloadBuilder } from '@xyo-network/sdk-js'
|
|
9
|
-
import type {
|
|
10
|
-
AllowedBlockPayload, AttoXL1, ConfirmSubmittedTransactionOptions,
|
|
11
|
-
DataLakeRunner, SignedHydratedTransaction, SignedHydratedTransactionWithHashMeta, TransactionOptions, Transfer, UnsignedHydratedTransaction,
|
|
12
|
-
XyoConnection, XyoGatewayRunner, XyoSigner,
|
|
13
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
14
|
-
import {
|
|
15
|
-
asXL1BlockNumber, DataLakeRunnerMoniker, isSignedHydratedTransaction, TransferSchema, XyoConnectionMoniker, XyoGatewayMoniker, XyoGatewayRunnerMoniker, XyoSignerMoniker,
|
|
16
|
-
} from '@xyo-network/xl1-protocol-lib'
|
|
17
|
-
|
|
18
|
-
import type { CreatableProviderParams } from '../../CreatableProvider/index.ts'
|
|
19
|
-
import { AbstractCreatableProvider } from '../../CreatableProvider/index.ts'
|
|
20
|
-
import {
|
|
21
|
-
buildUnsignedTransaction, confirmSubmittedTransaction, flattenHydratedTransaction,
|
|
22
|
-
} from '../../transaction/index.ts'
|
|
23
|
-
|
|
24
|
-
/** Parameters for SimpleXyoGatewayRunner. */
|
|
25
|
-
export interface SimpleXyoGatewayRunnerParams extends CreatableProviderParams {
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** SimpleXyoGatewayRunner implementation. */
|
|
30
|
-
export class SimpleXyoGatewayRunner extends AbstractCreatableProvider<SimpleXyoGatewayRunnerParams> implements XyoGatewayRunner {
|
|
31
|
-
static readonly defaultMoniker = XyoGatewayRunnerMoniker
|
|
32
|
-
static readonly dependencies = [XyoConnectionMoniker, XyoSignerMoniker]
|
|
33
|
-
static readonly monikers = [XyoGatewayRunnerMoniker, XyoGatewayMoniker]
|
|
34
|
-
moniker = SimpleXyoGatewayRunner.defaultMoniker
|
|
35
|
-
|
|
36
|
-
private _connection!: XyoConnection
|
|
37
|
-
private _dataLakeRunner?: DataLakeRunner
|
|
38
|
-
private _signer!: XyoSigner
|
|
39
|
-
|
|
40
|
-
get connection(): XyoConnection {
|
|
41
|
-
return this._connection
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
get dataLakeRunner(): DataLakeRunner | undefined {
|
|
45
|
-
return this._dataLakeRunner
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
get signer(): XyoSigner {
|
|
49
|
-
return this._signer
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async addPayloadsToChain(
|
|
53
|
-
onChain: AllowedBlockPayload[],
|
|
54
|
-
offChain: Payload[],
|
|
55
|
-
options?: TransactionOptions,
|
|
56
|
-
): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
57
|
-
// Get chain providers
|
|
58
|
-
const viewer = assertEx(this.connection.viewer, () => 'No viewer available on connection')
|
|
59
|
-
|
|
60
|
-
// Resolve transaction options
|
|
61
|
-
const {
|
|
62
|
-
nbf, exp, chain, fees,
|
|
63
|
-
} = options ?? {}
|
|
64
|
-
const resolvedChainId = isDefined(chain) ? chain : await viewer.chainId()
|
|
65
|
-
const resolvedNbf = asXL1BlockNumber(isDefined(nbf) ? nbf : await viewer.currentBlockNumber(), true)
|
|
66
|
-
const resolvedExp = asXL1BlockNumber(isDefined(exp) ? exp : resolvedNbf + 10, true)
|
|
67
|
-
|
|
68
|
-
// Build, sign, and broadcast the transaction
|
|
69
|
-
const tx = await buildUnsignedTransaction(resolvedChainId, onChain, offChain, resolvedNbf, resolvedExp, await this.signer.address(), fees)
|
|
70
|
-
return await this.addTransactionToChain(tx, await PayloadBuilder.addHashMeta(offChain))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async addTransactionToChain(
|
|
74
|
-
tx: UnsignedHydratedTransaction | SignedHydratedTransaction,
|
|
75
|
-
offChain: WithHashMeta<Payload>[] = [],
|
|
76
|
-
): Promise<[Hash, SignedHydratedTransactionWithHashMeta]> {
|
|
77
|
-
const connection = this.connection
|
|
78
|
-
|
|
79
|
-
const signer = this.signer
|
|
80
|
-
const runner = assertEx(connection.runner, () => 'No runner available on connection')
|
|
81
|
-
|
|
82
|
-
// Prepare for returning the SignedHydratedTransactionWithHashMeta
|
|
83
|
-
let signedTx: SignedHydratedTransactionWithHashMeta
|
|
84
|
-
|
|
85
|
-
// If the supplied transaction is already signed
|
|
86
|
-
if (isSignedHydratedTransaction(tx)) {
|
|
87
|
-
// Ensure it has hash meta
|
|
88
|
-
const [bw, payloads] = tx
|
|
89
|
-
const hashedBw = await PayloadBuilder.addHashMeta(bw)
|
|
90
|
-
const hashedPayloads = await PayloadBuilder.addHashMeta(payloads)
|
|
91
|
-
signedTx = [hashedBw, hashedPayloads]
|
|
92
|
-
} else {
|
|
93
|
-
// Otherwise, sign it using our signer
|
|
94
|
-
signedTx = await signer.signTransaction(tx)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
await this._dataLakeRunner?.insert([...flattenHydratedTransaction(signedTx), ...offChain])
|
|
98
|
-
|
|
99
|
-
// Broadcast the transaction
|
|
100
|
-
return [await runner.broadcastTransaction([signedTx[0], signedTx[1]]), signedTx]
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async confirmSubmittedTransaction(txHash: Hash, options?: ConfirmSubmittedTransactionOptions): Promise<SignedHydratedTransaction> {
|
|
104
|
-
return await confirmSubmittedTransaction(
|
|
105
|
-
assertEx(this.connection.viewer, () => 'Connection viewer is undefined'),
|
|
106
|
-
txHash,
|
|
107
|
-
options,
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
override async createHandler() {
|
|
112
|
-
await super.createHandler()
|
|
113
|
-
this._connection = await this.locator.getInstance<XyoConnection>(XyoConnectionMoniker)
|
|
114
|
-
this._signer = await this.locator.getInstance<XyoSigner>(XyoSignerMoniker)
|
|
115
|
-
this._dataLakeRunner = await this.locator.tryGetInstance<DataLakeRunner>(DataLakeRunnerMoniker)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
async send(to: Address, amount: AttoXL1, options?: TransactionOptions): Promise<Hash> {
|
|
119
|
-
return await this.sendMany({ [to]: amount }, options)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async sendMany(transfers: Record<Address, AttoXL1>, options?: TransactionOptions): Promise<Hash> {
|
|
123
|
-
const from = await this.signer.address()
|
|
124
|
-
const hexTransfers: Record<Address, Hex> = Object.fromEntries(
|
|
125
|
-
Object.entries(transfers).map(([address, amount]) => ([
|
|
126
|
-
address, BigIntToJsonZod.parse(amount),
|
|
127
|
-
])),
|
|
128
|
-
)
|
|
129
|
-
const transfer = new PayloadBuilder<Transfer>({ schema: TransferSchema }).fields({
|
|
130
|
-
from,
|
|
131
|
-
transfers: hexTransfers,
|
|
132
|
-
epoch: Date.now(),
|
|
133
|
-
}).build()
|
|
134
|
-
const [hash] = await this.addPayloadsToChain([transfer], [], options)
|
|
135
|
-
return hash
|
|
136
|
-
}
|
|
137
|
-
}
|
package/src/simple/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export * from './accountBalance/index.ts'
|
|
2
|
-
export * from './block/index.ts'
|
|
3
|
-
export * from './blockReward/index.ts'
|
|
4
|
-
export * from './blockValidation/index.ts'
|
|
5
|
-
export * from './chainContractViewer/index.ts'
|
|
6
|
-
export * from './client/index.ts'
|
|
7
|
-
export * from './datalake/index.ts'
|
|
8
|
-
export * from './finalization/index.ts'
|
|
9
|
-
export * from './gateway/index.ts'
|
|
10
|
-
export * from './mempool/index.ts'
|
|
11
|
-
export * from './network/index.ts'
|
|
12
|
-
export * from './permissions/index.ts'
|
|
13
|
-
export * from './runner/index.ts'
|
|
14
|
-
export * from './signer/index.ts'
|
|
15
|
-
export * from './StakeEventsViewer/index.ts'
|
|
16
|
-
export * from './StakeTotalsViewer/index.ts'
|
|
17
|
-
export * from './StakeViewer/index.ts'
|
|
18
|
-
export * from './timeSync2/index.ts'
|
|
19
|
-
export * from './transactionValidation/index.ts'
|
|
20
|
-
export * from './transactionValidation/index.ts'
|
|
21
|
-
export * from './TransactionViewer/index.ts'
|
|
22
|
-
export * from './windowedBlock/index.ts'
|