Skip to content

Commit

Permalink
fix: ada transfer (#3991)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 authored Dec 26, 2023
1 parent d2cd03a commit e4016d2
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions packages/engine/src/vaults/impl/ada/Vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,23 +432,28 @@ export default class Vault extends VaultBase {
sdk.ensureSDKReady(),
]);

const amountBN = new BigNumber(amount).shiftedBy(decimals);
const output = tokenAddress
? {
address: to,
amount: undefined,
assets: [
{
quantity: amountBN.toFixed(),
unit: tokenAddress,
},
],
}
: {
address: to,
amount: amountBN.toFixed(),
assets: [],
};
const amountBN = new BigNumber(amount);

let output;
if (tokenAddress) {
output = {
address: to,
amount: undefined,
assets: [
{
quantity: amountBN.shiftedBy(token.decimals).toFixed(),
unit: tokenAddress,
},
],
};
} else {
output = {
address: to,
amount: amountBN.shiftedBy(decimals).toFixed(),
assets: [],
};
}

const CardanoApi = await sdk.getCardanoApi();
let txPlan: Awaited<ReturnType<typeof CardanoApi.composeTxPlan>>;
try {
Expand Down

0 comments on commit e4016d2

Please sign in to comment.