@@ -65,7 +65,8 @@ import {
65
65
getOwnerComplexity ,
66
66
getSignerComplexity ,
67
67
} from '../txs/fee' ;
68
- import { spend , useSpendableLockedUTXOs , useUnlockedUTXOs } from './spend' ;
68
+ import { spend } from './spend' ;
69
+ import { useSpendableLockedUTXOs , useUnlockedUTXOs } from './spend-reducers' ;
69
70
70
71
const getAddressMaps = ( {
71
72
inputs,
@@ -156,7 +157,7 @@ export const newBaseTx: TxBuilderFn<NewBaseTxProps> = (
156
157
outputComplexity ,
157
158
) ;
158
159
159
- const [ error , spendResults ] = spend (
160
+ const spendResults = spend (
160
161
{
161
162
excessAVAX : 0n ,
162
163
fromAddresses,
@@ -170,10 +171,6 @@ export const newBaseTx: TxBuilderFn<NewBaseTxProps> = (
170
171
context ,
171
172
) ;
172
173
173
- if ( error ) {
174
- throw error ;
175
- }
176
-
177
174
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
178
175
const addressMaps = getAddressMaps ( {
179
176
inputs,
@@ -319,7 +316,7 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
319
316
outputComplexity ,
320
317
) ;
321
318
322
- const [ error , spendResults ] = spend (
319
+ const spendResults = spend (
323
320
{
324
321
excessAVAX : importedAvax ,
325
322
fromAddresses,
@@ -332,10 +329,6 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
332
329
context ,
333
330
) ;
334
331
335
- if ( error ) {
336
- throw error ;
337
- }
338
-
339
332
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
340
333
341
334
return new UnsignedTx (
@@ -397,7 +390,7 @@ export const newExportTx: TxBuilderFn<NewExportTxProps> = (
397
390
outputComplexity ,
398
391
) ;
399
392
400
- const [ error , spendResults ] = spend (
393
+ const spendResults = spend (
401
394
{
402
395
excessAVAX : 0n ,
403
396
fromAddresses,
@@ -410,10 +403,6 @@ export const newExportTx: TxBuilderFn<NewExportTxProps> = (
410
403
context ,
411
404
) ;
412
405
413
- if ( error ) {
414
- throw error ;
415
- }
416
-
417
406
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
418
407
const addressMaps = getAddressMaps ( {
419
408
inputs,
@@ -476,7 +465,7 @@ export const newCreateSubnetTx: TxBuilderFn<NewCreateSubnetTxProps> = (
476
465
ownerComplexity ,
477
466
) ;
478
467
479
- const [ error , spendResults ] = spend (
468
+ const spendResults = spend (
480
469
{
481
470
excessAVAX : 0n ,
482
471
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -488,10 +477,6 @@ export const newCreateSubnetTx: TxBuilderFn<NewCreateSubnetTxProps> = (
488
477
context ,
489
478
) ;
490
479
491
- if ( error ) {
492
- throw error ;
493
- }
494
-
495
480
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
496
481
const addressMaps = getAddressMaps ( {
497
482
inputs,
@@ -588,7 +573,7 @@ export const newCreateChainTx: TxBuilderFn<NewCreateChainTxProps> = (
588
573
authComplexity ,
589
574
) ;
590
575
591
- const [ error , spendResults ] = spend (
576
+ const spendResults = spend (
592
577
{
593
578
excessAVAX : 0n ,
594
579
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -600,10 +585,6 @@ export const newCreateChainTx: TxBuilderFn<NewCreateChainTxProps> = (
600
585
context ,
601
586
) ;
602
587
603
- if ( error ) {
604
- throw error ;
605
- }
606
-
607
588
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
608
589
const addressMaps = getAddressMaps ( {
609
590
inputs,
@@ -682,7 +663,7 @@ export const newAddSubnetValidatorTx: TxBuilderFn<
682
663
authComplexity ,
683
664
) ;
684
665
685
- const [ error , spendResults ] = spend (
666
+ const spendResults = spend (
686
667
{
687
668
excessAVAX : 0n ,
688
669
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -694,10 +675,6 @@ export const newAddSubnetValidatorTx: TxBuilderFn<
694
675
context ,
695
676
) ;
696
677
697
- if ( error ) {
698
- throw error ;
699
- }
700
-
701
678
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
702
679
const addressMaps = getAddressMaps ( {
703
680
inputs,
@@ -765,7 +742,7 @@ export const newRemoveSubnetValidatorTx: TxBuilderFn<
765
742
authComplexity ,
766
743
) ;
767
744
768
- const [ error , spendResults ] = spend (
745
+ const spendResults = spend (
769
746
{
770
747
excessAVAX : 0n ,
771
748
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -777,10 +754,6 @@ export const newRemoveSubnetValidatorTx: TxBuilderFn<
777
754
context ,
778
755
) ;
779
756
780
- if ( error ) {
781
- throw error ;
782
- }
783
-
784
757
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
785
758
const addressMaps = getAddressMaps ( {
786
759
inputs,
@@ -933,7 +906,7 @@ export const newAddPermissionlessValidatorTx: TxBuilderFn<
933
906
delegatorOwnerComplexity ,
934
907
) ;
935
908
936
- const [ error , spendResults ] = spend (
909
+ const spendResults = spend (
937
910
{
938
911
excessAVAX : 0n ,
939
912
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -947,10 +920,6 @@ export const newAddPermissionlessValidatorTx: TxBuilderFn<
947
920
context ,
948
921
) ;
949
922
950
- if ( error ) {
951
- throw error ;
952
- }
953
-
954
923
const { changeOutputs, inputs, inputUTXOs, stakeOutputs } = spendResults ;
955
924
const addressMaps = getAddressMaps ( {
956
925
inputs,
@@ -1083,7 +1052,7 @@ export const newAddPermissionlessDelegatorTx: TxBuilderFn<
1083
1052
ownerComplexity ,
1084
1053
) ;
1085
1054
1086
- const [ error , spendResults ] = spend (
1055
+ const spendResults = spend (
1087
1056
{
1088
1057
excessAVAX : 0n ,
1089
1058
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -1097,10 +1066,6 @@ export const newAddPermissionlessDelegatorTx: TxBuilderFn<
1097
1066
context ,
1098
1067
) ;
1099
1068
1100
- if ( error ) {
1101
- throw error ;
1102
- }
1103
-
1104
1069
const { changeOutputs, inputs, inputUTXOs, stakeOutputs } = spendResults ;
1105
1070
const addressMaps = getAddressMaps ( {
1106
1071
inputs,
@@ -1198,7 +1163,7 @@ export const newTransferSubnetOwnershipTx: TxBuilderFn<
1198
1163
ownerComplexity ,
1199
1164
) ;
1200
1165
1201
- const [ error , spendResults ] = spend (
1166
+ const spendResults = spend (
1202
1167
{
1203
1168
excessAVAX : 0n ,
1204
1169
fromAddresses : addressesFromBytes ( fromAddressesBytes ) ,
@@ -1210,10 +1175,6 @@ export const newTransferSubnetOwnershipTx: TxBuilderFn<
1210
1175
context ,
1211
1176
) ;
1212
1177
1213
- if ( error ) {
1214
- throw error ;
1215
- }
1216
-
1217
1178
const { changeOutputs, inputs, inputUTXOs } = spendResults ;
1218
1179
const addressMaps = getAddressMaps ( {
1219
1180
inputs,
0 commit comments