Skip to content

Commit

Permalink
Change to preview
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron committed Apr 29, 2024
1 parent 76c542c commit b314326
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions src/week02/scripts/collect_gift.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ def main(name: str, script: str):
break
assert isinstance(utxo_to_spend, UTxO), "No script UTxOs found!"

# Find a collateral UTxO
non_nft_utxo = None
for utxo in context.utxos(payment_address):
# multi_asset should be empty for collateral utxo
if not utxo.output.amount.multi_asset:
non_nft_utxo = utxo
break
assert isinstance(non_nft_utxo, UTxO), "No collateral UTxOs found!"

# Build the transaction
# no output is specified since everything minus fees is sent to change address
if script in ["fourty_two", "fourty_two_typed"]:
Expand All @@ -81,7 +72,6 @@ def main(name: str, script: str):
redeemer = Redeemer(0)
builder = TransactionBuilder(context)
builder.add_script_input(utxo_to_spend, script=plutus_script, redeemer=redeemer)
builder.collaterals.append(non_nft_utxo)

# Sign the transaction
payment_vkey, payment_skey, payment_address = get_signing_info(name)
Expand All @@ -95,7 +85,7 @@ def main(name: str, script: str):

# context.submit_tx(signed_tx.to_cbor())
print(f"transaction id: {signed_tx.id}")
print(f"Cardanoscan: https://preprod.cexplorer.io/tx/{signed_tx.id}")
print(f"Cardanoscan: https://preview.cexplorer.io/tx/{signed_tx.id}")


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions src/week02/scripts/make_gift.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import click
from pycardano import Address, TransactionBuilder, TransactionOutput, PlutusData
from pycardano import Address, TransactionBuilder, TransactionOutput, PlutusData, Unit

from src.utils import get_address, get_signing_info, get_chain_context
from src.week02 import assets_dir
Expand Down Expand Up @@ -35,7 +35,7 @@ def main(name: str, amount: int, script: str):
# Build the transaction
builder = TransactionBuilder(context)
builder.add_input_address(payment_address)
datum = PlutusData() # Plutus Unit type
datum = Unit()
builder.add_output(
TransactionOutput(address=script_address, amount=amount, datum=datum)
)
Expand All @@ -51,7 +51,7 @@ def main(name: str, amount: int, script: str):
context.submit_tx(signed_tx)

print(f"transaction id: {signed_tx.id}")
print(f"Cardanoscan: https://preprod.cexplorer.io/tx/{signed_tx.id}")
print(f"Cardanoscan: https://preview.cexplorer.io/tx/{signed_tx.id}")


if __name__ == "__main__":
Expand Down

0 comments on commit b314326

Please sign in to comment.