airgap-it / airgap-coin-lib

A library that offers a unified API to prepare, sign and broadcast multiple cryptocurrencies.
https://airgap-it.github.io/airgap-coin-lib/
MIT License
143 stars 38 forks source link

Examples not working #64

Open davidyuk opened 7 months ago

davidyuk commented 7 months ago

I've cloned this repo, did npm i and according to https://github.com/airgap-it/airgap-coin-lib/blob/master/examples/readme.md

$ npx ts-node examples/serializer/create-qr.ts 
/usr/local/lib/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
examples/serializer/create-qr.ts:6:3 - error TS2322: Type 'number' is not assignable to type 'string'.

6   id: generateId(8),
    ~~

  packages/serializer/src/v2/message.ts:22:3
    22   id: string
         ~~
    The expected type comes from property 'id' which is declared here on type 'IACMessageDefinitionObject'
examples/serializer/create-qr.ts:37:3 - error TS2322: Type 'number' is not assignable to type 'string'.

37   id: generateId(8),
     ~~

  packages/serializer/src/v2/message.ts:22:3
    22   id: string
         ~~
    The expected type comes from property 'id' which is declared here on type 'IACMessageDefinitionObject'
examples/serializer/create-qr.ts:48:20 - error TS2673: Constructor of class 'SerializerV3' is private and only accessible within the class declaration.

48 const serializer = new SerializerV3()
                      ~~~~~~~~~~~~~~~~~~
examples/serializer/create-qr.ts:52:16 - error TS7006: Parameter 'serialized' implicitly has an 'any' type.

52   .then(async (serialized) => {
                  ~~~~~~~~~~

    at createTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/usr/local/lib/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/usr/local/lib/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Object.require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Function.Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) {
  diagnosticCodes: [ 2322, 2322, 2673, 7006 ]
}