Skip to content

Commit 7e4efd3

Browse files
authored
Merge pull request #667 from multiversx/feat/next
Merge feat/next in main Add validators operations
2 parents 8b254b3 + 562df0d commit 7e4efd3

17 files changed

+1696
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@multiversx/sdk-core",
3-
"version": "15.1.1",
3+
"version": "15.2.0",
44
"description": "MultiversX SDK for JavaScript and TypeScript",
55
"author": "MultiversX",
66
"homepage": "https://multiversx.com",

src/core/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const CONTRACT_DEPLOY_ADDRESS_HEX = "000000000000000000000000000000000000
1515
export const DELEGATION_MANAGER_SC_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000004ffff";
1616
export const ESDT_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000002ffff";
1717
export const GOVERNANCE_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000003ffff";
18+
export const STAKING_SMART_CONTRACT_ADDRESS_HEX = "000000000000000000010000000000000000000000000000000000000001ffff";
1819

1920
export const DEFAULT_MESSAGE_VERSION = 1;
2021
export const MESSAGE_PREFIX = "\x17Elrond Signed Message:\n";

src/core/transactionsFactoryConfig.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ export class TransactionsFactoryConfig {
5050
gasLimitForClearProposals: bigint;
5151
gasLimitForChangeConfig: bigint;
5252
gasLimitForClaimAccumulatedFees: bigint;
53+
gasLimitForStaking: bigint;
54+
gasLimitForToppingUp: bigint;
55+
gasLimitForUnstaking: bigint;
56+
gasLimitForUnjailing: bigint;
57+
gasLimitForUnbonding: bigint;
58+
gasLimitForChangingRewardsAddress: bigint;
59+
gasLimitForClaiming: bigint;
60+
gasLimitForUnstakingNodes: bigint;
61+
gasLimitForUnstakingTokens: bigint;
62+
gasLimitForUnbondingNodes: bigint;
63+
gasLimitForUnbondingTokens: bigint;
64+
gasLimitForCleaningRegisteredData: bigint;
65+
gasLimitForRestakingUnstakedTokens: bigint;
66+
gasLimitForCreatingDelegationContractFromValidator: bigint;
67+
gasLimitForWhitelistForMerge: bigint;
68+
gasLimitForMergingValidatorToDelegation: bigint;
5369

5470
constructor(options: { chainID: string }) {
5571
// General-purpose configuration
@@ -114,5 +130,23 @@ export class TransactionsFactoryConfig {
114130
this.gasLimitForClearProposals = 50_000_000n;
115131
this.gasLimitForChangeConfig = 50_000_000n;
116132
this.gasLimitForClaimAccumulatedFees = 1_000_000n;
133+
134+
// Configuration for staking operations
135+
this.gasLimitForStaking = 5_000_000n;
136+
this.gasLimitForToppingUp = 5_000_000n;
137+
this.gasLimitForUnstaking = 5_000_000n;
138+
this.gasLimitForUnjailing = 5_000_000n;
139+
this.gasLimitForUnbonding = 5_000_000n;
140+
this.gasLimitForChangingRewardsAddress = 5_000_000n;
141+
this.gasLimitForClaiming = 5_000_000n;
142+
this.gasLimitForUnstakingNodes = 5_000_000n;
143+
this.gasLimitForUnstakingTokens = 5_000_000n;
144+
this.gasLimitForUnbondingNodes = 5_000_000n;
145+
this.gasLimitForUnbondingTokens = 5_000_000n;
146+
this.gasLimitForCleaningRegisteredData = 5_000_000n;
147+
this.gasLimitForRestakingUnstakedTokens = 5_000_000n;
148+
this.gasLimitForCreatingDelegationContractFromValidator = 51_000_000n;
149+
this.gasLimitForWhitelistForMerge = 5_000_000n;
150+
this.gasLimitForMergingValidatorToDelegation = 50_000_000n;
117151
}
118152
}

src/entrypoints/entrypoints.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import { SmartContractTransactionsFactory } from "../smartContracts";
2222
import { SmartContractController } from "../smartContracts/smartContractController";
2323
import { TokenManagementController, TokenManagementTransactionsFactory } from "../tokenManagement";
2424
import { TransfersController, TransferTransactionsFactory } from "../transfers";
25+
import { ValidatorsTransactionsFactory } from "../validators";
26+
import { ValidatorsController } from "../validators/validatorsController";
2527
import { UserSecretKey } from "../wallet";
2628
import { DevnetEntrypointConfig, MainnetEntrypointConfig, TestnetEntrypointConfig } from "./config";
2729

@@ -260,6 +262,21 @@ export class NetworkEntrypoint {
260262
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
261263
});
262264
}
265+
266+
createValidatorsController(): ValidatorsController {
267+
return new ValidatorsController({
268+
chainID: this.chainId,
269+
networkProvider: this.networkProvider,
270+
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
271+
});
272+
}
273+
274+
createValidatorsTransactionsFactory(): ValidatorsTransactionsFactory {
275+
return new ValidatorsTransactionsFactory({
276+
config: new TransactionsFactoryConfig({ chainID: this.chainId }),
277+
gasLimitEstimator: this.withGasLimitEstimator ? this.createGasLimitEstimator() : undefined,
278+
});
279+
}
263280
}
264281

