Skip to content

Commit 6c0bb52

Browse files
authored
Merge branch 'develop' into chore/ddw-1165-preprod-respin
2 parents 5fdd7a6 + a2715b3 commit 6c0bb52

File tree

3 files changed

+192
-60
lines changed

3 files changed

+192
-60
lines changed

CHANGELOG.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22

33
## vNext
44

5-
### Features
6-
7-
### Fixes
8-
95
### Chores
106

117
- Updated `cardano-node` configs for Preprod respin ([PR 3070](https://github.com/input-output-hk/daedalus/pull/3070))
8+
- Fixed the properties and providers for the Send stories ([PR 3047](https://github.com/input-output-hk/daedalus/pull/3047))
129
- Fixed locale in Storybook ([PR 3062](https://github.com/input-output-hk/daedalus/pull/3062))
1310

1411
## 5.1.0
@@ -20,7 +17,6 @@
2017
- Updated trezor-connect to v9 ([PR 3038](https://github.com/input-output-hk/daedalus/pull/3038))
2118
- Added analytics data collection ([PR 2927](https://github.com/input-output-hk/daedalus/pull/2927), [PR 2989](https://github.com/input-output-hk/daedalus/pull/2989), [PR 3003](https://github.com/input-output-hk/daedalus/pull/3003), [PR 3028](https://github.com/input-output-hk/daedalus/pull/3028))
2219
- Updated LedgerJS to 5.1.0 ([PR 3036](https://github.com/input-output-hk/daedalus/pull/3036))
23-
2420
## 5.0.0
2521

2622
### Features

storybook/stories/_support/StoryProvider.tsx

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ export const WALLETS = [
3333
isLegacy: false,
3434
recoveryPhraseVerificationDate: new Date(),
3535
delegatedStakePoolId: 'kfhdsdkhfskdjfhskdhf',
36+
assets: {
37+
total: [
38+
{
39+
policyId: '008',
40+
assetName: 'NFT',
41+
quantity: new BigNumber(0),
42+
uniqueId: '9998',
43+
},
44+
],
45+
},
3646
},
3747
{
3848
id: '1',
@@ -154,6 +164,45 @@ export const WALLETS_V2 = [
154164
},
155165
];
156166

167+
const coinSelectionResponse = {
168+
inputs: {
169+
address: '',
170+
amount: {
171+
quantity: 1,
172+
unit: 'lovelace',
173+
},
174+
id: '001',
175+
index: 1,
176+
derivationPath: [''],
177+
},
178+
outputs: {
179+
address: '',
180+
amount: {
181+
quantity: 1,
182+
unit: 'lovelace',
183+
},
184+
derivationPath: [''],
185+
assets: [
186+
{
187+
policyId: '',
188+
assetName: 'NFT',
189+
quantity: 1,
190+
},
191+
],
192+
},
193+
certificates: [
194+
{
195+
pool: '',
196+
certificateType: 'register_reward_account',
197+
rewardAccountPath: [''],
198+
},
199+
],
200+
deposits: new BigNumber(10),
201+
depositsReclaimed: new BigNumber(1),
202+
withdrawals: [],
203+
fee: new BigNumber(0.2),
204+
metadata: null,
205+
};
157206
@observer
158207
class StoryProvider extends Component<Props> {
159208
@observable
@@ -171,6 +220,31 @@ class StoryProvider extends Component<Props> {
171220
@computed
172221
get stores(): {} {
173222
return {
223+
assets: {
224+
getAsset: () => {
225+
return {
226+
coinSelection: coinSelectionResponse,
227+
receiver:
228+
'addr1qzhk85furdn6r9tlyp2q23q9vq7nfl420j7y0yqp3hf6yw7jar5rnzqr4h3g9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75een',
229+
selectedAssets: [
230+
{
231+
assetName: 'coin',
232+
fingerprint: 'urdn6r9tlyp2q23q9vq7nfl420',
233+
uniqueId: 'u000',
234+
policyId: '003',
235+
quantity: new BigNumber(2),
236+
},
237+
],
238+
assetsAmounts: [''],
239+
amount: new BigNumber(20),
240+
totalAmount: new BigNumber(20),
241+
transactionFee: new BigNumber(20),
242+
adaAmount: 20,
243+
selectedAddress:
244+
'addr1qzhk85furdn6r9tlyp2q23q9vq7nfl420j7y0yqp3hf6yw7jar5rnzqr4h3g9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75ytr',
245+
};
246+
},
247+
},
174248
wallets: {
175249
active: WALLETS[parseInt(this.activeWalletId, 10)],
176250
sendMoney: () => {},
@@ -179,6 +253,13 @@ class StoryProvider extends Component<Props> {
179253
reset: () => {},
180254
},
181255
},
256+
hardwareWallets: {
257+
_resetTransaction: () => {},
258+
sendMoneyRequest: () => {},
259+
isTransactionPending: false,
260+
checkIsTrezorByWalletId: () => {},
261+
initiateTransaction: null,
262+
},
182263
};
183264
}
184265

storybook/stories/wallets/send/WalletSend.stories.tsx

Lines changed: 110 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ const confirmationTokens = walletTokens.total.map((assetTotal) => {
173173
const confirmationTokensAmounts = confirmationTokens.map(
174174
(token) => `${token.quantity}`
175175
);
176+
176177
const sendFormAssetData = walletTokens.total.map((assetTotal) => {
177178
const assetData = allAssets.find(
178179
(item) => item.policyId === assetTotal.policyId
@@ -205,9 +206,91 @@ const sendFormAssetData = walletTokens.total.map((assetTotal) => {
205206
},
206207
};
207208
});
209+
210+
const coinSelectionResponse = {
211+
inputs: {
212+
address: '',
213+
amount: {
214+
quantity: 1,
215+
unit: 'lovelace',
216+
},
217+
id: '001',
218+
index: 1,
219+
derivationPath: [''],
220+
},
221+
outputs: {
222+
address: '',
223+
amount: {
224+
quantity: 1,
225+
unit: 'lovelace',
226+
},
227+
derivationPath: [''],
228+
assets: [
229+
{
230+
policyId: '',
231+
assetName: 'NFT',
232+
quantity: 1,
233+
},
234+
],
235+
},
236+
certificates: [
237+
{
238+
pool: '',
239+
certificateType: 'register_reward_account',
240+
rewardAccountPath: [''],
241+
},
242+
],
243+
deposits: new BigNumber(10),
244+
depositsReclaimed: new BigNumber(1),
245+
withdrawals: [],
246+
fee: new BigNumber(0.2),
247+
metadata: null,
248+
};
249+
250+
const formData = {
251+
coinSelection: coinSelectionResponse,
252+
receiver:
253+
'addr1qzhk85furdn6r9tlyp2q23q9vq7nfl420j7y0yqp3hf6yw7jar5rnzqr4h3g9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75een',
254+
selectedAssets: [
255+
{
256+
assetName: 'coin',
257+
fingerprint: 'urdn6r9tlyp2q23q9vq7nfl420',
258+
uniqueId: 'u000',
259+
policyId: '003',
260+
quantity: new BigNumber(2),
261+
},
262+
],
263+
assetsAmounts: [''],
264+
amount: new BigNumber(20),
265+
totalAmount: new BigNumber(20),
266+
transactionFee: new BigNumber(20),
267+
adaAmount: 20,
268+
selectedAddress:
269+
'addr1qzhk85furdn6r9tlyp2q23q9vq7nfl420j7y0yqp3hf6yw7jar5rnzqr4h3g9whm0zjh65utc2ty5uqtcpm0rm7ahj0qq75ytr',
270+
};
271+
272+
const selectedAsset = {
273+
assetName: '',
274+
assetNameASCII: '',
275+
decimals: 0,
276+
fingerprint: 'tokenb0ca20391caaf66a4d4e7897d282f9c136cd3513136945c2542',
277+
metadata: {
278+
name: 'MakerDAO',
279+
ticker: 'DAI',
280+
description: 'Test description',
281+
url: 'http://example.com',
282+
logo: '',
283+
},
284+
policyId: '65bc72542b0ca20391caaf66a4d4e7897d282f9c136cd3513136945c',
285+
quantity: new BigNumber(4),
286+
recommendedDecimals: null,
287+
uniqueId: '65bc72542b0ca20391caaf66a4d4e7897d282f9c136cd3513136945c',
288+
update: () => {},
289+
};
290+
208291
storiesOf('Wallets / Send', module)
209292
.addDecorator(WalletsWrapper)
210-
.add('Send - No Assets', () => (
293+
.add('Send - Send screen', () => (
211294
<WalletSendForm
212295
currencyMaxFractionalDigits={6}
213296
currencyMaxIntegerDigits={11}
@@ -216,24 +299,25 @@ storiesOf('Wallets / Send', module)
216299
validateAssetAmount={promise(true)}
217300
calculateTransactionFee={promise(true)}
218301
walletAmount={new BigNumber(123)}
219-
assets={sendFormAssetData}
220302
addressValidator={() => true}
221303
onSubmit={action('onSubmit')}
222-
isDialogOpen={() => boolean('isDialogOpen', false)}
223304
isRestoreActive={boolean('isRestoreActive', false)}
224305
hwDeviceStatus={HwDeviceStatuses.READY}
225-
isHardwareWallet={boolean('isHardwareWallet', false)}
306+
isDialogOpen={() => false}
307+
hasAssets={false}
308+
selectedAsset={null}
309+
assets={[]}
310+
isHardwareWallet
226311
isLoadingAssets={boolean('isLoadingAssets', false)}
227312
onExternalLinkClick={action('onExternalLinkClick')}
228-
hasAssets={boolean('hasAssets', false)}
229-
selectedAsset={null}
230313
onUnsetActiveAsset={() => {}}
231-
isAddressFromSameWallet={boolean('isAddressFromSameWallet', false)}
314+
isAddressFromSameWallet={false}
232315
tokenFavorites={{}}
233316
walletName="My wallet"
234317
onTokenPickerDialogClose={action('onTokenPickerDialogClose')}
235318
onTokenPickerDialogOpen={action('onTokenPickerDialogOpen')}
236319
analyticsTracker={analyticsTracker}
320+
confirmationDialogData={formData}
237321
/>
238322
))
239323
.add('Send - Hardware wallet verifying transaction', () => (
@@ -247,22 +331,23 @@ storiesOf('Wallets / Send', module)
247331
assets={sendFormAssetData}
248332
addressValidator={() => true}
249333
onSubmit={action('onSubmit')}
250-
isDialogOpen={() => boolean('isDialogOpen', false)}
251-
isRestoreActive={boolean('isRestoreActive', false)}
334+
isRestoreActive={false}
252335
walletAmount={new BigNumber(123)}
336+
isDialogOpen={(view) => view === WalletSendConfirmationDialogView}
253337
hwDeviceStatus={HwDeviceStatuses.VERIFYING_TRANSACTION}
254-
isHardwareWallet={boolean('isHardwareWallet', true)}
255-
isLoadingAssets={boolean('isLoadingAssets', false)}
338+
isHardwareWallet
339+
isLoadingAssets={false}
256340
onExternalLinkClick={action('onExternalLinkClick')}
257-
hasAssets={boolean('hasAssets', false)}
341+
hasAssets
258342
selectedAsset={null}
259343
onUnsetActiveAsset={() => {}}
260-
isAddressFromSameWallet={boolean('isAddressFromSameWallet', false)}
344+
isAddressFromSameWallet={false}
261345
tokenFavorites={{}}
262346
walletName="My wallet"
263347
onTokenPickerDialogClose={action('onTokenPickerDialogClose')}
264348
onTokenPickerDialogOpen={action('onTokenPickerDialogOpen')}
265349
analyticsTracker={analyticsTracker}
350+
confirmationDialogData={formData}
266351
/>
267352
))
268353
.add('Send - Hardware wallet verifying transaction succeeded', () => (
@@ -276,14 +361,14 @@ storiesOf('Wallets / Send', module)
276361
assets={sendFormAssetData}
277362
addressValidator={() => true}
278363
onSubmit={action('onSubmit')}
279-
isDialogOpen={() => boolean('isDialogOpen', false)}
280-
isRestoreActive={boolean('isRestoreActive', false)}
364+
isDialogOpen={(view) => view === WalletSendConfirmationDialogView}
365+
isRestoreActive={false}
281366
walletAmount={new BigNumber(123)}
282367
hwDeviceStatus={HwDeviceStatuses.VERIFYING_TRANSACTION_SUCCEEDED}
283-
isHardwareWallet={boolean('isHardwareWallet', true)}
284-
isLoadingAssets={boolean('isLoadingAssets', false)}
368+
isHardwareWallet
369+
isLoadingAssets={false}
285370
onExternalLinkClick={action('onExternalLinkClick')}
286-
hasAssets={boolean('hasAssets', false)}
371+
hasAssets
287372
selectedAsset={null}
288373
onUnsetActiveAsset={() => {}}
289374
isAddressFromSameWallet={boolean('isAddressFromSameWallet', false)}
@@ -292,6 +377,7 @@ storiesOf('Wallets / Send', module)
292377
onTokenPickerDialogClose={action('onTokenPickerDialogClose')}
293378
onTokenPickerDialogOpen={action('onTokenPickerDialogOpen')}
294379
analyticsTracker={analyticsTracker}
380+
confirmationDialogData={formData}
295381
/>
296382
))
297383
.add('Send - Hardware wallet verifying transaction failed', () => (
@@ -305,46 +391,14 @@ storiesOf('Wallets / Send', module)
305391
assets={sendFormAssetData}
306392
addressValidator={() => true}
307393
onSubmit={action('onSubmit')}
308-
isDialogOpen={() => boolean('isDialogOpen', false)}
309-
isRestoreActive={boolean('isRestoreActive', false)}
394+
isDialogOpen={(view) => view === WalletSendConfirmationDialogView}
395+
isRestoreActive={false}
310396
walletAmount={new BigNumber(123)}
311397
hwDeviceStatus={HwDeviceStatuses.VERIFYING_TRANSACTION_FAILED}
312-
isHardwareWallet={boolean('isHardwareWallet', true)}
313-
isLoadingAssets={boolean('isLoadingAssets', false)}
314-
onExternalLinkClick={action('onExternalLinkClick')}
315-
hasAssets={boolean('hasAssets', false)}
316-
selectedAsset={null}
317-
onUnsetActiveAsset={() => {}}
318-
isAddressFromSameWallet={boolean('isAddressFromSameWallet', false)}
319-
tokenFavorites={{}}
320-
walletName="My wallet"
321-
onTokenPickerDialogClose={action('onTokenPickerDialogClose')}
322-
onTokenPickerDialogOpen={action('onTokenPickerDialogOpen')}
323-
analyticsTracker={analyticsTracker}
324-
/>
325-
))
326-
.add('Send - With Assets', () => (
327-
<WalletSendForm
328-
currencyMaxFractionalDigits={6}
329-
currencyMaxIntegerDigits={11}
330-
currentNumberFormat={NUMBER_OPTIONS[0].value}
331-
validateAmount={promise(true)}
332-
validateAssetAmount={promise(true)}
333-
calculateTransactionFee={promise({
334-
fee: new BigNumber(number('fee', 1)),
335-
minimumAda: new BigNumber(number('minimumAda', 1)),
336-
})}
337-
addressValidator={() => true}
338-
onSubmit={action('onSubmit')}
339-
isDialogOpen={() => boolean('isDialogOpen', false)}
340-
isRestoreActive={boolean('isRestoreActive', false)}
341-
hwDeviceStatus={HwDeviceStatuses.READY}
342-
isHardwareWallet={boolean('isHardwareWallet', false)}
343-
isLoadingAssets={boolean('isLoadingAssets', false)}
344-
assets={sendFormAssetData}
345-
walletAmount={new BigNumber(123)}
398+
isHardwareWallet
399+
isLoadingAssets={false}
346400
onExternalLinkClick={action('onExternalLinkClick')}
347-
hasAssets={boolean('hasAssets', true)}
401+
hasAssets
348402
selectedAsset={null}
349403
onUnsetActiveAsset={() => {}}
350404
isAddressFromSameWallet={boolean('isAddressFromSameWallet', false)}
@@ -353,6 +407,7 @@ storiesOf('Wallets / Send', module)
353407
onTokenPickerDialogClose={action('onTokenPickerDialogClose')}
354408
onTokenPickerDialogOpen={action('onTokenPickerDialogOpen')}
355409
analyticsTracker={analyticsTracker}
410+
confirmationDialogData={formData}
356411
/>
357412
))
358413
.add('Wallet Send Confirmation Dialog With Assets', () => {

0 commit comments

Comments
 (0)