Skip to content

Commit

Permalink
implements dns example with full inkathon template
Browse files Browse the repository at this point in the history
  • Loading branch information
peetzweg committed Jan 5, 2024
1 parent ddee220 commit a575d4f
Show file tree
Hide file tree
Showing 81 changed files with 12,352 additions and 0 deletions.
45 changes: 45 additions & 0 deletions dns/example/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing Guidelines

[Scio Labs](https://scio.xyz) actively welcomes contributions from anyone to make this a community-driven effort. There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests, or writing code.

Our ink! developer tooling initiative is made up of the following projects:

- `create-ink-app` CLI (_Coming soon_)
- [`ink!athon`](https://github.com/scio-labs/inkathon) Boilerplate
- [`useInkathon`](https://github.com/scio-labs/use-inkathon) Hooks & Utility Library
- [`zink!`](https://github.com/scio-labs/zink) Smart Contract Macros

_To ensure a smooth and efficient collaboration, please follow the guidelines below._

## Issues

- Before starting work, please check the existing issues for your planned feature or bug fix.
- If there isn't an existing issue, create one. This allows us to avoid duplicate work and discuss the implementation details upfront.
- If you want to work on an issue, please comment on it to let us know. This helps us keep track of who is working on what.

## Pull Requests

- All changes should be made through pull requests (PRs).
- Please ensure your PR is linked to the relevant issue.
- Include a clear and detailed description of the changes in your PR.
- Request a review once your PR is ready.

## Code Style

- Please follow the existing coding style.
- Make sure your changes pass the lint checks.

> [!IMPORTANT]
>
> - Please install all recommended VSCode extensions (see `.vscode/extensions.json`).
> - After installing dependencies, enable the `pre-commit` hook in your local repository via `pnpm simple-git-hooks`.
> - Make sure to always use the `inkathon.code-workspace` file when working on the project in VSCode.
## Communication

- Be respectful and considerate in all interactions.
- If you have questions or need help, don't hesitate to ask.
- For code, feature, or bug discussions, please use the relevant GitHub issue or PR.
- To chat with us or ask questions, join our [Telegram Group](https://t.me/inkathon). 💬

Thanks for your contributions! 🙏
674 changes: 674 additions & 0 deletions dns/example/LICENSE

Large diffs are not rendered by default.

327 changes: 327 additions & 0 deletions dns/example/README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dns/example/contracts/.env.development.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACCOUNT_URI=//Alice
6 changes: 6 additions & 0 deletions dns/example/contracts/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
deployments
target
src
dist
.node-data
16 changes: 16 additions & 0 deletions dns/example/contracts/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-empty-function": "warn",
"no-extra-boolean-cast": "off",
"prefer-const": "warn"
}
}
134 changes: 134 additions & 0 deletions dns/example/contracts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
### Rust ###

# Ignore build artifacts from the local tests sub-crate.
target/
debug/

# Ignore backup files creates by cargo fmt.
**/*.rs.bk

# Remove Cargo.lock when creating an executable, leave it for libraries
# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

### Editors ###

# JetBrains
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

### Custom ###

# misc
.DS_Store
*.pem

# Substrate Contracts Node Persistence Cache
.node-data

# Local deployments
deployments/**/development.json
deployments/**/development.ts

# Environment files
*.env*
!.env*.example
4 changes: 4 additions & 0 deletions dns/example/contracts/.lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts}": ["pnpm run lint:fix"],
"*.{json,md,mdx,html,css,yml,yaml}": ["pnpm run lint:format"]
}
6 changes: 6 additions & 0 deletions dns/example/contracts/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
deployments
target
src
dist
.node-data
87 changes: 87 additions & 0 deletions dns/example/contracts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# @inkathon/contracts

## 0.4.2

### Patch Changes

- [`cf68f5f`](https://github.com/scio-labs/inkathon/commit/cf68f5f96888c69434014ff4f8eccdd3558d20bc) Thanks [@wottpal](https://github.com/wottpal)! - Further simplify contract scripts by moving required explicit types to `use-inkathon`. Also changing the module resolution setting in `tsconfig.json` to import directly from sub-paths like `@scio-labs/use-inkathon/types` which makes the scripts in a context like Next.js app-dir API routes.

- [`bc7d7ed`](https://github.com/scio-labs/inkathon/commit/bc7d7ed546fc2f17b6adaf96e34645f84ac2a5e0) Thanks [@wottpal](https://github.com/wottpal)! - Move VSCode settings to `settings.json` file but keep `inkathon.code-workspace`. It's now also supported by default to develop with ink!athon without opening the code-workspace file.

## 0.4.1

### Patch Changes

- [`14e8e11`](https://github.com/scio-labs/inkathon/commit/14e8e11ebc857e81b7cfa97e7c3c7f28d8dbccc3) Thanks [@wottpal](https://github.com/wottpal)! - Add sample code snippets from live workshops (greeter message reversion & make-it-rain script)

## 0.4.0

### Minor Changes

- [#42](https://github.com/scio-labs/inkathon/pull/42) [`0533391`](https://github.com/scio-labs/inkathon/commit/0533391ac6f9b953ba0cb231af8b3037e80bcbab) Thanks [@ical10](https://github.com/ical10)! - Update project default to Node 20.

## 0.3.2

### Patch Changes

- [#39](https://github.com/scio-labs/inkathon/pull/39) [`47aed1b`](https://github.com/scio-labs/inkathon/commit/47aed1b722138bd6fca2883337151d3c0b77e4a3) Thanks [@ical10](https://github.com/ical10)! - Deploy contracts & add deployment addresses for Rococo Contracts test-network.

## 0.3.1

### Patch Changes

- [`e73d9b8`](https://github.com/scio-labs/inkathon/commit/e73d9b86a4299702c59538ac43612b9977d479be) Thanks [@wottpal](https://github.com/wottpal)! - Replace `ts-node` with `tsx` (https://github.com/privatenumber/tsx) for less-verbose TypeScript script execution.

## 0.3.0

### Minor Changes

- [`cda19ae`](https://github.com/scio-labs/inkathon/commit/cda19aeb4107c076daeb17a455fecfbd7f373044) Thanks [@wottpal](https://github.com/wottpal)! - Vastly reduce boilerplate for JS/TS script initialization of Polkadot.js. You no longer need to read and parse dotenv environment variables in every script.

## 0.2.1

### Patch Changes

- [`3f4179e`](https://github.com/scio-labs/inkathon/commit/3f4179e9325b155324d23796234d9f853ae03dd9) Thanks [@wottpal](https://github.com/wottpal)! - Add workaround to run ESM-enabled ts-node scripts with Node.js 20. Related: https://github.com/TypeStrong/ts-node/issues/1997

## 0.2.0

### Minor Changes

- [`c2cfbe4`](https://github.com/scio-labs/inkathon/commit/c2cfbe428a4e86f7ddb3d25886d4da79238b69be) Thanks [@wottpal](https://github.com/wottpal)! - Ensure & document Windows, Ubuntu, and macOS compatibility. 🌈

## 0.1.3

### Patch Changes

- [`4bda28d`](https://github.com/scio-labs/inkathon/commit/4bda28d645abc8d8684d33bac788f04c278d7b4e) Thanks [@wottpal](https://github.com/wottpal)! - Further cross-platform script improvements (i.e. regarding the touch command).

## 0.1.2

### Patch Changes

- [`2b9bc68`](https://github.com/scio-labs/inkathon/commit/2b9bc689876ea195a1cf2f6af1ca2414bcf04172) Thanks [@wottpal](https://github.com/wottpal)! - Make cp/copy command work cross-platform (i.e. on Windows) for postinstall and build-all scripts.

## 0.1.0

### Minor Changes

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`cf04f67`](https://github.com/scio-labs/inkathon/commit/cf04f671c06276ffc51e33c1e38c181173227d75) Thanks [@wottpal](https://github.com/wottpal)! - Add `contract/scripts/script.template.ts` template script and simplify script initialization in general.

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Move `frontend` and `contracts` packages to the root level

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Auto-detect available contracts in build & test shell scripts

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`7a41afe`](https://github.com/scio-labs/inkathon/commit/7a41afe1e7c2f45b6d3972760c173a4a2197c643) Thanks [@wottpal](https://github.com/wottpal)! - Add contributor guidelines at `CONTRIBUTING.md`.

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Add pnpm/npm shorthand script for JS/TS script execution (i.e. `pnpm run script deploy`)

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`3598618`](https://github.com/scio-labs/inkathon/commit/3598618f87d788ec51964167557210ed8b659797) Thanks [@wottpal](https://github.com/wottpal)! - Major README.md overhaul & improvements

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Switch from `husky` to `simple-git-hooks` pre-commit hooks

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`07d8381`](https://github.com/scio-labs/inkathon/commit/07d83819c48f4aaa129ccc3d27929767b916c93d) Thanks [@wottpal](https://github.com/wottpal)! - Add compatability for using yarn (stable only, not classic v1) as the package manager. Note: npm is still not compatible as it lacks support for the workspace import protocol.

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Move ink! contract files under `contracts/src/`

- [#30](https://github.com/scio-labs/inkathon/pull/30) [`1839164`](https://github.com/scio-labs/inkathon/commit/183916440fb3043d06c1fd603aba923eb21a5964) Thanks [@wottpal](https://github.com/wottpal)! - Setup changeset integration for version, release, and changelog management.
4 changes: 4 additions & 0 deletions dns/example/contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[workspace]

resolver = "1"
members = ["src/*"]
25 changes: 25 additions & 0 deletions dns/example/contracts/build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -eu

# ENVIRONMENT VARIABLES
CONTRACTS_DIR="${CONTRACTS_DIR:=./src}" # Base contract directory
DIR="${DIR:=./deployments}" # Output directory for build files

# Copy command helper (cross-platform)
CP_CMD=$(command -v cp &> /dev/null && echo "cp" || echo "copy")

# Determine all contracts under `$CONTRACTS_DIR`
contracts=($(find $CONTRACTS_DIR -maxdepth 1 -type d -exec test -f {}/Cargo.toml \; -print | xargs -n 1 basename))

# Build all contracts
for i in "${contracts[@]}"
do
echo -e "\nBuilding '$CONTRACTS_DIR/$i/Cargo.toml'…"
cargo contract build --release --quiet --manifest-path $CONTRACTS_DIR/$i/Cargo.toml

echo "Copying build files to '$DIR/$i/'…"
mkdir -p $DIR/$i
$CP_CMD ./target/ink/$i/$i.contract $DIR/$i/
$CP_CMD ./target/ink/$i/$i.wasm $DIR/$i/
$CP_CMD ./target/ink/$i/$i.json $DIR/$i/
done
1 change: 1 addition & 0 deletions dns/example/contracts/deployments/dns/dns.contract

Large diffs are not rendered by default.

Loading

0 comments on commit a575d4f

Please sign in to comment.