UTXO - NFT #96
Replies: 3 comments
-
@dvirainisch So if I understand correctly, even if the receiver is same (contract address), you want two outputs at the same contract address. What about the datum hash? Both output need to have same datum or different ? One more question. Which api are you using to do the transfer ? High level api (PaymentTransaction ) or composable function (TxBuilder) ? In high-level api, it was possible earlier, but the current impl tries to merge the outputs if possible to minimize the fee. |
Beta Was this translation helpful? Give feedback.
-
No let me clarify. The problem is that the NFT we want to send to the contract address is part of a utxo that contains multiple other NFTs. If we send the entire utxo to the contract we would esstiantly be locking multiple assets in the contract and we don’t want that. We want to send only one of the NFTs to the contract and the rest should remain owned by the seller. For your second question, We are not using an external api. We are trying to implement it with your great library, so I guess you could say we are using blockfrost. |
Beta Was this translation helpful? Give feedback.
-
Got it. You are right. So, you will have one utxo as input and two output utxos (one at script address with datum and single NFT, another one as change output with remaining NFTs and ada balance). Sending a NFT to script address is similar to a payment transaction but with some datum hash. You can use high-level PaymentTransaction api or composable function. Both are ok. You can check many examples in this integration test class including actual contract calls. In this particular method, ADA is sent to a contract address. Check how you can pass your input utxo through utxosToInclude(utxos) . The api will refund remaining nfts and ada to sender address. But if you want control over the final transaction object before sending to the node, you can use composable functions. Here are few examples how to do payment transactions using functions Note: Above integration tests are using current master version of the lib. You may find some minor api changes in the current github version. But you can use SNAPSHOT version of the lib to resolve that for now. More info on how to use SNAPSHOT version can be found in project's README. (https://github.com/bloxbean/cardano-client-lib#for-snapshot-binary) Here's another repo where you can find some more examples |
Beta Was this translation helpful? Give feedback.
-
Hello,
We are trying to send a NFT that someone has to a smart contract.
There are two possible cases for the UTXO containing the NFT:
For example:
This case is a bit problematic. How would you go about splitting this UTXO into two new UTXOs where one UTXO would contain only one token and the second UTXO would contain all the other tokens? Is there a built-in function that does this? If not it is not a problem to create one but then rises the question of how would you split the lovelace between the two utxos?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions