cardano-serialization-lib icon indicating copy to clipboard operation
cardano-serialization-lib copied to clipboard

Errors after npm i and npm run js:build in the examples folder

Open 34r7h opened this issue 4 years ago • 1 comments

npm run js:build

> [email protected] js:build /home/34r7h/cardano-serialization-lib/example
> rm -rf dist && tsc

index.spec.ts:67:54 - error TS2554: Expected 6 arguments, but got 4.

 67     const txBuilder = CardanoWasm.TransactionBuilder.new(
                                                         ~~~~
 68       // all of these are taken from the mainnet genesis settings
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 72       CardanoWasm.BigNum.from_str('2000000')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 73     );
    ~~~~~

  ../rust/pkg/cardano_serialization_lib.d.ts:4033:106
    4033   static new(linear_fee: LinearFee, minimum_utxo_val: BigNum, pool_deposit: BigNum, key_deposit: BigNum, max_value_size: number, max_tx_size: number): TransactionBuilder;
                                                                                                                  ~~~~~~~~~~~~~~~~~~~~~~
    An argument for 'max_value_size' was not provided.

index.spec.ts:84:7 - error TS2345: Argument of type 'BigNum' is not assignable to parameter of type 'Value'.
  Type 'BigNum' is missing the following properties from type 'Value': coin, set_coin, multiasset, set_multiasset

84       CardanoWasm.BigNum.from_str('3000000')
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

index.spec.ts:91:9 - error TS2345: Argument of type 'BigNum' is not assignable to parameter of type 'Value'.

91         CardanoWasm.BigNum.from_str("1000000"),
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 3 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] js:build: `rm -rf dist && tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] js:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/34r7h/.npm/_logs/2021-10-29T12_11_21_651Z-debug.log

34r7h avatar Oct 29 '21 12:10 34r7h

These examples are very, very outdated. It's better to use the stuff in the docs as they're also a lot more fleshed out. We do have a pending PR in another fork that covers this and some other stuff but we'd have to untangle the fixes. iirc the main (or only?) issue was the shelley -> shelley-mary multiasset change so we just need to change stuff like Coin.from_str("100") to Value.new(&Coin.from_str("100")) We should still decide what we want to do with these @vsubhuman @SebastienGllmt and for documentation in general. We need to update the docs for the Alonzo changes as well. There's been quite a few updates to the tx builder too.

rooooooooob avatar Nov 03 '21 15:11 rooooooooob