265282
export class TestnetEntrypoint extends NetworkEntrypoint {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-----BEGIN PRIVATE KEY for f8910e47cf9464777c912e6390758bb39715fffcb861b184017920e4a807b42553f2f21e7f3914b81bcf58b66a72ab16d97013ae1cff807cefc977ef8cbf116258534b9e46d19528042d16ef8374404a89b184e0a4ee18c77c49e454d04eae8d-----
2+
N2MxOWJmM2EwYzU3Y2RkMWZiMDhlNDYwN2NlYmFhMzY0N2Q2YjkyNjFiNDY5M2Y2
3+
MWU5NmU1NGIyMThkNDQyYQ==
4+
-----END PRIVATE KEY for f8910e47cf9464777c912e6390758bb39715fffcb861b184017920e4a807b42553f2f21e7f3914b81bcf58b66a72ab16d97013ae1cff807cefc977ef8cbf116258534b9e46d19528042d16ef8374404a89b184e0a4ee18c77c49e454d04eae8d-----
5+
-----BEGIN PRIVATE KEY for 1b4e60e6d100cdf234d3427494dac55fbac49856cadc86bcb13a01b9bb05a0d9143e86c186c948e7ae9e52427c9523102efe9019a2a9c06db02993f2e3e6756576ae5a3ec7c235d548bc79de1a6990e1120ae435cb48f7fc436c9f9098b92a0d-----
6+
MzAzNGIxZDU4NjI4YTg0Mjk4NGRhMGM3MGRhMGI1YTI1MWViYjJhZWJmNTFhZmM1
7+
YjU4NmUyODM5YjVlNTI2Mw==
8+
-----END PRIVATE KEY for 1b4e60e6d100cdf234d3427494dac55fbac49856cadc86bcb13a01b9bb05a0d9143e86c186c948e7ae9e52427c9523102efe9019a2a9c06db02993f2e3e6756576ae5a3ec7c235d548bc79de1a6990e1120ae435cb48f7fc436c9f9098b92a0d-----

src/validators/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./resources";
2+
export * from "./validatorsTransactionsFactory";

src/validators/resources.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Address } from "../core/address";
2+
import { ValidatorPublicKey } from "../wallet";
3+
import { ValidatorsSigners } from "./validatorsSigner";
4+
5+
export type StakingInput = { validatorsFile: ValidatorsSigners | string; amount: bigint; rewardsAddress?: Address };
6+
export type ChangingRewardsAddressInput = { rewardsAddress: Address };
7+
export type ToppingUpInput = { amount: bigint };
8+
export type UnstakingTokensInput = { amount: bigint };
9+
export type UnstakingInput = { publicKeys: ValidatorPublicKey[] };
10+
export type RestakingInput = { publicKeys: ValidatorPublicKey[] };
11+
export type UnbondingInput = { publicKeys: ValidatorPublicKey[] };
12+
export type UnbondingTokensInput = { amount: bigint };
13+
export type UnjailingInput = { publicKeys: ValidatorPublicKey[]; amount: bigint };
14+
export type NewDelegationContractInput = { maxCap: bigint; fee: bigint };
15+
export type MergeValidatorToDelegationInput = { delegationAddress: Address };

0 commit comments

Comments
 (0)