Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/cardano-coin-selection-asmjs",
"version": "1.1.10-alpha.8",
"version": "1.1.10",
"description": "",
"keywords": [
"coin selection"
Expand Down
1 change: 0 additions & 1 deletion src/utils/onekey/dapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ const convertCborTxToEncodeTx = async ({
let body: CardanoWasm.TransactionBody;
let rawTxHex: string;

// console.log('CARDANO LOCAL_VERSION : 333====>>>');
try {
const tx = CardanoWasm.Transaction.from_bytes(Buffer.from(txHex, 'hex'));
body = tx.body();
Expand Down
28 changes: 17 additions & 11 deletions src/utils/onekey/txToOneKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,17 +457,23 @@ export const txToOneKey = async (
mintBundle = [];
for (let j = 0; j < mint.keys().len(); j++) {
const policy = mint.keys().get(j);
const assets = mint.get(policy);
// CSL 13: Mint.get(policy) returns MintsAssets — a list, one entry per
// occurrence of that policy in the original CBOR — to preserve byte-
// level round-trip (tx hash stability). Iterate the list, then each map.
const mintsAssets = mint.get(policy);
const tokens = [];
for (let k = 0; k < assets.keys().len(); k++) {
const assetName = assets.keys().get(k);
const amount = assets.get(assetName);
tokens.push({
assetNameBytes: Buffer.from(assetName.name()).toString('hex'),
mintAmount: amount.is_positive()
? amount.as_positive().to_str()
: '-' + amount.as_negative().to_str(),
});
for (let mai = 0; mai < mintsAssets.len(); mai++) {
const assets = mintsAssets.get(mai);
for (let k = 0; k < assets.keys().len(); k++) {
const assetName = assets.keys().get(k);
const amount = assets.get(assetName);
tokens.push({
assetNameBytes: Buffer.from(assetName.name()).toString('hex'),
mintAmount: amount.is_positive()
? amount.as_positive().to_str()
: '-' + amount.as_negative().to_str(),
});
}
}
// sort canonical
sortCanonicallyInPlace(tokens, item => item.assetNameBytes);
Expand Down Expand Up @@ -543,7 +549,7 @@ export const txToOneKey = async (
for (let i = 0; i < ri.len(); i++) {
referenceInputs.push({
prev_hash: ri.get(i).transaction_id().to_hex(),
prev_index: parseInt(ri.get(i).index().to_str()),
prev_index: parseInt(String(ri.get(i).index())),
});
}
signingMode = CardanoTxSigningMode.PLUTUS_TRANSACTION;
Expand Down
Loading