Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cw-hpl #100

Merged
merged 10 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ insert_final_newline = true

[*.rs]
indent_size = 4

[*.ts]
indent_size = 2
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,15 @@ Cargo.lock
.idea/

**/*.profraw

# Script setup

config.yaml
config.*.yaml
!config.example.yaml

context/*.config.json

tmp/
dist/
node_modules/
37 changes: 37 additions & 0 deletions codegen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as fs from "fs";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there documentation as to how to use the codegen?

import codegen from "@cosmwasm/ts-codegen";
import path from "path";

const SCHEMA_DIR = process.env.SCHEMA_DIR || path.join(process.cwd(), "schema");

const capitalize = (str: string): string =>
str.charAt(0).toUpperCase() + str.slice(1);

const contracts = fs
.readdirSync(SCHEMA_DIR, { withFileTypes: true })
.filter((c) => !c.isDirectory())
.map((c) => ({
name: c.name.replace(".json", ""),
dir: SCHEMA_DIR,
}));

codegen({
contracts,
outPath: "./dist/",

// options are completely optional ;)
options: {
bundle: {
bundleFile: "index.ts",
scope: "contracts",
},
client: {
enabled: true,
},
messageComposer: {
enabled: true,
},
},
}).then(() => {
console.log("✨ all done!");
});
15 changes: 10 additions & 5 deletions scripts/package.json → package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "scripts",
"name": "@many-things/cw-hyperlane",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"upload": "ts-node src/index.ts",
"deploy": "ts-node action/deploy.ts",
"build": "npx tsc"
"clean": "rm -rf dist",
"build": "yarn clean && esbuild ./script --bundle --outfile=./dist/index.js --platform=node",
"start": "yarn build && node ./dist/index.js",
"dev": "tsx ./script"
},
"keywords": [],
"author": "",
Expand All @@ -21,13 +22,17 @@
"axios": "^1.6.7",
"colors": "^1.4.0",
"commander": "^11.1.0",
"decompress": "^4.2.1",
"inversify": "^6.0.1",
"readline": "^1.3.0",
"reflect-metadata": "^0.1.13"
},
"devDependencies": {
"@cosmwasm/ts-codegen": "^0.35.7",
"@types/decompress": "^4.2.7",
"@types/js-yaml": "^4.0.8",
"@types/node": "^20.4.4",
"@types/node": "^20.11.20",
"esbuild": "^0.20.1",
"ts-node": "^10.9.1",
"ts-yaml": "^1.0.0",
"tsx": "^3.13.0",
Expand Down
6 changes: 0 additions & 6 deletions scripts/.gitignore

This file was deleted.

85 changes: 0 additions & 85 deletions scripts/README.md

This file was deleted.

154 changes: 0 additions & 154 deletions scripts/action/deploy.ts

This file was deleted.

Loading