Skip to content

Commit

Permalink
reorg script / cli
Browse files Browse the repository at this point in the history
  • Loading branch information
byeongsu-hong committed Feb 25, 2024
1 parent dbd3293 commit d6e4cbb
Show file tree
Hide file tree
Showing 73 changed files with 7,143 additions and 2,582 deletions.
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ Cargo.lock
.idea/

**/*.profraw

# Script setup

config.yaml

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";
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!");
});
132 changes: 132 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
networks:
- id: "localosmosis"
hrp: "osmo"
url: "http://localhost:26657"
gas:
price: "0.025"
denom: "uosmo"
domain: 1304

- id: "localneutron"
hrp: "neutron"
url: "http://localhost:26657"
gas:
price: "0.025"
denom: "untrn"
domain: 1302

signer: deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef

deploy:
ism:
# # hpl_ism_multisig with default validator setup (signer = validator, threshold = 1)
# - 5
# - 420
# - 421613

# # hpl_ism_multisig
# type: multisig
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# validators:
# 5:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1
# 420:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1
# 421613:
# addrs:
# - 2F47b319809A58bBBFa8e706171762eFBF168A62
# threshold: 1

# # hpl_test_mock_ism
# type: "mock"

# # hpl_ism_aggregate
# type: "aggregate"
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# isms:
# - type: "mock"
# - type: "multisig"
# ...

# # hpl_ism_routing
# type: "routing"
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# isms:
# 5:
# type: "mock"
# 420:
# type: "multisig"
# ...
# 421613:
# type: "aggregate"
# ...

hooks:
default:
# same as required field.
required:
# # hpl_test_mock_hook
# type: "mock"

# # hpl_hook_fee
# type: "fee"
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# fee:
# denom: uosmo
# amount: 1

# # hpl_hook_merkle
# type: "merkle"

# # hpl_hook_pausable
# type: "pausable"
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# paused: false

# # hpl_igp + hpl_igp_oracle
# type: "igp"
# token: "uosmo" # or default to gas token (in this case, uosmo will be set)
# configs:
# 5:
# exchange_rate: 1.0
# gas_price: 40000
# 420:
# exchange_rate: 1.4
# gas_price: 10322
# ...

# # hpl_hook_aggregate
# type: aggregate
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# hooks:
# - type: merkle
# - type: pausable
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# paused: false
# - type: fee
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# fee:
# denom: uosmo
# amount: 1

# # hpl_hook_routing / hpl_hook_routing_custom / hpl_hook_routing_fallback
# type: "routing"
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# hooks:
# 5:
# type: fee
# owner: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# fee:
# denom: uosmo
# amount: 1
# 420:
# type: "mock"
# custom_hooks: # optional
# 5:
# recipient: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# hook: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6
# fallback_hook: osmo1g3q542hpttdrj9aaczsq0tkl0uyfk7nkydklz6 # optional
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contracts": {
"artifacts": {
"hpl_hook_merkle": {
"codeId": 131,
"digest": "0fa54766b2e8cb3e87ef076fbe0d50e09a21c23b0ab5671b1d2c548571bd2728"
Expand Down Expand Up @@ -94,4 +94,4 @@
}
},
"address": "dual1dwnrgwsf5c9vqjxsax04pdm0mx007yrraj2dgn"
}
}
4 changes: 2 additions & 2 deletions scripts/context/neutron-1.json → context/neutron-1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"contracts": {
"artifacts": {
"hpl_hook_aggregate": {
"codeId": 405,
"digest": "910a823bb524dbbaed9952f484cb242ea837e50b5f7c458c1bf52d16c7de21fb"
Expand Down Expand Up @@ -70,4 +70,4 @@
}
},
"address": "neutron1dwnrgwsf5c9vqjxsax04pdm0mx007yrre4yyvm"
}
}
70 changes: 70 additions & 0 deletions context/osmo-test-5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"artifacts": {
"hpl_mailbox": 7058,
"hpl_validator_announce": 7059,
"hpl_ism_aggregate": 7060,
"hpl_ism_multisig": 7061,
"hpl_ism_pausable": 7062,
"hpl_ism_routing": 7063,
"hpl_igp": 7064,
"hpl_hook_aggregate": 7065,
"hpl_hook_fee": 7066,
"hpl_hook_merkle": 7067,
"hpl_hook_pausable": 7068,
"hpl_hook_routing": 7069,
"hpl_hook_routing_custom": 7070,
"hpl_hook_routing_fallback": 7071,
"hpl_test_mock_hook": 7072,
"hpl_test_mock_ism": 7073,
"hpl_test_mock_msg_receiver": 7074,
"hpl_igp_oracle": 7075,
"hpl_warp_cw20": 7076,
"hpl_warp_native": 7077
},
"deployments": {
"core": {
"mailbox": {
"type": "hpl_mailbox",
"address": "osmo1d6h26wx7sdzlxseanukm75v0rphj52pn20ge5tp52eatr7s02f8qxmpd5k"
},
"validator_announce": {
"type": "hpl_validator_announce",
"address": "osmo18r9myflwtr9tjqqvphus0508a2zf9xl2n3a30gq3jm644xwnyl2qxch6n6"
}
},
"isms": {
"type": "hpl_ism_multisig",
"address": "osmo1v6x3qn3wfwcmy3c3pwy9n8xfep4hy3w9dlrfzwqcxsf62k04clqqu93l8h"
},
"hooks": {
"default": {
"type": "hpl_test_mock_hook",
"address": "osmo13gm7yu86en9vgqwudj6eex2u04jaw9cx4yg4xgdjf92850hattms6keska"
},
"required": {
"type": "hpl_hook_aggregate",
"address": "osmo1wfxxzq3kuz3lpcdf0820szghteff3a60wfmuh6097376jgdn50ls7km4cl",
"hooks": [
{
"type": "hpl_hook_merkle",
"address": "osmo1md8ua6jgr5qu38gmzf4z4vntvk7d9ma800phc05sek7vcdztl9usfqyg0m"
},
{
"type": "hpl_hook_pausable",
"address": "osmo1yrtl6lqwjck0vvkl9ke8vcwu8hzpquaxtfsswfsrwled470k4euqkskprl"
},
{
"type": "hpl_hook_fee",
"address": "osmo1yd0kc7zzc8gcqy9kewmj63ygt289mh3rhcr8dkjtk5w74nn7g6gqm90wye"
}
]
}
},
"test": {
"msg_receiver": {
"type": "hpl_test_mock_msg_receiver",
"address": "osmo1rrrv7vqy9almwr8nnad7kxr8j8gzvuxrhdun0cas96cpp0ftnl3swh5v9d"
}
}
}
}
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@many-things/cw-hyperlane",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"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": "",
"license": "ISC",
"dependencies": {
"@cosmjs/cosmwasm-stargate": "^0.32.2",
"@cosmjs/crypto": "^0.32.2",
"@cosmjs/encoding": "^0.32.2",
"@cosmjs/proto-signing": "^0.32.2",
"@cosmjs/stargate": "^0.32.2",
"@cosmjs/tendermint-rpc": "^0.32.2",
"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.11.20",
"esbuild": "^0.20.1",
"ts-node": "^10.9.1",
"ts-yaml": "^1.0.0",
"tsx": "^3.13.0",
"typescript": "^5.1.6"
}
}
Loading

0 comments on commit d6e4cbb

Please sign in to comment.