scale-it/algo-builder

Problems with algob

Lumene98 opened this issue · 9 comments

I was trying to use algob from outside my project and after linking it, I used to work on projects in the same environment of algob(my project was in a cloned algob) and now as I'm trying to use algob with

yarn link
yarn link @algo-builder/algob

I get these errors during the build of my project, I also tried to install the same algosdk version in my project but nothing changed


2 import { AssetDef } from "algosdk";
           ~~~~~~~~

../algo-builder/packages/runtime/build/interpreter/interpreter.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/lib/constants.d.ts:2:10 - error TS2614: Module '"algosdk"' has no exported member 'AssetDefEnc'. Did you mean to use 'import AssetDefEnc from "algosdk"' instead?

2 import { AssetDefEnc, StateSchemaEnc, TxnEncodedObj } from "algosdk";
           ~~~~~~~~~~~

../algo-builder/packages/runtime/build/lib/constants.d.ts:2:23 - error TS2614: Module '"algosdk"' has no exported member 'StateSchemaEnc'. Did you mean to use 'import StateSchemaEnc from "algosdk"' instead?

2 import { AssetDefEnc, StateSchemaEnc, TxnEncodedObj } from "algosdk";
                        ~~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/lib/constants.d.ts:2:39 - error TS2614: Module '"algosdk"' has no exported member 'TxnEncodedObj'. Did you mean to use 'import TxnEncodedObj from "algosdk"' instead?

2 import { AssetDefEnc, StateSchemaEnc, TxnEncodedObj } from "algosdk";
                                        ~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/lib/constants.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/types.d.ts:2:33 - error TS2614: Module '"algosdk"' has no exported member 'AssetDef'. Did you mean to use 'import AssetDef from "algosdk"' instead?

2 import { Account as AccountSDK, AssetDef, LogicSig, LogicSigArgs, SSCSchemaConfig, TxnEncodedObj } from "algosdk";
                                  ~~~~~~~~

../algo-builder/packages/runtime/build/types.d.ts:2:43 - error TS2614: Module '"algosdk"' has no exported member 'LogicSig'. Did you mean to use 'import LogicSig from "algosdk"' instead?

2 import { Account as AccountSDK, AssetDef, LogicSig, LogicSigArgs, SSCSchemaConfig, TxnEncodedObj } from "algosdk";
                                            ~~~~~~~~

../algo-builder/packages/runtime/build/types.d.ts:2:53 - error TS2614: Module '"algosdk"' has no exported member 'LogicSigArgs'. Did you mean to use 'import LogicSigArgs from "algosdk"' instead?

2 import { Account as AccountSDK, AssetDef, LogicSig, LogicSigArgs, SSCSchemaConfig, TxnEncodedObj } from "algosdk";
                                                      ~~~~~~~~~~~~

../algo-builder/packages/runtime/build/types.d.ts:2:67 - error TS2614: Module '"algosdk"' has no exported member 'SSCSchemaConfig'. Did you mean to use 'import SSCSchemaConfig from "algosdk"' instead?

2 import { Account as AccountSDK, AssetDef, LogicSig, LogicSigArgs, SSCSchemaConfig, TxnEncodedObj } from "algosdk";
                                                                    ~~~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/types.d.ts:2:84 - error TS2614: Module '"algosdk"' has no exported member 'TxnEncodedObj'. Did you mean to use 'import TxnEncodedObj from "algosdk"' instead?

2 import { Account as AccountSDK, AssetDef, LogicSig, LogicSigArgs, SSCSchemaConfig, TxnEncodedObj } from "algosdk";
                                                                                     ~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/types.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/account.d.ts:2:24 - error TS2614: Module '"algosdk"' has no exported member 'AssetDef'. Did you mean to use 'import AssetDef from "algosdk"' instead?

2 import type { Account, AssetDef, SSCSchemaConfig } from "algosdk";
                         ~~~~~~~~

../algo-builder/packages/runtime/build/account.d.ts:2:34 - error TS2614: Module '"algosdk"' has no exported member 'SSCSchemaConfig'. Did you mean to use 'import SSCSchemaConfig from "algosdk"' instead?

2 import type { Account, AssetDef, SSCSchemaConfig } from "algosdk";
                                   ~~~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/account.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/lib/asa.d.ts:2:15 - error TS2614: Module '"algosdk"' has no exported member 'AssetDef'. Did you mean to use 'import AssetDef from "algosdk"' instead?

2 import type { AssetDef } from "algosdk";
                ~~~~~~~~

