0

I'm trying to build lucid to connect with cardano smartcontract from scratch using webpack, but I always getting this error related to datum data

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Symbol(TypeBox.Modifier)'

this error referring to this datum data

const VestingDatum = L.Data.Object({
    beneficiary: L.Data.String,
    deadline: L.Data.BigInt
});

the error is gone when I deleting this VestingDatum but the script still not working because it need the VestingDatum data , am I missing something ? and how to solve this problem ?

1 Answer 1

1

Looks like L.Data.BigInt doesn't exist in the code. You'll have to choose L.Data.Integer or another type to support what you need. For that matter, I don't see L.Data.String either. The data types available are inside the Data object starting around line 38 in the source listed below.

This is what they suggest to use in place of your current needs.

| bigint // Integer
| string // Bytes in hex

https://deno.land/x/[email protected]/src/plutus/data.ts?source#L38

Update:

const VestingDatum = L.Data.Object({
    beneficiary: L.Data.Bytes(),
    deadline: L.Data.Integer()
});

https://github.com/spacebudz/lucid/blob/c4da80a93ba70dde47c02e31036631e8be494620/src/examples/typed_data.ts#L12

4
  • Hi @PREEB, it's still not working, I use L.Data.Integer, now the error is Error: Could not serialize the data: Unsupported type, I also use L.Data.bigint but got another error TypeError: Cannot read properties of undefined (reading 'Symbol(TypeBox.Modifier)') Apr 14 at 1:14
  • @ErwinKurnia I added an update to my answer. You'll need to change both data types. The link below is to an example where I found that.
    – PREEB
    Apr 14 at 13:47
  • Hi @PREEB, now I change it to beneficiary: L.Data.Bytes() and deadline: L.Integer(), now the error is lucid_cardano__WEBPACK_IMPORTED_MODULE_3__.Integer is not a function and error export 'Integer' (imported as 'L') was not found in 'lucid-cardano, I use "lucid-cardano": "^0.9.1" Apr 14 at 23:17
  • 1
    The error is gone now, after I explicitly import Data using import {Blockfrost, Data, Lucid} from 'lucid-cardano'; thank you @PREEB Apr 14 at 23:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.