Skip to content

Commit 6368c41

Browse files
committed
Initial setup with pausing-unpausing command
1 parent 5eee8ec commit 6368c41

19 files changed

Lines changed: 8177 additions & 0 deletions

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
**/*/node_modules
6+
/.pnp
7+
.pnp.*
8+
9+
# testing
10+
/coverage
11+
12+
# production
13+
/build
14+
/dist-cjs
15+
16+
# misc
17+
.DS_Store
18+
.env
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
.env
29+
.vscode
30+
.history
31+
32+
# IDE
33+
.idea/
34+
35+
.yarn/*
36+
!.yarn/patches
37+
!.yarn/plugins
38+
!.yarn/releases
39+
!.yarn/sdks
40+
!.yarn/versions

.yarn/releases/yarn-3.6.1.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
compressionLevel: 0
2+
3+
enableGlobalCache: true
4+
5+
nmMode: hardlinks-local
6+
7+
nodeLinker: node-modules
8+
9+
yarnPath: .yarn/releases/yarn-3.6.1.cjs

eslintrc.cjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require("@rushstack/eslint-patch/modern-module-resolution");
2+
3+
module.exports = {
4+
root: true,
5+
extends: "@chainsafe",
6+
}

package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@buildwithsygma/sygma-sdk",
3+
"description": "Sygma Maintenance",
4+
"main": "index.js",
5+
"private": true,
6+
"type": "commonjs",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/sygmaprotocol/maintenance-utils"
10+
},
11+
"packageManager": "yarn@3.6.1",
12+
"engines": {
13+
"node": ">=16.0.0"
14+
},
15+
"scripts": {
16+
"build:cjs": "tsc -p tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./dist-cjs/package.json",
17+
"build:types": "tsc -p tsconfig.types.json",
18+
"build:all": "yarn build:cjs && yarn build:types",
19+
"lint": "eslint 'src/**/*.ts'",
20+
"lint:fix": "yarn run lint --fix",
21+
"clean": "rm -rf ./dist ./dist-cjs ./dist-esm ./types"
22+
},
23+
"keywords": [],
24+
"author": "Sygma Protocol Product Team",
25+
"license": "LGPL-3.0-or-later",
26+
"dependencies": {
27+
"axios": "^1.4.0",
28+
"commander": "^11.0.0",
29+
"ethers": "^6.6.2"
30+
},
31+
"devDependencies": {
32+
"@buildwithsygma/sygma-sdk-core": "^2.1.0",
33+
"typescript": "^5.1.6"
34+
},
35+
"resolutions": {
36+
"typescript": "^5.0.4"
37+
}
38+
}

prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"useTabs": false,
6+
"arrowParens": "avoid"
7+
}

src/bridgePausing.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import axios from 'axios';
2+
import {Command, Option} from 'commander';
3+
import {ConfigUrl} from "./constants";
4+
import {RawConfig} from "@buildwithsygma/sygma-sdk-core";
5+
6+
const program = new Command();
7+
console.log("pero");
8+
9+
program
10+
.name("pause-bridge")
11+
.description("Pauses all bridge instances across all networks")
12+
.argument("<string>", "mnemonic or private key of the wallet")
13+
.addOption(
14+
new Option('--environment, -e', 'Environment on which to pause bridge instances')
15+
.choices(['devnet', 'testnet', 'mainnet'])
16+
)
17+
.action(async (mnemonic: string, environment: keyof typeof ConfigUrl) => {
18+
try {
19+
console.log("pero");
20+
const response = await axios.get(ConfigUrl[environment]) as unknown as RawConfig;
21+
console.log(response)
22+
} catch (err) {
23+
if (err instanceof Error) {
24+
throw new Error(`Failed to fetch shared config because of: ${err.message}`);
25+
} else {
26+
throw new Error('Something went wrong while fetching config file');
27+
}
28+
}
29+
})

src/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const ConfigUrl = {
2+
devnet: "https://chainbridge-assets-stage.s3.us-east-2.amazonaws.com/shared-config-dev.json",
3+
testnet: "https://chainbridge-assets-stage.s3.us-east-2.amazonaws.com/shared-config-test.json",
4+
mainnet: "https://sygma-assets-mainnet.s3.us-east-2.amazonaws.com/shared-config-mainnet.json"
5+
}

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "bridgePausing"

tsconfig.cjs.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"exclude": [
3+
"src/**/__test__/**",
4+
"test/**",
5+
],
6+
"extends": "./tsconfig.json",
7+
"compilerOptions": {
8+
"declaration": true,
9+
"esModuleInterop": true,
10+
"module": "commonjs",
11+
"outDir": "./dis-cjs"
12+
}
13+
}

0 commit comments

Comments
 (0)