Closed BraCR10 closed 22 hours ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
create-soroban-dapp | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 2, 2024 9:48pm |
create-soroban-dapp-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 2, 2024 9:48pm |
May you include all the modifications?? and add a section on README to run the TS tests? I tried to replicate what you told but It didn't work for me.
Also, use Yarn please
Of course, I already add the changes, I will explain how I do the test on my local machine step by step.
First I rename the .env.example(Path:soroban-react-dapp/contracts/.env.example) to . env and make the following changes:
# Star Accounts Secret Keys
ADMIN_SECRET_KEY= -Note: Here use a private key that I obtained by following the instructions on this page https:///developers.stellar.org/docs/smart-contracts/getting-started/setup-contract
# RPC configuration
MAINNET_RPC_URL=https://horizon-testnet.stellar.org
2. I added the dependencies of chai and mocha as devDependencies in the last changes, so in theory once inside the repository you should only do the following:
cd soroban-react-dapp/contracts/ yarn
3-Once dependencies are installed, I compile TS files as JS files
`yarn run build`
4-Finally, I search and run the compiled test using mocha
cd dist/greeting/ mocha greeting.test.js
Following those steps the test works, I stay attentive to any news, thank you
Nice ! it worked
Excellent, thanks #19
-The test worked on the horizon testnet https://horizon-testnet.stellar.org/
-A .mocharc.json was proposed, It provide some necessary adjustments so that mocha can run the test.
-Added in the tsconfig the "include" section the test file to be compiled
-I didn’t include mocha and chai dependencies as developer dependencies in the file package.json(create-soroban-dapp/soroban-react-dapp/contracts), however I could easily do, I remain attentive,for now they must be installed manually command: npm i -D chai mocha @types/mocha @types/chai
-The test needs to have the file. env(soroban-react-dapp/contracts/.env) configured with RPC: https://horizon-testnet.stellar.org and private key: https:///developers.stellar.org/docs/smart-contracts/getting-started/setup
-I would like to mention that it is also necessary to install the dependencies of the package.json located in create-soroban-dapp/soroban-react-dapp/contracts. command: npm i
I had some problems using the env_config.js(soroban-react-dapp/contracts/dist/utils/env_config.js) file, the function only accepted the parameter "testnet", otherwise it presented an error.
In order to continue doing the test, I had to change in my local machine line #3 of the tx.js file. I replaced <process.argv[2]> with <"testnet">. I also did it in the contract.js file in line #9. Finally, when I used the function in the contract.js file, it displayed another error in line #44 related to the call to the <addressBook.getWasmHash(wasmKey)> function, to avoid the error instead of passing as a parameter I used the string <"greeting"> , I consider that this getter receives as parameter the name of the contract not a wasmhash.
In conclusion, to make the test in my local machine, I made the configuration described in the details, also I had to change the value of the constant in the tx.js and contract.js files by <"testnet"> and finally change the parameter in line #44 of the file contract.js by <"greeting">