Skip to content

Commit

Permalink
D contracts (#7)
Browse files Browse the repository at this point in the history
* Init contracts project

* Only one contracts repository

* Init new contracts

* Copy draft nft contracts

* Move NFT functionality to the traits

* Fix build errors

* Restructure contracts, becuase upward import doesn't work

tact-lang/tact#73

* Update node and fix lock file

* Build contracts before test

* Lint and test in single job

* Temporary hide tests

* Add build script

* Leave only one test

* Implement accounting trait

* Implement royalty extention

* Extraxt logic from transfer reciever

* Move get functions to the top

* Add custom function to get individual content for NFT item.

* Add getNftCollectionContent function to
NftCollection trait

* Refactor accounting functions to use more
descriptive names

* Add virtual function to calculate NFT item initial
balance.

* Add requireEnoughTonForMinting function to
NftCollection trait

* Fix semicolon in calculateNftItemInitalBalance()
function

* Refactor DSocialNetworkAccount and NftCollection
to use owner instead of owner_address

* Master contract draft

* Fix build errors

* Handle NFT custom internal content

* Handle account initialization

* Fix account registration

* Group NFT messages

* Try to store metadata on chain

* Use emptyMap() for map initialization

* Test accounts registration

* Create tests specifically for the account

* Change account parameters

* Create post

* Deploy test post to test how it looks like on getgems

* Add master contract address to account info

* Update social links to be stored as a JSON string

* Update metadata arrays to use empty cells instead
of JSON strings

* Refactor metadata arrays to use empty cells

* Store metadata in JSON string

* Don't convert metadata to cell

* Reuse similar messages

* v0.0.1-metadata-as-struct-no-convertation-to-cell

* v0.0.1-metadata-as-cells

* v0.0.1-no-maps-in-metadata

* Test parser for onchain metadata

* Correctly serialize metadata with native functions

* Correctly serialize dict fields

* Serialize nft content in collection

* Serialize nft collection metadata

* Prevent NFT serialiozation from other collections

* Add index validation in serializeNftContent
function

* Return standard metadata in 1 cell

* Update version and remove content_url

* Init d entities models

* Serialize post metadata to description

* Rework tests

* Refactor serialization of individual content in
NftItem trait

* Refactor serializeIndividualContent function to
remove unnecessary map initialization

* Comment test affected by library

ton-org/ton-core#16

* Resolve BitBuilder overflow issue

ton-org/ton-core#16

* Slightly refactor test

* Refactor DPost content field to contentMd

* Init d.d0rich.me

* Move models to frontend

* lintfix

* Refactor ignore-build.mjs files

* Add build task for d.d0rich.me

* Patch contracts wrappers imports

* Add eslint-disable to new-imports.ts

* Update DPostModel import in test-fixtures.ts

* Rename account to blog

* Update function name to get_blog_info()

* Refactor blog initialization to use blog metadata

* Add static covers images

* Add manifest file and update favicon.ico

* Fix sending amount calculation in contracts

* Fix initialization and editing of blog and post
metadata

* Include additional fees for actions

* Add StorageController trait to contracts

* Update version to v1
  • Loading branch information
d0rich committed Nov 22, 2023
1 parent 70dde39 commit a39ee41
Show file tree
Hide file tree
Showing 97 changed files with 11,359 additions and 521 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.tact]
indent_size = 4

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
trim_trailing_whitespace = false
25 changes: 0 additions & 25 deletions .github/workflows/lint.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 16.x
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x

- name: Install Dependencies
run: npm ci
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Use Node.js 16
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20

- name: Installing packages
run: npm ci

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Tests
run: npx turbo run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ yarn-error.log*

# vercel
.vercel

# build output
build
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ node_modules
.output
.env
dist
*.md
build
*.md
12 changes: 11 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,15 @@
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"endOfLine": "auto"
"endOfLine": "auto",
"overrides": [
{
"files": "*.tact",
"options": {
"parser": "typescript",
"semi": true,
"singleQuote": false
}
}
]
}
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"vue.volar",
"nuxt.mdc",
"bradlc.vscode-tailwindcss",
"antfu.iconify"
"antfu.iconify",
"tonwhales.func-vscode",
"ton-community.tact-vscode"
]
}
28 changes: 28 additions & 0 deletions apps/d.d0rich.me/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
46 changes: 46 additions & 0 deletions apps/d.d0rich.me/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# d.d0rich.me

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.

If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:

1. Disable the built-in TypeScript Extension
1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```

### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
npm run test:unit
```
1 change: 1 addition & 0 deletions apps/d.d0rich.me/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
3 changes: 3 additions & 0 deletions apps/d.d0rich.me/ignore-build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { ignoreDD0richMeBuild } from '../../ignore-builds-master.mjs'

process.exit(ignoreDD0richMeBuild ? 0 : 1)
14 changes: 14 additions & 0 deletions apps/d.d0rich.me/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="manifest" href="/app.webmanifest" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
33 changes: 33 additions & 0 deletions apps/d.d0rich.me/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "d.d0rich.me",
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"test:unit": "vitest",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false"
},
"dependencies": {
"@d0rich/contracts": "*",
"pinia": "^2.1.7",
"vue": "^3.3.4",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
"@types/jsdom": "^21.1.3",
"@types/node": "^18.18.5",
"@vitejs/plugin-vue": "^4.4.0",
"@vue/test-utils": "^2.4.1",
"@vue/tsconfig": "^0.4.0",
"jsdom": "^22.1.0",
"npm-run-all2": "^6.1.1",
"typescript": "~5.2.0",
"vite": "^4.4.11",
"vitest": "^0.34.6",
"vue-tsc": "^1.8.19"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions apps/d.d0rich.me/public/app.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "D",
"short_name": "D",
"description": "Blogs on TON Blockchain",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Binary file added apps/d.d0rich.me/public/apple-touch-icon.png
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 apps/d.d0rich.me/public/favicon-16x16.png
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 apps/d.d0rich.me/public/favicon-32x32.png
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 apps/d.d0rich.me/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions apps/d.d0rich.me/public/favicon.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 apps/d.d0rich.me/public/metadata/covers/blog.jpg
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 apps/d.d0rich.me/public/metadata/covers/post.jpg
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 apps/d.d0rich.me/public/og/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions apps/d.d0rich.me/src/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<script setup lang="ts">
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
</script>

<template>
<header>
<img
alt="Vue logo"
class="logo"
src="@/assets/logo.svg"
width="125"
height="125"
/>

<div class="wrapper">
<HelloWorld msg="You did it!" />

<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav>
</div>
</header>

<RouterView />
</template>

<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
Loading

0 comments on commit a39ee41

Please sign in to comment.