vechain / thor-devkit.js

Typescript library to aid DApp development on VeChain Thor
MIT License
40 stars 32 forks source link

Support latest connex #13

Open molekilla opened 5 years ago

molekilla commented 5 years ago

Hi I'm getting this with Typescript

Argument of type 'Connex.Thor.Clause[]' is not assignable to parameter of type 'import("/home/some/Code/connex-ts/node_modules/thor-devkit/dist/transaction").Transaction.Clause[]'.
  Type 'Connex.Thor.Clause' is not assignable to type 'import("/home/some/Code/connex-ts/node_modules/thor-devkit/dist/transaction").Transaction.Clause'.
    Property 'data' is optional in type 'Clause' but required in type 'Clause'

data needs to be optional in thor-devkit

Thanks Rogelio

qianbin commented 5 years ago

@molekilla ~You must be using latest connex release v1.3.1.~ In practical, type string? is more suitable for Clause.data, and i think it's the rare case to encode a tx in connex environment.

The workaround:

// assume type of `clauses` is Connex.Thor.Clause[]
const converted = clauses.map(c => ({to: c.to, value: c.value, data: c.data || '0x'}))