sCrypt-Inc / scrypt-ord

sCrypt 1sat ordinal library
https://docs.scrypt.io/tokens/
19 stars 5 forks source link

Multiple errors on bsv20V1.ts after installing scrypt-ord 1.0.3 on Windows, node v16.16.0 #36

Closed Neggia closed 11 months ago

Neggia commented 11 months ago

Hello, I have the following errors on file bsv20V1.ts : line 172: ...args -> Rest parameter 'args' implicitly has an 'any[]' type.ts(7019) line 230: instance: receiver.instance, -> Type 'BSV20V1 | OrdP2PKH' is not assignable to type 'SmartContract'. Type 'BSV20V1' is not assignable to type 'SmartContract'. The types returned by 'getTxBuilder(...)' are incompatible between these types. Type 'MethodCallTxBuilder' is not assignable to type 'MethodCallTxBuilder'. Type 'SmartContract' is missing the following properties from type 'BSV20V1': isBSV20V1, tick, max, lim, and 7 more.ts(2322) contract-call.d.ts(9, 5): The expected type comes from property 'instance' which is declared here on type 'StatefulNext' line 253: instance: p2pkh, -> Type 'OrdP2PKH' is not assignable to type 'SmartContract'. The types returned by 'getTxBuilder(...)' are incompatible between these types. Type 'MethodCallTxBuilder' is not assignable to type 'MethodCallTxBuilder'. Type 'SmartContract' is missing the following properties from type 'OrdP2PKH': addr, unlock, setBSV20, getNopScript, and 6 more.ts(2322) contract-call.d.ts(9, 5): The expected type comes from property 'instance' which is declared here on type 'StatefulNext' line 317: const tx = options.partialContractTx.tx -> 'options.partialContractTx' is possibly 'undefined'.ts(18048) lne 337: instance, -> Type 'BSV20V1' is not assignable to type 'SmartContract'.ts(2322) contract-call.d.ts(9, 5): The expected type comes from property 'instance' which is declared here on type 'StatefulNext' line 358: instance, -> Type 'BSV20V1' is not assignable to type 'SmartContract'.ts(2322) contract-call.d.ts(9, 5): The expected type comes from property 'instance' which is declared here on type 'StatefulNext' line 375: (sigResps) => findSig(sigResps, ordPubKey), -> Parameter 'sigResps' implicitly has an 'any' type.ts(7006)

Neggia commented 11 months ago

With 1.0.3 the following compiler directives in tsconfig.json cleared 3 out of 7 errors: { "compilerOptions": { "noImplicitAny": false, "strictNullChecks": false } } After updating to 1.0.4, all fixed with the following compiler directive: { "compilerOptions": { "strict": false, } }

Neggia commented 11 months ago

I'm having the following errors in 1.0.4, and also in new 1.0.5:

Also npx scrypt-cli@latest compile can't compile contract PermissionedFTV2:

Error: Command failed with exit code 2: at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\scrypt-cli\src\lib\helpers.js:16:24 at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\shelljs\src\exec.js:145:9 at ChildProcess.exithandler (node:child_process:406:5) at ChildProcess.emit (node:events:527:28) at maybeClose (node:internal/child_process:1092:16) ✖ Building TS ERROR: Building TS failed!

zhfnjust commented 11 months ago

@Neggia i have create a demo project and it works fine. idk why you got this. can you check the repo: https://github.com/zhfnjust/issue_36

zhfnjust commented 11 months ago

I'm having the following errors in 1.0.4, and also in new 1.0.5:

  • ERROR in ./node_modules/scrypt-ord/dist/contracts/bsv20V1.js 127:12-37 Module not found: Error: Cannot find file: 'BSV20V1P2PKH.js' does not match the corresponding name on disk: '.\node_modules\scrypt-ord\dist\contracts\bsv20V1P2PKH.js'.
  • ERROR in node_modules/scrypt-ord/src/1satApis.ts:16:9 TS2739: Type 'Promise' is missing the following properties from type 'IUnspentOutput': txId, outputIndex, script, satoshis

Also npx scrypt-cli@latest compile can't compile contract PermissionedFTV2:

Error: Command failed with exit code 2: at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\scrypt-cli\src\lib\helpers.js:16:24 at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\shelljs\src\exec.js:145:9 at ChildProcess.exithandler (node:child_process:406:5) at ChildProcess.emit (node:events:527:28) at maybeClose (node:internal/child_process:1092:16) ✖ Building TS ERROR: Building TS failed!

Fixed https://github.com/sCrypt-Inc/scrypt-ord/commit/cc7a9c0c837012897d040aca8bad9cab9ca97c9a

try v1.0.6

Neggia commented 11 months ago

After updating to 1.0.6 only error left is:

ERROR in node_modules/scrypt-ord/src/1satApis.ts:16:9 TS2739: Type 'Promise' is missing the following properties from type 'IUnspentOutput': txId, outputIndex, script, satoshis 14 | const url = ${this.apiBase}/txos/${outpoint}?script=true 15 |

16 | return superagent

But still npx scrypt-cli@latest compile can't compile contract PermissionedFTV2 (taken from https://github.com/sCrypt-Inc/scrypt-ord/blob/master/tests/contracts/permissionedFTV2.ts , should be compiled standalone without any other setting in my project right?):

Error: Command failed with exit code 2: at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\scrypt-cli\src\lib\helpers.js:20:24 at C:\Users\Andrea\AppData\Local\npm-cache_npx\2c137b5e74e84b07\node_modules\shelljs\src\exec.js:145:9 at ChildProcess.exithandler (node:child_process:406:5) at ChildProcess.emit (node:events:527:28) at maybeClose (node:internal/child_process:1092:16) at Socket. (node:internal/child_process:451:11) at Socket.emit (node:events:527:28) ✖ Building TS ERROR: Building TS failed!

Neggia commented 10 months ago

Ok, I did a new clean installation (don't know why it gets dirty at some time, already did once before..) and with all the latest version ("scrypt-ord": "^1.0.7", "scrypt-ts": "^1.3.14") all runs fine, had to set in tsconfig.json:

"strict": false, "isolatedModules": false,