-
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
0 parents
commit 7032ca7
Showing
25 changed files
with
8,815 additions
and
0 deletions.
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,8 @@ | ||
# Changesets | ||
|
||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works | ||
with multi-package repos, or single-package repos to help you version and publish your code. You can | ||
find the full documentation for it [in our repository](https://github.com/changesets/changesets) | ||
|
||
We have a quick list of common questions to get you started engaging with this project in | ||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.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,11 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": "@changesets/cli/changelog", | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [], | ||
"baseBranch": "main" | ||
} |
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,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['./config/eslint.js'], | ||
}; |
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,39 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup pnpm 8 | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
|
||
- name: Setup Node.js 18.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: Install Dependencies | ||
run: pnpm i | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
# This expects you to have a script called release which does a build for your packages and calls changeset publish | ||
publish: pnpm release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
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 @@ | ||
.DS_Store | ||
node_modules | ||
.turbo | ||
*.log | ||
.next | ||
dist | ||
dist-ssr | ||
*.local | ||
.env | ||
.cache | ||
server/dist | ||
public/dist | ||
.turbo |
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 @@ | ||
auto-install-peers = 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,6 @@ | ||
{ | ||
"tabWidth": 4, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "lf" | ||
} |
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 @@ | ||
{ | ||
"eslint.workingDirectories": [ | ||
{ | ||
"mode": "auto" | ||
} | ||
] | ||
} |
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,73 @@ | ||
# Turborepo Design System starter with Changesets | ||
|
||
This is an official React design system starter powered by Turborepo. Versioning and package publishing is handled by [Changesets](https://github.com/changesets/changesets) and fully automated with GitHub Actions. | ||
|
||
## Using this example | ||
|
||
Run the following command: | ||
|
||
```sh | ||
npx create-turbo@latest -e with-changesets | ||
``` | ||
|
||
## What's inside? | ||
|
||
This Turborepo includes the following: | ||
|
||
### Apps and Packages | ||
|
||
- `docs`: A placeholder documentation site powered by [Next.js](https://nextjs.org/) | ||
- `@acme/core`: core React components | ||
- `@acme/utils`: shared React utilities | ||
- `@acme/tsconfig`: shared `tsconfig.json`s used throughout the monorepo | ||
- `@acme/eslint-config`: ESLint preset | ||
|
||
Each package and app is 100% [TypeScript](https://www.typescriptlang.org/). | ||
|
||
### Utilities | ||
|
||
This Turborepo has some additional tools already setup for you: | ||
|
||
- [TypeScript](https://www.typescriptlang.org/) for static type checking | ||
- [ESLint](https://eslint.org/) for code linting | ||
- [Prettier](https://prettier.io) for code formatting | ||
|
||
### Useful commands | ||
|
||
- `yarn build` - Build all packages and the docs site | ||
- `yarn dev` - Develop all packages and the docs site | ||
- `yarn lint` - Lint all packages | ||
- `yarn changeset` - Generate a changeset | ||
- `yarn clean` - Clean up all `node_modules` and `dist` folders (runs each package's clean script) | ||
|
||
### Changing the npm organization scope | ||
|
||
The npm organization scope for this design system starter is `@acme`. To change this, it's a bit manual at the moment, but you'll need to do the following: | ||
|
||
- Rename folders in `packages/*` to replace `acme` with your desired scope | ||
- Search and replace `acme` with your desired scope | ||
- Re-run `yarn install` | ||
|
||
## Versioning and Publishing packages | ||
|
||
Package publishing has been configured using [Changesets](https://github.com/changesets/changesets). Please review their [documentation](https://github.com/changesets/changesets#documentation) to familiarize yourself with the workflow. | ||
|
||
This example comes with automated npm releases setup in a [GitHub Action](https://github.com/changesets/action). To get this working, you will need to create an `NPM_TOKEN` and `GITHUB_TOKEN` in your repository settings. You should also install the [Changesets bot](https://github.com/apps/changeset-bot) on your GitHub repository as well. | ||
|
||
For more information about this automation, refer to the official [changesets documentation](https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md) | ||
|
||
### npm | ||
|
||
If you want to publish package to the public npm registry and make them publicly available, this is already setup. | ||
|
||
To publish packages to a private npm organization scope, **remove** the following from each of the `package.json`'s | ||
|
||
```diff | ||
- "publishConfig": { | ||
- "access": "public" | ||
- }, | ||
``` | ||
|
||
### GitHub Package Registry | ||
|
||
See [Working with the npm registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#publishing-a-package-using-publishconfig-in-the-packagejson-file) |
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,34 @@ | ||
const { resolve } = require('node:path'); | ||
|
||
const project = resolve(process.cwd(), 'tsconfig.json'); | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: ['eslint:recommended', 'prettier', 'eslint-config-turbo'], | ||
plugins: ['only-warn'], | ||
globals: { | ||
React: true, | ||
JSX: true, | ||
}, | ||
env: { | ||
node: true, | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
typescript: { | ||
project, | ||
}, | ||
}, | ||
}, | ||
ignorePatterns: [ | ||
// Ignore dotfiles | ||
'.*.js', | ||
'node_modules/', | ||
'dist/', | ||
], | ||
overrides: [ | ||
{ | ||
files: ['*.js?(x)', '*.ts?(x)'], | ||
}, | ||
], | ||
}; |
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,23 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"build": "turbo build", | ||
"dev": "turbo dev", | ||
"lint": "turbo lint", | ||
"clean": "turbo clean && rm -rf node_modules", | ||
"format": "prettier --write \"**/*.{ts,tsx,md}\"", | ||
"changeset": "changeset", | ||
"version-packages": "changeset version", | ||
"release": "turbo build && changeset publish" | ||
}, | ||
"devDependencies": { | ||
"@changesets/cli": "^2.26.2", | ||
"eslint": "^8.54.0", | ||
"prettier": "^2.8.8", | ||
"turbo": "latest" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"node": ">=18" | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"tabWidth": 4, | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "lf" | ||
} |
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) 2023 Vedant Chainani | ||
|
||
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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,45 @@ | ||
{ | ||
"name": "atomic-toolkit", | ||
"version": "0.0.0", | ||
"description": "Toolkit for creating Atomic Assets on Arweave using Warp Contracts", | ||
"private": false, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"dist/**" | ||
], | ||
"scripts": { | ||
"dev": "vitest", | ||
"test": "vitest run", | ||
"build": "tsup src/index.ts --format cjs,esm --dts", | ||
"lint": "tsc", | ||
"ci": "pnpm run lint && pnpm run test && pnpm run build", | ||
"release": "pnpm run lint && pnpm run test && pnpm run build && changeset publish" | ||
}, | ||
"keywords": [ | ||
"arweave", | ||
"atomic", | ||
"assets", | ||
"warp", | ||
"contracts" | ||
], | ||
"author": "Vedant Chainani", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@changesets/cli": "^2.27.1", | ||
"@irys/sdk": "^0.1.1", | ||
"@types/node": "^18.19.3", | ||
"arbundles": "^0.10.0", | ||
"dotenv": "^16.3.1", | ||
"ethers": "v5", | ||
"tsup": "^8.0.1", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.0.4", | ||
"warp-contracts": "^1.4.26", | ||
"warp-contracts-plugin-deploy": "^1.0.12" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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,83 @@ | ||
import { Tag } from 'arbundles'; | ||
|
||
const ATOMIC_TOKEN_SRC = 'Of9pi--Gj7hCTawhgxOwbuWnFI1h24TTgO5pw8ENJNQ'; | ||
|
||
const getAtomicAssetTags = (tags?: Tag[]): Tag[] => { | ||
const baseTags: Tag[] = [ | ||
// Contract Identifiers | ||
{ name: 'App-Name', value: 'SmartWeaveContract' }, | ||
{ name: 'App-Version', value: '0.3.0' }, | ||
{ name: 'Contract-Src', value: ATOMIC_TOKEN_SRC }, | ||
{ | ||
name: 'Contract-Manifest', | ||
value: '{"evaluationOptions":{"sourceType":"redstone-sequencer","allowBigInt":true,"internalWrites":true,"unsafeClient":"skip","useConstructor":true}}', | ||
}, | ||
{ name: 'Indexed-By', value: 'ucm' }, | ||
// License | ||
{ name: 'License', value: 'udlicense' }, | ||
]; | ||
|
||
const requiredTags = baseTags.map((tag) => tag.name); | ||
const tagNames = tags?.map((tag) => tag.name); | ||
|
||
tagNames?.forEach((t) => { | ||
if (requiredTags.includes(t)) { | ||
const index = requiredTags.indexOf(t); | ||
baseTags[index] = tags?.find((tag) => tag.name === t) as Tag; | ||
} else { | ||
baseTags.push(tags?.find((tag) => tag.name === t) as Tag); | ||
} | ||
}); | ||
|
||
return baseTags; | ||
}; | ||
|
||
const checkAssetDiscoverabilityTags = (tags: Tag[]) => { | ||
const requiredTags = ['Type', 'Title', 'Description']; | ||
const tagNames = tags.map((tag) => tag.name); | ||
const missingTags = requiredTags.filter((tag) => !tagNames.includes(tag)); | ||
if (missingTags.length > 0) { | ||
throw new Error( | ||
`Missing required tags: ${missingTags.join(', ')} in tags array`, | ||
); | ||
} | ||
}; | ||
|
||
const checkInitStateTag = (tags: Tag[]) => { | ||
const initStateTag = tags.find((tag) => tag.name === 'Init-State'); | ||
if (!initStateTag) { | ||
throw new Error('Init-State tag not found'); | ||
} | ||
try { | ||
const parsed = JSON.parse(initStateTag.value); | ||
if ( | ||
!parsed.ticker || | ||
!parsed.name || | ||
!parsed.balances || | ||
!parsed.claimable | ||
) { | ||
throw new Error('Init-State tag value is not valid'); | ||
} | ||
} catch (e) { | ||
throw new Error('Init-State tag value is not valid JSON'); | ||
} | ||
}; | ||
|
||
const checkAndAddContentTypeTag = (file: File, tags: Tag[]): Tag[] => { | ||
const t = tags; | ||
const tagNames = t.map((tag) => tag.name); | ||
if (!tagNames.includes('Content-Type')) { | ||
const contentType = file.type; | ||
if (contentType) { | ||
t.push({ name: 'Content-Type', value: contentType }); | ||
} | ||
} | ||
return t; | ||
}; | ||
|
||
export { | ||
getAtomicAssetTags, | ||
checkAssetDiscoverabilityTags, | ||
checkAndAddContentTypeTag, | ||
checkInitStateTag, | ||
}; |
Oops, something went wrong.