bnb-chain / greenfield-js-sdk

JS SDK for Greenfield
https://docs.bnbchain.org/greenfield-js-sdk/
GNU General Public License v3.0
26 stars 16 forks source link

unable to run demo #17

Closed Azleal closed 1 year ago

Azleal commented 1 year ago

SDK version: alpha

Environment:

What happened: try to run demo as steps shown in README.md, however, pnpm run build in root dir doesn't work. and after executing npm run dev:qa, there are some errors image

What you expected to happen: expect it runs successfully

Have you tried the latest version: yes

How to reproduce it (as minimally and precisely as possible):

NEXT_PUBLIC_GREENFIELD_RPC_URL=https://gnfd-testnet-ethapi-us.bnbchain.org NEXT_PUBLIC_GREEN_CHAIN_ID=5600

BSC End POINT

NEXT_PUBLIC_BSC_RPC_URL=https://gnfd-bsc-testnet-dataseed1.bnbchain.org NEXT_PUBLIC_BSC_CHAIN_ID=5601

NEXT_PUBLIC_TOKEN_HUB_CONTRACT_ADDRESS=0x10C6E9530F1C1AF873a391030a1D9E8ed0630D26 NEXT_PUBLIC_CROSS_CHAIN_CONTRACT_ADDRESS=0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883

- run `npm run dev:qa`, and visit `http://localhost:3000/wallet`, error display as below
![image](https://user-images.githubusercontent.com/7901126/236400840-161c188c-55d6-4592-a2bd-09e94303fbe5.png)

**Logs (paste a small part showing an error (< 10 lines) or link a pastebin, gist, etc. containing more of the log file)**:

wallet > alpha: npm run dev:qa

@demo/wallet@0.0.2-alpha.0 dev:qa cross-env NODE_ENV=test next dev

ready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Loaded env from /Users/Azleal-Mac/Documents/workstation/github-workspace/greenfield-js-sdk/examples/wallet/.env.test.local event - compiled client and server successfully in 580 ms (396 modules) wait - compiling /_error (client and server)... wait - compiling /wallet (client and server)... error - ./src/client/index.ts:2:0 Module not found: Can't resolve '@bnb-chain/greenfield-chain-sdk' 1 | import { GRPC_URL } from '@/config';

2 | import { makeRpcClient } from '@bnb-chain/greenfield-chain-sdk'; 3 | import Long from 'long'; 4 | import { QueryClientImpl as spQueryClientImpl } from '@bnb-chain/greenfield-cosmos-types/greenfield/sp/query'; 5 | import { QueryClientImpl as storageQueryClientImpl } from '@bnb-chain/greenfield-cosmos-types/greenfield/storage/query';

Import trace for requested module: ./src/components/object/info/index.tsx ./src/components/object/index.tsx ./src/pages/wallet.tsx

https://nextjs.org/docs/messages/module-not-found


**Config (you can paste only the changes you've made)**:
`.env.test.local`

TESTNET

NEXT_PUBLIC_GRPC_URL=https://gnfd-testnet-fullnode-tendermint-us.bnbchain.org

NEXT_PUBLIC_GREENFIELD_RPC_URL=https://gnfd-testnet-ethapi-us.bnbchain.org NEXT_PUBLIC_GREEN_CHAIN_ID=5600

BSC End POINT

NEXT_PUBLIC_BSC_RPC_URL=https://gnfd-bsc-testnet-dataseed1.bnbchain.org NEXT_PUBLIC_BSC_CHAIN_ID=5601

NEXT_PUBLIC_TOKEN_HUB_CONTRACT_ADDRESS=0x10C6E9530F1C1AF873a391030a1D9E8ed0630D26 NEXT_PUBLIC_CROSS_CHAIN_CONTRACT_ADDRESS=0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883



**node command runtime flags**: none

**Anything else we need to know**: none
rrr523 commented 1 year ago

Sorry for replying so late. Docs had updated.