Skip to content

Commit

Permalink
Merge pull request #1 from v1xingyue/main
Browse files Browse the repository at this point in the history
一个基本的脚手架
  • Loading branch information
uvd authored Jun 29, 2023
2 parents f514b00 + 233e3b1 commit c7638b8
Show file tree
Hide file tree
Showing 30 changed files with 1,404 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"standard",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {
"no-debugger":"off",
"react/prop-types": "off",
"react/jsx-curly-brace-presence": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/self-closing-comp": [
"error",
{
"component": true,
"html": true
}
],
"react/jsx-boolean-value": "error",
"prefer-template": "error",
"jsx-quotes": ["error", "prefer-double"],
"react/jsx-tag-spacing": "error"
}
}
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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?

yarn.lock
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aptos-dapp-scaffold.movefuns.xyz
Binary file added docs/assets/favicon-2e5a0f62.ico
Binary file not shown.
26 changes: 26 additions & 0 deletions docs/assets/index-76421efa.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/index-774029a4.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;padding:1.5rem}
568 changes: 568 additions & 0 deletions docs/assets/index-79067bd9.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/assets/favicon-2e5a0f62.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aptos dapp scaffold</title>
<script type="module" crossorigin src="/assets/index-79067bd9.js"></script>
<link rel="stylesheet" href="/assets/index-774029a4.css">
</head>
<body>
<div id="root"></div>

</body>
</html>
1 change: 1 addition & 0 deletions docs/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added favicon.ico
Binary file not shown.
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>aptos dapp scaffold</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions move/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/*
.aptos/*
9 changes: 9 additions & 0 deletions move/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = 'playground'
version = '1.0.0'

[addresses]
playground = "_"

[dependencies.AptosFramework]
local = "../../aptos-core/aptos-move/framework/aptos-framework"
48 changes: 48 additions & 0 deletions move/sources/mycounter.move
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module playground::mycounter {

use std::signer;
use std::string;
use std::error;

const E_DATA_EXIST:u64 = 0;
const E_DATA_NOT_FOUND:u64 = 1;
const E_NOT_ALLOW:u64 = 2;

struct CounterHolder has key {
value: u64,
creator: address,
allow:address,
description: string::String
}

public fun allow_write(address:address,counter:&mut CounterHolder):bool {
counter.allow == address || counter.creator == address
}

public fun counter_exist(address:address):bool {
exists<CounterHolder>(address)
}

public entry fun make_counter(account:&signer,allow:address,value:u64,description:string::String) {
let creator = signer::address_of(account);
assert!(!counter_exist(creator), error::already_exists(E_DATA_EXIST));
move_to(account,CounterHolder{value,creator,allow,description});
}

public entry fun update_counter(account:&signer,holder:address,value:u64,description:string::String) acquires CounterHolder {
assert!(counter_exist(holder), error::already_exists(E_DATA_NOT_FOUND));
let current = signer::address_of(account);
let mut_counter = borrow_global_mut<CounterHolder>(holder);
assert!(allow_write(current,mut_counter), error::not_found(E_NOT_ALLOW));
mut_counter.value = value;
mut_counter.description = description;
}

public entry fun delete_counter(account:&signer) acquires CounterHolder {
let current = signer::address_of(account);
assert!(counter_exist(current), error::not_found(E_DATA_NOT_FOUND));
let counter = move_from<CounterHolder>(current);
let CounterHolder {value:_,creator:_,allow:_,description:_ } = counter;
}

}
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "aptos-dapp-scaffold",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"pub": "/bin/bash scripts/pub_page.sh"
},
"dependencies": {
"@aptos-labs/wallet-adapter-mui-design": "^1.0.0",
"@aptos-labs/wallet-adapter-react": "^1.2.1",
"@blocto/aptos-wallet-adapter-plugin": "^0.1.8",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@martianwallet/aptos-wallet-adapter": "^0.0.4",
"@mui/material": "^5.13.5",
"@nightlylabs/aptos-wallet-adapter-plugin": "^0.2.12",
"@openblockhq/aptos-wallet-adapter": "^0.1.5",
"@pontem/wallet-adapter-plugin": "^0.2.0",
"@rise-wallet/wallet-adapter": "^0.1.2",
"@tp-lab/aptos-wallet-adapter": "^1.0.1",
"@trustwallet/aptos-wallet-adapter": "^0.1.6",
"@welldone-studio/aptos-wallet-adapter": "^0.1.4",
"fewcha-plugin-wallet-adapter": "^0.1.2",
"msafe-plugin-wallet-adapter": "^0.1.0",
"petra-plugin-wallet-adapter": "^0.1.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@vitejs/plugin-react": "^4.0.0",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-tailwindcss": "^3.8.3",
"typescript": "^5.0.2",
"vite": "^4.3.9"
}
}
1 change: 1 addition & 0 deletions public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions scripts/pub_page.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

echo "build pages"
yarn build
echo "clean old pages"
rm -rf docs/index.html docs/assets/
echo "copy generated files"
cp -R dist/index.html dist/assets docs/
git add docs
now=$(date +%Y%m%d%H%m%S)
git commit -m "publish pages ${now} "
git push origin main
Loading

0 comments on commit c7638b8

Please sign in to comment.