@onekeyfe/cardano-coin-selection-asmjs 1.1.8 → 1.1.9

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.
@@ -90,13 +90,20 @@ const getUtxos = async (address, utxos, amount) => {
90
90
  const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) => {
91
91
  var _a, _b, _c, _d;
92
92
  let body;
93
+ let rawTxHex;
93
94
  console.log('CARDANO LOCAL_VERSION : 1');
94
95
  try {
95
96
  const tx = CardanoWasm.Transaction.from_bytes(Buffer.from(txHex, 'hex'));
96
97
  body = tx.body();
98
+ rawTxHex = txHex;
97
99
  }
98
100
  catch (_e) {
101
+ // Input is TransactionBody only (e.g., from staking providers like stakefish)
102
+ // Build a complete Transaction with empty witness set
99
103
  body = CardanoWasm.TransactionBody.from_bytes(Buffer.from(txHex, 'hex'));
104
+ const emptyWitnessSet = CardanoWasm.TransactionWitnessSet.new();
105
+ const tx = CardanoWasm.Transaction.new(body, emptyWitnessSet);
106
+ rawTxHex = Buffer.from(tx.to_bytes(), 'hex').toString('hex');
100
107
  }
101
108
  // Fee
102
109
  const fee = body.fee().to_str();
@@ -251,7 +258,7 @@ const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) =
251
258
  .transaction_hash()
252
259
  .to_hex(),
253
260
  size: 0,
254
- rawTxHex: txHex,
261
+ rawTxHex,
255
262
  },
256
263
  signOnly: true,
257
264
  staking: stakingInfo,
@@ -60,13 +60,20 @@ const getUtxos = async (address, utxos, amount) => {
60
60
  const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) => {
61
61
  var _a, _b, _c, _d;
62
62
  let body;
63
+ let rawTxHex;
63
64
  console.log('CARDANO LOCAL_VERSION : 1');
64
65
  try {
65
66
  const tx = CardanoWasm.Transaction.from_bytes(Buffer.from(txHex, 'hex'));
66
67
  body = tx.body();
68
+ rawTxHex = txHex;
67
69
  }
68
70
  catch (_e) {
71
+ // Input is TransactionBody only (e.g., from staking providers like stakefish)
72
+ // Build a complete Transaction with empty witness set
69
73
  body = CardanoWasm.TransactionBody.from_bytes(Buffer.from(txHex, 'hex'));
74
+ const emptyWitnessSet = CardanoWasm.TransactionWitnessSet.new();
75
+ const tx = CardanoWasm.Transaction.new(body, emptyWitnessSet);
76
+ rawTxHex = Buffer.from(tx.to_bytes(), 'hex').toString('hex');
70
77
  }
71
78
  // Fee
72
79
  const fee = body.fee().to_str();
@@ -221,7 +228,7 @@ const convertCborTxToEncodeTx = async (txHex, utxos, addresses, changeAddress) =
221
228
  .transaction_hash()
222
229
  .to_hex(),
223
230
  size: 0,
224
- rawTxHex: txHex,
231
+ rawTxHex,
225
232
  },
226
233
  signOnly: true,
227
234
  staking: stakingInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/cardano-coin-selection-asmjs",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "coin selection"