Skip to content

Commit f4fbbef

Browse files
authored
Merge pull request #280 from lidofinance/feat/stake-wrap-consistent-playground
feat: update docs and changelog, consistent playground
2 parents 4ce4f04 + add6f17 commit f4fbbef

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

docs/sdk/modules/wrap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Arguments:
1212

1313
- `value`: _string_ | _bigint_ - amount of ETH to wrap to wstETH (staking ETH and then wrapping stETH to wstETH in a single tx)
1414
- `callback`: _StageCallback_ - callback function that will be on each _stage_ of the transaction
15+
- `referralAddress`: _string_ - referral address (optional)
1516

1617
```ts
1718
import {
@@ -56,6 +57,7 @@ try {
5657
const wrapTx = await lidoSDK.staking.wrapETH({
5758
value,
5859
callback,
60+
referralAddress,
5961
account,
6062
});
6163

packages/sdk/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 4.6.0
2+
3+
## SDK
4+
5+
- `wrapEth` logic is migrated from direct ETH transfers to calling `stakeETH` on the `WstETHReferralStaker` contract
6+
- `wrapEth` now supports an optional `referralAddress` parameter
7+
8+
## Playground
9+
10+
- Support for referral address in `wrapEth` demo block
11+
112
# 4.5.0
213

314
## SDK
@@ -10,6 +21,8 @@
1021

1122
- DualGovernance warning status
1223

24+
# 4.4.0
25+
1326
## SDK
1427

1528
### Added

playground/demo/wrap/index.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Accordion, Input } from '@lidofinance/lido-ui';
2-
import { Address, zeroAddress } from 'viem';
32
import { useWeb3 } from 'reef-knot/web3-react';
43
import { Action, renderTokenResult } from 'components/action';
54
import { DEFAULT_VALUE, ValueType } from 'components/tokenInput';
@@ -13,7 +12,7 @@ const ZERO = BigInt(0);
1312
export const WrapDemo = () => {
1413
const { account: web3account = '0x0' } = useWeb3();
1514
const [wrapValue, setWrapValue] = useState<ValueType>(DEFAULT_VALUE);
16-
const [referralAddressValue, setReferralAddressValue] = useState<Address | undefined>(zeroAddress);
15+
const [referralAddressState, setReferralAddress] = useState<string>('');
1716
const [approveValue, setApproveValue] = useState<ValueType>(DEFAULT_VALUE);
1817
const [wrapStethValue, setWrapStethValue] =
1918
useState<ValueType>(DEFAULT_VALUE);
@@ -25,6 +24,9 @@ export const WrapDemo = () => {
2524
const { wrap } = useLidoSDK();
2625

2726
const account = web3account as `0x{string}`;
27+
const referralAddress = referralAddressState
28+
? (referralAddressState as `0x{string}`)
29+
: undefined;
2830

2931
return (
3032
<Accordion summary="Wrap">
@@ -34,7 +36,7 @@ export const WrapDemo = () => {
3436
action={() =>
3537
wrap.wrapEth({
3638
value: wrapValue ?? ZERO,
37-
referralAddress: referralAddressValue,
39+
referralAddress: referralAddress,
3840
account,
3941
callback: transactionToast,
4042
})
@@ -49,8 +51,8 @@ export const WrapDemo = () => {
4951
<Input
5052
label="referral address"
5153
placeholder="0x0000000"
52-
value={referralAddressValue}
53-
onChange={(e) => setReferralAddressValue(e.currentTarget.value as Address)}
54+
value={referralAddressState}
55+
onChange={(e) => setReferralAddress(e.currentTarget.value)}
5456
/>
5557
</Action>
5658
<Action
@@ -59,7 +61,7 @@ export const WrapDemo = () => {
5961
action={() =>
6062
wrap.wrapEthPopulateTx({
6163
value: wrapValue ?? ZERO,
62-
referralAddress: referralAddressValue,
64+
referralAddress: referralAddress,
6365
account,
6466
})
6567
}
@@ -70,7 +72,7 @@ export const WrapDemo = () => {
7072
action={() =>
7173
wrap.wrapEthEstimateGas({
7274
value: wrapValue ?? ZERO,
73-
referralAddress: referralAddressValue,
75+
referralAddress: referralAddress,
7476
account,
7577
})
7678
}

0 commit comments

Comments
 (0)