../algo-builder/packages/runtime/build/lib/asa.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/lib/txn.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/logicsig.d.ts:3:10 - error TS2614: Module '"algosdk"' has no exported member 'LogicSigBase'. Did you mean to use 'import LogicSigBase from "algosdk"' instead?

3 import { LogicSigBase, MultiSig, MultisigMetadata } from "algosdk";
           ~~~~~~~~~~~~

../algo-builder/packages/runtime/build/logicsig.d.ts:3:24 - error TS2614: Module '"algosdk"' has no exported member 'MultiSig'. Did you mean to use 'import MultiSig from "algosdk"' instead?

3 import { LogicSigBase, MultiSig, MultisigMetadata } from "algosdk";
                         ~~~~~~~~

../algo-builder/packages/runtime/build/logicsig.d.ts:3:34 - error TS2614: Module '"algosdk"' has no exported member 'MultisigMetadata'. Did you mean to use 'import MultisigMetadata from "algosdk"' instead?

3 import { LogicSigBase, MultiSig, MultisigMetadata } from "algosdk";
                                   ~~~~~~~~~~~~~~~~

../algo-builder/packages/runtime/build/logicsig.d.ts:2:23 - error TS2688: Cannot find type definition file for 'types'.

2 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/runtime/build/runtime.d.ts:2:10 - error TS2614: Module '"algosdk"' has no exported member 'AssetDef'. Did you mean to use 'import AssetDef from "algosdk"' instead?

2 import { AssetDef } from "algosdk";
           ~~~~~~~~

../algo-builder/packages/runtime/build/runtime.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/types.d.ts:4:15 - error TS2614: Module '"algosdk"' has no exported member 'LogicSig'. Did you mean to use 'import LogicSig from "algosdk"' instead?

4 import type { LogicSig } from "algosdk";
                ~~~~~~~~

../algo-builder/packages/algob/build/types.d.ts:317:54 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/index"' has no exported member 'ConfirmedTxInfo'.

317     logTx: (message: string, txConfirmation: algosdk.ConfirmedTxInfo) => void;
                                                         ~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/types.d.ts:322:74 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/index"' has no exported member 'ConfirmedTxInfo'.

322     sendAndWait: (rawTxns: Uint8Array | Uint8Array[]) => Promise<algosdk.ConfirmedTxInfo>;
                                                                             ~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/types.d.ts:368:60 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/index"' has no exported member 'ConfirmedTxInfo'.

368     waitForConfirmation: (txId: string) => Promise<algosdk.ConfirmedTxInfo>;
                                                               ~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/types.d.ts:371:68 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/index"' has no exported member 'AssetInfo'.

371     getAssetByID: (assetIndex: number | bigint) => Promise<algosdk.AssetInfo>;
                                                                       ~~~~~~~~~

../algo-builder/packages/algob/build/types.d.ts:2:23 - error TS2688: Cannot find type definition file for 'types'.

2 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/account.d.ts:3:15 - error TS2614: Module '"algosdk"' has no exported member 'MultisigMetadata'. Did you mean to use 'import MultisigMetadata from "algosdk"' instead?

3 import { Kmd, MultisigMetadata } from "algosdk";
                ~~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/account.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/constants.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/lsig.d.ts:3:15 - error TS2614: Module '"algosdk"' has no exported member 'LogicSig'. Did you mean to use 'import LogicSig from "algosdk"' instead?

3 import type { LogicSig, MultisigMetadata } from "algosdk";
                ~~~~~~~~

../algo-builder/packages/algob/build/lib/lsig.d.ts:3:25 - error TS2614: Module '"algosdk"' has no exported member 'MultisigMetadata'. Did you mean to use 'import MultisigMetadata from "algosdk"' instead?

3 import type { LogicSig, MultisigMetadata } from "algosdk";
                          ~~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/lsig.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/msig.d.ts:2:24 - error TS2614: Module '"algosdk"' has no exported member 'LogicSig'. Did you mean to use 'import LogicSig from "algosdk"' instead?

2 import type { Account, LogicSig, MultiSig, TxSig } from "algosdk";
                         ~~~~~~~~

../algo-builder/packages/algob/build/lib/msig.d.ts:2:34 - error TS2614: Module '"algosdk"' has no exported member 'MultiSig'. Did you mean to use 'import MultiSig from "algosdk"' instead?

2 import type { Account, LogicSig, MultiSig, TxSig } from "algosdk";
                                   ~~~~~~~~

../algo-builder/packages/algob/build/lib/msig.d.ts:2:44 - error TS2614: Module '"algosdk"' has no exported member 'TxSig'. Did you mean to use 'import TxSig from "algosdk"' instead?

