butaneprotocol / translucent-compat

Deprecated in favour of blaze https://github.com/butaneprotocol/blaze-cardano
https://github.com/butaneprotocol/blaze-cardano
Other
15 stars 8 forks source link

Error: null pointer passed to rust #42

Closed Proxiweb closed 5 months ago

Proxiweb commented 5 months ago

I'm encountering a strange problem, and I can't figure what's going on.

Here is my code :

paramsUtxo is an utxo with a state datum my contract need utxos are from my wallet asset is the asset built with the policyId of the contract. I want to mint and distribute contract_asset is a contract locked in the contract which is spent to the contract itself bankStateUtxo is an utxo containing the contract_asset

For simplicity, I've set redeemers and datums to Data.void()

        const tx = await translucent
          .newTx()
          .attachMintingPolicy(contract)
          .readFrom([paramsUtxo])
          .collectFrom(utxos)
          .mintAssets({ [asset]: BigInt(200) }, Data.void())
          .collectFrom([bankStateUtxo], Data.void())
          .validFrom(currentTime)
          .validTo(laterTime)
          .addSigner(await translucent.wallet.address())
          .payToContract(
            contractAddress,
            {
              inline: Data.void(),
            },
            { [contract_asset]: BigInt(1) }
          )
         .payToAddress(distributionA, { [asset]: BigInt(100) })
         .payToAddress(distributionB, { [asset]: BigInt(100) })          
          .complete();
.mintAssets({ [asset]: BigInt(bankMinterState.maxIssuance) }, Data.void())
.collectFrom([bankStateUtxo], Data.void())

When I have only one of this line, the other one disabled , the contract is executed. When I have these two lines, the code crash with the message

image

The code PlutusScriptWitness.from_script is called twice. The second time in the line

image

ptr0 is equal to 0. Then the app is crashing.

Have you an idea of what's going on ?