Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions docs/developers/SSV-SDK/examples/deposit-ssv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
sidebar_position: 8
---

# Deposit SSV

This page shows how to programmatically deposit SSV to a cluster on the SSV network. This executes the contract call to the SSV smart contract to deposit SSV to the cluster.

### Deposit SSV

```typescript
import { parseEther } from 'viem';

try {
const txnReceipt = await sdk.clusters.deposit({
args: {
id: "ee8881d3c979203025996773ef8a13cb4aac57076e22638dd6ed9b17adcdabfc",
amount: parseEther('30'),
},
}, {
approve: true, // Automatically triggers token approval transaction if the allowance is lower than the deposit amount
}).then(tx => tx.wait());

console.log('Transaction receipt:', txnReceipt);
} catch (error) {
console.error('Failed to deposit SSV:', error);
}
```

25 changes: 25 additions & 0 deletions docs/developers/SSV-SDK/examples/exit-validator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
sidebar_position: 7
---

# Exit Validator

This page shows how to programmatically exit a validator from the SSV network. This prompts SSV nodes to sign a voluntary exit of the validator.

### Exit Validator

```typescript
try {
const txnReceipt = await sdk.clusters.exitValidators({
args: {
publicKeys: ["0xA4831B989972605A62141a667578d742927Cbef9", "0xA4831B989972605A62141a667578d742927Cbef8"],
operatorIds: [1, 2, 3, 4],
},
}).then(tx => tx.wait());

console.log('Transaction receipt:', txnReceipt);
} catch (error) {
console.error('Failed to exit validators:', error);
}
```

28 changes: 28 additions & 0 deletions docs/developers/SSV-SDK/examples/remove-validator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
sidebar_position: 6
---

# Remove Validator

This page shows how to programmatically remove validators from a cluster on the SSV network.

### Remove Validator

```typescript
try {
const txnReceipt = await sdk.clusters.removeValidators({
args: {
id: "ee8881d3c979203025996773ef8a13cb4aac57076e22638dd6ed9b17adcdabfc",
publicKeys: [
"0x820fd0519c75f74c8be9f21f185406919721dad0c624464538e2eaa323d77d3eb3ef27a039e8779de6cfa649a5484e86",
"0x820fd0519c75f74c8be9f21f185406919721dad0c624464538e2eaa323d77d3eb3ef27a039e8779de6cfa649a5484e87"
],
},
}).then(tx => tx.wait());

console.log('Transaction receipt:', txnReceipt);
} catch (error) {
console.error('Failed to remove validators:', error);
}
```

27 changes: 27 additions & 0 deletions docs/developers/SSV-SDK/examples/withdraw-ssv.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
sidebar_position: 9
---

# Withdraw SSV

This page shows how to programmatically withdraw SSV from a cluster on the SSV network.

### Withdraw SSV

```typescript
import { parseEther } from 'viem';

try {
const txnReceipt = await sdk.clusters.withdraw({
args: {
id: "ee8881d3c979203025996773ef8a13cb4aac57076e22638dd6ed9b17adcdabfc",
amount: parseEther('30'),
},
}).then(tx => tx.wait());

console.log('Transaction receipt:', txnReceipt);
} catch (error) {
console.error('Failed to withdraw SSV:', error);
}
```

Loading