@@ -1986,9 +1986,10 @@ class Client {
1986
1986
1987
1987
const BINRepresentation = this . getTransactionBINrepresentation ( JSONRepresentation , 1 ) ;
1988
1988
1989
- const transaction_size = BigInt ( Math . ceil ( BINRepresentation . transactionsize ) ) ;
1990
- const feerate = BigInt ( '100000000000' ) ; // TODO: Get the current feerate from the network
1991
- const nextPreciseFee = ( transaction_size * feerate ) / 1000n ;
1989
+ const transaction_size_in_bytes = BigInt ( Math . ceil ( BINRepresentation . transactionsize ) ) ;
1990
+ const fee_amount_per_kb = BigInt ( '100000000000' ) ; // TODO: Get the current feerate from the network
1991
+
1992
+ const nextPreciseFee = ( ( fee_amount_per_kb * transaction_size_in_bytes ) + BigInt ( 999 ) ) / BigInt ( 1000 )
1992
1993
1993
1994
if ( nextPreciseFee === preciseFee || nextPreciseFee === previousFee ) {
1994
1995
const transaction = encode_transaction (
@@ -2072,7 +2073,7 @@ class Client {
2072
2073
return encode_input_for_fill_order (
2073
2074
input . order_id ,
2074
2075
Amount . from_atoms ( input . fill_atoms . toString ( ) ) ,
2075
- input . destination ,
2076
+ 'tmt1q8vjp3lrvezlnkwhhv944f2vw2k9get4ty0fkyn3' ,
2076
2077
BigInt ( input . nonce . toString ( ) ) ,
2077
2078
network ,
2078
2079
) ;
@@ -2130,6 +2131,8 @@ class Client {
2130
2131
2131
2132
const inputsArray = [ ...inputCommands , ...inputsIds ] . filter ( ( x ) : x is NonNullable < typeof x > => x !== undefined ) ;
2132
2133
2134
+ console . log ( 'inputsArray' , inputsArray ) ;
2135
+
2133
2136
const outputsArrayItems = transactionJSONrepresentation . outputs . map ( ( output ) => {
2134
2137
if ( output . type === 'Transfer' ) {
2135
2138
if ( output . value . type === 'TokenV1' ) {
@@ -2261,6 +2264,7 @@ class Client {
2261
2264
}
2262
2265
} ) ;
2263
2266
const outputsArray = outputsArrayItems . filter ( ( x ) : x is NonNullable < typeof x > => x !== undefined ) ;
2267
+ console . log ( 'outputsArray' , outputsArray ) ;
2264
2268
2265
2269
const inputAddresses : string [ ] = ( transactionJSONrepresentation . inputs as UtxoInput [ ] )
2266
2270
. filter ( ( { input } ) => input . input_type === 'UTXO' )
@@ -2271,6 +2275,14 @@ class Client {
2271
2275
// @ts -ignore
2272
2276
inputAddresses . push ( transactionJSONrepresentation . outputs [ 0 ] . destination ) ;
2273
2277
}
2278
+ // @ts -ignore
2279
+ if ( transactionJSONrepresentation . inputs [ 0 ] . input . input_type === 'AccountCommand' ) {
2280
+ // @ts -ignore
2281
+ if ( transactionJSONrepresentation . inputs [ 0 ] . input . destination ) {
2282
+ // @ts -ignore
2283
+ inputAddresses . push ( transactionJSONrepresentation . inputs [ 0 ] . input . destination ) ;
2284
+ }
2285
+ }
2274
2286
2275
2287
const transactionsize = estimate_transaction_size (
2276
2288
mergeUint8Arrays ( inputsArray ) ,
@@ -2279,6 +2291,8 @@ class Client {
2279
2291
network ,
2280
2292
) ;
2281
2293
2294
+ console . log ( 'transactionsize' , transactionsize ) ;
2295
+
2282
2296
return {
2283
2297
inputs : inputsArray ,
2284
2298
outputs : outputsArray ,
0 commit comments