2 import type { Account, LogicSig, MultiSig, TxSig } from "algosdk";
                                             ~~~~~

../algo-builder/packages/algob/build/lib/msig.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/status.d.ts:2:15 - error TS2614: Module '"algosdk"' has no exported member 'AssetHolding'. Did you mean to use 'import AssetHolding from "algosdk"' instead?

2 import type { AssetHolding, SSCStateSchema } from "algosdk";
                ~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/status.d.ts:2:29 - error TS2614: Module '"algosdk"' has no exported member 'SSCStateSchema'. Did you mean to use 'import SSCStateSchema from "algosdk"' instead?

2 import type { AssetHolding, SSCStateSchema } from "algosdk";
                              ~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/status.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

../algo-builder/packages/algob/build/lib/tx.d.ts:38:134 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/src/main"' has no exported member 'ConfirmedTxInfo'.

38 export declare function executeTransaction(deployer: Deployer, execParams: rtypes.ExecParams | rtypes.ExecParams[]): Promise<algosdk.ConfirmedTxInfo>;
                                                                                                                                        ~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/tx.d.ts:47:105 - error TS2694: Namespace '"/home/lumene/algo-builder/node_modules/algosdk/dist/types/src/main"' has no exported member 'ConfirmedTxInfo'.

47 export declare function executeSignedTxnFromFile(deployer: Deployer, fileName: string): Promise<algosdk.ConfirmedTxInfo>;
                                                                                                           ~~~~~~~~~~~~~~~

../algo-builder/packages/algob/build/lib/tx.d.ts:1:23 - error TS2688: Cannot find type definition file for 'types'.

1 /// <reference types="types" />
                        ~~~~~

@Lumene98 which version are you using?

algob --version

@Lumene98 which version are you using?

algob --version

I created a script that fetches last version

#!/bin/bash
BASEDIR=$(dirname "$0")
cd ~
rm -rf algo-builder
git clone https://github.com/scale-it/algo-builder.git
cd algo-builder
if [ "$1" == "--cleanlink" ]; then
    rm -rf ~/.config/yarn/link/@algo-builder
fi
yarn
yarn build
cd packages/algob
yarn link
cd ../runtime
yarn link
cd ../types-algosdk
yarn link
cd $BASEDIR
yarn link "@algo-builder/algob"
yarn link "@algo-builder/runtime"
yarn link "@algo-builder/types-algosdk"

ok, so you are on the lastes master (btw we updated master on Wednesday). We will try to replicate.

@Lumene98 i am not able to build the project after following your script. However, if i link only algob, it works.

could you please try the same without linking runtime & types-algosdk? i.e change your script to:

BASEDIR=$(dirname "$0")
cd ~
rm -rf algo-builder
git clone https://github.com/scale-it/algo-builder.git
cd algo-builder
if [ "$1" == "--cleanlink" ]; then
    rm -rf ~/.config/yarn/link/@algo-builder
fi
yarn
yarn build
cd packages/algob
yarn link
cd $BASEDIR
yarn link "@algo-builder/algob"

NOTE: you will need to unlink everything first. OR simply remove ~/.config/yarn/link like you're doing in script.

BASEDIR=$(dirname "$0")
cd ~
rm -rf algo-builder
git clone https://github.com/scale-it/algo-builder.git
cd algo-builder
if [ "$1" == "--cleanlink" ]; then
    rm -rf ~/.config/yarn/link/@algo-builder
fi
yarn
yarn build
cd packages/algob
yarn link
cd $BASEDIR
yarn link "@algo-builder/algob"

@ratik21 I tried doing it this way but I get more errors from the import of @algo-builder/runtime

@Lumene98 as we were discussing, the issue was we didn't add a "typeRoots": ["node_modules/@algo-builder/types-algosdk"] in our tsconfig.json.
BDW, we will soon be migrating from types-algosdk to js-sdk's own typing, so won't need to add this then.

BTW, we shouldn't do:

rm -rf ~/.config/yarn/link/@algo-builder

we should use yarn unlink

BTW, we shouldn't do:

rm -rf ~/.config/yarn/link/@algo-builder

we should use yarn unlink

I'm pretty sure yarn unlink should be called both on the algo-builder dir and on the project one

I just had a chat with @ratik21 - the problem is in your tsconfig.js @Lumene98 , you need to make sure that "node_modules/@algo-builder/types-algosdk" is in your typeRoots`, eg:

"typeRoots": ["node_modules/@algo-builder/types-algosdk"]