@0xtorch/evm 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { isTransferCryptoCurrencyIn, isTransferCryptoCurrencyOut, isTransferFiatCurrencyIn, isTransferFiatCurrencyOut, isTransferNftIn, isTransferNftOut, } from '@0xtorch/core';
1
+ import { parseBaseNormalActionToNormalAction } from '@0xtorch/core';
2
2
  import { createCommentByCommentComponent } from './components/comment';
3
3
  import { isMatchErc1155Component } from './components/erc1155';
4
4
  import { isMatchErc20Component } from './components/erc20';
@@ -149,7 +149,6 @@ export const generateActionsByGenerator = ({ generator, chain, transaction, }) =
149
149
  const generateActionByGeneratorWithTargets = ({ generator, chain, transaction, targetsErc20, targetsErc721, targetsErc1155, targetsInternal, targetsLog, }) => {
150
150
  // generator に基づいて action 生成
151
151
  const action = {
152
- type: 'NormalAction',
153
152
  action: generator.action,
154
153
  evidence: 'contract',
155
154
  timestamp: Number(transaction.block.timestamp) * 1000,
@@ -184,6 +183,7 @@ const generateActionByGeneratorWithTargets = ({ generator, chain, transaction, t
184
183
  targetsLog,
185
184
  }))
186
185
  .join(''),
186
+ crossType: generator.crossType,
187
187
  loanId: generator.loanId === undefined
188
188
  ? undefined
189
189
  : generator.loanId
@@ -194,632 +194,9 @@ const generateActionByGeneratorWithTargets = ({ generator, chain, transaction, t
194
194
  targetsLog,
195
195
  }))
196
196
  .join(''),
197
+ // TODO target を生成できるようにする
198
+ target: undefined,
197
199
  };
