Coder Social home page Coder Social logo

scio-labs / inkathon Goto Github PK

View Code? Open in Web Editor NEW
212.0 212.0 42.0 5.5 MB

Full-Stack DApp Boilerplate for Substrate and ink! Smart Contracts

Home Page: https://inkathon.xyz/

License: GNU General Public License v3.0

Shell 4.60% JavaScript 2.36% TypeScript 87.37% Rust 3.25% CSS 2.42%
backend blockchain cargo contracts dapp frontend ink next nextjs openbrush polkadot polkadot-js rust rust-lang smart-contracts substrate substrate-node tailwind tailwindcss typescript

inkathon's People

Contributors

github-actions[bot] avatar ical10 avatar niklasp avatar peetzweg avatar wottpal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

inkathon's Issues

CLI for scaffolding project structure

Create a CLI tool that creates a full ready-to-use ink!athon monorepo app structure. With a command like npm create create-inkathon-app.

Potential options:

  • Package Name
  • Project Name
  • pnpm/yarn/npm (will have to check first which of those works nicely with the monorepo)
  • TS/JS (will keep it probably ts-only)
  • prettier/eslint/husky
  • Twin/Tailwind/Chakra
  • Default Chain
  • Install Rust/cargo (probably too error-prone)

See https://github.com/facebook/create-react-app & https://github.com/t3-oss/create-t3-app for inspiration.

General setup improvements

  • Move packages to root directory & Update scripts/imports
  • Auto-create .env.local upon install
  • ts-node script execution shorthand in contracts/package.json
  • Switch from husky to simple-git-hooks
  • Move contracts into dedicated contracts/src directory
  • Improve workspace settings
  • Add release workflow via changesets
  • Test yarn/npm/bun compatibility
  • Add contributor guidelines
  • Improve README

Question: how to configure tsconfig.json in my CRACO app

Hi,
I've got the following error in my craco app.

attempted import error: 'webcrypto' is not exported from 'crypto' (imported as 'nc').
ERROR in ./node_modules/useink/dist/chunk-CFOEQQMR.mjs 16721:66-78
export 'webcrypto' (imported as 'nc') was not found in 'crypto' (possible exports: Cipher, Cipheriv, Decipher, Decipheriv, DiffieHellman, DiffieHellmanGroup, Hash, Hmac, Sign, Verify, constants, createCipher, createCipheriv, createCredentials, createDecipher, createDecipheriv, createDiffieHellman, createDiffieHellmanGroup, createECDH, createHash, createHmac, createSign, createVerify, getCiphers, getDiffieHellman, getHashes, listCiphers, pbkdf2, pbkdf2Sync, privateDecrypt, privateEncrypt, prng, pseudoRandomBytes, publicDecrypt, publicEncrypt, randomBytes, randomFill, randomFillSync, rng)

My tsconfig.json

    "module": "ESNext",
    "moduleResolution": "Node",

