Skip to content

Commit dda1184

Browse files
authored
Releasing v0.24.0 (#420)
* Add support for execution layer validator consolidations * chore: Prep for v0.24.0 release * disable shared eth staking e2e test
1 parent 524a572 commit dda1184

10 files changed

Lines changed: 328 additions & 256 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
## [0.24.0] - 2025-05-06
6+
7+
- Add support for execution layer consolidations post Pectra.
8+
59
## [0.23.0] - 2025-04-16
610

711
- Add support for both consensus and execution based withdrawals post-pectra.

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
@@ -4,7 +4,7 @@
44
"license": "ISC",
55
"description": "Coinbase Platform SDK",
66
"repository": "https://github.com/coinbase/coinbase-sdk-nodejs",
7-
"version": "0.23.0",
7+
"version": "0.24.0",
88
"main": "dist/index.js",
99
"types": "dist/index.d.ts",
1010
"scripts": {

quickstart-template/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"dependencies": {
2323
"@solana/web3.js": "^2.0.0-rc.1",
2424
"bs58": "^6.0.0",
25-
"@coinbase/coinbase-sdk": "^0.23.0",
25+
"@coinbase/coinbase-sdk": "^0.24.0",
2626
"csv-parse": "^5.5.6",
2727
"csv-writer": "^1.6.0",
2828
"viem": "^2.21.6"

src/coinbase/address/external_address.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ export class ExternalAddress extends Address {
9494
return this.buildStakingOperation(amount, assetId, "claim_stake", mode, options);
9595
}
9696

97+
/**
98+
* Builds a validator consolidation operation to help consolidate validators post Pectra.
99+
*
100+
* @param options - Additional options for the validator consolidation operation.
101+
*
102+
* @returns The validator consolidation operation.
103+
*/
104+
public async buildValidatorConsolidationOperation(
105+
options: { [key: string]: string } = {},
106+
): Promise<StakingOperation> {
107+
return this.buildStakingOperation(0, "eth", "consolidate", StakeOptionsMode.NATIVE, options);
108+
}
109+
97110
/**
98111
* Builds the staking operation based on the supplied input.
99112
*
@@ -119,15 +132,7 @@ export class ExternalAddress extends Address {
119132

120133
newOptions.mode = mode;
121134

122-
// If performing a native eth unstake v2, the amount is not required.
123-
if (!IsDedicatedEthUnstakeV2Operation(assetId, action, mode, newOptions)) {
124-
const stakingAmount = new Decimal(amount.toString());
125-
if (stakingAmount.lessThanOrEqualTo(0)) {
126-
throw new Error(`Amount required greater than zero.`);
127-
}
128-
129-
newOptions.amount = asset.toAtomicAmount(new Decimal(amount.toString())).toString();
130-
}
135+
newOptions.amount = asset.toAtomicAmount(new Decimal(amount.toString())).toString();
131136

132137
const request = {
133138
network_id: this.getNetworkId(),

src/coinbase/address/wallet_address.ts

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,32 @@ export class WalletAddress extends Address {
766766
);
767767
}
768768

769+
/**
770+
* Creates a staking operation to consolidate.
771+
*
772+
* @param options - Additional options for the consolidation operation.
773+
*
774+
* @param timeoutSeconds - The amount to wait for the transaction to complete when broadcasted.
775+
* @param intervalSeconds - The amount to check each time for a successful broadcast.
776+
*
777+
* @returns The staking operation after it's completed successfully.
778+
*/
779+
public async createValidatorConsolidation(
780+
options: { [key: string]: string } = {},
781+
timeoutSeconds = 600,
782+
intervalSeconds = 0.2,
783+
): Promise<StakingOperation> {
784+
return this.createStakingOperation(
785+
0,
786+
"eth",
787+
"consolidate",
788+
StakeOptionsMode.NATIVE,
789+
options,
790+
timeoutSeconds,
791+
intervalSeconds,
792+
);
793+
}
794+
769795
/**
770796
* Creates a Payload Signature.
771797
*
@@ -1011,13 +1037,6 @@ export class WalletAddress extends Address {
10111037
timeoutSeconds: number,
10121038
intervalSeconds: number,
10131039
): Promise<StakingOperation> {
1014-
// If performing a native ETH unstake, the amount is not required.
1015-
if (!IsDedicatedEthUnstakeV2Operation(assetId, action, mode, options)) {
1016-
if (new Decimal(amount.toString()).lessThanOrEqualTo(0)) {
1017-
throw new Error("Amount required greater than zero.");
1018-
}
1019-
}
1020-
10211040
let stakingOperation = await this.createStakingOperationRequest(
10221041
amount,
10231042
assetId,
@@ -1080,10 +1099,7 @@ export class WalletAddress extends Address {
10801099

10811100
options.mode = mode ? mode : StakeOptionsMode.DEFAULT;
10821101

1083-
// If performing a native ETH unstake, the amount is not required.
1084-
if (!IsDedicatedEthUnstakeV2Operation(assetId, action, mode, options)) {
1085-
options.amount = asset.toAtomicAmount(new Decimal(amount.toString())).toString();
1086-
}
1102+
options.amount = asset.toAtomicAmount(new Decimal(amount.toString())).toString();
10871103

10881104
const stakingOperationRequest = {
10891105
network_id: this.getNetworkId(),

src/tests/authenticator_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe("Authenticator tests", () => {
6666
const config = await authenticator.authenticateRequest(VALID_CONFIG, true);
6767
const correlationContext = config.headers["Correlation-Context"] as string;
6868
expect(correlationContext).toContain(
69-
"sdk_version=0.23.0,sdk_language=typescript,source=mockSource",
69+
"sdk_version=0.24.0,sdk_language=typescript,source=mockSource",
7070
);
7171
});
7272
});
@@ -204,7 +204,7 @@ describe("Authenticator tests for Edwards key", () => {
204204
const config = await authenticator.authenticateRequest(VALID_CONFIG, true);
205205
const correlationContext = config.headers["Correlation-Context"] as string;
206206
expect(correlationContext).toContain(
207-
"sdk_version=0.23.0,sdk_language=typescript,source=mockSource",
207+
"sdk_version=0.24.0,sdk_language=typescript,source=mockSource",
208208
);
209209
});
210210
});

0 commit comments

Comments
 (0)