platform icon indicating copy to clipboard operation
platform copied to clipboard

Try to include dash platform sdk to angular app

Open ItsMisterP opened this issue 2 years ago • 3 comments

I am in the process of creating the password manager on Dash platform. For this purpose, I want to include Dash SDK in the app. Here come some errors, due to which the app does not compile.

Expected Behavior

Can use the sdk without problems and ts can compile the app

Current Behavior

the following errors prevent Typescript from compiling the code:

Error: node_modules/@dashevo/dashcore-lib/typings/transaction/Transaction.d.ts:366:15 - error TS7006: Parameter 'txId' implicitly has an 'any' type.

366 removeInput(txId, outputIndex): void; ~~~~

Error: node_modules/@dashevo/dashcore-lib/typings/transaction/Transaction.d.ts:366:21 - error TS7006: Parameter 'outputIndex' implicitly has an 'any' type.

366 removeInput(txId, outputIndex): void; ~~~~~~~~~~~

Error: node_modules/@dashevo/dashcore-lib/typings/transaction/Transaction.d.ts:413:20 - error TS7006: Parameter 'signature' implicitly has an 'any' type.

413 isValidSignature(signature): boolean; ~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/index.d.ts:10:23 - error TS7016: Could not find a declaration file for module './CONSTANTS'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/CONSTANTS.js' implicitly has an 'any' type.

10 import CONSTANTS from "./CONSTANTS"; ~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/index.d.ts:11:20 - error TS7016: Could not find a declaration file for module './EVENTS'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/EVENTS.js' implicitly has an 'any' type.

11 import EVENTS from "./EVENTS"; ~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/index.d.ts:12:19 - error TS7016: Could not find a declaration file for module './utils'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/utils/index.js' implicitly has an 'any' type.

12 import utils from "./utils"; ~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/index.d.ts:13:21 - error TS7016: Could not find a declaration file for module './plugins'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/plugins/index.js' implicitly has an 'any' type.

13 import plugins from "./plugins"; ~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:1:47 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

1 import {Block, BlockHeader, Transaction} from "@dashevo/dashcore-lib"; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:4:5 - error TS7010: 'announce', which lacks return-type annotation, implicitly has an 'any' return type.

4 announce(eventName, args) ~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:4:14 - error TS7006: Parameter 'eventName' implicitly has an 'any' type.

4 announce(eventName, args) ~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:4:25 - error TS7006: Parameter 'args' implicitly has an 'any' type.

4 announce(eventName, args) ~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:6:5 - error TS7010: 'disconnect', which lacks return-type annotation, implicitly has an 'any' return type.

6 disconnect() ~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:16:20 - error TS7006: Parameter 'hash' implicitly has an 'any' type.

16 getBlockByHash(hash): Promise<Block> ~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:18:22 - error TS7006: Parameter 'height' implicitly has an 'any' type.

18 getBlockByHeight(height): Promise<Block> ~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:20:26 - error TS7006: Parameter 'hash' implicitly has an 'any' type.

20 getBlockHeaderByHash(hash): Promise<BlockHeader> ~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:22:28 - error TS7006: Parameter 'height' implicitly has an 'any' type.

22 getBlockHeaderByHeight(height): Promise<BlockHeader> ~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:28:20 - error TS7006: Parameter 'txid' implicitly has an 'any' type.

28 getTransaction(txid): Promise<Transaction> ~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:30:21 - error TS7006: Parameter 'serializedTransaction' implicitly has an 'any' type.

30 sendTransaction(serializedTransaction): Promise ~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/transport/Transport.d.ts:32:5 - error TS7010: 'subscribeToAddressesTransactions', which lacks return-type annotation, implicitly has an 'any' return type.

32 subscribeToAddressesTransactions() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:16:29 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

16 import { InstantLock } from "@dashevo/dashcore-lib"; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:21:25 - error TS7016: Could not find a declaration file for module '../Storage/Storage'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/types/Storage/Storage.js' implicitly has an 'any' type.

