Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f48c1a5
Add validatorPem and extend validatorSigner
danielailie Sep 15, 2025
76847b0
Merge pull request #658 from multiversx/main
danielailie Sep 15, 2025
f69ca88
Merge branch 'feat/next' into TOOL-677-add-validator-pem-and-validato…
danielailie Sep 15, 2025
5b44df2
Add validator pem tests
danielailie Sep 16, 2025
1540644
Add validators transaction factory and tests
danielailie Sep 16, 2025
411f273
Add Validators Controller
danielailie Sep 16, 2025
3a6839b
add toText tests and update private fields
danielailie Sep 16, 2025
34ba269
Fix Typos and some formatting errors
danielailie Sep 16, 2025
fd7510a
Fix naming
danielailie Sep 16, 2025
d80d3c9
Mark method with deprecated
danielailie Sep 16, 2025
cd9757d
Merge pull request #657 from multiversx/TOOL-677-add-validator-pem-an…
danielailie Sep 16, 2025
521faad
code review follow up
danielailie Sep 17, 2025
5e8250f
add toText tests and update private fields
danielailie Sep 16, 2025
ab986a8
Mark method with deprecated
danielailie Sep 16, 2025
6c839f8
Fix naming
danielailie Sep 17, 2025
440efd0
Merge branch 'feat/next' into TOOL-671-add-validator-factory
danielailie Sep 17, 2025
a2b63be
Merge pull request #659 from multiversx/TOOL-671-add-validator-factory
danielailie Sep 17, 2025
e40118a
Merge branch 'feat/next' into TOOL-678-add-validator-controller
danielailie Sep 18, 2025
0f7bc85
Fix build
danielailie Sep 18, 2025
078ac0b
Add tests and add methods to export validator via entrypoint
danielailie Sep 18, 2025
7fd18a9
Refactor validator controller
danielailie Sep 18, 2025
c12469c
Update tests
danielailie Sep 18, 2025
c3d25b0
Merge pull request #660 from multiversx/TOOL-678-add-validator-contro…
danielailie Sep 22, 2025
5821764
Merge branch 'main' into TOOL-678-Merge-main-in-next
danielailie Sep 22, 2025
1e2ea08
Merge pull request #664 from multiversx/TOOL-678-Merge-main-in-next
danielailie Sep 22, 2025
bcee878
Bump version
danielailie Sep 22, 2025
562df0d
Merge pull request #665 from multiversx/TOOL-678-add-validators-bump-…
danielailie Sep 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "15.1.1",
"version": "15.2.0",
"description": "MultiversX SDK for JavaScript and TypeScript",
"author": "MultiversX",
"homepage": "https://multiversx.com",
Expand Down
1 change: 1 addition & 0 deletions src/core/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const CONTRACT_DEPLOY_ADDRESS_HEX = "000000000000000000000000000000000000
export const DELEGATION_MANAGER_SC_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000004ffff";
export const ESDT_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000002ffff";
export const GOVERNANCE_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000003ffff";
export const STAKING_SMART_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000001ffff";

export const DEFAULT_MESSAGE_VERSION = 1;
export const MESSAGE_PREFIX = "\x17Elrond Signed Message:\n";
Expand Down
34 changes: 34 additions & 0 deletions src/core/transactionsFactoryConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ export class TransactionsFactoryConfig {
gasLimitForClearProposals: bigint;
gasLimitForChangeConfig: bigint;
gasLimitForClaimAccumulatedFees: bigint;
gasLimitForStaking: bigint;
gasLimitForToppingUp: bigint;
gasLimitForUnstaking: bigint;
gasLimitForUnjailing: bigint;
gasLimitForUnbonding: bigint;
gasLimitForChangingRewardsAddress: bigint;
gasLimitForClaiming: bigint;
gasLimitForUnstakingNodes: bigint;
gasLimitForUnstakingTokens: bigint;
gasLimitForUnbondingNodes: bigint;
gasLimitForUnbondingTokens: bigint;
gasLimitForCleaningRegisteredData: bigint;
gasLimitForRestakingUnstakedTokens: bigint;
gasLimitForCreatingDelegationContractFromValidator: bigint;
gasLimitForWhitelistForMerge: bigint;
gasLimitForMergingValidatorToDelegation: bigint;

constructor(options: { chainID: string }) {
// General-purpose configuration
Expand Down Expand Up @@ -114,5 +130,23 @@ export class TransactionsFactoryConfig {
this.gasLimitForClearProposals = 50_000_000n;
this.gasLimitForChangeConfig = 50_000_000n;
this.gasLimitForClaimAccumulatedFees = 1_000_000n;

// Configuration for staking operations
this.gasLimitForStaking = 5_000_000n;
this.gasLimitForToppingUp = 5_000_000n;
this.gasLimitForUnstaking = 5_000_000n;
this.gasLimitForUnjailing = 5_000_000n;
this.gasLimitForUnbonding = 5_000_000n;
this.gasLimitForChangingRewardsAddress = 5_000_000n;
this.gasLimitForClaiming = 5_000_000n;
this.gasLimitForUnstakingNodes = 5_000_000n;
this.gasLimitForUnstakingTokens = 5_000_000n;
this.gasLimitForUnbondingNodes = 5_000_000n;
this.gasLimitForUnbondingTokens = 5_000_000n;
this.gasLimitForCleaningRegisteredData = 5_000_000n;
this.gasLimitForRestakingUnstakedTokens = 5_000_000n;
this.gasLimitForCreatingDelegationContractFromValidator = 51_000_000n;
this.gasLimitForWhitelistForMerge = 5_000_000n;
this.gasLimitForMergingValidatorToDelegation = 50_000_000n;
}
}
17 changes: 17 additions & 0 deletions src/entrypoints/entrypoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { SmartContractTransactionsFactory } from "../smartContracts";
import { SmartContractController } from "../smartContracts/smartContractController";
import { TokenManagementController, TokenManagementTransactionsFactory } from "../tokenManagement";
import { TransfersController, TransferTransactionsFactory } from "../transfers";
import { ValidatorsTransactionsFactory } from "../validators";
import { ValidatorsController } from "../validators/validatorsController";
import { UserSecretKey } from "../wallet";
import { DevnetEntrypointConfig, MainnetEntrypointConfig, TestnetEntrypointConfig } from "./config";

Expand Down Expand Up @@ -260,6 +262,21 @@ export class NetworkEntrypoint {
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
});
}

