-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
Deserialization failed in AssetName because: Out of range: 34 - must be in range 0 - 32
Trace: Deserialization failed in AssetName because: Out of range: 34 - must be in range 0 - 32
at get_utx0_fee (<removed>/quictest.js:25:13)
at Object.<anonymous> (<removed>/quictest.js:39:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
const {
AddressWallet,
AssetWallet,
Seed,
} = require('cardano-wallet-js');
const {logger} = require('../src/utils/logger');
async function get_utx0_fee(asset) {
// log as debug
logger.debug(`call_api => get_utx0_fee, assets: ${JSON.stringify(asset)}`);
const to_wallet_address = 'addr_test1qqv8d2p20pympfn0y49kks7emlyjhr06zys3nh9juunkj2qetvza8gj77ccxvwrup8q7ptr3szfdv69weth92ta3888q3v6ttk';
const receiverAddress = [new AddressWallet(to_wallet_address)];
const assets = {};
assets[receiverAddress[0].id] = [asset];
let minAda = 0;
try {
minAda = Seed.getMinUtxoValueWithAssets([asset]);
} catch (e) {
logger.error(`get_utx0_fee => error: ${e}`);
logger.error(e.stack || e);
console.trace(e);
}
logger.debug(`minAda: ${minAda}`);
}
const asset_name = 'DegenDuckClub4997';
const policy_id = '39657c6085c655eed11db1dce015d8a8719dae1a77705a782720f1a7';
const asset_name_id = Buffer.from(asset_name).toString('hex');
const asset_amount = 1;
const asset = new AssetWallet(policy_id, asset_name_id, asset_amount);
get_utx0_fee(asset);
It looks like assetName can be up to 64
https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAsset
If I call the wallet API directly ie:
const getFees = await axios.post(
`${base_url}/wallets/${wallet_id}/payment-fees`,
payment,
);
It returns with a value
Metadata
Metadata
Assignees
Labels
No labels