I know that moduleResolution should be "nodenext" according to by your documentation. (For importing useink/chains

But this change breaks many imports of my app. So I can't configure like it is.

Is there any alternative way?

Thanks,

Deploy command line instruction don't work

When I follow the readme step configuration, the deploy script command don't exist ( and no reference in package.json )

# Deploy the contracts on the local node
pnpm run deploy

`#![feature]` may not be used on the stable release channel

on adding openbrush latest version which is suitable for latest ink 4.0.0 release doesn't work on inkathon greeter contract build with pnpm build and throws below error but on running with +nightly works fine. I have checked on freshly created ink project no issue there.

openbrush = { tag = "3.0.0", git = "https://github.com/727-Ventures/openbrush-contracts", default-features = false, features = [
    "psp22",
] }

Screenshot 2023-02-21 at 20 54 47

webpack and docker-compose up error for the frontend

` ERROR [frontend-prod builder 1/1] RUN NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build && pnpm --filter='*frontend' deploy pruned - 27.5s

[frontend-prod builder 1/1] RUN NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build && pnpm --filter='*frontend' deploy pruned --prod:
8.166
8.166 > @inkathon/[email protected] build /app/frontend
8.166 > NODE_ENV=production next build
8.166
9.318 Attention: Next.js now collects completely anonymous telemetry regarding usage.
9.318 This information is used to shape Next.js' roadmap and prioritize features.
9.318 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
9.318 https://nextjs.org/telemetry
9.318
9.865 ▲ Next.js 14.2.3
9.865 - Environments: .env.local
9.865
10.28 Creating an optimized production build ...
11.90
11.90 (process:37): VIPS-WARNING **: 20:02:53.317: threads clipped to 1024
23.87 Failed to compile.
23.87
23.87 ./src/app/page.tsx
23.87 Module not found: Can't resolve '@/app/components/home-page-title'
23.87
23.87 https://nextjs.org/docs/messages/module-not-found
23.87
23.87 ./src/app/page.tsx
23.87 Module not found: Can't resolve '@/components/web3/chain-info'
23.87
23.87 https://nextjs.org/docs/messages/module-not-found
23.87
23.87 ./src/app/page.tsx
23.87 Module not found: Can't resolve '@/components/web3/connect-button'
23.87
23.87 https://nextjs.org/docs/messages/module-not-found
23.87
23.87 ./src/app/page.tsx
23.87 Module not found: Can't resolve '@/components/web3/greeter-contract-interactions'
23.87
23.87 https://nextjs.org/docs/messages/module-not-found
23.87
23.87 ./src/app/providers.tsx
23.87 Module not found: Can't resolve '@/deployments/deployments'
23.87
23.87 https://nextjs.org/docs/messages/module-not-found
23.87
23.89
23.89 > Build failed because of webpack errors
23.90 /app/frontend:
23.90  ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @inkathon/[email protected] build: NODE_ENV=production next build
23.90 Exit status 1


failed to solve: process "/bin/sh -c NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build && pnpm --filter='*frontend' deploy pruned --prod" did not complete successfully: exit code: 1`

OS: Windows 11 with Ubuntu 20.04
Docker Desktop version Current version: 4.28.0 (139021)

Front-end prod app build will fail with Docker

Running docker compose command to build the production app
docker-compose -f ./docker-compose.frontend.yaml up

will show an error such as below:

 => ERROR [frontend-prod builder 1/1] RUN NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build  && pnpm --filter='*frontend' deploy pruned --prod                                                                                                        48.0s
------
 > [frontend-prod builder 1/1] RUN NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build  && pnpm --filter='*frontend' deploy pruned --prod:
0.550 
0.550 > @inkathon/[email protected] build /app/frontend
0.550 > NODE_ENV=production next build
0.550 
1.388 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.388 This information is used to shape Next.js' roadmap and prioritize features.
1.388 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.388 https://nextjs.org/telemetry
1.388 
1.446   ▲ Next.js 14.2.3
1.446   - Environments: .env.local
1.446 
1.509    Creating an optimized production build ...
29.38  ✓ Compiled successfully
29.38    Linting and checking validity of types ...
34.60    Collecting page data ...
35.44    Generating static pages (0/5) ...
35.91    Generating static pages (1/5) 
35.91    Generating static pages (2/5) 
35.91    Generating static pages (3/5) 
35.92  ✓ Generating static pages (5/5)
36.32    Finalizing page optimization ...
36.32    Collecting build traces ...
45.36 
45.37 Route (app)                              Size     First Load JS
45.37 ┌ ○ /                                    59.3 kB         562 kB
45.37 └ ○ /_not-found                          872 B          88.2 kB
45.37 + First Load JS shared by all            87.3 kB
45.37   ├ chunks/350-517ce4390b75eaef.js       31.5 kB
45.37   ├ chunks/8a6c70d3-b137850d6336eb59.js  53.6 kB
45.37   └ other shared chunks (total)          2.19 kB
45.37 
45.37 
45.37 ○  (Static)  prerendered as static content
45.37 
45.76  ERR_PNPM_DEPLOY_DIR_NOT_EMPTY  Deploy path /app/pruned is not empty
------
failed to solve: process "/bin/sh -c NEXT_BUILD_STANDALONE=true pnpm --filter='*frontend' build  && pnpm --filter='*frontend' deploy pruned --prod" did not complete successfully: exit code: 1

Since the path /app/pruned is not empty, we need to force remove it to avoid failure on subsequent runs (see pnpm/pnpm#7561).

Extend `deployment.ts` format

As of now the deployment.ts format is very basic

export const address = '5Ga8H7rtX66J3fn754cnTX1ZfCxZxwxzaZuqy5mfTRAfifQi'
export const blockNumber = 1

But this is not very future proof as this does not allow for the following things:

  • indicate which contract it belongs to, just indicated by file path,
  • does not give you information about which version of the contract it belongs to,
  • does not keep track of multiple deployemnts of the same contract.

A new format will have trade offs but I think solving the mentioned issues with this format will proof itself handy for longer lasting production dapps. Upgrades of contracts happen, same as multiple deployments of the same contract on a single chain.

We could get some inspiration from this plugin from hardhat or whatever foundry is doing right now. 🤔

https://github.com/wighawag/hardhat-deploy

https://github.com/wighawag/forge-deploy

Contract script improvements

Improve RPC selection logic in `PolkadotProvider`

Currently, the rpc selection is too simple. It just picks the first item in the rpcUrls array of PolkadotProviderChain (see https://github.com/scio-labs/inkathon/blob/main/packages/frontend/src/components/web3/PolkadotProvider.tsx#L64) and creates an creates an WsProvider object (which fails if the provided url is not a websocket).

  • It must be determined whether it's a wss/https rpc url (e.g. via regex) and create the according provider object
  • If an RPC connection fails multiple times it should try the next rpc (until the first one works). Otherwise, providing a full list of RPCs somehow makes no sense.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.