createValidatorsController(): ValidatorsController {
return new ValidatorsController({
chainID: this.chainId,
networkProvider: this.networkProvider,
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
});
}

createValidatorsTransactionsFactory(): ValidatorsTransactionsFactory {
return new ValidatorsTransactionsFactory({
config: new TransactionsFactoryConfig({ chainID: this.chainId }),
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
});
}
}

export class TestnetEntrypoint extends NetworkEntrypoint {
Expand Down
8 changes: 8 additions & 0 deletions src/testdata/testwallets/validators.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-----BEGIN PRIVATE KEY for f8910e47cf9464777c912e6390758bb39715fffcb861b184017920e4a807b42553f2f21e7f3914b81bcf58b66a72ab16d97013ae1cff807cefc977ef8cbf116258534b9e46d19528042d16ef8374404a89b184e0a4ee18c77c49e454d04eae8d-----
N2MxOWJmM2EwYzU3Y2RkMWZiMDhlNDYwN2NlYmFhMzY0N2Q2YjkyNjFiNDY5M2Y2
MWU5NmU1NGIyMThkNDQyYQ==
-----END PRIVATE KEY for f8910e47cf9464777c912e6390758bb39715fffcb861b184017920e4a807b42553f2f21e7f3914b81bcf58b66a72ab16d97013ae1cff807cefc977ef8cbf116258534b9e46d19528042d16ef8374404a89b184e0a4ee18c77c49e454d04eae8d-----
-----BEGIN PRIVATE KEY for 1b4e60e6d100cdf234d3427494dac55fbac49856cadc86bcb13a01b9bb05a0d9143e86c186c948e7ae9e52427c9523102efe9019a2a9c06db02993f2e3e6756576ae5a3ec7c235d548bc79de1a6990e1120ae435cb48f7fc436c9f9098b92a0d-----
MzAzNGIxZDU4NjI4YTg0Mjk4NGRhMGM3MGRhMGI1YTI1MWViYjJhZWJmNTFhZmM1
YjU4NmUyODM5YjVlNTI2Mw==
-----END PRIVATE KEY for 1b4e60e6d100cdf234d3427494dac55fbac49856cadc86bcb13a01b9bb05a0d9143e86c186c948e7ae9e52427c9523102efe9019a2a9c06db02993f2e3e6756576ae5a3ec7c235d548bc79de1a6990e1120ae435cb48f7fc436c9f9098b92a0d-----
2 changes: 2 additions & 0 deletions src/validators/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./resources";
export * from "./validatorsTransactionsFactory";
15 changes: 15 additions & 0 deletions src/validators/resources.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Address } from "../core/address";
import { ValidatorPublicKey } from "../wallet";
import { ValidatorsSigners } from "./validatorsSigner";

export type StakingInput = { validatorsFile: ValidatorsSigners | string; amount: bigint; rewardsAddress?: Address };
export type ChangingRewardsAddressInput = { rewardsAddress: Address };
export type ToppingUpInput = { amount: bigint };
export type UnstakingTokensInput = { amount: bigint };
export type UnstakingInput = { publicKeys: ValidatorPublicKey[] };
export type RestakingInput = { publicKeys: ValidatorPublicKey[] };
export type UnbondingInput = { publicKeys: ValidatorPublicKey[] };
export type UnbondingTokensInput = { amount: bigint };
export type UnjailingInput = { publicKeys: ValidatorPublicKey[]; amount: bigint };
export type NewDelegationContractInput = { maxCap: bigint; fee: bigint };
export type MergeValidatorToDelegationInput = { delegationAddress: Address };
Loading
Loading