File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -1787,7 +1787,6 @@ export class Transaction extends mol.Entity.Base<
1787
1787
addOutput (
1788
1788
cellOrOutputLike : CellAnyLike | CellOutputLike ,
1789
1789
outputDataLike ?: HexLike | null ,
1790
- marginCapacity ?: NumLike | null ,
1791
1790
) : number {
1792
1791
const cell =
1793
1792
"cellOutput" in cellOrOutputLike
@@ -1800,14 +1799,6 @@ export class Transaction extends mol.Entity.Base<
1800
1799
const len = this . outputs . push ( cell . cellOutput ) ;
1801
1800
this . setOutputDataAt ( len - 1 , cell . outputData ) ;
1802
1801
1803
- if (
1804
- marginCapacity !== undefined &&
1805
- marginCapacity !== null &&
1806
- marginCapacity !== Zero
1807
- ) {
1808
- cell . cellOutput . capacity += numFrom ( marginCapacity ) ;
1809
- }
1810
-
1811
1802
return len ;
1812
1803
}
1813
1804
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export async function createSpore(params: {
115
115
ids . push ( id ) ;
116
116
117
117
const packedData = packRawSporeData ( data ) ;
118
- tx . addOutput (
118
+ const outputIndex = tx . addOutput (
119
119
{
120
120
lock : to ?? lock ,
121
121
type : {
@@ -124,9 +124,16 @@ export async function createSpore(params: {
124
124
} ,
125
125
} ,
126
126
packedData ,
127
- marginCapacity ? ccc . numFrom ( marginCapacity ) : ONE_CKB ,
128
127
) ;
129
128
129
+ // Add margin capacity if specified
130
+ if ( marginCapacity ) {
131
+ const margin = ccc . numFrom ( marginCapacity ) ;
132
+ if ( margin > ONE_CKB ) {
133
+ tx . outputs [ outputIndex - 1 ] . capacity += margin ;
134
+ }
135
+ }
136
+
130
137
// create spore action
131
138
if ( scriptInfo . cobuild ) {
132
139
const output = tx . outputs [ tx . outputs . length - 1 ] ;
You can’t perform that action at this time.
0 commit comments