21 import { Storage } from "../Storage/Storage"; ~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:34:19 - error TS2304: Cannot find name 'KeyChainStore'.

34 keyChainSore: KeyChainStore; ~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:73:17 - error TS7031: Binding element 'Plugin' implicitly has an 'any' type.

73 hasPlugins([Plugin]): {found:Boolean, results:[{name: string}]}; ~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:76:91 - error TS2552: Cannot find name 'function'. Did you mean 'Function'?

76 waitForInstantLock(transactionHash: string): { promise: Promise<InstantLock>, cancel: function }; ~~~~~~~~

node_modules/typescript/lib/lib.es5.d.ts:319:13 319 declare var Function: FunctionConstructor; ~~~~~~~~ 'Function' is declared here.

Error: node_modules/@dashevo/wallet-lib/src/types/Account/Account.d.ts:77:85 - error TS2552: Cannot find name 'function'. Did you mean 'Function'?

77 waitForTxMetadata(transactionHash: string): { promise: Promise<Object>, cancel: function }; ~~~~~~~~

node_modules/typescript/lib/lib.es5.d.ts:319:13 319 declare var Function: FunctionConstructor; ~~~~~~~~ 'Function' is declared here.

Error: node_modules/@dashevo/wallet-lib/src/types/ChainStore/ChainStore.d.ts:34:15 - error TS7006: Parameter 'exportedState' implicitly has an 'any' type.

34 importState(exportedState): void; ~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/DerivableKeyChain/DerivableKeyChain.d.ts:2:41 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

2 import {HDPrivateKey, HDPublicKey} from "@dashevo/dashcore-lib"; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/DerivableKeyChain/DerivableKeyChain.d.ts:30:19 - error TS7006: Parameter 'address' implicitly has an 'any' type.

30 getForAddress(address): any; ~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Identities/Identities.d.ts:2:30 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

2 import { HDPrivateKey } from "@dashevo/dashcore-lib"; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Wallet/Wallet.d.ts:3:25 - error TS7016: Could not find a declaration file for module '../Storage/Storage'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/wallet-lib/src/types/Storage/Storage.js' implicitly has an 'any' type.

3 import { Storage } from "../Storage/Storage"; ~~~~~~~~~~~~~~~~~~~~

Error: node_modules/@dashevo/wallet-lib/src/types/Wallet/Wallet.d.ts:4:30 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

4 import { HDPrivateKey } from "@dashevo/dashcore-lib"; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/Client/Client.d.ts:4:25 - error TS7016: Could not find a declaration file for module '@dashevo/dashcore-lib'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dashcore-lib/index.js' implicitly has an 'any' type. If the '@dashevo/dashcore-lib' package actually exposes this module, try adding a new declaration (.d.ts) file containing declare module '@dashevo/dashcore-lib';

4 import { Network } from '@dashevo/dashcore-lib'; ~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/Client/Client.d.ts:5:24 - error TS7016: Could not find a declaration file for module '@dashevo/dapi-client'. '/home/philip/Projekte/Privat/AngularTutorial/node_modules/@dashevo/dapi-client/lib/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/dashevo__dapi-client if it exists or add a new declaration (.d.ts) file containing declare module '@dashevo/dapi-client';

5 import DAPIClient from '@dashevo/dapi-client'; ~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/Client/Platform/Platform.d.ts:100:57 - error TS2307: Cannot find module '@dashevo/wasm-dppdist/dpp' or its corresponding type declarations.

100 static initializeDppModule(): Promise<typeof import("@dashevo/wasm-dppdist/dpp")>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:110:43 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/plugins/StandardPlugin' or its corresponding type declarations.

