@xyo-network/chain-services 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/AccountBalance/BaseAccountBalanceService.d.ts +15 -5
- package/dist/neutral/AccountBalance/BaseAccountBalanceService.d.ts.map +1 -1
- package/dist/neutral/AccountTransfers/BaseAccountTransfersService.d.ts +1 -1
- package/dist/neutral/AccountTransfers/BaseAccountTransfersService.d.ts.map +1 -1
- package/dist/neutral/AccountTransfers/index.d.ts +0 -1
- package/dist/neutral/AccountTransfers/index.d.ts.map +1 -1
- package/dist/neutral/BaseService.d.ts +2 -3
- package/dist/neutral/BaseService.d.ts.map +1 -1
- package/dist/neutral/BlockProducer/BaseBlockProducerService.d.ts +4 -8
- package/dist/neutral/BlockProducer/BaseBlockProducerService.d.ts.map +1 -1
- package/dist/neutral/BlockProducer/generateTransactionFeeTransfers.d.ts +1 -1
- package/dist/neutral/BlockProducer/generateTransactionFeeTransfers.d.ts.map +1 -1
- package/dist/neutral/BlockProducer/spec/BaseBlockProducerService.spec.d.ts.map +1 -1
- package/dist/neutral/BlockReward/BaseBlockRewardService.d.ts +1 -2
- package/dist/neutral/BlockReward/BaseBlockRewardService.d.ts.map +1 -1
- package/dist/neutral/BlockReward/MemoryBlockRewardService.d.ts +1 -1
- package/dist/neutral/BlockReward/MemoryBlockRewardService.d.ts.map +1 -1
- package/dist/neutral/ChainBlockNumberIteration/ChainBlockNumberIterationService.d.ts +1 -1
- package/dist/neutral/ChainBlockNumberIteration/ChainBlockNumberIterationService.d.ts.map +1 -1
- package/dist/neutral/ChainBlockNumberIteration/model/BlockNumberIteration.d.ts +1 -1
- package/dist/neutral/ChainBlockNumberIteration/model/BlockNumberIteration.d.ts.map +1 -1
- package/dist/neutral/ChainService/Evm/Evm.d.ts +1 -1
- package/dist/neutral/ChainService/Evm/Evm.d.ts.map +1 -1
- package/dist/neutral/ChainService/Memory/Memory.d.ts +1 -1
- package/dist/neutral/ChainService/Memory/Memory.d.ts.map +1 -1
- package/dist/neutral/ChainValidator/XyoValidator.d.ts +4 -9
- package/dist/neutral/ChainValidator/XyoValidator.d.ts.map +1 -1
- package/dist/neutral/ChainValidator/model/Validator.d.ts +1 -1
- package/dist/neutral/ChainValidator/model/Validator.d.ts.map +1 -1
- package/dist/neutral/Election/BaseElectionService.d.ts +1 -1
- package/dist/neutral/Election/BaseElectionService.d.ts.map +1 -1
- package/dist/neutral/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.d.ts +1 -2
- package/dist/neutral/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.d.ts.map +1 -1
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts +1 -1
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts.map +1 -1
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts +2 -4
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts.map +1 -1
- package/dist/neutral/StakeIntent/lib/getBlockSignedStakeDeclarations.d.ts.map +1 -1
- package/dist/neutral/StepStake/BaseStepStakeService.d.ts +1 -2
- package/dist/neutral/StepStake/BaseStepStakeService.d.ts.map +1 -1
- package/dist/neutral/Time/BaseTimeSyncService.d.ts +8 -11
- package/dist/neutral/Time/BaseTimeSyncService.d.ts.map +1 -1
- package/dist/neutral/blockViewerFromChainIteratorAndArchivist.d.ts +4 -0
- package/dist/neutral/blockViewerFromChainIteratorAndArchivist.d.ts.map +1 -0
- package/dist/neutral/index.mjs +194 -261
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/model/Params.d.ts +1 -2
- package/dist/neutral/model/Params.d.ts.map +1 -1
- package/package.json +26 -36
- package/src/AccountBalance/BaseAccountBalanceService.ts +34 -7
- package/src/AccountBalance/accountBalanceServiceFromArchivist.ts +2 -2
- package/src/AccountTransfers/BaseAccountTransfersService.ts +3 -2
- package/src/AccountTransfers/index.ts +0 -1
- package/src/BaseService.ts +2 -3
- package/src/BlockProducer/BaseBlockProducerService.ts +8 -7
- package/src/BlockProducer/generateTransactionFeeTransfers.ts +2 -2
- package/src/BlockProducer/spec/BaseBlockProducerService.spec.ts +10 -13
- package/src/BlockProducer/spec/generateTransactionTransfer.spec.ts +5 -5
- package/src/BlockReward/BaseBlockRewardService.ts +3 -3
- package/src/BlockReward/EvmBlockRewardService.ts +3 -3
- package/src/BlockReward/MemoryBlockRewardService.ts +3 -4
- package/src/BlockReward/spec/MemoryBlockRewardService.spec.ts +1 -1
- package/src/ChainBlockNumberIteration/ChainBlockNumberIterationService.ts +3 -3
- package/src/ChainBlockNumberIteration/model/BlockNumberIteration.ts +1 -1
- package/src/ChainService/Evm/Evm.ts +4 -3
- package/src/ChainService/Memory/Memory.ts +2 -2
- package/src/ChainValidator/XyoValidator.ts +4 -4
- package/src/ChainValidator/model/Validator.ts +1 -1
- package/src/Election/BaseElectionService.ts +3 -3
- package/src/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.ts +3 -3
- package/src/PendingTransactions/BasePendingTransactions.ts +6 -7
- package/src/PendingTransactions/hydratedTransactionToPayloadBundle.ts +1 -1
- package/src/PendingTransactions/spec/BasePendingTransactions.spec.ts +4 -4
- package/src/StakeIntent/XyoStakeIntentService.ts +5 -8
- package/src/StakeIntent/lib/getBlockSignedStakeDeclarations.ts +2 -3
- package/src/StepStake/BaseStepStakeService.ts +3 -3
- package/src/Time/BaseTimeSyncService.ts +25 -80
- package/src/blockViewerFromChainIteratorAndArchivist.ts +61 -0
- package/src/model/Params.ts +1 -2
- package/dist/neutral/AccountTransfers/accountTransfersServiceFromArchivist.d.ts +0 -6
- package/dist/neutral/AccountTransfers/accountTransfersServiceFromArchivist.d.ts.map +0 -1
- package/src/AccountTransfers/accountTransfersServiceFromArchivist.ts +0 -39
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { CreatableParams } from '@xylabs/
|
|
2
|
-
import type { EmptyObject } from '@xylabs/object';
|
|
1
|
+
import type { CreatableParams, EmptyObject } from '@xylabs/sdk-js';
|
|
3
2
|
import type { AccountInstance } from '@xyo-network/account-model';
|
|
4
3
|
import type { OpenTelemetryProviders } from '@xyo-network/xl1-protocol';
|
|
5
4
|
export interface BaseServiceParams<TConfig extends EmptyObject = EmptyObject> extends CreatableParams, OpenTelemetryProviders {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/model/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/model/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAEvE,MAAM,WAAW,iBAAiB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,eAAe,EAAE,sBAAsB;IAC3H,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,4BAA4B,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,iBAAiB,CAAC,OAAO,CAAC;IACzH,OAAO,EAAE,eAAe,CAAA;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/chain-services",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.11",
|
|
5
5
|
"description": "XYO Layer One SDK Services",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -37,53 +37,43 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@opentelemetry/api": "~1.9.0",
|
|
40
|
-
"@xylabs/
|
|
41
|
-
"@xylabs/
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@xyo-network/
|
|
53
|
-
"@xyo-network/
|
|
54
|
-
"@xyo-network/archivist-model": "~5.1.21",
|
|
55
|
-
"@xyo-network/boundwitness-model": "~5.1.21",
|
|
56
|
-
"@xyo-network/boundwitness-validator": "~5.1.21",
|
|
57
|
-
"@xyo-network/boundwitness-wrapper": "~5.1.21",
|
|
58
|
-
"@xyo-network/chain-analyze": "~1.16.9",
|
|
59
|
-
"@xyo-network/chain-modules": "~1.16.9",
|
|
60
|
-
"@xyo-network/chain-protocol": "~1.16.9",
|
|
61
|
-
"@xyo-network/chain-utils": "~1.16.9",
|
|
62
|
-
"@xyo-network/payload-builder": "~5.1.21",
|
|
63
|
-
"@xyo-network/payload-model": "~5.1.21",
|
|
40
|
+
"@xylabs/sdk-js": "~5.0.33",
|
|
41
|
+
"@xylabs/telemetry": "~5.0.33",
|
|
42
|
+
"@xyo-network/account-model": "~5.1.22",
|
|
43
|
+
"@xyo-network/archivist-memory": "~5.1.22",
|
|
44
|
+
"@xyo-network/archivist-model": "~5.1.22",
|
|
45
|
+
"@xyo-network/boundwitness-model": "~5.1.22",
|
|
46
|
+
"@xyo-network/boundwitness-validator": "~5.1.22",
|
|
47
|
+
"@xyo-network/boundwitness-wrapper": "~5.1.22",
|
|
48
|
+
"@xyo-network/chain-analyze": "~1.16.11",
|
|
49
|
+
"@xyo-network/chain-modules": "~1.16.11",
|
|
50
|
+
"@xyo-network/chain-protocol": "~1.16.11",
|
|
51
|
+
"@xyo-network/chain-utils": "~1.16.11",
|
|
52
|
+
"@xyo-network/payload-builder": "~5.1.22",
|
|
53
|
+
"@xyo-network/payload-model": "~5.1.22",
|
|
64
54
|
"@xyo-network/typechain": "~4.0.10",
|
|
65
|
-
"@xyo-network/xl1-protocol": "~1.13.
|
|
66
|
-
"@xyo-network/xl1-protocol-sdk": "~1.16.
|
|
67
|
-
"@xyo-network/xl1-validation": "~1.16.
|
|
68
|
-
"@xyo-network/xl1-wrappers": "~1.16.
|
|
55
|
+
"@xyo-network/xl1-protocol": "~1.13.11",
|
|
56
|
+
"@xyo-network/xl1-protocol-sdk": "~1.16.11",
|
|
57
|
+
"@xyo-network/xl1-validation": "~1.16.11",
|
|
58
|
+
"@xyo-network/xl1-wrappers": "~1.16.11",
|
|
69
59
|
"async-mutex": "~0.5.0",
|
|
70
60
|
"ethers": "6.15.0",
|
|
71
61
|
"lru-cache": "~11.2.2"
|
|
72
62
|
},
|
|
73
63
|
"devDependencies": {
|
|
74
64
|
"@types/node": "~24.10.1",
|
|
75
|
-
"@xylabs/
|
|
65
|
+
"@xylabs/sdk-js": "~5.0.33",
|
|
76
66
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
77
67
|
"@xylabs/tsconfig": "~7.2.8",
|
|
78
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
79
|
-
"@xyo-network/account": "~5.1.
|
|
80
|
-
"@xyo-network/account-model": "~5.1.
|
|
81
|
-
"@xyo-network/chain-validation": "~1.16.
|
|
82
|
-
"@xyo-network/wallet": "~5.1.
|
|
68
|
+
"@xylabs/vitest-extended": "~5.0.33",
|
|
69
|
+
"@xyo-network/account": "~5.1.22",
|
|
70
|
+
"@xyo-network/account-model": "~5.1.22",
|
|
71
|
+
"@xyo-network/chain-validation": "~1.16.11",
|
|
72
|
+
"@xyo-network/wallet": "~5.1.22",
|
|
83
73
|
"eslint": "^9.39.1",
|
|
84
74
|
"tslib": "~2.8.1",
|
|
85
75
|
"typescript": "~5.9.3",
|
|
86
|
-
"vitest": "~4.0.
|
|
76
|
+
"vitest": "~4.0.9",
|
|
87
77
|
"vitest-mock-extended": "~3.1.0",
|
|
88
78
|
"web3-types": "~1.10.0"
|
|
89
79
|
},
|
|
@@ -1,31 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Address, creatable, Hash,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { spanRootAsync } from '@xylabs/telemetry'
|
|
5
|
+
import { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
6
|
import { AttoXL1, XL1BlockRange } from '@xyo-network/xl1-protocol'
|
|
6
7
|
import {
|
|
7
8
|
AccountBalanceHistoryItem,
|
|
8
9
|
AccountBalanceService,
|
|
9
10
|
balancesSummary,
|
|
10
11
|
BalanceStepSummaryContext,
|
|
12
|
+
BlockViewer,
|
|
13
|
+
EventingChainBlockNumberIteratorService,
|
|
14
|
+
SimpleAccountBalanceViewer,
|
|
15
|
+
TransfersStepSummaryContext,
|
|
11
16
|
} from '@xyo-network/xl1-protocol-sdk'
|
|
12
17
|
|
|
13
18
|
import { BaseService } from '../BaseService.ts'
|
|
19
|
+
import { blockViewerFromChainIteratorAndArchivist } from '../blockViewerFromChainIteratorAndArchivist.ts'
|
|
14
20
|
import { BaseServiceParams } from '../model/index.ts'
|
|
15
21
|
|
|
16
22
|
export interface BaseAccountBalanceServiceParams extends BaseServiceParams {
|
|
23
|
+
chainArchivist: ReadArchivist
|
|
24
|
+
chainIterator: EventingChainBlockNumberIteratorService
|
|
17
25
|
context: BalanceStepSummaryContext
|
|
26
|
+
transferContext: TransfersStepSummaryContext
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
@creatable()
|
|
21
30
|
export class BaseAccountBalanceService extends BaseService<BaseAccountBalanceServiceParams> implements AccountBalanceService {
|
|
31
|
+
protected accountBalanceViewer!: AccountBalanceService
|
|
32
|
+
protected blockViewer!: BlockViewer
|
|
33
|
+
|
|
22
34
|
async accountBalance(address: Address, headOrRange?: XL1BlockRange | Hash): Promise<AttoXL1> {
|
|
23
35
|
const balances = await this.accountBalances([address], headOrRange)
|
|
24
36
|
return balances[address] ?? AttoXL1(0n)
|
|
25
37
|
}
|
|
26
38
|
|
|
27
|
-
accountBalanceHistory(
|
|
28
|
-
|
|
39
|
+
async accountBalanceHistory(address: Address): Promise<AccountBalanceHistoryItem[]>
|
|
40
|
+
async accountBalanceHistory(address: Address, head: Hash): Promise<AccountBalanceHistoryItem[]>
|
|
41
|
+
async accountBalanceHistory(address: Address, range: XL1BlockRange): Promise<AccountBalanceHistoryItem[]>
|
|
42
|
+
async accountBalanceHistory(address: Address, headOrRange?: Hash | XL1BlockRange): Promise<AccountBalanceHistoryItem[]> {
|
|
43
|
+
return await this.accountBalanceViewer.accountBalanceHistory(address, headOrRange)
|
|
29
44
|
}
|
|
30
45
|
|
|
31
46
|
async accountBalances(address: Address[], _headOrRange?: XL1BlockRange | Hash): Promise<Partial<Record<Address, AttoXL1>>> {
|
|
@@ -42,7 +57,19 @@ export class BaseAccountBalanceService extends BaseService<BaseAccountBalanceSer
|
|
|
42
57
|
})
|
|
43
58
|
}
|
|
44
59
|
|
|
45
|
-
accountBalancesHistories(
|
|
46
|
-
|
|
60
|
+
async accountBalancesHistories(addresses: Address[]): Promise<Partial<Record<Address, AccountBalanceHistoryItem[]>>>
|
|
61
|
+
async accountBalancesHistories(addresses: Address[], head: Hash): Promise<Partial<Record<Address, AccountBalanceHistoryItem[]>>>
|
|
62
|
+
async accountBalancesHistories(addresses: Address[], range: XL1BlockRange): Promise<Partial<Record<Address, AccountBalanceHistoryItem[]>>>
|
|
63
|
+
async accountBalancesHistories(addresses: Address[], headOrRange?: Hash | XL1BlockRange): Promise<Partial<Record<Address, AccountBalanceHistoryItem[]>>> {
|
|
64
|
+
return await this.accountBalanceViewer.accountBalancesHistories(addresses, headOrRange)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override createHandler() {
|
|
68
|
+
this.blockViewer = blockViewerFromChainIteratorAndArchivist(this.params.chainIterator, this.params.chainArchivist)
|
|
69
|
+
this.accountBalanceViewer = new SimpleAccountBalanceViewer(
|
|
70
|
+
this.params.context,
|
|
71
|
+
this.params.transferContext,
|
|
72
|
+
this.blockViewer,
|
|
73
|
+
)
|
|
47
74
|
}
|
|
48
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
+
import { assertEx } from '@xylabs/sdk-js'
|
|
3
3
|
import type { ReadArchivist } from '@xyo-network/archivist-model'
|
|
4
4
|
import { findMostRecentBlock } from '@xyo-network/chain-protocol'
|
|
5
5
|
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Address, creatable, Hash,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
3
4
|
import { spanRootAsync } from '@xylabs/telemetry'
|
|
4
5
|
import { AttoXL1 } from '@xyo-network/xl1-protocol'
|
|
5
6
|
import {
|
package/src/BaseService.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type { Promisable } from '@xylabs/promise'
|
|
1
|
+
import type { EventData, Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import { AbstractCreatable, creatable } from '@xylabs/sdk-js'
|
|
4
3
|
import { spanRoot, spanRootAsync } from '@xylabs/telemetry'
|
|
5
4
|
import { Mutex } from 'async-mutex'
|
|
6
5
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
|
-
import { assertEx } from '@xylabs/assert'
|
|
3
|
-
import { creatable } from '@xylabs/creatable'
|
|
4
|
-
import { exists } from '@xylabs/exists'
|
|
5
2
|
import {
|
|
6
|
-
Address,
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Address, asHash, assertEx, creatable,
|
|
4
|
+
exists,
|
|
5
|
+
Hex,
|
|
6
|
+
hexToBigInt,
|
|
7
|
+
isDefined,
|
|
8
|
+
toHex,
|
|
9
|
+
} from '@xylabs/sdk-js'
|
|
9
10
|
import { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
10
11
|
import {
|
|
11
12
|
BlockRewardDiviner, FixedPercentageBlockRewardDiviner, FixedPercentageBlockRewardDivinerConfigSchema,
|
|
@@ -277,7 +278,7 @@ export class BaseBlockProducerService extends BaseService<BaseBlockProducerServi
|
|
|
277
278
|
|
|
278
279
|
private async generateTimePayload(head: WithStorageMeta<BlockBoundWitness>) {
|
|
279
280
|
const [ethereum, ethHashOrNull] = await this.time.currentTimeAndHash('ethereum')
|
|
280
|
-
const ethereumHash =
|
|
281
|
+
const ethereumHash = asHash(ethHashOrNull, () => 'No ethereum hash available from time sync service')
|
|
281
282
|
const timePayload: TimePayload = {
|
|
282
283
|
schema: TimeSchema,
|
|
283
284
|
// note, this is for the previous block
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { type Address, hexFromBigInt } from '@xylabs/sdk-js'
|
|
2
|
+
import { assertEx } from '@xylabs/sdk-js'
|
|
3
3
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
4
4
|
import type {
|
|
5
5
|
SignedHydratedTransaction,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
/* eslint-disable max-statements */
|
|
2
1
|
import '@xylabs/vitest-extended'
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { delay } from '@xylabs/delay'
|
|
8
|
-
import type { Address, Hash } from '@xylabs/hex'
|
|
3
|
+
import type {
|
|
4
|
+
Address, CreatableName, Hash, Promisable,
|
|
5
|
+
} from '@xylabs/sdk-js'
|
|
9
6
|
import {
|
|
10
|
-
asAddress,
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
asAddress, assertEx,
|
|
8
|
+
delay,
|
|
9
|
+
filterAs,
|
|
10
|
+
hexToBigInt, ZERO_HASH,
|
|
11
|
+
} from '@xylabs/sdk-js'
|
|
13
12
|
import { Account } from '@xyo-network/account'
|
|
14
13
|
import type { AccountInstance } from '@xyo-network/account-model'
|
|
15
14
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
@@ -287,10 +286,8 @@ describe('XyoBlockProducer', () => {
|
|
|
287
286
|
expect(blockRewardTransfer).toBeDefined()
|
|
288
287
|
let totalTransfer = 0n
|
|
289
288
|
for (const value of Object.values(blockRewardTransfer?.transfers ?? {})) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
totalTransfer += bigIntValue
|
|
293
|
-
}
|
|
289
|
+
const bigIntValue = hexToBigInt(value)
|
|
290
|
+
totalTransfer += bigIntValue
|
|
294
291
|
}
|
|
295
292
|
expect(totalTransfer).toEqual(3_000_000_000_000_000_000_000n)
|
|
296
293
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { assertEx } from '@xylabs/assert'
|
|
2
1
|
import type {
|
|
3
2
|
Address, Hash, Hex,
|
|
4
|
-
} from '@xylabs/
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
5
4
|
import {
|
|
6
|
-
asAddress,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
asAddress, assertEx,
|
|
6
|
+
hexToBigInt, isDefined,
|
|
7
|
+
toHex,
|
|
8
|
+
} from '@xylabs/sdk-js'
|
|
9
9
|
import type { Sequence, WithStorageMeta } from '@xyo-network/payload-model'
|
|
10
10
|
import { XYO_ZERO_ADDRESS } from '@xyo-network/xl1-protocol'
|
|
11
11
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
creatable, EmptyObject, Promisable,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { BlockRewardService } from '@xyo-network/xl1-protocol-sdk'
|
|
5
5
|
|
|
6
6
|
import { BaseService } from '../BaseService.ts'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
assertEx, creatable, toEthAddress,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { AccountInstance } from '@xyo-network/account-model'
|
|
5
5
|
import { XyoChainRewards__factory as XyoChainRewardsFactory } from '@xyo-network/typechain'
|
|
6
6
|
import {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { Promisable } from '@xylabs/promise'
|
|
1
|
+
import {
|
|
2
|
+
assertEx, creatable, Promisable, toFixedPoint,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
5
4
|
import { rewardFromBlockNumber } from '@xyo-network/chain-protocol'
|
|
6
5
|
import { BlockRewardService } from '@xyo-network/xl1-protocol-sdk'
|
|
7
6
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Hex } from '@xylabs/hex'
|
|
1
|
+
import type { Hex } from '@xylabs/sdk-js'
|
|
3
2
|
import {
|
|
3
|
+
assertEx,
|
|
4
4
|
isDefined, isNull, isUndefined,
|
|
5
|
-
} from '@xylabs/
|
|
5
|
+
} from '@xylabs/sdk-js'
|
|
6
6
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
7
7
|
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
8
8
|
import type { BlockBoundWitness } from '@xyo-network/xl1-protocol'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
+
import {
|
|
3
|
+
assertEx, toAddress, toEthAddress,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
4
5
|
import type { StakedXyoChain } from '@xyo-network/typechain'
|
|
5
6
|
import { StakedXyoChain__factory as StakedXyoChainFactory } from '@xyo-network/typechain'
|
|
6
7
|
import type { ChainService } from '@xyo-network/xl1-protocol-sdk'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Address } from '@xylabs/
|
|
2
|
-
import { ZERO_ADDRESS } from '@xylabs/
|
|
1
|
+
import type { Address } from '@xylabs/sdk-js'
|
|
2
|
+
import { ZERO_ADDRESS } from '@xylabs/sdk-js'
|
|
3
3
|
import type { ChainService, Config } from '@xyo-network/xl1-protocol-sdk'
|
|
4
4
|
|
|
5
5
|
import { BaseService } from '../../BaseService.ts'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
assertEx, creatable, EmptyObject,
|
|
3
|
+
Promisable,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
5
5
|
import { AccountInstance } from '@xyo-network/account-model'
|
|
6
6
|
import { ArchivistInstance, ReadArchivist } from '@xyo-network/archivist-model'
|
|
7
7
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Address, assertEx, creatable, Hash,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { hexToLast4BytesInt, shuffleWithSeed } from '@xyo-network/chain-utils'
|
|
5
5
|
import { WithHashMeta } from '@xyo-network/payload-model'
|
|
6
6
|
import { BlockBoundWitness } from '@xyo-network/xl1-protocol'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Address, creatable, Promisable,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
5
|
import {
|
|
6
6
|
StepIdentity,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ValueType } from '@opentelemetry/api'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { isDefined, isUndefined } from '@xylabs/typeof'
|
|
2
|
+
import {
|
|
3
|
+
assertEx, creatable,
|
|
4
|
+
exists,
|
|
5
|
+
filterAs, filterAsync, forget, Hash,
|
|
6
|
+
isDefined, isUndefined,
|
|
7
|
+
} from '@xylabs/sdk-js'
|
|
9
8
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
10
9
|
import { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
11
10
|
import { findMostRecentBlock } from '@xyo-network/chain-protocol'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js'
|
|
2
2
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
3
3
|
import type { PayloadBundle } from '@xyo-network/payload-model'
|
|
4
4
|
import { PayloadBundleSchema } from '@xyo-network/payload-model'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { CreatableName } from '@xylabs/sdk-js'
|
|
2
|
+
import {
|
|
3
|
+
asAddress, assertEx, delay,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
5
5
|
import { Account } from '@xyo-network/account'
|
|
6
6
|
import type { AccountInstance } from '@xyo-network/account-model'
|
|
7
7
|
import { MemoryArchivist } from '@xyo-network/archivist-memory'
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { filterAs } from '@xylabs/array'
|
|
2
|
-
import { assertEx } from '@xylabs/assert'
|
|
3
|
-
import { creatable } from '@xylabs/creatable'
|
|
4
1
|
import {
|
|
5
|
-
Address, asAddress, Hash,
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Address, asAddress, assertEx, creatable, filterAs, Hash,
|
|
3
|
+
isUndefined,
|
|
4
|
+
} from '@xylabs/sdk-js'
|
|
8
5
|
import { ArchivistInstance, ArchivistNextOptions } from '@xyo-network/archivist-model'
|
|
9
6
|
import {
|
|
10
7
|
analyzeChain, ChainStakeIntentAnalyzer,
|
|
@@ -94,14 +91,14 @@ export class XyoStakeIntentService extends BaseService<XyoStakeIntentServicePara
|
|
|
94
91
|
|
|
95
92
|
async getDeclaredCandidateRanges(address: Address, intent: Intent): Promise<Readonly<Readonly<[number, number]>[]>> {
|
|
96
93
|
await Promise.resolve()
|
|
97
|
-
assertEx(intent === 'producer', () => `
|
|
94
|
+
assertEx(intent === 'producer', () => `Support not yet added for intent ${intent}`)
|
|
98
95
|
const results = this._producers.get(address)
|
|
99
96
|
return results ?? []
|
|
100
97
|
}
|
|
101
98
|
|
|
102
99
|
async getDeclaredCandidatesForBlock(block: number, intent: Intent): Promise<Address[]> {
|
|
103
100
|
return await this.spanAsync('getDeclaredCandidatesForBlock', async () => {
|
|
104
|
-
assertEx(intent === 'producer', () => `
|
|
101
|
+
assertEx(intent === 'producer', () => `Support not yet added for intent ${intent}`)
|
|
105
102
|
const results = this._producers.findAllContaining(block)
|
|
106
103
|
const candidates = [...results]
|
|
107
104
|
const requiredMinimumStake = this.getRequiredMinimumStakeForIntent(intent)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { exists } from '@xylabs/
|
|
3
|
-
import type { Hash } from '@xylabs/hex'
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js'
|
|
2
|
+
import { exists, filterAs } from '@xylabs/sdk-js'
|
|
4
3
|
import type { ArchivistInstance } from '@xyo-network/archivist-model'
|
|
5
4
|
import type { BoundWitness } from '@xyo-network/boundwitness-model'
|
|
6
5
|
import { asOptionalBoundWitness } from '@xyo-network/boundwitness-model'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
Address, creatable, Promisable,
|
|
3
|
+
} from '@xylabs/sdk-js'
|
|
4
4
|
import { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
5
|
import { StepIdentity } from '@xyo-network/xl1-protocol'
|
|
6
6
|
import { StepStakeViewer } from '@xyo-network/xl1-protocol-sdk'
|