Skip to content

Commit

Permalink
Fix: prettify and lint (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mfigueira authored Jun 14, 2023
1 parent 9b7e81d commit 401826e
Show file tree
Hide file tree
Showing 50 changed files with 1,068 additions and 354 deletions.
59 changes: 0 additions & 59 deletions .eslintrc.base.js

This file was deleted.

63 changes: 53 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,63 @@
const path = require("path");

const OFF = 0;
const WARN = 1;
const ERROR = 2;

/**
* @type {import("eslint").Linter.Config}
*/
module.exports = {
extends: [".eslintrc.base.js"],
parser: "@typescript-eslint/parser",
plugins: [
"@typescript-eslint",
"simple-import-sort",
"prettier",
"unused-imports",
],
extends: ["prettier"],
env: {
es6: true,
node: true,
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
"import/resolver": {
typescript: {
project: path.join(__dirname, "tsconfig.json"),
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
},
},
},
overrides: [
{
files: ["**/*"],
rules: {
"@next/next/no-img-element": "off",
parserOptions: {
project: [
path.join(__dirname, "tsconfig.json"),
path.join(__dirname, "tsconfig.eslint.json"),
],
},
rules: {
"no-process-env": OFF,
"no-underscore-dangle": OFF,
"@typescript-eslint/ban-ts-comment": WARN,
"prettier/prettier": [
ERROR,
{
endOfLine: "auto",
},
},
],
],
"import/prefer-default-export": OFF,
"simple-import-sort/imports": ERROR,
"simple-import-sort/exports": ERROR,
"no-console": ["error", { allow: ["error"] }],
"import/extensions": OFF,
"@typescript-eslint/naming-convention": [
ERROR,
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"],
leadingUnderscore: "allow",
},
],
},
};
2 changes: 1 addition & 1 deletion docs/about/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"label": "About ZetaChain",
"collapsed": false,
"position": 2
}
}
4 changes: 2 additions & 2 deletions docs/developers/_category_.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"label": "Developers",
"collapsed": false,
"position": 3,
}
"position": 3
}
2 changes: 1 addition & 1 deletion docs/developers/concepts/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Concepts",
"position": 3
}
}
22 changes: 18 additions & 4 deletions docs/developers/concepts/zrc-20.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,24 @@ import { ethers } from "hardhat";
import { ZRC20Addresses, TSS_ATHENS2 } from "../systemConstants";
import { network } from "hardhat";
// Helper function to format data for sending a swap transaction
const getSwapData = (zetaSwap: string, destination: string, destinationToken: string, minOutput: BigNumber) => {
const getSwapData = (
zetaSwap: string,
destination: string,
destinationToken: string,
minOutput: BigNumber
) => {
const params = getSwapParams(destination, destinationToken, minOutput);
return zetaSwap + params.slice(2);
};
// Primary function definition
const main = async () => {
if (!isNetworkName(network.name) || !network.name) throw new Error("Invalid network name");
if (!isNetworkName(network.name) || !network.name)
throw new Error("Invalid network name");
// Here you're choosing the target token you want the swap to output based on the network
const destinationToken = network.name == "goerli" ? ZRC20Addresses["tMATIC"] : ZRC20Addresses["gETH"];
const destinationToken =
network.name == "goerli"
? ZRC20Addresses["tMATIC"]
: ZRC20Addresses["gETH"];
console.log("Swapping native token...");
// Get a signer to write your transaction
const [signer] = await ethers.getSigners();
Expand All @@ -163,7 +172,12 @@ const main = async () => {
zetaNetwork: "athens",
});
// Use formatting function to get the correct data format
const data = getSwapData(zetaSwap, signer.address, destinationToken, BigNumber.from("0"));
const data = getSwapData(
zetaSwap,
signer.address,
destinationToken,
BigNumber.from("0")
);
// Sign your transaction with Swap data.
const tx = await signer.sendTransaction({
data,
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/tutorials/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"label": "Tutorials",
"collapsed": false,
"position": 2
}
}
2 changes: 1 addition & 1 deletion docs/developers/tutorials/examples/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Examples",
"position": 99
}
}
2 changes: 1 addition & 1 deletion docs/reference/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"label": "Reference",
"position": 5,
"collapsed": false
}
}
2 changes: 1 addition & 1 deletion docs/validators/_category_.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"label": "Validators",
"collapsed": true,
"position": 4
}
}
15 changes: 7 additions & 8 deletions docs/validators/validator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ This guide assumes your have already created and synced up your node using the [
This guide is design for simplicity and does not cover the intricacies of secure
key management. We recommend you follow best practices when it comes to secure
key generation and key management. We are unable to offer support outside of the
basic setup of a ZetaChain validator.
basic setup of a ZetaChain validator.

### Create a Validator Account

Create the account `operator`.
Create the account `operator`.

Make sure to store the mnemonic from the output in a safe place. You will need this information to later access your account.

Expand All @@ -35,7 +35,7 @@ zetacored query bank balances $(zetacored keys show operator -a)

Add funds to your validator account.

Send tokens from your own wallet or from an exchange to your validators address.
Send tokens from your own wallet or from an exchange to your validators address.
Make sure you are sending them using the zetachain cosmos based network, not the zEVM network.

Check your validator account funds `balances`.
Expand All @@ -46,7 +46,7 @@ zetacored query bank balances $(zetacored keys show operator -a)

### Create Your Validator

Create a new validator by staking ***azeta*** tokens. Here is an example of
Create a new validator by staking **_azeta_** tokens. Here is an example of
creating a validator on Zetachain Testnet. Save the transaction hash
from the output.

Expand Down Expand Up @@ -97,10 +97,9 @@ status of your validator.
zetacored query staking validator $(zetacored keys show operator --bech operator -a)
```

It's possible that you don’t have enough ***azeta*** tokens to be part of the
active set of validators in the beginning. If the status is unbonded `status:
BOND_STATUS_UNBONDED`, you didn’t stake enough tokens `amount` when you created
your validator.
It's possible that you don’t have enough **_azeta_** tokens to be part of the
active set of validators in the beginning. If the status is unbonded `status: BOND_STATUS_UNBONDED`,
you didn’t stake enough tokens `amount` when you created your validator.

In this case, your validator is not in the active set. It cannot sign blocks and
it does not earn rewards. It can however, receive delegations.
Expand Down
Loading

0 comments on commit 401826e

Please sign in to comment.