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