-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c58fa89
commit 67d92b8
Showing
19,620 changed files
with
2,885,027 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build and Lint (frontend) | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: main | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 9 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'pnpm' | ||
- run: pnpm install --frozen-lockfile | ||
- run: pnpm frontend:build | ||
- run: pnpm frontend:lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build | ||
Move.lock | ||
Suibase.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"recommendations": [ | ||
// Backend | ||
"mysten.move", | ||
"damirka.move-syntax", | ||
"tamasfe.even-better-toml", | ||
|
||
// Frontend | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module zk_lokomotive::HelloWorld { | ||
use sui::tx_context::TxContext; | ||
|
||
public entry fun hello(ctx: &mut TxContext) { | ||
sui::debug::print("Hello, World!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Konstantin Komelin | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "zk-lokomotive" | ||
edition = "2024.beta" | ||
|
||
[dependencies] | ||
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/devnet" } | ||
|
||
[addresses] | ||
greeting = "0x0" | ||
|
||
[dev-dependencies] | ||
Local = { local = "../path/to/dev-build" } | ||
|
||
[dev-addresses] | ||
alice = "0xB0B" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Sui dApp Starter: Backend | ||
|
||
Please find the root project [README](../../README.md). |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"name": "backend", | ||
"private": true, | ||
"version": "0.0.0", | ||
"scripts": { | ||
"build": "lsui move build -d -p ./move/greeting", | ||
"test": "lsui move test -d -p ./move/greeting", | ||
"copy-package-id": "node ./scripts/copy-package-id", | ||
"localnet:start": "localnet start", | ||
"localnet:stop": "localnet stop", | ||
"localnet:status": "localnet status", | ||
"localnet:faucet": "localnet faucet", | ||
"localnet:regen": "localnet regen", | ||
"localnet:update": "localnet update", | ||
"localnet:address": "lsui client active-address", | ||
"localnet:deploy": "localnet publish --path ${PWD}/move/greeting && pnpm copy-package-id -n localnet", | ||
"localnet:explorer:start": "sui-explorer-local start", | ||
"localnet:explorer:stop": "sui-explorer-local stop", | ||
"localnet:explorer:restart": "sui-explorer-local restart", | ||
"localnet:explorer:rebuild": "sui-explorer-local rebuild", | ||
"devnet:start": "devnet start", | ||
"devnet:stop": "devnet stop", | ||
"devnet:status": "devnet status", | ||
"devnet:update": "devnet update", | ||
"devnet:links": "devnet links", | ||
"devnet:address": "dsui client active-address", | ||
"devnet:deploy": "devnet publish --path ${PWD}/move/greeting && pnpm copy-package-id -n devnet", | ||
"testnet:start": "testnet start", | ||
"testnet:stop": "testnet stop", | ||
"testnet:status": "testnet status", | ||
"testnet:update": "testnet update", | ||
"testnet:links": "testnet links", | ||
"testnet:address": "tsui client active-address", | ||
"testnet:deploy": "testnet publish --path ${PWD}/move/greeting && pnpm copy-package-id -n testnet", | ||
"mainnet:start": "mainnet start", | ||
"mainnet:stop": "mainnet stop", | ||
"mainnet:status": "mainnet status", | ||
"mainnet:update": "mainnet update", | ||
"mainnet:links": "mainnet links", | ||
"mainnet:address": "msui client active-address", | ||
"mainnet:deploy": "mainnet publish --path ${PWD}/move/greeting && pnpm copy-package-id -n mainnet" | ||
}, | ||
"devDependencies": { | ||
"env-file-rw": "^1.0.0", | ||
"sui-explorer-local": "^0.4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/usr/bin/env node | ||
|
||
/** | ||
* The script copies the deployed package ID from the corresponding Suibase network file to .env.local of the frontend package, | ||
* which is then read by the app. | ||
* | ||
* The default network is localnet. To change it, pass "-n [NETWORK_TYPE]" through console. | ||
*/ | ||
|
||
const { promises } = require("node:fs"); | ||
const { homedir } = require("node:os"); | ||
const path = require("node:path"); | ||
const EnvFileWriter = require("env-file-rw").default; | ||
|
||
const DEPLOYED_MODULE_NAME = "greeting"; | ||
|
||
const main = async () => { | ||
const network = getNetworkFromArgs(); | ||
const sourceFile = sourceFilePath(network, DEPLOYED_MODULE_NAME); | ||
const targetFile = targetFilePath(); | ||
|
||
// Read package ID from SuiBase packageId file. | ||
const packageId = await readPackageId(sourceFile); | ||
|
||
// Create .env.local file if it doesn't exist. | ||
await createFileIfNecessary(targetFile); | ||
|
||
// Add VITE_[network]_CONTRACT_PACKAGE_ID variable to .env.local or update its value if it exists. | ||
await setEnvVar( | ||
targetFile, | ||
`VITE_${network.toUpperCase()}_CONTRACT_PACKAGE_ID`, | ||
packageId | ||
); | ||
}; | ||
|
||
const sourceFilePath = (network, deployedModuleName) => { | ||
return path.join( | ||
homedir(), | ||
`/suibase/workdirs/${network}/published-data/${deployedModuleName}/most-recent/package-id.json` | ||
); | ||
}; | ||
|
||
const targetFilePath = () => { | ||
return path.join(process.cwd(), "../frontend/.env.local"); | ||
}; | ||
|
||
const getNetworkFromArgs = () => { | ||
const arg = process.argv.slice(2); | ||
|
||
switch (arg[0]) { | ||
case "-n": | ||
return arg[1]; | ||
|
||
default: | ||
return "localnet"; | ||
} | ||
}; | ||
|
||
/** | ||
* Read package ID from SuiBase packageId file. | ||
* | ||
* @param {string} sourceFile | ||
* @returns | ||
*/ | ||
const readPackageId = async (sourceFile) => { | ||
const data = await promises.readFile(sourceFile, "utf8"); | ||
return JSON.parse(data)[0]; | ||
}; | ||
|
||
/** | ||
* Create a file if it doesn't exist. | ||
* | ||
* @param {string} filePath | ||
* @returns | ||
*/ | ||
const createFileIfNecessary = async (filePath) => { | ||
try { | ||
await promises.writeFile(filePath, "", { flag: "wx" }); | ||
} catch {} | ||
}; | ||
|
||
/** | ||
* Set the environment variable in the .env.local file. | ||
* | ||
* @param {string} envFilePath | ||
* @param {string} name | ||
* @param {string} value | ||
* @returns | ||
*/ | ||
const setEnvVar = async (envFilePath, name, value) => { | ||
const envFileWriter = new EnvFileWriter(envFilePath, false); | ||
await envFileWriter.parse(); | ||
envFileWriter.set(name, value); | ||
await envFileWriter.save(); | ||
}; | ||
|
||
// Main entry point. | ||
main().catch((e) => { | ||
console.error(e); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: weekly | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
pnpm localnet:start | ||
pnpm localnet:deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
VITE_APP_NAME="Sui dApp Starter" | ||
VITE_APP_DESCRIPTION="Full-Stack Sui Starter on Steroids" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'prettier', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"projects": { | ||
"default": "sui-dapp-starter" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# Firebase | ||
.firebase/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
public | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @type {import("prettier").Config} */ | ||
const config = { | ||
trailingComma: 'es5', | ||
tabWidth: 2, | ||
useTabs: false, | ||
semi: false, | ||
singleQuote: true, | ||
tailwindConfig: './tailwind.config.mjs', | ||
plugins: ['prettier-plugin-tailwindcss'], | ||
tailwindFunctions: ['clsx', 'c', 'cn'], | ||
} | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Sui dApp Starter: Frontend | ||
|
||
Please find the root project [README](../../README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"hosting": { | ||
"predeploy": "pnpm build", | ||
"public": "dist", | ||
"ignore": [ | ||
"firebase.json", | ||
"**/.*", | ||
"**/node_modules/**" | ||
], | ||
"rewrites": [ | ||
{ | ||
"source": "**", | ||
"destination": "/index.html" | ||
} | ||
] | ||
}, | ||
"emulators": { | ||
"hosting": { | ||
"port": 5000 | ||
} | ||
} | ||
} |
Oops, something went wrong.