198
- switch (action.action) {
199
- case 'add-liquidity': {
200
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
201
- isTransferNftIn(transfer) ||
202
- isTransferCryptoCurrencyOut(transfer) ||
203
- isTransferNftOut(transfer));
204
- if (transfers.length !== action.transfers.length) {
205
- throw new Error('Invalid action.transfers for add-liquidity');
206
- }
207
- if (action.loanId === undefined) {
208
- throw new Error('action.loandId is required for add-liquidity');
209
- }
210
- return {
211
- ...action,
212
- type: 'LoanNormalAction',
213
- action: 'add-liquidity',
214
- loanId: action.loanId,
215
- transfers,
216
- };
217
- }
218
- case 'approve': {
219
- if (action.transfers.length > 0) {
220
- throw new Error('Invalid action.transfers for approve');
221
- }
222
- return {
223
- ...action,
224
- type: 'NormalAction',
225
- action: 'approve',
226
- transfers: [],
227
- };
228
- }
229
- case 'atomic-arbitrage': {
230
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
231
- isTransferCryptoCurrencyOut(transfer));
232
- if (transfers.length !== action.transfers.length) {
233
- throw new Error('Invalid action.transfers for atomic-arbitrage');
234
- }
235
- return {
236
- ...action,
237
- type: 'NormalAction',
238
- action: 'atomic-arbitrage',
239
- transfers,
240
- };
241
- }
242
- case 'borrow': {
243
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) || isTransferNftIn(transfer));
244
- if (transfers.length !== action.transfers.length) {
245
- throw new Error('Invalid action.transfers for borrow');
246
- }
247
- if (action.loanId === undefined) {
248
- throw new Error('action.loandId is required for borrow');
249
- }
250
- return {
251
- ...action,
252
- type: 'LoanNormalAction',
253
- action: 'borrow',
254
- loanId: action.loanId,
255
- transfers,
256
- };
257
- }
258
- case 'borrow-with-debt': {
259
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
260
- isTransferNftIn(transfer) ||
261
- isTransferCryptoCurrencyOut(transfer) ||
262
- isTransferNftOut(transfer));
263
- if (transfers.length !== action.transfers.length) {
264
- throw new Error('Invalid action.transfers for borrow-with-debt');
265
- }
266
- if (action.loanId === undefined) {
267
- throw new Error('action.loandId is required for borrow-with-debt');
268
- }
269
- return {
270
- ...action,
271
- type: 'LoanNormalAction',
272
- action: 'borrow-with-debt',
273
- loanId: action.loanId,
274
- transfers,
275
- };
276
- }
277
- case 'bridge-from': {
278
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) || isTransferNftOut(transfer));
279
- if (transfers.length !== action.transfers.length) {
280
- throw new Error('Invalid action.transfers for bridge-from');
281
- }
282
- if (action.crossId === undefined) {
283
- throw new Error('action.crossId is required for bridge-from');
284
- }
285
- return {
286
- ...action,
287
- type: 'CrossNormalAction',
288
- action: 'bridge-from',
289
- crossId: action.crossId,
290
- transfers,
291
- };
292
- }
293
- case 'bridge-to': {
294
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) || isTransferNftIn(transfer));
295
- if (transfers.length !== action.transfers.length) {
296
- throw new Error('Invalid action.transfers for bridge-to');
297
- }
298
- if (action.crossId === undefined) {
299
- throw new Error('action.crossId is required for bridge-to');
300
- }
301
- return {
302
- ...action,
303
- type: 'CrossNormalAction',
304
- action: 'bridge-to',
305
- crossId: action.crossId,
306
- transfers,
307
- };
308
- }
309
- case 'buy-crypto': {
310
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
311
- isTransferFiatCurrencyOut(transfer));
312
- if (transfers.length !== action.transfers.length) {
313
- throw new Error('Invalid action.transfers for buy-crypto');
314
- }
315
- return {
316
- ...action,
317
- type: 'NormalAction',
318
- action: 'buy-crypto',
319
- transfers,
320
- };
321
- }
322
- case 'buy-nft': {
323
- const transfers = action.transfers.filter((transfer) => isTransferNftIn(transfer) ||
324
- isTransferFiatCurrencyOut(transfer) ||
325
- isTransferCryptoCurrencyOut(transfer));
326
- if (transfers.length !== action.transfers.length) {
327
- throw new Error('Invalid action.transfers for buy-nft');
328
- }
329
- return {
330
- ...action,
331
- type: 'NormalAction',
332
- action: 'buy-nft',
333
- transfers,
334
- };
335
- }
336
- case 'cross-replace': {
337
- // transferInSchema, transferOutSchema
338
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
339
- isTransferNftIn(transfer) ||
340
- isTransferFiatCurrencyIn(transfer) ||
341
- isTransferCryptoCurrencyOut(transfer) ||
342
- isTransferNftOut(transfer) ||
343
- isTransferFiatCurrencyOut(transfer));
344
- if (transfers.length !== action.transfers.length) {
345
- throw new Error('Invalid action.transfers for cross-replace');
346
- }
347
- if (action.crossId === undefined) {
348
- throw new Error('action.crossId is required for cross-replace');
349
- }
350
- return {
351
- ...action,
352
- type: 'CrossNormalAction',
353
- action: 'cross-replace',
354
- crossId: action.crossId,
355
- transfers,
356
- };
357
- }
358
- case 'deposit': {
359
- // transferCryptoCurrencyOutSchema, transferNftOutSchema
360
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) || isTransferNftOut(transfer));
361
- if (transfers.length !== action.transfers.length) {
362
- throw new Error('Invalid action.transfers for deposit');
363
- }
364
- if (action.loanId === undefined) {
365
- throw new Error('action.loandId is required for deposit');
366
- }
367
- return {
368
- ...action,
369
- type: 'LoanNormalAction',
370
- action: 'deposit',
371
- loanId: action.loanId,
372
- transfers,
373
- };
374
- }
375
- case 'cross-trade': {
376
- // transferInSchema, transferOutSchema
377
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
378
- isTransferNftIn(transfer) ||
379
- isTransferFiatCurrencyIn(transfer) ||
380
- isTransferCryptoCurrencyOut(transfer) ||
381
- isTransferNftOut(transfer) ||
382
- isTransferFiatCurrencyOut(transfer));
383
- if (transfers.length !== action.transfers.length) {
384
- throw new Error('Invalid action.transfers for cross-trade');
385
- }
386
- if (action.crossId === undefined) {
387
- throw new Error('action.crossId is required for cross-trade');
388
- }
389
- return {
390
- ...action,
391
- type: 'CrossNormalAction',
392
- action: 'cross-trade',
393
- crossId: action.crossId,
394
- transfers,
395
- };
396
- }
397
- case 'deposit-with-bond': {
398
- // transferCryptoCurrencyInSchema,
399
- // transferNftInSchema,
400
- // transferCryptoCurrencyOutSchema,
401
- // transferNftOutSchema,
402
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
403
- isTransferNftIn(transfer) ||
404
- isTransferCryptoCurrencyOut(transfer) ||
405
- isTransferNftOut(transfer));
406
- if (transfers.length !== action.transfers.length) {
407
- throw new Error('Invalid action.transfers for deposit-with-bond');
408
- }
409
- if (action.loanId === undefined) {
410
- throw new Error('action.loandId is required for deposit-with-bond');
411
- }
412
- return {
413
- ...action,
414
- type: 'LoanNormalAction',
415
- action: 'deposit-with-bond',
416
- loanId: action.loanId,
417
- transfers,
418
- };
419
- }
420
- case 'fail-tx': {
421
- if (action.transfers.length > 0) {
422
- throw new Error('Invalid action.transfers for fail-tx');
423
- }
424
- return {
425
- ...action,
426
- type: 'NormalAction',
427
- action: 'fail-tx',
428
- transfers: [],
429
- };
430
- }
431
- case 'fee': {
432
- // transferCryptoCurrencyOutSchema, transferFiatCurrencyOutSchema
433
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) ||
434
- isTransferFiatCurrencyOut(transfer));
435
- if (transfers.length !== action.transfers.length) {
436
- throw new Error('Invalid action.transfers for fee');
437
- }
438
- return {
439
- ...action,
440
- type: 'NormalAction',
441
- action: 'fee',
442
- transfers,
443
- };
444
- }
445
- case 'free-mint-nft': {
446
- // transferNftInSchema
447
- const transfers = action.transfers.filter((transfer) => isTransferNftIn(transfer));
448
- if (transfers.length !== action.transfers.length) {
449
- throw new Error('Invalid action.transfers for free-mint-nft');
450
- }
451
- return {
452
- ...action,
453
- type: 'NormalAction',
454
- action: 'free-mint-nft',
455
- transfers,
456
- };
457
- }
458
- case 'income': {
459
- // transferInSchema
460
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
461
- isTransferNftIn(transfer) ||
462
- isTransferFiatCurrencyIn(transfer));
463
- if (transfers.length !== action.transfers.length) {
464
- throw new Error('Invalid action.transfers for income');
465
- }
466
- return {
467
- ...action,
468
- type: 'NormalAction',
469
- action: 'income',
470
- transfers,
471
- };
472
- }
473
- case 'mint-nft': {
474
- // transferNftInSchema,
475
- // transferFiatCurrencyOutSchema,
476
- // transferCryptoCurrencyOutSchema,
477
- const transfers = action.transfers.filter((transfer) => isTransferNftIn(transfer) ||
478
- isTransferFiatCurrencyOut(transfer) ||
479
- isTransferCryptoCurrencyOut(transfer));
480
- if (transfers.length !== action.transfers.length) {
481
- throw new Error('Invalid action.transfers for mint-nft');
482
- }
483
- return {
484
- ...action,
485
- type: 'NormalAction',
486
- action: 'mint-nft',
487
- transfers,
488
- };
489
- }
490
- case 'receive-from-cex': {
491
- // transferCryptoCurrencyInSchema, transferNftInSchema
492
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) || isTransferNftIn(transfer));
493
- if (transfers.length !== action.transfers.length) {
494
- throw new Error('Invalid action.transfers for receive-from-cex');
495
- }
496
- return {
497
- ...action,
498
- type: 'NormalAction',
499
- action: 'receive-from-cex',
500
- transfers,
501
- };
502
- }
503
- case 'remove-liquidity': {
504
- // transferCryptoCurrencyInSchema,
505
- // transferNftInSchema,
506
- // transferCryptoCurrencyOutSchema,
507
- // transferNftOutSchema,
508
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
509
- isTransferNftIn(transfer) ||
510
- isTransferCryptoCurrencyOut(transfer) ||
511
- isTransferNftOut(transfer));
512
- if (transfers.length !== action.transfers.length) {
513
- throw new Error('Invalid action.transfers for remove-liquidity');
514
- }
515
- if (action.loanId === undefined) {
516
- throw new Error('action.loandId is required for remove-liquidity');
517
- }
518
- return {
519
- ...action,
520
- type: 'LoanNormalAction',
521
- action: 'remove-liquidity',
522
- loanId: action.loanId,
523
- transfers,
524
- };
525
- }
526
- case 'repayment': {
527
- // transferCryptoCurrencyOutSchema, transferNftOutSchema
528
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) || isTransferNftOut(transfer));
529
- if (transfers.length !== action.transfers.length) {
530
- throw new Error('Invalid action.transfers for repayment');
531
- }
532
- if (action.loanId === undefined) {
533
- throw new Error('action.loandId is required for repayment');
534
- }
535
- return {
536
- ...action,
537
- type: 'LoanNormalAction',
538
- action: 'repayment',
539
- loanId: action.loanId,
540
- transfers,
541
- };
542
- }
543
- case 'repayment-with-debt': {
544
- // transferCryptoCurrencyInSchema,
545
- // transferNftInSchema,
546
- // transferCryptoCurrencyOutSchema,
547
- // transferNftOutSchema,
548
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
549
- isTransferNftIn(transfer) ||
550
- isTransferCryptoCurrencyOut(transfer) ||
551
- isTransferNftOut(transfer));
552
- if (transfers.length !== action.transfers.length) {
553
- throw new Error('Invalid action.transfers for repayment-with-debt');
554
- }
555
- if (action.loanId === undefined) {
556
- throw new Error('action.loandId is required for repayment-with-debt');
557
- }
558
- return {
559
- ...action,
560
- type: 'LoanNormalAction',
561
- action: 'repayment-with-debt',
562
- loanId: action.loanId,
563
- transfers,
564
- };
565
- }
566
- case 'replace': {
567
- // transferCryptoCurrencyInSchema,
568
- // transferNftInSchema,
569
- // transferCryptoCurrencyOutSchema,
570
- // transferNftOutSchema,
571
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
572
- isTransferNftIn(transfer) ||
573
- isTransferCryptoCurrencyOut(transfer) ||
574
- isTransferNftOut(transfer));
575
- if (transfers.length !== action.transfers.length) {
576
- throw new Error('Invalid action.transfers for replace');
577
- }
578
- return {
579
- ...action,
580
- type: 'NormalAction',
581
- action: 'replace',
582
- transfers,
583
- };
584
- }
585
- case 'revoke': {
586
- if (action.transfers.length > 0) {
587
- throw new Error('Invalid action.transfers for revoke');
588
- }
589
- return {
590
- ...action,
591
- type: 'NormalAction',
592
- action: 'revoke',
593
- transfers: [],
594
- };
595
- }
596
- case 'sell-crypto': {
597
- // transferFiatCurrencyInSchema, transferCryptoCurrencyOutSchema
598
- const transfers = action.transfers.filter((transfer) => isTransferFiatCurrencyIn(transfer) ||
599
- isTransferCryptoCurrencyOut(transfer));
600
- if (transfers.length !== action.transfers.length) {
601
- throw new Error('Invalid action.transfers for sell-crypto');
602
- }
603
- return {
604
- ...action,
605
- type: 'NormalAction',
606
- action: 'sell-crypto',
607
- transfers,
608
- };
609
- }
610
- case 'sell-nft': {
611
- // transferFiatCurrencyInSchema,
612
- // transferCryptoCurrencyInSchema,
613
- // transferNftOutSchema,
614
- const transfers = action.transfers.filter((transfer) => isTransferFiatCurrencyIn(transfer) ||
615
- isTransferCryptoCurrencyIn(transfer) ||
616
- isTransferNftOut(transfer));
617
- if (transfers.length !== action.transfers.length) {
618
- throw new Error('Invalid action.transfers for sell-nft');
619
- }
620
- return {
621
- ...action,
622
- type: 'NormalAction',
623
- action: 'sell-nft',
624
- transfers,
625
- };
626
- }
627
- case 'send-to-cex': {
628
- // transferCryptoCurrencyOutSchema, transferNftOutSchema
629
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) || isTransferNftOut(transfer));
630
- if (transfers.length !== action.transfers.length) {
631
- throw new Error('Invalid action.transfers for send-to-cex');
632
- }
633
- return {
634
- ...action,
635
- type: 'NormalAction',
636
- action: 'send-to-cex',
637
- transfers,
638
- };
639
- }
640
- case 'spam': {
641
- // transferCryptoCurrencyInSchema,
642
- // transferNftInSchema,
643
- // transferCryptoCurrencyOutSchema,
644
- // transferNftOutSchema,
645
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
646
- isTransferNftIn(transfer) ||
647
- isTransferCryptoCurrencyOut(transfer) ||
648
- isTransferNftOut(transfer));
649
- if (transfers.length !== action.transfers.length) {
650
- throw new Error('Invalid action.transfers for spam');
651
- }
652
- return {
653
- ...action,
654
- type: 'NormalAction',
655
- action: 'spam',
656
- transfers,
657
- };
658
- }
659
- case 'stake': {
660
- // transferCryptoCurrencyOutSchema, transferNftOutSchema
661
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer) || isTransferNftOut(transfer));
662
- if (transfers.length !== action.transfers.length) {
663
- throw new Error('Invalid action.transfers for stake');
664
- }
665
- if (action.loanId === undefined) {
666
- throw new Error('action.loandId is required for stake');
667
- }
668
- return {
669
- ...action,
670
- type: 'LoanNormalAction',
671
- action: 'stake',
672
- loanId: action.loanId,
673
- transfers,
674
- };
675
- }
676
- case 'swap-nft': {
677
- // transferNftInSchema, transferNftOutSchema
678
- const transfers = action.transfers.filter((transfer) => isTransferNftIn(transfer) || isTransferNftOut(transfer));
679
- if (transfers.length !== action.transfers.length) {
680
- throw new Error('Invalid action.transfers for swap-nft');
681
- }
682
- return {
683
- ...action,
684
- type: 'NormalAction',
685
- action: 'swap-nft',
686
- transfers,
687
- };
688
- }
689
- case 'trade': {
690
- // transferInSchema, transferOutSchema
691
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
692
- isTransferNftIn(transfer) ||
693
- isTransferFiatCurrencyIn(transfer) ||
694
- isTransferCryptoCurrencyOut(transfer) ||
695
- isTransferNftOut(transfer) ||
696
- isTransferFiatCurrencyOut(transfer));
697
- if (transfers.length !== action.transfers.length) {
698
- throw new Error('Invalid action.transfers for trade');
699
- }
700
- return {
701
- ...action,
702
- type: 'NormalAction',
703
- action: 'trade',
704
- transfers,
705
- };
706
- }
707
- case 'transaction-fee': {
708
- // transferCryptoCurrencyOutSchema
709
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyOut(transfer));
710
- if (transfers.length !== action.transfers.length) {
711
- throw new Error('Invalid action.transfers for transaction-fee');
712
- }
713
- return {
714
- ...action,
715
- type: 'NormalAction',
716
- action: 'transaction-fee',
717
- transfers,
718
- };
719
- }
720
- case 'transfer': {
721
- return {
722
- ...action,
723
- type: 'NormalAction',
724
- action: 'transfer',
725
- transfers: [...action.transfers],
726
- };
727
- }
728
- case 'unstake': {
729
- // transferCryptoCurrencyInSchema, transferNftInSchema
730
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) || isTransferNftIn(transfer));
731
- if (transfers.length !== action.transfers.length) {
732
- throw new Error('Invalid action.transfers for unstake');
733
- }
734
- if (action.loanId === undefined) {
735
- throw new Error('action.loandId is required for unstake');
736
- }
737
- return {
738
- ...action,
739
- type: 'LoanNormalAction',
740
- action: 'unstake',
741
- loanId: action.loanId,
742
- transfers,
743
- };
744
- }
745
- case 'unwrap': {
746
- // transferCryptoCurrencyInSchema,
747
- // transferCryptoCurrencyOutSchema,
748
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
749
- isTransferCryptoCurrencyOut(transfer));
750
- if (transfers.length !== action.transfers.length) {
751
- throw new Error('Invalid action.transfers for unwrap');
752
- }
753
- return {
754
- ...action,
755
- type: 'NormalAction',
756
- action: 'unwrap',
757
- transfers,
758
- };
759
- }
760
- case 'wrap': {
761
- // transferCryptoCurrencyInSchema,
762
- // transferCryptoCurrencyOutSchema,
763
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
764
- isTransferCryptoCurrencyOut(transfer));
765
- if (transfers.length !== action.transfers.length) {
766
- throw new Error('Invalid action.transfers for wrap');
767
- }
768
- return {
769
- ...action,
770
- type: 'NormalAction',
771
- action: 'wrap',
772
- transfers,
773
- };
774
- }
775
- case 'valuedown': {
776
- // TODO asset の指定を可能にする
777
- throw new Error('Not implemented for valuedown');
778
- }
779
- case 'valueup': {
780
- // TODO
781
- throw new Error('Not implemented for valueup');
782
- }
783
- case 'withdraw': {
784
- // transferCryptoCurrencyInSchema, transferNftInSchema
785
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) || isTransferNftIn(transfer));
786
- if (transfers.length !== action.transfers.length) {
787
- throw new Error('Invalid action.transfers for withdraw');
788
- }
789
- if (action.loanId === undefined) {
790
- throw new Error('action.loandId is required for withdraw');
791
- }
792
- return {
793
- ...action,
794
- type: 'LoanNormalAction',
795
- action: 'withdraw',
796
- loanId: action.loanId,
797
- transfers,
798
- };
799
- }
800
- case 'withdraw-with-bond': {
801
- // transferCryptoCurrencyInSchema,
802
- // transferNftInSchema,
803
- // transferCryptoCurrencyOutSchema,
804
- // transferNftOutSchema,
805
- const transfers = action.transfers.filter((transfer) => isTransferCryptoCurrencyIn(transfer) ||
806
- isTransferNftIn(transfer) ||
807
- isTransferCryptoCurrencyOut(transfer) ||
808
- isTransferNftOut(transfer));
809
- if (transfers.length !== action.transfers.length) {
810
- throw new Error('Invalid action.transfers for withdraw-with-bond');
811
- }
812
- if (action.loanId === undefined) {
813
- throw new Error('action.loandId is required for withdraw-with-bond');
814
- }
815
- return {
816
- ...action,
817
- type: 'LoanNormalAction',
818
- action: 'withdraw-with-bond',
819
- loanId: action.loanId,
820
- transfers,
821
- };
822
- }
823
- }
200
+ return parseBaseNormalActionToNormalAction(action);
824
201
  };
825
202
  //# sourceMappingURL=generator.js.map