thor-devkit.js
thor-devkit.js copied to clipboard
Support latest connex
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
@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'}))