Closed aleeusgr closed 1 year ago
I get an error in https://github.com/aleeusgr/potential-robot/blob/d799586672f3daf1ce59a769a35256435468c24b/tests/helios-vesting-cancel.test.ts#L135
```shell { + origOutput: { + address: { + bech32: 'addr_test1vz2a83z0d5gceyghfrjqpaqu2f98evk8q6swje2c5ddqmaca2vhfl', + hex: '6095d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7', + }, + datum: null, + refScript: null, + value: { + assets: {}, + lovelace: '59747752', + }, + }, + txId: '28e8c61f4da31df8541b4fca272dd66b6fb258404bba7a8c8d7fc75d7b00c5ef', + utxoIdx: '1', + } ```
```shell { + origOutput: { + address: { + bech32: 'addr_test1wqzs96thkxedr0jpak4ar9qp6ew58uwexmuz99ah93ckv0q6z8ey4', + hex: '700502e977b1b2d1be41edabd19401d65d43f1d936f82297b72c71663c', + }, + datum: { + inlineCbor: '9f581c95d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7581c3b61a40bc5872219ce830fb9c792d8 d53fb87921f590287057e4e3b41b000001867b8b7b00ff', + inlineSchema: { + list: [ + { + bytes: '95d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7', + }, + { + bytes: '3b61a40bc5872219ce830fb9c792d8d53fb87921f590287057e4e3b4', + }, + { + int: 1677109984000, + }, + ], + }, + }, refScript: null, + value: { + assets: { + '49b106e698de78171de2faf35932635e1085c12508ca87718a2d4487': { + '56657374696e67204b6579': '1', + }, + }, + lovelace: '10000000', + }, + }, + txId: '28e8c61f4da31df8541b4fca272dd66b6fb258404bba7a8c8d7fc75d7b00c5ef', + utxoIdx: '0', + } ```
If you have some spare utxos, you could use them to cover those fees: tx.finalize(networkParams, changeAddress, spareUtxos)
You need to dump the complete body to be able to debug this properly (i.e. all the inputs and all the outputs)
@christianschmitz thank you for responding. I will experiment with utxos next, here is tx.dump().body:
{ [71/794]
+ collateral: [
+ {
+ origOutput: {
+ address: {
+ bech32: 'addr_test1vz2a83z0d5gceyghfrjqpaqu2f98evk8q6swje2c5ddqmaca2vhfl',
+ hex: '6095d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7',
+ },
+ datum: null,
+ refScript: null,
+ value: {
+ assets: {},
+ lovelace: '59747752',
+ },
+ },
+ txId: '28e8c61f4da31df8541b4fca272dd66b6fb258404bba7a8c8d7fc75d7b00c5ef',
+ utxoIdx: '1',
+ },
+ ],
+ collateralReturn: null,
+ fee: '0',
+ firstValidSlot: null,
nputs: [ [49/794]
+ {
+ origOutput: {
+ address: {
+ bech32: 'addr_test1wqzs96thkxedr0jpak4ar9qp6ew58uwexmuz99ah93ckv0q6z8ey4',
+ hex: '700502e977b1b2d1be41edabd19401d65d43f1d936f82297b72c71663c',
+ },
+ datum: {
+ inlineCbor: '9f581c95d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7581c3b61a40bc5872219ce830fb9c7
92d8d53fb87921f590287057e4e3b41b000001867b8b7b00ff',
+ inlineSchema: {
+ list: [
+ {
+ bytes: '95d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7',
+ },
+ {
+ bytes: '3b61a40bc5872219ce830fb9c792d8d53fb87921f590287057e4e3b4',
+ },
+ {
+ int: 1677109984000,
+ },
+ ],
+ },
+ },
+ refScript: null,
+ value: { [24/794]
+ assets: {
+ '49b106e698de78171de2faf35932635e1085c12508ca87718a2d4487': {
+ '56657374696e67204b6579': '1',
+ },
+ },
+ lovelace: '10000000',
+ },
+ },
+ txId: '28e8c61f4da31df8541b4fca272dd66b6fb258404bba7a8c8d7fc75d7b00c5ef',
+ utxoIdx: '0',
+ },
+ ],
+ lastValidSlot: null,
+ metadataHash: null,
+ minted: null,
+ outputs: [
+ {
+ address: {
+ bech32: 'addr_test1vz2a83z0d5gceyghfrjqpaqu2f98evk8q6swje2c5ddqmaca2vhfl',
+ hex: '6095d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7',
+ },
+ datum: null,
+ refScript: null,
+ value: {
+ assets: {
+ '49b106e698de78171de2faf35932635e1085c12508ca87718a2d4487': {
+ '56657374696e67204b6579': '1',
+ },
+ },
+ lovelace: '10000000',
+ },
+ },
+ ],
+ refInputs: [],
+ scriptDataHash: null,
+ signers: [
+ '95d3c44f6d118c911748e400f41c524a7cb2c706a0e96558a35a0df7',
+ ],
+ }
total input: 10000000 total output: 10000000
And fees will be > 0. Including some spareUtxos will be the easiest way to cover the fees.
I thought that the purpose of the collateral to cover fees. Fair enough I stand corrected.
:thinking: I network.createUtxo but it does not show up...
lockAda takes all utxos from a wallet and leaves it with only one, I think I should add an explanation to it.
Or should I fix it?
My wallet does not have spare utxos: my lockAda tx had a list of utxos's as input, and the output of the lock transaction sends all the change to a single utxo in alice.address;
if I duplicate https://github.com/aleeusgr/potential-robot/blob/d799586672f3daf1ce59a769a35256435468c24b/tests/helios-vesting-cancel.test.ts#L43 even after a transaction, my test shows only one utxo in alice.address; maybe I can only add utxos to a wallet if it didn't have any transactions, only for emulator instantiation. :thinking: A good way to do is to have several utxos at emulator instantiation and have lockAda consume only one utxo.
@christianschmitz thanks for your help, I solved it.
I changed tx building process so that it consumes only one utxo, while api requires a list. Adding all utxos seems to be bunching stuff up together in one utxo in the transaction output (I got change of its value if I added network.createUtxo
, and if I did so after submitting a lockAda transaction, new utxos did not appear in the wallet address.)
https://www.hyperion-bt.org/helios-book/api/reference/tx.html?highlight=addcoll#addcollateral
https://www.hyperion-bt.org/helios-book/api/reference/networkparams.html
Originally posted by @aleeusgr in https://github.com/aleeusgr/potential-robot/issues/104#issuecomment-1556605860