110 StandardPlugin: typeof import("@dashevo/wallet-libsrc/plugins/StandardPlugin"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:111:35 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/plugins/Worker' or its corresponding type declarations.

111 Worker: typeof import("@dashevo/wallet-libsrc/plugins/Worker"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:116:53 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/calculateTransactionFees' or its corresponding type declarations.

116 calculateTransactionFees: typeof import("@dashevo/wallet-libsrc/utils/calculateTransactionFees"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:117:51 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/categorizeTransactions' or its corresponding type declarations.

117 categorizeTransactions: typeof import("@dashevo/wallet-libsrc/utils/categorizeTransactions"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:127:47 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/filterTransactions' or its corresponding type declarations.

127 filterTransactions: typeof import("@dashevo/wallet-libsrc/utils/filterTransactions"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:128:46 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/classifyAddresses' or its corresponding type declarations.

128 classifyAddresses: typeof import("@dashevo/wallet-libsrc/utils/classifyAddresses"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:148:40 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/dashToDuffs' or its corresponding type declarations.

148 dashToDuffs: typeof import("@dashevo/wallet-libsrc/utils/dashToDuffs"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:149:40 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/duffsToDash' or its corresponding type declarations.

149 duffsToDash: typeof import("@dashevo/wallet-libsrc/utils/duffsToDash"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:150:39 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/fundWallet' or its corresponding type declarations.

150 fundWallet: typeof import("@dashevo/wallet-libsrc/utils/fundWallet"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:151:39 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/getBytesOf' or its corresponding type declarations.

151 getBytesOf: typeof import("@dashevo/wallet-libsrc/utils/getBytesOf"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:152:38 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/hasMethod' or its corresponding type declarations.

152 hasMethod: typeof import("@dashevo/wallet-libsrc/utils/hasMethod"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: node_modules/dash/dist/src/SDK/SDK.d.ts:153:36 - error TS2307: Cannot find module '@dashevo/wallet-libsrc/utils/hasProp' or its corresponding type declarations.

153 hasProp: typeof import("@dashevo/wallet-libsrc/utils/hasProp");

Possible Solution

no idea :(

Steps to Reproduce (for bugs)

Create angular app and install dash sdk. After that, just include sdk with import Dash from 'dash';

Context

I'm trying to implement a passwordmanager frontend

Your Environment

Node 16 Ubuntu 22.04

ItsMisterP avatar May 14 '23 09:05 ItsMisterP

Sorry I can't help you with these issues @ItsMisterP, but I'm interested in following the conversation so I'm commenting here.

Also, if you're in the Dash Discord, please DM me. I need an Angular dev for one of our new Dash Incubator projects which we'll be discussing in this Monday's Incubator Weekly show (on YouTube).

riongull avatar May 14 '23 14:05 riongull

i changed import Dash from 'dash' to const Dash = require('dash') .

Errors are gone, but when i try to do something with sdk, i got the following error: core.mjs:10141 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'hi') TypeError: Cannot read properties of undefined (reading 'hi') at N (dash.min.js:2:873215) at M (dash.min.js:2:874300) at J (dash.min.js:2:875003) at F (dash.min.js:2:875252) at A.exports (dash.min.js:2:876036) at A.exports.digest (dash.min.js:2:824830) at i.x11 (dash.min.js:2:501712) at k._getHash (dash.min.js:2:483937) at A.get (dash.min.js:2:484024) at new o (dash.min.js:2:2507028) at resolvePromise (zone.js:1193:31) at resolvePromise (zone.js:1147:17) at zone.js:1260:17 at _ZoneDelegate.invokeTask (zone.js:402:31) at core.mjs:25803:55 at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:25803:36) at _ZoneDelegate.invokeTask (zone.js:401:60) at Object.onInvokeTask (core.mjs:26104:33) at _ZoneDelegate.invokeTask (zone.js:401:60) at Zone.runTask (zone.js:171:47)

ItsMisterP avatar May 14 '23 17:05 ItsMisterP

I don't think you can use require in the web browser environment. Can you share any code that is causing such errors?

pshenmic avatar May 14 '23 18:05 pshenmic

It seems not actual. Please reopen otherwise.

shumkov avatar Sep 23 '24 18:09 shumkov