@xyo-network/chain-services 1.18.0 → 1.18.2
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/accountBalanceServiceFromArchivist.d.ts +1 -2
- package/dist/neutral/AccountBalance/accountBalanceServiceFromArchivist.d.ts.map +1 -1
- package/dist/neutral/BlockReward/EvmBlockRewardViewer.d.ts +1 -2
- package/dist/neutral/BlockReward/EvmBlockRewardViewer.d.ts.map +1 -1
- package/dist/neutral/ChainValidator/XyoValidator.d.ts +8 -8
- 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 +8 -5
- package/dist/neutral/Election/BaseElectionService.d.ts.map +1 -1
- package/dist/neutral/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.d.ts +16 -17
- package/dist/neutral/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.d.ts.map +1 -1
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts +3 -4
- package/dist/neutral/PendingTransactions/BasePendingTransactions.d.ts.map +1 -1
- package/dist/neutral/PendingTransactions/bundledPayloadToHydratedTransaction.d.ts +1 -1
- package/dist/neutral/PendingTransactions/bundledPayloadToHydratedTransaction.d.ts.map +1 -1
- package/dist/neutral/PendingTransactions/hydratedTransactionToPayloadBundle.d.ts +1 -1
- package/dist/neutral/PendingTransactions/hydratedTransactionToPayloadBundle.d.ts.map +1 -1
- package/dist/neutral/Schemas/BaseSchemasService.d.ts +6 -3
- package/dist/neutral/Schemas/BaseSchemasService.d.ts.map +1 -1
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts +13 -6
- package/dist/neutral/StakeIntent/XyoStakeIntentService.d.ts.map +1 -1
- package/dist/neutral/StakeIntent/lib/getBlockSignedStakeDeclarations.d.ts +1 -1
- package/dist/neutral/StakeIntent/lib/getBlockSignedStakeDeclarations.d.ts.map +1 -1
- package/dist/neutral/StepStake/BaseStepStakeService.d.ts +6 -7
- package/dist/neutral/StepStake/BaseStepStakeService.d.ts.map +1 -1
- package/dist/neutral/blockViewerFromChainIteratorAndArchivist.d.ts +1 -1
- package/dist/neutral/blockViewerFromChainIteratorAndArchivist.d.ts.map +1 -1
- package/dist/neutral/implementation/evm/initChainId.d.ts +1 -1
- package/dist/neutral/implementation/evm/initChainId.d.ts.map +1 -1
- package/dist/neutral/implementation/evm/initEvmProvider.d.ts +1 -1
- package/dist/neutral/implementation/evm/initEvmProvider.d.ts.map +1 -1
- package/dist/neutral/implementation/evm/initInfuraProvider.d.ts +1 -1
- package/dist/neutral/implementation/evm/initInfuraProvider.d.ts.map +1 -1
- package/dist/neutral/implementation/evm/initJsonRpcProvider.d.ts +1 -1
- package/dist/neutral/implementation/evm/initJsonRpcProvider.d.ts.map +1 -1
- package/dist/neutral/implementation/head/createBootstrapHead.d.ts +1 -1
- package/dist/neutral/implementation/head/createBootstrapHead.d.ts.map +1 -1
- package/dist/neutral/implementation/index.d.ts +0 -1
- package/dist/neutral/implementation/index.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +0 -2
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +180 -415
- 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/dist/neutral/simple/block/runner/SimpleBlockRunner.d.ts +34 -20
- package/dist/neutral/simple/block/runner/SimpleBlockRunner.d.ts.map +1 -1
- package/dist/neutral/simple/block/runner/generateTransactionFeeTransfers.d.ts +1 -1
- package/dist/neutral/simple/block/runner/generateTransactionFeeTransfers.d.ts.map +1 -1
- package/package.json +29 -32
- package/src/AccountBalance/accountBalanceServiceFromArchivist.ts +12 -9
- package/src/BlockReward/EvmBlockRewardViewer.ts +5 -7
- package/src/ChainValidator/XyoValidator.ts +9 -14
- package/src/ChainValidator/model/Validator.ts +1 -1
- package/src/Election/BaseElectionService.ts +15 -10
- package/src/NetworkStakeStepReward/BaseNetworkStakeStepRewardService.ts +24 -24
- package/src/PendingTransactions/BasePendingTransactions.ts +14 -14
- package/src/PendingTransactions/bundledPayloadToHydratedTransaction.ts +2 -2
- package/src/PendingTransactions/hydratedTransactionToPayloadBundle.ts +2 -2
- package/src/Schemas/BaseSchemasService.ts +12 -9
- package/src/StakeIntent/XyoStakeIntentService.ts +32 -29
- package/src/StakeIntent/lib/getBlockSignedStakeDeclarations.ts +2 -2
- package/src/StepStake/BaseStepStakeService.ts +7 -11
- package/src/blockViewerFromChainIteratorAndArchivist.ts +14 -4
- package/src/implementation/evm/initChainId.ts +1 -1
- package/src/implementation/evm/initEvmProvider.ts +1 -1
- package/src/implementation/evm/initInfuraProvider.ts +1 -1
- package/src/implementation/evm/initJsonRpcProvider.ts +1 -1
- package/src/implementation/head/createBootstrapHead.ts +2 -2
- package/src/implementation/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/model/Params.ts +1 -2
- package/src/simple/block/runner/SimpleBlockRunner.ts +39 -36
- package/src/simple/block/runner/generateTransactionFeeTransfers.ts +5 -4
- package/dist/neutral/BaseService.d.ts +0 -19
- package/dist/neutral/BaseService.d.ts.map +0 -1
- package/dist/neutral/ChainService/Evm/Evm.d.ts +0 -39
- package/dist/neutral/ChainService/Evm/Evm.d.ts.map +0 -1
- package/dist/neutral/ChainService/Evm/index.d.ts +0 -2
- package/dist/neutral/ChainService/Evm/index.d.ts.map +0 -1
- package/dist/neutral/ChainService/Memory/Memory.d.ts +0 -38
- package/dist/neutral/ChainService/Memory/Memory.d.ts.map +0 -1
- package/dist/neutral/ChainService/Memory/index.d.ts +0 -2
- package/dist/neutral/ChainService/Memory/index.d.ts.map +0 -1
- package/dist/neutral/ChainService/index.d.ts +0 -3
- package/dist/neutral/ChainService/index.d.ts.map +0 -1
- package/dist/neutral/implementation/chain/evm.d.ts +0 -7
- package/dist/neutral/implementation/chain/evm.d.ts.map +0 -1
- package/dist/neutral/implementation/chain/index.d.ts +0 -6
- package/dist/neutral/implementation/chain/index.d.ts.map +0 -1
- package/src/BaseService.ts +0 -45
- package/src/ChainService/Evm/Evm.ts +0 -105
- package/src/ChainService/Evm/index.ts +0 -1
- package/src/ChainService/Memory/Memory.ts +0 -106
- package/src/ChainService/Memory/index.ts +0 -1
- package/src/ChainService/index.ts +0 -2
- package/src/implementation/chain/evm.ts +0 -39
- package/src/implementation/chain/index.ts +0 -44
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AccountInstance } from '@xyo-network/account-model';
|
|
2
|
-
import type { OpenTelemetryProviders } from '@xyo-network/xl1-
|
|
3
|
-
import type { CreatableProviderParams } from '@xyo-network/xl1-protocol-sdk';
|
|
2
|
+
import type { CreatableProviderParams, OpenTelemetryProviders } from '@xyo-network/xl1-sdk';
|
|
4
3
|
export interface BaseServiceParams extends CreatableProviderParams, OpenTelemetryProviders {
|
|
5
4
|
}
|
|
6
5
|
export interface BaseAccountableServiceParams extends BaseServiceParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/model/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Params.d.ts","sourceRoot":"","sources":["../../../src/model/Params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE3F,MAAM,WAAW,iBAAkB,SAAQ,uBAAuB,EAAE,sBAAsB;CAEzF;AAED,MAAM,WAAW,4BAA6B,SAAQ,iBAAiB;IACrE,OAAO,EAAE,eAAe,CAAA;CACzB"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address,
|
|
1
|
+
import { Address, Promisable } from '@xylabs/sdk-js';
|
|
2
2
|
import { AccountInstance } from '@xyo-network/account-model';
|
|
3
3
|
import { ArchivistInstance } from '@xyo-network/archivist-model';
|
|
4
4
|
import { BlockRewardDiviner } from '@xyo-network/chain-modules';
|
|
5
5
|
import { WithHashMeta } from '@xyo-network/payload-model';
|
|
6
|
-
import { BlockBoundWitness, ChainStakeIntent, SignedBlockBoundWitnessWithHashMeta, SignedHydratedBlockWithHashMeta, Transfer } from '@xyo-network/xl1-
|
|
7
|
-
import { AbstractCreatableProvider, AccountBalanceViewer, BlockRewardViewer, BlockRunner, BlockValidationViewer, CreatableProviderParams, HydratedBlockStateValidationFunction, MempoolRunner, MempoolViewer, TimeSyncViewer } from '@xyo-network/xl1-protocol-sdk';
|
|
6
|
+
import { AbstractCreatableProvider, AccountBalanceViewer, BlockBoundWitness, BlockRewardViewer, BlockRunner, BlockValidationViewer, ChainStakeIntent, CreatableProviderParams, HydratedBlockStateValidationFunction, MempoolRunner, MempoolViewer, SignedBlockBoundWitnessWithHashMeta, SignedHydratedBlockWithHashMeta, TimeSyncViewer, Transfer } from '@xyo-network/xl1-sdk';
|
|
8
7
|
/**
|
|
9
8
|
* The default block size for a block
|
|
10
9
|
*/
|
|
@@ -18,14 +17,15 @@ export declare const XYO_PRODUCER_REDECLARATION_DURATION = 10000;
|
|
|
18
17
|
* their intent to produce blocks
|
|
19
18
|
*/
|
|
20
19
|
export declare const XYO_PRODUCER_REDECLARATION_WINDOW = 500;
|
|
21
|
-
export
|
|
20
|
+
export interface SimpleBlockRunnerParams extends CreatableProviderParams {
|
|
22
21
|
account: AccountInstance;
|
|
23
22
|
rejectedTransactionsArchivist?: ArchivistInstance;
|
|
24
23
|
rewardAddress: Address;
|
|
25
24
|
validateHydratedBlockState?: HydratedBlockStateValidationFunction;
|
|
26
|
-
}
|
|
25
|
+
}
|
|
27
26
|
export declare class SimpleBlockRunner extends AbstractCreatableProvider<SimpleBlockRunnerParams> implements BlockRunner {
|
|
28
27
|
static readonly defaultMoniker: "BlockRunner";
|
|
28
|
+
static readonly dependencies: ("AccountBalanceViewer" | "BlockRewardViewer" | "MempoolViewer" | "BlockValidationViewer" | "MempoolRunner" | "TimeSyncViewer")[];
|
|
29
29
|
static readonly monikers: "BlockRunner"[];
|
|
30
30
|
moniker: "BlockRunner";
|
|
31
31
|
protected _blockRewardDiviner?: BlockRewardDiviner;
|
|
@@ -36,6 +36,7 @@ export declare class SimpleBlockRunner extends AbstractCreatableProvider<SimpleB
|
|
|
36
36
|
private _address?;
|
|
37
37
|
private _blockRewardViewer?;
|
|
38
38
|
private _blockValidationViewer?;
|
|
39
|
+
private _chainId?;
|
|
39
40
|
private _mempoolRunner?;
|
|
40
41
|
private _mempoolViewer?;
|
|
41
42
|
private _rewardAddress?;
|
|
@@ -56,9 +57,14 @@ export declare class SimpleBlockRunner extends AbstractCreatableProvider<SimpleB
|
|
|
56
57
|
static get RedeclarationWindow(): number;
|
|
57
58
|
protected get account(): AccountInstance;
|
|
58
59
|
protected get accountBalanceViewer(): AccountBalanceViewer;
|
|
59
|
-
protected get address():
|
|
60
|
+
protected get address(): Lowercase<string> & {
|
|
61
|
+
readonly __hex: true;
|
|
62
|
+
} & {
|
|
63
|
+
readonly __address: true;
|
|
64
|
+
};
|
|
60
65
|
protected get blockRewardViewer(): BlockRewardViewer;
|
|
61
66
|
protected get blockValidationViewer(): BlockValidationViewer;
|
|
67
|
+
protected get chainId(): import("@xylabs/sdk-js").BrandedHex | undefined;
|
|
62
68
|
protected get mempoolRunner(): MempoolRunner;
|
|
63
69
|
protected get mempoolViewer(): MempoolViewer;
|
|
64
70
|
protected get rejectedTransactionsArchivist(): ArchivistInstance<import("@xyo-network/archivist-model").ArchivistParams<import("@xyo-network/module-model").AnyConfigSchema<import("@xyo-network/archivist-model").ArchivistConfig>>, import("@xyo-network/archivist-model").ArchivistModuleEventData, import("@xyo-network/payload-model").Payload>;
|
|
@@ -77,25 +83,33 @@ export declare class SimpleBlockRunner extends AbstractCreatableProvider<SimpleB
|
|
|
77
83
|
protected getProducerRedeclaration(head: WithHashMeta<BlockBoundWitness>): Promisable<ChainStakeIntent | undefined>;
|
|
78
84
|
protected proposeNextValidBlock(head: WithHashMeta<BlockBoundWitness>, validateBalances?: boolean, force?: boolean): Promise<[{
|
|
79
85
|
schema: "network.xyo.boundwitness";
|
|
80
|
-
addresses:
|
|
81
|
-
|
|
86
|
+
addresses: (Lowercase<string> & {
|
|
87
|
+
readonly __hex: true;
|
|
88
|
+
} & {
|
|
89
|
+
readonly __address: true;
|
|
90
|
+
})[];
|
|
91
|
+
payload_hashes: import("@xylabs/sdk-js").BrandedHash[];
|
|
82
92
|
payload_schemas: string[];
|
|
83
|
-
previous_hashes: (import("@xylabs/sdk-js").
|
|
84
|
-
$signatures:
|
|
85
|
-
block: import("@xyo-network/xl1-
|
|
86
|
-
chain:
|
|
87
|
-
previous: import("@xylabs/sdk-js").
|
|
93
|
+
previous_hashes: (import("@xylabs/sdk-js").BrandedHash | null)[];
|
|
94
|
+
$signatures: import("@xylabs/sdk-js").BrandedHex[];
|
|
95
|
+
block: import("@xyo-network/xl1-sdk").XL1BlockNumber;
|
|
96
|
+
chain: import("@xylabs/sdk-js").BrandedHex;
|
|
97
|
+
previous: import("@xylabs/sdk-js").BrandedHash | null;
|
|
88
98
|
$epoch: number;
|
|
89
|
-
_hash: import("@xylabs/sdk-js").
|
|
90
|
-
_dataHash: import("@xylabs/sdk-js").
|
|
91
|
-
$destination?:
|
|
92
|
-
|
|
99
|
+
_hash: import("@xylabs/sdk-js").BrandedHash;
|
|
100
|
+
_dataHash: import("@xylabs/sdk-js").BrandedHash;
|
|
101
|
+
$destination?: (Lowercase<string> & {
|
|
102
|
+
readonly __hex: true;
|
|
103
|
+
} & {
|
|
104
|
+
readonly __address: true;
|
|
105
|
+
}) | undefined;
|
|
106
|
+
$sourceQuery?: import("@xylabs/sdk-js").BrandedHash | undefined;
|
|
93
107
|
protocol?: number | undefined;
|
|
94
|
-
step_hashes?: import("@xylabs/sdk-js").
|
|
108
|
+
step_hashes?: import("@xylabs/sdk-js").BrandedHash[] | undefined;
|
|
95
109
|
}, {
|
|
96
110
|
schema: string;
|
|
97
|
-
_hash: import("@xylabs/sdk-js").
|
|
98
|
-
_dataHash: import("@xylabs/sdk-js").
|
|
111
|
+
_hash: import("@xylabs/sdk-js").BrandedHash;
|
|
112
|
+
_dataHash: import("@xylabs/sdk-js").BrandedHash;
|
|
99
113
|
}[]] | undefined>;
|
|
100
114
|
private filterByFunded;
|
|
101
115
|
private generateTimePayload;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleBlockRunner.d.ts","sourceRoot":"","sources":["../../../../../src/simple/block/runner/SimpleBlockRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"SimpleBlockRunner.d.ts","sourceRoot":"","sources":["../../../../../src/simple/block/runner/SimpleBlockRunner.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Address } from '@xylabs/sdk-js';
|
|
2
|
-
import type { SignedHydratedTransaction, Transfer } from '@xyo-network/xl1-
|
|
2
|
+
import type { SignedHydratedTransaction, Transfer } from '@xyo-network/xl1-sdk';
|
|
3
3
|
export declare function generateTransactionFeeTransfers(address: Address, transactions: SignedHydratedTransaction[]): Promise<Transfer[]>;
|
|
4
4
|
//# sourceMappingURL=generateTransactionFeeTransfers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTransactionFeeTransfers.d.ts","sourceRoot":"","sources":["../../../../../src/simple/block/runner/generateTransactionFeeTransfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,gBAAgB,CAAA;AAG5D,OAAO,KAAK,EACV,yBAAyB,EACzB,QAAQ,EAET,MAAM,
|
|
1
|
+
{"version":3,"file":"generateTransactionFeeTransfers.d.ts","sourceRoot":"","sources":["../../../../../src/simple/block/runner/generateTransactionFeeTransfers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAiB,MAAM,gBAAgB,CAAA;AAG5D,OAAO,KAAK,EACV,yBAAyB,EACzB,QAAQ,EAET,MAAM,sBAAsB,CAAA;AAM7B,wBAAsB,+BAA+B,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,yBAAyB,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CA0CtI"}
|
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.18.
|
|
4
|
+
"version": "1.18.2",
|
|
5
5
|
"description": "XYO Layer One SDK Services",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -40,44 +40,41 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@opentelemetry/api": "^1.9.0",
|
|
43
|
-
"@xylabs/sdk-js": "~5.0.
|
|
44
|
-
"@xyo-network/account-model": "~5.2.
|
|
45
|
-
"@xyo-network/archivist-memory": "~5.2.
|
|
46
|
-
"@xyo-network/archivist-model": "~5.2.
|
|
47
|
-
"@xyo-network/boundwitness-model": "~5.2.
|
|
48
|
-
"@xyo-network/boundwitness-validator": "~5.2.
|
|
49
|
-
"@xyo-network/boundwitness-wrapper": "~5.2.
|
|
50
|
-
"@xyo-network/chain-analyze": "~1.18.
|
|
51
|
-
"@xyo-network/chain-modules": "~1.18.
|
|
52
|
-
"@xyo-network/chain-protocol": "~1.18.
|
|
53
|
-
"@xyo-network/chain-utils": "~1.18.
|
|
54
|
-
"@xyo-network/payload-builder": "~5.2.
|
|
55
|
-
"@xyo-network/payload-model": "~5.2.
|
|
56
|
-
"@xyo-network/typechain": "~4.
|
|
57
|
-
"@xyo-network/xl1-
|
|
58
|
-
"@xyo-network/xl1-protocol-sdk": "~1.18.0",
|
|
59
|
-
"@xyo-network/xl1-validation": "~1.18.0",
|
|
60
|
-
"@xyo-network/xl1-wrappers": "~1.18.0",
|
|
43
|
+
"@xylabs/sdk-js": "~5.0.64",
|
|
44
|
+
"@xyo-network/account-model": "~5.2.25",
|
|
45
|
+
"@xyo-network/archivist-memory": "~5.2.25",
|
|
46
|
+
"@xyo-network/archivist-model": "~5.2.25",
|
|
47
|
+
"@xyo-network/boundwitness-model": "~5.2.25",
|
|
48
|
+
"@xyo-network/boundwitness-validator": "~5.2.25",
|
|
49
|
+
"@xyo-network/boundwitness-wrapper": "~5.2.25",
|
|
50
|
+
"@xyo-network/chain-analyze": "~1.18.2",
|
|
51
|
+
"@xyo-network/chain-modules": "~1.18.2",
|
|
52
|
+
"@xyo-network/chain-protocol": "~1.18.2",
|
|
53
|
+
"@xyo-network/chain-utils": "~1.18.2",
|
|
54
|
+
"@xyo-network/payload-builder": "~5.2.25",
|
|
55
|
+
"@xyo-network/payload-model": "~5.2.25",
|
|
56
|
+
"@xyo-network/typechain": "~4.1.1",
|
|
57
|
+
"@xyo-network/xl1-sdk": "~1.19.4",
|
|
61
58
|
"async-mutex": "~0.5.0",
|
|
62
59
|
"ethers": "^6.16.0",
|
|
63
|
-
"lru-cache": "^11.2.
|
|
60
|
+
"lru-cache": "^11.2.5"
|
|
64
61
|
},
|
|
65
62
|
"devDependencies": {
|
|
66
|
-
"@types/node": "~25.0.
|
|
67
|
-
"@xylabs/sdk-js": "~5.0.
|
|
68
|
-
"@xylabs/ts-scripts-yarn3": "~7.2
|
|
69
|
-
"@xylabs/tsconfig": "~7.2
|
|
70
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
71
|
-
"@xyo-network/account": "~5.2.
|
|
72
|
-
"@xyo-network/account-model": "~5.2.
|
|
73
|
-
"@xyo-network/chain-validation": "~1.18.
|
|
74
|
-
"@xyo-network/wallet": "~5.2.
|
|
75
|
-
"@xyo-network/wallet-model": "~5.2.
|
|
63
|
+
"@types/node": "~25.0.10",
|
|
64
|
+
"@xylabs/sdk-js": "~5.0.64",
|
|
65
|
+
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
66
|
+
"@xylabs/tsconfig": "~7.3.2",
|
|
67
|
+
"@xylabs/vitest-extended": "~5.0.64",
|
|
68
|
+
"@xyo-network/account": "~5.2.25",
|
|
69
|
+
"@xyo-network/account-model": "~5.2.25",
|
|
70
|
+
"@xyo-network/chain-validation": "~1.18.2",
|
|
71
|
+
"@xyo-network/wallet": "~5.2.25",
|
|
72
|
+
"@xyo-network/wallet-model": "~5.2.25",
|
|
76
73
|
"cosmiconfig": "^9.0.0",
|
|
77
74
|
"eslint": "^9.39.2",
|
|
78
75
|
"tslib": "~2.8.1",
|
|
79
76
|
"typescript": "~5.9.3",
|
|
80
|
-
"vitest": "~4.0.
|
|
77
|
+
"vitest": "~4.0.18",
|
|
81
78
|
"vitest-mock-extended": "~3.1.0",
|
|
82
79
|
"web3-types": "~1.10.0"
|
|
83
80
|
},
|
|
@@ -88,4 +85,4 @@
|
|
|
88
85
|
"publishConfig": {
|
|
89
86
|
"access": "restricted"
|
|
90
87
|
}
|
|
91
|
-
}
|
|
88
|
+
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { Hash } from '@xylabs/sdk-js'
|
|
2
2
|
import { assertEx } from '@xylabs/sdk-js'
|
|
3
3
|
import type { ReadWriteArchivist } from '@xyo-network/archivist-model'
|
|
4
|
-
import type { Payload, WithStorageMeta } from '@xyo-network/payload-model'
|
|
5
|
-
import type { ChainId } from '@xyo-network/xl1-protocol'
|
|
6
|
-
import { StepSizes } from '@xyo-network/xl1-protocol'
|
|
7
4
|
import type {
|
|
8
|
-
|
|
9
|
-
} from '@xyo-network/
|
|
5
|
+
Payload, WithHashMeta, WithStorageMeta,
|
|
6
|
+
} from '@xyo-network/payload-model'
|
|
7
|
+
import type {
|
|
8
|
+
AccountBalanceViewer, BalancesStepSummary, ChainId,
|
|
9
|
+
CreatableProviderContext, SimpleAccountBalanceViewerParams, TransfersStepSummary,
|
|
10
|
+
} from '@xyo-network/xl1-sdk'
|
|
10
11
|
import {
|
|
11
12
|
findMostRecentBlock, LruCacheMap, payloadMapFromStore,
|
|
12
|
-
SimpleAccountBalanceViewer,
|
|
13
|
-
} from '@xyo-network/xl1-
|
|
13
|
+
SimpleAccountBalanceViewer, StepSizes,
|
|
14
|
+
} from '@xyo-network/xl1-sdk'
|
|
14
15
|
import { Semaphore } from 'async-mutex'
|
|
15
16
|
|
|
16
17
|
// this is intended to only be used for testing
|
|
@@ -19,14 +20,14 @@ export const accountBalancesViewerFromArchivist = async (
|
|
|
19
20
|
chainId: ChainId,
|
|
20
21
|
archivist: ReadWriteArchivist<WithStorageMeta<Payload>>,
|
|
21
22
|
): Promise<AccountBalanceViewer> => {
|
|
22
|
-
const summaryMap = new LruCacheMap<string, BalancesStepSummary
|
|
23
|
+
const summaryMap = new LruCacheMap<string, WithHashMeta<BalancesStepSummary>>({
|
|
23
24
|
max: 100_000,
|
|
24
25
|
allowStale: true,
|
|
25
26
|
noDisposeOnSet: false,
|
|
26
27
|
updateAgeOnGet: true,
|
|
27
28
|
})
|
|
28
29
|
|
|
29
|
-
const transferSummaryMap = new LruCacheMap<string, TransfersStepSummary
|
|
30
|
+
const transferSummaryMap = new LruCacheMap<string, WithHashMeta<TransfersStepSummary>>({
|
|
30
31
|
max: 100_000,
|
|
31
32
|
allowStale: true,
|
|
32
33
|
noDisposeOnSet: false,
|
|
@@ -48,6 +49,7 @@ export const accountBalancesViewerFromArchivist = async (
|
|
|
48
49
|
summaryMap,
|
|
49
50
|
head: headFunc,
|
|
50
51
|
singletons: context.singletons,
|
|
52
|
+
caches: context.caches,
|
|
51
53
|
},
|
|
52
54
|
transfersSummaryContext: {
|
|
53
55
|
chainId,
|
|
@@ -56,6 +58,7 @@ export const accountBalancesViewerFromArchivist = async (
|
|
|
56
58
|
summaryMap: transferSummaryMap,
|
|
57
59
|
head: headFunc,
|
|
58
60
|
singletons: context.singletons,
|
|
61
|
+
caches: context.caches,
|
|
59
62
|
},
|
|
60
63
|
} satisfies SimpleAccountBalanceViewerParams)
|
|
61
64
|
return service
|
|
@@ -2,15 +2,13 @@ import {
|
|
|
2
2
|
AbstractCreatable,
|
|
3
3
|
assertEx, creatable, CreatableParams, toEthAddress,
|
|
4
4
|
} from '@xylabs/sdk-js'
|
|
5
|
-
import {
|
|
5
|
+
import { IXyoChainRewards__factory } from '@xyo-network/typechain'
|
|
6
6
|
import {
|
|
7
|
-
asAttoXL1, AttoXL1,
|
|
8
|
-
} from '@xyo-network/xl1-protocol'
|
|
9
|
-
import {
|
|
10
|
-
BlockRewardViewer,
|
|
7
|
+
asAttoXL1, AttoXL1, BlockRewardViewer,
|
|
11
8
|
BlockRewardViewerMoniker,
|
|
12
9
|
ChainContractViewer,
|
|
13
|
-
|
|
10
|
+
XL1BlockNumber,
|
|
11
|
+
} from '@xyo-network/xl1-sdk'
|
|
14
12
|
import { Provider } from 'ethers/providers'
|
|
15
13
|
|
|
16
14
|
export interface EvmBlockRewardViewerParams extends CreatableParams {
|
|
@@ -39,7 +37,7 @@ export class EvmBlockRewardViewer extends AbstractCreatable<EvmBlockRewardViewer
|
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
async allowedRewardForBlock(blockNumber: XL1BlockNumber): Promise<AttoXL1> {
|
|
42
|
-
const contract =
|
|
40
|
+
const contract = IXyoChainRewards__factory.connect(toEthAddress(this.contractAddress), this.provider)
|
|
43
41
|
return asAttoXL1(await contract.calcBlockReward(blockNumber))
|
|
44
42
|
}
|
|
45
43
|
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Promisable,
|
|
4
|
-
} from '@xylabs/sdk-js'
|
|
5
|
-
import {
|
|
1
|
+
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
+
import type {
|
|
6
3
|
BlockBoundWitness,
|
|
4
|
+
BlockViewer, HydratedBlockStateValidationFunction,
|
|
7
5
|
SignedHydratedTransactionWithStorageMeta,
|
|
8
|
-
} from '@xyo-network/xl1-
|
|
9
|
-
import {
|
|
10
|
-
BlockViewer, BlockViewerMoniker, HydratedBlockStateValidationFunction,
|
|
11
|
-
} from '@xyo-network/xl1-protocol-sdk'
|
|
6
|
+
} from '@xyo-network/xl1-sdk'
|
|
7
|
+
import { AbstractCreatableProvider, BlockViewerMoniker } from '@xyo-network/xl1-sdk'
|
|
12
8
|
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { Validator } from './model/index.ts'
|
|
9
|
+
import type { BaseServiceParams } from '../model/index.ts'
|
|
10
|
+
import type { Validator } from './model/index.ts'
|
|
16
11
|
|
|
17
12
|
export interface XyoValidatorParams extends BaseServiceParams {
|
|
18
13
|
// account: AccountInstance
|
|
@@ -25,8 +20,8 @@ export interface XyoValidatorParams extends BaseServiceParams {
|
|
|
25
20
|
validateHydratedBlockState: HydratedBlockStateValidationFunction
|
|
26
21
|
}
|
|
27
22
|
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export class XyoValidator<TParams extends XyoValidatorParams = XyoValidatorParams> extends AbstractCreatableProvider<TParams> implements Validator {
|
|
24
|
+
moniker = 'Validator'
|
|
30
25
|
private _blockViewer?: BlockViewer
|
|
31
26
|
// get address() {
|
|
32
27
|
// return this.account.address
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Promisable } from '@xylabs/sdk-js'
|
|
2
|
-
import type { BlockBoundWitness, SignedHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-
|
|
2
|
+
import type { BlockBoundWitness, SignedHydratedTransactionWithStorageMeta } from '@xyo-network/xl1-sdk'
|
|
3
3
|
|
|
4
4
|
export interface Validator {
|
|
5
5
|
validatePendingBlock(block: BlockBoundWitness): Promisable<Error[]>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Address, assertEx,
|
|
2
|
+
Address, assertEx, Hash,
|
|
3
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
|
-
import {
|
|
7
|
-
|
|
8
|
-
BlockViewer,
|
|
9
|
-
ChainStakeViewer,
|
|
10
|
-
|
|
6
|
+
import {
|
|
7
|
+
AbstractCreatableProvider,
|
|
8
|
+
type BlockViewer,
|
|
9
|
+
type ChainStakeViewer, creatableProvider,
|
|
10
|
+
type ElectionService, type StakeIntentService,
|
|
11
|
+
} from '@xyo-network/xl1-sdk'
|
|
12
|
+
import { BlockBoundWitness } from '@xyo-network/xl1-sdk'
|
|
11
13
|
|
|
12
|
-
import { BaseService } from '../BaseService.ts'
|
|
13
14
|
import { BaseServiceParams } from '../model/index.ts'
|
|
14
15
|
|
|
15
16
|
export interface BaseElectionServicesParams extends BaseServiceParams {
|
|
@@ -18,8 +19,12 @@ export interface BaseElectionServicesParams extends BaseServiceParams {
|
|
|
18
19
|
stakeIntentService?: StakeIntentService
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
@
|
|
22
|
-
export class BaseElectionService extends
|
|
22
|
+
@creatableProvider()
|
|
23
|
+
export class BaseElectionService extends AbstractCreatableProvider<BaseElectionServicesParams> implements ElectionService {
|
|
24
|
+
static readonly defaultMoniker = 'Election'
|
|
25
|
+
static readonly dependencies = []
|
|
26
|
+
static readonly monikers = ['Election']
|
|
27
|
+
moniker = BaseElectionService.defaultMoniker
|
|
23
28
|
get blockViewer() {
|
|
24
29
|
return assertEx(this.params.blockViewer, () => 'No block viewer')
|
|
25
30
|
}
|
|
@@ -38,7 +43,7 @@ export class BaseElectionService extends BaseService<BaseElectionServicesParams>
|
|
|
38
43
|
const candidates = await this.stakeIntentService.getDeclaredCandidatesForBlock(nextBlock, 'producer')
|
|
39
44
|
const previousBlockHash = current._hash
|
|
40
45
|
return this.generateCreatorCommittee(candidates, previousBlockHash)
|
|
41
|
-
})
|
|
46
|
+
}, { timeBudgetLimit: 200 })
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
protected generateCreatorCommittee(candidates: Address[], previousBlockHash: Hash, maxSize = 3): Address[] {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Address, creatable, Promisable,
|
|
3
|
-
} from '@xylabs/sdk-js'
|
|
1
|
+
import { Address, Promisable } from '@xylabs/sdk-js'
|
|
4
2
|
import { ReadArchivist } from '@xyo-network/archivist-model'
|
|
5
3
|
import {
|
|
4
|
+
AbstractCreatableProvider,
|
|
5
|
+
AttoXL1,
|
|
6
|
+
creatableProvider,
|
|
7
|
+
EventingChainBlockNumberIteratorService, NetworkStakeStepRewardService, NetworkStakeStepRewardViewerMoniker,
|
|
6
8
|
StepIdentity,
|
|
7
9
|
StepIdentityString,
|
|
8
|
-
} from '@xyo-network/xl1-
|
|
9
|
-
import {
|
|
10
|
-
EventingChainBlockNumberIteratorService, NetworkStakeStepRewardService, NetworkStakeStepRewardViewerMoniker,
|
|
11
|
-
} from '@xyo-network/xl1-protocol-sdk'
|
|
10
|
+
} from '@xyo-network/xl1-sdk'
|
|
12
11
|
import { Provider } from 'ethers'
|
|
13
12
|
|
|
14
|
-
import { BaseService } from '../BaseService.ts'
|
|
15
13
|
import { BaseServiceParams } from '../model/index.ts'
|
|
16
14
|
|
|
17
15
|
export interface BaseNetworkStakeStepRewardServiceParams extends BaseServiceParams {
|
|
@@ -20,17 +18,19 @@ export interface BaseNetworkStakeStepRewardServiceParams extends BaseServicePara
|
|
|
20
18
|
ethProvider?: Provider
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
@
|
|
24
|
-
export class BaseNetworkStakeStepRewardService extends
|
|
21
|
+
@creatableProvider()
|
|
22
|
+
export class BaseNetworkStakeStepRewardService extends
|
|
23
|
+
AbstractCreatableProvider<BaseNetworkStakeStepRewardServiceParams> implements NetworkStakeStepRewardService {
|
|
25
24
|
static readonly defaultMoniker = NetworkStakeStepRewardViewerMoniker
|
|
25
|
+
static readonly dependencies = []
|
|
26
26
|
static readonly monikers = [NetworkStakeStepRewardViewerMoniker]
|
|
27
|
-
moniker = BaseNetworkStakeStepRewardService.defaultMoniker
|
|
27
|
+
override moniker = BaseNetworkStakeStepRewardService.defaultMoniker
|
|
28
28
|
|
|
29
|
-
networkStakeStepRewardAddressHistory(_address: Address): Promisable<Record<Address,
|
|
29
|
+
networkStakeStepRewardAddressHistory(_address: Address): Promisable<Record<Address, AttoXL1>> {
|
|
30
30
|
throw new Error('Method [networkStakeStepRewardAddressHistory] not implemented.')
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
networkStakeStepRewardAddressReward(_context: StepIdentity, _address: Address): Promisable<Record<Address,
|
|
33
|
+
networkStakeStepRewardAddressReward(_context: StepIdentity, _address: Address): Promisable<Record<Address, AttoXL1>> {
|
|
34
34
|
throw new Error('Method [networkStakeStepRewardAddressReward] not implemented.')
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -38,23 +38,23 @@ export class BaseNetworkStakeStepRewardService extends BaseService<BaseNetworkSt
|
|
|
38
38
|
throw new Error('Method [networkStakeStepRewardAddressShare] not implemented.')
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
networkStakeStepRewardClaimedByAddress(_address: Address): Promisable<
|
|
41
|
+
networkStakeStepRewardClaimedByAddress(_address: Address): Promisable<AttoXL1> {
|
|
42
42
|
throw new Error('Method [networkStakeStepRewardClaimedByAddress] not implemented.')
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
networkStakeStepRewardForPosition(_position: number, _range: [number, number]): Promisable<[
|
|
45
|
+
networkStakeStepRewardForPosition(_position: number, _range: [number, number]): Promisable<[AttoXL1, AttoXL1]> {
|
|
46
46
|
throw new Error('Method [networkStakeStepRewardForPosition] not implemented.')
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
networkStakeStepRewardForStep(_context: StepIdentity): Promisable<
|
|
49
|
+
networkStakeStepRewardForStep(_context: StepIdentity): Promisable<AttoXL1> {
|
|
50
50
|
throw new Error('Method [networkStakeStepRewardForStep] not implemented.')
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
networkStakeStepRewardForStepForPosition(_context: StepIdentity, _position: number): Promisable<[
|
|
53
|
+
networkStakeStepRewardForStepForPosition(_context: StepIdentity, _position: number): Promisable<[AttoXL1, AttoXL1]> {
|
|
54
54
|
throw new Error('Method [networkStakeStepRewardForStepForPosition] not implemented.')
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
networkStakeStepRewardPoolRewards(_context: StepIdentity): Promisable<Record<Address,
|
|
57
|
+
networkStakeStepRewardPoolRewards(_context: StepIdentity): Promisable<Record<Address, AttoXL1>> {
|
|
58
58
|
throw new Error('Method [networkStakeStepRewardPoolRewards] not implemented.')
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -66,11 +66,11 @@ export class BaseNetworkStakeStepRewardService extends BaseService<BaseNetworkSt
|
|
|
66
66
|
throw new Error('Method [networkStakeStepRewardPositionWeight] not implemented.')
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
networkStakeStepRewardPotentialPositionLoss(_context: StepIdentity, _position: number): Promisable<
|
|
69
|
+
networkStakeStepRewardPotentialPositionLoss(_context: StepIdentity, _position: number): Promisable<AttoXL1> {
|
|
70
70
|
throw new Error('Method [networkStakeStepRewardPotentialPositionLoss] not implemented.')
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
networkStakeStepRewardRandomizer(_context: StepIdentity): Promisable<
|
|
73
|
+
networkStakeStepRewardRandomizer(_context: StepIdentity): Promisable<AttoXL1> {
|
|
74
74
|
throw new Error('Method [networkStakeStepRewardRandomizer] not implemented.')
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -78,7 +78,7 @@ export class BaseNetworkStakeStepRewardService extends BaseService<BaseNetworkSt
|
|
|
78
78
|
throw new Error('Method [networkStakeStepRewardStakerCount] not implemented.')
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
networkStakeStepRewardUnclaimedByAddress(_address: Address): Promisable<
|
|
81
|
+
networkStakeStepRewardUnclaimedByAddress(_address: Address): Promisable<AttoXL1> {
|
|
82
82
|
throw new Error('Method [networkStakeStepRewardUnclaimedByAddress] not implemented.')
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -86,15 +86,15 @@ export class BaseNetworkStakeStepRewardService extends BaseService<BaseNetworkSt
|
|
|
86
86
|
throw new Error('Method [networkStakeStepRewardWeightForAddress] not implemented.')
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
networkStakeStepRewardsForPosition(_position: number, _range: [number, number]): Promisable<Record<StepIdentityString, [
|
|
89
|
+
networkStakeStepRewardsForPosition(_position: number, _range: [number, number]): Promisable<Record<StepIdentityString, [AttoXL1, AttoXL1]>> {
|
|
90
90
|
throw new Error('Method [networkStakeStepRewardsForPosition] not implemented.')
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
networkStakeStepRewardsForRange(_range: [number, number]): Promisable<
|
|
93
|
+
networkStakeStepRewardsForRange(_range: [number, number]): Promisable<AttoXL1> {
|
|
94
94
|
throw new Error('Method [networkStakeStepRewardsForRange] not implemented.')
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
networkStakeStepRewardsForStepLevel(_stepLevel: number, _range: [number, number]): Promisable<
|
|
97
|
+
networkStakeStepRewardsForStepLevel(_stepLevel: number, _range: [number, number]): Promisable<AttoXL1> {
|
|
98
98
|
throw new Error('Method [networkStakeStepRewardsForStepLevel] not implemented.')
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValueType } from '@opentelemetry/api'
|
|
2
2
|
import {
|
|
3
|
-
assertEx,
|
|
3
|
+
assertEx,
|
|
4
4
|
exists,
|
|
5
5
|
filterAs, filterAsync, forget, Hash,
|
|
6
6
|
isDefined, isUndefined,
|
|
@@ -11,19 +11,18 @@ import {
|
|
|
11
11
|
Payload, PayloadBundle, Sequence, WithStorageMeta,
|
|
12
12
|
} from '@xyo-network/payload-model'
|
|
13
13
|
import {
|
|
14
|
-
|
|
14
|
+
AbstractCreatableProvider,
|
|
15
|
+
asBlockBoundWitnessWithHashMeta, asXL1BlockNumber, ChainId, creatableProvider,
|
|
16
|
+
findMostRecentBlock, HydratedTransactionValidationFunction, isTransactionBoundWitnessWithStorageMeta,
|
|
17
|
+
MempoolViewer, MempoolViewerMoniker, PendingBlocksOptions, PendingTransactionsOptions,
|
|
15
18
|
SignedHydratedBlockWithHashMeta,
|
|
16
19
|
SignedHydratedTransactionWithHashMeta,
|
|
17
20
|
SignedHydratedTransactionWithStorageMeta,
|
|
21
|
+
TransactionJsonSchemaValidator, validateTransaction,
|
|
18
22
|
XL1BlockNumber,
|
|
19
|
-
} from '@xyo-network/xl1-
|
|
20
|
-
import {
|
|
21
|
-
findMostRecentBlock, MempoolViewer, MempoolViewerMoniker, PendingBlocksOptions, PendingTransactionsOptions,
|
|
22
|
-
} from '@xyo-network/xl1-protocol-sdk'
|
|
23
|
-
import { TransactionJsonSchemaValidator, validateTransaction } from '@xyo-network/xl1-validation'
|
|
23
|
+
} from '@xyo-network/xl1-sdk'
|
|
24
24
|
import { Mutex } from 'async-mutex'
|
|
25
25
|
|
|
26
|
-
import { BaseService } from '../BaseService.ts'
|
|
27
26
|
import { BaseServiceParams } from '../model/index.ts'
|
|
28
27
|
import { bundledPayloadToHydratedTransaction } from './bundledPayloadToHydratedTransaction.ts'
|
|
29
28
|
import { hydratedTransactionToPayloadBundle } from './hydratedTransactionToPayloadBundle.ts'
|
|
@@ -36,9 +35,10 @@ export interface BasePendingTransactionsServiceParams extends BaseServiceParams
|
|
|
36
35
|
rejectedTransactionsArchivist: ArchivistInstance
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
@
|
|
40
|
-
export class BasePendingTransactionsService extends
|
|
38
|
+
@creatableProvider()
|
|
39
|
+
export class BasePendingTransactionsService extends AbstractCreatableProvider<BasePendingTransactionsServiceParams> implements MempoolViewer {
|
|
41
40
|
static readonly defaultMoniker = MempoolViewerMoniker
|
|
41
|
+
static readonly dependencies = []
|
|
42
42
|
static readonly monikers = [MempoolViewerMoniker]
|
|
43
43
|
|
|
44
44
|
private static readonly MutexPriority = {
|
|
@@ -56,7 +56,7 @@ export class BasePendingTransactionsService extends BaseService<BasePendingTrans
|
|
|
56
56
|
PurgeTransactions: 1,
|
|
57
57
|
} as const
|
|
58
58
|
|
|
59
|
-
moniker = BasePendingTransactionsService.defaultMoniker
|
|
59
|
+
override moniker = BasePendingTransactionsService.defaultMoniker
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* A mutex to ensure that the counting the number of pending transactions is
|
|
@@ -224,7 +224,7 @@ export class BasePendingTransactionsService extends BaseService<BasePendingTrans
|
|
|
224
224
|
|
|
225
225
|
return foundPendingTransactions
|
|
226
226
|
}, BasePendingTransactionsService.MutexPriority.ReadTransactions)
|
|
227
|
-
})
|
|
227
|
+
}, { timeBudgetLimit: 100 })
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
private async cleanupWorker() {
|
|
@@ -275,7 +275,7 @@ export class BasePendingTransactionsService extends BaseService<BasePendingTrans
|
|
|
275
275
|
await this.pendingBundledTransactionsLocalArchivist.insert(bundledTransactions)
|
|
276
276
|
}
|
|
277
277
|
}, BasePendingTransactionsService.MutexPriority.InsertNewTransactions)
|
|
278
|
-
})
|
|
278
|
+
}, { timeBudgetLimit: 200 })
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
/**
|
|
@@ -359,7 +359,7 @@ export class BasePendingTransactionsService extends BaseService<BasePendingTrans
|
|
|
359
359
|
this.logger?.log(payload._hash)
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
})
|
|
362
|
+
}, { timeBudgetLimit: 200 })
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PayloadBuilder } from '@xyo-network/payload-builder'
|
|
2
2
|
import type { PayloadBundle, WithStorageMeta } from '@xyo-network/payload-model'
|
|
3
|
-
import type { SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-
|
|
4
|
-
import { asSignedTransactionBoundWitnessWithHashMeta } from '@xyo-network/xl1-
|
|
3
|
+
import type { SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
4
|
+
import { asSignedTransactionBoundWitnessWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
5
5
|
|
|
6
6
|
export const bundledPayloadToHydratedTransaction = async (
|
|
7
7
|
payload: WithStorageMeta<PayloadBundle>,
|
|
@@ -2,8 +2,8 @@ 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'
|
|
5
|
-
import type { SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-
|
|
6
|
-
import { flattenHydratedTransaction } from '@xyo-network/xl1-
|
|
5
|
+
import type { SignedHydratedTransactionWithHashMeta } from '@xyo-network/xl1-sdk'
|
|
6
|
+
import { flattenHydratedTransaction } from '@xyo-network/xl1-sdk'
|
|
7
7
|
|
|
8
8
|
export const hydratedTransactionToPayloadBundle = (transaction: SignedHydratedTransactionWithHashMeta): PayloadBundle => {
|
|
9
9
|
const root = transaction[0]._hash
|