diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 996df00..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1,27 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - node: true, - jasmine: true, - }, - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - ], - rules: { - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/no-namespace': 'off', - 'no-inner-declarations': 'off', - '@typescript-eslint/no-use-before-define': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/ban-ts-ignore': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/ban-types': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - }, -}; diff --git a/.husky/pre-commit b/.husky/pre-commit index d37daa0..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx --no-install lint-staged +npx lint-staged diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..7fc2542 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,39 @@ +// @ts-check + +import eslint from '@eslint/js' +import tseslint from 'typescript-eslint' +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.stylistic, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + parserOptions: { + project: './tsconfig.json', + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/require-await': 'off', + } + }, + { + files: ['**/*.js'], + ...tseslint.configs.disableTypeChecked, + }, + eslintPluginPrettierRecommended, + { + ignores: ['dist/**/*', 'integration-tests/**/*', '**/*.config.js', '**/*.config.mjs', '**/*.spec.ts'], + }, +) diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 914e01e..0000000 --- a/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - testEnvironment: 'node', - preset: 'ts-jest', - roots: ['/src'], -}; diff --git a/jest.config.mjs b/jest.config.mjs new file mode 100644 index 0000000..ef57c39 --- /dev/null +++ b/jest.config.mjs @@ -0,0 +1,6 @@ +/** @type {import('jest').Config} */ +const config = { + verbose: true, +} + +export default config diff --git a/package-lock.json b/package-lock.json index 3929171..67f9cc7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "@initia/initia.js", "version": "0.2.9", - "license": "MIT", + "license": "Apache-2.0", "dependencies": { "@initia/initia.proto": "^0.2.1", "@initia/opinit.proto": "^0.0.8", @@ -29,37 +29,44 @@ "ws": "^7.5.9" }, "devDependencies": { + "@eslint/js": "^9.5.0", "@initia/builder.js": "^0.1.6", "@types/bn.js": "^5.1.1", + "@types/eslint": "^8.56.10", + "@types/eslint__js": "^8.42.3", "@types/jest": "^29.0.3", "@types/node": "^18.7.18", "@types/ripemd160": "^2.0.0", "@types/secp256k1": "^4.0.6", + "@types/semver": "^7.5.8", "@types/tmp": "^0.2.3", "@types/ws": "^7.4.7", - "@typescript-eslint/eslint-plugin": "^6.9.1", - "@typescript-eslint/parser": "^6.9.1", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", - "eslint": "^8.23.1", - "husky": "^6.0.0", - "jest": "^29.0.3", - "lint-staged": "^13.0.3", - "prettier": "^2.7.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.1.3", + "husky": "^9.0.11", + "jest": "^29.1.1", + "lint-staged": "^13.3.0", + "prettier": "^3.1.1", "process": "^0.11.10", "stream-browserify": "^3.0.0", - "ts-jest": "^29.0.1", + "ts-jest": "^29.1.1", "ts-loader": "^9.4.1", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "tsconfig-paths-webpack-plugin": "^4.0.0", - "typedoc": "^0.25.2", - "typescript": "^5.1.6", + "typescript": "^5.4.5", + "typescript-eslint": "^7.13.1", "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.6.1", "webpack-cli": "^4.10.0" }, "engines": { - "node": ">=14" + "node": ">=20" } }, "node_modules/@ampproject/remapping": { @@ -802,15 +809,15 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", - "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", - "globals": "^13.15.0", + "espree": "^9.6.0", + "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", @@ -824,14 +831,24 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/js": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.6.0.tgz", + "integrity": "sha512-D9B0/3vNg44ZeWbYMpBoXqNP4j6eQD5vNwIlGAuFRRzK/WtT/jvDQW3Bi9kkf3PMDMlM7Yi+73VLUsn5bJcl8A==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.7", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz", - "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==", + "version": "0.11.14", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", + "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", "minimatch": "^3.0.5" }, "engines": { @@ -852,9 +869,10 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true }, "node_modules/@improbable-eng/grpc-web": { @@ -1486,6 +1504,18 @@ "node": ">= 8" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@polka/url": { "version": "1.0.0-next.21", "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.21.tgz", @@ -1645,15 +1675,24 @@ } }, "node_modules/@types/eslint": { - "version": "8.4.10", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", - "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", + "version": "8.56.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz", + "integrity": "sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ==", "dev": true, "dependencies": { "@types/estree": "*", "@types/json-schema": "*" } }, + "node_modules/@types/eslint__js": { + "version": "8.42.3", + "resolved": "https://registry.npmjs.org/@types/eslint__js/-/eslint__js-8.42.3.tgz", + "integrity": "sha512-alfG737uhmPdnvkrLdZLcEKJ/B8s9Y4hrZ+YAdzUeoArBlSUERA2E87ROfOaS4jd/C45fzOoZzidLc1IPwLqOw==", + "dev": true, + "dependencies": { + "@types/eslint": "*" + } + }, "node_modules/@types/eslint-scope": { "version": "3.7.4", "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", @@ -1719,6 +1758,12 @@ "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, "node_modules/@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", @@ -1749,9 +1794,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, "node_modules/@types/stack-utils": { @@ -1791,33 +1836,31 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz", - "integrity": "sha512-w0tiiRc9I4S5XSXXrMHOWgHgxbrBn1Ro+PmiYhSg2ZVdxrAJtQgzU5o2m1BfP6UOn7Vxcc6152vFjQfmZR4xEg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.15.0.tgz", + "integrity": "sha512-uiNHpyjZtFrLwLDpHnzaDlP3Tt6sGMqTCiqmxaN4n4RP0EfYZDODJyddiFDF44Hjwxr5xAcaYxVKm9QKQFJFLA==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/type-utils": "6.9.1", - "@typescript-eslint/utils": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", - "debug": "^4.3.4", + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/type-utils": "7.15.0", + "@typescript-eslint/utils": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "graphemer": "^1.4.0", - "ignore": "^5.2.4", + "ignore": "^5.3.1", "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1826,26 +1869,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.1.tgz", - "integrity": "sha512-C7AK2wn43GSaCUZ9do6Ksgi2g3mwFkMO3Cis96kzmgudoVaKyt62yNzJOktP0HDLb/iO2O0n2lBOzJgr6Q/cyg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.15.0.tgz", + "integrity": "sha512-k9fYuQNnypLFcqORNClRykkGOMOj+pV6V91R4GO/l1FDGwpqmSwoOQrOHo3cGaH63e+D3ZiCAOsuS/D2c99j/A==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/typescript-estree": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/typescript-estree": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "debug": "^4.3.4" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1854,16 +1897,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.1.tgz", - "integrity": "sha512-38IxvKB6NAne3g/+MyXMs2Cda/Sz+CEpmm+KLGEM8hx/CvnSRuw51i8ukfwB/B/sESdeTGet1NH1Wj7I0YXswg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.15.0.tgz", + "integrity": "sha512-Q/1yrF/XbxOTvttNVPihxh1b9fxamjEoz2Os/Pe38OHwxC24CyCqXxGTOdpb4lt6HYtqw9HetA/Rf6gDGaMPlw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1" + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1871,25 +1914,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.1.tgz", - "integrity": "sha512-eh2oHaUKCK58qIeYp19F5V5TbpM52680sB4zNSz29VBQPTWIlE/hCj5P5B1AChxECe/fmZlspAWFuRniep1Skg==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.15.0.tgz", + "integrity": "sha512-SkgriaeV6PDvpA6253PDVep0qCqgbO1IOBiycjnXsszNTVQe5flN5wR5jiczoEoDEnAqYFSFFc9al9BSGVltkg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.9.1", - "@typescript-eslint/utils": "6.9.1", + "@typescript-eslint/typescript-estree": "7.15.0", + "@typescript-eslint/utils": "7.15.0", "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -1898,12 +1941,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.1.tgz", - "integrity": "sha512-BUGslGOb14zUHOUmDB2FfT6SI1CcZEJYfF3qFwBeUrU6srJfzANonwRYHDpLBuzbq3HaoF2XL2hcr01c8f8OaQ==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.15.0.tgz", + "integrity": "sha512-aV1+B1+ySXbQH0pLK0rx66I3IkiZNidYobyfn0WFsdGhSXw+P3YOqeTq5GED458SfB24tg+ux3S+9g118hjlTw==", "dev": true, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1911,21 +1954,22 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.1.tgz", - "integrity": "sha512-U+mUylTHfcqeO7mLWVQ5W/tMLXqVpRv61wm9ZtfE5egz7gtnmqVIw9ryh0mgIlkKk9rZLY3UHygsBSdB9/ftyw==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.15.0.tgz", + "integrity": "sha512-gjyB/rHAopL/XxfmYThQbXbzRMGhZzGw6KpcMbfe8Q3nNQKStpxnUKeXb0KiN/fFDR42Z43szs6rY7eHk0zdGQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/visitor-keys": "6.9.1", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/visitor-keys": "7.15.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1937,48 +1981,87 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/utils": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.1.tgz", - "integrity": "sha512-L1T0A5nFdQrMVunpZgzqPL6y2wVreSyHhKGZryS6jrEN7bD9NplVAyMryUhXsQ4TWLnZmxc2ekar/lSGIlprCA==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.15.0.tgz", + "integrity": "sha512-hfDMDqaqOqsUVGiEPSMLR/AjTSCsmJwjpKkYQRo1FNbmW4tBwBspYDwO9eh7sKSTwMQgBw9/T4DHudPaqshRWA==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.9.1", - "@typescript-eslint/types": "6.9.1", - "@typescript-eslint/typescript-estree": "6.9.1", - "semver": "^7.5.4" + "@typescript-eslint/scope-manager": "7.15.0", + "@typescript-eslint/types": "7.15.0", + "@typescript-eslint/typescript-estree": "7.15.0" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.1.tgz", - "integrity": "sha512-MUaPUe/QRLEffARsmNfmpghuQkW436DvESW+h+M52w0coICHRfD6Np9/K6PdACwnrq1HmuLl+cSPZaJmeVPkSw==", + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.15.0.tgz", + "integrity": "sha512-Hqgy/ETgpt2L5xueA/zHHIl4fJI2O4XUE9l4+OIfbJIRSnTJb/QscncdqqZzofQegIJugRIF57OJea1khw2SDw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.9.1", - "eslint-visitor-keys": "^3.4.1" + "@typescript-eslint/types": "7.15.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^16.0.0 || >=18.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -2174,9 +2257,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.8.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", - "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2212,19 +2295,6 @@ "node": ">=0.4.0" } }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -2286,12 +2356,6 @@ "node": ">=8" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dev": true - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -2332,6 +2396,42 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", @@ -2341,6 +2441,84 @@ "node": ">=8" } }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "es-shim-unscopables": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz", + "integrity": "sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "es-abstract": "^1.22.3", + "es-errors": "^1.2.1", + "get-intrinsic": "^1.2.3", + "is-array-buffer": "^3.0.4", + "is-shared-array-buffer": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -2359,20 +2537,26 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, - "node_modules/astral-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", - "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/axios": { "version": "1.6.5", "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", @@ -2805,6 +2989,25 @@ "node": ">=6.14.2" } }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2894,25 +3097,19 @@ "integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==", "dev": true }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", "dev": true, "dependencies": { - "restore-cursor": "^3.1.0" + "restore-cursor": "^4.0.0" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/cli-truncate": { @@ -3023,9 +3220,9 @@ "dev": true }, "node_modules/colorette": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz", - "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", "dev": true }, "node_modules/combined-stream": { @@ -3040,12 +3237,12 @@ } }, "node_modules/commander": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", - "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.0.0.tgz", + "integrity": "sha512-9HMlXtt/BNoYr8ooyjjNRdIilOTkVJXB+GhxMTtOKwk0R4j4lS4NpjuqmRxroBfnfTSHQIHQB7wryHhXarNjmQ==", "dev": true, "engines": { - "node": "^12.20.0 || >=14" + "node": ">=16" } }, "node_modules/concat-map": { @@ -3142,6 +3339,57 @@ "node": "*" } }, + "node_modules/data-view-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", + "integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz", + "integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz", + "integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3180,6 +3428,40 @@ "node": ">=0.10.0" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3355,77 +3637,209 @@ "is-arrayish": "^0.2.1" } }, - "node_modules/es-module-lexer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", - "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, + "node_modules/es-abstract": { + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", + "integrity": "sha512-e+HfNH61Bj1X9/jLc5v1owaLYuHdeHHSQlkhCBiTK8rBvKaULl/beGMxwrMXjpYrv4pz22BlY570vVePA2ho4A==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "arraybuffer.prototype.slice": "^1.0.3", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "data-view-buffer": "^1.0.1", + "data-view-byte-length": "^1.0.1", + "data-view-byte-offset": "^1.0.0", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.0.3", + "es-to-primitive": "^1.2.1", + "function.prototype.name": "^1.1.6", + "get-intrinsic": "^1.2.4", + "get-symbol-description": "^1.0.2", + "globalthis": "^1.0.3", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.0.3", + "has-symbols": "^1.0.3", + "hasown": "^2.0.2", + "internal-slot": "^1.0.7", + "is-array-buffer": "^3.0.4", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.1", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.3", + "is-string": "^1.0.7", + "is-typed-array": "^1.1.13", + "is-weakref": "^1.0.2", + "object-inspect": "^1.13.1", + "object-keys": "^1.1.1", + "object.assign": "^4.1.5", + "regexp.prototype.flags": "^1.5.2", + "safe-array-concat": "^1.1.2", + "safe-regex-test": "^1.0.3", + "string.prototype.trim": "^1.2.9", + "string.prototype.trimend": "^1.0.8", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.2", + "typed-array-byte-length": "^1.0.1", + "typed-array-byte-offset": "^1.0.2", + "typed-array-length": "^1.0.6", + "unbox-primitive": "^1.0.2", + "which-typed-array": "^1.1.15" + }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint": { - "version": "8.27.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.27.0.tgz", - "integrity": "sha512-0y1bfG2ho7mty+SiILVf9PfuRA49ek4Nc60Wmmu62QlobNR+CeXa4xXIJgcuwSQgZiWaPH+5BDsctpIW0PR/wQ==", + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.3", - "@humanwhocodes/config-array": "^0.11.6", - "@humanwhocodes/module-importer": "^1.0.1", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-module-lexer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.2.1.tgz", + "integrity": "sha512-9978wrXM50Y4rTMmW5kXIC09ZdXQZqkE4mxhwkd8VbzsGkXGPgV4zWuqQJgCEzYngdo2dYDa0l8xhX4fkSwJSg==", + "dev": true + }, + "node_modules/es-object-atoms": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", + "integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz", + "integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.2.4", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", + "dev": true, + "dependencies": { + "hasown": "^2.0.0" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", + "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.10.0", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.4.0", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", "glob-parent": "^6.0.2", - "globals": "^13.15.0", - "grapheme-splitter": "^1.0.4", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "is-path-inside": "^3.0.3", - "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", "text-table": "^0.2.0" }, "bin": { @@ -3438,44 +3852,199 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "node_modules/eslint-config-prettier": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", + "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", + "dev": true, + "dependencies": { + "debug": "^3.2.7" }, "engines": { - "node": ">=8.0.0" + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } } }, - "node_modules/eslint-utils": { + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", + "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.7", + "array.prototype.findlastindex": "^1.2.3", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.8.0", + "hasown": "^2.0.0", + "is-core-module": "^2.13.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.7", + "object.groupby": "^1.0.1", + "object.values": "^1.1.7", + "semver": "^6.3.1", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-import/node_modules/strip-bom": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import/node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", "dev": true, "dependencies": { - "eslint-visitor-keys": "^2.0.0" + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.1.3.tgz", + "integrity": "sha512-C9GCVAs4Eq7ZC/XFQHITLiHJxQngdtraXaM+LoUFoFp/lHNl2Zn8f3WQbe9HvTBBQ9YnKFB0/2Ajdqwo5D1EAw==", + "dev": true, + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.6" }, "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + "node": "^14.18.0 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/mysticatea" + "url": "https://opencollective.com/eslint-plugin-prettier" }, "peerDependencies": { - "eslint": ">=5" + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": "*", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } } }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, "engines": { - "node": ">=10" + "node": ">=8.0.0" } }, "node_modules/eslint-visitor-keys": { @@ -3490,10 +4059,19 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/@eslint/js": { + "version": "8.57.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", + "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", - "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", @@ -3501,6 +4079,9 @@ }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint/node_modules/estraverse": { @@ -3513,14 +4094,14 @@ } }, "node_modules/espree": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.4.1.tgz", - "integrity": "sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==", + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", "dev": true, "dependencies": { - "acorn": "^8.8.0", + "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.1" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -3543,9 +4124,9 @@ } }, "node_modules/esquery": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", - "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", "dev": true, "dependencies": { "estraverse": "^5.1.0" @@ -3602,6 +4183,12 @@ "node": ">=0.10.0" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -3674,10 +4261,16 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true + }, "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -3724,9 +4317,9 @@ } }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -3812,12 +4405,13 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, "dependencies": { - "flatted": "^3.1.0", + "flatted": "^3.2.9", + "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { @@ -3825,9 +4419,9 @@ } }, "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, "node_modules/follow-redirects": { @@ -3850,6 +4444,15 @@ } } }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -3891,6 +4494,33 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/function.prototype.name": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -3909,6 +4539,25 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -3930,6 +4579,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-symbol-description": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.2.tgz", + "integrity": "sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-symbol-from-current-process-h": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/get-symbol-from-current-process-h/-/get-symbol-from-current-process-h-1.0.2.tgz", @@ -3983,9 +4649,9 @@ "dev": true }, "node_modules/globals": { - "version": "13.17.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.17.0.tgz", - "integrity": "sha512-1C+6nQRb1GwGMKm2dH/E7enFAMxGTmGI7/dEdhy/DNelv85w9B72t3uc5frtMNXIbzrarJJ/lTCjcaZwbLJmyw==", + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, "dependencies": { "type-fest": "^0.20.2" @@ -3997,6 +4663,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -4022,18 +4704,24 @@ "resolved": "https://registry.npmjs.org/google-protobuf/-/google-protobuf-3.21.2.tgz", "integrity": "sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==" }, + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -4055,16 +4743,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-flag": { @@ -4076,6 +4761,57 @@ "node": ">=8" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -4117,6 +4853,18 @@ "minimalistic-assert": "^1.0.1" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -4143,12 +4891,15 @@ } }, "node_modules/husky": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/husky/-/husky-6.0.0.tgz", - "integrity": "sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==", + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.0.11.tgz", + "integrity": "sha512-AB6lFlbwwyIqMdHYhwPe+kjOC3Oc5P3nThEoW/AaO2BX3vJDjWPFxYLxokUZOo6RNX20He3AaT8sESs9NJcmEw==", "dev": true, "bin": { - "husky": "lib/bin.js" + "husky": "bin.mjs" + }, + "engines": { + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/typicode" @@ -4174,9 +4925,9 @@ ] }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", + "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", "dev": true, "engines": { "node": ">= 4" @@ -4226,15 +4977,6 @@ "node": ">=0.8.19" } }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -4249,6 +4991,20 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, + "node_modules/internal-slot": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz", + "integrity": "sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==", + "dev": true, + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.0", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/interpret": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", @@ -4258,19 +5014,108 @@ "node": ">= 0.10" } }, + "node_modules/is-array-buffer": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz", + "integrity": "sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-core-module": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", - "integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", + "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz", + "integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==", + "dev": true, + "dependencies": { + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, "dependencies": { - "has": "^1.0.3" + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4311,56 +5156,177 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", + "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", + "integrity": "sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, - "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, "engines": { - "node": ">=0.12.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", "dev": true, "dependencies": { - "isobject": "^3.0.1" + "which-typed-array": "^1.1.14" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, - "engines": { - "node": ">=8" + "dependencies": { + "call-bind": "^1.0.2" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -5009,12 +5975,6 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/js-sdsl": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.5.tgz", - "integrity": "sha512-08bOAKweV2NUC1wqTtf3qZlnpOX/R2DU9ikpjOHs0H+ibQv3zpncVQg6um4uYtRtrwIX8M4Nh3ytK4HGlYAq7Q==", - "dev": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5053,6 +6013,12 @@ "node": ">=4" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -5083,12 +6049,6 @@ "node": ">=6" } }, - "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", - "dev": true - }, "node_modules/keccak": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", @@ -5113,6 +6073,15 @@ "keccak": "^3.0.2" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -5154,9 +6123,9 @@ } }, "node_modules/lilconfig": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.0.5.tgz", - "integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", "dev": true, "engines": { "node": ">=10" @@ -5169,44 +6138,53 @@ "dev": true }, "node_modules/lint-staged": { - "version": "13.0.3", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.0.3.tgz", - "integrity": "sha512-9hmrwSCFroTSYLjflGI8Uk+GWAwMB4OlpU4bMJEAT5d/llQwtYKoim4bLOyLCuWFAhWEupE0vkIFqtw/WIsPug==", - "dev": true, - "dependencies": { - "cli-truncate": "^3.1.0", - "colorette": "^2.0.17", - "commander": "^9.3.0", - "debug": "^4.3.4", - "execa": "^6.1.0", - "lilconfig": "2.0.5", - "listr2": "^4.0.5", - "micromatch": "^4.0.5", - "normalize-path": "^3.0.0", - "object-inspect": "^1.12.2", - "pidtree": "^0.6.0", - "string-argv": "^0.3.1", - "yaml": "^2.1.1" + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-13.3.0.tgz", + "integrity": "sha512-mPRtrYnipYYv1FEE134ufbWpeggNTo+O/UPzngoaKzbzHAthvR55am+8GfHTnqNRQVRRrYQLGW9ZyUoD7DsBHQ==", + "dev": true, + "dependencies": { + "chalk": "5.3.0", + "commander": "11.0.0", + "debug": "4.3.4", + "execa": "7.2.0", + "lilconfig": "2.1.0", + "listr2": "6.6.1", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.1" }, "bin": { "lint-staged": "bin/lint-staged.js" }, "engines": { - "node": "^14.13.1 || >=16.0.0" + "node": "^16.14.0 || >=18.0.0" }, "funding": { "url": "https://opencollective.com/lint-staged" } }, + "node_modules/lint-staged/node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/lint-staged/node_modules/execa": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-6.1.0.tgz", - "integrity": "sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", "dev": true, "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.1", - "human-signals": "^3.0.1", + "human-signals": "^4.3.0", "is-stream": "^3.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^5.1.0", @@ -5215,19 +6193,19 @@ "strip-final-newline": "^3.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" }, "funding": { "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, "node_modules/lint-staged/node_modules/human-signals": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-3.0.1.tgz", - "integrity": "sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", "dev": true, "engines": { - "node": ">=12.20.0" + "node": ">=14.18.0" } }, "node_modules/lint-staged/node_modules/is-stream": { @@ -5255,9 +6233,9 @@ } }, "node_modules/lint-staged/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", "dev": true, "dependencies": { "path-key": "^4.0.0" @@ -5309,22 +6287,20 @@ } }, "node_modules/listr2": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-4.0.5.tgz", - "integrity": "sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==", + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-6.6.1.tgz", + "integrity": "sha512-+rAXGHh0fkEWdXBmX+L6mmfmXmXvDGEKzkjxO+8mP3+nI/r/CWznVBvsibXdxda9Zz0OW2e2ikphN3OwCT/jSg==", "dev": true, "dependencies": { - "cli-truncate": "^2.1.0", - "colorette": "^2.0.16", - "log-update": "^4.0.0", - "p-map": "^4.0.0", + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", "rfdc": "^1.3.0", - "rxjs": "^7.5.5", - "through": "^2.3.8", - "wrap-ansi": "^7.0.0" + "wrap-ansi": "^8.1.0" }, "engines": { - "node": ">=12" + "node": ">=16.0.0" }, "peerDependencies": { "enquirer": ">= 2.3.0 < 3" @@ -5335,63 +6311,60 @@ } } }, - "node_modules/listr2/node_modules/cli-truncate": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", - "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "node_modules/listr2/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", "dev": true, - "dependencies": { - "slice-ansi": "^3.0.0", - "string-width": "^4.2.0" - }, "engines": { - "node": ">=8" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/listr2/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/listr2/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "node_modules/listr2/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/listr2/node_modules/slice-ansi": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", - "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "node_modules/listr2/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/listr2/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "node_modules/listr2/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/loader-runner": { @@ -5437,81 +6410,105 @@ "dev": true }, "node_modules/log-update": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", - "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", "dev": true, "dependencies": { - "ansi-escapes": "^4.3.0", - "cli-cursor": "^3.1.0", - "slice-ansi": "^4.0.0", - "wrap-ansi": "^6.2.0" + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" }, "engines": { - "node": ">=10" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-update/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/log-update/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "node_modules/log-update/node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", "dev": true, + "dependencies": { + "type-fest": "^1.0.2" + }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/log-update/node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "node_modules/log-update/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" + "engines": { + "node": ">=12" }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/log-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/log-update/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "node_modules/log-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/log-update/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/log-update/node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, "node_modules/long": { @@ -5530,12 +6527,6 @@ "node": ">=10" } }, - "node_modules/lunr": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", - "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", - "dev": true - }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -5575,18 +6566,6 @@ "tmpl": "1.0.5" } }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", - "dev": true, - "bin": { - "marked": "bin/marked.js" - }, - "engines": { - "node": ">= 12" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -5755,38 +6734,117 @@ "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", "dev": true }, - "node_modules/node-releases": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", - "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", - "dev": true + "node_modules/node-releases": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", + "integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", "dev": true, "dependencies": { - "path-key": "^3.0.0" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" }, "engines": { - "node": ">=8" + "node": ">= 0.4" } }, - "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "node_modules/object.values": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", + "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5824,9 +6882,9 @@ } }, "node_modules/optionator": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", - "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, "dependencies": { "deep-is": "^0.1.3", @@ -5834,7 +6892,7 @@ "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", - "word-wrap": "^1.2.3" + "word-wrap": "^1.2.5" }, "engines": { "node": ">= 0.8.0" @@ -5870,21 +6928,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -6096,6 +7139,15 @@ "node": ">=8" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -6106,20 +7158,32 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.2.tgz", + "integrity": "sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/pretty-format": { "version": "29.3.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.3.1.tgz", @@ -6335,16 +7399,22 @@ "ms": "^2.1.1" } }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "node_modules/regexp.prototype.flags": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", + "integrity": "sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw==", "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "set-function-name": "^2.0.1" + }, "engines": { - "node": ">=8" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/mysticatea" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/require-directory": { @@ -6357,12 +7427,12 @@ } }, "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -6413,16 +7483,19 @@ } }, "node_modules/restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", "dev": true, "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" }, "engines": { - "node": ">=8" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/reusify": { @@ -6436,9 +7509,9 @@ } }, "node_modules/rfdc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", - "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", + "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", "dev": true }, "node_modules/rimraf": { @@ -6487,13 +7560,22 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/rxjs": { - "version": "7.5.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.7.tgz", - "integrity": "sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==", + "node_modules/safe-array-concat": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.2.tgz", + "integrity": "sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==", "dev": true, "dependencies": { - "tslib": "^2.1.0" + "call-bind": "^1.0.7", + "get-intrinsic": "^1.2.4", + "has-symbols": "^1.0.3", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/safe-buffer": { @@ -6501,6 +7583,23 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, + "node_modules/safe-regex-test": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.3.tgz", + "integrity": "sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.6", + "es-errors": "^1.3.0", + "is-regex": "^1.1.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -6567,6 +7666,38 @@ "randombytes": "^2.1.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -6612,16 +7743,22 @@ "node": ">=8" } }, - "node_modules/shiki": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.5.tgz", - "integrity": "sha512-1gCAYOcmCFONmErGTrS1fjzJLA7MGZmKzrBNX7apqSwhyITJg2O102uFzXUeBxNnEkDA9vHIKLyeKq0V083vIw==", + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dev": true, "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/signal-exit": { @@ -6771,9 +7908,9 @@ ] }, "node_modules/string-argv": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.1.tgz", - "integrity": "sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", "dev": true, "engines": { "node": ">=0.6.19" @@ -6822,9 +7959,9 @@ } }, "node_modules/string-width/node_modules/strip-ansi": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", - "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, "dependencies": { "ansi-regex": "^6.0.1" @@ -6836,6 +7973,55 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/string.prototype.trim": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz", + "integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz", + "integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -6902,6 +8088,22 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/synckit": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.8.tgz", + "integrity": "sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ==", + "dev": true, + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", @@ -7028,12 +8230,6 @@ "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true - }, "node_modules/tiny-secp256k1": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.6.tgz", @@ -7104,49 +8300,53 @@ } }, "node_modules/ts-api-utils": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", - "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, "engines": { - "node": ">=16.13.0" + "node": ">=16" }, "peerDependencies": { "typescript": ">=4.2.0" } }, "node_modules/ts-jest": { - "version": "29.0.3", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.0.3.tgz", - "integrity": "sha512-Ibygvmuyq1qp/z3yTh9QTwVVAbFdDy/+4BtIQR2sp6baF2SJU/8CKK/hhnGIDY2L90Az2jIqTwZPnN2p+BweiQ==", + "version": "29.1.5", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.5.tgz", + "integrity": "sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg==", "dev": true, "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", "jest-util": "^29.0.0", - "json5": "^2.2.1", + "json5": "^2.2.3", "lodash.memoize": "4.x", "make-error": "1.x", - "semver": "7.x", + "semver": "^7.5.3", "yargs-parser": "^21.0.1" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", "@jest/types": "^29.0.0", "babel-jest": "^29.0.0", "jest": "^29.0.0", - "typescript": ">=4.3" + "typescript": ">=4.3 <6" }, "peerDependenciesMeta": { "@babel/core": { "optional": true }, + "@jest/transform": { + "optional": true + }, "@jest/types": { "optional": true }, @@ -7178,9 +8378,9 @@ } }, "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", @@ -7258,9 +8458,9 @@ } }, "node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/type-check": { @@ -7296,49 +8496,77 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typedoc": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.2.tgz", - "integrity": "sha512-286F7BeATBiWe/qC4PCOCKlSTwfnsLbC/4cZ68oGBbvAqb9vV33quEOXx7q176OXotD+JdEerdQ1OZGJ818lnA==", + "node_modules/typed-array-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", + "integrity": "sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ==", "dev": true, "dependencies": { - "lunr": "^2.3.9", - "marked": "^4.3.0", - "minimatch": "^9.0.3", - "shiki": "^0.14.1" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.13" }, - "bin": { - "typedoc": "bin/typedoc" + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz", + "integrity": "sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" }, "engines": { - "node": ">= 16" + "node": ">= 0.4" }, - "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typedoc/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "node_modules/typed-array-byte-offset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz", + "integrity": "sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typedoc/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "node_modules/typed-array-length": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.6.tgz", + "integrity": "sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-proto": "^1.0.3", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/typeforce": { @@ -7347,9 +8575,9 @@ "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" }, "node_modules/typescript": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", - "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7359,6 +8587,47 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-7.15.0.tgz", + "integrity": "sha512-Ta40FhMXBCwHura4X4fncaCVkVcnJ9jnOq5+Lp4lN8F4DzHZtOwZdRvVBiNUGznUDHPwdGnrnwxmUOU2fFQqFA==", + "dev": true, + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.15.0", + "@typescript-eslint/parser": "7.15.0", + "@typescript-eslint/utils": "7.15.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", + "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-bigints": "^1.0.2", + "has-symbols": "^1.0.3", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", @@ -7439,18 +8708,6 @@ "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -7645,6 +8902,41 @@ "node": ">= 8" } }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/wif": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/wif/-/wif-2.0.6.tgz", @@ -7767,9 +9059,9 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/yaml": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", - "integrity": "sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.1.tgz", + "integrity": "sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==", "dev": true, "engines": { "node": ">= 14" diff --git a/package.json b/package.json index 9893558..18d0aff 100644 --- a/package.json +++ b/package.json @@ -2,17 +2,8 @@ "name": "@initia/initia.js", "version": "0.2.9", "description": "The JavaScript SDK for Initia", - "license": "MIT", + "license": "Apache-2.0", "author": "Initia Foundation", - "keywords": [ - "cryptocurrency", - "blockchain", - "smart-contracts", - "altcoin", - "altcoins", - "wallet", - "move" - ], "repository": { "type": "git", "url": "https://github.com/initia-labs/initia.js" @@ -23,64 +14,48 @@ "dist" ], "engines": { - "node": ">=14" + "node": ">=20" }, "scripts": { "build": "tsc --module commonjs && webpack --mode production", - "create-hook": "husky add .husky/pre-commit", - "test": "jest", - "format": "prettier --check \"./src/**/*.ts\"", - "format:fix": "prettier --write \"./src/**/*.ts\"", - "lint": "eslint src --ext .js,.ts", - "lint:fix": "eslint src --ext .js,.ts --fix", - "doc": "typedoc", - "prepare": "husky install", + "test": "jest --passWithNoTests", + "lint": "npx eslint . --fix", + "prepare": "husky", "prepublishOnly": "rm -rf ./dist && npm run build" }, - "lint-staged": { - "./src/**/*.ts": [ - "npm run lint:fix", - "npm run format:fix" - ] - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "post-checkout": "npm i" - } - }, - "prettier": { - "semi": true, - "singleQuote": true, - "trailingComma": "es5", - "arrowParens": "avoid" - }, "devDependencies": { + "@eslint/js": "^9.5.0", "@initia/builder.js": "^0.1.6", "@types/bn.js": "^5.1.1", + "@types/eslint": "^8.56.10", + "@types/eslint__js": "^8.42.3", "@types/jest": "^29.0.3", "@types/node": "^18.7.18", "@types/ripemd160": "^2.0.0", "@types/secp256k1": "^4.0.6", + "@types/semver": "^7.5.8", "@types/tmp": "^0.2.3", "@types/ws": "^7.4.7", - "@typescript-eslint/eslint-plugin": "^6.9.1", - "@typescript-eslint/parser": "^6.9.1", + "@typescript-eslint/eslint-plugin": "^7", + "@typescript-eslint/parser": "^7", "buffer": "^6.0.3", "crypto-browserify": "^3.12.0", - "eslint": "^8.23.1", - "husky": "^6.0.0", - "jest": "^29.0.3", - "lint-staged": "^13.0.3", - "prettier": "^2.7.1", + "eslint": "^8.57.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.1.3", + "husky": "^9.0.11", + "jest": "^29.1.1", + "lint-staged": "^13.3.0", + "prettier": "^3.1.1", "process": "^0.11.10", "stream-browserify": "^3.0.0", - "ts-jest": "^29.0.1", + "ts-jest": "^29.1.1", "ts-loader": "^9.4.1", - "ts-node": "^10.9.1", + "ts-node": "^10.9.2", "tsconfig-paths-webpack-plugin": "^4.0.0", - "typedoc": "^0.25.2", - "typescript": "^5.1.6", + "typescript": "^5.4.5", + "typescript-eslint": "^7.13.1", "webpack": "^5.74.0", "webpack-bundle-analyzer": "^4.6.1", "webpack-cli": "^4.10.0" @@ -104,5 +79,10 @@ "secp256k1": "^5.0.0", "tmp": "^0.2.1", "ws": "^7.5.9" + }, + "lint-staged": { + "src/**/*.{mjs|ts}": [ + "npx eslint . --fix" + ] } } diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..ccf0715 --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,12 @@ +/** + * @see https://prettier.io/docs/en/configuration.html + * @type {import("prettier").Config} + */ +const config = { + trailingComma: 'es5', + tabWidth: 2, + semi: false, + singleQuote: true, +} + +export default config diff --git a/src/client/LocalInitia.ts b/src/client/LocalInitia.ts index 0a3836a..2f2478e 100644 --- a/src/client/LocalInitia.ts +++ b/src/client/LocalInitia.ts @@ -1,6 +1,6 @@ -import { LCDClient } from './lcd/LCDClient'; -import { Wallet } from './lcd/Wallet'; -import { MnemonicKey } from '../key/MnemonicKey'; +import { LCDClient } from './lcd/LCDClient' +import { Wallet } from './lcd/Wallet' +import { MnemonicKey } from '../key/MnemonicKey' const LOCALINITIA_MNEMONICS = { validator: @@ -25,25 +25,25 @@ const LOCALINITIA_MNEMONICS = { 'index light average senior silent limit usual local involve delay update rack cause inmate wall render magnet common feature laundry exact casual resource hundred', test10: 'prefer forget visit mistake mixture feel eyebrow autumn shop pair address airport diesel street pass vague innocent poem method awful require hurry unhappy shoulder', -}; +} export class LocalInitia extends LCDClient { public wallets: { - validator: Wallet; - test1: Wallet; - test2: Wallet; - test3: Wallet; - test4: Wallet; - test5: Wallet; - test6: Wallet; - test7: Wallet; - test8: Wallet; - test9: Wallet; - test10: Wallet; - }; + validator: Wallet + test1: Wallet + test2: Wallet + test3: Wallet + test4: Wallet + test5: Wallet + test6: Wallet + test7: Wallet + test8: Wallet + test9: Wallet + test10: Wallet + } constructor() { - super('https://stone-rest.initia.tech', { chainId: 'localinitia' }); + super('https://stone-rest.initia.tech', { chainId: 'localinitia' }) this.wallets = { validator: this.wallet( @@ -79,6 +79,6 @@ export class LocalInitia extends LCDClient { test10: this.wallet( new MnemonicKey({ mnemonic: LOCALINITIA_MNEMONICS.test10 }) ), - }; + } } } diff --git a/src/client/WebSocketClient.ts b/src/client/WebSocketClient.ts index 8995b77..34e2400 100644 --- a/src/client/WebSocketClient.ts +++ b/src/client/WebSocketClient.ts @@ -1,12 +1,12 @@ -import { EventEmitter } from 'events'; -import WebSocket from 'ws'; -import { hashToHex } from '../util'; +import { EventEmitter } from 'events' +import WebSocket from 'ws' +import { hashToHex } from '../util' -type Callback = (data: TendermintSubscriptionResponse) => void; +type Callback = (data: TendermintSubscriptionResponse) => void export interface TendermintSubscriptionResponse { - type: string; - value: Record; + type: string + value: Record } export type TendermintEventType = @@ -21,45 +21,44 @@ export type TendermintEventType = | 'NewRoundStep' | 'Polka' | 'Relock' - | 'Relock' | 'TimeoutPropose' | 'TimeoutWait' | 'Unlock' | 'ValidBlock' - | 'Vote'; - -type TendermintQueryOperand = string | number | Date; - -export interface TendermintQuery { - [k: string]: - | TendermintQueryOperand - | ['>', number | Date] - | ['<', number | Date] - | ['<=', number | Date] - | ['>=', number | Date] - | ['CONTAINS', string] - | ['EXISTS']; -} + | 'Vote' + +type TendermintQueryOperand = string | number | Date + +export type TendermintQuery = Record< + string, + | TendermintQueryOperand + | ['>', number | Date] + | ['<', number | Date] + | ['<=', number | Date] + | ['>=', number | Date] + | ['CONTAINS', string] + | ['EXISTS'] +> -const escapeSingleQuotes = (str: string) => str.replace(/'/g, "\\'"); +const escapeSingleQuotes = (str: string) => str.replace(/'/g, "\\'") function makeQueryParams(query: TendermintQuery): string { - const queryBuilder: string[] = []; + const queryBuilder: string[] = [] for (const key of Object.keys(query)) { - let queryItem: string; - const value = query[key]; + let queryItem: string + const value = query[key] // if value is scalar if (!Array.isArray(value)) { switch (typeof value) { case 'number': - queryItem = `${key}=${value}`; - break; + queryItem = `${key}=${value}` + break case 'string': - queryItem = `${key}='${escapeSingleQuotes(value)}'`; - break; + queryItem = `${key}='${escapeSingleQuotes(value)}'` + break default: // Date - queryItem = `${key}=${value.toISOString()}`; + queryItem = `${key}=${value.toISOString()}` } } else { switch (value[0]) { @@ -68,22 +67,22 @@ function makeQueryParams(query: TendermintQuery): string { case '<=': case '>=': if (typeof value[1] !== 'number') { - queryItem = `${key}${value[0]}${value[1].toISOString()}`; + queryItem = `${key}${value[0]}${value[1].toISOString()}` } else { - queryItem = `${key}${value[0]}${value[1]}`; + queryItem = `${key}${value[0]}${value[1]}` } - break; + break case 'CONTAINS': - queryItem = `${key} CONTAINS '${escapeSingleQuotes(value[1])}'`; - break; + queryItem = `${key} CONTAINS '${escapeSingleQuotes(value[1])}'` + break case 'EXISTS': - queryItem = `${key} EXISTS`; - break; + queryItem = `${key} EXISTS` + break } } - queryBuilder.push(queryItem); + queryBuilder.push(queryItem) } - return queryBuilder.join(' AND '); + return queryBuilder.join(' AND ') } /** @@ -127,13 +126,13 @@ function makeQueryParams(query: TendermintQuery): string { * ``` */ export class WebSocketClient extends EventEmitter { - public isConnected: boolean; - private reconnectTimeoutId?: NodeJS.Timeout; - private queryParams?: string; - private callback?: Callback; - private shouldAttemptReconnect: boolean; - private socket!: WebSocket; - private _reconnectCount: number; + public isConnected: boolean + private reconnectTimeoutId?: NodeJS.Timeout + private queryParams?: string + private callback?: Callback + private shouldAttemptReconnect: boolean + private socket!: WebSocket + private _reconnectCount: number /** * WebSocketClient constructor @@ -147,35 +146,35 @@ export class WebSocketClient extends EventEmitter { private reconnectCount = 0, private reconnectInterval = 1000 ) { - super(); - this._reconnectCount = this.reconnectCount; - this.isConnected = false; - this.shouldAttemptReconnect = !!this.reconnectInterval; + super() + this._reconnectCount = this.reconnectCount + this.isConnected = false + this.shouldAttemptReconnect = !!this.reconnectInterval } /** * Destroys class as well as socket */ destroy() { - this.shouldAttemptReconnect = false; - this.reconnectTimeoutId && clearTimeout(this.reconnectTimeoutId); - this.socket && this.socket.close(); + this.shouldAttemptReconnect = false + this.reconnectTimeoutId && clearTimeout(this.reconnectTimeoutId) + this.socket && this.socket.close() } start() { - this.socket = new WebSocket(this.URL); + this.socket = new WebSocket(this.URL) - this.socket.onopen = this.onOpen.bind(this); - this.socket.onmessage = this.onMessage.bind(this); - this.socket.onclose = this.onClose.bind(this); - this.socket.onerror = () => undefined; + this.socket.onopen = this.onOpen.bind(this) + this.socket.onmessage = this.onMessage.bind(this) + this.socket.onclose = this.onClose.bind(this) + this.socket.onerror = () => undefined } private onOpen() { - this.isConnected = true; - this.emit('connect'); + this.isConnected = true + this.emit('connect') // reset reconnectCount after connection establishment - this._reconnectCount = this.reconnectCount; + this._reconnectCount = this.reconnectCount this.socket.send( JSON.stringify({ @@ -184,12 +183,22 @@ export class WebSocketClient extends EventEmitter { params: [this.queryParams], id: 1, }) - ); + ) } private onMessage(message: WebSocket.MessageEvent) { try { - const parsedData = JSON.parse(message.data.toString()); + let data: string + + if (typeof message.data === 'string') { + data = message.data + } else if (message.data instanceof Buffer) { + data = message.data.toString() + } else { + throw new Error('Unsupported message data type') + } + + const parsedData = JSON.parse(data) if ( this.callback && @@ -197,31 +206,31 @@ export class WebSocketClient extends EventEmitter { parsedData.result.query === this.queryParams ) { // this.emit('message', parsedData.result.data); - this.callback(parsedData.result.data); + this.callback(parsedData.result.data) } } catch (err) { - this.emit('error', err); + this.emit('error', err) } } private onClose() { - this.isConnected = false; + this.isConnected = false if ( this.shouldAttemptReconnect && (this._reconnectCount > 0 || this._reconnectCount === -1) ) { if (this._reconnectCount !== -1) { - this._reconnectCount--; + this._reconnectCount-- } - this.reconnectTimeoutId && clearTimeout(this.reconnectTimeoutId); + this.reconnectTimeoutId && clearTimeout(this.reconnectTimeoutId) this.reconnectTimeoutId = setTimeout(() => { - this.emit('reconnect'); - this.start(); - }, this.reconnectInterval); + this.emit('reconnect') + this.start() + }, this.reconnectInterval) } else { - this.emit('destroyed'); + this.emit('destroyed') } } @@ -233,16 +242,16 @@ export class WebSocketClient extends EventEmitter { this.queryParams = makeQueryParams({ 'tm.event': event, ...query, - }); - this.callback = callback; + }) + this.callback = callback } public subscribeTx(query: TendermintQuery, callback: Callback): void { - const newCallback: Callback = d => { - d.value.TxResult.txhash = hashToHex(d.value.TxResult.tx); - return callback(d); - }; + const newCallback: Callback = (d) => { + d.value.TxResult.txhash = hashToHex(d.value.TxResult.tx) + return callback(d) + } - this.subscribe('Tx', query, newCallback); + this.subscribe('Tx', query, newCallback) } } diff --git a/src/client/index.ts b/src/client/index.ts index e64dfa3..f18636a 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -1,11 +1,11 @@ // LCDClient -export * from './lcd/APIRequester'; -export * from './lcd/LCDClient'; -export * from './lcd/Wallet'; -export * from './lcd/api'; +export * from './lcd/APIRequester' +export * from './lcd/LCDClient' +export * from './lcd/Wallet' +export * from './lcd/api' // LocalInitia (LCDClient) -export * from './LocalInitia'; +export * from './LocalInitia' // WebSocketClient -export * from './WebSocketClient'; +export * from './WebSocketClient' diff --git a/src/client/lcd/APIRequester.spec.ts b/src/client/lcd/APIRequester.spec.ts index 2b710ef..d35ca45 100644 --- a/src/client/lcd/APIRequester.spec.ts +++ b/src/client/lcd/APIRequester.spec.ts @@ -1,20 +1,20 @@ -import axios from 'axios'; -import { APIRequester } from './APIRequester'; +import axios from 'axios' +import { APIRequester } from './APIRequester' -jest.mock('axios'); -const mockedAxios = jest.mocked(axios); +jest.mock('axios') +const mockedAxios = jest.mocked(axios) describe('APIRequester', () => { beforeAll(() => { // @ts-expect-error - axios.create.mockReturnThis(); - }); + axios.create.mockReturnThis() + }) it('accept a standard URL', async () => { - mockedAxios.get.mockResolvedValueOnce({ data: null }); + mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://stone-rest.initia.tech/'); - await request.get('/foo'); + const request = new APIRequester('https://stone-rest.initia.tech/') + await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( 'https://stone-rest.initia.tech/foo', @@ -22,14 +22,14 @@ describe('APIRequester', () => { headers: new axios.AxiosHeaders(), params: {}, } - ); - }); + ) + }) it('accept a deep URL', async () => { - mockedAxios.get.mockResolvedValueOnce({ data: null }); + mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://stone-rest.initia.tech/bar'); - await request.get('/foo'); + const request = new APIRequester('https://stone-rest.initia.tech/bar') + await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( 'https://stone-rest.initia.tech/bar/foo', @@ -37,14 +37,14 @@ describe('APIRequester', () => { headers: new axios.AxiosHeaders(), params: {}, } - ); - }); + ) + }) it('accept an URL with search params', async () => { - mockedAxios.get.mockResolvedValueOnce({ data: null }); + mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://stone-rest.initia.tech?key=123'); - await request.get('/foo'); + const request = new APIRequester('https://stone-rest.initia.tech?key=123') + await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( 'https://stone-rest.initia.tech/foo?key=123', @@ -52,14 +52,14 @@ describe('APIRequester', () => { headers: new axios.AxiosHeaders(), params: {}, } - ); - }); + ) + }) it('accept an URL with credentials', async () => { - mockedAxios.get.mockResolvedValueOnce({ data: null }); + mockedAxios.get.mockResolvedValueOnce({ data: null }) - const request = new APIRequester('https://abc:123@stone-rest.initia.tech/'); - await request.get('/foo'); + const request = new APIRequester('https://abc:123@stone-rest.initia.tech/') + await request.get('/foo') expect(mockedAxios.get).toHaveBeenCalledWith( 'https://:123@stone-rest.initia.tech/foo', @@ -67,6 +67,6 @@ describe('APIRequester', () => { headers: new axios.AxiosHeaders(), params: {}, } - ); - }); -}); + ) + }) +}) diff --git a/src/client/lcd/APIRequester.ts b/src/client/lcd/APIRequester.ts index 598602d..ce512be 100644 --- a/src/client/lcd/APIRequester.ts +++ b/src/client/lcd/APIRequester.ts @@ -1,61 +1,61 @@ -import Axios, { AxiosInstance, AxiosHeaders, CreateAxiosDefaults } from 'axios'; -import { OrderBy as OrderBy_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/service'; +import Axios, { AxiosInstance, AxiosHeaders, CreateAxiosDefaults } from 'axios' +import { OrderBy as OrderBy_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/service' -export type APIParams = Record; +export type APIParams = Record export interface Pagination { - next_key?: string; - total: number; + next_key?: string + total: number } -export const OrderBy = OrderBy_pb; -export type OrderBy = OrderBy_pb; +export const OrderBy = OrderBy_pb +export type OrderBy = OrderBy_pb export interface PaginationOptions { - 'pagination.limit': string; - 'pagination.offset': string; - 'pagination.key': string; - 'pagination.count_total': 'true' | 'false'; - 'pagination.reverse': 'true' | 'false'; - order_by: keyof typeof OrderBy; + 'pagination.limit': string + 'pagination.offset': string + 'pagination.key': string + 'pagination.count_total': 'true' | 'false' + 'pagination.reverse': 'true' | 'false' + order_by: keyof typeof OrderBy } export class APIRequester { - private axios: AxiosInstance; - private readonly baseURL: string; + private axios: AxiosInstance + private readonly baseURL: string constructor(baseURL: string, config?: CreateAxiosDefaults | undefined) { - this.baseURL = baseURL; + this.baseURL = baseURL const defaultConfig: CreateAxiosDefaults = { headers: { Accept: 'application/json', }, timeout: 30000, - }; + } this.axios = Axios.create({ ...defaultConfig, ...config, headers: { ...defaultConfig.headers, ...config?.headers }, - }); + }) } private computeEndpoint(endpoint: string) { - const url = new URL(this.baseURL); + const url = new URL(this.baseURL) url.pathname === '/' ? (url.pathname = endpoint) - : (url.pathname += endpoint); + : (url.pathname += endpoint) - return url.toString(); + return url.toString() } public async getRaw( endpoint: string, params: URLSearchParams | APIParams = {} ): Promise { - const url = this.computeEndpoint(endpoint); - return this.axios.get(url, { params }).then(d => d.data); + const url = this.computeEndpoint(endpoint) + return this.axios.get(url, { params }).then((d) => d.data) } public async get( @@ -63,12 +63,12 @@ export class APIRequester { params: URLSearchParams | APIParams = {}, headers: AxiosHeaders = new AxiosHeaders() ): Promise { - const url = this.computeEndpoint(endpoint); - return this.axios.get(url, { params, headers }).then(d => d.data); + const url = this.computeEndpoint(endpoint) + return this.axios.get(url, { params, headers }).then((d) => d.data) } public async post(endpoint: string, data?: any): Promise { - const url = this.computeEndpoint(endpoint); - return this.axios.post(url, data).then(d => d.data); + const url = this.computeEndpoint(endpoint) + return this.axios.post(url, data).then((d) => d.data) } } diff --git a/src/client/lcd/LCDClient.ts b/src/client/lcd/LCDClient.ts index aa45394..b103feb 100644 --- a/src/client/lcd/LCDClient.ts +++ b/src/client/lcd/LCDClient.ts @@ -1,4 +1,4 @@ -import { APIRequester } from './APIRequester'; +import { APIRequester } from './APIRequester' import { AuctionAPI, AuthAPI, @@ -30,37 +30,37 @@ import { TxAPI, UpgradeAPI, WasmAPI, -} from './api'; -import { Wallet } from './Wallet'; -import { Coins } from '../../core'; -import { Key } from '../../key'; +} from './api' +import { Wallet } from './Wallet' +import { Coins } from '../../core' +import { Key } from '../../key' export interface LCDClientConfig { /** * Chain ID of the blockchain to connect to. */ - chainId?: string; + chainId?: string /** * Coins representing the default gas prices to use for fee estimation. */ - gasPrices?: Coins.Input; + gasPrices?: Coins.Input /** * Number presenting the default gas adjustment value to use for fee estimation. */ - gasAdjustment?: string; + gasAdjustment?: string } const DEFAULT_LCD_OPTIONS: Partial = { gasAdjustment: '1.75', -}; +} -const DEFAULT_GAS_PRICES_BY_CHAIN_ID: { [key: string]: Coins.Input } = { +const DEFAULT_GAS_PRICES_BY_CHAIN_ID: Record = { default: { uinit: 0.15, }, -}; +} /** * An object repesenting a connection to a initiad node running the Lite Client Daemon (LCD) @@ -78,41 +78,41 @@ const DEFAULT_GAS_PRICES_BY_CHAIN_ID: { [key: string]: Coins.Input } = { */ export class LCDClient { - public URL: string; - public config: LCDClientConfig; - public apiRequester: APIRequester; + public URL: string + public config: LCDClientConfig + public apiRequester: APIRequester // API access - public auction: AuctionAPI; - public auth: AuthAPI; - public authz: AuthzAPI; - public bank: BankAPI; - public distribution: DistributionAPI; - public evidence: EvidenceAPI; - public evm: EvmAPI; - public feeGrant: FeeGrantAPI; - public forwarding: ForwardingAPI; - public gov: GovAPI; - public group: GroupAPI; - public ibc: IbcAPI; - public ibcHooks: IbcHooksAPI; - public ibcNft: IbcNftAPI; - public ibcTransfer: IbcTransferAPI; - public ibcPerm: IbcPermAPI; - public interTx: InterTxAPI; - public marketmap: MarketmapAPI; - public move: MoveAPI; - public mstaking: MstakingAPI; - public opchild: OpchildAPI; - public ophost: OphostAPI; - public oracle: OracleAPI; - public reward: RewardAPI; - public slashing: SlashingAPI; - public tendermint: TendermintAPI; - public tokenfactory: TokenfactoryAPI; - public tx: TxAPI; - public upgrade: UpgradeAPI; - public wasm: WasmAPI; + public auction: AuctionAPI + public auth: AuthAPI + public authz: AuthzAPI + public bank: BankAPI + public distribution: DistributionAPI + public evidence: EvidenceAPI + public evm: EvmAPI + public feeGrant: FeeGrantAPI + public forwarding: ForwardingAPI + public gov: GovAPI + public group: GroupAPI + public ibc: IbcAPI + public ibcHooks: IbcHooksAPI + public ibcNft: IbcNftAPI + public ibcTransfer: IbcTransferAPI + public ibcPerm: IbcPermAPI + public interTx: InterTxAPI + public marketmap: MarketmapAPI + public move: MoveAPI + public mstaking: MstakingAPI + public opchild: OpchildAPI + public ophost: OphostAPI + public oracle: OracleAPI + public reward: RewardAPI + public slashing: SlashingAPI + public tendermint: TendermintAPI + public tokenfactory: TokenfactoryAPI + public tx: TxAPI + public upgrade: UpgradeAPI + public wasm: WasmAPI /** * Creates a new LCD client with the specified configuration. @@ -124,51 +124,51 @@ export class LCDClient { config?: LCDClientConfig, apiRequester?: APIRequester ) { - this.URL = URL; + this.URL = URL this.config = { ...DEFAULT_LCD_OPTIONS, gasPrices: (config?.chainId && DEFAULT_GAS_PRICES_BY_CHAIN_ID[config.chainId]) ?? DEFAULT_GAS_PRICES_BY_CHAIN_ID['default'], ...config, - }; - this.apiRequester = apiRequester ?? new APIRequester(this.URL); + } + this.apiRequester = apiRequester ?? new APIRequester(this.URL) // instantiate APIs - this.auction = new AuctionAPI(this.apiRequester); - this.auth = new AuthAPI(this.apiRequester); - this.authz = new AuthzAPI(this.apiRequester); - this.bank = new BankAPI(this.apiRequester); - this.distribution = new DistributionAPI(this.apiRequester); - this.evidence = new EvidenceAPI(this.apiRequester); - this.evm = new EvmAPI(this.apiRequester); - this.feeGrant = new FeeGrantAPI(this.apiRequester); - this.forwarding = new ForwardingAPI(this.apiRequester); - this.gov = new GovAPI(this.apiRequester); - this.group = new GroupAPI(this.apiRequester); - this.ibc = new IbcAPI(this.apiRequester); - this.ibcHooks = new IbcHooksAPI(this.apiRequester); - this.ibcNft = new IbcNftAPI(this.apiRequester); - this.ibcTransfer = new IbcTransferAPI(this.apiRequester); - this.ibcPerm = new IbcPermAPI(this.apiRequester); - this.interTx = new InterTxAPI(this.apiRequester); - this.marketmap = new MarketmapAPI(this.apiRequester); - this.move = new MoveAPI(this.apiRequester); - this.mstaking = new MstakingAPI(this.apiRequester); - this.opchild = new OpchildAPI(this.apiRequester); - this.ophost = new OphostAPI(this.apiRequester); - this.oracle = new OracleAPI(this.apiRequester); - this.reward = new RewardAPI(this.apiRequester); - this.slashing = new SlashingAPI(this.apiRequester); - this.tendermint = new TendermintAPI(this.apiRequester); - this.tokenfactory = new TokenfactoryAPI(this.apiRequester); - this.tx = new TxAPI(this); - this.upgrade = new UpgradeAPI(this.apiRequester); - this.wasm = new WasmAPI(this.apiRequester); + this.auction = new AuctionAPI(this.apiRequester) + this.auth = new AuthAPI(this.apiRequester) + this.authz = new AuthzAPI(this.apiRequester) + this.bank = new BankAPI(this.apiRequester) + this.distribution = new DistributionAPI(this.apiRequester) + this.evidence = new EvidenceAPI(this.apiRequester) + this.evm = new EvmAPI(this.apiRequester) + this.feeGrant = new FeeGrantAPI(this.apiRequester) + this.forwarding = new ForwardingAPI(this.apiRequester) + this.gov = new GovAPI(this.apiRequester) + this.group = new GroupAPI(this.apiRequester) + this.ibc = new IbcAPI(this.apiRequester) + this.ibcHooks = new IbcHooksAPI(this.apiRequester) + this.ibcNft = new IbcNftAPI(this.apiRequester) + this.ibcTransfer = new IbcTransferAPI(this.apiRequester) + this.ibcPerm = new IbcPermAPI(this.apiRequester) + this.interTx = new InterTxAPI(this.apiRequester) + this.marketmap = new MarketmapAPI(this.apiRequester) + this.move = new MoveAPI(this.apiRequester) + this.mstaking = new MstakingAPI(this.apiRequester) + this.opchild = new OpchildAPI(this.apiRequester) + this.ophost = new OphostAPI(this.apiRequester) + this.oracle = new OracleAPI(this.apiRequester) + this.reward = new RewardAPI(this.apiRequester) + this.slashing = new SlashingAPI(this.apiRequester) + this.tendermint = new TendermintAPI(this.apiRequester) + this.tokenfactory = new TokenfactoryAPI(this.apiRequester) + this.tx = new TxAPI(this) + this.upgrade = new UpgradeAPI(this.apiRequester) + this.wasm = new WasmAPI(this.apiRequester) } /** Creates a new wallet with the Key. */ public wallet(key: Key): Wallet { - return new Wallet(this, key); + return new Wallet(this, key) } } diff --git a/src/client/lcd/Wallet.ts b/src/client/lcd/Wallet.ts index b35fa55..243fffa 100644 --- a/src/client/lcd/Wallet.ts +++ b/src/client/lcd/Wallet.ts @@ -1,46 +1,49 @@ -import { LCDClient } from './LCDClient'; -import { Key } from '../../key'; -import { CreateTxOptions } from '../lcd/api/TxAPI'; -import { Tx } from '../../core'; -import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing'; +import { LCDClient } from './LCDClient' +import { Key } from '../../key' +import { CreateTxOptions } from '../lcd/api/TxAPI' +import { Tx } from '../../core' +import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing' export class Wallet { - private accAddress: string; - constructor(public lcd: LCDClient, public key: Key) { - this.accAddress = key.accAddress; + private accAddress: string + constructor( + public lcd: LCDClient, + public key: Key + ) { + this.accAddress = key.accAddress } public setAccountAddress(accAddress: string) { - this.accAddress = accAddress; + this.accAddress = accAddress } public async accountNumberAndSequence(): Promise<{ - account_number: number; - sequence: number; + account_number: number + sequence: number }> { - return this.lcd.auth.accountInfo(this.accAddress).then(d => { + return this.lcd.auth.accountInfo(this.accAddress).then((d) => { return { account_number: d.getAccountNumber(), sequence: d.getSequenceNumber(), - }; - }); + } + }) } public async accountNumber(): Promise { - return this.lcd.auth.accountInfo(this.accAddress).then(d => { - return d.getAccountNumber(); - }); + return this.lcd.auth.accountInfo(this.accAddress).then((d) => { + return d.getAccountNumber() + }) } public async sequence(): Promise { - return this.lcd.auth.accountInfo(this.accAddress).then(d => { - return d.getSequenceNumber(); - }); + return this.lcd.auth.accountInfo(this.accAddress).then((d) => { + return d.getSequenceNumber() + }) } public async createTx( options: CreateTxOptions & { - sequence?: number; + sequence?: number } ): Promise { return this.lcd.tx.create( @@ -52,43 +55,43 @@ export class Wallet { }, ], options - ); + ) } public async createAndSignTx( options: CreateTxOptions & { - sequence?: number; - accountNumber?: number; - signMode?: SignMode; + sequence?: number + accountNumber?: number + signMode?: SignMode } ): Promise { if (!this.lcd.config.chainId) { - this.lcd.config.chainId = await this.lcd.tendermint.chainId(); + this.lcd.config.chainId = await this.lcd.tendermint.chainId() } - let accountNumber = options.accountNumber; - let sequence = options.sequence; + let accountNumber = options.accountNumber + let sequence = options.sequence if (accountNumber === undefined || sequence === undefined) { - const res = await this.accountNumberAndSequence(); + const res = await this.accountNumberAndSequence() if (accountNumber === undefined) { - accountNumber = res.account_number; + accountNumber = res.account_number } if (sequence === undefined) { - sequence = res.sequence; + sequence = res.sequence } } - options.sequence = sequence; - options.accountNumber = accountNumber; + options.sequence = sequence + options.accountNumber = accountNumber - const tx = await this.createTx(options); + const tx = await this.createTx(options) return this.key.signTx(tx, { accountNumber, sequence, chainId: this.lcd.config.chainId, signMode: options.signMode ?? SignMode.SIGN_MODE_DIRECT, - }); + }) } } diff --git a/src/client/lcd/api/AuctionAPI.ts b/src/client/lcd/api/AuctionAPI.ts index edec2ca..faee5e7 100644 --- a/src/client/lcd/api/AuctionAPI.ts +++ b/src/client/lcd/api/AuctionAPI.ts @@ -1,14 +1,13 @@ -import { AuctionParams } from '../../../core/auction'; -import { APIParams } from '../APIRequester'; -import { BaseAPI } from './BaseAPI'; +import { AuctionParams } from '../../../core/auction' +import { APIParams } from '../APIRequester' +import { BaseAPI } from './BaseAPI' export class AuctionAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: AuctionParams.Data }>( - `/block-sdk/auction/v1/params`, - params - ) - .then(({ params: d }) => AuctionParams.fromData(d)); + .get<{ + params: AuctionParams.Data + }>(`/block-sdk/auction/v1/params`, params) + .then(({ params: d }) => AuctionParams.fromData(d)) } } diff --git a/src/client/lcd/api/AuthAPI.spec.ts b/src/client/lcd/api/AuthAPI.spec.ts index faa3947..55d5585 100644 --- a/src/client/lcd/api/AuthAPI.spec.ts +++ b/src/client/lcd/api/AuthAPI.spec.ts @@ -1,42 +1,42 @@ -import { APIRequester } from '../APIRequester'; -import { AuthAPI } from './AuthAPI'; -import { BaseAccount } from '../../../core'; -import { MnemonicKey } from '../../../key'; +import { APIRequester } from '../APIRequester' +import { AuthAPI } from './AuthAPI' +import { BaseAccount } from '../../../core' +import { MnemonicKey } from '../../../key' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const auth = new AuthAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const auth = new AuthAPI(c) describe('AuthAPI', () => { describe('accounts', () => { it('account exists', async () => { const acct = await auth.accountInfo( 'init1hk0asaef9nxvnj7gjwawv0zz0yd7adcysktpqu' - ); + ) - expect(acct instanceof BaseAccount).toBe(true); - }); + expect(acct instanceof BaseAccount).toBe(true) + }) it('invalid account', async () => { - await expect(auth.accountInfo('1234')).rejects.toThrow(); - }); + await expect(auth.accountInfo('1234')).rejects.toThrow() + }) it("account doesn't exist (valid but new account)", async () => { - const mk = new MnemonicKey(); + const mk = new MnemonicKey() await expect(auth.accountInfo(mk.accAddress)).rejects.toThrow( 'status code 404' - ); - }); - }); + ) + }) + }) describe('parameters', () => { it('parameters', async () => { - const param = await auth.parameters(); + const param = await auth.parameters() - expect(param.max_memo_characters).toBeGreaterThanOrEqual(0); - expect(param.tx_sig_limit).toBeGreaterThanOrEqual(0); - expect(param.tx_size_cost_per_byte).toBeGreaterThanOrEqual(0); - expect(param.sig_verify_cost_ed25519).toBeGreaterThanOrEqual(0); - expect(param.sig_verify_cost_secp256k1).toBeGreaterThanOrEqual(0); - }); - }); -}); + expect(param.max_memo_characters).toBeGreaterThanOrEqual(0) + expect(param.tx_sig_limit).toBeGreaterThanOrEqual(0) + expect(param.tx_size_cost_per_byte).toBeGreaterThanOrEqual(0) + expect(param.sig_verify_cost_ed25519).toBeGreaterThanOrEqual(0) + expect(param.sig_verify_cost_secp256k1).toBeGreaterThanOrEqual(0) + }) + }) +}) diff --git a/src/client/lcd/api/AuthAPI.ts b/src/client/lcd/api/AuthAPI.ts index f25a1ff..3e9ccd3 100644 --- a/src/client/lcd/api/AuthAPI.ts +++ b/src/client/lcd/api/AuthAPI.ts @@ -4,9 +4,9 @@ import { ModuleAccount, BaseAccount, AuthParams, -} from '../../../core'; -import { BaseAPI } from './BaseAPI'; -import { APIParams } from '../APIRequester'; +} from '../../../core' +import { BaseAPI } from './BaseAPI' +import { APIParams } from '../APIRequester' export class AuthAPI extends BaseAPI { /** @@ -17,9 +17,9 @@ export class AuthAPI extends BaseAPI { params: APIParams = {} ): Promise { const { account } = await this.c.get<{ - account: BaseAccount.Data | ModuleAccount.Data; - }>(`/cosmos/auth/v1beta1/accounts/${address}`, params); - return Account.fromData(account); + account: BaseAccount.Data | ModuleAccount.Data + }>(`/cosmos/auth/v1beta1/accounts/${address}`, params) + return Account.fromData(account) } public async moduleAccount( @@ -29,13 +29,13 @@ export class AuthAPI extends BaseAPI { const { account } = await this.c.get<{ account: ModuleAccount.Data }>( `/cosmos/auth/v1beta1/module_accounts/${name}`, params - ); - return ModuleAccount.fromData(account); + ) + return ModuleAccount.fromData(account) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: AuthParams.Data }>(`/cosmos/auth/v1beta1/params`, params) - .then(({ params: d }) => AuthParams.fromData(d)); + .then(({ params: d }) => AuthParams.fromData(d)) } } diff --git a/src/client/lcd/api/AuthzAPI.ts b/src/client/lcd/api/AuthzAPI.ts index ba0ce22..a2b65ae 100644 --- a/src/client/lcd/api/AuthzAPI.ts +++ b/src/client/lcd/api/AuthzAPI.ts @@ -1,6 +1,6 @@ -import { AccAddress, AuthorizationGrant } from '../../../core'; -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination } from '../APIRequester'; +import { AccAddress, AuthorizationGrant } from '../../../core' +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination } from '../APIRequester' export class AuthzAPI extends BaseAPI { /** @@ -24,7 +24,7 @@ export class AuthzAPI extends BaseAPI { params ) ) - .then(d => [d.grants.map(AuthorizationGrant.fromData), d.pagination]); + .then((d) => [d.grants.map(AuthorizationGrant.fromData), d.pagination]) } /** @@ -35,14 +35,14 @@ export class AuthzAPI extends BaseAPI { params: APIParams = {} ): Promise<[AuthorizationGrant[], Pagination]> { return this.c - .get<{ grants: AuthorizationGrant.Data[]; pagination: Pagination }>( - `/cosmos/authz/v1beta1/grants/granter/${granter}`, - params - ) - .then(d => [ - d.grants.map(g => AuthorizationGrant.fromData(g)), + .get<{ + grants: AuthorizationGrant.Data[] + pagination: Pagination + }>(`/cosmos/authz/v1beta1/grants/granter/${granter}`, params) + .then((d) => [ + d.grants.map((g) => AuthorizationGrant.fromData(g)), d.pagination, - ]); + ]) } /** @@ -53,13 +53,13 @@ export class AuthzAPI extends BaseAPI { params: APIParams = {} ): Promise<[AuthorizationGrant[], Pagination]> { return this.c - .get<{ grants: AuthorizationGrant.Data[]; pagination: Pagination }>( - `/cosmos/authz/v1beta1/grants/grantee/${grantee}`, - params - ) - .then(d => [ - d.grants.map(g => AuthorizationGrant.fromData(g)), + .get<{ + grants: AuthorizationGrant.Data[] + pagination: Pagination + }>(`/cosmos/authz/v1beta1/grants/grantee/${grantee}`, params) + .then((d) => [ + d.grants.map((g) => AuthorizationGrant.fromData(g)), d.pagination, - ]); + ]) } } diff --git a/src/client/lcd/api/BankAPI.spec.ts b/src/client/lcd/api/BankAPI.spec.ts index 088b9ff..c41cede 100644 --- a/src/client/lcd/api/BankAPI.spec.ts +++ b/src/client/lcd/api/BankAPI.spec.ts @@ -1,30 +1,30 @@ -import { APIRequester } from '../APIRequester'; -import { BankAPI } from './BankAPI'; +import { APIRequester } from '../APIRequester' +import { BankAPI } from './BankAPI' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const bank = new BankAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const bank = new BankAPI(c) describe('BankAPI', () => { describe('balance', () => { it('account exists', async () => { - await bank.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs'); - }); + await bank.balance('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') + }) it('invalid account', async () => { - await expect(bank.balance('1234')).rejects.toThrow(); - }); - }); + await expect(bank.balance('1234')).rejects.toThrow() + }) + }) it('total supply', async () => { - const totalSupply = await bank.total(); - expect(totalSupply[0].toArray().length).toBeGreaterThan(0); - }); + const totalSupply = await bank.total() + expect(totalSupply[0].toArray().length).toBeGreaterThan(0) + }) describe('parameters', () => { it('parameters', async () => { - const param = await bank.parameters(); + const param = await bank.parameters() - expect(param.default_send_enabled).toBeDefined(); - }); - }); -}); + expect(param.default_send_enabled).toBeDefined() + }) + }) +}) diff --git a/src/client/lcd/api/BankAPI.ts b/src/client/lcd/api/BankAPI.ts index a515a52..155e0e8 100644 --- a/src/client/lcd/api/BankAPI.ts +++ b/src/client/lcd/api/BankAPI.ts @@ -1,6 +1,6 @@ -import { BaseAPI } from './BaseAPI'; -import { Coins, Coin, AccAddress, BankParams, Denom } from '../../../core'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { Coins, Coin, AccAddress, BankParams, Denom } from '../../../core' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class BankAPI extends BaseAPI { /** @@ -13,10 +13,10 @@ export class BankAPI extends BaseAPI { ): Promise<[Coins, Pagination]> { return this.c .get<{ - balances: Coins.Data; - pagination: Pagination; + balances: Coins.Data + pagination: Pagination }>(`/cosmos/bank/v1beta1/balances/${address}`, params) - .then(d => [Coins.fromData(d.balances), d.pagination]); + .then((d) => [Coins.fromData(d.balances), d.pagination]) } /** @@ -30,11 +30,13 @@ export class BankAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ balance: Coin.Data }>( - `/cosmos/bank/v1beta1/balances/${address}/by_denom`, - { ...params, denom } - ) - .then(d => Coin.fromData(d.balance)); + .get<{ + balance: Coin.Data + }>(`/cosmos/bank/v1beta1/balances/${address}/by_denom`, { + ...params, + denom, + }) + .then((d) => Coin.fromData(d.balance)) } /** @@ -44,11 +46,11 @@ export class BankAPI extends BaseAPI { params: Partial = {} ): Promise<[Coins, Pagination]> { return this.c - .get<{ supply: Coins.Data; pagination: Pagination }>( - `/cosmos/bank/v1beta1/supply`, - params - ) - .then(d => [Coins.fromData(d.supply), d.pagination]); + .get<{ + supply: Coins.Data + pagination: Pagination + }>(`/cosmos/bank/v1beta1/supply`, params) + .then((d) => [Coins.fromData(d.supply), d.pagination]) } /** @@ -61,15 +63,15 @@ export class BankAPI extends BaseAPI { ): Promise<[Coins, Pagination]> { return this.c .get<{ - balances: Coins.Data; - pagination: Pagination; + balances: Coins.Data + pagination: Pagination }>(`/cosmos/bank/v1beta1/spendable_balances/${address}`, params) - .then(d => [Coins.fromData(d.balances), d.pagination]); + .then((d) => [Coins.fromData(d.balances), d.pagination]) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: BankParams.Data }>(`/cosmos/bank/v1beta1/params`, params) - .then(({ params: d }) => BankParams.fromData(d)); + .then(({ params: d }) => BankParams.fromData(d)) } } diff --git a/src/client/lcd/api/BaseAPI.ts b/src/client/lcd/api/BaseAPI.ts index 4649f22..6ca599f 100644 --- a/src/client/lcd/api/BaseAPI.ts +++ b/src/client/lcd/api/BaseAPI.ts @@ -1,4 +1,4 @@ -import { APIRequester } from '../APIRequester'; +import { APIRequester } from '../APIRequester' export abstract class BaseAPI { constructor(protected c: APIRequester) {} diff --git a/src/client/lcd/api/DistributionAPI.spec.ts b/src/client/lcd/api/DistributionAPI.spec.ts index b36d606..24d1e53 100644 --- a/src/client/lcd/api/DistributionAPI.spec.ts +++ b/src/client/lcd/api/DistributionAPI.spec.ts @@ -1,9 +1,9 @@ -import { APIRequester } from '../APIRequester'; -import { DistributionAPI } from './DistributionAPI'; -import { Coins } from '../../../core'; +import { APIRequester } from '../APIRequester' +import { DistributionAPI } from './DistributionAPI' +import { Coins } from '../../../core' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const distribution = new DistributionAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const distribution = new DistributionAPI(c) describe('DistributionAPI', () => { it('parameters', async () => { @@ -16,20 +16,20 @@ describe('DistributionAPI', () => { weight: expect.any(String), }), ]), - }); - }); + }) + }) it('withdrawAddress', async () => { await expect( distribution.withdrawAddress( 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs' ) - ).resolves.toEqual('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs'); - }); + ).resolves.toEqual('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') + }) it('communityPool', async () => { await expect(distribution.communityPool()).resolves.toEqual( expect.any(Coins) - ); - }); -}); + ) + }) +}) diff --git a/src/client/lcd/api/DistributionAPI.ts b/src/client/lcd/api/DistributionAPI.ts index 433520f..3bd8132 100644 --- a/src/client/lcd/api/DistributionAPI.ts +++ b/src/client/lcd/api/DistributionAPI.ts @@ -1,21 +1,21 @@ -import { BaseAPI } from './BaseAPI'; +import { BaseAPI } from './BaseAPI' import { Coins, AccAddress, ValAddress, DistributionParams, -} from '../../../core'; -import { APIParams } from '../APIRequester'; +} from '../../../core' +import { APIParams } from '../APIRequester' export interface Pool { - denom: string; - coins: Coins; + denom: string + coins: Coins } export namespace Pool { export interface Data { - denom: string; - dec_coins: Coins.Data; + denom: string + dec_coins: Coins.Data } } @@ -26,23 +26,21 @@ export interface Rewards { /** * An object that maps validator addresses to corresponding rewards earned with that validator */ - rewards: { - [validator: string]: Pool[]; - }; + rewards: Record /** * Total cumulative rewards across delegations with all validators */ - total: Pool[]; + total: Pool[] } export namespace Rewards { export interface Data { rewards: { - validator_address: ValAddress; - reward: Pool.Data[]; - }[]; - total: Pool.Data[]; + validator_address: ValAddress + reward: Pool.Data[] + }[] + total: Pool.Data[] } } @@ -58,22 +56,22 @@ export class DistributionAPI extends BaseAPI { const rewardsData = await this.c.get( `/initia/distribution/v1/delegators/${delegator}/rewards`, params - ); + ) - const rewards: Rewards['rewards'] = {}; + const rewards: Rewards['rewards'] = {} for (const reward of rewardsData.rewards) { - rewards[reward.validator_address] = reward.reward.map(pool => ({ + rewards[reward.validator_address] = reward.reward.map((pool) => ({ denom: pool.denom, coins: Coins.fromData(pool.dec_coins), - })); + })) } return { rewards, - total: rewardsData.total.map(pool => ({ + total: rewardsData.total.map((pool) => ({ denom: pool.denom, coins: Coins.fromData(pool.dec_coins), })), - }; + } } /** @@ -87,16 +85,18 @@ export class DistributionAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ rewards: Pool.Data[] }>( + .get<{ + rewards: Pool.Data[] + }>( `/initia/distribution/v1/delegators/${delegator}/rewards/${validator}`, params ) - .then(d => - d.rewards.map(pool => ({ + .then((d) => + d.rewards.map((pool) => ({ denom: pool.denom, coins: Coins.fromData(pool.dec_coins), })) - ); + ) } /** @@ -109,17 +109,17 @@ export class DistributionAPI extends BaseAPI { ): Promise { return this.c .get<{ - rewards: { rewards: Pool.Data[] }; + rewards: { rewards: Pool.Data[] } }>( `/initia/distribution/v1/validators/${validator}/outstanding_rewards`, params ) - .then(d => - d.rewards.rewards.map(pool => ({ + .then((d) => + d.rewards.rewards.map((pool) => ({ denom: pool.denom, coins: Coins.fromData(pool.dec_coins), })) - ); + ) } /** @@ -133,15 +133,15 @@ export class DistributionAPI extends BaseAPI { return this.c .get<{ commission: { - commissions: Pool.Data[]; - }; + commissions: Pool.Data[] + } }>(`/initia/distribution/v1/validators/${validator}/commission`, params) - .then(d => - d.commission.commissions.map(pool => ({ + .then((d) => + d.commission.commissions.map((pool) => ({ denom: pool.denom, coins: Coins.fromData(pool.dec_coins), })) - ); + ) } /** @@ -153,11 +153,13 @@ export class DistributionAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ withdraw_address: AccAddress }>( + .get<{ + withdraw_address: AccAddress + }>( `/cosmos/distribution/v1beta1/delegators/${delegator}/withdraw_address`, params ) - .then(d => d.withdraw_address); + .then((d) => d.withdraw_address) } /** @@ -165,11 +167,10 @@ export class DistributionAPI extends BaseAPI { */ public async communityPool(params: APIParams = {}): Promise { return this.c - .get<{ pool: Coins.Data }>( - `/cosmos/distribution/v1beta1/community_pool`, - params - ) - .then(d => Coins.fromData(d.pool)); + .get<{ + pool: Coins.Data + }>(`/cosmos/distribution/v1beta1/community_pool`, params) + .then((d) => Coins.fromData(d.pool)) } /** @@ -177,10 +178,9 @@ export class DistributionAPI extends BaseAPI { */ public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: DistributionParams.Data }>( - `/initia/distribution/v1/params`, - params - ) - .then(({ params: d }) => DistributionParams.fromData(d)); + .get<{ + params: DistributionParams.Data + }>(`/initia/distribution/v1/params`, params) + .then(({ params: d }) => DistributionParams.fromData(d)) } } diff --git a/src/client/lcd/api/EvidenceAPI.ts b/src/client/lcd/api/EvidenceAPI.ts index c58a932..5683017 100644 --- a/src/client/lcd/api/EvidenceAPI.ts +++ b/src/client/lcd/api/EvidenceAPI.ts @@ -1,6 +1,6 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { Evidence } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { Evidence } from '../../../core' export class EvidenceAPI extends BaseAPI { public async evidences( @@ -8,10 +8,10 @@ export class EvidenceAPI extends BaseAPI { ): Promise<[Evidence[], Pagination]> { return this.c .get<{ - evidence: Evidence.Data[]; - pagination: Pagination; + evidence: Evidence.Data[] + pagination: Pagination }>(`/cosmos/evidence/v1beta1/evidence`, params) - .then(d => [d.evidence.map(Evidence.fromData), d.pagination]); + .then((d) => [d.evidence.map(Evidence.fromData), d.pagination]) } public async evidence( @@ -19,10 +19,9 @@ export class EvidenceAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ evidence: Evidence.Data }>( - `/cosmos/evidence/v1beta1/evidence/${hash}`, - params - ) - .then(d => Evidence.fromData(d.evidence)); + .get<{ + evidence: Evidence.Data + }>(`/cosmos/evidence/v1beta1/evidence/${hash}`, params) + .then((d) => Evidence.fromData(d.evidence)) } } diff --git a/src/client/lcd/api/EvmAPI.ts b/src/client/lcd/api/EvmAPI.ts index b895c56..0440e9f 100644 --- a/src/client/lcd/api/EvmAPI.ts +++ b/src/client/lcd/api/EvmAPI.ts @@ -1,16 +1,16 @@ -import { AccAddress, EvmParams } from '../../../core'; -import { APIParams } from '../APIRequester'; -import { BaseAPI } from './BaseAPI'; +import { AccAddress, EvmParams } from '../../../core' +import { APIParams } from '../APIRequester' +import { BaseAPI } from './BaseAPI' export interface CallResponse { - response: string; - used_gas: string; + response: string + used_gas: string logs: { - address: AccAddress; - topics: string[]; - data: string; - }[]; - trace_output: string; + address: AccAddress + topics: string[] + data: string + }[] + trace_output: string } export class EvmAPI extends BaseAPI { @@ -20,7 +20,7 @@ export class EvmAPI extends BaseAPI { ): Promise { return this.c .get<{ code: string }>(`/minievm/evm/v1/codes/${contractAddr}`, params) - .then(d => d.code); + .then((d) => d.code) } public async state( @@ -29,11 +29,10 @@ export class EvmAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ value: string }>( - `/minievm/evm/v1/states/${contractAddr}/${key}`, - params - ) - .then(d => d.value); + .get<{ + value: string + }>(`/minievm/evm/v1/states/${contractAddr}/${key}`, params) + .then((d) => d.value) } public async contractAddrByDenom( @@ -45,7 +44,7 @@ export class EvmAPI extends BaseAPI { ...params, denom, }) - .then(d => d.address); + .then((d) => d.address) } public async denom( @@ -54,7 +53,7 @@ export class EvmAPI extends BaseAPI { ): Promise { return this.c .get<{ denom: string }>(`/minievm/evm/v1/denoms/${contractAddr}`, params) - .then(d => d.denom); + .then((d) => d.denom) } public async call( @@ -68,12 +67,12 @@ export class EvmAPI extends BaseAPI { contract_addr: contractAddr, input, with_trace: withTrace, - }); + }) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: EvmParams.Data }>(`/minievm/evm/v1/params`, params) - .then(({ params: d }) => EvmParams.fromData(d)); + .then(({ params: d }) => EvmParams.fromData(d)) } } diff --git a/src/client/lcd/api/FeeGrantAPI.spec.ts b/src/client/lcd/api/FeeGrantAPI.spec.ts index 4df6660..108e376 100644 --- a/src/client/lcd/api/FeeGrantAPI.spec.ts +++ b/src/client/lcd/api/FeeGrantAPI.spec.ts @@ -16,7 +16,7 @@ describe('FeeGrantAPI', () => { // const allowanceData = res.allowances[0].allowance.toData(); // expect(allowanceData['@type']).toMatch(/cosmos.feegrant.v1beta1/g); // expect(res.pagination).not.toBeUndefined(); - }); + }) // describe('allowance', () => { // it('allowance exist', async () => { @@ -51,4 +51,4 @@ describe('FeeGrantAPI', () => { // expect(allowanceData['@type']).toMatch(/cosmos.feegrant.v1beta1/g); // expect(res.pagination).not.toBeUndefined(); // }); -}); +}) diff --git a/src/client/lcd/api/FeeGrantAPI.ts b/src/client/lcd/api/FeeGrantAPI.ts index 9974715..5ffdbaf 100644 --- a/src/client/lcd/api/FeeGrantAPI.ts +++ b/src/client/lcd/api/FeeGrantAPI.ts @@ -1,6 +1,6 @@ -import { AccAddress, Allowance } from '../../../core'; -import { BaseAPI } from './BaseAPI'; -import { Pagination, PaginationOptions } from '../APIRequester'; +import { AccAddress, Allowance } from '../../../core' +import { BaseAPI } from './BaseAPI' +import { Pagination, PaginationOptions } from '../APIRequester' export class FeeGrantAPI extends BaseAPI { public async allowances( @@ -8,29 +8,29 @@ export class FeeGrantAPI extends BaseAPI { params: Partial = {} ): Promise<{ allowances: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance; - }[]; - pagination: Pagination; + granter: AccAddress + grantee: AccAddress + allowance: Allowance + }[] + pagination: Pagination }> { return this.c .get<{ allowances: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance.Data; - }[]; - pagination: Pagination; + granter: AccAddress + grantee: AccAddress + allowance: Allowance.Data + }[] + pagination: Pagination }>(`/cosmos/feegrant/v1beta1/allowances/${grantee}`, params) - .then(d => ({ - allowances: d.allowances.map(allowance => ({ + .then((d) => ({ + allowances: d.allowances.map((allowance) => ({ granter: allowance.granter, grantee: allowance.grantee, allowance: Allowance.fromData(allowance.allowance), })), pagination: d.pagination, - })); + })) } public async allowance( @@ -40,12 +40,12 @@ export class FeeGrantAPI extends BaseAPI { return this.c .get<{ allowance: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance.Data; - }; + granter: AccAddress + grantee: AccAddress + allowance: Allowance.Data + } }>(`/cosmos/feegrant/v1beta1/allowance/${granter}/${grantee}`) - .then(d => Allowance.fromData(d.allowance.allowance)); + .then((d) => Allowance.fromData(d.allowance.allowance)) } public async allowancesByGranter( @@ -53,28 +53,28 @@ export class FeeGrantAPI extends BaseAPI { params: Partial = {} ): Promise<{ allowances: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance; - }[]; - pagination: Pagination; + granter: AccAddress + grantee: AccAddress + allowance: Allowance + }[] + pagination: Pagination }> { return this.c .get<{ allowances: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance.Data; - }[]; - pagination: Pagination; + granter: AccAddress + grantee: AccAddress + allowance: Allowance.Data + }[] + pagination: Pagination }>(`/cosmos/feegrant/v1beta1/issued/${granter}`, params) - .then(d => ({ - allowances: d.allowances.map(allowance => ({ + .then((d) => ({ + allowances: d.allowances.map((allowance) => ({ granter: allowance.granter, grantee: allowance.grantee, allowance: Allowance.fromData(allowance.allowance), })), pagination: d.pagination, - })); + })) } } diff --git a/src/client/lcd/api/ForwardingAPI.ts b/src/client/lcd/api/ForwardingAPI.ts index 20f5712..a4c0620 100644 --- a/src/client/lcd/api/ForwardingAPI.ts +++ b/src/client/lcd/api/ForwardingAPI.ts @@ -1,18 +1,18 @@ -import { AccAddress, Coin } from '../../../core'; -import { APIParams } from '../APIRequester'; -import { BaseAPI } from './BaseAPI'; +import { AccAddress, Coin } from '../../../core' +import { APIParams } from '../APIRequester' +import { BaseAPI } from './BaseAPI' export interface ForwardingStats { - num_of_accounts: number; - num_of_forwards: number; - total_forwarded: Coin; + num_of_accounts: number + num_of_forwards: number + total_forwarded: Coin } export namespace ForwardingStats { export interface Data { - num_of_accounts: string; - num_of_forwards: string; - total_forwarded: Coin.Data; + num_of_accounts: string + num_of_forwards: string + total_forwarded: Coin.Data } } @@ -23,11 +23,10 @@ export class ForwardingAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ address: AccAddress }>( - `/noble/forwarding/v1/address/${channel}/${recipient}`, - params - ) - .then(d => d.address); + .get<{ + address: AccAddress + }>(`/noble/forwarding/v1/address/${channel}/${recipient}`, params) + .then((d) => d.address) } public async stats( @@ -39,10 +38,10 @@ export class ForwardingAPI extends BaseAPI { `/noble/forwarding/v1/stats/${channel}`, params ) - .then(d => ({ + .then((d) => ({ num_of_accounts: parseInt(d.num_of_accounts), num_of_forwards: parseInt(d.num_of_forwards), total_forwarded: Coin.fromData(d.total_forwarded), - })); + })) } } diff --git a/src/client/lcd/api/GovAPI.spec.ts b/src/client/lcd/api/GovAPI.spec.ts index c8163f6..0d1613b 100644 --- a/src/client/lcd/api/GovAPI.spec.ts +++ b/src/client/lcd/api/GovAPI.spec.ts @@ -1,9 +1,9 @@ -import { APIRequester } from '../APIRequester'; -import { GovAPI } from './GovAPI'; -import { Coins } from '../../../core'; +import { APIRequester } from '../APIRequester' +import { GovAPI } from './GovAPI' +import { Coins } from '../../../core' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const gov = new GovAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const gov = new GovAPI(c) describe('GovAPI', () => { it('parameters', async () => { @@ -20,8 +20,8 @@ describe('GovAPI', () => { threshold: expect.any(String), veto_threshold: expect.any(String), }, - }); - }); + }) + }) // it('tally', async () => { // await expect(gov.tally(5333)).resolves.toMatchObject({ @@ -63,4 +63,4 @@ describe('GovAPI', () => { // expect(deposits).toEqual(expect.any(Deposit)); // } // }); -}); +}) diff --git a/src/client/lcd/api/GovAPI.ts b/src/client/lcd/api/GovAPI.ts index 9762c1d..e09d46f 100644 --- a/src/client/lcd/api/GovAPI.ts +++ b/src/client/lcd/api/GovAPI.ts @@ -1,6 +1,6 @@ -import { BaseAPI } from './BaseAPI'; -import { Proposal, Deposit, Vote, GovParams } from '../../../core'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { Proposal, Deposit, Vote, GovParams } from '../../../core' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class GovAPI extends BaseAPI { /** @@ -11,10 +11,10 @@ export class GovAPI extends BaseAPI { ): Promise<[Proposal[], Pagination]> { return this.c .get<{ - proposals: Proposal.Data[]; - pagination: Pagination; + proposals: Proposal.Data[] + pagination: Pagination }>(`/initia/gov/v1/proposals`, params) - .then(d => [d.proposals.map(Proposal.fromData), d.pagination]); + .then((d) => [d.proposals.map(Proposal.fromData), d.pagination]) } /** @@ -26,11 +26,10 @@ export class GovAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ proposal: Proposal.Data }>( - `/initia/gov/v1/proposals/${proposalId}`, - params - ) - .then(d => Proposal.fromData(d.proposal)); + .get<{ + proposal: Proposal.Data + }>(`/initia/gov/v1/proposals/${proposalId}`, params) + .then((d) => Proposal.fromData(d.proposal)) } /** @@ -42,14 +41,14 @@ export class GovAPI extends BaseAPI { _params: Partial = {} ): Promise<[Deposit[], Pagination]> { return this.c - .get<{ deposits: Deposit.Data[]; pagination: Pagination }>( - `/cosmos/gov/v1/proposals/${proposalId}/deposits`, - _params - ) - .then(d => [ - d.deposits.map(deposit => Deposit.fromData(deposit)), + .get<{ + deposits: Deposit.Data[] + pagination: Pagination + }>(`/cosmos/gov/v1/proposals/${proposalId}/deposits`, _params) + .then((d) => [ + d.deposits.map((deposit) => Deposit.fromData(deposit)), d.pagination, - ]); + ]) } /** @@ -61,11 +60,11 @@ export class GovAPI extends BaseAPI { _params: Partial = {} ): Promise<[Vote[], Pagination]> { return this.c - .get<{ votes: Vote.Data[]; pagination: Pagination }>( - `/cosmos/gov/v1/proposals/${proposalId}/votes`, - _params - ) - .then(d => [d.votes.map(v => Vote.fromData(v)), d.pagination]); + .get<{ + votes: Vote.Data[] + pagination: Pagination + }>(`/cosmos/gov/v1/proposals/${proposalId}/votes`, _params) + .then((d) => [d.votes.map((v) => Vote.fromData(v)), d.pagination]) } /** @@ -77,18 +76,17 @@ export class GovAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ tally: Proposal.FinalTallyResult }>( - `/cosmos/gov/v1/proposals/${proposalId}/tally`, - params - ) - .then(d => d.tally); + .get<{ + tally: Proposal.FinalTallyResult + }>(`/cosmos/gov/v1/proposals/${proposalId}/tally`, params) + .then((d) => d.tally) } /** Gets the Gov module's current parameters */ public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: GovParams.Data }>(`/initia/gov/v1/params`, params) - .then(d => GovParams.fromData(d.params)); + .then((d) => GovParams.fromData(d.params)) } public async emergencyProposals( @@ -96,12 +94,12 @@ export class GovAPI extends BaseAPI { ): Promise<[Proposal[], Pagination]> { return this.c .get<{ - proposals: Proposal.Data[]; - pagination: Pagination; + proposals: Proposal.Data[] + pagination: Pagination }>(`/initia/gov/v1/emergency_proposals`, params) - .then(d => [ - d.proposals.map(prop => Proposal.fromData(prop)), + .then((d) => [ + d.proposals.map((prop) => Proposal.fromData(prop)), d.pagination, - ]); + ]) } } diff --git a/src/client/lcd/api/GroupAPI.ts b/src/client/lcd/api/GroupAPI.ts index c2b2139..4909533 100644 --- a/src/client/lcd/api/GroupAPI.ts +++ b/src/client/lcd/api/GroupAPI.ts @@ -1,4 +1,4 @@ -import { BaseAPI } from './BaseAPI'; +import { BaseAPI } from './BaseAPI' import { AccAddress, GroupInfo, @@ -6,22 +6,22 @@ import { GroupPolicyInfo, GroupProposal, GroupVote, -} from '../../../core'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +} from '../../../core' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export class GroupAPI extends BaseAPI { public async groupInfo(groupId: number): Promise { return this.c .get<{ info: GroupInfo.Data }>(`/cosmos/group/v1/group_info/${groupId}`) - .then(d => GroupInfo.fromData(d.info)); + .then((d) => GroupInfo.fromData(d.info)) } public async groupPolicyInfo(address: AccAddress): Promise { return this.c - .get<{ info: GroupPolicyInfo.Data }>( - `/cosmos/group/v1/group_policy_info/${address}` - ) - .then(d => GroupPolicyInfo.fromData(d.info)); + .get<{ + info: GroupPolicyInfo.Data + }>(`/cosmos/group/v1/group_policy_info/${address}`) + .then((d) => GroupPolicyInfo.fromData(d.info)) } public async groupMembers( @@ -30,10 +30,10 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupMember[], Pagination]> { return this.c .get<{ - members: GroupMember.Data[]; - pagination: Pagination; + members: GroupMember.Data[] + pagination: Pagination }>(`/cosmos/group/v1/group_members/${groupId}`, params) - .then(d => [d.members.map(GroupMember.fromData), d.pagination]); + .then((d) => [d.members.map(GroupMember.fromData), d.pagination]) } public async groupsByAdmin( @@ -42,10 +42,10 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupInfo[], Pagination]> { return this.c .get<{ - groups: GroupInfo.Data[]; - pagination: Pagination; + groups: GroupInfo.Data[] + pagination: Pagination }>(`/cosmos/group/v1/groups_by_admin/${admin}`, params) - .then(d => [d.groups.map(GroupInfo.fromData), d.pagination]); + .then((d) => [d.groups.map(GroupInfo.fromData), d.pagination]) } public async groupPoliciesByGroup( @@ -54,13 +54,13 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupPolicyInfo[], Pagination]> { return this.c .get<{ - group_policies: GroupPolicyInfo.Data[]; - pagination: Pagination; + group_policies: GroupPolicyInfo.Data[] + pagination: Pagination }>(`/cosmos/group/v1/group_policies_by_group/${groupId}`, params) - .then(d => [ + .then((d) => [ d.group_policies.map(GroupPolicyInfo.fromData), d.pagination, - ]); + ]) } public async groupPoliciesByAdmin( @@ -69,21 +69,21 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupPolicyInfo[], Pagination]> { return this.c .get<{ - group_policies: GroupPolicyInfo.Data[]; - pagination: Pagination; + group_policies: GroupPolicyInfo.Data[] + pagination: Pagination }>(`/cosmos/group/v1/group_policies_by_admin/${admin}`, params) - .then(d => [ + .then((d) => [ d.group_policies.map(GroupPolicyInfo.fromData), d.pagination, - ]); + ]) } public async proposal(proposalId: number): Promise { return this.c - .get<{ proposal: GroupProposal.Data }>( - `/cosmos/group/v1/proposal/${proposalId}` - ) - .then(d => GroupProposal.fromData(d.proposal)); + .get<{ + proposal: GroupProposal.Data + }>(`/cosmos/group/v1/proposal/${proposalId}`) + .then((d) => GroupProposal.fromData(d.proposal)) } public async proposalsByGroupPolicy( @@ -92,10 +92,10 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupProposal[], Pagination]> { return this.c .get<{ - proposals: GroupProposal.Data[]; - pagination: Pagination; + proposals: GroupProposal.Data[] + pagination: Pagination }>(`/cosmos/group/v1/proposals_by_group_policy/${address}`, params) - .then(d => [d.proposals.map(GroupProposal.fromData), d.pagination]); + .then((d) => [d.proposals.map(GroupProposal.fromData), d.pagination]) } public async voteByProposalVoter( @@ -103,10 +103,10 @@ export class GroupAPI extends BaseAPI { voter: AccAddress ): Promise { return this.c - .get<{ vote: GroupVote.Data }>( - `/cosmos/group/v1/vote_by_proposal_voter/${proposalId}/${voter}` - ) - .then(d => GroupVote.fromData(d.vote)); + .get<{ + vote: GroupVote.Data + }>(`/cosmos/group/v1/vote_by_proposal_voter/${proposalId}/${voter}`) + .then((d) => GroupVote.fromData(d.vote)) } public async votesByProposal( @@ -115,10 +115,10 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupVote[], Pagination]> { return this.c .get<{ - votes: GroupVote.Data[]; - pagination: Pagination; + votes: GroupVote.Data[] + pagination: Pagination }>(`/cosmos/group/v1/votes_by_proposal/${proposalId}`, params) - .then(d => [d.votes.map(GroupVote.fromData), d.pagination]); + .then((d) => [d.votes.map(GroupVote.fromData), d.pagination]) } public async votesByVoter( @@ -127,10 +127,10 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupVote[], Pagination]> { return this.c .get<{ - votes: GroupVote.Data[]; - pagination: Pagination; + votes: GroupVote.Data[] + pagination: Pagination }>(`/cosmos/group/v1/votes_by_voter/${voter}`, params) - .then(d => [d.votes.map(GroupVote.fromData), d.pagination]); + .then((d) => [d.votes.map(GroupVote.fromData), d.pagination]) } public async groupsByMember( @@ -139,20 +139,20 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupInfo[], Pagination]> { return this.c .get<{ - groups: GroupInfo.Data[]; - pagination: Pagination; + groups: GroupInfo.Data[] + pagination: Pagination }>(`/cosmos/group/v1/groups_by_member/${address}`, params) - .then(d => [d.groups.map(GroupInfo.fromData), d.pagination]); + .then((d) => [d.groups.map(GroupInfo.fromData), d.pagination]) } public async tally( proposalId: number ): Promise { return this.c - .get<{ tally: GroupProposal.FinalTallyResult }>( - `/cosmos/group/v1/proposals/${proposalId}/tally` - ) - .then(d => d.tally); + .get<{ + tally: GroupProposal.FinalTallyResult + }>(`/cosmos/group/v1/proposals/${proposalId}/tally`) + .then((d) => d.tally) } public async groups( @@ -160,9 +160,9 @@ export class GroupAPI extends BaseAPI { ): Promise<[GroupInfo[], Pagination]> { return this.c .get<{ - groups: GroupInfo.Data[]; - pagination: Pagination; + groups: GroupInfo.Data[] + pagination: Pagination }>(`/cosmos/group/v1/groups`, params) - .then(d => [d.groups.map(GroupInfo.fromData), d.pagination]); + .then((d) => [d.groups.map(GroupInfo.fromData), d.pagination]) } } diff --git a/src/client/lcd/api/IbcAPI.spec.ts b/src/client/lcd/api/IbcAPI.spec.ts index 1fd7583..3f1975c 100644 --- a/src/client/lcd/api/IbcAPI.spec.ts +++ b/src/client/lcd/api/IbcAPI.spec.ts @@ -1,21 +1,21 @@ -import { APIRequester } from '../APIRequester'; -import { IbcAPI } from './IbcAPI'; +import { APIRequester } from '../APIRequester' +import { IbcAPI } from './IbcAPI' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const ibc = new IbcAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const ibc = new IbcAPI(c) describe('IbcClientAPI', () => { it('params', async () => { - const param = await ibc.parameters(); - expect(param.allowed_clients).not.toBeNull(); - expect(param.allowed_clients).not.toBeUndefined(); - }); + const param = await ibc.parameters() + expect(param.allowed_clients).not.toBeNull() + expect(param.allowed_clients).not.toBeUndefined() + }) it('client_states', async () => { - const res = await ibc.clientStates(); - expect(res).not.toBeNull(); - expect(res).not.toBeUndefined(); - }); + const res = await ibc.clientStates() + expect(res).not.toBeNull() + expect(res).not.toBeUndefined() + }) // it('client_state', async () => { // const res = await ibc.clientState('07-tendermint-0'); @@ -30,10 +30,10 @@ describe('IbcClientAPI', () => { // }); it('consensus_states', async () => { - const res = await ibc.consensusStates('07-tendermint-0'); - expect(res).not.toBeNull(); - expect(res).not.toBeUndefined(); - }); + const res = await ibc.consensusStates('07-tendermint-0') + expect(res).not.toBeNull() + expect(res).not.toBeUndefined() + }) // it('channels', async () => { // const [res, _] = await ibc.channels(); @@ -72,4 +72,4 @@ describe('IbcClientAPI', () => { // expect(res).not.toBeNull(); // expect(res).not.toBeUndefined(); // }); -}); +}) diff --git a/src/client/lcd/api/IbcAPI.ts b/src/client/lcd/api/IbcAPI.ts index 55fa60c..1b57793 100644 --- a/src/client/lcd/api/IbcAPI.ts +++ b/src/client/lcd/api/IbcAPI.ts @@ -1,5 +1,5 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { IdentifiedClientState, ClientConsensusStates, @@ -7,33 +7,33 @@ import { IdentifiedConnection, Height, IbcClientParams, -} from '../../../core'; +} from '../../../core' export interface ClientState { - client_state: any; - proof: string | null; - proof_height: Height; + client_state: any + proof: string | null + proof_height: Height } export namespace ClientState { export interface Data { - client_state: any; - proof: string | null; - proof_height: Height.Data; + client_state: any + proof: string | null + proof_height: Height.Data } } export interface Port { - channel: Channel; - proof: string; - proof_height: Height; + channel: Channel + proof: string + proof_height: Height } export namespace Port { export interface Data { - channel: Channel.Data; - proof: string; - proof_height: Height.Data; + channel: Channel.Data + proof: string + proof_height: Height.Data } } @@ -46,10 +46,10 @@ export class IbcAPI extends BaseAPI { ): Promise<[Channel[], Pagination]> { return this.c .get<{ - channels: Channel.Data[]; - pagination: Pagination; + channels: Channel.Data[] + pagination: Pagination }>(`/ibc/core/channel/v1/channels`, params) - .then(d => [d.channels.map(Channel.fromData), d.pagination]); + .then((d) => [d.channels.map(Channel.fromData), d.pagination]) } /** @@ -64,17 +64,17 @@ export class IbcAPI extends BaseAPI { ): Promise { return this.c .get<{ - channel: Channel.Data; - proof: string; - proof_height: Height.Data; + channel: Channel.Data + proof: string + proof_height: Height.Data }>(`/ibc/core/channel/v1/channels/${channel_id}/ports/${port_id}`, params) - .then(d => { + .then((d) => { return { channel: Channel.fromData(d.channel), proof: d.proof, proof_height: Height.fromData(d.proof_height), - }; - }); + } + }) } /** @@ -85,13 +85,13 @@ export class IbcAPI extends BaseAPI { ): Promise<[IdentifiedConnection[], Pagination]> { return this.c .get<{ - connections: IdentifiedConnection.Data[]; - pagination: Pagination; + connections: IdentifiedConnection.Data[] + pagination: Pagination }>(`/ibc/core/connection/v1/connections`, params) - .then(d => [ + .then((d) => [ d.connections.map(IdentifiedConnection.fromData), d.pagination, - ]); + ]) } /** @@ -104,9 +104,9 @@ export class IbcAPI extends BaseAPI { ): Promise { return this.c .get<{ - connection: IdentifiedConnection.Data; + connection: IdentifiedConnection.Data }>(`/ibc/core/connection/v1/connections/${connection_id}`, params) - .then(d => IdentifiedConnection.fromData(d.connection)); + .then((d) => IdentifiedConnection.fromData(d.connection)) } /** @@ -119,15 +119,15 @@ export class IbcAPI extends BaseAPI { ): Promise<[Channel[], Height, Pagination]> { return this.c .get<{ - channels: Channel.Data[]; - pagination: Pagination; - height: Height.Data; + channels: Channel.Data[] + pagination: Pagination + height: Height.Data }>(`/ibc/core/channel/v1/connections/${connection_id}/channels`, params) - .then(d => [ + .then((d) => [ d.channels.map(Channel.fromData), Height.fromData(d.height), d.pagination, - ]); + ]) } /** @@ -136,7 +136,7 @@ export class IbcAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: IbcClientParams.Data }>(`/ibc/client/v1/params`, params) - .then(d => IbcClientParams.fromData(d.params)); + .then((d) => IbcClientParams.fromData(d.params)) } /** @@ -147,13 +147,13 @@ export class IbcAPI extends BaseAPI { ): Promise<[IdentifiedClientState[], Pagination]> { return this.c .get<{ - client_states: IdentifiedClientState.Data[]; - pagination: Pagination; + client_states: IdentifiedClientState.Data[] + pagination: Pagination }>(`/ibc/core/client/v1/client_states`, params) - .then(d => [ + .then((d) => [ d.client_states.map(IdentifiedClientState.fromData), d.pagination, - ]); + ]) } /** @@ -170,11 +170,11 @@ export class IbcAPI extends BaseAPI { `/ibc/core/client/v1/client_states/${client_id}`, params ) - .then(d => ({ + .then((d) => ({ client_state: d.client_state, proof: d.proof, proof_height: Height.fromData(d.proof_height), - })); + })) } /** @@ -188,9 +188,9 @@ export class IbcAPI extends BaseAPI { ): Promise { return this.c .get<{ - status: string; + status: string }>(`/ibc/core/client/v1/client_status/${client_id}`, params) - .then(d => d.status); + .then((d) => d.status) } /** @@ -204,10 +204,10 @@ export class IbcAPI extends BaseAPI { ): Promise<[ClientConsensusStates, Pagination]> { return this.c .get<{ - consensus_states: ClientConsensusStates.Data; - pagination: Pagination; + consensus_states: ClientConsensusStates.Data + pagination: Pagination }>(`/ibc/core/client/v1/consensus_states/${client_id}`, params) - .then(); + .then() } /** @@ -221,13 +221,13 @@ export class IbcAPI extends BaseAPI { ): Promise<[Height[], Pagination]> { return this.c .get<{ - consensus_state_heights: Height.Data[]; - pagination: Pagination; + consensus_state_heights: Height.Data[] + pagination: Pagination }>(`/ibc/core/client/v1/consensus_states/${client_id}/heights`, params) - .then(d => [ + .then((d) => [ d.consensus_state_heights.map(Height.fromData), d.pagination, - ]); + ]) } public async unreceivedPackets( @@ -241,7 +241,7 @@ export class IbcAPI extends BaseAPI { ',' )}/unreceived_packets`, params - ); + ) } public async unreceivedAcks( @@ -255,6 +255,6 @@ export class IbcAPI extends BaseAPI { ',' )}/unreceived_acks`, params - ); + ) } } diff --git a/src/client/lcd/api/IbcHooksAPI.ts b/src/client/lcd/api/IbcHooksAPI.ts index 2ca295e..c41fd52 100644 --- a/src/client/lcd/api/IbcHooksAPI.ts +++ b/src/client/lcd/api/IbcHooksAPI.ts @@ -1,6 +1,6 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { AccAddress, ACL, IbcHooksParams } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { AccAddress, ACL, IbcHooksParams } from '../../../core' export class IbcHooksAPI extends BaseAPI { public async acls( @@ -8,24 +8,23 @@ export class IbcHooksAPI extends BaseAPI { ): Promise<[ACL[], Pagination]> { return this.c .get<{ - acls: ACL.Data[]; - pagination: Pagination; + acls: ACL.Data[] + pagination: Pagination }>(`/initia/ibchooks/v1/acls`, params) - .then(d => [d.acls.map(ACL.fromData), d.pagination]); + .then((d) => [d.acls.map(ACL.fromData), d.pagination]) } public async acl(address: AccAddress, params: APIParams = {}): Promise { return this.c .get<{ acl: ACL.Data }>(`/initia/ibchooks/v1/acls/${address}`, params) - .then(d => ACL.fromData(d.acl)); + .then((d) => ACL.fromData(d.acl)) } public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: IbcHooksParams.Data }>( - `/initia/ibchooks/v1/params`, - params - ) - .then(d => IbcHooksParams.fromData(d.params)); + .get<{ + params: IbcHooksParams.Data + }>(`/initia/ibchooks/v1/params`, params) + .then((d) => IbcHooksParams.fromData(d.params)) } } diff --git a/src/client/lcd/api/IbcNftAPI.ts b/src/client/lcd/api/IbcNftAPI.ts index 37db437..eb13409 100644 --- a/src/client/lcd/api/IbcNftAPI.ts +++ b/src/client/lcd/api/IbcNftAPI.ts @@ -1,15 +1,15 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { NftClassTrace, IbcNftParams } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { NftClassTrace, IbcNftParams } from '../../../core' export class IbcNftAPI extends BaseAPI { /** Gets a classTrace for the hash */ public async classTrace(hash: string): Promise { return this.c - .get<{ class_trace: NftClassTrace.Data }>( - `/ibc/apps/nft_transfer/v1/class_traces/${hash}` - ) - .then(d => NftClassTrace.fromData(d.class_trace)); + .get<{ + class_trace: NftClassTrace.Data + }>(`/ibc/apps/nft_transfer/v1/class_traces/${hash}`) + .then((d) => NftClassTrace.fromData(d.class_trace)) } /** Gets a list of classTraces */ @@ -17,18 +17,18 @@ export class IbcNftAPI extends BaseAPI { params: Partial = {} ): Promise<[NftClassTrace[], Pagination]> { return this.c - .get<{ class_traces: NftClassTrace[]; pagination: Pagination }>( - `/ibc/apps/nft_transfer/v1/class_traces`, - params - ) - .then(d => [d.class_traces.map(NftClassTrace.fromData), d.pagination]); + .get<{ + class_traces: NftClassTrace[] + pagination: Pagination + }>(`/ibc/apps/nft_transfer/v1/class_traces`, params) + .then((d) => [d.class_traces.map(NftClassTrace.fromData), d.pagination]) } /** Gets a class id hash information */ public async classHash(trace: string): Promise { return await this.c .get<{ hash: string }>(`/ibc/apps/nft_transfer/v1/class_hashes/${trace}`) - .then(d => d.hash); + .then((d) => d.hash) } /** @@ -36,11 +36,10 @@ export class IbcNftAPI extends BaseAPI { */ public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: IbcNftParams.Data }>( - `/ibc/apps/nft_transfer/v1/params`, - params - ) - .then(({ params: d }) => IbcNftParams.fromData(d)); + .get<{ + params: IbcNftParams.Data + }>(`/ibc/apps/nft_transfer/v1/params`, params) + .then(({ params: d }) => IbcNftParams.fromData(d)) } /** Gets the escrow address for a particular port and channel id */ @@ -50,10 +49,12 @@ export class IbcNftAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ escrow_address: string }>( + .get<{ + escrow_address: string + }>( `/ibc/apps/nft_transfer/v1/channels/${channel_id}/ports/${port_id}/escrow_address`, params ) - .then(d => d.escrow_address); + .then((d) => d.escrow_address) } } diff --git a/src/client/lcd/api/IbcPermAPI.ts b/src/client/lcd/api/IbcPermAPI.ts index 4902761..10ca033 100644 --- a/src/client/lcd/api/IbcPermAPI.ts +++ b/src/client/lcd/api/IbcPermAPI.ts @@ -1,10 +1,10 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export interface PermissionedRelayers { - port_id: string; - channel_id: string; - relayers: string[]; + port_id: string + channel_id: string + relayers: string[] } export class IbcPermAPI extends BaseAPI { @@ -13,10 +13,10 @@ export class IbcPermAPI extends BaseAPI { ): Promise<[PermissionedRelayers[], Pagination]> { return this.c .get<{ - permissioned_relayers: PermissionedRelayers[]; - pagination: Pagination; + permissioned_relayers: PermissionedRelayers[] + pagination: Pagination }>(`/ibc/apps/perm/v1/relayers`, params) - .then(d => [d.permissioned_relayers, d.pagination]); + .then((d) => [d.permissioned_relayers, d.pagination]) } public async relayersByChannel( @@ -24,9 +24,9 @@ export class IbcPermAPI extends BaseAPI { channel_id: string ): Promise { return this.c - .get<{ permissioned_relayers: PermissionedRelayers }>( - `/ibc/apps/perm/v1/relayers/${port_id}/${channel_id}` - ) - .then(d => d.permissioned_relayers); + .get<{ + permissioned_relayers: PermissionedRelayers + }>(`/ibc/apps/perm/v1/relayers/${port_id}/${channel_id}`) + .then((d) => d.permissioned_relayers) } } diff --git a/src/client/lcd/api/IbcTransferAPI.spec.ts b/src/client/lcd/api/IbcTransferAPI.spec.ts index f476dd3..0e0e9b8 100644 --- a/src/client/lcd/api/IbcTransferAPI.spec.ts +++ b/src/client/lcd/api/IbcTransferAPI.spec.ts @@ -1,18 +1,18 @@ -import { APIRequester } from '../APIRequester'; -import { IbcTransferAPI } from './IbcTransferAPI'; -import { DenomTrace } from '../../../core/ibc/applications/transfer/v1/DenomTrace'; +import { APIRequester } from '../APIRequester' +import { IbcTransferAPI } from './IbcTransferAPI' +import { DenomTrace } from '../../../core/ibc/applications/transfer/v1/DenomTrace' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const ibctx = new IbcTransferAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const ibctx = new IbcTransferAPI(c) describe('IbcTransferAPI', () => { it('denomTraces', async () => { - const denomTraces = await ibctx.denomTraces().then(v => v[0]); + const denomTraces = await ibctx.denomTraces().then((v) => v[0]) denomTraces.forEach(function (denomTrace: DenomTrace.Data) { - expect(denomTrace.path).toMatch('transfer/channel-'); - expect(denomTrace.base_denom).not.toBeUndefined(); - }); - }); + expect(denomTrace.path).toMatch('transfer/channel-') + expect(denomTrace.base_denom).not.toBeUndefined() + }) + }) // it('denomTrace', async () => { // const denomTrace = await ibctx.denomTrace( @@ -23,8 +23,8 @@ describe('IbcTransferAPI', () => { // }); it('params', async () => { - const param = await ibctx.parameters(); - expect(param.send_enabled).toEqual(expect.any(Boolean)); - expect(param.receive_enabled).toEqual(expect.any(Boolean)); - }); -}); + const param = await ibctx.parameters() + expect(param.send_enabled).toEqual(expect.any(Boolean)) + expect(param.receive_enabled).toEqual(expect.any(Boolean)) + }) +}) diff --git a/src/client/lcd/api/IbcTransferAPI.ts b/src/client/lcd/api/IbcTransferAPI.ts index db4182a..21058cb 100644 --- a/src/client/lcd/api/IbcTransferAPI.ts +++ b/src/client/lcd/api/IbcTransferAPI.ts @@ -1,16 +1,16 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { DenomTrace } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { DenomTrace } from '../../../core' export interface IbcTransferParams { - send_enabled: boolean; - receive_enabled: boolean; + send_enabled: boolean + receive_enabled: boolean } export namespace IbcTransferParams { export interface Data { - send_enabled: boolean; - receive_enabled: boolean; + send_enabled: boolean + receive_enabled: boolean } } @@ -18,10 +18,10 @@ export class IbcTransferAPI extends BaseAPI { /** Gets a denomTrace for the hash or denom */ public async denomTrace(hash: string): Promise { return this.c - .get<{ denom_trace: DenomTrace.Data }>( - `/ibc/apps/transfer/v1/denom_traces/${hash}` - ) - .then(d => DenomTrace.fromData(d.denom_trace)); + .get<{ + denom_trace: DenomTrace.Data + }>(`/ibc/apps/transfer/v1/denom_traces/${hash}`) + .then((d) => DenomTrace.fromData(d.denom_trace)) } /** Gets a list of denomTraces */ @@ -29,18 +29,18 @@ export class IbcTransferAPI extends BaseAPI { params: Partial = {} ): Promise<[DenomTrace[], Pagination]> { return this.c - .get<{ denom_traces: DenomTrace[]; pagination: Pagination }>( - `/ibc/apps/transfer/v1/denom_traces`, - params - ) - .then(d => [d.denom_traces.map(DenomTrace.fromData), d.pagination]); + .get<{ + denom_traces: DenomTrace[] + pagination: Pagination + }>(`/ibc/apps/transfer/v1/denom_traces`, params) + .then((d) => [d.denom_traces.map(DenomTrace.fromData), d.pagination]) } /** Gets a denomination hash information */ public async denomHash(trace: string): Promise { return await this.c .get<{ hash: string }>(`/ibc/apps/transfer/v1/denom_hashes/${trace}`) - .then(d => d.hash); + .then((d) => d.hash) } /** @@ -48,14 +48,13 @@ export class IbcTransferAPI extends BaseAPI { */ public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: IbcTransferParams.Data }>( - `/ibc/apps/transfer/v1/params`, - params - ) + .get<{ + params: IbcTransferParams.Data + }>(`/ibc/apps/transfer/v1/params`, params) .then(({ params: d }) => ({ send_enabled: d.send_enabled, receive_enabled: d.receive_enabled, - })); + })) } /** Gets the escrow address for a particular port and channel id */ @@ -65,10 +64,12 @@ export class IbcTransferAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ escrow_address: string }>( + .get<{ + escrow_address: string + }>( `/ibc/apps/transfer/v1/channels/${channel_id}/ports/${port_id}/escrow_address`, params ) - .then(d => d.escrow_address); + .then((d) => d.escrow_address) } } diff --git a/src/client/lcd/api/InterTxAPI.ts b/src/client/lcd/api/InterTxAPI.ts index 10dabe0..0c1ec88 100644 --- a/src/client/lcd/api/InterTxAPI.ts +++ b/src/client/lcd/api/InterTxAPI.ts @@ -1,5 +1,5 @@ -import { AccAddress } from '../../../core'; -import { BaseAPI } from './BaseAPI'; +import { AccAddress } from '../../../core' +import { BaseAPI } from './BaseAPI' export class InterTxAPI extends BaseAPI { public async interchainAccount( @@ -7,9 +7,11 @@ export class InterTxAPI extends BaseAPI { connection_id: string ): Promise { return this.c - .get<{ interchain_account_address: string }>( + .get<{ + interchain_account_address: string + }>( `/inter-tx/interchain_account/owner/${owner}/connection/${connection_id}` ) - .then(d => d.interchain_account_address); + .then((d) => d.interchain_account_address) } } diff --git a/src/client/lcd/api/MarketmapAPI.ts b/src/client/lcd/api/MarketmapAPI.ts index c4169e4..80fa782 100644 --- a/src/client/lcd/api/MarketmapAPI.ts +++ b/src/client/lcd/api/MarketmapAPI.ts @@ -1,31 +1,30 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams } from '../APIRequester'; -import { CurrencyPair, Market, MarketmapParams } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams } from '../APIRequester' +import { CurrencyPair, Market, MarketmapParams } from '../../../core' export interface MarketMap { - markets: { [ticker: string]: Market }; + markets: Record } export namespace MarketMap { export interface Data { - markets: { [ticker: string]: Market.Data }; + markets: Record } } export class MarketmapAPI extends BaseAPI { public async marketMap(params: APIParams = {}): Promise { return this.c - .get<{ market_map: MarketMap.Data }>( - `/slinky/marketmap/v1/marketmap`, - params - ) - .then(d => { - const markets: { [ticker: string]: Market } = {}; + .get<{ + market_map: MarketMap.Data + }>(`/slinky/marketmap/v1/marketmap`, params) + .then((d) => { + const markets: Record = {} for (const [ticker, market] of Object.entries(d.market_map.markets)) { - markets[ticker] = Market.fromData(market); + markets[ticker] = Market.fromData(market) } - return { markets }; - }); + return { markets } + }) } public async market( @@ -38,24 +37,22 @@ export class MarketmapAPI extends BaseAPI { 'currency_pair.Base': pair.Base, 'currency_pair.Quote': pair.Quote, }) - .then(d => Market.fromData(d.market)); + .then((d) => Market.fromData(d.market)) } public async lastUpdated(params: APIParams = {}): Promise { return this.c - .get<{ last_updated: string }>( - `/slinky/marketmap/v1/last_updated`, - params - ) - .then(d => Number.parseInt(d.last_updated)); + .get<{ + last_updated: string + }>(`/slinky/marketmap/v1/last_updated`, params) + .then((d) => Number.parseInt(d.last_updated)) } public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: MarketmapParams.Data }>( - `/slinky/marketmap/v1/params`, - params - ) - .then(d => MarketmapParams.fromData(d.params)); + .get<{ + params: MarketmapParams.Data + }>(`/slinky/marketmap/v1/params`, params) + .then((d) => MarketmapParams.fromData(d.params)) } } diff --git a/src/client/lcd/api/MoveAPI.ts b/src/client/lcd/api/MoveAPI.ts index 2590965..56ed476 100644 --- a/src/client/lcd/api/MoveAPI.ts +++ b/src/client/lcd/api/MoveAPI.ts @@ -1,56 +1,56 @@ -import { BaseAPI } from './BaseAPI'; -import { AccAddress, Denom, MoveParams } from '../../../core'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types'; +import { BaseAPI } from './BaseAPI' +import { AccAddress, Denom, MoveParams } from '../../../core' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' export interface Module { - address: AccAddress; - module_name: string; - abi: string; - raw_bytes: string; - upgrade_policy: UpgradePolicy; + address: AccAddress + module_name: string + abi: string + raw_bytes: string + upgrade_policy: UpgradePolicy } export interface Resource { - address: AccAddress; - struct_tag: string; - move_resource: string; - raw_bytes: string; + address: AccAddress + struct_tag: string + move_resource: string + raw_bytes: string } export interface ABI { - abi: string; + abi: string } export interface TableEntry { - address: AccAddress; - key: string; - value: string; + address: AccAddress + key: string + value: string } export interface TableInfo { - address: AccAddress; - key_type: string; - value_type: string; + address: AccAddress + key_type: string + value_type: string } export interface ViewRequest { - address: AccAddress; - module_name: string; - function_name: string; - type_args: string[]; - args: string[]; + address: AccAddress + module_name: string + function_name: string + type_args: string[] + args: string[] } export interface ViewResponse { - data: string; - events: VMEvent[]; - gas_used: string; + data: string + events: VMEvent[] + gas_used: string } export interface VMEvent { - type_tag: string; - data: string; + type_tag: string + data: string } export class MoveAPI extends BaseAPI { @@ -60,11 +60,11 @@ export class MoveAPI extends BaseAPI { ): Promise<[Module[], Pagination]> { return this.c .get<{ - modules: Module[]; - pagination: Pagination; + modules: Module[] + pagination: Pagination }>(`/initia/move/v1/accounts/${address}/modules`, params) - .then(d => [ - d.modules.map(mod => ({ + .then((d) => [ + d.modules.map((mod) => ({ address: mod.address, module_name: mod.module_name, abi: mod.abi, @@ -72,7 +72,7 @@ export class MoveAPI extends BaseAPI { upgrade_policy: mod.upgrade_policy, })), d.pagination, - ]); + ]) } public async module( @@ -81,17 +81,16 @@ export class MoveAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ module: Module }>( - `/initia/move/v1/accounts/${address}/modules/${moduleName}`, - params - ) + .get<{ + module: Module + }>(`/initia/move/v1/accounts/${address}/modules/${moduleName}`, params) .then(({ module: d }) => ({ address: d.address, module_name: d.module_name, abi: d.abi, raw_bytes: d.raw_bytes, upgrade_policy: d.upgrade_policy, - })); + })) } public async viewFunction( @@ -109,7 +108,7 @@ export class MoveAPI extends BaseAPI { args, } ) - .then(res => JSON.parse(res.data) as T); + .then((res) => JSON.parse(res.data) as T) } public async view( @@ -125,7 +124,7 @@ export class MoveAPI extends BaseAPI { function_name: functionName, type_args: typeArgs, args, - }); + }) } public async viewBatch(requests: ViewRequest[]): Promise { @@ -133,7 +132,7 @@ export class MoveAPI extends BaseAPI { .post<{ responses: ViewResponse[] }>(`/initia/move/v1/view/batch`, { requests, }) - .then(d => d.responses); + .then((d) => d.responses) } public async viewJSON( @@ -149,7 +148,7 @@ export class MoveAPI extends BaseAPI { function_name: functionName, type_args: typeArgs, args, - }); + }) } public async viewBatchJSON(requests: ViewRequest[]): Promise { @@ -157,7 +156,7 @@ export class MoveAPI extends BaseAPI { .post<{ responses: ViewResponse[] }>(`/initia/move/v1/view/json/batch`, { requests, }) - .then(d => d.responses); + .then((d) => d.responses) } public async resources( @@ -166,13 +165,13 @@ export class MoveAPI extends BaseAPI { ): Promise<[{ type: string; data: any }[], Pagination]> { return this.c .get<{ - resources: Resource[]; - pagination: Pagination; + resources: Resource[] + pagination: Pagination }>(`/initia/move/v1/accounts/${address}/resources`, params) - .then(d => [ - d.resources.map(res => JSON.parse(res.move_resource)), + .then((d) => [ + d.resources.map((res) => JSON.parse(res.move_resource)), d.pagination, - ]); + ]) } public async resource( @@ -181,17 +180,19 @@ export class MoveAPI extends BaseAPI { params: APIParams = {} ): Promise<{ type: string; data: T }> { return this.c - .get<{ resource: Resource }>( - `/initia/move/v1/accounts/${address}/resources/by_struct_tag`, - { ...params, struct_tag: structTag } - ) - .then(({ resource: d }) => JSON.parse(d.move_resource)); + .get<{ + resource: Resource + }>(`/initia/move/v1/accounts/${address}/resources/by_struct_tag`, { + ...params, + struct_tag: structTag, + }) + .then(({ resource: d }) => JSON.parse(d.move_resource)) } public async denom(metadata: string, params: APIParams = {}): Promise { return this.c .get<{ denom: Denom }>(`/initia/move/v1/denom`, { ...params, metadata }) - .then(d => d.denom); + .then((d) => d.denom) } public async metadata(denom: Denom, params: APIParams = {}): Promise { @@ -200,19 +201,19 @@ export class MoveAPI extends BaseAPI { ...params, denom, }) - .then(d => d.metadata); + .then((d) => d.metadata) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: MoveParams.Data }>(`/initia/move/v1/params`, params) - .then(({ params: d }) => MoveParams.fromData(d)); + .then(({ params: d }) => MoveParams.fromData(d)) } public async scriptABI(codeBytes: string): Promise { return this.c.post(`/initia/move/v1/script/abi`, { code_bytes: codeBytes, - }); + }) } public async tableInfo( @@ -220,11 +221,10 @@ export class MoveAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ table_info: TableInfo }>( - `/initia/move/v1/tables/${address}`, - params - ) - .then(d => d.table_info); + .get<{ + table_info: TableInfo + }>(`/initia/move/v1/tables/${address}`, params) + .then((d) => d.table_info) } public async tableEntries( @@ -232,11 +232,11 @@ export class MoveAPI extends BaseAPI { params: Partial = {} ): Promise<[TableEntry[], Pagination]> { return this.c - .get<{ table_entries: TableEntry[]; pagination: Pagination }>( - `/initia/move/v1/tables/${address}/entries`, - params - ) - .then(d => [d.table_entries, d.pagination]); + .get<{ + table_entries: TableEntry[] + pagination: Pagination + }>(`/initia/move/v1/tables/${address}/entries`, params) + .then((d) => [d.table_entries, d.pagination]) } public async tableEntry( @@ -245,10 +245,12 @@ export class MoveAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ table_entry: TableEntry }>( - `/initia/move/v1/tables/${address}/entries/by_key_bytes`, - { ...params, key_bytes: keyBytes } - ) - .then(d => d.table_entry); + .get<{ + table_entry: TableEntry + }>(`/initia/move/v1/tables/${address}/entries/by_key_bytes`, { + ...params, + key_bytes: keyBytes, + }) + .then((d) => d.table_entry) } } diff --git a/src/client/lcd/api/MstakingAPI.spec.ts b/src/client/lcd/api/MstakingAPI.spec.ts index c96e6b2..a661dcf 100644 --- a/src/client/lcd/api/MstakingAPI.spec.ts +++ b/src/client/lcd/api/MstakingAPI.spec.ts @@ -1,10 +1,10 @@ -import { APIRequester } from '../APIRequester'; -import { MstakingAPI } from './MstakingAPI'; -import { Coins } from '../../../core'; -import { ValConsPublicKey } from '../../../core'; +import { APIRequester } from '../APIRequester' +import { MstakingAPI } from './MstakingAPI' +import { Coins } from '../../../core' +import { ValConsPublicKey } from '../../../core' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const mstaking = new MstakingAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const mstaking = new MstakingAPI(c) describe('MstakingAPI', () => { it('parameters', async () => { @@ -13,21 +13,21 @@ describe('MstakingAPI', () => { max_validators: expect.any(Number), max_entries: expect.any(Number), historical_entries: expect.any(Number), - bond_denoms: expect.any(Array), + bond_denoms: expect.any(Array), min_voting_power: expect.any(Number), - }); - }); + }) + }) it('delegations without parameter should throw an error', async () => { - await expect(mstaking.delegations()).rejects.toThrowError(); - }); + await expect(mstaking.delegations()).rejects.toThrowError() + }) it('unbondingDelegations without parameter should throw an error', async () => { - await expect(mstaking.unbondingDelegations()).rejects.toThrowError(); - }); + await expect(mstaking.unbondingDelegations()).rejects.toThrowError() + }) it('validators', async () => { - const validators = await mstaking.validators().then(v => v[0]); + const validators = await mstaking.validators().then((v) => v[0]) expect(validators).toContainEqual({ operator_address: expect.any(String), @@ -55,13 +55,13 @@ describe('MstakingAPI', () => { }, voting_powers: expect.any(Coins), voting_power: expect.any(String), - }); - }); + }) + }) it('pool', async () => { await expect(mstaking.pool()).resolves.toMatchObject({ bonded_tokens: expect.any(Coins), not_bonded_tokens: expect.any(Coins), - }); - }); -}); + }) + }) +}) diff --git a/src/client/lcd/api/MstakingAPI.ts b/src/client/lcd/api/MstakingAPI.ts index a089fe6..9409808 100644 --- a/src/client/lcd/api/MstakingAPI.ts +++ b/src/client/lcd/api/MstakingAPI.ts @@ -7,22 +7,22 @@ import { Validator, Redelegation, MstakingParams, -} from '../../../core'; -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +} from '../../../core' +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' export interface MstakingPool { /** amount of tokens are bonded, including those that are currently unbonding */ - bonded_tokens: Coins; + bonded_tokens: Coins /** amount of tokens that are not bonded */ - not_bonded_tokens: Coins; + not_bonded_tokens: Coins } export namespace MstakingPool { export interface Data { - bonded_tokens: Coins.Data; - not_bonded_tokens: Coins.Data; + bonded_tokens: Coins.Data + not_bonded_tokens: Coins.Data } } @@ -41,38 +41,40 @@ export class MstakingAPI extends BaseAPI { ): Promise<[Delegation[], Pagination]> { if (delegator !== undefined && validator !== undefined) { return this.c - .get<{ delegation_response: Delegation.Data }>( + .get<{ + delegation_response: Delegation.Data + }>( `/initia/mstaking/v1/validators/${validator}/delegations/${delegator}`, params ) .then(({ delegation_response: data }) => [ [Delegation.fromData(data)], { total: 1, next_key: '' }, - ]); + ]) } else if (delegator !== undefined) { return this.c .get<{ - delegation_responses: Delegation.Data[]; - pagination: Pagination; + delegation_responses: Delegation.Data[] + pagination: Pagination }>(`/initia/mstaking/v1/delegations/${delegator}`, params) - .then(data => [ + .then((data) => [ data.delegation_responses.map(Delegation.fromData), data.pagination, - ]); + ]) } else if (validator !== undefined) { return this.c .get<{ - delegation_responses: Delegation.Data[]; - pagination: Pagination; + delegation_responses: Delegation.Data[] + pagination: Pagination }>(`/initia/mstaking/v1/validators/${validator}/delegations`, params) - .then(data => [ + .then((data) => [ data.delegation_responses.map(Delegation.fromData), data.pagination, - ]); + ]) } else { throw new TypeError( 'arguments delegator and validator cannot both be empty' - ); + ) } } @@ -85,7 +87,7 @@ export class MstakingAPI extends BaseAPI { delegator: AccAddress, validator: ValAddress ): Promise { - return this.delegations(delegator, validator).then(delgs => delgs[0][0]); + return this.delegations(delegator, validator).then((delgs) => delgs[0][0]) } /** @@ -102,44 +104,46 @@ export class MstakingAPI extends BaseAPI { ): Promise<[UnbondingDelegation[], Pagination]> { if (delegator !== undefined && validator !== undefined) { return this.c - .get<{ unbond: UnbondingDelegation.Data }>( + .get<{ + unbond: UnbondingDelegation.Data + }>( `/initia/mstaking/v1/validators/${validator}/delegations/${delegator}/unbonding_delegation`, params ) .then(({ unbond: data }) => [ [UnbondingDelegation.fromData(data)], { next_key: '', total: 1 }, - ]); + ]) } else if (delegator !== undefined) { return this.c .get<{ - unbonding_responses: UnbondingDelegation.Data[]; - pagination: Pagination; + unbonding_responses: UnbondingDelegation.Data[] + pagination: Pagination }>( `/initia/mstaking/v1/delegators/${delegator}/unbonding_delegations`, params ) - .then(data => [ + .then((data) => [ data.unbonding_responses.map(UnbondingDelegation.fromData), data.pagination, - ]); + ]) } else if (validator !== undefined) { return this.c .get<{ - unbonding_responses: UnbondingDelegation.Data[]; - pagination: Pagination; + unbonding_responses: UnbondingDelegation.Data[] + pagination: Pagination }>( `/initia/mstaking/v1/validators/${validator}/unbonding_delegations`, params ) - .then(data => [ + .then((data) => [ data.unbonding_responses.map(UnbondingDelegation.fromData), data.pagination, - ]); + ]) } else { throw new TypeError( 'arguments delegator and validator cannot both be empty' - ); + ) } } @@ -153,8 +157,8 @@ export class MstakingAPI extends BaseAPI { validator?: ValAddress ): Promise { return this.unbondingDelegations(delegator, validator).then( - udelgs => udelgs[0][0] - ); + (udelgs) => udelgs[0][0] + ) } /** @@ -173,16 +177,16 @@ export class MstakingAPI extends BaseAPI { ..._params, src_validator_addr: validatorSrc, dst_validator_addr: validatorDst, - }; + } return this.c .get<{ - redelegation_responses: Redelegation.Data[]; - pagination: Pagination; + redelegation_responses: Redelegation.Data[] + pagination: Pagination }>(`/initia/mstaking/v1/delegators/${delegator}/redelegations`, params) - .then(d => [ + .then((d) => [ d.redelegation_responses.map(Redelegation.fromData), d.pagination, - ]); + ]) } /** @@ -194,11 +198,11 @@ export class MstakingAPI extends BaseAPI { params: Partial = {} ): Promise<[Validator[], Pagination]> { return this.c - .get<{ validators: Validator.Data[]; pagination: Pagination }>( - `/initia/mstaking/v1/delegators/${delegator}/validators`, - params - ) - .then(d => [d.validators.map(Validator.fromData), d.pagination]); + .get<{ + validators: Validator.Data[] + pagination: Pagination + }>(`/initia/mstaking/v1/delegators/${delegator}/validators`, params) + .then((d) => [d.validators.map(Validator.fromData), d.pagination]) } /** @@ -208,11 +212,11 @@ export class MstakingAPI extends BaseAPI { params: Partial = {} ): Promise<[Validator[], Pagination]> { return this.c - .get<{ validators: Validator.Data[]; pagination: Pagination }>( - `/initia/mstaking/v1/validators`, - params - ) - .then(d => [d.validators.map(Validator.fromData), d.pagination]); + .get<{ + validators: Validator.Data[] + pagination: Pagination + }>(`/initia/mstaking/v1/validators`, params) + .then((d) => [d.validators.map(Validator.fromData), d.pagination]) } /** @@ -224,11 +228,10 @@ export class MstakingAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ validator: Validator.Data }>( - `/initia/mstaking/v1/validators/${validator}`, - params - ) - .then(d => Validator.fromData(d.validator)); + .get<{ + validator: Validator.Data + }>(`/initia/mstaking/v1/validators/${validator}`, params) + .then((d) => Validator.fromData(d.validator)) } /** @@ -240,7 +243,7 @@ export class MstakingAPI extends BaseAPI { .then(({ pool: d }) => ({ bonded_tokens: Coins.fromData(d.bonded_tokens), not_bonded_tokens: Coins.fromData(d.not_bonded_tokens), - })); + })) } /** @@ -248,10 +251,9 @@ export class MstakingAPI extends BaseAPI { */ public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: MstakingParams.Data }>( - `/initia/mstaking/v1/params`, - params - ) - .then(({ params: d }) => MstakingParams.fromData(d)); + .get<{ + params: MstakingParams.Data + }>(`/initia/mstaking/v1/params`, params) + .then(({ params: d }) => MstakingParams.fromData(d)) } } diff --git a/src/client/lcd/api/OpchildAPI.ts b/src/client/lcd/api/OpchildAPI.ts index fc6e298..fe93ab5 100644 --- a/src/client/lcd/api/OpchildAPI.ts +++ b/src/client/lcd/api/OpchildAPI.ts @@ -1,11 +1,11 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { OpValidator, ValAddress, OpchildParams, BridgeInfo, -} from '../../../core'; +} from '../../../core' export class OpchildAPI extends BaseAPI { public async validators( @@ -13,10 +13,10 @@ export class OpchildAPI extends BaseAPI { ): Promise<[OpValidator[], Pagination]> { return this.c .get<{ - validators: OpValidator.Data[]; - pagination: Pagination; + validators: OpValidator.Data[] + pagination: Pagination }>(`/opinit/opchild/v1/validators`, params) - .then(d => [d.validators.map(OpValidator.fromData), d.pagination]); + .then((d) => [d.validators.map(OpValidator.fromData), d.pagination]) } public async validator( @@ -24,25 +24,23 @@ export class OpchildAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ validator: OpValidator.Data }>( - `/opinit/opchild/v1/validator/${validatorAddr}`, - params - ) - .then(d => OpValidator.fromData(d.validator)); + .get<{ + validator: OpValidator.Data + }>(`/opinit/opchild/v1/validator/${validatorAddr}`, params) + .then((d) => OpValidator.fromData(d.validator)) } public async bridgeInfo(params: APIParams = {}): Promise { return this.c - .get<{ bridge_info: BridgeInfo.Data }>( - `/opinit/opchild/v1/bridge_info`, - params - ) - .then(d => BridgeInfo.fromData(d.bridge_info)); + .get<{ + bridge_info: BridgeInfo.Data + }>(`/opinit/opchild/v1/bridge_info`, params) + .then((d) => BridgeInfo.fromData(d.bridge_info)) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: OpchildParams.Data }>(`/opinit/opchild/v1/params`, params) - .then(d => OpchildParams.fromData(d.params)); + .then((d) => OpchildParams.fromData(d.params)) } } diff --git a/src/client/lcd/api/OphostAPI.ts b/src/client/lcd/api/OphostAPI.ts index 13ab674..f48d324 100644 --- a/src/client/lcd/api/OphostAPI.ts +++ b/src/client/lcd/api/OphostAPI.ts @@ -1,23 +1,23 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { OphostParams, Output, BridgeInfo } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { OphostParams, Output, BridgeInfo } from '../../../core' export interface TokenPair { - l1_denom: string; - l2_denom: string; + l1_denom: string + l2_denom: string } export interface OutputInfo { - bridge_id?: number; - output_index: number; - output_proposal: Output; + bridge_id?: number + output_index: number + output_proposal: Output } export namespace OutputInfo { export interface Data { - bridge_id?: string; - output_index: string; - output_proposal: Output.Data; + bridge_id?: string + output_index: string + output_proposal: Output.Data } } @@ -27,10 +27,10 @@ export class OphostAPI extends BaseAPI { ): Promise<[BridgeInfo[], Pagination]> { return this.c .get<{ - bridges: BridgeInfo.Data[]; - pagination: Pagination; + bridges: BridgeInfo.Data[] + pagination: Pagination }>(`/opinit/ophost/v1/bridges`, params) - .then(d => [d.bridges.map(BridgeInfo.fromData), d.pagination]); + .then((d) => [d.bridges.map(BridgeInfo.fromData), d.pagination]) } public async bridgeInfo( @@ -39,7 +39,7 @@ export class OphostAPI extends BaseAPI { ): Promise { return this.c .get(`/opinit/ophost/v1/bridges/${bridgeId}`, params) - .then(d => BridgeInfo.fromData(d)); + .then((d) => BridgeInfo.fromData(d)) } public async tokenPairs( @@ -48,10 +48,10 @@ export class OphostAPI extends BaseAPI { ): Promise<[TokenPair[], Pagination]> { return this.c .get<{ - token_pairs: TokenPair[]; - pagination: Pagination; + token_pairs: TokenPair[] + pagination: Pagination }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs`, params) - .then(d => [d.token_pairs, d.pagination]); + .then((d) => [d.token_pairs, d.pagination]) } public async tokenPairByL1Denom( @@ -60,11 +60,13 @@ export class OphostAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ token_pair: TokenPair }>( - `/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l1_denom`, - { ...params, l1_denom: l1Denom } - ) - .then(d => d.token_pair); + .get<{ + token_pair: TokenPair + }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l1_denom`, { + ...params, + l1_denom: l1Denom, + }) + .then((d) => d.token_pair) } public async tokenPairByL2Denom( @@ -73,11 +75,13 @@ export class OphostAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ token_pair: TokenPair }>( - `/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l2_denom`, - { ...params, l2_denom: l2Denom } - ) - .then(d => d.token_pair); + .get<{ + token_pair: TokenPair + }>(`/opinit/ophost/v1/bridges/${bridgeId}/token_pairs/by_l2_denom`, { + ...params, + l2_denom: l2Denom, + }) + .then((d) => d.token_pair) } public async lastFinalizedOutput( @@ -89,10 +93,10 @@ export class OphostAPI extends BaseAPI { `/opinit/ophost/v1/bridges/${bridgeId}/last_finalized_output`, params ) - .then(d => ({ + .then((d) => ({ output_index: Number.parseInt(d.output_index), output_proposal: Output.fromData(d.output_proposal), - })); + })) } public async outputInfos( @@ -101,17 +105,17 @@ export class OphostAPI extends BaseAPI { ): Promise<[OutputInfo[], Pagination]> { return this.c .get<{ - output_proposals: OutputInfo.Data[]; - pagination: Pagination; + output_proposals: OutputInfo.Data[] + pagination: Pagination }>(`/opinit/ophost/v1/bridges/${bridgeId}/outputs`, params) - .then(d => [ - d.output_proposals.map(info => ({ + .then((d) => [ + d.output_proposals.map((info) => ({ bridge_id: Number.parseInt(info.bridge_id ?? `${bridgeId}`), output_index: Number.parseInt(info.output_index), output_proposal: Output.fromData(info.output_proposal), })), d.pagination, - ]); + ]) } public async outputInfo( @@ -124,16 +128,16 @@ export class OphostAPI extends BaseAPI { `/opinit/ophost/v1/bridges/${bridgeId}/outputs/${outputIndex}`, params ) - .then(d => ({ + .then((d) => ({ bridge_id: Number.parseInt(d.bridge_id ?? `${bridgeId}`), output_index: Number.parseInt(d.output_index), output_proposal: Output.fromData(d.output_proposal), - })); + })) } public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: OphostParams.Data }>(`/opinit/opchild/v1/params`, params) - .then(d => OphostParams.fromData(d.params)); + .then((d) => OphostParams.fromData(d.params)) } } diff --git a/src/client/lcd/api/OracleAPI.ts b/src/client/lcd/api/OracleAPI.ts index 8afcb7a..66c49db 100644 --- a/src/client/lcd/api/OracleAPI.ts +++ b/src/client/lcd/api/OracleAPI.ts @@ -1,15 +1,14 @@ -import { BaseAPI } from './BaseAPI'; -import { APIParams } from '../APIRequester'; -import { CurrencyPair, QuotePrice } from '../../../core'; +import { BaseAPI } from './BaseAPI' +import { APIParams } from '../APIRequester' +import { CurrencyPair, QuotePrice } from '../../../core' export class OracleAPI extends BaseAPI { public async currencyPairs(params: APIParams = {}): Promise { return this.c - .get<{ currency_pairs: CurrencyPair.Data[] }>( - `/slinky/oracle/v1/get_all_tickers`, - params - ) - .then(d => d.currency_pairs.map(CurrencyPair.fromData)); + .get<{ + currency_pairs: CurrencyPair.Data[] + }>(`/slinky/oracle/v1/get_all_tickers`, params) + .then((d) => d.currency_pairs.map(CurrencyPair.fromData)) } public async price( @@ -21,6 +20,6 @@ export class OracleAPI extends BaseAPI { ...params, currency_pair_id: pair.toString(), }) - .then(d => QuotePrice.fromData(d.price)); + .then((d) => QuotePrice.fromData(d.price)) } } diff --git a/src/client/lcd/api/RewardAPI.spec.ts b/src/client/lcd/api/RewardAPI.spec.ts index ae2b09d..656b7c9 100644 --- a/src/client/lcd/api/RewardAPI.spec.ts +++ b/src/client/lcd/api/RewardAPI.spec.ts @@ -1,19 +1,19 @@ -import { APIRequester } from '../APIRequester'; -import { RewardAPI } from './RewardAPI'; +import { APIRequester } from '../APIRequester' +import { RewardAPI } from './RewardAPI' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const api = new RewardAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const api = new RewardAPI(c) describe('RewardAPI', () => { it('last_dilution_timestamp', async () => { await expect(api.last_dilution_timestamp()).resolves.toEqual( expect.any(String) - ); - }); + ) + }) it('annual provisions', async () => { - await expect(api.annualProvisions()).resolves.toEqual(expect.any(String)); - }); + await expect(api.annualProvisions()).resolves.toEqual(expect.any(String)) + }) it('parameters', async () => { await expect(api.parameters()).resolves.toMatchObject({ @@ -22,6 +22,6 @@ describe('RewardAPI', () => { release_rate: expect.any(String), dilution_rate: expect.any(String), release_enabled: expect.any(Boolean), - }); - }); -}); + }) + }) +}) diff --git a/src/client/lcd/api/RewardAPI.ts b/src/client/lcd/api/RewardAPI.ts index 4956806..7d6bc74 100644 --- a/src/client/lcd/api/RewardAPI.ts +++ b/src/client/lcd/api/RewardAPI.ts @@ -1,6 +1,6 @@ -import { RewardParams } from '../../../core'; -import { APIParams } from '../APIRequester'; -import { BaseAPI } from './BaseAPI'; +import { RewardParams } from '../../../core' +import { APIParams } from '../APIRequester' +import { BaseAPI } from './BaseAPI' export class RewardAPI extends BaseAPI { /** @@ -10,11 +10,10 @@ export class RewardAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ last_dilution_timestamp: string }>( - `/initia/reward/v1/last_dilution_timestamp`, - params - ) - .then(d => d.last_dilution_timestamp); + .get<{ + last_dilution_timestamp: string + }>(`/initia/reward/v1/last_dilution_timestamp`, params) + .then((d) => d.last_dilution_timestamp) } /** @@ -22,11 +21,10 @@ export class RewardAPI extends BaseAPI { */ public async annualProvisions(params: APIParams = {}): Promise { return this.c - .get<{ annual_provisions: string }>( - `/initia/reward/v1/annual_provisions`, - params - ) - .then(d => d.annual_provisions); + .get<{ + annual_provisions: string + }>(`/initia/reward/v1/annual_provisions`, params) + .then((d) => d.annual_provisions) } /** @@ -35,6 +33,6 @@ export class RewardAPI extends BaseAPI { public async parameters(params: APIParams = {}): Promise { return this.c .get<{ params: RewardParams.Data }>(`/initia/reward/v1/params`, params) - .then(({ params: d }) => RewardParams.fromData(d)); + .then(({ params: d }) => RewardParams.fromData(d)) } } diff --git a/src/client/lcd/api/SlashingAPI.spec.ts b/src/client/lcd/api/SlashingAPI.spec.ts index 00caa2b..d34d0cc 100644 --- a/src/client/lcd/api/SlashingAPI.spec.ts +++ b/src/client/lcd/api/SlashingAPI.spec.ts @@ -1,8 +1,8 @@ -import { APIRequester } from '../APIRequester'; -import { SlashingAPI } from './SlashingAPI'; +import { APIRequester } from '../APIRequester' +import { SlashingAPI } from './SlashingAPI' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const slashing = new SlashingAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const slashing = new SlashingAPI(c) describe('SlashingAPI', () => { it('parameters', async () => { @@ -12,6 +12,6 @@ describe('SlashingAPI', () => { downtime_jail_duration: expect.any(Number), slash_fraction_double_sign: expect.any(String), slash_fraction_downtime: expect.any(String), - }); - }); -}); + }) + }) +}) diff --git a/src/client/lcd/api/SlashingAPI.ts b/src/client/lcd/api/SlashingAPI.ts index ff91c22..1fc1f1c 100644 --- a/src/client/lcd/api/SlashingAPI.ts +++ b/src/client/lcd/api/SlashingAPI.ts @@ -1,35 +1,35 @@ -import { BaseAPI } from './BaseAPI'; -import { ValConsAddress, SlashingParams } from '../../../core'; -import { APIParams, Pagination } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { ValConsAddress, SlashingParams } from '../../../core' +import { APIParams, Pagination } from '../APIRequester' export interface SigningInfo { /** Validator's consensus address. */ - address: ValConsAddress; + address: ValConsAddress /** Number of blocks over which missed blocks are tallied for downtime. */ - start_height: number; + start_height: number /** If a validator misses more than this number, they will be penalized and jailed for downtime. */ - index_offset: number; + index_offset: number /** If the current validator is jailed, this value represents when they can submit a [[MsgUnjail]] to unjail themselves. */ - jailed_until: Date; + jailed_until: Date /** Whether or not the validator is "tombstoned", meaning they are forever barred from joining the validator process. */ - tombstoned: boolean; + tombstoned: boolean /** Number of blocks the validator has missed for the current signed blocks window. */ - missed_blocks_counter: number; + missed_blocks_counter: number } export namespace SigningInfo { export interface Data { - address: string; - start_height: string; - index_offset: string; - jailed_until: string; - tombstoned: boolean; - missed_blocks_counter: string; + address: string + start_height: string + index_offset: string + jailed_until: string + tombstoned: boolean + missed_blocks_counter: string } } @@ -39,10 +39,9 @@ export class SlashingAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ val_signing_info: SigningInfo.Data }>( - `/cosmos/slashing/v1beta1/signing_infos/${valConsAddress}`, - params - ) + .get<{ + val_signing_info: SigningInfo.Data + }>(`/cosmos/slashing/v1beta1/signing_infos/${valConsAddress}`, params) .then(({ val_signing_info: d }) => ({ address: d.address, start_height: Number.parseInt(d.start_height), @@ -50,17 +49,17 @@ export class SlashingAPI extends BaseAPI { jailed_until: new Date(d.jailed_until), tombstoned: d.tombstoned, missed_blocks_counter: Number.parseInt(d.missed_blocks_counter), - })); + })) } public async signingInfos(params: APIParams = {}): Promise { return this.c - .get<{ info: SigningInfo.Data[]; pagination: Pagination }>( - `/cosmos/slashing/v1beta1/signing_infos`, - params - ) - .then(d => - d.info.map(x => ({ + .get<{ + info: SigningInfo.Data[] + pagination: Pagination + }>(`/cosmos/slashing/v1beta1/signing_infos`, params) + .then((d) => + d.info.map((x) => ({ address: x.address, start_height: Number.parseInt(x.start_height), index_offset: Number.parseInt(x.index_offset), @@ -68,7 +67,7 @@ export class SlashingAPI extends BaseAPI { tombstoned: x.tombstoned, missed_blocks_counter: Number.parseInt(x.missed_blocks_counter), })) - ); + ) } /** @@ -76,10 +75,9 @@ export class SlashingAPI extends BaseAPI { */ public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: SlashingParams.Data }>( - `/cosmos/slashing/v1beta1/params`, - params - ) - .then(({ params: d }) => SlashingParams.fromData(d)); + .get<{ + params: SlashingParams.Data + }>(`/cosmos/slashing/v1beta1/params`, params) + .then(({ params: d }) => SlashingParams.fromData(d)) } } diff --git a/src/client/lcd/api/TendermintAPI.spec.ts b/src/client/lcd/api/TendermintAPI.spec.ts index 558b74d..beb6e8e 100644 --- a/src/client/lcd/api/TendermintAPI.spec.ts +++ b/src/client/lcd/api/TendermintAPI.spec.ts @@ -1,28 +1,28 @@ -import { APIRequester } from '../APIRequester'; -import { TendermintAPI } from './TendermintAPI'; -import { Tx } from '../../../core'; -import { Tx as Tx_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx'; +import { APIRequester } from '../APIRequester' +import { TendermintAPI } from './TendermintAPI' +import { Tx } from '../../../core' +import { Tx as Tx_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const tendermint = new TendermintAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const tendermint = new TendermintAPI(c) describe('TendermintAPI', () => { it('load block and decode txs', async () => { - const blockInfo = await tendermint.blockInfo(1); + const blockInfo = await tendermint.blockInfo(1) if (blockInfo.block.data.txs != null) { - blockInfo.block.data.txs.every(txBytes => { - const txProto = Tx_pb.decode(Buffer.from(txBytes, 'base64')); - expect(Tx.fromProto(txProto)).toBeDefined(); - }); + blockInfo.block.data.txs.every((txBytes) => { + const txProto = Tx_pb.decode(Buffer.from(txBytes, 'base64')) + expect(Tx.fromProto(txProto)).toBeDefined() + }) } - }); + }) it('node info', async () => { - await expect(tendermint.nodeInfo()).resolves.toBeInstanceOf(Object); - }); + await expect(tendermint.nodeInfo()).resolves.toBeInstanceOf(Object) + }) it('validator set (latest)', async () => { - const vals = await tendermint.validatorSet(); + const vals = await tendermint.validatorSet() expect(vals[0]).toContainEqual({ address: expect.any(String), @@ -32,11 +32,11 @@ describe('TendermintAPI', () => { }, proposer_priority: expect.any(String), voting_power: expect.any(String), - }); - }); + }) + }) it('validator set (1)', async () => { - const vals = await tendermint.validatorSet(1); + const vals = await tendermint.validatorSet(1) expect(vals[0]).toContainEqual({ address: expect.any(String), @@ -46,14 +46,14 @@ describe('TendermintAPI', () => { }, proposer_priority: expect.any(String), voting_power: expect.any(String), - }); - }); + }) + }) it('block info', async () => { - const block = await tendermint.blockInfo(); + const block = await tendermint.blockInfo() expect(block).toMatchObject({ block: expect.any(Object), - }); - }); -}); + }) + }) +}) diff --git a/src/client/lcd/api/TendermintAPI.ts b/src/client/lcd/api/TendermintAPI.ts index a85bb79..4487c40 100644 --- a/src/client/lcd/api/TendermintAPI.ts +++ b/src/client/lcd/api/TendermintAPI.ts @@ -1,12 +1,12 @@ -import { BaseAPI } from './BaseAPI'; -import { BlockInfo, ValConsAddress, ValConsPublicKey } from '../../../core'; -import { APIParams, Pagination } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { BlockInfo, ValConsAddress, ValConsPublicKey } from '../../../core' +import { APIParams, Pagination } from '../APIRequester' export interface DelegateValidator { - address: ValConsAddress; - pub_key: ValConsPublicKey.Data; - proposer_priority: string; - voting_power: string; + address: ValConsAddress + pub_key: ValConsPublicKey.Data + proposer_priority: string + voting_power: string } export class TendermintAPI extends BaseAPI { @@ -14,7 +14,7 @@ export class TendermintAPI extends BaseAPI { * Gets the node's information. */ public async nodeInfo(params: APIParams = {}): Promise { - return this.c.getRaw(`/cosmos/base/tendermint/v1beta1/node_info`, params); + return this.c.getRaw(`/cosmos/base/tendermint/v1beta1/node_info`, params) } /** @@ -22,11 +22,10 @@ export class TendermintAPI extends BaseAPI { */ public async chainId(params: APIParams = {}): Promise { return this.c - .get<{ default_node_info: { network: string } }>( - `/cosmos/base/tendermint/v1beta1/node_info`, - params - ) - .then(res => res?.default_node_info?.network); + .get<{ + default_node_info: { network: string } + }>(`/cosmos/base/tendermint/v1beta1/node_info`, params) + .then((res) => res?.default_node_info?.network) } /** @@ -34,11 +33,10 @@ export class TendermintAPI extends BaseAPI { */ public async syncing(params: APIParams = {}): Promise { return this.c - .getRaw<{ syncing: boolean }>( - `/cosmos/base/tendermint/v1beta1/syncing`, - params - ) - .then(d => d.syncing); + .getRaw<{ + syncing: boolean + }>(`/cosmos/base/tendermint/v1beta1/syncing`, params) + .then((d) => d.syncing) } /** @@ -52,14 +50,14 @@ export class TendermintAPI extends BaseAPI { const url = height !== undefined ? `/cosmos/base/tendermint/v1beta1/validatorsets/${height}` - : `/cosmos/base/tendermint/v1beta1/validatorsets/latest`; + : `/cosmos/base/tendermint/v1beta1/validatorsets/latest` return this.c .get<{ - block_height: string; - validators: DelegateValidator[]; - pagination: Pagination; + block_height: string + validators: DelegateValidator[] + pagination: Pagination }>(url, params) - .then(d => [d.validators, d.pagination]); + .then((d) => [d.validators, d.pagination]) } /** @@ -73,7 +71,7 @@ export class TendermintAPI extends BaseAPI { const url = height !== undefined ? `/cosmos/base/tendermint/v1beta1/blocks/${height}` - : `/cosmos/base/tendermint/v1beta1/blocks/latest`; - return this.c.getRaw(url, params); + : `/cosmos/base/tendermint/v1beta1/blocks/latest` + return this.c.getRaw(url, params) } } diff --git a/src/client/lcd/api/TokenfactoryAPI.ts b/src/client/lcd/api/TokenfactoryAPI.ts index d947b49..695f0b6 100644 --- a/src/client/lcd/api/TokenfactoryAPI.ts +++ b/src/client/lcd/api/TokenfactoryAPI.ts @@ -1,9 +1,9 @@ -import { TokenfactoryParams } from '../../../core'; -import { APIParams } from '../APIRequester'; -import { BaseAPI } from './BaseAPI'; +import { TokenfactoryParams } from '../../../core' +import { APIParams } from '../APIRequester' +import { BaseAPI } from './BaseAPI' export interface AuthorityMetadata { - admin: string; + admin: string } export class TokenfactoryAPI extends BaseAPI { @@ -12,11 +12,10 @@ export class TokenfactoryAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ authority_metadata: AuthorityMetadata }>( - `/miniwasm/tokenfactory/v1/denoms/${denom}/authority_metadata`, - params - ) - .then(d => d.authority_metadata); + .get<{ + authority_metadata: AuthorityMetadata + }>(`/miniwasm/tokenfactory/v1/denoms/${denom}/authority_metadata`, params) + .then((d) => d.authority_metadata) } public async beforeSendHookAddr( @@ -24,11 +23,10 @@ export class TokenfactoryAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ cosmwasm_address: string }>( - `/miniwasm/tokenfactory/v1/denoms/${denom}/before_send_hook`, - params - ) - .then(d => d.cosmwasm_address); + .get<{ + cosmwasm_address: string + }>(`/miniwasm/tokenfactory/v1/denoms/${denom}/before_send_hook`, params) + .then((d) => d.cosmwasm_address) } public async denomsFromCreator( @@ -36,19 +34,17 @@ export class TokenfactoryAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ denoms: string[] }>( - `/miniwasm/tokenfactory/v1/denoms_from_creator/${creator}`, - params - ) - .then(d => d.denoms); + .get<{ + denoms: string[] + }>(`/miniwasm/tokenfactory/v1/denoms_from_creator/${creator}`, params) + .then((d) => d.denoms) } public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: TokenfactoryParams.Data }>( - `/miniwasm/tokenfactory/v1/params`, - params - ) - .then(({ params: d }) => TokenfactoryParams.fromData(d)); + .get<{ + params: TokenfactoryParams.Data + }>(`/miniwasm/tokenfactory/v1/params`, params) + .then(({ params: d }) => TokenfactoryParams.fromData(d)) } } diff --git a/src/client/lcd/api/TxAPI.spec.ts b/src/client/lcd/api/TxAPI.spec.ts index a73f4cc..eb9e997 100644 --- a/src/client/lcd/api/TxAPI.spec.ts +++ b/src/client/lcd/api/TxAPI.spec.ts @@ -1,23 +1,23 @@ -import { LCDClient } from '../LCDClient'; -import { APIRequester } from '../APIRequester'; -import { MsgSend } from '../../../core'; -import { MnemonicKey } from '../../../key'; -import { isTxError } from './TxAPI'; +import { LCDClient } from '../LCDClient' +import { APIRequester } from '../APIRequester' +import { MsgSend } from '../../../core' +import { MnemonicKey } from '../../../key' +import { isTxError } from './TxAPI' const mk = new MnemonicKey({ mnemonic: 'sound hour era feature bacon code drift deal raw toward soldier nation winter consider tissue jewel script result mean faculty water exist lunch betray', -}); +}) const initia = new LCDClient('https://stone-rest.initia.tech', { chainId: 'stone-3', -}); -const wallet = initia.wallet(mk); +}) +const wallet = initia.wallet(mk) describe('TxAPI', () => { describe('broadcast', () => { beforeEach(() => { // Need to respond to requests made by createAndSignTx. - jest.spyOn(APIRequester.prototype, 'get').mockImplementation(route => { + jest.spyOn(APIRequester.prototype, 'get').mockImplementation((route) => { if (route.includes('/cosmos/auth/v1beta1/accounts')) { return Promise.resolve({ account: { @@ -27,12 +27,12 @@ describe('TxAPI', () => { account_number: 1, sequence: 1, }, - }); + }) } - return Promise.resolve(); - }); + return Promise.resolve() + }) - jest.spyOn(APIRequester.prototype, 'post').mockImplementation(route => { + jest.spyOn(APIRequester.prototype, 'post').mockImplementation((route) => { if (route.includes('/cosmos/tx/v1beta1/simulate')) { return Promise.resolve({ gas_info: { @@ -44,7 +44,7 @@ describe('TxAPI', () => { log: '', events: [], }, - }); + }) } return Promise.resolve({ @@ -53,82 +53,86 @@ describe('TxAPI', () => { '4E63BF998EC3C8765400C800122207FB151B84123673554AAEB8BDF443AEDC39', }, tx: {}, - }); - }); - }); + }) + }) + }) afterEach(() => { - jest.clearAllMocks(); - }); + jest.clearAllMocks() + }) it('broadcast fetches and returns txInfo', async () => { - jest.spyOn(APIRequester.prototype, 'getRaw').mockImplementation(route => { - if (route.includes('/cosmos/tx/v1beta1/txs/')) { - return Promise.resolve({ - tx_response: { - txhash: 'txInfo.txhash', - raw_log: '[]', - gas_wanted: 20000, - gas_used: 20000, - height: 20000, - logs: [], - timestamp: '1650608740', - tx: { - '@type': '/cosmos.tx.v1beta1.Tx', - body: { - messages: [], - memo: '', - }, - auth_info: { - signer_infos: [], - fee: { - amount: [], - gas_limit: '300000', - payer: '', - granter: '', + jest + .spyOn(APIRequester.prototype, 'getRaw') + .mockImplementation((route) => { + if (route.includes('/cosmos/tx/v1beta1/txs/')) { + return Promise.resolve({ + tx_response: { + txhash: 'txInfo.txhash', + raw_log: '[]', + gas_wanted: 20000, + gas_used: 20000, + height: 20000, + logs: [], + timestamp: '1650608740', + tx: { + '@type': '/cosmos.tx.v1beta1.Tx', + body: { + messages: [], + memo: '', + }, + auth_info: { + signer_infos: [], + fee: { + amount: [], + gas_limit: '300000', + payer: '', + granter: '', + }, }, + signatures: [], }, - signatures: [], }, - }, - }); - } - return Promise.resolve(); - }); + }) + } + return Promise.resolve() + }) const send = new MsgSend( 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs', 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs', { uinit: '1000000' } - ); + ) - const tx = await wallet.createAndSignTx({ msgs: [send] }); - const txInfo = await initia.tx.broadcast(tx); + const tx = await wallet.createAndSignTx({ msgs: [send] }) + const txInfo = await initia.tx.broadcast(tx) - expect(isTxError(txInfo)).toBeFalsy(); - }); + expect(isTxError(txInfo)).toBeFalsy() + }) it('broadcast timesout if txInfo not found in time', async () => { - jest.spyOn(APIRequester.prototype, 'getRaw').mockImplementation(route => { - if (route.includes('/cosmos/tx/v1beta1/txs/')) { - // Force an error to emulate a transaction not found. - return Promise.reject(); - } + jest + .spyOn(APIRequester.prototype, 'getRaw') + .mockImplementation((route) => { + if (route.includes('/cosmos/tx/v1beta1/txs/')) { + // Force an error to emulate a transaction not found. + return Promise.reject() + } - return Promise.resolve(); - }); + return Promise.resolve() + }) const send = new MsgSend( 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs', 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs', { uinit: '1000000' } - ); + ) - const tx = await wallet.createAndSignTx({ msgs: [send] }); + const tx = await wallet.createAndSignTx({ msgs: [send] }) await expect(async () => { - await initia.tx.broadcast(tx, 500); - }).rejects.toThrow('Transaction was not included in a block'); - }); - }); -}); + await initia.tx.broadcast(tx, 500) + }).rejects.toThrow('Transaction was not included in a block') + }) + }) +}) diff --git a/src/client/lcd/api/TxAPI.ts b/src/client/lcd/api/TxAPI.ts index 4edb9d8..50bfcc1 100644 --- a/src/client/lcd/api/TxAPI.ts +++ b/src/client/lcd/api/TxAPI.ts @@ -1,4 +1,4 @@ -import { BaseAPI } from './BaseAPI'; +import { BaseAPI } from './BaseAPI' import { Msg, Tx, @@ -11,146 +11,143 @@ import { num, TxLog, Event, -} from '../../../core'; -import { hashToHex } from '../../../util'; -import { LCDClient } from '../LCDClient'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; -import { BroadcastMode } from '@initia/initia.proto/cosmos/tx/v1beta1/service'; +} from '../../../core' +import { hashToHex } from '../../../util' +import { LCDClient } from '../LCDClient' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' +import { BroadcastMode } from '@initia/initia.proto/cosmos/tx/v1beta1/service' interface Wait { - height: number; - txhash: string; - raw_log: string; - gas_wanted: number; - gas_used: number; - logs: TxLog[]; - timestamp: string; + height: number + txhash: string + raw_log: string + gas_wanted: number + gas_used: number + logs: TxLog[] + timestamp: string } interface Block extends Wait { - info: string; - data: string; + info: string + data: string } interface Sync { - height: number; - txhash: string; - raw_log: string; + height: number + txhash: string + raw_log: string } interface Async { - height: number; - txhash: string; + height: number + txhash: string } export type TxBroadcastResult< B extends Wait | Block | Sync | Async, - C extends TxSuccess | TxError | {} -> = B & C; + C extends TxSuccess | TxError | object, +> = B & C export interface TxSuccess { - logs: TxLog[]; + logs: TxLog[] } export interface TxError { - code: number | string; - codespace?: string; + code: number | string + codespace?: string } -export type WaitTxBroadcastResult = TxBroadcastResult< - Wait, - TxSuccess | TxError ->; +export type WaitTxBroadcastResult = TxBroadcastResult export type BlockTxBroadcastResult = TxBroadcastResult< Block, TxSuccess | TxError ->; -export type SyncTxBroadcastResult = TxBroadcastResult; -export type AsyncTxBroadcastResult = TxBroadcastResult; +> +export type SyncTxBroadcastResult = TxBroadcastResult +export type AsyncTxBroadcastResult = TxBroadcastResult export function isTxError< T extends TxBroadcastResult, B extends Wait | Block | Sync, - C extends TxSuccess | TxError | {} + C extends TxSuccess | TxError | object, >(x: T): x is T & TxBroadcastResult { return ( (x as T & TxError).code !== undefined && (x as T & TxError).code !== 0 && (x as T & TxError).code !== '0' - ); + ) } export namespace BlockTxBroadcastResult { export interface Data { - height: string; - txhash: string; - raw_log: string; - gas_wanted: string; - gas_used: string; - logs: TxLog.Data[]; - code: number | string; - codespace: string; - info: string; - data: string; - timestamp: string; - events: Event[]; + height: string + txhash: string + raw_log: string + gas_wanted: string + gas_used: string + logs: TxLog.Data[] + code: number | string + codespace: string + info: string + data: string + timestamp: string + events: Event[] } } export namespace AsyncTxBroadcastResult { - export type Data = Pick; + export type Data = Pick } export namespace SyncTxBroadcastResult { export type Data = Pick< BlockTxBroadcastResult.Data, 'height' | 'txhash' | 'raw_log' | 'code' | 'codespace' - >; + > } export interface SignerOptions { - address: string; - sequenceNumber?: number; - publicKey?: PublicKey; + address: string + sequenceNumber?: number + publicKey?: PublicKey } export interface SignerData { - sequenceNumber: number; - publicKey?: PublicKey; + sequenceNumber: number + publicKey?: PublicKey } export interface CreateTxOptions { - msgs: Msg[]; - fee?: Fee; - memo?: string; - gas?: string; - gasPrices?: Coins.Input; - gasAdjustment?: number | string; - feeDenoms?: string[]; - timeoutHeight?: number; + msgs: Msg[] + fee?: Fee + memo?: string + gas?: string + gasPrices?: Coins.Input + gasAdjustment?: number | string + feeDenoms?: string[] + timeoutHeight?: number } export interface TxResult { - tx: TxInfo; + tx: TxInfo } export namespace TxResult { export interface Data { - tx: Tx.Data; - tx_response: TxInfo.Data; + tx: Tx.Data + tx_response: TxInfo.Data } } export interface TxSearchResult { - pagination: Pagination; - txs: TxInfo[]; + pagination: Pagination + txs: TxInfo[] } export namespace TxSearchResult { export interface Data { - txs: Tx.Data[]; - tx_responses: TxInfo.Data[]; - pagination: Pagination; + txs: Tx.Data[] + tx_responses: TxInfo.Data[] + pagination: Pagination } } @@ -158,9 +155,9 @@ export class SimulateResponse { constructor( public gas_info: { gas_wanted: number; gas_used: number }, public result: { - data: string; - log: string; - events: { type: string; attributes: { key: string; value: string }[] }[]; + data: string + log: string + events: { type: string; attributes: { key: string; value: string }[] }[] } ) {} @@ -171,31 +168,31 @@ export class SimulateResponse { gas_used: Number.parseInt(data.gas_info.gas_used), }, data.result - ); + ) } } export namespace SimulateResponse { export interface Data { gas_info: { - gas_wanted: string; - gas_used: string; - }; + gas_wanted: string + gas_used: string + } result: { - data: string; - log: string; - events: { type: string; attributes: { key: string; value: string }[] }[]; - }; + data: string + log: string + events: { type: string; attributes: { key: string; value: string }[] }[] + } } } export interface TxSearchOptions extends PaginationOptions { - query: { key: string; value: string }[]; + query: { key: string; value: string }[] } export class TxAPI extends BaseAPI { constructor(public lcd: LCDClient) { - super(lcd.apiRequester); + super(lcd.apiRequester) } /** @@ -205,7 +202,7 @@ export class TxAPI extends BaseAPI { public async txInfo(txHash: string, params: APIParams = {}): Promise { return this.c .getRaw(`/cosmos/tx/v1beta1/txs/${txHash}`, params) - .then(v => TxInfo.fromData(v.tx_response)); + .then((v) => TxInfo.fromData(v.tx_response)) } /** @@ -222,40 +219,40 @@ export class TxAPI extends BaseAPI { signers: SignerOptions[], options: CreateTxOptions ): Promise { - let { fee } = options; - const { msgs, memo, timeoutHeight } = options; + let { fee } = options + const { msgs, memo, timeoutHeight } = options - const signerDatas: SignerData[] = []; + const signerDatas: SignerData[] = [] for (const signer of signers) { - let sequenceNumber = signer.sequenceNumber; - let publicKey = signer.publicKey; + let sequenceNumber = signer.sequenceNumber + let publicKey = signer.publicKey if (sequenceNumber === undefined || !publicKey) { - const account = await this.lcd.auth.accountInfo(signer.address); + const account = await this.lcd.auth.accountInfo(signer.address) if (sequenceNumber === undefined) { - sequenceNumber = account.getSequenceNumber(); + sequenceNumber = account.getSequenceNumber() } if (!publicKey) { - publicKey = account.getPublicKey(); + publicKey = account.getPublicKey() } } signerDatas.push({ sequenceNumber, publicKey, - }); + }) } if (fee === undefined) { - fee = await this.lcd.tx.estimateFee(signerDatas, options); + fee = await this.lcd.tx.estimateFee(signerDatas, options) } return new Tx( new TxBody(msgs, memo ?? '', timeoutHeight ?? 0), new AuthInfo([], fee), [] - ); + ) } /** @@ -264,19 +261,19 @@ export class TxAPI extends BaseAPI { * @param height block height */ public async txInfosByHeight(height: number | undefined): Promise { - const blockInfo = await this.lcd.tendermint.blockInfo(height); - const { txs } = blockInfo.block.data; + const blockInfo = await this.lcd.tendermint.blockInfo(height) + const { txs } = blockInfo.block.data if (!txs) { - return []; + return [] } else { - const txhashes = txs.map(txdata => hashToHex(txdata)); - const txInfos: TxInfo[] = []; + const txhashes = txs.map((txdata) => hashToHex(txdata)) + const txInfos: TxInfo[] = [] for (const txhash of txhashes) { - txInfos.push(await this.txInfo(txhash)); + txInfos.push(await this.txInfo(txhash)) } - return txInfos; + return txInfos } } @@ -290,76 +287,75 @@ export class TxAPI extends BaseAPI { signers: SignerData[], options: CreateTxOptions ): Promise { - const gasPrices = options.gasPrices ?? this.lcd.config.gasPrices; - const gasAdjustment = - options.gasAdjustment ?? this.lcd.config.gasAdjustment; - const feeDenoms = options.feeDenoms ?? ['uinit']; - let gas = options.gas; - let gasPricesCoins: Coins | undefined; + const gasPrices = options.gasPrices ?? this.lcd.config.gasPrices + const gasAdjustment = options.gasAdjustment ?? this.lcd.config.gasAdjustment + const feeDenoms = options.feeDenoms ?? ['uinit'] + let gas = options.gas + let gasPricesCoins: Coins | undefined if (gasPrices) { - gasPricesCoins = new Coins(gasPrices); + gasPricesCoins = new Coins(gasPrices) if (feeDenoms) { - const gasPricesCoinsFiltered = gasPricesCoins.filter(c => + const gasPricesCoinsFiltered = gasPricesCoins.filter((c) => feeDenoms.includes(c.denom) - ); + ) if (gasPricesCoinsFiltered.toArray().length > 0) { - gasPricesCoins = gasPricesCoinsFiltered; + gasPricesCoins = gasPricesCoinsFiltered } } } - const txBody = new TxBody(options.msgs, options.memo ?? ''); - const authInfo = new AuthInfo([], new Fee(0, new Coins())); - const tx = new Tx(txBody, authInfo, []); + const txBody = new TxBody(options.msgs, options.memo ?? '') + const authInfo = new AuthInfo([], new Fee(0, new Coins())) + const tx = new Tx(txBody, authInfo, []) // fill empty signature - tx.appendEmptySignatures(signers); + tx.appendEmptySignatures(signers) // simulate gas if (!gas || gas === 'auto' || gas === '0') { - gas = await this.estimateGas(tx, { gasAdjustment }); + gas = await this.estimateGas(tx, { gasAdjustment }) } const feeAmount = gasPricesCoins ? gasPricesCoins.mul(gas).toIntCeilCoins() - : '0uinit'; + : '0uinit' - return new Fee(Number.parseInt(gas), feeAmount, '', ''); + return new Fee(Number.parseInt(gas), feeAmount, '', '') } public async estimateGas( tx: Tx, options?: { - gasAdjustment?: number | string; - signers?: SignerData[]; + gasAdjustment?: number | string + signers?: SignerData[] } ): Promise { const gasAdjustment = - options?.gasAdjustment ?? this.lcd.config.gasAdjustment; + options?.gasAdjustment ?? this.lcd.config.gasAdjustment // append empty signatures if there's no signatures in tx - let simTx: Tx = tx; + let simTx: Tx = tx if (tx.signatures.length <= 0) { if (!(options && options.signers && options.signers.length > 0)) { - throw new Error('cannot append signature'); + throw new Error('cannot append signature') } - const authInfo = new AuthInfo([], new Fee(0, new Coins())); - simTx = new Tx(tx.body, authInfo, []); - simTx.appendEmptySignatures(options.signers); + const authInfo = new AuthInfo([], new Fee(0, new Coins())) + simTx = new Tx(tx.body, authInfo, []) + simTx.appendEmptySignatures(options.signers) } const simulateRes = await this.c .post(`/cosmos/tx/v1beta1/simulate`, { tx_bytes: TxAPI.encode(simTx), }) - .then(d => SimulateResponse.fromData(d)); + .then((d) => SimulateResponse.fromData(d)) return num(gasAdjustment ?? 0) .multipliedBy(simulateRes.gas_info.gas_used) - .toString(); + .toString() } /** @@ -367,7 +363,7 @@ export class TxAPI extends BaseAPI { * @param tx transaction to encode */ public static encode(tx: Tx): string { - return Buffer.from(tx.toBytes()).toString('base64'); + return Buffer.from(tx.toBytes()).toString('base64') } /** @@ -375,7 +371,7 @@ export class TxAPI extends BaseAPI { * @param tx transaction string to decode */ public static decode(encodedTx: string): Tx { - return Tx.fromBuffer(Buffer.from(encodedTx, 'base64')); + return Tx.fromBuffer(Buffer.from(encodedTx, 'base64')) } /** @@ -383,19 +379,19 @@ export class TxAPI extends BaseAPI { * @param tx transaction to hash */ public static hash(tx: Tx): string { - const txBytes = TxAPI.encode(tx); - return hashToHex(txBytes); + const txBytes = TxAPI.encode(tx) + return hashToHex(txBytes) } private async _broadcast( tx: Tx | string, mode: keyof typeof BroadcastMode ): Promise { - const txBytes = tx instanceof Tx ? TxAPI.encode(tx) : tx; + const txBytes = tx instanceof Tx ? TxAPI.encode(tx) : tx return await this.c.post(`/cosmos/tx/v1beta1/txs`, { tx_bytes: txBytes, mode, - }); + }) } /** @@ -410,10 +406,10 @@ export class TxAPI extends BaseAPI { tx: Tx | string, timeout = 30000 ): Promise { - const POLL_INTERVAL = 500; + const POLL_INTERVAL = 500 const { tx_response: txResponse } = await this._broadcast<{ - tx_response: SyncTxBroadcastResult.Data; - }>(tx, 'BROADCAST_MODE_SYNC'); + tx_response: SyncTxBroadcastResult.Data + }>(tx, 'BROADCAST_MODE_SYNC') if (txResponse.code != undefined && txResponse.code != 0) { const result: WaitTxBroadcastResult = { @@ -426,29 +422,29 @@ export class TxAPI extends BaseAPI { gas_wanted: 0, timestamp: '', logs: [], - }; - return result; + } + return result } - let txInfo: undefined | TxInfo; + let txInfo: undefined | TxInfo for (let i = 0; i <= timeout / POLL_INTERVAL; i++) { try { - txInfo = await this.txInfo(txResponse.txhash); + txInfo = await this.txInfo(txResponse.txhash) } catch (error) { // Errors when transaction is not found. } if (txInfo) { - break; + break } - await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL)); + await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL)) } if (!txInfo) { throw new Error( `Transaction was not included in a block before timeout of ${timeout}ms` - ); + ) } return { @@ -457,11 +453,11 @@ export class TxAPI extends BaseAPI { gas_wanted: txInfo.gas_wanted, gas_used: txInfo.gas_used, height: +txInfo.height, - logs: (txInfo.logs ?? []).map(l => TxLog.fromData(l)), + logs: (txInfo.logs ?? []).map((l) => TxLog.fromData(l)), code: txInfo.code, codespace: txInfo.codespace, timestamp: txInfo.timestamp, - }; + } } /** @@ -480,18 +476,18 @@ export class TxAPI extends BaseAPI { height: +d.height, txhash: d.txhash, raw_log: d.raw_log, - }; + } if (d.code) { - blockResult.code = d.code; + blockResult.code = d.code } if (d.codespace) { - blockResult.codespace = d.codespace; + blockResult.codespace = d.codespace } - return blockResult; - }); + return blockResult + }) } /** @@ -507,7 +503,7 @@ export class TxAPI extends BaseAPI { ).then(({ tx_response: d }) => ({ height: +d.height, txhash: d.txhash, - })); + })) } /** @@ -517,29 +513,31 @@ export class TxAPI extends BaseAPI { public async search( options: Partial ): Promise { - const params = new URLSearchParams(); + const params = new URLSearchParams() // build search params - options.query?.forEach(v => + options.query?.forEach((v) => params.append( 'query', v.key === 'tx.height' ? `${v.key}=${v.value}` : `${v.key}='${v.value}'` ) - ); + ) - delete options['query']; + delete options['query'] - Object.entries(options).forEach(v => { - params.append(v[0], v[1] as string); - }); + Object.entries(options).forEach((v) => { + params.append(v[0], v[1] as string) + }) return this.c .getRaw(`/cosmos/tx/v1beta1/txs`, params) - .then(d => { + .then((d) => { return { - txs: d.tx_responses.map(tx_response => TxInfo.fromData(tx_response)), + txs: d.tx_responses.map((tx_response) => + TxInfo.fromData(tx_response) + ), pagination: d.pagination, - }; - }); + } + }) } } diff --git a/src/client/lcd/api/UpgradeAPI.spec.ts b/src/client/lcd/api/UpgradeAPI.spec.ts index 66ce9a7..4ca4430 100644 --- a/src/client/lcd/api/UpgradeAPI.spec.ts +++ b/src/client/lcd/api/UpgradeAPI.spec.ts @@ -1,28 +1,28 @@ -import { APIRequester } from '../APIRequester'; -import { Plan } from '../../../core'; -import { UpgradeAPI } from './UpgradeAPI'; +import { APIRequester } from '../APIRequester' +import { Plan } from '../../../core' +import { UpgradeAPI } from './UpgradeAPI' -const c = new APIRequester('https://stone-rest.initia.tech/'); -const upgrade = new UpgradeAPI(c); +const c = new APIRequester('https://stone-rest.initia.tech/') +const upgrade = new UpgradeAPI(c) describe('UpgradeAPI', () => { describe('applied_plan', () => { it('0 for invalid name', async () => { - const height = await upgrade.appliedPlan('there_is_no_plan_like_this'); - expect(height).toEqual(0); - }); - }); + const height = await upgrade.appliedPlan('there_is_no_plan_like_this') + expect(height).toEqual(0) + }) + }) describe('current_plan', () => { it('null plan', async () => { - const plan = await upgrade.currentPlan(); - expect(plan == null || plan instanceof Plan); - }); - }); + const plan = await upgrade.currentPlan() + expect(plan == null || plan instanceof Plan) + }) + }) describe('node_versions', () => { it('module count', async () => { - expect(await upgrade.moduleVersions()).toHaveLength(22); - }); - }); -}); + expect(await upgrade.moduleVersions()).toHaveLength(22) + }) + }) +}) diff --git a/src/client/lcd/api/UpgradeAPI.ts b/src/client/lcd/api/UpgradeAPI.ts index 1bf3df9..0bce0b2 100644 --- a/src/client/lcd/api/UpgradeAPI.ts +++ b/src/client/lcd/api/UpgradeAPI.ts @@ -1,16 +1,16 @@ -import { BaseAPI } from './BaseAPI'; -import { Plan } from '../../../core'; -import { APIParams, PaginationOptions } from '../APIRequester'; +import { BaseAPI } from './BaseAPI' +import { Plan } from '../../../core' +import { APIParams, PaginationOptions } from '../APIRequester' export interface ModuleVersion { - name: string; - version: number; + name: string + version: number } export namespace ModuleVersion { export interface Data { - name: string; - version: string; + name: string + version: string } } @@ -24,11 +24,10 @@ export class UpgradeAPI extends BaseAPI { params: Partial = {} ): Promise { return this.c - .get<{ height: string }>( - `/cosmos/upgrade/v1beta1/applied_plan/${name}`, - params - ) - .then(d => Number.parseInt(d.height)); + .get<{ + height: string + }>(`/cosmos/upgrade/v1beta1/applied_plan/${name}`, params) + .then((d) => Number.parseInt(d.height)) } /** @@ -37,7 +36,7 @@ export class UpgradeAPI extends BaseAPI { public async currentPlan(params: APIParams = {}): Promise { return this.c .get<{ plan?: Plan.Data }>(`/cosmos/upgrade/v1beta1/current_plan`, params) - .then(d => (d.plan ? Plan.fromData(d.plan) : undefined)); + .then((d) => (d.plan ? Plan.fromData(d.plan) : undefined)) } /** @@ -48,12 +47,12 @@ export class UpgradeAPI extends BaseAPI { ): Promise { return this.c .get<{ - module_versions: ModuleVersion.Data[]; + module_versions: ModuleVersion.Data[] }>(`/cosmos/upgrade/v1beta1/module_versions`, params) - .then(d => - d.module_versions.map(mv => { - return { name: mv.name, version: Number.parseInt(mv.version) }; + .then((d) => + d.module_versions.map((mv) => { + return { name: mv.name, version: Number.parseInt(mv.version) } }) - ); + ) } } diff --git a/src/client/lcd/api/WasmAPI.ts b/src/client/lcd/api/WasmAPI.ts index f45ce7a..c43e094 100644 --- a/src/client/lcd/api/WasmAPI.ts +++ b/src/client/lcd/api/WasmAPI.ts @@ -1,78 +1,78 @@ -import { BaseAPI } from './BaseAPI'; +import { BaseAPI } from './BaseAPI' import { AbsoluteTxPosition, AccAddress, AccessConfig, WasmParams, -} from '../../../core'; -import { APIParams, Pagination, PaginationOptions } from '../APIRequester'; +} from '../../../core' +import { APIParams, Pagination, PaginationOptions } from '../APIRequester' import { ContractCodeHistoryOperationType, contractCodeHistoryOperationTypeFromJSON, -} from '@initia/initia.proto/cosmwasm/wasm/v1/types'; +} from '@initia/initia.proto/cosmwasm/wasm/v1/types' export interface ContractInfo { - code_id: number; - creator: AccAddress; - admin?: AccAddress; - label?: string; - created: AbsoluteTxPosition; - ibc_port_id: string; + code_id: number + creator: AccAddress + admin?: AccAddress + label?: string + created: AbsoluteTxPosition + ibc_port_id: string extension: { - type_url: string; - value: string; - }; + type_url: string + value: string + } } export namespace ContractInfo { export interface Data { - code_id: string; - creator: AccAddress; - admin?: AccAddress; - label?: string; - created: AbsoluteTxPosition.Data; - ibc_port_id: string; + code_id: string + creator: AccAddress + admin?: AccAddress + label?: string + created: AbsoluteTxPosition.Data + ibc_port_id: string extension: { - type_url: string; - value: string; - }; + type_url: string + value: string + } } } export interface ContractCodeHistoryEntry { - operation: ContractCodeHistoryOperationType; - code_id: number; - updated: AbsoluteTxPosition; - msg: string; + operation: ContractCodeHistoryOperationType + code_id: number + updated: AbsoluteTxPosition + msg: string } export namespace ContractCodeHistoryEntry { export interface Data { - operation: string; - code_id: string; - updated: AbsoluteTxPosition.Data; - msg: string; + operation: string + code_id: string + updated: AbsoluteTxPosition.Data + msg: string } } export interface Model { - key: string; - value: string; + key: string + value: string } export interface CodeInfo { - code_id: number; - creator: AccAddress; - data_hash: string; - instantiate_permission: AccessConfig; + code_id: number + creator: AccAddress + data_hash: string + instantiate_permission: AccessConfig } export namespace CodeInfo { export interface Data { - code_id: string; - creator: AccAddress; - data_hash: string; - instantiate_permission: AccessConfig.Data; + code_id: string + creator: AccAddress + data_hash: string + instantiate_permission: AccessConfig.Data } } @@ -83,10 +83,10 @@ export class WasmAPI extends BaseAPI { ): Promise { return this.c .get<{ - address: AccAddress; - contract_info: ContractInfo.Data; + address: AccAddress + contract_info: ContractInfo.Data }>(`/cosmwasm/wasm/v1/contract/${address}`, params) - .then(d => ({ + .then((d) => ({ code_id: Number.parseInt(d.contract_info.code_id), creator: d.contract_info.creator, admin: d.contract_info.admin, @@ -94,7 +94,7 @@ export class WasmAPI extends BaseAPI { created: AbsoluteTxPosition.fromData(d.contract_info.created), ibc_port_id: d.contract_info.ibc_port_id, extension: d.contract_info.extension, - })); + })) } public async contractHistory( @@ -103,18 +103,18 @@ export class WasmAPI extends BaseAPI { ): Promise<[ContractCodeHistoryEntry[], Pagination]> { return this.c .get<{ - entries: ContractCodeHistoryEntry.Data[]; - pagination: Pagination; + entries: ContractCodeHistoryEntry.Data[] + pagination: Pagination }>(`/cosmwasm/wasm/v1/contract/${address}/history`, params) - .then(d => [ - d.entries.map(entry => ({ + .then((d) => [ + d.entries.map((entry) => ({ operation: contractCodeHistoryOperationTypeFromJSON(entry.operation), code_id: Number.parseInt(entry.code_id), updated: AbsoluteTxPosition.fromData(entry.updated), msg: entry.msg, })), d.pagination, - ]); + ]) } public async contractsByCode( @@ -123,10 +123,10 @@ export class WasmAPI extends BaseAPI { ): Promise<[string[], Pagination]> { return this.c .get<{ - contracts: string[]; - pagination: Pagination; + contracts: string[] + pagination: Pagination }>(`/cosmwasm/wasm/v1/code/${codeId}/contracts`, params) - .then(d => [d.contracts, d.pagination]); + .then((d) => [d.contracts, d.pagination]) } public async allContractState( @@ -135,10 +135,10 @@ export class WasmAPI extends BaseAPI { ): Promise<[Model[], Pagination]> { return this.c .get<{ - models: Model[]; - pagination: Pagination; + models: Model[] + pagination: Pagination }>(`/cosmwasm/wasm/v1/contract/${address}/state`, params) - .then(d => [d.models, d.pagination]); + .then((d) => [d.models, d.pagination]) } public async rawContractState( @@ -147,11 +147,10 @@ export class WasmAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ data: string }>( - `/cosmwasm/wasm/v1/contract/${address}/raw/${queryData}`, - params - ) - .then(d => d.data); + .get<{ + data: string + }>(`/cosmwasm/wasm/v1/contract/${address}/raw/${queryData}`, params) + .then((d) => d.data) } public async smartContractState( @@ -160,11 +159,10 @@ export class WasmAPI extends BaseAPI { params: APIParams = {} ): Promise { return this.c - .get<{ data: T }>( - `/cosmwasm/wasm/v1/contract/${address}/smart/${queryData}`, - params - ) - .then(res => res.data as T); + .get<{ + data: T + }>(`/cosmwasm/wasm/v1/contract/${address}/smart/${queryData}`, params) + .then((res) => res.data) } public async codeInfos( @@ -172,11 +170,11 @@ export class WasmAPI extends BaseAPI { ): Promise<[CodeInfo[], Pagination]> { return this.c .get<{ - code_infos: CodeInfo.Data[]; - pagination: Pagination; + code_infos: CodeInfo.Data[] + pagination: Pagination }>(`/cosmwasm/wasm/v1/code`, params) - .then(d => [ - d.code_infos.map(info => ({ + .then((d) => [ + d.code_infos.map((info) => ({ code_id: Number.parseInt(info.code_id), creator: info.creator, data_hash: info.data_hash, @@ -185,7 +183,7 @@ export class WasmAPI extends BaseAPI { ), })), d.pagination, - ]); + ]) } public async codeInfo( @@ -193,11 +191,11 @@ export class WasmAPI extends BaseAPI { params: APIParams = {} ): Promise<{ code_info: CodeInfo; data: string }> { return this.c - .get<{ code_info: CodeInfo.Data; data: string }>( - `/cosmwasm/wasm/v1/code/${codeId}`, - params - ) - .then(d => ({ + .get<{ + code_info: CodeInfo.Data + data: string + }>(`/cosmwasm/wasm/v1/code/${codeId}`, params) + .then((d) => ({ code_info: { code_id: Number.parseInt(d.code_info.code_id), creator: d.code_info.creator, @@ -207,27 +205,26 @@ export class WasmAPI extends BaseAPI { ), }, data: d.data, - })); + })) } public async pinnedCodes( params: Partial = {} ): Promise<[number[], Pagination]> { return this.c - .get<{ code_ids: string[]; pagination: Pagination }>( - `/cosmwasm/wasm/v1/codes/pinned`, - params - ) - .then(d => [d.code_ids.map(id => Number.parseInt(id)), d.pagination]); + .get<{ + code_ids: string[] + pagination: Pagination + }>(`/cosmwasm/wasm/v1/codes/pinned`, params) + .then((d) => [d.code_ids.map((id) => Number.parseInt(id)), d.pagination]) } public async parameters(params: APIParams = {}): Promise { return this.c - .get<{ params: WasmParams.Data }>( - `/cosmwasm/wasm/v1/codes/params`, - params - ) - .then(d => WasmParams.fromData(d.params)); + .get<{ + params: WasmParams.Data + }>(`/cosmwasm/wasm/v1/codes/params`, params) + .then((d) => WasmParams.fromData(d.params)) } public async contractsByCreator( @@ -236,9 +233,9 @@ export class WasmAPI extends BaseAPI { ): Promise<[string[], Pagination]> { return this.c .get<{ - contract_addresses: string[]; - pagination: Pagination; + contract_addresses: string[] + pagination: Pagination }>(`/cosmwasm/wasm/v1/contracts/creator/${creator}`, params) - .then(d => [d.contract_addresses, d.pagination]); + .then((d) => [d.contract_addresses, d.pagination]) } } diff --git a/src/client/lcd/api/index.ts b/src/client/lcd/api/index.ts index d0bd48b..847bb38 100644 --- a/src/client/lcd/api/index.ts +++ b/src/client/lcd/api/index.ts @@ -1,30 +1,30 @@ -export * from './AuctionAPI'; -export * from './AuthAPI'; -export * from './AuthzAPI'; -export * from './BankAPI'; -export * from './DistributionAPI'; -export * from './EvidenceAPI'; -export * from './EvmAPI'; -export * from './FeeGrantAPI'; -export * from './ForwardingAPI'; -export * from './GovAPI'; -export * from './GroupAPI'; -export * from './IbcAPI'; -export * from './IbcHooksAPI'; -export * from './IbcNftAPI'; -export * from './IbcTransferAPI'; -export * from './IbcPermAPI'; -export * from './InterTxAPI'; -export * from './MarketmapAPI'; -export * from './MoveAPI'; -export * from './MstakingAPI'; -export * from './OpchildAPI'; -export * from './OphostAPI'; -export * from './OracleAPI'; -export * from './RewardAPI'; -export * from './SlashingAPI'; -export * from './TendermintAPI'; -export * from './TokenfactoryAPI'; -export * from './TxAPI'; -export * from './UpgradeAPI'; -export * from './WasmAPI'; +export * from './AuctionAPI' +export * from './AuthAPI' +export * from './AuthzAPI' +export * from './BankAPI' +export * from './DistributionAPI' +export * from './EvidenceAPI' +export * from './EvmAPI' +export * from './FeeGrantAPI' +export * from './ForwardingAPI' +export * from './GovAPI' +export * from './GroupAPI' +export * from './IbcAPI' +export * from './IbcHooksAPI' +export * from './IbcNftAPI' +export * from './IbcTransferAPI' +export * from './IbcPermAPI' +export * from './InterTxAPI' +export * from './MarketmapAPI' +export * from './MoveAPI' +export * from './MstakingAPI' +export * from './OpchildAPI' +export * from './OphostAPI' +export * from './OracleAPI' +export * from './RewardAPI' +export * from './SlashingAPI' +export * from './TendermintAPI' +export * from './TokenfactoryAPI' +export * from './TxAPI' +export * from './UpgradeAPI' +export * from './WasmAPI' diff --git a/src/core/Block.ts b/src/core/Block.ts index 0bb8c70..71c48b1 100644 --- a/src/core/Block.ts +++ b/src/core/Block.ts @@ -1,67 +1,67 @@ export interface BlockInfo { - block_id: BlockID; - block: Block; + block_id: BlockID + block: Block } export interface Block { - header: Header; - data: { txs?: string[] }; - evidence: EvidenceList; - last_commit: LastCommit; + header: Header + data: { txs?: string[] } + evidence: EvidenceList + last_commit: LastCommit } export interface EvidenceList { - evidence: string[]; + evidence: string[] } export interface Header { - version: Version; + version: Version /** blockchain ID */ - chain_id: string; + chain_id: string /** block's height */ - height: string; + height: string /** time the block was included */ - time: string; - last_block_id: BlockID; - last_commit_hash: string; - data_hash: string; - validators_hash: string; - next_validators_hash: string; - consensus_hash: string; - app_hash: string; - last_results_hash: string; - evidence_hash: string; - proposer_address: string; + time: string + last_block_id: BlockID + last_commit_hash: string + data_hash: string + validators_hash: string + next_validators_hash: string + consensus_hash: string + app_hash: string + last_results_hash: string + evidence_hash: string + proposer_address: string } export interface BlockID { - hash: string; - part_set_header: Parts; + hash: string + part_set_header: Parts } export interface Parts { - total: string; - hash: string; + total: string + hash: string } export interface Version { - block: string; - app: string; + block: string + app: string } export interface LastCommit { - height: string; - round: number; - block_id: BlockID; - signatures: Signature[]; + height: string + round: number + block_id: BlockID + signatures: Signature[] } export interface Signature { - block_id_flag: string; - validator_address: string; - timestamp: string; - signature: string; + block_id_flag: string + validator_address: string + timestamp: string + signature: string } diff --git a/src/core/Coin.spec.ts b/src/core/Coin.spec.ts index 1d3262b..142e9c5 100644 --- a/src/core/Coin.spec.ts +++ b/src/core/Coin.spec.ts @@ -1,150 +1,150 @@ -import { Coin } from './Coin'; +import { Coin } from './Coin' describe('Coin', () => { it('different types for amount', () => { - const ref = new Coin('uinit', 1000); - const coins = [new Coin('uinit', 1000.0), new Coin('uinit', '1000')]; - coins.forEach(coin => expect(coin).toEqual(ref)); - }); + const ref = new Coin('uinit', 1000) + const coins = [new Coin('uinit', 1000.0), new Coin('uinit', '1000')] + coins.forEach((coin) => expect(coin).toEqual(ref)) + }) it('deserializes Coin value', () => { const coin = Coin.fromAmino({ denom: 'uinit', amount: '1000', - }); + }) - expect(coin.denom).toEqual('uinit'); - expect(Number(coin.amount)).toEqual(1000); - }); + expect(coin.denom).toEqual('uinit') + expect(Number(coin.amount)).toEqual(1000) + }) it('serializes', () => { const coinAmino: Coin.Amino = { denom: 'uinit', amount: '1000', - }; + } - const coin = Coin.fromAmino(coinAmino); - expect(coin.toAmino()).toEqual(coinAmino); + const coin = Coin.fromAmino(coinAmino) + expect(coin.toAmino()).toEqual(coinAmino) const decCoinAmino = { denom: 'uinit', amount: '1000.000000000000000000', - }; - const decCoin = Coin.fromAmino(decCoinAmino); - expect(decCoin.toAmino()).toEqual(decCoinAmino); - }); + } + const decCoin = Coin.fromAmino(decCoinAmino) + expect(decCoin.toAmino()).toEqual(decCoinAmino) + }) it('arithmetic', () => { - const zero = new Coin('uinit', 0); - const coin = new Coin('uinit', 1000); - const coin2 = new Coin('uinit', 2000); + const zero = new Coin('uinit', 0) + const coin = new Coin('uinit', 1000) + const coin2 = new Coin('uinit', 2000) // addition - const sum = coin.add(coin2); - const decSum = coin.add(0.1); - expect(coin.add(zero).amount).toEqual(coin.amount); - expect(Number(sum.amount)).toEqual(3000); - expect(sum.denom).toEqual('uinit'); - expect(coin.add(1500)).toEqual(new Coin('uinit', 2500)); - expect(decSum.isDecimal).toBe(true); - expect(Number(decSum.amount)).toEqual(1000.1); + const sum = coin.add(coin2) + const decSum = coin.add(0.1) + expect(coin.add(zero).amount).toEqual(coin.amount) + expect(Number(sum.amount)).toEqual(3000) + expect(sum.denom).toEqual('uinit') + expect(coin.add(1500)).toEqual(new Coin('uinit', 2500)) + expect(decSum.isDecimal).toBe(true) + expect(Number(decSum.amount)).toEqual(1000.1) // subtraction - const diff = coin2.sub(coin); - expect(diff.denom).toEqual('uinit'); - expect(Number(diff.amount)).toEqual(1000); + const diff = coin2.sub(coin) + expect(diff.denom).toEqual('uinit') + expect(Number(diff.amount)).toEqual(1000) // multiplication - const product = coin.mul(3.1233); - expect(product.denom).toEqual('uinit'); - expect(Number(product.amount)).toEqual(3123.3); + const product = coin.mul(3.1233) + expect(product.denom).toEqual('uinit') + expect(Number(product.amount)).toEqual(3123.3) // division - const quotient = coin.div(5); - expect(quotient.denom).toEqual('uinit'); - expect(Number(quotient.amount)).toEqual(200); + const quotient = coin.div(5) + expect(quotient.denom).toEqual('uinit') + expect(Number(quotient.amount)).toEqual(200) // modulo - const rem = coin.mod(43); - expect(rem.denom).toEqual('uinit'); - expect(Number(rem.amount)).toEqual(Number(coin.amount) % 43); - }); + const rem = coin.mod(43) + expect(rem.denom).toEqual('uinit') + expect(Number(rem.amount)).toEqual(Number(coin.amount) % 43) + }) it('equality', () => { - const coin1 = new Coin('uinit', 1000); - const coin2 = new Coin('uinit', 1000); - const coin3 = new Coin('uinit', 1001); - expect(coin1).toEqual(coin2); - expect(coin1).not.toEqual(coin3); - }); + const coin1 = new Coin('uinit', 1000) + const coin2 = new Coin('uinit', 1000) + const coin3 = new Coin('uinit', 1001) + expect(coin1).toEqual(coin2) + expect(coin1).not.toEqual(coin3) + }) it('toString', () => { - const coin1 = new Coin('uinit', 123456); - const coin2 = new Coin('uinit', 123456.789); - expect(coin1.toString()).toEqual('123456uinit'); - expect(coin1.toDecCoin().toString()).toEqual('123456.0uinit'); - expect(coin2.toString()).toEqual('123456.789uinit'); - }); + const coin1 = new Coin('uinit', 123456) + const coin2 = new Coin('uinit', 123456.789) + expect(coin1.toString()).toEqual('123456uinit') + expect(coin1.toDecCoin().toString()).toEqual('123456.0uinit') + expect(coin2.toString()).toEqual('123456.789uinit') + }) describe('fromString', () => { it('parse IntCoin', () => { - const coin1 = new Coin('uinit', 1001); - const coin2 = Coin.fromString('1001uinit'); - expect(coin1).toEqual(coin2); + const coin1 = new Coin('uinit', 1001) + const coin2 = Coin.fromString('1001uinit') + expect(coin1).toEqual(coin2) - const coin3 = new Coin('uinit', -1); - const coin4 = Coin.fromString('-1uinit'); - expect(coin3).toEqual(coin4); - }); + const coin3 = new Coin('uinit', -1) + const coin4 = Coin.fromString('-1uinit') + expect(coin3).toEqual(coin4) + }) it('parse IBC IntCoin', () => { const coin1 = new Coin( 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B', 1001 - ); + ) const coin2 = Coin.fromString( '1001ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B' - ); - expect(coin1).toEqual(coin2); + ) + expect(coin1).toEqual(coin2) const coin3 = new Coin( 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B', -1 - ); + ) const coin4 = Coin.fromString( '-1ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B' - ); - expect(coin3).toEqual(coin4); - }); + ) + expect(coin3).toEqual(coin4) + }) it('parse DecCoin', () => { - const coin1 = new Coin('uinit', 1001.5); - const coin2 = Coin.fromString('1001.500000000000000000uinit'); - expect(coin1).toEqual(coin2); + const coin1 = new Coin('uinit', 1001.5) + const coin2 = Coin.fromString('1001.500000000000000000uinit') + expect(coin1).toEqual(coin2) - const coin3 = new Coin('uinit', '-1.0'); - const coin4 = Coin.fromString('-1.000000000000000000uinit'); - expect(coin3).toEqual(coin4); - }); + const coin3 = new Coin('uinit', '-1.0') + const coin4 = Coin.fromString('-1.000000000000000000uinit') + expect(coin3).toEqual(coin4) + }) it('parse IBC DecCoin', () => { const coin1 = new Coin( 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B', 1001.5 - ); + ) const coin2 = Coin.fromString( '1001.500000000000000000ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B' - ); - expect(coin1).toEqual(coin2); + ) + expect(coin1).toEqual(coin2) const coin3 = new Coin( 'ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B', '-1.0' - ); + ) const coin4 = Coin.fromString( '-1.000000000000000000ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B' - ); - expect(coin3).toEqual(coin4); - }); - }); -}); + ) + expect(coin3).toEqual(coin4) + }) + }) +}) diff --git a/src/core/Coin.ts b/src/core/Coin.ts index 6d841f2..ce3b86e 100644 --- a/src/core/Coin.ts +++ b/src/core/Coin.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../util/json'; -import { Denom } from './Denom'; -import { num, checkDecimal } from './num'; -import { Coin as Coin_pb } from '@initia/initia.proto/cosmos/base/v1beta1/coin'; +import { JSONSerializable } from '../util/json' +import { Denom } from './Denom' +import { num, checkDecimal } from './num' +import { Coin as Coin_pb } from '@initia/initia.proto/cosmos/base/v1beta1/coin' /** * Captures `sdk.Coin` and `sdk.DecCoin` from Cosmos SDK. A composite value that combines @@ -9,8 +9,8 @@ import { Coin as Coin_pb } from '@initia/initia.proto/cosmos/base/v1beta1/coin'; * that return Coin will return a new Coin. See [[Coins]] for a collection of Coin objects. */ export class Coin extends JSONSerializable { - public readonly amount: string; - public readonly isDecimal: boolean; + public readonly amount: string + public readonly isDecimal: boolean /** * Creates a new coin. Depending on the type of amount, it will be converted to an @@ -19,24 +19,27 @@ export class Coin extends JSONSerializable { * @param denom denomination * @param amount coin's amount */ - constructor(public readonly denom: Denom, amount: number | string) { - super(); - this.amount = num(amount).toString(); - this.isDecimal = checkDecimal(amount); + constructor( + public readonly denom: Denom, + amount: number | string + ) { + super() + this.amount = num(amount).toString() + this.isDecimal = checkDecimal(amount) } /** * Turns the Coin into an Integer coin. */ public toIntCoin(): Coin { - return new Coin(this.denom, num(this.amount).toFixed(0)); + return new Coin(this.denom, num(this.amount).toFixed(0)) } /** * Turns the Coin into an Integer coin with ceiling the amount. */ public toIntCeilCoin(): Coin { - return new Coin(this.denom, num(this.amount).toFixed(0, 2)); + return new Coin(this.denom, num(this.amount).toFixed(0, 2)) } /** @@ -46,7 +49,7 @@ export class Coin extends JSONSerializable { return new Coin( this.denom, this.amount.includes('.') ? this.amount : num(this.amount).toFixed(1) - ); + ) } /** @@ -58,18 +61,18 @@ export class Coin extends JSONSerializable { const amount = this.isDecimal && !this.amount.includes('.') ? num(this.amount).toFixed(1) - : num(this.amount).toFixed(); - return `${amount}${this.denom}`; + : num(this.amount).toFixed() + return `${amount}${this.denom}` } public static fromString(str: string): Coin { - const m = str.match(/^(-?[0-9]+(\.[0-9]+)?)([0-9a-zA-Z/]+)$/); + const m = str.match(/^(-?[0-9]+(\.[0-9]+)?)([0-9a-zA-Z/]+)$/) if (m === null) { - throw new Error(`failed to parse to Coin: ${str}`); + throw new Error(`failed to parse to Coin: ${str}`) } - const amount = m[1]; - const denom = m[3]; - return new Coin(denom, amount); + const amount = m[1] + const denom = m[3] + return new Coin(denom, amount) } /** @@ -78,26 +81,26 @@ export class Coin extends JSONSerializable { * @param other */ public add(other: number | string | Coin): Coin { - let otherAmount; - let isDecimal = this.isDecimal; + let otherAmount + let isDecimal = this.isDecimal if (other instanceof Coin) { if (other.denom !== this.denom) { throw new Coin.ArithmeticError( `cannot add two Coins of different denoms: ${this.denom} and ${other.denom}` - ); + ) } - otherAmount = other.amount; - isDecimal = isDecimal || other.isDecimal; + otherAmount = other.amount + isDecimal = isDecimal || other.isDecimal } else { - otherAmount = other; - isDecimal = isDecimal || checkDecimal(other); + otherAmount = other + isDecimal = isDecimal || checkDecimal(other) } - const res = num(this.amount).plus(otherAmount); + const res = num(this.amount).plus(otherAmount) return new Coin( this.denom, isDecimal && res.isInteger() ? res.toFixed(1) : res.toFixed() - ); + ) } /** @@ -105,26 +108,26 @@ export class Coin extends JSONSerializable { * @param other */ public sub(other: number | string | Coin): Coin { - let otherAmount; - let isDecimal = this.isDecimal; + let otherAmount + let isDecimal = this.isDecimal if (other instanceof Coin) { if (other.denom !== this.denom) { throw new Coin.ArithmeticError( `cannot subtract two Coins of different denoms: ${this.denom} and ${other.denom}` - ); + ) } - otherAmount = other.amount; - isDecimal = isDecimal || other.isDecimal; + otherAmount = other.amount + isDecimal = isDecimal || other.isDecimal } else { - otherAmount = other; - isDecimal = isDecimal || checkDecimal(other); + otherAmount = other + isDecimal = isDecimal || checkDecimal(other) } - const res = num(this.amount).minus(otherAmount); + const res = num(this.amount).minus(otherAmount) return new Coin( this.denom, isDecimal && res.isInteger() ? res.toFixed(1) : res.toFixed() - ); + ) } /** @@ -132,13 +135,13 @@ export class Coin extends JSONSerializable { * @param other */ public mul(other: number | string): Coin { - const isDecimal = this.isDecimal || checkDecimal(other); - const res = num(this.amount).multipliedBy(other); + const isDecimal = this.isDecimal || checkDecimal(other) + const res = num(this.amount).multipliedBy(other) return new Coin( this.denom, isDecimal && res.isInteger() ? res.toFixed(1) : res.toFixed() - ); + ) } /** @@ -146,13 +149,13 @@ export class Coin extends JSONSerializable { * @param other */ public div(other: number | string): Coin { - const isDecimal = this.isDecimal || checkDecimal(other); - const res = num(this.amount).dividedBy(other); + const isDecimal = this.isDecimal || checkDecimal(other) + const res = num(this.amount).dividedBy(other) return new Coin( this.denom, isDecimal && res.isInteger() ? res.toFixed(1) : res.toFixed() - ); + ) } /** @@ -160,67 +163,67 @@ export class Coin extends JSONSerializable { * @param other */ public mod(other: number | string): Coin { - const isDecimal = this.isDecimal || checkDecimal(other); - const res = num(this.amount).mod(other); + const isDecimal = this.isDecimal || checkDecimal(other) + const res = num(this.amount).mod(other) return new Coin( this.denom, isDecimal && res.isInteger() ? res.toFixed(1) : res.toFixed() - ); + ) } public static fromAmino(data: Coin.Amino): Coin { - const { denom, amount } = data; - return new Coin(denom, amount); + const { denom, amount } = data + return new Coin(denom, amount) } public toAmino(): Coin.Amino { - const { denom, amount } = this; + const { denom, amount } = this return { denom, amount: this.isDecimal ? num(amount).toFixed(18) : amount, - }; + } } public static fromData(data: Coin.Data): Coin { - const { denom, amount } = data; - return new Coin(denom, amount); + const { denom, amount } = data + return new Coin(denom, amount) } public toData(): Coin.Data { - const { denom, amount } = this; + const { denom, amount } = this return { denom, amount: this.isDecimal ? num(amount).toFixed(18) : amount, - }; + } } public static fromProto(proto: Coin.Proto): Coin { - return new Coin(proto.denom, proto.amount); + return new Coin(proto.denom, proto.amount) } public toProto(): Coin.Proto { return Coin_pb.fromPartial({ denom: this.denom, amount: this.isDecimal ? num(this.amount).toFixed(18) : this.amount, - }); + }) } } export namespace Coin { export interface Amino { - denom: Denom; - amount: string; + denom: Denom + amount: string } export interface Data { - denom: Denom; - amount: string; + denom: Denom + amount: string } export class ArithmeticError { constructor(public readonly message: string) {} } - export type Proto = Coin_pb; + export type Proto = Coin_pb } diff --git a/src/core/Coins.spec.ts b/src/core/Coins.spec.ts index 8a70cca..810a461 100644 --- a/src/core/Coins.spec.ts +++ b/src/core/Coins.spec.ts @@ -1,5 +1,5 @@ -import { Coins } from './Coins'; -import { Coin } from './Coin'; +import { Coins } from './Coins' +import { Coin } from './Coin' describe('Coins', () => { it('clobbers coins of similar denom', () => { @@ -7,82 +7,82 @@ describe('Coins', () => { new Coin('uinit', 1000), new Coin('uinit', 1000), new Coin('uinit', 1000), - ]); + ]) - const coinINIT = coins1.get('uinit'); + const coinINIT = coins1.get('uinit') - expect(coinINIT).toBeDefined(); + expect(coinINIT).toBeDefined() if (coinINIT !== undefined) { - expect(Number(coinINIT.amount)).toEqual(3000); + expect(Number(coinINIT.amount)).toEqual(3000) } - }); + }) it('allows coins to be instantiated with a variety of inputs', () => { const ref = new Coins({ uinit: 3, - }); + }) // input #1: Coins - const coins1 = new Coins(ref); + const coins1 = new Coins(ref) // input #2: Coin[] - const coins2 = new Coins([new Coin('uinit', 1), new Coin('uinit', 2)]); + const coins2 = new Coins([new Coin('uinit', 1), new Coin('uinit', 2)]) // input #3: Coins.AminoDict const coins3 = new Coins({ uinit: 3, - }); + }) // input #4: string - const coins4 = new Coins('2uinit,1uinit'); + const coins4 = new Coins('2uinit,1uinit') - [coins1, coins2, coins3, coins4].forEach(cs => { - expect(cs).toEqual(ref); - }); - }); + ;[coins1, coins2, coins3, coins4].forEach((cs) => { + expect(cs).toEqual(ref) + }) + }) it('fromString', () => { - const int_coins_string = '5uinit,12uinit'; - const dec_coins_string = '2.3uinit,1.45uinit'; - const neg_dec_coins_string = '-1.0uinit,2.5uinit'; + const int_coins_string = '5uinit,12uinit' + const dec_coins_string = '2.3uinit,1.45uinit' + const neg_dec_coins_string = '-1.0uinit,2.5uinit' const int_coins = new Coins({ uinit: 17, - }); + }) const dec_coins = new Coins({ uinit: 3.75, - }); + }) const neg_dec_coins = new Coins({ uinit: '1.5', - }); + }) - const coins1 = Coins.fromString(int_coins_string); - const coins2 = Coins.fromString(dec_coins_string); - const coins3 = Coins.fromString(neg_dec_coins_string); + const coins1 = Coins.fromString(int_coins_string) + const coins2 = Coins.fromString(dec_coins_string) + const coins3 = Coins.fromString(neg_dec_coins_string) - expect(coins1).toEqual(int_coins); - expect(coins2).toEqual(dec_coins); - expect(coins3).toEqual(neg_dec_coins); - }); + expect(coins1).toEqual(int_coins) + expect(coins2).toEqual(dec_coins) + expect(coins3).toEqual(neg_dec_coins) + }) it('filters', () => { const gasPrices = new Coins({ uinit: '0.15', - }); + }) - expect(gasPrices.filter(c => ['uinit'].includes(c.denom))).toEqual( + expect(gasPrices.filter((c) => ['uinit'].includes(c.denom))).toEqual( new Coins({ uinit: '0.15' }) - ); - }); + ) + }) it('is iterable', () => { const gasPrices = new Coins({ uinit: '0.15', - }); + }) // shouldn't fail or ts giving errors on type - expect(Array.isArray(Array.from(gasPrices))).toBe(true); - }); -}); + expect(Array.isArray(Array.from(gasPrices))).toBe(true) + }) +}) diff --git a/src/core/Coins.ts b/src/core/Coins.ts index f10edc1..701851b 100644 --- a/src/core/Coins.ts +++ b/src/core/Coins.ts @@ -1,6 +1,6 @@ -import { Coin } from './Coin'; -import { JSONSerializable } from '../util/json'; -import { Denom } from './Denom'; +import { Coin } from './Coin' +import { JSONSerializable } from '../util/json' +import { Denom } from './Denom' /** * Analogous to `sdk.Coins` and `sdk.DecCoins` from Cosmos-SDK, and represents a collection @@ -15,15 +15,15 @@ export class Coins // implement iterator interface for interop [Symbol.iterator]() { - let index = -1; - const data = this.toArray(); + let index = -1 + const data = this.toArray() return { next: () => ({ value: data[++index], done: (index === data.length) as true, }), - }; + } } /** @@ -33,8 +33,8 @@ export class Coins */ public toString(): string { return this.toArray() - .map(c => c.toString()) - .join(','); + .map((c) => c.toString()) + .join(',') } /** @@ -45,74 +45,74 @@ export class Coins * @param str comma-separated list of coins */ public static fromString(str: string): Coins { - const coin_strings = str.split(/,\s*/); - const coins = coin_strings.map(s => Coin.fromString(s)); - return new Coins(coins); + const coin_strings = str.split(/,\s*/) + const coins = coin_strings.map((s) => Coin.fromString(s)) + return new Coins(coins) } /** * Gets the list of denominations */ public denoms(): Denom[] { - return this.map(c => c.denom); + return this.map((c) => c.denom) } /** * Creates a new Coins object with all Decimal coins */ public toDecCoins(): Coins { - return new Coins(this.map(c => c.toDecCoin())); + return new Coins(this.map((c) => c.toDecCoin())) } /** * Creates a new Coins object with all Integer coins */ public toIntCoins(): Coins { - return new Coins(this.map(c => c.toIntCoin())); + return new Coins(this.map((c) => c.toIntCoin())) } /** * Creates a new Coins object with all Integer coins with ceiling the amount */ public toIntCeilCoins(): Coins { - return new Coins(this.map(c => c.toIntCeilCoin())); + return new Coins(this.map((c) => c.toIntCeilCoin())) } /** * @param arg coins to input */ constructor(arg: Coins.Input = {}) { - super(); + super() if (arg instanceof Coins) { - this._coins = { ...arg._coins }; + this._coins = { ...arg._coins } } else if (typeof arg === 'string') { - this._coins = Coins.fromString(arg)._coins; + this._coins = Coins.fromString(arg)._coins } else { - this._coins = {}; - let coins: Coin[]; + this._coins = {} + let coins: Coin[] if (!Array.isArray(arg)) { - coins = []; - Object.keys(arg).forEach(denom => + coins = [] + Object.keys(arg).forEach((denom) => coins.push(new Coin(denom, arg[denom])) - ); + ) } else { - coins = arg; + coins = arg } for (const coin of coins) { - const { denom } = coin; - const x = this._coins[denom]; + const { denom } = coin + const x = this._coins[denom] if (x !== undefined) { - this._coins[denom] = x.add(coin); + this._coins[denom] = x.add(coin) } else { - this._coins[denom] = coin; + this._coins[denom] = coin } } // convert all coins to Dec if one is Dec - if (this.toArray().some(c => c.isDecimal)) { + if (this.toArray().some((c) => c.isDecimal)) { for (const denom of Object.keys(this._coins)) { - this._coins[denom] = this._coins[denom].toDecCoin(); + this._coins[denom] = this._coins[denom].toDecCoin() } } } @@ -123,7 +123,7 @@ export class Coins * @param denom denomination to lookup */ public get(denom: Denom): Coin | undefined { - return this._coins[denom]; + return this._coins[denom] } /** @@ -132,18 +132,18 @@ export class Coins * @param value value to set */ public set(denom: Denom, value: number | string | Coin): void { - let val; + let val if (value instanceof Coin) { if (value.denom != denom) { throw new Error( `Denoms must match when setting: ${denom}, ${value.denom}` - ); + ) } - val = value; + val = value } else { - val = new Coin(denom, value); + val = new Coin(denom, value) } - this._coins[denom] = val; + this._coins[denom] = val } /** @@ -152,7 +152,7 @@ export class Coins public toArray(): Coin[] { return Object.values(this._coins).sort((a, b) => a.denom.localeCompare(b.denom) - ); + ) } /** @@ -162,12 +162,12 @@ export class Coins */ public add(other: Coin | Coins): Coins { if (other instanceof Coin) { - return new Coins([other, ...Object.values(this._coins)]); + return new Coins([other, ...Object.values(this._coins)]) } else { return new Coins([ ...Object.values(other._coins), ...Object.values(this._coins), - ]); + ]) } } @@ -176,7 +176,7 @@ export class Coins * @param other */ public sub(other: Coin | Coins): Coins { - return this.add(other.mul(-1)); + return this.add(other.mul(-1)) } /** @@ -184,7 +184,7 @@ export class Coins * @param other */ public mul(other: number | string): Coins { - return new Coins(this.map(c => c.mul(other))); + return new Coins(this.map((c) => c.mul(other))) } /** @@ -192,7 +192,7 @@ export class Coins * @param other */ public div(other: number | string): Coins { - return new Coins(this.map(c => c.div(other))); + return new Coins(this.map((c) => c.div(other))) } /** @@ -200,7 +200,7 @@ export class Coins * @param other */ public mod(other: number | string): Coins { - return new Coins(this.map(c => c.mod(other))); + return new Coins(this.map((c) => c.mod(other))) } /** @@ -208,7 +208,7 @@ export class Coins * @param fn */ public map(fn: (c: Coin) => T): T[] { - return this.toArray().map(fn); + return this.toArray().map(fn) } /** @@ -216,43 +216,39 @@ export class Coins * @param fn predicate */ public filter(fn: (c: Coin) => boolean): Coins { - return new Coins(this.toArray().filter(fn)); + return new Coins(this.toArray().filter(fn)) } public static fromAmino(data?: Coins.Amino): Coins { - return new Coins((data ?? []).map(Coin.fromAmino)); + return new Coins((data ?? []).map(Coin.fromAmino)) } public toAmino(): Coins.Amino { - return this.toArray().map(c => c.toAmino()); + return this.toArray().map((c) => c.toAmino()) } public static fromData(data?: Coins.Data): Coins { - return new Coins((data ?? []).map(Coin.fromData)); + return new Coins((data ?? []).map(Coin.fromData)) } public toData(): Coins.Data { - return this.toArray().map(c => c.toData()); + return this.toArray().map((c) => c.toData()) } public static fromProto(data?: Coins.Proto): Coins { - return new Coins((data ?? []).map(Coin.fromProto)); + return new Coins((data ?? []).map(Coin.fromProto)) } public toProto(): Coins.Proto { - return this.toArray().map(c => c.toProto()); + return this.toArray().map((c) => c.toProto()) } } export namespace Coins { - export type Input = Coins.AminoDict | Coin[] | Coins | string; - export type Amino = Coin.Amino[]; - export type Data = Coin.Data[]; - export type Proto = Coin.Proto[]; - export type AminoDict = { - [denom: string]: number | string; - }; - export type ReprDict = { - [denom: string]: Coin; - }; + export type Input = Coins.AminoDict | Coin[] | Coins | string + export type Amino = Coin.Amino[] + export type Data = Coin.Data[] + export type Proto = Coin.Proto[] + export type AminoDict = Record + export type ReprDict = Record } diff --git a/src/core/Denom.ts b/src/core/Denom.ts index 54451d7..9af8bf8 100644 --- a/src/core/Denom.ts +++ b/src/core/Denom.ts @@ -1 +1 @@ -export type Denom = string; +export type Denom = string diff --git a/src/core/Duration.ts b/src/core/Duration.ts index 5e1282f..6759a6a 100644 --- a/src/core/Duration.ts +++ b/src/core/Duration.ts @@ -1,5 +1,5 @@ -import { Duration as Duration_pb } from '@initia/initia.proto/google/protobuf/duration'; -import Long from 'long'; +import { Duration as Duration_pb } from '@initia/initia.proto/google/protobuf/duration' +import Long from 'long' /** * A Duration represents a signed, fixed-length span of time represented @@ -20,55 +20,55 @@ import Long from 'long'; * microsecond should be expressed in JSON format as "3.000001s". */ export class Duration { - public seconds: Long; - public nanos: number; + public seconds: Long + public nanos: number constructor(seconds: number, nanos = 0) { const [sec, nano] = (nanos / Math.pow(10, 9) + seconds) .toFixed(9) - .split('.'); - this.seconds = Long.fromString(sec); - this.nanos = Number.parseInt(nano); + .split('.') + this.seconds = Long.fromString(sec) + this.nanos = Number.parseInt(nano) } public static fromString(str: string): Duration { const [sec, nano] = Number.parseFloat(str.replace('s', '')) .toFixed(9) - .split('.'); - return new Duration(Number.parseInt(sec), Number.parseInt(nano)); + .split('.') + return new Duration(Number.parseInt(sec), Number.parseInt(nano)) } public toString(): string { - return `${this.nanos / Math.pow(10, 9) + this.seconds.toNumber()}s`; + return `${this.nanos / Math.pow(10, 9) + this.seconds.toNumber()}s` } public static fromAmino(amino: Duration.Amino): Duration { - return Duration.fromString(amino); + return Duration.fromString(amino) } public toAmino(): Duration.Amino { - return this.toString(); + return this.toString() } public static fromData(data: Duration.Data): Duration { - return Duration.fromString(data); + return Duration.fromString(data) } public toData(): Duration.Data { - return this.toString(); + return this.toString() } public static fromProto(proto: Duration.Proto): Duration { - return new Duration(proto.seconds.toNumber(), proto.nanos); + return new Duration(proto.seconds.toNumber(), proto.nanos) } public toProto(): Duration.Proto { - return { seconds: this.seconds, nanos: this.nanos }; + return { seconds: this.seconds, nanos: this.nanos } } } export namespace Duration { - export type Amino = string; - export type Data = string; - export type Proto = Duration_pb; + export type Amino = string + export type Data = string + export type Proto = Duration_pb } diff --git a/src/core/Msg.ts b/src/core/Msg.ts index 98b3345..1dd60b6 100644 --- a/src/core/Msg.ts +++ b/src/core/Msg.ts @@ -1,11 +1,11 @@ -import { AuctionMsg, MsgAuctionBid, MsgUpdateAuctionParams } from './auction'; -import { AuthMsg, MsgUpdateAuthParams } from './auth'; +import { AuctionMsg, MsgAuctionBid, MsgUpdateAuctionParams } from './auction' +import { AuthMsg, MsgUpdateAuthParams } from './auth' import { AuthzMsg, MsgGrantAuthorization, MsgRevokeAuthorization, MsgExecAuthorized, -} from './authz'; +} from './authz' import { BankMsg, MsgMultiSend, @@ -13,10 +13,10 @@ import { MsgUpdateBankParams, MsgSetSendEnabled, MsgSetDenomMetadata, -} from './bank'; -import { CelestiaMsg, MsgPayForBlobs } from './celestia'; -import { ConsensusMsg, MsgUpdateConsensusParams } from './consensus'; -import { CrisisMsg, MsgVerifyInvariant, MsgUpdateCrisisParams } from './crisis'; +} from './bank' +import { CelestiaMsg, MsgPayForBlobs } from './celestia' +import { ConsensusMsg, MsgUpdateConsensusParams } from './consensus' +import { CrisisMsg, MsgVerifyInvariant, MsgUpdateCrisisParams } from './crisis' import { DistributionMsg, MsgSetWithdrawAddress, @@ -26,15 +26,15 @@ import { MsgUpdateDistrParams, MsgCommunityPoolSpend, MsgDepositValidatorRewardsPool, -} from './distribution'; -import { EvidenceMsg, MsgSubmitEvidence } from './evidence'; -import { EvmMsg, MsgCreate, MsgCall, MsgUpdateEvmParams } from './evm'; -import { FeeGrantMsg, MsgGrantAllowance, MsgRevokeAllowance } from './feegrant'; +} from './distribution' +import { EvidenceMsg, MsgSubmitEvidence } from './evidence' +import { EvmMsg, MsgCreate, MsgCall, MsgUpdateEvmParams } from './evm' +import { FeeGrantMsg, MsgGrantAllowance, MsgRevokeAllowance } from './feegrant' import { ForwardingMsg, MsgRegisterForwardingAccount, MsgClearForwardingAccount, -} from './forwarding'; +} from './forwarding' import { GovMsg, MsgCancelProposal, @@ -47,7 +47,7 @@ import { MsgVoteWeightedLegacy, MsgVoteWeighted, MsgUpdateGovParams, -} from './gov'; +} from './gov' import { GroupMsg, MsgCreateGroup, @@ -63,29 +63,26 @@ import { MsgUpdateGroupMetadata, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyMetadata, -} from './group'; +} from './group' import { IbcFeeMsg, MsgPayPacketFee, MsgPayPacketFeeAsync, MsgRegisterCounterpartyPayee, MsgRegisterPayee, -} from './ibc/applications/fee'; -import { IbcHooksMsg, MsgUpdateACL, MsgUpdateIbcHooksParams } from './ibchooks'; +} from './ibc/applications/fee' +import { IbcHooksMsg, MsgUpdateACL, MsgUpdateIbcHooksParams } from './ibchooks' import { IbcNftMsg, MsgNftTransfer, MsgUpdateIbcNftParams, -} from './ibc/applications/nft-transfer'; -import { - IbcPermMsg, - MsgSetPermissionedRelayers, -} from './ibc/applications/perm'; +} from './ibc/applications/nft-transfer' +import { IbcPermMsg, MsgSetPermissionedRelayers } from './ibc/applications/perm' import { IbcTransferMsg, MsgTransfer, MsgUpdateIbcTransferParams, -} from './ibc/applications/transfer'; +} from './ibc/applications/transfer' import { IbcChannelMsg, MsgChannelOpenInit, @@ -99,7 +96,7 @@ import { MsgTimeout, MsgTimeoutOnClose, MsgUpdateIbcChannelParams, -} from './ibc/core/channel/msgs'; +} from './ibc/core/channel/msgs' import { IbcClientMsg, MsgCreateClient, @@ -109,7 +106,7 @@ import { MsgRecoverClient, MsgIBCSoftwareUpgrade, MsgUpdateIbcClientParams, -} from './ibc/core/client/msgs'; +} from './ibc/core/client/msgs' import { IbcConnectionMsg, MsgConnectionOpenInit, @@ -117,15 +114,15 @@ import { MsgConnectionOpenConfirm, MsgConnectionOpenAck, MsgUpdateIbcConnectionParams, -} from './ibc/core/connection/msgs'; -import { InterTxMsg, MsgRegisterAccount, MsgSubmitTx } from './intertx'; +} from './ibc/core/connection/msgs' +import { InterTxMsg, MsgRegisterAccount, MsgSubmitTx } from './intertx' import { MarketmapMsg, MsgCreateMarkets, MsgUpdateMarkets, MsgRemoveMarketAuthorities, MsgUpdateMarketmapParams, -} from './marketmap/msgs'; +} from './marketmap/msgs' import { MoveMsg, MsgPublish, @@ -141,7 +138,7 @@ import { MsgGovPublish, MsgGovScript, MsgGovScriptJSON, -} from './move'; +} from './move' import { MstakingMsg, MsgBeginRedelegate, @@ -151,7 +148,7 @@ import { MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateMstakingParams, -} from './mstaking'; +} from './mstaking' import { OpchildMsg, MsgAddValidator, @@ -163,7 +160,7 @@ import { MsgSetBridgeInfo, MsgUpdateOracle, MsgUpdateOpchildParams, -} from './opchild'; +} from './opchild' import { OphostMsg, MsgRecordBatch, @@ -177,14 +174,14 @@ import { MsgUpdateBatchInfo, MsgUpdateMetadata, MsgUpdateOphostParams, -} from './ophost'; +} from './ophost' import { OracleMsg, MsgAddCurrencyPairs, MsgRemoveCurrencyPairs, -} from './oracle'; -import { RewardMsg, MsgUpdateRewardParams } from './reward'; -import { SlashingMsg, MsgUnjail, MsgUpdateSlashingParams } from './slashing'; +} from './oracle' +import { RewardMsg, MsgUpdateRewardParams } from './reward' +import { SlashingMsg, MsgUnjail, MsgUpdateSlashingParams } from './slashing' import { TokenfactoryMsg, MsgCreateDenom, @@ -195,8 +192,8 @@ import { MsgSetBeforeSendHook, MsgForceTransfer, MsgUpdateTokenfactoryParams, -} from './tokenfactory'; -import { UpgradeMsg, MsgSoftwareUpgrade, MsgCancelUpgrade } from './upgrade'; +} from './tokenfactory' +import { UpgradeMsg, MsgSoftwareUpgrade, MsgCancelUpgrade } from './upgrade' import { WasmMsg, MsgStoreCode, @@ -216,8 +213,8 @@ import { MsgAddCodeUploadParamsAddresses, MsgRemoveCodeUploadParamsAddresses, MsgUpdateContractLabel, -} from './wasm'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from './wasm' +import { Any } from '@initia/initia.proto/google/protobuf/any' export type Msg = | AuctionMsg @@ -253,7 +250,7 @@ export type Msg = | SlashingMsg | TokenfactoryMsg | UpgradeMsg - | WasmMsg; + | WasmMsg export namespace Msg { export type Amino = @@ -285,7 +282,7 @@ export namespace Msg { | SlashingMsg.Amino | TokenfactoryMsg.Amino | UpgradeMsg.Amino - | WasmMsg.Amino; + | WasmMsg.Amino export type Data = | AuctionMsg.Data @@ -321,7 +318,7 @@ export namespace Msg { | SlashingMsg.Data | TokenfactoryMsg.Data | UpgradeMsg.Data - | WasmMsg.Data; + | WasmMsg.Data export type Proto = | AuctionMsg.Proto @@ -357,339 +354,339 @@ export namespace Msg { | SlashingMsg.Proto | TokenfactoryMsg.Proto | UpgradeMsg.Proto - | WasmMsg.Proto; + | WasmMsg.Proto export function fromAmino(data: Msg.Amino): Msg { switch (data.type) { // auction case 'block-sdk/x/auction/MsgAuctionBid': - return MsgAuctionBid.fromAmino(data); + return MsgAuctionBid.fromAmino(data) case 'block-sdk/x/auction/MsgUpdateParams': - return MsgUpdateAuctionParams.fromAmino(data); + return MsgUpdateAuctionParams.fromAmino(data) // auth case 'cosmos-sdk/x/auth/MsgUpdateParams': - return MsgUpdateAuthParams.fromAmino(data); + return MsgUpdateAuthParams.fromAmino(data) // authz case 'cosmos-sdk/MsgGrant': - return MsgGrantAuthorization.fromAmino(data); + return MsgGrantAuthorization.fromAmino(data) case 'cosmos-sdk/MsgRevoke': - return MsgRevokeAuthorization.fromAmino(data); + return MsgRevokeAuthorization.fromAmino(data) case 'cosmos-sdk/MsgExec': - return MsgExecAuthorized.fromAmino(data); + return MsgExecAuthorized.fromAmino(data) // bank case 'cosmos-sdk/MsgSend': - return MsgSend.fromAmino(data); + return MsgSend.fromAmino(data) case 'cosmos-sdk/MsgMultiSend': - return MsgMultiSend.fromAmino(data); + return MsgMultiSend.fromAmino(data) case 'cosmos-sdk/x/bank/MsgUpdateParams': - return MsgUpdateBankParams.fromAmino(data); + return MsgUpdateBankParams.fromAmino(data) case 'cosmos-sdk/MsgSetSendEnabled': - return MsgSetSendEnabled.fromAmino(data); + return MsgSetSendEnabled.fromAmino(data) case 'bank/MsgSetDenomMetadata': - return MsgSetDenomMetadata.fromAmino(data); + return MsgSetDenomMetadata.fromAmino(data) // crisis case 'cosmos-sdk/MsgVerifyInvariant': - return MsgVerifyInvariant.fromAmino(data); + return MsgVerifyInvariant.fromAmino(data) case 'cosmos-sdk/x/crisis/MsgUpdateParams': - return MsgUpdateCrisisParams.fromAmino(data); + return MsgUpdateCrisisParams.fromAmino(data) // consensus case 'cosmos-sdk/x/consensus/MsgUpdateParams': - return MsgUpdateConsensusParams.fromAmino(data); + return MsgUpdateConsensusParams.fromAmino(data) // distribution case 'cosmos-sdk/MsgModifyWithdrawAddress': - return MsgSetWithdrawAddress.fromAmino(data); + return MsgSetWithdrawAddress.fromAmino(data) case 'cosmos-sdk/MsgWithdrawDelegationReward': - return MsgWithdrawDelegatorReward.fromAmino(data); + return MsgWithdrawDelegatorReward.fromAmino(data) case 'cosmos-sdk/MsgWithdrawValidatorCommission': - return MsgWithdrawValidatorCommission.fromAmino(data); + return MsgWithdrawValidatorCommission.fromAmino(data) case 'cosmos-sdk/MsgFundCommunityPool': - return MsgFundCommunityPool.fromAmino(data); + return MsgFundCommunityPool.fromAmino(data) case 'distribution/MsgUpdateParams': - return MsgUpdateDistrParams.fromAmino(data); + return MsgUpdateDistrParams.fromAmino(data) case 'cosmos-sdk/distr/MsgCommunityPoolSpend': - return MsgCommunityPoolSpend.fromAmino(data); + return MsgCommunityPoolSpend.fromAmino(data) case 'cosmos-sdk/distr/MsgDepositValRewards': - return MsgDepositValidatorRewardsPool.fromAmino(data); + return MsgDepositValidatorRewardsPool.fromAmino(data) // evidence case 'cosmos-sdk/MsgSubmitEvidence': - return MsgSubmitEvidence.fromAmino(data); + return MsgSubmitEvidence.fromAmino(data) // evm case 'evm/MsgCreate': - return MsgCreate.fromAmino(data); + return MsgCreate.fromAmino(data) case 'evm/MsgCall': - return MsgCall.fromAmino(data); + return MsgCall.fromAmino(data) case 'evm/MsgUpdateParams': - return MsgUpdateEvmParams.fromAmino(data); + return MsgUpdateEvmParams.fromAmino(data) // feegrant case 'cosmos-sdk/MsgGrantAllowance': - return MsgGrantAllowance.fromAmino(data); + return MsgGrantAllowance.fromAmino(data) case 'cosmos-sdk/MsgRevokeAllowance': - return MsgRevokeAllowance.fromAmino(data); + return MsgRevokeAllowance.fromAmino(data) // forwarding case 'noble/forwarding/RegisterAccount': - return MsgRegisterForwardingAccount.fromAmino(data); + return MsgRegisterForwardingAccount.fromAmino(data) case 'noble/forwarding/ClearAccount': - return MsgClearForwardingAccount.fromAmino(data); + return MsgClearForwardingAccount.fromAmino(data) // gov case 'cosmos-sdk/v1/MsgCancelProposal': - return MsgCancelProposal.fromAmino(data); + return MsgCancelProposal.fromAmino(data) case 'cosmos-sdk/MsgDeposit': - return MsgDepositLegacy.fromAmino(data); + return MsgDepositLegacy.fromAmino(data) case 'cosmos-sdk/v1/MsgDeposit': - return MsgDeposit.fromAmino(data); + return MsgDeposit.fromAmino(data) case 'cosmos-sdk/MsgSubmitProposal': - return MsgSubmitProposalLegacy.fromAmino(data); + return MsgSubmitProposalLegacy.fromAmino(data) case 'cosmos-sdk/v1/MsgSubmitProposal': - return MsgSubmitProposal.fromAmino(data); + return MsgSubmitProposal.fromAmino(data) case 'cosmos-sdk/MsgVote': - return MsgVoteLegacy.fromAmino(data); + return MsgVoteLegacy.fromAmino(data) case 'cosmos-sdk/v1/MsgVote': - return MsgVote.fromAmino(data); + return MsgVote.fromAmino(data) case 'cosmos-sdk/MsgVoteWeighted': - return MsgVoteWeightedLegacy.fromAmino(data); + return MsgVoteWeightedLegacy.fromAmino(data) case 'cosmos-sdk/v1/MsgVoteWeighted': - return MsgVoteWeighted.fromAmino(data); + return MsgVoteWeighted.fromAmino(data) case 'gov/MsgUpdateParams': - return MsgUpdateGovParams.fromAmino(data); + return MsgUpdateGovParams.fromAmino(data) // group case 'cosmos-sdk/MsgCreateGroup': - return MsgCreateGroup.fromAmino(data); + return MsgCreateGroup.fromAmino(data) case 'cosmos-sdk/MsgCreateGroupPolicy': - return MsgCreateGroupPolicy.fromAmino(data); + return MsgCreateGroupPolicy.fromAmino(data) case 'cosmos-sdk/MsgCreateGroupWithPolicy': - return MsgCreateGroupWithPolicy.fromAmino(data); + return MsgCreateGroupWithPolicy.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupAdmin': - return MsgUpdateGroupAdmin.fromAmino(data); + return MsgUpdateGroupAdmin.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupDecisionPolicy': - return MsgUpdateGroupDecisionPolicy.fromAmino(data); + return MsgUpdateGroupDecisionPolicy.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupMembers': - return MsgUpdateGroupMembers.fromAmino(data); + return MsgUpdateGroupMembers.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupMetadata': - return MsgUpdateGroupMetadata.fromAmino(data); + return MsgUpdateGroupMetadata.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupPolicyAdmin': - return MsgUpdateGroupPolicyAdmin.fromAmino(data); + return MsgUpdateGroupPolicyAdmin.fromAmino(data) case 'cosmos-sdk/MsgUpdateGroupPolicyMetadata': - return MsgUpdateGroupPolicyMetadata.fromAmino(data); + return MsgUpdateGroupPolicyMetadata.fromAmino(data) case 'cosmos-sdk/group/MsgExec': - return MsgGroupExec.fromAmino(data); + return MsgGroupExec.fromAmino(data) case 'cosmos-sdk/group/MsgLeaveGroup': - return MsgLeaveGroup.fromAmino(data); + return MsgLeaveGroup.fromAmino(data) case 'cosmos-sdk/group/MsgSubmitProposal': - return MsgSubmitGroupProposal.fromAmino(data); + return MsgSubmitGroupProposal.fromAmino(data) case 'cosmos-sdk/group/MsgVote': - return MsgGroupVote.fromAmino(data); + return MsgGroupVote.fromAmino(data) // ibc-hooks case 'ibchooks/MsgUpdateACL': - return MsgUpdateACL.fromAmino(data); + return MsgUpdateACL.fromAmino(data) case 'ibchooks/MsgUpdateParams': - return MsgUpdateIbcHooksParams.fromAmino(data); + return MsgUpdateIbcHooksParams.fromAmino(data) // ibc-nft-transfer case 'nft-transfer/MsgTransfer': - return MsgNftTransfer.fromAmino(data); + return MsgNftTransfer.fromAmino(data) case 'nft-transfer/MsgUpdateParams': - return MsgUpdateIbcNftParams.fromAmino(data); + return MsgUpdateIbcNftParams.fromAmino(data) // ibc-perm case 'perm/MsgSetPermissionedRelayers': - return MsgSetPermissionedRelayers.fromAmino(data); + return MsgSetPermissionedRelayers.fromAmino(data) // ibc-transfer case 'cosmos-sdk/MsgTransfer': - return MsgTransfer.fromAmino(data); + return MsgTransfer.fromAmino(data) // intertx case 'intertx/MsgRegisterAccount': - return MsgRegisterAccount.fromAmino(data); + return MsgRegisterAccount.fromAmino(data) case 'intertx/MsgSubmitTx': - return MsgSubmitTx.fromAmino(data); + return MsgSubmitTx.fromAmino(data) // marketmap case 'slinky/x/marketmap/MsgCreateMarkets': - return MsgCreateMarkets.fromAmino(data); + return MsgCreateMarkets.fromAmino(data) case 'slinky/x/marketmap/MsgUpdateMarkets': - return MsgUpdateMarkets.fromAmino(data); + return MsgUpdateMarkets.fromAmino(data) case 'slinky/x/marketmap/MsgRemoveMarketAuthorities': - return MsgRemoveMarketAuthorities.fromAmino(data); + return MsgRemoveMarketAuthorities.fromAmino(data) case 'slinky/x/marketmap/MsgParams': - return MsgUpdateMarketmapParams.fromAmino(data); + return MsgUpdateMarketmapParams.fromAmino(data) // move case 'move/MsgPublish': - return MsgPublish.fromAmino(data); + return MsgPublish.fromAmino(data) case 'move/MsgExecute': - return MsgExecute.fromAmino(data); + return MsgExecute.fromAmino(data) case 'move/MsgExecuteJSON': - return MsgExecuteJSON.fromAmino(data); + return MsgExecuteJSON.fromAmino(data) case 'move/MsgScript': - return MsgScript.fromAmino(data); + return MsgScript.fromAmino(data) case 'move/MsgScriptJSON': - return MsgScriptJSON.fromAmino(data); + return MsgScriptJSON.fromAmino(data) case 'move/MsgUpdateParams': - return MsgUpdateMoveParams.fromAmino(data); + return MsgUpdateMoveParams.fromAmino(data) case 'move/MsgWhitelist': - return MsgWhitelist.fromAmino(data); + return MsgWhitelist.fromAmino(data) case 'move/MsgDelist': - return MsgDelist.fromAmino(data); + return MsgDelist.fromAmino(data) case 'move/MsgGovExecute': - return MsgGovExecute.fromAmino(data); + return MsgGovExecute.fromAmino(data) case 'move/MsgGovExecuteJSON': - return MsgGovExecuteJSON.fromAmino(data); + return MsgGovExecuteJSON.fromAmino(data) case 'move/MsgGovPublish': - return MsgGovPublish.fromAmino(data); + return MsgGovPublish.fromAmino(data) case 'move/MsgGovScript': - return MsgGovScript.fromAmino(data); + return MsgGovScript.fromAmino(data) case 'move/MsgGovScriptJSON': - return MsgGovScriptJSON.fromAmino(data); + return MsgGovScriptJSON.fromAmino(data) // mstaking case 'mstaking/MsgDelegate': - return MsgDelegate.fromAmino(data); + return MsgDelegate.fromAmino(data) case 'mstaking/MsgUndelegate': - return MsgUndelegate.fromAmino(data); + return MsgUndelegate.fromAmino(data) case 'mstaking/MsgBeginRedelegate': - return MsgBeginRedelegate.fromAmino(data); + return MsgBeginRedelegate.fromAmino(data) case 'mstaking/MsgCreateValidator': - return MsgCreateValidator.fromAmino(data); + return MsgCreateValidator.fromAmino(data) case 'mstaking/MsgEditValidator': - return MsgEditValidator.fromAmino(data); + return MsgEditValidator.fromAmino(data) case 'mstaking/MsgCancelUnbondingDelegation': - return MsgCancelUnbondingDelegation.fromAmino(data); + return MsgCancelUnbondingDelegation.fromAmino(data) case 'mstaking/MsgUpdateParams': - return MsgUpdateMstakingParams.fromAmino(data); + return MsgUpdateMstakingParams.fromAmino(data) // opchild case 'opchild/MsgAddValidator': - return MsgAddValidator.fromAmino(data); + return MsgAddValidator.fromAmino(data) case 'opchild/MsgRemoveValidator': - return MsgRemoveValidator.fromAmino(data); + return MsgRemoveValidator.fromAmino(data) case 'opchild/MsgFinalizeTokenDeposit': - return MsgFinalizeTokenDeposit.fromAmino(data); + return MsgFinalizeTokenDeposit.fromAmino(data) case 'opchild/MsgInitiateTokenWithdrawal': - return MsgInitiateTokenWithdrawal.fromAmino(data); + return MsgInitiateTokenWithdrawal.fromAmino(data) case 'opchild/MsgExecuteMessages': - return MsgExecuteMessages.fromAmino(data); + return MsgExecuteMessages.fromAmino(data) case 'opchild/MsgSpendFeePool': - return MsgSpendFeePool.fromAmino(data); + return MsgSpendFeePool.fromAmino(data) case 'opchild/MsgSetBridgeInfo': - return MsgSetBridgeInfo.fromAmino(data); + return MsgSetBridgeInfo.fromAmino(data) case 'opchild/MsgUpdateOracle': - return MsgUpdateOracle.fromAmino(data); + return MsgUpdateOracle.fromAmino(data) case 'opchild/MsgUpdateParams': - return MsgUpdateOpchildParams.fromAmino(data); + return MsgUpdateOpchildParams.fromAmino(data) // ophost case 'ophost/MsgRecordBatch': - return MsgRecordBatch.fromAmino(data); + return MsgRecordBatch.fromAmino(data) case 'ophost/MsgCreateBridge': - return MsgCreateBridge.fromAmino(data); + return MsgCreateBridge.fromAmino(data) case 'ophost/MsgProposeOutput': - return MsgProposeOutput.fromAmino(data); + return MsgProposeOutput.fromAmino(data) case 'ophost/MsgDeleteOutput': - return MsgDeleteOutput.fromAmino(data); + return MsgDeleteOutput.fromAmino(data) case 'ophost/MsgInitiateTokenDeposit': - return MsgInitiateTokenDeposit.fromAmino(data); + return MsgInitiateTokenDeposit.fromAmino(data) case 'ophost/MsgFinalizeTokenWithdrawal': - return MsgFinalizeTokenWithdrawal.fromAmino(data); + return MsgFinalizeTokenWithdrawal.fromAmino(data) case 'ophost/MsgUpdateProposer': - return MsgUpdateProposer.fromAmino(data); + return MsgUpdateProposer.fromAmino(data) case 'ophost/MsgUpdateChallenger': - return MsgUpdateChallenger.fromAmino(data); + return MsgUpdateChallenger.fromAmino(data) case 'ophost/MsgUpdateBatchInfo': - return MsgUpdateBatchInfo.fromAmino(data); + return MsgUpdateBatchInfo.fromAmino(data) case 'ophost/MsgUpdateMetadata': - return MsgUpdateMetadata.fromAmino(data); + return MsgUpdateMetadata.fromAmino(data) case 'ophost/MsgUpdateParams': - return MsgUpdateOphostParams.fromAmino(data); + return MsgUpdateOphostParams.fromAmino(data) // oracle case 'slinky/x/oracle/MsgAddCurrencyPairs': - return MsgAddCurrencyPairs.fromAmino(data); + return MsgAddCurrencyPairs.fromAmino(data) case 'slinky/x/oracle/MsgSetCurrencyPairs': - return MsgRemoveCurrencyPairs.fromAmino(data); + return MsgRemoveCurrencyPairs.fromAmino(data) // reward case 'reward/MsgUpdateParams': - return MsgUpdateRewardParams.fromAmino(data); + return MsgUpdateRewardParams.fromAmino(data) // slashing case 'cosmos-sdk/MsgUnjail': - return MsgUnjail.fromAmino(data); + return MsgUnjail.fromAmino(data) case 'cosmos-sdk/x/slashing/MsgUpdateParams': - return MsgUpdateSlashingParams.fromAmino(data); + return MsgUpdateSlashingParams.fromAmino(data) // tokenfactory case 'tokenfactory/MsgCreateDenom': - return MsgCreateDenom.fromAmino(data); + return MsgCreateDenom.fromAmino(data) case 'tokenfactory/MsgMint': - return MsgMint.fromAmino(data); + return MsgMint.fromAmino(data) case 'tokenfactory/MsgBurn': - return MsgBurn.fromAmino(data); + return MsgBurn.fromAmino(data) case 'tokenfactory/MsgChangeAdmin': - return MsgChangeAdmin.fromAmino(data); + return MsgChangeAdmin.fromAmino(data) case 'tokenfactory/MsgSetDenomMetadata': - return MsgSetDenomMetadataWasm.fromAmino(data); + return MsgSetDenomMetadataWasm.fromAmino(data) case 'tokenfactory/MsgSetBeforeSendHook': - return MsgSetBeforeSendHook.fromAmino(data); + return MsgSetBeforeSendHook.fromAmino(data) case 'tokenfactory/MsgForceTransfer': - return MsgForceTransfer.fromAmino(data); + return MsgForceTransfer.fromAmino(data) case 'tokenfactory/MsgUpdateParams': - return MsgUpdateTokenfactoryParams.fromAmino(data); + return MsgUpdateTokenfactoryParams.fromAmino(data) // upgrade case 'cosmos-sdk/MsgSoftwareUpgrade': - return MsgSoftwareUpgrade.fromAmino(data); + return MsgSoftwareUpgrade.fromAmino(data) case 'cosmos-sdk/MsgCancelUpgrade': - return MsgCancelUpgrade.fromAmino(data); + return MsgCancelUpgrade.fromAmino(data) // wasm case 'wasm/MsgStoreCode': - return MsgStoreCode.fromAmino(data); + return MsgStoreCode.fromAmino(data) case 'wasm/MsgInstantiateContract': - return MsgInstantiateContract.fromAmino(data); + return MsgInstantiateContract.fromAmino(data) case 'wasm/MsgInstantiateContract2': - return MsgInstantiateContractV2.fromAmino(data); + return MsgInstantiateContractV2.fromAmino(data) case 'wasm/MsgExecuteContract': - return MsgExecuteContract.fromAmino(data); + return MsgExecuteContract.fromAmino(data) case 'wasm/MsgMigrateContract': - return MsgMigrateContract.fromAmino(data); + return MsgMigrateContract.fromAmino(data) case 'wasm/MsgUpdateAdmin': - return MsgUpdateAdmin.fromAmino(data); + return MsgUpdateAdmin.fromAmino(data) case 'wasm/MsgClearAdmin': - return MsgClearAdmin.fromAmino(data); + return MsgClearAdmin.fromAmino(data) case 'wasm/MsgUpdateInstantiateConfig': - return MsgUpdateInstantiateConfig.fromAmino(data); + return MsgUpdateInstantiateConfig.fromAmino(data) case 'wasm/MsgUpdateParams': - return MsgUpdateWasmParams.fromAmino(data); + return MsgUpdateWasmParams.fromAmino(data) case 'wasm/MsgSudoContract': - return MsgSudoContract.fromAmino(data); + return MsgSudoContract.fromAmino(data) case 'wasm/MsgPinCodes': - return MsgPinCodes.fromAmino(data); + return MsgPinCodes.fromAmino(data) case 'wasm/MsgUnpinCodes': - return MsgUnpinCodes.fromAmino(data); + return MsgUnpinCodes.fromAmino(data) case 'wasm/MsgStoreAndInstantiateContract': - return MsgStoreAndInstantiateContract.fromAmino(data); + return MsgStoreAndInstantiateContract.fromAmino(data) case 'wasm/MsgStoreAndMigrateContract': - return MsgStoreAndMigrateContract.fromAmino(data); + return MsgStoreAndMigrateContract.fromAmino(data) case 'wasm/MsgAddCodeUploadParamsAddresses': - return MsgAddCodeUploadParamsAddresses.fromAmino(data); + return MsgAddCodeUploadParamsAddresses.fromAmino(data) case 'wasm/MsgRemoveCodeUploadParamsAddresses': - return MsgRemoveCodeUploadParamsAddresses.fromAmino(data); + return MsgRemoveCodeUploadParamsAddresses.fromAmino(data) case 'wasm/MsgUpdateContractLabel': - return MsgUpdateContractLabel.fromAmino(data); + return MsgUpdateContractLabel.fromAmino(data) } } @@ -697,404 +694,401 @@ export namespace Msg { switch (data['@type']) { // auction case '/sdk.auction.v1.MsgAuctionBid': - return MsgAuctionBid.fromData(data); + return MsgAuctionBid.fromData(data) case '/sdk.auction.v1.MsgUpdateParams': - return MsgUpdateAuctionParams.fromData(data); + return MsgUpdateAuctionParams.fromData(data) //auth case '/cosmos.auth.v1beta1.MsgUpdateParams': - return MsgUpdateAuthParams.fromData(data); + return MsgUpdateAuthParams.fromData(data) // authz case '/cosmos.authz.v1beta1.MsgGrant': - return MsgGrantAuthorization.fromData(data); + return MsgGrantAuthorization.fromData(data) case '/cosmos.authz.v1beta1.MsgRevoke': - return MsgRevokeAuthorization.fromData(data); + return MsgRevokeAuthorization.fromData(data) case '/cosmos.authz.v1beta1.MsgExec': - return MsgExecAuthorized.fromData(data); + return MsgExecAuthorized.fromData(data) // bank case '/cosmos.bank.v1beta1.MsgSend': - return MsgSend.fromData(data); + return MsgSend.fromData(data) case '/cosmos.bank.v1beta1.MsgMultiSend': - return MsgMultiSend.fromData(data); + return MsgMultiSend.fromData(data) case '/cosmos.bank.v1beta1.MsgUpdateParams': - return MsgUpdateBankParams.fromData(data); + return MsgUpdateBankParams.fromData(data) case '/cosmos.bank.v1beta1.MsgSetSendEnabled': - return MsgSetSendEnabled.fromData(data); + return MsgSetSendEnabled.fromData(data) case '/initia.bank.v1.MsgSetDenomMetadata': - return MsgSetDenomMetadata.fromData(data); + return MsgSetDenomMetadata.fromData(data) // celestia case '/celestia.blob.v1.MsgPayForBlobs': - return MsgPayForBlobs.fromData(data); + return MsgPayForBlobs.fromData(data) // consensus case '/cosmos.consensus.v1.MsgUpdateParams': - return MsgUpdateConsensusParams.fromData(data); + return MsgUpdateConsensusParams.fromData(data) // crisis case '/cosmos.crisis.v1beta1.MsgVerifyInvariant': - return MsgVerifyInvariant.fromData(data); + return MsgVerifyInvariant.fromData(data) case '/cosmos.crisis.v1beta1.MsgUpdateParams': - return MsgUpdateCrisisParams.fromData(data); + return MsgUpdateCrisisParams.fromData(data) // distribution case '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress': - return MsgSetWithdrawAddress.fromData(data); + return MsgSetWithdrawAddress.fromData(data) case '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward': - return MsgWithdrawDelegatorReward.fromData(data); + return MsgWithdrawDelegatorReward.fromData(data) case '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission': - return MsgWithdrawValidatorCommission.fromData(data); + return MsgWithdrawValidatorCommission.fromData(data) case '/cosmos.distribution.v1beta1.MsgFundCommunityPool': - return MsgFundCommunityPool.fromData(data); + return MsgFundCommunityPool.fromData(data) case '/initia.distribution.v1.MsgUpdateParams': - return MsgUpdateDistrParams.fromData(data); + return MsgUpdateDistrParams.fromData(data) case '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend': - return MsgCommunityPoolSpend.fromData(data); + return MsgCommunityPoolSpend.fromData(data) case '/initia.distribution.v1.MsgDepositValidatorRewardsPool': - return MsgDepositValidatorRewardsPool.fromData(data); + return MsgDepositValidatorRewardsPool.fromData(data) // evidence case '/cosmos.evidence.v1beta1.MsgSubmitEvidence': - return MsgSubmitEvidence.fromData(data); + return MsgSubmitEvidence.fromData(data) // evm case '/minievm.evm.v1.MsgCreate': - return MsgCreate.fromData(data); + return MsgCreate.fromData(data) case '/minievm.evm.v1.MsgCall': - return MsgCall.fromData(data); + return MsgCall.fromData(data) case '/minievm.evm.v1.MsgUpdateParams': - return MsgUpdateEvmParams.fromData(data); + return MsgUpdateEvmParams.fromData(data) // feegrant case '/cosmos.feegrant.v1beta1.MsgGrantAllowance': - return MsgGrantAllowance.fromData(data); + return MsgGrantAllowance.fromData(data) case '/cosmos.feegrant.v1beta1.MsgRevokeAllowance': - return MsgRevokeAllowance.fromData(data); + return MsgRevokeAllowance.fromData(data) // forwarding case '/noble.forwarding.v1.MsgRegisterAccount': - return MsgRegisterForwardingAccount.fromData(data); + return MsgRegisterForwardingAccount.fromData(data) case '/noble.forwarding.v1.MsgClearAccount': - return MsgClearForwardingAccount.fromData(data); + return MsgClearForwardingAccount.fromData(data) // gov case '/cosmos.gov.v1.MsgCancelProposal': - return MsgCancelProposal.fromData(data); + return MsgCancelProposal.fromData(data) case '/cosmos.gov.v1beta1.MsgDeposit': - return MsgDepositLegacy.fromData(data); + return MsgDepositLegacy.fromData(data) case '/cosmos.gov.v1.MsgDeposit': - return MsgDeposit.fromData(data); + return MsgDeposit.fromData(data) case '/cosmos.gov.v1beta1.MsgSubmitProposal': - return MsgSubmitProposalLegacy.fromData(data); + return MsgSubmitProposalLegacy.fromData(data) case '/cosmos.gov.v1.MsgSubmitProposal': - return MsgSubmitProposal.fromData(data); + return MsgSubmitProposal.fromData(data) case '/cosmos.gov.v1beta1.MsgVote': - return MsgVoteLegacy.fromData(data); + return MsgVoteLegacy.fromData(data) case '/cosmos.gov.v1.MsgVote': - return MsgVote.fromData(data); + return MsgVote.fromData(data) case '/cosmos.gov.v1beta1.MsgVoteWeighted': - return MsgVoteWeightedLegacy.fromData(data); + return MsgVoteWeightedLegacy.fromData(data) case '/cosmos.gov.v1.MsgVoteWeighted': - return MsgVoteWeighted.fromData(data); + return MsgVoteWeighted.fromData(data) case '/initia.gov.v1.MsgUpdateParams': - return MsgUpdateGovParams.fromData(data); + return MsgUpdateGovParams.fromData(data) // group case '/cosmos.group.v1.MsgCreateGroup': - return MsgCreateGroup.fromData(data); + return MsgCreateGroup.fromData(data) case '/cosmos.group.v1.MsgCreateGroupPolicy': - return MsgCreateGroupPolicy.fromData(data); + return MsgCreateGroupPolicy.fromData(data) case '/cosmos.group.v1.MsgCreateGroupWithPolicy': - return MsgCreateGroupWithPolicy.fromData(data); + return MsgCreateGroupWithPolicy.fromData(data) case '/cosmos.group.v1.MsgExec': - return MsgGroupExec.fromData(data); + return MsgGroupExec.fromData(data) case '/cosmos.group.v1.MsgLeaveGroup': - return MsgLeaveGroup.fromData(data); + return MsgLeaveGroup.fromData(data) case '/cosmos.group.v1.MsgSubmitProposal': - return MsgSubmitGroupProposal.fromData(data); + return MsgSubmitGroupProposal.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupAdmin': - return MsgUpdateGroupAdmin.fromData(data); + return MsgUpdateGroupAdmin.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupMembers': - return MsgUpdateGroupMembers.fromData(data); + return MsgUpdateGroupMembers.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupMetadata': - return MsgUpdateGroupMetadata.fromData(data); + return MsgUpdateGroupMetadata.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin': - return MsgUpdateGroupPolicyAdmin.fromData(data); + return MsgUpdateGroupPolicyAdmin.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy': - return MsgUpdateGroupDecisionPolicy.fromData(data); + return MsgUpdateGroupDecisionPolicy.fromData(data) case '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata': - return MsgUpdateGroupPolicyMetadata.fromData(data); + return MsgUpdateGroupPolicyMetadata.fromData(data) case '/cosmos.group.v1.MsgVote': - return MsgGroupVote.fromData(data); + return MsgGroupVote.fromData(data) // ibc-fee case '/ibc.applications.fee.v1.MsgPayPacketFee': - return MsgPayPacketFee.fromData(data); + return MsgPayPacketFee.fromData(data) case '/ibc.applications.fee.v1.MsgPayPacketFeeAsync': - return MsgPayPacketFeeAsync.fromData(data); + return MsgPayPacketFeeAsync.fromData(data) case '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee': - return MsgRegisterCounterpartyPayee.fromData(data); + return MsgRegisterCounterpartyPayee.fromData(data) case '/ibc.applications.fee.v1.MsgRegisterPayee': - return MsgRegisterPayee.fromData(data); + return MsgRegisterPayee.fromData(data) // ibc-hooks case '/initia.ibchooks.v1.MsgUpdateACL': - return MsgUpdateACL.fromData(data); + return MsgUpdateACL.fromData(data) case '/initia.ibchooks.v1.MsgUpdateParams': - return MsgUpdateIbcHooksParams.fromData(data); + return MsgUpdateIbcHooksParams.fromData(data) // ibc-nft-transfer case '/ibc.applications.nft_transfer.v1.MsgTransfer': - return MsgNftTransfer.fromData(data); + return MsgNftTransfer.fromData(data) case '/ibc.applications.nft_transfer.v1.MsgUpdateParams': - return MsgUpdateIbcNftParams.fromData(data); + return MsgUpdateIbcNftParams.fromData(data) // ibc-perm case '/ibc.applications.perm.v1.MsgSetPermissionedRelayers': - return MsgSetPermissionedRelayers.fromData(data); + return MsgSetPermissionedRelayers.fromData(data) // ibc-transfer case '/ibc.applications.transfer.v1.MsgTransfer': - return MsgTransfer.fromData(data); + return MsgTransfer.fromData(data) case '/ibc.applications.transfer.v1.MsgUpdateParams': - return MsgUpdateIbcTransferParams.fromData(data); + return MsgUpdateIbcTransferParams.fromData(data) // ibc-channel case '/ibc.core.channel.v1.MsgChannelOpenInit': - return MsgChannelOpenInit.fromData(data); + return MsgChannelOpenInit.fromData(data) case '/ibc.core.channel.v1.MsgChannelOpenTry': - return MsgChannelOpenTry.fromData(data); + return MsgChannelOpenTry.fromData(data) case '/ibc.core.channel.v1.MsgChannelOpenConfirm': - return MsgChannelOpenConfirm.fromData(data); + return MsgChannelOpenConfirm.fromData(data) case '/ibc.core.channel.v1.MsgChannelOpenAck': - return MsgChannelOpenAck.fromData(data); + return MsgChannelOpenAck.fromData(data) case '/ibc.core.channel.v1.MsgChannelCloseInit': - return MsgChannelCloseInit.fromData(data); + return MsgChannelCloseInit.fromData(data) case '/ibc.core.channel.v1.MsgChannelCloseConfirm': - return MsgChannelCloseConfirm.fromData(data); + return MsgChannelCloseConfirm.fromData(data) case '/ibc.core.channel.v1.MsgRecvPacket': - return MsgRecvPacket.fromData(data); + return MsgRecvPacket.fromData(data) case '/ibc.core.channel.v1.MsgAcknowledgement': - return MsgAcknowledgement.fromData(data); + return MsgAcknowledgement.fromData(data) case '/ibc.core.channel.v1.MsgTimeout': - return MsgTimeout.fromData(data); + return MsgTimeout.fromData(data) case '/ibc.core.channel.v1.MsgTimeoutOnClose': - return MsgTimeoutOnClose.fromData(data); + return MsgTimeoutOnClose.fromData(data) case '/ibc.core.channel.v1.MsgUpdateParams': - return MsgUpdateIbcChannelParams.fromData(data); + return MsgUpdateIbcChannelParams.fromData(data) // ibc-client case '/ibc.core.client.v1.MsgCreateClient': - return MsgCreateClient.fromData(data); + return MsgCreateClient.fromData(data) case '/ibc.core.client.v1.MsgUpdateClient': - return MsgUpdateClient.fromData(data); + return MsgUpdateClient.fromData(data) case '/ibc.core.client.v1.MsgUpgradeClient': - return MsgUpgradeClient.fromData(data); + return MsgUpgradeClient.fromData(data) case '/ibc.core.client.v1.MsgSubmitMisbehaviour': - return MsgSubmitMisbehaviour.fromData(data); + return MsgSubmitMisbehaviour.fromData(data) case '/ibc.core.client.v1.MsgRecoverClient': - return MsgRecoverClient.fromData(data); + return MsgRecoverClient.fromData(data) case '/ibc.core.client.v1.MsgIBCSoftwareUpgrade': - return MsgIBCSoftwareUpgrade.fromData(data); + return MsgIBCSoftwareUpgrade.fromData(data) case '/ibc.core.client.v1.MsgUpdateParams': - return MsgUpdateIbcClientParams.fromData(data); + return MsgUpdateIbcClientParams.fromData(data) // ibc-connection case '/ibc.core.connection.v1.MsgConnectionOpenInit': - return MsgConnectionOpenInit.fromData(data); + return MsgConnectionOpenInit.fromData(data) case '/ibc.core.connection.v1.MsgConnectionOpenTry': - return MsgConnectionOpenTry.fromData(data); + return MsgConnectionOpenTry.fromData(data) case '/ibc.core.connection.v1.MsgConnectionOpenConfirm': - return MsgConnectionOpenConfirm.fromData(data); + return MsgConnectionOpenConfirm.fromData(data) case '/ibc.core.connection.v1.MsgConnectionOpenAck': - return MsgConnectionOpenAck.fromData(data); + return MsgConnectionOpenAck.fromData(data) case '/ibc.core.connection.v1.MsgUpdateParams': - return MsgUpdateIbcConnectionParams.fromData(data); + return MsgUpdateIbcConnectionParams.fromData(data) // intertx case '/initia.intertx.v1.MsgRegisterAccount': - return MsgRegisterAccount.fromData(data); + return MsgRegisterAccount.fromData(data) case '/initia.intertx.v1.MsgSubmitTx': - return MsgSubmitTx.fromData(data); + return MsgSubmitTx.fromData(data) // marketmap case '/slinky.marketmap.v1.MsgCreateMarkets': - return MsgCreateMarkets.fromData(data); + return MsgCreateMarkets.fromData(data) case '/slinky.marketmap.v1.MsgUpdateMarkets': - return MsgUpdateMarkets.fromData(data); + return MsgUpdateMarkets.fromData(data) case '/slinky.marketmap.v1.MsgRemoveMarketAuthorities': - return MsgRemoveMarketAuthorities.fromData(data); + return MsgRemoveMarketAuthorities.fromData(data) case '/slinky.marketmap.v1.MsgParams': - return MsgUpdateMarketmapParams.fromData(data); + return MsgUpdateMarketmapParams.fromData(data) // move case '/initia.move.v1.MsgPublish': - return MsgPublish.fromData(data); + return MsgPublish.fromData(data) case '/initia.move.v1.MsgExecute': - return MsgExecute.fromData(data); + return MsgExecute.fromData(data) case '/initia.move.v1.MsgExecuteJSON': - return MsgExecuteJSON.fromData(data); + return MsgExecuteJSON.fromData(data) case '/initia.move.v1.MsgScript': - return MsgScript.fromData(data); + return MsgScript.fromData(data) case '/initia.move.v1.MsgScriptJSON': - return MsgScriptJSON.fromData(data); + return MsgScriptJSON.fromData(data) case '/initia.move.v1.MsgUpdateParams': - return MsgUpdateMoveParams.fromData(data); + return MsgUpdateMoveParams.fromData(data) case '/initia.move.v1.MsgWhitelist': - return MsgWhitelist.fromData(data); + return MsgWhitelist.fromData(data) case '/initia.move.v1.MsgDelist': - return MsgDelist.fromData(data); + return MsgDelist.fromData(data) case '/initia.move.v1.MsgGovExecute': - return MsgGovExecute.fromData(data); + return MsgGovExecute.fromData(data) case '/initia.move.v1.MsgGovExecuteJSON': - return MsgGovExecuteJSON.fromData(data); + return MsgGovExecuteJSON.fromData(data) case '/initia.move.v1.MsgGovPublish': - return MsgGovPublish.fromData(data); + return MsgGovPublish.fromData(data) case '/initia.move.v1.MsgGovScript': - return MsgGovScript.fromData(data); + return MsgGovScript.fromData(data) case '/initia.move.v1.MsgGovScriptJSON': - return MsgGovScriptJSON.fromData(data); + return MsgGovScriptJSON.fromData(data) // mstaking case '/initia.mstaking.v1.MsgDelegate': - return MsgDelegate.fromData(data); + return MsgDelegate.fromData(data) case '/initia.mstaking.v1.MsgUndelegate': - return MsgUndelegate.fromData(data); + return MsgUndelegate.fromData(data) case '/initia.mstaking.v1.MsgBeginRedelegate': - return MsgBeginRedelegate.fromData(data); + return MsgBeginRedelegate.fromData(data) case '/initia.mstaking.v1.MsgCreateValidator': - return MsgCreateValidator.fromData(data); + return MsgCreateValidator.fromData(data) case '/initia.mstaking.v1.MsgEditValidator': - return MsgEditValidator.fromData(data); + return MsgEditValidator.fromData(data) case '/initia.mstaking.v1.MsgCancelUnbondingDelegation': - return MsgCancelUnbondingDelegation.fromData(data); + return MsgCancelUnbondingDelegation.fromData(data) case '/initia.mstaking.v1.MsgUpdateParams': - return MsgUpdateMstakingParams.fromData(data); + return MsgUpdateMstakingParams.fromData(data) // opchild case '/opinit.opchild.v1.MsgAddValidator': - return MsgAddValidator.fromData(data); + return MsgAddValidator.fromData(data) case '/opinit.opchild.v1.MsgRemoveValidator': - return MsgRemoveValidator.fromData(data); + return MsgRemoveValidator.fromData(data) case '/opinit.opchild.v1.MsgFinalizeTokenDeposit': - return MsgFinalizeTokenDeposit.fromData(data); + return MsgFinalizeTokenDeposit.fromData(data) case '/opinit.opchild.v1.MsgInitiateTokenWithdrawal': - return MsgInitiateTokenWithdrawal.fromData(data); + return MsgInitiateTokenWithdrawal.fromData(data) case '/opinit.opchild.v1.MsgExecuteMessages': - return MsgExecuteMessages.fromData(data); + return MsgExecuteMessages.fromData(data) case '/opinit.opchild.v1.MsgSpendFeePool': - return MsgSpendFeePool.fromData(data); + return MsgSpendFeePool.fromData(data) case '/opinit.opchild.v1.MsgSetBridgeInfo': - return MsgSetBridgeInfo.fromData(data); + return MsgSetBridgeInfo.fromData(data) case '/opinit.opchild.v1.MsgUpdateOracle': - return MsgUpdateOracle.fromData(data); + return MsgUpdateOracle.fromData(data) case '/opinit.opchild.v1.MsgUpdateParams': - return MsgUpdateOpchildParams.fromData(data); + return MsgUpdateOpchildParams.fromData(data) // ophost case '/opinit.ophost.v1.MsgRecordBatch': - return MsgRecordBatch.fromData(data); + return MsgRecordBatch.fromData(data) case '/opinit.ophost.v1.MsgCreateBridge': - return MsgCreateBridge.fromData(data); + return MsgCreateBridge.fromData(data) case '/opinit.ophost.v1.MsgProposeOutput': - return MsgProposeOutput.fromData(data); + return MsgProposeOutput.fromData(data) case '/opinit.ophost.v1.MsgDeleteOutput': - return MsgDeleteOutput.fromData(data); + return MsgDeleteOutput.fromData(data) case '/opinit.ophost.v1.MsgInitiateTokenDeposit': - return MsgInitiateTokenDeposit.fromData(data); + return MsgInitiateTokenDeposit.fromData(data) case '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal': - return MsgFinalizeTokenWithdrawal.fromData(data); + return MsgFinalizeTokenWithdrawal.fromData(data) case '/opinit.ophost.v1.MsgUpdateProposer': - return MsgUpdateProposer.fromData(data); + return MsgUpdateProposer.fromData(data) case '/opinit.ophost.v1.MsgUpdateChallenger': - return MsgUpdateChallenger.fromData(data); + return MsgUpdateChallenger.fromData(data) case '/opinit.ophost.v1.MsgUpdateBatchInfo': - return MsgUpdateBatchInfo.fromData(data); + return MsgUpdateBatchInfo.fromData(data) case '/opinit.ophost.v1.MsgUpdateMetadata': - return MsgUpdateMetadata.fromData(data); + return MsgUpdateMetadata.fromData(data) case '/opinit.ophost.v1.MsgUpdateParams': - return MsgUpdateOphostParams.fromData(data); + return MsgUpdateOphostParams.fromData(data) // oracle case '/slinky.oracle.v1.MsgAddCurrencyPairs': - return MsgAddCurrencyPairs.fromData(data); + return MsgAddCurrencyPairs.fromData(data) case '/slinky.oracle.v1.MsgRemoveCurrencyPairs': - return MsgRemoveCurrencyPairs.fromData(data); + return MsgRemoveCurrencyPairs.fromData(data) // reward case '/initia.reward.v1.MsgUpdateParams': - return MsgUpdateRewardParams.fromData(data); + return MsgUpdateRewardParams.fromData(data) // slashing case '/cosmos.slashing.v1beta1.MsgUnjail': - return MsgUnjail.fromData(data); + return MsgUnjail.fromData(data) case '/cosmos.slashing.v1beta1.MsgUpdateParams': - return MsgUpdateSlashingParams.fromData(data); + return MsgUpdateSlashingParams.fromData(data) // tokenfactory case '/miniwasm.tokenfactory.v1.MsgCreateDenom': - return MsgCreateDenom.fromData(data); + return MsgCreateDenom.fromData(data) case '/miniwasm.tokenfactory.v1.MsgMint': - return MsgMint.fromData(data); + return MsgMint.fromData(data) case '/miniwasm.tokenfactory.v1.MsgBurn': - return MsgBurn.fromData(data); + return MsgBurn.fromData(data) case '/miniwasm.tokenfactory.v1.MsgChangeAdmin': - return MsgChangeAdmin.fromData(data); + return MsgChangeAdmin.fromData(data) case '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata': - return MsgSetDenomMetadataWasm.fromData(data); + return MsgSetDenomMetadataWasm.fromData(data) case '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook': - return MsgSetBeforeSendHook.fromData(data); + return MsgSetBeforeSendHook.fromData(data) case '/miniwasm.tokenfactory.v1.MsgForceTransfer': - return MsgForceTransfer.fromData(data); + return MsgForceTransfer.fromData(data) case '/miniwasm.tokenfactory.v1.MsgUpdateParams': - return MsgUpdateTokenfactoryParams.fromData(data); + return MsgUpdateTokenfactoryParams.fromData(data) // upgrade case '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade': - return MsgSoftwareUpgrade.fromData(data); + return MsgSoftwareUpgrade.fromData(data) case '/cosmos.upgrade.v1beta1.MsgCancelUpgrade': - return MsgCancelUpgrade.fromData(data); + return MsgCancelUpgrade.fromData(data) // wasm case '/cosmwasm.wasm.v1.MsgStoreCode': - return MsgStoreCode.fromData(data); + return MsgStoreCode.fromData(data) case '/cosmwasm.wasm.v1.MsgInstantiateContract': - return MsgInstantiateContract.fromData(data); + return MsgInstantiateContract.fromData(data) case '/cosmwasm.wasm.v1.MsgInstantiateContract2': - return MsgInstantiateContractV2.fromData(data); + return MsgInstantiateContractV2.fromData(data) case '/cosmwasm.wasm.v1.MsgExecuteContract': - return MsgExecuteContract.fromData(data); + return MsgExecuteContract.fromData(data) case '/cosmwasm.wasm.v1.MsgMigrateContract': - return MsgMigrateContract.fromData(data); + return MsgMigrateContract.fromData(data) case '/cosmwasm.wasm.v1.MsgUpdateAdmin': - return MsgUpdateAdmin.fromData(data); + return MsgUpdateAdmin.fromData(data) case '/cosmwasm.wasm.v1.MsgClearAdmin': - return MsgClearAdmin.fromData(data); + return MsgClearAdmin.fromData(data) case '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig': - return MsgUpdateInstantiateConfig.fromData(data); + return MsgUpdateInstantiateConfig.fromData(data) case '/cosmwasm.wasm.v1.MsgUpdateParams': - return MsgUpdateWasmParams.fromData(data); + return MsgUpdateWasmParams.fromData(data) case '/cosmwasm.wasm.v1.MsgSudoContract': - return MsgSudoContract.fromData(data); + return MsgSudoContract.fromData(data) case '/cosmwasm.wasm.v1.MsgPinCodes': - return MsgPinCodes.fromData(data); + return MsgPinCodes.fromData(data) case '/cosmwasm.wasm.v1.MsgUnpinCodes': - return MsgUnpinCodes.fromData(data); + return MsgUnpinCodes.fromData(data) case '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract': - return MsgStoreAndInstantiateContract.fromData(data); + return MsgStoreAndInstantiateContract.fromData(data) case '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract': - return MsgStoreAndMigrateContract.fromData(data); + return MsgStoreAndMigrateContract.fromData(data) case '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses': - return MsgAddCodeUploadParamsAddresses.fromData(data); + return MsgAddCodeUploadParamsAddresses.fromData(data) case '/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses': - return MsgRemoveCodeUploadParamsAddresses.fromData(data); + return MsgRemoveCodeUploadParamsAddresses.fromData(data) case '/cosmwasm.wasm.v1.MsgUpdateContractLabel': - return MsgUpdateContractLabel.fromData(data); - - default: - throw new Error(`not supported msg ${data['@type']}`); + return MsgUpdateContractLabel.fromData(data) } } @@ -1102,404 +1096,404 @@ export namespace Msg { switch (proto.typeUrl) { // auction case '/sdk.auction.v1.MsgAuctionBid': - return MsgAuctionBid.unpackAny(proto); + return MsgAuctionBid.unpackAny(proto) case '/sdk.auction.v1.MsgUpdateParams': - return MsgUpdateAuctionParams.unpackAny(proto); + return MsgUpdateAuctionParams.unpackAny(proto) // auth case '/cosmos.auth.v1beta1.MsgUpdateParams': - return MsgUpdateAuthParams.unpackAny(proto); + return MsgUpdateAuthParams.unpackAny(proto) // authz case '/cosmos.authz.v1beta1.MsgGrant': - return MsgGrantAuthorization.unpackAny(proto); + return MsgGrantAuthorization.unpackAny(proto) case '/cosmos.authz.v1beta1.MsgRevoke': - return MsgRevokeAuthorization.unpackAny(proto); + return MsgRevokeAuthorization.unpackAny(proto) case '/cosmos.authz.v1beta1.MsgExec': - return MsgExecAuthorized.unpackAny(proto); + return MsgExecAuthorized.unpackAny(proto) // bank case '/cosmos.bank.v1beta1.MsgSend': - return MsgSend.unpackAny(proto); + return MsgSend.unpackAny(proto) case '/cosmos.bank.v1beta1.MsgMultiSend': - return MsgMultiSend.unpackAny(proto); + return MsgMultiSend.unpackAny(proto) case '/cosmos.bank.v1beta1.MsgUpdateParams': - return MsgUpdateBankParams.unpackAny(proto); + return MsgUpdateBankParams.unpackAny(proto) case '/cosmos.bank.v1beta1.MsgSetSendEnabled': - return MsgSetSendEnabled.unpackAny(proto); + return MsgSetSendEnabled.unpackAny(proto) case '/initia.bank.v1.MsgSetDenomMetadata': - return MsgSetDenomMetadata.unpackAny(proto); + return MsgSetDenomMetadata.unpackAny(proto) // celestia case '/celestia.blob.v1.MsgPayForBlobs': - return MsgPayForBlobs.unpackAny(proto); + return MsgPayForBlobs.unpackAny(proto) // consensus case '/cosmos.consensus.v1.MsgUpdateParams': - return MsgUpdateConsensusParams.unpackAny(proto); + return MsgUpdateConsensusParams.unpackAny(proto) // crisis case '/cosmos.crisis.v1beta1.MsgVerifyInvariant': - return MsgVerifyInvariant.unpackAny(proto); + return MsgVerifyInvariant.unpackAny(proto) case '/cosmos.crisis.v1beta1.MsgUpdateParams': - return MsgUpdateCrisisParams.unpackAny(proto); + return MsgUpdateCrisisParams.unpackAny(proto) // distribution case '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress': - return MsgSetWithdrawAddress.unpackAny(proto); + return MsgSetWithdrawAddress.unpackAny(proto) case '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward': - return MsgWithdrawDelegatorReward.unpackAny(proto); + return MsgWithdrawDelegatorReward.unpackAny(proto) case '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission': - return MsgWithdrawValidatorCommission.unpackAny(proto); + return MsgWithdrawValidatorCommission.unpackAny(proto) case '/cosmos.distribution.v1beta1.MsgFundCommunityPool': - return MsgFundCommunityPool.unpackAny(proto); + return MsgFundCommunityPool.unpackAny(proto) case '/initia.distribution.v1.MsgUpdateParams': - return MsgUpdateDistrParams.unpackAny(proto); + return MsgUpdateDistrParams.unpackAny(proto) case '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend': - return MsgCommunityPoolSpend.unpackAny(proto); + return MsgCommunityPoolSpend.unpackAny(proto) case '/initia.distribution.v1.MsgDepositValidatorRewardsPool': - return MsgDepositValidatorRewardsPool.unpackAny(proto); + return MsgDepositValidatorRewardsPool.unpackAny(proto) // evidence case '/cosmos.evidence.v1beta1.MsgSubmitEvidence': - return MsgSubmitEvidence.unpackAny(proto); + return MsgSubmitEvidence.unpackAny(proto) // evm case '/minievm.evm.v1.MsgCreate': - return MsgCreate.unpackAny(proto); + return MsgCreate.unpackAny(proto) case '/minievm.evm.v1.MsgCall': - return MsgCall.unpackAny(proto); + return MsgCall.unpackAny(proto) case '/minievm.evm.v1.MsgUpdateParams': - return MsgUpdateEvmParams.unpackAny(proto); + return MsgUpdateEvmParams.unpackAny(proto) // feegrant case '/cosmos.feegrant.v1beta1.MsgGrantAllowance': - return MsgGrantAllowance.unpackAny(proto); + return MsgGrantAllowance.unpackAny(proto) case '/cosmos.feegrant.v1beta1.MsgRevokeAllowance': - return MsgRevokeAllowance.unpackAny(proto); + return MsgRevokeAllowance.unpackAny(proto) // forwarding case '/noble.forwarding.v1.MsgRegisterAccount': - return MsgRegisterForwardingAccount.unpackAny(proto); + return MsgRegisterForwardingAccount.unpackAny(proto) case '/noble.forwarding.v1.MsgClearAccount': - return MsgClearForwardingAccount.unpackAny(proto); + return MsgClearForwardingAccount.unpackAny(proto) // gov case '/cosmos.gov.v1.MsgCancelProposal': - return MsgCancelProposal.unpackAny(proto); + return MsgCancelProposal.unpackAny(proto) case '/cosmos.gov.v1beta1.MsgDeposit': - return MsgDepositLegacy.unpackAny(proto); + return MsgDepositLegacy.unpackAny(proto) case '/cosmos.gov.v1.MsgDeposit': - return MsgDeposit.unpackAny(proto); + return MsgDeposit.unpackAny(proto) case '/cosmos.gov.v1beta1.MsgSubmitProposal': - return MsgSubmitProposalLegacy.unpackAny(proto); + return MsgSubmitProposalLegacy.unpackAny(proto) case '/cosmos.gov.v1.MsgSubmitProposal': - return MsgSubmitProposal.unpackAny(proto); + return MsgSubmitProposal.unpackAny(proto) case '/cosmos.gov.v1beta1.MsgVote': - return MsgVoteLegacy.unpackAny(proto); + return MsgVoteLegacy.unpackAny(proto) case '/cosmos.gov.v1.MsgVote': - return MsgVote.unpackAny(proto); + return MsgVote.unpackAny(proto) case '/cosmos.gov.v1beta1.MsgVoteWeighted': - return MsgVoteWeightedLegacy.unpackAny(proto); + return MsgVoteWeightedLegacy.unpackAny(proto) case '/cosmos.gov.v1.MsgVoteWeighted': - return MsgVoteWeighted.unpackAny(proto); + return MsgVoteWeighted.unpackAny(proto) case '/initia.gov.v1.MsgUpdateParams': - return MsgUpdateGovParams.unpackAny(proto); + return MsgUpdateGovParams.unpackAny(proto) // group case '/cosmos.group.v1.MsgCreateGroup': - return MsgCreateGroup.unpackAny(proto); + return MsgCreateGroup.unpackAny(proto) case '/cosmos.group.v1.MsgCreateGroupPolicy': - return MsgCreateGroupPolicy.unpackAny(proto); + return MsgCreateGroupPolicy.unpackAny(proto) case '/cosmos.group.v1.MsgCreateGroupWithPolicy': - return MsgCreateGroupWithPolicy.unpackAny(proto); + return MsgCreateGroupWithPolicy.unpackAny(proto) case '/cosmos.group.v1.MsgExec': - return MsgGroupExec.unpackAny(proto); + return MsgGroupExec.unpackAny(proto) case '/cosmos.group.v1.MsgLeaveGroup': - return MsgLeaveGroup.unpackAny(proto); + return MsgLeaveGroup.unpackAny(proto) case '/cosmos.group.v1.MsgSubmitProposal': - return MsgSubmitGroupProposal.unpackAny(proto); + return MsgSubmitGroupProposal.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupAdmin': - return MsgUpdateGroupAdmin.unpackAny(proto); + return MsgUpdateGroupAdmin.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupMembers': - return MsgUpdateGroupMembers.unpackAny(proto); + return MsgUpdateGroupMembers.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupMetadata': - return MsgUpdateGroupMetadata.unpackAny(proto); + return MsgUpdateGroupMetadata.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin': - return MsgUpdateGroupPolicyAdmin.unpackAny(proto); + return MsgUpdateGroupPolicyAdmin.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy': - return MsgUpdateGroupDecisionPolicy.unpackAny(proto); + return MsgUpdateGroupDecisionPolicy.unpackAny(proto) case '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata': - return MsgUpdateGroupPolicyMetadata.unpackAny(proto); + return MsgUpdateGroupPolicyMetadata.unpackAny(proto) case '/cosmos.group.v1.MsgVote': - return MsgGroupVote.unpackAny(proto); + return MsgGroupVote.unpackAny(proto) // ibc-fee case '/ibc.applications.fee.v1.MsgPayPacketFee': - return MsgPayPacketFee.unpackAny(proto); + return MsgPayPacketFee.unpackAny(proto) case '/ibc.applications.fee.v1.MsgPayPacketFeeAsync': - return MsgPayPacketFeeAsync.unpackAny(proto); + return MsgPayPacketFeeAsync.unpackAny(proto) case '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee': - return MsgRegisterCounterpartyPayee.unpackAny(proto); + return MsgRegisterCounterpartyPayee.unpackAny(proto) case '/ibc.applications.fee.v1.MsgRegisterPayee': - return MsgRegisterPayee.unpackAny(proto); + return MsgRegisterPayee.unpackAny(proto) // ibc-hooks case '/initia.ibchooks.v1.MsgUpdateACL': - return MsgUpdateACL.unpackAny(proto); + return MsgUpdateACL.unpackAny(proto) case '/initia.ibchooks.v1.MsgUpdateParams': - return MsgUpdateIbcHooksParams.unpackAny(proto); + return MsgUpdateIbcHooksParams.unpackAny(proto) // ibc-nft-transfer case '/ibc.applications.nft_transfer.v1.MsgTransfer': - return MsgNftTransfer.unpackAny(proto); + return MsgNftTransfer.unpackAny(proto) case '/ibc.applications.nft_transfer.v1.MsgUpdateParams': - return MsgUpdateIbcNftParams.unpackAny(proto); + return MsgUpdateIbcNftParams.unpackAny(proto) // ibc-perm case '/ibc.applications.perm.v1.MsgSetPermissionedRelayers': - return MsgSetPermissionedRelayers.unpackAny(proto); + return MsgSetPermissionedRelayers.unpackAny(proto) // ibc-transfer case '/ibc.applications.transfer.v1.MsgTransfer': - return MsgTransfer.unpackAny(proto); + return MsgTransfer.unpackAny(proto) case '/ibc.applications.transfer.v1.MsgUpdateParams': - return MsgUpdateIbcTransferParams.unpackAny(proto); + return MsgUpdateIbcTransferParams.unpackAny(proto) // ibc-channel case '/ibc.core.channel.v1.MsgChannelOpenInit': - return MsgChannelOpenInit.unpackAny(proto); + return MsgChannelOpenInit.unpackAny(proto) case '/ibc.core.channel.v1.MsgChannelOpenTry': - return MsgChannelOpenTry.unpackAny(proto); + return MsgChannelOpenTry.unpackAny(proto) case '/ibc.core.channel.v1.MsgChannelOpenConfirm': - return MsgChannelOpenConfirm.unpackAny(proto); + return MsgChannelOpenConfirm.unpackAny(proto) case '/ibc.core.channel.v1.MsgChannelOpenAck': - return MsgChannelOpenAck.unpackAny(proto); + return MsgChannelOpenAck.unpackAny(proto) case '/ibc.core.channel.v1.MsgChannelCloseInit': - return MsgChannelCloseInit.unpackAny(proto); + return MsgChannelCloseInit.unpackAny(proto) case '/ibc.core.channel.v1.MsgChannelCloseConfirm': - return MsgChannelCloseConfirm.unpackAny(proto); + return MsgChannelCloseConfirm.unpackAny(proto) case '/ibc.core.channel.v1.MsgRecvPacket': - return MsgRecvPacket.unpackAny(proto); + return MsgRecvPacket.unpackAny(proto) case '/ibc.core.channel.v1.MsgAcknowledgement': - return MsgAcknowledgement.unpackAny(proto); + return MsgAcknowledgement.unpackAny(proto) case '/ibc.core.channel.v1.MsgTimeout': - return MsgTimeout.unpackAny(proto); + return MsgTimeout.unpackAny(proto) case '/ibc.core.channel.v1.MsgTimeoutOnClose': - return MsgTimeoutOnClose.unpackAny(proto); + return MsgTimeoutOnClose.unpackAny(proto) case '/ibc.core.channel.v1.MsgUpdateParams': - return MsgUpdateIbcChannelParams.unpackAny(proto); + return MsgUpdateIbcChannelParams.unpackAny(proto) // ibc-client case '/ibc.core.client.v1.MsgCreateClient': - return MsgCreateClient.unpackAny(proto); + return MsgCreateClient.unpackAny(proto) case '/ibc.core.client.v1.MsgUpdateClient': - return MsgUpdateClient.unpackAny(proto); + return MsgUpdateClient.unpackAny(proto) case '/ibc.core.client.v1.MsgUpgradeClient': - return MsgUpgradeClient.unpackAny(proto); + return MsgUpgradeClient.unpackAny(proto) case '/ibc.core.client.v1.MsgSubmitMisbehaviour': - return MsgSubmitMisbehaviour.unpackAny(proto); + return MsgSubmitMisbehaviour.unpackAny(proto) case '/ibc.core.client.v1.MsgRecoverClient': - return MsgRecoverClient.unpackAny(proto); + return MsgRecoverClient.unpackAny(proto) case '/ibc.core.client.v1.MsgIBCSoftwareUpgrade': - return MsgIBCSoftwareUpgrade.unpackAny(proto); + return MsgIBCSoftwareUpgrade.unpackAny(proto) case '/ibc.core.client.v1.MsgUpdateParams': - return MsgUpdateIbcClientParams.unpackAny(proto); + return MsgUpdateIbcClientParams.unpackAny(proto) // ibc-connection case '/ibc.core.connection.v1.MsgConnectionOpenInit': - return MsgConnectionOpenInit.unpackAny(proto); + return MsgConnectionOpenInit.unpackAny(proto) case '/ibc.core.connection.v1.MsgConnectionOpenTry': - return MsgConnectionOpenTry.unpackAny(proto); + return MsgConnectionOpenTry.unpackAny(proto) case '/ibc.core.connection.v1.MsgConnectionOpenConfirm': - return MsgConnectionOpenConfirm.unpackAny(proto); + return MsgConnectionOpenConfirm.unpackAny(proto) case '/ibc.core.connection.v1.MsgConnectionOpenAck': - return MsgConnectionOpenAck.unpackAny(proto); + return MsgConnectionOpenAck.unpackAny(proto) case '/ibc.core.connection.v1.MsgUpdateParams': - return MsgUpdateIbcConnectionParams.unpackAny(proto); + return MsgUpdateIbcConnectionParams.unpackAny(proto) // intertx case '/initia.intertx.v1.MsgRegisterAccount': - return MsgRegisterAccount.unpackAny(proto); + return MsgRegisterAccount.unpackAny(proto) case '/initia.intertx.v1.MsgSubmitTx': - return MsgSubmitTx.unpackAny(proto); + return MsgSubmitTx.unpackAny(proto) // marketmap case '/slinky.marketmap.v1.MsgCreateMarkets': - return MsgCreateMarkets.unpackAny(proto); + return MsgCreateMarkets.unpackAny(proto) case '/slinky.marketmap.v1.MsgUpdateMarkets': - return MsgUpdateMarkets.unpackAny(proto); + return MsgUpdateMarkets.unpackAny(proto) case '/slinky.marketmap.v1.MsgRemoveMarketAuthorities': - return MsgRemoveMarketAuthorities.unpackAny(proto); + return MsgRemoveMarketAuthorities.unpackAny(proto) case '/slinky.marketmap.v1.MsgParams': - return MsgUpdateMarketmapParams.unpackAny(proto); + return MsgUpdateMarketmapParams.unpackAny(proto) // move case '/initia.move.v1.MsgPublish': - return MsgPublish.unpackAny(proto); + return MsgPublish.unpackAny(proto) case '/initia.move.v1.MsgExecute': - return MsgExecute.unpackAny(proto); + return MsgExecute.unpackAny(proto) case '/initia.move.v1.MsgExecuteJSON': - return MsgExecuteJSON.unpackAny(proto); + return MsgExecuteJSON.unpackAny(proto) case '/initia.move.v1.MsgScript': - return MsgScript.unpackAny(proto); + return MsgScript.unpackAny(proto) case '/initia.move.v1.MsgScriptJSON': - return MsgScriptJSON.unpackAny(proto); + return MsgScriptJSON.unpackAny(proto) case '/initia.move.v1.MsgUpdateParams': - return MsgUpdateMoveParams.unpackAny(proto); + return MsgUpdateMoveParams.unpackAny(proto) case '/initia.move.v1.MsgWhitelist': - return MsgWhitelist.unpackAny(proto); + return MsgWhitelist.unpackAny(proto) case '/initia.move.v1.MsgDelist': - return MsgDelist.unpackAny(proto); + return MsgDelist.unpackAny(proto) case '/initia.move.v1.MsgGovExecute': - return MsgGovExecute.unpackAny(proto); + return MsgGovExecute.unpackAny(proto) case '/initia.move.v1.MsgGovExecuteJSON': - return MsgGovExecuteJSON.unpackAny(proto); + return MsgGovExecuteJSON.unpackAny(proto) case '/initia.move.v1.MsgGovPublish': - return MsgGovPublish.unpackAny(proto); + return MsgGovPublish.unpackAny(proto) case '/initia.move.v1.MsgGovScript': - return MsgGovScript.unpackAny(proto); + return MsgGovScript.unpackAny(proto) case '/initia.move.v1.MsgGovScriptJSON': - return MsgGovScriptJSON.unpackAny(proto); + return MsgGovScriptJSON.unpackAny(proto) // mstaking case '/initia.mstaking.v1.MsgDelegate': - return MsgDelegate.unpackAny(proto); + return MsgDelegate.unpackAny(proto) case '/initia.mstaking.v1.MsgUndelegate': - return MsgUndelegate.unpackAny(proto); + return MsgUndelegate.unpackAny(proto) case '/initia.mstaking.v1.MsgBeginRedelegate': - return MsgBeginRedelegate.unpackAny(proto); + return MsgBeginRedelegate.unpackAny(proto) case '/initia.mstaking.v1.MsgCreateValidator': - return MsgCreateValidator.unpackAny(proto); + return MsgCreateValidator.unpackAny(proto) case '/initia.mstaking.v1.MsgEditValidator': - return MsgEditValidator.unpackAny(proto); + return MsgEditValidator.unpackAny(proto) case '/initia.mstaking.v1.MsgCancelUnbondingDelegation': - return MsgCancelUnbondingDelegation.unpackAny(proto); + return MsgCancelUnbondingDelegation.unpackAny(proto) case '/initia.mstaking.v1.MsgUpdateParams': - return MsgUpdateMstakingParams.unpackAny(proto); + return MsgUpdateMstakingParams.unpackAny(proto) // opchild case '/opinit.opchild.v1.MsgAddValidator': - return MsgAddValidator.unpackAny(proto); + return MsgAddValidator.unpackAny(proto) case '/opinit.opchild.v1.MsgRemoveValidator': - return MsgRemoveValidator.unpackAny(proto); + return MsgRemoveValidator.unpackAny(proto) case '/opinit.opchild.v1.MsgFinalizeTokenDeposit': - return MsgFinalizeTokenDeposit.unpackAny(proto); + return MsgFinalizeTokenDeposit.unpackAny(proto) case '/opinit.opchild.v1.MsgInitiateTokenWithdrawal': - return MsgInitiateTokenWithdrawal.unpackAny(proto); + return MsgInitiateTokenWithdrawal.unpackAny(proto) case '/opinit.opchild.v1.MsgExecuteMessages': - return MsgExecuteMessages.unpackAny(proto); + return MsgExecuteMessages.unpackAny(proto) case '/opinit.opchild.v1.MsgSpendFeePool': - return MsgSpendFeePool.unpackAny(proto); + return MsgSpendFeePool.unpackAny(proto) case '/opinit.opchild.v1.MsgSetBridgeInfo': - return MsgSetBridgeInfo.unpackAny(proto); + return MsgSetBridgeInfo.unpackAny(proto) case '/opinit.opchild.v1.MsgUpdateOracle': - return MsgUpdateOracle.unpackAny(proto); + return MsgUpdateOracle.unpackAny(proto) case '/opinit.opchild.v1.MsgUpdateParams': - return MsgUpdateOpchildParams.unpackAny(proto); + return MsgUpdateOpchildParams.unpackAny(proto) // ophost case '/opinit.ophost.v1.MsgRecordBatch': - return MsgRecordBatch.unpackAny(proto); + return MsgRecordBatch.unpackAny(proto) case '/opinit.ophost.v1.MsgCreateBridge': - return MsgCreateBridge.unpackAny(proto); + return MsgCreateBridge.unpackAny(proto) case '/opinit.ophost.v1.MsgProposeOutput': - return MsgProposeOutput.unpackAny(proto); + return MsgProposeOutput.unpackAny(proto) case '/opinit.ophost.v1.MsgDeleteOutput': - return MsgDeleteOutput.unpackAny(proto); + return MsgDeleteOutput.unpackAny(proto) case '/opinit.ophost.v1.MsgInitiateTokenDeposit': - return MsgInitiateTokenDeposit.unpackAny(proto); + return MsgInitiateTokenDeposit.unpackAny(proto) case '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal': - return MsgFinalizeTokenWithdrawal.unpackAny(proto); + return MsgFinalizeTokenWithdrawal.unpackAny(proto) case '/opinit.ophost.v1.MsgUpdateProposer': - return MsgUpdateProposer.unpackAny(proto); + return MsgUpdateProposer.unpackAny(proto) case '/opinit.ophost.v1.MsgUpdateChallenger': - return MsgUpdateChallenger.unpackAny(proto); + return MsgUpdateChallenger.unpackAny(proto) case '/opinit.ophost.v1.MsgUpdateBatchInfo': - return MsgUpdateBatchInfo.unpackAny(proto); + return MsgUpdateBatchInfo.unpackAny(proto) case '/opinit.ophost.v1.MsgUpdateMetadata': - return MsgUpdateMetadata.unpackAny(proto); + return MsgUpdateMetadata.unpackAny(proto) case '/opinit.ophost.v1.MsgUpdateParams': - return MsgUpdateOphostParams.unpackAny(proto); + return MsgUpdateOphostParams.unpackAny(proto) // oracle case '/slinky.oracle.v1.MsgAddCurrencyPairs': - return MsgAddCurrencyPairs.unpackAny(proto); + return MsgAddCurrencyPairs.unpackAny(proto) case '/slinky.oracle.v1.MsgRemoveCurrencyPairs': - return MsgRemoveCurrencyPairs.unpackAny(proto); + return MsgRemoveCurrencyPairs.unpackAny(proto) // reward case '/initia.reward.v1.MsgUpdateParams': - return MsgUpdateRewardParams.unpackAny(proto); + return MsgUpdateRewardParams.unpackAny(proto) // slashing case '/cosmos.slashing.v1beta1.MsgUnjail': - return MsgUnjail.unpackAny(proto); + return MsgUnjail.unpackAny(proto) case '/cosmos.slashing.v1beta1.MsgUpdateParams': - return MsgUpdateSlashingParams.unpackAny(proto); + return MsgUpdateSlashingParams.unpackAny(proto) // tokenfactory case '/miniwasm.tokenfactory.v1.MsgCreateDenom': - return MsgCreateDenom.unpackAny(proto); + return MsgCreateDenom.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgMint': - return MsgMint.unpackAny(proto); + return MsgMint.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgBurn': - return MsgBurn.unpackAny(proto); + return MsgBurn.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgChangeAdmin': - return MsgChangeAdmin.unpackAny(proto); + return MsgChangeAdmin.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata': - return MsgSetDenomMetadataWasm.unpackAny(proto); + return MsgSetDenomMetadataWasm.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook': - return MsgSetBeforeSendHook.unpackAny(proto); + return MsgSetBeforeSendHook.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgForceTransfer': - return MsgForceTransfer.unpackAny(proto); + return MsgForceTransfer.unpackAny(proto) case '/miniwasm.tokenfactory.v1.MsgUpdateParams': - return MsgUpdateTokenfactoryParams.unpackAny(proto); + return MsgUpdateTokenfactoryParams.unpackAny(proto) // upgrade case '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade': - return MsgSoftwareUpgrade.unpackAny(proto); + return MsgSoftwareUpgrade.unpackAny(proto) case '/cosmos.upgrade.v1beta1.MsgCancelUpgrade': - return MsgCancelUpgrade.unpackAny(proto); + return MsgCancelUpgrade.unpackAny(proto) // wasm case '/cosmwasm.wasm.v1.MsgStoreCode': - return MsgStoreCode.unpackAny(proto); + return MsgStoreCode.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgInstantiateContract': - return MsgInstantiateContract.unpackAny(proto); + return MsgInstantiateContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgInstantiateContract2': - return MsgInstantiateContractV2.unpackAny(proto); + return MsgInstantiateContractV2.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgExecuteContract': - return MsgExecuteContract.unpackAny(proto); + return MsgExecuteContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgMigrateContract': - return MsgMigrateContract.unpackAny(proto); + return MsgMigrateContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgUpdateAdmin': - return MsgUpdateAdmin.unpackAny(proto); + return MsgUpdateAdmin.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgClearAdmin': - return MsgClearAdmin.unpackAny(proto); + return MsgClearAdmin.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig': - return MsgUpdateInstantiateConfig.unpackAny(proto); + return MsgUpdateInstantiateConfig.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgUpdateParams': - return MsgUpdateWasmParams.unpackAny(proto); + return MsgUpdateWasmParams.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgSudoContract': - return MsgSudoContract.unpackAny(proto); + return MsgSudoContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgPinCodes': - return MsgPinCodes.unpackAny(proto); + return MsgPinCodes.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgUnpinCodes': - return MsgUnpinCodes.unpackAny(proto); + return MsgUnpinCodes.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract': - return MsgStoreAndInstantiateContract.unpackAny(proto); + return MsgStoreAndInstantiateContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract': - return MsgStoreAndMigrateContract.unpackAny(proto); + return MsgStoreAndMigrateContract.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses': - return MsgAddCodeUploadParamsAddresses.unpackAny(proto); + return MsgAddCodeUploadParamsAddresses.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses': - return MsgRemoveCodeUploadParamsAddresses.unpackAny(proto); + return MsgRemoveCodeUploadParamsAddresses.unpackAny(proto) case '/cosmwasm.wasm.v1.MsgUpdateContractLabel': - return MsgUpdateContractLabel.unpackAny(proto); + return MsgUpdateContractLabel.unpackAny(proto) default: - throw new Error(`not supported msg ${proto.typeUrl}`); + throw new Error(`not supported msg ${proto.typeUrl}`) } } } diff --git a/src/core/PublicKey.spec.ts b/src/core/PublicKey.spec.ts index 80a6f34..10fb54e 100644 --- a/src/core/PublicKey.spec.ts +++ b/src/core/PublicKey.spec.ts @@ -2,7 +2,7 @@ import { LegacyAminoMultisigPublicKey, SimplePublicKey, ValConsPublicKey, -} from './PublicKey'; +} from './PublicKey' describe('PublicKey', () => { it('Multisig address', () => { @@ -10,28 +10,28 @@ describe('PublicKey', () => { new SimplePublicKey('A/PwvW/JLEnhb0/o5g+AnOqMN+FFT24gjJfDtA1tBsBv'), new SimplePublicKey('A9XR3uRxAD5L9kkYotz094hH6ye92YLraSO/sGhWalxb'), new SimplePublicKey('AyETa9Y9ihObzeRPWMP0MBAa0Mqune3I+5KonOCPTtkv'), - ]); + ]) expect(pubkey.address()).toEqual( 'init1gufrav46pnpwf03yu7xz76ylkmatsxtph3uqj6' - ); - }); + ) + }) it('SimplePubkey address', () => { const pubkey = new SimplePublicKey( 'AjszqFJDRAYbEjZMuiD+ChqzbUSGq/RRu3zr0R6iJB5b' - ); + ) expect(pubkey.address()).toEqual( 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4tdzavzww' - ); - }); + ) + }) it('ValCons address', () => { const pubkey = new ValConsPublicKey( 'zC1zhckGr/0ZjlXkRbD575N0KC+yhWKYcEFDueBTX5o=' - ); + ) expect(pubkey.address()).toEqual( 'initvalcons1mlhj044zpxqdeaajfxpnav59rp4ap38tgp3hzm' - ); - }); -}); + ) + }) +}) diff --git a/src/core/PublicKey.ts b/src/core/PublicKey.ts index 5b777c9..4133d39 100644 --- a/src/core/PublicKey.ts +++ b/src/core/PublicKey.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../util/json'; -import { sha256, ripemd160 } from '../util/hash'; -import { LegacyAminoPubKey as LegacyAminoPubKey_pb } from '@initia/initia.proto/cosmos/crypto/multisig/keys'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { PubKey as PubKey_pb } from '@initia/initia.proto/cosmos/crypto/secp256k1/keys'; -import { PubKey as ValConsPubKey_pb } from '@initia/initia.proto/cosmos/crypto/ed25519/keys'; -import { bech32 } from 'bech32'; +import { JSONSerializable } from '../util/json' +import { sha256, ripemd160 } from '../util/hash' +import { LegacyAminoPubKey as LegacyAminoPubKey_pb } from '@initia/initia.proto/cosmos/crypto/multisig/keys' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { PubKey as PubKey_pb } from '@initia/initia.proto/cosmos/crypto/secp256k1/keys' +import { PubKey as ValConsPubKey_pb } from '@initia/initia.proto/cosmos/crypto/ed25519/keys' +import { bech32 } from 'bech32' // As discussed in https://github.com/binance-chain/javascript-sdk/issues/163 // Prefixes listed here: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/docs/spec/blockchain/encoding.md#public-key-cryptography @@ -12,76 +12,76 @@ import { bech32 } from 'bech32'; const pubkeyAminoPrefixSecp256k1 = Buffer.from( 'eb5ae987' + '21' /* fixed length */, 'hex' -); +) const pubkeyAminoPrefixEd25519 = Buffer.from( '1624de64' + '20' /* fixed length */, 'hex' -); +) /** See https://github.com/tendermint/tendermint/commit/38b401657e4ad7a7eeb3c30a3cbf512037df3740 */ const pubkeyAminoPrefixMultisigThreshold = Buffer.from( '22c1f7e2' /* variable length not included */, 'hex' -); +) const encodeUvarint = (value: number | string): number[] => { - const checked = Number.parseInt(value.toString()); + const checked = Number.parseInt(value.toString()) if (checked > 127) { throw new Error( 'Encoding numbers > 127 is not supported here. Please tell those lazy CosmJS maintainers to port the binary.PutUvarint implementation from the Go standard library and write some tests.' - ); + ) } - return [checked]; -}; + return [checked] +} export type PublicKey = | SimplePublicKey | LegacyAminoMultisigPublicKey - | ValConsPublicKey; + | ValConsPublicKey export namespace PublicKey { export type Amino = | SimplePublicKey.Amino | LegacyAminoMultisigPublicKey.Amino - | ValConsPublicKey.Amino; + | ValConsPublicKey.Amino export type Data = | SimplePublicKey.Data | LegacyAminoMultisigPublicKey.Data - | ValConsPublicKey.Data; - export type Proto = Any; + | ValConsPublicKey.Data + export type Proto = Any export function fromAmino(data: PublicKey.Amino): PublicKey { switch (data.type) { case 'tendermint/PubKeySecp256k1': - return SimplePublicKey.fromAmino(data); + return SimplePublicKey.fromAmino(data) case 'tendermint/PubKeyMultisigThreshold': - return LegacyAminoMultisigPublicKey.fromAmino(data); + return LegacyAminoMultisigPublicKey.fromAmino(data) case 'tendermint/PubKeyEd25519': - return ValConsPublicKey.fromAmino(data); + return ValConsPublicKey.fromAmino(data) } } export function fromData(data: PublicKey.Data): PublicKey { switch (data['@type']) { case '/cosmos.crypto.secp256k1.PubKey': - return SimplePublicKey.fromData(data); + return SimplePublicKey.fromData(data) case '/cosmos.crypto.multisig.LegacyAminoPubKey': - return LegacyAminoMultisigPublicKey.fromData(data); + return LegacyAminoMultisigPublicKey.fromData(data) case '/cosmos.crypto.ed25519.PubKey': - return ValConsPublicKey.fromData(data); + return ValConsPublicKey.fromData(data) } } export function fromProto(pubkeyAny: PublicKey.Proto): PublicKey { - const typeUrl = pubkeyAny.typeUrl; + const typeUrl = pubkeyAny.typeUrl if (typeUrl === '/cosmos.crypto.secp256k1.PubKey') { - return SimplePublicKey.unpackAny(pubkeyAny); + return SimplePublicKey.unpackAny(pubkeyAny) } else if (typeUrl === '/cosmos.crypto.multisig.LegacyAminoPubKey') { - return LegacyAminoMultisigPublicKey.unpackAny(pubkeyAny); + return LegacyAminoMultisigPublicKey.unpackAny(pubkeyAny) } else if (typeUrl === '/cosmos.crypto.ed25519.PubKey') { - return ValConsPublicKey.unpackAny(pubkeyAny); + return ValConsPublicKey.unpackAny(pubkeyAny) } - throw new Error(`Pubkey type ${typeUrl} not recognized`); + throw new Error(`Pubkey type ${typeUrl} not recognized`) } } @@ -91,85 +91,85 @@ export class SimplePublicKey extends JSONSerializable< SimplePublicKey.Proto > { constructor(public key: string) { - super(); + super() } public static fromAmino(data: SimplePublicKey.Amino): SimplePublicKey { - return new SimplePublicKey(data.value); + return new SimplePublicKey(data.value) } public toAmino(): SimplePublicKey.Amino { return { type: 'tendermint/PubKeySecp256k1', value: this.key, - }; + } } public static fromData(data: SimplePublicKey.Data): SimplePublicKey { - return new SimplePublicKey(data.key); + return new SimplePublicKey(data.key) } public toData(): SimplePublicKey.Data { return { '@type': '/cosmos.crypto.secp256k1.PubKey', key: this.key, - }; + } } public static fromProto(pubkeyProto: SimplePublicKey.Proto): SimplePublicKey { - return new SimplePublicKey(Buffer.from(pubkeyProto.key).toString('base64')); + return new SimplePublicKey(Buffer.from(pubkeyProto.key).toString('base64')) } public toProto(): SimplePublicKey.Proto { return PubKey_pb.fromPartial({ key: Buffer.from(this.key, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.crypto.secp256k1.PubKey', value: PubKey_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(pubkeyAny: Any): SimplePublicKey { - return SimplePublicKey.fromProto(PubKey_pb.decode(pubkeyAny.value)); + return SimplePublicKey.fromProto(PubKey_pb.decode(pubkeyAny.value)) } public encodeAminoPubkey(): Uint8Array { return Buffer.concat([ pubkeyAminoPrefixSecp256k1, Buffer.from(this.key, 'base64'), - ]); + ]) } public rawAddress(): Uint8Array { - const pubkeyData = Buffer.from(this.key, 'base64'); - return ripemd160(sha256(pubkeyData)); + const pubkeyData = Buffer.from(this.key, 'base64') + return ripemd160(sha256(pubkeyData)) } public address(): string { - return bech32.encode('init', bech32.toWords(this.rawAddress())); + return bech32.encode('init', bech32.toWords(this.rawAddress())) } public pubkeyAddress(): string { - return bech32.encode('initpub', bech32.toWords(this.encodeAminoPubkey())); + return bech32.encode('initpub', bech32.toWords(this.encodeAminoPubkey())) } } export namespace SimplePublicKey { export interface Amino { - type: 'tendermint/PubKeySecp256k1'; - value: string; + type: 'tendermint/PubKeySecp256k1' + value: string } export interface Data { - '@type': '/cosmos.crypto.secp256k1.PubKey'; - key: string; + '@type': '/cosmos.crypto.secp256k1.PubKey' + key: string } - export type Proto = PubKey_pb; + export type Proto = PubKey_pb } export class LegacyAminoMultisigPublicKey extends JSONSerializable< @@ -177,34 +177,37 @@ export class LegacyAminoMultisigPublicKey extends JSONSerializable< LegacyAminoMultisigPublicKey.Data, LegacyAminoMultisigPublicKey.Proto > { - constructor(public threshold: number, public pubkeys: SimplePublicKey[]) { - super(); + constructor( + public threshold: number, + public pubkeys: SimplePublicKey[] + ) { + super() } public encodeAminoPubkey(): Uint8Array { - const out = Array.from(pubkeyAminoPrefixMultisigThreshold); - out.push(0x08); - out.push(...encodeUvarint(this.threshold)); - for (const pubkeyData of this.pubkeys.map(p => p.encodeAminoPubkey())) { - out.push(0x12); - out.push(...encodeUvarint(pubkeyData.length)); - out.push(...Array.from(pubkeyData)); + const out = Array.from(pubkeyAminoPrefixMultisigThreshold) + out.push(0x08) + out.push(...encodeUvarint(this.threshold)) + for (const pubkeyData of this.pubkeys.map((p) => p.encodeAminoPubkey())) { + out.push(0x12) + out.push(...encodeUvarint(pubkeyData.length)) + out.push(...Array.from(pubkeyData)) } - return new Uint8Array(out); + return new Uint8Array(out) } public rawAddress(): Uint8Array { - const pubkeyData = this.encodeAminoPubkey(); - return sha256(pubkeyData).slice(0, 20); + const pubkeyData = this.encodeAminoPubkey() + return sha256(pubkeyData).slice(0, 20) } public address(): string { - return bech32.encode('init', bech32.toWords(this.rawAddress())); + return bech32.encode('init', bech32.toWords(this.rawAddress())) } public pubkeyAddress(): string { - return bech32.encode('initpub', bech32.toWords(this.encodeAminoPubkey())); + return bech32.encode('initpub', bech32.toWords(this.encodeAminoPubkey())) } public static fromAmino( @@ -212,8 +215,8 @@ export class LegacyAminoMultisigPublicKey extends JSONSerializable< ): LegacyAminoMultisigPublicKey { return new LegacyAminoMultisigPublicKey( Number.parseInt(data.value.threshold), - data.value.pubkeys.map(p => SimplePublicKey.fromAmino(p)) - ); + data.value.pubkeys.map((p) => SimplePublicKey.fromAmino(p)) + ) } public toAmino(): LegacyAminoMultisigPublicKey.Amino { @@ -221,9 +224,9 @@ export class LegacyAminoMultisigPublicKey extends JSONSerializable< type: 'tendermint/PubKeyMultisigThreshold', value: { threshold: this.threshold.toFixed(), - pubkeys: this.pubkeys.map(p => p.toAmino()), + pubkeys: this.pubkeys.map((p) => p.toAmino()), }, - }; + } } public static fromData( @@ -231,16 +234,16 @@ export class LegacyAminoMultisigPublicKey extends JSONSerializable< ): LegacyAminoMultisigPublicKey { return new LegacyAminoMultisigPublicKey( Number.parseInt(data.threshold), - data.public_keys.map(v => SimplePublicKey.fromData(v)) - ); + data.public_keys.map((v) => SimplePublicKey.fromData(v)) + ) } public toData(): LegacyAminoMultisigPublicKey.Data { return { '@type': '/cosmos.crypto.multisig.LegacyAminoPubKey', threshold: this.threshold.toFixed(), - public_keys: this.pubkeys.map(p => p.toData()), - }; + public_keys: this.pubkeys.map((p) => p.toData()), + } } public static fromProto( @@ -248,47 +251,47 @@ export class LegacyAminoMultisigPublicKey extends JSONSerializable< ): LegacyAminoMultisigPublicKey { return new LegacyAminoMultisigPublicKey( pubkeyProto.threshold, - pubkeyProto.publicKeys.map(v => SimplePublicKey.unpackAny(v)) - ); + pubkeyProto.publicKeys.map((v) => SimplePublicKey.unpackAny(v)) + ) } public toProto(): LegacyAminoMultisigPublicKey.Proto { return LegacyAminoPubKey_pb.fromPartial({ threshold: this.threshold, - publicKeys: this.pubkeys.map(v => v.packAny()), - }); + publicKeys: this.pubkeys.map((v) => v.packAny()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.crypto.multisig.LegacyAminoPubKey', value: LegacyAminoPubKey_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(pubkeyAny: Any): LegacyAminoMultisigPublicKey { return LegacyAminoMultisigPublicKey.fromProto( LegacyAminoPubKey_pb.decode(pubkeyAny.value) - ); + ) } } export namespace LegacyAminoMultisigPublicKey { export interface Amino { - type: 'tendermint/PubKeyMultisigThreshold'; + type: 'tendermint/PubKeyMultisigThreshold' value: { - threshold: string; - pubkeys: SimplePublicKey.Amino[]; - }; + threshold: string + pubkeys: SimplePublicKey.Amino[] + } } export interface Data { - '@type': '/cosmos.crypto.multisig.LegacyAminoPubKey'; - threshold: string; - public_keys: SimplePublicKey.Data[]; + '@type': '/cosmos.crypto.multisig.LegacyAminoPubKey' + threshold: string + public_keys: SimplePublicKey.Data[] } - export type Proto = LegacyAminoPubKey_pb; + export type Proto = LegacyAminoPubKey_pb } export class ValConsPublicKey extends JSONSerializable< @@ -297,90 +300,88 @@ export class ValConsPublicKey extends JSONSerializable< ValConsPublicKey.Proto > { constructor(public key: string) { - super(); + super() } public static fromAmino(data: ValConsPublicKey.Amino): ValConsPublicKey { - return new ValConsPublicKey(data.value); + return new ValConsPublicKey(data.value) } public toAmino(): ValConsPublicKey.Amino { return { type: 'tendermint/PubKeyEd25519', value: this.key, - }; + } } public static fromData(data: ValConsPublicKey.Data): ValConsPublicKey { - return new ValConsPublicKey(data.key); + return new ValConsPublicKey(data.key) } public toData(): ValConsPublicKey.Data { return { '@type': '/cosmos.crypto.ed25519.PubKey', key: this.key, - }; + } } public static fromProto( pubkeyProto: ValConsPublicKey.Proto ): ValConsPublicKey { - return new ValConsPublicKey( - Buffer.from(pubkeyProto.key).toString('base64') - ); + return new ValConsPublicKey(Buffer.from(pubkeyProto.key).toString('base64')) } public toProto(): ValConsPublicKey.Proto { return ValConsPubKey_pb.fromPartial({ key: Buffer.from(this.key, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.crypto.ed25519.PubKey', value: ValConsPubKey_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(pubkeyAny: Any): ValConsPublicKey { - return ValConsPublicKey.fromProto(ValConsPubKey_pb.decode(pubkeyAny.value)); + return ValConsPublicKey.fromProto(ValConsPubKey_pb.decode(pubkeyAny.value)) } public encodeAminoPubkey(): Uint8Array { return Buffer.concat([ pubkeyAminoPrefixEd25519, Buffer.from(this.key, 'base64'), - ]); + ]) } public rawAddress(): Uint8Array { - const pubkeyData = Buffer.from(this.key, 'base64'); - return sha256(pubkeyData).slice(0, 20); + const pubkeyData = Buffer.from(this.key, 'base64') + return sha256(pubkeyData).slice(0, 20) } public address(): string { - return bech32.encode('initvalcons', bech32.toWords(this.rawAddress())); + return bech32.encode('initvalcons', bech32.toWords(this.rawAddress())) } public pubkeyAddress(): string { return bech32.encode( 'initvalconspub', bech32.toWords(this.encodeAminoPubkey()) - ); + ) } } export namespace ValConsPublicKey { export interface Amino { - type: 'tendermint/PubKeyEd25519'; - value: string; + type: 'tendermint/PubKeyEd25519' + value: string } export interface Data { - '@type': '/cosmos.crypto.ed25519.PubKey'; - key: string; + '@type': '/cosmos.crypto.ed25519.PubKey' + key: string } - export type Proto = ValConsPubKey_pb; + export type Proto = ValConsPubKey_pb } diff --git a/src/core/auction/AuctionParams.ts b/src/core/auction/AuctionParams.ts index 73b1047..a3f6a64 100644 --- a/src/core/auction/AuctionParams.ts +++ b/src/core/auction/AuctionParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Coin } from '../Coin'; -import { Params as Params_pb } from '@initia/initia.proto/sdk/auction/v1/genesis'; +import { JSONSerializable } from '../../util/json' +import { Coin } from '../Coin' +import { Params as Params_pb } from '@initia/initia.proto/sdk/auction/v1/genesis' export class AuctionParams extends JSONSerializable< AuctionParams.Amino, @@ -23,7 +23,7 @@ export class AuctionParams extends JSONSerializable< public front_running_protection: boolean, public proposer_fee: string ) { - super(); + super() } public static fromAmino(data: AuctionParams.Amino): AuctionParams { @@ -36,7 +36,7 @@ export class AuctionParams extends JSONSerializable< front_running_protection, proposer_fee, }, - } = data; + } = data return new AuctionParams( Number.parseInt(max_bundle_size), @@ -45,7 +45,7 @@ export class AuctionParams extends JSONSerializable< Coin.fromAmino(min_bid_increment), front_running_protection, proposer_fee - ); + ) } public toAmino(): AuctionParams.Amino { @@ -56,7 +56,7 @@ export class AuctionParams extends JSONSerializable< min_bid_increment, front_running_protection, proposer_fee, - } = this; + } = this return { type: 'block-sdk/x/auction/Params', @@ -68,7 +68,7 @@ export class AuctionParams extends JSONSerializable< front_running_protection, proposer_fee, }, - }; + } } public static fromData(data: AuctionParams.Data): AuctionParams { @@ -79,7 +79,7 @@ export class AuctionParams extends JSONSerializable< min_bid_increment, front_running_protection, proposer_fee, - } = data; + } = data return new AuctionParams( Number.parseInt(max_bundle_size), @@ -88,7 +88,7 @@ export class AuctionParams extends JSONSerializable< Coin.fromData(min_bid_increment), front_running_protection, proposer_fee - ); + ) } public toData(): AuctionParams.Data { @@ -99,7 +99,7 @@ export class AuctionParams extends JSONSerializable< min_bid_increment, front_running_protection, proposer_fee, - } = this; + } = this return { '@type': '/sdk.auction.v1.Params', @@ -109,7 +109,7 @@ export class AuctionParams extends JSONSerializable< min_bid_increment: min_bid_increment.toData(), front_running_protection, proposer_fee, - }; + } } public static fromProto(data: AuctionParams.Proto): AuctionParams { @@ -120,7 +120,7 @@ export class AuctionParams extends JSONSerializable< Coin.fromProto(data.minBidIncrement as Coin), data.frontRunningProtection, data.proposerFee - ); + ) } public toProto(): AuctionParams.Proto { @@ -131,7 +131,7 @@ export class AuctionParams extends JSONSerializable< min_bid_increment, front_running_protection, proposer_fee, - } = this; + } = this return Params_pb.fromPartial({ maxBundleSize: max_bundle_size, @@ -140,32 +140,32 @@ export class AuctionParams extends JSONSerializable< minBidIncrement: min_bid_increment.toProto(), frontRunningProtection: front_running_protection, proposerFee: proposer_fee, - }); + }) } } export namespace AuctionParams { export interface Amino { - type: 'block-sdk/x/auction/Params'; + type: 'block-sdk/x/auction/Params' value: { - max_bundle_size: string; - escrow_account_address: string; - reserve_fee: Coin.Amino; - min_bid_increment: Coin.Amino; - front_running_protection: boolean; - proposer_fee: string; - }; + max_bundle_size: string + escrow_account_address: string + reserve_fee: Coin.Amino + min_bid_increment: Coin.Amino + front_running_protection: boolean + proposer_fee: string + } } export interface Data { - '@type': '/sdk.auction.v1.Params'; - max_bundle_size: string; - escrow_account_address: string; - reserve_fee: Coin.Data; - min_bid_increment: Coin.Data; - front_running_protection: boolean; - proposer_fee: string; + '@type': '/sdk.auction.v1.Params' + max_bundle_size: string + escrow_account_address: string + reserve_fee: Coin.Data + min_bid_increment: Coin.Data + front_running_protection: boolean + proposer_fee: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/auction/index.ts b/src/core/auction/index.ts index f6b6ca8..f6d1d1c 100644 --- a/src/core/auction/index.ts +++ b/src/core/auction/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './AuctionParams'; +export * from './msgs' +export * from './AuctionParams' diff --git a/src/core/auction/msgs/MsgAuctionBid.ts b/src/core/auction/msgs/MsgAuctionBid.ts index 51450f9..06b82d0 100644 --- a/src/core/auction/msgs/MsgAuctionBid.ts +++ b/src/core/auction/msgs/MsgAuctionBid.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgAuctionBid as MsgAuctionBid_pb } from '@initia/initia.proto/sdk/auction/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgAuctionBid as MsgAuctionBid_pb } from '@initia/initia.proto/sdk/auction/v1/tx' export class MsgAuctionBid extends JSONSerializable< MsgAuctionBid.Amino, @@ -19,18 +19,18 @@ export class MsgAuctionBid extends JSONSerializable< public bid: Coin, public transactions: string[] ) { - super(); + super() } public static fromAmino(data: MsgAuctionBid.Amino): MsgAuctionBid { const { value: { bidder, bid, transactions }, - } = data; - return new MsgAuctionBid(bidder, Coin.fromAmino(bid), transactions); + } = data + return new MsgAuctionBid(bidder, Coin.fromAmino(bid), transactions) } public toAmino(): MsgAuctionBid.Amino { - const { bidder, bid, transactions } = this; + const { bidder, bid, transactions } = this return { type: 'block-sdk/x/auction/MsgAuctionBid', value: { @@ -38,69 +38,69 @@ export class MsgAuctionBid extends JSONSerializable< bid: bid.toAmino(), transactions, }, - }; + } } public static fromData(data: MsgAuctionBid.Data): MsgAuctionBid { - const { bidder, bid, transactions } = data; - return new MsgAuctionBid(bidder, Coin.fromData(bid), transactions); + const { bidder, bid, transactions } = data + return new MsgAuctionBid(bidder, Coin.fromData(bid), transactions) } public toData(): MsgAuctionBid.Data { - const { bidder, bid, transactions } = this; + const { bidder, bid, transactions } = this return { '@type': '/sdk.auction.v1.MsgAuctionBid', bidder, bid: bid.toData(), transactions, - }; + } } public static fromProto(data: MsgAuctionBid.Proto): MsgAuctionBid { return new MsgAuctionBid( data.bidder, Coin.fromProto(data.bid as Coin), - data.transactions.map(tx => Buffer.from(tx).toString('base64')) - ); + data.transactions.map((tx) => Buffer.from(tx).toString('base64')) + ) } public toProto(): MsgAuctionBid.Proto { - const { bidder, bid, transactions } = this; + const { bidder, bid, transactions } = this return MsgAuctionBid_pb.fromPartial({ bidder, bid: bid.toProto(), - transactions: transactions.map(tx => Buffer.from(tx, 'base64')), - }); + transactions: transactions.map((tx) => Buffer.from(tx, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/sdk.auction.v1.MsgAuctionBid', value: MsgAuctionBid_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgAuctionBid { - return MsgAuctionBid.fromProto(MsgAuctionBid_pb.decode(msgAny.value)); + return MsgAuctionBid.fromProto(MsgAuctionBid_pb.decode(msgAny.value)) } } export namespace MsgAuctionBid { export interface Amino { - type: 'block-sdk/x/auction/MsgAuctionBid'; + type: 'block-sdk/x/auction/MsgAuctionBid' value: { - bidder: AccAddress; - bid: Coin.Amino; - transactions: string[]; - }; + bidder: AccAddress + bid: Coin.Amino + transactions: string[] + } } export interface Data { - '@type': '/sdk.auction.v1.MsgAuctionBid'; - bidder: AccAddress; - bid: Coin.Data; - transactions: string[]; + '@type': '/sdk.auction.v1.MsgAuctionBid' + bidder: AccAddress + bid: Coin.Data + transactions: string[] } - export type Proto = MsgAuctionBid_pb; + export type Proto = MsgAuctionBid_pb } diff --git a/src/core/auction/msgs/MsgUpdateAuctionParams.ts b/src/core/auction/msgs/MsgUpdateAuctionParams.ts index 25f175a..e50127e 100644 --- a/src/core/auction/msgs/MsgUpdateAuctionParams.ts +++ b/src/core/auction/msgs/MsgUpdateAuctionParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { AuctionParams } from '../AuctionParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/sdk/auction/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { AuctionParams } from '../AuctionParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/sdk/auction/v1/tx' export class MsgUpdateAuctionParams extends JSONSerializable< MsgUpdateAuctionParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateAuctionParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/auth parameters to update */ - constructor(public authority: AccAddress, public params: AuctionParams) { - super(); + constructor( + public authority: AccAddress, + public params: AuctionParams + ) { + super() } public static fromAmino( @@ -22,41 +25,38 @@ export class MsgUpdateAuctionParams extends JSONSerializable< ): MsgUpdateAuctionParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateAuctionParams( authority, AuctionParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateAuctionParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'block-sdk/x/auction/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateAuctionParams.Data ): MsgUpdateAuctionParams { - const { authority, params } = data; - return new MsgUpdateAuctionParams( - authority, - AuctionParams.fromData(params) - ); + const { authority, params } = data + return new MsgUpdateAuctionParams(authority, AuctionParams.fromData(params)) } public toData(): MsgUpdateAuctionParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/sdk.auction.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +65,45 @@ export class MsgUpdateAuctionParams extends JSONSerializable< return new MsgUpdateAuctionParams( data.authority, AuctionParams.fromProto(data.params as AuctionParams.Proto) - ); + ) } public toProto(): MsgUpdateAuctionParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/sdk.auction.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateAuctionParams { return MsgUpdateAuctionParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateAuctionParams { export interface Amino { - type: 'block-sdk/x/auction/MsgUpdateParams'; + type: 'block-sdk/x/auction/MsgUpdateParams' value: { - authority: AccAddress; - params: AuctionParams.Amino; - }; + authority: AccAddress + params: AuctionParams.Amino + } } export interface Data { - '@type': '/sdk.auction.v1.MsgUpdateParams'; - authority: AccAddress; - params: AuctionParams.Data; + '@type': '/sdk.auction.v1.MsgUpdateParams' + authority: AccAddress + params: AuctionParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/auction/msgs/index.ts b/src/core/auction/msgs/index.ts index 08111fb..93b4bc0 100644 --- a/src/core/auction/msgs/index.ts +++ b/src/core/auction/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgAuctionBid } from './MsgAuctionBid'; -import { MsgUpdateAuctionParams } from './MsgUpdateAuctionParams'; +import { MsgAuctionBid } from './MsgAuctionBid' +import { MsgUpdateAuctionParams } from './MsgUpdateAuctionParams' -export * from './MsgAuctionBid'; -export * from './MsgUpdateAuctionParams'; +export * from './MsgAuctionBid' +export * from './MsgUpdateAuctionParams' -export type AuctionMsg = MsgAuctionBid | MsgUpdateAuctionParams; +export type AuctionMsg = MsgAuctionBid | MsgUpdateAuctionParams export namespace AuctionMsg { - export type Amino = MsgAuctionBid.Amino | MsgUpdateAuctionParams.Amino; - export type Data = MsgAuctionBid.Data | MsgUpdateAuctionParams.Data; - export type Proto = MsgAuctionBid.Proto | MsgUpdateAuctionParams.Proto; + export type Amino = MsgAuctionBid.Amino | MsgUpdateAuctionParams.Amino + export type Data = MsgAuctionBid.Data | MsgUpdateAuctionParams.Data + export type Proto = MsgAuctionBid.Proto | MsgUpdateAuctionParams.Proto } diff --git a/src/core/auth/Account.ts b/src/core/auth/Account.ts index 4ba8e7f..2a4a031 100644 --- a/src/core/auth/Account.ts +++ b/src/core/auth/Account.ts @@ -1,43 +1,43 @@ -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { BaseAccount } from './BaseAccount'; -import { ModuleAccount } from './ModuleAccount'; +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { BaseAccount } from './BaseAccount' +import { ModuleAccount } from './ModuleAccount' -export type Account = BaseAccount | ModuleAccount; +export type Account = BaseAccount | ModuleAccount /** * Stores information about an account fetched from the blockchain. */ export namespace Account { - export type Amino = BaseAccount.Amino | ModuleAccount.Amino; - export type Data = BaseAccount.Data | ModuleAccount.Data; - export type Proto = Any; + export type Amino = BaseAccount.Amino | ModuleAccount.Amino + export type Data = BaseAccount.Data | ModuleAccount.Data + export type Proto = Any export function fromAmino(amino: Account.Amino): Account { switch (amino.type) { case 'cosmos-sdk/BaseAccount': - return BaseAccount.fromAmino(amino); + return BaseAccount.fromAmino(amino) case 'cosmos-sdk/ModuleAccount': - return ModuleAccount.fromAmino(amino); + return ModuleAccount.fromAmino(amino) } } export function fromData(data: Account.Data): Account { switch (data['@type']) { case '/cosmos.auth.v1beta1.BaseAccount': - return BaseAccount.fromData(data); + return BaseAccount.fromData(data) case '/cosmos.auth.v1beta1.ModuleAccount': - return ModuleAccount.fromData(data); + return ModuleAccount.fromData(data) } } export function fromProto(accountAny: Account.Proto): Account { - const typeUrl = accountAny.typeUrl; + const typeUrl = accountAny.typeUrl if (typeUrl === '/cosmos.auth.v1beta1.BaseAccount') { - return BaseAccount.unpackAny(accountAny); + return BaseAccount.unpackAny(accountAny) } else if (typeUrl === '/cosmos.auth.v1beta1.ModuleAccount') { - return ModuleAccount.unpackAny(accountAny); + return ModuleAccount.unpackAny(accountAny) } - throw new Error(`Account type ${typeUrl} not recognized`); + throw new Error(`Account type ${typeUrl} not recognized`) } } diff --git a/src/core/auth/AuthParams.ts b/src/core/auth/AuthParams.ts index 1617434..b99eec2 100644 --- a/src/core/auth/AuthParams.ts +++ b/src/core/auth/AuthParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth' +import Long from 'long' export class AuthParams extends JSONSerializable< AuthParams.Amino, @@ -21,7 +21,7 @@ export class AuthParams extends JSONSerializable< public sig_verify_cost_ed25519: number, public sig_verify_cost_secp256k1: number ) { - super(); + super() } public static fromAmino(data: AuthParams.Amino): AuthParams { @@ -33,7 +33,7 @@ export class AuthParams extends JSONSerializable< sig_verify_cost_ed25519, sig_verify_cost_secp256k1, }, - } = data; + } = data return new AuthParams( Number.parseInt(max_memo_characters), @@ -41,7 +41,7 @@ export class AuthParams extends JSONSerializable< Number.parseInt(tx_size_cost_per_byte), Number.parseInt(sig_verify_cost_ed25519), Number.parseInt(sig_verify_cost_secp256k1) - ); + ) } public toAmino(): AuthParams.Amino { @@ -51,7 +51,7 @@ export class AuthParams extends JSONSerializable< tx_size_cost_per_byte, sig_verify_cost_ed25519, sig_verify_cost_secp256k1, - } = this; + } = this return { type: 'cosmos-sdk/x/auth/Params', @@ -62,7 +62,7 @@ export class AuthParams extends JSONSerializable< sig_verify_cost_ed25519: sig_verify_cost_ed25519.toString(), sig_verify_cost_secp256k1: sig_verify_cost_secp256k1.toString(), }, - }; + } } public static fromData(data: AuthParams.Data): AuthParams { @@ -72,7 +72,7 @@ export class AuthParams extends JSONSerializable< tx_size_cost_per_byte, sig_verify_cost_ed25519, sig_verify_cost_secp256k1, - } = data; + } = data return new AuthParams( Number.parseInt(max_memo_characters), @@ -80,7 +80,7 @@ export class AuthParams extends JSONSerializable< Number.parseInt(tx_size_cost_per_byte), Number.parseInt(sig_verify_cost_ed25519), Number.parseInt(sig_verify_cost_secp256k1) - ); + ) } public toData(): AuthParams.Data { @@ -90,7 +90,7 @@ export class AuthParams extends JSONSerializable< tx_size_cost_per_byte, sig_verify_cost_ed25519, sig_verify_cost_secp256k1, - } = this; + } = this return { '@type': '/cosmos.auth.v1beta1.Params', @@ -99,7 +99,7 @@ export class AuthParams extends JSONSerializable< tx_size_cost_per_byte: tx_size_cost_per_byte.toString(), sig_verify_cost_ed25519: sig_verify_cost_ed25519.toString(), sig_verify_cost_secp256k1: sig_verify_cost_secp256k1.toString(), - }; + } } public static fromProto(data: AuthParams.Proto): AuthParams { @@ -109,7 +109,7 @@ export class AuthParams extends JSONSerializable< data.txSizeCostPerByte.toNumber(), data.sigVerifyCostEd25519.toNumber(), data.sigVerifyCostSecp256k1.toNumber() - ); + ) } public toProto(): AuthParams.Proto { @@ -119,7 +119,7 @@ export class AuthParams extends JSONSerializable< tx_size_cost_per_byte, sig_verify_cost_ed25519, sig_verify_cost_secp256k1, - } = this; + } = this return Params_pb.fromPartial({ maxMemoCharacters: Long.fromNumber(max_memo_characters), @@ -127,30 +127,30 @@ export class AuthParams extends JSONSerializable< txSizeCostPerByte: Long.fromNumber(tx_size_cost_per_byte), sigVerifyCostEd25519: Long.fromNumber(sig_verify_cost_ed25519), sigVerifyCostSecp256k1: Long.fromNumber(sig_verify_cost_secp256k1), - }); + }) } } export namespace AuthParams { export interface Amino { - type: 'cosmos-sdk/x/auth/Params'; + type: 'cosmos-sdk/x/auth/Params' value: { - max_memo_characters: string; - tx_sig_limit: string; - tx_size_cost_per_byte: string; - sig_verify_cost_ed25519: string; - sig_verify_cost_secp256k1: string; - }; + max_memo_characters: string + tx_sig_limit: string + tx_size_cost_per_byte: string + sig_verify_cost_ed25519: string + sig_verify_cost_secp256k1: string + } } export interface Data { - '@type': '/cosmos.auth.v1beta1.Params'; - max_memo_characters: string; - tx_sig_limit: string; - tx_size_cost_per_byte: string; - sig_verify_cost_ed25519: string; - sig_verify_cost_secp256k1: string; + '@type': '/cosmos.auth.v1beta1.Params' + max_memo_characters: string + tx_sig_limit: string + tx_size_cost_per_byte: string + sig_verify_cost_ed25519: string + sig_verify_cost_secp256k1: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/auth/BaseAccount.spec.ts b/src/core/auth/BaseAccount.spec.ts index 9a7f915..0926b46 100644 --- a/src/core/auth/BaseAccount.spec.ts +++ b/src/core/auth/BaseAccount.spec.ts @@ -1,7 +1,7 @@ -import { BaseAccount } from './BaseAccount'; -import { SimplePublicKey } from '../PublicKey'; +import { BaseAccount } from './BaseAccount' +import { SimplePublicKey } from '../PublicKey' -const data = require('./BaseAccount.data.json'); +const data = require('./BaseAccount.data.json') describe('Account', () => { it('deserializes accounts correctly', () => { @@ -16,8 +16,8 @@ describe('Account', () => { account_number: '251248', sequence: '58', }, - }; - const acct = BaseAccount.fromAmino(data); + } + const acct = BaseAccount.fromAmino(data) expect(acct).toMatchObject({ address: 'init12fm3tql2uu0gheuj3st9cwz7ml97tq9mla88c2', public_key: new SimplePublicKey( @@ -25,9 +25,9 @@ describe('Account', () => { ), account_number: 251248, sequence: 58, - }); - expect(acct.toAmino()).toMatchObject(data); - }); + }) + expect(acct.toAmino()).toMatchObject(data) + }) it('deserializes a new account correctly', () => { // a new account does not yet have a public key @@ -39,12 +39,12 @@ describe('Account', () => { account_number: '0', sequence: '0', }, - }; + } expect(BaseAccount.fromAmino(newAccount).toAmino()).toMatchObject( newAccount - ); - }); + ) + }) it('serializes accounts correctly', () => { const acct = new BaseAccount( @@ -52,7 +52,7 @@ describe('Account', () => { new SimplePublicKey('abc'), 251248, 58 - ); + ) expect(acct.toAmino()).toMatchObject({ type: 'cosmos-sdk/BaseAccount', @@ -65,12 +65,12 @@ describe('Account', () => { account_number: '251248', sequence: '58', }, - }); - }); + }) + }) it('deserializes from example data', () => { data.forEach((ex: BaseAccount.Amino) => { - expect(BaseAccount.fromAmino(ex).toAmino()).toMatchObject(ex); - }); - }); -}); + expect(BaseAccount.fromAmino(ex).toAmino()).toMatchObject(ex) + }) + }) +}) diff --git a/src/core/auth/BaseAccount.ts b/src/core/auth/BaseAccount.ts index f747765..fd6218d 100644 --- a/src/core/auth/BaseAccount.ts +++ b/src/core/auth/BaseAccount.ts @@ -1,9 +1,9 @@ -import { PublicKey } from '../PublicKey'; -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { BaseAccount as BaseAccount_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { PublicKey } from '../PublicKey' +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { BaseAccount as BaseAccount_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' /** * Stores information about an account fetched from the blockchain. @@ -28,23 +28,23 @@ export class BaseAccount extends JSONSerializable< public account_number: number, public sequence: number ) { - super(); + super() } public getAccountNumber(): number { - return this.account_number; + return this.account_number } public getSequenceNumber(): number { - return this.sequence; + return this.sequence } public getPublicKey(): PublicKey | undefined { - return this.public_key; + return this.public_key } public toAmino(): BaseAccount.Amino { - const { address, public_key, account_number, sequence } = this; + const { address, public_key, account_number, sequence } = this return { type: 'cosmos-sdk/BaseAccount', value: { @@ -53,99 +53,99 @@ export class BaseAccount extends JSONSerializable< account_number: account_number.toFixed(), sequence: sequence.toFixed(), }, - }; + } } public static fromAmino(data: BaseAccount.Amino): BaseAccount { const { value: { address, public_key, account_number, sequence }, - } = data; + } = data return new BaseAccount( address ?? '', public_key ? PublicKey.fromAmino(public_key) : undefined, Number.parseInt(account_number) ?? 0, Number.parseInt(sequence) ?? 0 - ); + ) } public static fromData(data: BaseAccount.Data): BaseAccount { - const { address, pub_key, account_number, sequence } = data; + const { address, pub_key, account_number, sequence } = data return new BaseAccount( address ?? '', pub_key ? PublicKey.fromData(pub_key) : undefined, Number.parseInt(account_number) ?? 0, Number.parseInt(sequence) ?? 0 - ); + ) } public toData(): BaseAccount.Data { - const { address, public_key, account_number, sequence } = this; + const { address, public_key, account_number, sequence } = this return { '@type': '/cosmos.auth.v1beta1.BaseAccount', address, pub_key: public_key?.toData(), account_number: account_number.toFixed(), sequence: sequence.toFixed(), - }; + } } public toProto(): BaseAccount.Proto { - const { address, public_key, account_number, sequence } = this; + const { address, public_key, account_number, sequence } = this return BaseAccount_pb.fromPartial({ address, pubKey: public_key?.packAny(), accountNumber: Long.fromNumber(account_number), sequence: Long.fromNumber(sequence), - }); + }) } public static fromProto(baseAccountProto: BaseAccount.Proto): BaseAccount { - const pubkey = baseAccountProto.pubKey; + const pubkey = baseAccountProto.pubKey return new BaseAccount( baseAccountProto.address, pubkey ? PublicKey.fromProto(pubkey) : undefined, baseAccountProto.accountNumber.toNumber(), baseAccountProto.sequence.toNumber() - ); + ) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.auth.v1beta1.BaseAccount', value: BaseAccount_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(pubkeyAny: Any): BaseAccount { - return BaseAccount.fromProto(BaseAccount_pb.decode(pubkeyAny.value)); + return BaseAccount.fromProto(BaseAccount_pb.decode(pubkeyAny.value)) } } export namespace BaseAccount { export interface AminoValue { - address: AccAddress; - public_key?: PublicKey.Amino; - account_number: string; - sequence: string; + address: AccAddress + public_key?: PublicKey.Amino + account_number: string + sequence: string } export interface Amino { - type: 'cosmos-sdk/BaseAccount'; - value: AminoValue; + type: 'cosmos-sdk/BaseAccount' + value: AminoValue } export interface DataValue { - address: AccAddress; - pub_key?: PublicKey.Data; - account_number: string; - sequence: string; + address: AccAddress + pub_key?: PublicKey.Data + account_number: string + sequence: string } export interface Data extends DataValue { - '@type': '/cosmos.auth.v1beta1.BaseAccount'; + '@type': '/cosmos.auth.v1beta1.BaseAccount' } - export type Proto = BaseAccount_pb; + export type Proto = BaseAccount_pb } diff --git a/src/core/auth/ModuleAccount.ts b/src/core/auth/ModuleAccount.ts index 1d4d7b4..0740c8b 100644 --- a/src/core/auth/ModuleAccount.ts +++ b/src/core/auth/ModuleAccount.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../util/json'; -import { PublicKey } from '../PublicKey'; -import { BaseAccount } from './BaseAccount'; -import { ModuleAccount as ModuleAccount_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../util/json' +import { PublicKey } from '../PublicKey' +import { BaseAccount } from './BaseAccount' +import { ModuleAccount as ModuleAccount_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth' +import { Any } from '@initia/initia.proto/google/protobuf/any' /** * Stores information about an account for modules that holds coins on a pool. @@ -23,25 +23,25 @@ export class ModuleAccount extends JSONSerializable< public name: string, public permissions: string[] ) { - super(); + super() } public getAccountNumber(): number { - return this.base_account.account_number; + return this.base_account.account_number } public getSequenceNumber(): number { - return this.base_account.sequence; + return this.base_account.sequence } public getPublicKey(): PublicKey | undefined { - return this.base_account.public_key; + return this.base_account.public_key } public static fromAmino(data: ModuleAccount.Amino): ModuleAccount { const { value: { base_account, name, permissions }, - } = data; + } = data return new ModuleAccount( BaseAccount.fromAmino({ @@ -50,11 +50,11 @@ export class ModuleAccount extends JSONSerializable< }), name, permissions - ); + ) } public toAmino(): ModuleAccount.Amino { - const { base_account, name, permissions } = this; + const { base_account, name, permissions } = this return { type: 'cosmos-sdk/ModuleAccount', value: { @@ -62,11 +62,11 @@ export class ModuleAccount extends JSONSerializable< name, permissions, }, - }; + } } public static fromData(data: ModuleAccount.Data): ModuleAccount { - const { base_account, name, permissions } = data; + const { base_account, name, permissions } = data return new ModuleAccount( BaseAccount.fromData({ @@ -75,17 +75,17 @@ export class ModuleAccount extends JSONSerializable< }), name, permissions - ); + ) } public toData(): ModuleAccount.Data { - const { base_account, name, permissions } = this; + const { base_account, name, permissions } = this return { '@type': '/cosmos.auth.v1beta1.ModuleAccount', base_account: base_account.toData(), name, permissions, - }; + } } public static fromProto(proto: ModuleAccount.Proto): ModuleAccount { @@ -93,46 +93,46 @@ export class ModuleAccount extends JSONSerializable< BaseAccount.fromProto(proto.baseAccount as BaseAccount.Proto), proto.name, proto.permissions - ); + ) } public toProto(): ModuleAccount.Proto { - const { base_account, name, permissions } = this; + const { base_account, name, permissions } = this return ModuleAccount_pb.fromPartial({ baseAccount: base_account.toProto(), name, permissions, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.auth.v1beta1.ModuleAccount', value: ModuleAccount_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(pubkeyAny: Any): ModuleAccount { - return ModuleAccount.fromProto(ModuleAccount_pb.decode(pubkeyAny.value)); + return ModuleAccount.fromProto(ModuleAccount_pb.decode(pubkeyAny.value)) } } export namespace ModuleAccount { export interface Amino { - type: 'cosmos-sdk/ModuleAccount'; + type: 'cosmos-sdk/ModuleAccount' value: { - base_account: BaseAccount.AminoValue; - name: string; - permissions: string[]; - }; + base_account: BaseAccount.AminoValue + name: string + permissions: string[] + } } export interface Data { - '@type': '/cosmos.auth.v1beta1.ModuleAccount'; - base_account: BaseAccount.DataValue; - name: string; - permissions: string[]; + '@type': '/cosmos.auth.v1beta1.ModuleAccount' + base_account: BaseAccount.DataValue + name: string + permissions: string[] } - export type Proto = ModuleAccount_pb; + export type Proto = ModuleAccount_pb } diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index bc44073..7add70b 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './Account'; -export * from './BaseAccount'; -export * from './ModuleAccount'; -export * from './AuthParams'; +export * from './msgs' +export * from './Account' +export * from './BaseAccount' +export * from './ModuleAccount' +export * from './AuthParams' diff --git a/src/core/auth/msgs/MsgUpdateAuthParams.ts b/src/core/auth/msgs/MsgUpdateAuthParams.ts index 2e2256c..66c2f08 100644 --- a/src/core/auth/msgs/MsgUpdateAuthParams.ts +++ b/src/core/auth/msgs/MsgUpdateAuthParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { AuthParams } from '../AuthParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { AuthParams } from '../AuthParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/tx' export class MsgUpdateAuthParams extends JSONSerializable< MsgUpdateAuthParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateAuthParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/auth parameters to update */ - constructor(public authority: AccAddress, public params: AuthParams) { - super(); + constructor( + public authority: AccAddress, + public params: AuthParams + ) { + super() } public static fromAmino( @@ -22,33 +25,33 @@ export class MsgUpdateAuthParams extends JSONSerializable< ): MsgUpdateAuthParams { const { value: { authority, params }, - } = data; - return new MsgUpdateAuthParams(authority, AuthParams.fromAmino(params)); + } = data + return new MsgUpdateAuthParams(authority, AuthParams.fromAmino(params)) } public toAmino(): MsgUpdateAuthParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'cosmos-sdk/x/auth/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateAuthParams.Data): MsgUpdateAuthParams { - const { authority, params } = data; - return new MsgUpdateAuthParams(authority, AuthParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateAuthParams(authority, AuthParams.fromData(params)) } public toData(): MsgUpdateAuthParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/cosmos.auth.v1beta1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -57,45 +60,45 @@ export class MsgUpdateAuthParams extends JSONSerializable< return new MsgUpdateAuthParams( data.authority, AuthParams.fromProto(data.params as AuthParams.Proto) - ); + ) } public toProto(): MsgUpdateAuthParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.auth.v1beta1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateAuthParams { return MsgUpdateAuthParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateAuthParams { export interface Amino { - type: 'cosmos-sdk/x/auth/MsgUpdateParams'; + type: 'cosmos-sdk/x/auth/MsgUpdateParams' value: { - authority: AccAddress; - params: AuthParams.Amino; - }; + authority: AccAddress + params: AuthParams.Amino + } } export interface Data { - '@type': '/cosmos.auth.v1beta1.MsgUpdateParams'; - authority: AccAddress; - params: AuthParams.Data; + '@type': '/cosmos.auth.v1beta1.MsgUpdateParams' + authority: AccAddress + params: AuthParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/auth/msgs/index.ts b/src/core/auth/msgs/index.ts index 99f7dc2..6731a46 100644 --- a/src/core/auth/msgs/index.ts +++ b/src/core/auth/msgs/index.ts @@ -1,10 +1,10 @@ -import { MsgUpdateAuthParams } from './MsgUpdateAuthParams'; +import { MsgUpdateAuthParams } from './MsgUpdateAuthParams' -export * from './MsgUpdateAuthParams'; +export * from './MsgUpdateAuthParams' -export type AuthMsg = MsgUpdateAuthParams; +export type AuthMsg = MsgUpdateAuthParams export namespace AuthMsg { - export type Amino = MsgUpdateAuthParams.Amino; - export type Data = MsgUpdateAuthParams.Data; - export type Proto = MsgUpdateAuthParams.Proto; + export type Amino = MsgUpdateAuthParams.Amino + export type Data = MsgUpdateAuthParams.Data + export type Proto = MsgUpdateAuthParams.Proto } diff --git a/src/core/authz/authorizations/Authorization.ts b/src/core/authz/authorizations/Authorization.ts index 0a37421..43ef854 100644 --- a/src/core/authz/authorizations/Authorization.ts +++ b/src/core/authz/authorizations/Authorization.ts @@ -1,87 +1,90 @@ -import { JSONSerializable } from '../../../util/json'; -import { GenericAuthorization } from './GenericAuthorization'; -import { SendAuthorization } from './SendAuthorization'; -import { StakeAuthorization } from './StakeAuthorization'; -import { PublishAuthorization } from './PublishAuthorization'; -import { ExecuteAuthorization } from './ExecuteAuthorization'; +import { JSONSerializable } from '../../../util/json' +import { GenericAuthorization } from './GenericAuthorization' +import { SendAuthorization } from './SendAuthorization' +import { StakeAuthorization } from './StakeAuthorization' +import { PublishAuthorization } from './PublishAuthorization' +import { ExecuteAuthorization } from './ExecuteAuthorization' import { StoreCodeAuthorization, ContractExecutionAuthorization, ContractMigrationAuthorization, -} from '../../wasm'; -import { TransferAuthorization } from '../../ibc/applications/transfer'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'; +} from '../../wasm' +import { TransferAuthorization } from '../../ibc/applications/transfer' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz' export class AuthorizationGrant extends JSONSerializable< AuthorizationGrant.Amino, AuthorizationGrant.Data, AuthorizationGrant.Proto > { - constructor(public authorization: Authorization, public expiration?: Date) { - super(); + constructor( + public authorization: Authorization, + public expiration?: Date + ) { + super() } public static fromAmino(amino: AuthorizationGrant.Amino): AuthorizationGrant { - const { authorization, expiration } = amino; + const { authorization, expiration } = amino return new AuthorizationGrant( Authorization.fromAmino(authorization), expiration ? new Date(expiration) : undefined - ); + ) } public toAmino(): AuthorizationGrant.Amino { - const { authorization, expiration } = this; + const { authorization, expiration } = this return { authorization: authorization.toAmino(), expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), - }; + } } public static fromData(data: AuthorizationGrant.Data): AuthorizationGrant { - const { authorization, expiration } = data; + const { authorization, expiration } = data return new AuthorizationGrant( Authorization.fromData(authorization), expiration ? new Date(expiration) : undefined - ); + ) } public toData(): AuthorizationGrant.Data { - const { authorization, expiration } = this; + const { authorization, expiration } = this return { authorization: authorization.toData(), expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), - }; + } } public static fromProto(proto: AuthorizationGrant.Proto): AuthorizationGrant { return new AuthorizationGrant( Authorization.fromProto(proto.authorization as Any), proto.expiration - ); + ) } public toProto(): AuthorizationGrant.Proto { - const { authorization, expiration } = this; + const { authorization, expiration } = this return Grant_pb.fromPartial({ authorization: authorization.packAny(), expiration, - }); + }) } } export namespace AuthorizationGrant { export interface Amino { - authorization: Authorization.Amino; - expiration?: string; + authorization: Authorization.Amino + expiration?: string } export interface Data { - authorization: Authorization.Data; - expiration?: string; + authorization: Authorization.Data + expiration?: string } - export type Proto = Grant_pb; + export type Proto = Grant_pb } export type Authorization = @@ -93,7 +96,7 @@ export type Authorization = | StoreCodeAuthorization | ContractExecutionAuthorization | ContractMigrationAuthorization - | TransferAuthorization; + | TransferAuthorization export namespace Authorization { export type Amino = @@ -104,7 +107,7 @@ export namespace Authorization { | ExecuteAuthorization.Amino | StoreCodeAuthorization.Amino | ContractExecutionAuthorization.Amino - | ContractMigrationAuthorization.Amino; + | ContractMigrationAuthorization.Amino export type Data = | SendAuthorization.Data | GenericAuthorization.Data @@ -114,7 +117,7 @@ export namespace Authorization { | StoreCodeAuthorization.Data | ContractExecutionAuthorization.Data | ContractMigrationAuthorization.Data - | TransferAuthorization.Data; + | TransferAuthorization.Data export type Proto = | SendAuthorization.Proto | GenericAuthorization.Proto @@ -124,75 +127,75 @@ export namespace Authorization { | StoreCodeAuthorization.Proto | ContractExecutionAuthorization.Proto | ContractMigrationAuthorization.Proto - | TransferAuthorization.Proto; + | TransferAuthorization.Proto export function fromAmino(data: Authorization.Amino): Authorization { switch (data.type) { case 'cosmos-sdk/SendAuthorization': - return SendAuthorization.fromAmino(data); + return SendAuthorization.fromAmino(data) case 'cosmos-sdk/GenericAuthorization': - return GenericAuthorization.fromAmino(data); + return GenericAuthorization.fromAmino(data) case 'mstake/StakeAuthorization': - return StakeAuthorization.fromAmino(data); + return StakeAuthorization.fromAmino(data) case 'move/ExecuteAuthorization': - return ExecuteAuthorization.fromAmino(data); + return ExecuteAuthorization.fromAmino(data) case 'move/PublishAuthorization': - return PublishAuthorization.fromAmino(data); + return PublishAuthorization.fromAmino(data) case 'wasm/StoreCodeAuthorization': - return StoreCodeAuthorization.fromAmino(data); + return StoreCodeAuthorization.fromAmino(data) case 'wasm/ContractExecutionAuthorization': - return ContractExecutionAuthorization.fromAmino(data); + return ContractExecutionAuthorization.fromAmino(data) case 'wasm/ContractMigrationAuthorization': - return ContractMigrationAuthorization.fromAmino(data); + return ContractMigrationAuthorization.fromAmino(data) } } export function fromData(data: Authorization.Data): Authorization { switch (data['@type']) { case '/cosmos.authz.v1beta1.GenericAuthorization': - return GenericAuthorization.fromData(data); + return GenericAuthorization.fromData(data) case '/cosmos.bank.v1beta1.SendAuthorization': - return SendAuthorization.fromData(data); + return SendAuthorization.fromData(data) case '/initia.mstaking.v1.StakeAuthorization': - return StakeAuthorization.fromData(data); + return StakeAuthorization.fromData(data) case '/initia.move.v1.PublishAuthorization': - return PublishAuthorization.fromData(data); + return PublishAuthorization.fromData(data) case '/initia.move.v1.ExecuteAuthorization': - return ExecuteAuthorization.fromData(data); + return ExecuteAuthorization.fromData(data) case '/cosmwasm.wasm.v1.StoreCodeAuthorization': - return StoreCodeAuthorization.fromData(data); + return StoreCodeAuthorization.fromData(data) case '/cosmwasm.wasm.v1.ContractExecutionAuthorization': - return ContractExecutionAuthorization.fromData(data); + return ContractExecutionAuthorization.fromData(data) case '/cosmwasm.wasm.v1.ContractMigrationAuthorization': - return ContractMigrationAuthorization.fromData(data); + return ContractMigrationAuthorization.fromData(data) case '/ibc.applications.transfer.v1.TransferAuthorization': - return TransferAuthorization.fromData(data); + return TransferAuthorization.fromData(data) } } export function fromProto(proto: Any): Authorization { - const typeUrl = proto.typeUrl; + const typeUrl = proto.typeUrl switch (typeUrl) { case '/cosmos.authz.v1beta1.GenericAuthorization': - return GenericAuthorization.unpackAny(proto); + return GenericAuthorization.unpackAny(proto) case '/cosmos.bank.v1beta1.SendAuthorization': - return SendAuthorization.unpackAny(proto); + return SendAuthorization.unpackAny(proto) case '/initia.mstaking.v1.StakeAuthorization': - return StakeAuthorization.unpackAny(proto); + return StakeAuthorization.unpackAny(proto) case '/initia.move.v1.PublishAuthorization': - return PublishAuthorization.unpackAny(proto); + return PublishAuthorization.unpackAny(proto) case '/initia.move.v1.ExecuteAuthorization': - return ExecuteAuthorization.unpackAny(proto); + return ExecuteAuthorization.unpackAny(proto) case '/cosmwasm.wasm.v1.StoreCodeAuthorization': - return StoreCodeAuthorization.unpackAny(proto); + return StoreCodeAuthorization.unpackAny(proto) case '/cosmwasm.wasm.v1.ContractExecutionAuthorization': - return ContractExecutionAuthorization.unpackAny(proto); + return ContractExecutionAuthorization.unpackAny(proto) case '/cosmwasm.wasm.v1.ContractMigrationAuthorization': - return ContractMigrationAuthorization.unpackAny(proto); + return ContractMigrationAuthorization.unpackAny(proto) case '/ibc.applications.transfer.v1.TransferAuthorization': - return TransferAuthorization.unpackAny(proto); + return TransferAuthorization.unpackAny(proto) } - throw new Error(`Authorization type ${typeUrl} not recognized`); + throw new Error(`Authorization type ${typeUrl} not recognized`) } } diff --git a/src/core/authz/authorizations/ExecuteAuthorization.ts b/src/core/authz/authorizations/ExecuteAuthorization.ts index 4633744..6e99904 100644 --- a/src/core/authz/authorizations/ExecuteAuthorization.ts +++ b/src/core/authz/authorizations/ExecuteAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ExecuteAuthorization as ExecuteAuthorization_pb } from '@initia/initia.proto/initia/move/v1/authz'; -import { ExecuteAuthorizationItem as ExecuteAuthorizationItem_pb } from '@initia/initia.proto/initia/move/v1/types'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { ExecuteAuthorization as ExecuteAuthorization_pb } from '@initia/initia.proto/initia/move/v1/authz' +import { ExecuteAuthorizationItem as ExecuteAuthorizationItem_pb } from '@initia/initia.proto/initia/move/v1/types' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class ExecuteAuthorization extends JSONSerializable< ExecuteAuthorization.Amino, @@ -9,7 +9,7 @@ export class ExecuteAuthorization extends JSONSerializable< ExecuteAuthorization.Proto > { constructor(public items: ExecuteAuthorizationItem[]) { - super(); + super() } public static fromAmino( @@ -17,16 +17,16 @@ export class ExecuteAuthorization extends JSONSerializable< ): ExecuteAuthorization { return new ExecuteAuthorization( data.value.items.map(ExecuteAuthorizationItem.fromAmino) - ); + ) } public toAmino(): ExecuteAuthorization.Amino { return { type: 'move/ExecuteAuthorization', value: { - items: this.items.map(d => d.toAmino()), + items: this.items.map((d) => d.toAmino()), }, - }; + } } public static fromData( @@ -34,14 +34,14 @@ export class ExecuteAuthorization extends JSONSerializable< ): ExecuteAuthorization { return new ExecuteAuthorization( data.items.map(ExecuteAuthorizationItem.fromData) - ); + ) } public toData(): ExecuteAuthorization.Data { return { '@type': '/initia.move.v1.ExecuteAuthorization', - items: this.items.map(item => item.toData()), - }; + items: this.items.map((item) => item.toData()), + } } public static fromProto( @@ -49,26 +49,26 @@ export class ExecuteAuthorization extends JSONSerializable< ): ExecuteAuthorization { return new ExecuteAuthorization( proto.items.map(ExecuteAuthorizationItem.fromProto) - ); + ) } public toProto(): ExecuteAuthorization.Proto { return ExecuteAuthorization_pb.fromPartial({ - items: this.items.map(item => item.toProto()), - }); + items: this.items.map((item) => item.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.ExecuteAuthorization', value: ExecuteAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): ExecuteAuthorization { return ExecuteAuthorization.fromProto( ExecuteAuthorization_pb.decode(msgAny.value) - ); + ) } } @@ -82,47 +82,47 @@ export class ExecuteAuthorizationItem extends JSONSerializable< public module_name: string, public function_names: string[] ) { - super(); + super() } public static fromAmino( data: ExecuteAuthorizationItem.Amino ): ExecuteAuthorizationItem { - const { module_address, module_name, function_names } = data; + const { module_address, module_name, function_names } = data return new ExecuteAuthorizationItem( module_address, module_name, function_names - ); + ) } public toAmino(): ExecuteAuthorizationItem.Amino { - const { module_address, module_name, function_names } = this; + const { module_address, module_name, function_names } = this return { module_address, module_name, function_names, - }; + } } public static fromData( data: ExecuteAuthorizationItem.Data ): ExecuteAuthorizationItem { - const { module_address, module_name, function_names } = data; + const { module_address, module_name, function_names } = data return new ExecuteAuthorizationItem( module_address, module_name, function_names - ); + ) } public toData(): ExecuteAuthorizationItem.Data { - const { module_address, module_name, function_names } = this; + const { module_address, module_name, function_names } = this return { module_address, module_name, function_names, - }; + } } public static fromProto( @@ -132,7 +132,7 @@ export class ExecuteAuthorizationItem extends JSONSerializable< proto.moduleAddress, proto.moduleName, proto.functionNames - ); + ) } public toProto(): ExecuteAuthorizationItem.Proto { @@ -140,38 +140,38 @@ export class ExecuteAuthorizationItem extends JSONSerializable< moduleAddress: this.module_address, moduleName: this.module_name, functionNames: this.function_names, - }); + }) } } export namespace ExecuteAuthorizationItem { export interface Amino { - module_address: string; - module_name: string; - function_names: string[]; + module_address: string + module_name: string + function_names: string[] } export interface Data { - module_address: string; - module_name: string; - function_names: string[]; + module_address: string + module_name: string + function_names: string[] } - export type Proto = ExecuteAuthorizationItem_pb; + export type Proto = ExecuteAuthorizationItem_pb } export namespace ExecuteAuthorization { export interface Amino { - type: 'move/ExecuteAuthorization'; + type: 'move/ExecuteAuthorization' value: { - items: ExecuteAuthorizationItem.Amino[]; - }; + items: ExecuteAuthorizationItem.Amino[] + } } export interface Data { - '@type': '/initia.move.v1.ExecuteAuthorization'; - items: ExecuteAuthorizationItem.Data[]; + '@type': '/initia.move.v1.ExecuteAuthorization' + items: ExecuteAuthorizationItem.Data[] } - export type Proto = ExecuteAuthorization_pb; + export type Proto = ExecuteAuthorization_pb } diff --git a/src/core/authz/authorizations/GenericAuthorization.ts b/src/core/authz/authorizations/GenericAuthorization.ts index 313783b..1164f75 100644 --- a/src/core/authz/authorizations/GenericAuthorization.ts +++ b/src/core/authz/authorizations/GenericAuthorization.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { GenericAuthorization as GenericAuthorization_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { GenericAuthorization as GenericAuthorization_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class GenericAuthorization extends JSONSerializable< GenericAuthorization.Amino, @@ -8,77 +8,77 @@ export class GenericAuthorization extends JSONSerializable< GenericAuthorization.Proto > { constructor(public msg: string) { - super(); + super() } public static fromAmino( data: GenericAuthorization.Amino ): GenericAuthorization { - return new GenericAuthorization(data.value.msg); + return new GenericAuthorization(data.value.msg) } public toAmino(): GenericAuthorization.Amino { - const { msg } = this; + const { msg } = this return { type: 'cosmos-sdk/GenericAuthorization', value: { msg, }, - }; + } } public static fromData( data: GenericAuthorization.Data ): GenericAuthorization { - return new GenericAuthorization(data.msg); + return new GenericAuthorization(data.msg) } public toData(): GenericAuthorization.Data { - const { msg } = this; + const { msg } = this return { '@type': '/cosmos.authz.v1beta1.GenericAuthorization', msg, - }; + } } public static fromProto( data: GenericAuthorization.Proto ): GenericAuthorization { - return new GenericAuthorization(data.msg); + return new GenericAuthorization(data.msg) } public toProto(): GenericAuthorization.Proto { return GenericAuthorization_pb.fromPartial({ msg: this.msg, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.authz.v1beta1.GenericAuthorization', value: GenericAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): GenericAuthorization { return GenericAuthorization.fromProto( GenericAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace GenericAuthorization { export interface Amino { - type: 'cosmos-sdk/GenericAuthorization'; + type: 'cosmos-sdk/GenericAuthorization' value: { - msg: string; - }; + msg: string + } } export interface Data { - '@type': '/cosmos.authz.v1beta1.GenericAuthorization'; - msg: string; + '@type': '/cosmos.authz.v1beta1.GenericAuthorization' + msg: string } - export type Proto = GenericAuthorization_pb; + export type Proto = GenericAuthorization_pb } diff --git a/src/core/authz/authorizations/PublishAuthorization.ts b/src/core/authz/authorizations/PublishAuthorization.ts index 29cb77a..80ca15b 100644 --- a/src/core/authz/authorizations/PublishAuthorization.ts +++ b/src/core/authz/authorizations/PublishAuthorization.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { PublishAuthorization as PublishAuthorization_pb } from '@initia/initia.proto/initia/move/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { PublishAuthorization as PublishAuthorization_pb } from '@initia/initia.proto/initia/move/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class PublishAuthorization extends JSONSerializable< PublishAuthorization.Amino, @@ -8,73 +8,73 @@ export class PublishAuthorization extends JSONSerializable< PublishAuthorization.Proto > { constructor(public module_names: string[]) { - super(); + super() } public static fromAmino( data: PublishAuthorization.Amino ): PublishAuthorization { - return new PublishAuthorization(data.value.module_names); + return new PublishAuthorization(data.value.module_names) } public toAmino(): PublishAuthorization.Amino { return { type: 'move/PublishAuthorization', value: { module_names: this.module_names }, - }; + } } public static fromData( data: PublishAuthorization.Data ): PublishAuthorization { - return new PublishAuthorization(data.module_names); + return new PublishAuthorization(data.module_names) } public toData(): PublishAuthorization.Data { return { '@type': '/initia.move.v1.PublishAuthorization', module_names: this.module_names, - }; + } } public static fromProto( proto: PublishAuthorization.Proto ): PublishAuthorization { - return new PublishAuthorization(proto.moduleNames); + return new PublishAuthorization(proto.moduleNames) } public toProto(): PublishAuthorization.Proto { return PublishAuthorization_pb.fromPartial({ moduleNames: this.module_names, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.PublishAuthorization', value: PublishAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): PublishAuthorization { return PublishAuthorization.fromProto( PublishAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace PublishAuthorization { export interface Amino { - type: 'move/PublishAuthorization'; + type: 'move/PublishAuthorization' value: { - module_names: string[]; - }; + module_names: string[] + } } export interface Data { - '@type': '/initia.move.v1.PublishAuthorization'; - module_names: string[]; + '@type': '/initia.move.v1.PublishAuthorization' + module_names: string[] } - export type Proto = PublishAuthorization_pb; + export type Proto = PublishAuthorization_pb } diff --git a/src/core/authz/authorizations/SendAuthorization.ts b/src/core/authz/authorizations/SendAuthorization.ts index 517c5b5..f594a8a 100644 --- a/src/core/authz/authorizations/SendAuthorization.ts +++ b/src/core/authz/authorizations/SendAuthorization.ts @@ -1,96 +1,99 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coins } from '../../Coins'; -import { SendAuthorization as SendAuthorization_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coins } from '../../Coins' +import { SendAuthorization as SendAuthorization_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class SendAuthorization extends JSONSerializable< SendAuthorization.Amino, SendAuthorization.Data, SendAuthorization.Proto > { - public spend_limit: Coins; - constructor(spend_limit: Coins.Input, public allow_list: AccAddress[]) { - super(); - this.spend_limit = new Coins(spend_limit); + public spend_limit: Coins + constructor( + spend_limit: Coins.Input, + public allow_list: AccAddress[] + ) { + super() + this.spend_limit = new Coins(spend_limit) } public static fromAmino(data: SendAuthorization.Amino): SendAuthorization { return new SendAuthorization( Coins.fromAmino(data.value.spend_limit), data.value.allow_list - ); + ) } public toAmino(): SendAuthorization.Amino { - const { spend_limit, allow_list } = this; + const { spend_limit, allow_list } = this return { type: 'cosmos-sdk/SendAuthorization', value: { spend_limit: spend_limit.toAmino(), allow_list, }, - }; + } } public static fromData(data: SendAuthorization.Data): SendAuthorization { return new SendAuthorization( Coins.fromData(data.spend_limit), data.allow_list - ); + ) } public toData(): SendAuthorization.Data { - const { spend_limit, allow_list } = this; + const { spend_limit, allow_list } = this return { '@type': '/cosmos.bank.v1beta1.SendAuthorization', spend_limit: spend_limit.toAmino(), allow_list, - }; + } } public static fromProto(proto: SendAuthorization.Proto): SendAuthorization { return new SendAuthorization( Coins.fromProto(proto.spendLimit), proto.allowList - ); + ) } public toProto(): SendAuthorization.Proto { return SendAuthorization_pb.fromPartial({ spendLimit: this.spend_limit.toProto(), allowList: this.allow_list, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.bank.v1beta1.SendAuthorization', value: SendAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): SendAuthorization { return SendAuthorization.fromProto( SendAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace SendAuthorization { export interface Amino { - type: 'cosmos-sdk/SendAuthorization'; + type: 'cosmos-sdk/SendAuthorization' value: { - spend_limit: Coins.Amino; - allow_list: AccAddress[]; - }; + spend_limit: Coins.Amino + allow_list: AccAddress[] + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.SendAuthorization'; - spend_limit: Coins.Data; - allow_list: AccAddress[]; + '@type': '/cosmos.bank.v1beta1.SendAuthorization' + spend_limit: Coins.Data + allow_list: AccAddress[] } - export type Proto = SendAuthorization_pb; + export type Proto = SendAuthorization_pb } diff --git a/src/core/authz/authorizations/StakeAuthorization.ts b/src/core/authz/authorizations/StakeAuthorization.ts index 20c6b2b..0f2bfd8 100644 --- a/src/core/authz/authorizations/StakeAuthorization.ts +++ b/src/core/authz/authorizations/StakeAuthorization.ts @@ -1,21 +1,21 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' import { StakeAuthorization as StakeAuthorization_pb, AuthorizationType, StakeAuthorization_Validators as StakeAuthorizationValidators_pb, authorizationTypeFromJSON, authorizationTypeToJSON, -} from '@initia/initia.proto/initia/mstaking/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from '@initia/initia.proto/initia/mstaking/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class StakeAuthorization extends JSONSerializable< StakeAuthorization.Amino, StakeAuthorization.Data, StakeAuthorization.Proto > { - public max_tokens: Coins; + public max_tokens: Coins constructor( max_tokens: Coins.Input, @@ -23,25 +23,25 @@ export class StakeAuthorization extends JSONSerializable< public deny_list: StakeAuthorizationValidators, public authorization_type: AuthorizationType ) { - super(); - this.max_tokens = new Coins(max_tokens); + super() + this.max_tokens = new Coins(max_tokens) } public static fromAmino(data: StakeAuthorization.Amino): StakeAuthorization { const { value: { max_tokens, allow_list, deny_list, authorization_type }, - } = data; + } = data return new StakeAuthorization( Coins.fromAmino(max_tokens), StakeAuthorizationValidators.fromAmino(allow_list), StakeAuthorizationValidators.fromAmino(deny_list), authorizationTypeFromJSON(authorization_type) - ); + ) } public toAmino(): StakeAuthorization.Amino { - const { max_tokens, allow_list, deny_list, authorization_type } = this; + const { max_tokens, allow_list, deny_list, authorization_type } = this return { type: 'mstake/StakeAuthorization', value: { @@ -50,29 +50,29 @@ export class StakeAuthorization extends JSONSerializable< deny_list: deny_list.toAmino(), authorization_type: authorizationTypeToJSON(authorization_type), }, - }; + } } public static fromData(data: StakeAuthorization.Data): StakeAuthorization { - const { max_tokens, allow_list, deny_list, authorization_type } = data; + const { max_tokens, allow_list, deny_list, authorization_type } = data return new StakeAuthorization( Coins.fromData(max_tokens), StakeAuthorizationValidators.fromData(allow_list), StakeAuthorizationValidators.fromData(deny_list), authorizationTypeFromJSON(authorization_type) - ); + ) } public toData(): StakeAuthorization.Data { - const { max_tokens, allow_list, deny_list, authorization_type } = this; + const { max_tokens, allow_list, deny_list, authorization_type } = this return { '@type': '/initia.mstaking.v1.StakeAuthorization', max_tokens: max_tokens.toData(), allow_list: allow_list.toData(), deny_list: deny_list.toData(), authorization_type: authorizationTypeToJSON(authorization_type), - }; + } } public static fromProto(proto: StakeAuthorization.Proto): StakeAuthorization { @@ -85,30 +85,30 @@ export class StakeAuthorization extends JSONSerializable< proto.denyList as StakeAuthorizationValidators ), proto.authorizationType - ); + ) } public toProto(): StakeAuthorization.Proto { - const { max_tokens, allow_list, deny_list, authorization_type } = this; + const { max_tokens, allow_list, deny_list, authorization_type } = this return StakeAuthorization_pb.fromPartial({ maxTokens: max_tokens.toProto(), allowList: allow_list.toProto(), denyList: deny_list.toProto(), authorizationType: authorization_type, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.StakeAuthorization', value: StakeAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): StakeAuthorization { return StakeAuthorization.fromProto( StakeAuthorization_pb.decode(msgAny.value) - ); + ) } } @@ -118,77 +118,77 @@ export class StakeAuthorizationValidators extends JSONSerializable< StakeAuthorizationValidators.Proto > { constructor(public address: AccAddress[]) { - super(); + super() } public static fromAmino( data: StakeAuthorizationValidators.Amino ): StakeAuthorizationValidators { - return new StakeAuthorizationValidators(data.address); + return new StakeAuthorizationValidators(data.address) } public toAmino(): StakeAuthorizationValidators.Amino { - return { address: this.address }; + return { address: this.address } } public static fromData( data: StakeAuthorizationValidators.Data ): StakeAuthorizationValidators { - return new StakeAuthorizationValidators(data.address); + return new StakeAuthorizationValidators(data.address) } public toData(): StakeAuthorizationValidators.Data { return { address: this.address, - }; + } } public static fromProto( proto: StakeAuthorizationValidators.Proto ): StakeAuthorizationValidators { - return new StakeAuthorizationValidators(proto.address); + return new StakeAuthorizationValidators(proto.address) } public toProto(): StakeAuthorizationValidators.Proto { return StakeAuthorizationValidators_pb.fromPartial({ address: this.address, - }); + }) } } export namespace StakeAuthorizationValidators { export interface Amino { - address: AccAddress[]; + address: AccAddress[] } export interface Data { - address: AccAddress[]; + address: AccAddress[] } - export type Proto = StakeAuthorizationValidators_pb; + export type Proto = StakeAuthorizationValidators_pb } export namespace StakeAuthorization { - export type Type = AuthorizationType; - export const Type = AuthorizationType; + export type Type = AuthorizationType + export const Type = AuthorizationType export interface Amino { - type: 'mstake/StakeAuthorization'; + type: 'mstake/StakeAuthorization' value: { - max_tokens: Coins.Amino; - allow_list: StakeAuthorizationValidators.Amino; - deny_list: StakeAuthorizationValidators.Amino; - authorization_type: string; - }; + max_tokens: Coins.Amino + allow_list: StakeAuthorizationValidators.Amino + deny_list: StakeAuthorizationValidators.Amino + authorization_type: string + } } export interface Data { - '@type': '/initia.mstaking.v1.StakeAuthorization'; - max_tokens: Coins.Data; - allow_list: StakeAuthorizationValidators.Data; - deny_list: StakeAuthorizationValidators.Data; - authorization_type: string; + '@type': '/initia.mstaking.v1.StakeAuthorization' + max_tokens: Coins.Data + allow_list: StakeAuthorizationValidators.Data + deny_list: StakeAuthorizationValidators.Data + authorization_type: string } - export type Proto = StakeAuthorization_pb; + export type Proto = StakeAuthorization_pb } diff --git a/src/core/authz/authorizations/index.ts b/src/core/authz/authorizations/index.ts index ba4fb6a..84447d4 100644 --- a/src/core/authz/authorizations/index.ts +++ b/src/core/authz/authorizations/index.ts @@ -1,6 +1,6 @@ -export * from './StakeAuthorization'; -export * from './SendAuthorization'; -export * from './GenericAuthorization'; -export * from './Authorization'; -export * from './PublishAuthorization'; -export * from './ExecuteAuthorization'; +export * from './StakeAuthorization' +export * from './SendAuthorization' +export * from './GenericAuthorization' +export * from './Authorization' +export * from './PublishAuthorization' +export * from './ExecuteAuthorization' diff --git a/src/core/authz/index.ts b/src/core/authz/index.ts index e860721..004dcb3 100644 --- a/src/core/authz/index.ts +++ b/src/core/authz/index.ts @@ -1,2 +1,2 @@ -export * from './authorizations'; -export * from './msgs'; +export * from './authorizations' +export * from './msgs' diff --git a/src/core/authz/msgs/MsgExecAuthorized.spec.ts b/src/core/authz/msgs/MsgExecAuthorized.spec.ts index 94459c0..c25bc8a 100644 --- a/src/core/authz/msgs/MsgExecAuthorized.spec.ts +++ b/src/core/authz/msgs/MsgExecAuthorized.spec.ts @@ -1,10 +1,10 @@ -import { MsgExecAuthorized } from './MsgExecAuthorized'; -const examples = require('./MsgExecAuthorized.data.json'); +import { MsgExecAuthorized } from './MsgExecAuthorized' +const examples = require('./MsgExecAuthorized.data.json') describe('MsgExecAuthorized', () => { it('deserializes', () => { examples.forEach((data: MsgExecAuthorized.Amino) => { - expect(MsgExecAuthorized.fromAmino(data).toAmino()).toEqual(data); - }); - }); -}); + expect(MsgExecAuthorized.fromAmino(data).toAmino()).toEqual(data) + }) + }) +}) diff --git a/src/core/authz/msgs/MsgExecAuthorized.ts b/src/core/authz/msgs/MsgExecAuthorized.ts index 772ab11..efe9bed 100644 --- a/src/core/authz/msgs/MsgExecAuthorized.ts +++ b/src/core/authz/msgs/MsgExecAuthorized.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Msg } from '../../Msg'; -import { MsgExec as MsgExec_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Msg } from '../../Msg' +import { MsgExec as MsgExec_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgExecAuthorized extends JSONSerializable< MsgExecAuthorized.Amino, @@ -13,91 +13,94 @@ export class MsgExecAuthorized extends JSONSerializable< * @param grantee authorization grantee * @param msgs list of messages to execute */ - constructor(public grantee: AccAddress, public msgs: Msg[]) { - super(); + constructor( + public grantee: AccAddress, + public msgs: Msg[] + ) { + super() } public static fromAmino(data: MsgExecAuthorized.Amino): MsgExecAuthorized { const { value: { grantee, msgs }, - } = data; + } = data return new MsgExecAuthorized( grantee, - msgs.map(x => Msg.fromAmino(x)) - ); + msgs.map((x) => Msg.fromAmino(x)) + ) } public toAmino(): MsgExecAuthorized.Amino { - const { grantee, msgs } = this; + const { grantee, msgs } = this return { type: 'cosmos-sdk/MsgExec', value: { grantee, - msgs: msgs.map(msg => { - return msg.toAmino(); + msgs: msgs.map((msg) => { + return msg.toAmino() }), }, - }; + } } public static fromData(proto: MsgExecAuthorized.Data): MsgExecAuthorized { - const { grantee, msgs } = proto; + const { grantee, msgs } = proto return new MsgExecAuthorized( grantee, - msgs.map(x => Msg.fromData(x)) - ); + msgs.map((x) => Msg.fromData(x)) + ) } public toData(): MsgExecAuthorized.Data { - const { grantee, msgs } = this; + const { grantee, msgs } = this return { '@type': '/cosmos.authz.v1beta1.MsgExec', grantee, - msgs: msgs.map(msg => msg.toData()), - }; + msgs: msgs.map((msg) => msg.toData()), + } } public static fromProto(proto: MsgExecAuthorized.Proto): MsgExecAuthorized { return new MsgExecAuthorized( proto.grantee, - proto.msgs.map(x => Msg.fromProto(x)) - ); + proto.msgs.map((x) => Msg.fromProto(x)) + ) } public toProto(): MsgExecAuthorized.Proto { - const { grantee, msgs } = this; + const { grantee, msgs } = this return MsgExec_pb.fromPartial({ grantee, - msgs: msgs.map(m => m.packAny()), - }); + msgs: msgs.map((m) => m.packAny()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.authz.v1beta1.MsgExec', value: MsgExec_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgExecAuthorized { - return MsgExecAuthorized.fromProto(MsgExec_pb.decode(msgAny.value)); + return MsgExecAuthorized.fromProto(MsgExec_pb.decode(msgAny.value)) } } export namespace MsgExecAuthorized { export interface Amino { - type: 'cosmos-sdk/MsgExec'; + type: 'cosmos-sdk/MsgExec' value: { - grantee: AccAddress; - msgs: Msg.Amino[]; - }; + grantee: AccAddress + msgs: Msg.Amino[] + } } export interface Data { - '@type': '/cosmos.authz.v1beta1.MsgExec'; - grantee: AccAddress; - msgs: Msg.Data[]; + '@type': '/cosmos.authz.v1beta1.MsgExec' + grantee: AccAddress + msgs: Msg.Data[] } - export type Proto = MsgExec_pb; + export type Proto = MsgExec_pb } diff --git a/src/core/authz/msgs/MsgGrantAuthorization.spec.ts b/src/core/authz/msgs/MsgGrantAuthorization.spec.ts index b21a1bf..752913b 100644 --- a/src/core/authz/msgs/MsgGrantAuthorization.spec.ts +++ b/src/core/authz/msgs/MsgGrantAuthorization.spec.ts @@ -1,10 +1,10 @@ -import { MsgGrantAuthorization } from './MsgGrantAuthorization'; -const examples = require('./MsgGrantAuthorization.data.json'); +import { MsgGrantAuthorization } from './MsgGrantAuthorization' +const examples = require('./MsgGrantAuthorization.data.json') describe('MsgGrantAuthorization', () => { it('deserializes', () => { examples.forEach((data: MsgGrantAuthorization.Amino) => { - expect(MsgGrantAuthorization.fromAmino(data).toAmino()).toEqual(data); - }); - }); -}); + expect(MsgGrantAuthorization.fromAmino(data).toAmino()).toEqual(data) + }) + }) +}) diff --git a/src/core/authz/msgs/MsgGrantAuthorization.ts b/src/core/authz/msgs/MsgGrantAuthorization.ts index 265b934..7e9e2e8 100644 --- a/src/core/authz/msgs/MsgGrantAuthorization.ts +++ b/src/core/authz/msgs/MsgGrantAuthorization.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { AuthorizationGrant } from '../authorizations'; -import { MsgGrant as MsgGrant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { AuthorizationGrant } from '../authorizations' +import { MsgGrant as MsgGrant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { Grant as Grant_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/authz' export class MsgGrantAuthorization extends JSONSerializable< MsgGrantAuthorization.Amino, @@ -19,7 +19,7 @@ export class MsgGrantAuthorization extends JSONSerializable< public grantee: AccAddress, public grant: AuthorizationGrant ) { - super(); + super() } public static fromAmino( @@ -27,16 +27,16 @@ export class MsgGrantAuthorization extends JSONSerializable< ): MsgGrantAuthorization { const { value: { granter, grantee, grant }, - } = data; + } = data return new MsgGrantAuthorization( granter, grantee, AuthorizationGrant.fromAmino(grant) - ); + ) } public toAmino(): MsgGrantAuthorization.Amino { - const { granter, grantee, grant } = this; + const { granter, grantee, grant } = this return { type: 'cosmos-sdk/MsgGrant', value: { @@ -44,28 +44,28 @@ export class MsgGrantAuthorization extends JSONSerializable< grantee, grant: grant.toAmino(), }, - }; + } } public static fromData( data: MsgGrantAuthorization.Data ): MsgGrantAuthorization { - const { granter, grantee, grant } = data; + const { granter, grantee, grant } = data return new MsgGrantAuthorization( granter, grantee, AuthorizationGrant.fromData(grant) - ); + ) } public toData(): MsgGrantAuthorization.Data { - const { granter, grantee, grant } = this; + const { granter, grantee, grant } = this return { '@type': '/cosmos.authz.v1beta1.MsgGrant', granter, grantee, grant: grant.toData(), - }; + } } public static fromProto( @@ -75,46 +75,46 @@ export class MsgGrantAuthorization extends JSONSerializable< data.granter, data.grantee, AuthorizationGrant.fromProto(data.grant as Grant_pb) - ); + ) } public toProto(): MsgGrantAuthorization.Proto { - const { grant, granter, grantee } = this; + const { grant, granter, grantee } = this return MsgGrant_pb.fromPartial({ grant: grant.toProto(), grantee, granter, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.authz.v1beta1.MsgGrant', value: MsgGrant_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGrantAuthorization { - return MsgGrantAuthorization.fromProto(MsgGrant_pb.decode(msgAny.value)); + return MsgGrantAuthorization.fromProto(MsgGrant_pb.decode(msgAny.value)) } } export namespace MsgGrantAuthorization { export interface Amino { - type: 'cosmos-sdk/MsgGrant'; + type: 'cosmos-sdk/MsgGrant' value: { - granter: AccAddress; - grantee: AccAddress; - grant: AuthorizationGrant.Amino; - }; + granter: AccAddress + grantee: AccAddress + grant: AuthorizationGrant.Amino + } } export interface Data { - '@type': '/cosmos.authz.v1beta1.MsgGrant'; - granter: AccAddress; - grantee: AccAddress; - grant: AuthorizationGrant.Data; + '@type': '/cosmos.authz.v1beta1.MsgGrant' + granter: AccAddress + grantee: AccAddress + grant: AuthorizationGrant.Data } - export type Proto = MsgGrant_pb; + export type Proto = MsgGrant_pb } diff --git a/src/core/authz/msgs/MsgRevokeAuthorization.spec.ts b/src/core/authz/msgs/MsgRevokeAuthorization.spec.ts index 4872097..eeb5cd8 100644 --- a/src/core/authz/msgs/MsgRevokeAuthorization.spec.ts +++ b/src/core/authz/msgs/MsgRevokeAuthorization.spec.ts @@ -1,10 +1,10 @@ -import { MsgRevokeAuthorization } from './MsgRevokeAuthorization'; -const examples = require('./MsgRevokeAuthorization.data.json'); +import { MsgRevokeAuthorization } from './MsgRevokeAuthorization' +const examples = require('./MsgRevokeAuthorization.data.json') describe('MsgRevokeAuthorization', () => { it('deserializes', () => { examples.forEach((data: MsgRevokeAuthorization.Amino) => { - expect(MsgRevokeAuthorization.fromAmino(data).toAmino()).toEqual(data); - }); - }); -}); + expect(MsgRevokeAuthorization.fromAmino(data).toAmino()).toEqual(data) + }) + }) +}) diff --git a/src/core/authz/msgs/MsgRevokeAuthorization.ts b/src/core/authz/msgs/MsgRevokeAuthorization.ts index 10dd8b8..e7ff0e8 100644 --- a/src/core/authz/msgs/MsgRevokeAuthorization.ts +++ b/src/core/authz/msgs/MsgRevokeAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgRevoke as MsgRevoke_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgRevoke as MsgRevoke_pb } from '@initia/initia.proto/cosmos/authz/v1beta1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgRevokeAuthorization extends JSONSerializable< MsgRevokeAuthorization.Amino, @@ -18,7 +18,7 @@ export class MsgRevokeAuthorization extends JSONSerializable< public grantee: AccAddress, public msg_type_url: string ) { - super(); + super() } public static fromAmino( @@ -26,12 +26,12 @@ export class MsgRevokeAuthorization extends JSONSerializable< ): MsgRevokeAuthorization { const { value: { granter, grantee, msg_type_url }, - } = data; - return new MsgRevokeAuthorization(granter, grantee, msg_type_url); + } = data + return new MsgRevokeAuthorization(granter, grantee, msg_type_url) } public toAmino(): MsgRevokeAuthorization.Amino { - const { granter, grantee, msg_type_url } = this; + const { granter, grantee, msg_type_url } = this return { type: 'cosmos-sdk/MsgRevoke', value: { @@ -39,24 +39,24 @@ export class MsgRevokeAuthorization extends JSONSerializable< grantee, msg_type_url, }, - }; + } } public static fromData( data: MsgRevokeAuthorization.Data ): MsgRevokeAuthorization { - const { granter, grantee, msg_type_url } = data; - return new MsgRevokeAuthorization(granter, grantee, msg_type_url); + const { granter, grantee, msg_type_url } = data + return new MsgRevokeAuthorization(granter, grantee, msg_type_url) } public toData(): MsgRevokeAuthorization.Data { - const { granter, grantee, msg_type_url } = this; + const { granter, grantee, msg_type_url } = this return { '@type': '/cosmos.authz.v1beta1.MsgRevoke', granter, grantee, msg_type_url, - }; + } } public static fromProto( @@ -66,46 +66,46 @@ export class MsgRevokeAuthorization extends JSONSerializable< proto.granter, proto.grantee, proto.msgTypeUrl - ); + ) } public toProto(): MsgRevokeAuthorization.Proto { - const { granter, grantee, msg_type_url } = this; + const { granter, grantee, msg_type_url } = this return MsgRevoke_pb.fromPartial({ grantee, granter, msgTypeUrl: msg_type_url, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.authz.v1beta1.MsgRevoke', value: MsgRevoke_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRevokeAuthorization { - return MsgRevokeAuthorization.fromProto(MsgRevoke_pb.decode(msgAny.value)); + return MsgRevokeAuthorization.fromProto(MsgRevoke_pb.decode(msgAny.value)) } } export namespace MsgRevokeAuthorization { export interface Amino { - type: 'cosmos-sdk/MsgRevoke'; + type: 'cosmos-sdk/MsgRevoke' value: { - granter: AccAddress; - grantee: AccAddress; - msg_type_url: string; - }; + granter: AccAddress + grantee: AccAddress + msg_type_url: string + } } export interface Data { - '@type': '/cosmos.authz.v1beta1.MsgRevoke'; - granter: AccAddress; - grantee: AccAddress; - msg_type_url: string; + '@type': '/cosmos.authz.v1beta1.MsgRevoke' + granter: AccAddress + grantee: AccAddress + msg_type_url: string } - export type Proto = MsgRevoke_pb; + export type Proto = MsgRevoke_pb } diff --git a/src/core/authz/msgs/index.ts b/src/core/authz/msgs/index.ts index 1abd86c..1f97dcc 100644 --- a/src/core/authz/msgs/index.ts +++ b/src/core/authz/msgs/index.ts @@ -1,27 +1,27 @@ -import { MsgGrantAuthorization } from './MsgGrantAuthorization'; -import { MsgRevokeAuthorization } from './MsgRevokeAuthorization'; -import { MsgExecAuthorized } from './MsgExecAuthorized'; +import { MsgGrantAuthorization } from './MsgGrantAuthorization' +import { MsgRevokeAuthorization } from './MsgRevokeAuthorization' +import { MsgExecAuthorized } from './MsgExecAuthorized' -export * from './MsgGrantAuthorization'; -export * from './MsgRevokeAuthorization'; -export * from './MsgExecAuthorized'; +export * from './MsgGrantAuthorization' +export * from './MsgRevokeAuthorization' +export * from './MsgExecAuthorized' export type AuthzMsg = | MsgGrantAuthorization | MsgRevokeAuthorization - | MsgExecAuthorized; + | MsgExecAuthorized export namespace AuthzMsg { export type Amino = | MsgGrantAuthorization.Amino | MsgRevokeAuthorization.Amino - | MsgExecAuthorized.Amino; + | MsgExecAuthorized.Amino export type Data = | MsgGrantAuthorization.Data | MsgRevokeAuthorization.Data - | MsgExecAuthorized.Data; + | MsgExecAuthorized.Data export type Proto = | MsgGrantAuthorization.Proto | MsgRevokeAuthorization.Proto - | MsgExecAuthorized.Proto; + | MsgExecAuthorized.Proto } diff --git a/src/core/bank/BankParams.ts b/src/core/bank/BankParams.ts index 8b80ea2..8065e6a 100644 --- a/src/core/bank/BankParams.ts +++ b/src/core/bank/BankParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { SendEnabled } from './SendEnabled'; -import { Params as Params_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'; +import { JSONSerializable } from '../../util/json' +import { SendEnabled } from './SendEnabled' +import { Params as Params_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank' export class BankParams extends JSONSerializable< BankParams.Amino, @@ -15,77 +15,77 @@ export class BankParams extends JSONSerializable< public send_enabled: SendEnabled[], public default_send_enabled: boolean ) { - super(); + super() } public static fromAmino(data: BankParams.Amino): BankParams { const { value: { send_enabled, default_send_enabled }, - } = data; + } = data return new BankParams( send_enabled.map(SendEnabled.fromAmino), default_send_enabled - ); + ) } public toAmino(): BankParams.Amino { - const { send_enabled, default_send_enabled } = this; + const { send_enabled, default_send_enabled } = this return { type: 'cosmos-sdk/x/bank/Params', value: { - send_enabled: send_enabled.map(d => d.toAmino()), + send_enabled: send_enabled.map((d) => d.toAmino()), default_send_enabled, }, - }; + } } public static fromData(data: BankParams.Data): BankParams { - const { send_enabled, default_send_enabled } = data; + const { send_enabled, default_send_enabled } = data return new BankParams( send_enabled.map(SendEnabled.fromData), default_send_enabled - ); + ) } public toData(): BankParams.Data { - const { send_enabled, default_send_enabled } = this; + const { send_enabled, default_send_enabled } = this return { '@type': '/cosmos.bank.v1beta1.Params', - send_enabled: send_enabled.map(d => d.toData()), + send_enabled: send_enabled.map((d) => d.toData()), default_send_enabled, - }; + } } public static fromProto(data: BankParams.Proto): BankParams { return new BankParams( data.sendEnabled.map(SendEnabled.fromProto), data.defaultSendEnabled - ); + ) } public toProto(): BankParams.Proto { - const { send_enabled, default_send_enabled } = this; + const { send_enabled, default_send_enabled } = this return Params_pb.fromPartial({ - sendEnabled: send_enabled.map(d => d.toProto()), + sendEnabled: send_enabled.map((d) => d.toProto()), defaultSendEnabled: default_send_enabled, - }); + }) } } export namespace BankParams { export interface Amino { - type: 'cosmos-sdk/x/bank/Params'; + type: 'cosmos-sdk/x/bank/Params' value: { - send_enabled: SendEnabled.Amino[]; - default_send_enabled: boolean; - }; + send_enabled: SendEnabled.Amino[] + default_send_enabled: boolean + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.Params'; - send_enabled: SendEnabled.Data[]; - default_send_enabled: boolean; + '@type': '/cosmos.bank.v1beta1.Params' + send_enabled: SendEnabled.Data[] + default_send_enabled: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/bank/DenomMetadata.ts b/src/core/bank/DenomMetadata.ts index b9d0e06..903cdbc 100644 --- a/src/core/bank/DenomMetadata.ts +++ b/src/core/bank/DenomMetadata.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { DenomUnit } from './DenomUnit'; -import { Metadata as Metadata_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'; +import { JSONSerializable } from '../../util/json' +import { DenomUnit } from './DenomUnit' +import { Metadata as Metadata_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank' export class DenomMetadata extends JSONSerializable< DenomMetadata.Amino, @@ -27,7 +27,7 @@ export class DenomMetadata extends JSONSerializable< public uri: string, public uri_hash: string ) { - super(); + super() } public static fromAmino(data: DenomMetadata.Amino): DenomMetadata { @@ -40,7 +40,7 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash, - } = data; + } = data return new DenomMetadata( description, @@ -51,7 +51,7 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash - ); + ) } public toAmino(): DenomMetadata.Amino { @@ -64,18 +64,18 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash, - } = this; + } = this return { description, - denom_units: denom_units.map(d => d.toAmino()), + denom_units: denom_units.map((d) => d.toAmino()), base, display, name, symbol, uri, uri_hash, - }; + } } public static fromData(data: DenomMetadata.Data): DenomMetadata { @@ -88,7 +88,7 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash, - } = data; + } = data return new DenomMetadata( description, @@ -99,7 +99,7 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash - ); + ) } public toData(): DenomMetadata.Data { @@ -112,18 +112,18 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash, - } = this; + } = this return { description, - denom_units: denom_units.map(d => d.toData()), + denom_units: denom_units.map((d) => d.toData()), base, display, name, symbol, uri, uri_hash, - }; + } } public static fromProto(data: DenomMetadata.Proto): DenomMetadata { @@ -136,7 +136,7 @@ export class DenomMetadata extends JSONSerializable< data.symbol, data.uri, data.uriHash - ); + ) } public toProto(): DenomMetadata.Proto { @@ -149,43 +149,43 @@ export class DenomMetadata extends JSONSerializable< symbol, uri, uri_hash, - } = this; + } = this return Metadata_pb.fromPartial({ description, - denomUnits: denom_units.map(d => d.toProto()), + denomUnits: denom_units.map((d) => d.toProto()), base, display, name, symbol, uri, uriHash: uri_hash, - }); + }) } } export namespace DenomMetadata { export interface Amino { - description: string; - denom_units: DenomUnit.Amino[]; - base: string; - display: string; - name: string; - symbol: string; - uri: string; - uri_hash: string; + description: string + denom_units: DenomUnit.Amino[] + base: string + display: string + name: string + symbol: string + uri: string + uri_hash: string } export interface Data { - description: string; - denom_units: DenomUnit.Data[]; - base: string; - display: string; - name: string; - symbol: string; - uri: string; - uri_hash: string; + description: string + denom_units: DenomUnit.Data[] + base: string + display: string + name: string + symbol: string + uri: string + uri_hash: string } - export type Proto = Metadata_pb; + export type Proto = Metadata_pb } diff --git a/src/core/bank/DenomUnit.ts b/src/core/bank/DenomUnit.ts index 6c97d01..3d65097 100644 --- a/src/core/bank/DenomUnit.ts +++ b/src/core/bank/DenomUnit.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Denom } from '../Denom'; -import { DenomUnit as DenomUnit_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'; +import { JSONSerializable } from '../../util/json' +import { Denom } from '../Denom' +import { DenomUnit as DenomUnit_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank' export class DenomUnit extends JSONSerializable< DenomUnit.Amino, @@ -17,63 +17,63 @@ export class DenomUnit extends JSONSerializable< public exponent: number, public aliases: string[] ) { - super(); + super() } public static fromAmino(data: DenomUnit.Amino): DenomUnit { - const { denom, exponent, aliases } = data; - return new DenomUnit(denom, Number.parseInt(exponent), aliases); + const { denom, exponent, aliases } = data + return new DenomUnit(denom, Number.parseInt(exponent), aliases) } public toAmino(): DenomUnit.Amino { - const { denom, exponent, aliases } = this; + const { denom, exponent, aliases } = this return { denom, exponent: exponent.toString(), aliases, - }; + } } public static fromData(data: DenomUnit.Data): DenomUnit { - const { denom, exponent, aliases } = data; - return new DenomUnit(denom, Number.parseInt(exponent), aliases); + const { denom, exponent, aliases } = data + return new DenomUnit(denom, Number.parseInt(exponent), aliases) } public toData(): DenomUnit.Data { - const { denom, exponent, aliases } = this; + const { denom, exponent, aliases } = this return { denom, exponent: exponent.toString(), aliases, - }; + } } public static fromProto(data: DenomUnit.Proto): DenomUnit { - return new DenomUnit(data.denom, data.exponent, data.aliases); + return new DenomUnit(data.denom, data.exponent, data.aliases) } public toProto(): DenomUnit.Proto { - const { denom, exponent, aliases } = this; + const { denom, exponent, aliases } = this return DenomUnit_pb.fromPartial({ denom, exponent, aliases, - }); + }) } } export namespace DenomUnit { export interface Amino { - denom: Denom; - exponent: string; - aliases: string[]; + denom: Denom + exponent: string + aliases: string[] } export interface Data { - denom: Denom; - exponent: string; - aliases: string[]; + denom: Denom + exponent: string + aliases: string[] } - export type Proto = DenomUnit_pb; + export type Proto = DenomUnit_pb } diff --git a/src/core/bank/SendEnabled.ts b/src/core/bank/SendEnabled.ts index f279d0e..d4a46d1 100644 --- a/src/core/bank/SendEnabled.ts +++ b/src/core/bank/SendEnabled.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Denom } from '../Denom'; -import { SendEnabled as SendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank'; +import { JSONSerializable } from '../../util/json' +import { Denom } from '../Denom' +import { SendEnabled as SendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/bank' export class SendEnabled extends JSONSerializable< SendEnabled.Amino, @@ -11,53 +11,56 @@ export class SendEnabled extends JSONSerializable< * @param denom * @param enabled */ - constructor(public denom: Denom, public enabled: boolean) { - super(); + constructor( + public denom: Denom, + public enabled: boolean + ) { + super() } public static fromAmino(data: SendEnabled.Amino): SendEnabled { - const { denom, enabled } = data; - return new SendEnabled(denom, enabled); + const { denom, enabled } = data + return new SendEnabled(denom, enabled) } public toAmino(): SendEnabled.Amino { - const { denom, enabled } = this; - return { denom, enabled }; + const { denom, enabled } = this + return { denom, enabled } } public static fromData(data: SendEnabled.Data): SendEnabled { - const { denom, enabled } = data; - return new SendEnabled(denom, enabled); + const { denom, enabled } = data + return new SendEnabled(denom, enabled) } public toData(): SendEnabled.Data { - const { denom, enabled } = this; - return { denom, enabled }; + const { denom, enabled } = this + return { denom, enabled } } public static fromProto(data: SendEnabled.Proto): SendEnabled { - return new SendEnabled(data.denom, data.enabled); + return new SendEnabled(data.denom, data.enabled) } public toProto(): SendEnabled.Proto { - const { denom, enabled } = this; + const { denom, enabled } = this return SendEnabled_pb.fromPartial({ denom, enabled, - }); + }) } } export namespace SendEnabled { export interface Amino { - denom: Denom; - enabled: boolean; + denom: Denom + enabled: boolean } export interface Data { - denom: Denom; - enabled: boolean; + denom: Denom + enabled: boolean } - export type Proto = SendEnabled_pb; + export type Proto = SendEnabled_pb } diff --git a/src/core/bank/index.ts b/src/core/bank/index.ts index b42513d..6264fc3 100644 --- a/src/core/bank/index.ts +++ b/src/core/bank/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './BankParams'; -export * from './SendEnabled'; -export * from './DenomMetadata'; -export * from './DenomUnit'; +export * from './msgs' +export * from './BankParams' +export * from './SendEnabled' +export * from './DenomMetadata' +export * from './DenomUnit' diff --git a/src/core/bank/msgs/MsgMultiSend.spec.ts b/src/core/bank/msgs/MsgMultiSend.spec.ts index d3fbd16..a7c768b 100644 --- a/src/core/bank/msgs/MsgMultiSend.spec.ts +++ b/src/core/bank/msgs/MsgMultiSend.spec.ts @@ -1,6 +1,6 @@ -import { MsgMultiSend } from './MsgMultiSend'; -import { Coins } from '../../Coins'; -import { Coin } from '../../Coin'; +import { MsgMultiSend } from './MsgMultiSend' +import { Coins } from '../../Coins' +import { Coin } from '../../Coin' const example: MsgMultiSend.Amino = { type: 'cosmos-sdk/MsgMultiSend', @@ -136,7 +136,7 @@ const example: MsgMultiSend.Amino = { }, ], }, -}; +} const proto_example: MsgMultiSend.Data = { '@type': '/cosmos.bank.v1beta1.MsgMultiSend', @@ -270,18 +270,18 @@ const proto_example: MsgMultiSend.Data = { ], }, ], -}; +} describe('MsgMultiSend', () => { it('deserialize correctly', () => { - const multisend = MsgMultiSend.fromAmino(example); - expect(multisend.toAmino()).toMatchObject(example); - }); + const multisend = MsgMultiSend.fromAmino(example) + expect(multisend.toAmino()).toMatchObject(example) + }) it('deserialize correctly proto', () => { - const multisend = MsgMultiSend.fromProto(proto_example); - expect(multisend.toData()).toMatchObject(proto_example); - }); + const multisend = MsgMultiSend.fromProto(proto_example) + expect(multisend.toData()).toMatchObject(proto_example) + }) it('can be created manually', () => { const inputs: MsgMultiSend.Input[] = [ @@ -294,7 +294,7 @@ describe('MsgMultiSend', () => { new MsgMultiSend.Input('init105rz2q5a4w7nv7239tl9c4px5cjy7axx3axfad', [ new Coin('uinit', 123123), ]), - ]; + ] const outputs: MsgMultiSend.Output[] = [ new MsgMultiSend.Output( @@ -306,8 +306,8 @@ describe('MsgMultiSend', () => { new MsgMultiSend.Output('init105rz2q5a4w7nv7239tl9c4px5cjy7axx3axfga', { uinit: 123123, }), - ]; - const multisend = new MsgMultiSend(inputs, outputs); + ] + const multisend = new MsgMultiSend(inputs, outputs) expect(multisend.toAmino()).toMatchObject({ type: 'cosmos-sdk/MsgMultiSend', value: { @@ -352,6 +352,6 @@ describe('MsgMultiSend', () => { }, ], }, - }); - }); -}); + }) + }) +}) diff --git a/src/core/bank/msgs/MsgMultiSend.ts b/src/core/bank/msgs/MsgMultiSend.ts index 021a4fd..2a2569c 100644 --- a/src/core/bank/msgs/MsgMultiSend.ts +++ b/src/core/bank/msgs/MsgMultiSend.ts @@ -1,12 +1,12 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgMultiSend as MsgMultiSend_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgMultiSend as MsgMultiSend_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx' import { Input as Input_pb, Output as Output_pb, -} from '@initia/initia.proto/cosmos/bank/v1beta1/bank'; +} from '@initia/initia.proto/cosmos/bank/v1beta1/bank' /** * If you have multiple senders and/or multiple recipients, you can use MsgMultiSend, @@ -61,90 +61,90 @@ export class MsgMultiSend extends JSONSerializable< public inputs: MsgMultiSend.Input[], public outputs: MsgMultiSend.Output[] ) { - super(); + super() } public static fromAmino(data: MsgMultiSend.Amino): MsgMultiSend { const { value: { inputs, outputs }, - } = data; + } = data return new MsgMultiSend( - inputs.map(i => MsgMultiSend.Input.fromAmino(i)), - outputs.map(o => MsgMultiSend.Output.fromAmino(o)) - ); + inputs.map((i) => MsgMultiSend.Input.fromAmino(i)), + outputs.map((o) => MsgMultiSend.Output.fromAmino(o)) + ) } public toAmino(): MsgMultiSend.Amino { - const { inputs, outputs } = this; + const { inputs, outputs } = this return { type: 'cosmos-sdk/MsgMultiSend', value: { - inputs: inputs.map(i => i.toAmino()), - outputs: outputs.map(o => o.toAmino()), + inputs: inputs.map((i) => i.toAmino()), + outputs: outputs.map((o) => o.toAmino()), }, - }; + } } public static fromData(data: MsgMultiSend.Data): MsgMultiSend { - const { inputs, outputs } = data; + const { inputs, outputs } = data return new MsgMultiSend( - inputs.map(i => MsgMultiSend.Input.fromData(i)), - outputs.map(o => MsgMultiSend.Output.fromData(o)) - ); + inputs.map((i) => MsgMultiSend.Input.fromData(i)), + outputs.map((o) => MsgMultiSend.Output.fromData(o)) + ) } public toData(): MsgMultiSend.Data { - const { inputs, outputs } = this; + const { inputs, outputs } = this return { '@type': '/cosmos.bank.v1beta1.MsgMultiSend', - inputs: inputs.map(i => i.toData()), - outputs: outputs.map(o => o.toData()), - }; + inputs: inputs.map((i) => i.toData()), + outputs: outputs.map((o) => o.toData()), + } } public static fromProto(proto: MsgMultiSend.Proto): MsgMultiSend { return new MsgMultiSend( - proto.inputs.map(i => MsgMultiSend.Input.fromProto(i)), - proto.outputs.map(o => MsgMultiSend.Output.fromProto(o)) - ); + proto.inputs.map((i) => MsgMultiSend.Input.fromProto(i)), + proto.outputs.map((o) => MsgMultiSend.Output.fromProto(o)) + ) } public toProto(): MsgMultiSend.Proto { - const { inputs, outputs } = this; + const { inputs, outputs } = this return MsgMultiSend_pb.fromPartial({ - inputs: inputs.map(i => i.toProto()), - outputs: outputs.map(i => i.toProto()), - }); + inputs: inputs.map((i) => i.toProto()), + outputs: outputs.map((i) => i.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.bank.v1beta1.MsgMultiSend', value: MsgMultiSend_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgMultiSend { - return MsgMultiSend.fromProto(MsgMultiSend_pb.decode(msgAny.value)); + return MsgMultiSend.fromProto(MsgMultiSend_pb.decode(msgAny.value)) } } export namespace MsgMultiSend { export interface Amino { - readonly type: 'cosmos-sdk/MsgMultiSend'; + readonly type: 'cosmos-sdk/MsgMultiSend' value: { - inputs: Input.Amino[]; - outputs: Output.Amino[]; - }; + inputs: Input.Amino[] + outputs: Output.Amino[] + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.MsgMultiSend'; - inputs: Input.Data[]; - outputs: Output.Data[]; + '@type': '/cosmos.bank.v1beta1.MsgMultiSend' + inputs: Input.Data[] + outputs: Output.Data[] } - export type Proto = MsgMultiSend_pb; + export type Proto = MsgMultiSend_pb export class Input extends JSONSerializable< Input.Amino, @@ -154,53 +154,56 @@ export namespace MsgMultiSend { /** * Value of the transaction */ - public coins: Coins; + public coins: Coins /** * @param address address * @param coinsInput coins-compatible input */ - constructor(public address: AccAddress, coinsInput: Coins.Input) { - super(); - this.coins = new Coins(coinsInput); + constructor( + public address: AccAddress, + coinsInput: Coins.Input + ) { + super() + this.coins = new Coins(coinsInput) } public toAmino(): Input.Amino { - const { address, coins } = this; + const { address, coins } = this return { address, coins: coins.toAmino(), - }; + } } public static fromAmino(data: Input.Amino): Input { - const { address, coins } = data; - return new Input(address, Coins.fromAmino(coins)); + const { address, coins } = data + return new Input(address, Coins.fromAmino(coins)) } public toData(): Input.Data { - const { address, coins } = this; + const { address, coins } = this return { address, coins: coins.toData(), - }; + } } public static fromData(data: Input.Data): Input { - const { address, coins } = data; - return new Input(address, Coins.fromData(coins)); + const { address, coins } = data + return new Input(address, Coins.fromData(coins)) } public toProto(): Input.Proto { - const { address, coins } = this; + const { address, coins } = this return Input_pb.fromPartial({ address, coins: coins.toProto(), - }); + }) } public static fromProto(proto: Input.Proto): Input { - return new Input(proto.address, Coins.fromProto(proto.coins)); + return new Input(proto.address, Coins.fromProto(proto.coins)) } } @@ -212,81 +215,84 @@ export namespace MsgMultiSend { /** * Value of the transaction */ - public coins: Coins; + public coins: Coins /** * @param address address * @param coinsOutput coins-compatible input */ - constructor(public address: AccAddress, coinsInput: Coins.Input) { - super(); - this.coins = new Coins(coinsInput); + constructor( + public address: AccAddress, + coinsInput: Coins.Input + ) { + super() + this.coins = new Coins(coinsInput) } public toAmino(): Output.Amino { - const { address, coins } = this; + const { address, coins } = this return { address, coins: coins.toAmino(), - }; + } } public static fromAmino(data: Output.Amino): Output { - const { address, coins } = data; - return new Output(address, Coins.fromAmino(coins)); + const { address, coins } = data + return new Output(address, Coins.fromAmino(coins)) } public toData(): Output.Data { - const { address, coins } = this; + const { address, coins } = this return { address, coins: coins.toData(), - }; + } } public static fromData(data: Output.Data): Output { - const { address, coins } = data; - return new Output(address, Coins.fromData(coins)); + const { address, coins } = data + return new Output(address, Coins.fromData(coins)) } public toProto(): Output.Proto { - const { address, coins } = this; + const { address, coins } = this return Output_pb.fromPartial({ address, coins: coins.toProto(), - }); + }) } public static fromProto(proto: Output.Proto): Output { - return new Output(proto.address, Coins.fromProto(proto.coins)); + return new Output(proto.address, Coins.fromProto(proto.coins)) } } export namespace Input { export interface Amino { - address: AccAddress; - coins: Coins.Amino; + address: AccAddress + coins: Coins.Amino } export interface Data { - address: AccAddress; - coins: Coins.Data; + address: AccAddress + coins: Coins.Data } - export type Proto = Input_pb; + export type Proto = Input_pb } export namespace Output { export interface Amino { - address: AccAddress; - coins: Coins.Amino; + address: AccAddress + coins: Coins.Amino } export interface Data { - address: AccAddress; - coins: Coins.Data; + address: AccAddress + coins: Coins.Data } - export type Proto = Output_pb; + export type Proto = Output_pb } } diff --git a/src/core/bank/msgs/MsgSend.spec.ts b/src/core/bank/msgs/MsgSend.spec.ts index f50d22b..2498bfb 100644 --- a/src/core/bank/msgs/MsgSend.spec.ts +++ b/src/core/bank/msgs/MsgSend.spec.ts @@ -1,5 +1,5 @@ -import { MsgSend } from './MsgSend'; -import { Coins } from '../../Coins'; +import { MsgSend } from './MsgSend' +import { Coins } from '../../Coins' describe('MsgSend', () => { it('deserialize correctly', () => { @@ -15,7 +15,7 @@ describe('MsgSend', () => { }, ], }, - }); + }) expect(send).toMatchObject({ from_address: 'init1y4umfuqfg76t8mfcff6zzx7elvy93jtp4xcdvw', @@ -23,7 +23,7 @@ describe('MsgSend', () => { amount: new Coins({ uinit: 8102024952, }), - }); + }) expect(send.toAmino()).toMatchObject({ type: 'cosmos-sdk/MsgSend', @@ -37,8 +37,8 @@ describe('MsgSend', () => { }, ], }, - }); - }); + }) + }) it('deserialize correctly proto', () => { const send = MsgSend.fromData({ @@ -51,7 +51,7 @@ describe('MsgSend', () => { amount: '8102024952', }, ], - }); + }) expect(send).toMatchObject({ from_address: 'init1y4umfuqfg76t8mfcff6zzx7elvy93jtp4xcdvw', @@ -59,7 +59,7 @@ describe('MsgSend', () => { amount: new Coins({ uinit: 8102024952, }), - }); + }) expect(send.toData()).toMatchObject({ '@type': '/cosmos.bank.v1beta1.MsgSend', @@ -71,6 +71,6 @@ describe('MsgSend', () => { amount: '8102024952', }, ], - }); - }); -}); + }) + }) +}) diff --git a/src/core/bank/msgs/MsgSend.ts b/src/core/bank/msgs/MsgSend.ts index 62cf0a5..81be7a2 100644 --- a/src/core/bank/msgs/MsgSend.ts +++ b/src/core/bank/msgs/MsgSend.ts @@ -1,8 +1,8 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSend as MsgSend_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSend as MsgSend_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx' /** * A basic message for sending [[Coins]] between Initia accounts. @@ -15,7 +15,7 @@ export class MsgSend extends JSONSerializable< /** * value of the transaction */ - public amount: Coins; + public amount: Coins /** * @param from_address sender's address @@ -27,19 +27,19 @@ export class MsgSend extends JSONSerializable< public to_address: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgSend.Amino): MsgSend { const { value: { from_address, to_address, amount }, - } = data; - return new MsgSend(from_address, to_address, Coins.fromAmino(amount)); + } = data + return new MsgSend(from_address, to_address, Coins.fromAmino(amount)) } public toAmino(): MsgSend.Amino { - const { from_address, to_address, amount } = this; + const { from_address, to_address, amount } = this return { type: 'cosmos-sdk/MsgSend', value: { @@ -47,23 +47,23 @@ export class MsgSend extends JSONSerializable< to_address, amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgSend.Data): MsgSend { - const { from_address, to_address, amount } = data; + const { from_address, to_address, amount } = data - return new MsgSend(from_address, to_address, Coins.fromData(amount)); + return new MsgSend(from_address, to_address, Coins.fromData(amount)) } public toData(): MsgSend.Data { - const { from_address, to_address, amount } = this; + const { from_address, to_address, amount } = this return { '@type': '/cosmos.bank.v1beta1.MsgSend', from_address, to_address, amount: amount.toData(), - }; + } } public static fromProto(proto: MsgSend.Proto): MsgSend { @@ -71,46 +71,46 @@ export class MsgSend extends JSONSerializable< proto.fromAddress, proto.toAddress, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgSend.Proto { - const { from_address, to_address, amount } = this; + const { from_address, to_address, amount } = this return MsgSend_pb.fromPartial({ fromAddress: from_address, toAddress: to_address, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.bank.v1beta1.MsgSend', value: MsgSend_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSend { - return MsgSend.fromProto(MsgSend_pb.decode(msgAny.value)); + return MsgSend.fromProto(MsgSend_pb.decode(msgAny.value)) } } export namespace MsgSend { export interface Amino { - type: 'cosmos-sdk/MsgSend'; + type: 'cosmos-sdk/MsgSend' value: { - from_address: AccAddress; - to_address: AccAddress; - amount: Coins.Amino; - }; + from_address: AccAddress + to_address: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.MsgSend'; - from_address: AccAddress; - to_address: AccAddress; - amount: Coins.Data; + '@type': '/cosmos.bank.v1beta1.MsgSend' + from_address: AccAddress + to_address: AccAddress + amount: Coins.Data } - export type Proto = MsgSend_pb; + export type Proto = MsgSend_pb } diff --git a/src/core/bank/msgs/MsgSetDenomMetadata.ts b/src/core/bank/msgs/MsgSetDenomMetadata.ts index 301819e..5e61037 100644 --- a/src/core/bank/msgs/MsgSetDenomMetadata.ts +++ b/src/core/bank/msgs/MsgSetDenomMetadata.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DenomMetadata } from '../DenomMetadata'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/initia/bank/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DenomMetadata } from '../DenomMetadata' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/initia/bank/v1/tx' export class MsgSetDenomMetadata extends JSONSerializable< MsgSetDenomMetadata.Amino, @@ -13,8 +13,11 @@ export class MsgSetDenomMetadata extends JSONSerializable< * @param authority the address that controls the module * @param metadata the x/bank denom metadata to update */ - constructor(public authority: AccAddress, public metadata: DenomMetadata) { - super(); + constructor( + public authority: AccAddress, + public metadata: DenomMetadata + ) { + super() } public static fromAmino( @@ -22,36 +25,33 @@ export class MsgSetDenomMetadata extends JSONSerializable< ): MsgSetDenomMetadata { const { value: { authority, metadata }, - } = data; - return new MsgSetDenomMetadata( - authority, - DenomMetadata.fromAmino(metadata) - ); + } = data + return new MsgSetDenomMetadata(authority, DenomMetadata.fromAmino(metadata)) } public toAmino(): MsgSetDenomMetadata.Amino { - const { authority, metadata } = this; + const { authority, metadata } = this return { type: 'bank/MsgSetDenomMetadata', value: { authority, metadata: metadata.toAmino(), }, - }; + } } public static fromData(data: MsgSetDenomMetadata.Data): MsgSetDenomMetadata { - const { authority, metadata } = data; - return new MsgSetDenomMetadata(authority, DenomMetadata.fromData(metadata)); + const { authority, metadata } = data + return new MsgSetDenomMetadata(authority, DenomMetadata.fromData(metadata)) } public toData(): MsgSetDenomMetadata.Data { - const { authority, metadata } = this; + const { authority, metadata } = this return { '@type': '/initia.bank.v1.MsgSetDenomMetadata', authority, metadata: metadata.toData(), - }; + } } public static fromProto( @@ -60,45 +60,45 @@ export class MsgSetDenomMetadata extends JSONSerializable< return new MsgSetDenomMetadata( data.authority, DenomMetadata.fromProto(data.metadata as DenomMetadata.Proto) - ); + ) } public toProto(): MsgSetDenomMetadata.Proto { - const { authority, metadata } = this; + const { authority, metadata } = this return MsgSetDenomMetadata_pb.fromPartial({ authority, metadata: metadata.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.bank.v1.MsgSetDenomMetadata', value: MsgSetDenomMetadata_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetDenomMetadata { return MsgSetDenomMetadata.fromProto( MsgSetDenomMetadata_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetDenomMetadata { export interface Amino { - type: 'bank/MsgSetDenomMetadata'; + type: 'bank/MsgSetDenomMetadata' value: { - authority: AccAddress; - metadata: DenomMetadata.Amino; - }; + authority: AccAddress + metadata: DenomMetadata.Amino + } } export interface Data { - '@type': '/initia.bank.v1.MsgSetDenomMetadata'; - authority: AccAddress; - metadata: DenomMetadata.Data; + '@type': '/initia.bank.v1.MsgSetDenomMetadata' + authority: AccAddress + metadata: DenomMetadata.Data } - export type Proto = MsgSetDenomMetadata_pb; + export type Proto = MsgSetDenomMetadata_pb } diff --git a/src/core/bank/msgs/MsgSetSendEnabled.ts b/src/core/bank/msgs/MsgSetSendEnabled.ts index 805d946..09745e6 100644 --- a/src/core/bank/msgs/MsgSetSendEnabled.ts +++ b/src/core/bank/msgs/MsgSetSendEnabled.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Denom } from '../../Denom'; -import { SendEnabled } from '../SendEnabled'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetSendEnabled as MsgSetSendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Denom } from '../../Denom' +import { SendEnabled } from '../SendEnabled' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetSendEnabled as MsgSetSendEnabled_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx' export class MsgSetSendEnabled extends JSONSerializable< MsgSetSendEnabled.Amino, @@ -20,50 +20,50 @@ export class MsgSetSendEnabled extends JSONSerializable< public send_enabled: SendEnabled[], public use_default_for: Denom[] ) { - super(); + super() } public static fromAmino(data: MsgSetSendEnabled.Amino): MsgSetSendEnabled { const { value: { authority, send_enabled, use_default_for }, - } = data; + } = data return new MsgSetSendEnabled( authority, send_enabled.map(SendEnabled.fromAmino), use_default_for - ); + ) } public toAmino(): MsgSetSendEnabled.Amino { - const { authority, send_enabled, use_default_for } = this; + const { authority, send_enabled, use_default_for } = this return { type: 'cosmos-sdk/MsgSetSendEnabled', value: { authority, - send_enabled: send_enabled.map(d => d.toAmino()), + send_enabled: send_enabled.map((d) => d.toAmino()), use_default_for, }, - }; + } } public static fromData(data: MsgSetSendEnabled.Data): MsgSetSendEnabled { - const { authority, send_enabled, use_default_for } = data; + const { authority, send_enabled, use_default_for } = data return new MsgSetSendEnabled( authority, send_enabled.map(SendEnabled.fromData), use_default_for - ); + ) } public toData(): MsgSetSendEnabled.Data { - const { authority, send_enabled, use_default_for } = this; + const { authority, send_enabled, use_default_for } = this return { '@type': '/cosmos.bank.v1beta1.MsgSetSendEnabled', authority, - send_enabled: send_enabled.map(d => d.toData()), + send_enabled: send_enabled.map((d) => d.toData()), use_default_for, - }; + } } public static fromProto(data: MsgSetSendEnabled.Proto): MsgSetSendEnabled { @@ -71,48 +71,48 @@ export class MsgSetSendEnabled extends JSONSerializable< data.authority, data.sendEnabled.map(SendEnabled.fromProto), data.useDefaultFor - ); + ) } public toProto(): MsgSetSendEnabled.Proto { - const { authority, send_enabled, use_default_for } = this; + const { authority, send_enabled, use_default_for } = this return MsgSetSendEnabled_pb.fromPartial({ authority, - sendEnabled: send_enabled.map(d => d.toProto()), + sendEnabled: send_enabled.map((d) => d.toProto()), useDefaultFor: use_default_for, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.bank.v1beta1.MsgSetSendEnabled', value: MsgSetSendEnabled_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetSendEnabled { return MsgSetSendEnabled.fromProto( MsgSetSendEnabled_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetSendEnabled { export interface Amino { - type: 'cosmos-sdk/MsgSetSendEnabled'; + type: 'cosmos-sdk/MsgSetSendEnabled' value: { - authority: AccAddress; - send_enabled: SendEnabled.Amino[]; - use_default_for: Denom[]; - }; + authority: AccAddress + send_enabled: SendEnabled.Amino[] + use_default_for: Denom[] + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.MsgSetSendEnabled'; - authority: AccAddress; - send_enabled: SendEnabled.Amino[]; - use_default_for: Denom[]; + '@type': '/cosmos.bank.v1beta1.MsgSetSendEnabled' + authority: AccAddress + send_enabled: SendEnabled.Amino[] + use_default_for: Denom[] } - export type Proto = MsgSetSendEnabled_pb; + export type Proto = MsgSetSendEnabled_pb } diff --git a/src/core/bank/msgs/MsgUpdateBankParams.ts b/src/core/bank/msgs/MsgUpdateBankParams.ts index 866dd4f..0df6738 100644 --- a/src/core/bank/msgs/MsgUpdateBankParams.ts +++ b/src/core/bank/msgs/MsgUpdateBankParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { BankParams } from '../BankParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { BankParams } from '../BankParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/bank/v1beta1/tx' export class MsgUpdateBankParams extends JSONSerializable< MsgUpdateBankParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateBankParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/bank parameters to update */ - constructor(public authority: AccAddress, public params: BankParams) { - super(); + constructor( + public authority: AccAddress, + public params: BankParams + ) { + super() } public static fromAmino( @@ -22,33 +25,33 @@ export class MsgUpdateBankParams extends JSONSerializable< ): MsgUpdateBankParams { const { value: { authority, params }, - } = data; - return new MsgUpdateBankParams(authority, BankParams.fromAmino(params)); + } = data + return new MsgUpdateBankParams(authority, BankParams.fromAmino(params)) } public toAmino(): MsgUpdateBankParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'cosmos-sdk/x/bank/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateBankParams.Data): MsgUpdateBankParams { - const { authority, params } = data; - return new MsgUpdateBankParams(authority, BankParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateBankParams(authority, BankParams.fromData(params)) } public toData(): MsgUpdateBankParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/cosmos.bank.v1beta1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -57,45 +60,45 @@ export class MsgUpdateBankParams extends JSONSerializable< return new MsgUpdateBankParams( data.authority, BankParams.fromProto(data.params as BankParams.Proto) - ); + ) } public toProto(): MsgUpdateBankParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.bank.v1beta1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateBankParams { return MsgUpdateBankParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateBankParams { export interface Amino { - type: 'cosmos-sdk/x/bank/MsgUpdateParams'; + type: 'cosmos-sdk/x/bank/MsgUpdateParams' value: { - authority: AccAddress; - params: BankParams.Amino; - }; + authority: AccAddress + params: BankParams.Amino + } } export interface Data { - '@type': '/cosmos.bank.v1beta1.MsgUpdateParams'; - authority: AccAddress; - params: BankParams.Data; + '@type': '/cosmos.bank.v1beta1.MsgUpdateParams' + authority: AccAddress + params: BankParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/bank/msgs/index.ts b/src/core/bank/msgs/index.ts index f71f6ba..efb65b3 100644 --- a/src/core/bank/msgs/index.ts +++ b/src/core/bank/msgs/index.ts @@ -1,38 +1,38 @@ -import { MsgSend } from './MsgSend'; -import { MsgMultiSend } from './MsgMultiSend'; -import { MsgUpdateBankParams } from './MsgUpdateBankParams'; -import { MsgSetSendEnabled } from './MsgSetSendEnabled'; -import { MsgSetDenomMetadata } from './MsgSetDenomMetadata'; +import { MsgSend } from './MsgSend' +import { MsgMultiSend } from './MsgMultiSend' +import { MsgUpdateBankParams } from './MsgUpdateBankParams' +import { MsgSetSendEnabled } from './MsgSetSendEnabled' +import { MsgSetDenomMetadata } from './MsgSetDenomMetadata' -export * from './MsgSend'; -export * from './MsgMultiSend'; -export * from './MsgUpdateBankParams'; -export * from './MsgSetSendEnabled'; -export * from './MsgSetDenomMetadata'; +export * from './MsgSend' +export * from './MsgMultiSend' +export * from './MsgUpdateBankParams' +export * from './MsgSetSendEnabled' +export * from './MsgSetDenomMetadata' export type BankMsg = | MsgSend | MsgMultiSend | MsgUpdateBankParams | MsgSetSendEnabled - | MsgSetDenomMetadata; + | MsgSetDenomMetadata export namespace BankMsg { export type Amino = | MsgSend.Amino | MsgMultiSend.Amino | MsgUpdateBankParams.Amino | MsgSetSendEnabled.Amino - | MsgSetDenomMetadata.Amino; + | MsgSetDenomMetadata.Amino export type Data = | MsgSend.Data | MsgMultiSend.Data | MsgUpdateBankParams.Data | MsgSetSendEnabled.Data - | MsgSetDenomMetadata.Data; + | MsgSetDenomMetadata.Data export type Proto = | MsgSend.Proto | MsgMultiSend.Proto | MsgUpdateBankParams.Proto | MsgSetSendEnabled.Proto - | MsgSetDenomMetadata.Proto; + | MsgSetDenomMetadata.Proto } diff --git a/src/core/bech32.spec.ts b/src/core/bech32.spec.ts index b815851..beb82ad 100644 --- a/src/core/bech32.spec.ts +++ b/src/core/bech32.spec.ts @@ -4,59 +4,59 @@ import { AccPubKey, ValPubKey, ValConsAddress, -} from './bech32'; -import { bech32 } from 'bech32'; +} from './bech32' +import { bech32 } from 'bech32' describe('AccAddress', () => { it('validates account address', () => { expect( AccAddress.validate('initvaloper1pdx498r0hrc2fj36sjhs8vuhrz9hd2cw0yhqtk') - ).toBe(false); + ).toBe(false) expect( AccAddress.validate('init1pdx498r0h7c2fj36sjhs8vu8rz9hd2cw0tmam9') - ).toBe(false); // bad checksum + ).toBe(false) // bad checksum expect( AccAddress.validate('cosmos176m2p8l3fps3dal7h8gf9jvrv98tu3rqfdht86') - ).toBe(false); + ).toBe(false) - const words = bech32.toWords(Buffer.from('foobar', 'utf8')); - const badAddress = bech32.encode('init', words); + const words = bech32.toWords(Buffer.from('foobar', 'utf8')) + const badAddress = bech32.encode('init', words) - expect(AccAddress.validate(badAddress)).toBe(false); + expect(AccAddress.validate(badAddress)).toBe(false) expect( AccAddress.validate('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') - ).toBe(true); - }); + ).toBe(true) + }) it('converts from validator address', () => { expect( AccAddress.fromValAddress( 'initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q' ) - ).toEqual('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs'); - }); -}); + ).toEqual('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') + }) +}) describe('ValAddress', () => { it('validates validator address', () => { - const words = bech32.toWords(Buffer.from('foobar', 'utf8')); - const badAddress = bech32.encode('initvaloper', words); + const words = bech32.toWords(Buffer.from('foobar', 'utf8')) + const badAddress = bech32.encode('initvaloper', words) - expect(ValAddress.validate(badAddress)).toBe(false); + expect(ValAddress.validate(badAddress)).toBe(false) expect( ValAddress.validate('initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q') - ).toBe(true); - }); + ).toBe(true) + }) it('converts from account address', () => { expect( ValAddress.fromAccAddress('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') - ).toEqual('initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q'); - }); -}); + ).toEqual('initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q') + }) +}) describe('AccPubKey', () => { it('validates account pubkey', () => { @@ -64,23 +64,23 @@ describe('AccPubKey', () => { AccPubKey.validate( 'initvaloperpub1addwnpepqt8ha594svjn3nvfk4ggfn5n8xd3sm3cz6ztxyugwcuqzsuuhhfq5y7accr' ) - ).toBe(false); + ).toBe(false) - const words = bech32.toWords(Buffer.from('foobar', 'utf8')); - const badPubKey = bech32.encode('initpub', words); + const words = bech32.toWords(Buffer.from('foobar', 'utf8')) + const badPubKey = bech32.encode('initpub', words) - expect(AccPubKey.validate(badPubKey)).toBe(false); + expect(AccPubKey.validate(badPubKey)).toBe(false) expect( AccPubKey.validate('initpub1wlvk4e083pd3nddlfe5quy56e68atra352764k') - ).toBe(true); - }); + ).toBe(true) + }) it('converts from validator pubkey', () => { expect( AccPubKey.fromAccAddress('init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs') - ).toEqual('initpub1wlvk4e083pd3nddlfe5quy56e68atra352764k'); - }); -}); + ).toEqual('initpub1wlvk4e083pd3nddlfe5quy56e68atra352764k') + }) +}) describe('ValPubKey', () => { it('validates validator pubkey', () => { @@ -88,25 +88,25 @@ describe('ValPubKey', () => { ValPubKey.validate( 'initvaloperpub1wlvk4e083pd3nddlfe5quy56e68atra3sx35rr' ) - ).toBe(true); + ).toBe(true) - const words = bech32.toWords(Buffer.from('foobar', 'utf8')); - const badPubKey = bech32.encode('initpub', words); + const words = bech32.toWords(Buffer.from('foobar', 'utf8')) + const badPubKey = bech32.encode('initpub', words) - expect(ValPubKey.validate(badPubKey)).toBe(false); + expect(ValPubKey.validate(badPubKey)).toBe(false) expect( ValPubKey.validate('initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q') - ).toBe(false); - }); + ).toBe(false) + }) it('converts from validator address', () => { expect( ValPubKey.fromValAddress( 'initvaloper1wlvk4e083pd3nddlfe5quy56e68atra3ueul8q' ) - ).toEqual('initvaloperpub1wlvk4e083pd3nddlfe5quy56e68atra3sx35rr'); - }); -}); + ).toEqual('initvaloperpub1wlvk4e083pd3nddlfe5quy56e68atra3sx35rr') + }) +}) describe('ValConsAddress', () => { it('validate validator consensus address', () => { @@ -114,6 +114,6 @@ describe('ValConsAddress', () => { ValConsAddress.validate( 'initvalcons1wlvk4e083pd3nddlfe5quy56e68atra3g20rtp' ) - ).toBeTruthy(); - }); -}); + ).toBeTruthy() + }) +}) diff --git a/src/core/bech32.ts b/src/core/bech32.ts index 9e68583..bbb5be1 100644 --- a/src/core/bech32.ts +++ b/src/core/bech32.ts @@ -1,19 +1,19 @@ -import { bech32 } from 'bech32'; +import { bech32 } from 'bech32' /** `init-` prefixed account address */ -export type AccAddress = string; +export type AccAddress = string /** `initvaloper-` prefixed validator operator address */ -export type ValAddress = string; +export type ValAddress = string /** `initvalcons-` prefixed validator consensus address */ -export type ValConsAddress = string; +export type ValConsAddress = string /** `initpub-` prefixed account public key */ -export type AccPubKey = string; +export type AccPubKey = string /** `initvaloperpub-` prefixed validator public key */ -export type ValPubKey = string; +export type ValPubKey = string function checkPrefixAndLength( prefix: string, @@ -21,10 +21,10 @@ function checkPrefixAndLength( length: number ): boolean { try { - const vals = bech32.decode(data); - return vals.prefix === prefix && data.length == length; + const vals = bech32.decode(data) + return vals.prefix === prefix && data.length == length } catch (e) { - return false; + return false } } @@ -38,7 +38,7 @@ export namespace AccAddress { return ( checkPrefixAndLength('init', data, 43) || checkPrefixAndLength('init', data, 63) - ); + ) } /** @@ -47,8 +47,8 @@ export namespace AccAddress { * @param address validator address */ export function fromValAddress(address: ValAddress): AccAddress { - const vals = bech32.decode(address); - return bech32.encode('init', vals.words); + const vals = bech32.decode(address) + return bech32.encode('init', vals.words) } /** @@ -57,8 +57,8 @@ export namespace AccAddress { * @param address account address */ export function toHex(address: AccAddress): string { - const vals = bech32.decode(address); - return '0x' + Buffer.from(bech32.fromWords(vals.words)).toString('hex'); + const vals = bech32.decode(address) + return '0x' + Buffer.from(bech32.fromWords(vals.words)).toString('hex') } /** @@ -67,24 +67,24 @@ export namespace AccAddress { * @param hexAddress hex address */ export function fromHex(hexAddress: string): AccAddress { - const hex = hexAddress.replace(/^0x0+|^0x|^0+(?!x)/, ''); + const hex = hexAddress.replace(/^0x0+|^0x|^0+(?!x)/, '') // That moudule address reach here is nearly impossible if (hex.length <= 40) { return bech32.encode( 'init', bech32.toWords(Buffer.from(hex.padStart(40, '0'), 'hex')) - ); + ) } else { return bech32.encode( 'init', bech32.toWords(Buffer.from(hex.padStart(64, '0'), 'hex')) - ); + ) } } export function toBuffer(address: AccAddress): Buffer { - const vals = bech32.decode(address); - return Buffer.from(bech32.fromWords(vals.words)); + const vals = bech32.decode(address) + return Buffer.from(bech32.fromWords(vals.words)) } } @@ -95,7 +95,7 @@ export namespace AccPubKey { */ export function validate(data: string): boolean { - return checkPrefixAndLength('initpub', data, 46); + return checkPrefixAndLength('initpub', data, 46) } /** @@ -103,8 +103,8 @@ export namespace AccPubKey { * @param address validator pubkey to convert */ export function fromAccAddress(address: AccAddress): AccPubKey { - const vals = bech32.decode(address); - return bech32.encode('initpub', vals.words); + const vals = bech32.decode(address) + return bech32.encode('initpub', vals.words) } } @@ -115,7 +115,7 @@ export namespace ValAddress { * @param data string to check */ export function validate(data: string): boolean { - return checkPrefixAndLength('initvaloper', data, 50); + return checkPrefixAndLength('initvaloper', data, 50) } /** @@ -123,8 +123,8 @@ export namespace ValAddress { * @param address account address to convert */ export function fromAccAddress(address: AccAddress): ValAddress { - const vals = bech32.decode(address); - return bech32.encode('initvaloper', vals.words); + const vals = bech32.decode(address) + return bech32.encode('initvaloper', vals.words) } } @@ -134,7 +134,7 @@ export namespace ValPubKey { * @param data string to check */ export function validate(data: string): boolean { - return checkPrefixAndLength('initvaloperpub', data, 53); + return checkPrefixAndLength('initvaloperpub', data, 53) } /** @@ -142,8 +142,8 @@ export namespace ValPubKey { * @param valAddress account pubkey */ export function fromValAddress(valAddress: ValAddress): ValPubKey { - const vals = bech32.decode(valAddress); - return bech32.encode('initvaloperpub', vals.words); + const vals = bech32.decode(valAddress) + return bech32.encode('initvaloperpub', vals.words) } } @@ -154,6 +154,6 @@ export namespace ValConsAddress { */ export function validate(data: string): boolean { - return checkPrefixAndLength('initvalcons', data, 50); + return checkPrefixAndLength('initvalcons', data, 50) } } diff --git a/src/core/celestia/Blob.ts b/src/core/celestia/Blob.ts index e263ed4..d4926a7 100644 --- a/src/core/celestia/Blob.ts +++ b/src/core/celestia/Blob.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { Blob as Blob_pb } from '@initia/initia.proto/celestia/blob/v1/blob'; +import { JSONSerializable } from '../../util/json' +import { Blob as Blob_pb } from '@initia/initia.proto/celestia/blob/v1/blob' export class Blob extends JSONSerializable { /** @@ -14,16 +14,16 @@ export class Blob extends JSONSerializable { public share_version: number, public namespace_version: number ) { - super(); + super() } public static fromAmino(_: any): Blob { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Blob.Data): Blob { @@ -32,17 +32,17 @@ export class Blob extends JSONSerializable { data.data, Number.parseInt(data.share_version), Number.parseInt(data.namespace_version) - ); + ) } public toData(): Blob.Data { - const { namespace_id, data, share_version, namespace_version } = this; + const { namespace_id, data, share_version, namespace_version } = this return { namespace_id, data, share_version: share_version.toString(), namespace_version: namespace_version.toString(), - }; + } } public static fromProto(data: Blob.Proto): Blob { @@ -51,27 +51,27 @@ export class Blob extends JSONSerializable { Buffer.from(data.data).toString('base64'), data.shareVersion, data.namespaceVersion - ); + ) } public toProto(): Blob.Proto { - const { namespace_id, data, share_version, namespace_version } = this; + const { namespace_id, data, share_version, namespace_version } = this return Blob_pb.fromPartial({ namespaceId: Buffer.from(namespace_id, 'base64'), data: Buffer.from(data, 'base64'), shareVersion: share_version, namespaceVersion: namespace_version, - }); + }) } } export namespace Blob { export interface Data { - namespace_id: string; - data: string; - share_version: string; - namespace_version: string; + namespace_id: string + data: string + share_version: string + namespace_version: string } - export type Proto = Blob_pb; + export type Proto = Blob_pb } diff --git a/src/core/celestia/BlobTx.ts b/src/core/celestia/BlobTx.ts index ffa2f3b..2e43646 100644 --- a/src/core/celestia/BlobTx.ts +++ b/src/core/celestia/BlobTx.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { Tx } from '../tx/Tx'; -import { Blob } from './Blob'; -import { BlobTx as BlobTx_pb } from '@initia/initia.proto/celestia/blob/v1/blob'; +import { JSONSerializable } from '../../util/json' +import { Tx } from '../tx/Tx' +import { Blob } from './Blob' +import { BlobTx as BlobTx_pb } from '@initia/initia.proto/celestia/blob/v1/blob' export class BlobTx extends JSONSerializable { /** @@ -9,31 +9,35 @@ export class BlobTx extends JSONSerializable { * @param blobs * @param type_id */ - constructor(public tx: Tx, public blobs: Blob[], public type_id: string) { - super(); + constructor( + public tx: Tx, + public blobs: Blob[], + public type_id: string + ) { + super() } public static fromAmino(_: any): BlobTx { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: BlobTx.Data): BlobTx { - const { tx, blobs, type_id } = data; - return new BlobTx(Tx.fromData(tx), blobs.map(Blob.fromData), type_id); + const { tx, blobs, type_id } = data + return new BlobTx(Tx.fromData(tx), blobs.map(Blob.fromData), type_id) } public toData(): BlobTx.Data { - const { tx, blobs, type_id } = this; + const { tx, blobs, type_id } = this return { tx: tx.toData(), - blobs: blobs.map(blob => blob.toData()), + blobs: blobs.map((blob) => blob.toData()), type_id, - }; + } } public static fromProto(data: BlobTx.Proto): BlobTx { @@ -41,29 +45,29 @@ export class BlobTx extends JSONSerializable { Tx.fromBuffer(Buffer.from(data.tx)), data.blobs.map(Blob.fromProto), data.typeId - ); + ) } public toProto(): BlobTx.Proto { - const { tx, blobs, type_id } = this; + const { tx, blobs, type_id } = this return BlobTx_pb.fromPartial({ tx: tx.toBytes(), - blobs: blobs.map(blob => blob.toProto()), + blobs: blobs.map((blob) => blob.toProto()), typeId: type_id, - }); + }) } public toBytes(): Uint8Array { - return BlobTx_pb.encode(this.toProto()).finish(); + return BlobTx_pb.encode(this.toProto()).finish() } } export namespace BlobTx { export interface Data { - tx: Tx.Data; - blobs: Blob.Data[]; - type_id: string; + tx: Tx.Data + blobs: Blob.Data[] + type_id: string } - export type Proto = BlobTx_pb; + export type Proto = BlobTx_pb } diff --git a/src/core/celestia/index.ts b/src/core/celestia/index.ts index 9021742..de5bbea 100644 --- a/src/core/celestia/index.ts +++ b/src/core/celestia/index.ts @@ -1,3 +1,3 @@ -export * from './msgs'; -export * from './Blob'; -export * from './BlobTx'; +export * from './msgs' +export * from './Blob' +export * from './BlobTx' diff --git a/src/core/celestia/msgs/MsgPayForBlobs.ts b/src/core/celestia/msgs/MsgPayForBlobs.ts index 3599982..3ec59c6 100644 --- a/src/core/celestia/msgs/MsgPayForBlobs.ts +++ b/src/core/celestia/msgs/MsgPayForBlobs.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgPayForBlobs as MsgPayForBlobs_pb } from '@initia/initia.proto/celestia/blob/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgPayForBlobs as MsgPayForBlobs_pb } from '@initia/initia.proto/celestia/blob/v1/tx' export class MsgPayForBlobs extends JSONSerializable< any, @@ -22,16 +22,16 @@ export class MsgPayForBlobs extends JSONSerializable< public share_commitments: string[], public share_versions: number[] ) { - super(); + super() } public static fromAmino(_: any): MsgPayForBlobs { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgPayForBlobs.Data): MsgPayForBlobs { @@ -41,14 +41,14 @@ export class MsgPayForBlobs extends JSONSerializable< blob_sizes, share_commitments, share_versions, - } = data; + } = data return new MsgPayForBlobs( signer, namespaces, blob_sizes.map(Number.parseInt), share_commitments, share_versions.map(Number.parseInt) - ); + ) } public toData(): MsgPayForBlobs.Data { @@ -58,29 +58,29 @@ export class MsgPayForBlobs extends JSONSerializable< blob_sizes, share_commitments, share_versions, - } = this; + } = this return { '@type': '/celestia.blob.v1.MsgPayForBlobs', signer, namespaces, - blob_sizes: blob_sizes.map(size => size.toString()), + blob_sizes: blob_sizes.map((size) => size.toString()), share_commitments, - share_versions: share_versions.map(version => version.toString()), - }; + share_versions: share_versions.map((version) => version.toString()), + } } public static fromProto(data: MsgPayForBlobs.Proto): MsgPayForBlobs { return new MsgPayForBlobs( data.signer, - data.namespaces.map(namespace => + data.namespaces.map((namespace) => Buffer.from(namespace).toString('base64') ), data.blobSizes, - data.shareCommitments.map(commitment => + data.shareCommitments.map((commitment) => Buffer.from(commitment).toString('base64') ), data.shareVersions - ); + ) } public toProto(): MsgPayForBlobs.Proto { @@ -90,39 +90,41 @@ export class MsgPayForBlobs extends JSONSerializable< blob_sizes, share_commitments, share_versions, - } = this; + } = this return MsgPayForBlobs_pb.fromPartial({ signer, - namespaces: namespaces.map(namespace => Buffer.from(namespace, 'base64')), + namespaces: namespaces.map((namespace) => + Buffer.from(namespace, 'base64') + ), blobSizes: blob_sizes, - shareCommitments: share_commitments.map(commitment => + shareCommitments: share_commitments.map((commitment) => Buffer.from(commitment, 'base64') ), shareVersions: share_versions, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/celestia.blob.v1.MsgPayForBlobs', value: MsgPayForBlobs_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgPayForBlobs { - return MsgPayForBlobs.fromProto(MsgPayForBlobs_pb.decode(msgAny.value)); + return MsgPayForBlobs.fromProto(MsgPayForBlobs_pb.decode(msgAny.value)) } } export namespace MsgPayForBlobs { export interface Data { - '@type': '/celestia.blob.v1.MsgPayForBlobs'; - signer: AccAddress; - namespaces: string[]; - blob_sizes: string[]; - share_commitments: string[]; - share_versions: string[]; + '@type': '/celestia.blob.v1.MsgPayForBlobs' + signer: AccAddress + namespaces: string[] + blob_sizes: string[] + share_commitments: string[] + share_versions: string[] } - export type Proto = MsgPayForBlobs_pb; + export type Proto = MsgPayForBlobs_pb } diff --git a/src/core/celestia/msgs/index.ts b/src/core/celestia/msgs/index.ts index 76453d6..404e6da 100644 --- a/src/core/celestia/msgs/index.ts +++ b/src/core/celestia/msgs/index.ts @@ -1,10 +1,10 @@ -import { MsgPayForBlobs } from './MsgPayForBlobs'; +import { MsgPayForBlobs } from './MsgPayForBlobs' -export * from './MsgPayForBlobs'; +export * from './MsgPayForBlobs' -export type CelestiaMsg = MsgPayForBlobs; +export type CelestiaMsg = MsgPayForBlobs export namespace CelestiaMsg { - export type Data = MsgPayForBlobs.Data; - export type Proto = MsgPayForBlobs.Proto; + export type Data = MsgPayForBlobs.Data + export type Proto = MsgPayForBlobs.Proto } diff --git a/src/core/consensus/ABCIParams.ts b/src/core/consensus/ABCIParams.ts index 9054ec8..de9b50e 100644 --- a/src/core/consensus/ABCIParams.ts +++ b/src/core/consensus/ABCIParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { ABCIParams as ABCIParams_pb } from '@initia/initia.proto/tendermint/types/params'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { ABCIParams as ABCIParams_pb } from '@initia/initia.proto/tendermint/types/params' +import Long from 'long' export class ABCIParams extends JSONSerializable< ABCIParams.Amino, @@ -11,33 +11,33 @@ export class ABCIParams extends JSONSerializable< * @param vote_extensions_enable_height */ constructor(public vote_extensions_enable_height: number) { - super(); + super() } public static fromAmino(data: ABCIParams.Amino): ABCIParams { - return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height)); + return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height)) } public toAmino(): ABCIParams.Amino { return { vote_extensions_enable_height: this.vote_extensions_enable_height.toString(), - }; + } } public static fromData(data: ABCIParams.Data): ABCIParams { - return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height)); + return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height)) } public toData(): ABCIParams.Data { return { vote_extensions_enable_height: this.vote_extensions_enable_height.toString(), - }; + } } public static fromProto(data: ABCIParams.Proto): ABCIParams { - return new ABCIParams(data.voteExtensionsEnableHeight.toNumber()); + return new ABCIParams(data.voteExtensionsEnableHeight.toNumber()) } public toProto(): ABCIParams.Proto { @@ -45,18 +45,18 @@ export class ABCIParams extends JSONSerializable< voteExtensionsEnableHeight: Long.fromNumber( this.vote_extensions_enable_height ), - }); + }) } } export namespace ABCIParams { export interface Amino { - vote_extensions_enable_height: string; + vote_extensions_enable_height: string } export interface Data { - vote_extensions_enable_height: string; + vote_extensions_enable_height: string } - export type Proto = ABCIParams_pb; + export type Proto = ABCIParams_pb } diff --git a/src/core/consensus/BlockParams.ts b/src/core/consensus/BlockParams.ts index 8a83c5b..ca30d98 100644 --- a/src/core/consensus/BlockParams.ts +++ b/src/core/consensus/BlockParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { BlockParams as BlockParams_pb } from '@initia/initia.proto/tendermint/types/params'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { BlockParams as BlockParams_pb } from '@initia/initia.proto/tendermint/types/params' +import Long from 'long' export class BlockParams extends JSONSerializable< BlockParams.Amino, @@ -11,65 +11,62 @@ export class BlockParams extends JSONSerializable< * @param max_bytes Max block size in bytes, must be greater than 0 * @param max_gas Max gas per block, must be greater or equal to -1 */ - constructor(public max_bytes: number, public max_gas: number) { - super(); + constructor( + public max_bytes: number, + public max_gas: number + ) { + super() } public static fromAmino(data: BlockParams.Amino): BlockParams { - const { max_bytes, max_gas } = data; - return new BlockParams( - Number.parseInt(max_bytes), - Number.parseInt(max_gas) - ); + const { max_bytes, max_gas } = data + return new BlockParams(Number.parseInt(max_bytes), Number.parseInt(max_gas)) } public toAmino(): BlockParams.Amino { - const { max_bytes, max_gas } = this; + const { max_bytes, max_gas } = this return { max_bytes: max_bytes.toString(), max_gas: max_gas.toString(), - }; + } } public static fromData(data: BlockParams.Data): BlockParams { - const { max_bytes, max_gas } = data; - return new BlockParams( - Number.parseInt(max_bytes), - Number.parseInt(max_gas) - ); + const { max_bytes, max_gas } = data + return new BlockParams(Number.parseInt(max_bytes), Number.parseInt(max_gas)) } public toData(): BlockParams.Data { - const { max_bytes, max_gas } = this; + const { max_bytes, max_gas } = this return { max_bytes: max_bytes.toString(), max_gas: max_gas.toString(), - }; + } } public static fromProto(data: BlockParams.Proto): BlockParams { - return new BlockParams(data.maxBytes.toNumber(), data.maxGas.toNumber()); + return new BlockParams(data.maxBytes.toNumber(), data.maxGas.toNumber()) } public toProto(): BlockParams.Proto { - const { max_bytes, max_gas } = this; + const { max_bytes, max_gas } = this return BlockParams_pb.fromPartial({ maxBytes: Long.fromNumber(max_bytes), maxGas: Long.fromNumber(max_gas), - }); + }) } } export namespace BlockParams { export interface Amino { - max_bytes: string; - max_gas: string; + max_bytes: string + max_gas: string } export interface Data { - max_bytes: string; - max_gas: string; + max_bytes: string + max_gas: string } - export type Proto = BlockParams_pb; + export type Proto = BlockParams_pb } diff --git a/src/core/consensus/EvidenceParams.ts b/src/core/consensus/EvidenceParams.ts index b8c4637..b68e145 100644 --- a/src/core/consensus/EvidenceParams.ts +++ b/src/core/consensus/EvidenceParams.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { Duration } from '../Duration'; -import { EvidenceParams as EvidenceParams_pb } from '@initia/initia.proto/tendermint/types/params'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Duration } from '../Duration' +import { EvidenceParams as EvidenceParams_pb } from '@initia/initia.proto/tendermint/types/params' +import Long from 'long' export class EvidenceParams extends JSONSerializable< EvidenceParams.Amino, @@ -18,43 +18,43 @@ export class EvidenceParams extends JSONSerializable< public max_age_duration: Duration, public max_bytes: number ) { - super(); + super() } public static fromAmino(data: EvidenceParams.Amino): EvidenceParams { - const { max_age_num_blocks, max_age_duration, max_bytes } = data; + const { max_age_num_blocks, max_age_duration, max_bytes } = data return new EvidenceParams( Number.parseInt(max_age_num_blocks), Duration.fromAmino(max_age_duration), Number.parseInt(max_bytes) - ); + ) } public toAmino(): EvidenceParams.Amino { - const { max_age_num_blocks, max_age_duration, max_bytes } = this; + const { max_age_num_blocks, max_age_duration, max_bytes } = this return { max_age_num_blocks: max_age_num_blocks.toString(), max_age_duration: max_age_duration.toAmino(), max_bytes: max_bytes.toString(), - }; + } } public static fromData(data: EvidenceParams.Data): EvidenceParams { - const { max_age_num_blocks, max_age_duration, max_bytes } = data; + const { max_age_num_blocks, max_age_duration, max_bytes } = data return new EvidenceParams( Number.parseInt(max_age_num_blocks), Duration.fromData(max_age_duration), Number.parseInt(max_bytes) - ); + ) } public toData(): EvidenceParams.Data { - const { max_age_num_blocks, max_age_duration, max_bytes } = this; + const { max_age_num_blocks, max_age_duration, max_bytes } = this return { max_age_num_blocks: max_age_num_blocks.toString(), max_age_duration: max_age_duration.toData(), max_bytes: max_bytes.toString(), - }; + } } public static fromProto(data: EvidenceParams.Proto): EvidenceParams { @@ -62,31 +62,31 @@ export class EvidenceParams extends JSONSerializable< data.maxAgeNumBlocks.toNumber(), Duration.fromProto(data.maxAgeDuration as Duration.Proto), data.maxBytes.toNumber() - ); + ) } public toProto(): EvidenceParams.Proto { - const { max_age_num_blocks, max_age_duration, max_bytes } = this; + const { max_age_num_blocks, max_age_duration, max_bytes } = this return EvidenceParams_pb.fromPartial({ maxAgeNumBlocks: Long.fromNumber(max_age_num_blocks), maxAgeDuration: max_age_duration.toProto(), maxBytes: Long.fromNumber(max_bytes), - }); + }) } } export namespace EvidenceParams { export interface Amino { - max_age_num_blocks: string; - max_age_duration: Duration.Amino; - max_bytes: string; + max_age_num_blocks: string + max_age_duration: Duration.Amino + max_bytes: string } export interface Data { - max_age_num_blocks: string; - max_age_duration: Duration.Data; - max_bytes: string; + max_age_num_blocks: string + max_age_duration: Duration.Data + max_bytes: string } - export type Proto = EvidenceParams_pb; + export type Proto = EvidenceParams_pb } diff --git a/src/core/consensus/ValidatorParams.ts b/src/core/consensus/ValidatorParams.ts index 53c03db..6ba1e02 100644 --- a/src/core/consensus/ValidatorParams.ts +++ b/src/core/consensus/ValidatorParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { ValidatorParams as ValidatorParams_pb } from '@initia/initia.proto/tendermint/types/params'; +import { JSONSerializable } from '../../util/json' +import { ValidatorParams as ValidatorParams_pb } from '@initia/initia.proto/tendermint/types/params' export class ValidatorParams extends JSONSerializable< ValidatorParams.Amino, @@ -10,48 +10,48 @@ export class ValidatorParams extends JSONSerializable< * @param pub_key_types */ constructor(public pub_key_types: string[]) { - super(); + super() } public static fromAmino(data: ValidatorParams.Amino): ValidatorParams { - return new ValidatorParams(data.pub_key_types); + return new ValidatorParams(data.pub_key_types) } public toAmino(): ValidatorParams.Amino { return { pub_key_types: this.pub_key_types, - }; + } } public static fromData(data: ValidatorParams.Data): ValidatorParams { - return new ValidatorParams(data.pub_key_types); + return new ValidatorParams(data.pub_key_types) } public toData(): ValidatorParams.Data { return { pub_key_types: this.pub_key_types, - }; + } } public static fromProto(data: ValidatorParams.Proto): ValidatorParams { - return new ValidatorParams(data.pubKeyTypes); + return new ValidatorParams(data.pubKeyTypes) } public toProto(): ValidatorParams.Proto { return ValidatorParams_pb.fromPartial({ pubKeyTypes: this.pub_key_types, - }); + }) } } export namespace ValidatorParams { export interface Amino { - pub_key_types: string[]; + pub_key_types: string[] } export interface Data { - pub_key_types: string[]; + pub_key_types: string[] } - export type Proto = ValidatorParams_pb; + export type Proto = ValidatorParams_pb } diff --git a/src/core/consensus/index.ts b/src/core/consensus/index.ts index f2d8b29..1e3077e 100644 --- a/src/core/consensus/index.ts +++ b/src/core/consensus/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './BlockParams'; -export * from './EvidenceParams'; -export * from './ValidatorParams'; -export * from './ABCIParams'; +export * from './msgs' +export * from './BlockParams' +export * from './EvidenceParams' +export * from './ValidatorParams' +export * from './ABCIParams' diff --git a/src/core/consensus/msgs/MsgUpdateConsensusParams.ts b/src/core/consensus/msgs/MsgUpdateConsensusParams.ts index 0888ac8..ff84d98 100644 --- a/src/core/consensus/msgs/MsgUpdateConsensusParams.ts +++ b/src/core/consensus/msgs/MsgUpdateConsensusParams.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { BlockParams } from '../BlockParams'; -import { EvidenceParams } from '../EvidenceParams'; -import { ValidatorParams } from '../ValidatorParams'; -import { ABCIParams } from '../ABCIParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/consensus/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { BlockParams } from '../BlockParams' +import { EvidenceParams } from '../EvidenceParams' +import { ValidatorParams } from '../ValidatorParams' +import { ABCIParams } from '../ABCIParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/consensus/v1/tx' export class MsgUpdateConsensusParams extends JSONSerializable< MsgUpdateConsensusParams.Amino, @@ -26,7 +26,7 @@ export class MsgUpdateConsensusParams extends JSONSerializable< public validator?: ValidatorParams, public abci?: ABCIParams ) { - super(); + super() } public static fromAmino( @@ -34,18 +34,18 @@ export class MsgUpdateConsensusParams extends JSONSerializable< ): MsgUpdateConsensusParams { const { value: { authority, block, evidence, validator, abci }, - } = data; + } = data return new MsgUpdateConsensusParams( authority, block ? BlockParams.fromAmino(block) : undefined, evidence ? EvidenceParams.fromAmino(evidence) : undefined, validator ? ValidatorParams.fromAmino(validator) : undefined, abci ? ABCIParams.fromAmino(abci) : undefined - ); + ) } public toAmino(): MsgUpdateConsensusParams.Amino { - const { authority, block, evidence, validator, abci } = this; + const { authority, block, evidence, validator, abci } = this return { type: 'cosmos-sdk/x/consensus/MsgUpdateParams', value: { @@ -55,24 +55,24 @@ export class MsgUpdateConsensusParams extends JSONSerializable< validator: validator?.toAmino(), abci: abci?.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateConsensusParams.Data ): MsgUpdateConsensusParams { - const { authority, block, evidence, validator, abci } = data; + const { authority, block, evidence, validator, abci } = data return new MsgUpdateConsensusParams( authority, block ? BlockParams.fromData(block) : undefined, evidence ? EvidenceParams.fromData(evidence) : undefined, validator ? ValidatorParams.fromData(validator) : undefined, abci ? ABCIParams.fromData(abci) : undefined - ); + ) } public toData(): MsgUpdateConsensusParams.Data { - const { authority, block, evidence, validator, abci } = this; + const { authority, block, evidence, validator, abci } = this return { '@type': '/cosmos.consensus.v1.MsgUpdateParams', authority, @@ -80,7 +80,7 @@ export class MsgUpdateConsensusParams extends JSONSerializable< evidence: evidence?.toData(), validator: validator?.toData(), abci: abci?.toData(), - }; + } } public static fromProto( @@ -92,54 +92,54 @@ export class MsgUpdateConsensusParams extends JSONSerializable< EvidenceParams.fromProto(data.evidence as EvidenceParams.Proto), ValidatorParams.fromProto(data.validator as ValidatorParams.Proto), ABCIParams.fromProto(data.abci as ABCIParams.Proto) - ); + ) } public toProto(): MsgUpdateConsensusParams.Proto { - const { authority, block, evidence, validator, abci } = this; + const { authority, block, evidence, validator, abci } = this return MsgUpdateParams_pb.fromPartial({ authority, block: block?.toProto(), evidence: evidence?.toProto(), validator: validator?.toProto(), abci: abci?.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.consensus.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateConsensusParams { return MsgUpdateConsensusParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateConsensusParams { export interface Amino { - type: 'cosmos-sdk/x/consensus/MsgUpdateParams'; + type: 'cosmos-sdk/x/consensus/MsgUpdateParams' value: { - authority: AccAddress; - block?: BlockParams.Amino; - evidence?: EvidenceParams.Amino; - validator?: ValidatorParams.Amino; - abci?: ABCIParams.Amino; - }; + authority: AccAddress + block?: BlockParams.Amino + evidence?: EvidenceParams.Amino + validator?: ValidatorParams.Amino + abci?: ABCIParams.Amino + } } export interface Data { - '@type': '/cosmos.consensus.v1.MsgUpdateParams'; - authority: AccAddress; - block?: BlockParams.Data; - evidence?: EvidenceParams.Data; - validator?: ValidatorParams.Data; - abci?: ABCIParams.Data; + '@type': '/cosmos.consensus.v1.MsgUpdateParams' + authority: AccAddress + block?: BlockParams.Data + evidence?: EvidenceParams.Data + validator?: ValidatorParams.Data + abci?: ABCIParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/consensus/msgs/index.ts b/src/core/consensus/msgs/index.ts index ecf5fa9..91f0fa2 100644 --- a/src/core/consensus/msgs/index.ts +++ b/src/core/consensus/msgs/index.ts @@ -1,10 +1,10 @@ -import { MsgUpdateConsensusParams } from './MsgUpdateConsensusParams'; +import { MsgUpdateConsensusParams } from './MsgUpdateConsensusParams' -export * from './MsgUpdateConsensusParams'; +export * from './MsgUpdateConsensusParams' -export type ConsensusMsg = MsgUpdateConsensusParams; +export type ConsensusMsg = MsgUpdateConsensusParams export namespace ConsensusMsg { - export type Amino = MsgUpdateConsensusParams.Amino; - export type Data = MsgUpdateConsensusParams.Data; - export type Proto = MsgUpdateConsensusParams.Proto; + export type Amino = MsgUpdateConsensusParams.Amino + export type Data = MsgUpdateConsensusParams.Data + export type Proto = MsgUpdateConsensusParams.Proto } diff --git a/src/core/crisis/index.ts b/src/core/crisis/index.ts index 231cb79..01eded2 100644 --- a/src/core/crisis/index.ts +++ b/src/core/crisis/index.ts @@ -1 +1 @@ -export * from './msgs'; +export * from './msgs' diff --git a/src/core/crisis/msgs/MsgUpdateCrisisParams.ts b/src/core/crisis/msgs/MsgUpdateCrisisParams.ts index f2cbf02..80bb6db 100644 --- a/src/core/crisis/msgs/MsgUpdateCrisisParams.ts +++ b/src/core/crisis/msgs/MsgUpdateCrisisParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/crisis/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/crisis/v1beta1/tx' export class MsgUpdateCrisisParams extends JSONSerializable< MsgUpdateCrisisParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateCrisisParams extends JSONSerializable< * @param authority the address that controls the module * @param constant_fee constant_fee defines the x/crisis parameters to update */ - constructor(public authority: AccAddress, public constant_fee: Coin) { - super(); + constructor( + public authority: AccAddress, + public constant_fee: Coin + ) { + super() } public static fromAmino( @@ -22,35 +25,35 @@ export class MsgUpdateCrisisParams extends JSONSerializable< ): MsgUpdateCrisisParams { const { value: { authority, constant_fee }, - } = data; - return new MsgUpdateCrisisParams(authority, Coin.fromAmino(constant_fee)); + } = data + return new MsgUpdateCrisisParams(authority, Coin.fromAmino(constant_fee)) } public toAmino(): MsgUpdateCrisisParams.Amino { - const { authority, constant_fee } = this; + const { authority, constant_fee } = this return { type: 'cosmos-sdk/x/crisis/MsgUpdateParams', value: { authority, constant_fee: constant_fee.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateCrisisParams.Data ): MsgUpdateCrisisParams { - const { authority, constant_fee } = data; - return new MsgUpdateCrisisParams(authority, Coin.fromData(constant_fee)); + const { authority, constant_fee } = data + return new MsgUpdateCrisisParams(authority, Coin.fromData(constant_fee)) } public toData(): MsgUpdateCrisisParams.Data { - const { authority, constant_fee } = this; + const { authority, constant_fee } = this return { '@type': '/cosmos.crisis.v1beta1.MsgUpdateParams', authority, constant_fee: constant_fee.toData(), - }; + } } public static fromProto( @@ -59,45 +62,45 @@ export class MsgUpdateCrisisParams extends JSONSerializable< return new MsgUpdateCrisisParams( data.authority, Coin.fromProto(data.constantFee as Coin.Proto) - ); + ) } public toProto(): MsgUpdateCrisisParams.Proto { - const { authority, constant_fee } = this; + const { authority, constant_fee } = this return MsgUpdateParams_pb.fromPartial({ authority, constantFee: constant_fee.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.crisis.v1beta1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateCrisisParams { return MsgUpdateCrisisParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateCrisisParams { export interface Amino { - type: 'cosmos-sdk/x/crisis/MsgUpdateParams'; + type: 'cosmos-sdk/x/crisis/MsgUpdateParams' value: { - authority: AccAddress; - constant_fee: Coin.Amino; - }; + authority: AccAddress + constant_fee: Coin.Amino + } } export interface Data { - '@type': '/cosmos.crisis.v1beta1.MsgUpdateParams'; - authority: AccAddress; - constant_fee: Coin.Data; + '@type': '/cosmos.crisis.v1beta1.MsgUpdateParams' + authority: AccAddress + constant_fee: Coin.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts b/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts index eeeb1b2..7fe71e5 100644 --- a/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts +++ b/src/core/crisis/msgs/MsgVerifyInvariant.spec.ts @@ -1,4 +1,4 @@ -import { MsgVerifyInvariant } from './MsgVerifyInvariant'; +import { MsgVerifyInvariant } from './MsgVerifyInvariant' describe('MsgVerifyInvariant', () => { it('deserialize correctly', () => { @@ -9,14 +9,14 @@ describe('MsgVerifyInvariant', () => { invariantModuleName: 'bank', invariantRoute: 'nonnegative-outstanding-supply', }, - }); + }) expect(send).toMatchObject({ sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', invariantModuleName: 'bank', invariantRoute: 'nonnegative-outstanding-supply', - }); - }); + }) + }) it('deserialize correctly proto', () => { const send = MsgVerifyInvariant.fromData({ @@ -24,29 +24,29 @@ describe('MsgVerifyInvariant', () => { sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', invariantModuleName: 'bank', invariantRoute: 'nonnegative-outstanding-supply', - }); + }) expect(send).toMatchObject({ sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', invariantModuleName: 'bank', invariantRoute: 'nonnegative-outstanding-supply', - }); + }) expect(send.toData()).toMatchObject({ '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant', sender: 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', invariantModuleName: 'bank', invariantRoute: 'nonnegative-outstanding-supply', - }); - }); + }) + }) it('not allowed conversion to amino/proto', () => { const Msg = new MsgVerifyInvariant( 'init1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v', 'bank', 'nonnegative-outstanding-supply' - ); - expect(Msg.toAmino).toThrow(/MsgVerifyInvarant is not allowed to send/); - expect(Msg.toProto).toThrow(/MsgVerifyInvarant is not allowed to send/); - }); -}); + ) + expect(Msg.toAmino).toThrow(/MsgVerifyInvarant is not allowed to send/) + expect(Msg.toProto).toThrow(/MsgVerifyInvarant is not allowed to send/) + }) +}) diff --git a/src/core/crisis/msgs/MsgVerifyInvariant.ts b/src/core/crisis/msgs/MsgVerifyInvariant.ts index c21fee5..fb71a21 100644 --- a/src/core/crisis/msgs/MsgVerifyInvariant.ts +++ b/src/core/crisis/msgs/MsgVerifyInvariant.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgVerifyInvariant as MsgVerifyInvariant_pb } from '@initia/initia.proto/cosmos/crisis/v1beta1/tx'; -import { AccAddress } from '../../bech32'; +import { JSONSerializable } from '../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgVerifyInvariant as MsgVerifyInvariant_pb } from '@initia/initia.proto/cosmos/crisis/v1beta1/tx' +import { AccAddress } from '../../bech32' /** * MsgVerifyInvariant represents a message to verify a particular invariance. @@ -21,34 +21,34 @@ export class MsgVerifyInvariant extends JSONSerializable< public invariantModuleName: string, public invariantRoute: string ) { - super(); + super() } public static fromAmino(data: MsgVerifyInvariant.Amino): MsgVerifyInvariant { const { value: { sender, invariantModuleName, invariantRoute }, - } = data; - return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute); + } = data + return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute) } public toAmino(): MsgVerifyInvariant.Amino { - throw new Error('MsgVerifyInvarant is not allowed to send'); + throw new Error('MsgVerifyInvarant is not allowed to send') } public static fromData(data: MsgVerifyInvariant.Data): MsgVerifyInvariant { - const { sender, invariantModuleName, invariantRoute } = data; + const { sender, invariantModuleName, invariantRoute } = data - return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute); + return new MsgVerifyInvariant(sender, invariantModuleName, invariantRoute) } public toData(): MsgVerifyInvariant.Data { - const { sender, invariantModuleName, invariantRoute } = this; + const { sender, invariantModuleName, invariantRoute } = this return { '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant', sender, invariantModuleName, invariantRoute, - }; + } } public static fromProto(proto: MsgVerifyInvariant.Proto): MsgVerifyInvariant { @@ -56,43 +56,43 @@ export class MsgVerifyInvariant extends JSONSerializable< proto.sender, proto.invariantModuleName, proto.invariantRoute - ); + ) } public toProto(): MsgVerifyInvariant.Proto { - throw new Error('MsgVerifyInvarant is not allowed to send'); + throw new Error('MsgVerifyInvarant is not allowed to send') } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.crisis.v1beta1.MsgVerifyInvariant', value: MsgVerifyInvariant_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgVerifyInvariant { return MsgVerifyInvariant.fromProto( MsgVerifyInvariant_pb.decode(msgAny.value) - ); + ) } } export namespace MsgVerifyInvariant { export interface Amino { - type: 'cosmos-sdk/MsgVerifyInvariant'; + type: 'cosmos-sdk/MsgVerifyInvariant' value: { - sender: AccAddress; - invariantModuleName: string; - invariantRoute: string; - }; + sender: AccAddress + invariantModuleName: string + invariantRoute: string + } } export interface Data { - '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant'; - sender: AccAddress; - invariantModuleName: string; - invariantRoute: string; + '@type': '/cosmos.crisis.v1beta1.MsgVerifyInvariant' + sender: AccAddress + invariantModuleName: string + invariantRoute: string } - export type Proto = MsgVerifyInvariant_pb; + export type Proto = MsgVerifyInvariant_pb } diff --git a/src/core/crisis/msgs/index.ts b/src/core/crisis/msgs/index.ts index 7073245..7e33f9a 100644 --- a/src/core/crisis/msgs/index.ts +++ b/src/core/crisis/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgVerifyInvariant } from './MsgVerifyInvariant'; -import { MsgUpdateCrisisParams } from './MsgUpdateCrisisParams'; +import { MsgVerifyInvariant } from './MsgVerifyInvariant' +import { MsgUpdateCrisisParams } from './MsgUpdateCrisisParams' -export * from './MsgVerifyInvariant'; -export * from './MsgUpdateCrisisParams'; +export * from './MsgVerifyInvariant' +export * from './MsgUpdateCrisisParams' -export type CrisisMsg = MsgVerifyInvariant | MsgUpdateCrisisParams; +export type CrisisMsg = MsgVerifyInvariant | MsgUpdateCrisisParams export namespace CrisisMsg { - export type Amino = MsgVerifyInvariant.Amino | MsgUpdateCrisisParams.Amino; - export type Data = MsgVerifyInvariant.Data | MsgUpdateCrisisParams.Data; - export type Proto = MsgVerifyInvariant.Proto | MsgUpdateCrisisParams.Proto; + export type Amino = MsgVerifyInvariant.Amino | MsgUpdateCrisisParams.Amino + export type Data = MsgVerifyInvariant.Data | MsgUpdateCrisisParams.Data + export type Proto = MsgVerifyInvariant.Proto | MsgUpdateCrisisParams.Proto } diff --git a/src/core/distribution/DistributionParams.ts b/src/core/distribution/DistributionParams.ts index c92ac7f..ea12198 100644 --- a/src/core/distribution/DistributionParams.ts +++ b/src/core/distribution/DistributionParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { RewardWeight } from './RewardWeight'; -import { Params as Params_pb } from '@initia/initia.proto/initia/distribution/v1/distribution'; +import { JSONSerializable } from '../../util/json' +import { RewardWeight } from './RewardWeight' +import { Params as Params_pb } from '@initia/initia.proto/initia/distribution/v1/distribution' export class DistributionParams extends JSONSerializable< DistributionParams.Amino, @@ -17,49 +17,49 @@ export class DistributionParams extends JSONSerializable< public withdraw_addr_enabled: boolean, public reward_weights: RewardWeight[] ) { - super(); + super() } public static fromAmino(data: DistributionParams.Amino): DistributionParams { const { value: { community_tax, withdraw_addr_enabled, reward_weights }, - } = data; + } = data return new DistributionParams( community_tax, withdraw_addr_enabled, reward_weights.map(RewardWeight.fromAmino) - ); + ) } public toAmino(): DistributionParams.Amino { - const { community_tax, withdraw_addr_enabled, reward_weights } = this; + const { community_tax, withdraw_addr_enabled, reward_weights } = this return { type: 'distribution/Params', value: { community_tax, withdraw_addr_enabled, - reward_weights: reward_weights.map(d => d.toAmino()), + reward_weights: reward_weights.map((d) => d.toAmino()), }, - }; + } } public static fromData(data: DistributionParams.Data): DistributionParams { - const { community_tax, withdraw_addr_enabled, reward_weights } = data; + const { community_tax, withdraw_addr_enabled, reward_weights } = data return new DistributionParams( community_tax, withdraw_addr_enabled, reward_weights.map(RewardWeight.fromData) - ); + ) } public toData(): DistributionParams.Data { - const { community_tax, withdraw_addr_enabled, reward_weights } = this; + const { community_tax, withdraw_addr_enabled, reward_weights } = this return { '@type': '/initia.distribution.v1.Params', community_tax, withdraw_addr_enabled, - reward_weights: reward_weights.map(d => d.toData()), - }; + reward_weights: reward_weights.map((d) => d.toData()), + } } public static fromProto(data: DistributionParams.Proto): DistributionParams { @@ -67,35 +67,35 @@ export class DistributionParams extends JSONSerializable< data.communityTax, data.withdrawAddrEnabled, data.rewardWeights.map(RewardWeight.fromProto) - ); + ) } public toProto(): DistributionParams.Proto { - const { community_tax, withdraw_addr_enabled, reward_weights } = this; + const { community_tax, withdraw_addr_enabled, reward_weights } = this return Params_pb.fromPartial({ communityTax: community_tax, withdrawAddrEnabled: withdraw_addr_enabled, - rewardWeights: reward_weights.map(d => d.toProto()), - }); + rewardWeights: reward_weights.map((d) => d.toProto()), + }) } } export namespace DistributionParams { export interface Amino { - type: 'distribution/Params'; + type: 'distribution/Params' value: { - community_tax: string; - withdraw_addr_enabled: boolean; - reward_weights: RewardWeight.Amino[]; - }; + community_tax: string + withdraw_addr_enabled: boolean + reward_weights: RewardWeight.Amino[] + } } export interface Data { - '@type': '/initia.distribution.v1.Params'; - community_tax: string; - withdraw_addr_enabled: boolean; - reward_weights: RewardWeight.Data[]; + '@type': '/initia.distribution.v1.Params' + community_tax: string + withdraw_addr_enabled: boolean + reward_weights: RewardWeight.Data[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/distribution/RewardWeight.ts b/src/core/distribution/RewardWeight.ts index 247b759..9e7fff5 100644 --- a/src/core/distribution/RewardWeight.ts +++ b/src/core/distribution/RewardWeight.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Denom } from '../Denom'; -import { RewardWeight as RewardWeight_pb } from '@initia/initia.proto/initia/distribution/v1/distribution'; +import { JSONSerializable } from '../../util/json' +import { Denom } from '../Denom' +import { RewardWeight as RewardWeight_pb } from '@initia/initia.proto/initia/distribution/v1/distribution' export class RewardWeight extends JSONSerializable< RewardWeight.Amino, @@ -11,59 +11,62 @@ export class RewardWeight extends JSONSerializable< * @param denom * @param weight */ - constructor(public denom: Denom, public weight: string) { - super(); + constructor( + public denom: Denom, + public weight: string + ) { + super() } public static fromAmino(data: RewardWeight.Amino): RewardWeight { - const { denom, weight } = data; - return new RewardWeight(denom, weight); + const { denom, weight } = data + return new RewardWeight(denom, weight) } public toAmino(): RewardWeight.Amino { - const { denom, weight } = this; + const { denom, weight } = this return { denom, weight, - }; + } } public static fromData(data: RewardWeight.Data): RewardWeight { - const { denom, weight } = data; - return new RewardWeight(denom, weight); + const { denom, weight } = data + return new RewardWeight(denom, weight) } public toData(): RewardWeight.Data { - const { denom, weight } = this; + const { denom, weight } = this return { denom, weight, - }; + } } public static fromProto(data: RewardWeight.Proto): RewardWeight { - return new RewardWeight(data.denom, data.weight); + return new RewardWeight(data.denom, data.weight) } public toProto(): RewardWeight.Proto { - const { denom, weight } = this; + const { denom, weight } = this return RewardWeight_pb.fromPartial({ denom, weight, - }); + }) } } export namespace RewardWeight { export interface Amino { - denom: Denom; - weight: string; + denom: Denom + weight: string } export interface Data { - denom: Denom; - weight: string; + denom: Denom + weight: string } - export type Proto = RewardWeight_pb; + export type Proto = RewardWeight_pb } diff --git a/src/core/distribution/index.ts b/src/core/distribution/index.ts index c5c30b0..1ad7633 100644 --- a/src/core/distribution/index.ts +++ b/src/core/distribution/index.ts @@ -1,3 +1,3 @@ -export * from './msgs'; -export * from './DistributionParams'; -export * from './RewardWeight'; +export * from './msgs' +export * from './DistributionParams' +export * from './RewardWeight' diff --git a/src/core/distribution/msgs/MsgCommunityPoolSpend.ts b/src/core/distribution/msgs/MsgCommunityPoolSpend.ts index 9b36826..c4fc72b 100644 --- a/src/core/distribution/msgs/MsgCommunityPoolSpend.ts +++ b/src/core/distribution/msgs/MsgCommunityPoolSpend.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCommunityPoolSpend as MsgCommunityPoolSpend_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCommunityPoolSpend as MsgCommunityPoolSpend_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx' /** * defines a message for sending tokens from the community pool to another account @@ -12,7 +12,7 @@ export class MsgCommunityPoolSpend extends JSONSerializable< MsgCommunityPoolSpend.Data, MsgCommunityPoolSpend.Proto > { - public amount: Coins; + public amount: Coins /** * @param authority the address that controls the module * @param recipient recipient address @@ -23,8 +23,8 @@ export class MsgCommunityPoolSpend extends JSONSerializable< public recipient: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino( @@ -32,16 +32,16 @@ export class MsgCommunityPoolSpend extends JSONSerializable< ): MsgCommunityPoolSpend { const { value: { authority, recipient, amount }, - } = data; + } = data return new MsgCommunityPoolSpend( authority, recipient, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgCommunityPoolSpend.Amino { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return { type: 'cosmos-sdk/distr/MsgCommunityPoolSpend', value: { @@ -49,28 +49,28 @@ export class MsgCommunityPoolSpend extends JSONSerializable< recipient, amount: amount.toAmino(), }, - }; + } } public static fromData( data: MsgCommunityPoolSpend.Data ): MsgCommunityPoolSpend { - const { authority, recipient, amount } = data; + const { authority, recipient, amount } = data return new MsgCommunityPoolSpend( authority, recipient, Coins.fromData(amount) - ); + ) } public toData(): MsgCommunityPoolSpend.Data { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return { '@type': '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend', authority, recipient, amount: amount.toData(), - }; + } } public static fromProto( @@ -80,48 +80,48 @@ export class MsgCommunityPoolSpend extends JSONSerializable< proto.authority, proto.recipient, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgCommunityPoolSpend.Proto { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return MsgCommunityPoolSpend_pb.fromPartial({ authority, recipient, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend', value: MsgCommunityPoolSpend_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCommunityPoolSpend { return MsgCommunityPoolSpend.fromProto( MsgCommunityPoolSpend_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCommunityPoolSpend { export interface Amino { - type: 'cosmos-sdk/distr/MsgCommunityPoolSpend'; + type: 'cosmos-sdk/distr/MsgCommunityPoolSpend' value: { - authority: AccAddress; - recipient: AccAddress; - amount: Coins.Amino; - }; + authority: AccAddress + recipient: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend'; - authority: AccAddress; - recipient: AccAddress; - amount: Coins.Data; + '@type': '/cosmos.distribution.v1beta1.MsgCommunityPoolSpend' + authority: AccAddress + recipient: AccAddress + amount: Coins.Data } - export type Proto = MsgCommunityPoolSpend_pb; + export type Proto = MsgCommunityPoolSpend_pb } diff --git a/src/core/distribution/msgs/MsgDepositValidatorRewardsPool.ts b/src/core/distribution/msgs/MsgDepositValidatorRewardsPool.ts index bff772b..ad3167d 100644 --- a/src/core/distribution/msgs/MsgDepositValidatorRewardsPool.ts +++ b/src/core/distribution/msgs/MsgDepositValidatorRewardsPool.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Denom } from '../../Denom'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgDepositValidatorRewardsPool as MsgDepositValidatorRewardsPool_pb } from '@initia/initia.proto/initia/distribution/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress, ValAddress } from '../../bech32' +import { Denom } from '../../Denom' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgDepositValidatorRewardsPool as MsgDepositValidatorRewardsPool_pb } from '@initia/initia.proto/initia/distribution/v1/tx' export class MsgDepositValidatorRewardsPool extends JSONSerializable< MsgDepositValidatorRewardsPool.Amino, MsgDepositValidatorRewardsPool.Data, MsgDepositValidatorRewardsPool.Proto > { - public amount: Coins; + public amount: Coins /** * @param depositor * @param validator_address @@ -23,8 +23,8 @@ export class MsgDepositValidatorRewardsPool extends JSONSerializable< public denom: Denom, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino( @@ -32,17 +32,17 @@ export class MsgDepositValidatorRewardsPool extends JSONSerializable< ): MsgDepositValidatorRewardsPool { const { value: { depositor, validator_address, denom, amount }, - } = data; + } = data return new MsgDepositValidatorRewardsPool( depositor, validator_address, denom, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgDepositValidatorRewardsPool.Amino { - const { depositor, validator_address, denom, amount } = this; + const { depositor, validator_address, denom, amount } = this return { type: 'cosmos-sdk/distr/MsgDepositValRewards', value: { @@ -51,30 +51,30 @@ export class MsgDepositValidatorRewardsPool extends JSONSerializable< denom, amount: amount.toAmino(), }, - }; + } } public static fromData( data: MsgDepositValidatorRewardsPool.Data ): MsgDepositValidatorRewardsPool { - const { depositor, validator_address, denom, amount } = data; + const { depositor, validator_address, denom, amount } = data return new MsgDepositValidatorRewardsPool( depositor, validator_address, denom, Coins.fromData(amount) - ); + ) } public toData(): MsgDepositValidatorRewardsPool.Data { - const { depositor, validator_address, denom, amount } = this; + const { depositor, validator_address, denom, amount } = this return { '@type': '/initia.distribution.v1.MsgDepositValidatorRewardsPool', depositor, validator_address, denom, amount: amount.toData(), - }; + } } public static fromProto( @@ -85,51 +85,51 @@ export class MsgDepositValidatorRewardsPool extends JSONSerializable< proto.validatorAddress, proto.denom, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgDepositValidatorRewardsPool.Proto { - const { depositor, validator_address, denom, amount } = this; + const { depositor, validator_address, denom, amount } = this return MsgDepositValidatorRewardsPool_pb.fromPartial({ depositor, validatorAddress: validator_address, denom, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.distribution.v1.MsgDepositValidatorRewardsPool', value: MsgDepositValidatorRewardsPool_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDepositValidatorRewardsPool { return MsgDepositValidatorRewardsPool.fromProto( MsgDepositValidatorRewardsPool_pb.decode(msgAny.value) - ); + ) } } export namespace MsgDepositValidatorRewardsPool { export interface Amino { - type: 'cosmos-sdk/distr/MsgDepositValRewards'; + type: 'cosmos-sdk/distr/MsgDepositValRewards' value: { - depositor: AccAddress; - validator_address: ValAddress; - denom: Denom; - amount: Coins.Amino; - }; + depositor: AccAddress + validator_address: ValAddress + denom: Denom + amount: Coins.Amino + } } export interface Data { - '@type': '/initia.distribution.v1.MsgDepositValidatorRewardsPool'; - depositor: AccAddress; - validator_address: ValAddress; - denom: Denom; - amount: Coins.Data; + '@type': '/initia.distribution.v1.MsgDepositValidatorRewardsPool' + depositor: AccAddress + validator_address: ValAddress + denom: Denom + amount: Coins.Data } - export type Proto = MsgDepositValidatorRewardsPool_pb; + export type Proto = MsgDepositValidatorRewardsPool_pb } diff --git a/src/core/distribution/msgs/MsgFundCommunityPool.ts b/src/core/distribution/msgs/MsgFundCommunityPool.ts index 7beadc9..fc10ce7 100644 --- a/src/core/distribution/msgs/MsgFundCommunityPool.ts +++ b/src/core/distribution/msgs/MsgFundCommunityPool.ts @@ -1,22 +1,25 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coins } from '../../Coins'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgFundCommunityPool as MsgFundCommunityPool_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coins } from '../../Coins' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgFundCommunityPool as MsgFundCommunityPool_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx' export class MsgFundCommunityPool extends JSONSerializable< MsgFundCommunityPool.Amino, MsgFundCommunityPool.Data, MsgFundCommunityPool.Proto > { - public amount: Coins; + public amount: Coins /** * @param depositor depositor's account address * @param amount coins to fund the community pool */ - constructor(public depositor: AccAddress, amount: Coins.Input) { - super(); - this.amount = new Coins(amount); + constructor( + public depositor: AccAddress, + amount: Coins.Input + ) { + super() + this.amount = new Coins(amount) } public static fromAmino( @@ -24,35 +27,35 @@ export class MsgFundCommunityPool extends JSONSerializable< ): MsgFundCommunityPool { const { value: { depositor, amount }, - } = data; - return new MsgFundCommunityPool(depositor, Coins.fromAmino(amount)); + } = data + return new MsgFundCommunityPool(depositor, Coins.fromAmino(amount)) } public toAmino(): MsgFundCommunityPool.Amino { - const { depositor, amount } = this; + const { depositor, amount } = this return { type: 'cosmos-sdk/MsgFundCommunityPool', value: { depositor, amount: amount.toAmino(), }, - }; + } } public static fromData( proto: MsgFundCommunityPool.Data ): MsgFundCommunityPool { - const { depositor, amount } = proto; - return new MsgFundCommunityPool(depositor, Coins.fromData(amount)); + const { depositor, amount } = proto + return new MsgFundCommunityPool(depositor, Coins.fromData(amount)) } public toData(): MsgFundCommunityPool.Data { - const { depositor, amount } = this; + const { depositor, amount } = this return { '@type': '/cosmos.distribution.v1beta1.MsgFundCommunityPool', depositor, amount: amount.toData(), - }; + } } public static fromProto( @@ -61,45 +64,45 @@ export class MsgFundCommunityPool extends JSONSerializable< return new MsgFundCommunityPool( proto.depositor, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgFundCommunityPool.Proto { - const { depositor, amount } = this; + const { depositor, amount } = this return MsgFundCommunityPool_pb.fromPartial({ amount: amount.toProto(), depositor, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.distribution.v1beta1.MsgFundCommunityPool', value: MsgFundCommunityPool_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgFundCommunityPool { return MsgFundCommunityPool.fromProto( MsgFundCommunityPool_pb.decode(msgAny.value) - ); + ) } } export namespace MsgFundCommunityPool { export interface Amino { - type: 'cosmos-sdk/MsgFundCommunityPool'; + type: 'cosmos-sdk/MsgFundCommunityPool' value: { - depositor: AccAddress; - amount: Coins.Amino; - }; + depositor: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/cosmos.distribution.v1beta1.MsgFundCommunityPool'; - depositor: AccAddress; - amount: Coins.Data; + '@type': '/cosmos.distribution.v1beta1.MsgFundCommunityPool' + depositor: AccAddress + amount: Coins.Data } - export type Proto = MsgFundCommunityPool_pb; + export type Proto = MsgFundCommunityPool_pb } diff --git a/src/core/distribution/msgs/MsgSetWithdrawAddress.spec.ts b/src/core/distribution/msgs/MsgSetWithdrawAddress.spec.ts index b0479b0..e800450 100644 --- a/src/core/distribution/msgs/MsgSetWithdrawAddress.spec.ts +++ b/src/core/distribution/msgs/MsgSetWithdrawAddress.spec.ts @@ -1,15 +1,15 @@ -import { MsgSetWithdrawAddress } from './MsgSetWithdrawAddress'; -const MsgSetWithdrawAddressAmino = require('./MsgSetWithdrawAddress.data.json'); +import { MsgSetWithdrawAddress } from './MsgSetWithdrawAddress' +const MsgSetWithdrawAddressAmino = require('./MsgSetWithdrawAddress.data.json') describe('MsgSetWithdrawAddress', () => { it('deserializes', () => { MsgSetWithdrawAddressAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgModifyWithdrawAddress') { - const e = MsgSetWithdrawAddress.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgSetWithdrawAddress.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/distribution/msgs/MsgSetWithdrawAddress.ts b/src/core/distribution/msgs/MsgSetWithdrawAddress.ts index c7de3c5..164b321 100644 --- a/src/core/distribution/msgs/MsgSetWithdrawAddress.ts +++ b/src/core/distribution/msgs/MsgSetWithdrawAddress.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetWithdrawAddress as MsgSetWithdrawAddress_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetWithdrawAddress as MsgSetWithdrawAddress_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx' /** * A validator can withdraw their outstanding commission rewards accrued from all @@ -21,7 +21,7 @@ export class MsgSetWithdrawAddress extends JSONSerializable< public delegator_address: AccAddress, public withdraw_address: AccAddress ) { - super(); + super() } public static fromAmino( @@ -29,35 +29,35 @@ export class MsgSetWithdrawAddress extends JSONSerializable< ): MsgSetWithdrawAddress { const { value: { delegator_address, withdraw_address }, - } = data; - return new MsgSetWithdrawAddress(delegator_address, withdraw_address); + } = data + return new MsgSetWithdrawAddress(delegator_address, withdraw_address) } public toAmino(): MsgSetWithdrawAddress.Amino { - const { delegator_address, withdraw_address } = this; + const { delegator_address, withdraw_address } = this return { type: 'cosmos-sdk/MsgModifyWithdrawAddress', value: { delegator_address, withdraw_address, }, - }; + } } public static fromData( data: MsgSetWithdrawAddress.Data ): MsgSetWithdrawAddress { - const { delegator_address, withdraw_address } = data; - return new MsgSetWithdrawAddress(delegator_address, withdraw_address); + const { delegator_address, withdraw_address } = data + return new MsgSetWithdrawAddress(delegator_address, withdraw_address) } public toData(): MsgSetWithdrawAddress.Data { - const { delegator_address, withdraw_address } = this; + const { delegator_address, withdraw_address } = this return { '@type': '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress', delegator_address, withdraw_address, - }; + } } public static fromProto( @@ -66,45 +66,45 @@ export class MsgSetWithdrawAddress extends JSONSerializable< return new MsgSetWithdrawAddress( proto.delegatorAddress, proto.withdrawAddress - ); + ) } public toProto(): MsgSetWithdrawAddress.Proto { - const { delegator_address, withdraw_address } = this; + const { delegator_address, withdraw_address } = this return MsgSetWithdrawAddress_pb.fromPartial({ delegatorAddress: delegator_address, withdrawAddress: withdraw_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress', value: MsgSetWithdrawAddress_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetWithdrawAddress { return MsgSetWithdrawAddress.fromProto( MsgSetWithdrawAddress_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetWithdrawAddress { export interface Amino { - type: 'cosmos-sdk/MsgModifyWithdrawAddress'; + type: 'cosmos-sdk/MsgModifyWithdrawAddress' value: { - delegator_address: AccAddress; - withdraw_address: AccAddress; - }; + delegator_address: AccAddress + withdraw_address: AccAddress + } } export interface Data { - '@type': '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress'; - delegator_address: AccAddress; - withdraw_address: AccAddress; + '@type': '/cosmos.distribution.v1beta1.MsgSetWithdrawAddress' + delegator_address: AccAddress + withdraw_address: AccAddress } - export type Proto = MsgSetWithdrawAddress_pb; + export type Proto = MsgSetWithdrawAddress_pb } diff --git a/src/core/distribution/msgs/MsgUpdateDistrParams.ts b/src/core/distribution/msgs/MsgUpdateDistrParams.ts index 979052a..9302594 100644 --- a/src/core/distribution/msgs/MsgUpdateDistrParams.ts +++ b/src/core/distribution/msgs/MsgUpdateDistrParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DistributionParams } from '../DistributionParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/distribution/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DistributionParams } from '../DistributionParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/distribution/v1/tx' export class MsgUpdateDistrParams extends JSONSerializable< MsgUpdateDistrParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateDistrParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/distribution parameters to update */ - constructor(public authority: AccAddress, public params: DistributionParams) { - super(); + constructor( + public authority: AccAddress, + public params: DistributionParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateDistrParams extends JSONSerializable< ): MsgUpdateDistrParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateDistrParams( authority, DistributionParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateDistrParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'distribution/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateDistrParams.Data ): MsgUpdateDistrParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateDistrParams( authority, DistributionParams.fromData(params) - ); + ) } public toData(): MsgUpdateDistrParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.distribution.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,45 @@ export class MsgUpdateDistrParams extends JSONSerializable< return new MsgUpdateDistrParams( data.authority, DistributionParams.fromProto(data.params as DistributionParams.Proto) - ); + ) } public toProto(): MsgUpdateDistrParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.distribution.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateDistrParams { return MsgUpdateDistrParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateDistrParams { export interface Amino { - type: 'distribution/MsgUpdateParams'; + type: 'distribution/MsgUpdateParams' value: { - authority: AccAddress; - params: DistributionParams.Amino; - }; + authority: AccAddress + params: DistributionParams.Amino + } } export interface Data { - '@type': '/initia.distribution.v1.MsgUpdateParams'; - authority: AccAddress; - params: DistributionParams.Data; + '@type': '/initia.distribution.v1.MsgUpdateParams' + authority: AccAddress + params: DistributionParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/distribution/msgs/MsgWithdrawDelegatorReward.spec.ts b/src/core/distribution/msgs/MsgWithdrawDelegatorReward.spec.ts index cca1e40..e7fa589 100644 --- a/src/core/distribution/msgs/MsgWithdrawDelegatorReward.spec.ts +++ b/src/core/distribution/msgs/MsgWithdrawDelegatorReward.spec.ts @@ -1,15 +1,15 @@ -import { MsgWithdrawDelegatorReward } from './MsgWithdrawDelegatorReward'; -const MsgWithdrawDelegatorRewardAmino = require('./MsgWithdrawDelegatorReward.data.json'); +import { MsgWithdrawDelegatorReward } from './MsgWithdrawDelegatorReward' +const MsgWithdrawDelegatorRewardAmino = require('./MsgWithdrawDelegatorReward.data.json') describe('MsgWithdrawDelegatorReward', () => { it('deserializes', () => { MsgWithdrawDelegatorRewardAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgWithdrawDelegationReward') { - const e = MsgWithdrawDelegatorReward.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgWithdrawDelegatorReward.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/distribution/msgs/MsgWithdrawDelegatorReward.ts b/src/core/distribution/msgs/MsgWithdrawDelegatorReward.ts index c8abe86..246551e 100644 --- a/src/core/distribution/msgs/MsgWithdrawDelegatorReward.ts +++ b/src/core/distribution/msgs/MsgWithdrawDelegatorReward.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgWithdrawDelegatorReward as MsgWithdrawDelegatorReward_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgWithdrawDelegatorReward as MsgWithdrawDelegatorReward_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx' /** * A delegator can withdraw currently outstanding rewards accrued from their delegation @@ -23,7 +23,7 @@ export class MsgWithdrawDelegatorReward extends JSONSerializable< public delegator_address: AccAddress, public validator_address: ValAddress ) { - super(); + super() } public static fromAmino( @@ -31,35 +31,35 @@ export class MsgWithdrawDelegatorReward extends JSONSerializable< ): MsgWithdrawDelegatorReward { const { value: { delegator_address, validator_address }, - } = data; - return new MsgWithdrawDelegatorReward(delegator_address, validator_address); + } = data + return new MsgWithdrawDelegatorReward(delegator_address, validator_address) } public toAmino(): MsgWithdrawDelegatorReward.Amino { - const { delegator_address, validator_address } = this; + const { delegator_address, validator_address } = this return { type: 'cosmos-sdk/MsgWithdrawDelegationReward', value: { delegator_address, validator_address, }, - }; + } } public static fromData( proto: MsgWithdrawDelegatorReward.Data ): MsgWithdrawDelegatorReward { - const { delegator_address, validator_address } = proto; - return new MsgWithdrawDelegatorReward(delegator_address, validator_address); + const { delegator_address, validator_address } = proto + return new MsgWithdrawDelegatorReward(delegator_address, validator_address) } public toData(): MsgWithdrawDelegatorReward.Data { - const { delegator_address, validator_address } = this; + const { delegator_address, validator_address } = this return { '@type': '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward', delegator_address, validator_address, - }; + } } public static fromProto( @@ -68,45 +68,45 @@ export class MsgWithdrawDelegatorReward extends JSONSerializable< return new MsgWithdrawDelegatorReward( proto.delegatorAddress, proto.validatorAddress - ); + ) } public toProto(): MsgWithdrawDelegatorReward.Proto { - const { delegator_address, validator_address } = this; + const { delegator_address, validator_address } = this return MsgWithdrawDelegatorReward_pb.fromPartial({ delegatorAddress: delegator_address, validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward', value: MsgWithdrawDelegatorReward_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgWithdrawDelegatorReward { return MsgWithdrawDelegatorReward.fromProto( MsgWithdrawDelegatorReward_pb.decode(msgAny.value) - ); + ) } } export namespace MsgWithdrawDelegatorReward { export interface Amino { - type: 'cosmos-sdk/MsgWithdrawDelegationReward'; + type: 'cosmos-sdk/MsgWithdrawDelegationReward' value: { - delegator_address: AccAddress; - validator_address: ValAddress; - }; + delegator_address: AccAddress + validator_address: ValAddress + } } export interface Data { - '@type': '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward'; - delegator_address: AccAddress; - validator_address: ValAddress; + '@type': '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward' + delegator_address: AccAddress + validator_address: ValAddress } - export type Proto = MsgWithdrawDelegatorReward_pb; + export type Proto = MsgWithdrawDelegatorReward_pb } diff --git a/src/core/distribution/msgs/MsgWithdrawValidatorCommission.spec.ts b/src/core/distribution/msgs/MsgWithdrawValidatorCommission.spec.ts index b9953cb..afa564b 100644 --- a/src/core/distribution/msgs/MsgWithdrawValidatorCommission.spec.ts +++ b/src/core/distribution/msgs/MsgWithdrawValidatorCommission.spec.ts @@ -1,15 +1,15 @@ -import { MsgWithdrawValidatorCommission } from './MsgWithdrawValidatorCommission'; -const MsgWithdrawValidatorCommissionAmino = require('./MsgWithdrawValidatorCommission.data.json'); +import { MsgWithdrawValidatorCommission } from './MsgWithdrawValidatorCommission' +const MsgWithdrawValidatorCommissionAmino = require('./MsgWithdrawValidatorCommission.data.json') describe('MsgWithdrawValidatorCommission', () => { it('deserializes', () => { MsgWithdrawValidatorCommissionAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgWithdrawValidatorCommission') { - const e = MsgWithdrawValidatorCommission.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgWithdrawValidatorCommission.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/distribution/msgs/MsgWithdrawValidatorCommission.ts b/src/core/distribution/msgs/MsgWithdrawValidatorCommission.ts index 935d8d1..4182893 100644 --- a/src/core/distribution/msgs/MsgWithdrawValidatorCommission.ts +++ b/src/core/distribution/msgs/MsgWithdrawValidatorCommission.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgWithdrawValidatorCommission as MsgWithdrawValidatorCommission_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgWithdrawValidatorCommission as MsgWithdrawValidatorCommission_pb } from '@initia/initia.proto/cosmos/distribution/v1beta1/tx' /** * A validator can withdraw their outstanding commission rewards accrued from all @@ -17,7 +17,7 @@ export class MsgWithdrawValidatorCommission extends JSONSerializable< * @param validator_address validator's operator address */ constructor(public validator_address: ValAddress) { - super(); + super() } public static fromAmino( @@ -25,74 +25,74 @@ export class MsgWithdrawValidatorCommission extends JSONSerializable< ): MsgWithdrawValidatorCommission { const { value: { validator_address }, - } = data; - return new MsgWithdrawValidatorCommission(validator_address); + } = data + return new MsgWithdrawValidatorCommission(validator_address) } public toAmino(): MsgWithdrawValidatorCommission.Amino { - const { validator_address } = this; + const { validator_address } = this return { type: 'cosmos-sdk/MsgWithdrawValidatorCommission', value: { validator_address, }, - }; + } } public static fromData( proto: MsgWithdrawValidatorCommission.Data ): MsgWithdrawValidatorCommission { - const { validator_address } = proto; - return new MsgWithdrawValidatorCommission(validator_address); + const { validator_address } = proto + return new MsgWithdrawValidatorCommission(validator_address) } public toData(): MsgWithdrawValidatorCommission.Data { - const { validator_address } = this; + const { validator_address } = this return { '@type': '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission', validator_address, - }; + } } public static fromProto( proto: MsgWithdrawValidatorCommission.Proto ): MsgWithdrawValidatorCommission { - return new MsgWithdrawValidatorCommission(proto.validatorAddress); + return new MsgWithdrawValidatorCommission(proto.validatorAddress) } public toProto(): MsgWithdrawValidatorCommission.Proto { - const { validator_address } = this; + const { validator_address } = this return MsgWithdrawValidatorCommission_pb.fromPartial({ validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission', value: MsgWithdrawValidatorCommission_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgWithdrawValidatorCommission { return MsgWithdrawValidatorCommission.fromProto( MsgWithdrawValidatorCommission_pb.decode(msgAny.value) - ); + ) } } export namespace MsgWithdrawValidatorCommission { export interface Amino { - type: 'cosmos-sdk/MsgWithdrawValidatorCommission'; + type: 'cosmos-sdk/MsgWithdrawValidatorCommission' value: { - validator_address: ValAddress; - }; + validator_address: ValAddress + } } export interface Data { - '@type': '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission'; - validator_address: ValAddress; + '@type': '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission' + validator_address: ValAddress } - export type Proto = MsgWithdrawValidatorCommission_pb; + export type Proto = MsgWithdrawValidatorCommission_pb } diff --git a/src/core/distribution/msgs/index.ts b/src/core/distribution/msgs/index.ts index 8d96147..e3d3c79 100644 --- a/src/core/distribution/msgs/index.ts +++ b/src/core/distribution/msgs/index.ts @@ -1,18 +1,18 @@ -import { MsgSetWithdrawAddress } from './MsgSetWithdrawAddress'; -import { MsgWithdrawDelegatorReward } from './MsgWithdrawDelegatorReward'; -import { MsgWithdrawValidatorCommission } from './MsgWithdrawValidatorCommission'; -import { MsgFundCommunityPool } from './MsgFundCommunityPool'; -import { MsgUpdateDistrParams } from './MsgUpdateDistrParams'; -import { MsgCommunityPoolSpend } from './MsgCommunityPoolSpend'; -import { MsgDepositValidatorRewardsPool } from './MsgDepositValidatorRewardsPool'; +import { MsgSetWithdrawAddress } from './MsgSetWithdrawAddress' +import { MsgWithdrawDelegatorReward } from './MsgWithdrawDelegatorReward' +import { MsgWithdrawValidatorCommission } from './MsgWithdrawValidatorCommission' +import { MsgFundCommunityPool } from './MsgFundCommunityPool' +import { MsgUpdateDistrParams } from './MsgUpdateDistrParams' +import { MsgCommunityPoolSpend } from './MsgCommunityPoolSpend' +import { MsgDepositValidatorRewardsPool } from './MsgDepositValidatorRewardsPool' -export * from './MsgSetWithdrawAddress'; -export * from './MsgWithdrawDelegatorReward'; -export * from './MsgWithdrawValidatorCommission'; -export * from './MsgFundCommunityPool'; -export * from './MsgUpdateDistrParams'; -export * from './MsgCommunityPoolSpend'; -export * from './MsgDepositValidatorRewardsPool'; +export * from './MsgSetWithdrawAddress' +export * from './MsgWithdrawDelegatorReward' +export * from './MsgWithdrawValidatorCommission' +export * from './MsgFundCommunityPool' +export * from './MsgUpdateDistrParams' +export * from './MsgCommunityPoolSpend' +export * from './MsgDepositValidatorRewardsPool' export type DistributionMsg = | MsgSetWithdrawAddress @@ -21,7 +21,7 @@ export type DistributionMsg = | MsgFundCommunityPool | MsgUpdateDistrParams | MsgCommunityPoolSpend - | MsgDepositValidatorRewardsPool; + | MsgDepositValidatorRewardsPool export namespace DistributionMsg { export type Amino = @@ -31,7 +31,7 @@ export namespace DistributionMsg { | MsgFundCommunityPool.Amino | MsgUpdateDistrParams.Amino | MsgCommunityPoolSpend.Amino - | MsgDepositValidatorRewardsPool.Amino; + | MsgDepositValidatorRewardsPool.Amino export type Data = | MsgSetWithdrawAddress.Data @@ -40,7 +40,7 @@ export namespace DistributionMsg { | MsgFundCommunityPool.Data | MsgUpdateDistrParams.Data | MsgCommunityPoolSpend.Data - | MsgDepositValidatorRewardsPool.Data; + | MsgDepositValidatorRewardsPool.Data export type Proto = | MsgSetWithdrawAddress.Proto @@ -49,5 +49,5 @@ export namespace DistributionMsg { | MsgFundCommunityPool.Proto | MsgUpdateDistrParams.Proto | MsgCommunityPoolSpend.Proto - | MsgDepositValidatorRewardsPool.Proto; + | MsgDepositValidatorRewardsPool.Proto } diff --git a/src/core/evidence/Equivocation.ts b/src/core/evidence/Equivocation.ts index bf23141..9631d1c 100644 --- a/src/core/evidence/Equivocation.ts +++ b/src/core/evidence/Equivocation.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../util/json'; -import { ValConsAddress } from '../bech32'; -import { Equivocation as Equivocation_pb } from '@initia/initia.proto/cosmos/evidence/v1beta1/evidence'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { ValConsAddress } from '../bech32' +import { Equivocation as Equivocation_pb } from '@initia/initia.proto/cosmos/evidence/v1beta1/evidence' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class Equivocation extends JSONSerializable< Equivocation.Amino, @@ -21,24 +21,24 @@ export class Equivocation extends JSONSerializable< public power: number, public consensus_address: ValConsAddress ) { - super(); + super() } public static fromAmino(data: Equivocation.Amino): Equivocation { const { value: { height, time, power, consensus_address }, - } = data; + } = data return new Equivocation( Number.parseInt(height), new Date(time), Number.parseInt(power), consensus_address - ); + ) } public toAmino(): Equivocation.Amino { - const { height, time, power, consensus_address } = this; + const { height, time, power, consensus_address } = this return { type: 'cosmos-sdk/Equivocation', @@ -48,22 +48,22 @@ export class Equivocation extends JSONSerializable< power: power.toString(), consensus_address, }, - }; + } } public static fromData(data: Equivocation.Data): Equivocation { - const { height, time, power, consensus_address } = data; + const { height, time, power, consensus_address } = data return new Equivocation( Number.parseInt(height), new Date(time), Number.parseInt(power), consensus_address - ); + ) } public toData(): Equivocation.Data { - const { height, time, power, consensus_address } = this; + const { height, time, power, consensus_address } = this return { '@type': '/cosmos.evidence.v1beta1.Equivocation', @@ -71,7 +71,7 @@ export class Equivocation extends JSONSerializable< time: time.toISOString(), power: power.toString(), consensus_address, - }; + } } public static fromProto(data: Equivocation.Proto): Equivocation { @@ -80,50 +80,50 @@ export class Equivocation extends JSONSerializable< data.time as Date, data.power.toNumber(), data.consensusAddress - ); + ) } public toProto(): Equivocation.Proto { - const { height, time, power, consensus_address } = this; + const { height, time, power, consensus_address } = this return Equivocation_pb.fromPartial({ height: Long.fromNumber(height), time, power: Long.fromNumber(power), consensusAddress: consensus_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.evidence.v1beta1.Equivocation', value: Equivocation_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): Equivocation { - return Equivocation.fromProto(Equivocation_pb.decode(msgAny.value)); + return Equivocation.fromProto(Equivocation_pb.decode(msgAny.value)) } } export namespace Equivocation { export interface Amino { - type: 'cosmos-sdk/Equivocation'; + type: 'cosmos-sdk/Equivocation' value: { - height: string; - time: string; - power: string; - consensus_address: ValConsAddress; - }; + height: string + time: string + power: string + consensus_address: ValConsAddress + } } export interface Data { - '@type': '/cosmos.evidence.v1beta1.Equivocation'; - height: string; - time: string; - power: string; - consensus_address: ValConsAddress; + '@type': '/cosmos.evidence.v1beta1.Equivocation' + height: string + time: string + power: string + consensus_address: ValConsAddress } - export type Proto = Equivocation_pb; + export type Proto = Equivocation_pb } diff --git a/src/core/evidence/Evidence.ts b/src/core/evidence/Evidence.ts index d0d1a0c..7ca7e31 100644 --- a/src/core/evidence/Evidence.ts +++ b/src/core/evidence/Evidence.ts @@ -1,34 +1,34 @@ -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { Equivocation } from './Equivocation'; +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { Equivocation } from './Equivocation' -export type Evidence = Equivocation; +export type Evidence = Equivocation export namespace Evidence { - export type Amino = Equivocation.Amino; - export type Data = Equivocation.Data; - export type Proto = Equivocation.Proto; + export type Amino = Equivocation.Amino + export type Data = Equivocation.Data + export type Proto = Equivocation.Proto export function fromAmino(data: Evidence.Amino): Evidence { switch (data.type) { case 'cosmos-sdk/Equivocation': - return Equivocation.fromAmino(data); + return Equivocation.fromAmino(data) } } export function fromData(data: Evidence.Data): Evidence { switch (data['@type']) { case '/cosmos.evidence.v1beta1.Equivocation': - return Equivocation.fromData(data); + return Equivocation.fromData(data) } } export function fromProto(proto: Any): Evidence { - const typeUrl = proto.typeUrl; + const typeUrl = proto.typeUrl switch (typeUrl) { case '/cosmos.evidence.v1beta1.Equivocation': - return Equivocation.unpackAny(proto); + return Equivocation.unpackAny(proto) } - throw new Error(`Evidence type ${typeUrl} not recognized`); + throw new Error(`Evidence type ${typeUrl} not recognized`) } } diff --git a/src/core/evidence/index.ts b/src/core/evidence/index.ts index f6c74aa..bf92b21 100644 --- a/src/core/evidence/index.ts +++ b/src/core/evidence/index.ts @@ -1,3 +1,3 @@ -export * from './msgs'; -export * from './Equivocation'; -export * from './Evidence'; +export * from './msgs' +export * from './Equivocation' +export * from './Evidence' diff --git a/src/core/evidence/msgs/MsgSubmitEvidence.ts b/src/core/evidence/msgs/MsgSubmitEvidence.ts index 9c13373..8656e9f 100644 --- a/src/core/evidence/msgs/MsgSubmitEvidence.ts +++ b/src/core/evidence/msgs/MsgSubmitEvidence.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSubmitEvidence as MsgSubmitEvidence_pb } from '@initia/initia.proto/cosmos/evidence/v1beta1/tx'; -import { Evidence } from '../Evidence'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSubmitEvidence as MsgSubmitEvidence_pb } from '@initia/initia.proto/cosmos/evidence/v1beta1/tx' +import { Evidence } from '../Evidence' export class MsgSubmitEvidence extends JSONSerializable< MsgSubmitEvidence.Amino, @@ -13,86 +13,89 @@ export class MsgSubmitEvidence extends JSONSerializable< * @param submitter the signer account address of evidence * @param evidence the evidence of misbehavior */ - constructor(public submitter: AccAddress, public evidence: Evidence) { - super(); + constructor( + public submitter: AccAddress, + public evidence: Evidence + ) { + super() } public static fromAmino(data: MsgSubmitEvidence.Amino): MsgSubmitEvidence { const { value: { submitter, evidence }, - } = data; + } = data - return new MsgSubmitEvidence(submitter, Evidence.fromAmino(evidence)); + return new MsgSubmitEvidence(submitter, Evidence.fromAmino(evidence)) } public toAmino(): MsgSubmitEvidence.Amino { - const { submitter, evidence } = this; + const { submitter, evidence } = this return { type: 'cosmos-sdk/MsgSubmitEvidence', value: { submitter, evidence: evidence.toAmino(), }, - }; + } } public static fromData(data: MsgSubmitEvidence.Data): MsgSubmitEvidence { - const { submitter, evidence } = data; - return new MsgSubmitEvidence(submitter, Evidence.fromData(evidence)); + const { submitter, evidence } = data + return new MsgSubmitEvidence(submitter, Evidence.fromData(evidence)) } public toData(): MsgSubmitEvidence.Data { - const { submitter, evidence } = this; + const { submitter, evidence } = this return { '@type': '/cosmos.evidence.v1beta1.MsgSubmitEvidence', submitter, evidence: evidence.toData(), - }; + } } public static fromProto(data: MsgSubmitEvidence.Proto): MsgSubmitEvidence { return new MsgSubmitEvidence( data.submitter, Evidence.fromProto(data.evidence as Any) - ); + ) } public toProto(): MsgSubmitEvidence.Proto { - const { submitter, evidence } = this; + const { submitter, evidence } = this return MsgSubmitEvidence_pb.fromPartial({ submitter, evidence: evidence.packAny(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.evidence.v1beta1.MsgSubmitEvidence', value: MsgSubmitEvidence_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitEvidence { return MsgSubmitEvidence.fromProto( MsgSubmitEvidence_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSubmitEvidence { export interface Amino { - type: 'cosmos-sdk/MsgSubmitEvidence'; + type: 'cosmos-sdk/MsgSubmitEvidence' value: { - submitter: AccAddress; - evidence: Evidence.Amino; - }; + submitter: AccAddress + evidence: Evidence.Amino + } } export interface Data { - '@type': '/cosmos.evidence.v1beta1.MsgSubmitEvidence'; - submitter: AccAddress; - evidence: Evidence.Data; + '@type': '/cosmos.evidence.v1beta1.MsgSubmitEvidence' + submitter: AccAddress + evidence: Evidence.Data } - export type Proto = MsgSubmitEvidence_pb; + export type Proto = MsgSubmitEvidence_pb } diff --git a/src/core/evidence/msgs/index.ts b/src/core/evidence/msgs/index.ts index ef1580e..0dacfd4 100644 --- a/src/core/evidence/msgs/index.ts +++ b/src/core/evidence/msgs/index.ts @@ -1,11 +1,11 @@ -import { MsgSubmitEvidence } from './MsgSubmitEvidence'; +import { MsgSubmitEvidence } from './MsgSubmitEvidence' -export * from './MsgSubmitEvidence'; +export * from './MsgSubmitEvidence' -export type EvidenceMsg = MsgSubmitEvidence; +export type EvidenceMsg = MsgSubmitEvidence export namespace EvidenceMsg { - export type Amino = MsgSubmitEvidence.Amino; - export type Data = MsgSubmitEvidence.Data; - export type Proto = MsgSubmitEvidence.Proto; + export type Amino = MsgSubmitEvidence.Amino + export type Data = MsgSubmitEvidence.Data + export type Proto = MsgSubmitEvidence.Proto } diff --git a/src/core/evm/EvmParams.ts b/src/core/evm/EvmParams.ts index c9e8edf..4600d9b 100644 --- a/src/core/evm/EvmParams.ts +++ b/src/core/evm/EvmParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/minievm/evm/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/minievm/evm/v1/types' export class EvmParams extends JSONSerializable< EvmParams.Amino, @@ -14,61 +14,61 @@ export class EvmParams extends JSONSerializable< public extra_eips: number[], public allowed_publishers: string[] ) { - super(); + super() } public static fromAmino(data: EvmParams.Amino): EvmParams { - const { extra_eips, allowed_publishers } = data; - return new EvmParams(extra_eips.map(Number.parseInt), allowed_publishers); + const { extra_eips, allowed_publishers } = data + return new EvmParams(extra_eips.map(Number.parseInt), allowed_publishers) } public toAmino(): EvmParams.Amino { - const { extra_eips, allowed_publishers } = this; + const { extra_eips, allowed_publishers } = this return { - extra_eips: extra_eips.map(eip => eip.toString()), + extra_eips: extra_eips.map((eip) => eip.toString()), allowed_publishers, - }; + } } public static fromData(data: EvmParams.Data): EvmParams { - const { extra_eips, allowed_publishers } = data; - return new EvmParams(extra_eips.map(Number.parseInt), allowed_publishers); + const { extra_eips, allowed_publishers } = data + return new EvmParams(extra_eips.map(Number.parseInt), allowed_publishers) } public toData(): EvmParams.Data { - const { extra_eips, allowed_publishers } = this; + const { extra_eips, allowed_publishers } = this return { - extra_eips: extra_eips.map(eip => eip.toString()), + extra_eips: extra_eips.map((eip) => eip.toString()), allowed_publishers, - }; + } } public static fromProto(proto: EvmParams.Proto): EvmParams { return new EvmParams( - proto.extraEips.map(eip => eip.toNumber()), + proto.extraEips.map((eip) => eip.toNumber()), proto.allowedPublishers - ); + ) } public toProto(): EvmParams.Proto { - const { extra_eips, allowed_publishers } = this; + const { extra_eips, allowed_publishers } = this return Params_pb.fromPartial({ extraEips: extra_eips, allowedPublishers: allowed_publishers, - }); + }) } } export namespace EvmParams { export interface Amino { - extra_eips: string[]; - allowed_publishers: string[]; + extra_eips: string[] + allowed_publishers: string[] } export interface Data { - extra_eips: string[]; - allowed_publishers: string[]; + extra_eips: string[] + allowed_publishers: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/evm/index.ts b/src/core/evm/index.ts index dca890e..dce8885 100644 --- a/src/core/evm/index.ts +++ b/src/core/evm/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './EvmParams'; +export * from './msgs' +export * from './EvmParams' diff --git a/src/core/evm/msgs/MsgCall.ts b/src/core/evm/msgs/MsgCall.ts index fb412d5..9700912 100644 --- a/src/core/evm/msgs/MsgCall.ts +++ b/src/core/evm/msgs/MsgCall.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCall as MsgCall_pb } from '@initia/initia.proto/minievm/evm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCall as MsgCall_pb } from '@initia/initia.proto/minievm/evm/v1/tx' export class MsgCall extends JSONSerializable< MsgCall.Amino, @@ -18,19 +18,19 @@ export class MsgCall extends JSONSerializable< public contract_addr: AccAddress, public input: string ) { - super(); + super() } public static fromAmino(data: MsgCall.Amino): MsgCall { const { value: { sender, contract_addr, input }, - } = data; + } = data - return new MsgCall(sender, contract_addr, input); + return new MsgCall(sender, contract_addr, input) } public toAmino(): MsgCall.Amino { - const { sender, contract_addr, input } = this; + const { sender, contract_addr, input } = this return { type: 'evm/MsgCall', value: { @@ -38,65 +38,65 @@ export class MsgCall extends JSONSerializable< contract_addr, input, }, - }; + } } public static fromData(data: MsgCall.Data): MsgCall { - const { sender, contract_addr, input } = data; - return new MsgCall(sender, contract_addr, input); + const { sender, contract_addr, input } = data + return new MsgCall(sender, contract_addr, input) } public toData(): MsgCall.Data { - const { sender, contract_addr, input } = this; + const { sender, contract_addr, input } = this return { '@type': '/minievm.evm.v1.MsgCall', sender, contract_addr, input, - }; + } } public static fromProto(data: MsgCall.Proto): MsgCall { - return new MsgCall(data.sender, data.contractAddr, data.input); + return new MsgCall(data.sender, data.contractAddr, data.input) } public toProto(): MsgCall.Proto { - const { sender, contract_addr, input } = this; + const { sender, contract_addr, input } = this return MsgCall_pb.fromPartial({ sender, contractAddr: contract_addr, input, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/minievm.evm.v1.MsgCall', value: MsgCall_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCall { - return MsgCall.fromProto(MsgCall_pb.decode(msgAny.value)); + return MsgCall.fromProto(MsgCall_pb.decode(msgAny.value)) } } export namespace MsgCall { export interface Amino { - type: 'evm/MsgCall'; + type: 'evm/MsgCall' value: { - sender: AccAddress; - contract_addr: AccAddress; - input: string; - }; + sender: AccAddress + contract_addr: AccAddress + input: string + } } export interface Data { - '@type': '/minievm.evm.v1.MsgCall'; - sender: AccAddress; - contract_addr: AccAddress; - input: string; + '@type': '/minievm.evm.v1.MsgCall' + sender: AccAddress + contract_addr: AccAddress + input: string } - export type Proto = MsgCall_pb; + export type Proto = MsgCall_pb } diff --git a/src/core/evm/msgs/MsgCreate.ts b/src/core/evm/msgs/MsgCreate.ts index 464360b..b3f89fd 100644 --- a/src/core/evm/msgs/MsgCreate.ts +++ b/src/core/evm/msgs/MsgCreate.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreate as MsgCreate_pb } from '@initia/initia.proto/minievm/evm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreate as MsgCreate_pb } from '@initia/initia.proto/minievm/evm/v1/tx' export class MsgCreate extends JSONSerializable< MsgCreate.Amino, @@ -12,81 +12,84 @@ export class MsgCreate extends JSONSerializable< * @param sender the actor that signed the messages * @param code hex encoded raw contract bytes code */ - constructor(public sender: AccAddress, public code: string) { - super(); + constructor( + public sender: AccAddress, + public code: string + ) { + super() } public static fromAmino(data: MsgCreate.Amino): MsgCreate { const { value: { sender, code }, - } = data; + } = data - return new MsgCreate(sender, code); + return new MsgCreate(sender, code) } public toAmino(): MsgCreate.Amino { - const { sender, code } = this; + const { sender, code } = this return { type: 'evm/MsgCreate', value: { sender, code, }, - }; + } } public static fromData(data: MsgCreate.Data): MsgCreate { - const { sender, code } = data; - return new MsgCreate(sender, code); + const { sender, code } = data + return new MsgCreate(sender, code) } public toData(): MsgCreate.Data { - const { sender, code } = this; + const { sender, code } = this return { '@type': '/minievm.evm.v1.MsgCreate', sender, code, - }; + } } public static fromProto(data: MsgCreate.Proto): MsgCreate { - return new MsgCreate(data.sender, data.code); + return new MsgCreate(data.sender, data.code) } public toProto(): MsgCreate.Proto { - const { sender, code } = this; + const { sender, code } = this return MsgCreate_pb.fromPartial({ sender, code, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/minievm.evm.v1.MsgCreate', value: MsgCreate_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreate { - return MsgCreate.fromProto(MsgCreate_pb.decode(msgAny.value)); + return MsgCreate.fromProto(MsgCreate_pb.decode(msgAny.value)) } } export namespace MsgCreate { export interface Amino { - type: 'evm/MsgCreate'; + type: 'evm/MsgCreate' value: { - sender: AccAddress; - code: string; - }; + sender: AccAddress + code: string + } } export interface Data { - '@type': '/minievm.evm.v1.MsgCreate'; - sender: AccAddress; - code: string; + '@type': '/minievm.evm.v1.MsgCreate' + sender: AccAddress + code: string } - export type Proto = MsgCreate_pb; + export type Proto = MsgCreate_pb } diff --git a/src/core/evm/msgs/MsgUpdateEvmParams.ts b/src/core/evm/msgs/MsgUpdateEvmParams.ts index c29b91b..ce193db 100644 --- a/src/core/evm/msgs/MsgUpdateEvmParams.ts +++ b/src/core/evm/msgs/MsgUpdateEvmParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { EvmParams } from '../EvmParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/minievm/evm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { EvmParams } from '../EvmParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/minievm/evm/v1/tx' export class MsgUpdateEvmParams extends JSONSerializable< MsgUpdateEvmParams.Amino, @@ -13,85 +13,86 @@ export class MsgUpdateEvmParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/evm parameters to update */ - constructor(public authority: AccAddress, public params: EvmParams) { - super(); + constructor( + public authority: AccAddress, + public params: EvmParams + ) { + super() } public static fromAmino(data: MsgUpdateEvmParams.Amino): MsgUpdateEvmParams { const { value: { authority, params }, - } = data; - return new MsgUpdateEvmParams(authority, EvmParams.fromAmino(params)); + } = data + return new MsgUpdateEvmParams(authority, EvmParams.fromAmino(params)) } public toAmino(): MsgUpdateEvmParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'evm/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateEvmParams.Data): MsgUpdateEvmParams { - const { authority, params } = data; - return new MsgUpdateEvmParams(authority, EvmParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateEvmParams(authority, EvmParams.fromData(params)) } public toData(): MsgUpdateEvmParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/minievm.evm.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto(data: MsgUpdateEvmParams.Proto): MsgUpdateEvmParams { return new MsgUpdateEvmParams( data.authority, EvmParams.fromProto(data.params as EvmParams.Proto) - ); + ) } public toProto(): MsgUpdateEvmParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/minievm.evm.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateEvmParams { - return MsgUpdateEvmParams.fromProto( - MsgUpdateParams_pb.decode(msgAny.value) - ); + return MsgUpdateEvmParams.fromProto(MsgUpdateParams_pb.decode(msgAny.value)) } } export namespace MsgUpdateEvmParams { export interface Amino { - type: 'evm/MsgUpdateParams'; + type: 'evm/MsgUpdateParams' value: { - authority: AccAddress; - params: EvmParams.Amino; - }; + authority: AccAddress + params: EvmParams.Amino + } } export interface Data { - '@type': '/minievm.evm.v1.MsgUpdateParams'; - authority: AccAddress; - params: EvmParams.Data; + '@type': '/minievm.evm.v1.MsgUpdateParams' + authority: AccAddress + params: EvmParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/evm/msgs/index.ts b/src/core/evm/msgs/index.ts index c66b364..02afaef 100644 --- a/src/core/evm/msgs/index.ts +++ b/src/core/evm/msgs/index.ts @@ -1,23 +1,17 @@ -import { MsgCreate } from './MsgCreate'; -import { MsgCall } from './MsgCall'; -import { MsgUpdateEvmParams } from './MsgUpdateEvmParams'; +import { MsgCreate } from './MsgCreate' +import { MsgCall } from './MsgCall' +import { MsgUpdateEvmParams } from './MsgUpdateEvmParams' -export * from './MsgCreate'; -export * from './MsgCall'; -export * from './MsgUpdateEvmParams'; +export * from './MsgCreate' +export * from './MsgCall' +export * from './MsgUpdateEvmParams' -export type EvmMsg = MsgCreate | MsgCall | MsgUpdateEvmParams; +export type EvmMsg = MsgCreate | MsgCall | MsgUpdateEvmParams export namespace EvmMsg { - export type Amino = - | MsgCreate.Amino - | MsgCall.Amino - | MsgUpdateEvmParams.Amino; + export type Amino = MsgCreate.Amino | MsgCall.Amino | MsgUpdateEvmParams.Amino - export type Data = MsgCreate.Data | MsgCall.Data | MsgUpdateEvmParams.Data; + export type Data = MsgCreate.Data | MsgCall.Data | MsgUpdateEvmParams.Data - export type Proto = - | MsgCreate.Proto - | MsgCall.Proto - | MsgUpdateEvmParams.Proto; + export type Proto = MsgCreate.Proto | MsgCall.Proto | MsgUpdateEvmParams.Proto } diff --git a/src/core/feegrant/allowances/AllowedMsgAllowance.ts b/src/core/feegrant/allowances/AllowedMsgAllowance.ts index b7bb0ee..0b2f77a 100644 --- a/src/core/feegrant/allowances/AllowedMsgAllowance.ts +++ b/src/core/feegrant/allowances/AllowedMsgAllowance.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { BasicAllowance } from './BasicAllowance'; -import { PeriodicAllowance } from './PeriodicAllowance'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { AllowedMsgAllowance as AllowedMsgAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant'; +import { JSONSerializable } from '../../../util/json' +import { BasicAllowance } from './BasicAllowance' +import { PeriodicAllowance } from './PeriodicAllowance' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { AllowedMsgAllowance as AllowedMsgAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant' /** * AllowedMsgAllowance creates allowance only for specified message types. @@ -20,7 +20,7 @@ export class AllowedMsgAllowance extends JSONSerializable< public allowance: BasicAllowance | PeriodicAllowance, public allowed_messages: string[] ) { - super(); + super() } public static fromAmino( @@ -28,94 +28,94 @@ export class AllowedMsgAllowance extends JSONSerializable< ): AllowedMsgAllowance { const { value: { allowance, allowed_messages }, - } = data; + } = data return new AllowedMsgAllowance( allowance.type === 'cosmos-sdk/BasicAllowance' ? BasicAllowance.fromAmino(allowance) : PeriodicAllowance.fromAmino(allowance), allowed_messages - ); + ) } public toAmino(): AllowedMsgAllowance.Amino { - const { allowance, allowed_messages } = this; + const { allowance, allowed_messages } = this return { type: 'cosmos-sdk/AllowedMsgAllowance', value: { allowance: allowance.toAmino(), allowed_messages, }, - }; + } } public static fromData(proto: AllowedMsgAllowance.Data): AllowedMsgAllowance { - const { allowance, allowed_messages } = proto; + const { allowance, allowed_messages } = proto return new AllowedMsgAllowance( allowance['@type'] === '/cosmos.feegrant.v1beta1.BasicAllowance' ? BasicAllowance.fromData(allowance) : PeriodicAllowance.fromData(allowance), allowed_messages - ); + ) } public toData(): AllowedMsgAllowance.Data { - const { allowance, allowed_messages } = this; + const { allowance, allowed_messages } = this return { '@type': '/cosmos.feegrant.v1beta1.AllowedMsgAllowance', allowance: allowance.toData(), allowed_messages, - }; + } } public static fromProto( proto: AllowedMsgAllowance.Proto ): AllowedMsgAllowance { - const allowance = proto.allowance as Any; + const allowance = proto.allowance as Any return new AllowedMsgAllowance( allowance?.typeUrl === '/cosmos.feegrant.v1beta1.BasicAllowance' ? BasicAllowance.unpackAny(allowance) : PeriodicAllowance.unpackAny(allowance), proto.allowedMessages - ); + ) } public toProto(): AllowedMsgAllowance.Proto { - const { allowance, allowed_messages } = this; + const { allowance, allowed_messages } = this return AllowedMsgAllowance_pb.fromPartial({ allowance: allowance.packAny(), allowedMessages: allowed_messages, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.feegrant.v1beta1.AllowedMsgAllowance', value: AllowedMsgAllowance_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): AllowedMsgAllowance { return AllowedMsgAllowance.fromProto( AllowedMsgAllowance_pb.decode(msgAny.value) - ); + ) } } export namespace AllowedMsgAllowance { export interface Amino { - type: 'cosmos-sdk/AllowedMsgAllowance'; + type: 'cosmos-sdk/AllowedMsgAllowance' value: { - allowance: BasicAllowance.Amino | PeriodicAllowance.Amino; - allowed_messages: string[]; - }; + allowance: BasicAllowance.Amino | PeriodicAllowance.Amino + allowed_messages: string[] + } } export interface Data { - '@type': '/cosmos.feegrant.v1beta1.AllowedMsgAllowance'; - allowance: BasicAllowance.Data | PeriodicAllowance.Data; - allowed_messages: string[]; + '@type': '/cosmos.feegrant.v1beta1.AllowedMsgAllowance' + allowance: BasicAllowance.Data | PeriodicAllowance.Data + allowed_messages: string[] } - export type Proto = AllowedMsgAllowance_pb; + export type Proto = AllowedMsgAllowance_pb } diff --git a/src/core/feegrant/allowances/BasicAllowance.spec.ts b/src/core/feegrant/allowances/BasicAllowance.spec.ts index 3ed5e6a..7d2cfc4 100644 --- a/src/core/feegrant/allowances/BasicAllowance.spec.ts +++ b/src/core/feegrant/allowances/BasicAllowance.spec.ts @@ -1,57 +1,55 @@ -import { Coins } from '../../Coins'; -import { BasicAllowance } from './BasicAllowance'; +import { Coins } from '../../Coins' +import { BasicAllowance } from './BasicAllowance' describe('BasicAllowance', () => { it('both set', () => { - const now = new Date(); - const ba = new BasicAllowance('1000uinit', now); + const now = new Date() + const ba = new BasicAllowance('1000uinit', now) - expect(ba.toData().spend_limit).toEqual(new Coins('1000uinit').toData()); - expect(ba.toData().expiration).toEqual(now.toISOString()); - expect(ba.toProto().spendLimit).toEqual(new Coins('1000uinit').toProto()); - expect(ba.toProto().expiration).toEqual(now); + expect(ba.toData().spend_limit).toEqual(new Coins('1000uinit').toData()) + expect(ba.toData().expiration).toEqual(now.toISOString()) + expect(ba.toProto().spendLimit).toEqual(new Coins('1000uinit').toProto()) + expect(ba.toProto().expiration).toEqual(now) expect(ba.toAmino().value.spend_limit).toEqual( new Coins('1000uinit').toAmino() - ); - expect(ba.toAmino().value.expiration).toEqual(now.toISOString()); - }); + ) + expect(ba.toAmino().value.expiration).toEqual(now.toISOString()) + }) it('spend_limit only', () => { - const ba = new BasicAllowance('1000uinit', undefined); + const ba = new BasicAllowance('1000uinit', undefined) - expect(ba.toData().spend_limit).toEqual(new Coins('1000uinit').toData()); - expect(ba.toData().expiration).toBeUndefined(); - expect(ba.toProto().spendLimit).toEqual(new Coins('1000uinit').toProto()); - expect(ba.toProto().expiration).toBeUndefined(); + expect(ba.toData().spend_limit).toEqual(new Coins('1000uinit').toData()) + expect(ba.toData().expiration).toBeUndefined() + expect(ba.toProto().spendLimit).toEqual(new Coins('1000uinit').toProto()) + expect(ba.toProto().expiration).toBeUndefined() expect(ba.toAmino().value.spend_limit).toEqual( new Coins('1000uinit').toAmino() - ); - expect(ba.toAmino().value.expiration).toBeUndefined(); - }); + ) + expect(ba.toAmino().value.expiration).toBeUndefined() + }) it('expiration only', () => { - const now = new Date(); - const ba = new BasicAllowance(undefined, now); + const now = new Date() + const ba = new BasicAllowance(undefined, now) - expect(ba.toData().spend_limit).toEqual(undefined); - expect(ba.toData().expiration).toEqual(now.toISOString()); - expect(ba.toProto().spendLimit).toHaveLength(0); - expect(ba.toProto().expiration).toEqual(now); - expect(ba.toAmino().value.spend_limit).toBeUndefined(); - expect(ba.toAmino().value.expiration).toEqual(now.toISOString()); - }); + expect(ba.toData().spend_limit).toEqual(undefined) + expect(ba.toData().expiration).toEqual(now.toISOString()) + expect(ba.toProto().spendLimit).toHaveLength(0) + expect(ba.toProto().expiration).toEqual(now) + expect(ba.toAmino().value.spend_limit).toBeUndefined() + expect(ba.toAmino().value.expiration).toEqual(now.toISOString()) + }) it('spend_limit has zero amount', () => { - expect( - () => new BasicAllowance('1uinit,-1uinit', undefined) - ).toThrowError(); - expect(() => new BasicAllowance('0uinit', undefined)).toThrowError(); - expect(() => new BasicAllowance('-1204uinit', undefined)).toThrowError(); - }); + expect(() => new BasicAllowance('1uinit,-1uinit', undefined)).toThrowError() + expect(() => new BasicAllowance('0uinit', undefined)).toThrowError() + expect(() => new BasicAllowance('-1204uinit', undefined)).toThrowError() + }) it('allow both empty', () => { - const ba = new BasicAllowance(); - expect(ba.spend_limit).toBeUndefined(); - expect(ba.expiration).toBeUndefined(); - }); -}); + const ba = new BasicAllowance() + expect(ba.spend_limit).toBeUndefined() + expect(ba.expiration).toBeUndefined() + }) +}) diff --git a/src/core/feegrant/allowances/BasicAllowance.ts b/src/core/feegrant/allowances/BasicAllowance.ts index ebefe6f..f386b99 100644 --- a/src/core/feegrant/allowances/BasicAllowance.ts +++ b/src/core/feegrant/allowances/BasicAllowance.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { num } from '../../num'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { BasicAllowance as BasicAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { num } from '../../num' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { BasicAllowance as BasicAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant' /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -13,111 +13,114 @@ export class BasicAllowance extends JSONSerializable< BasicAllowance.Data, BasicAllowance.Proto > { - public spend_limit?: Coins; + public spend_limit?: Coins /** * @param spend_limit spend_limit allowed to be spent as fee * @param expiration allowance's expiration */ - constructor(spend_limit?: Coins.Input, public expiration?: Date) { - super(); - let hasNotPositive = false; + constructor( + spend_limit?: Coins.Input, + public expiration?: Date + ) { + super() + let hasNotPositive = false if (spend_limit) { - this.spend_limit = new Coins(spend_limit); - this.spend_limit.map(c => { + this.spend_limit = new Coins(spend_limit) + this.spend_limit.map((c) => { // isPositive() from decimal.js returns true when the amount is 0. // but Coins.IsAllPositive() from cosmos-sdk will return false in same case. // so we use lessThanorEquenTo(0) instead of isPositive() == false if (num(c.amount).isLessThanOrEqualTo(0)) { - hasNotPositive = true; + hasNotPositive = true } - }); + }) } if (spend_limit && hasNotPositive) { - throw new Error('spend_limit must be positive'); + throw new Error('spend_limit must be positive') } } public static fromAmino(data: BasicAllowance.Amino): BasicAllowance { const { value: { spend_limit, expiration }, - } = data; + } = data return new BasicAllowance( spend_limit ? Coins.fromAmino(spend_limit) : undefined, expiration ? new Date(expiration) : undefined - ); + ) } public toAmino(): BasicAllowance.Amino { - const { spend_limit, expiration } = this; + const { spend_limit, expiration } = this return { type: 'cosmos-sdk/BasicAllowance', value: { spend_limit: spend_limit?.toAmino(), expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), }, - }; + } } public static fromData(proto: BasicAllowance.Data): BasicAllowance { - const { spend_limit, expiration } = proto; + const { spend_limit, expiration } = proto return new BasicAllowance( spend_limit ? Coins.fromData(spend_limit) : undefined, expiration ? new Date(expiration) : undefined - ); + ) } public toData(): BasicAllowance.Data { - const { spend_limit, expiration } = this; + const { spend_limit, expiration } = this return { '@type': '/cosmos.feegrant.v1beta1.BasicAllowance', spend_limit: spend_limit?.toData(), expiration: expiration?.toISOString().replace(/\.000Z$/, 'Z'), - }; + } } public static fromProto(proto: BasicAllowance.Proto): BasicAllowance { return new BasicAllowance( Coins.fromProto(proto.spendLimit), proto.expiration - ); + ) } public toProto(): BasicAllowance.Proto { - const { spend_limit, expiration } = this; + const { spend_limit, expiration } = this return BasicAllowance_pb.fromPartial({ expiration, spendLimit: spend_limit?.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.feegrant.v1beta1.BasicAllowance', value: BasicAllowance_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): BasicAllowance { - return BasicAllowance.fromProto(BasicAllowance_pb.decode(msgAny.value)); + return BasicAllowance.fromProto(BasicAllowance_pb.decode(msgAny.value)) } } export namespace BasicAllowance { export interface Amino { - type: 'cosmos-sdk/BasicAllowance'; + type: 'cosmos-sdk/BasicAllowance' value: { - spend_limit?: Coins.Amino; - expiration?: string; - }; + spend_limit?: Coins.Amino + expiration?: string + } } export interface Data { - '@type': '/cosmos.feegrant.v1beta1.BasicAllowance'; - spend_limit?: Coins.Data; - expiration?: string; + '@type': '/cosmos.feegrant.v1beta1.BasicAllowance' + spend_limit?: Coins.Data + expiration?: string } - export type Proto = BasicAllowance_pb; + export type Proto = BasicAllowance_pb } diff --git a/src/core/feegrant/allowances/PeriodicAllowance.ts b/src/core/feegrant/allowances/PeriodicAllowance.ts index 49c5376..7f7c73c 100644 --- a/src/core/feegrant/allowances/PeriodicAllowance.ts +++ b/src/core/feegrant/allowances/PeriodicAllowance.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { Duration } from '../../Duration'; -import { BasicAllowance } from './BasicAllowance'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { PeriodicAllowance as PeriodicAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { Duration } from '../../Duration' +import { BasicAllowance } from './BasicAllowance' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { PeriodicAllowance as PeriodicAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/feegrant' /** * PeriodicAllowance extends Allowance to allow for both a maximum cap, @@ -14,8 +14,8 @@ export class PeriodicAllowance extends JSONSerializable< PeriodicAllowance.Data, PeriodicAllowance.Proto > { - public period_spend_limit: Coins; - public period_can_spend: Coins; + public period_spend_limit: Coins + public period_can_spend: Coins /** * @param basic basic allowance given per period @@ -31,10 +31,10 @@ export class PeriodicAllowance extends JSONSerializable< period_can_spend: Coins.Input, public period_reset: Date ) { - super(); + super() - this.period_spend_limit = new Coins(period_spend_limit); - this.period_can_spend = new Coins(period_can_spend); + this.period_spend_limit = new Coins(period_spend_limit) + this.period_can_spend = new Coins(period_can_spend) } public static fromAmino(data: PeriodicAllowance.Amino): PeriodicAllowance { @@ -46,7 +46,7 @@ export class PeriodicAllowance extends JSONSerializable< period_can_spend, period_reset, }, - } = data; + } = data return new PeriodicAllowance( BasicAllowance.fromAmino(basic), @@ -54,7 +54,7 @@ export class PeriodicAllowance extends JSONSerializable< Coins.fromAmino(period_spend_limit), Coins.fromAmino(period_can_spend), new Date(period_reset) - ); + ) } public toAmino(): PeriodicAllowance.Amino { @@ -64,7 +64,7 @@ export class PeriodicAllowance extends JSONSerializable< period_spend_limit, period_can_spend, period_reset, - } = this; + } = this return { type: 'cosmos-sdk/PeriodicAllowance', value: { @@ -74,7 +74,7 @@ export class PeriodicAllowance extends JSONSerializable< period_can_spend: period_can_spend.toAmino(), period_reset: period_reset.toISOString().replace(/\.000Z$/, 'Z'), }, - }; + } } public static fromData(proto: PeriodicAllowance.Data): PeriodicAllowance { @@ -84,14 +84,14 @@ export class PeriodicAllowance extends JSONSerializable< period_spend_limit, period_can_spend, period_reset, - } = proto; + } = proto return new PeriodicAllowance( BasicAllowance.fromData(basic), Duration.fromData(period), Coins.fromData(period_spend_limit), Coins.fromData(period_can_spend), new Date(period_reset) - ); + ) } public toData(): PeriodicAllowance.Data { @@ -101,7 +101,7 @@ export class PeriodicAllowance extends JSONSerializable< period_spend_limit, period_can_spend, period_reset, - } = this; + } = this return { '@type': '/cosmos.feegrant.v1beta1.PeriodicAllowance', basic: basic.toData(), @@ -109,7 +109,7 @@ export class PeriodicAllowance extends JSONSerializable< period_spend_limit: period_spend_limit.toData(), period_can_spend: period_can_spend.toData(), period_reset: period_reset.toISOString().replace(/\.000Z$/, 'Z'), - }; + } } public static fromProto(proto: PeriodicAllowance.Proto): PeriodicAllowance { @@ -119,7 +119,7 @@ export class PeriodicAllowance extends JSONSerializable< Coins.fromProto(proto.periodSpendLimit), Coins.fromProto(proto.periodCanSpend), proto.periodReset as Date - ); + ) } public toProto(): PeriodicAllowance.Proto { @@ -129,7 +129,7 @@ export class PeriodicAllowance extends JSONSerializable< period_spend_limit, period_can_spend, period_reset, - } = this; + } = this return PeriodicAllowance_pb.fromPartial({ basic: basic.toProto(), @@ -137,43 +137,43 @@ export class PeriodicAllowance extends JSONSerializable< periodCanSpend: period_can_spend.toProto(), periodReset: period_reset, periodSpendLimit: period_spend_limit.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.feegrant.v1beta1.PeriodicAllowance', value: PeriodicAllowance_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): PeriodicAllowance { return PeriodicAllowance.fromProto( PeriodicAllowance_pb.decode(msgAny.value) - ); + ) } } export namespace PeriodicAllowance { export interface Amino { - type: 'cosmos-sdk/PeriodicAllowance'; + type: 'cosmos-sdk/PeriodicAllowance' value: { - basic: BasicAllowance.Amino; - period: Duration.Amino; - period_spend_limit: Coins.Amino; - period_can_spend: Coins.Amino; - period_reset: string; - }; + basic: BasicAllowance.Amino + period: Duration.Amino + period_spend_limit: Coins.Amino + period_can_spend: Coins.Amino + period_reset: string + } } export interface Data { - '@type': '/cosmos.feegrant.v1beta1.PeriodicAllowance'; - basic: BasicAllowance.Data; - period: Duration.Data; - period_spend_limit: Coins.Data; - period_can_spend: Coins.Data; - period_reset: string; + '@type': '/cosmos.feegrant.v1beta1.PeriodicAllowance' + basic: BasicAllowance.Data + period: Duration.Data + period_spend_limit: Coins.Data + period_can_spend: Coins.Data + period_reset: string } - export type Proto = PeriodicAllowance_pb; + export type Proto = PeriodicAllowance_pb } diff --git a/src/core/feegrant/allowances/index.ts b/src/core/feegrant/allowances/index.ts index c92433e..3b21732 100644 --- a/src/core/feegrant/allowances/index.ts +++ b/src/core/feegrant/allowances/index.ts @@ -1,65 +1,62 @@ -import { BasicAllowance } from './BasicAllowance'; -import { PeriodicAllowance } from './PeriodicAllowance'; -import { AllowedMsgAllowance } from './AllowedMsgAllowance'; +import { BasicAllowance } from './BasicAllowance' +import { PeriodicAllowance } from './PeriodicAllowance' +import { AllowedMsgAllowance } from './AllowedMsgAllowance' -export * from './BasicAllowance'; -export * from './PeriodicAllowance'; -export * from './AllowedMsgAllowance'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +export * from './BasicAllowance' +export * from './PeriodicAllowance' +export * from './AllowedMsgAllowance' +import { Any } from '@initia/initia.proto/google/protobuf/any' -export type Allowance = - | BasicAllowance - | PeriodicAllowance - | AllowedMsgAllowance; +export type Allowance = BasicAllowance | PeriodicAllowance | AllowedMsgAllowance export namespace Allowance { export type Amino = | BasicAllowance.Amino | PeriodicAllowance.Amino - | AllowedMsgAllowance.Amino; + | AllowedMsgAllowance.Amino export type Data = | BasicAllowance.Data | PeriodicAllowance.Data - | AllowedMsgAllowance.Data; + | AllowedMsgAllowance.Data export type Proto = | BasicAllowance.Proto | PeriodicAllowance.Proto - | AllowedMsgAllowance.Proto; + | AllowedMsgAllowance.Proto export function fromAmino(data: Allowance.Amino): Allowance { switch (data.type) { case 'cosmos-sdk/BasicAllowance': - return BasicAllowance.fromAmino(data); + return BasicAllowance.fromAmino(data) case 'cosmos-sdk/PeriodicAllowance': - return PeriodicAllowance.fromAmino(data); + return PeriodicAllowance.fromAmino(data) case 'cosmos-sdk/AllowedMsgAllowance': - return AllowedMsgAllowance.fromAmino(data); + return AllowedMsgAllowance.fromAmino(data) } } export function fromData(data: Allowance.Data): Allowance { switch (data['@type']) { case '/cosmos.feegrant.v1beta1.PeriodicAllowance': - return PeriodicAllowance.fromData(data); + return PeriodicAllowance.fromData(data) case '/cosmos.feegrant.v1beta1.BasicAllowance': - return BasicAllowance.fromData(data); + return BasicAllowance.fromData(data) case '/cosmos.feegrant.v1beta1.AllowedMsgAllowance': - return AllowedMsgAllowance.fromData(data); + return AllowedMsgAllowance.fromData(data) } } export function fromProto(proto: Any): Allowance { switch (proto.typeUrl) { case '/cosmos.feegrant.v1beta1.PeriodicAllowance': - return PeriodicAllowance.unpackAny(proto); + return PeriodicAllowance.unpackAny(proto) case '/cosmos.feegrant.v1beta1.BasicAllowance': - return BasicAllowance.unpackAny(proto); + return BasicAllowance.unpackAny(proto) case '/cosmos.feegrant.v1beta1.AllowedMsgAllowance': - return AllowedMsgAllowance.unpackAny(proto); + return AllowedMsgAllowance.unpackAny(proto) } - throw new Error(`not supported allowance ${proto.typeUrl}`); + throw new Error(`not supported allowance ${proto.typeUrl}`) } } diff --git a/src/core/feegrant/index.ts b/src/core/feegrant/index.ts index c64e0bd..c6d146e 100644 --- a/src/core/feegrant/index.ts +++ b/src/core/feegrant/index.ts @@ -1,2 +1,2 @@ -export * from './allowances'; -export * from './msgs'; +export * from './allowances' +export * from './msgs' diff --git a/src/core/feegrant/msgs/MsgGrantAllowance.ts b/src/core/feegrant/msgs/MsgGrantAllowance.ts index 3c665ce..1495372 100644 --- a/src/core/feegrant/msgs/MsgGrantAllowance.ts +++ b/src/core/feegrant/msgs/MsgGrantAllowance.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Allowance } from '../allowances'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGrantAllowance as MsgGrantAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Allowance } from '../allowances' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGrantAllowance as MsgGrantAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/tx' /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -24,22 +24,22 @@ export class MsgGrantAllowance extends JSONSerializable< public grantee: AccAddress, public allowance: Allowance ) { - super(); + super() } public static fromAmino(data: MsgGrantAllowance.Amino): MsgGrantAllowance { const { value: { granter, grantee, allowance }, - } = data; + } = data return new MsgGrantAllowance( granter, grantee, Allowance.fromAmino(allowance) - ); + ) } public toAmino(): MsgGrantAllowance.Amino { - const { granter, grantee, allowance } = this; + const { granter, grantee, allowance } = this return { type: 'cosmos-sdk/MsgGrantAllowance', value: { @@ -47,26 +47,26 @@ export class MsgGrantAllowance extends JSONSerializable< grantee, allowance: allowance.toAmino(), }, - }; + } } public static fromData(data: MsgGrantAllowance.Data): MsgGrantAllowance { - const { granter, grantee, allowance } = data; + const { granter, grantee, allowance } = data return new MsgGrantAllowance( granter, grantee, Allowance.fromData(allowance) - ); + ) } public toData(): MsgGrantAllowance.Data { - const { granter, grantee, allowance } = this; + const { granter, grantee, allowance } = this return { '@type': '/cosmos.feegrant.v1beta1.MsgGrantAllowance', granter, grantee, allowance: allowance.toData(), - }; + } } public static fromProto(proto: MsgGrantAllowance.Proto): MsgGrantAllowance { @@ -74,48 +74,48 @@ export class MsgGrantAllowance extends JSONSerializable< proto.granter, proto.grantee, Allowance.fromProto(proto.allowance as Any) - ); + ) } public toProto(): MsgGrantAllowance.Proto { - const { granter, grantee, allowance } = this; + const { granter, grantee, allowance } = this return MsgGrantAllowance_pb.fromPartial({ allowance: allowance.packAny(), grantee, granter, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.feegrant.v1beta1.MsgGrantAllowance', value: MsgGrantAllowance_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGrantAllowance { return MsgGrantAllowance.fromProto( MsgGrantAllowance_pb.decode(msgAny.value) - ); + ) } } export namespace MsgGrantAllowance { export interface Amino { - type: 'cosmos-sdk/MsgGrantAllowance'; + type: 'cosmos-sdk/MsgGrantAllowance' value: { - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance.Amino; - }; + granter: AccAddress + grantee: AccAddress + allowance: Allowance.Amino + } } export interface Data { - '@type': '/cosmos.feegrant.v1beta1.MsgGrantAllowance'; - granter: AccAddress; - grantee: AccAddress; - allowance: Allowance.Data; + '@type': '/cosmos.feegrant.v1beta1.MsgGrantAllowance' + granter: AccAddress + grantee: AccAddress + allowance: Allowance.Data } - export type Proto = MsgGrantAllowance_pb; + export type Proto = MsgGrantAllowance_pb } diff --git a/src/core/feegrant/msgs/MsgRevokeAllowance.ts b/src/core/feegrant/msgs/MsgRevokeAllowance.ts index 23b386b..7f7f653 100644 --- a/src/core/feegrant/msgs/MsgRevokeAllowance.ts +++ b/src/core/feegrant/msgs/MsgRevokeAllowance.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRevokeAllowance as MsgRevokeAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRevokeAllowance as MsgRevokeAllowance_pb } from '@initia/initia.proto/cosmos/feegrant/v1beta1/tx' /** * MsgRevokeAllowance remove permission any existing Allowance from Granter to Grantee. @@ -16,82 +16,85 @@ export class MsgRevokeAllowance extends JSONSerializable< * @param granter granter's account address * @param grantee grantee's account address */ - constructor(public granter: AccAddress, public grantee: AccAddress) { - super(); + constructor( + public granter: AccAddress, + public grantee: AccAddress + ) { + super() } public static fromAmino(data: MsgRevokeAllowance.Amino): MsgRevokeAllowance { const { value: { granter, grantee }, - } = data; - return new MsgRevokeAllowance(granter, grantee); + } = data + return new MsgRevokeAllowance(granter, grantee) } public toAmino(): MsgRevokeAllowance.Amino { - const { granter, grantee } = this; + const { granter, grantee } = this return { type: 'cosmos-sdk/MsgRevokeAllowance', value: { granter, grantee, }, - }; + } } public static fromData(proto: MsgRevokeAllowance.Data): MsgRevokeAllowance { - const { granter, grantee } = proto; - return new MsgRevokeAllowance(granter, grantee); + const { granter, grantee } = proto + return new MsgRevokeAllowance(granter, grantee) } public toData(): MsgRevokeAllowance.Data { - const { granter, grantee } = this; + const { granter, grantee } = this return { '@type': '/cosmos.feegrant.v1beta1.MsgRevokeAllowance', granter, grantee, - }; + } } public static fromProto(proto: MsgRevokeAllowance.Proto): MsgRevokeAllowance { - return new MsgRevokeAllowance(proto.granter, proto.grantee); + return new MsgRevokeAllowance(proto.granter, proto.grantee) } public toProto(): MsgRevokeAllowance.Proto { - const { granter, grantee } = this; + const { granter, grantee } = this return MsgRevokeAllowance_pb.fromPartial({ grantee, granter, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.feegrant.v1beta1.MsgRevokeAllowance', value: MsgRevokeAllowance_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRevokeAllowance { return MsgRevokeAllowance.fromProto( MsgRevokeAllowance_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRevokeAllowance { export interface Amino { - type: 'cosmos-sdk/MsgRevokeAllowance'; + type: 'cosmos-sdk/MsgRevokeAllowance' value: { - granter: AccAddress; - grantee: AccAddress; - }; + granter: AccAddress + grantee: AccAddress + } } export interface Data { - '@type': '/cosmos.feegrant.v1beta1.MsgRevokeAllowance'; - granter: AccAddress; - grantee: AccAddress; + '@type': '/cosmos.feegrant.v1beta1.MsgRevokeAllowance' + granter: AccAddress + grantee: AccAddress } - export type Proto = MsgRevokeAllowance_pb; + export type Proto = MsgRevokeAllowance_pb } diff --git a/src/core/feegrant/msgs/index.ts b/src/core/feegrant/msgs/index.ts index f4225f9..59cae97 100644 --- a/src/core/feegrant/msgs/index.ts +++ b/src/core/feegrant/msgs/index.ts @@ -1,13 +1,13 @@ -import { MsgGrantAllowance } from './MsgGrantAllowance'; -import { MsgRevokeAllowance } from './MsgRevokeAllowance'; +import { MsgGrantAllowance } from './MsgGrantAllowance' +import { MsgRevokeAllowance } from './MsgRevokeAllowance' -export * from './MsgGrantAllowance'; -export * from './MsgRevokeAllowance'; +export * from './MsgGrantAllowance' +export * from './MsgRevokeAllowance' -export type FeeGrantMsg = MsgGrantAllowance | MsgRevokeAllowance; +export type FeeGrantMsg = MsgGrantAllowance | MsgRevokeAllowance export namespace FeeGrantMsg { - export type Amino = MsgGrantAllowance.Amino | MsgRevokeAllowance.Amino; - export type Data = MsgGrantAllowance.Data | MsgRevokeAllowance.Data; - export type Proto = MsgGrantAllowance.Proto | MsgRevokeAllowance.Proto; + export type Amino = MsgGrantAllowance.Amino | MsgRevokeAllowance.Amino + export type Data = MsgGrantAllowance.Data | MsgRevokeAllowance.Data + export type Proto = MsgGrantAllowance.Proto | MsgRevokeAllowance.Proto } diff --git a/src/core/forwarding/index.ts b/src/core/forwarding/index.ts index 231cb79..01eded2 100644 --- a/src/core/forwarding/index.ts +++ b/src/core/forwarding/index.ts @@ -1 +1 @@ -export * from './msgs'; +export * from './msgs' diff --git a/src/core/forwarding/msgs/MsgClearForwardingAccount.ts b/src/core/forwarding/msgs/MsgClearForwardingAccount.ts index 5cef1c2..d4fa67f 100644 --- a/src/core/forwarding/msgs/MsgClearForwardingAccount.ts +++ b/src/core/forwarding/msgs/MsgClearForwardingAccount.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgClearAccount as MsgClearAccount_pb } from '@initia/initia.proto/noble/forwarding/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgClearAccount as MsgClearAccount_pb } from '@initia/initia.proto/noble/forwarding/v1/tx' export class MsgClearForwardingAccount extends JSONSerializable< MsgClearForwardingAccount.Amino, @@ -12,8 +12,11 @@ export class MsgClearForwardingAccount extends JSONSerializable< * @param signer * @param address */ - constructor(public signer: AccAddress, public address: string) { - super(); + constructor( + public signer: AccAddress, + public address: string + ) { + super() } public static fromAmino( @@ -21,79 +24,79 @@ export class MsgClearForwardingAccount extends JSONSerializable< ): MsgClearForwardingAccount { const { value: { signer, address }, - } = data; - return new MsgClearForwardingAccount(signer, address); + } = data + return new MsgClearForwardingAccount(signer, address) } public toAmino(): MsgClearForwardingAccount.Amino { - const { signer, address } = this; + const { signer, address } = this return { type: 'noble/forwarding/ClearAccount', value: { signer, address, }, - }; + } } public static fromData( data: MsgClearForwardingAccount.Data ): MsgClearForwardingAccount { - const { signer, address } = data; - return new MsgClearForwardingAccount(signer, address); + const { signer, address } = data + return new MsgClearForwardingAccount(signer, address) } public toData(): MsgClearForwardingAccount.Data { - const { signer, address } = this; + const { signer, address } = this return { '@type': '/noble.forwarding.v1.MsgClearAccount', signer, address, - }; + } } public static fromProto( data: MsgClearForwardingAccount.Proto ): MsgClearForwardingAccount { - return new MsgClearForwardingAccount(data.signer, data.address); + return new MsgClearForwardingAccount(data.signer, data.address) } public toProto(): MsgClearForwardingAccount.Proto { - const { signer, address } = this; + const { signer, address } = this return MsgClearAccount_pb.fromPartial({ signer, address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/noble.forwarding.v1.MsgClearAccount', value: MsgClearAccount_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgClearForwardingAccount { return MsgClearForwardingAccount.fromProto( MsgClearAccount_pb.decode(msgAny.value) - ); + ) } } export namespace MsgClearForwardingAccount { export interface Amino { - type: 'noble/forwarding/ClearAccount'; + type: 'noble/forwarding/ClearAccount' value: { - signer: AccAddress; - address: string; - }; + signer: AccAddress + address: string + } } export interface Data { - '@type': '/noble.forwarding.v1.MsgClearAccount'; - signer: AccAddress; - address: string; + '@type': '/noble.forwarding.v1.MsgClearAccount' + signer: AccAddress + address: string } - export type Proto = MsgClearAccount_pb; + export type Proto = MsgClearAccount_pb } diff --git a/src/core/forwarding/msgs/MsgRegisterForwardingAccount.ts b/src/core/forwarding/msgs/MsgRegisterForwardingAccount.ts index c9cddaf..e37f166 100644 --- a/src/core/forwarding/msgs/MsgRegisterForwardingAccount.ts +++ b/src/core/forwarding/msgs/MsgRegisterForwardingAccount.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRegisterAccount as MsgRegisterAccount_pb } from '@initia/initia.proto/noble/forwarding/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRegisterAccount as MsgRegisterAccount_pb } from '@initia/initia.proto/noble/forwarding/v1/tx' export class MsgRegisterForwardingAccount extends JSONSerializable< MsgRegisterForwardingAccount.Amino, @@ -18,7 +18,7 @@ export class MsgRegisterForwardingAccount extends JSONSerializable< public recipient: string, public channel: string ) { - super(); + super() } public static fromAmino( @@ -26,12 +26,12 @@ export class MsgRegisterForwardingAccount extends JSONSerializable< ): MsgRegisterForwardingAccount { const { value: { signer, recipient, channel }, - } = data; - return new MsgRegisterForwardingAccount(signer, recipient, channel); + } = data + return new MsgRegisterForwardingAccount(signer, recipient, channel) } public toAmino(): MsgRegisterForwardingAccount.Amino { - const { signer, recipient, channel } = this; + const { signer, recipient, channel } = this return { type: 'noble/forwarding/RegisterAccount', value: { @@ -39,24 +39,24 @@ export class MsgRegisterForwardingAccount extends JSONSerializable< recipient, channel, }, - }; + } } public static fromData( data: MsgRegisterForwardingAccount.Data ): MsgRegisterForwardingAccount { - const { signer, recipient, channel } = data; - return new MsgRegisterForwardingAccount(signer, recipient, channel); + const { signer, recipient, channel } = data + return new MsgRegisterForwardingAccount(signer, recipient, channel) } public toData(): MsgRegisterForwardingAccount.Data { - const { signer, recipient, channel } = this; + const { signer, recipient, channel } = this return { '@type': '/noble.forwarding.v1.MsgRegisterAccount', signer, recipient, channel, - }; + } } public static fromProto( @@ -66,48 +66,48 @@ export class MsgRegisterForwardingAccount extends JSONSerializable< data.signer, data.recipient, data.channel - ); + ) } public toProto(): MsgRegisterForwardingAccount.Proto { - const { signer, recipient, channel } = this; + const { signer, recipient, channel } = this return MsgRegisterAccount_pb.fromPartial({ signer, recipient, channel, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/noble.forwarding.v1.MsgRegisterAccount', value: MsgRegisterAccount_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRegisterForwardingAccount { return MsgRegisterForwardingAccount.fromProto( MsgRegisterAccount_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRegisterForwardingAccount { export interface Amino { - type: 'noble/forwarding/RegisterAccount'; + type: 'noble/forwarding/RegisterAccount' value: { - signer: AccAddress; - recipient: string; - channel: string; - }; + signer: AccAddress + recipient: string + channel: string + } } export interface Data { - '@type': '/noble.forwarding.v1.MsgRegisterAccount'; - signer: AccAddress; - recipient: string; - channel: string; + '@type': '/noble.forwarding.v1.MsgRegisterAccount' + signer: AccAddress + recipient: string + channel: string } - export type Proto = MsgRegisterAccount_pb; + export type Proto = MsgRegisterAccount_pb } diff --git a/src/core/forwarding/msgs/index.ts b/src/core/forwarding/msgs/index.ts index 0e329d4..367b722 100644 --- a/src/core/forwarding/msgs/index.ts +++ b/src/core/forwarding/msgs/index.ts @@ -1,23 +1,23 @@ -import { MsgRegisterForwardingAccount } from './MsgRegisterForwardingAccount'; -import { MsgClearForwardingAccount } from './MsgClearForwardingAccount'; +import { MsgRegisterForwardingAccount } from './MsgRegisterForwardingAccount' +import { MsgClearForwardingAccount } from './MsgClearForwardingAccount' -export * from './MsgRegisterForwardingAccount'; -export * from './MsgClearForwardingAccount'; +export * from './MsgRegisterForwardingAccount' +export * from './MsgClearForwardingAccount' export type ForwardingMsg = | MsgRegisterForwardingAccount - | MsgClearForwardingAccount; + | MsgClearForwardingAccount export namespace ForwardingMsg { export type Amino = | MsgRegisterForwardingAccount.Amino - | MsgClearForwardingAccount.Amino; + | MsgClearForwardingAccount.Amino export type Data = | MsgRegisterForwardingAccount.Data - | MsgClearForwardingAccount.Data; + | MsgClearForwardingAccount.Data export type Proto = | MsgRegisterForwardingAccount.Proto - | MsgClearForwardingAccount.Proto; + | MsgClearForwardingAccount.Proto } diff --git a/src/core/gov/Deposit.ts b/src/core/gov/Deposit.ts index 7d4be10..b80344f 100644 --- a/src/core/gov/Deposit.ts +++ b/src/core/gov/Deposit.ts @@ -1,8 +1,8 @@ -import { Coins } from '../Coins'; -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { Deposit as Deposit_pb } from '@initia/initia.proto/cosmos/gov/v1/gov'; -import Long from 'long'; +import { Coins } from '../Coins' +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { Deposit as Deposit_pb } from '@initia/initia.proto/cosmos/gov/v1/gov' +import Long from 'long' /** * Defines an amount deposited by an account address to an active proposal @@ -12,7 +12,7 @@ export class Deposit extends JSONSerializable< Deposit.Data, Deposit.Proto > { - public amount: Coins; + public amount: Coins /** * @param proposal_id the unique id of the proposal * @param depositor the deposit addresses from the proposals @@ -23,44 +23,44 @@ export class Deposit extends JSONSerializable< public depositor: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: Deposit.Amino): Deposit { - const { proposal_id, depositor, amount } = data; + const { proposal_id, depositor, amount } = data return new Deposit( Number.parseInt(proposal_id), depositor, Coins.fromAmino(amount) - ); + ) } public toAmino(): Deposit.Amino { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { proposal_id: proposal_id.toString(), depositor, amount: amount.toAmino(), - }; + } } public static fromData(data: Deposit.Data): Deposit { - const { proposal_id, depositor, amount } = data; + const { proposal_id, depositor, amount } = data return new Deposit( Number.parseInt(proposal_id), depositor, Coins.fromData(amount) - ); + ) } public toData(): Deposit.Data { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { proposal_id: proposal_id.toString(), depositor, amount: amount.toData(), - }; + } } public static fromProto(data: Deposit.Proto): Deposit { @@ -68,31 +68,31 @@ export class Deposit extends JSONSerializable< data.proposalId.toNumber(), data.depositor, Coins.fromProto(data.amount) - ); + ) } public toProto(): Deposit.Proto { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return Deposit_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), depositor: depositor, amount: amount.toProto(), - }); + }) } } export namespace Deposit { export interface Amino { - proposal_id: string; - depositor: AccAddress; - amount: Coins.Amino; + proposal_id: string + depositor: AccAddress + amount: Coins.Amino } export interface Data { - proposal_id: string; - depositor: AccAddress; - amount: Coins.Data; + proposal_id: string + depositor: AccAddress + amount: Coins.Data } - export type Proto = Deposit_pb; + export type Proto = Deposit_pb } diff --git a/src/core/gov/GovParams.ts b/src/core/gov/GovParams.ts index afe46e6..c0edbe2 100644 --- a/src/core/gov/GovParams.ts +++ b/src/core/gov/GovParams.ts @@ -1,17 +1,17 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { Coins } from '../Coins'; -import { Duration } from '../Duration'; -import { Params as Params_pb } from '@initia/initia.proto/initia/gov/v1/gov'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { Coins } from '../Coins' +import { Duration } from '../Duration' +import { Params as Params_pb } from '@initia/initia.proto/initia/gov/v1/gov' export class GovParams extends JSONSerializable< GovParams.Amino, GovParams.Data, GovParams.Proto > { - public min_deposit: Coins; - public expedited_min_deposit: Coins; - public emergency_min_deposit: Coins; + public min_deposit: Coins + public expedited_min_deposit: Coins + public emergency_min_deposit: Coins /** * @param min_deposit Minimum deposit for a proposal to enter voting period @@ -55,10 +55,10 @@ export class GovParams extends JSONSerializable< public emergency_tally_interval: Duration, public low_threshold_functions: string[] ) { - super(); - this.min_deposit = new Coins(min_deposit); - this.expedited_min_deposit = new Coins(expedited_min_deposit); - this.emergency_min_deposit = new Coins(emergency_min_deposit); + super() + this.min_deposit = new Coins(min_deposit) + this.expedited_min_deposit = new Coins(expedited_min_deposit) + this.emergency_min_deposit = new Coins(emergency_min_deposit) } public static fromAmino(data: GovParams.Amino): GovParams { @@ -82,7 +82,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit, emergency_tally_interval, low_threshold_functions, - } = data; + } = data return new GovParams( Coins.fromAmino(min_deposit), @@ -104,7 +104,7 @@ export class GovParams extends JSONSerializable< Coins.fromAmino(emergency_min_deposit), Duration.fromAmino(emergency_tally_interval), low_threshold_functions - ); + ) } public toAmino(): GovParams.Amino { @@ -128,7 +128,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit, emergency_tally_interval, low_threshold_functions, - } = this; + } = this return { min_deposit: min_deposit.toAmino(), @@ -150,7 +150,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit: emergency_min_deposit.toAmino(), emergency_tally_interval: emergency_tally_interval.toAmino(), low_threshold_functions, - }; + } } public static fromData(data: GovParams.Data): GovParams { @@ -174,7 +174,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit, emergency_tally_interval, low_threshold_functions, - } = data; + } = data return new GovParams( Coins.fromData(min_deposit), @@ -196,7 +196,7 @@ export class GovParams extends JSONSerializable< Coins.fromData(emergency_min_deposit), Duration.fromData(emergency_tally_interval), low_threshold_functions - ); + ) } public toData(): GovParams.Data { @@ -220,7 +220,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit, emergency_tally_interval, low_threshold_functions, - } = this; + } = this return { min_deposit: min_deposit.toData(), @@ -242,7 +242,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit: emergency_min_deposit.toData(), emergency_tally_interval: emergency_tally_interval.toData(), low_threshold_functions, - }; + } } public static fromProto(data: GovParams.Proto): GovParams { @@ -266,7 +266,7 @@ export class GovParams extends JSONSerializable< Coins.fromProto(data.emergencyMinDeposit), Duration.fromProto(data.emergencyTallyInterval as Duration.Proto), data.lowThresholdFunctions - ); + ) } public toProto(): GovParams.Proto { @@ -290,7 +290,7 @@ export class GovParams extends JSONSerializable< emergency_min_deposit, emergency_tally_interval, low_threshold_functions, - } = this; + } = this return Params_pb.fromPartial({ minDeposit: min_deposit.toProto(), @@ -312,54 +312,54 @@ export class GovParams extends JSONSerializable< emergencyMinDeposit: emergency_min_deposit.toProto(), emergencyTallyInterval: emergency_tally_interval.toProto(), lowThresholdFunctions: low_threshold_functions, - }); + }) } } export namespace GovParams { export interface Amino { - min_deposit: Coins.Amino; - max_deposit_period: Duration.Amino; - voting_period: Duration.Amino; - quorum: string; - threshold: string; - veto_threshold: string; - min_initial_deposit_ratio: string; - proposal_cancel_ratio: string; - proposal_cancel_dest: AccAddress; - expedited_voting_period: Duration.Amino; - expedited_threshold: string; - expedited_min_deposit: Coins.Amino; - burn_vote_quorum: boolean; - burn_proposal_deposit_prevote: boolean; - burn_vote_veto: boolean; - min_deposit_ratio: string; - emergency_min_deposit: Coins.Amino; - emergency_tally_interval: Duration.Amino; - low_threshold_functions: string[]; + min_deposit: Coins.Amino + max_deposit_period: Duration.Amino + voting_period: Duration.Amino + quorum: string + threshold: string + veto_threshold: string + min_initial_deposit_ratio: string + proposal_cancel_ratio: string + proposal_cancel_dest: AccAddress + expedited_voting_period: Duration.Amino + expedited_threshold: string + expedited_min_deposit: Coins.Amino + burn_vote_quorum: boolean + burn_proposal_deposit_prevote: boolean + burn_vote_veto: boolean + min_deposit_ratio: string + emergency_min_deposit: Coins.Amino + emergency_tally_interval: Duration.Amino + low_threshold_functions: string[] } export interface Data { - min_deposit: Coins.Data; - max_deposit_period: Duration.Data; - voting_period: Duration.Data; - quorum: string; - threshold: string; - veto_threshold: string; - min_initial_deposit_ratio: string; - proposal_cancel_ratio: string; - proposal_cancel_dest: AccAddress; - expedited_voting_period: Duration.Data; - expedited_threshold: string; - expedited_min_deposit: Coins.Data; - burn_vote_quorum: boolean; - burn_proposal_deposit_prevote: boolean; - burn_vote_veto: boolean; - min_deposit_ratio: string; - emergency_min_deposit: Coins.Data; - emergency_tally_interval: Duration.Data; - low_threshold_functions: string[]; + min_deposit: Coins.Data + max_deposit_period: Duration.Data + voting_period: Duration.Data + quorum: string + threshold: string + veto_threshold: string + min_initial_deposit_ratio: string + proposal_cancel_ratio: string + proposal_cancel_dest: AccAddress + expedited_voting_period: Duration.Data + expedited_threshold: string + expedited_min_deposit: Coins.Data + burn_vote_quorum: boolean + burn_proposal_deposit_prevote: boolean + burn_vote_veto: boolean + min_deposit_ratio: string + emergency_min_deposit: Coins.Data + emergency_tally_interval: Duration.Data + low_threshold_functions: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/gov/Vote.ts b/src/core/gov/Vote.ts index 6e6e1de..80d11d1 100644 --- a/src/core/gov/Vote.ts +++ b/src/core/gov/Vote.ts @@ -1,12 +1,12 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' import { Vote as Vote_pb, VoteOption, WeightedVoteOption as WeightedVoteOption_pb, -} from '@initia/initia.proto/cosmos/gov/v1/gov'; -import { num } from '../num'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/gov/v1/gov' +import { num } from '../num' +import Long from 'long' /** * Defines a vote on a governance proposal */ @@ -23,88 +23,88 @@ export class Vote extends JSONSerializable { public options: WeightedVoteOption[], public metadata: string ) { - super(); + super() } public static fromAmino(data: Vote.Amino): Vote { - const { proposal_id, voter, options, metadata } = data; + const { proposal_id, voter, options, metadata } = data return new Vote( Number.parseInt(proposal_id), voter, - options.map(v => WeightedVoteOption.fromAmino(v)), + options.map((v) => WeightedVoteOption.fromAmino(v)), metadata - ); + ) } public toAmino(): Vote.Amino { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return { proposal_id: proposal_id.toString(), voter, - options: options.map(v => v.toAmino()), + options: options.map((v) => v.toAmino()), metadata, - }; + } } public static fromData(data: Vote.Data): Vote { - const { proposal_id, voter, options, metadata } = data; + const { proposal_id, voter, options, metadata } = data return new Vote( Number.parseInt(proposal_id), voter, - options.map(v => WeightedVoteOption.fromData(v)), + options.map((v) => WeightedVoteOption.fromData(v)), metadata - ); + ) } public toData(): Vote.Data { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return { proposal_id: proposal_id.toString(), voter, - options: options.map(v => v.toData()), + options: options.map((v) => v.toData()), metadata, - }; + } } public static fromProto(proto: Vote.Proto): Vote { return new Vote( proto.proposalId.toNumber(), proto.voter, - proto.options.map(o => WeightedVoteOption.fromProto(o)), + proto.options.map((o) => WeightedVoteOption.fromProto(o)), proto.metadata - ); + ) } public toProto(): Vote.Proto { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return Vote_pb.fromPartial({ - options: options.map(o => o.toProto()), + options: options.map((o) => o.toProto()), proposalId: Long.fromNumber(proposal_id), voter, metadata, - }); + }) } } export namespace Vote { - export const Option = VoteOption; - export type Option = VoteOption; + export const Option = VoteOption + export type Option = VoteOption export interface Amino { - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Amino[]; - metadata: string; + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Amino[] + metadata: string } export interface Data { - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Data[]; - metadata: string; + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Data[] + metadata: string } - export type Proto = Vote_pb; + export type Proto = Vote_pb } export class WeightedVoteOption extends JSONSerializable< @@ -112,61 +112,64 @@ export class WeightedVoteOption extends JSONSerializable< WeightedVoteOption.Data, WeightedVoteOption.Proto > { - public weight: string; - constructor(public option: VoteOption, weight: number | string) { - super(); - this.weight = num(weight).toString(); + public weight: string + constructor( + public option: VoteOption, + weight: number | string + ) { + super() + this.weight = num(weight).toString() } public static fromAmino(data: WeightedVoteOption.Amino): WeightedVoteOption { - const { option, weight } = data; - return new WeightedVoteOption(option, weight); + const { option, weight } = data + return new WeightedVoteOption(option, weight) } public toAmino(): WeightedVoteOption.Amino { - const { option, weight } = this; + const { option, weight } = this return { option, weight, - }; + } } public static fromData(data: WeightedVoteOption.Data): WeightedVoteOption { - const { option, weight } = data; - return new WeightedVoteOption(option, weight); + const { option, weight } = data + return new WeightedVoteOption(option, weight) } public toData(): WeightedVoteOption.Data { - const { option, weight } = this; + const { option, weight } = this return { option, weight, - }; + } } public static fromProto(proto: WeightedVoteOption.Proto): WeightedVoteOption { - return new WeightedVoteOption(proto.option, proto.weight); + return new WeightedVoteOption(proto.option, proto.weight) } public toProto(): WeightedVoteOption.Proto { - const { option, weight } = this; + const { option, weight } = this return WeightedVoteOption_pb.fromPartial({ option, weight, - }); + }) } } export namespace WeightedVoteOption { export interface Amino { - option: VoteOption; - weight: string; + option: VoteOption + weight: string } export interface Data { - option: VoteOption; - weight: string; + option: VoteOption + weight: string } - export type Proto = WeightedVoteOption_pb; + export type Proto = WeightedVoteOption_pb } diff --git a/src/core/gov/index.ts b/src/core/gov/index.ts index 052e538..13eb967 100644 --- a/src/core/gov/index.ts +++ b/src/core/gov/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './proposals'; -export * from './Deposit'; -export * from './Vote'; -export * from './GovParams'; +export * from './msgs' +export * from './proposals' +export * from './Deposit' +export * from './Vote' +export * from './GovParams' diff --git a/src/core/gov/msgs/MsgCancelProposal.ts b/src/core/gov/msgs/MsgCancelProposal.ts index 9fd9cec..d8f2dd9 100644 --- a/src/core/gov/msgs/MsgCancelProposal.ts +++ b/src/core/gov/msgs/MsgCancelProposal.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCancelProposal as MsgCancelProposal_pb } from '@initia/initia.proto/cosmos/gov/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCancelProposal as MsgCancelProposal_pb } from '@initia/initia.proto/cosmos/gov/v1/tx' +import Long from 'long' export class MsgCancelProposal extends JSONSerializable< MsgCancelProposal.Amino, @@ -13,82 +13,85 @@ export class MsgCancelProposal extends JSONSerializable< * @param proposal_id the unique id of the proposal * @param proposer the account address of the proposer */ - constructor(public proposal_id: number, public proposer: AccAddress) { - super(); + constructor( + public proposal_id: number, + public proposer: AccAddress + ) { + super() } public static fromAmino(data: MsgCancelProposal.Amino): MsgCancelProposal { const { value: { proposal_id, proposer }, - } = data; - return new MsgCancelProposal(Number.parseInt(proposal_id), proposer); + } = data + return new MsgCancelProposal(Number.parseInt(proposal_id), proposer) } public toAmino(): MsgCancelProposal.Amino { - const { proposal_id, proposer } = this; + const { proposal_id, proposer } = this return { type: 'cosmos-sdk/v1/MsgCancelProposal', value: { proposal_id: proposal_id.toString(), proposer, }, - }; + } } public static fromData(data: MsgCancelProposal.Data): MsgCancelProposal { - const { proposal_id, proposer } = data; - return new MsgCancelProposal(Number.parseInt(proposal_id), proposer); + const { proposal_id, proposer } = data + return new MsgCancelProposal(Number.parseInt(proposal_id), proposer) } public toData(): MsgCancelProposal.Data { - const { proposal_id, proposer } = this; + const { proposal_id, proposer } = this return { '@type': '/cosmos.gov.v1.MsgCancelProposal', proposal_id: proposal_id.toString(), proposer, - }; + } } public static fromProto(proto: MsgCancelProposal.Proto): MsgCancelProposal { - return new MsgCancelProposal(proto.proposalId.toNumber(), proto.proposer); + return new MsgCancelProposal(proto.proposalId.toNumber(), proto.proposer) } public toProto(): MsgCancelProposal.Proto { - const { proposal_id, proposer } = this; + const { proposal_id, proposer } = this return MsgCancelProposal_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), proposer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1.MsgCancelProposal', value: MsgCancelProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCancelProposal { return MsgCancelProposal.fromProto( MsgCancelProposal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCancelProposal { export interface Amino { - type: 'cosmos-sdk/v1/MsgCancelProposal'; + type: 'cosmos-sdk/v1/MsgCancelProposal' value: { - proposal_id: string; - proposer: AccAddress; - }; + proposal_id: string + proposer: AccAddress + } } export interface Data { - '@type': '/cosmos.gov.v1.MsgCancelProposal'; - proposal_id: string; - proposer: AccAddress; + '@type': '/cosmos.gov.v1.MsgCancelProposal' + proposal_id: string + proposer: AccAddress } - export type Proto = MsgCancelProposal_pb; + export type Proto = MsgCancelProposal_pb } diff --git a/src/core/gov/msgs/MsgDeposit.ts b/src/core/gov/msgs/MsgDeposit.ts index 6edf664..a3c5d8f 100644 --- a/src/core/gov/msgs/MsgDeposit.ts +++ b/src/core/gov/msgs/MsgDeposit.ts @@ -1,9 +1,9 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgDeposit as MsgDeposit_pb } from '@initia/initia.proto/cosmos/gov/v1/tx'; -import Long from 'long'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgDeposit as MsgDeposit_pb } from '@initia/initia.proto/cosmos/gov/v1/tx' +import Long from 'long' /** * Defines a message to submit a deposit to an existing proposal @@ -13,7 +13,7 @@ export class MsgDeposit extends JSONSerializable< MsgDeposit.Data, MsgDeposit.Proto > { - public amount: Coins; + public amount: Coins /** * @param proposal_id the unique id of the proposal * @param depositor the deposit addresses from the proposals @@ -24,23 +24,23 @@ export class MsgDeposit extends JSONSerializable< public depositor: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgDeposit.Amino): MsgDeposit { const { value: { proposal_id, depositor, amount }, - } = data; + } = data return new MsgDeposit( Number.parseInt(proposal_id), depositor, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgDeposit.Amino { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { type: 'cosmos-sdk/v1/MsgDeposit', value: { @@ -48,26 +48,26 @@ export class MsgDeposit extends JSONSerializable< depositor, amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgDeposit.Data): MsgDeposit { - const { proposal_id, depositor, amount } = data; + const { proposal_id, depositor, amount } = data return new MsgDeposit( Number.parseInt(proposal_id), depositor, Coins.fromData(amount) - ); + ) } public toData(): MsgDeposit.Data { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { '@type': '/cosmos.gov.v1.MsgDeposit', proposal_id: proposal_id.toString(), depositor, amount: amount.toData(), - }; + } } public static fromProto(proto: MsgDeposit.Proto): MsgDeposit { @@ -75,46 +75,46 @@ export class MsgDeposit extends JSONSerializable< proto.proposalId.toNumber(), proto.depositor, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgDeposit.Proto { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return MsgDeposit_pb.fromPartial({ amount: amount.toProto(), depositor, proposalId: Long.fromNumber(proposal_id), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1.MsgDeposit', value: MsgDeposit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDeposit { - return MsgDeposit.fromProto(MsgDeposit_pb.decode(msgAny.value)); + return MsgDeposit.fromProto(MsgDeposit_pb.decode(msgAny.value)) } } export namespace MsgDeposit { export interface Amino { - type: 'cosmos-sdk/v1/MsgDeposit'; + type: 'cosmos-sdk/v1/MsgDeposit' value: { - proposal_id: string; - depositor: AccAddress; - amount: Coins.Amino; - }; + proposal_id: string + depositor: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/cosmos.gov.v1.MsgDeposit'; - proposal_id: string; - depositor: AccAddress; - amount: Coins.Data; + '@type': '/cosmos.gov.v1.MsgDeposit' + proposal_id: string + depositor: AccAddress + amount: Coins.Data } - export type Proto = MsgDeposit_pb; + export type Proto = MsgDeposit_pb } diff --git a/src/core/gov/msgs/MsgDepositLegacy.ts b/src/core/gov/msgs/MsgDepositLegacy.ts index 1f99e9d..ced47b2 100644 --- a/src/core/gov/msgs/MsgDepositLegacy.ts +++ b/src/core/gov/msgs/MsgDepositLegacy.ts @@ -1,9 +1,9 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgDeposit as MsgDeposit_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx'; -import Long from 'long'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgDeposit as MsgDeposit_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx' +import Long from 'long' /** * Add a deposit for a proposal @@ -13,7 +13,7 @@ export class MsgDepositLegacy extends JSONSerializable< MsgDepositLegacy.Data, MsgDepositLegacy.Proto > { - public amount: Coins; + public amount: Coins /** * @param proposal_id Id of porposal to deposit to * @param depositor depositor's account address @@ -24,23 +24,23 @@ export class MsgDepositLegacy extends JSONSerializable< public depositor: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgDepositLegacy.Amino): MsgDepositLegacy { const { value: { proposal_id, depositor, amount }, - } = data; + } = data return new MsgDepositLegacy( Number.parseInt(proposal_id), depositor, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgDepositLegacy.Amino { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { type: 'cosmos-sdk/MsgDeposit', value: { @@ -48,26 +48,26 @@ export class MsgDepositLegacy extends JSONSerializable< depositor, amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgDepositLegacy.Data): MsgDepositLegacy { - const { proposal_id, depositor, amount } = data; + const { proposal_id, depositor, amount } = data return new MsgDepositLegacy( Number.parseInt(proposal_id), depositor, Coins.fromData(amount) - ); + ) } public toData(): MsgDepositLegacy.Data { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return { '@type': '/cosmos.gov.v1beta1.MsgDeposit', proposal_id: proposal_id.toString(), depositor, amount: amount.toData(), - }; + } } public static fromProto(proto: MsgDepositLegacy.Proto): MsgDepositLegacy { @@ -75,46 +75,46 @@ export class MsgDepositLegacy extends JSONSerializable< proto.proposalId.toNumber(), proto.depositor, Coins.fromProto(proto.amount) - ); + ) } public toProto(): MsgDepositLegacy.Proto { - const { proposal_id, depositor, amount } = this; + const { proposal_id, depositor, amount } = this return MsgDeposit_pb.fromPartial({ amount: amount.toProto(), depositor, proposalId: Long.fromNumber(proposal_id), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1beta1.MsgDeposit', value: MsgDeposit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDepositLegacy { - return MsgDepositLegacy.fromProto(MsgDeposit_pb.decode(msgAny.value)); + return MsgDepositLegacy.fromProto(MsgDeposit_pb.decode(msgAny.value)) } } export namespace MsgDepositLegacy { export interface Amino { - type: 'cosmos-sdk/MsgDeposit'; + type: 'cosmos-sdk/MsgDeposit' value: { - proposal_id: string; - depositor: AccAddress; - amount: Coins.Amino; - }; + proposal_id: string + depositor: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/cosmos.gov.v1beta1.MsgDeposit'; - proposal_id: string; - depositor: AccAddress; - amount: Coins.Data; + '@type': '/cosmos.gov.v1beta1.MsgDeposit' + proposal_id: string + depositor: AccAddress + amount: Coins.Data } - export type Proto = MsgDeposit_pb; + export type Proto = MsgDeposit_pb } diff --git a/src/core/gov/msgs/MsgSubmitProposal.ts b/src/core/gov/msgs/MsgSubmitProposal.ts index 38d0c46..b3b5c25 100644 --- a/src/core/gov/msgs/MsgSubmitProposal.ts +++ b/src/core/gov/msgs/MsgSubmitProposal.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Msg } from '../../Msg'; -import { Coins } from '../../Coins'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSubmitProposal as MsgSubmitProposal_pb } from '@initia/initia.proto/cosmos/gov/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Msg } from '../../Msg' +import { Coins } from '../../Coins' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSubmitProposal as MsgSubmitProposal_pb } from '@initia/initia.proto/cosmos/gov/v1/tx' export class MsgSubmitProposal extends JSONSerializable< MsgSubmitProposal.Amino, MsgSubmitProposal.Data, MsgSubmitProposal.Proto > { - public initial_deposit: Coins; + public initial_deposit: Coins /** * @param messages the arbitrary messages to be executed if proposal passes @@ -30,8 +30,8 @@ export class MsgSubmitProposal extends JSONSerializable< public summary: string, public expedited: boolean ) { - super(); - this.initial_deposit = new Coins(initial_deposit); + super() + this.initial_deposit = new Coins(initial_deposit) } public static fromAmino(data: MsgSubmitProposal.Amino): MsgSubmitProposal { @@ -45,7 +45,7 @@ export class MsgSubmitProposal extends JSONSerializable< summary, expedited, }, - } = data; + } = data return new MsgSubmitProposal( messages.map(Msg.fromAmino), @@ -55,7 +55,7 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited - ); + ) } public toAmino(): MsgSubmitProposal.Amino { @@ -67,12 +67,12 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited, - } = this; + } = this return { type: 'cosmos-sdk/v1/MsgSubmitProposal', value: { - messages: messages.map(msg => msg.toAmino()), + messages: messages.map((msg) => msg.toAmino()), initial_deposit: initial_deposit.toAmino(), proposer, metadata: metadata && metadata !== '' ? metadata : undefined, @@ -80,7 +80,7 @@ export class MsgSubmitProposal extends JSONSerializable< summary, expedited, }, - }; + } } public static fromData(data: MsgSubmitProposal.Data): MsgSubmitProposal { @@ -92,7 +92,7 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited, - } = data; + } = data return new MsgSubmitProposal( messages.map(Msg.fromData), @@ -102,7 +102,7 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited - ); + ) } public toData(): MsgSubmitProposal.Data { @@ -114,18 +114,18 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited, - } = this; + } = this return { '@type': '/cosmos.gov.v1.MsgSubmitProposal', - messages: messages.map(msg => msg.toData()), + messages: messages.map((msg) => msg.toData()), initial_deposit: initial_deposit.toData(), proposer, metadata, title, summary, expedited, - }; + } } public static fromProto(data: MsgSubmitProposal.Proto): MsgSubmitProposal { @@ -137,7 +137,7 @@ export class MsgSubmitProposal extends JSONSerializable< data.title, data.summary, data.expedited - ); + ) } public toProto(): MsgSubmitProposal.Proto { @@ -149,57 +149,57 @@ export class MsgSubmitProposal extends JSONSerializable< title, summary, expedited, - } = this; + } = this return MsgSubmitProposal_pb.fromPartial({ - messages: messages.map(msg => msg.packAny()), + messages: messages.map((msg) => msg.packAny()), initialDeposit: initial_deposit.toProto(), proposer, metadata, title, summary, expedited, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1.MsgSubmitProposal', value: MsgSubmitProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitProposal { return MsgSubmitProposal.fromProto( MsgSubmitProposal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSubmitProposal { export interface Amino { - type: 'cosmos-sdk/v1/MsgSubmitProposal'; + type: 'cosmos-sdk/v1/MsgSubmitProposal' value: { - messages: Msg.Amino[]; - initial_deposit: Coins.Amino; - proposer: AccAddress; - metadata?: string; - title: string; - summary: string; - expedited: boolean; - }; + messages: Msg.Amino[] + initial_deposit: Coins.Amino + proposer: AccAddress + metadata?: string + title: string + summary: string + expedited: boolean + } } export interface Data { - '@type': '/cosmos.gov.v1.MsgSubmitProposal'; - messages: Msg.Data[]; - initial_deposit: Coins.Data; - proposer: AccAddress; - metadata: string; - title: string; - summary: string; - expedited: boolean; + '@type': '/cosmos.gov.v1.MsgSubmitProposal' + messages: Msg.Data[] + initial_deposit: Coins.Data + proposer: AccAddress + metadata: string + title: string + summary: string + expedited: boolean } - export type Proto = MsgSubmitProposal_pb; + export type Proto = MsgSubmitProposal_pb } diff --git a/src/core/gov/msgs/MsgSubmitProposalLegacy.ts b/src/core/gov/msgs/MsgSubmitProposalLegacy.ts index 5322ce9..bdeb78f 100644 --- a/src/core/gov/msgs/MsgSubmitProposalLegacy.ts +++ b/src/core/gov/msgs/MsgSubmitProposalLegacy.ts @@ -1,9 +1,9 @@ -import { Coins } from '../../Coins'; -import { Content } from '../proposals'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSubmitProposal as MsgSubmitProposal_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx'; +import { Coins } from '../../Coins' +import { Content } from '../proposals' +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSubmitProposal as MsgSubmitProposal_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx' /** * Submit a proposal alongside an initial deposit. @@ -13,7 +13,7 @@ export class MsgSubmitProposalLegacy extends JSONSerializable< MsgSubmitProposalLegacy.Data, MsgSubmitProposalLegacy.Proto > { - public initial_deposit: Coins; + public initial_deposit: Coins /** * @param content proposal content to submit @@ -25,8 +25,8 @@ export class MsgSubmitProposalLegacy extends JSONSerializable< initial_deposit: Coins.Input, public proposer: AccAddress ) { - super(); - this.initial_deposit = new Coins(initial_deposit); + super() + this.initial_deposit = new Coins(initial_deposit) } public static fromAmino( @@ -34,16 +34,16 @@ export class MsgSubmitProposalLegacy extends JSONSerializable< ): MsgSubmitProposalLegacy { const { value: { content, initial_deposit, proposer }, - } = data; + } = data return new MsgSubmitProposalLegacy( Content.fromAmino(content), Coins.fromAmino(initial_deposit), proposer - ); + ) } public toAmino(): MsgSubmitProposalLegacy.Amino { - const { content, initial_deposit, proposer } = this; + const { content, initial_deposit, proposer } = this return { type: 'cosmos-sdk/MsgSubmitProposal', value: { @@ -51,28 +51,28 @@ export class MsgSubmitProposalLegacy extends JSONSerializable< initial_deposit: initial_deposit.toAmino(), proposer, }, - }; + } } public static fromData( data: MsgSubmitProposalLegacy.Data ): MsgSubmitProposalLegacy { - const { content, initial_deposit, proposer } = data; + const { content, initial_deposit, proposer } = data return new MsgSubmitProposalLegacy( Content.fromData(content), Coins.fromData(initial_deposit), proposer - ); + ) } public toData(): MsgSubmitProposalLegacy.Data { - const { content, initial_deposit, proposer } = this; + const { content, initial_deposit, proposer } = this return { '@type': '/cosmos.gov.v1beta1.MsgSubmitProposal', content: content.toData(), initial_deposit: initial_deposit.toData(), proposer, - }; + } } public static fromProto( @@ -82,48 +82,48 @@ export class MsgSubmitProposalLegacy extends JSONSerializable< Content.fromProto(proto.content as any), Coins.fromProto(proto.initialDeposit), proto.proposer - ); + ) } public toProto(): MsgSubmitProposalLegacy.Proto { - const { content, initial_deposit, proposer } = this; + const { content, initial_deposit, proposer } = this return MsgSubmitProposal_pb.fromPartial({ content: content.packAny(), initialDeposit: initial_deposit.toProto(), proposer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1beta1.MsgSubmitProposal', value: MsgSubmitProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitProposalLegacy { return MsgSubmitProposalLegacy.fromProto( MsgSubmitProposal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSubmitProposalLegacy { export interface Amino { - type: 'cosmos-sdk/MsgSubmitProposal'; + type: 'cosmos-sdk/MsgSubmitProposal' value: { - content: Content.Amino; - initial_deposit: Coins.Amino; - proposer: AccAddress; - }; + content: Content.Amino + initial_deposit: Coins.Amino + proposer: AccAddress + } } export interface Data { - '@type': '/cosmos.gov.v1beta1.MsgSubmitProposal'; - content: Content.Data; - initial_deposit: Coins.Data; - proposer: AccAddress; + '@type': '/cosmos.gov.v1beta1.MsgSubmitProposal' + content: Content.Data + initial_deposit: Coins.Data + proposer: AccAddress } - export type Proto = MsgSubmitProposal_pb; + export type Proto = MsgSubmitProposal_pb } diff --git a/src/core/gov/msgs/MsgUpdateGovParams.ts b/src/core/gov/msgs/MsgUpdateGovParams.ts index 47168df..7eedd0c 100644 --- a/src/core/gov/msgs/MsgUpdateGovParams.ts +++ b/src/core/gov/msgs/MsgUpdateGovParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { GovParams } from '../GovParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/gov/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { GovParams } from '../GovParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/gov/v1/tx' export class MsgUpdateGovParams extends JSONSerializable< MsgUpdateGovParams.Amino, @@ -13,85 +13,86 @@ export class MsgUpdateGovParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/auth parameters to update */ - constructor(public authority: AccAddress, public params: GovParams) { - super(); + constructor( + public authority: AccAddress, + public params: GovParams + ) { + super() } public static fromAmino(data: MsgUpdateGovParams.Amino): MsgUpdateGovParams { const { value: { authority, params }, - } = data; - return new MsgUpdateGovParams(authority, GovParams.fromAmino(params)); + } = data + return new MsgUpdateGovParams(authority, GovParams.fromAmino(params)) } public toAmino(): MsgUpdateGovParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'gov/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateGovParams.Data): MsgUpdateGovParams { - const { authority, params } = data; - return new MsgUpdateGovParams(authority, GovParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateGovParams(authority, GovParams.fromData(params)) } public toData(): MsgUpdateGovParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.gov.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto(data: MsgUpdateGovParams.Proto): MsgUpdateGovParams { return new MsgUpdateGovParams( data.authority, GovParams.fromProto(data.params as GovParams.Proto) - ); + ) } public toProto(): MsgUpdateGovParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.gov.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGovParams { - return MsgUpdateGovParams.fromProto( - MsgUpdateParams_pb.decode(msgAny.value) - ); + return MsgUpdateGovParams.fromProto(MsgUpdateParams_pb.decode(msgAny.value)) } } export namespace MsgUpdateGovParams { export interface Amino { - type: 'gov/MsgUpdateParams'; + type: 'gov/MsgUpdateParams' value: { - authority: AccAddress; - params: GovParams.Amino; - }; + authority: AccAddress + params: GovParams.Amino + } } export interface Data { - '@type': '/initia.gov.v1.MsgUpdateParams'; - authority: AccAddress; - params: GovParams.Data; + '@type': '/initia.gov.v1.MsgUpdateParams' + authority: AccAddress + params: GovParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/gov/msgs/MsgVote.ts b/src/core/gov/msgs/MsgVote.ts index 29bee83..968bcd8 100644 --- a/src/core/gov/msgs/MsgVote.ts +++ b/src/core/gov/msgs/MsgVote.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgVote as MsgVote_pb } from '@initia/initia.proto/cosmos/gov/v1/tx'; -import { VoteOption } from '@initia/initia.proto/cosmos/gov/v1/gov'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgVote as MsgVote_pb } from '@initia/initia.proto/cosmos/gov/v1/tx' +import { VoteOption } from '@initia/initia.proto/cosmos/gov/v1/gov' +import Long from 'long' /** * Defines a message to cast a vote @@ -25,23 +25,23 @@ export class MsgVote extends JSONSerializable< public option: VoteOption, public metadata: string ) { - super(); + super() } public static fromAmino(data: MsgVote.Amino): MsgVote { const { value: { proposal_id, voter, option, metadata }, - } = data; + } = data return new MsgVote( Number.parseInt(proposal_id), voter, option, metadata ?? '' - ); + ) } public toAmino(): MsgVote.Amino { - const { proposal_id, voter, option, metadata } = this; + const { proposal_id, voter, option, metadata } = this return { type: 'cosmos-sdk/v1/MsgVote', value: { @@ -50,23 +50,23 @@ export class MsgVote extends JSONSerializable< option, metadata: metadata && metadata !== '' ? metadata : undefined, }, - }; + } } public static fromData(data: MsgVote.Data): MsgVote { - const { proposal_id, voter, option, metadata } = data; - return new MsgVote(Number.parseInt(proposal_id), voter, option, metadata); + const { proposal_id, voter, option, metadata } = data + return new MsgVote(Number.parseInt(proposal_id), voter, option, metadata) } public toData(): MsgVote.Data { - const { proposal_id, voter, option, metadata } = this; + const { proposal_id, voter, option, metadata } = this return { '@type': '/cosmos.gov.v1.MsgVote', proposal_id: proposal_id.toString(), voter, option, metadata, - }; + } } public static fromProto(data: MsgVote.Proto): MsgVote { @@ -75,52 +75,52 @@ export class MsgVote extends JSONSerializable< data.voter, data.option, data.metadata - ); + ) } public toProto(): MsgVote.Proto { - const { proposal_id, voter, option, metadata } = this; + const { proposal_id, voter, option, metadata } = this return MsgVote_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), voter, option, metadata, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1.MsgVote', value: MsgVote_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgVote { - return MsgVote.fromProto(MsgVote_pb.decode(msgAny.value)); + return MsgVote.fromProto(MsgVote_pb.decode(msgAny.value)) } } export namespace MsgVote { - export const Option = VoteOption; - export type Option = VoteOption; + export const Option = VoteOption + export type Option = VoteOption export interface Amino { - type: 'cosmos-sdk/v1/MsgVote'; + type: 'cosmos-sdk/v1/MsgVote' value: { - proposal_id: string; - voter: AccAddress; - option: VoteOption; - metadata?: string; - }; + proposal_id: string + voter: AccAddress + option: VoteOption + metadata?: string + } } export interface Data { - '@type': '/cosmos.gov.v1.MsgVote'; - proposal_id: string; - voter: AccAddress; - option: Option; - metadata: string; + '@type': '/cosmos.gov.v1.MsgVote' + proposal_id: string + voter: AccAddress + option: Option + metadata: string } - export type Proto = MsgVote_pb; + export type Proto = MsgVote_pb } diff --git a/src/core/gov/msgs/MsgVoteLegacy.ts b/src/core/gov/msgs/MsgVoteLegacy.ts index a465ccc..694370a 100644 --- a/src/core/gov/msgs/MsgVoteLegacy.ts +++ b/src/core/gov/msgs/MsgVoteLegacy.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgVote as MsgVote_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx'; -import { VoteOption } from '@initia/initia.proto/cosmos/gov/v1beta1/gov'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgVote as MsgVote_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx' +import { VoteOption } from '@initia/initia.proto/cosmos/gov/v1beta1/gov' +import Long from 'long' /** * Vote for a proposal @@ -23,18 +23,18 @@ export class MsgVoteLegacy extends JSONSerializable< public voter: AccAddress, public option: VoteOption ) { - super(); + super() } public static fromAmino(data: MsgVoteLegacy.Amino): MsgVoteLegacy { const { value: { proposal_id, voter, option }, - } = data; - return new MsgVoteLegacy(Number.parseInt(proposal_id), voter, option); + } = data + return new MsgVoteLegacy(Number.parseInt(proposal_id), voter, option) } public toAmino(): MsgVoteLegacy.Amino { - const { proposal_id, voter, option } = this; + const { proposal_id, voter, option } = this return { type: 'cosmos-sdk/MsgVote', value: { @@ -42,22 +42,22 @@ export class MsgVoteLegacy extends JSONSerializable< voter, option, }, - }; + } } public static fromData(data: MsgVoteLegacy.Data): MsgVoteLegacy { - const { proposal_id, voter, option } = data; - return new MsgVoteLegacy(Number.parseInt(proposal_id), voter, option); + const { proposal_id, voter, option } = data + return new MsgVoteLegacy(Number.parseInt(proposal_id), voter, option) } public toData(): MsgVoteLegacy.Data { - const { proposal_id, voter, option } = this; + const { proposal_id, voter, option } = this return { '@type': '/cosmos.gov.v1beta1.MsgVote', proposal_id: proposal_id.toFixed(), voter, option, - }; + } } public static fromProto(proto: MsgVoteLegacy.Proto): MsgVoteLegacy { @@ -65,49 +65,49 @@ export class MsgVoteLegacy extends JSONSerializable< proto.proposalId.toNumber(), proto.voter, proto.option - ); + ) } public toProto(): MsgVoteLegacy.Proto { - const { proposal_id, voter, option } = this; + const { proposal_id, voter, option } = this return MsgVote_pb.fromPartial({ option, proposalId: Long.fromNumber(proposal_id), voter, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1beta1.MsgVote', value: MsgVote_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgVoteLegacy { - return MsgVoteLegacy.fromProto(MsgVote_pb.decode(msgAny.value)); + return MsgVoteLegacy.fromProto(MsgVote_pb.decode(msgAny.value)) } } export namespace MsgVoteLegacy { - export const Option = VoteOption; - export type Option = VoteOption; + export const Option = VoteOption + export type Option = VoteOption export interface Amino { - type: 'cosmos-sdk/MsgVote'; + type: 'cosmos-sdk/MsgVote' value: { - proposal_id: string; - voter: AccAddress; - option: VoteOption; - }; + proposal_id: string + voter: AccAddress + option: VoteOption + } } export interface Data { - '@type': '/cosmos.gov.v1beta1.MsgVote'; - proposal_id: string; - voter: AccAddress; - option: Option; + '@type': '/cosmos.gov.v1beta1.MsgVote' + proposal_id: string + voter: AccAddress + option: Option } - export type Proto = MsgVote_pb; + export type Proto = MsgVote_pb } diff --git a/src/core/gov/msgs/MsgVoteWeighted.ts b/src/core/gov/msgs/MsgVoteWeighted.ts index 1a1351a..75b971c 100644 --- a/src/core/gov/msgs/MsgVoteWeighted.ts +++ b/src/core/gov/msgs/MsgVoteWeighted.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { WeightedVoteOption } from '../Vote'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgVoteWeighted as MsgVoteWeighted_pb } from '@initia/initia.proto/cosmos/gov/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { WeightedVoteOption } from '../Vote' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgVoteWeighted as MsgVoteWeighted_pb } from '@initia/initia.proto/cosmos/gov/v1/tx' +import Long from 'long' /** * Defines a message to cast a vote @@ -25,104 +25,104 @@ export class MsgVoteWeighted extends JSONSerializable< public options: WeightedVoteOption[], public metadata: string ) { - super(); + super() } public static fromAmino(data: MsgVoteWeighted.Amino): MsgVoteWeighted { const { value: { proposal_id, voter, options, metadata }, - } = data; + } = data return new MsgVoteWeighted( Number.parseInt(proposal_id), voter, - options.map(o => WeightedVoteOption.fromAmino(o)), + options.map((o) => WeightedVoteOption.fromAmino(o)), metadata ?? '' - ); + ) } public toAmino(): MsgVoteWeighted.Amino { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return { type: 'cosmos-sdk/v1/MsgVoteWeighted', value: { proposal_id: proposal_id.toFixed(), voter, - options: options.map(o => o.toAmino()), + options: options.map((o) => o.toAmino()), metadata: metadata && metadata !== '' ? metadata : undefined, }, - }; + } } public static fromData(data: MsgVoteWeighted.Data): MsgVoteWeighted { - const { proposal_id, voter, options, metadata } = data; + const { proposal_id, voter, options, metadata } = data return new MsgVoteWeighted( Number.parseInt(proposal_id), voter, - options.map(o => WeightedVoteOption.fromData(o)), + options.map((o) => WeightedVoteOption.fromData(o)), metadata - ); + ) } public toData(): MsgVoteWeighted.Data { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return { '@type': '/cosmos.gov.v1.MsgVoteWeighted', proposal_id: proposal_id.toFixed(), voter, - options: options.map(o => o.toData()), + options: options.map((o) => o.toData()), metadata, - }; + } } public static fromProto(proto: MsgVoteWeighted.Proto): MsgVoteWeighted { return new MsgVoteWeighted( proto.proposalId.toNumber(), proto.voter, - proto.options.map(o => WeightedVoteOption.fromProto(o)), + proto.options.map((o) => WeightedVoteOption.fromProto(o)), proto.metadata - ); + ) } public toProto(): MsgVoteWeighted.Proto { - const { proposal_id, voter, options, metadata } = this; + const { proposal_id, voter, options, metadata } = this return MsgVoteWeighted_pb.fromPartial({ - options: options.map(o => o.toProto()), + options: options.map((o) => o.toProto()), proposalId: Long.fromNumber(proposal_id), voter, metadata, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1.MsgVoteWeighted', value: MsgVoteWeighted_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgVoteWeighted { - return MsgVoteWeighted.fromProto(MsgVoteWeighted_pb.decode(msgAny.value)); + return MsgVoteWeighted.fromProto(MsgVoteWeighted_pb.decode(msgAny.value)) } } export namespace MsgVoteWeighted { export interface Amino { - type: 'cosmos-sdk/v1/MsgVoteWeighted'; + type: 'cosmos-sdk/v1/MsgVoteWeighted' value: { - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Amino[]; - metadata?: string; - }; + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Amino[] + metadata?: string + } } export interface Data { - '@type': '/cosmos.gov.v1.MsgVoteWeighted'; - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Data[]; - metadata: string; + '@type': '/cosmos.gov.v1.MsgVoteWeighted' + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Data[] + metadata: string } - export type Proto = MsgVoteWeighted_pb; + export type Proto = MsgVoteWeighted_pb } diff --git a/src/core/gov/msgs/MsgVoteWeightedLegacy.ts b/src/core/gov/msgs/MsgVoteWeightedLegacy.ts index 8b53989..892b829 100644 --- a/src/core/gov/msgs/MsgVoteWeightedLegacy.ts +++ b/src/core/gov/msgs/MsgVoteWeightedLegacy.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { WeightedVoteOption } from '../Vote'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgVoteWeighted as MsgVoteWeighted_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { WeightedVoteOption } from '../Vote' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgVoteWeighted as MsgVoteWeighted_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/tx' +import Long from 'long' /** * Weighted vote for a proposal @@ -23,7 +23,7 @@ export class MsgVoteWeightedLegacy extends JSONSerializable< public voter: AccAddress, public options: WeightedVoteOption[] ) { - super(); + super() } public static fromAmino( @@ -31,45 +31,45 @@ export class MsgVoteWeightedLegacy extends JSONSerializable< ): MsgVoteWeightedLegacy { const { value: { proposal_id, voter, options }, - } = data; + } = data return new MsgVoteWeightedLegacy( Number.parseInt(proposal_id), voter, - options.map(o => WeightedVoteOption.fromAmino(o)) - ); + options.map((o) => WeightedVoteOption.fromAmino(o)) + ) } public toAmino(): MsgVoteWeightedLegacy.Amino { - const { proposal_id, voter, options } = this; + const { proposal_id, voter, options } = this return { type: 'cosmos-sdk/MsgVoteWeighted', value: { proposal_id: proposal_id.toFixed(), voter, - options: options.map(o => o.toAmino()), + options: options.map((o) => o.toAmino()), }, - }; + } } public static fromData( data: MsgVoteWeightedLegacy.Data ): MsgVoteWeightedLegacy { - const { proposal_id, voter, options } = data; + const { proposal_id, voter, options } = data return new MsgVoteWeightedLegacy( Number.parseInt(proposal_id), voter, - options.map(o => WeightedVoteOption.fromData(o)) - ); + options.map((o) => WeightedVoteOption.fromData(o)) + ) } public toData(): MsgVoteWeightedLegacy.Data { - const { proposal_id, voter, options } = this; + const { proposal_id, voter, options } = this return { '@type': '/cosmos.gov.v1beta1.MsgVoteWeighted', proposal_id: proposal_id.toFixed(), voter, - options: options.map(o => o.toData()), - }; + options: options.map((o) => o.toData()), + } } public static fromProto( @@ -78,49 +78,49 @@ export class MsgVoteWeightedLegacy extends JSONSerializable< return new MsgVoteWeightedLegacy( proto.proposalId.toNumber(), proto.voter, - proto.options.map(o => WeightedVoteOption.fromProto(o)) - ); + proto.options.map((o) => WeightedVoteOption.fromProto(o)) + ) } public toProto(): MsgVoteWeightedLegacy.Proto { - const { proposal_id, voter, options } = this; + const { proposal_id, voter, options } = this return MsgVoteWeighted_pb.fromPartial({ - options: options.map(o => o.toProto()), + options: options.map((o) => o.toProto()), proposalId: Long.fromNumber(proposal_id), voter, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1beta1.MsgVoteWeighted', value: MsgVoteWeighted_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgVoteWeightedLegacy { return MsgVoteWeightedLegacy.fromProto( MsgVoteWeighted_pb.decode(msgAny.value) - ); + ) } } export namespace MsgVoteWeightedLegacy { export interface Amino { - type: 'cosmos-sdk/MsgVoteWeighted'; + type: 'cosmos-sdk/MsgVoteWeighted' value: { - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Amino[]; - }; + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Amino[] + } } export interface Data { - '@type': '/cosmos.gov.v1beta1.MsgVoteWeighted'; - proposal_id: string; - voter: AccAddress; - options: WeightedVoteOption.Data[]; + '@type': '/cosmos.gov.v1beta1.MsgVoteWeighted' + proposal_id: string + voter: AccAddress + options: WeightedVoteOption.Data[] } - export type Proto = MsgVoteWeighted_pb; + export type Proto = MsgVoteWeighted_pb } diff --git a/src/core/gov/msgs/index.ts b/src/core/gov/msgs/index.ts index 217cb31..5fe2c58 100644 --- a/src/core/gov/msgs/index.ts +++ b/src/core/gov/msgs/index.ts @@ -1,24 +1,24 @@ -import { MsgCancelProposal } from './MsgCancelProposal'; -import { MsgSubmitProposalLegacy } from './MsgSubmitProposalLegacy'; -import { MsgSubmitProposal } from './MsgSubmitProposal'; -import { MsgVoteLegacy } from './MsgVoteLegacy'; -import { MsgVote } from './MsgVote'; -import { MsgDepositLegacy } from './MsgDepositLegacy'; -import { MsgDeposit } from './MsgDeposit'; -import { MsgVoteWeightedLegacy } from './MsgVoteWeightedLegacy'; -import { MsgVoteWeighted } from './MsgVoteWeighted'; -import { MsgUpdateGovParams } from './MsgUpdateGovParams'; +import { MsgCancelProposal } from './MsgCancelProposal' +import { MsgSubmitProposalLegacy } from './MsgSubmitProposalLegacy' +import { MsgSubmitProposal } from './MsgSubmitProposal' +import { MsgVoteLegacy } from './MsgVoteLegacy' +import { MsgVote } from './MsgVote' +import { MsgDepositLegacy } from './MsgDepositLegacy' +import { MsgDeposit } from './MsgDeposit' +import { MsgVoteWeightedLegacy } from './MsgVoteWeightedLegacy' +import { MsgVoteWeighted } from './MsgVoteWeighted' +import { MsgUpdateGovParams } from './MsgUpdateGovParams' -export * from './MsgCancelProposal'; -export * from './MsgDepositLegacy'; -export * from './MsgDeposit'; -export * from './MsgSubmitProposalLegacy'; -export * from './MsgSubmitProposal'; -export * from './MsgVoteLegacy'; -export * from './MsgVote'; -export * from './MsgVoteWeightedLegacy'; -export * from './MsgVoteWeighted'; -export * from './MsgUpdateGovParams'; +export * from './MsgCancelProposal' +export * from './MsgDepositLegacy' +export * from './MsgDeposit' +export * from './MsgSubmitProposalLegacy' +export * from './MsgSubmitProposal' +export * from './MsgVoteLegacy' +export * from './MsgVote' +export * from './MsgVoteWeightedLegacy' +export * from './MsgVoteWeighted' +export * from './MsgUpdateGovParams' export type GovMsg = | MsgCancelProposal @@ -30,7 +30,7 @@ export type GovMsg = | MsgVote | MsgVoteWeightedLegacy | MsgVoteWeighted - | MsgUpdateGovParams; + | MsgUpdateGovParams export namespace GovMsg { export type Amino = @@ -43,7 +43,7 @@ export namespace GovMsg { | MsgVote.Amino | MsgVoteWeightedLegacy.Amino | MsgVoteWeighted.Amino - | MsgUpdateGovParams.Amino; + | MsgUpdateGovParams.Amino export type Data = | MsgCancelProposal.Data | MsgDepositLegacy.Data @@ -54,7 +54,7 @@ export namespace GovMsg { | MsgVote.Data | MsgVoteWeightedLegacy.Data | MsgVoteWeighted.Data - | MsgUpdateGovParams.Data; + | MsgUpdateGovParams.Data export type Proto = | MsgCancelProposal.Proto | MsgDepositLegacy.Proto @@ -65,5 +65,5 @@ export namespace GovMsg { | MsgVote.Proto | MsgVoteWeightedLegacy.Proto | MsgVoteWeighted.Proto - | MsgUpdateGovParams.Proto; + | MsgUpdateGovParams.Proto } diff --git a/src/core/gov/proposals/Content.ts b/src/core/gov/proposals/Content.ts index 788164f..5e6d30d 100644 --- a/src/core/gov/proposals/Content.ts +++ b/src/core/gov/proposals/Content.ts @@ -1,43 +1,43 @@ -import { ParameterChangeProposal } from '../../params/proposals'; -import { TextProposal } from './TextProposal'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { ParameterChangeProposal } from '../../params/proposals' +import { TextProposal } from './TextProposal' +import { Any } from '@initia/initia.proto/google/protobuf/any' -export type Content = TextProposal | ParameterChangeProposal; +export type Content = TextProposal | ParameterChangeProposal export namespace Content { - export type Amino = TextProposal.Amino | ParameterChangeProposal.Amino; + export type Amino = TextProposal.Amino | ParameterChangeProposal.Amino - export type Data = TextProposal.Data | ParameterChangeProposal.Data; + export type Data = TextProposal.Data | ParameterChangeProposal.Data - export type Proto = TextProposal.Proto | ParameterChangeProposal.Proto; + export type Proto = TextProposal.Proto | ParameterChangeProposal.Proto export function fromAmino(data: Content.Amino): Content { switch (data.type) { case 'cosmos-sdk/TextProposal': - return TextProposal.fromAmino(data); + return TextProposal.fromAmino(data) case 'cosmos-sdk/ParameterChangeProposal': - return ParameterChangeProposal.fromAmino(data); + return ParameterChangeProposal.fromAmino(data) } } export function fromData(data: Content.Data): Content { switch (data['@type']) { case '/cosmos.gov.v1beta1.TextProposal': - return TextProposal.fromData(data); + return TextProposal.fromData(data) case '/cosmos.params.v1beta1.ParameterChangeProposal': - return ParameterChangeProposal.fromData(data); + return ParameterChangeProposal.fromData(data) } } export function fromProto(anyProto: Any): Content { - const typeUrl = anyProto.typeUrl; + const typeUrl = anyProto.typeUrl switch (typeUrl) { case '/cosmos.gov.v1beta1.TextProposal': - return TextProposal.unpackAny(anyProto); + return TextProposal.unpackAny(anyProto) case '/cosmos.params.v1beta1.ParameterChangeProposal': - return ParameterChangeProposal.unpackAny(anyProto); + return ParameterChangeProposal.unpackAny(anyProto) } - throw new Error(`Proposal content ${typeUrl} not recognized`); + throw new Error(`Proposal content ${typeUrl} not recognized`) } } diff --git a/src/core/gov/proposals/Proposal.ts b/src/core/gov/proposals/Proposal.ts index 0864128..db20976 100644 --- a/src/core/gov/proposals/Proposal.ts +++ b/src/core/gov/proposals/Proposal.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { num } from '../../num'; -import { AccAddress } from '../../bech32'; -import { Msg } from '../../Msg'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { num } from '../../num' +import { AccAddress } from '../../bech32' +import { Msg } from '../../Msg' import { ProposalStatus, TallyResult, proposalStatusFromJSON, proposalStatusToJSON, -} from '@initia/initia.proto/cosmos/gov/v1/gov'; -import { Proposal as Proposal_pb } from '@initia/initia.proto/initia/gov/v1/gov'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/gov/v1/gov' +import { Proposal as Proposal_pb } from '@initia/initia.proto/initia/gov/v1/gov' +import Long from 'long' /** * Defines the core field members of a governance proposal @@ -20,7 +20,7 @@ export class Proposal extends JSONSerializable< Proposal.Data, Proposal.Proto > { - public total_deposit: Coins; + public total_deposit: Coins /** * @@ -63,8 +63,8 @@ export class Proposal extends JSONSerializable< public emergency: boolean, public failed_reason: string ) { - super(); - this.total_deposit = new Coins(total_deposit); + super() + this.total_deposit = new Coins(total_deposit) } public static fromAmino(data: Proposal.Amino): Proposal { @@ -87,7 +87,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - } = data; + } = data return new Proposal( Number.parseInt(id), @@ -115,7 +115,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason - ); + ) } public toAmino(): Proposal.Amino { @@ -138,11 +138,11 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - } = this; + } = this return { id: id.toString(), - messages: messages.map(msg => msg.toAmino()), + messages: messages.map((msg) => msg.toAmino()), status: proposalStatusToJSON(status), final_tally_result: { yes_count: num(final_tally_result.yes_count).toFixed(), @@ -166,7 +166,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - }; + } } public static fromData(data: Proposal.Data): Proposal { @@ -189,7 +189,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - } = data; + } = data return new Proposal( Number.parseInt(id), @@ -217,7 +217,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason - ); + ) } public toData(): Proposal.Data { @@ -240,11 +240,11 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - } = this; + } = this return { id: id.toString(), - messages: messages.map(msg => msg.toData()), + messages: messages.map((msg) => msg.toData()), status: proposalStatusToJSON(status), final_tally_result: { yes_count: num(final_tally_result.yes_count).toFixed(), @@ -268,7 +268,7 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - }; + } } public static fromProto(data: Proposal.Proto): Proposal { @@ -298,7 +298,7 @@ export class Proposal extends JSONSerializable< data.expedited, data.emergency, data.failedReason - ); + ) } public toProto(): Proposal.Proto { @@ -321,21 +321,21 @@ export class Proposal extends JSONSerializable< expedited, emergency, failed_reason, - } = this; + } = this - let ftr: TallyResult | undefined; + let ftr: TallyResult | undefined if (final_tally_result) { ftr = TallyResult.fromPartial({ yesCount: final_tally_result.yes_count.toString(), noCount: final_tally_result.no_count.toString(), abstainCount: final_tally_result.abstain_count.toString(), noWithVetoCount: final_tally_result.no_with_veto_count.toString(), - }); + }) } return Proposal_pb.fromPartial({ id: Long.fromNumber(id), - messages: messages.map(msg => msg.packAny()), + messages: messages.map((msg) => msg.packAny()), status, finalTallyResult: ftr, submitTime: submit_time, @@ -352,72 +352,72 @@ export class Proposal extends JSONSerializable< expedited, emergency, failedReason: failed_reason, - }); + }) } } export namespace Proposal { - export const Status = ProposalStatus; - export type Status = ProposalStatus; + export const Status = ProposalStatus + export type Status = ProposalStatus export interface FinalTallyResult { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string } export interface Amino { - id: string; - messages: Msg.Amino[]; - status: string; + id: string + messages: Msg.Amino[] + status: string final_tally_result: { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; - }; - submit_time: string; - deposit_end_time: string; - total_deposit: Coins.Amino; - voting_start_time: string; - voting_end_time: string; - emergency_start_time: string; - emergency_next_tally_time: string; - metadata: string; - title: string; - summary: string; - proposer: AccAddress; - expedited: boolean; - emergency: boolean; - failed_reason: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string + } + submit_time: string + deposit_end_time: string + total_deposit: Coins.Amino + voting_start_time: string + voting_end_time: string + emergency_start_time: string + emergency_next_tally_time: string + metadata: string + title: string + summary: string + proposer: AccAddress + expedited: boolean + emergency: boolean + failed_reason: string } export interface Data { - id: string; - messages: Msg.Data[]; - status: string; + id: string + messages: Msg.Data[] + status: string final_tally_result: { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; - }; - submit_time: string; - deposit_end_time: string; - total_deposit: Coins.Data; - voting_start_time: string; - voting_end_time: string; - emergency_start_time: string; - emergency_next_tally_time: string; - metadata: string; - title: string; - summary: string; - proposer: AccAddress; - expedited: boolean; - emergency: boolean; - failed_reason: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string + } + submit_time: string + deposit_end_time: string + total_deposit: Coins.Data + voting_start_time: string + voting_end_time: string + emergency_start_time: string + emergency_next_tally_time: string + metadata: string + title: string + summary: string + proposer: AccAddress + expedited: boolean + emergency: boolean + failed_reason: string } - export type Proto = Proposal_pb; + export type Proto = Proposal_pb } diff --git a/src/core/gov/proposals/TextProposal.ts b/src/core/gov/proposals/TextProposal.ts index 66dcafd..f4f06a9 100644 --- a/src/core/gov/proposals/TextProposal.ts +++ b/src/core/gov/proposals/TextProposal.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { TextProposal as TextProposal_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/gov'; +import { JSONSerializable } from '../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { TextProposal as TextProposal_pb } from '@initia/initia.proto/cosmos/gov/v1beta1/gov' /** * Basic proposal which describes the candidate proposition that must be put into effect @@ -16,80 +16,83 @@ export class TextProposal extends JSONSerializable< * @param title proposal's title * @param description proposal's description */ - constructor(public title: string, public description: string) { - super(); + constructor( + public title: string, + public description: string + ) { + super() } public static fromAmino(data: TextProposal.Amino): TextProposal { const { value: { title, description }, - } = data; - return new TextProposal(title, description); + } = data + return new TextProposal(title, description) } public toAmino(): TextProposal.Amino { - const { title, description } = this; + const { title, description } = this return { type: 'cosmos-sdk/TextProposal', value: { title, description, }, - }; + } } public static fromData(proto: TextProposal.Data): TextProposal { - const { title, description } = proto; - return new TextProposal(title, description); + const { title, description } = proto + return new TextProposal(title, description) } public toData(): TextProposal.Data { - const { title, description } = this; + const { title, description } = this return { '@type': '/cosmos.gov.v1beta1.TextProposal', title, description, - }; + } } public static fromProto(proto: TextProposal.Proto): TextProposal { - return new TextProposal(proto.title, proto.description); + return new TextProposal(proto.title, proto.description) } public toProto(): TextProposal.Proto { - const { title, description } = this; + const { title, description } = this return TextProposal_pb.fromPartial({ description, title, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.gov.v1beta1.TextProposal', value: TextProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): TextProposal { - return TextProposal.fromProto(TextProposal_pb.decode(msgAny.value)); + return TextProposal.fromProto(TextProposal_pb.decode(msgAny.value)) } } export namespace TextProposal { export interface Amino { - type: 'cosmos-sdk/TextProposal'; + type: 'cosmos-sdk/TextProposal' value: { - title: string; - description: string; - }; + title: string + description: string + } } export interface Data { - '@type': '/cosmos.gov.v1beta1.TextProposal'; - title: string; - description: string; + '@type': '/cosmos.gov.v1beta1.TextProposal' + title: string + description: string } - export type Proto = TextProposal_pb; + export type Proto = TextProposal_pb } diff --git a/src/core/gov/proposals/index.ts b/src/core/gov/proposals/index.ts index d834959..08ace1c 100644 --- a/src/core/gov/proposals/index.ts +++ b/src/core/gov/proposals/index.ts @@ -1,3 +1,3 @@ -export * from './Content'; -export * from './Proposal'; -export * from './TextProposal'; +export * from './Content' +export * from './Proposal' +export * from './TextProposal' diff --git a/src/core/group/GroupInfo.ts b/src/core/group/GroupInfo.ts index 3aac107..6ab52cd 100644 --- a/src/core/group/GroupInfo.ts +++ b/src/core/group/GroupInfo.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { GroupInfo as GroupInfo_pb } from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { GroupInfo as GroupInfo_pb } from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' export class GroupInfo extends JSONSerializable< GroupInfo.Amino, @@ -24,11 +24,11 @@ export class GroupInfo extends JSONSerializable< public total_weight: string, public created_at: Date ) { - super(); + super() } public static fromAmino(data: GroupInfo.Amino): GroupInfo { - const { id, admin, metadata, version, total_weight, created_at } = data; + const { id, admin, metadata, version, total_weight, created_at } = data return new GroupInfo( Number.parseInt(id), admin, @@ -36,11 +36,11 @@ export class GroupInfo extends JSONSerializable< Number.parseInt(version), total_weight, new Date(created_at) - ); + ) } public toAmino(): GroupInfo.Amino { - const { id, admin, metadata, version, total_weight, created_at } = this; + const { id, admin, metadata, version, total_weight, created_at } = this return { id: id.toString(), admin, @@ -48,11 +48,11 @@ export class GroupInfo extends JSONSerializable< version: version.toString(), total_weight, created_at: created_at.toISOString(), - }; + } } public static fromData(data: GroupInfo.Data): GroupInfo { - const { id, admin, metadata, version, total_weight, created_at } = data; + const { id, admin, metadata, version, total_weight, created_at } = data return new GroupInfo( Number.parseInt(id), admin, @@ -60,11 +60,11 @@ export class GroupInfo extends JSONSerializable< Number.parseInt(version), total_weight, new Date(created_at) - ); + ) } public toData(): GroupInfo.Data { - const { id, admin, metadata, version, total_weight, created_at } = this; + const { id, admin, metadata, version, total_weight, created_at } = this return { id: id.toString(), admin, @@ -72,7 +72,7 @@ export class GroupInfo extends JSONSerializable< version: version.toString(), total_weight, created_at: created_at.toISOString(), - }; + } } public static fromProto(data: GroupInfo.Proto): GroupInfo { @@ -83,11 +83,11 @@ export class GroupInfo extends JSONSerializable< data.version.toNumber(), data.totalWeight, data.createdAt as Date - ); + ) } public toProto(): GroupInfo.Proto { - const { id, admin, metadata, version, total_weight, created_at } = this; + const { id, admin, metadata, version, total_weight, created_at } = this return GroupInfo_pb.fromPartial({ id: Long.fromNumber(id), admin, @@ -95,28 +95,28 @@ export class GroupInfo extends JSONSerializable< version: Long.fromNumber(version), totalWeight: total_weight, createdAt: created_at, - }); + }) } } export namespace GroupInfo { export interface Amino { - id: string; - admin: AccAddress; - metadata: string; - version: string; - total_weight: string; - created_at: string; + id: string + admin: AccAddress + metadata: string + version: string + total_weight: string + created_at: string } export interface Data { - id: string; - admin: AccAddress; - metadata: string; - version: string; - total_weight: string; - created_at: string; + id: string + admin: AccAddress + metadata: string + version: string + total_weight: string + created_at: string } - export type Proto = GroupInfo_pb; + export type Proto = GroupInfo_pb } diff --git a/src/core/group/GroupMember.ts b/src/core/group/GroupMember.ts index fd90b1a..645fc90 100644 --- a/src/core/group/GroupMember.ts +++ b/src/core/group/GroupMember.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' import { GroupMember as GroupMember_pb, Member as Member_pb, MemberRequest as MemberRequest_pb, -} from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' export class GroupMember extends JSONSerializable< GroupMember.Amino, @@ -16,64 +16,67 @@ export class GroupMember extends JSONSerializable< * @param group_id the unique ID of the group * @param member the member data */ - constructor(public group_id: number, public member: Member) { - super(); + constructor( + public group_id: number, + public member: Member + ) { + super() } public static fromAmino(data: GroupMember.Amino): GroupMember { - const { group_id, member } = data; - return new GroupMember(Number.parseInt(group_id), Member.fromAmino(member)); + const { group_id, member } = data + return new GroupMember(Number.parseInt(group_id), Member.fromAmino(member)) } public toAmino(): GroupMember.Amino { - const { group_id, member } = this; + const { group_id, member } = this return { group_id: group_id.toString(), member: member.toAmino(), - }; + } } public static fromData(data: GroupMember.Data): GroupMember { - const { group_id, member } = data; - return new GroupMember(Number.parseInt(group_id), Member.fromData(member)); + const { group_id, member } = data + return new GroupMember(Number.parseInt(group_id), Member.fromData(member)) } public toData(): GroupMember.Data { - const { group_id, member } = this; + const { group_id, member } = this return { group_id: group_id.toString(), member: member.toData(), - }; + } } public static fromProto(data: GroupMember.Proto): GroupMember { return new GroupMember( data.groupId.toNumber(), Member.fromProto(data.member as Member) - ); + ) } public toProto(): GroupMember.Proto { - const { group_id, member } = this; + const { group_id, member } = this return GroupMember_pb.fromPartial({ groupId: Long.fromNumber(group_id), member: member.toProto(), - }); + }) } } export namespace GroupMember { export interface Amino { - group_id: string; - member: Member.Amino; + group_id: string + member: Member.Amino } export interface Data { - group_id: string; - member: Member.Data; + group_id: string + member: Member.Data } - export type Proto = GroupMember_pb; + export type Proto = GroupMember_pb } export class Member extends JSONSerializable< @@ -93,37 +96,37 @@ export class Member extends JSONSerializable< public metadata: string, public added_at: Date ) { - super(); + super() } public static fromAmino(data: Member.Amino): Member { - const { address, weight, metadata, added_at } = data; - return new Member(address, weight, metadata, new Date(added_at)); + const { address, weight, metadata, added_at } = data + return new Member(address, weight, metadata, new Date(added_at)) } public toAmino(): Member.Amino { - const { address, weight, metadata, added_at } = this; + const { address, weight, metadata, added_at } = this return { address, weight, metadata, added_at: added_at.toISOString(), - }; + } } public static fromData(data: Member.Data): Member { - const { address, weight, metadata, added_at } = data; - return new Member(address, weight, metadata, new Date(added_at)); + const { address, weight, metadata, added_at } = data + return new Member(address, weight, metadata, new Date(added_at)) } public toData(): Member.Data { - const { address, weight, metadata, added_at } = this; + const { address, weight, metadata, added_at } = this return { address, weight, metadata, added_at: added_at.toISOString(), - }; + } } public static fromProto(data: Member.Proto): Member { @@ -132,36 +135,36 @@ export class Member extends JSONSerializable< data.weight, data.metadata, data.addedAt as Date - ); + ) } public toProto(): Member.Proto { - const { address, weight, metadata, added_at } = this; + const { address, weight, metadata, added_at } = this return Member_pb.fromPartial({ address, weight, metadata, addedAt: added_at, - }); + }) } } export namespace Member { export interface Amino { - address: AccAddress; - weight: string; - metadata: string; - added_at: string; + address: AccAddress + weight: string + metadata: string + added_at: string } export interface Data { - address: AccAddress; - weight: string; - metadata: string; - added_at: string; + address: AccAddress + weight: string + metadata: string + added_at: string } - export type Proto = Member_pb; + export type Proto = Member_pb } export class MemberRequest extends JSONSerializable< @@ -179,63 +182,63 @@ export class MemberRequest extends JSONSerializable< public weight: string, public metadata: string ) { - super(); + super() } public static fromAmino(data: MemberRequest.Amino): MemberRequest { - const { address, weight, metadata } = data; - return new MemberRequest(address, weight, metadata); + const { address, weight, metadata } = data + return new MemberRequest(address, weight, metadata) } public toAmino(): MemberRequest.Amino { - const { address, weight, metadata } = this; + const { address, weight, metadata } = this return { address, weight, metadata, - }; + } } public static fromData(data: MemberRequest.Data): MemberRequest { - const { address, weight, metadata } = data; - return new MemberRequest(address, weight, metadata); + const { address, weight, metadata } = data + return new MemberRequest(address, weight, metadata) } public toData(): MemberRequest.Data { - const { address, weight, metadata } = this; + const { address, weight, metadata } = this return { address, weight, metadata, - }; + } } public static fromProto(data: MemberRequest.Proto): MemberRequest { - return new MemberRequest(data.address, data.weight, data.metadata); + return new MemberRequest(data.address, data.weight, data.metadata) } public toProto(): MemberRequest.Proto { - const { address, weight, metadata } = this; + const { address, weight, metadata } = this return MemberRequest_pb.fromPartial({ address, weight, metadata, - }); + }) } } export namespace MemberRequest { export interface Amino { - address: AccAddress; - weight: string; - metadata: string; + address: AccAddress + weight: string + metadata: string } export interface Data { - address: AccAddress; - weight: string; - metadata: string; + address: AccAddress + weight: string + metadata: string } - export type Proto = MemberRequest_pb; + export type Proto = MemberRequest_pb } diff --git a/src/core/group/GroupPolicyInfo.ts b/src/core/group/GroupPolicyInfo.ts index eeb1da5..430e377 100644 --- a/src/core/group/GroupPolicyInfo.ts +++ b/src/core/group/GroupPolicyInfo.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { DecisionPolicy } from './policies'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { GroupPolicyInfo as GroupPolicyInfo_pb } from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { DecisionPolicy } from './policies' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { GroupPolicyInfo as GroupPolicyInfo_pb } from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' export class GroupPolicyInfo extends JSONSerializable< GroupPolicyInfo.Amino, @@ -28,7 +28,7 @@ export class GroupPolicyInfo extends JSONSerializable< public decision_policy: DecisionPolicy, public created_at: Date ) { - super(); + super() } public static fromAmino(data: GroupPolicyInfo.Amino): GroupPolicyInfo { @@ -40,7 +40,7 @@ export class GroupPolicyInfo extends JSONSerializable< version, decision_policy, created_at, - } = data; + } = data return new GroupPolicyInfo( address, @@ -50,7 +50,7 @@ export class GroupPolicyInfo extends JSONSerializable< Number.parseInt(version), DecisionPolicy.fromAmino(decision_policy), new Date(created_at) - ); + ) } public toAmino(): GroupPolicyInfo.Amino { @@ -62,7 +62,7 @@ export class GroupPolicyInfo extends JSONSerializable< version, decision_policy, created_at, - } = this; + } = this return { address, @@ -72,7 +72,7 @@ export class GroupPolicyInfo extends JSONSerializable< version: version.toString(), decision_policy: decision_policy.toAmino(), created_at: created_at.toISOString(), - }; + } } public static fromData(data: GroupPolicyInfo.Data): GroupPolicyInfo { @@ -84,7 +84,7 @@ export class GroupPolicyInfo extends JSONSerializable< version, decision_policy, created_at, - } = data; + } = data return new GroupPolicyInfo( address, @@ -94,7 +94,7 @@ export class GroupPolicyInfo extends JSONSerializable< Number.parseInt(version), DecisionPolicy.fromData(decision_policy), new Date(created_at) - ); + ) } public toData(): GroupPolicyInfo.Data { @@ -106,7 +106,7 @@ export class GroupPolicyInfo extends JSONSerializable< version, decision_policy, created_at, - } = this; + } = this return { address, @@ -116,7 +116,7 @@ export class GroupPolicyInfo extends JSONSerializable< version: version.toString(), decision_policy: decision_policy.toData(), created_at: created_at.toISOString(), - }; + } } public static fromProto(data: GroupPolicyInfo.Proto): GroupPolicyInfo { @@ -128,7 +128,7 @@ export class GroupPolicyInfo extends JSONSerializable< data.version.toNumber(), DecisionPolicy.fromProto(data.decisionPolicy as Any), data.createdAt as Date - ); + ) } public toProto(): GroupPolicyInfo.Proto { @@ -140,7 +140,7 @@ export class GroupPolicyInfo extends JSONSerializable< version, decision_policy, created_at, - } = this; + } = this return GroupPolicyInfo_pb.fromPartial({ address, @@ -150,30 +150,30 @@ export class GroupPolicyInfo extends JSONSerializable< version: Long.fromNumber(version), decisionPolicy: decision_policy.packAny(), createdAt: created_at, - }); + }) } } export namespace GroupPolicyInfo { export interface Amino { - address: AccAddress; - group_id: string; - admin: AccAddress; - metadata: string; - version: string; - decision_policy: DecisionPolicy.Amino; - created_at: string; + address: AccAddress + group_id: string + admin: AccAddress + metadata: string + version: string + decision_policy: DecisionPolicy.Amino + created_at: string } export interface Data { - address: AccAddress; - group_id: string; - admin: AccAddress; - metadata: string; - version: string; - decision_policy: DecisionPolicy.Data; - created_at: string; + address: AccAddress + group_id: string + admin: AccAddress + metadata: string + version: string + decision_policy: DecisionPolicy.Data + created_at: string } - export type Proto = GroupPolicyInfo_pb; + export type Proto = GroupPolicyInfo_pb } diff --git a/src/core/group/GroupProposal.ts b/src/core/group/GroupProposal.ts index 97734a8..c9eb3eb 100644 --- a/src/core/group/GroupProposal.ts +++ b/src/core/group/GroupProposal.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { num } from '../num'; -import { AccAddress } from '../bech32'; -import { Msg } from '../Msg'; +import { JSONSerializable } from '../../util/json' +import { num } from '../num' +import { AccAddress } from '../bech32' +import { Msg } from '../Msg' import { Proposal as Proposal_pb, ProposalStatus, @@ -11,8 +11,8 @@ import { proposalStatusToJSON, proposalExecutorResultFromJSON, proposalExecutorResultToJSON, -} from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' /** * A group proposal consists of a set of `sdk.Msg`s that will be executed if the proposal @@ -56,7 +56,7 @@ export class GroupProposal extends JSONSerializable< public title: string, public summary: string ) { - super(); + super() } public static fromAmino(data: GroupProposal.Amino): GroupProposal { @@ -75,7 +75,7 @@ export class GroupProposal extends JSONSerializable< messages, title, summary, - } = data; + } = data return new GroupProposal( Number.parseInt(id), @@ -99,7 +99,7 @@ export class GroupProposal extends JSONSerializable< messages.map(Msg.fromAmino), title, summary - ); + ) } public toAmino(): GroupProposal.Amino { @@ -118,7 +118,7 @@ export class GroupProposal extends JSONSerializable< messages, title, summary, - } = this; + } = this return { id: id.toString(), @@ -139,10 +139,10 @@ export class GroupProposal extends JSONSerializable< }, voting_period_end: voting_period_end.toISOString(), executor_result: proposalExecutorResultToJSON(executor_result), - messages: messages.map(msg => msg.toAmino()), + messages: messages.map((msg) => msg.toAmino()), title, summary, - }; + } } public static fromData(data: GroupProposal.Data): GroupProposal { @@ -161,7 +161,7 @@ export class GroupProposal extends JSONSerializable< messages, title, summary, - } = data; + } = data return new GroupProposal( Number.parseInt(id), @@ -185,7 +185,7 @@ export class GroupProposal extends JSONSerializable< messages.map(Msg.fromData), title, summary - ); + ) } public toData(): GroupProposal.Data { @@ -204,7 +204,7 @@ export class GroupProposal extends JSONSerializable< messages, title, summary, - } = this; + } = this return { id: id.toString(), @@ -225,10 +225,10 @@ export class GroupProposal extends JSONSerializable< }, voting_period_end: voting_period_end.toISOString(), executor_result: proposalExecutorResultToJSON(executor_result), - messages: messages.map(msg => msg.toData()), + messages: messages.map((msg) => msg.toData()), title, summary, - }; + } } public static fromProto(data: GroupProposal.Proto): GroupProposal { @@ -254,7 +254,7 @@ export class GroupProposal extends JSONSerializable< data.messages.map(Msg.fromProto), data.title, data.summary - ); + ) } public toProto(): GroupProposal.Proto { @@ -273,16 +273,16 @@ export class GroupProposal extends JSONSerializable< messages, title, summary, - } = this; + } = this - let ftr: TallyResult | undefined; + let ftr: TallyResult | undefined if (final_tally_result) { ftr = TallyResult.fromPartial({ yesCount: final_tally_result.yes_count.toString(), noCount: final_tally_result.no_count.toString(), abstainCount: final_tally_result.abstain_count.toString(), noWithVetoCount: final_tally_result.no_with_veto_count.toString(), - }); + }) } return Proposal_pb.fromPartial({ @@ -297,69 +297,69 @@ export class GroupProposal extends JSONSerializable< finalTallyResult: ftr, votingPeriodEnd: voting_period_end, executorResult: executor_result, - messages: messages.map(msg => msg.packAny()), + messages: messages.map((msg) => msg.packAny()), title, summary, - }); + }) } } export namespace GroupProposal { - export const Status = ProposalStatus; - export type Status = ProposalStatus; - export const ExecutorResult = ProposalExecutorResult; - export type ExecutorResult = ProposalExecutorResult; + export const Status = ProposalStatus + export type Status = ProposalStatus + export const ExecutorResult = ProposalExecutorResult + export type ExecutorResult = ProposalExecutorResult export interface FinalTallyResult { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string } export interface Amino { - id: string; - group_policy_address: AccAddress; - metadata: string; - proposers: AccAddress[]; - submit_time: string; - group_version: string; - group_policy_version: string; - status: string; + id: string + group_policy_address: AccAddress + metadata: string + proposers: AccAddress[] + submit_time: string + group_version: string + group_policy_version: string + status: string final_tally_result: { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; - }; - voting_period_end: string; - executor_result: string; - messages: Msg.Amino[]; - title: string; - summary: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string + } + voting_period_end: string + executor_result: string + messages: Msg.Amino[] + title: string + summary: string } export interface Data { - id: string; - group_policy_address: AccAddress; - metadata: string; - proposers: AccAddress[]; - submit_time: string; - group_version: string; - group_policy_version: string; - status: string; + id: string + group_policy_address: AccAddress + metadata: string + proposers: AccAddress[] + submit_time: string + group_version: string + group_policy_version: string + status: string final_tally_result: { - yes_count: string; - abstain_count: string; - no_count: string; - no_with_veto_count: string; - }; - voting_period_end: string; - executor_result: string; - messages: Msg.Data[]; - title: string; - summary: string; + yes_count: string + abstain_count: string + no_count: string + no_with_veto_count: string + } + voting_period_end: string + executor_result: string + messages: Msg.Data[] + title: string + summary: string } - export type Proto = Proposal_pb; + export type Proto = Proposal_pb } diff --git a/src/core/group/GroupVote.ts b/src/core/group/GroupVote.ts index 9b89e9d..d445b90 100644 --- a/src/core/group/GroupVote.ts +++ b/src/core/group/GroupVote.ts @@ -1,12 +1,12 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' import { Vote as Vote_pb, VoteOption, voteOptionFromJSON, voteOptionToJSON, -} from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' export class GroupVote extends JSONSerializable< GroupVote.Amino, @@ -27,51 +27,51 @@ export class GroupVote extends JSONSerializable< public metadata: string, public submit_time: Date ) { - super(); + super() } public static fromAmino(data: GroupVote.Amino): GroupVote { - const { proposal_id, voter, option, metadata, submit_time } = data; + const { proposal_id, voter, option, metadata, submit_time } = data return new GroupVote( Number.parseInt(proposal_id), voter, voteOptionFromJSON(option), metadata, new Date(submit_time) - ); + ) } public toAmino(): GroupVote.Amino { - const { proposal_id, voter, option, metadata, submit_time } = this; + const { proposal_id, voter, option, metadata, submit_time } = this return { proposal_id: proposal_id.toString(), voter, option: voteOptionToJSON(option), metadata, submit_time: submit_time.toISOString(), - }; + } } public static fromData(data: GroupVote.Data): GroupVote { - const { proposal_id, voter, option, metadata, submit_time } = data; + const { proposal_id, voter, option, metadata, submit_time } = data return new GroupVote( Number.parseInt(proposal_id), voter, voteOptionFromJSON(option), metadata, new Date(submit_time) - ); + ) } public toData(): GroupVote.Data { - const { proposal_id, voter, option, metadata, submit_time } = this; + const { proposal_id, voter, option, metadata, submit_time } = this return { proposal_id: proposal_id.toString(), voter, option: voteOptionToJSON(option), metadata, submit_time: submit_time.toISOString(), - }; + } } public static fromProto(data: GroupVote.Proto): GroupVote { @@ -81,40 +81,40 @@ export class GroupVote extends JSONSerializable< data.option, data.metadata, data.submitTime as Date - ); + ) } public toProto(): GroupVote.Proto { - const { proposal_id, voter, option, metadata, submit_time } = this; + const { proposal_id, voter, option, metadata, submit_time } = this return Vote_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), voter, option, metadata, submitTime: submit_time, - }); + }) } } export namespace GroupVote { - export type Option = VoteOption; - export const Option = VoteOption; + export type Option = VoteOption + export const Option = VoteOption export interface Amino { - proposal_id: string; - voter: AccAddress; - option: string; - metadata: string; - submit_time: string; + proposal_id: string + voter: AccAddress + option: string + metadata: string + submit_time: string } export interface Data { - proposal_id: string; - voter: AccAddress; - option: string; - metadata: string; - submit_time: string; + proposal_id: string + voter: AccAddress + option: string + metadata: string + submit_time: string } - export type Proto = Vote_pb; + export type Proto = Vote_pb } diff --git a/src/core/group/index.ts b/src/core/group/index.ts index f4233ca..44c9cea 100644 --- a/src/core/group/index.ts +++ b/src/core/group/index.ts @@ -1,7 +1,7 @@ -export * from './msgs'; -export * from './policies'; -export * from './GroupInfo'; -export * from './GroupMember'; -export * from './GroupPolicyInfo'; -export * from './GroupProposal'; -export * from './GroupVote'; +export * from './msgs' +export * from './policies' +export * from './GroupInfo' +export * from './GroupMember' +export * from './GroupPolicyInfo' +export * from './GroupProposal' +export * from './GroupVote' diff --git a/src/core/group/msgs/MsgCreateGroup.ts b/src/core/group/msgs/MsgCreateGroup.ts index 3422382..76c9dca 100644 --- a/src/core/group/msgs/MsgCreateGroup.ts +++ b/src/core/group/msgs/MsgCreateGroup.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MemberRequest } from '../GroupMember'; -import { MsgCreateGroup as MsgCreateGroup_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MemberRequest } from '../GroupMember' +import { MsgCreateGroup as MsgCreateGroup_pb } from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgCreateGroup extends JSONSerializable< MsgCreateGroup.Amino, @@ -19,49 +19,49 @@ export class MsgCreateGroup extends JSONSerializable< public members: MemberRequest[], public metadata: string ) { - super(); + super() } public static fromAmino(data: MsgCreateGroup.Amino): MsgCreateGroup { const { value: { admin, members, metadata }, - } = data; + } = data return new MsgCreateGroup( admin, members.map(MemberRequest.fromAmino), metadata - ); + ) } public toAmino(): MsgCreateGroup.Amino { - const { admin, members, metadata } = this; + const { admin, members, metadata } = this return { type: 'cosmos-sdk/MsgCreateGroup', value: { admin, - members: members.map(d => d.toAmino()), + members: members.map((d) => d.toAmino()), metadata, }, - }; + } } public static fromData(data: MsgCreateGroup.Data): MsgCreateGroup { - const { admin, members, metadata } = data; + const { admin, members, metadata } = data return new MsgCreateGroup( admin, members.map(MemberRequest.fromData), metadata - ); + ) } public toData(): MsgCreateGroup.Data { - const { admin, members, metadata } = this; + const { admin, members, metadata } = this return { '@type': '/cosmos.group.v1.MsgCreateGroup', admin, - members: members.map(d => d.toData()), + members: members.map((d) => d.toData()), metadata, - }; + } } public static fromProto(data: MsgCreateGroup.Proto): MsgCreateGroup { @@ -69,46 +69,46 @@ export class MsgCreateGroup extends JSONSerializable< data.admin, data.members.map(MemberRequest.fromProto), data.metadata - ); + ) } public toProto(): MsgCreateGroup.Proto { - const { admin, members, metadata } = this; + const { admin, members, metadata } = this return MsgCreateGroup_pb.fromPartial({ admin, - members: members.map(d => d.toProto()), + members: members.map((d) => d.toProto()), metadata, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgCreateGroup', value: MsgCreateGroup_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateGroup { - return MsgCreateGroup.fromProto(MsgCreateGroup_pb.decode(msgAny.value)); + return MsgCreateGroup.fromProto(MsgCreateGroup_pb.decode(msgAny.value)) } } export namespace MsgCreateGroup { export interface Amino { - type: 'cosmos-sdk/MsgCreateGroup'; + type: 'cosmos-sdk/MsgCreateGroup' value: { - admin: AccAddress; - members: MemberRequest.Amino[]; - metadata: string; - }; + admin: AccAddress + members: MemberRequest.Amino[] + metadata: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgCreateGroup'; - admin: AccAddress; - members: MemberRequest.Data[]; - metadata: string; + '@type': '/cosmos.group.v1.MsgCreateGroup' + admin: AccAddress + members: MemberRequest.Data[] + metadata: string } - export type Proto = MsgCreateGroup_pb; + export type Proto = MsgCreateGroup_pb } diff --git a/src/core/group/msgs/MsgCreateGroupPolicy.ts b/src/core/group/msgs/MsgCreateGroupPolicy.ts index 519efa2..c63de5d 100644 --- a/src/core/group/msgs/MsgCreateGroupPolicy.ts +++ b/src/core/group/msgs/MsgCreateGroupPolicy.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DecisionPolicy } from '../policies'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreateGroupPolicy as MsgCreateGroupPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DecisionPolicy } from '../policies' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreateGroupPolicy as MsgCreateGroupPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgCreateGroupPolicy extends JSONSerializable< MsgCreateGroupPolicy.Amino, @@ -22,7 +22,7 @@ export class MsgCreateGroupPolicy extends JSONSerializable< public metadata: string, public decision_policy: DecisionPolicy ) { - super(); + super() } public static fromAmino( @@ -30,17 +30,17 @@ export class MsgCreateGroupPolicy extends JSONSerializable< ): MsgCreateGroupPolicy { const { value: { admin, group_id, metadata, decision_policy }, - } = data; + } = data return new MsgCreateGroupPolicy( admin, Number.parseInt(group_id), metadata, DecisionPolicy.fromAmino(decision_policy) - ); + ) } public toAmino(): MsgCreateGroupPolicy.Amino { - const { admin, group_id, metadata, decision_policy } = this; + const { admin, group_id, metadata, decision_policy } = this return { type: 'cosmos-sdk/MsgCreateGroupPolicy', value: { @@ -49,30 +49,30 @@ export class MsgCreateGroupPolicy extends JSONSerializable< metadata, decision_policy: decision_policy.toAmino(), }, - }; + } } public static fromData( data: MsgCreateGroupPolicy.Data ): MsgCreateGroupPolicy { - const { admin, group_id, metadata, decision_policy } = data; + const { admin, group_id, metadata, decision_policy } = data return new MsgCreateGroupPolicy( admin, Number.parseInt(group_id), metadata, DecisionPolicy.fromData(decision_policy) - ); + ) } public toData(): MsgCreateGroupPolicy.Data { - const { admin, group_id, metadata, decision_policy } = this; + const { admin, group_id, metadata, decision_policy } = this return { '@type': '/cosmos.group.v1.MsgCreateGroupPolicy', admin, group_id: group_id.toString(), metadata, decision_policy: decision_policy.toData(), - }; + } } public static fromProto( @@ -83,51 +83,51 @@ export class MsgCreateGroupPolicy extends JSONSerializable< data.groupId.toNumber(), data.metadata, DecisionPolicy.fromProto(data.decisionPolicy as DecisionPolicy.Proto) - ); + ) } public toProto(): MsgCreateGroupPolicy.Proto { - const { admin, group_id, metadata, decision_policy } = this; + const { admin, group_id, metadata, decision_policy } = this return MsgCreateGroupPolicy_pb.fromPartial({ admin, groupId: Long.fromNumber(group_id), metadata, decisionPolicy: decision_policy.packAny(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgCreateGroupPolicy', value: MsgCreateGroupPolicy_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateGroupPolicy { return MsgCreateGroupPolicy.fromProto( MsgCreateGroupPolicy_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCreateGroupPolicy { export interface Amino { - type: 'cosmos-sdk/MsgCreateGroupPolicy'; + type: 'cosmos-sdk/MsgCreateGroupPolicy' value: { - admin: AccAddress; - group_id: string; - metadata: string; - decision_policy: DecisionPolicy.Amino; - }; + admin: AccAddress + group_id: string + metadata: string + decision_policy: DecisionPolicy.Amino + } } export interface Data { - '@type': '/cosmos.group.v1.MsgCreateGroupPolicy'; - admin: AccAddress; - group_id: string; - metadata: string; - decision_policy: DecisionPolicy.Data; + '@type': '/cosmos.group.v1.MsgCreateGroupPolicy' + admin: AccAddress + group_id: string + metadata: string + decision_policy: DecisionPolicy.Data } - export type Proto = MsgCreateGroupPolicy_pb; + export type Proto = MsgCreateGroupPolicy_pb } diff --git a/src/core/group/msgs/MsgCreateGroupWithPolicy.ts b/src/core/group/msgs/MsgCreateGroupWithPolicy.ts index 0ef3000..2e64758 100644 --- a/src/core/group/msgs/MsgCreateGroupWithPolicy.ts +++ b/src/core/group/msgs/MsgCreateGroupWithPolicy.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DecisionPolicy } from '../policies'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MemberRequest } from '../GroupMember'; -import { MsgCreateGroupWithPolicy as MsgCreateGroupWithPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DecisionPolicy } from '../policies' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MemberRequest } from '../GroupMember' +import { MsgCreateGroupWithPolicy as MsgCreateGroupWithPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgCreateGroupWithPolicy extends JSONSerializable< MsgCreateGroupWithPolicy.Amino, @@ -26,7 +26,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< public group_policy_as_admin: boolean, public decision_policy: DecisionPolicy ) { - super(); + super() } public static fromAmino( @@ -41,7 +41,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_as_admin, decision_policy, }, - } = data; + } = data return new MsgCreateGroupWithPolicy( admin, @@ -50,7 +50,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, DecisionPolicy.fromAmino(decision_policy) - ); + ) } public toAmino(): MsgCreateGroupWithPolicy.Amino { @@ -61,19 +61,19 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, decision_policy, - } = this; + } = this return { type: 'cosmos-sdk/MsgCreateGroupWithPolicy', value: { admin, - members: members.map(d => d.toAmino()), + members: members.map((d) => d.toAmino()), group_metadata, group_policy_metadata, group_policy_as_admin, decision_policy: decision_policy.toAmino(), }, - }; + } } public static fromData( @@ -86,7 +86,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, decision_policy, - } = data; + } = data return new MsgCreateGroupWithPolicy( admin, @@ -95,7 +95,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, DecisionPolicy.fromData(decision_policy) - ); + ) } public toData(): MsgCreateGroupWithPolicy.Data { @@ -106,17 +106,17 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, decision_policy, - } = this; + } = this return { '@type': '/cosmos.group.v1.MsgCreateGroupWithPolicy', admin, - members: members.map(d => d.toData()), + members: members.map((d) => d.toData()), group_metadata, group_policy_metadata, group_policy_as_admin, decision_policy: decision_policy.toData(), - }; + } } public static fromProto( @@ -129,7 +129,7 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< data.groupPolicyMetadata, data.groupPolicyAsAdmin, DecisionPolicy.fromProto(data.decisionPolicy as DecisionPolicy.Proto) - ); + ) } public toProto(): MsgCreateGroupWithPolicy.Proto { @@ -140,54 +140,54 @@ export class MsgCreateGroupWithPolicy extends JSONSerializable< group_policy_metadata, group_policy_as_admin, decision_policy, - } = this; + } = this return MsgCreateGroupWithPolicy_pb.fromPartial({ admin, - members: members.map(d => d.toProto()), + members: members.map((d) => d.toProto()), groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, decisionPolicy: decision_policy.packAny(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgCreateGroupWithPolicy', value: MsgCreateGroupWithPolicy_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateGroupWithPolicy { return MsgCreateGroupWithPolicy.fromProto( MsgCreateGroupWithPolicy_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCreateGroupWithPolicy { export interface Amino { - type: 'cosmos-sdk/MsgCreateGroupWithPolicy'; + type: 'cosmos-sdk/MsgCreateGroupWithPolicy' value: { - admin: AccAddress; - members: MemberRequest.Amino[]; - group_metadata: string; - group_policy_metadata: string; - group_policy_as_admin: boolean; - decision_policy: DecisionPolicy.Amino; - }; + admin: AccAddress + members: MemberRequest.Amino[] + group_metadata: string + group_policy_metadata: string + group_policy_as_admin: boolean + decision_policy: DecisionPolicy.Amino + } } export interface Data { - '@type': '/cosmos.group.v1.MsgCreateGroupWithPolicy'; - admin: AccAddress; - members: MemberRequest.Data[]; - group_metadata: string; - group_policy_metadata: string; - group_policy_as_admin: boolean; - decision_policy: DecisionPolicy.Data; + '@type': '/cosmos.group.v1.MsgCreateGroupWithPolicy' + admin: AccAddress + members: MemberRequest.Data[] + group_metadata: string + group_policy_metadata: string + group_policy_as_admin: boolean + decision_policy: DecisionPolicy.Data } - export type Proto = MsgCreateGroupWithPolicy_pb; + export type Proto = MsgCreateGroupWithPolicy_pb } diff --git a/src/core/group/msgs/MsgGroupExec.ts b/src/core/group/msgs/MsgGroupExec.ts index 50e1063..bae3dc6 100644 --- a/src/core/group/msgs/MsgGroupExec.ts +++ b/src/core/group/msgs/MsgGroupExec.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgExec as MsgExec_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgExec as MsgExec_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgGroupExec extends JSONSerializable< MsgGroupExec.Amino, @@ -13,80 +13,83 @@ export class MsgGroupExec extends JSONSerializable< * @param proposal_id the unique ID of the proposal * @param executor the account address used to execute the proposal */ - constructor(public proposal_id: number, public executor: AccAddress) { - super(); + constructor( + public proposal_id: number, + public executor: AccAddress + ) { + super() } public static fromAmino(data: MsgGroupExec.Amino): MsgGroupExec { const { value: { proposal_id, executor }, - } = data; - return new MsgGroupExec(Number.parseInt(proposal_id), executor); + } = data + return new MsgGroupExec(Number.parseInt(proposal_id), executor) } public toAmino(): MsgGroupExec.Amino { - const { proposal_id, executor } = this; + const { proposal_id, executor } = this return { type: 'cosmos-sdk/group/MsgExec', value: { proposal_id: proposal_id.toString(), executor, }, - }; + } } public static fromData(data: MsgGroupExec.Data): MsgGroupExec { - const { proposal_id, executor } = data; - return new MsgGroupExec(Number.parseInt(proposal_id), executor); + const { proposal_id, executor } = data + return new MsgGroupExec(Number.parseInt(proposal_id), executor) } public toData(): MsgGroupExec.Data { - const { proposal_id, executor } = this; + const { proposal_id, executor } = this return { '@type': '/cosmos.group.v1.MsgExec', proposal_id: proposal_id.toString(), executor, - }; + } } public static fromProto(data: MsgGroupExec.Proto): MsgGroupExec { - return new MsgGroupExec(data.proposalId.toNumber(), data.executor); + return new MsgGroupExec(data.proposalId.toNumber(), data.executor) } public toProto(): MsgGroupExec.Proto { - const { proposal_id, executor } = this; + const { proposal_id, executor } = this return MsgExec_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), executor, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgExec', value: MsgExec_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGroupExec { - return MsgGroupExec.fromProto(MsgExec_pb.decode(msgAny.value)); + return MsgGroupExec.fromProto(MsgExec_pb.decode(msgAny.value)) } } export namespace MsgGroupExec { export interface Amino { - type: 'cosmos-sdk/group/MsgExec'; + type: 'cosmos-sdk/group/MsgExec' value: { - proposal_id: string; - executor: AccAddress; - }; + proposal_id: string + executor: AccAddress + } } export interface Data { - '@type': '/cosmos.group.v1.MsgExec'; - proposal_id: string; - executor: AccAddress; + '@type': '/cosmos.group.v1.MsgExec' + proposal_id: string + executor: AccAddress } - export type Proto = MsgExec_pb; + export type Proto = MsgExec_pb } diff --git a/src/core/group/msgs/MsgGroupVote.ts b/src/core/group/msgs/MsgGroupVote.ts index 7e33133..848cea3 100644 --- a/src/core/group/msgs/MsgGroupVote.ts +++ b/src/core/group/msgs/MsgGroupVote.ts @@ -1,18 +1,18 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgVote as MsgVote_pb, Exec as Exec_pb, execFromJSON, execToJSON, -} from '@initia/initia.proto/cosmos/group/v1/tx'; +} from '@initia/initia.proto/cosmos/group/v1/tx' import { VoteOption, voteOptionFromJSON, voteOptionToJSON, -} from '@initia/initia.proto/cosmos/group/v1/types'; -import Long from 'long'; +} from '@initia/initia.proto/cosmos/group/v1/types' +import Long from 'long' export class MsgGroupVote extends JSONSerializable< MsgGroupVote.Amino, @@ -33,13 +33,13 @@ export class MsgGroupVote extends JSONSerializable< public metadata: string, public exec: MsgGroupVote.Exec ) { - super(); + super() } public static fromAmino(data: MsgGroupVote.Amino): MsgGroupVote { const { value: { proposal_id, voter, option, metadata, exec }, - } = data; + } = data return new MsgGroupVote( Number.parseInt(proposal_id), @@ -47,11 +47,11 @@ export class MsgGroupVote extends JSONSerializable< voteOptionFromJSON(option), metadata, execFromJSON(exec) - ); + ) } public toAmino(): MsgGroupVote.Amino { - const { proposal_id, voter, option, metadata, exec } = this; + const { proposal_id, voter, option, metadata, exec } = this return { type: 'cosmos-sdk/group/MsgVote', @@ -62,11 +62,11 @@ export class MsgGroupVote extends JSONSerializable< metadata, exec: execToJSON(exec), }, - }; + } } public static fromData(data: MsgGroupVote.Data): MsgGroupVote { - const { proposal_id, voter, option, metadata, exec } = data; + const { proposal_id, voter, option, metadata, exec } = data return new MsgGroupVote( Number.parseInt(proposal_id), @@ -74,11 +74,11 @@ export class MsgGroupVote extends JSONSerializable< voteOptionFromJSON(option), metadata, execFromJSON(exec) - ); + ) } public toData(): MsgGroupVote.Data { - const { proposal_id, voter, option, metadata, exec } = this; + const { proposal_id, voter, option, metadata, exec } = this return { '@type': '/cosmos.group.v1.MsgVote', @@ -87,7 +87,7 @@ export class MsgGroupVote extends JSONSerializable< option: voteOptionToJSON(option), metadata, exec: execToJSON(exec), - }; + } } public static fromProto(data: MsgGroupVote.Proto): MsgGroupVote { @@ -97,11 +97,11 @@ export class MsgGroupVote extends JSONSerializable< data.option, data.metadata, data.exec - ); + ) } public toProto(): MsgGroupVote.Proto { - const { proposal_id, voter, option, metadata, exec } = this; + const { proposal_id, voter, option, metadata, exec } = this return MsgVote_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), @@ -109,46 +109,46 @@ export class MsgGroupVote extends JSONSerializable< option, metadata, exec, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgVote', value: MsgVote_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGroupVote { - return MsgGroupVote.fromProto(MsgVote_pb.decode(msgAny.value)); + return MsgGroupVote.fromProto(MsgVote_pb.decode(msgAny.value)) } } export namespace MsgGroupVote { - export type Option = VoteOption; - export const Option = VoteOption; - export type Exec = Exec_pb; - export const Exec = Exec_pb; + export type Option = VoteOption + export const Option = VoteOption + export type Exec = Exec_pb + export const Exec = Exec_pb export interface Amino { - type: 'cosmos-sdk/group/MsgVote'; + type: 'cosmos-sdk/group/MsgVote' value: { - proposal_id: string; - voter: AccAddress; - option: string; - metadata: string; - exec: string; - }; + proposal_id: string + voter: AccAddress + option: string + metadata: string + exec: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgVote'; - proposal_id: string; - voter: AccAddress; - option: string; - metadata: string; - exec: string; + '@type': '/cosmos.group.v1.MsgVote' + proposal_id: string + voter: AccAddress + option: string + metadata: string + exec: string } - export type Proto = MsgVote_pb; + export type Proto = MsgVote_pb } diff --git a/src/core/group/msgs/MsgLeaveGroup.ts b/src/core/group/msgs/MsgLeaveGroup.ts index 026fe4e..eec5032 100644 --- a/src/core/group/msgs/MsgLeaveGroup.ts +++ b/src/core/group/msgs/MsgLeaveGroup.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgLeaveGroup as MsgLeaveGroup_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgLeaveGroup as MsgLeaveGroup_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgLeaveGroup extends JSONSerializable< MsgLeaveGroup.Amino, @@ -13,80 +13,83 @@ export class MsgLeaveGroup extends JSONSerializable< * @param address the account address of the group member * @param group_id the unique ID of the group */ - constructor(public address: AccAddress, public group_id: number) { - super(); + constructor( + public address: AccAddress, + public group_id: number + ) { + super() } public static fromAmino(data: MsgLeaveGroup.Amino): MsgLeaveGroup { const { value: { address, group_id }, - } = data; - return new MsgLeaveGroup(address, Number.parseInt(group_id)); + } = data + return new MsgLeaveGroup(address, Number.parseInt(group_id)) } public toAmino(): MsgLeaveGroup.Amino { - const { address, group_id } = this; + const { address, group_id } = this return { type: 'cosmos-sdk/group/MsgLeaveGroup', value: { address: address, group_id: group_id.toString(), }, - }; + } } public static fromData(data: MsgLeaveGroup.Data): MsgLeaveGroup { - const { address, group_id } = data; - return new MsgLeaveGroup(address, Number.parseInt(group_id)); + const { address, group_id } = data + return new MsgLeaveGroup(address, Number.parseInt(group_id)) } public toData(): MsgLeaveGroup.Data { - const { address, group_id } = this; + const { address, group_id } = this return { '@type': '/cosmos.group.v1.MsgLeaveGroup', address, group_id: group_id.toString(), - }; + } } public static fromProto(data: MsgLeaveGroup.Proto): MsgLeaveGroup { - return new MsgLeaveGroup(data.address, data.groupId.toNumber()); + return new MsgLeaveGroup(data.address, data.groupId.toNumber()) } public toProto(): MsgLeaveGroup.Proto { - const { address, group_id } = this; + const { address, group_id } = this return MsgLeaveGroup_pb.fromPartial({ address, groupId: Long.fromNumber(group_id), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgLeaveGroup', value: MsgLeaveGroup_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgLeaveGroup { - return MsgLeaveGroup.fromProto(MsgLeaveGroup_pb.decode(msgAny.value)); + return MsgLeaveGroup.fromProto(MsgLeaveGroup_pb.decode(msgAny.value)) } } export namespace MsgLeaveGroup { export interface Amino { - type: 'cosmos-sdk/group/MsgLeaveGroup'; + type: 'cosmos-sdk/group/MsgLeaveGroup' value: { - address: AccAddress; - group_id: string; - }; + address: AccAddress + group_id: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgLeaveGroup'; - address: AccAddress; - group_id: string; + '@type': '/cosmos.group.v1.MsgLeaveGroup' + address: AccAddress + group_id: string } - export type Proto = MsgLeaveGroup_pb; + export type Proto = MsgLeaveGroup_pb } diff --git a/src/core/group/msgs/MsgSubmitGroupProposal.ts b/src/core/group/msgs/MsgSubmitGroupProposal.ts index 3695534..e4fd3e8 100644 --- a/src/core/group/msgs/MsgSubmitGroupProposal.ts +++ b/src/core/group/msgs/MsgSubmitGroupProposal.ts @@ -1,13 +1,13 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Msg } from '../../Msg'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Msg } from '../../Msg' +import { Any } from '@initia/initia.proto/google/protobuf/any' import { MsgSubmitProposal as MsgSubmitProposal_pb, Exec as Exec_pb, execFromJSON, execToJSON, -} from '@initia/initia.proto/cosmos/group/v1/tx'; +} from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgSubmitGroupProposal extends JSONSerializable< MsgSubmitGroupProposal.Amino, @@ -32,7 +32,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< public title: string, public summary: string ) { - super(); + super() } public static fromAmino( @@ -48,7 +48,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< title, summary, }, - } = data; + } = data return new MsgSubmitGroupProposal( group_policy_address, @@ -58,7 +58,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< execFromJSON(exec), title, summary - ); + ) } public toAmino(): MsgSubmitGroupProposal.Amino { @@ -70,7 +70,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< exec, title, summary, - } = this; + } = this return { type: 'cosmos-sdk/group/MsgSubmitProposal', @@ -78,12 +78,12 @@ export class MsgSubmitGroupProposal extends JSONSerializable< group_policy_address, proposers, metadata, - messages: messages.map(msg => msg.toAmino()), + messages: messages.map((msg) => msg.toAmino()), exec: execToJSON(exec), title, summary, }, - }; + } } public static fromData( @@ -97,7 +97,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< exec, title, summary, - } = data; + } = data return new MsgSubmitGroupProposal( group_policy_address, @@ -107,7 +107,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< execFromJSON(exec), title, summary - ); + ) } public toData(): MsgSubmitGroupProposal.Data { @@ -119,18 +119,18 @@ export class MsgSubmitGroupProposal extends JSONSerializable< exec, title, summary, - } = this; + } = this return { '@type': '/cosmos.group.v1.MsgSubmitProposal', group_policy_address, proposers, metadata, - messages: messages.map(msg => msg.toData()), + messages: messages.map((msg) => msg.toData()), exec: execToJSON(exec), title, summary, - }; + } } public static fromProto( @@ -144,7 +144,7 @@ export class MsgSubmitGroupProposal extends JSONSerializable< data.exec, data.title, data.summary - ); + ) } public toProto(): MsgSubmitGroupProposal.Proto { @@ -156,60 +156,60 @@ export class MsgSubmitGroupProposal extends JSONSerializable< exec, title, summary, - } = this; + } = this return MsgSubmitProposal_pb.fromPartial({ groupPolicyAddress: group_policy_address, proposers, metadata, - messages: messages.map(msg => msg.packAny()), + messages: messages.map((msg) => msg.packAny()), exec, title, summary, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgSubmitProposal', value: MsgSubmitProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitGroupProposal { return MsgSubmitGroupProposal.fromProto( MsgSubmitProposal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSubmitGroupProposal { - export type Exec = Exec_pb; - export const Exec = Exec_pb; + export type Exec = Exec_pb + export const Exec = Exec_pb export interface Amino { - type: 'cosmos-sdk/group/MsgSubmitProposal'; + type: 'cosmos-sdk/group/MsgSubmitProposal' value: { - group_policy_address: AccAddress; - proposers: AccAddress[]; - metadata: string; - messages: Msg.Amino[]; - exec: string; - title: string; - summary: string; - }; + group_policy_address: AccAddress + proposers: AccAddress[] + metadata: string + messages: Msg.Amino[] + exec: string + title: string + summary: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgSubmitProposal'; - group_policy_address: AccAddress; - proposers: AccAddress[]; - metadata: string; - messages: Msg.Data[]; - exec: string; - title: string; - summary: string; + '@type': '/cosmos.group.v1.MsgSubmitProposal' + group_policy_address: AccAddress + proposers: AccAddress[] + metadata: string + messages: Msg.Data[] + exec: string + title: string + summary: string } - export type Proto = MsgSubmitProposal_pb; + export type Proto = MsgSubmitProposal_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupAdmin.ts b/src/core/group/msgs/MsgUpdateGroupAdmin.ts index f144df1..6fbfe5b 100644 --- a/src/core/group/msgs/MsgUpdateGroupAdmin.ts +++ b/src/core/group/msgs/MsgUpdateGroupAdmin.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateGroupAdmin as MsgUpdateGroupAdmin_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateGroupAdmin as MsgUpdateGroupAdmin_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgUpdateGroupAdmin extends JSONSerializable< MsgUpdateGroupAdmin.Amino, @@ -19,7 +19,7 @@ export class MsgUpdateGroupAdmin extends JSONSerializable< public group_id: number, public new_admin: AccAddress ) { - super(); + super() } public static fromAmino( @@ -27,12 +27,12 @@ export class MsgUpdateGroupAdmin extends JSONSerializable< ): MsgUpdateGroupAdmin { const { value: { admin, group_id, new_admin }, - } = data; - return new MsgUpdateGroupAdmin(admin, Number.parseInt(group_id), new_admin); + } = data + return new MsgUpdateGroupAdmin(admin, Number.parseInt(group_id), new_admin) } public toAmino(): MsgUpdateGroupAdmin.Amino { - const { admin, group_id, new_admin } = this; + const { admin, group_id, new_admin } = this return { type: 'cosmos-sdk/MsgUpdateGroupAdmin', value: { @@ -40,22 +40,22 @@ export class MsgUpdateGroupAdmin extends JSONSerializable< group_id: group_id.toString(), new_admin, }, - }; + } } public static fromData(data: MsgUpdateGroupAdmin.Data): MsgUpdateGroupAdmin { - const { admin, group_id, new_admin } = data; - return new MsgUpdateGroupAdmin(admin, Number.parseInt(group_id), new_admin); + const { admin, group_id, new_admin } = data + return new MsgUpdateGroupAdmin(admin, Number.parseInt(group_id), new_admin) } public toData(): MsgUpdateGroupAdmin.Data { - const { admin, group_id, new_admin } = this; + const { admin, group_id, new_admin } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupAdmin', admin, group_id: group_id.toString(), new_admin, - }; + } } public static fromProto( @@ -65,48 +65,48 @@ export class MsgUpdateGroupAdmin extends JSONSerializable< data.admin, data.groupId.toNumber(), data.newAdmin - ); + ) } public toProto(): MsgUpdateGroupAdmin.Proto { - const { admin, group_id, new_admin } = this; + const { admin, group_id, new_admin } = this return MsgUpdateGroupAdmin_pb.fromPartial({ admin, groupId: Long.fromNumber(group_id), newAdmin: new_admin, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgUpdateGroupAdmin', value: MsgUpdateGroupAdmin_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupAdmin { return MsgUpdateGroupAdmin.fromProto( MsgUpdateGroupAdmin_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupAdmin { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupAdmin'; + type: 'cosmos-sdk/MsgUpdateGroupAdmin' value: { - admin: AccAddress; - group_id: string; - new_admin: AccAddress; - }; + admin: AccAddress + group_id: string + new_admin: AccAddress + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupAdmin'; - admin: AccAddress; - group_id: string; - new_admin: AccAddress; + '@type': '/cosmos.group.v1.MsgUpdateGroupAdmin' + admin: AccAddress + group_id: string + new_admin: AccAddress } - export type Proto = MsgUpdateGroupAdmin_pb; + export type Proto = MsgUpdateGroupAdmin_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupDecisionPolicy.ts b/src/core/group/msgs/MsgUpdateGroupDecisionPolicy.ts index a79b0a0..f8ea35e 100644 --- a/src/core/group/msgs/MsgUpdateGroupDecisionPolicy.ts +++ b/src/core/group/msgs/MsgUpdateGroupDecisionPolicy.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DecisionPolicy } from '../policies'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateGroupPolicyDecisionPolicy as MsgUpdateGroupPolicyDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DecisionPolicy } from '../policies' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateGroupPolicyDecisionPolicy as MsgUpdateGroupPolicyDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< MsgUpdateGroupDecisionPolicy.Amino, @@ -19,7 +19,7 @@ export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< public group_policy_address: AccAddress, public decision_policy: DecisionPolicy ) { - super(); + super() } public static fromAmino( @@ -27,16 +27,16 @@ export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< ): MsgUpdateGroupDecisionPolicy { const { value: { admin, group_policy_address, decision_policy }, - } = data; + } = data return new MsgUpdateGroupDecisionPolicy( admin, group_policy_address, DecisionPolicy.fromAmino(decision_policy) - ); + ) } public toAmino(): MsgUpdateGroupDecisionPolicy.Amino { - const { admin, group_policy_address, decision_policy } = this; + const { admin, group_policy_address, decision_policy } = this return { type: 'cosmos-sdk/MsgUpdateGroupDecisionPolicy', value: { @@ -44,28 +44,28 @@ export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< group_policy_address, decision_policy: decision_policy.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateGroupDecisionPolicy.Data ): MsgUpdateGroupDecisionPolicy { - const { admin, group_policy_address, decision_policy } = data; + const { admin, group_policy_address, decision_policy } = data return new MsgUpdateGroupDecisionPolicy( admin, group_policy_address, DecisionPolicy.fromData(decision_policy) - ); + ) } public toData(): MsgUpdateGroupDecisionPolicy.Data { - const { admin, group_policy_address, decision_policy } = this; + const { admin, group_policy_address, decision_policy } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy', admin, group_policy_address, decision_policy: decision_policy.toData(), - }; + } } public static fromProto( @@ -75,16 +75,16 @@ export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< data.admin, data.groupPolicyAddress, DecisionPolicy.fromProto(data.decisionPolicy as DecisionPolicy.Proto) - ); + ) } public toProto(): MsgUpdateGroupDecisionPolicy.Proto { - const { admin, group_policy_address, decision_policy } = this; + const { admin, group_policy_address, decision_policy } = this return MsgUpdateGroupPolicyDecisionPolicy_pb.fromPartial({ admin, groupPolicyAddress: group_policy_address, decisionPolicy: decision_policy.packAny(), - }); + }) } public packAny(): Any { @@ -93,32 +93,32 @@ export class MsgUpdateGroupDecisionPolicy extends JSONSerializable< value: MsgUpdateGroupPolicyDecisionPolicy_pb.encode( this.toProto() ).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupDecisionPolicy { return MsgUpdateGroupDecisionPolicy.fromProto( MsgUpdateGroupPolicyDecisionPolicy_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupDecisionPolicy { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupDecisionPolicy'; + type: 'cosmos-sdk/MsgUpdateGroupDecisionPolicy' value: { - admin: AccAddress; - group_policy_address: AccAddress; - decision_policy: DecisionPolicy.Amino; - }; + admin: AccAddress + group_policy_address: AccAddress + decision_policy: DecisionPolicy.Amino + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy'; - admin: AccAddress; - group_policy_address: AccAddress; - decision_policy: DecisionPolicy.Data; + '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy' + admin: AccAddress + group_policy_address: AccAddress + decision_policy: DecisionPolicy.Data } - export type Proto = MsgUpdateGroupPolicyDecisionPolicy_pb; + export type Proto = MsgUpdateGroupPolicyDecisionPolicy_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupMembers.ts b/src/core/group/msgs/MsgUpdateGroupMembers.ts index ff42401..99b4fc7 100644 --- a/src/core/group/msgs/MsgUpdateGroupMembers.ts +++ b/src/core/group/msgs/MsgUpdateGroupMembers.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MemberRequest } from '../GroupMember'; -import { MsgUpdateGroupMembers as MsgUpdateGroupMembers_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MemberRequest } from '../GroupMember' +import { MsgUpdateGroupMembers as MsgUpdateGroupMembers_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgUpdateGroupMembers extends JSONSerializable< MsgUpdateGroupMembers.Amino, @@ -20,7 +20,7 @@ export class MsgUpdateGroupMembers extends JSONSerializable< public group_id: number, public member_updates: MemberRequest[] ) { - super(); + super() } public static fromAmino( @@ -28,45 +28,45 @@ export class MsgUpdateGroupMembers extends JSONSerializable< ): MsgUpdateGroupMembers { const { value: { admin, group_id, member_updates }, - } = data; + } = data return new MsgUpdateGroupMembers( admin, Number.parseInt(group_id), member_updates.map(MemberRequest.fromAmino) - ); + ) } public toAmino(): MsgUpdateGroupMembers.Amino { - const { admin, group_id, member_updates } = this; + const { admin, group_id, member_updates } = this return { type: 'cosmos-sdk/MsgUpdateGroupMembers', value: { admin, group_id: group_id.toString(), - member_updates: member_updates.map(d => d.toAmino()), + member_updates: member_updates.map((d) => d.toAmino()), }, - }; + } } public static fromData( data: MsgUpdateGroupMembers.Data ): MsgUpdateGroupMembers { - const { admin, group_id, member_updates } = data; + const { admin, group_id, member_updates } = data return new MsgUpdateGroupMembers( admin, Number.parseInt(group_id), member_updates.map(MemberRequest.fromData) - ); + ) } public toData(): MsgUpdateGroupMembers.Data { - const { admin, group_id, member_updates } = this; + const { admin, group_id, member_updates } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupMembers', admin, group_id: group_id.toString(), - member_updates: member_updates.map(d => d.toData()), - }; + member_updates: member_updates.map((d) => d.toData()), + } } public static fromProto( @@ -76,48 +76,48 @@ export class MsgUpdateGroupMembers extends JSONSerializable< data.admin, data.groupId.toNumber(), data.memberUpdates.map(MemberRequest.fromProto) - ); + ) } public toProto(): MsgUpdateGroupMembers.Proto { - const { admin, group_id, member_updates } = this; + const { admin, group_id, member_updates } = this return MsgUpdateGroupMembers_pb.fromPartial({ admin, groupId: Long.fromNumber(group_id), - memberUpdates: member_updates.map(d => d.toProto()), - }); + memberUpdates: member_updates.map((d) => d.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgUpdateGroupMembers', value: MsgUpdateGroupMembers_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupMembers { return MsgUpdateGroupMembers.fromProto( MsgUpdateGroupMembers_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupMembers { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupMembers'; + type: 'cosmos-sdk/MsgUpdateGroupMembers' value: { - admin: AccAddress; - group_id: string; - member_updates: MemberRequest.Amino[]; - }; + admin: AccAddress + group_id: string + member_updates: MemberRequest.Amino[] + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupMembers'; - admin: AccAddress; - group_id: string; - member_updates: MemberRequest.Data[]; + '@type': '/cosmos.group.v1.MsgUpdateGroupMembers' + admin: AccAddress + group_id: string + member_updates: MemberRequest.Data[] } - export type Proto = MsgUpdateGroupMembers_pb; + export type Proto = MsgUpdateGroupMembers_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupMetadata.ts b/src/core/group/msgs/MsgUpdateGroupMetadata.ts index 69d08d9..e099e21 100644 --- a/src/core/group/msgs/MsgUpdateGroupMetadata.ts +++ b/src/core/group/msgs/MsgUpdateGroupMetadata.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateGroupMetadata as MsgUpdateGroupMetadata_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateGroupMetadata as MsgUpdateGroupMetadata_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgUpdateGroupMetadata extends JSONSerializable< MsgUpdateGroupMetadata.Amino, @@ -19,7 +19,7 @@ export class MsgUpdateGroupMetadata extends JSONSerializable< public group_id: number, public metadata: string ) { - super(); + super() } public static fromAmino( @@ -27,16 +27,16 @@ export class MsgUpdateGroupMetadata extends JSONSerializable< ): MsgUpdateGroupMetadata { const { value: { admin, group_id, metadata }, - } = data; + } = data return new MsgUpdateGroupMetadata( admin, Number.parseInt(group_id), metadata - ); + ) } public toAmino(): MsgUpdateGroupMetadata.Amino { - const { admin, group_id, metadata } = this; + const { admin, group_id, metadata } = this return { type: 'cosmos-sdk/MsgUpdateGroupMetadata', value: { @@ -44,28 +44,28 @@ export class MsgUpdateGroupMetadata extends JSONSerializable< group_id: group_id.toString(), metadata, }, - }; + } } public static fromData( data: MsgUpdateGroupMetadata.Data ): MsgUpdateGroupMetadata { - const { admin, group_id, metadata } = data; + const { admin, group_id, metadata } = data return new MsgUpdateGroupMetadata( admin, Number.parseInt(group_id), metadata - ); + ) } public toData(): MsgUpdateGroupMetadata.Data { - const { admin, group_id, metadata } = this; + const { admin, group_id, metadata } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupMetadata', admin, group_id: group_id.toString(), metadata, - }; + } } public static fromProto( @@ -75,48 +75,48 @@ export class MsgUpdateGroupMetadata extends JSONSerializable< data.admin, data.groupId.toNumber(), data.metadata - ); + ) } public toProto(): MsgUpdateGroupMetadata.Proto { - const { admin, group_id, metadata } = this; + const { admin, group_id, metadata } = this return MsgUpdateGroupMetadata_pb.fromPartial({ admin, groupId: Long.fromNumber(group_id), metadata, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgUpdateGroupMetadata', value: MsgUpdateGroupMetadata_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupMetadata { return MsgUpdateGroupMetadata.fromProto( MsgUpdateGroupMetadata_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupMetadata { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupMetadata'; + type: 'cosmos-sdk/MsgUpdateGroupMetadata' value: { - admin: AccAddress; - group_id: string; - metadata: string; - }; + admin: AccAddress + group_id: string + metadata: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupMetadata'; - admin: AccAddress; - group_id: string; - metadata: string; + '@type': '/cosmos.group.v1.MsgUpdateGroupMetadata' + admin: AccAddress + group_id: string + metadata: string } - export type Proto = MsgUpdateGroupMetadata_pb; + export type Proto = MsgUpdateGroupMetadata_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupPolicyAdmin.ts b/src/core/group/msgs/MsgUpdateGroupPolicyAdmin.ts index 42257bd..cf3b0d4 100644 --- a/src/core/group/msgs/MsgUpdateGroupPolicyAdmin.ts +++ b/src/core/group/msgs/MsgUpdateGroupPolicyAdmin.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateGroupPolicyAdmin as MsgUpdateGroupPolicyAdmin_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateGroupPolicyAdmin as MsgUpdateGroupPolicyAdmin_pb } from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgUpdateGroupPolicyAdmin extends JSONSerializable< MsgUpdateGroupPolicyAdmin.Amino, @@ -18,7 +18,7 @@ export class MsgUpdateGroupPolicyAdmin extends JSONSerializable< public group_policy_address: AccAddress, public new_admin: AccAddress ) { - super(); + super() } public static fromAmino( @@ -26,16 +26,12 @@ export class MsgUpdateGroupPolicyAdmin extends JSONSerializable< ): MsgUpdateGroupPolicyAdmin { const { value: { admin, group_policy_address, new_admin }, - } = data; - return new MsgUpdateGroupPolicyAdmin( - admin, - group_policy_address, - new_admin - ); + } = data + return new MsgUpdateGroupPolicyAdmin(admin, group_policy_address, new_admin) } public toAmino(): MsgUpdateGroupPolicyAdmin.Amino { - const { admin, group_policy_address, new_admin } = this; + const { admin, group_policy_address, new_admin } = this return { type: 'cosmos-sdk/MsgUpdateGroupPolicyAdmin', value: { @@ -43,28 +39,24 @@ export class MsgUpdateGroupPolicyAdmin extends JSONSerializable< group_policy_address, new_admin, }, - }; + } } public static fromData( data: MsgUpdateGroupPolicyAdmin.Data ): MsgUpdateGroupPolicyAdmin { - const { admin, group_policy_address, new_admin } = data; - return new MsgUpdateGroupPolicyAdmin( - admin, - group_policy_address, - new_admin - ); + const { admin, group_policy_address, new_admin } = data + return new MsgUpdateGroupPolicyAdmin(admin, group_policy_address, new_admin) } public toData(): MsgUpdateGroupPolicyAdmin.Data { - const { admin, group_policy_address, new_admin } = this; + const { admin, group_policy_address, new_admin } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin', admin, group_policy_address, new_admin, - }; + } } public static fromProto( @@ -74,48 +66,48 @@ export class MsgUpdateGroupPolicyAdmin extends JSONSerializable< data.admin, data.groupPolicyAddress, data.newAdmin - ); + ) } public toProto(): MsgUpdateGroupPolicyAdmin.Proto { - const { admin, group_policy_address, new_admin } = this; + const { admin, group_policy_address, new_admin } = this return MsgUpdateGroupPolicyAdmin_pb.fromPartial({ admin, groupPolicyAddress: group_policy_address, newAdmin: new_admin, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin', value: MsgUpdateGroupPolicyAdmin_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupPolicyAdmin { return MsgUpdateGroupPolicyAdmin.fromProto( MsgUpdateGroupPolicyAdmin_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupPolicyAdmin { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupPolicyAdmin'; + type: 'cosmos-sdk/MsgUpdateGroupPolicyAdmin' value: { - admin: AccAddress; - group_policy_address: AccAddress; - new_admin: AccAddress; - }; + admin: AccAddress + group_policy_address: AccAddress + new_admin: AccAddress + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin'; - admin: AccAddress; - group_policy_address: AccAddress; - new_admin: AccAddress; + '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyAdmin' + admin: AccAddress + group_policy_address: AccAddress + new_admin: AccAddress } - export type Proto = MsgUpdateGroupPolicyAdmin_pb; + export type Proto = MsgUpdateGroupPolicyAdmin_pb } diff --git a/src/core/group/msgs/MsgUpdateGroupPolicyMetadata.ts b/src/core/group/msgs/MsgUpdateGroupPolicyMetadata.ts index ca04b85..e3bca7b 100644 --- a/src/core/group/msgs/MsgUpdateGroupPolicyMetadata.ts +++ b/src/core/group/msgs/MsgUpdateGroupPolicyMetadata.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateGroupPolicyMetadata as MsgUpdateGroupPolicyMetadata_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateGroupPolicyMetadata as MsgUpdateGroupPolicyMetadata_pb } from '@initia/initia.proto/cosmos/group/v1/tx' export class MsgUpdateGroupPolicyMetadata extends JSONSerializable< MsgUpdateGroupPolicyMetadata.Amino, @@ -18,7 +18,7 @@ export class MsgUpdateGroupPolicyMetadata extends JSONSerializable< public group_policy_address: AccAddress, public metadata: string ) { - super(); + super() } public static fromAmino( @@ -26,16 +26,16 @@ export class MsgUpdateGroupPolicyMetadata extends JSONSerializable< ): MsgUpdateGroupPolicyMetadata { const { value: { admin, group_policy_address, metadata }, - } = data; + } = data return new MsgUpdateGroupPolicyMetadata( admin, group_policy_address, metadata - ); + ) } public toAmino(): MsgUpdateGroupPolicyMetadata.Amino { - const { admin, group_policy_address, metadata } = this; + const { admin, group_policy_address, metadata } = this return { type: 'cosmos-sdk/MsgUpdateGroupPolicyMetadata', value: { @@ -43,28 +43,28 @@ export class MsgUpdateGroupPolicyMetadata extends JSONSerializable< group_policy_address, metadata, }, - }; + } } public static fromData( data: MsgUpdateGroupPolicyMetadata.Data ): MsgUpdateGroupPolicyMetadata { - const { admin, group_policy_address, metadata } = data; + const { admin, group_policy_address, metadata } = data return new MsgUpdateGroupPolicyMetadata( admin, group_policy_address, metadata - ); + ) } public toData(): MsgUpdateGroupPolicyMetadata.Data { - const { admin, group_policy_address, metadata } = this; + const { admin, group_policy_address, metadata } = this return { '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata', admin, group_policy_address, metadata, - }; + } } public static fromProto( @@ -74,48 +74,48 @@ export class MsgUpdateGroupPolicyMetadata extends JSONSerializable< data.admin, data.groupPolicyAddress, data.metadata - ); + ) } public toProto(): MsgUpdateGroupPolicyMetadata.Proto { - const { admin, group_policy_address, metadata } = this; + const { admin, group_policy_address, metadata } = this return MsgUpdateGroupPolicyMetadata_pb.fromPartial({ admin, groupPolicyAddress: group_policy_address, metadata, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata', value: MsgUpdateGroupPolicyMetadata_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateGroupPolicyMetadata { return MsgUpdateGroupPolicyMetadata.fromProto( MsgUpdateGroupPolicyMetadata_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateGroupPolicyMetadata { export interface Amino { - type: 'cosmos-sdk/MsgUpdateGroupPolicyMetadata'; + type: 'cosmos-sdk/MsgUpdateGroupPolicyMetadata' value: { - admin: AccAddress; - group_policy_address: AccAddress; - metadata: string; - }; + admin: AccAddress + group_policy_address: AccAddress + metadata: string + } } export interface Data { - '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata'; - admin: AccAddress; - group_policy_address: AccAddress; - metadata: string; + '@type': '/cosmos.group.v1.MsgUpdateGroupPolicyMetadata' + admin: AccAddress + group_policy_address: AccAddress + metadata: string } - export type Proto = MsgUpdateGroupPolicyMetadata_pb; + export type Proto = MsgUpdateGroupPolicyMetadata_pb } diff --git a/src/core/group/msgs/MsgWithdrawProposal.ts b/src/core/group/msgs/MsgWithdrawProposal.ts index 0873b45..cd1923f 100644 --- a/src/core/group/msgs/MsgWithdrawProposal.ts +++ b/src/core/group/msgs/MsgWithdrawProposal.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgWithdrawProposal as MsgWithdrawProposal_pb } from '@initia/initia.proto/cosmos/group/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgWithdrawProposal as MsgWithdrawProposal_pb } from '@initia/initia.proto/cosmos/group/v1/tx' +import Long from 'long' export class MsgWithdrawProposal extends JSONSerializable< MsgWithdrawProposal.Amino, @@ -13,8 +13,11 @@ export class MsgWithdrawProposal extends JSONSerializable< * @param proposal_id the unique ID of the proposal * @param address the admin of the group policy or one of the proposer of the proposal */ - constructor(public proposal_id: number, public address: AccAddress) { - super(); + constructor( + public proposal_id: number, + public address: AccAddress + ) { + super() } public static fromAmino( @@ -22,77 +25,77 @@ export class MsgWithdrawProposal extends JSONSerializable< ): MsgWithdrawProposal { const { value: { proposal_id, address }, - } = data; - return new MsgWithdrawProposal(Number.parseInt(proposal_id), address); + } = data + return new MsgWithdrawProposal(Number.parseInt(proposal_id), address) } public toAmino(): MsgWithdrawProposal.Amino { - const { proposal_id, address } = this; + const { proposal_id, address } = this return { type: 'cosmos-sdk/group/MsgWithdrawProposal', value: { proposal_id: proposal_id.toString(), address, }, - }; + } } public static fromData(data: MsgWithdrawProposal.Data): MsgWithdrawProposal { - const { proposal_id, address } = data; - return new MsgWithdrawProposal(Number.parseInt(proposal_id), address); + const { proposal_id, address } = data + return new MsgWithdrawProposal(Number.parseInt(proposal_id), address) } public toData(): MsgWithdrawProposal.Data { - const { proposal_id, address } = this; + const { proposal_id, address } = this return { '@type': '/cosmos.group.v1.MsgWithdrawProposal', proposal_id: proposal_id.toString(), address, - }; + } } public static fromProto( data: MsgWithdrawProposal.Proto ): MsgWithdrawProposal { - return new MsgWithdrawProposal(data.proposalId.toNumber(), data.address); + return new MsgWithdrawProposal(data.proposalId.toNumber(), data.address) } public toProto(): MsgWithdrawProposal.Proto { - const { proposal_id, address } = this; + const { proposal_id, address } = this return MsgWithdrawProposal_pb.fromPartial({ proposalId: Long.fromNumber(proposal_id), address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.MsgWithdrawProposal', value: MsgWithdrawProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgWithdrawProposal { return MsgWithdrawProposal.fromProto( MsgWithdrawProposal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgWithdrawProposal { export interface Amino { - type: 'cosmos-sdk/group/MsgWithdrawProposal'; + type: 'cosmos-sdk/group/MsgWithdrawProposal' value: { - proposal_id: string; - address: AccAddress; - }; + proposal_id: string + address: AccAddress + } } export interface Data { - '@type': '/cosmos.group.v1.MsgWithdrawProposal'; - proposal_id: string; - address: AccAddress; + '@type': '/cosmos.group.v1.MsgWithdrawProposal' + proposal_id: string + address: AccAddress } - export type Proto = MsgWithdrawProposal_pb; + export type Proto = MsgWithdrawProposal_pb } diff --git a/src/core/group/msgs/index.ts b/src/core/group/msgs/index.ts index 864f367..fa4e840 100644 --- a/src/core/group/msgs/index.ts +++ b/src/core/group/msgs/index.ts @@ -1,30 +1,30 @@ -import { MsgCreateGroup } from './MsgCreateGroup'; -import { MsgCreateGroupPolicy } from './MsgCreateGroupPolicy'; -import { MsgCreateGroupWithPolicy } from './MsgCreateGroupWithPolicy'; -import { MsgGroupExec } from './MsgGroupExec'; -import { MsgGroupVote } from './MsgGroupVote'; -import { MsgLeaveGroup } from './MsgLeaveGroup'; -import { MsgSubmitGroupProposal } from './MsgSubmitGroupProposal'; -import { MsgUpdateGroupAdmin } from './MsgUpdateGroupAdmin'; -import { MsgUpdateGroupDecisionPolicy } from './MsgUpdateGroupDecisionPolicy'; -import { MsgUpdateGroupMembers } from './MsgUpdateGroupMembers'; -import { MsgUpdateGroupMetadata } from './MsgUpdateGroupMetadata'; -import { MsgUpdateGroupPolicyAdmin } from './MsgUpdateGroupPolicyAdmin'; -import { MsgUpdateGroupPolicyMetadata } from './MsgUpdateGroupPolicyMetadata'; +import { MsgCreateGroup } from './MsgCreateGroup' +import { MsgCreateGroupPolicy } from './MsgCreateGroupPolicy' +import { MsgCreateGroupWithPolicy } from './MsgCreateGroupWithPolicy' +import { MsgGroupExec } from './MsgGroupExec' +import { MsgGroupVote } from './MsgGroupVote' +import { MsgLeaveGroup } from './MsgLeaveGroup' +import { MsgSubmitGroupProposal } from './MsgSubmitGroupProposal' +import { MsgUpdateGroupAdmin } from './MsgUpdateGroupAdmin' +import { MsgUpdateGroupDecisionPolicy } from './MsgUpdateGroupDecisionPolicy' +import { MsgUpdateGroupMembers } from './MsgUpdateGroupMembers' +import { MsgUpdateGroupMetadata } from './MsgUpdateGroupMetadata' +import { MsgUpdateGroupPolicyAdmin } from './MsgUpdateGroupPolicyAdmin' +import { MsgUpdateGroupPolicyMetadata } from './MsgUpdateGroupPolicyMetadata' -export * from './MsgCreateGroup'; -export * from './MsgCreateGroupPolicy'; -export * from './MsgCreateGroupWithPolicy'; -export * from './MsgGroupExec'; -export * from './MsgGroupVote'; -export * from './MsgLeaveGroup'; -export * from './MsgSubmitGroupProposal'; -export * from './MsgUpdateGroupAdmin'; -export * from './MsgUpdateGroupDecisionPolicy'; -export * from './MsgUpdateGroupMembers'; -export * from './MsgUpdateGroupMetadata'; -export * from './MsgUpdateGroupPolicyAdmin'; -export * from './MsgUpdateGroupPolicyMetadata'; +export * from './MsgCreateGroup' +export * from './MsgCreateGroupPolicy' +export * from './MsgCreateGroupWithPolicy' +export * from './MsgGroupExec' +export * from './MsgGroupVote' +export * from './MsgLeaveGroup' +export * from './MsgSubmitGroupProposal' +export * from './MsgUpdateGroupAdmin' +export * from './MsgUpdateGroupDecisionPolicy' +export * from './MsgUpdateGroupMembers' +export * from './MsgUpdateGroupMetadata' +export * from './MsgUpdateGroupPolicyAdmin' +export * from './MsgUpdateGroupPolicyMetadata' export type GroupMsg = | MsgCreateGroup @@ -39,7 +39,7 @@ export type GroupMsg = | MsgUpdateGroupMembers | MsgUpdateGroupMetadata | MsgUpdateGroupPolicyAdmin - | MsgUpdateGroupPolicyMetadata; + | MsgUpdateGroupPolicyMetadata export namespace GroupMsg { export type Amino = @@ -55,7 +55,7 @@ export namespace GroupMsg { | MsgUpdateGroupMembers.Amino | MsgUpdateGroupMetadata.Amino | MsgUpdateGroupPolicyAdmin.Amino - | MsgUpdateGroupPolicyMetadata.Amino; + | MsgUpdateGroupPolicyMetadata.Amino export type Data = | MsgCreateGroup.Data @@ -70,7 +70,7 @@ export namespace GroupMsg { | MsgUpdateGroupMembers.Data | MsgUpdateGroupMetadata.Data | MsgUpdateGroupPolicyAdmin.Data - | MsgUpdateGroupPolicyMetadata.Data; + | MsgUpdateGroupPolicyMetadata.Data export type Proto = | MsgCreateGroup.Proto @@ -85,5 +85,5 @@ export namespace GroupMsg { | MsgUpdateGroupMembers.Proto | MsgUpdateGroupMetadata.Proto | MsgUpdateGroupPolicyAdmin.Proto - | MsgUpdateGroupPolicyMetadata.Proto; + | MsgUpdateGroupPolicyMetadata.Proto } diff --git a/src/core/group/policies/DecisionPolicyWindows.ts b/src/core/group/policies/DecisionPolicyWindows.ts index f1e034e..b9f6b6c 100644 --- a/src/core/group/policies/DecisionPolicyWindows.ts +++ b/src/core/group/policies/DecisionPolicyWindows.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { Duration } from '../../Duration'; -import { DecisionPolicyWindows as DecisionPolicyWindows_pb } from '@initia/initia.proto/cosmos/group/v1/types'; +import { JSONSerializable } from '../../../util/json' +import { Duration } from '../../Duration' +import { DecisionPolicyWindows as DecisionPolicyWindows_pb } from '@initia/initia.proto/cosmos/group/v1/types' export class DecisionPolicyWindows extends JSONSerializable< DecisionPolicyWindows.Amino, @@ -15,43 +15,43 @@ export class DecisionPolicyWindows extends JSONSerializable< public voting_period: Duration, public min_execution_period: Duration ) { - super(); + super() } public static fromAmino( data: DecisionPolicyWindows.Amino ): DecisionPolicyWindows { - const { voting_period, min_execution_period } = data; + const { voting_period, min_execution_period } = data return new DecisionPolicyWindows( Duration.fromAmino(voting_period), Duration.fromAmino(min_execution_period) - ); + ) } public toAmino(): DecisionPolicyWindows.Amino { - const { voting_period, min_execution_period } = this; + const { voting_period, min_execution_period } = this return { voting_period: voting_period.toAmino(), min_execution_period: min_execution_period.toAmino(), - }; + } } public static fromData( data: DecisionPolicyWindows.Data ): DecisionPolicyWindows { - const { voting_period, min_execution_period } = data; + const { voting_period, min_execution_period } = data return new DecisionPolicyWindows( Duration.fromData(voting_period), Duration.fromData(min_execution_period) - ); + ) } public toData(): DecisionPolicyWindows.Data { - const { voting_period, min_execution_period } = this; + const { voting_period, min_execution_period } = this return { voting_period: voting_period.toData(), min_execution_period: min_execution_period.toData(), - }; + } } public static fromProto( @@ -60,28 +60,28 @@ export class DecisionPolicyWindows extends JSONSerializable< return new DecisionPolicyWindows( Duration.fromProto(data.votingPeriod as Duration.Proto), Duration.fromProto(data.minExecutionPeriod as Duration.Proto) - ); + ) } public toProto(): DecisionPolicyWindows.Proto { - const { voting_period, min_execution_period } = this; + const { voting_period, min_execution_period } = this return DecisionPolicyWindows_pb.fromPartial({ votingPeriod: voting_period.toProto(), minExecutionPeriod: min_execution_period.toProto(), - }); + }) } } export namespace DecisionPolicyWindows { export interface Amino { - voting_period: Duration.Amino; - min_execution_period: Duration.Amino; + voting_period: Duration.Amino + min_execution_period: Duration.Amino } export interface Data { - voting_period: Duration.Data; - min_execution_period: Duration.Data; + voting_period: Duration.Data + min_execution_period: Duration.Data } - export type Proto = DecisionPolicyWindows_pb; + export type Proto = DecisionPolicyWindows_pb } diff --git a/src/core/group/policies/PercentageDecisionPolicy.ts b/src/core/group/policies/PercentageDecisionPolicy.ts index a3d5786..aa587fa 100644 --- a/src/core/group/policies/PercentageDecisionPolicy.ts +++ b/src/core/group/policies/PercentageDecisionPolicy.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { DecisionPolicyWindows } from './DecisionPolicyWindows'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { PercentageDecisionPolicy as PercentageDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/types'; +import { JSONSerializable } from '../../../util/json' +import { DecisionPolicyWindows } from './DecisionPolicyWindows' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { PercentageDecisionPolicy as PercentageDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/types' export class PercentageDecisionPolicy extends JSONSerializable< PercentageDecisionPolicy.Amino, @@ -16,7 +16,7 @@ export class PercentageDecisionPolicy extends JSONSerializable< public percentage: string, public windows: DecisionPolicyWindows ) { - super(); + super() } public static fromAmino( @@ -24,41 +24,41 @@ export class PercentageDecisionPolicy extends JSONSerializable< ): PercentageDecisionPolicy { const { value: { percentage, windows }, - } = data; + } = data return new PercentageDecisionPolicy( percentage, DecisionPolicyWindows.fromAmino(windows) - ); + ) } public toAmino(): PercentageDecisionPolicy.Amino { - const { percentage, windows } = this; + const { percentage, windows } = this return { type: 'cosmos-sdk/PercentageDecisionPolicy', value: { percentage, windows: windows.toAmino(), }, - }; + } } public static fromData( data: PercentageDecisionPolicy.Data ): PercentageDecisionPolicy { - const { percentage, windows } = data; + const { percentage, windows } = data return new PercentageDecisionPolicy( percentage, DecisionPolicyWindows.fromData(windows) - ); + ) } public toData(): PercentageDecisionPolicy.Data { - const { percentage, windows } = this; + const { percentage, windows } = this return { '@type': '/cosmos.group.v1.PercentageDecisionPolicy', percentage, windows: windows.toData(), - }; + } } public static fromProto( @@ -69,45 +69,45 @@ export class PercentageDecisionPolicy extends JSONSerializable< DecisionPolicyWindows.fromProto( data.windows as DecisionPolicyWindows.Proto ) - ); + ) } public toProto(): PercentageDecisionPolicy.Proto { - const { percentage, windows } = this; + const { percentage, windows } = this return PercentageDecisionPolicy_pb.fromPartial({ percentage, windows: windows.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.PercentageDecisionPolicy', value: PercentageDecisionPolicy_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): PercentageDecisionPolicy { return PercentageDecisionPolicy.fromProto( PercentageDecisionPolicy_pb.decode(msgAny.value) - ); + ) } } export namespace PercentageDecisionPolicy { export interface Amino { - type: 'cosmos-sdk/PercentageDecisionPolicy'; + type: 'cosmos-sdk/PercentageDecisionPolicy' value: { - percentage: string; - windows: DecisionPolicyWindows.Amino; - }; + percentage: string + windows: DecisionPolicyWindows.Amino + } } export interface Data { - '@type': '/cosmos.group.v1.PercentageDecisionPolicy'; - percentage: string; - windows: DecisionPolicyWindows.Data; + '@type': '/cosmos.group.v1.PercentageDecisionPolicy' + percentage: string + windows: DecisionPolicyWindows.Data } - export type Proto = PercentageDecisionPolicy_pb; + export type Proto = PercentageDecisionPolicy_pb } diff --git a/src/core/group/policies/ThresholdDecisionPolicy.ts b/src/core/group/policies/ThresholdDecisionPolicy.ts index 33da422..4c78931 100644 --- a/src/core/group/policies/ThresholdDecisionPolicy.ts +++ b/src/core/group/policies/ThresholdDecisionPolicy.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { DecisionPolicyWindows } from './DecisionPolicyWindows'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { ThresholdDecisionPolicy as ThresholdDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/types'; +import { JSONSerializable } from '../../../util/json' +import { DecisionPolicyWindows } from './DecisionPolicyWindows' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { ThresholdDecisionPolicy as ThresholdDecisionPolicy_pb } from '@initia/initia.proto/cosmos/group/v1/types' export class ThresholdDecisionPolicy extends JSONSerializable< ThresholdDecisionPolicy.Amino, @@ -12,8 +12,11 @@ export class ThresholdDecisionPolicy extends JSONSerializable< * @param threshold the minimum weighted sum of `YES` votes that must be met for a proposal to succeed * @param windows the different windows for voting and execution */ - constructor(public threshold: string, public windows: DecisionPolicyWindows) { - super(); + constructor( + public threshold: string, + public windows: DecisionPolicyWindows + ) { + super() } public static fromAmino( @@ -21,41 +24,41 @@ export class ThresholdDecisionPolicy extends JSONSerializable< ): ThresholdDecisionPolicy { const { value: { threshold, windows }, - } = data; + } = data return new ThresholdDecisionPolicy( threshold, DecisionPolicyWindows.fromAmino(windows) - ); + ) } public toAmino(): ThresholdDecisionPolicy.Amino { - const { threshold, windows } = this; + const { threshold, windows } = this return { type: 'cosmos-sdk/ThresholdDecisionPolicy', value: { threshold, windows: windows.toAmino(), }, - }; + } } public static fromData( data: ThresholdDecisionPolicy.Data ): ThresholdDecisionPolicy { - const { threshold, windows } = data; + const { threshold, windows } = data return new ThresholdDecisionPolicy( threshold, DecisionPolicyWindows.fromData(windows) - ); + ) } public toData(): ThresholdDecisionPolicy.Data { - const { threshold, windows } = this; + const { threshold, windows } = this return { '@type': '/cosmos.group.v1.ThresholdDecisionPolicy', threshold, windows: windows.toData(), - }; + } } public static fromProto( @@ -66,45 +69,45 @@ export class ThresholdDecisionPolicy extends JSONSerializable< DecisionPolicyWindows.fromProto( data.windows as DecisionPolicyWindows.Proto ) - ); + ) } public toProto(): ThresholdDecisionPolicy.Proto { - const { threshold, windows } = this; + const { threshold, windows } = this return ThresholdDecisionPolicy_pb.fromPartial({ threshold, windows: windows.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.group.v1.ThresholdDecisionPolicy', value: ThresholdDecisionPolicy_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): ThresholdDecisionPolicy { return ThresholdDecisionPolicy.fromProto( ThresholdDecisionPolicy_pb.decode(msgAny.value) - ); + ) } } export namespace ThresholdDecisionPolicy { export interface Amino { - type: 'cosmos-sdk/ThresholdDecisionPolicy'; + type: 'cosmos-sdk/ThresholdDecisionPolicy' value: { - threshold: string; - windows: DecisionPolicyWindows.Amino; - }; + threshold: string + windows: DecisionPolicyWindows.Amino + } } export interface Data { - '@type': '/cosmos.group.v1.ThresholdDecisionPolicy'; - threshold: string; - windows: DecisionPolicyWindows.Data; + '@type': '/cosmos.group.v1.ThresholdDecisionPolicy' + threshold: string + windows: DecisionPolicyWindows.Data } - export type Proto = ThresholdDecisionPolicy_pb; + export type Proto = ThresholdDecisionPolicy_pb } diff --git a/src/core/group/policies/index.ts b/src/core/group/policies/index.ts index c0a5368..020d3a4 100644 --- a/src/core/group/policies/index.ts +++ b/src/core/group/policies/index.ts @@ -1,48 +1,48 @@ -import { ThresholdDecisionPolicy } from './ThresholdDecisionPolicy'; -import { PercentageDecisionPolicy } from './PercentageDecisionPolicy'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { ThresholdDecisionPolicy } from './ThresholdDecisionPolicy' +import { PercentageDecisionPolicy } from './PercentageDecisionPolicy' +import { Any } from '@initia/initia.proto/google/protobuf/any' -export * from './ThresholdDecisionPolicy'; -export * from './PercentageDecisionPolicy'; -export * from './DecisionPolicyWindows'; +export * from './ThresholdDecisionPolicy' +export * from './PercentageDecisionPolicy' +export * from './DecisionPolicyWindows' -export type DecisionPolicy = ThresholdDecisionPolicy | PercentageDecisionPolicy; +export type DecisionPolicy = ThresholdDecisionPolicy | PercentageDecisionPolicy export namespace DecisionPolicy { export type Amino = | ThresholdDecisionPolicy.Amino - | PercentageDecisionPolicy.Amino; + | PercentageDecisionPolicy.Amino export type Data = | ThresholdDecisionPolicy.Data - | PercentageDecisionPolicy.Data; - export type Proto = Any; + | PercentageDecisionPolicy.Data + export type Proto = Any export function fromAmino(data: DecisionPolicy.Amino): DecisionPolicy { switch (data.type) { case 'cosmos-sdk/ThresholdDecisionPolicy': - return ThresholdDecisionPolicy.fromAmino(data); + return ThresholdDecisionPolicy.fromAmino(data) case 'cosmos-sdk/PercentageDecisionPolicy': - return PercentageDecisionPolicy.fromAmino(data); + return PercentageDecisionPolicy.fromAmino(data) } } export function fromData(data: DecisionPolicy.Data): DecisionPolicy { switch (data['@type']) { case '/cosmos.group.v1.ThresholdDecisionPolicy': - return ThresholdDecisionPolicy.fromData(data); + return ThresholdDecisionPolicy.fromData(data) case '/cosmos.group.v1.PercentageDecisionPolicy': - return PercentageDecisionPolicy.fromData(data); + return PercentageDecisionPolicy.fromData(data) } } export function fromProto(proto: DecisionPolicy.Proto): DecisionPolicy { - const typeUrl = proto.typeUrl; + const typeUrl = proto.typeUrl switch (typeUrl) { case '/cosmos.group.v1.ThresholdDecisionPolicy': - return ThresholdDecisionPolicy.unpackAny(proto); + return ThresholdDecisionPolicy.unpackAny(proto) case '/cosmos.group.v1.PercentageDecisionPolicy': - return PercentageDecisionPolicy.unpackAny(proto); + return PercentageDecisionPolicy.unpackAny(proto) } - throw new Error(`DecisionPolicy type ${typeUrl} not recognized`); + throw new Error(`DecisionPolicy type ${typeUrl} not recognized`) } } diff --git a/src/core/ibc/applications/fee/IbcFee.ts b/src/core/ibc/applications/fee/IbcFee.ts index 6f8882f..37056d9 100644 --- a/src/core/ibc/applications/fee/IbcFee.ts +++ b/src/core/ibc/applications/fee/IbcFee.ts @@ -1,6 +1,6 @@ -import { Fee as Fee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee'; -import { Coins } from '../../../Coins'; -import { JSONSerializable } from '../../../../util/json'; +import { Fee as Fee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee' +import { Coins } from '../../../Coins' +import { JSONSerializable } from '../../../../util/json' /** * Fee defines the ICS29 receive, acknowledgement and timeout fees @@ -11,11 +11,11 @@ export class IbcFee extends JSONSerializable< IbcFee.Proto > { /** the packet receive fee */ - public recv_fee: Coins; + public recv_fee: Coins /** the packet acknowledgement fee */ - public ack_fee: Coins; + public ack_fee: Coins /** the packet timeout fee */ - public timeout_fee: Coins; + public timeout_fee: Coins /** * @param recv_fee the packet receive fee * @param ack_fee the packet acknowledgement fee @@ -26,48 +26,48 @@ export class IbcFee extends JSONSerializable< ack_fee: Coins.Input, timeout_fee: Coins.Input ) { - super(); - this.recv_fee = new Coins(recv_fee); - this.ack_fee = new Coins(ack_fee); - this.timeout_fee = new Coins(timeout_fee); + super() + this.recv_fee = new Coins(recv_fee) + this.ack_fee = new Coins(ack_fee) + this.timeout_fee = new Coins(timeout_fee) } public static fromAmino(data: IbcFee.Amino): IbcFee { - const { recv_fee, ack_fee, timeout_fee } = data; + const { recv_fee, ack_fee, timeout_fee } = data return new IbcFee( Coins.fromAmino(recv_fee), Coins.fromAmino(ack_fee), Coins.fromAmino(timeout_fee) - ); + ) } public toAmino(): IbcFee.Amino { - const { recv_fee, ack_fee, timeout_fee } = this; + const { recv_fee, ack_fee, timeout_fee } = this const res: IbcFee.Amino = { recv_fee: recv_fee.toAmino(), ack_fee: ack_fee.toAmino(), timeout_fee: timeout_fee.toAmino(), - }; - return res; + } + return res } public static fromData(data: IbcFee.Data): IbcFee { - const { recv_fee, ack_fee, timeout_fee } = data; + const { recv_fee, ack_fee, timeout_fee } = data return new IbcFee( Coins.fromData(recv_fee), Coins.fromData(ack_fee), Coins.fromData(timeout_fee) - ); + ) } public toData(): IbcFee.Data { - const { recv_fee, ack_fee, timeout_fee } = this; + const { recv_fee, ack_fee, timeout_fee } = this const res: IbcFee.Data = { recv_fee: recv_fee.toData(), ack_fee: ack_fee.toData(), timeout_fee: timeout_fee.toData(), - }; - return res; + } + return res } public static fromProto(proto: IbcFee.Proto): IbcFee { @@ -75,31 +75,31 @@ export class IbcFee extends JSONSerializable< Coins.fromProto(proto.recvFee), Coins.fromProto(proto.ackFee), Coins.fromProto(proto.timeoutFee) - ); + ) } public toProto(): IbcFee.Proto { - const { recv_fee, ack_fee, timeout_fee } = this; + const { recv_fee, ack_fee, timeout_fee } = this return Fee_pb.fromPartial({ recvFee: recv_fee.toProto(), ackFee: ack_fee.toProto(), timeoutFee: timeout_fee.toProto(), - }); + }) } } export namespace IbcFee { export interface Amino { - recv_fee: Coins.Amino; - ack_fee: Coins.Amino; - timeout_fee: Coins.Amino; + recv_fee: Coins.Amino + ack_fee: Coins.Amino + timeout_fee: Coins.Amino } export interface Data { - recv_fee: Coins.Data; - ack_fee: Coins.Data; - timeout_fee: Coins.Data; + recv_fee: Coins.Data + ack_fee: Coins.Data + timeout_fee: Coins.Data } - export type Proto = Fee_pb; + export type Proto = Fee_pb } diff --git a/src/core/ibc/applications/fee/IdentifiedPacketFee.ts b/src/core/ibc/applications/fee/IdentifiedPacketFee.ts index ef6751e..4dcc141 100644 --- a/src/core/ibc/applications/fee/IdentifiedPacketFee.ts +++ b/src/core/ibc/applications/fee/IdentifiedPacketFee.ts @@ -1,7 +1,7 @@ -import { IdentifiedPacketFees as IdentifiedPacketFees_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee'; -import { JSONSerializable } from '../../../../util/json'; -import { PacketFee } from './PacketFee'; -import { PacketId } from '../../core/channel/PacketId'; +import { IdentifiedPacketFees as IdentifiedPacketFees_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee' +import { JSONSerializable } from '../../../../util/json' +import { PacketFee } from './PacketFee' +import { PacketId } from '../../core/channel/PacketId' /** * IdentifiedPacketFees contains a list of type PacketFee and associated PacketId @@ -19,45 +19,45 @@ export class IdentifiedPacketFees extends JSONSerializable< public packet_id?: PacketId, public packet_fees: PacketFee[] = [] ) { - super(); + super() } public static fromAmino( data: IdentifiedPacketFees.Amino ): IdentifiedPacketFees { - const { packet_id, packet_fees } = data; + const { packet_id, packet_fees } = data return new IdentifiedPacketFees( packet_id ? PacketId.fromAmino(packet_id) : undefined, - packet_fees.map(fee => PacketFee.fromAmino(fee)) - ); + packet_fees.map((fee) => PacketFee.fromAmino(fee)) + ) } public toAmino(): IdentifiedPacketFees.Amino { - const { packet_id, packet_fees } = this; + const { packet_id, packet_fees } = this const res: IdentifiedPacketFees.Amino = { packet_id: packet_id?.toAmino(), - packet_fees: packet_fees.map(fee => fee.toAmino()), - }; - return res; + packet_fees: packet_fees.map((fee) => fee.toAmino()), + } + return res } public static fromData( data: IdentifiedPacketFees.Data ): IdentifiedPacketFees { - const { packet_id, packet_fees } = data; + const { packet_id, packet_fees } = data return new IdentifiedPacketFees( packet_id ? PacketId.fromData(packet_id) : undefined, - packet_fees.map(fee => PacketFee.fromData(fee)) - ); + packet_fees.map((fee) => PacketFee.fromData(fee)) + ) } public toData(): IdentifiedPacketFees.Data { - const { packet_id, packet_fees } = this; + const { packet_id, packet_fees } = this const res: IdentifiedPacketFees.Data = { packet_id: packet_id?.toData(), - packet_fees: packet_fees.map(fee => fee.toData()), - }; - return res; + packet_fees: packet_fees.map((fee) => fee.toData()), + } + return res } public static fromProto( @@ -65,30 +65,30 @@ export class IdentifiedPacketFees extends JSONSerializable< ): IdentifiedPacketFees { return new IdentifiedPacketFees( proto.packetId ? PacketId.fromProto(proto.packetId) : undefined, - proto.packetFees.map(fee => PacketFee.fromProto(fee)) - ); + proto.packetFees.map((fee) => PacketFee.fromProto(fee)) + ) } public toProto(): IdentifiedPacketFees.Proto { - const { packet_id, packet_fees } = this; + const { packet_id, packet_fees } = this const res: IdentifiedPacketFees.Proto = { packetId: packet_id?.toProto(), - packetFees: packet_fees.map(fee => fee.toProto()), - }; - return res; + packetFees: packet_fees.map((fee) => fee.toProto()), + } + return res } } export namespace IdentifiedPacketFees { export interface Amino { - packet_id?: PacketId.Amino; - packet_fees: PacketFee.Amino[]; + packet_id?: PacketId.Amino + packet_fees: PacketFee.Amino[] } export interface Data { - packet_id?: PacketId.Data; - packet_fees: PacketFee.Data[]; + packet_id?: PacketId.Data + packet_fees: PacketFee.Data[] } - export type Proto = IdentifiedPacketFees_pb; + export type Proto = IdentifiedPacketFees_pb } diff --git a/src/core/ibc/applications/fee/Metadata.ts b/src/core/ibc/applications/fee/Metadata.ts index 96b39fb..7c608c0 100644 --- a/src/core/ibc/applications/fee/Metadata.ts +++ b/src/core/ibc/applications/fee/Metadata.ts @@ -1,5 +1,5 @@ -import { Metadata as Metadata_pb } from '@initia/initia.proto/ibc/applications/fee/v1/metadata'; -import { JSONSerializable } from '../../../../util/json'; +import { Metadata as Metadata_pb } from '@initia/initia.proto/ibc/applications/fee/v1/metadata' +import { JSONSerializable } from '../../../../util/json' /** * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring @@ -14,61 +14,64 @@ export class Metadata extends JSONSerializable< * @param fee_version fee_version defines the ICS29 fee version * @param app_version app_version defines the underlying application version, which may or may not be a JSON encoded bytestring */ - constructor(public fee_version: string, public app_version: string) { - super(); + constructor( + public fee_version: string, + public app_version: string + ) { + super() } public static fromAmino(data: Metadata.Amino): Metadata { - const { fee_version, app_version } = data; - return new Metadata(fee_version, app_version); + const { fee_version, app_version } = data + return new Metadata(fee_version, app_version) } public toAmino(): Metadata.Amino { - const { fee_version, app_version } = this; + const { fee_version, app_version } = this const res: Metadata.Amino = { fee_version, app_version, - }; - return res; + } + return res } public static fromData(data: Metadata.Data): Metadata { - const { fee_version, app_version } = data; - return new Metadata(fee_version, app_version); + const { fee_version, app_version } = data + return new Metadata(fee_version, app_version) } public toData(): Metadata.Data { - const { fee_version, app_version } = this; + const { fee_version, app_version } = this const res: Metadata.Data = { fee_version, app_version, - }; - return res; + } + return res } public static fromProto(proto: Metadata.Proto): Metadata { - return new Metadata(proto.feeVersion, proto.appVersion); + return new Metadata(proto.feeVersion, proto.appVersion) } public toProto(): Metadata.Proto { - const { fee_version, app_version } = this; + const { fee_version, app_version } = this return Metadata_pb.fromPartial({ feeVersion: fee_version, appVersion: app_version, - }); + }) } } export namespace Metadata { export interface Amino { - fee_version: string; - app_version: string; + fee_version: string + app_version: string } export interface Data { - fee_version: string; - app_version: string; + fee_version: string + app_version: string } - export type Proto = Metadata_pb; + export type Proto = Metadata_pb } diff --git a/src/core/ibc/applications/fee/PacketFee.ts b/src/core/ibc/applications/fee/PacketFee.ts index 39382ff..beaa524 100644 --- a/src/core/ibc/applications/fee/PacketFee.ts +++ b/src/core/ibc/applications/fee/PacketFee.ts @@ -1,7 +1,7 @@ -import { PacketFee as PacketFee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee'; -import { JSONSerializable } from '../../../../util/json'; -import { IbcFee } from './IbcFee'; -import { AccAddress } from '../../../..'; +import { PacketFee as PacketFee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/fee' +import { JSONSerializable } from '../../../../util/json' +import { IbcFee } from './IbcFee' +import { AccAddress } from '../../../..' /** * PacketFee contains ICS29 relayer fees, refund address and optional list of permitted relayers @@ -21,45 +21,45 @@ export class PacketFee extends JSONSerializable< public refund_address: AccAddress, public relayers: string[] = [] ) { - super(); + super() } public static fromAmino(data: PacketFee.Amino): PacketFee { - const { fee, refund_address, relayers } = data; + const { fee, refund_address, relayers } = data return new PacketFee( fee ? IbcFee.fromAmino(fee) : undefined, refund_address, relayers - ); + ) } public toAmino(): PacketFee.Amino { - const { fee, refund_address, relayers } = this; + const { fee, refund_address, relayers } = this const res: PacketFee.Amino = { fee: fee?.toAmino(), refund_address, relayers, - }; - return res; + } + return res } public static fromData(data: PacketFee.Data): PacketFee { - const { fee, refund_address, relayers } = data; + const { fee, refund_address, relayers } = data return new PacketFee( fee ? IbcFee.fromData(fee) : undefined, refund_address, relayers - ); + ) } public toData(): PacketFee.Data { - const { fee, refund_address, relayers } = this; + const { fee, refund_address, relayers } = this const res: PacketFee.Data = { fee: fee?.toData(), refund_address, relayers, - }; - return res; + } + return res } public static fromProto(proto: PacketFee.Proto): PacketFee { @@ -67,31 +67,31 @@ export class PacketFee extends JSONSerializable< proto.fee ? IbcFee.fromProto(proto.fee) : undefined, proto.refundAddress, proto.relayers - ); + ) } public toProto(): PacketFee.Proto { - const { fee, refund_address, relayers } = this; + const { fee, refund_address, relayers } = this return PacketFee_pb.fromPartial({ fee: fee?.toProto(), refundAddress: refund_address, relayers: relayers, - }); + }) } } export namespace PacketFee { export interface Amino { - fee?: IbcFee.Amino; - refund_address: AccAddress; - relayers: string[]; + fee?: IbcFee.Amino + refund_address: AccAddress + relayers: string[] } export interface Data { - fee?: IbcFee.Data; - refund_address: AccAddress; - relayers: string[]; + fee?: IbcFee.Data + refund_address: AccAddress + relayers: string[] } - export type Proto = PacketFee_pb; + export type Proto = PacketFee_pb } diff --git a/src/core/ibc/applications/fee/index.ts b/src/core/ibc/applications/fee/index.ts index a4ac35a..8eeccd3 100644 --- a/src/core/ibc/applications/fee/index.ts +++ b/src/core/ibc/applications/fee/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './Metadata'; -export * from './IdentifiedPacketFee'; -export * from './PacketFee'; -export * from './IbcFee'; +export * from './msgs' +export * from './Metadata' +export * from './IdentifiedPacketFee' +export * from './PacketFee' +export * from './IbcFee' diff --git a/src/core/ibc/applications/fee/msgs/MsgPayPacketFee.ts b/src/core/ibc/applications/fee/msgs/MsgPayPacketFee.ts index 73a49ad..e1a1873 100644 --- a/src/core/ibc/applications/fee/msgs/MsgPayPacketFee.ts +++ b/src/core/ibc/applications/fee/msgs/MsgPayPacketFee.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgPayPacketFee as MsgPayPacketFee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx'; -import { IbcFee } from '../IbcFee'; +import { JSONSerializable } from '../../../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgPayPacketFee as MsgPayPacketFee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx' +import { IbcFee } from '../IbcFee' /** * MsgPayPacketFee defines the request type for the PayPacketFee rpc @@ -26,20 +26,20 @@ export class MsgPayPacketFee extends JSONSerializable< public signer: string, public relayers: string[] ) { - super(); + super() } public static fromAmino(_: any): MsgPayPacketFee { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgPayPacketFee.Data): MsgPayPacketFee { - const { fee, source_port_id, source_channel_id, signer, relayers } = data; + const { fee, source_port_id, source_channel_id, signer, relayers } = data return new MsgPayPacketFee( fee ? IbcFee.fromData(fee) : undefined, @@ -47,11 +47,11 @@ export class MsgPayPacketFee extends JSONSerializable< source_channel_id, signer, relayers - ); + ) } public toData(): MsgPayPacketFee.Data { - const { fee, source_port_id, source_channel_id, signer, relayers } = this; + const { fee, source_port_id, source_channel_id, signer, relayers } = this return { '@type': '/ibc.applications.fee.v1.MsgPayPacketFee', fee: fee?.toData(), @@ -59,7 +59,7 @@ export class MsgPayPacketFee extends JSONSerializable< source_channel_id, signer, relayers, - }; + } } public static fromProto(proto: MsgPayPacketFee.Proto): MsgPayPacketFee { @@ -69,41 +69,41 @@ export class MsgPayPacketFee extends JSONSerializable< proto.sourceChannelId, proto.signer, proto.relayers - ); + ) } public toProto(): MsgPayPacketFee.Proto { - const { fee, source_port_id, source_channel_id, signer, relayers } = this; + const { fee, source_port_id, source_channel_id, signer, relayers } = this return MsgPayPacketFee_pb.fromPartial({ fee: fee?.toProto(), sourcePortId: source_port_id, sourceChannelId: source_channel_id, signer, relayers, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.fee.v1.MsgPayPacketFee', value: MsgPayPacketFee_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgPayPacketFee { - return MsgPayPacketFee.fromProto(MsgPayPacketFee_pb.decode(msgAny.value)); + return MsgPayPacketFee.fromProto(MsgPayPacketFee_pb.decode(msgAny.value)) } } export namespace MsgPayPacketFee { export interface Data { - '@type': '/ibc.applications.fee.v1.MsgPayPacketFee'; - fee?: IbcFee.Data; - source_port_id: string; - source_channel_id: string; - signer: string; - relayers: string[]; + '@type': '/ibc.applications.fee.v1.MsgPayPacketFee' + fee?: IbcFee.Data + source_port_id: string + source_channel_id: string + signer: string + relayers: string[] } - export type Proto = MsgPayPacketFee_pb; + export type Proto = MsgPayPacketFee_pb } diff --git a/src/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.ts b/src/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.ts index f0315eb..05e5fe8 100644 --- a/src/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.ts +++ b/src/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgPayPacketFeeAsync as MsgPayPacketFeeAsync_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx'; -import { PacketId } from '../../../core/channel/PacketId'; -import { PacketFee } from '../PacketFee'; +import { JSONSerializable } from '../../../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgPayPacketFeeAsync as MsgPayPacketFeeAsync_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx' +import { PacketId } from '../../../core/channel/PacketId' +import { PacketFee } from '../PacketFee' /** * MsgPayPacketFeeAsync defines the request type for the PayPacketFeeAsync rpc @@ -17,37 +17,40 @@ export class MsgPayPacketFeeAsync extends JSONSerializable< * @param packet_id packet identifier comprised of the channel ID, port ID and sequence * @param packet_fee the packet fee associated with a particular IBC packet */ - constructor(public packet_id?: PacketId, public packet_fee?: PacketFee) { - super(); + constructor( + public packet_id?: PacketId, + public packet_fee?: PacketFee + ) { + super() } public static fromAmino(_: any): any { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgPayPacketFeeAsync.Data ): MsgPayPacketFeeAsync { - const { packet_id, packet_fee } = data; + const { packet_id, packet_fee } = data return new MsgPayPacketFeeAsync( packet_id ? PacketId.fromData(packet_id) : undefined, packet_fee ? PacketFee.fromData(packet_fee) : undefined - ); + ) } public toData(): MsgPayPacketFeeAsync.Data { - const { packet_id, packet_fee } = this; + const { packet_id, packet_fee } = this return { '@type': '/ibc.applications.fee.v1.MsgPayPacketFeeAsync', packet_id: packet_id?.toData(), packet_fee: packet_fee?.toData(), - }; + } } public static fromProto( @@ -56,37 +59,37 @@ export class MsgPayPacketFeeAsync extends JSONSerializable< return new MsgPayPacketFeeAsync( proto.packetId ? PacketId.fromProto(proto.packetId) : undefined, proto.packetFee ? PacketFee.fromProto(proto.packetFee) : undefined - ); + ) } public toProto(): MsgPayPacketFeeAsync.Proto { - const { packet_id, packet_fee } = this; + const { packet_id, packet_fee } = this return MsgPayPacketFeeAsync_pb.fromPartial({ packetId: packet_id?.toProto(), packetFee: packet_fee?.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.fee.v1.MsgPayPacketFeeAsync', value: MsgPayPacketFeeAsync_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgPayPacketFeeAsync { return MsgPayPacketFeeAsync.fromProto( MsgPayPacketFeeAsync_pb.decode(msgAny.value) - ); + ) } } export namespace MsgPayPacketFeeAsync { export interface Data { - '@type': '/ibc.applications.fee.v1.MsgPayPacketFeeAsync'; - packet_id?: PacketId.Data; - packet_fee?: PacketFee.Data; + '@type': '/ibc.applications.fee.v1.MsgPayPacketFeeAsync' + packet_id?: PacketId.Data + packet_fee?: PacketFee.Data } - export type Proto = MsgPayPacketFeeAsync_pb; + export type Proto = MsgPayPacketFeeAsync_pb } diff --git a/src/core/ibc/applications/fee/msgs/MsgRegisterCounterpartyPayee.ts b/src/core/ibc/applications/fee/msgs/MsgRegisterCounterpartyPayee.ts index 2878d08..df2c8cb 100644 --- a/src/core/ibc/applications/fee/msgs/MsgRegisterCounterpartyPayee.ts +++ b/src/core/ibc/applications/fee/msgs/MsgRegisterCounterpartyPayee.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRegisterCounterpartyPayee as MsgRegisterCounterpartyPayee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRegisterCounterpartyPayee as MsgRegisterCounterpartyPayee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx' /** * MsgRegisterCounterpartyPayee defines the request type for the RegisterCounterpartyPayee rpc @@ -22,40 +22,40 @@ export class MsgRegisterCounterpartyPayee extends JSONSerializable< public relayer: string, public counterparty_payee: string ) { - super(); + super() } public static fromAmino(_: any): MsgRegisterCounterpartyPayee { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgRegisterCounterpartyPayee.Data ): MsgRegisterCounterpartyPayee { - const { port_id, channel_id, relayer, counterparty_payee } = data; + const { port_id, channel_id, relayer, counterparty_payee } = data return new MsgRegisterCounterpartyPayee( port_id, channel_id, relayer, counterparty_payee - ); + ) } public toData(): MsgRegisterCounterpartyPayee.Data { - const { port_id, channel_id, relayer, counterparty_payee } = this; + const { port_id, channel_id, relayer, counterparty_payee } = this return { '@type': '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee', port_id, channel_id, relayer, counterparty_payee, - }; + } } public static fromProto( @@ -66,41 +66,41 @@ export class MsgRegisterCounterpartyPayee extends JSONSerializable< proto.channelId, proto.relayer, proto.counterpartyPayee - ); + ) } public toProto(): MsgRegisterCounterpartyPayee.Proto { - const { port_id, channel_id, relayer, counterparty_payee } = this; + const { port_id, channel_id, relayer, counterparty_payee } = this return MsgRegisterCounterpartyPayee_pb.fromPartial({ portId: port_id, channelId: channel_id, relayer, counterpartyPayee: counterparty_payee, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee', value: MsgRegisterCounterpartyPayee_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRegisterCounterpartyPayee { return MsgRegisterCounterpartyPayee.fromProto( MsgRegisterCounterpartyPayee_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRegisterCounterpartyPayee { export interface Data { - '@type': '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee'; - port_id: string; - channel_id: string; - relayer: string; - counterparty_payee: string; + '@type': '/ibc.applications.fee.v1.MsgRegisterCounterpartyPayee' + port_id: string + channel_id: string + relayer: string + counterparty_payee: string } - export type Proto = MsgRegisterCounterpartyPayee_pb; + export type Proto = MsgRegisterCounterpartyPayee_pb } diff --git a/src/core/ibc/applications/fee/msgs/MsgRegisterPayee.ts b/src/core/ibc/applications/fee/msgs/MsgRegisterPayee.ts index 122af14..41f6f2e 100644 --- a/src/core/ibc/applications/fee/msgs/MsgRegisterPayee.ts +++ b/src/core/ibc/applications/fee/msgs/MsgRegisterPayee.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRegisterPayee as MsgRegisterPayee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRegisterPayee as MsgRegisterPayee_pb } from '@initia/initia.proto/ibc/applications/fee/v1/tx' /** * MsgRegisterPayee defines the request type for the RegisterPayee rpc @@ -22,33 +22,33 @@ export class MsgRegisterPayee extends JSONSerializable< public relayer: string, public payee: string ) { - super(); + super() } public static fromAmino(_: any): MsgRegisterPayee { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgRegisterPayee.Data): MsgRegisterPayee { - const { port_id, channel_id, relayer, payee } = data; + const { port_id, channel_id, relayer, payee } = data - return new MsgRegisterPayee(port_id, channel_id, relayer, payee); + return new MsgRegisterPayee(port_id, channel_id, relayer, payee) } public toData(): MsgRegisterPayee.Data { - const { port_id, channel_id, relayer, payee } = this; + const { port_id, channel_id, relayer, payee } = this return { '@type': '/ibc.applications.fee.v1.MsgRegisterPayee', port_id, channel_id, relayer, payee, - }; + } } public static fromProto(proto: MsgRegisterPayee.Proto): MsgRegisterPayee { @@ -57,39 +57,39 @@ export class MsgRegisterPayee extends JSONSerializable< proto.channelId, proto.relayer, proto.payee - ); + ) } public toProto(): MsgRegisterPayee.Proto { - const { port_id, channel_id, relayer, payee } = this; + const { port_id, channel_id, relayer, payee } = this return MsgRegisterPayee_pb.fromPartial({ portId: port_id, channelId: channel_id, relayer, payee, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.fee.v1.MsgRegisterPayee', value: MsgRegisterPayee_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRegisterPayee { - return MsgRegisterPayee.fromProto(MsgRegisterPayee_pb.decode(msgAny.value)); + return MsgRegisterPayee.fromProto(MsgRegisterPayee_pb.decode(msgAny.value)) } } export namespace MsgRegisterPayee { export interface Data { - '@type': '/ibc.applications.fee.v1.MsgRegisterPayee'; - port_id: string; - channel_id: string; - relayer: string; - payee: string; + '@type': '/ibc.applications.fee.v1.MsgRegisterPayee' + port_id: string + channel_id: string + relayer: string + payee: string } - export type Proto = MsgRegisterPayee_pb; + export type Proto = MsgRegisterPayee_pb } diff --git a/src/core/ibc/applications/fee/msgs/index.ts b/src/core/ibc/applications/fee/msgs/index.ts index 7fd4211..80c3d9c 100644 --- a/src/core/ibc/applications/fee/msgs/index.ts +++ b/src/core/ibc/applications/fee/msgs/index.ts @@ -1,28 +1,28 @@ -import { MsgPayPacketFee } from './MsgPayPacketFee'; -import { MsgPayPacketFeeAsync } from './MsgPayPacketFeeAsync'; -import { MsgRegisterCounterpartyPayee } from './MsgRegisterCounterpartyPayee'; -import { MsgRegisterPayee } from './MsgRegisterPayee'; +import { MsgPayPacketFee } from './MsgPayPacketFee' +import { MsgPayPacketFeeAsync } from './MsgPayPacketFeeAsync' +import { MsgRegisterCounterpartyPayee } from './MsgRegisterCounterpartyPayee' +import { MsgRegisterPayee } from './MsgRegisterPayee' -export * from './MsgPayPacketFee'; -export * from './MsgPayPacketFeeAsync'; -export * from './MsgRegisterPayee'; -export * from './MsgRegisterCounterpartyPayee'; +export * from './MsgPayPacketFee' +export * from './MsgPayPacketFeeAsync' +export * from './MsgRegisterPayee' +export * from './MsgRegisterCounterpartyPayee' export type IbcFeeMsg = | MsgPayPacketFee | MsgPayPacketFeeAsync | MsgRegisterPayee - | MsgRegisterCounterpartyPayee; + | MsgRegisterCounterpartyPayee export namespace IbcFeeMsg { export type Data = | MsgPayPacketFee.Data | MsgPayPacketFeeAsync.Data | MsgRegisterPayee.Data - | MsgRegisterCounterpartyPayee.Data; + | MsgRegisterCounterpartyPayee.Data export type Proto = | MsgPayPacketFee.Proto | MsgPayPacketFeeAsync.Proto | MsgRegisterPayee.Proto - | MsgRegisterCounterpartyPayee.Proto; + | MsgRegisterCounterpartyPayee.Proto } diff --git a/src/core/ibc/applications/index.ts b/src/core/ibc/applications/index.ts index dc3e720..cf9bd3a 100644 --- a/src/core/ibc/applications/index.ts +++ b/src/core/ibc/applications/index.ts @@ -1,4 +1,4 @@ -export * from './fee'; -export * from './nft-transfer'; -export * from './perm'; -export * from './transfer'; +export * from './fee' +export * from './nft-transfer' +export * from './perm' +export * from './transfer' diff --git a/src/core/ibc/applications/interchain-account/Account.ts b/src/core/ibc/applications/interchain-account/Account.ts index f2ffc2d..825b83a 100644 --- a/src/core/ibc/applications/interchain-account/Account.ts +++ b/src/core/ibc/applications/interchain-account/Account.ts @@ -1,6 +1,6 @@ -import { InterchainAccount as InterchainAccount_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/v1/account'; -import { BaseAccount } from '../../../..'; -import { JSONSerializable } from '../../../../util/json'; +import { InterchainAccount as InterchainAccount_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/v1/account' +import { BaseAccount } from '../../../..' +import { JSONSerializable } from '../../../../util/json' /** * An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain @@ -18,69 +18,69 @@ export class InterchainAccount extends JSONSerializable< public base_account: BaseAccount | undefined, public account_owner: string ) { - super(); + super() } public static fromAmino(data: InterchainAccount.Amino): InterchainAccount { - const { base_account, account_owner } = data; + const { base_account, account_owner } = data return new InterchainAccount( base_account ? BaseAccount.fromAmino(base_account) : undefined, account_owner - ); + ) } public toAmino(): InterchainAccount.Amino { - const { base_account, account_owner } = this; + const { base_account, account_owner } = this const res: InterchainAccount.Amino = { base_account: base_account?.toAmino(), account_owner, - }; - return res; + } + return res } public static fromData(data: InterchainAccount.Data): InterchainAccount { - const { base_account, account_owner } = data; + const { base_account, account_owner } = data return new InterchainAccount( base_account ? BaseAccount.fromData(base_account) : undefined, account_owner - ); + ) } public toData(): InterchainAccount.Data { - const { base_account, account_owner } = this; + const { base_account, account_owner } = this const res: InterchainAccount.Data = { base_account: base_account?.toData(), account_owner, - }; - return res; + } + return res } public static fromProto(proto: InterchainAccount.Proto): InterchainAccount { return new InterchainAccount( proto.baseAccount ? BaseAccount.fromProto(proto.baseAccount) : undefined, proto.accountOwner - ); + ) } public toProto(): InterchainAccount.Proto { - const { base_account, account_owner } = this; + const { base_account, account_owner } = this return InterchainAccount_pb.fromPartial({ baseAccount: base_account?.toProto(), accountOwner: account_owner, - }); + }) } } export namespace InterchainAccount { export interface Amino { - base_account?: BaseAccount.Amino; - account_owner: string; + base_account?: BaseAccount.Amino + account_owner: string } export interface Data { - base_account?: BaseAccount.Data; - account_owner: string; + base_account?: BaseAccount.Data + account_owner: string } - export type Proto = InterchainAccount_pb; + export type Proto = InterchainAccount_pb } diff --git a/src/core/ibc/applications/interchain-account/Metadata.ts b/src/core/ibc/applications/interchain-account/Metadata.ts index 2e3301c..b7d2846 100644 --- a/src/core/ibc/applications/interchain-account/Metadata.ts +++ b/src/core/ibc/applications/interchain-account/Metadata.ts @@ -1,5 +1,5 @@ -import { Metadata as Metadata_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/v1/metadata'; -import { JSONSerializable } from '../../../../util/json'; +import { Metadata as Metadata_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/v1/metadata' +import { JSONSerializable } from '../../../../util/json' /** * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring @@ -26,7 +26,7 @@ export class Metadata extends JSONSerializable< public encoding: string, public tx_type: string ) { - super(); + super() } public static fromAmino(data: Metadata.Amino): Metadata { @@ -37,7 +37,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - } = data; + } = data return new Metadata( version, controller_connection_id, @@ -45,7 +45,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type - ); + ) } public toAmino(): Metadata.Amino { @@ -56,7 +56,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - } = this; + } = this const res: Metadata.Amino = { version, controller_connection_id, @@ -64,8 +64,8 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - }; - return res; + } + return res } public static fromData(data: Metadata.Data): Metadata { @@ -76,7 +76,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - } = data; + } = data return new Metadata( version, controller_connection_id, @@ -84,7 +84,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type - ); + ) } public toData(): Metadata.Data { @@ -95,7 +95,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - } = this; + } = this const res: Metadata.Data = { version, controller_connection_id, @@ -103,8 +103,8 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - }; - return res; + } + return res } public static fromProto(proto: Metadata.Proto): Metadata { @@ -115,7 +115,7 @@ export class Metadata extends JSONSerializable< proto.address, proto.encoding, proto.txType - ); + ) } public toProto(): Metadata.Proto { @@ -126,7 +126,7 @@ export class Metadata extends JSONSerializable< address, encoding, tx_type, - } = this; + } = this return Metadata_pb.fromPartial({ version: version, controllerConnectionId: controller_connection_id, @@ -134,28 +134,28 @@ export class Metadata extends JSONSerializable< address: address, encoding: encoding, txType: tx_type, - }); + }) } } export namespace Metadata { export interface Amino { - version: string; - controller_connection_id: string; - host_connection_id: string; - address: string; - encoding: string; - tx_type: string; + version: string + controller_connection_id: string + host_connection_id: string + address: string + encoding: string + tx_type: string } export interface Data { - version: string; - controller_connection_id: string; - host_connection_id: string; - address: string; - encoding: string; - tx_type: string; + version: string + controller_connection_id: string + host_connection_id: string + address: string + encoding: string + tx_type: string } - export type Proto = Metadata_pb; + export type Proto = Metadata_pb } diff --git a/src/core/ibc/applications/interchain-account/controller/Params.ts b/src/core/ibc/applications/interchain-account/controller/Params.ts index 557b2a1..d2fe1b5 100644 --- a/src/core/ibc/applications/interchain-account/controller/Params.ts +++ b/src/core/ibc/applications/interchain-account/controller/Params.ts @@ -1,5 +1,5 @@ -import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/controller/v1/controller'; -import { JSONSerializable } from '../../../../../util/json'; +import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/controller/v1/controller' +import { JSONSerializable } from '../../../../../util/json' /** * Params defines the set of on-chain interchain accounts parameters. @@ -14,55 +14,55 @@ export class Params extends JSONSerializable< * @param controller_enabled controller_enabled enables or disables the controller submodule */ constructor(public controller_enabled: boolean) { - super(); + super() } public static fromAmino(data: Params.Amino): Params { - const { controller_enabled } = data; - return new Params(controller_enabled); + const { controller_enabled } = data + return new Params(controller_enabled) } public toAmino(): Params.Amino { - const { controller_enabled } = this; + const { controller_enabled } = this const res: Params.Amino = { controller_enabled: controller_enabled, - }; - return res; + } + return res } public static fromData(data: Params.Data): Params { - const { controller_enabled } = data; - return new Params(controller_enabled); + const { controller_enabled } = data + return new Params(controller_enabled) } public toData(): Params.Data { - const { controller_enabled } = this; + const { controller_enabled } = this const res: Params.Data = { controller_enabled, - }; - return res; + } + return res } public static fromProto(proto: Params.Proto): Params { - return new Params(proto.controllerEnabled); + return new Params(proto.controllerEnabled) } public toProto(): Params.Proto { - const { controller_enabled } = this; + const { controller_enabled } = this return Params_pb.fromPartial({ controllerEnabled: controller_enabled, - }); + }) } } export namespace Params { export interface Amino { - controller_enabled: boolean; + controller_enabled: boolean } export interface Data { - controller_enabled: boolean; + controller_enabled: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/applications/interchain-account/host/Params.ts b/src/core/ibc/applications/interchain-account/host/Params.ts index ab7ecf0..74e810e 100644 --- a/src/core/ibc/applications/interchain-account/host/Params.ts +++ b/src/core/ibc/applications/interchain-account/host/Params.ts @@ -1,5 +1,5 @@ -import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/host/v1/host'; -import { JSONSerializable } from '../../../../../util/json'; +import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/interchain_accounts/host/v1/host' +import { JSONSerializable } from '../../../../../util/json' /** * Params defines the set of on-chain interchain accounts parameters. @@ -13,61 +13,64 @@ export class Params extends JSONSerializable< /** * @param host_enabled host_enabled enables or disables the host submodule. */ - constructor(public host_enabled: boolean, public allowed_messages: string[]) { - super(); + constructor( + public host_enabled: boolean, + public allowed_messages: string[] + ) { + super() } public static fromAmino(data: Params.Amino): Params { - const { host_enabled, allowed_messages } = data; - return new Params(host_enabled, allowed_messages); + const { host_enabled, allowed_messages } = data + return new Params(host_enabled, allowed_messages) } public toAmino(): Params.Amino { - const { host_enabled, allowed_messages } = this; + const { host_enabled, allowed_messages } = this const res: Params.Amino = { host_enabled: host_enabled, allowed_messages: allowed_messages, - }; - return res; + } + return res } public static fromData(data: Params.Data): Params { - const { host_enabled, allowed_messages } = data; - return new Params(host_enabled, allowed_messages); + const { host_enabled, allowed_messages } = data + return new Params(host_enabled, allowed_messages) } public toData(): Params.Data { - const { host_enabled, allowed_messages } = this; + const { host_enabled, allowed_messages } = this const res: Params.Data = { host_enabled, allowed_messages, - }; - return res; + } + return res } public static fromProto(proto: Params.Proto): Params { - return new Params(proto.hostEnabled, proto.allowMessages); + return new Params(proto.hostEnabled, proto.allowMessages) } public toProto(): Params.Proto { - const { host_enabled, allowed_messages } = this; + const { host_enabled, allowed_messages } = this return Params_pb.fromPartial({ hostEnabled: host_enabled, allowMessages: allowed_messages, - }); + }) } } export namespace Params { export interface Amino { - host_enabled: boolean; - allowed_messages: string[]; + host_enabled: boolean + allowed_messages: string[] } export interface Data { - host_enabled: boolean; - allowed_messages: string[]; + host_enabled: boolean + allowed_messages: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/applications/interchain-account/index.ts b/src/core/ibc/applications/interchain-account/index.ts index fe4c8d9..9607249 100644 --- a/src/core/ibc/applications/interchain-account/index.ts +++ b/src/core/ibc/applications/interchain-account/index.ts @@ -1,5 +1,5 @@ -export { Params as ControllerParams } from './controller/Params'; -export { Params as HostParams } from './host/Params'; +export { Params as ControllerParams } from './controller/Params' +export { Params as HostParams } from './host/Params' -export * from './Account'; -export * from './Metadata'; +export * from './Account' +export * from './Metadata' diff --git a/src/core/ibc/applications/nft-transfer/IbcNftParams.ts b/src/core/ibc/applications/nft-transfer/IbcNftParams.ts index 2bc0ff1..adaa82d 100644 --- a/src/core/ibc/applications/nft-transfer/IbcNftParams.ts +++ b/src/core/ibc/applications/nft-transfer/IbcNftParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/types'; +import { JSONSerializable } from '../../../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/types' export class IbcNftParams extends JSONSerializable< IbcNftParams.Amino, @@ -10,66 +10,69 @@ export class IbcNftParams extends JSONSerializable< * @param send_enabled enables or disables all cross-chain token transfers from this chain * @param receive_enabled enables or disables all cross-chain token transfers to this chain */ - constructor(public send_enabled: boolean, public receive_enabled: boolean) { - super(); + constructor( + public send_enabled: boolean, + public receive_enabled: boolean + ) { + super() } public static fromAmino(data: IbcNftParams.Amino): IbcNftParams { const { value: { send_enabled, receive_enabled }, - } = data; - return new IbcNftParams(send_enabled, receive_enabled); + } = data + return new IbcNftParams(send_enabled, receive_enabled) } public toAmino(): IbcNftParams.Amino { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return { type: 'nft-transfer/Params', value: { send_enabled, receive_enabled }, - }; + } } public static fromData(data: IbcNftParams.Data): IbcNftParams { - const { send_enabled, receive_enabled } = data; - return new IbcNftParams(send_enabled, receive_enabled); + const { send_enabled, receive_enabled } = data + return new IbcNftParams(send_enabled, receive_enabled) } public toData(): IbcNftParams.Data { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return { '@type': '/ibc.applications.nft_transfer.v1.Params', send_enabled, receive_enabled, - }; + } } public static fromProto(data: IbcNftParams.Proto): IbcNftParams { - return new IbcNftParams(data.sendEnabled, data.receiveEnabled); + return new IbcNftParams(data.sendEnabled, data.receiveEnabled) } public toProto(): IbcNftParams.Proto { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return Params_pb.fromPartial({ sendEnabled: send_enabled, receiveEnabled: receive_enabled, - }); + }) } } export namespace IbcNftParams { export interface Amino { - type: 'nft-transfer/Params'; + type: 'nft-transfer/Params' value: { - send_enabled: boolean; - receive_enabled: boolean; - }; + send_enabled: boolean + receive_enabled: boolean + } } export interface Data { - '@type': '/ibc.applications.nft_transfer.v1.Params'; - send_enabled: boolean; - receive_enabled: boolean; + '@type': '/ibc.applications.nft_transfer.v1.Params' + send_enabled: boolean + receive_enabled: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/applications/nft-transfer/NftClassTrace.ts b/src/core/ibc/applications/nft-transfer/NftClassTrace.ts index 0af4e69..613b992 100644 --- a/src/core/ibc/applications/nft-transfer/NftClassTrace.ts +++ b/src/core/ibc/applications/nft-transfer/NftClassTrace.ts @@ -1,5 +1,5 @@ -import { ClassTrace as NftClassTrace_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/types'; -import { JSONSerializable } from '../../../../util/json'; +import { ClassTrace as NftClassTrace_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/types' +import { JSONSerializable } from '../../../../util/json' export class NftClassTrace extends JSONSerializable< NftClassTrace.Amino, @@ -10,58 +10,61 @@ export class NftClassTrace extends JSONSerializable< * @param path the chain of port/channel identifiers used for tracing the source of the non fungible token * @param base_class_id base class id of the relayed non fungible token */ - constructor(public path: string, public base_class_id: string) { - super(); + constructor( + public path: string, + public base_class_id: string + ) { + super() } public static fromAmino(data: NftClassTrace.Amino): NftClassTrace { - const { path, base_class_id } = data; - return new NftClassTrace(path, base_class_id); + const { path, base_class_id } = data + return new NftClassTrace(path, base_class_id) } public toAmino(): NftClassTrace.Amino { - const { path, base_class_id } = this; + const { path, base_class_id } = this const res: NftClassTrace.Amino = { path, base_class_id, - }; - return res; + } + return res } public static fromData(data: NftClassTrace.Data): NftClassTrace { - const { path, base_class_id } = data; - return new NftClassTrace(path, base_class_id); + const { path, base_class_id } = data + return new NftClassTrace(path, base_class_id) } public toData(): NftClassTrace.Data { - const { path, base_class_id } = this; + const { path, base_class_id } = this const res: NftClassTrace.Data = { path, base_class_id, - }; - return res; + } + return res } public static fromProto(proto: NftClassTrace.Proto): NftClassTrace { - return new NftClassTrace(proto.path, proto.baseClassId); + return new NftClassTrace(proto.path, proto.baseClassId) } public toProto(): NftClassTrace.Proto { - const { path, base_class_id } = this; - return NftClassTrace_pb.fromPartial({ path, baseClassId: base_class_id }); + const { path, base_class_id } = this + return NftClassTrace_pb.fromPartial({ path, baseClassId: base_class_id }) } } export namespace NftClassTrace { export interface Amino { - path: string; - base_class_id: string; + path: string + base_class_id: string } export interface Data { - path: string; - base_class_id: string; + path: string + base_class_id: string } - export type Proto = NftClassTrace_pb; + export type Proto = NftClassTrace_pb } diff --git a/src/core/ibc/applications/nft-transfer/NonFungibleTokenPacketData.ts b/src/core/ibc/applications/nft-transfer/NonFungibleTokenPacketData.ts index 829edea..7ed6b6d 100644 --- a/src/core/ibc/applications/nft-transfer/NonFungibleTokenPacketData.ts +++ b/src/core/ibc/applications/nft-transfer/NonFungibleTokenPacketData.ts @@ -1,5 +1,5 @@ -import { NonFungibleTokenPacketData as NonFungibleTokenPacketData_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/packet'; -import { JSONSerializable } from '../../../../util/json'; +import { NonFungibleTokenPacketData as NonFungibleTokenPacketData_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/packet' +import { JSONSerializable } from '../../../../util/json' /** * NonFungibleTokenPacketData defines a struct for the packet payload @@ -33,7 +33,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< public receiver: string, public memo?: string ) { - super(); + super() } public static fromAmino( @@ -49,7 +49,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - } = data; + } = data return new NonFungibleTokenPacketData( class_id, @@ -61,7 +61,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo - ); + ) } public toAmino(): NonFungibleTokenPacketData.Amino { @@ -75,7 +75,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - } = this; + } = this return { class_id, @@ -87,7 +87,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - }; + } } public static fromData( @@ -103,7 +103,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - } = data; + } = data return new NonFungibleTokenPacketData( class_id, @@ -115,7 +115,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo - ); + ) } public toData(): NonFungibleTokenPacketData.Data { @@ -129,7 +129,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - } = this; + } = this return { class_id, @@ -141,7 +141,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - }; + } } public static fromProto( @@ -157,7 +157,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< proto.sender, proto.receiver, proto.memo - ); + ) } public toProto(): NonFungibleTokenPacketData.Proto { @@ -171,7 +171,7 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - } = this; + } = this return NonFungibleTokenPacketData_pb.fromPartial({ classId: class_id, @@ -183,34 +183,34 @@ export class NonFungibleTokenPacketData extends JSONSerializable< sender, receiver, memo, - }); + }) } } export namespace NonFungibleTokenPacketData { export interface Amino { - class_id: string; - class_uri: string; - class_data: string; - token_ids: string[]; - token_uris: string[]; - token_data: string[]; - sender: string; - receiver: string; - memo?: string; + class_id: string + class_uri: string + class_data: string + token_ids: string[] + token_uris: string[] + token_data: string[] + sender: string + receiver: string + memo?: string } export interface Data { - class_id: string; - class_uri: string; - class_data: string; - token_ids: string[]; - token_uris: string[]; - token_data: string[]; - sender: string; - receiver: string; - memo?: string; + class_id: string + class_uri: string + class_data: string + token_ids: string[] + token_uris: string[] + token_data: string[] + sender: string + receiver: string + memo?: string } - export type Proto = NonFungibleTokenPacketData_pb; + export type Proto = NonFungibleTokenPacketData_pb } diff --git a/src/core/ibc/applications/nft-transfer/index.ts b/src/core/ibc/applications/nft-transfer/index.ts index 24364b4..078b060 100644 --- a/src/core/ibc/applications/nft-transfer/index.ts +++ b/src/core/ibc/applications/nft-transfer/index.ts @@ -1,4 +1,4 @@ -export * from './msgs'; -export * from './NonFungibleTokenPacketData'; -export * from './NftClassTrace'; -export * from './IbcNftParams'; +export * from './msgs' +export * from './NonFungibleTokenPacketData' +export * from './NftClassTrace' +export * from './IbcNftParams' diff --git a/src/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.ts b/src/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.ts index 32b6efb..cea663d 100644 --- a/src/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.ts +++ b/src/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import Long from 'long'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgTransfer as MsgTransfer_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/tx'; -import { Height } from '../../../core/client/Height'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import Long from 'long' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgTransfer as MsgTransfer_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/tx' +import { Height } from '../../../core/client/Height' /** * A basic message for NFT transfer via IBC. @@ -13,15 +13,15 @@ export class MsgNftTransfer extends JSONSerializable< MsgNftTransfer.Data, MsgNftTransfer.Proto > { - public source_port: string; - public source_channel: string; - public class_id: string; - public token_ids: string[]; - public sender: AccAddress; - public receiver: string; // destination chain can be non-cosmos-based - public timeout_height?: Height; // 0 to disable - public timeout_timestamp?: string; // 0 to disable - public memo?: string; + public source_port: string + public source_channel: string + public class_id: string + public token_ids: string[] + public sender: AccAddress + public receiver: string // destination chain can be non-cosmos-based + public timeout_height?: Height // 0 to disable + public timeout_timestamp?: string // 0 to disable + public memo?: string /** * @param source_port the port on which the packet will be sent * @param source_channel the channel by which the packet will be sent @@ -44,23 +44,23 @@ export class MsgNftTransfer extends JSONSerializable< timeout_timestamp?: string, memo?: string ) { - super(); + super() if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } - this.source_port = source_port; - this.source_channel = source_channel; - this.class_id = class_id; - this.token_ids = token_ids; - this.sender = sender; - this.receiver = receiver; - this.timeout_height = timeout_height; - this.timeout_timestamp = timeout_timestamp; - this.memo = memo; + this.source_port = source_port + this.source_channel = source_channel + this.class_id = class_id + this.token_ids = token_ids + this.sender = sender + this.receiver = receiver + this.timeout_height = timeout_height + this.timeout_timestamp = timeout_timestamp + this.memo = memo } public static fromAmino(data: MsgNftTransfer.Amino): MsgNftTransfer { @@ -76,12 +76,12 @@ export class MsgNftTransfer extends JSONSerializable< timeout_timestamp, memo, }, - } = data; + } = data if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } return new MsgNftTransfer( @@ -94,7 +94,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_height ? Height.fromAmino(timeout_height) : undefined, timeout_timestamp, memo - ); + ) } public toAmino(): MsgNftTransfer.Amino { @@ -108,7 +108,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return { type: 'nft-transfer/MsgTransfer', value: { @@ -122,7 +122,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_timestamp, memo, }, - }; + } } public static fromData(data: MsgNftTransfer.Data): MsgNftTransfer { @@ -136,12 +136,12 @@ export class MsgNftTransfer extends JSONSerializable< timeout_timestamp, timeout_height, memo, - } = data; + } = data if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } return new MsgNftTransfer( @@ -154,7 +154,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_height ? Height.fromData(timeout_height) : undefined, timeout_timestamp === '0' ? undefined : timeout_timestamp, memo - ); + ) } public toData(): MsgNftTransfer.Data { @@ -168,7 +168,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return { '@type': '/ibc.applications.nft_transfer.v1.MsgTransfer', source_port, @@ -182,12 +182,12 @@ export class MsgNftTransfer extends JSONSerializable< : new Height(0, 0).toData(), timeout_timestamp: timeout_timestamp ?? '0', memo, - }; + } } public static fromProto(proto: MsgNftTransfer.Proto): MsgNftTransfer { if (!proto.timeoutHeight && proto.timeoutTimestamp.toNumber() == 0) { - throw new Error('both of timeout_height and timeout_timestamp are empty'); + throw new Error('both of timeout_height and timeout_timestamp are empty') } return new MsgNftTransfer( @@ -200,7 +200,7 @@ export class MsgNftTransfer extends JSONSerializable< proto.timeoutHeight ? Height.fromProto(proto.timeoutHeight) : undefined, proto.timeoutTimestamp.toString(), proto.memo - ); + ) } public toProto(): MsgNftTransfer.Proto { @@ -214,7 +214,7 @@ export class MsgNftTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return MsgTransfer_pb.fromPartial({ sourcePort: source_port, sourceChannel: source_channel, @@ -225,49 +225,49 @@ export class MsgNftTransfer extends JSONSerializable< timeoutHeight: timeout_height?.toProto(), timeoutTimestamp: Long.fromString(timeout_timestamp ?? '0'), memo, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.nft_transfer.v1.MsgTransfer', value: MsgTransfer_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgNftTransfer { - return MsgNftTransfer.fromProto(MsgTransfer_pb.decode(msgAny.value)); + return MsgNftTransfer.fromProto(MsgTransfer_pb.decode(msgAny.value)) } } export namespace MsgNftTransfer { export interface Amino { - type: 'nft-transfer/MsgTransfer'; + type: 'nft-transfer/MsgTransfer' value: { - source_port: string; - source_channel: string; - class_id: string; - token_ids: string[]; - sender: AccAddress; - receiver: string; - timeout_height: Height.Amino; - timeout_timestamp?: string; - memo?: string; - }; + source_port: string + source_channel: string + class_id: string + token_ids: string[] + sender: AccAddress + receiver: string + timeout_height: Height.Amino + timeout_timestamp?: string + memo?: string + } } export interface Data { - '@type': '/ibc.applications.nft_transfer.v1.MsgTransfer'; - source_port: string; - source_channel: string; - class_id: string; - token_ids: string[]; - sender: AccAddress; - receiver: string; - timeout_height: Height.Data; - timeout_timestamp: string; - memo?: string; + '@type': '/ibc.applications.nft_transfer.v1.MsgTransfer' + source_port: string + source_channel: string + class_id: string + token_ids: string[] + sender: AccAddress + receiver: string + timeout_height: Height.Data + timeout_timestamp: string + memo?: string } - export type Proto = MsgTransfer_pb; + export type Proto = MsgTransfer_pb } diff --git a/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts b/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts index 6af2a7a..7ab4e85 100644 --- a/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts +++ b/src/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { IbcNftParams } from '../IbcNftParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { IbcNftParams } from '../IbcNftParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/applications/nft_transfer/v1/tx' export class MsgUpdateIbcNftParams extends JSONSerializable< MsgUpdateIbcNftParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateIbcNftParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the parameters to update */ - constructor(public authority: AccAddress, public params: IbcNftParams) { - super(); + constructor( + public authority: AccAddress, + public params: IbcNftParams + ) { + super() } public static fromAmino( @@ -22,35 +25,35 @@ export class MsgUpdateIbcNftParams extends JSONSerializable< ): MsgUpdateIbcNftParams { const { value: { authority, params }, - } = data; - return new MsgUpdateIbcNftParams(authority, IbcNftParams.fromAmino(params)); + } = data + return new MsgUpdateIbcNftParams(authority, IbcNftParams.fromAmino(params)) } public toAmino(): MsgUpdateIbcNftParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'nft-transfer/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateIbcNftParams.Data ): MsgUpdateIbcNftParams { - const { authority, params } = data; - return new MsgUpdateIbcNftParams(authority, IbcNftParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateIbcNftParams(authority, IbcNftParams.fromData(params)) } public toData(): MsgUpdateIbcNftParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/ibc.applications.nft_transfer.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -59,45 +62,45 @@ export class MsgUpdateIbcNftParams extends JSONSerializable< return new MsgUpdateIbcNftParams( data.authority, IbcNftParams.fromProto(data.params as IbcNftParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcNftParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.nft_transfer.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcNftParams { return MsgUpdateIbcNftParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcNftParams { export interface Amino { - type: 'nft-transfer/MsgUpdateParams'; + type: 'nft-transfer/MsgUpdateParams' value: { - authority: AccAddress; - params: IbcNftParams.Amino; - }; + authority: AccAddress + params: IbcNftParams.Amino + } } export interface Data { - '@type': '/ibc.applications.nft_transfer.v1.MsgUpdateParams'; - authority: AccAddress; - params: IbcNftParams.Data; + '@type': '/ibc.applications.nft_transfer.v1.MsgUpdateParams' + authority: AccAddress + params: IbcNftParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibc/applications/nft-transfer/msgs/index.ts b/src/core/ibc/applications/nft-transfer/msgs/index.ts index b5f56c7..0ba03e3 100644 --- a/src/core/ibc/applications/nft-transfer/msgs/index.ts +++ b/src/core/ibc/applications/nft-transfer/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgNftTransfer } from './MsgNftTransfer'; -import { MsgUpdateIbcNftParams } from './MsgUpdateIbcNftParams'; +import { MsgNftTransfer } from './MsgNftTransfer' +import { MsgUpdateIbcNftParams } from './MsgUpdateIbcNftParams' -export * from './MsgNftTransfer'; -export * from './MsgUpdateIbcNftParams'; +export * from './MsgNftTransfer' +export * from './MsgUpdateIbcNftParams' -export type IbcNftMsg = MsgNftTransfer | MsgUpdateIbcNftParams; +export type IbcNftMsg = MsgNftTransfer | MsgUpdateIbcNftParams export namespace IbcNftMsg { - export type Amino = MsgNftTransfer.Amino | MsgUpdateIbcNftParams.Amino; - export type Data = MsgNftTransfer.Data | MsgUpdateIbcNftParams.Data; - export type Proto = MsgNftTransfer.Proto | MsgUpdateIbcNftParams.Proto; + export type Amino = MsgNftTransfer.Amino | MsgUpdateIbcNftParams.Amino + export type Data = MsgNftTransfer.Data | MsgUpdateIbcNftParams.Data + export type Proto = MsgNftTransfer.Proto | MsgUpdateIbcNftParams.Proto } diff --git a/src/core/ibc/applications/perm/index.ts b/src/core/ibc/applications/perm/index.ts index 231cb79..01eded2 100644 --- a/src/core/ibc/applications/perm/index.ts +++ b/src/core/ibc/applications/perm/index.ts @@ -1 +1 @@ -export * from './msgs'; +export * from './msgs' diff --git a/src/core/ibc/applications/perm/msgs/MsgSetPermissionedRelayers.ts b/src/core/ibc/applications/perm/msgs/MsgSetPermissionedRelayers.ts index ad4a79d..cf03587 100644 --- a/src/core/ibc/applications/perm/msgs/MsgSetPermissionedRelayers.ts +++ b/src/core/ibc/applications/perm/msgs/MsgSetPermissionedRelayers.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetPermissionedRelayers as MsgSetPermissionedRelayers_pb } from '@initia/initia.proto/ibc/applications/perm/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetPermissionedRelayers as MsgSetPermissionedRelayers_pb } from '@initia/initia.proto/ibc/applications/perm/v1/tx' export class MsgSetPermissionedRelayers extends JSONSerializable< MsgSetPermissionedRelayers.Amino, @@ -20,7 +20,7 @@ export class MsgSetPermissionedRelayers extends JSONSerializable< public channel_id: string, public relayers: string[] ) { - super(); + super() } public static fromAmino( @@ -28,17 +28,17 @@ export class MsgSetPermissionedRelayers extends JSONSerializable< ): MsgSetPermissionedRelayers { const { value: { authority, port_id, channel_id, relayers }, - } = data; + } = data return new MsgSetPermissionedRelayers( authority, port_id, channel_id, relayers - ); + ) } public toAmino(): MsgSetPermissionedRelayers.Amino { - const { authority, port_id, channel_id, relayers } = this; + const { authority, port_id, channel_id, relayers } = this return { type: 'perm/MsgSetPermissionedRelayers', value: { @@ -47,30 +47,30 @@ export class MsgSetPermissionedRelayers extends JSONSerializable< channel_id, relayers, }, - }; + } } public static fromData( data: MsgSetPermissionedRelayers.Data ): MsgSetPermissionedRelayers { - const { authority, port_id, channel_id, relayers } = data; + const { authority, port_id, channel_id, relayers } = data return new MsgSetPermissionedRelayers( authority, port_id, channel_id, relayers - ); + ) } public toData(): MsgSetPermissionedRelayers.Data { - const { authority, port_id, channel_id, relayers } = this; + const { authority, port_id, channel_id, relayers } = this return { '@type': '/ibc.applications.perm.v1.MsgSetPermissionedRelayers', authority, port_id, channel_id, relayers, - }; + } } public static fromProto( @@ -81,51 +81,51 @@ export class MsgSetPermissionedRelayers extends JSONSerializable< data.portId, data.channelId, data.relayers - ); + ) } public toProto(): MsgSetPermissionedRelayers.Proto { - const { authority, port_id, channel_id, relayers } = this; + const { authority, port_id, channel_id, relayers } = this return MsgSetPermissionedRelayers_pb.fromPartial({ authority, portId: port_id, channelId: channel_id, relayers, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.perm.v1.MsgSetPermissionedRelayers', value: MsgSetPermissionedRelayers_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetPermissionedRelayers { return MsgSetPermissionedRelayers.fromProto( MsgSetPermissionedRelayers_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetPermissionedRelayers { export interface Amino { - type: 'perm/MsgSetPermissionedRelayers'; + type: 'perm/MsgSetPermissionedRelayers' value: { - authority: AccAddress; - port_id: string; - channel_id: string; - relayers: string[]; - }; + authority: AccAddress + port_id: string + channel_id: string + relayers: string[] + } } export interface Data { - '@type': '/ibc.applications.perm.v1.MsgSetPermissionedRelayers'; - authority: AccAddress; - port_id: string; - channel_id: string; - relayers: string[]; + '@type': '/ibc.applications.perm.v1.MsgSetPermissionedRelayers' + authority: AccAddress + port_id: string + channel_id: string + relayers: string[] } - export type Proto = MsgSetPermissionedRelayers_pb; + export type Proto = MsgSetPermissionedRelayers_pb } diff --git a/src/core/ibc/applications/perm/msgs/index.ts b/src/core/ibc/applications/perm/msgs/index.ts index 0e9e3bb..020204f 100644 --- a/src/core/ibc/applications/perm/msgs/index.ts +++ b/src/core/ibc/applications/perm/msgs/index.ts @@ -1,10 +1,10 @@ -import { MsgSetPermissionedRelayers } from './MsgSetPermissionedRelayers'; +import { MsgSetPermissionedRelayers } from './MsgSetPermissionedRelayers' -export * from './MsgSetPermissionedRelayers'; +export * from './MsgSetPermissionedRelayers' -export type IbcPermMsg = MsgSetPermissionedRelayers; +export type IbcPermMsg = MsgSetPermissionedRelayers export namespace IbcPermMsg { - export type Amino = MsgSetPermissionedRelayers.Amino; - export type Data = MsgSetPermissionedRelayers.Data; - export type Proto = MsgSetPermissionedRelayers.Proto; + export type Amino = MsgSetPermissionedRelayers.Amino + export type Data = MsgSetPermissionedRelayers.Data + export type Proto = MsgSetPermissionedRelayers.Proto } diff --git a/src/core/ibc/applications/transfer/DenomTrace.ts b/src/core/ibc/applications/transfer/DenomTrace.ts index c0b6302..edd7edc 100644 --- a/src/core/ibc/applications/transfer/DenomTrace.ts +++ b/src/core/ibc/applications/transfer/DenomTrace.ts @@ -1,5 +1,5 @@ -import { DenomTrace as DenomTrace_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/denomtrace'; -import { JSONSerializable } from '../../../../util/json'; +import { DenomTrace as DenomTrace_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/denomtrace' +import { JSONSerializable } from '../../../../util/json' /** * DenomTrace is a monotonically increasing data type @@ -22,58 +22,61 @@ export class DenomTrace extends JSONSerializable< * @param path the revision that the client is currently on * @param base_denom the height within the given revision */ - constructor(public path: string, public base_denom: string) { - super(); + constructor( + public path: string, + public base_denom: string + ) { + super() } public static fromAmino(data: DenomTrace.Amino): DenomTrace { - const { path, base_denom } = data; - return new DenomTrace(path, base_denom); + const { path, base_denom } = data + return new DenomTrace(path, base_denom) } public toAmino(): DenomTrace.Amino { - const { path, base_denom } = this; + const { path, base_denom } = this const res: DenomTrace.Amino = { path, base_denom, - }; - return res; + } + return res } public static fromData(data: DenomTrace.Data): DenomTrace { - const { path, base_denom } = data; - return new DenomTrace(path, base_denom); + const { path, base_denom } = data + return new DenomTrace(path, base_denom) } public toData(): DenomTrace.Data { - const { path, base_denom } = this; + const { path, base_denom } = this const res: DenomTrace.Data = { path, base_denom, - }; - return res; + } + return res } public static fromProto(proto: DenomTrace.Proto): DenomTrace { - return new DenomTrace(proto.path, proto.baseDenom); + return new DenomTrace(proto.path, proto.baseDenom) } public toProto(): DenomTrace.Proto { - const { path, base_denom } = this; - return DenomTrace_pb.fromPartial({ path, baseDenom: base_denom }); + const { path, base_denom } = this + return DenomTrace_pb.fromPartial({ path, baseDenom: base_denom }) } } export namespace DenomTrace { export interface Amino { - path: string; - base_denom: string; + path: string + base_denom: string } export interface Data { - path: string; - base_denom: string; + path: string + base_denom: string } - export type Proto = DenomTrace_pb; + export type Proto = DenomTrace_pb } diff --git a/src/core/ibc/applications/transfer/FungibleTokenPacketData.ts b/src/core/ibc/applications/transfer/FungibleTokenPacketData.ts index 544726b..d0f3f80 100644 --- a/src/core/ibc/applications/transfer/FungibleTokenPacketData.ts +++ b/src/core/ibc/applications/transfer/FungibleTokenPacketData.ts @@ -1,5 +1,5 @@ -import { FungibleTokenPacketData as FungibleTokenPacketData_pb } from '@initia/initia.proto/ibc/applications/transfer/v2/packet'; -import { JSONSerializable } from '../../../../util/json'; +import { FungibleTokenPacketData as FungibleTokenPacketData_pb } from '@initia/initia.proto/ibc/applications/transfer/v2/packet' +import { JSONSerializable } from '../../../../util/json' /** * FungibleTokenPacketData defines a struct for the packet payload @@ -25,45 +25,45 @@ export class FungibleTokenPacketData extends JSONSerializable< public receiver: string, public memo?: string ) { - super(); + super() } public static fromAmino( data: FungibleTokenPacketData.Amino ): FungibleTokenPacketData { - const { denom, amount, sender, receiver, memo } = data; - return new FungibleTokenPacketData(denom, amount, sender, receiver, memo); + const { denom, amount, sender, receiver, memo } = data + return new FungibleTokenPacketData(denom, amount, sender, receiver, memo) } public toAmino(): FungibleTokenPacketData.Amino { - const { denom, amount, sender, receiver, memo } = this; + const { denom, amount, sender, receiver, memo } = this const res: FungibleTokenPacketData.Amino = { denom, amount, sender, receiver, memo, - }; - return res; + } + return res } public static fromData( data: FungibleTokenPacketData.Data ): FungibleTokenPacketData { - const { denom, amount, sender, receiver, memo } = data; - return new FungibleTokenPacketData(denom, amount, sender, receiver, memo); + const { denom, amount, sender, receiver, memo } = data + return new FungibleTokenPacketData(denom, amount, sender, receiver, memo) } public toData(): FungibleTokenPacketData.Data { - const { denom, amount, sender, receiver, memo } = this; + const { denom, amount, sender, receiver, memo } = this const res: FungibleTokenPacketData.Data = { denom, amount, sender, receiver, memo, - }; - return res; + } + return res } public static fromProto( @@ -75,37 +75,37 @@ export class FungibleTokenPacketData extends JSONSerializable< proto.sender, proto.receiver, proto.memo - ); + ) } public toProto(): FungibleTokenPacketData.Proto { - const { denom, amount, sender, receiver, memo } = this; + const { denom, amount, sender, receiver, memo } = this return FungibleTokenPacketData_pb.fromPartial({ denom, amount, sender, receiver, memo, - }); + }) } } export namespace FungibleTokenPacketData { export interface Amino { - denom: string; - amount: string; - sender: string; - receiver: string; - memo?: string; + denom: string + amount: string + sender: string + receiver: string + memo?: string } export interface Data { - denom: string; - amount: string; - sender: string; - receiver: string; - memo?: string; + denom: string + amount: string + sender: string + receiver: string + memo?: string } - export type Proto = FungibleTokenPacketData_pb; + export type Proto = FungibleTokenPacketData_pb } diff --git a/src/core/ibc/applications/transfer/IbcTransferParams.ts b/src/core/ibc/applications/transfer/IbcTransferParams.ts index f5a10f6..c7ddae8 100644 --- a/src/core/ibc/applications/transfer/IbcTransferParams.ts +++ b/src/core/ibc/applications/transfer/IbcTransferParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/transfer'; +import { JSONSerializable } from '../../../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/transfer' export class IbcTransferParams extends JSONSerializable< IbcTransferParams.Amino, @@ -10,59 +10,62 @@ export class IbcTransferParams extends JSONSerializable< * @param send_enabled enables or disables all cross-chain token transfers from this chain * @param receive_enabled enables or disables all cross-chain token transfers to this chain */ - constructor(public send_enabled: boolean, public receive_enabled: boolean) { - super(); + constructor( + public send_enabled: boolean, + public receive_enabled: boolean + ) { + super() } public static fromAmino(data: IbcTransferParams.Amino): IbcTransferParams { - const { send_enabled, receive_enabled } = data; - return new IbcTransferParams(send_enabled, receive_enabled); + const { send_enabled, receive_enabled } = data + return new IbcTransferParams(send_enabled, receive_enabled) } public toAmino(): IbcTransferParams.Amino { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return { send_enabled, receive_enabled, - }; + } } public static fromData(data: IbcTransferParams.Data): IbcTransferParams { - const { send_enabled, receive_enabled } = data; - return new IbcTransferParams(send_enabled, receive_enabled); + const { send_enabled, receive_enabled } = data + return new IbcTransferParams(send_enabled, receive_enabled) } public toData(): IbcTransferParams.Data { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return { send_enabled, receive_enabled, - }; + } } public static fromProto(data: IbcTransferParams.Proto): IbcTransferParams { - return new IbcTransferParams(data.sendEnabled, data.receiveEnabled); + return new IbcTransferParams(data.sendEnabled, data.receiveEnabled) } public toProto(): IbcTransferParams.Proto { - const { send_enabled, receive_enabled } = this; + const { send_enabled, receive_enabled } = this return Params_pb.fromPartial({ sendEnabled: send_enabled, receiveEnabled: receive_enabled, - }); + }) } } export namespace IbcTransferParams { export interface Amino { - send_enabled: boolean; - receive_enabled: boolean; + send_enabled: boolean + receive_enabled: boolean } export interface Data { - send_enabled: boolean; - receive_enabled: boolean; + send_enabled: boolean + receive_enabled: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/applications/transfer/authorizations/Allocation.ts b/src/core/ibc/applications/transfer/authorizations/Allocation.ts index 7055cd2..e1c0a54 100644 --- a/src/core/ibc/applications/transfer/authorizations/Allocation.ts +++ b/src/core/ibc/applications/transfer/authorizations/Allocation.ts @@ -1,13 +1,13 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { Coins } from '../../../../Coins'; -import { Allocation as Allocation_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/authz'; +import { JSONSerializable } from '../../../../../util/json' +import { Coins } from '../../../../Coins' +import { Allocation as Allocation_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/authz' export class Allocation extends JSONSerializable< Allocation.Amino, Allocation.Data, Allocation.Proto > { - public spend_limit: Coins; + public spend_limit: Coins /** * @param source_port the port on which the packet will be sent @@ -23,8 +23,8 @@ export class Allocation extends JSONSerializable< public allow_list: string[], public allowed_packet_data: string[] ) { - super(); - this.spend_limit = new Coins(spend_limit); + super() + this.spend_limit = new Coins(spend_limit) } public static fromAmino(data: Allocation.Amino): Allocation { @@ -34,7 +34,7 @@ export class Allocation extends JSONSerializable< spend_limit, allow_list, allowed_packet_data, - } = data; + } = data return new Allocation( source_port, @@ -42,7 +42,7 @@ export class Allocation extends JSONSerializable< Coins.fromAmino(spend_limit), allow_list, allowed_packet_data - ); + ) } public toAmino(): Allocation.Amino { @@ -52,7 +52,7 @@ export class Allocation extends JSONSerializable< spend_limit, allow_list, allowed_packet_data, - } = this; + } = this return { source_port, @@ -60,7 +60,7 @@ export class Allocation extends JSONSerializable< spend_limit: spend_limit.toAmino(), allow_list, allowed_packet_data, - }; + } } public static fromData(data: Allocation.Data): Allocation { @@ -70,7 +70,7 @@ export class Allocation extends JSONSerializable< spend_limit, allow_list, allowed_packet_data, - } = data; + } = data return new Allocation( source_port, @@ -78,7 +78,7 @@ export class Allocation extends JSONSerializable< Coins.fromData(spend_limit), allow_list, allowed_packet_data - ); + ) } public toData(): Allocation.Data { @@ -88,7 +88,7 @@ export class Allocation extends JSONSerializable< spend_limit, allow_list, allowed_packet_data, - } = this; + } = this return { source_port, @@ -96,7 +96,7 @@ export class Allocation extends JSONSerializable< spend_limit: spend_limit.toData(), allow_list, allowed_packet_data, - }; + } } public static fromProto(data: Allocation.Proto): Allocation { @@ -106,7 +106,7 @@ export class Allocation extends JSONSerializable< Coins.fromProto(data.spendLimit), data.allowList, data.allowedPacketData - ); + ) } public toProto(): Allocation.Proto { @@ -116,7 +116,7 @@ export class Allocation extends JSONSerializable< spend_limit, allow_list, allowed_packet_data, - } = this; + } = this return Allocation_pb.fromPartial({ sourcePort: source_port, @@ -124,26 +124,26 @@ export class Allocation extends JSONSerializable< spendLimit: spend_limit.toProto(), allowList: allow_list, allowedPacketData: allowed_packet_data, - }); + }) } } export namespace Allocation { export interface Amino { - source_port: string; - source_channel: string; - spend_limit: Coins.Amino; - allow_list: string[]; - allowed_packet_data: string[]; + source_port: string + source_channel: string + spend_limit: Coins.Amino + allow_list: string[] + allowed_packet_data: string[] } export interface Data { - source_port: string; - source_channel: string; - spend_limit: Coins.Data; - allow_list: string[]; - allowed_packet_data: string[]; + source_port: string + source_channel: string + spend_limit: Coins.Data + allow_list: string[] + allowed_packet_data: string[] } - export type Proto = Allocation_pb; + export type Proto = Allocation_pb } diff --git a/src/core/ibc/applications/transfer/authorizations/TransferAuthorization.ts b/src/core/ibc/applications/transfer/authorizations/TransferAuthorization.ts index 85b0117..e60ea2d 100644 --- a/src/core/ibc/applications/transfer/authorizations/TransferAuthorization.ts +++ b/src/core/ibc/applications/transfer/authorizations/TransferAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { TransferAuthorization as TransferAuthorization_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { Allocation } from './Allocation'; +import { JSONSerializable } from '../../../../../util/json' +import { TransferAuthorization as TransferAuthorization_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { Allocation } from './Allocation' export class TransferAuthorization extends JSONSerializable< any, @@ -9,64 +9,62 @@ export class TransferAuthorization extends JSONSerializable< TransferAuthorization.Proto > { constructor(public allocations: Allocation[]) { - super(); + super() } public static fromAmino(_: any): TransferAuthorization { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: TransferAuthorization.Data ): TransferAuthorization { - return new TransferAuthorization(data.allocations.map(Allocation.fromData)); + return new TransferAuthorization(data.allocations.map(Allocation.fromData)) } public toData(): TransferAuthorization.Data { return { '@type': '/ibc.applications.transfer.v1.TransferAuthorization', - allocations: this.allocations.map(alloc => alloc.toData()), - }; + allocations: this.allocations.map((alloc) => alloc.toData()), + } } public static fromProto( data: TransferAuthorization.Proto ): TransferAuthorization { - return new TransferAuthorization( - data.allocations.map(Allocation.fromProto) - ); + return new TransferAuthorization(data.allocations.map(Allocation.fromProto)) } public toProto(): TransferAuthorization.Proto { return TransferAuthorization_pb.fromPartial({ - allocations: this.allocations.map(alloc => alloc.toProto()), - }); + allocations: this.allocations.map((alloc) => alloc.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.transfer.v1.TransferAuthorization', value: TransferAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): TransferAuthorization { return TransferAuthorization.fromProto( TransferAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace TransferAuthorization { export interface Data { - '@type': '/ibc.applications.transfer.v1.TransferAuthorization'; - allocations: Allocation.Data[]; + '@type': '/ibc.applications.transfer.v1.TransferAuthorization' + allocations: Allocation.Data[] } - export type Proto = TransferAuthorization_pb; + export type Proto = TransferAuthorization_pb } diff --git a/src/core/ibc/applications/transfer/authorizations/index.ts b/src/core/ibc/applications/transfer/authorizations/index.ts index bf6511f..b493654 100644 --- a/src/core/ibc/applications/transfer/authorizations/index.ts +++ b/src/core/ibc/applications/transfer/authorizations/index.ts @@ -1,2 +1,2 @@ -export * from './Allocation'; -export * from './TransferAuthorization'; +export * from './Allocation' +export * from './TransferAuthorization' diff --git a/src/core/ibc/applications/transfer/index.ts b/src/core/ibc/applications/transfer/index.ts index 2364179..3711060 100644 --- a/src/core/ibc/applications/transfer/index.ts +++ b/src/core/ibc/applications/transfer/index.ts @@ -1,4 +1,4 @@ -export * from './authorizations'; -export * from './msgs'; -export * from './DenomTrace'; -export * from './FungibleTokenPacketData'; +export * from './authorizations' +export * from './msgs' +export * from './DenomTrace' +export * from './FungibleTokenPacketData' diff --git a/src/core/ibc/applications/transfer/msgs/MsgTransfer.spec.ts b/src/core/ibc/applications/transfer/msgs/MsgTransfer.spec.ts index 4f131fa..d50af47 100644 --- a/src/core/ibc/applications/transfer/msgs/MsgTransfer.spec.ts +++ b/src/core/ibc/applications/transfer/msgs/MsgTransfer.spec.ts @@ -1,6 +1,6 @@ -import { MsgTransfer } from './MsgTransfer'; -import { Coin } from '../../../../Coin'; -import { Height } from '../../../core/client/Height'; +import { MsgTransfer } from './MsgTransfer' +import { Coin } from '../../../../Coin' +import { Height } from '../../../core/client/Height' describe('MsgTransfer', () => { it('deserializes correctly', () => { @@ -16,7 +16,7 @@ describe('MsgTransfer', () => { revision_height: '0', }, timeout_timestamp: '1642663176848000000', - }); + }) expect(send).toMatchObject({ source_port: 'sourceport-01', @@ -29,8 +29,8 @@ describe('MsgTransfer', () => { revision_height: 0, }, timeout_timestamp: '1642663176848000000', - }); - }); + }) + }) it('deserializes amino without timeout_height', () => { const send = MsgTransfer.fromData({ @@ -42,8 +42,8 @@ describe('MsgTransfer', () => { receiver: 'recvr17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp', timeout_height: new Height(0, 0).toData(), timeout_timestamp: '1642663176848000000', - }); - const aminoSend = send.toAmino(); + }) + const aminoSend = send.toAmino() expect(aminoSend).toMatchObject({ type: 'cosmos-sdk/MsgTransfer', @@ -56,10 +56,10 @@ describe('MsgTransfer', () => { timeout_height: {}, timeout_timestamp: '1642663176848000000', }, - }); + }) - expect(send.toData()).toMatchObject({}); - }); + expect(send.toData()).toMatchObject({}) + }) it('deserializes amino without timeout_timestamp', () => { const send = MsgTransfer.fromData({ @@ -74,8 +74,8 @@ describe('MsgTransfer', () => { revision_height: '57240001', }, timeout_timestamp: '0', - }); - const aminoSend = send.toAmino(); + }) + const aminoSend = send.toAmino() expect(aminoSend).toMatchObject({ type: 'cosmos-sdk/MsgTransfer', @@ -88,8 +88,8 @@ describe('MsgTransfer', () => { timeout_height: new Height(5, 57240001).toAmino(), timeout_timestamp: undefined, }, - }); + }) - expect(send.toData()).toMatchObject({}); - }); -}); + expect(send.toData()).toMatchObject({}) + }) +}) diff --git a/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts b/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts index 12c083c..b1be2c5 100644 --- a/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts +++ b/src/core/ibc/applications/transfer/msgs/MsgTransfer.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Coin } from '../../../../Coin'; -import Long from 'long'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgTransfer as MsgTransfer_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/tx'; -import { Height } from '../../../core/client/Height'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Coin } from '../../../../Coin' +import Long from 'long' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgTransfer as MsgTransfer_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/tx' +import { Height } from '../../../core/client/Height' /** * A basic message for transfer [[Coin]] via IBC. @@ -14,14 +14,14 @@ export class MsgTransfer extends JSONSerializable< MsgTransfer.Data, MsgTransfer.Proto > { - public source_port: string; - public source_channel: string; - public token?: Coin; - public sender: AccAddress; - public receiver: string; // destination chain can be non-cosmos-based - public timeout_height?: Height; // 0 to disable - public timeout_timestamp?: string; // 0 to disable - public memo?: string; + public source_port: string + public source_channel: string + public token?: Coin + public sender: AccAddress + public receiver: string // destination chain can be non-cosmos-based + public timeout_height?: Height // 0 to disable + public timeout_timestamp?: string // 0 to disable + public memo?: string /** * @param source_port the port on which the packet will be sent * @param source_channel the channel by which the packet will be sent @@ -42,22 +42,22 @@ export class MsgTransfer extends JSONSerializable< timeout_timestamp?: string, memo?: string ) { - super(); + super() if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } - this.source_port = source_port; - this.source_channel = source_channel; - this.token = token; - this.sender = sender; - this.receiver = receiver; - this.timeout_height = timeout_height; - this.timeout_timestamp = timeout_timestamp; - this.memo = memo; + this.source_port = source_port + this.source_channel = source_channel + this.token = token + this.sender = sender + this.receiver = receiver + this.timeout_height = timeout_height + this.timeout_timestamp = timeout_timestamp + this.memo = memo } public static fromAmino(data: MsgTransfer.Amino): MsgTransfer { @@ -72,12 +72,12 @@ export class MsgTransfer extends JSONSerializable< timeout_timestamp, memo, }, - } = data; + } = data if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } return new MsgTransfer( @@ -89,7 +89,7 @@ export class MsgTransfer extends JSONSerializable< timeout_height ? Height.fromAmino(timeout_height) : undefined, timeout_timestamp, memo - ); + ) } public toAmino(): MsgTransfer.Amino { @@ -102,7 +102,7 @@ export class MsgTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return { type: 'cosmos-sdk/MsgTransfer', value: { @@ -115,7 +115,7 @@ export class MsgTransfer extends JSONSerializable< timeout_timestamp, memo, }, - }; + } } public static fromData(data: MsgTransfer.Data): MsgTransfer { @@ -128,12 +128,12 @@ export class MsgTransfer extends JSONSerializable< timeout_timestamp, timeout_height, memo, - } = data; + } = data if (!timeout_height && !timeout_timestamp) { throw new Error( 'both of timeout_height and timeout_timestamp are undefined' - ); + ) } return new MsgTransfer( @@ -145,7 +145,7 @@ export class MsgTransfer extends JSONSerializable< timeout_height ? Height.fromData(timeout_height) : undefined, timeout_timestamp === '0' ? undefined : timeout_timestamp, memo - ); + ) } public toData(): MsgTransfer.Data { @@ -158,7 +158,7 @@ export class MsgTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return { '@type': '/ibc.applications.transfer.v1.MsgTransfer', source_port, @@ -171,12 +171,12 @@ export class MsgTransfer extends JSONSerializable< : new Height(0, 0).toData(), timeout_timestamp: timeout_timestamp ?? '0', memo, - }; + } } public static fromProto(proto: MsgTransfer.Proto): MsgTransfer { if (!proto.timeoutHeight && proto.timeoutTimestamp.toNumber() == 0) { - throw new Error('both of timeout_height and timeout_timestamp are empty'); + throw new Error('both of timeout_height and timeout_timestamp are empty') } return new MsgTransfer( @@ -188,7 +188,7 @@ export class MsgTransfer extends JSONSerializable< proto.timeoutHeight ? Height.fromProto(proto.timeoutHeight) : undefined, proto.timeoutTimestamp.toString(), proto.memo - ); + ) } public toProto(): MsgTransfer.Proto { @@ -201,7 +201,7 @@ export class MsgTransfer extends JSONSerializable< timeout_height, timeout_timestamp, memo, - } = this; + } = this return MsgTransfer_pb.fromPartial({ sourcePort: source_port, sourceChannel: source_channel, @@ -211,45 +211,45 @@ export class MsgTransfer extends JSONSerializable< timeoutHeight: timeout_height?.toProto(), timeoutTimestamp: Long.fromString(timeout_timestamp ?? '0'), memo, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', value: MsgTransfer_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgTransfer { - return MsgTransfer.fromProto(MsgTransfer_pb.decode(msgAny.value)); + return MsgTransfer.fromProto(MsgTransfer_pb.decode(msgAny.value)) } } export namespace MsgTransfer { export interface Amino { - type: 'cosmos-sdk/MsgTransfer'; + type: 'cosmos-sdk/MsgTransfer' value: { - source_port: string; - source_channel: string; - token?: Coin.Amino; - sender: AccAddress; - receiver: string; - timeout_height: Height.Amino; - timeout_timestamp?: string; - memo?: string; - }; + source_port: string + source_channel: string + token?: Coin.Amino + sender: AccAddress + receiver: string + timeout_height: Height.Amino + timeout_timestamp?: string + memo?: string + } } export interface Data { - '@type': '/ibc.applications.transfer.v1.MsgTransfer'; - source_port: string; - source_channel: string; - token?: Coin.Data; - sender: AccAddress; - receiver: string; - timeout_height: Height.Data; - timeout_timestamp: string; - memo?: string; + '@type': '/ibc.applications.transfer.v1.MsgTransfer' + source_port: string + source_channel: string + token?: Coin.Data + sender: AccAddress + receiver: string + timeout_height: Height.Data + timeout_timestamp: string + memo?: string } - export type Proto = MsgTransfer_pb; + export type Proto = MsgTransfer_pb } diff --git a/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts b/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts index fcc5985..f0066bc 100644 --- a/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts +++ b/src/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { IbcTransferParams } from '../IbcTransferParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { IbcTransferParams } from '../IbcTransferParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/applications/transfer/v1/tx' export class MsgUpdateIbcTransferParams extends JSONSerializable< any, @@ -13,36 +13,39 @@ export class MsgUpdateIbcTransferParams extends JSONSerializable< * @param signer the address that controls the module * @param params params defines the parameters to update */ - constructor(public signer: AccAddress, public params: IbcTransferParams) { - super(); + constructor( + public signer: AccAddress, + public params: IbcTransferParams + ) { + super() } public static fromAmino(_: any): MsgUpdateIbcTransferParams { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgUpdateIbcTransferParams.Data ): MsgUpdateIbcTransferParams { - const { signer, params } = data; + const { signer, params } = data return new MsgUpdateIbcTransferParams( signer, IbcTransferParams.fromData(params) - ); + ) } public toData(): MsgUpdateIbcTransferParams.Data { - const { signer, params } = this; + const { signer, params } = this return { '@type': '/ibc.applications.transfer.v1.MsgUpdateParams', signer, params: params.toData(), - }; + } } public static fromProto( @@ -51,37 +54,37 @@ export class MsgUpdateIbcTransferParams extends JSONSerializable< return new MsgUpdateIbcTransferParams( data.signer, IbcTransferParams.fromProto(data.params as IbcTransferParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcTransferParams.Proto { - const { signer, params } = this; + const { signer, params } = this return MsgUpdateParams_pb.fromPartial({ signer, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.applications.transfer.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcTransferParams { return MsgUpdateIbcTransferParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcTransferParams { export interface Data { - '@type': '/ibc.applications.transfer.v1.MsgUpdateParams'; - signer: AccAddress; - params: IbcTransferParams.Data; + '@type': '/ibc.applications.transfer.v1.MsgUpdateParams' + signer: AccAddress + params: IbcTransferParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibc/applications/transfer/msgs/index.ts b/src/core/ibc/applications/transfer/msgs/index.ts index 6d2bb9f..f60aa26 100644 --- a/src/core/ibc/applications/transfer/msgs/index.ts +++ b/src/core/ibc/applications/transfer/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgTransfer } from './MsgTransfer'; -import { MsgUpdateIbcTransferParams } from './MsgUpdateIbcTransferParams'; +import { MsgTransfer } from './MsgTransfer' +import { MsgUpdateIbcTransferParams } from './MsgUpdateIbcTransferParams' -export * from './MsgTransfer'; -export * from './MsgUpdateIbcTransferParams'; +export * from './MsgTransfer' +export * from './MsgUpdateIbcTransferParams' -export type IbcTransferMsg = MsgTransfer | MsgUpdateIbcTransferParams; +export type IbcTransferMsg = MsgTransfer | MsgUpdateIbcTransferParams export namespace IbcTransferMsg { - export type Amino = MsgTransfer.Amino; - export type Data = MsgTransfer.Data | MsgUpdateIbcTransferParams.Data; - export type Proto = MsgTransfer.Proto | MsgUpdateIbcTransferParams.Proto; + export type Amino = MsgTransfer.Amino + export type Data = MsgTransfer.Data | MsgUpdateIbcTransferParams.Data + export type Proto = MsgTransfer.Proto | MsgUpdateIbcTransferParams.Proto } diff --git a/src/core/ibc/core/channel/Channel.ts b/src/core/ibc/core/channel/Channel.ts index e1be264..4c76d9f 100644 --- a/src/core/ibc/core/channel/Channel.ts +++ b/src/core/ibc/core/channel/Channel.ts @@ -2,9 +2,9 @@ import { State, Order, Channel as Channel_pb, -} from '@initia/initia.proto/ibc/core/channel/v1/channel'; -import { JSONSerializable } from '../../../../util/json'; -import { ChannelCounterparty } from './ChannelCounterparty'; +} from '@initia/initia.proto/ibc/core/channel/v1/channel' +import { JSONSerializable } from '../../../../util/json' +import { ChannelCounterparty } from './ChannelCounterparty' /** * Channel is a monotonically increasing data type @@ -37,53 +37,53 @@ export class Channel extends JSONSerializable< public connection_hops: string[], public version: string ) { - super(); + super() } public static fromAmino(data: Channel.Amino): Channel { - const { state, ordering, counterparty, connection_hops, version } = data; + const { state, ordering, counterparty, connection_hops, version } = data return new Channel( state, ordering, counterparty ? ChannelCounterparty.fromAmino(counterparty) : undefined, connection_hops, version - ); + ) } public toAmino(): Channel.Amino { - const { state, ordering, counterparty, connection_hops, version } = this; + const { state, ordering, counterparty, connection_hops, version } = this const res: Channel.Amino = { state, ordering, counterparty: counterparty?.toAmino(), connection_hops, version, - }; - return res; + } + return res } public static fromData(data: Channel.Data): Channel { - const { state, ordering, counterparty, connection_hops, version } = data; + const { state, ordering, counterparty, connection_hops, version } = data return new Channel( state, ordering, counterparty ? ChannelCounterparty.fromData(counterparty) : undefined, connection_hops, version - ); + ) } public toData(): Channel.Data { - const { state, ordering, counterparty, connection_hops, version } = this; + const { state, ordering, counterparty, connection_hops, version } = this const res: Channel.Data = { state, ordering, counterparty: counterparty?.toData(), connection_hops, version, - }; - return res; + } + return res } public static fromProto(proto: Channel.Proto): Channel { @@ -95,37 +95,37 @@ export class Channel extends JSONSerializable< : undefined, proto.connectionHops, proto.version - ); + ) } public toProto(): Channel.Proto { - const { state, ordering, counterparty, connection_hops, version } = this; + const { state, ordering, counterparty, connection_hops, version } = this return Channel_pb.fromPartial({ state, ordering, counterparty: counterparty?.toProto(), connectionHops: connection_hops, version, - }); + }) } } export namespace Channel { export interface Amino { - state: State; - ordering: Order; - counterparty?: ChannelCounterparty.Amino; - connection_hops: string[]; - version: string; + state: State + ordering: Order + counterparty?: ChannelCounterparty.Amino + connection_hops: string[] + version: string } export interface Data { - state: State; - ordering: Order; - counterparty?: ChannelCounterparty.Data; - connection_hops: string[]; - version: string; + state: State + ordering: Order + counterparty?: ChannelCounterparty.Data + connection_hops: string[] + version: string } - export type Proto = Channel_pb; + export type Proto = Channel_pb } diff --git a/src/core/ibc/core/channel/ChannelCounterparty.ts b/src/core/ibc/core/channel/ChannelCounterparty.ts index 5c1e1e2..4fd1c0c 100644 --- a/src/core/ibc/core/channel/ChannelCounterparty.ts +++ b/src/core/ibc/core/channel/ChannelCounterparty.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Counterparty as Counterparty_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel'; +import { JSONSerializable } from '../../../../util/json' +import { Counterparty as Counterparty_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel' /** ChannelCounterparty defines a channel end ChannelCounterparty */ export class ChannelCounterparty extends JSONSerializable< @@ -11,65 +11,68 @@ export class ChannelCounterparty extends JSONSerializable< * @param port_id port on the ChannelCounterparty chain which owns the other end of the channel. * @param channel_id channel end on the ChannelCounterparty chain */ - constructor(public port_id: string, public channel_id: string) { - super(); + constructor( + public port_id: string, + public channel_id: string + ) { + super() } public static fromAmino( data: ChannelCounterparty.Amino ): ChannelCounterparty { - const { port_id, channel_id } = data; - return new ChannelCounterparty(port_id, channel_id); + const { port_id, channel_id } = data + return new ChannelCounterparty(port_id, channel_id) } public toAmino(): ChannelCounterparty.Amino { - const { port_id, channel_id } = this; + const { port_id, channel_id } = this const res: ChannelCounterparty.Amino = { port_id, channel_id, - }; - return res; + } + return res } public static fromData(data: ChannelCounterparty.Data): ChannelCounterparty { - const { port_id, channel_id } = data; - return new ChannelCounterparty(port_id, channel_id); + const { port_id, channel_id } = data + return new ChannelCounterparty(port_id, channel_id) } public toData(): ChannelCounterparty.Data { - const { port_id, channel_id } = this; + const { port_id, channel_id } = this const res: ChannelCounterparty.Data = { port_id, channel_id, - }; - return res; + } + return res } public static fromProto( proto: ChannelCounterparty.Proto ): ChannelCounterparty { - return new ChannelCounterparty(proto.portId, proto.channelId); + return new ChannelCounterparty(proto.portId, proto.channelId) } public toProto(): ChannelCounterparty.Proto { - const { port_id, channel_id } = this; + const { port_id, channel_id } = this return Counterparty_pb.fromPartial({ portId: port_id, channelId: channel_id, - }); + }) } } export namespace ChannelCounterparty { export interface Amino { - port_id: string; - channel_id: string; + port_id: string + channel_id: string } export interface Data { - port_id: string; - channel_id: string; + port_id: string + channel_id: string } - export type Proto = Counterparty_pb; + export type Proto = Counterparty_pb } diff --git a/src/core/ibc/core/channel/IbcChannelParams.ts b/src/core/ibc/core/channel/IbcChannelParams.ts index 6d17c5d..178c591 100644 --- a/src/core/ibc/core/channel/IbcChannelParams.ts +++ b/src/core/ibc/core/channel/IbcChannelParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel'; -import { Timeout } from './Timeout'; +import { JSONSerializable } from '../../../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel' +import { Timeout } from './Timeout' export class IbcChannelParams extends JSONSerializable< IbcChannelParams.Amino, @@ -11,50 +11,50 @@ export class IbcChannelParams extends JSONSerializable< * @param upgrade_timeout the relative timeout after which channel upgrades will time out */ constructor(public upgrade_timeout: Timeout) { - super(); + super() } public static fromAmino(data: IbcChannelParams.Amino): IbcChannelParams { - return new IbcChannelParams(Timeout.fromAmino(data.upgrade_timeout)); + return new IbcChannelParams(Timeout.fromAmino(data.upgrade_timeout)) } public toAmino(): IbcChannelParams.Amino { return { upgrade_timeout: this.upgrade_timeout.toAmino(), - }; + } } public static fromData(data: IbcChannelParams.Data): IbcChannelParams { - return new IbcChannelParams(Timeout.fromData(data.upgrade_timeout)); + return new IbcChannelParams(Timeout.fromData(data.upgrade_timeout)) } public toData(): IbcChannelParams.Data { return { upgrade_timeout: this.upgrade_timeout.toData(), - }; + } } public static fromProto(data: IbcChannelParams.Proto): IbcChannelParams { return new IbcChannelParams( Timeout.fromProto(data.upgradeTimeout as Timeout.Proto) - ); + ) } public toProto(): IbcChannelParams.Proto { return Params_pb.fromPartial({ upgradeTimeout: this.upgrade_timeout.toProto(), - }); + }) } } export namespace IbcChannelParams { export interface Amino { - upgrade_timeout: Timeout.Amino; + upgrade_timeout: Timeout.Amino } export interface Data { - upgrade_timeout: Timeout.Data; + upgrade_timeout: Timeout.Data } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/core/channel/Packet.ts b/src/core/ibc/core/channel/Packet.ts index ff8fb6e..52c1a5f 100644 --- a/src/core/ibc/core/channel/Packet.ts +++ b/src/core/ibc/core/channel/Packet.ts @@ -1,7 +1,7 @@ -import { Packet as Packet_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel'; -import Long from 'long'; -import { JSONSerializable } from '../../../../util/json'; -import { Height } from '../client/Height'; +import { Packet as Packet_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel' +import Long from 'long' +import { JSONSerializable } from '../../../../util/json' +import { Height } from '../client/Height' /** Packet defines a type that carries data across different chains through IBC */ export class Packet extends JSONSerializable< @@ -23,7 +23,7 @@ export class Packet extends JSONSerializable< public timeout_height: Height | undefined, public timeout_timestamp: string ) { - super(); + super() } public static fromAmino(_data: Packet.Amino): Packet { @@ -36,7 +36,7 @@ export class Packet extends JSONSerializable< data, timeout_height, timeout_timestamp, - } = _data; + } = _data return new Packet( sequence, source_port, @@ -46,7 +46,7 @@ export class Packet extends JSONSerializable< data, timeout_height ? Height.fromAmino(timeout_height) : undefined, timeout_timestamp - ); + ) } public toAmino(): Packet.Amino { @@ -59,7 +59,7 @@ export class Packet extends JSONSerializable< data, timeout_height, timeout_timestamp, - } = this; + } = this const res: Packet.Amino = { sequence, source_port, @@ -69,8 +69,8 @@ export class Packet extends JSONSerializable< data, timeout_height: timeout_height?.toAmino(), timeout_timestamp, - }; - return res; + } + return res } public static fromData(_data: Packet.Data): Packet { @@ -83,7 +83,7 @@ export class Packet extends JSONSerializable< data, timeout_height, timeout_timestamp, - } = _data; + } = _data return new Packet( sequence, source_port, @@ -93,7 +93,7 @@ export class Packet extends JSONSerializable< data, timeout_height ? Height.fromData(timeout_height) : undefined, timeout_timestamp - ); + ) } public toData(): Packet.Data { @@ -106,7 +106,7 @@ export class Packet extends JSONSerializable< data, timeout_height, timeout_timestamp, - } = this; + } = this const res: Packet.Data = { sequence, source_port, @@ -116,8 +116,8 @@ export class Packet extends JSONSerializable< data, timeout_height: timeout_height?.toData(), timeout_timestamp: timeout_timestamp, - }; - return res; + } + return res } public static fromProto(proto: Packet.Proto): Packet { @@ -130,7 +130,7 @@ export class Packet extends JSONSerializable< Buffer.from(proto.data).toString('base64'), proto.timeoutHeight ? Height.fromProto(proto.timeoutHeight) : undefined, proto.timeoutTimestamp.toString() - ); + ) } public toProto(): Packet.Proto { @@ -143,7 +143,7 @@ export class Packet extends JSONSerializable< data, timeout_height, timeout_timestamp, - } = this; + } = this return Packet_pb.fromPartial({ sequence: Long.fromNumber(sequence), sourcePort: source_port, @@ -153,32 +153,32 @@ export class Packet extends JSONSerializable< data: Buffer.from(data, 'base64'), timeoutHeight: timeout_height?.toProto(), timeoutTimestamp: Long.fromString(timeout_timestamp), - }); + }) } } export namespace Packet { export interface Amino { - sequence: number; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: string; - timeout_height?: Height.Amino; - timeout_timestamp: string; + sequence: number + source_port: string + source_channel: string + destination_port: string + destination_channel: string + data: string + timeout_height?: Height.Amino + timeout_timestamp: string } export interface Data { - sequence: number; - source_port: string; - source_channel: string; - destination_port: string; - destination_channel: string; - data: string; - timeout_height?: Height.Data; - timeout_timestamp: string; + sequence: number + source_port: string + source_channel: string + destination_port: string + destination_channel: string + data: string + timeout_height?: Height.Data + timeout_timestamp: string } - export type Proto = Packet_pb; + export type Proto = Packet_pb } diff --git a/src/core/ibc/core/channel/PacketId.ts b/src/core/ibc/core/channel/PacketId.ts index caded57..638ec8a 100644 --- a/src/core/ibc/core/channel/PacketId.ts +++ b/src/core/ibc/core/channel/PacketId.ts @@ -1,6 +1,6 @@ -import { PacketId as PacketId_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel'; -import { JSONSerializable } from '../../../../util/json'; -import Long from 'long'; +import { PacketId as PacketId_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel' +import { JSONSerializable } from '../../../../util/json' +import Long from 'long' /** * PacketId is an identifer for a unique Packet @@ -22,37 +22,37 @@ export class PacketId extends JSONSerializable< public channel_id: string, public sequence: number ) { - super(); + super() } public static fromAmino(data: PacketId.Amino): PacketId { - const { port_id, channel_id, sequence } = data; - return new PacketId(port_id, channel_id, Number.parseInt(sequence)); + const { port_id, channel_id, sequence } = data + return new PacketId(port_id, channel_id, Number.parseInt(sequence)) } public toAmino(): PacketId.Amino { - const { port_id, channel_id, sequence } = this; + const { port_id, channel_id, sequence } = this const res: PacketId.Amino = { port_id, channel_id, sequence: sequence.toFixed(), - }; - return res; + } + return res } public static fromData(data: PacketId.Data): PacketId { - const { port_id, channel_id, sequence } = data; - return new PacketId(port_id, channel_id, Number.parseInt(sequence)); + const { port_id, channel_id, sequence } = data + return new PacketId(port_id, channel_id, Number.parseInt(sequence)) } public toData(): PacketId.Data { - const { port_id, channel_id, sequence } = this; + const { port_id, channel_id, sequence } = this const res: PacketId.Data = { port_id, channel_id, sequence: sequence.toFixed(), - }; - return res; + } + return res } public static fromProto(proto: PacketId.Proto): PacketId { @@ -60,31 +60,31 @@ export class PacketId extends JSONSerializable< proto.portId, proto.channelId, proto.sequence.toNumber() - ); + ) } public toProto(): PacketId.Proto { - const { port_id, channel_id, sequence } = this; + const { port_id, channel_id, sequence } = this return PacketId_pb.fromPartial({ portId: port_id, channelId: channel_id, sequence: Long.fromNumber(sequence), - }); + }) } } export namespace PacketId { export interface Amino { - port_id: string; - channel_id: string; - sequence: string; + port_id: string + channel_id: string + sequence: string } export interface Data { - port_id: string; - channel_id: string; - sequence: string; + port_id: string + channel_id: string + sequence: string } - export type Proto = PacketId_pb; + export type Proto = PacketId_pb } diff --git a/src/core/ibc/core/channel/Timeout.ts b/src/core/ibc/core/channel/Timeout.ts index e4c11eb..391b1b8 100644 --- a/src/core/ibc/core/channel/Timeout.ts +++ b/src/core/ibc/core/channel/Timeout.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Timeout as Timeout_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel'; -import { Height } from '../client'; -import Long from 'long'; +import { JSONSerializable } from '../../../../util/json' +import { Timeout as Timeout_pb } from '@initia/initia.proto/ibc/core/channel/v1/channel' +import { Height } from '../client' +import Long from 'long' export class Timeout extends JSONSerializable< Timeout.Amino, @@ -12,62 +12,65 @@ export class Timeout extends JSONSerializable< * @param height block height after which the packet or upgrade times out * @param timestamp block timestamp (in nanoseconds) after which the packet or upgrade times out */ - constructor(public height: Height, public timestamp: number) { - super(); + constructor( + public height: Height, + public timestamp: number + ) { + super() } public static fromAmino(data: Timeout.Amino): Timeout { - const { height, timestamp } = data; - return new Timeout(Height.fromAmino(height), Number.parseInt(timestamp)); + const { height, timestamp } = data + return new Timeout(Height.fromAmino(height), Number.parseInt(timestamp)) } public toAmino(): Timeout.Amino { - const { height, timestamp } = this; + const { height, timestamp } = this return { height: height.toAmino(), timestamp: timestamp.toString(), - }; + } } public static fromData(data: Timeout.Data): Timeout { - const { height, timestamp } = data; - return new Timeout(Height.fromData(height), Number.parseInt(timestamp)); + const { height, timestamp } = data + return new Timeout(Height.fromData(height), Number.parseInt(timestamp)) } public toData(): Timeout.Data { - const { height, timestamp } = this; + const { height, timestamp } = this return { height: height.toData(), timestamp: timestamp.toString(), - }; + } } public static fromProto(proto: Timeout.Proto): Timeout { return new Timeout( Height.fromProto(proto.height as Height.Proto), proto.timestamp.toNumber() - ); + ) } public toProto(): Timeout.Proto { - const { height, timestamp } = this; + const { height, timestamp } = this return Timeout_pb.fromPartial({ height: height.toProto(), timestamp: Long.fromNumber(timestamp), - }); + }) } } export namespace Timeout { export interface Amino { - height: Height.Amino; - timestamp: string; + height: Height.Amino + timestamp: string } export interface Data { - height: Height.Data; - timestamp: string; + height: Height.Data + timestamp: string } - export type Proto = Timeout_pb; + export type Proto = Timeout_pb } diff --git a/src/core/ibc/core/channel/index.ts b/src/core/ibc/core/channel/index.ts index 48fcdf4..94511bc 100644 --- a/src/core/ibc/core/channel/index.ts +++ b/src/core/ibc/core/channel/index.ts @@ -1,7 +1,7 @@ -export * from './msgs'; -export * from './Channel'; -export * from './ChannelCounterparty'; -export * from './IbcChannelParams'; -export * from './Packet'; -export * from './PacketId'; -export * from './Timeout'; +export * from './msgs' +export * from './Channel' +export * from './ChannelCounterparty' +export * from './IbcChannelParams' +export * from './Packet' +export * from './PacketId' +export * from './Timeout' diff --git a/src/core/ibc/core/channel/msgs/MsgChannelCloseConfirm.ts b/src/core/ibc/core/channel/msgs/MsgChannelCloseConfirm.ts index 31b3436..39cb064 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelCloseConfirm.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelCloseConfirm.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelCloseConfirm as MsgChannelCloseConfirm_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Height } from '../../client'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelCloseConfirm as MsgChannelCloseConfirm_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Height } from '../../client' /** * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B to acknowledge the change of channel state to CLOSED on Chain A. @@ -26,33 +26,33 @@ export class MsgChannelCloseConfirm extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelCloseConfirm { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgChannelCloseConfirm.Data ): MsgChannelCloseConfirm { - const { port_id, channel_id, proof_init, proof_height, signer } = data; + const { port_id, channel_id, proof_init, proof_height, signer } = data return new MsgChannelCloseConfirm( port_id, channel_id, proof_init, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgChannelCloseConfirm.Data { - const { port_id, channel_id, proof_init, proof_height, signer } = this; + const { port_id, channel_id, proof_init, proof_height, signer } = this return { '@type': '/ibc.core.channel.v1.MsgChannelCloseConfirm', port_id, @@ -60,7 +60,7 @@ export class MsgChannelCloseConfirm extends JSONSerializable< proof_init, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto( @@ -72,42 +72,42 @@ export class MsgChannelCloseConfirm extends JSONSerializable< Buffer.from(proto.proofInit).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgChannelCloseConfirm.Proto { - const { port_id, channel_id, proof_init, proof_height, signer } = this; + const { port_id, channel_id, proof_init, proof_height, signer } = this return MsgChannelCloseConfirm_pb.fromPartial({ portId: port_id, channelId: channel_id, proofInit: Buffer.from(proof_init, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelCloseConfirm', value: MsgChannelCloseConfirm_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelCloseConfirm { return MsgChannelCloseConfirm.fromProto( MsgChannelCloseConfirm_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelCloseConfirm { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelCloseConfirm'; - port_id: string; - channel_id: string; - proof_init: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelCloseConfirm' + port_id: string + channel_id: string + proof_init: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgChannelCloseConfirm_pb; + export type Proto = MsgChannelCloseConfirm_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgChannelCloseInit.ts b/src/core/ibc/core/channel/msgs/MsgChannelCloseInit.ts index d79cb47..12ab275 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelCloseInit.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelCloseInit.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelCloseInit as MsgChannelCloseInit_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelCloseInit as MsgChannelCloseInit_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' /** * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A to close a channel with Chain B. @@ -21,68 +21,68 @@ export class MsgChannelCloseInit extends JSONSerializable< public channel_id: string, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelCloseInit { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgChannelCloseInit.Data): MsgChannelCloseInit { - const { port_id, channel_id, signer } = data; - return new MsgChannelCloseInit(port_id, channel_id, signer); + const { port_id, channel_id, signer } = data + return new MsgChannelCloseInit(port_id, channel_id, signer) } public toData(): MsgChannelCloseInit.Data { - const { port_id, channel_id, signer } = this; + const { port_id, channel_id, signer } = this return { '@type': '/ibc.core.channel.v1.MsgChannelCloseInit', port_id, channel_id, signer, - }; + } } public static fromProto( proto: MsgChannelCloseInit.Proto ): MsgChannelCloseInit { - return new MsgChannelCloseInit(proto.portId, proto.channelId, proto.signer); + return new MsgChannelCloseInit(proto.portId, proto.channelId, proto.signer) } public toProto(): MsgChannelCloseInit.Proto { - const { port_id, channel_id, signer } = this; + const { port_id, channel_id, signer } = this return MsgChannelCloseInit_pb.fromPartial({ portId: port_id, channelId: channel_id, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelCloseInit', value: MsgChannelCloseInit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelCloseInit { return MsgChannelCloseInit.fromProto( MsgChannelCloseInit_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelCloseInit { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelCloseInit'; - port_id: string; - channel_id: string; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelCloseInit' + port_id: string + channel_id: string + signer: AccAddress } - export type Proto = MsgChannelCloseInit_pb; + export type Proto = MsgChannelCloseInit_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgChannelOpenAck.ts b/src/core/ibc/core/channel/msgs/MsgChannelOpenAck.ts index 5b9503a..a9ac232 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelOpenAck.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelOpenAck.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelOpenAck as MsgChannelOpenAck_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Height } from '../../client'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelOpenAck as MsgChannelOpenAck_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Height } from '../../client' /** * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge the change of channel state to TRYOPEN on Chain B. @@ -30,16 +30,16 @@ export class MsgChannelOpenAck extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelOpenAck { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgChannelOpenAck.Data): MsgChannelOpenAck { @@ -51,7 +51,7 @@ export class MsgChannelOpenAck extends JSONSerializable< proof_try, proof_height, signer, - } = data; + } = data return new MsgChannelOpenAck( port_id, channel_id, @@ -60,7 +60,7 @@ export class MsgChannelOpenAck extends JSONSerializable< proof_try, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgChannelOpenAck.Data { @@ -72,7 +72,7 @@ export class MsgChannelOpenAck extends JSONSerializable< proof_try, proof_height, signer, - } = this; + } = this return { '@type': '/ibc.core.channel.v1.MsgChannelOpenAck', port_id, @@ -82,7 +82,7 @@ export class MsgChannelOpenAck extends JSONSerializable< proof_try, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto(proto: MsgChannelOpenAck.Proto): MsgChannelOpenAck { @@ -94,7 +94,7 @@ export class MsgChannelOpenAck extends JSONSerializable< Buffer.from(proto.proofTry).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgChannelOpenAck.Proto { @@ -106,7 +106,7 @@ export class MsgChannelOpenAck extends JSONSerializable< proof_try, proof_height, signer, - } = this; + } = this return MsgChannelOpenAck_pb.fromPartial({ portId: port_id, channelId: channel_id, @@ -115,33 +115,33 @@ export class MsgChannelOpenAck extends JSONSerializable< proofTry: Buffer.from(proof_try, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelOpenAck', value: MsgChannelOpenAck_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelOpenAck { return MsgChannelOpenAck.fromProto( MsgChannelOpenAck_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelOpenAck { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelOpenAck'; - port_id: string; - channel_id: string; - counterparty_channel_id: string; - counterparty_version: string; - proof_try: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelOpenAck' + port_id: string + channel_id: string + counterparty_channel_id: string + counterparty_version: string + proof_try: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgChannelOpenAck_pb; + export type Proto = MsgChannelOpenAck_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgChannelOpenConfirm.ts b/src/core/ibc/core/channel/msgs/MsgChannelOpenConfirm.ts index bf31e2b..13b0cf2 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelOpenConfirm.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelOpenConfirm.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelOpenConfirm as MsgChannelOpenConfirm_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Height } from '../../client'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelOpenConfirm as MsgChannelOpenConfirm_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Height } from '../../client' /** * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to acknowledge the change of channel state to OPEN on Chain A. @@ -26,33 +26,33 @@ export class MsgChannelOpenConfirm extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelOpenConfirm { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgChannelOpenConfirm.Data ): MsgChannelOpenConfirm { - const { port_id, channel_id, proof_ack, proof_height, signer } = data; + const { port_id, channel_id, proof_ack, proof_height, signer } = data return new MsgChannelOpenConfirm( port_id, channel_id, proof_ack, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgChannelOpenConfirm.Data { - const { port_id, channel_id, proof_ack, proof_height, signer } = this; + const { port_id, channel_id, proof_ack, proof_height, signer } = this return { '@type': '/ibc.core.channel.v1.MsgChannelOpenConfirm', port_id, @@ -60,7 +60,7 @@ export class MsgChannelOpenConfirm extends JSONSerializable< proof_ack, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto( @@ -72,42 +72,42 @@ export class MsgChannelOpenConfirm extends JSONSerializable< Buffer.from(proto.proofAck).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgChannelOpenConfirm.Proto { - const { port_id, channel_id, proof_ack, proof_height, signer } = this; + const { port_id, channel_id, proof_ack, proof_height, signer } = this return MsgChannelOpenConfirm_pb.fromPartial({ portId: port_id, channelId: channel_id, proofAck: Buffer.from(proof_ack, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelOpenConfirm', value: MsgChannelOpenConfirm_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelOpenConfirm { return MsgChannelOpenConfirm.fromProto( MsgChannelOpenConfirm_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelOpenConfirm { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelOpenConfirm'; - port_id: string; - channel_id: string; - proof_ack: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelOpenConfirm' + port_id: string + channel_id: string + proof_ack: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgChannelOpenConfirm_pb; + export type Proto = MsgChannelOpenConfirm_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgChannelOpenInit.ts b/src/core/ibc/core/channel/msgs/MsgChannelOpenInit.ts index a495b00..866550b 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelOpenInit.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelOpenInit.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelOpenInit as MsgChannelOpenInit_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Channel } from '../Channel'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelOpenInit as MsgChannelOpenInit_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Channel } from '../Channel' /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It is called by a relayer on Chain A. @@ -22,35 +22,35 @@ export class MsgChannelOpenInit extends JSONSerializable< public channel: Channel | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelOpenInit { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgChannelOpenInit.Data): MsgChannelOpenInit { - const { port_id, channel, signer } = data; + const { port_id, channel, signer } = data return new MsgChannelOpenInit( port_id, channel ? Channel.fromData(channel) : undefined, signer - ); + ) } public toData(): MsgChannelOpenInit.Data { - const { port_id, channel, signer } = this; + const { port_id, channel, signer } = this return { '@type': '/ibc.core.channel.v1.MsgChannelOpenInit', port_id, channel: channel?.toData(), signer, - }; + } } public static fromProto(proto: MsgChannelOpenInit.Proto): MsgChannelOpenInit { @@ -58,38 +58,38 @@ export class MsgChannelOpenInit extends JSONSerializable< proto.portId, proto.channel ? Channel.fromProto(proto.channel) : undefined, proto.signer - ); + ) } public toProto(): MsgChannelOpenInit.Proto { - const { port_id, channel, signer } = this; + const { port_id, channel, signer } = this return MsgChannelOpenInit_pb.fromPartial({ portId: port_id, channel: channel?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelOpenInit', value: MsgChannelOpenInit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelOpenInit { return MsgChannelOpenInit.fromProto( MsgChannelOpenInit_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelOpenInit { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelOpenInit'; - port_id: string; - channel?: Channel.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelOpenInit' + port_id: string + channel?: Channel.Data + signer: AccAddress } - export type Proto = MsgChannelOpenInit_pb; + export type Proto = MsgChannelOpenInit_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgChannelOpenTry.ts b/src/core/ibc/core/channel/msgs/MsgChannelOpenTry.ts index d2dfb50..3788ba4 100644 --- a/src/core/ibc/core/channel/msgs/MsgChannelOpenTry.ts +++ b/src/core/ibc/core/channel/msgs/MsgChannelOpenTry.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChannelOpenTry as MsgChannelOpenTry_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Channel, Height } from '../../../core'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChannelOpenTry as MsgChannelOpenTry_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Channel, Height } from '../../../core' /** * MsgChannelOpenTry defines a msg sent by a Relayer to try to open a channel on Chain B @@ -30,16 +30,16 @@ export class MsgChannelOpenTry extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgChannelOpenTry { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgChannelOpenTry.Data): MsgChannelOpenTry { @@ -51,7 +51,7 @@ export class MsgChannelOpenTry extends JSONSerializable< proof_init, proof_height, signer, - } = data; + } = data return new MsgChannelOpenTry( port_id, previous_channel_id, @@ -60,7 +60,7 @@ export class MsgChannelOpenTry extends JSONSerializable< proof_init, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgChannelOpenTry.Data { @@ -72,7 +72,7 @@ export class MsgChannelOpenTry extends JSONSerializable< proof_init, proof_height, signer, - } = this; + } = this return { '@type': '/ibc.core.channel.v1.MsgChannelOpenTry', port_id, @@ -82,7 +82,7 @@ export class MsgChannelOpenTry extends JSONSerializable< proof_init, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto(proto: MsgChannelOpenTry.Proto): MsgChannelOpenTry { @@ -94,7 +94,7 @@ export class MsgChannelOpenTry extends JSONSerializable< Buffer.from(proto.proofInit).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgChannelOpenTry.Proto { @@ -106,7 +106,7 @@ export class MsgChannelOpenTry extends JSONSerializable< proof_init, proof_height, signer, - } = this; + } = this return MsgChannelOpenTry_pb.fromPartial({ portId: port_id, previousChannelId: previous_channel_id, @@ -115,33 +115,33 @@ export class MsgChannelOpenTry extends JSONSerializable< proofInit: Buffer.from(proof_init, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgChannelOpenTry', value: MsgChannelOpenTry_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChannelOpenTry { return MsgChannelOpenTry.fromProto( MsgChannelOpenTry_pb.decode(msgAny.value) - ); + ) } } export namespace MsgChannelOpenTry { export interface Data { - '@type': '/ibc.core.channel.v1.MsgChannelOpenTry'; - port_id: string; - previous_channel_id: string; - channel?: Channel.Data; - counterparty_version: string; - proof_init: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgChannelOpenTry' + port_id: string + previous_channel_id: string + channel?: Channel.Data + counterparty_version: string + proof_init: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgChannelOpenTry_pb; + export type Proto = MsgChannelOpenTry_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgRecvAcknowledgement.ts b/src/core/ibc/core/channel/msgs/MsgRecvAcknowledgement.ts index 7d1e6f3..16415b3 100644 --- a/src/core/ibc/core/channel/msgs/MsgRecvAcknowledgement.ts +++ b/src/core/ibc/core/channel/msgs/MsgRecvAcknowledgement.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgAcknowledgement as MsgAcknowledgement_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Packet, Height } from '../../../core'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgAcknowledgement as MsgAcknowledgement_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Packet, Height } from '../../../core' /** * MsgAcknowledgement receives incoming IBC acknowledgement @@ -26,31 +26,31 @@ export class MsgAcknowledgement extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgAcknowledgement { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgAcknowledgement.Data): MsgAcknowledgement { - const { packet, acknowledgement, proof_acked, proof_height, signer } = data; + const { packet, acknowledgement, proof_acked, proof_height, signer } = data return new MsgAcknowledgement( packet ? Packet.fromData(packet) : undefined, proof_acked, acknowledgement, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgAcknowledgement.Data { - const { packet, acknowledgement, proof_acked, proof_height, signer } = this; + const { packet, acknowledgement, proof_acked, proof_height, signer } = this return { '@type': '/ibc.core.channel.v1.MsgAcknowledgement', packet: packet?.toData(), @@ -58,7 +58,7 @@ export class MsgAcknowledgement extends JSONSerializable< proof_acked, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto(proto: MsgAcknowledgement.Proto): MsgAcknowledgement { @@ -68,42 +68,42 @@ export class MsgAcknowledgement extends JSONSerializable< Buffer.from(proto.proofAcked).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgAcknowledgement.Proto { - const { packet, acknowledgement, proof_acked, proof_height, signer } = this; + const { packet, acknowledgement, proof_acked, proof_height, signer } = this return MsgAcknowledgement_pb.fromPartial({ packet: packet?.toProto(), acknowledgement: Buffer.from(acknowledgement, 'base64'), proofAcked: Buffer.from(proof_acked, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgAcknowledgement', value: MsgAcknowledgement_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgAcknowledgement { return MsgAcknowledgement.fromProto( MsgAcknowledgement_pb.decode(msgAny.value) - ); + ) } } export namespace MsgAcknowledgement { export interface Data { - '@type': '/ibc.core.channel.v1.MsgAcknowledgement'; - packet?: Packet.Data; - acknowledgement: string; - proof_acked: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgAcknowledgement' + packet?: Packet.Data + acknowledgement: string + proof_acked: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgAcknowledgement_pb; + export type Proto = MsgAcknowledgement_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgRecvPacket.ts b/src/core/ibc/core/channel/msgs/MsgRecvPacket.ts index e1f9246..602035a 100644 --- a/src/core/ibc/core/channel/msgs/MsgRecvPacket.ts +++ b/src/core/ibc/core/channel/msgs/MsgRecvPacket.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRecvPacket as MsgRecvPacket_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Packet, Height } from '../../../core'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRecvPacket as MsgRecvPacket_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Packet, Height } from '../../../core' /** * MsgRecvPacket receives incoming IBC packet @@ -24,37 +24,37 @@ export class MsgRecvPacket extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgRecvPacket { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgRecvPacket.Data): MsgRecvPacket { - const { packet, proof_commitment, proof_height, signer } = data; + const { packet, proof_commitment, proof_height, signer } = data return new MsgRecvPacket( packet ? Packet.fromData(packet) : undefined, proof_commitment, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgRecvPacket.Data { - const { packet, proof_commitment, proof_height, signer } = this; + const { packet, proof_commitment, proof_height, signer } = this return { '@type': '/ibc.core.channel.v1.MsgRecvPacket', packet: packet?.toData(), proof_commitment, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto(proto: MsgRecvPacket.Proto): MsgRecvPacket { @@ -63,38 +63,38 @@ export class MsgRecvPacket extends JSONSerializable< Buffer.from(proto.proofCommitment).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgRecvPacket.Proto { - const { packet, proof_commitment, proof_height, signer } = this; + const { packet, proof_commitment, proof_height, signer } = this return MsgRecvPacket_pb.fromPartial({ packet: packet?.toProto(), proofCommitment: Buffer.from(proof_commitment, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgRecvPacket', value: MsgRecvPacket_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRecvPacket { - return MsgRecvPacket.fromProto(MsgRecvPacket_pb.decode(msgAny.value)); + return MsgRecvPacket.fromProto(MsgRecvPacket_pb.decode(msgAny.value)) } } export namespace MsgRecvPacket { export interface Data { - '@type': '/ibc.core.channel.v1.MsgRecvPacket'; - packet?: Packet.Data; - proof_commitment: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgRecvPacket' + packet?: Packet.Data + proof_commitment: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgRecvPacket_pb; + export type Proto = MsgRecvPacket_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgTimeout.ts b/src/core/ibc/core/channel/msgs/MsgTimeout.ts index 0964f98..5b5e04d 100644 --- a/src/core/ibc/core/channel/msgs/MsgTimeout.ts +++ b/src/core/ibc/core/channel/msgs/MsgTimeout.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgTimeout as MsgTimeout_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Packet, Height } from '../../../core'; -import Long from 'long'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgTimeout as MsgTimeout_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Packet, Height } from '../../../core' +import Long from 'long' /** * MsgTimeout receives timed-out packet @@ -27,16 +27,16 @@ export class MsgTimeout extends JSONSerializable< public next_sequence_recv: number, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgTimeout { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgTimeout.Data): MsgTimeout { @@ -46,14 +46,14 @@ export class MsgTimeout extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = data; + } = data return new MsgTimeout( packet ? Packet.fromData(packet) : undefined, proof_unreceived, proof_height ? Height.fromData(proof_height) : undefined, Number.parseInt(next_sequence_recv), signer - ); + ) } public toData(): MsgTimeout.Data { @@ -63,7 +63,7 @@ export class MsgTimeout extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = this; + } = this return { '@type': '/ibc.core.channel.v1.MsgTimeout', packet: packet?.toData(), @@ -71,7 +71,7 @@ export class MsgTimeout extends JSONSerializable< proof_height: proof_height?.toData(), next_sequence_recv: next_sequence_recv.toFixed(), signer, - }; + } } public static fromProto(proto: MsgTimeout.Proto): MsgTimeout { @@ -81,7 +81,7 @@ export class MsgTimeout extends JSONSerializable< proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.nextSequenceRecv.toNumber(), proto.signer - ); + ) } public toProto(): MsgTimeout.Proto { @@ -91,36 +91,36 @@ export class MsgTimeout extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = this; + } = this return MsgTimeout_pb.fromPartial({ packet: packet?.toProto(), proofUnreceived: Buffer.from(proof_unreceived, 'base64'), proofHeight: proof_height?.toProto(), nextSequenceRecv: Long.fromNumber(next_sequence_recv), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgTimeout', value: MsgTimeout_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgTimeout { - return MsgTimeout.fromProto(MsgTimeout_pb.decode(msgAny.value)); + return MsgTimeout.fromProto(MsgTimeout_pb.decode(msgAny.value)) } } export namespace MsgTimeout { export interface Data { - '@type': '/ibc.core.channel.v1.MsgTimeout'; - packet?: Packet.Data; - proof_unreceived: string; - proof_height?: Height.Data; - next_sequence_recv: string; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgTimeout' + packet?: Packet.Data + proof_unreceived: string + proof_height?: Height.Data + next_sequence_recv: string + signer: AccAddress } - export type Proto = MsgTimeout_pb; + export type Proto = MsgTimeout_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgTimeoutClose.ts b/src/core/ibc/core/channel/msgs/MsgTimeoutClose.ts index 7273fd7..69846ae 100644 --- a/src/core/ibc/core/channel/msgs/MsgTimeoutClose.ts +++ b/src/core/ibc/core/channel/msgs/MsgTimeoutClose.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgTimeoutOnClose as MsgTimeoutOnClose_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; -import { Packet, Height } from '../../../core'; -import Long from 'long'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgTimeoutOnClose as MsgTimeoutOnClose_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' +import { Packet, Height } from '../../../core' +import Long from 'long' /** * MsgTimeoutOnClose timed-out packet upon counterparty channel closure. @@ -29,16 +29,16 @@ export class MsgTimeoutOnClose extends JSONSerializable< public next_sequence_recv: number, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgTimeoutOnClose { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgTimeoutOnClose.Data): MsgTimeoutOnClose { @@ -49,7 +49,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = data; + } = data return new MsgTimeoutOnClose( packet ? Packet.fromData(packet) : undefined, proof_close, @@ -57,7 +57,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proof_height ? Height.fromData(proof_height) : undefined, Number.parseInt(next_sequence_recv), signer - ); + ) } public toData(): MsgTimeoutOnClose.Data { @@ -68,7 +68,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = this; + } = this return { '@type': '/ibc.core.channel.v1.MsgTimeoutOnClose', packet: packet?.toData(), @@ -77,7 +77,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proof_height: proof_height?.toData(), next_sequence_recv: next_sequence_recv.toFixed(), signer, - }; + } } public static fromProto(proto: MsgTimeoutOnClose.Proto): MsgTimeoutOnClose { @@ -88,7 +88,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.nextSequenceRecv.toNumber(), proto.signer - ); + ) } public toProto(): MsgTimeoutOnClose.Proto { @@ -99,7 +99,7 @@ export class MsgTimeoutOnClose extends JSONSerializable< proof_height, next_sequence_recv, signer, - } = this; + } = this return MsgTimeoutOnClose_pb.fromPartial({ packet: packet?.toProto(), proofUnreceived: Buffer.from(proof_unreceived, 'base64'), @@ -107,32 +107,32 @@ export class MsgTimeoutOnClose extends JSONSerializable< proofHeight: proof_height?.toProto(), nextSequenceRecv: Long.fromNumber(next_sequence_recv), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgTimeoutOnClose', value: MsgTimeoutOnClose_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgTimeoutOnClose { return MsgTimeoutOnClose.fromProto( MsgTimeoutOnClose_pb.decode(msgAny.value) - ); + ) } } export namespace MsgTimeoutOnClose { export interface Data { - '@type': '/ibc.core.channel.v1.MsgTimeoutOnClose'; - packet?: Packet.Data; - proof_unreceived: string; - proof_close: string; - proof_height?: Height.Data; - next_sequence_recv: string; - signer: AccAddress; + '@type': '/ibc.core.channel.v1.MsgTimeoutOnClose' + packet?: Packet.Data + proof_unreceived: string + proof_close: string + proof_height?: Height.Data + next_sequence_recv: string + signer: AccAddress } - export type Proto = MsgTimeoutOnClose_pb; + export type Proto = MsgTimeoutOnClose_pb } diff --git a/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts b/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts index 4970840..407f5a7 100644 --- a/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts +++ b/src/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { IbcChannelParams } from '../IbcChannelParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { IbcChannelParams } from '../IbcChannelParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/channel/v1/tx' export class MsgUpdateIbcChannelParams extends JSONSerializable< any, @@ -13,36 +13,39 @@ export class MsgUpdateIbcChannelParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the channel parameters to update */ - constructor(public authority: AccAddress, public params: IbcChannelParams) { - super(); + constructor( + public authority: AccAddress, + public params: IbcChannelParams + ) { + super() } public static fromAmino(_: any): MsgUpdateIbcChannelParams { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgUpdateIbcChannelParams.Data ): MsgUpdateIbcChannelParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateIbcChannelParams( authority, IbcChannelParams.fromData(params) - ); + ) } public toData(): MsgUpdateIbcChannelParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/ibc.core.channel.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -51,37 +54,37 @@ export class MsgUpdateIbcChannelParams extends JSONSerializable< return new MsgUpdateIbcChannelParams( data.authority, IbcChannelParams.fromProto(data.params as IbcChannelParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcChannelParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.channel.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcChannelParams { return MsgUpdateIbcChannelParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcChannelParams { export interface Data { - '@type': '/ibc.core.channel.v1.MsgUpdateParams'; - authority: AccAddress; - params: IbcChannelParams.Data; + '@type': '/ibc.core.channel.v1.MsgUpdateParams' + authority: AccAddress + params: IbcChannelParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibc/core/channel/msgs/index.ts b/src/core/ibc/core/channel/msgs/index.ts index 16c840a..c443cd2 100644 --- a/src/core/ibc/core/channel/msgs/index.ts +++ b/src/core/ibc/core/channel/msgs/index.ts @@ -1,26 +1,26 @@ -import { MsgChannelOpenInit } from './MsgChannelOpenInit'; -import { MsgChannelOpenTry } from './MsgChannelOpenTry'; -import { MsgChannelOpenConfirm } from './MsgChannelOpenConfirm'; -import { MsgChannelOpenAck } from './MsgChannelOpenAck'; -import { MsgChannelCloseInit } from './MsgChannelCloseInit'; -import { MsgChannelCloseConfirm } from './MsgChannelCloseConfirm'; -import { MsgRecvPacket } from './MsgRecvPacket'; -import { MsgAcknowledgement } from './MsgRecvAcknowledgement'; -import { MsgTimeout } from './MsgTimeout'; -import { MsgTimeoutOnClose } from './MsgTimeoutClose'; -import { MsgUpdateIbcChannelParams } from './MsgUpdateIbcChannelParams'; +import { MsgChannelOpenInit } from './MsgChannelOpenInit' +import { MsgChannelOpenTry } from './MsgChannelOpenTry' +import { MsgChannelOpenConfirm } from './MsgChannelOpenConfirm' +import { MsgChannelOpenAck } from './MsgChannelOpenAck' +import { MsgChannelCloseInit } from './MsgChannelCloseInit' +import { MsgChannelCloseConfirm } from './MsgChannelCloseConfirm' +import { MsgRecvPacket } from './MsgRecvPacket' +import { MsgAcknowledgement } from './MsgRecvAcknowledgement' +import { MsgTimeout } from './MsgTimeout' +import { MsgTimeoutOnClose } from './MsgTimeoutClose' +import { MsgUpdateIbcChannelParams } from './MsgUpdateIbcChannelParams' -export * from './MsgChannelOpenInit'; -export * from './MsgChannelOpenTry'; -export * from './MsgChannelOpenConfirm'; -export * from './MsgChannelOpenAck'; -export * from './MsgChannelCloseInit'; -export * from './MsgChannelCloseConfirm'; -export * from './MsgRecvPacket'; -export * from './MsgRecvAcknowledgement'; -export * from './MsgTimeout'; -export * from './MsgTimeoutClose'; -export * from './MsgUpdateIbcChannelParams'; +export * from './MsgChannelOpenInit' +export * from './MsgChannelOpenTry' +export * from './MsgChannelOpenConfirm' +export * from './MsgChannelOpenAck' +export * from './MsgChannelCloseInit' +export * from './MsgChannelCloseConfirm' +export * from './MsgRecvPacket' +export * from './MsgRecvAcknowledgement' +export * from './MsgTimeout' +export * from './MsgTimeoutClose' +export * from './MsgUpdateIbcChannelParams' export type IbcChannelMsg = | MsgChannelOpenInit @@ -33,7 +33,7 @@ export type IbcChannelMsg = | MsgAcknowledgement | MsgTimeout | MsgTimeoutOnClose - | MsgUpdateIbcChannelParams; + | MsgUpdateIbcChannelParams export namespace IbcChannelMsg { export type Data = @@ -47,7 +47,7 @@ export namespace IbcChannelMsg { | MsgAcknowledgement.Data | MsgTimeout.Data | MsgTimeoutOnClose.Data - | MsgUpdateIbcChannelParams.Data; + | MsgUpdateIbcChannelParams.Data export type Proto = | MsgChannelOpenInit.Proto @@ -60,5 +60,5 @@ export namespace IbcChannelMsg { | MsgAcknowledgement.Proto | MsgTimeout.Proto | MsgTimeoutOnClose.Proto - | MsgUpdateIbcChannelParams.Proto; + | MsgUpdateIbcChannelParams.Proto } diff --git a/src/core/ibc/core/client/ClientConsensusStates.ts b/src/core/ibc/core/client/ClientConsensusStates.ts index b64ff74..bf820ca 100644 --- a/src/core/ibc/core/client/ClientConsensusStates.ts +++ b/src/core/ibc/core/client/ClientConsensusStates.ts @@ -1,6 +1,6 @@ -import { ClientConsensusStates as ClientConsensusStates_pb } from '@initia/initia.proto/ibc/core/client/v1/client'; -import { JSONSerializable } from '../../../../util/json'; -import { ConsensusStateWithHeight } from './ConsensusStateWithHeight'; +import { ClientConsensusStates as ClientConsensusStates_pb } from '@initia/initia.proto/ibc/core/client/v1/client' +import { JSONSerializable } from '../../../../util/json' +import { ConsensusStateWithHeight } from './ConsensusStateWithHeight' /** * ClientConsensusStates defines all the stored consensus states for a given client/ @@ -18,45 +18,45 @@ export class ClientConsensusStates extends JSONSerializable< public client_id: string, public consensus_states: ConsensusStateWithHeight[] ) { - super(); + super() } public static fromAmino( data: ClientConsensusStates.Amino ): ClientConsensusStates { - const { client_id, consensus_states } = data; + const { client_id, consensus_states } = data return new ClientConsensusStates( client_id, - consensus_states.map(state => ConsensusStateWithHeight.fromAmino(state)) - ); + consensus_states.map((state) => ConsensusStateWithHeight.fromAmino(state)) + ) } public toAmino(): ClientConsensusStates.Amino { - const { client_id, consensus_states } = this; + const { client_id, consensus_states } = this const res: ClientConsensusStates.Amino = { client_id: client_id, - consensus_states: consensus_states.map(state => state.toAmino()), - }; - return res; + consensus_states: consensus_states.map((state) => state.toAmino()), + } + return res } public static fromData( data: ClientConsensusStates.Data ): ClientConsensusStates { - const { client_id, consensus_states } = data; + const { client_id, consensus_states } = data return new ClientConsensusStates( client_id, - consensus_states.map(state => ConsensusStateWithHeight.fromData(state)) - ); + consensus_states.map((state) => ConsensusStateWithHeight.fromData(state)) + ) } public toData(): ClientConsensusStates.Data { - const { client_id, consensus_states } = this; + const { client_id, consensus_states } = this const res: ClientConsensusStates.Data = { client_id, - consensus_states: consensus_states.map(state => state.toData()), - }; - return res; + consensus_states: consensus_states.map((state) => state.toData()), + } + return res } public static fromProto( @@ -64,31 +64,31 @@ export class ClientConsensusStates extends JSONSerializable< ): ClientConsensusStates { return new ClientConsensusStates( proto.clientId, - proto.consensusStates.map(state => + proto.consensusStates.map((state) => ConsensusStateWithHeight.fromProto(state) ) - ); + ) } public toProto(): ClientConsensusStates.Proto { - const { client_id, consensus_states } = this; + const { client_id, consensus_states } = this return ClientConsensusStates_pb.fromPartial({ clientId: client_id, - consensusStates: consensus_states.map(state => state.toProto()), - }); + consensusStates: consensus_states.map((state) => state.toProto()), + }) } } export namespace ClientConsensusStates { export interface Amino { - client_id: string; - consensus_states: ConsensusStateWithHeight.Amino[]; + client_id: string + consensus_states: ConsensusStateWithHeight.Amino[] } export interface Data { - client_id: string; - consensus_states: ConsensusStateWithHeight.Data[]; + client_id: string + consensus_states: ConsensusStateWithHeight.Data[] } - export type Proto = ClientConsensusStates_pb; + export type Proto = ClientConsensusStates_pb } diff --git a/src/core/ibc/core/client/ConsensusStateWithHeight.ts b/src/core/ibc/core/client/ConsensusStateWithHeight.ts index 0cb96e2..196d061 100644 --- a/src/core/ibc/core/client/ConsensusStateWithHeight.ts +++ b/src/core/ibc/core/client/ConsensusStateWithHeight.ts @@ -1,6 +1,6 @@ -import { ConsensusStateWithHeight as ConsensusStateWithHeight_pb } from '@initia/initia.proto/ibc/core/client/v1/client'; -import { Height } from './Height'; -import { JSONSerializable } from '../../../../util/json'; +import { ConsensusStateWithHeight as ConsensusStateWithHeight_pb } from '@initia/initia.proto/ibc/core/client/v1/client' +import { Height } from './Height' +import { JSONSerializable } from '../../../../util/json' /** * ConsensusStateWithHeight defines a consensus state with an additional height field. @@ -10,55 +10,55 @@ export class ConsensusStateWithHeight extends JSONSerializable< ConsensusStateWithHeight.Data, ConsensusStateWithHeight.Proto > { - public height: Height | undefined; - public consensus_state: any; + public height: Height | undefined + public consensus_state: any /** * @param height consensus state height * @param consensus_state consensus state */ constructor(height: Height | undefined, consensus_state: any) { - super(); - this.height = height; - this.consensus_state = consensus_state; + super() + this.height = height + this.consensus_state = consensus_state } public static fromAmino( data: ConsensusStateWithHeight.Amino ): ConsensusStateWithHeight { - const { height, consensus_state } = data; + const { height, consensus_state } = data return new ConsensusStateWithHeight( height ? Height.fromAmino(height) : undefined, consensus_state - ); + ) } public toAmino(): ConsensusStateWithHeight.Amino { - const { height, consensus_state } = this; + const { height, consensus_state } = this const res: ConsensusStateWithHeight.Amino = { height: height?.toAmino(), consensus_state: consensus_state, - }; - return res; + } + return res } public static fromData( data: ConsensusStateWithHeight.Data ): ConsensusStateWithHeight { - const { height, consensus_state } = data; + const { height, consensus_state } = data return new ConsensusStateWithHeight( height ? Height.fromData(height) : undefined, consensus_state - ); + ) } public toData(): ConsensusStateWithHeight.Data { - const { height, consensus_state } = this; + const { height, consensus_state } = this const res: ConsensusStateWithHeight.Data = { height: height?.toData(), consensus_state, - }; - return res; + } + return res } public static fromProto( @@ -67,28 +67,28 @@ export class ConsensusStateWithHeight extends JSONSerializable< return new ConsensusStateWithHeight( proto.height ? Height.fromProto(proto.height) : undefined, proto.consensusState - ); + ) } public toProto(): ConsensusStateWithHeight.Proto { - const { height, consensus_state } = this; + const { height, consensus_state } = this return ConsensusStateWithHeight_pb.fromPartial({ height: height?.toProto(), consensusState: consensus_state, - }); + }) } } export namespace ConsensusStateWithHeight { export interface Amino { - height?: Height.Amino; - consensus_state: any; + height?: Height.Amino + consensus_state: any } export interface Data { - height?: Height.Data; - consensus_state: any; + height?: Height.Data + consensus_state: any } - export type Proto = ConsensusStateWithHeight_pb; + export type Proto = ConsensusStateWithHeight_pb } diff --git a/src/core/ibc/core/client/Height.ts b/src/core/ibc/core/client/Height.ts index 9a02f05..b57bf52 100644 --- a/src/core/ibc/core/client/Height.ts +++ b/src/core/ibc/core/client/Height.ts @@ -1,6 +1,6 @@ -import { Height as Height_pb } from '@initia/initia.proto/ibc/core/client/v1/client'; -import Long from 'long'; -import { JSONSerializable } from '../../../../util/json'; +import { Height as Height_pb } from '@initia/initia.proto/ibc/core/client/v1/client' +import Long from 'long' +import { JSONSerializable } from '../../../../util/json' /** * Height is a monotonically increasing data type @@ -23,72 +23,75 @@ export class Height extends JSONSerializable< * @param revision_number the revision that the client is currently on * @param revision_height the height within the given revision */ - constructor(public revision_number: number, public revision_height: number) { - super(); + constructor( + public revision_number: number, + public revision_height: number + ) { + super() } public static fromAmino(data: Height.Amino): Height { - const { revision_number, revision_height } = data; + const { revision_number, revision_height } = data return new Height( parseInt(revision_number ?? '0'), parseInt(revision_height ?? '0') - ); + ) } public toAmino(): Height.Amino { - const { revision_number, revision_height } = this; + const { revision_number, revision_height } = this const res: Height.Amino = { revision_number: revision_number > 0 ? revision_number.toFixed() : undefined, revision_height: revision_height > 0 ? revision_height.toFixed() : undefined, - }; - return res; + } + return res } public static fromData(data: Height.Data): Height { - const { revision_number, revision_height } = data; + const { revision_number, revision_height } = data return new Height( Number.parseInt(revision_number), Number.parseInt(revision_height) - ); + ) } public toData(): Height.Data { - const { revision_number, revision_height } = this; + const { revision_number, revision_height } = this const res: Height.Data = { revision_number: revision_number.toFixed(), revision_height: revision_height.toFixed(), - }; - return res; + } + return res } public static fromProto(proto: Height.Proto): Height { return new Height( proto.revisionNumber.toNumber(), proto.revisionHeight.toNumber() - ); + ) } public toProto(): Height.Proto { - const { revision_number, revision_height } = this; + const { revision_number, revision_height } = this return Height_pb.fromPartial({ revisionNumber: Long.fromNumber(revision_number), revisionHeight: Long.fromNumber(revision_height), - }); + }) } } export namespace Height { export interface Amino { - revision_number?: string; - revision_height?: string; + revision_number?: string + revision_height?: string } export interface Data { - revision_number: string; - revision_height: string; + revision_number: string + revision_height: string } - export type Proto = Height_pb; + export type Proto = Height_pb } diff --git a/src/core/ibc/core/client/IbcClientParams.ts b/src/core/ibc/core/client/IbcClientParams.ts index c32ce9b..e2b6b98 100644 --- a/src/core/ibc/core/client/IbcClientParams.ts +++ b/src/core/ibc/core/client/IbcClientParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/ibc/core/client/v1/client'; +import { JSONSerializable } from '../../../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/ibc/core/client/v1/client' export class IbcClientParams extends JSONSerializable< IbcClientParams.Amino, @@ -10,55 +10,55 @@ export class IbcClientParams extends JSONSerializable< * @param allowed_clients the list of allowed client state types. */ constructor(public allowed_clients: string[]) { - super(); + super() } public static fromAmino(data: IbcClientParams.Amino): IbcClientParams { - const { allowed_clients } = data; - return new IbcClientParams(allowed_clients); + const { allowed_clients } = data + return new IbcClientParams(allowed_clients) } public toAmino(): IbcClientParams.Amino { - const { allowed_clients } = this; + const { allowed_clients } = this const res: IbcClientParams.Amino = { allowed_clients: allowed_clients, - }; - return res; + } + return res } public static fromData(data: IbcClientParams.Data): IbcClientParams { - const { allowed_clients } = data; - return new IbcClientParams(allowed_clients); + const { allowed_clients } = data + return new IbcClientParams(allowed_clients) } public toData(): IbcClientParams.Data { - const { allowed_clients } = this; + const { allowed_clients } = this const res: IbcClientParams.Data = { allowed_clients, - }; - return res; + } + return res } public static fromProto(proto: IbcClientParams.Proto): IbcClientParams { - return new IbcClientParams(proto.allowedClients); + return new IbcClientParams(proto.allowedClients) } public toProto(): IbcClientParams.Proto { - const { allowed_clients } = this; + const { allowed_clients } = this return Params_pb.fromPartial({ allowedClients: allowed_clients, - }); + }) } } export namespace IbcClientParams { export interface Amino { - allowed_clients: string[]; + allowed_clients: string[] } export interface Data { - allowed_clients: string[]; + allowed_clients: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/core/client/IdentifiedClient.ts b/src/core/ibc/core/client/IdentifiedClient.ts index 1a39ebe..55a2d13 100644 --- a/src/core/ibc/core/client/IdentifiedClient.ts +++ b/src/core/ibc/core/client/IdentifiedClient.ts @@ -1,5 +1,5 @@ -import { IdentifiedClientState as IdentifiedClientState_pb } from '@initia/initia.proto/ibc/core/client/v1/client'; -import { JSONSerializable } from '../../../../util/json'; +import { IdentifiedClientState as IdentifiedClientState_pb } from '@initia/initia.proto/ibc/core/client/v1/client' +import { JSONSerializable } from '../../../../util/json' /** * IdentifiedClientState defines a client state with an additional client identifier field @@ -13,67 +13,70 @@ export class IdentifiedClientState extends JSONSerializable< * @param client_id client identifier * @param client_state client state */ - constructor(public client_id: string, public client_state: any) { - super(); + constructor( + public client_id: string, + public client_state: any + ) { + super() } public static fromAmino( data: IdentifiedClientState.Amino ): IdentifiedClientState { - const { client_id, client_state } = data; - return new IdentifiedClientState(client_id, client_state); + const { client_id, client_state } = data + return new IdentifiedClientState(client_id, client_state) } public toAmino(): IdentifiedClientState.Amino { - const { client_id, client_state } = this; + const { client_id, client_state } = this const res: IdentifiedClientState.Amino = { client_id: client_id, client_state: client_state, - }; - return res; + } + return res } public static fromData( data: IdentifiedClientState.Data ): IdentifiedClientState { - const { client_id, client_state } = data; - return new IdentifiedClientState(client_id, client_state); + const { client_id, client_state } = data + return new IdentifiedClientState(client_id, client_state) } public toData(): IdentifiedClientState.Data { - const { client_id, client_state } = this; + const { client_id, client_state } = this const res: IdentifiedClientState.Data = { client_id, client_state, - }; - return res; + } + return res } public static fromProto( proto: IdentifiedClientState.Proto ): IdentifiedClientState { - return new IdentifiedClientState(proto.clientId, proto.clientState); + return new IdentifiedClientState(proto.clientId, proto.clientState) } public toProto(): IdentifiedClientState.Proto { - const { client_id, client_state } = this; + const { client_id, client_state } = this return IdentifiedClientState_pb.fromPartial({ clientId: client_id, clientState: client_state, - }); + }) } } export namespace IdentifiedClientState { export interface Amino { - client_id: string; - client_state: any; + client_id: string + client_state: any } export interface Data { - client_id: string; - client_state: any; + client_id: string + client_state: any } - export type Proto = IdentifiedClientState_pb; + export type Proto = IdentifiedClientState_pb } diff --git a/src/core/ibc/core/client/index.ts b/src/core/ibc/core/client/index.ts index 5b6ec0a..854ec94 100644 --- a/src/core/ibc/core/client/index.ts +++ b/src/core/ibc/core/client/index.ts @@ -1,5 +1,5 @@ -export * from './ClientConsensusStates'; -export * from './ConsensusStateWithHeight'; -export * from './Height'; -export * from './IdentifiedClient'; -export * from './IbcClientParams'; +export * from './ClientConsensusStates' +export * from './ConsensusStateWithHeight' +export * from './Height' +export * from './IdentifiedClient' +export * from './IbcClientParams' diff --git a/src/core/ibc/core/client/msgs/MsgCreateClient.ts b/src/core/ibc/core/client/msgs/MsgCreateClient.ts index 41f1b2a..b2a14d2 100644 --- a/src/core/ibc/core/client/msgs/MsgCreateClient.ts +++ b/src/core/ibc/core/client/msgs/MsgCreateClient.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreateClient as MsgCreateClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreateClient as MsgCreateClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' /** * MsgCreateClient defines a message to create an IBC client @@ -11,43 +11,43 @@ export class MsgCreateClient extends JSONSerializable< MsgCreateClient.Data, MsgCreateClient.Proto > { - public client_state?: any; - public consensus_state?: any; - public signer: AccAddress; + public client_state?: any + public consensus_state?: any + public signer: AccAddress /** * @param client_state light client state * @param consensus_state consensus state associated with the client that corresponds to a given * @param signer signer address */ constructor(client_state: any, consensus_state: any, signer: any) { - super(); - this.client_state = client_state; - this.consensus_state = consensus_state; - this.signer = signer; + super() + this.client_state = client_state + this.consensus_state = consensus_state + this.signer = signer } public static fromAmino(_: any): MsgCreateClient { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgCreateClient.Data): MsgCreateClient { - const { client_state, consensus_state, signer } = data; - return new MsgCreateClient(client_state, consensus_state, signer); + const { client_state, consensus_state, signer } = data + return new MsgCreateClient(client_state, consensus_state, signer) } public toData(): MsgCreateClient.Data { - const { client_state, consensus_state, signer } = this; + const { client_state, consensus_state, signer } = this return { '@type': '/ibc.core.client.v1.MsgCreateClient', client_state, consensus_state, signer, - }; + } } public static fromProto(proto: MsgCreateClient.Proto): MsgCreateClient { @@ -55,36 +55,36 @@ export class MsgCreateClient extends JSONSerializable< proto.clientState, proto.consensusState, proto.signer - ); + ) } public toProto(): MsgCreateClient.Proto { - const { client_state, consensus_state, signer } = this; + const { client_state, consensus_state, signer } = this return MsgCreateClient_pb.fromPartial({ clientState: client_state, consensusState: consensus_state, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgCreateClient', value: MsgCreateClient_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateClient { - return MsgCreateClient.fromProto(MsgCreateClient_pb.decode(msgAny.value)); + return MsgCreateClient.fromProto(MsgCreateClient_pb.decode(msgAny.value)) } } export namespace MsgCreateClient { export interface Data { - '@type': '/ibc.core.client.v1.MsgCreateClient'; - client_state?: any; - consensus_state?: any; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgCreateClient' + client_state?: any + consensus_state?: any + signer: AccAddress } - export type Proto = MsgCreateClient_pb; + export type Proto = MsgCreateClient_pb } diff --git a/src/core/ibc/core/client/msgs/MsgIBCSoftwareUpgrade.ts b/src/core/ibc/core/client/msgs/MsgIBCSoftwareUpgrade.ts index dde0fb3..95d4a8e 100644 --- a/src/core/ibc/core/client/msgs/MsgIBCSoftwareUpgrade.ts +++ b/src/core/ibc/core/client/msgs/MsgIBCSoftwareUpgrade.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgIBCSoftwareUpgrade as MsgIBCSoftwareUpgrade_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; -import { Plan } from '../../../../upgrade'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgIBCSoftwareUpgrade as MsgIBCSoftwareUpgrade_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' +import { Plan } from '../../../../upgrade' /** * MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal @@ -22,37 +22,37 @@ export class MsgIBCSoftwareUpgrade extends JSONSerializable< public upgraded_client_state: any, public signer: string ) { - super(); + super() } public static fromAmino(_: any): MsgIBCSoftwareUpgrade { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgIBCSoftwareUpgrade.Data ): MsgIBCSoftwareUpgrade { - const { plan, upgraded_client_state, signer } = data; + const { plan, upgraded_client_state, signer } = data return new MsgIBCSoftwareUpgrade( Plan.fromData(plan), upgraded_client_state, signer - ); + ) } public toData(): MsgIBCSoftwareUpgrade.Data { - const { plan, upgraded_client_state, signer } = this; + const { plan, upgraded_client_state, signer } = this return { '@type': '/ibc.core.client.v1.MsgIBCSoftwareUpgrade', plan: plan.toData(), upgraded_client_state, signer, - }; + } } public static fromProto( @@ -62,39 +62,39 @@ export class MsgIBCSoftwareUpgrade extends JSONSerializable< Plan.fromProto(proto.plan as Plan.Proto), proto.upgradedClientState, proto.signer - ); + ) } public toProto(): MsgIBCSoftwareUpgrade.Proto { - const { plan, upgraded_client_state, signer } = this; + const { plan, upgraded_client_state, signer } = this return MsgIBCSoftwareUpgrade_pb.fromPartial({ plan: plan.toProto(), upgradedClientState: upgraded_client_state, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgIBCSoftwareUpgrade', value: MsgIBCSoftwareUpgrade_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgIBCSoftwareUpgrade { return MsgIBCSoftwareUpgrade.fromProto( MsgIBCSoftwareUpgrade_pb.decode(msgAny.value) - ); + ) } } export namespace MsgIBCSoftwareUpgrade { export interface Data { - '@type': '/ibc.core.client.v1.MsgIBCSoftwareUpgrade'; - plan: Plan.Data; - upgraded_client_state: any; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgIBCSoftwareUpgrade' + plan: Plan.Data + upgraded_client_state: any + signer: AccAddress } - export type Proto = MsgIBCSoftwareUpgrade_pb; + export type Proto = MsgIBCSoftwareUpgrade_pb } diff --git a/src/core/ibc/core/client/msgs/MsgRecoverClient.ts b/src/core/ibc/core/client/msgs/MsgRecoverClient.ts index eef6938..2958298 100644 --- a/src/core/ibc/core/client/msgs/MsgRecoverClient.ts +++ b/src/core/ibc/core/client/msgs/MsgRecoverClient.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRecoverClient as MsgRecoverClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRecoverClient as MsgRecoverClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' /** * MsgRecoverClient defines the message used to recover a frozen or expired client @@ -21,35 +21,31 @@ export class MsgRecoverClient extends JSONSerializable< public substitute_client_id: string, public signer: string ) { - super(); + super() } public static fromAmino(_: any): MsgRecoverClient { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgRecoverClient.Data): MsgRecoverClient { - const { subject_client_id, substitute_client_id, signer } = data; - return new MsgRecoverClient( - subject_client_id, - substitute_client_id, - signer - ); + const { subject_client_id, substitute_client_id, signer } = data + return new MsgRecoverClient(subject_client_id, substitute_client_id, signer) } public toData(): MsgRecoverClient.Data { - const { subject_client_id, substitute_client_id, signer } = this; + const { subject_client_id, substitute_client_id, signer } = this return { '@type': '/ibc.core.client.v1.MsgRecoverClient', subject_client_id, substitute_client_id, signer, - }; + } } public static fromProto(proto: MsgRecoverClient.Proto): MsgRecoverClient { @@ -57,37 +53,37 @@ export class MsgRecoverClient extends JSONSerializable< proto.subjectClientId, proto.substituteClientId, proto.signer - ); + ) } public toProto(): MsgRecoverClient.Proto { - const { subject_client_id, substitute_client_id, signer } = this; + const { subject_client_id, substitute_client_id, signer } = this return MsgRecoverClient_pb.fromPartial({ subjectClientId: subject_client_id, substituteClientId: substitute_client_id, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgRecoverClient', value: MsgRecoverClient_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRecoverClient { - return MsgRecoverClient.fromProto(MsgRecoverClient_pb.decode(msgAny.value)); + return MsgRecoverClient.fromProto(MsgRecoverClient_pb.decode(msgAny.value)) } } export namespace MsgRecoverClient { export interface Data { - '@type': '/ibc.core.client.v1.MsgRecoverClient'; - subject_client_id: string; - substitute_client_id: string; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgRecoverClient' + subject_client_id: string + substitute_client_id: string + signer: AccAddress } - export type Proto = MsgRecoverClient_pb; + export type Proto = MsgRecoverClient_pb } diff --git a/src/core/ibc/core/client/msgs/MsgSubmitMisbehaviour.ts b/src/core/ibc/core/client/msgs/MsgSubmitMisbehaviour.ts index d6b85c8..594d163 100644 --- a/src/core/ibc/core/client/msgs/MsgSubmitMisbehaviour.ts +++ b/src/core/ibc/core/client/msgs/MsgSubmitMisbehaviour.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSubmitMisbehaviour as MsgSubmitMisbehaviour_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSubmitMisbehaviour as MsgSubmitMisbehaviour_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' /** * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for light client misbehaviour. @@ -21,33 +21,33 @@ export class MsgSubmitMisbehaviour extends JSONSerializable< public misbehaviour: any, public signer: string ) { - super(); + super() } public static fromAmino(_: any): MsgSubmitMisbehaviour { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgSubmitMisbehaviour.Data ): MsgSubmitMisbehaviour { - const { client_id, misbehaviour, signer } = data; - return new MsgSubmitMisbehaviour(client_id, misbehaviour, signer); + const { client_id, misbehaviour, signer } = data + return new MsgSubmitMisbehaviour(client_id, misbehaviour, signer) } public toData(): MsgSubmitMisbehaviour.Data { - const { client_id, misbehaviour, signer } = this; + const { client_id, misbehaviour, signer } = this return { '@type': '/ibc.core.client.v1.MsgSubmitMisbehaviour', client_id, misbehaviour, signer, - }; + } } public static fromProto( @@ -57,38 +57,38 @@ export class MsgSubmitMisbehaviour extends JSONSerializable< proto.clientId, proto.misbehaviour, proto.signer - ); + ) } public toProto(): MsgSubmitMisbehaviour.Proto { - const { client_id, misbehaviour, signer } = this; + const { client_id, misbehaviour, signer } = this return MsgSubmitMisbehaviour_pb.fromPartial({ clientId: client_id, misbehaviour, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgSubmitMisbehaviour', value: MsgSubmitMisbehaviour_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitMisbehaviour { return MsgSubmitMisbehaviour.fromProto( MsgSubmitMisbehaviour_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSubmitMisbehaviour { export interface Data { - '@type': '/ibc.core.client.v1.MsgSubmitMisbehaviour'; - client_id: string; - misbehaviour: any; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgSubmitMisbehaviour' + client_id: string + misbehaviour: any + signer: AccAddress } - export type Proto = MsgSubmitMisbehaviour_pb; + export type Proto = MsgSubmitMisbehaviour_pb } diff --git a/src/core/ibc/core/client/msgs/MsgUpdateClient.ts b/src/core/ibc/core/client/msgs/MsgUpdateClient.ts index 7e90453..c49f538 100644 --- a/src/core/ibc/core/client/msgs/MsgUpdateClient.ts +++ b/src/core/ibc/core/client/msgs/MsgUpdateClient.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateClient as MsgUpdateClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateClient as MsgUpdateClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using the given client message @@ -18,34 +18,34 @@ export class MsgUpdateClient extends JSONSerializable< */ constructor( public client_id: string, - public client_message: any | undefined, + public client_message: any, public signer: string ) { - super(); + super() } public static fromAmino(_: any): MsgUpdateClient { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgUpdateClient.Data): MsgUpdateClient { - const { client_id, client_message, signer } = data; - return new MsgUpdateClient(client_id, client_message, signer); + const { client_id, client_message, signer } = data + return new MsgUpdateClient(client_id, client_message, signer) } public toData(): MsgUpdateClient.Data { - const { client_id, client_message, signer } = this; + const { client_id, client_message, signer } = this return { '@type': '/ibc.core.client.v1.MsgUpdateClient', client_id, client_message, signer, - }; + } } public static fromProto(proto: MsgUpdateClient.Proto): MsgUpdateClient { @@ -53,36 +53,36 @@ export class MsgUpdateClient extends JSONSerializable< proto.clientId, proto.clientMessage, proto.signer - ); + ) } public toProto(): MsgUpdateClient.Proto { - const { client_id, client_message, signer } = this; + const { client_id, client_message, signer } = this return MsgUpdateClient_pb.fromPartial({ clientId: client_id, clientMessage: client_message, signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgUpdateClient', value: MsgUpdateClient_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateClient { - return MsgUpdateClient.fromProto(MsgUpdateClient_pb.decode(msgAny.value)); + return MsgUpdateClient.fromProto(MsgUpdateClient_pb.decode(msgAny.value)) } } export namespace MsgUpdateClient { export interface Data { - '@type': '/ibc.core.client.v1.MsgUpdateClient'; - client_id: string; - client_message?: any; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgUpdateClient' + client_id: string + client_message?: any + signer: AccAddress } - export type Proto = MsgUpdateClient_pb; + export type Proto = MsgUpdateClient_pb } diff --git a/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts b/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts index 4dec78c..35b55e3 100644 --- a/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts +++ b/src/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; -import { IbcClientParams } from '../IbcClientParams'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' +import { IbcClientParams } from '../IbcClientParams' export class MsgUpdateIbcClientParams extends JSONSerializable< any, @@ -13,36 +13,39 @@ export class MsgUpdateIbcClientParams extends JSONSerializable< * @param signer signer address * @param params params defines the client parameters to update */ - constructor(public signer: AccAddress, public params: IbcClientParams) { - super(); + constructor( + public signer: AccAddress, + public params: IbcClientParams + ) { + super() } public static fromAmino(_: any): MsgUpdateIbcClientParams { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgUpdateIbcClientParams.Data ): MsgUpdateIbcClientParams { - const { signer, params } = data; + const { signer, params } = data return new MsgUpdateIbcClientParams( signer, IbcClientParams.fromData(params) - ); + ) } public toData(): MsgUpdateIbcClientParams.Data { - const { signer, params } = this; + const { signer, params } = this return { '@type': '/ibc.core.client.v1.MsgUpdateParams', signer, params: params.toData(), - }; + } } public static fromProto( @@ -51,37 +54,37 @@ export class MsgUpdateIbcClientParams extends JSONSerializable< return new MsgUpdateIbcClientParams( data.signer, IbcClientParams.fromProto(data.params as IbcClientParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcClientParams.Proto { - const { signer, params } = this; + const { signer, params } = this return MsgUpdateParams_pb.fromPartial({ signer, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcClientParams { return MsgUpdateIbcClientParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcClientParams { export interface Data { - '@type': '/ibc.core.client.v1.MsgUpdateParams'; - signer: AccAddress; - params: IbcClientParams.Data; + '@type': '/ibc.core.client.v1.MsgUpdateParams' + signer: AccAddress + params: IbcClientParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibc/core/client/msgs/MsgUpgradeClient.ts b/src/core/ibc/core/client/msgs/MsgUpgradeClient.ts index cea646f..3209942 100644 --- a/src/core/ibc/core/client/msgs/MsgUpgradeClient.ts +++ b/src/core/ibc/core/client/msgs/MsgUpgradeClient.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpgradeClient as MsgUpgradeClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpgradeClient as MsgUpgradeClient_pb } from '@initia/initia.proto/ibc/core/client/v1/tx' /** * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client state @@ -27,16 +27,16 @@ export class MsgUpgradeClient extends JSONSerializable< public proof_upgrade_consensus_state: string, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgUpgradeClient { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MsgUpgradeClient.Data): MsgUpgradeClient { @@ -47,7 +47,7 @@ export class MsgUpgradeClient extends JSONSerializable< proof_upgrade_client, proof_upgrade_consensus_state, signer, - } = data; + } = data return new MsgUpgradeClient( client_id, client_state, @@ -55,7 +55,7 @@ export class MsgUpgradeClient extends JSONSerializable< proof_upgrade_client, proof_upgrade_consensus_state, signer - ); + ) } public toData(): MsgUpgradeClient.Data { @@ -66,7 +66,7 @@ export class MsgUpgradeClient extends JSONSerializable< proof_upgrade_client, proof_upgrade_consensus_state, signer, - } = this; + } = this return { '@type': '/ibc.core.client.v1.MsgUpgradeClient', client_id, @@ -75,7 +75,7 @@ export class MsgUpgradeClient extends JSONSerializable< proof_upgrade_client, proof_upgrade_consensus_state, signer, - }; + } } public static fromProto(proto: MsgUpgradeClient.Proto): MsgUpgradeClient { @@ -86,7 +86,7 @@ export class MsgUpgradeClient extends JSONSerializable< Buffer.from(proto.proofUpgradeClient).toString('base64'), Buffer.from(proto.proofUpgradeConsensusState).toString('base64'), proto.signer - ); + ) } public toProto(): MsgUpgradeClient.Proto { @@ -97,7 +97,7 @@ export class MsgUpgradeClient extends JSONSerializable< proof_upgrade_client, proof_upgrade_consensus_state, signer, - } = this; + } = this return MsgUpgradeClient_pb.fromPartial({ clientId: client_id, clientState: client_state, @@ -108,30 +108,30 @@ export class MsgUpgradeClient extends JSONSerializable< 'base64' ), signer: signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.client.v1.MsgUpgradeClient', value: MsgUpgradeClient_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpgradeClient { - return MsgUpgradeClient.fromProto(MsgUpgradeClient_pb.decode(msgAny.value)); + return MsgUpgradeClient.fromProto(MsgUpgradeClient_pb.decode(msgAny.value)) } } export namespace MsgUpgradeClient { export interface Data { - '@type': '/ibc.core.client.v1.MsgUpgradeClient'; - client_id: string; - client_state: any; - consensus_state: any; - proof_upgrade_client: string; - proof_upgrade_consensus_state: string; - signer: AccAddress; + '@type': '/ibc.core.client.v1.MsgUpgradeClient' + client_id: string + client_state: any + consensus_state: any + proof_upgrade_client: string + proof_upgrade_consensus_state: string + signer: AccAddress } - export type Proto = MsgUpgradeClient_pb; + export type Proto = MsgUpgradeClient_pb } diff --git a/src/core/ibc/core/client/msgs/index.ts b/src/core/ibc/core/client/msgs/index.ts index 6cb88ce..5fd6493 100644 --- a/src/core/ibc/core/client/msgs/index.ts +++ b/src/core/ibc/core/client/msgs/index.ts @@ -1,18 +1,18 @@ -import { MsgCreateClient } from './MsgCreateClient'; -import { MsgSubmitMisbehaviour } from './MsgSubmitMisbehaviour'; -import { MsgUpdateClient } from './MsgUpdateClient'; -import { MsgUpgradeClient } from './MsgUpgradeClient'; -import { MsgRecoverClient } from './MsgRecoverClient'; -import { MsgIBCSoftwareUpgrade } from './MsgIBCSoftwareUpgrade'; -import { MsgUpdateIbcClientParams } from './MsgUpdateIbcClientParams'; +import { MsgCreateClient } from './MsgCreateClient' +import { MsgSubmitMisbehaviour } from './MsgSubmitMisbehaviour' +import { MsgUpdateClient } from './MsgUpdateClient' +import { MsgUpgradeClient } from './MsgUpgradeClient' +import { MsgRecoverClient } from './MsgRecoverClient' +import { MsgIBCSoftwareUpgrade } from './MsgIBCSoftwareUpgrade' +import { MsgUpdateIbcClientParams } from './MsgUpdateIbcClientParams' -export * from './MsgCreateClient'; -export * from './MsgUpdateClient'; -export * from './MsgUpgradeClient'; -export * from './MsgSubmitMisbehaviour'; -export * from './MsgRecoverClient'; -export * from './MsgIBCSoftwareUpgrade'; -export * from './MsgUpdateIbcClientParams'; +export * from './MsgCreateClient' +export * from './MsgUpdateClient' +export * from './MsgUpgradeClient' +export * from './MsgSubmitMisbehaviour' +export * from './MsgRecoverClient' +export * from './MsgIBCSoftwareUpgrade' +export * from './MsgUpdateIbcClientParams' export type IbcClientMsg = | MsgCreateClient @@ -21,7 +21,7 @@ export type IbcClientMsg = | MsgSubmitMisbehaviour | MsgRecoverClient | MsgIBCSoftwareUpgrade - | MsgUpdateIbcClientParams; + | MsgUpdateIbcClientParams export namespace IbcClientMsg { export type Data = @@ -31,7 +31,7 @@ export namespace IbcClientMsg { | MsgSubmitMisbehaviour.Data | MsgRecoverClient.Data | MsgIBCSoftwareUpgrade.Data - | MsgUpdateIbcClientParams.Data; + | MsgUpdateIbcClientParams.Data export type Proto = | MsgCreateClient.Proto @@ -40,5 +40,5 @@ export namespace IbcClientMsg { | MsgSubmitMisbehaviour.Proto | MsgRecoverClient.Proto | MsgIBCSoftwareUpgrade.Proto - | MsgUpdateIbcClientParams.Proto; + | MsgUpdateIbcClientParams.Proto } diff --git a/src/core/ibc/core/client/msgs/tendermint/crypto.ts b/src/core/ibc/core/client/msgs/tendermint/crypto.ts index 1aef582..51d1e1d 100644 --- a/src/core/ibc/core/client/msgs/tendermint/crypto.ts +++ b/src/core/ibc/core/client/msgs/tendermint/crypto.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../../../../util/json'; -import { Proof as Proof_pb } from '@initia/initia.proto/tendermint/crypto/proof'; -import { PublicKey as PublicKey_pb } from '@initia/initia.proto/tendermint/crypto/keys'; -import Long from 'long'; +import { JSONSerializable } from '../../../../../../util/json' +import { Proof as Proof_pb } from '@initia/initia.proto/tendermint/crypto/proof' +import { PublicKey as PublicKey_pb } from '@initia/initia.proto/tendermint/crypto/keys' +import Long from 'long' export class Proof extends JSONSerializable { /** @@ -16,37 +16,37 @@ export class Proof extends JSONSerializable { public leafHash: string, public aunts: string[] ) { - super(); + super() } public static fromAmino(_: any): Proof { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Proof.Data): Proof { - const { total, index, leaf_hash: leafHash, aunts } = data; + const { total, index, leaf_hash: leafHash, aunts } = data return new Proof( Number.parseInt(total), Number.parseInt(index), leafHash, aunts - ); + ) } public toData(): Proof.Data { - const { total, index, leafHash, aunts } = this; + const { total, index, leafHash, aunts } = this const res: Proof.Data = { total: total.toFixed(), index: index.toFixed(), leaf_hash: leafHash, aunts, - }; - return res; + } + return res } public static fromProto(proto: Proof.Proto): Proof { @@ -54,30 +54,30 @@ export class Proof extends JSONSerializable { proto.total.toNumber(), proto.index.toNumber(), Buffer.from(proto.leafHash).toString('base64'), - proto.aunts.map(aunt => Buffer.from(aunt).toString('base64')) - ); + proto.aunts.map((aunt) => Buffer.from(aunt).toString('base64')) + ) } public toProto(): Proof.Proto { - const { total, index, leafHash, aunts } = this; + const { total, index, leafHash, aunts } = this return Proof_pb.fromPartial({ total: Long.fromNumber(total), index: Long.fromNumber(index), leafHash: Buffer.from(leafHash, 'base64'), - aunts: aunts.map(aunt => Buffer.from(aunt, 'base64')), - }); + aunts: aunts.map((aunt) => Buffer.from(aunt, 'base64')), + }) } } export namespace Proof { export interface Data { - total: string; - index: string; - leaf_hash: string; - aunts: string[]; + total: string + index: string + leaf_hash: string + aunts: string[] } - export type Proto = Proof_pb; + export type Proto = Proof_pb } /** PublicKey defines the keys available for use with Tendermint Validators */ @@ -90,55 +90,58 @@ export class PublicKey extends JSONSerializable< * @param ed25519 * @param secp256k1 */ - constructor(public ed25519?: string, public secp256k1?: string) { - super(); + constructor( + public ed25519?: string, + public secp256k1?: string + ) { + super() } public static fromAmino(_: any): PublicKey { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: PublicKey.Data): PublicKey { - const { ed25519, secp256k1 } = data; - return new PublicKey(ed25519, secp256k1); + const { ed25519, secp256k1 } = data + return new PublicKey(ed25519, secp256k1) } public toData(): PublicKey.Data { - const { ed25519, secp256k1 } = this; + const { ed25519, secp256k1 } = this const res: PublicKey.Data = { ed25519, secp256k1, - }; - return res; + } + return res } public static fromProto(proto: PublicKey.Proto): PublicKey { - const { ed25519, secp256k1 } = proto; + const { ed25519, secp256k1 } = proto return new PublicKey( ed25519 ? Buffer.from(ed25519).toString('base64') : undefined, secp256k1 ? Buffer.from(secp256k1).toString('base64') : undefined - ); + ) } public toProto(): PublicKey.Proto { - const { ed25519, secp256k1 } = this; + const { ed25519, secp256k1 } = this return PublicKey_pb.fromPartial({ ed25519: ed25519 ? Buffer.from(ed25519, 'base64') : undefined, secp256k1: secp256k1 ? Buffer.from(secp256k1, 'base64') : undefined, - }); + }) } } export namespace PublicKey { export interface Data { - ed25519?: string; - secp256k1?: string; + ed25519?: string + secp256k1?: string } - export type Proto = PublicKey_pb; + export type Proto = PublicKey_pb } diff --git a/src/core/ibc/core/client/msgs/tendermint/types.ts b/src/core/ibc/core/client/msgs/tendermint/types.ts index bb63e79..38dbdb3 100644 --- a/src/core/ibc/core/client/msgs/tendermint/types.ts +++ b/src/core/ibc/core/client/msgs/tendermint/types.ts @@ -1,4 +1,4 @@ -import { JSONSerializable } from '../../../../../../util/json'; +import { JSONSerializable } from '../../../../../../util/json' import { Header as Header_pb, SignedHeader as SignedHeader_pb, @@ -6,17 +6,17 @@ import { PartSetHeader as PartSetHeader_pb, Commit as Commit_pb, CommitSig as CommitSig_pb, -} from '@initia/initia.proto/tendermint/types/types'; +} from '@initia/initia.proto/tendermint/types/types' import { Validator as Validator_pb, ValidatorSet as ValidatorSet_pb, BlockIDFlag, blockIDFlagFromJSON, blockIDFlagToJSON, -} from '@initia/initia.proto/tendermint/types/validator'; -import { Consensus } from './version'; -import { PublicKey } from './crypto'; -import Long from 'long'; +} from '@initia/initia.proto/tendermint/types/validator' +import { Consensus } from './version' +import { PublicKey } from './crypto' +import Long from 'long' /** Header defines the structure of a Tendermint block header. */ export class Header extends JSONSerializable { @@ -40,16 +40,16 @@ export class Header extends JSONSerializable { public evidenceHash: string, public proposerAddress: string ) { - super(); + super() } public static fromAmino(_: any): Header { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Header.Data): Header { @@ -68,7 +68,7 @@ export class Header extends JSONSerializable { last_results_hash: lastResultsHash, evidence_hash: evidenceHash, proposer_address: proposerAddress, - } = data; + } = data return new Header( version ? Consensus.fromData(version) : undefined, chainId, @@ -84,7 +84,7 @@ export class Header extends JSONSerializable { lastResultsHash, evidenceHash, proposerAddress - ); + ) } public toData(): Header.Data { @@ -103,7 +103,7 @@ export class Header extends JSONSerializable { lastResultsHash, evidenceHash, proposerAddress, - } = this; + } = this const res: Header.Data = { version: version?.toData(), chain_id: chainId, @@ -119,8 +119,8 @@ export class Header extends JSONSerializable { last_results_hash: lastResultsHash, evidence_hash: evidenceHash, proposer_address: proposerAddress, - }; - return res; + } + return res } public static fromProto(proto: Header.Proto): Header { @@ -139,7 +139,7 @@ export class Header extends JSONSerializable { lastResultsHash, evidenceHash, proposerAddress, - } = proto; + } = proto return new Header( version ? Consensus.fromProto(version) : undefined, chainId, @@ -155,7 +155,7 @@ export class Header extends JSONSerializable { Buffer.from(lastResultsHash).toString('base64'), Buffer.from(evidenceHash).toString('base64'), Buffer.from(proposerAddress).toString('base64') - ); + ) } public toProto(): Header.Proto { @@ -174,7 +174,7 @@ export class Header extends JSONSerializable { lastResultsHash, evidenceHash, proposerAddress, - } = this; + } = this return Header_pb.fromPartial({ version: version?.toProto(), chainId, @@ -190,29 +190,29 @@ export class Header extends JSONSerializable { lastResultsHash: Buffer.from(lastResultsHash, 'base64'), evidenceHash: Buffer.from(evidenceHash, 'base64'), proposerAddress: Buffer.from(proposerAddress, 'base64'), - }); + }) } } export namespace Header { export interface Data { - version?: Consensus.Data; - chain_id: string; - height: string; - time?: string; - last_block_id?: BlockID.Data; - last_commit_hash: string; - data_hash: string; - validators_hash: string; - next_validators_hash: string; - consensus_hash: string; - app_hash: string; - last_results_hash: string; - evidence_hash: string; - proposer_address: string; - } - - export type Proto = Header_pb; + version?: Consensus.Data + chain_id: string + height: string + time?: string + last_block_id?: BlockID.Data + last_commit_hash: string + data_hash: string + validators_hash: string + next_validators_hash: string + consensus_hash: string + app_hash: string + last_results_hash: string + evidence_hash: string + proposer_address: string + } + + export type Proto = Header_pb } export class SignedHeader extends JSONSerializable< @@ -224,59 +224,62 @@ export class SignedHeader extends JSONSerializable< * @param header * @param commit */ - constructor(public header?: Header, public commit?: Commit) { - super(); + constructor( + public header?: Header, + public commit?: Commit + ) { + super() } public static fromAmino(_: any): SignedHeader { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: SignedHeader.Data): SignedHeader { - const { header, commit } = data; + const { header, commit } = data return new SignedHeader( header ? Header.fromData(header) : undefined, commit ? Commit.fromData(commit) : undefined - ); + ) } public toData(): SignedHeader.Data { - const { header, commit } = this; + const { header, commit } = this const res: SignedHeader.Data = { header: header?.toData(), commit: commit?.toData(), - }; - return res; + } + return res } public static fromProto(proto: SignedHeader.Proto): SignedHeader { return new SignedHeader( proto.header ? Header.fromProto(proto.header) : undefined, proto.commit ? Commit.fromProto(proto.commit) : undefined - ); + ) } public toProto(): SignedHeader.Proto { - const { header, commit } = this; + const { header, commit } = this return SignedHeader_pb.fromPartial({ header: header?.toProto(), commit: commit?.toProto(), - }); + }) } } export namespace SignedHeader { export interface Data { - header?: Header.Data; - commit?: Commit.Data; + header?: Header.Data + commit?: Commit.Data } - export type Proto = SignedHeader_pb; + export type Proto = SignedHeader_pb } /** BlockID */ @@ -289,34 +292,37 @@ export class BlockID extends JSONSerializable< * @param hash * @param partSetHeader */ - constructor(public hash: string, public partSetHeader?: PartSetHeader) { - super(); + constructor( + public hash: string, + public partSetHeader?: PartSetHeader + ) { + super() } public static fromAmino(_: any): BlockID { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: BlockID.Data): BlockID { - const { hash, part_set_header: partSetHeader } = data; + const { hash, part_set_header: partSetHeader } = data return new BlockID( hash, partSetHeader ? PartSetHeader.fromData(partSetHeader) : undefined - ); + ) } public toData(): BlockID.Data { - const { hash, partSetHeader } = this; + const { hash, partSetHeader } = this const res: BlockID.Data = { hash, part_set_header: partSetHeader?.toData(), - }; - return res; + } + return res } public static fromProto(proto: BlockID.Proto): BlockID { @@ -325,25 +331,25 @@ export class BlockID extends JSONSerializable< proto.partSetHeader ? PartSetHeader.fromProto(proto.partSetHeader) : undefined - ); + ) } public toProto(): BlockID.Proto { - const { hash, partSetHeader } = this; + const { hash, partSetHeader } = this return BlockID_pb.fromPartial({ hash: Buffer.from(hash, 'base64'), partSetHeader: partSetHeader?.toProto(), - }); + }) } } export namespace BlockID { export interface Data { - hash: string; - part_set_header?: PartSetHeader.Data; + hash: string + part_set_header?: PartSetHeader.Data } - export type Proto = BlockID_pb; + export type Proto = BlockID_pb } /** PartsetHeader */ @@ -356,56 +362,59 @@ export class PartSetHeader extends JSONSerializable< * @param total * @param hash */ - constructor(public total: number, public hash: string) { - super(); + constructor( + public total: number, + public hash: string + ) { + super() } public static fromAmino(_: any): PartSetHeader { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: PartSetHeader.Data): PartSetHeader { - const { total, hash } = data; - return new PartSetHeader(parseInt(total), hash); + const { total, hash } = data + return new PartSetHeader(parseInt(total), hash) } public toData(): PartSetHeader.Data { - const { total, hash } = this; + const { total, hash } = this const res: PartSetHeader.Data = { total: total.toFixed(), hash: hash, - }; - return res; + } + return res } public static fromProto(proto: PartSetHeader.Proto): PartSetHeader { return new PartSetHeader( proto.total, Buffer.from(proto.hash).toString('base64') - ); + ) } public toProto(): PartSetHeader.Proto { - const { total, hash } = this; + const { total, hash } = this return PartSetHeader_pb.fromPartial({ total: total, hash: Buffer.from(hash, 'base64'), - }); + }) } } export namespace PartSetHeader { export interface Data { - total: string; - hash: string; + total: string + hash: string } - export type Proto = PartSetHeader_pb; + export type Proto = PartSetHeader_pb } /** Commit contains the evidence that a block was committed by a set of validators. */ @@ -422,69 +431,69 @@ export class Commit extends JSONSerializable { public blockId: BlockID | undefined, public signatures: CommitSig[] ) { - super(); + super() } public static fromAmino(_: any): Commit { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Commit.Data): Commit { - const { height, round, block_id: blockId, signatures } = data; + const { height, round, block_id: blockId, signatures } = data return new Commit( Long.fromString(height), Number.parseInt(round), blockId ? BlockID.fromData(blockId) : undefined, - signatures.map(sig => CommitSig.fromData(sig)) - ); + signatures.map((sig) => CommitSig.fromData(sig)) + ) } public toData(): Commit.Data { - const { height, round, blockId, signatures } = this; + const { height, round, blockId, signatures } = this const res: Commit.Data = { height: height.toString(), round: round.toFixed(), block_id: blockId?.toData(), - signatures: signatures.map(sig => sig.toData()), - }; - return res; + signatures: signatures.map((sig) => sig.toData()), + } + return res } public static fromProto(proto: Commit.Proto): Commit { - const { height, round, blockId, signatures } = proto; + const { height, round, blockId, signatures } = proto return new Commit( height, round, blockId ? BlockID.fromProto(blockId) : undefined, - signatures.map(sig => CommitSig.fromProto(sig)) - ); + signatures.map((sig) => CommitSig.fromProto(sig)) + ) } public toProto(): Commit.Proto { - const { height, round, blockId, signatures } = this; + const { height, round, blockId, signatures } = this return Commit_pb.fromPartial({ height, round, blockId: blockId?.toProto(), - signatures: signatures.map(sig => sig.toProto()), - }); + signatures: signatures.map((sig) => sig.toProto()), + }) } } export namespace Commit { export interface Data { - height: string; - round: string; - block_id?: BlockID.Data; - signatures: CommitSig.Data[]; + height: string + round: string + block_id?: BlockID.Data + signatures: CommitSig.Data[] } - export type Proto = Commit_pb; + export type Proto = Commit_pb } /** CommitSig is a part of the Vote included in a Commit. */ @@ -505,51 +514,51 @@ export class CommitSig extends JSONSerializable< public timestamp?: Date, public signature?: string ) { - super(); + super() } public static fromAmino(_: any): CommitSig { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: CommitSig.Data): CommitSig { - const { block_id_flag, validator_address, timestamp, signature } = data; + const { block_id_flag, validator_address, timestamp, signature } = data return new CommitSig( blockIDFlagFromJSON(block_id_flag), validator_address, timestamp ? new Date(timestamp) : undefined, signature - ); + ) } public toData(): CommitSig.Data { - const { blockIdFlag, validatorAddress, timestamp, signature } = this; + const { blockIdFlag, validatorAddress, timestamp, signature } = this const res: CommitSig.Data = { block_id_flag: blockIDFlagToJSON(blockIdFlag), validator_address: validatorAddress ?? '', timestamp: timestamp?.toISOString().replace(/\.000Z$/, 'Z'), signature: signature ?? '', - }; - return res; + } + return res } public static fromProto(proto: CommitSig.Proto): CommitSig { - const { blockIdFlag, validatorAddress, timestamp, signature } = proto; + const { blockIdFlag, validatorAddress, timestamp, signature } = proto return new CommitSig( blockIdFlag, Buffer.from(validatorAddress).toString('base64'), timestamp, Buffer.from(signature).toString('base64') - ); + ) } public toProto(): CommitSig.Proto { - const { blockIdFlag, validatorAddress, timestamp, signature } = this; + const { blockIdFlag, validatorAddress, timestamp, signature } = this return CommitSig_pb.fromPartial({ blockIdFlag, validatorAddress: validatorAddress @@ -557,19 +566,19 @@ export class CommitSig extends JSONSerializable< : undefined, timestamp, signature: signature ? Buffer.from(signature, 'base64') : undefined, - }); + }) } } export namespace CommitSig { export interface Data { - block_id_flag: string; - validator_address?: string; - timestamp?: string; - signature?: string; + block_id_flag: string + validator_address?: string + timestamp?: string + signature?: string } - export type Proto = CommitSig_pb; + export type Proto = CommitSig_pb } export class ValidatorSet extends JSONSerializable< @@ -587,64 +596,64 @@ export class ValidatorSet extends JSONSerializable< public proposer: Validator | undefined, public totalVotingPower: Long ) { - super(); + super() } public static fromAmino(_: any): ValidatorSet { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: ValidatorSet.Data): ValidatorSet { - const { validators, proposer, total_voting_power } = data; + const { validators, proposer, total_voting_power } = data return new ValidatorSet( - validators.map(val => Validator.fromData(val)), + validators.map((val) => Validator.fromData(val)), proposer ? Validator.fromData(proposer) : undefined, Long.fromString(total_voting_power) - ); + ) } public toData(): ValidatorSet.Data { - const { validators, proposer, totalVotingPower } = this; + const { validators, proposer, totalVotingPower } = this const res: ValidatorSet.Data = { - validators: validators.map(val => val.toData()), + validators: validators.map((val) => val.toData()), proposer: proposer?.toData(), total_voting_power: totalVotingPower.toString(), - }; - return res; + } + return res } public static fromProto(proto: ValidatorSet.Proto): ValidatorSet { - const { validators, proposer, totalVotingPower } = proto; + const { validators, proposer, totalVotingPower } = proto return new ValidatorSet( - validators.map(val => Validator.fromProto(val)), + validators.map((val) => Validator.fromProto(val)), proposer ? Validator.fromProto(proposer) : undefined, totalVotingPower - ); + ) } public toProto(): ValidatorSet.Proto { - const { validators, proposer, totalVotingPower } = this; + const { validators, proposer, totalVotingPower } = this return ValidatorSet_pb.fromPartial({ - validators: validators.map(val => val.toProto()), + validators: validators.map((val) => val.toProto()), proposer: proposer?.toProto(), totalVotingPower, - }); + }) } } export namespace ValidatorSet { export interface Data { - validators: Validator.Data[]; - proposer?: Validator.Data; - total_voting_power: string; + validators: Validator.Data[] + proposer?: Validator.Data + total_voting_power: string } - export type Proto = ValidatorSet_pb; + export type Proto = ValidatorSet_pb } export class Validator extends JSONSerializable< @@ -664,16 +673,16 @@ export class Validator extends JSONSerializable< public votingPower: Long, public proposerPriority: Long ) { - super(); + super() } public static fromAmino(_: any): Validator { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Validator.Data): Validator { @@ -682,54 +691,54 @@ export class Validator extends JSONSerializable< pub_key: pubKey, voting_power: votingPower, proposer_priority: proposerPriority, - } = data; + } = data return new Validator( address, pubKey ? PublicKey.fromData(pubKey) : undefined, Long.fromString(votingPower), Long.fromString(proposerPriority) - ); + ) } public toData(): Validator.Data { - const { address, pubKey, votingPower, proposerPriority } = this; + const { address, pubKey, votingPower, proposerPriority } = this const res: Validator.Data = { address, pub_key: pubKey?.toData(), voting_power: votingPower.toString(), proposer_priority: proposerPriority.toString(), - }; - return res; + } + return res } public static fromProto(proto: Validator.Proto): Validator { - const { address, pubKey, votingPower, proposerPriority } = proto; + const { address, pubKey, votingPower, proposerPriority } = proto return new Validator( Buffer.from(address).toString('base64'), pubKey ? PublicKey.fromProto(pubKey) : undefined, votingPower, proposerPriority - ); + ) } public toProto(): Validator.Proto { - const { address, pubKey, votingPower, proposerPriority } = this; + const { address, pubKey, votingPower, proposerPriority } = this return Validator_pb.fromPartial({ address: Buffer.from(address, 'base64'), pubKey: pubKey?.toProto(), votingPower, proposerPriority, - }); + }) } } export namespace Validator { export interface Data { - address: string; - pub_key?: PublicKey.Data; - voting_power: string; - proposer_priority: string; + address: string + pub_key?: PublicKey.Data + voting_power: string + proposer_priority: string } - export type Proto = Validator_pb; + export type Proto = Validator_pb } diff --git a/src/core/ibc/core/client/msgs/tendermint/version.ts b/src/core/ibc/core/client/msgs/tendermint/version.ts index 33e4578..5e19803 100644 --- a/src/core/ibc/core/client/msgs/tendermint/version.ts +++ b/src/core/ibc/core/client/msgs/tendermint/version.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../../../../util/json'; +import { JSONSerializable } from '../../../../../../util/json' import { Consensus as Consensus_pb, App as App_pb, -} from '@initia/initia.proto/tendermint/version/types'; -import Long from 'long'; +} from '@initia/initia.proto/tendermint/version/types' +import Long from 'long' /** * Consensus captures the consensus rules for processing a block in the blockchain, @@ -19,53 +19,56 @@ export class Consensus extends JSONSerializable< * @param block * @param app */ - constructor(public block: number, public app: number) { - super(); + constructor( + public block: number, + public app: number + ) { + super() } public static fromAmino(_: any): Consensus { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Consensus.Data): Consensus { - const { block, app } = data; - return new Consensus(Number.parseInt(block), Number.parseInt(app)); + const { block, app } = data + return new Consensus(Number.parseInt(block), Number.parseInt(app)) } public toData(): Consensus.Data { - const { block, app } = this; + const { block, app } = this const res: Consensus.Data = { block: block.toFixed(), app: app.toFixed(), - }; - return res; + } + return res } public static fromProto(proto: Consensus.Proto): Consensus { - return new Consensus(proto.block.toNumber(), proto.app.toNumber()); + return new Consensus(proto.block.toNumber(), proto.app.toNumber()) } public toProto(): Consensus.Proto { - const { block, app } = this; + const { block, app } = this return Consensus_pb.fromPartial({ block: Long.fromNumber(block), app: Long.fromNumber(app), - }); + }) } } export namespace Consensus { export interface Data { - block: string; - app: string; + block: string + app: string } - export type Proto = Consensus_pb; + export type Proto = Consensus_pb } /** @@ -78,51 +81,54 @@ export class App extends JSONSerializable { * @param protocol * @param software */ - constructor(public protocol: number, public software: string) { - super(); + constructor( + public protocol: number, + public software: string + ) { + super() } public static fromAmino(_: any): App { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: App.Data): App { - const { protocol, software } = data; - return new App(Number.parseInt(protocol), software); + const { protocol, software } = data + return new App(Number.parseInt(protocol), software) } public toData(): App.Data { - const { protocol, software } = this; + const { protocol, software } = this const res: App.Data = { protocol: protocol.toFixed(), software: software, - }; - return res; + } + return res } public static fromProto(proto: App.Proto): App { - return new App(proto.protocol.toNumber(), proto.software); + return new App(proto.protocol.toNumber(), proto.software) } public toProto(): App.Proto { - const { protocol, software } = this; + const { protocol, software } = this return App_pb.fromPartial({ protocol: Long.fromNumber(protocol), software: software, - }); + }) } } export namespace App { export interface Data { - protocol: string; - software: string; + protocol: string + software: string } - export type Proto = App_pb; + export type Proto = App_pb } diff --git a/src/core/ibc/core/commitment/MerklePrefix.ts b/src/core/ibc/core/commitment/MerklePrefix.ts index eac253d..7f7ff7f 100644 --- a/src/core/ibc/core/commitment/MerklePrefix.ts +++ b/src/core/ibc/core/commitment/MerklePrefix.ts @@ -1,5 +1,5 @@ -import { MerklePrefix as MerklePrefix_pb } from '@initia/initia.proto/ibc/core/commitment/v1/commitment'; -import { JSONSerializable } from '../../../../util/json'; +import { MerklePrefix as MerklePrefix_pb } from '@initia/initia.proto/ibc/core/commitment/v1/commitment' +import { JSONSerializable } from '../../../../util/json' /* * MerklePrefix is merkle path prefixed to the key. @@ -15,55 +15,55 @@ export class MerklePrefix extends JSONSerializable< * @param key_prefix */ constructor(public key_prefix: string) { - super(); + super() } public static fromAmino(data: MerklePrefix.Amino): MerklePrefix { - const { key_prefix } = data; - return new MerklePrefix(key_prefix); + const { key_prefix } = data + return new MerklePrefix(key_prefix) } public toAmino(): MerklePrefix.Amino { - const { key_prefix } = this; + const { key_prefix } = this const res: MerklePrefix.Amino = { key_prefix, - }; - return res; + } + return res } public static fromData(data: MerklePrefix.Data): MerklePrefix { - const { key_prefix } = data; - return new MerklePrefix(key_prefix); + const { key_prefix } = data + return new MerklePrefix(key_prefix) } public toData(): MerklePrefix.Data { - const { key_prefix } = this; + const { key_prefix } = this const res: MerklePrefix.Data = { key_prefix, - }; - return res; + } + return res } public static fromProto(proto: MerklePrefix.Proto): MerklePrefix { - return new MerklePrefix(Buffer.from(proto.keyPrefix).toString('base64')); + return new MerklePrefix(Buffer.from(proto.keyPrefix).toString('base64')) } public toProto(): MerklePrefix.Proto { - const { key_prefix } = this; + const { key_prefix } = this return MerklePrefix_pb.fromPartial({ keyPrefix: Buffer.from(key_prefix, 'base64'), - }); + }) } } export namespace MerklePrefix { export interface Amino { - key_prefix: string; + key_prefix: string } export interface Data { - key_prefix: string; + key_prefix: string } - export type Proto = MerklePrefix_pb; + export type Proto = MerklePrefix_pb } diff --git a/src/core/ibc/core/commitment/MerkleRoot.ts b/src/core/ibc/core/commitment/MerkleRoot.ts index 3577151..916ec2d 100644 --- a/src/core/ibc/core/commitment/MerkleRoot.ts +++ b/src/core/ibc/core/commitment/MerkleRoot.ts @@ -1,5 +1,5 @@ -import { MerkleRoot as MerkleRoot_pb } from '@initia/initia.proto/ibc/core/commitment/v1/commitment'; -import { JSONSerializable } from '../../../../util/json'; +import { MerkleRoot as MerkleRoot_pb } from '@initia/initia.proto/ibc/core/commitment/v1/commitment' +import { JSONSerializable } from '../../../../util/json' // MerkleRoot defines a merkle root hash. // In the Cosmos SDK, the AppHash of a block header becomes the root. @@ -12,48 +12,48 @@ export class MerkleRoot extends JSONSerializable< * @param hash */ constructor(public hash: string) { - super(); + super() } public static fromAmino(_: any): MerkleRoot { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: MerkleRoot.Data): MerkleRoot { - return new MerkleRoot(data.hash); + return new MerkleRoot(data.hash) } public toData(): MerkleRoot.Data { const res: MerkleRoot.Data = { hash: this.hash, - }; - return res; + } + return res } public static fromProto(proto: MerkleRoot.Proto): MerkleRoot { - return new MerkleRoot(Buffer.from(proto.hash).toString('base64')); + return new MerkleRoot(Buffer.from(proto.hash).toString('base64')) } public toProto(): MerkleRoot.Proto { return MerkleRoot_pb.fromPartial({ hash: Buffer.from(this.hash, 'base64'), - }); + }) } } export namespace MerkleRoot { export interface Amino { - hash: string; + hash: string } export interface Data { - hash: string; + hash: string } - export type Proto = MerkleRoot_pb; + export type Proto = MerkleRoot_pb } diff --git a/src/core/ibc/core/commitment/index.ts b/src/core/ibc/core/commitment/index.ts index 03260c0..a8b308b 100644 --- a/src/core/ibc/core/commitment/index.ts +++ b/src/core/ibc/core/commitment/index.ts @@ -1,2 +1,2 @@ -export * from './MerklePrefix'; -export * from './MerkleRoot'; +export * from './MerklePrefix' +export * from './MerkleRoot' diff --git a/src/core/ibc/core/connection/ConnectionCounterparty.ts b/src/core/ibc/core/connection/ConnectionCounterparty.ts index 619bdc1..a814084 100644 --- a/src/core/ibc/core/connection/ConnectionCounterparty.ts +++ b/src/core/ibc/core/connection/ConnectionCounterparty.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Counterparty as Counterparty_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection'; -import { MerklePrefix } from '../commitment/MerklePrefix'; +import { JSONSerializable } from '../../../../util/json' +import { Counterparty as Counterparty_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection' +import { MerklePrefix } from '../commitment/MerklePrefix' /** ConnectionCounterparty defines the ConnectionCounterparty chain associated with a connection end */ export class ConnectionCounterparty extends JSONSerializable< @@ -18,49 +18,49 @@ export class ConnectionCounterparty extends JSONSerializable< public connection_id: string, public prefix?: MerklePrefix ) { - super(); + super() } public static fromAmino( data: ConnectionCounterparty.Amino ): ConnectionCounterparty { - const { client_id, connection_id, prefix } = data; + const { client_id, connection_id, prefix } = data return new ConnectionCounterparty( client_id, connection_id, prefix ? MerklePrefix.fromAmino(prefix) : undefined - ); + ) } public toAmino(): ConnectionCounterparty.Amino { - const { client_id, connection_id, prefix } = this; + const { client_id, connection_id, prefix } = this const res: ConnectionCounterparty.Amino = { client_id, connection_id, prefix, - }; - return res; + } + return res } public static fromData( data: ConnectionCounterparty.Data ): ConnectionCounterparty { - const { client_id, connection_id, prefix } = data; + const { client_id, connection_id, prefix } = data return new ConnectionCounterparty( client_id, connection_id, prefix ? MerklePrefix.fromData(prefix) : undefined - ); + ) } public toData(): ConnectionCounterparty.Data { - const { client_id, connection_id, prefix } = this; + const { client_id, connection_id, prefix } = this const res: ConnectionCounterparty.Data = { client_id, connection_id, prefix: prefix?.toData(), - }; - return res; + } + return res } public static fromProto( @@ -70,31 +70,31 @@ export class ConnectionCounterparty extends JSONSerializable< proto.clientId, proto.connectionId, proto.prefix ? MerklePrefix.fromProto(proto.prefix) : undefined - ); + ) } public toProto(): ConnectionCounterparty.Proto { - const { client_id, connection_id, prefix } = this; + const { client_id, connection_id, prefix } = this return Counterparty_pb.fromPartial({ clientId: client_id, connectionId: connection_id, prefix: prefix?.toProto(), - }); + }) } } export namespace ConnectionCounterparty { export interface Amino { - client_id: string; - connection_id: string; - prefix?: MerklePrefix.Amino; + client_id: string + connection_id: string + prefix?: MerklePrefix.Amino } export interface Data { - client_id: string; - connection_id: string; - prefix?: MerklePrefix.Data; + client_id: string + connection_id: string + prefix?: MerklePrefix.Data } - export type Proto = Counterparty_pb; + export type Proto = Counterparty_pb } diff --git a/src/core/ibc/core/connection/IbcConnectionParams.ts b/src/core/ibc/core/connection/IbcConnectionParams.ts index f4b2ea1..1944c7b 100644 --- a/src/core/ibc/core/connection/IbcConnectionParams.ts +++ b/src/core/ibc/core/connection/IbcConnectionParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection'; -import Long from 'long'; +import { JSONSerializable } from '../../../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection' +import Long from 'long' export class IbcConnectionParams extends JSONSerializable< IbcConnectionParams.Amino, @@ -11,61 +11,57 @@ export class IbcConnectionParams extends JSONSerializable< * @param max_expected_time_per_block maximum expected time per block (in nanoseconds), used to enforce block delay */ constructor(public max_expected_time_per_block: number) { - super(); + super() } public static fromAmino( data: IbcConnectionParams.Amino ): IbcConnectionParams { - const { max_expected_time_per_block } = data; - return new IbcConnectionParams( - Number.parseInt(max_expected_time_per_block) - ); + const { max_expected_time_per_block } = data + return new IbcConnectionParams(Number.parseInt(max_expected_time_per_block)) } public toAmino(): IbcConnectionParams.Amino { - const { max_expected_time_per_block } = this; + const { max_expected_time_per_block } = this return { max_expected_time_per_block: max_expected_time_per_block.toString(), - }; + } } public static fromData(data: IbcConnectionParams.Data): IbcConnectionParams { - const { max_expected_time_per_block } = data; - return new IbcConnectionParams( - Number.parseInt(max_expected_time_per_block) - ); + const { max_expected_time_per_block } = data + return new IbcConnectionParams(Number.parseInt(max_expected_time_per_block)) } public toData(): IbcConnectionParams.Data { - const { max_expected_time_per_block } = this; + const { max_expected_time_per_block } = this return { max_expected_time_per_block: max_expected_time_per_block.toString(), - }; + } } public static fromProto( proto: IbcConnectionParams.Proto ): IbcConnectionParams { - return new IbcConnectionParams(proto.maxExpectedTimePerBlock.toNumber()); + return new IbcConnectionParams(proto.maxExpectedTimePerBlock.toNumber()) } public toProto(): IbcConnectionParams.Proto { - const { max_expected_time_per_block } = this; + const { max_expected_time_per_block } = this return Params_pb.fromPartial({ maxExpectedTimePerBlock: Long.fromNumber(max_expected_time_per_block), - }); + }) } } export namespace IbcConnectionParams { export interface Amino { - max_expected_time_per_block: string; + max_expected_time_per_block: string } export interface Data { - max_expected_time_per_block: string; + max_expected_time_per_block: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibc/core/connection/IbcVersion.ts b/src/core/ibc/core/connection/IbcVersion.ts index 143affa..9cc7d88 100644 --- a/src/core/ibc/core/connection/IbcVersion.ts +++ b/src/core/ibc/core/connection/IbcVersion.ts @@ -1,5 +1,5 @@ -import { Version as Version_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection'; -import { JSONSerializable } from '../../../../util/json'; +import { Version as Version_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection' +import { JSONSerializable } from '../../../../util/json' /* * IbcVersion defines the versioning scheme used to negotiate the IBC version in the connection handshake. @@ -13,58 +13,61 @@ export class IbcVersion extends JSONSerializable< * @param identifier unique version identifier * @param features list of features compatible with the specified identifier */ - constructor(public identifier: string, public features: string[]) { - super(); + constructor( + public identifier: string, + public features: string[] + ) { + super() } public static fromAmino(data: IbcVersion.Amino): IbcVersion { - const { identifier, features } = data; - return new IbcVersion(identifier, features); + const { identifier, features } = data + return new IbcVersion(identifier, features) } public toAmino(): IbcVersion.Amino { - const { identifier, features } = this; + const { identifier, features } = this const res: IbcVersion.Amino = { identifier, features, - }; - return res; + } + return res } public static fromData(data: IbcVersion.Data): IbcVersion { - const { identifier, features } = data; - return new IbcVersion(identifier, features); + const { identifier, features } = data + return new IbcVersion(identifier, features) } public toData(): IbcVersion.Data { - const { identifier, features } = this; + const { identifier, features } = this const res: IbcVersion.Data = { identifier, features, - }; - return res; + } + return res } public static fromProto(proto: IbcVersion.Proto): IbcVersion { - return new IbcVersion(proto.identifier, proto.features); + return new IbcVersion(proto.identifier, proto.features) } public toProto(): IbcVersion.Proto { - const { identifier, features } = this; - return Version_pb.fromPartial({ identifier, features }); + const { identifier, features } = this + return Version_pb.fromPartial({ identifier, features }) } } export namespace IbcVersion { export interface Amino { - identifier: string; - features: string[]; + identifier: string + features: string[] } export interface Data { - identifier: string; - features: string[]; + identifier: string + features: string[] } - export type Proto = Version_pb; + export type Proto = Version_pb } diff --git a/src/core/ibc/core/connection/IdentifiedConnection.ts b/src/core/ibc/core/connection/IdentifiedConnection.ts index 8f4d848..54876fb 100644 --- a/src/core/ibc/core/connection/IdentifiedConnection.ts +++ b/src/core/ibc/core/connection/IdentifiedConnection.ts @@ -1,15 +1,15 @@ -import { IdentifiedConnection as IdentifiedConnection_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection'; -import { JSONSerializable } from '../../../../util/json'; -import { IbcVersion } from './IbcVersion'; +import { IdentifiedConnection as IdentifiedConnection_pb } from '@initia/initia.proto/ibc/core/connection/v1/connection' +import { JSONSerializable } from '../../../../util/json' +import { IbcVersion } from './IbcVersion' import { State, stateFromJSON, stateToJSON, -} from '@initia/initia.proto/ibc/core/connection/v1/connection'; -import { ConnectionCounterparty } from './ConnectionCounterparty'; -import Long from 'long'; +} from '@initia/initia.proto/ibc/core/connection/v1/connection' +import { ConnectionCounterparty } from './ConnectionCounterparty' +import Long from 'long' -export { State, stateFromJSON, stateToJSON }; +export { State, stateFromJSON, stateToJSON } /** * IdentifiedConnection defines a connection with additional connection identifier field @@ -35,13 +35,13 @@ export class IdentifiedConnection extends JSONSerializable< public counterparty: ConnectionCounterparty | undefined, public delay_period: number ) { - super(); + super() } public static fromAmino( data: IdentifiedConnection.Amino ): IdentifiedConnection { - const { id, client_id, versions, state, counterparty, delay_period } = data; + const { id, client_id, versions, state, counterparty, delay_period } = data return new IdentifiedConnection( id, client_id, @@ -49,26 +49,26 @@ export class IdentifiedConnection extends JSONSerializable< stateFromJSON(state), counterparty ? ConnectionCounterparty.fromAmino(counterparty) : undefined, Number.parseInt(delay_period) - ); + ) } public toAmino(): IdentifiedConnection.Amino { - const { id, client_id, versions, state, counterparty, delay_period } = this; + const { id, client_id, versions, state, counterparty, delay_period } = this const res: IdentifiedConnection.Amino = { id, client_id, - versions: versions.map(version => version.toAmino()), + versions: versions.map((version) => version.toAmino()), state: stateToJSON(state), counterparty: counterparty?.toAmino(), delay_period: delay_period.toFixed(), - }; - return res; + } + return res } public static fromData( data: IdentifiedConnection.Data ): IdentifiedConnection { - const { id, client_id, versions, state, counterparty, delay_period } = data; + const { id, client_id, versions, state, counterparty, delay_period } = data return new IdentifiedConnection( id, client_id, @@ -76,20 +76,20 @@ export class IdentifiedConnection extends JSONSerializable< stateFromJSON(state), counterparty ? ConnectionCounterparty.fromData(counterparty) : undefined, Number.parseInt(delay_period) - ); + ) } public toData(): IdentifiedConnection.Data { - const { id, client_id, versions, state, counterparty, delay_period } = this; + const { id, client_id, versions, state, counterparty, delay_period } = this const res: IdentifiedConnection.Amino = { id, client_id, - versions: versions.map(version => version.toData()), + versions: versions.map((version) => version.toData()), state: stateToJSON(state), counterparty: counterparty?.toData(), delay_period: delay_period.toFixed(), - }; - return res; + } + return res } public static fromProto( @@ -104,40 +104,40 @@ export class IdentifiedConnection extends JSONSerializable< ? ConnectionCounterparty.fromProto(proto.counterparty) : undefined, proto.delayPeriod.toNumber() - ); + ) } public toProto(): IdentifiedConnection.Proto { - const { id, client_id, versions, state, counterparty, delay_period } = this; + const { id, client_id, versions, state, counterparty, delay_period } = this return IdentifiedConnection_pb.fromPartial({ id, clientId: client_id, - versions: versions.map(v => v.toProto()), + versions: versions.map((v) => v.toProto()), state, counterparty: counterparty?.toProto(), delayPeriod: Long.fromNumber(delay_period), - }); + }) } } export namespace IdentifiedConnection { export interface Amino { - id: string; - client_id: string; - versions: IbcVersion.Amino[]; - state: string; - counterparty?: ConnectionCounterparty.Amino; - delay_period: string; + id: string + client_id: string + versions: IbcVersion.Amino[] + state: string + counterparty?: ConnectionCounterparty.Amino + delay_period: string } export interface Data { - id: string; - client_id: string; - versions: IbcVersion.Data[]; - state: string; - counterparty?: ConnectionCounterparty.Data; - delay_period: string; + id: string + client_id: string + versions: IbcVersion.Data[] + state: string + counterparty?: ConnectionCounterparty.Data + delay_period: string } - export type Proto = IdentifiedConnection_pb; + export type Proto = IdentifiedConnection_pb } diff --git a/src/core/ibc/core/connection/index.ts b/src/core/ibc/core/connection/index.ts index 156ca26..3c7efcd 100644 --- a/src/core/ibc/core/connection/index.ts +++ b/src/core/ibc/core/connection/index.ts @@ -1,4 +1,4 @@ -export * from './ConnectionCounterparty'; -export * from './IbcVersion'; -export * from './IdentifiedConnection'; -export * from './IbcConnectionParams'; +export * from './ConnectionCounterparty' +export * from './IbcVersion' +export * from './IdentifiedConnection' +export * from './IbcConnectionParams' diff --git a/src/core/ibc/core/connection/msgs/MsgConnectionOpenAck.ts b/src/core/ibc/core/connection/msgs/MsgConnectionOpenAck.ts index 8c1e6b0..e38bad8 100644 --- a/src/core/ibc/core/connection/msgs/MsgConnectionOpenAck.ts +++ b/src/core/ibc/core/connection/msgs/MsgConnectionOpenAck.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgConnectionOpenAck as MsgConnectionOpenAck_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx'; -import { IbcVersion, Height } from '../../../core'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgConnectionOpenAck as MsgConnectionOpenAck_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx' +import { IbcVersion, Height } from '../../../core' /** * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to @@ -37,16 +37,16 @@ export class MsgConnectionOpenAck extends JSONSerializable< public consensus_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgConnectionOpenAck { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( @@ -63,7 +63,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< proof_consensus, consensus_height, signer, - } = data; + } = data return new MsgConnectionOpenAck( connection_id, counterparty_connection_id, @@ -75,7 +75,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< proof_consensus, consensus_height ? Height.fromData(consensus_height) : undefined, signer - ); + ) } public toData(): MsgConnectionOpenAck.Data { @@ -90,7 +90,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< proof_consensus, consensus_height, signer, - } = this; + } = this return { '@type': '/ibc.core.connection.v1.MsgConnectionOpenAck', connection_id, @@ -103,7 +103,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< proof_consensus, consensus_height: consensus_height?.toData(), signer, - }; + } } public static fromProto( @@ -122,7 +122,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< ? Height.fromProto(proto.consensusHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgConnectionOpenAck.Proto { @@ -137,7 +137,7 @@ export class MsgConnectionOpenAck extends JSONSerializable< proof_consensus, consensus_height, signer, - } = this; + } = this return MsgConnectionOpenAck_pb.fromPartial({ connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, @@ -149,36 +149,36 @@ export class MsgConnectionOpenAck extends JSONSerializable< proofConsensus: Buffer.from(proof_consensus, 'base64'), consensusHeight: consensus_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenAck', value: MsgConnectionOpenAck_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgConnectionOpenAck { return MsgConnectionOpenAck.fromProto( MsgConnectionOpenAck_pb.decode(msgAny.value) - ); + ) } } export namespace MsgConnectionOpenAck { export interface Data { - '@type': '/ibc.core.connection.v1.MsgConnectionOpenAck'; - connection_id: string; - counterparty_connection_id: string; - version?: IbcVersion.Data; - client_state: Any; - proof_height?: Height.Data; - proof_try: string; - proof_client: string; - proof_consensus: string; - consensus_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.connection.v1.MsgConnectionOpenAck' + connection_id: string + counterparty_connection_id: string + version?: IbcVersion.Data + client_state: Any + proof_height?: Height.Data + proof_try: string + proof_client: string + proof_consensus: string + consensus_height?: Height.Data + signer: AccAddress } - export type Proto = MsgConnectionOpenAck_pb; + export type Proto = MsgConnectionOpenAck_pb } diff --git a/src/core/ibc/core/connection/msgs/MsgConnectionOpenConfirm.ts b/src/core/ibc/core/connection/msgs/MsgConnectionOpenConfirm.ts index 7e66312..31c7c11 100644 --- a/src/core/ibc/core/connection/msgs/MsgConnectionOpenConfirm.ts +++ b/src/core/ibc/core/connection/msgs/MsgConnectionOpenConfirm.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgConnectionOpenConfirm as MsgConnectionOpenConfirm_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx'; -import { Height } from '../../client/Height'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgConnectionOpenConfirm as MsgConnectionOpenConfirm_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx' +import { Height } from '../../client/Height' /** * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to @@ -25,39 +25,39 @@ export class MsgConnectionOpenConfirm extends JSONSerializable< public proof_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgConnectionOpenConfirm { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgConnectionOpenConfirm.Data ): MsgConnectionOpenConfirm { - const { connection_id, proof_ack, proof_height, signer } = data; + const { connection_id, proof_ack, proof_height, signer } = data return new MsgConnectionOpenConfirm( connection_id, proof_ack, proof_height ? Height.fromData(proof_height) : undefined, signer - ); + ) } public toData(): MsgConnectionOpenConfirm.Data { - const { connection_id, proof_ack, proof_height, signer } = this; + const { connection_id, proof_ack, proof_height, signer } = this return { '@type': '/ibc.core.connection.v1.MsgConnectionOpenConfirm', connection_id, proof_ack, proof_height: proof_height?.toData(), signer, - }; + } } public static fromProto( @@ -68,40 +68,40 @@ export class MsgConnectionOpenConfirm extends JSONSerializable< Buffer.from(proto.proofAck).toString('base64'), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgConnectionOpenConfirm.Proto { - const { connection_id, proof_ack, proof_height, signer } = this; + const { connection_id, proof_ack, proof_height, signer } = this return MsgConnectionOpenConfirm_pb.fromPartial({ connectionId: connection_id, proofAck: Buffer.from(proof_ack, 'base64'), proofHeight: proof_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenConfirm', value: MsgConnectionOpenConfirm_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgConnectionOpenConfirm { return MsgConnectionOpenConfirm.fromProto( MsgConnectionOpenConfirm_pb.decode(msgAny.value) - ); + ) } } export namespace MsgConnectionOpenConfirm { export interface Data { - '@type': '/ibc.core.connection.v1.MsgConnectionOpenConfirm'; - connection_id: string; - proof_ack: string; - proof_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.connection.v1.MsgConnectionOpenConfirm' + connection_id: string + proof_ack: string + proof_height?: Height.Data + signer: AccAddress } - export type Proto = MsgConnectionOpenConfirm_pb; + export type Proto = MsgConnectionOpenConfirm_pb } diff --git a/src/core/ibc/core/connection/msgs/MsgConnectionOpenInit.ts b/src/core/ibc/core/connection/msgs/MsgConnectionOpenInit.ts index 72c046b..6a15206 100644 --- a/src/core/ibc/core/connection/msgs/MsgConnectionOpenInit.ts +++ b/src/core/ibc/core/connection/msgs/MsgConnectionOpenInit.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgConnectionOpenInit as MsgConnectionOpenInit_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx'; -import { ConnectionCounterparty } from '../ConnectionCounterparty'; -import { IbcVersion } from '../IbcVersion'; -import Long from 'long'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgConnectionOpenInit as MsgConnectionOpenInit_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx' +import { ConnectionCounterparty } from '../ConnectionCounterparty' +import { IbcVersion } from '../IbcVersion' +import Long from 'long' /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to initialize a connection with Chain B. @@ -28,33 +28,33 @@ export class MsgConnectionOpenInit extends JSONSerializable< public delay_period: number, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgConnectionOpenInit { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgConnectionOpenInit.Data ): MsgConnectionOpenInit { - const { client_id, counterparty, version, delay_period, signer } = data; + const { client_id, counterparty, version, delay_period, signer } = data return new MsgConnectionOpenInit( client_id, ConnectionCounterparty.fromData(counterparty), version ? IbcVersion.fromData(version) : undefined, Number.parseInt(delay_period), signer - ); + ) } public toData(): MsgConnectionOpenInit.Data { - const { client_id, counterparty, version, delay_period, signer } = this; + const { client_id, counterparty, version, delay_period, signer } = this return { '@type': '/ibc.core.connection.v1.MsgConnectionOpenInit', client_id, @@ -62,7 +62,7 @@ export class MsgConnectionOpenInit extends JSONSerializable< version: version?.toData(), delay_period: delay_period.toFixed(), signer, - }; + } } public static fromProto( @@ -76,43 +76,43 @@ export class MsgConnectionOpenInit extends JSONSerializable< proto.version ? IbcVersion.fromProto(proto.version) : undefined, proto.delayPeriod.toNumber(), proto.signer - ); + ) } public toProto(): MsgConnectionOpenInit.Proto { - const { client_id, counterparty, version, delay_period, signer } = this; + const { client_id, counterparty, version, delay_period, signer } = this return MsgConnectionOpenInit_pb.fromPartial({ clientId: client_id, counterparty: counterparty.toProto(), version: version?.toProto(), delayPeriod: Long.fromNumber(delay_period), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenInit', value: MsgConnectionOpenInit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgConnectionOpenInit { return MsgConnectionOpenInit.fromProto( MsgConnectionOpenInit_pb.decode(msgAny.value) - ); + ) } } export namespace MsgConnectionOpenInit { export interface Data { - '@type': '/ibc.core.connection.v1.MsgConnectionOpenInit'; - client_id: string; - counterparty: ConnectionCounterparty.Data; - version?: IbcVersion.Data; - delay_period: string; - signer: AccAddress; + '@type': '/ibc.core.connection.v1.MsgConnectionOpenInit' + client_id: string + counterparty: ConnectionCounterparty.Data + version?: IbcVersion.Data + delay_period: string + signer: AccAddress } - export type Proto = MsgConnectionOpenInit_pb; + export type Proto = MsgConnectionOpenInit_pb } diff --git a/src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts b/src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts index 8176eed..2e2898d 100644 --- a/src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts +++ b/src/core/ibc/core/connection/msgs/MsgConnectionOpenTry.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgConnectionOpenTry as MsgConnectionOpenTry_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx'; -import { ConnectionCounterparty } from '../ConnectionCounterparty'; -import { IbcVersion } from '../IbcVersion'; -import { Height } from '../../client'; -import Long from 'long'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgConnectionOpenTry as MsgConnectionOpenTry_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx' +import { ConnectionCounterparty } from '../ConnectionCounterparty' +import { IbcVersion } from '../IbcVersion' +import { Height } from '../../client' +import Long from 'long' /** * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a connection on Chain B. @@ -41,16 +41,16 @@ export class MsgConnectionOpenTry extends JSONSerializable< public consensus_height: Height | undefined, public signer: AccAddress ) { - super(); + super() } public static fromAmino(_: any): MsgConnectionOpenTry { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( @@ -68,20 +68,20 @@ export class MsgConnectionOpenTry extends JSONSerializable< proof_consensus, consensus_height, signer, - } = data; + } = data return new MsgConnectionOpenTry( client_id, client_state, counterparty ? ConnectionCounterparty.fromData(counterparty) : undefined, Number.parseInt(delay_period), - counterparty_versions.map(cv => IbcVersion.fromData(cv)), + counterparty_versions.map((cv) => IbcVersion.fromData(cv)), proof_height ? Height.fromData(proof_height) : undefined, Buffer.from(proof_init).toString('base64'), Buffer.from(proof_client).toString('base64'), Buffer.from(proof_consensus).toString('base64'), consensus_height ? Height.fromData(consensus_height) : undefined, signer - ); + ) } public toData(): MsgConnectionOpenTry.Data { @@ -97,21 +97,21 @@ export class MsgConnectionOpenTry extends JSONSerializable< proof_consensus, consensus_height, signer, - } = this; + } = this return { '@type': '/ibc.core.connection.v1.MsgConnectionOpenTry', client_id, client_state, counterparty: counterparty?.toData(), delay_period: delay_period.toFixed(), - counterparty_versions: counterparty_versions.map(cv => cv.toData()), + counterparty_versions: counterparty_versions.map((cv) => cv.toData()), proof_height: proof_height?.toData(), proof_init, proof_client, proof_consensus, consensus_height: consensus_height?.toData(), signer, - }; + } } public static fromProto( @@ -124,7 +124,7 @@ export class MsgConnectionOpenTry extends JSONSerializable< ? ConnectionCounterparty.fromProto(proto.counterparty) : undefined, proto.delayPeriod.toNumber(), - proto.counterpartyVersions.map(cv => IbcVersion.fromProto(cv)), + proto.counterpartyVersions.map((cv) => IbcVersion.fromProto(cv)), proto.proofHeight ? Height.fromProto(proto.proofHeight) : undefined, Buffer.from(proto.proofInit).toString('base64'), Buffer.from(proto.proofClient).toString('base64'), @@ -133,7 +133,7 @@ export class MsgConnectionOpenTry extends JSONSerializable< ? Height.fromProto(proto.consensusHeight) : undefined, proto.signer - ); + ) } public toProto(): MsgConnectionOpenTry.Proto { @@ -149,51 +149,51 @@ export class MsgConnectionOpenTry extends JSONSerializable< proof_consensus, consensus_height, signer, - } = this; + } = this return MsgConnectionOpenTry_pb.fromPartial({ clientId: client_id, clientState: client_state.toProto(), counterparty: counterparty?.toProto(), delayPeriod: Long.fromNumber(delay_period), - counterpartyVersions: counterparty_versions.map(cv => cv.toProto()), + counterpartyVersions: counterparty_versions.map((cv) => cv.toProto()), proofHeight: proof_height?.toProto(), proofInit: Buffer.from(proof_init, 'base64'), proofClient: Buffer.from(proof_client, 'base64'), proofConsensus: Buffer.from(proof_consensus, 'base64'), consensusHeight: consensus_height?.toProto(), signer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.connection.v1.MsgConnectionOpenTry', value: MsgConnectionOpenTry_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgConnectionOpenTry { return MsgConnectionOpenTry.fromProto( MsgConnectionOpenTry_pb.decode(msgAny.value) - ); + ) } } export namespace MsgConnectionOpenTry { export interface Data { - '@type': '/ibc.core.connection.v1.MsgConnectionOpenTry'; - client_id: string; - client_state: Any; - counterparty?: ConnectionCounterparty.Data; - delay_period: string; - counterparty_versions: IbcVersion.Data[]; - proof_height?: Height.Data; - proof_init: string; - proof_client: string; - proof_consensus: string; - consensus_height?: Height.Data; - signer: AccAddress; + '@type': '/ibc.core.connection.v1.MsgConnectionOpenTry' + client_id: string + client_state: Any + counterparty?: ConnectionCounterparty.Data + delay_period: string + counterparty_versions: IbcVersion.Data[] + proof_height?: Height.Data + proof_init: string + proof_client: string + proof_consensus: string + consensus_height?: Height.Data + signer: AccAddress } - export type Proto = MsgConnectionOpenTry_pb; + export type Proto = MsgConnectionOpenTry_pb } diff --git a/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts b/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts index 9d57e7d..4fa1473 100644 --- a/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts +++ b/src/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../../../util/json'; -import { AccAddress } from '../../../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx'; -import { IbcConnectionParams } from '../IbcConnectionParams'; +import { JSONSerializable } from '../../../../../util/json' +import { AccAddress } from '../../../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/ibc/core/connection/v1/tx' +import { IbcConnectionParams } from '../IbcConnectionParams' export class MsgUpdateIbcConnectionParams extends JSONSerializable< any, @@ -13,36 +13,39 @@ export class MsgUpdateIbcConnectionParams extends JSONSerializable< * @param signer signer address * @param params params defines the connection parameters to update */ - constructor(public signer: AccAddress, public params: IbcConnectionParams) { - super(); + constructor( + public signer: AccAddress, + public params: IbcConnectionParams + ) { + super() } public static fromAmino(_: any): MsgUpdateIbcConnectionParams { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData( data: MsgUpdateIbcConnectionParams.Data ): MsgUpdateIbcConnectionParams { - const { signer, params } = data; + const { signer, params } = data return new MsgUpdateIbcConnectionParams( signer, IbcConnectionParams.fromData(params) - ); + ) } public toData(): MsgUpdateIbcConnectionParams.Data { - const { signer, params } = this; + const { signer, params } = this return { '@type': '/ibc.core.connection.v1.MsgUpdateParams', signer, params: params.toData(), - }; + } } public static fromProto( @@ -51,37 +54,37 @@ export class MsgUpdateIbcConnectionParams extends JSONSerializable< return new MsgUpdateIbcConnectionParams( data.signer, IbcConnectionParams.fromProto(data.params as IbcConnectionParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcConnectionParams.Proto { - const { signer, params } = this; + const { signer, params } = this return MsgUpdateParams_pb.fromPartial({ signer, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/ibc.core.connection.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcConnectionParams { return MsgUpdateIbcConnectionParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcConnectionParams { export interface Data { - '@type': '/ibc.core.connection.v1.MsgUpdateParams'; - signer: AccAddress; - params: IbcConnectionParams.Data; + '@type': '/ibc.core.connection.v1.MsgUpdateParams' + signer: AccAddress + params: IbcConnectionParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibc/core/connection/msgs/index.ts b/src/core/ibc/core/connection/msgs/index.ts index 87e47cc..74bef8f 100644 --- a/src/core/ibc/core/connection/msgs/index.ts +++ b/src/core/ibc/core/connection/msgs/index.ts @@ -1,21 +1,21 @@ -import { MsgConnectionOpenAck } from './MsgConnectionOpenAck'; -import { MsgConnectionOpenConfirm } from './MsgConnectionOpenConfirm'; -import { MsgConnectionOpenInit } from './MsgConnectionOpenInit'; -import { MsgConnectionOpenTry } from './MsgConnectionOpenTry'; -import { MsgUpdateIbcConnectionParams } from './MsgUpdateIbcConnectionParams'; +import { MsgConnectionOpenAck } from './MsgConnectionOpenAck' +import { MsgConnectionOpenConfirm } from './MsgConnectionOpenConfirm' +import { MsgConnectionOpenInit } from './MsgConnectionOpenInit' +import { MsgConnectionOpenTry } from './MsgConnectionOpenTry' +import { MsgUpdateIbcConnectionParams } from './MsgUpdateIbcConnectionParams' -export * from './MsgConnectionOpenInit'; -export * from './MsgConnectionOpenTry'; -export * from './MsgConnectionOpenConfirm'; -export * from './MsgConnectionOpenAck'; -export * from './MsgUpdateIbcConnectionParams'; +export * from './MsgConnectionOpenInit' +export * from './MsgConnectionOpenTry' +export * from './MsgConnectionOpenConfirm' +export * from './MsgConnectionOpenAck' +export * from './MsgUpdateIbcConnectionParams' export type IbcConnectionMsg = | MsgConnectionOpenInit | MsgConnectionOpenTry | MsgConnectionOpenConfirm | MsgConnectionOpenAck - | MsgUpdateIbcConnectionParams; + | MsgUpdateIbcConnectionParams export namespace IbcConnectionMsg { export type Data = @@ -23,12 +23,12 @@ export namespace IbcConnectionMsg { | MsgConnectionOpenTry.Data | MsgConnectionOpenConfirm.Data | MsgConnectionOpenAck.Data - | MsgUpdateIbcConnectionParams.Data; + | MsgUpdateIbcConnectionParams.Data export type Proto = | MsgConnectionOpenInit.Proto | MsgConnectionOpenTry.Proto | MsgConnectionOpenConfirm.Proto | MsgConnectionOpenAck.Proto - | MsgUpdateIbcConnectionParams.Proto; + | MsgUpdateIbcConnectionParams.Proto } diff --git a/src/core/ibc/core/index.ts b/src/core/ibc/core/index.ts index 58e94a7..2e78b9f 100644 --- a/src/core/ibc/core/index.ts +++ b/src/core/ibc/core/index.ts @@ -1,4 +1,4 @@ -export * from './channel'; -export * from './client'; -export * from './commitment'; -export * from './connection'; +export * from './channel' +export * from './client' +export * from './commitment' +export * from './connection' diff --git a/src/core/ibc/index.ts b/src/core/ibc/index.ts index a724fe2..2045ed4 100644 --- a/src/core/ibc/index.ts +++ b/src/core/ibc/index.ts @@ -1,2 +1,2 @@ -export * from './applications'; -export * from './core'; +export * from './applications' +export * from './core' diff --git a/src/core/ibc/lightclient/index.ts b/src/core/ibc/lightclient/index.ts index e17981c..6454e39 100644 --- a/src/core/ibc/lightclient/index.ts +++ b/src/core/ibc/lightclient/index.ts @@ -1 +1 @@ -export * from './tendermint/Header'; +export * from './tendermint/Header' diff --git a/src/core/ibc/lightclient/tendermint/Header.ts b/src/core/ibc/lightclient/tendermint/Header.ts index b1fe3ac..5c14956 100644 --- a/src/core/ibc/lightclient/tendermint/Header.ts +++ b/src/core/ibc/lightclient/tendermint/Header.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../../../util/json'; -import { Header as Header_pb } from '@initia/initia.proto/ibc/lightclients/tendermint/v1/tendermint'; -import { Height } from '../../core/client/Height'; +import { JSONSerializable } from '../../../../util/json' +import { Header as Header_pb } from '@initia/initia.proto/ibc/lightclients/tendermint/v1/tendermint' +import { Height } from '../../core/client/Height' import { SignedHeader, ValidatorSet, -} from '../../core/client/msgs/tendermint/types'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from '../../core/client/msgs/tendermint/types' +import { Any } from '@initia/initia.proto/google/protobuf/any' /** * Header defines the Tendermint client consensus Header. @@ -34,16 +34,16 @@ export class Header extends JSONSerializable { public trustedHeight?: Height, public trustedValidators?: ValidatorSet ) { - super(); + super() } public static fromAmino(_: any): Header { - _; - throw new Error('Amino not supported'); + _ + throw new Error('Amino not supported') } public toAmino(): any { - throw new Error('Amino not supported'); + throw new Error('Amino not supported') } public static fromData(data: Header.Data): Header { @@ -52,67 +52,67 @@ export class Header extends JSONSerializable { validator_set: validatorSet, trusted_height: trustedHeight, trusted_validators: trustedValidators, - } = data; + } = data return new Header( signedHeader ? SignedHeader.fromData(signedHeader) : undefined, validatorSet ? ValidatorSet.fromData(validatorSet) : undefined, trustedHeight ? Height.fromData(trustedHeight) : undefined, trustedValidators ? ValidatorSet.fromData(trustedValidators) : undefined - ); + ) } public toData(): Header.Data { const { signedHeader, validatorSet, trustedHeight, trustedValidators } = - this; + this return { signed_header: signedHeader?.toData(), validator_set: validatorSet?.toData(), trusted_height: trustedHeight?.toData(), trusted_validators: trustedValidators?.toData(), - }; + } } public static fromProto(proto: Header.Proto): Header { const { signedHeader, validatorSet, trustedHeight, trustedValidators } = - proto; + proto return new Header( signedHeader ? SignedHeader.fromProto(signedHeader) : undefined, validatorSet ? ValidatorSet.fromProto(validatorSet) : undefined, trustedHeight ? Height.fromProto(trustedHeight) : undefined, trustedValidators ? ValidatorSet.fromProto(trustedValidators) : undefined - ); + ) } public toProto(): Header.Proto { const { signedHeader, validatorSet, trustedHeight, trustedValidators } = - this; + this return Header_pb.fromPartial({ signedHeader: signedHeader?.toProto(), validatorSet: validatorSet?.toProto(), trustedHeight: trustedHeight?.toProto(), trustedValidators: trustedValidators?.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: 'ibc.lightclients.tendermint.v1.Header', value: Header_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): Header { - return Header.fromProto(Header_pb.decode(msgAny.value)); + return Header.fromProto(Header_pb.decode(msgAny.value)) } } export namespace Header { export interface Data { - signed_header?: SignedHeader.Data; - validator_set?: ValidatorSet.Data; - trusted_height?: Height.Data; - trusted_validators?: ValidatorSet.Data; + signed_header?: SignedHeader.Data + validator_set?: ValidatorSet.Data + trusted_height?: Height.Data + trusted_validators?: ValidatorSet.Data } - export type Proto = Header_pb; + export type Proto = Header_pb } diff --git a/src/core/ibchooks/ACL.ts b/src/core/ibchooks/ACL.ts index f772e29..868ff0a 100644 --- a/src/core/ibchooks/ACL.ts +++ b/src/core/ibchooks/ACL.ts @@ -1,59 +1,62 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { ACL as ACL_pb } from '@initia/initia.proto/initia/ibchooks/v1/types'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { ACL as ACL_pb } from '@initia/initia.proto/initia/ibchooks/v1/types' export class ACL extends JSONSerializable { /** * @param address * @param allowed */ - constructor(public address: AccAddress, public allowed: boolean) { - super(); + constructor( + public address: AccAddress, + public allowed: boolean + ) { + super() } public static fromAmino(data: ACL.Amino): ACL { - const { address, allowed } = data; - return new ACL(address, allowed); + const { address, allowed } = data + return new ACL(address, allowed) } public toAmino(): ACL.Amino { - const { address, allowed } = this; - return { address, allowed }; + const { address, allowed } = this + return { address, allowed } } public static fromData(data: ACL.Data): ACL { - const { address, allowed } = data; - return new ACL(address, allowed); + const { address, allowed } = data + return new ACL(address, allowed) } public toData(): ACL.Data { - const { address, allowed } = this; - return { address, allowed }; + const { address, allowed } = this + return { address, allowed } } public static fromProto(data: ACL.Proto): ACL { - return new ACL(data.address, data.allowed); + return new ACL(data.address, data.allowed) } public toProto(): ACL.Proto { - const { address, allowed } = this; + const { address, allowed } = this return ACL_pb.fromPartial({ address, allowed, - }); + }) } } export namespace ACL { export interface Amino { - address: AccAddress; - allowed: boolean; + address: AccAddress + allowed: boolean } export interface Data { - address: AccAddress; - allowed: boolean; + address: AccAddress + allowed: boolean } - export type Proto = ACL_pb; + export type Proto = ACL_pb } diff --git a/src/core/ibchooks/IbcHooksParams.ts b/src/core/ibchooks/IbcHooksParams.ts index 3c92b84..f279ba7 100644 --- a/src/core/ibchooks/IbcHooksParams.ts +++ b/src/core/ibchooks/IbcHooksParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/initia/ibchooks/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/initia/ibchooks/v1/types' export class IbcHooksParams extends JSONSerializable< IbcHooksParams.Amino, @@ -10,54 +10,54 @@ export class IbcHooksParams extends JSONSerializable< * @param default_allowed */ constructor(public default_allowed: boolean) { - super(); + super() } public static fromAmino(data: IbcHooksParams.Amino): IbcHooksParams { - return new IbcHooksParams(data.value.default_allowed); + return new IbcHooksParams(data.value.default_allowed) } public toAmino(): IbcHooksParams.Amino { return { type: 'ibc-hooks/Params', value: { default_allowed: this.default_allowed }, - }; + } } public static fromData(data: IbcHooksParams.Data): IbcHooksParams { - return new IbcHooksParams(data.default_allowed); + return new IbcHooksParams(data.default_allowed) } public toData(): IbcHooksParams.Data { return { '@type': '/initia.ibchooks.v1.Params', default_allowed: this.default_allowed, - }; + } } public static fromProto(data: IbcHooksParams.Proto): IbcHooksParams { - return new IbcHooksParams(data.defaultAllowed); + return new IbcHooksParams(data.defaultAllowed) } public toProto(): IbcHooksParams.Proto { return Params_pb.fromPartial({ defaultAllowed: this.default_allowed, - }); + }) } } export namespace IbcHooksParams { export interface Amino { - type: 'ibc-hooks/Params'; + type: 'ibc-hooks/Params' value: { - default_allowed: boolean; - }; + default_allowed: boolean + } } export interface Data { - '@type': '/initia.ibchooks.v1.Params'; - default_allowed: boolean; + '@type': '/initia.ibchooks.v1.Params' + default_allowed: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ibchooks/index.ts b/src/core/ibchooks/index.ts index 17186b2..ccd836d 100644 --- a/src/core/ibchooks/index.ts +++ b/src/core/ibchooks/index.ts @@ -1,3 +1,3 @@ -export * from './msgs'; -export * from './ACL'; -export * from './IbcHooksParams'; +export * from './msgs' +export * from './ACL' +export * from './IbcHooksParams' diff --git a/src/core/ibchooks/msgs/MsgUpdateACL.ts b/src/core/ibchooks/msgs/MsgUpdateACL.ts index 2ff01e0..aad857f 100644 --- a/src/core/ibchooks/msgs/MsgUpdateACL.ts +++ b/src/core/ibchooks/msgs/MsgUpdateACL.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateACL as MsgUpdateACL_pb } from '@initia/initia.proto/initia/ibchooks/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateACL as MsgUpdateACL_pb } from '@initia/initia.proto/initia/ibchooks/v1/tx' export class MsgUpdateACL extends JSONSerializable< MsgUpdateACL.Amino, @@ -18,18 +18,18 @@ export class MsgUpdateACL extends JSONSerializable< public address: AccAddress, public allowed: boolean ) { - super(); + super() } public static fromAmino(data: MsgUpdateACL.Amino): MsgUpdateACL { const { value: { authority, address, allowed }, - } = data; - return new MsgUpdateACL(authority, address, allowed); + } = data + return new MsgUpdateACL(authority, address, allowed) } public toAmino(): MsgUpdateACL.Amino { - const { authority, address, allowed } = this; + const { authority, address, allowed } = this return { type: 'ibchooks/MsgUpdateACL', value: { @@ -37,65 +37,65 @@ export class MsgUpdateACL extends JSONSerializable< address, allowed, }, - }; + } } public static fromData(data: MsgUpdateACL.Data): MsgUpdateACL { - const { authority, address, allowed } = data; - return new MsgUpdateACL(authority, address, allowed); + const { authority, address, allowed } = data + return new MsgUpdateACL(authority, address, allowed) } public toData(): MsgUpdateACL.Data { - const { authority, address, allowed } = this; + const { authority, address, allowed } = this return { '@type': '/initia.ibchooks.v1.MsgUpdateACL', authority, address, allowed, - }; + } } public static fromProto(data: MsgUpdateACL.Proto): MsgUpdateACL { - return new MsgUpdateACL(data.authority, data.address, data.allowed); + return new MsgUpdateACL(data.authority, data.address, data.allowed) } public toProto(): MsgUpdateACL.Proto { - const { authority, address, allowed } = this; + const { authority, address, allowed } = this return MsgUpdateACL_pb.fromPartial({ authority, address, allowed, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.ibchooks.v1.MsgUpdateACL', value: MsgUpdateACL_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateACL { - return MsgUpdateACL.fromProto(MsgUpdateACL_pb.decode(msgAny.value)); + return MsgUpdateACL.fromProto(MsgUpdateACL_pb.decode(msgAny.value)) } } export namespace MsgUpdateACL { export interface Amino { - type: 'ibchooks/MsgUpdateACL'; + type: 'ibchooks/MsgUpdateACL' value: { - authority: AccAddress; - address: AccAddress; - allowed: boolean; - }; + authority: AccAddress + address: AccAddress + allowed: boolean + } } export interface Data { - '@type': '/initia.ibchooks.v1.MsgUpdateACL'; - authority: AccAddress; - address: AccAddress; - allowed: boolean; + '@type': '/initia.ibchooks.v1.MsgUpdateACL' + authority: AccAddress + address: AccAddress + allowed: boolean } - export type Proto = MsgUpdateACL_pb; + export type Proto = MsgUpdateACL_pb } diff --git a/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts b/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts index d0ae6d7..98c4944 100644 --- a/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts +++ b/src/core/ibchooks/msgs/MsgUpdateIbcHooksParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { IbcHooksParams } from '../IbcHooksParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/ibchooks/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { IbcHooksParams } from '../IbcHooksParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/ibchooks/v1/tx' export class MsgUpdateIbcHooksParams extends JSONSerializable< MsgUpdateIbcHooksParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateIbcHooksParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/hook parameters to update */ - constructor(public authority: AccAddress, public params: IbcHooksParams) { - super(); + constructor( + public authority: AccAddress, + public params: IbcHooksParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateIbcHooksParams extends JSONSerializable< ): MsgUpdateIbcHooksParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateIbcHooksParams( authority, IbcHooksParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateIbcHooksParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'ibchooks/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateIbcHooksParams.Data ): MsgUpdateIbcHooksParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateIbcHooksParams( authority, IbcHooksParams.fromData(params) - ); + ) } public toData(): MsgUpdateIbcHooksParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.ibchooks.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,45 @@ export class MsgUpdateIbcHooksParams extends JSONSerializable< return new MsgUpdateIbcHooksParams( data.authority, IbcHooksParams.fromProto(data.params as IbcHooksParams.Proto) - ); + ) } public toProto(): MsgUpdateIbcHooksParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.ibchooks.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateIbcHooksParams { return MsgUpdateIbcHooksParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateIbcHooksParams { export interface Amino { - type: 'ibchooks/MsgUpdateParams'; + type: 'ibchooks/MsgUpdateParams' value: { - authority: AccAddress; - params: IbcHooksParams.Amino; - }; + authority: AccAddress + params: IbcHooksParams.Amino + } } export interface Data { - '@type': '/initia.ibchooks.v1.MsgUpdateParams'; - authority: AccAddress; - params: IbcHooksParams.Data; + '@type': '/initia.ibchooks.v1.MsgUpdateParams' + authority: AccAddress + params: IbcHooksParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ibchooks/msgs/index.ts b/src/core/ibchooks/msgs/index.ts index 25b488d..85f3afb 100644 --- a/src/core/ibchooks/msgs/index.ts +++ b/src/core/ibchooks/msgs/index.ts @@ -1,13 +1,13 @@ -import { MsgUpdateACL } from './MsgUpdateACL'; -import { MsgUpdateIbcHooksParams } from './MsgUpdateIbcHooksParams'; +import { MsgUpdateACL } from './MsgUpdateACL' +import { MsgUpdateIbcHooksParams } from './MsgUpdateIbcHooksParams' -export * from './MsgUpdateACL'; -export * from './MsgUpdateIbcHooksParams'; +export * from './MsgUpdateACL' +export * from './MsgUpdateIbcHooksParams' -export type IbcHooksMsg = MsgUpdateACL | MsgUpdateIbcHooksParams; +export type IbcHooksMsg = MsgUpdateACL | MsgUpdateIbcHooksParams export namespace IbcHooksMsg { - export type Amino = MsgUpdateACL.Amino | MsgUpdateIbcHooksParams.Amino; - export type Data = MsgUpdateACL.Data | MsgUpdateIbcHooksParams.Data; - export type Proto = MsgUpdateACL.Proto | MsgUpdateIbcHooksParams.Proto; + export type Amino = MsgUpdateACL.Amino | MsgUpdateIbcHooksParams.Amino + export type Data = MsgUpdateACL.Data | MsgUpdateIbcHooksParams.Data + export type Proto = MsgUpdateACL.Proto | MsgUpdateIbcHooksParams.Proto } diff --git a/src/core/index.ts b/src/core/index.ts index bf6c39d..d5a86bf 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,40 +1,40 @@ -export * from './Block'; -export * from './Coin'; -export * from './Coins'; -export * from './Denom'; -export * from './Duration'; -export * from './Msg'; -export * from './PublicKey'; -export * from './bech32'; -export * from './num'; +export * from './Block' +export * from './Coin' +export * from './Coins' +export * from './Denom' +export * from './Duration' +export * from './Msg' +export * from './PublicKey' +export * from './bech32' +export * from './num' -export * from './auction'; -export * from './auth'; -export * from './authz'; -export * from './bank'; -export * from './celestia'; -export * from './consensus'; -export * from './crisis'; -export * from './distribution'; -export * from './evidence'; -export * from './evm'; -export * from './feegrant'; -export * from './forwarding'; -export * from './gov'; -export * from './group'; -export * from './ibc'; -export * from './ibchooks'; -export * from './intertx'; -export * from './marketmap'; -export * from './move'; -export * from './mstaking'; -export * from './opchild'; -export * from './ophost'; -export * from './oracle'; -export * from './params'; -export * from './reward'; -export * from './slashing'; -export * from './tokenfactory'; -export * from './tx'; -export * from './upgrade'; -export * from './wasm'; +export * from './auction' +export * from './auth' +export * from './authz' +export * from './bank' +export * from './celestia' +export * from './consensus' +export * from './crisis' +export * from './distribution' +export * from './evidence' +export * from './evm' +export * from './feegrant' +export * from './forwarding' +export * from './gov' +export * from './group' +export * from './ibc' +export * from './ibchooks' +export * from './intertx' +export * from './marketmap' +export * from './move' +export * from './mstaking' +export * from './opchild' +export * from './ophost' +export * from './oracle' +export * from './params' +export * from './reward' +export * from './slashing' +export * from './tokenfactory' +export * from './tx' +export * from './upgrade' +export * from './wasm' diff --git a/src/core/intertx/index.ts b/src/core/intertx/index.ts index 231cb79..01eded2 100644 --- a/src/core/intertx/index.ts +++ b/src/core/intertx/index.ts @@ -1 +1 @@ -export * from './msgs'; +export * from './msgs' diff --git a/src/core/intertx/msgs/MsgRegisterAccount.ts b/src/core/intertx/msgs/MsgRegisterAccount.ts index cdde4ea..973ce20 100644 --- a/src/core/intertx/msgs/MsgRegisterAccount.ts +++ b/src/core/intertx/msgs/MsgRegisterAccount.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRegisterAccount as MsgRegisterAccount_pb } from '@initia/initia.proto/initia/intertx/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRegisterAccount as MsgRegisterAccount_pb } from '@initia/initia.proto/initia/intertx/v1/tx' export class MsgRegisterAccount extends JSONSerializable< MsgRegisterAccount.Amino, @@ -18,38 +18,38 @@ export class MsgRegisterAccount extends JSONSerializable< public connection_id: string, public version: string ) { - super(); + super() } public static fromAmino(data: MsgRegisterAccount.Amino): MsgRegisterAccount { const { value: { owner, connection_id, version }, - } = data; + } = data - return new MsgRegisterAccount(owner, connection_id, version); + return new MsgRegisterAccount(owner, connection_id, version) } public toAmino(): MsgRegisterAccount.Amino { - const { owner, connection_id, version } = this; + const { owner, connection_id, version } = this return { type: 'intertx/MsgRegisterAccount', value: { owner, connection_id, version }, - }; + } } public static fromData(data: MsgRegisterAccount.Data): MsgRegisterAccount { - const { owner, connection_id, version } = data; - return new MsgRegisterAccount(owner, connection_id, version); + const { owner, connection_id, version } = data + return new MsgRegisterAccount(owner, connection_id, version) } public toData(): MsgRegisterAccount.Data { - const { owner, connection_id, version } = this; + const { owner, connection_id, version } = this return { '@type': '/initia.intertx.v1.MsgRegisterAccount', owner, connection_id, version, - }; + } } public static fromProto(proto: MsgRegisterAccount.Proto): MsgRegisterAccount { @@ -57,48 +57,48 @@ export class MsgRegisterAccount extends JSONSerializable< proto.owner, proto.connectionId, proto.version - ); + ) } public toProto(): MsgRegisterAccount.Proto { - const { owner, connection_id, version } = this; + const { owner, connection_id, version } = this return MsgRegisterAccount_pb.fromPartial({ owner, connectionId: connection_id, version, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.intertx.v1.MsgRegisterAccount', value: MsgRegisterAccount_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRegisterAccount { return MsgRegisterAccount.fromProto( MsgRegisterAccount_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRegisterAccount { export interface Amino { - type: 'intertx/MsgRegisterAccount'; + type: 'intertx/MsgRegisterAccount' value: { - owner: AccAddress; - connection_id: string; - version: string; - }; + owner: AccAddress + connection_id: string + version: string + } } export interface Data { - '@type': '/initia.intertx.v1.MsgRegisterAccount'; - owner: AccAddress; - connection_id: string; - version: string; + '@type': '/initia.intertx.v1.MsgRegisterAccount' + owner: AccAddress + connection_id: string + version: string } - export type Proto = MsgRegisterAccount_pb; + export type Proto = MsgRegisterAccount_pb } diff --git a/src/core/intertx/msgs/MsgSubmitTx.ts b/src/core/intertx/msgs/MsgSubmitTx.ts index a69dd9c..adb4015 100644 --- a/src/core/intertx/msgs/MsgSubmitTx.ts +++ b/src/core/intertx/msgs/MsgSubmitTx.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSubmitTx as MsgSubmitTx_pb } from '@initia/initia.proto/initia/intertx/v1/tx'; -import { Msg } from '../../Msg'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSubmitTx as MsgSubmitTx_pb } from '@initia/initia.proto/initia/intertx/v1/tx' +import { Msg } from '../../Msg' export class MsgSubmitTx extends JSONSerializable< MsgSubmitTx.Amino, @@ -19,19 +19,19 @@ export class MsgSubmitTx extends JSONSerializable< public connection_id: string, public msg: Msg ) { - super(); + super() } public static fromAmino(data: MsgSubmitTx.Amino): MsgSubmitTx { const { value: { owner, connection_id, msg }, - } = data; + } = data - return new MsgSubmitTx(owner, connection_id, Msg.fromAmino(msg)); + return new MsgSubmitTx(owner, connection_id, Msg.fromAmino(msg)) } public toAmino(): MsgSubmitTx.Amino { - const { owner, connection_id, msg } = this; + const { owner, connection_id, msg } = this return { type: 'intertx/MsgSubmitTx', value: { @@ -39,22 +39,22 @@ export class MsgSubmitTx extends JSONSerializable< connection_id, msg: msg.toAmino(), }, - }; + } } public static fromData(data: MsgSubmitTx.Data): MsgSubmitTx { - const { owner, connection_id, msg } = data; - return new MsgSubmitTx(owner, connection_id, Msg.fromData(msg)); + const { owner, connection_id, msg } = data + return new MsgSubmitTx(owner, connection_id, Msg.fromData(msg)) } public toData(): MsgSubmitTx.Data { - const { owner, connection_id, msg } = this; + const { owner, connection_id, msg } = this return { '@type': '/initia.intertx.v1.MsgSubmitTx', owner, connection_id, msg: msg.toData(), - }; + } } public static fromProto(proto: MsgSubmitTx.Proto): MsgSubmitTx { @@ -62,46 +62,46 @@ export class MsgSubmitTx extends JSONSerializable< proto.owner, proto.connectionId, Msg.fromProto(proto.msg as any) - ); + ) } public toProto(): MsgSubmitTx.Proto { - const { owner, connection_id, msg } = this; + const { owner, connection_id, msg } = this return MsgSubmitTx_pb.fromPartial({ owner, connectionId: connection_id, msg: msg.packAny(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.intertx.v1.MsgSubmitTx', value: MsgSubmitTx_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSubmitTx { - return MsgSubmitTx.fromProto(MsgSubmitTx_pb.decode(msgAny.value)); + return MsgSubmitTx.fromProto(MsgSubmitTx_pb.decode(msgAny.value)) } } export namespace MsgSubmitTx { export interface Amino { - type: 'intertx/MsgSubmitTx'; + type: 'intertx/MsgSubmitTx' value: { - owner: AccAddress; - connection_id: string; - msg: Msg.Amino; - }; + owner: AccAddress + connection_id: string + msg: Msg.Amino + } } export interface Data { - '@type': '/initia.intertx.v1.MsgSubmitTx'; - owner: AccAddress; - connection_id: string; - msg: Msg.Data; + '@type': '/initia.intertx.v1.MsgSubmitTx' + owner: AccAddress + connection_id: string + msg: Msg.Data } - export type Proto = MsgSubmitTx_pb; + export type Proto = MsgSubmitTx_pb } diff --git a/src/core/intertx/msgs/index.ts b/src/core/intertx/msgs/index.ts index f8f1126..efb97bf 100644 --- a/src/core/intertx/msgs/index.ts +++ b/src/core/intertx/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgRegisterAccount } from './MsgRegisterAccount'; -import { MsgSubmitTx } from './MsgSubmitTx'; +import { MsgRegisterAccount } from './MsgRegisterAccount' +import { MsgSubmitTx } from './MsgSubmitTx' -export * from './MsgRegisterAccount'; -export * from './MsgSubmitTx'; +export * from './MsgRegisterAccount' +export * from './MsgSubmitTx' -export type InterTxMsg = MsgRegisterAccount | MsgSubmitTx; +export type InterTxMsg = MsgRegisterAccount | MsgSubmitTx export namespace InterTxMsg { - export type Amino = MsgRegisterAccount.Amino | MsgSubmitTx.Amino; - export type Data = MsgRegisterAccount.Data | MsgSubmitTx.Data; - export type Proto = MsgRegisterAccount.Proto | MsgSubmitTx.Proto; + export type Amino = MsgRegisterAccount.Amino | MsgSubmitTx.Amino + export type Data = MsgRegisterAccount.Data | MsgSubmitTx.Data + export type Proto = MsgRegisterAccount.Proto | MsgSubmitTx.Proto } diff --git a/src/core/marketmap/Market.ts b/src/core/marketmap/Market.ts index ad6d054..b58d33e 100644 --- a/src/core/marketmap/Market.ts +++ b/src/core/marketmap/Market.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { ProviderConfig } from './ProviderConfig'; -import { Ticker } from './Ticker'; -import { Market as Market_pb } from '@initia/initia.proto/slinky/marketmap/v1/market'; +import { JSONSerializable } from '../../util/json' +import { ProviderConfig } from './ProviderConfig' +import { Ticker } from './Ticker' +import { Market as Market_pb } from '@initia/initia.proto/slinky/marketmap/v1/market' export class Market extends JSONSerializable< Market.Amino, @@ -16,67 +16,67 @@ export class Market extends JSONSerializable< public ticker: Ticker, public provider_configs: ProviderConfig[] ) { - super(); + super() } public static fromAmino(data: Market.Amino): Market { - const { ticker, provider_configs } = data; + const { ticker, provider_configs } = data return new Market( Ticker.fromAmino(ticker), provider_configs.map(ProviderConfig.fromAmino) - ); + ) } public toAmino(): Market.Amino { - const { ticker, provider_configs } = this; + const { ticker, provider_configs } = this return { ticker: ticker.toAmino(), - provider_configs: provider_configs.map(config => config.toAmino()), - }; + provider_configs: provider_configs.map((config) => config.toAmino()), + } } public static fromData(data: Market.Data): Market { - const { ticker, provider_configs } = data; + const { ticker, provider_configs } = data return new Market( Ticker.fromData(ticker), provider_configs.map(ProviderConfig.fromData) - ); + ) } public toData(): Market.Data { - const { ticker, provider_configs } = this; + const { ticker, provider_configs } = this return { ticker: ticker.toData(), - provider_configs: provider_configs.map(config => config.toData()), - }; + provider_configs: provider_configs.map((config) => config.toData()), + } } public static fromProto(proto: Market.Proto): Market { return new Market( Ticker.fromProto(proto.ticker as Ticker.Proto), proto.providerConfigs.map(ProviderConfig.fromProto) - ); + ) } public toProto(): Market.Proto { - const { ticker, provider_configs } = this; + const { ticker, provider_configs } = this return Market_pb.fromPartial({ ticker: ticker.toProto(), - providerConfigs: provider_configs.map(config => config.toProto()), - }); + providerConfigs: provider_configs.map((config) => config.toProto()), + }) } } export namespace Market { export interface Amino { - ticker: Ticker.Amino; - provider_configs: ProviderConfig.Amino[]; + ticker: Ticker.Amino + provider_configs: ProviderConfig.Amino[] } export interface Data { - ticker: Ticker.Data; - provider_configs: ProviderConfig.Data[]; + ticker: Ticker.Data + provider_configs: ProviderConfig.Data[] } - export type Proto = Market_pb; + export type Proto = Market_pb } diff --git a/src/core/marketmap/MarketmapParams.ts b/src/core/marketmap/MarketmapParams.ts index c95ec83..64ac7d5 100644 --- a/src/core/marketmap/MarketmapParams.ts +++ b/src/core/marketmap/MarketmapParams.ts @@ -1,6 +1,6 @@ -import { AccAddress } from '../bech32'; -import { JSONSerializable } from '../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/slinky/marketmap/v1/params'; +import { AccAddress } from '../bech32' +import { JSONSerializable } from '../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/slinky/marketmap/v1/params' export class MarketmapParams extends JSONSerializable< MarketmapParams.Amino, @@ -15,50 +15,50 @@ export class MarketmapParams extends JSONSerializable< public market_authorities: AccAddress[], public admin: AccAddress ) { - super(); + super() } public static fromAmino(data: MarketmapParams.Amino): MarketmapParams { - return new MarketmapParams(data.market_authorities, data.admin); + return new MarketmapParams(data.market_authorities, data.admin) } public toAmino(): MarketmapParams.Amino { - const { market_authorities, admin } = this; - return { market_authorities, admin }; + const { market_authorities, admin } = this + return { market_authorities, admin } } public static fromData(data: MarketmapParams.Data): MarketmapParams { - return new MarketmapParams(data.market_authorities, data.admin); + return new MarketmapParams(data.market_authorities, data.admin) } public toData(): MarketmapParams.Data { - const { market_authorities, admin } = this; - return { market_authorities, admin }; + const { market_authorities, admin } = this + return { market_authorities, admin } } public static fromProto(data: MarketmapParams.Proto): MarketmapParams { - return new MarketmapParams(data.marketAuthorities, data.admin); + return new MarketmapParams(data.marketAuthorities, data.admin) } public toProto(): MarketmapParams.Proto { - const { market_authorities, admin } = this; + const { market_authorities, admin } = this return Params_pb.fromPartial({ marketAuthorities: market_authorities, admin, - }); + }) } } export namespace MarketmapParams { export interface Amino { - market_authorities: AccAddress[]; - admin: AccAddress; + market_authorities: AccAddress[] + admin: AccAddress } export interface Data { - market_authorities: AccAddress[]; - admin: AccAddress; + market_authorities: AccAddress[] + admin: AccAddress } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/marketmap/ProviderConfig.ts b/src/core/marketmap/ProviderConfig.ts index 3bc9414..2c35797 100644 --- a/src/core/marketmap/ProviderConfig.ts +++ b/src/core/marketmap/ProviderConfig.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { CurrencyPair } from '../oracle'; -import { ProviderConfig as ProviderConfig_pb } from '@initia/initia.proto/slinky/marketmap/v1/market'; +import { JSONSerializable } from '../../util/json' +import { CurrencyPair } from '../oracle' +import { ProviderConfig as ProviderConfig_pb } from '@initia/initia.proto/slinky/marketmap/v1/market' export class ProviderConfig extends JSONSerializable< ProviderConfig.Amino, @@ -21,55 +21,55 @@ export class ProviderConfig extends JSONSerializable< public invert: boolean, public metadata_JSON: string ) { - super(); + super() } public static fromAmino(data: ProviderConfig.Amino): ProviderConfig { const { name, off_chain_ticker, normalize_by_pair, invert, metadata_JSON } = - data; + data return new ProviderConfig( name, off_chain_ticker, normalize_by_pair ? CurrencyPair.fromAmino(normalize_by_pair) : undefined, invert, metadata_JSON - ); + ) } public toAmino(): ProviderConfig.Amino { const { name, off_chain_ticker, normalize_by_pair, invert, metadata_JSON } = - this; + this return { name, off_chain_ticker, normalize_by_pair: normalize_by_pair?.toAmino(), invert, metadata_JSON, - }; + } } public static fromData(data: ProviderConfig.Data): ProviderConfig { const { name, off_chain_ticker, normalize_by_pair, invert, metadata_JSON } = - data; + data return new ProviderConfig( name, off_chain_ticker, normalize_by_pair ? CurrencyPair.fromData(normalize_by_pair) : undefined, invert, metadata_JSON - ); + ) } public toData(): ProviderConfig.Data { const { name, off_chain_ticker, normalize_by_pair, invert, metadata_JSON } = - this; + this return { name, off_chain_ticker, normalize_by_pair: normalize_by_pair?.toData(), invert, metadata_JSON, - }; + } } public static fromProto(proto: ProviderConfig.Proto): ProviderConfig { @@ -81,38 +81,38 @@ export class ProviderConfig extends JSONSerializable< : undefined, proto.invert, proto.metadataJSON - ); + ) } public toProto(): ProviderConfig.Proto { const { name, off_chain_ticker, normalize_by_pair, invert, metadata_JSON } = - this; + this return ProviderConfig_pb.fromPartial({ name, offChainTicker: off_chain_ticker, normalizeByPair: normalize_by_pair?.toProto(), invert, metadataJSON: metadata_JSON, - }); + }) } } export namespace ProviderConfig { export interface Amino { - name: string; - off_chain_ticker: string; - normalize_by_pair?: CurrencyPair.Amino; - invert: boolean; - metadata_JSON: string; + name: string + off_chain_ticker: string + normalize_by_pair?: CurrencyPair.Amino + invert: boolean + metadata_JSON: string } export interface Data { - name: string; - off_chain_ticker: string; - normalize_by_pair?: CurrencyPair.Data; - invert: boolean; - metadata_JSON: string; + name: string + off_chain_ticker: string + normalize_by_pair?: CurrencyPair.Data + invert: boolean + metadata_JSON: string } - export type Proto = ProviderConfig_pb; + export type Proto = ProviderConfig_pb } diff --git a/src/core/marketmap/Ticker.ts b/src/core/marketmap/Ticker.ts index 9342a5a..89dbfe0 100644 --- a/src/core/marketmap/Ticker.ts +++ b/src/core/marketmap/Ticker.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { CurrencyPair } from '../oracle'; -import { Ticker as Ticker_pb } from '@initia/initia.proto/slinky/marketmap/v1/market'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { CurrencyPair } from '../oracle' +import { Ticker as Ticker_pb } from '@initia/initia.proto/slinky/marketmap/v1/market' +import Long from 'long' export class Ticker extends JSONSerializable< Ticker.Amino, @@ -22,7 +22,7 @@ export class Ticker extends JSONSerializable< public enabled: boolean, public metadata_JSON: string ) { - super(); + super() } public static fromAmino(data: Ticker.Amino): Ticker { @@ -32,14 +32,14 @@ export class Ticker extends JSONSerializable< min_provider_count, enabled, metadata_JSON, - } = data; + } = data return new Ticker( CurrencyPair.fromAmino(currency_pair), Number.parseInt(decimals), Number.parseInt(min_provider_count), enabled, metadata_JSON - ); + ) } public toAmino(): Ticker.Amino { @@ -49,14 +49,14 @@ export class Ticker extends JSONSerializable< min_provider_count, enabled, metadata_JSON, - } = this; + } = this return { currency_pair: currency_pair.toAmino(), decimals: decimals.toString(), min_provider_count: min_provider_count.toString(), enabled, metadata_JSON, - }; + } } public static fromData(data: Ticker.Data): Ticker { @@ -66,14 +66,14 @@ export class Ticker extends JSONSerializable< min_provider_count, enabled, metadata_JSON, - } = data; + } = data return new Ticker( CurrencyPair.fromData(currency_pair), Number.parseInt(decimals), Number.parseInt(min_provider_count), enabled, metadata_JSON - ); + ) } public toData(): Ticker.Data { @@ -83,14 +83,14 @@ export class Ticker extends JSONSerializable< min_provider_count, enabled, metadata_JSON, - } = this; + } = this return { currency_pair: currency_pair.toData(), decimals: decimals.toString(), min_provider_count: min_provider_count.toString(), enabled, metadata_JSON, - }; + } } public static fromProto(proto: Ticker.Proto): Ticker { @@ -100,7 +100,7 @@ export class Ticker extends JSONSerializable< proto.minProviderCount.toNumber(), proto.enabled, proto.metadataJSON - ); + ) } public toProto(): Ticker.Proto { @@ -110,33 +110,33 @@ export class Ticker extends JSONSerializable< min_provider_count, enabled, metadata_JSON, - } = this; + } = this return Ticker_pb.fromPartial({ currencyPair: currency_pair, decimals: Long.fromNumber(decimals), minProviderCount: Long.fromNumber(min_provider_count), enabled, metadataJSON: metadata_JSON, - }); + }) } } export namespace Ticker { export interface Amino { - currency_pair: CurrencyPair.Amino; - decimals: string; - min_provider_count: string; - enabled: boolean; - metadata_JSON: string; + currency_pair: CurrencyPair.Amino + decimals: string + min_provider_count: string + enabled: boolean + metadata_JSON: string } export interface Data { - currency_pair: CurrencyPair.Data; - decimals: string; - min_provider_count: string; - enabled: boolean; - metadata_JSON: string; + currency_pair: CurrencyPair.Data + decimals: string + min_provider_count: string + enabled: boolean + metadata_JSON: string } - export type Proto = Ticker_pb; + export type Proto = Ticker_pb } diff --git a/src/core/marketmap/index.ts b/src/core/marketmap/index.ts index b6ca969..d1f8195 100644 --- a/src/core/marketmap/index.ts +++ b/src/core/marketmap/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './Market'; -export * from './ProviderConfig'; -export * from './Ticker'; -export * from './MarketmapParams'; +export * from './msgs' +export * from './Market' +export * from './ProviderConfig' +export * from './Ticker' +export * from './MarketmapParams' diff --git a/src/core/marketmap/msgs/MsgCreateMarkets.ts b/src/core/marketmap/msgs/MsgCreateMarkets.ts index 4f28987..c8860ea 100644 --- a/src/core/marketmap/msgs/MsgCreateMarkets.ts +++ b/src/core/marketmap/msgs/MsgCreateMarkets.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreateMarkets as MsgCreateMarkets_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx'; -import { Market } from '../Market'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreateMarkets as MsgCreateMarkets_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx' +import { Market } from '../Market' export class MsgCreateMarkets extends JSONSerializable< MsgCreateMarkets.Amino, @@ -13,86 +13,86 @@ export class MsgCreateMarkets extends JSONSerializable< * @param authority the signer of this transaction * @param create_markets the list of all markets to be created for the given transaction */ - constructor(public authority: AccAddress, public create_markets: Market[]) { - super(); + constructor( + public authority: AccAddress, + public create_markets: Market[] + ) { + super() } public static fromAmino(data: MsgCreateMarkets.Amino): MsgCreateMarkets { const { value: { authority, create_markets }, - } = data; - return new MsgCreateMarkets( - authority, - create_markets.map(Market.fromAmino) - ); + } = data + return new MsgCreateMarkets(authority, create_markets.map(Market.fromAmino)) } public toAmino(): MsgCreateMarkets.Amino { - const { authority, create_markets } = this; + const { authority, create_markets } = this return { type: 'slinky/x/marketmap/MsgCreateMarkets', value: { authority, - create_markets: create_markets.map(msg => msg.toAmino()), + create_markets: create_markets.map((msg) => msg.toAmino()), }, - }; + } } public static fromData(data: MsgCreateMarkets.Data): MsgCreateMarkets { - const { authority, create_markets } = data; - return new MsgCreateMarkets(authority, create_markets.map(Market.fromData)); + const { authority, create_markets } = data + return new MsgCreateMarkets(authority, create_markets.map(Market.fromData)) } public toData(): MsgCreateMarkets.Data { - const { authority, create_markets } = this; + const { authority, create_markets } = this return { '@type': '/slinky.marketmap.v1.MsgCreateMarkets', authority, - create_markets: create_markets.map(msg => msg.toData()), - }; + create_markets: create_markets.map((msg) => msg.toData()), + } } public static fromProto(data: MsgCreateMarkets.Proto): MsgCreateMarkets { return new MsgCreateMarkets( data.authority, data.createMarkets.map(Market.fromProto) - ); + ) } public toProto(): MsgCreateMarkets.Proto { - const { authority, create_markets } = this; + const { authority, create_markets } = this return MsgCreateMarkets_pb.fromPartial({ authority, - createMarkets: create_markets.map(c => c.toProto()), - }); + createMarkets: create_markets.map((c) => c.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.marketmap.v1.MsgCreateMarkets', value: MsgCreateMarkets_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateMarkets { - return MsgCreateMarkets.fromProto(MsgCreateMarkets_pb.decode(msgAny.value)); + return MsgCreateMarkets.fromProto(MsgCreateMarkets_pb.decode(msgAny.value)) } } export namespace MsgCreateMarkets { export interface Amino { - type: 'slinky/x/marketmap/MsgCreateMarkets'; + type: 'slinky/x/marketmap/MsgCreateMarkets' value: { - authority: AccAddress; - create_markets: Market.Amino[]; - }; + authority: AccAddress + create_markets: Market.Amino[] + } } export interface Data { - '@type': '/slinky.marketmap.v1.MsgCreateMarkets'; - authority: AccAddress; - create_markets: Market.Data[]; + '@type': '/slinky.marketmap.v1.MsgCreateMarkets' + authority: AccAddress + create_markets: Market.Data[] } - export type Proto = MsgCreateMarkets_pb; + export type Proto = MsgCreateMarkets_pb } diff --git a/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts b/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts index 4b5d6bd..d4c6357 100644 --- a/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts +++ b/src/core/marketmap/msgs/MsgRemoveMarketAuthorities.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRemoveMarketAuthorities as MsgRemoveMarketAuthorities_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRemoveMarketAuthorities as MsgRemoveMarketAuthorities_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx' export class MsgRemoveMarketAuthorities extends JSONSerializable< MsgRemoveMarketAuthorities.Amino, @@ -12,8 +12,11 @@ export class MsgRemoveMarketAuthorities extends JSONSerializable< * @param remove_addresses the list of addresses to remove * @param admin the authority that is the x/marketmap Admin account */ - constructor(public remove_addresses: AccAddress[], public admin: AccAddress) { - super(); + constructor( + public remove_addresses: AccAddress[], + public admin: AccAddress + ) { + super() } public static fromAmino( @@ -21,79 +24,79 @@ export class MsgRemoveMarketAuthorities extends JSONSerializable< ): MsgRemoveMarketAuthorities { const { value: { remove_addresses, admin }, - } = data; - return new MsgRemoveMarketAuthorities(remove_addresses, admin); + } = data + return new MsgRemoveMarketAuthorities(remove_addresses, admin) } public toAmino(): MsgRemoveMarketAuthorities.Amino { - const { remove_addresses, admin } = this; + const { remove_addresses, admin } = this return { type: 'slinky/x/marketmap/MsgRemoveMarketAuthorities', value: { remove_addresses, admin, }, - }; + } } public static fromData( data: MsgRemoveMarketAuthorities.Data ): MsgRemoveMarketAuthorities { - const { remove_addresses, admin } = data; - return new MsgRemoveMarketAuthorities(remove_addresses, admin); + const { remove_addresses, admin } = data + return new MsgRemoveMarketAuthorities(remove_addresses, admin) } public toData(): MsgRemoveMarketAuthorities.Data { - const { remove_addresses, admin } = this; + const { remove_addresses, admin } = this return { '@type': '/slinky.marketmap.v1.MsgRemoveMarketAuthorities', remove_addresses, admin, - }; + } } public static fromProto( data: MsgRemoveMarketAuthorities.Proto ): MsgRemoveMarketAuthorities { - return new MsgRemoveMarketAuthorities(data.removeAddresses, data.admin); + return new MsgRemoveMarketAuthorities(data.removeAddresses, data.admin) } public toProto(): MsgRemoveMarketAuthorities.Proto { - const { remove_addresses, admin } = this; + const { remove_addresses, admin } = this return MsgRemoveMarketAuthorities_pb.fromPartial({ removeAddresses: remove_addresses, admin, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.marketmap.v1.MsgRemoveMarketAuthorities', value: MsgRemoveMarketAuthorities_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRemoveMarketAuthorities { return MsgRemoveMarketAuthorities.fromProto( MsgRemoveMarketAuthorities_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRemoveMarketAuthorities { export interface Amino { - type: 'slinky/x/marketmap/MsgRemoveMarketAuthorities'; + type: 'slinky/x/marketmap/MsgRemoveMarketAuthorities' value: { - remove_addresses: AccAddress[]; - admin: AccAddress; - }; + remove_addresses: AccAddress[] + admin: AccAddress + } } export interface Data { - '@type': '/slinky.marketmap.v1.MsgRemoveMarketAuthorities'; - remove_addresses: AccAddress[]; - admin: AccAddress; + '@type': '/slinky.marketmap.v1.MsgRemoveMarketAuthorities' + remove_addresses: AccAddress[] + admin: AccAddress } - export type Proto = MsgRemoveMarketAuthorities_pb; + export type Proto = MsgRemoveMarketAuthorities_pb } diff --git a/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts b/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts index 87480da..46a153e 100644 --- a/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts +++ b/src/core/marketmap/msgs/MsgUpdateMarketmapParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MarketmapParams } from '../MarketmapParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgParams as MsgParams_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MarketmapParams } from '../MarketmapParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgParams as MsgParams_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx' export class MsgUpdateMarketmapParams extends JSONSerializable< MsgUpdateMarketmapParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateMarketmapParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/hook parameters to update */ - constructor(public authority: AccAddress, public params: MarketmapParams) { - super(); + constructor( + public authority: AccAddress, + public params: MarketmapParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateMarketmapParams extends JSONSerializable< ): MsgUpdateMarketmapParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateMarketmapParams( authority, MarketmapParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateMarketmapParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'slinky/x/marketmap/MsgParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateMarketmapParams.Data ): MsgUpdateMarketmapParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateMarketmapParams( authority, MarketmapParams.fromData(params) - ); + ) } public toData(): MsgUpdateMarketmapParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/slinky.marketmap.v1.MsgParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,43 @@ export class MsgUpdateMarketmapParams extends JSONSerializable< return new MsgUpdateMarketmapParams( data.authority, MarketmapParams.fromProto(data.params as MarketmapParams.Proto) - ); + ) } public toProto(): MsgUpdateMarketmapParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.marketmap.v1.MsgParams', value: MsgParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateMarketmapParams { - return MsgUpdateMarketmapParams.fromProto( - MsgParams_pb.decode(msgAny.value) - ); + return MsgUpdateMarketmapParams.fromProto(MsgParams_pb.decode(msgAny.value)) } } export namespace MsgUpdateMarketmapParams { export interface Amino { - type: 'slinky/x/marketmap/MsgParams'; + type: 'slinky/x/marketmap/MsgParams' value: { - authority: AccAddress; - params: MarketmapParams.Amino; - }; + authority: AccAddress + params: MarketmapParams.Amino + } } export interface Data { - '@type': '/slinky.marketmap.v1.MsgParams'; - authority: AccAddress; - params: MarketmapParams.Data; + '@type': '/slinky.marketmap.v1.MsgParams' + authority: AccAddress + params: MarketmapParams.Data } - export type Proto = MsgParams_pb; + export type Proto = MsgParams_pb } diff --git a/src/core/marketmap/msgs/MsgUpdateMarkets.ts b/src/core/marketmap/msgs/MsgUpdateMarkets.ts index fd4fbda..08d28d4 100644 --- a/src/core/marketmap/msgs/MsgUpdateMarkets.ts +++ b/src/core/marketmap/msgs/MsgUpdateMarkets.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateMarkets as MsgUpdateMarkets_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx'; -import { Market } from '../Market'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateMarkets as MsgUpdateMarkets_pb } from '@initia/initia.proto/slinky/marketmap/v1/tx' +import { Market } from '../Market' export class MsgUpdateMarkets extends JSONSerializable< MsgUpdateMarkets.Amino, @@ -13,86 +13,86 @@ export class MsgUpdateMarkets extends JSONSerializable< * @param authority the signer of this transaction * @param update_markets the list of all markets to be updated for the given transaction */ - constructor(public authority: AccAddress, public update_markets: Market[]) { - super(); + constructor( + public authority: AccAddress, + public update_markets: Market[] + ) { + super() } public static fromAmino(data: MsgUpdateMarkets.Amino): MsgUpdateMarkets { const { value: { authority, update_markets }, - } = data; - return new MsgUpdateMarkets( - authority, - update_markets.map(Market.fromAmino) - ); + } = data + return new MsgUpdateMarkets(authority, update_markets.map(Market.fromAmino)) } public toAmino(): MsgUpdateMarkets.Amino { - const { authority, update_markets } = this; + const { authority, update_markets } = this return { type: 'slinky/x/marketmap/MsgUpdateMarkets', value: { authority, - update_markets: update_markets.map(msg => msg.toAmino()), + update_markets: update_markets.map((msg) => msg.toAmino()), }, - }; + } } public static fromData(data: MsgUpdateMarkets.Data): MsgUpdateMarkets { - const { authority, update_markets } = data; - return new MsgUpdateMarkets(authority, update_markets.map(Market.fromData)); + const { authority, update_markets } = data + return new MsgUpdateMarkets(authority, update_markets.map(Market.fromData)) } public toData(): MsgUpdateMarkets.Data { - const { authority, update_markets } = this; + const { authority, update_markets } = this return { '@type': '/slinky.marketmap.v1.MsgUpdateMarkets', authority, - update_markets: update_markets.map(msg => msg.toData()), - }; + update_markets: update_markets.map((msg) => msg.toData()), + } } public static fromProto(data: MsgUpdateMarkets.Proto): MsgUpdateMarkets { return new MsgUpdateMarkets( data.authority, data.updateMarkets.map(Market.fromProto) - ); + ) } public toProto(): MsgUpdateMarkets.Proto { - const { authority, update_markets } = this; + const { authority, update_markets } = this return MsgUpdateMarkets_pb.fromPartial({ authority, - updateMarkets: update_markets.map(c => c.toProto()), - }); + updateMarkets: update_markets.map((c) => c.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.marketmap.v1.MsgUpdateMarkets', value: MsgUpdateMarkets_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateMarkets { - return MsgUpdateMarkets.fromProto(MsgUpdateMarkets_pb.decode(msgAny.value)); + return MsgUpdateMarkets.fromProto(MsgUpdateMarkets_pb.decode(msgAny.value)) } } export namespace MsgUpdateMarkets { export interface Amino { - type: 'slinky/x/marketmap/MsgUpdateMarkets'; + type: 'slinky/x/marketmap/MsgUpdateMarkets' value: { - authority: AccAddress; - update_markets: Market.Amino[]; - }; + authority: AccAddress + update_markets: Market.Amino[] + } } export interface Data { - '@type': '/slinky.marketmap.v1.MsgUpdateMarkets'; - authority: AccAddress; - update_markets: Market.Data[]; + '@type': '/slinky.marketmap.v1.MsgUpdateMarkets' + authority: AccAddress + update_markets: Market.Data[] } - export type Proto = MsgUpdateMarkets_pb; + export type Proto = MsgUpdateMarkets_pb } diff --git a/src/core/marketmap/msgs/index.ts b/src/core/marketmap/msgs/index.ts index e137d96..4c68157 100644 --- a/src/core/marketmap/msgs/index.ts +++ b/src/core/marketmap/msgs/index.ts @@ -1,35 +1,35 @@ -import { MsgCreateMarkets } from './MsgCreateMarkets'; -import { MsgUpdateMarkets } from './MsgUpdateMarkets'; -import { MsgRemoveMarketAuthorities } from './MsgRemoveMarketAuthorities'; -import { MsgUpdateMarketmapParams } from './MsgUpdateMarketmapParams'; +import { MsgCreateMarkets } from './MsgCreateMarkets' +import { MsgUpdateMarkets } from './MsgUpdateMarkets' +import { MsgRemoveMarketAuthorities } from './MsgRemoveMarketAuthorities' +import { MsgUpdateMarketmapParams } from './MsgUpdateMarketmapParams' -export * from './MsgCreateMarkets'; -export * from './MsgUpdateMarkets'; -export * from './MsgRemoveMarketAuthorities'; -export * from './MsgUpdateMarketmapParams'; +export * from './MsgCreateMarkets' +export * from './MsgUpdateMarkets' +export * from './MsgRemoveMarketAuthorities' +export * from './MsgUpdateMarketmapParams' export type MarketmapMsg = | MsgCreateMarkets | MsgUpdateMarkets | MsgRemoveMarketAuthorities - | MsgUpdateMarketmapParams; + | MsgUpdateMarketmapParams export namespace MarketmapMsg { export type Amino = | MsgCreateMarkets.Amino | MsgUpdateMarkets.Amino | MsgRemoveMarketAuthorities.Amino - | MsgUpdateMarketmapParams.Amino; + | MsgUpdateMarketmapParams.Amino export type Data = | MsgCreateMarkets.Data | MsgUpdateMarkets.Data | MsgRemoveMarketAuthorities.Data - | MsgUpdateMarketmapParams.Data; + | MsgUpdateMarketmapParams.Data export type Proto = | MsgCreateMarkets.Proto | MsgUpdateMarkets.Proto | MsgRemoveMarketAuthorities.Proto - | MsgUpdateMarketmapParams.Proto; + | MsgUpdateMarketmapParams.Proto } diff --git a/src/core/move/MoveParams.ts b/src/core/move/MoveParams.ts index 91a8247..7b32b16 100644 --- a/src/core/move/MoveParams.ts +++ b/src/core/move/MoveParams.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { Params as Params_pb } from '@initia/initia.proto/initia/move/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Params as Params_pb } from '@initia/initia.proto/initia/move/v1/types' export class MoveParams extends JSONSerializable< MoveParams.Amino, @@ -18,7 +18,7 @@ export class MoveParams extends JSONSerializable< public contract_shared_revenue_ratio: string, public allowed_publishers: string[] ) { - super(); + super() } public static fromAmino(data: MoveParams.Amino): MoveParams { @@ -29,13 +29,13 @@ export class MoveParams extends JSONSerializable< contract_shared_revenue_ratio, allowed_publishers, }, - } = data; + } = data return new MoveParams( base_denom, base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers - ); + ) } public toAmino(): MoveParams.Amino { @@ -44,7 +44,7 @@ export class MoveParams extends JSONSerializable< base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers, - } = this; + } = this return { type: 'move/Params', value: { @@ -53,7 +53,7 @@ export class MoveParams extends JSONSerializable< contract_shared_revenue_ratio, allowed_publishers, }, - }; + } } public static fromData(data: MoveParams.Data): MoveParams { @@ -62,13 +62,13 @@ export class MoveParams extends JSONSerializable< base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers, - } = data; + } = data return new MoveParams( base_denom, base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers - ); + ) } public toData(): MoveParams.Data { @@ -77,14 +77,14 @@ export class MoveParams extends JSONSerializable< base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers, - } = this; + } = this return { '@type': '/initia.move.v1.Params', base_denom, base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers, - }; + } } public static fromProto(data: MoveParams.Proto): MoveParams { @@ -93,7 +93,7 @@ export class MoveParams extends JSONSerializable< data.baseMinGasPrice, data.contractSharedRevenueRatio, data.allowedPublishers - ); + ) } public toProto(): MoveParams.Proto { @@ -102,34 +102,34 @@ export class MoveParams extends JSONSerializable< base_min_gas_price, contract_shared_revenue_ratio, allowed_publishers, - } = this; + } = this return Params_pb.fromPartial({ baseDenom: base_denom, baseMinGasPrice: base_min_gas_price, contractSharedRevenueRatio: contract_shared_revenue_ratio, allowedPublishers: allowed_publishers, - }); + }) } } export namespace MoveParams { export interface Amino { - type: 'move/Params'; + type: 'move/Params' value: { - base_denom: string; - base_min_gas_price: string; - contract_shared_revenue_ratio: string; - allowed_publishers: string[]; - }; + base_denom: string + base_min_gas_price: string + contract_shared_revenue_ratio: string + allowed_publishers: string[] + } } export interface Data { - '@type': '/initia.move.v1.Params'; - base_denom: string; - base_min_gas_price: string; - contract_shared_revenue_ratio: string; - allowed_publishers: string[]; + '@type': '/initia.move.v1.Params' + base_denom: string + base_min_gas_price: string + contract_shared_revenue_ratio: string + allowed_publishers: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/move/index.ts b/src/core/move/index.ts index f6c1771..08bbf83 100644 --- a/src/core/move/index.ts +++ b/src/core/move/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './MoveParams'; +export * from './msgs' +export * from './MoveParams' diff --git a/src/core/move/msgs/MsgDelist.ts b/src/core/move/msgs/MsgDelist.ts index 229dc40..cc0924c 100644 --- a/src/core/move/msgs/MsgDelist.ts +++ b/src/core/move/msgs/MsgDelist.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgDelist as MsgDelist_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgDelist as MsgDelist_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgDelist extends JSONSerializable< MsgDelist.Amino, @@ -12,20 +12,23 @@ export class MsgDelist extends JSONSerializable< * @param authority the address that controls the module * @param metadata_lp Dex coin LP metadata address */ - constructor(public authority: AccAddress, public metadata_lp: string) { - super(); + constructor( + public authority: AccAddress, + public metadata_lp: string + ) { + super() } public static fromAmino(data: MsgDelist.Amino): MsgDelist { const { value: { authority, metadata_lp }, - } = data; + } = data - return new MsgDelist(authority, metadata_lp); + return new MsgDelist(authority, metadata_lp) } public toAmino(): MsgDelist.Amino { - const { authority, metadata_lp } = this; + const { authority, metadata_lp } = this return { type: 'move/MsgDelist', @@ -33,64 +36,64 @@ export class MsgDelist extends JSONSerializable< authority, metadata_lp, }, - }; + } } public static fromData(data: MsgDelist.Data): MsgDelist { - const { authority, metadata_lp } = data; + const { authority, metadata_lp } = data - return new MsgDelist(authority, metadata_lp); + return new MsgDelist(authority, metadata_lp) } public toData(): MsgDelist.Data { - const { authority, metadata_lp } = this; + const { authority, metadata_lp } = this return { '@type': '/initia.move.v1.MsgDelist', authority, metadata_lp, - }; + } } public static fromProto(data: MsgDelist.Proto): MsgDelist { - return new MsgDelist(data.authority, data.metadataLp); + return new MsgDelist(data.authority, data.metadataLp) } public toProto(): MsgDelist.Proto { - const { authority, metadata_lp } = this; + const { authority, metadata_lp } = this return MsgDelist_pb.fromPartial({ authority, metadataLp: metadata_lp, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgDelist', value: MsgDelist_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDelist { - return MsgDelist.fromProto(MsgDelist_pb.decode(msgAny.value)); + return MsgDelist.fromProto(MsgDelist_pb.decode(msgAny.value)) } } export namespace MsgDelist { export interface Amino { - type: 'move/MsgDelist'; + type: 'move/MsgDelist' value: { - authority: AccAddress; - metadata_lp: string; - }; + authority: AccAddress + metadata_lp: string + } } export interface Data { - '@type': '/initia.move.v1.MsgDelist'; - authority: AccAddress; - metadata_lp: string; + '@type': '/initia.move.v1.MsgDelist' + authority: AccAddress + metadata_lp: string } - export type Proto = MsgDelist_pb; + export type Proto = MsgDelist_pb } diff --git a/src/core/move/msgs/MsgExecute.ts b/src/core/move/msgs/MsgExecute.ts index dd1daa7..574122a 100644 --- a/src/core/move/msgs/MsgExecute.ts +++ b/src/core/move/msgs/MsgExecute.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgExecute as MsgExecute_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgExecute as MsgExecute_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgExecute extends JSONSerializable< MsgExecute.Amino, MsgExecute.Data, MsgExecute.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param sender the actor that signed the messages @@ -27,9 +27,9 @@ export class MsgExecute extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgExecute.Amino): MsgExecute { @@ -42,7 +42,7 @@ export class MsgExecute extends JSONSerializable< type_args, args, }, - } = data; + } = data return new MsgExecute( sender, module_address, @@ -50,7 +50,7 @@ export class MsgExecute extends JSONSerializable< function_name, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgExecute.Amino { @@ -61,7 +61,7 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { type: 'move/MsgExecute', @@ -73,7 +73,7 @@ export class MsgExecute extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromProto(data: MsgExecute.Proto): MsgExecute { @@ -83,8 +83,8 @@ export class MsgExecute extends JSONSerializable< data.moduleName, data.functionName, data.typeArgs, - data.args.map(arg => Buffer.from(arg).toString('base64')) - ); + data.args.map((arg) => Buffer.from(arg).toString('base64')) + ) } public toProto(): MsgExecute.Proto { @@ -95,26 +95,26 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return MsgExecute_pb.fromPartial({ sender, moduleAddress: module_address, moduleName: module_name, functionName: function_name, typeArgs: type_args, - args: args.map(arg => Buffer.from(arg, 'base64')), - }); + args: args.map((arg) => Buffer.from(arg, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgExecute', value: MsgExecute_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgExecute { - return MsgExecute.fromProto(MsgExecute_pb.decode(msgAny.value)); + return MsgExecute.fromProto(MsgExecute_pb.decode(msgAny.value)) } public static fromData(data: MsgExecute.Data): MsgExecute { @@ -125,7 +125,7 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args, - } = data; + } = data return new MsgExecute( sender, module_address, @@ -133,7 +133,7 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args - ); + ) } public toData(): MsgExecute.Data { @@ -144,7 +144,7 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { '@type': '/initia.move.v1.MsgExecute', sender, @@ -153,32 +153,32 @@ export class MsgExecute extends JSONSerializable< function_name, type_args, args, - }; + } } } export namespace MsgExecute { export interface Amino { - type: 'move/MsgExecute'; + type: 'move/MsgExecute' value: { - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args?: string[]; - args?: string[]; - }; + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgExecute'; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgExecute' + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args: string[] + args: string[] } - export type Proto = MsgExecute_pb; + export type Proto = MsgExecute_pb } diff --git a/src/core/move/msgs/MsgExecuteJSON.ts b/src/core/move/msgs/MsgExecuteJSON.ts index 3e8e133..0db61a0 100644 --- a/src/core/move/msgs/MsgExecuteJSON.ts +++ b/src/core/move/msgs/MsgExecuteJSON.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgExecuteJSON as MsgExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgExecuteJSON as MsgExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgExecuteJSON extends JSONSerializable< MsgExecuteJSON.Amino, MsgExecuteJSON.Data, MsgExecuteJSON.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param sender the actor that signed the messages @@ -27,9 +27,9 @@ export class MsgExecuteJSON extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgExecuteJSON.Amino): MsgExecuteJSON { @@ -42,7 +42,7 @@ export class MsgExecuteJSON extends JSONSerializable< type_args, args, }, - } = data; + } = data return new MsgExecuteJSON( sender, module_address, @@ -50,7 +50,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgExecuteJSON.Amino { @@ -61,7 +61,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { type: 'move/MsgExecuteJSON', @@ -73,7 +73,7 @@ export class MsgExecuteJSON extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgExecuteJSON.Data): MsgExecuteJSON { @@ -84,7 +84,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = data; + } = data return new MsgExecuteJSON( sender, module_address, @@ -92,7 +92,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args - ); + ) } public toData(): MsgExecuteJSON.Data { @@ -103,7 +103,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { '@type': '/initia.move.v1.MsgExecuteJSON', sender, @@ -112,7 +112,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args, - }; + } } public static fromProto(data: MsgExecuteJSON.Proto): MsgExecuteJSON { @@ -123,7 +123,7 @@ export class MsgExecuteJSON extends JSONSerializable< data.functionName, data.typeArgs, data.args - ); + ) } public toProto(): MsgExecuteJSON.Proto { @@ -134,7 +134,7 @@ export class MsgExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return MsgExecuteJSON_pb.fromPartial({ sender, moduleAddress: module_address, @@ -142,43 +142,43 @@ export class MsgExecuteJSON extends JSONSerializable< functionName: function_name, typeArgs: type_args, args, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgExecuteJSON', value: MsgExecuteJSON_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgExecuteJSON { - return MsgExecuteJSON.fromProto(MsgExecuteJSON_pb.decode(msgAny.value)); + return MsgExecuteJSON.fromProto(MsgExecuteJSON_pb.decode(msgAny.value)) } } export namespace MsgExecuteJSON { export interface Amino { - type: 'move/MsgExecuteJSON'; + type: 'move/MsgExecuteJSON' value: { - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args?: string[]; - args?: string[]; - }; + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgExecuteJSON'; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgExecuteJSON' + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args: string[] + args: string[] } - export type Proto = MsgExecuteJSON_pb; + export type Proto = MsgExecuteJSON_pb } diff --git a/src/core/move/msgs/MsgGovExecute.ts b/src/core/move/msgs/MsgGovExecute.ts index 5429777..6cc440b 100644 --- a/src/core/move/msgs/MsgGovExecute.ts +++ b/src/core/move/msgs/MsgGovExecute.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGovExecute as MsgGovExecute_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGovExecute as MsgGovExecute_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgGovExecute extends JSONSerializable< MsgGovExecute.Amino, MsgGovExecute.Data, MsgGovExecute.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param authority the address that controls the module @@ -29,9 +29,9 @@ export class MsgGovExecute extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgGovExecute.Amino): MsgGovExecute { @@ -45,7 +45,7 @@ export class MsgGovExecute extends JSONSerializable< type_args, args, }, - } = data; + } = data return new MsgGovExecute( authority, @@ -55,7 +55,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgGovExecute.Amino { @@ -67,7 +67,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { type: 'move/MsgGovExecute', @@ -80,7 +80,7 @@ export class MsgGovExecute extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgGovExecute.Data): MsgGovExecute { @@ -92,7 +92,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args, - } = data; + } = data return new MsgGovExecute( authority, @@ -102,7 +102,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args - ); + ) } public toData(): MsgGovExecute.Data { @@ -114,7 +114,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { '@type': '/initia.move.v1.MsgGovExecute', @@ -125,7 +125,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args, - }; + } } public static fromProto(data: MsgGovExecute.Proto): MsgGovExecute { @@ -136,8 +136,8 @@ export class MsgGovExecute extends JSONSerializable< data.moduleName, data.functionName, data.typeArgs, - data.args.map(arg => Buffer.from(arg).toString('base64')) - ); + data.args.map((arg) => Buffer.from(arg).toString('base64')) + ) } public toProto(): MsgGovExecute.Proto { @@ -149,7 +149,7 @@ export class MsgGovExecute extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return MsgGovExecute_pb.fromPartial({ authority, @@ -158,46 +158,46 @@ export class MsgGovExecute extends JSONSerializable< moduleName: module_name, functionName: function_name, typeArgs: type_args, - args: args.map(arg => Buffer.from(arg, 'base64')), - }); + args: args.map((arg) => Buffer.from(arg, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgGovExecute', value: MsgGovExecute_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGovExecute { - return MsgGovExecute.fromProto(MsgGovExecute_pb.decode(msgAny.value)); + return MsgGovExecute.fromProto(MsgGovExecute_pb.decode(msgAny.value)) } } export namespace MsgGovExecute { export interface Amino { - type: 'move/MsgGovExecute'; + type: 'move/MsgGovExecute' value: { - authority: AccAddress; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args?: string[]; - args?: string[]; - }; + authority: AccAddress + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgGovExecute'; - authority: AccAddress; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgGovExecute' + authority: AccAddress + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args: string[] + args: string[] } - export type Proto = MsgGovExecute_pb; + export type Proto = MsgGovExecute_pb } diff --git a/src/core/move/msgs/MsgGovExecuteJSON.ts b/src/core/move/msgs/MsgGovExecuteJSON.ts index 44b904f..0a8273a 100644 --- a/src/core/move/msgs/MsgGovExecuteJSON.ts +++ b/src/core/move/msgs/MsgGovExecuteJSON.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGovExecuteJSON as MsgGovExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGovExecuteJSON as MsgGovExecuteJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgGovExecuteJSON extends JSONSerializable< MsgGovExecuteJSON.Amino, MsgGovExecuteJSON.Data, MsgGovExecuteJSON.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param authority the address that controls the module @@ -29,9 +29,9 @@ export class MsgGovExecuteJSON extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgGovExecuteJSON.Amino): MsgGovExecuteJSON { @@ -45,7 +45,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< type_args, args, }, - } = data; + } = data return new MsgGovExecuteJSON( authority, @@ -55,7 +55,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgGovExecuteJSON.Amino { @@ -67,7 +67,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { type: 'move/MsgGovExecuteJSON', @@ -80,7 +80,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgGovExecuteJSON.Data): MsgGovExecuteJSON { @@ -92,7 +92,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = data; + } = data return new MsgGovExecuteJSON( authority, @@ -102,7 +102,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args - ); + ) } public toData(): MsgGovExecuteJSON.Data { @@ -114,7 +114,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return { '@type': '/initia.move.v1.MsgGovExecuteJSON', @@ -125,7 +125,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args, - }; + } } public static fromProto(data: MsgGovExecuteJSON.Proto): MsgGovExecuteJSON { @@ -137,7 +137,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< data.functionName, data.typeArgs, data.args - ); + ) } public toProto(): MsgGovExecuteJSON.Proto { @@ -149,7 +149,7 @@ export class MsgGovExecuteJSON extends JSONSerializable< function_name, type_args, args, - } = this; + } = this return MsgGovExecuteJSON_pb.fromPartial({ authority, @@ -159,47 +159,47 @@ export class MsgGovExecuteJSON extends JSONSerializable< functionName: function_name, typeArgs: type_args, args, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgGovExecuteJSON', value: MsgGovExecuteJSON_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGovExecuteJSON { return MsgGovExecuteJSON.fromProto( MsgGovExecuteJSON_pb.decode(msgAny.value) - ); + ) } } export namespace MsgGovExecuteJSON { export interface Amino { - type: 'move/MsgGovExecuteJSON'; + type: 'move/MsgGovExecuteJSON' value: { - authority: AccAddress; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args?: string[]; - args?: string[]; - }; + authority: AccAddress + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgGovExecuteJSON'; - authority: AccAddress; - sender: AccAddress; - module_address: AccAddress; - module_name: string; - function_name: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgGovExecuteJSON' + authority: AccAddress + sender: AccAddress + module_address: AccAddress + module_name: string + function_name: string + type_args: string[] + args: string[] } - export type Proto = MsgGovExecuteJSON_pb; + export type Proto = MsgGovExecuteJSON_pb } diff --git a/src/core/move/msgs/MsgGovPublish.ts b/src/core/move/msgs/MsgGovPublish.ts index b91804f..d4c20ef 100644 --- a/src/core/move/msgs/MsgGovPublish.ts +++ b/src/core/move/msgs/MsgGovPublish.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGovPublish as MsgGovPublish_pb } from '@initia/initia.proto/initia/move/v1/tx'; -import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGovPublish as MsgGovPublish_pb } from '@initia/initia.proto/initia/move/v1/tx' +import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' export class MsgGovPublish extends JSONSerializable< MsgGovPublish.Amino, @@ -21,103 +21,106 @@ export class MsgGovPublish extends JSONSerializable< public code_bytes: string[], public upgrade_policy: MsgGovPublish.Policy ) { - super(); + super() } public static fromAmino(data: MsgGovPublish.Amino): MsgGovPublish { const { value: { authority, sender, code_bytes, upgrade_policy }, - } = data; + } = data return new MsgGovPublish( authority, sender, code_bytes, upgrade_policy ? upgrade_policy : 0 - ); + ) } public toAmino(): MsgGovPublish.Amino { - const { authority, sender, code_bytes, upgrade_policy } = this; + const { authority, sender, code_bytes, upgrade_policy } = this return { type: 'move/MsgGovPublish', value: { authority, sender, code_bytes, - upgrade_policy: upgrade_policy === 0 ? undefined : upgrade_policy, + upgrade_policy: + upgrade_policy === UpgradePolicy.UNSPECIFIED + ? undefined + : upgrade_policy, }, - }; + } } public static fromData(data: MsgGovPublish.Data): MsgGovPublish { - const { authority, sender, code_bytes, upgrade_policy } = data; - return new MsgGovPublish(authority, sender, code_bytes, upgrade_policy); + const { authority, sender, code_bytes, upgrade_policy } = data + return new MsgGovPublish(authority, sender, code_bytes, upgrade_policy) } public toData(): MsgGovPublish.Data { - const { authority, sender, code_bytes, upgrade_policy } = this; + const { authority, sender, code_bytes, upgrade_policy } = this return { '@type': '/initia.move.v1.MsgGovPublish', authority, sender, code_bytes, upgrade_policy, - }; + } } public static fromProto(proto: MsgGovPublish.Proto): MsgGovPublish { return new MsgGovPublish( proto.authority, proto.sender, - proto.codeBytes.map(code => Buffer.from(code).toString('base64')), + proto.codeBytes.map((code) => Buffer.from(code).toString('base64')), proto.upgradePolicy - ); + ) } public toProto(): MsgGovPublish.Proto { - const { authority, sender, code_bytes, upgrade_policy } = this; + const { authority, sender, code_bytes, upgrade_policy } = this return MsgGovPublish_pb.fromPartial({ authority, sender, - codeBytes: code_bytes.map(code => Buffer.from(code, 'base64')), + codeBytes: code_bytes.map((code) => Buffer.from(code, 'base64')), upgradePolicy: upgrade_policy, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgGovPublish', value: MsgGovPublish_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGovPublish { - return MsgGovPublish.fromProto(MsgGovPublish_pb.decode(msgAny.value)); + return MsgGovPublish.fromProto(MsgGovPublish_pb.decode(msgAny.value)) } } export namespace MsgGovPublish { - export type Policy = UpgradePolicy; - export const Policy = UpgradePolicy; + export type Policy = UpgradePolicy + export const Policy = UpgradePolicy export interface Amino { - type: 'move/MsgGovPublish'; + type: 'move/MsgGovPublish' value: { - authority: AccAddress; - sender: AccAddress; - code_bytes: string[]; - upgrade_policy?: UpgradePolicy; - }; + authority: AccAddress + sender: AccAddress + code_bytes: string[] + upgrade_policy?: UpgradePolicy + } } export interface Data { - '@type': '/initia.move.v1.MsgGovPublish'; - authority: AccAddress; - sender: AccAddress; - code_bytes: string[]; - upgrade_policy: UpgradePolicy; + '@type': '/initia.move.v1.MsgGovPublish' + authority: AccAddress + sender: AccAddress + code_bytes: string[] + upgrade_policy: UpgradePolicy } - export type Proto = MsgGovPublish_pb; + export type Proto = MsgGovPublish_pb } diff --git a/src/core/move/msgs/MsgGovScript.ts b/src/core/move/msgs/MsgGovScript.ts index 66fcaf3..7642ae0 100644 --- a/src/core/move/msgs/MsgGovScript.ts +++ b/src/core/move/msgs/MsgGovScript.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGovScript as MsgGovScript_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGovScript as MsgGovScript_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgGovScript extends JSONSerializable< MsgGovScript.Amino, MsgGovScript.Data, MsgGovScript.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param authority the address that controls the module @@ -25,15 +25,15 @@ export class MsgGovScript extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgGovScript.Amino): MsgGovScript { const { value: { authority, sender, code_bytes, type_args, args }, - } = data; + } = data return new MsgGovScript( authority, @@ -41,11 +41,11 @@ export class MsgGovScript extends JSONSerializable< code_bytes, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgGovScript.Amino { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return { type: 'move/MsgGovScript', value: { @@ -55,16 +55,16 @@ export class MsgGovScript extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgGovScript.Data): MsgGovScript { - const { authority, sender, code_bytes, type_args, args } = data; - return new MsgGovScript(authority, sender, code_bytes, type_args, args); + const { authority, sender, code_bytes, type_args, args } = data + return new MsgGovScript(authority, sender, code_bytes, type_args, args) } public toData(): MsgGovScript.Data { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return { '@type': '/initia.move.v1.MsgGovScript', authority, @@ -72,7 +72,7 @@ export class MsgGovScript extends JSONSerializable< code_bytes, type_args, args, - }; + } } public static fromProto(data: MsgGovScript.Proto): MsgGovScript { @@ -81,53 +81,53 @@ export class MsgGovScript extends JSONSerializable< data.sender, Buffer.from(data.codeBytes).toString('base64'), data.typeArgs, - data.args.map(arg => Buffer.from(arg).toString('base64')) - ); + data.args.map((arg) => Buffer.from(arg).toString('base64')) + ) } public toProto(): MsgGovScript.Proto { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return MsgGovScript_pb.fromPartial({ authority, sender, codeBytes: Buffer.from(code_bytes, 'base64'), typeArgs: type_args, - args: args.map(arg => Buffer.from(arg, 'base64')), - }); + args: args.map((arg) => Buffer.from(arg, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgGovScript', value: MsgGovScript_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGovScript { - return MsgGovScript.fromProto(MsgGovScript_pb.decode(msgAny.value)); + return MsgGovScript.fromProto(MsgGovScript_pb.decode(msgAny.value)) } } export namespace MsgGovScript { export interface Amino { - type: 'move/MsgGovScript'; + type: 'move/MsgGovScript' value: { - authority: AccAddress; - sender: AccAddress; - code_bytes: string; - type_args?: string[]; - args?: string[]; - }; + authority: AccAddress + sender: AccAddress + code_bytes: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgGovScript'; - authority: AccAddress; - sender: AccAddress; - code_bytes: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgGovScript' + authority: AccAddress + sender: AccAddress + code_bytes: string + type_args: string[] + args: string[] } - export type Proto = MsgGovScript_pb; + export type Proto = MsgGovScript_pb } diff --git a/src/core/move/msgs/MsgGovScriptJSON.ts b/src/core/move/msgs/MsgGovScriptJSON.ts index 65729c6..92fd1c2 100644 --- a/src/core/move/msgs/MsgGovScriptJSON.ts +++ b/src/core/move/msgs/MsgGovScriptJSON.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgGovScriptJSON as MsgGovScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgGovScriptJSON as MsgGovScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgGovScriptJSON extends JSONSerializable< MsgGovScriptJSON.Amino, MsgGovScriptJSON.Data, MsgGovScriptJSON.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param authority the address that controls the module @@ -25,15 +25,15 @@ export class MsgGovScriptJSON extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgGovScriptJSON.Amino): MsgGovScriptJSON { const { value: { authority, sender, code_bytes, type_args, args }, - } = data; + } = data return new MsgGovScriptJSON( authority, @@ -41,11 +41,11 @@ export class MsgGovScriptJSON extends JSONSerializable< code_bytes, type_args ?? [], args ?? [] - ); + ) } public toAmino(): MsgGovScriptJSON.Amino { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return { type: 'move/MsgGovScriptJSON', value: { @@ -55,16 +55,16 @@ export class MsgGovScriptJSON extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgGovScriptJSON.Data): MsgGovScriptJSON { - const { authority, sender, code_bytes, type_args, args } = data; - return new MsgGovScriptJSON(authority, sender, code_bytes, type_args, args); + const { authority, sender, code_bytes, type_args, args } = data + return new MsgGovScriptJSON(authority, sender, code_bytes, type_args, args) } public toData(): MsgGovScriptJSON.Data { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return { '@type': '/initia.move.v1.MsgGovScriptJSON', authority, @@ -72,7 +72,7 @@ export class MsgGovScriptJSON extends JSONSerializable< code_bytes, type_args, args, - }; + } } public static fromProto(data: MsgGovScriptJSON.Proto): MsgGovScriptJSON { @@ -82,52 +82,52 @@ export class MsgGovScriptJSON extends JSONSerializable< Buffer.from(data.codeBytes).toString('base64'), data.typeArgs, data.args - ); + ) } public toProto(): MsgGovScriptJSON.Proto { - const { authority, sender, code_bytes, type_args, args } = this; + const { authority, sender, code_bytes, type_args, args } = this return MsgGovScriptJSON_pb.fromPartial({ authority, sender, codeBytes: Buffer.from(code_bytes, 'base64'), typeArgs: type_args, args, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgGovScriptJSON', value: MsgGovScriptJSON_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgGovScriptJSON { - return MsgGovScriptJSON.fromProto(MsgGovScriptJSON_pb.decode(msgAny.value)); + return MsgGovScriptJSON.fromProto(MsgGovScriptJSON_pb.decode(msgAny.value)) } } export namespace MsgGovScriptJSON { export interface Amino { - type: 'move/MsgGovScriptJSON'; + type: 'move/MsgGovScriptJSON' value: { - authority: AccAddress; - sender: AccAddress; - code_bytes: string; - type_args?: string[]; - args?: string[]; - }; + authority: AccAddress + sender: AccAddress + code_bytes: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgGovScriptJSON'; - authority: AccAddress; - sender: AccAddress; - code_bytes: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgGovScriptJSON' + authority: AccAddress + sender: AccAddress + code_bytes: string + type_args: string[] + args: string[] } - export type Proto = MsgGovScriptJSON_pb; + export type Proto = MsgGovScriptJSON_pb } diff --git a/src/core/move/msgs/MsgPublish.ts b/src/core/move/msgs/MsgPublish.ts index 631d9cf..1cd6f55 100644 --- a/src/core/move/msgs/MsgPublish.ts +++ b/src/core/move/msgs/MsgPublish.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgPublish as MsgPublish_pb } from '@initia/initia.proto/initia/move/v1/tx'; -import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgPublish as MsgPublish_pb } from '@initia/initia.proto/initia/move/v1/tx' +import { UpgradePolicy } from '@initia/initia.proto/initia/move/v1/types' export class MsgPublish extends JSONSerializable< MsgPublish.Amino, @@ -19,95 +19,98 @@ export class MsgPublish extends JSONSerializable< public code_bytes: string[], public upgrade_policy: MsgPublish.Policy ) { - super(); + super() } public static fromAmino(data: MsgPublish.Amino): MsgPublish { const { value: { sender, code_bytes, upgrade_policy }, - } = data; + } = data return new MsgPublish( sender, code_bytes, upgrade_policy ? upgrade_policy : 0 - ); + ) } public toAmino(): MsgPublish.Amino { - const { sender, code_bytes, upgrade_policy } = this; + const { sender, code_bytes, upgrade_policy } = this return { type: 'move/MsgPublish', value: { sender, code_bytes, - upgrade_policy: upgrade_policy === 0 ? undefined : upgrade_policy, + upgrade_policy: + upgrade_policy === UpgradePolicy.UNSPECIFIED + ? undefined + : upgrade_policy, }, - }; + } } public static fromProto(proto: MsgPublish.Proto): MsgPublish { return new MsgPublish( proto.sender, - proto.codeBytes.map(code => Buffer.from(code).toString('base64')), + proto.codeBytes.map((code) => Buffer.from(code).toString('base64')), proto.upgradePolicy - ); + ) } public toProto(): MsgPublish.Proto { - const { sender, code_bytes, upgrade_policy } = this; + const { sender, code_bytes, upgrade_policy } = this return MsgPublish_pb.fromPartial({ sender, - codeBytes: code_bytes.map(code => Buffer.from(code, 'base64')), + codeBytes: code_bytes.map((code) => Buffer.from(code, 'base64')), upgradePolicy: upgrade_policy, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgPublish', value: MsgPublish_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgPublish { - return MsgPublish.fromProto(MsgPublish_pb.decode(msgAny.value)); + return MsgPublish.fromProto(MsgPublish_pb.decode(msgAny.value)) } public static fromData(data: MsgPublish.Data): MsgPublish { - const { sender, code_bytes, upgrade_policy } = data; - return new MsgPublish(sender, code_bytes, upgrade_policy); + const { sender, code_bytes, upgrade_policy } = data + return new MsgPublish(sender, code_bytes, upgrade_policy) } public toData(): MsgPublish.Data { - const { sender, code_bytes, upgrade_policy } = this; + const { sender, code_bytes, upgrade_policy } = this return { '@type': '/initia.move.v1.MsgPublish', sender, code_bytes, upgrade_policy, - }; + } } } export namespace MsgPublish { - export type Policy = UpgradePolicy; - export const Policy = UpgradePolicy; + export type Policy = UpgradePolicy + export const Policy = UpgradePolicy export interface Amino { - type: 'move/MsgPublish'; + type: 'move/MsgPublish' value: { - sender: AccAddress; - code_bytes: string[]; - upgrade_policy?: UpgradePolicy; - }; + sender: AccAddress + code_bytes: string[] + upgrade_policy?: UpgradePolicy + } } export interface Data { - '@type': '/initia.move.v1.MsgPublish'; - sender: AccAddress; - code_bytes: string[]; - upgrade_policy: UpgradePolicy; + '@type': '/initia.move.v1.MsgPublish' + sender: AccAddress + code_bytes: string[] + upgrade_policy: UpgradePolicy } - export type Proto = MsgPublish_pb; + export type Proto = MsgPublish_pb } diff --git a/src/core/move/msgs/MsgScript.ts b/src/core/move/msgs/MsgScript.ts index 3d4cf53..c17ac59 100644 --- a/src/core/move/msgs/MsgScript.ts +++ b/src/core/move/msgs/MsgScript.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgScript as MsgScript_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgScript as MsgScript_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgScript extends JSONSerializable< MsgScript.Amino, MsgScript.Data, MsgScript.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param sender the actor that signed the messages @@ -23,20 +23,20 @@ export class MsgScript extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgScript.Amino): MsgScript { const { value: { sender, code_bytes, type_args, args }, - } = data; - return new MsgScript(sender, code_bytes, type_args ?? [], args ?? []); + } = data + return new MsgScript(sender, code_bytes, type_args ?? [], args ?? []) } public toAmino(): MsgScript.Amino { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return { type: 'move/MsgScript', @@ -46,7 +46,7 @@ export class MsgScript extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromProto(data: MsgScript.Proto): MsgScript { @@ -54,66 +54,66 @@ export class MsgScript extends JSONSerializable< data.sender, Buffer.from(data.codeBytes).toString('base64'), data.typeArgs, - data.args.map(arg => Buffer.from(arg).toString('base64')) - ); + data.args.map((arg) => Buffer.from(arg).toString('base64')) + ) } public toProto(): MsgScript.Proto { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return MsgScript_pb.fromPartial({ sender, codeBytes: Buffer.from(code_bytes, 'base64'), typeArgs: type_args, - args: args.map(arg => Buffer.from(arg, 'base64')), - }); + args: args.map((arg) => Buffer.from(arg, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgScript', value: MsgScript_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgScript { - return MsgScript.fromProto(MsgScript_pb.decode(msgAny.value)); + return MsgScript.fromProto(MsgScript_pb.decode(msgAny.value)) } public static fromData(data: MsgScript.Data): MsgScript { - const { sender, code_bytes, type_args, args } = data; - return new MsgScript(sender, code_bytes, type_args, args); + const { sender, code_bytes, type_args, args } = data + return new MsgScript(sender, code_bytes, type_args, args) } public toData(): MsgScript.Data { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return { '@type': '/initia.move.v1.MsgScript', sender, code_bytes, type_args, args, - }; + } } } export namespace MsgScript { export interface Amino { - type: 'move/MsgScript'; + type: 'move/MsgScript' value: { - sender: AccAddress; - code_bytes: string; - type_args?: string[]; - args?: string[]; - }; + sender: AccAddress + code_bytes: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgScript'; - sender: AccAddress; - code_bytes: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgScript' + sender: AccAddress + code_bytes: string + type_args: string[] + args: string[] } - export type Proto = MsgScript_pb; + export type Proto = MsgScript_pb } diff --git a/src/core/move/msgs/MsgScriptJSON.ts b/src/core/move/msgs/MsgScriptJSON.ts index 803a45a..614447a 100644 --- a/src/core/move/msgs/MsgScriptJSON.ts +++ b/src/core/move/msgs/MsgScriptJSON.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgScriptJSON as MsgScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgScriptJSON as MsgScriptJSON_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgScriptJSON extends JSONSerializable< MsgScriptJSON.Amino, MsgScriptJSON.Data, MsgScriptJSON.Proto > { - public type_args: string[]; - public args: string[]; + public type_args: string[] + public args: string[] /** * @param sender the actor that signed the messages @@ -23,20 +23,20 @@ export class MsgScriptJSON extends JSONSerializable< type_args: string[] = [], args: string[] = [] ) { - super(); - this.type_args = type_args; - this.args = args; + super() + this.type_args = type_args + this.args = args } public static fromAmino(data: MsgScriptJSON.Amino): MsgScriptJSON { const { value: { sender, code_bytes, type_args, args }, - } = data; - return new MsgScriptJSON(sender, code_bytes, type_args ?? [], args ?? []); + } = data + return new MsgScriptJSON(sender, code_bytes, type_args ?? [], args ?? []) } public toAmino(): MsgScriptJSON.Amino { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return { type: 'move/MsgScriptJSON', @@ -46,23 +46,23 @@ export class MsgScriptJSON extends JSONSerializable< type_args: type_args.length === 0 ? undefined : type_args, args: args.length === 0 ? undefined : args, }, - }; + } } public static fromData(data: MsgScriptJSON.Data): MsgScriptJSON { - const { sender, code_bytes, type_args, args } = data; - return new MsgScriptJSON(sender, code_bytes, type_args, args); + const { sender, code_bytes, type_args, args } = data + return new MsgScriptJSON(sender, code_bytes, type_args, args) } public toData(): MsgScriptJSON.Data { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return { '@type': '/initia.move.v1.MsgScriptJSON', sender, code_bytes, type_args, args, - }; + } } public static fromProto(data: MsgScriptJSON.Proto): MsgScriptJSON { @@ -71,49 +71,49 @@ export class MsgScriptJSON extends JSONSerializable< Buffer.from(data.codeBytes).toString('base64'), data.typeArgs, data.args - ); + ) } public toProto(): MsgScriptJSON.Proto { - const { sender, code_bytes, type_args, args } = this; + const { sender, code_bytes, type_args, args } = this return MsgScriptJSON_pb.fromPartial({ sender, codeBytes: Buffer.from(code_bytes, 'base64'), typeArgs: type_args, args, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgScriptJSON', value: MsgScriptJSON_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgScriptJSON { - return MsgScriptJSON.fromProto(MsgScriptJSON_pb.decode(msgAny.value)); + return MsgScriptJSON.fromProto(MsgScriptJSON_pb.decode(msgAny.value)) } } export namespace MsgScriptJSON { export interface Amino { - type: 'move/MsgScriptJSON'; + type: 'move/MsgScriptJSON' value: { - sender: AccAddress; - code_bytes: string; - type_args?: string[]; - args?: string[]; - }; + sender: AccAddress + code_bytes: string + type_args?: string[] + args?: string[] + } } export interface Data { - '@type': '/initia.move.v1.MsgScriptJSON'; - sender: AccAddress; - code_bytes: string; - type_args: string[]; - args: string[]; + '@type': '/initia.move.v1.MsgScriptJSON' + sender: AccAddress + code_bytes: string + type_args: string[] + args: string[] } - export type Proto = MsgScriptJSON_pb; + export type Proto = MsgScriptJSON_pb } diff --git a/src/core/move/msgs/MsgUpdateMoveParams.ts b/src/core/move/msgs/MsgUpdateMoveParams.ts index c18a71d..c387a89 100644 --- a/src/core/move/msgs/MsgUpdateMoveParams.ts +++ b/src/core/move/msgs/MsgUpdateMoveParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MoveParams } from '../MoveParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MoveParams } from '../MoveParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgUpdateMoveParams extends JSONSerializable< MsgUpdateMoveParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateMoveParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/move parameters to update */ - constructor(public authority: AccAddress, public params: MoveParams) { - super(); + constructor( + public authority: AccAddress, + public params: MoveParams + ) { + super() } public static fromAmino( @@ -22,33 +25,33 @@ export class MsgUpdateMoveParams extends JSONSerializable< ): MsgUpdateMoveParams { const { value: { authority, params }, - } = data; - return new MsgUpdateMoveParams(authority, MoveParams.fromAmino(params)); + } = data + return new MsgUpdateMoveParams(authority, MoveParams.fromAmino(params)) } public toAmino(): MsgUpdateMoveParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'move/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateMoveParams.Data): MsgUpdateMoveParams { - const { authority, params } = data; - return new MsgUpdateMoveParams(authority, MoveParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateMoveParams(authority, MoveParams.fromData(params)) } public toData(): MsgUpdateMoveParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.move.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -57,45 +60,45 @@ export class MsgUpdateMoveParams extends JSONSerializable< return new MsgUpdateMoveParams( data.authority, MoveParams.fromProto(data.params as MoveParams.Proto) - ); + ) } public toProto(): MsgUpdateMoveParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateMoveParams { return MsgUpdateMoveParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateMoveParams { export interface Amino { - type: 'move/MsgUpdateParams'; + type: 'move/MsgUpdateParams' value: { - authority: AccAddress; - params: MoveParams.Amino; - }; + authority: AccAddress + params: MoveParams.Amino + } } export interface Data { - '@type': '/initia.move.v1.MsgUpdateParams'; - authority: AccAddress; - params: MoveParams.Data; + '@type': '/initia.move.v1.MsgUpdateParams' + authority: AccAddress + params: MoveParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/move/msgs/MsgWhitelist.ts b/src/core/move/msgs/MsgWhitelist.ts index 5938478..8ffdf6f 100644 --- a/src/core/move/msgs/MsgWhitelist.ts +++ b/src/core/move/msgs/MsgWhitelist.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgWhitelist as MsgWhitelist_pb } from '@initia/initia.proto/initia/move/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgWhitelist as MsgWhitelist_pb } from '@initia/initia.proto/initia/move/v1/tx' export class MsgWhitelist extends JSONSerializable< MsgWhitelist.Amino, @@ -18,19 +18,19 @@ export class MsgWhitelist extends JSONSerializable< public metadata_lp: string, public reward_weight: string ) { - super(); + super() } public static fromAmino(data: MsgWhitelist.Amino): MsgWhitelist { const { value: { authority, metadata_lp, reward_weight }, - } = data; + } = data - return new MsgWhitelist(authority, metadata_lp, reward_weight); + return new MsgWhitelist(authority, metadata_lp, reward_weight) } public toAmino(): MsgWhitelist.Amino { - const { authority, metadata_lp, reward_weight } = this; + const { authority, metadata_lp, reward_weight } = this return { type: 'move/MsgWhitelist', @@ -39,68 +39,68 @@ export class MsgWhitelist extends JSONSerializable< metadata_lp, reward_weight, }, - }; + } } public static fromData(data: MsgWhitelist.Data): MsgWhitelist { - const { authority, metadata_lp, reward_weight } = data; + const { authority, metadata_lp, reward_weight } = data - return new MsgWhitelist(authority, metadata_lp, reward_weight); + return new MsgWhitelist(authority, metadata_lp, reward_weight) } public toData(): MsgWhitelist.Data { - const { authority, metadata_lp, reward_weight } = this; + const { authority, metadata_lp, reward_weight } = this return { '@type': '/initia.move.v1.MsgWhitelist', authority, metadata_lp, reward_weight, - }; + } } public static fromProto(data: MsgWhitelist.Proto): MsgWhitelist { - return new MsgWhitelist(data.authority, data.metadataLp, data.rewardWeight); + return new MsgWhitelist(data.authority, data.metadataLp, data.rewardWeight) } public toProto(): MsgWhitelist.Proto { - const { authority, metadata_lp, reward_weight } = this; + const { authority, metadata_lp, reward_weight } = this return MsgWhitelist_pb.fromPartial({ authority, metadataLp: metadata_lp, rewardWeight: reward_weight, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.move.v1.MsgWhitelist', value: MsgWhitelist_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgWhitelist { - return MsgWhitelist.fromProto(MsgWhitelist_pb.decode(msgAny.value)); + return MsgWhitelist.fromProto(MsgWhitelist_pb.decode(msgAny.value)) } } export namespace MsgWhitelist { export interface Amino { - type: 'move/MsgWhitelist'; + type: 'move/MsgWhitelist' value: { - authority: AccAddress; - metadata_lp: string; - reward_weight: string; - }; + authority: AccAddress + metadata_lp: string + reward_weight: string + } } export interface Data { - '@type': '/initia.move.v1.MsgWhitelist'; - authority: AccAddress; - metadata_lp: string; - reward_weight: string; + '@type': '/initia.move.v1.MsgWhitelist' + authority: AccAddress + metadata_lp: string + reward_weight: string } - export type Proto = MsgWhitelist_pb; + export type Proto = MsgWhitelist_pb } diff --git a/src/core/move/msgs/index.ts b/src/core/move/msgs/index.ts index 4065863..f4b03d3 100644 --- a/src/core/move/msgs/index.ts +++ b/src/core/move/msgs/index.ts @@ -1,30 +1,30 @@ -import { MsgPublish } from './MsgPublish'; -import { MsgExecute } from './MsgExecute'; -import { MsgExecuteJSON } from './MsgExecuteJSON'; -import { MsgScript } from './MsgScript'; -import { MsgScriptJSON } from './MsgScriptJSON'; -import { MsgUpdateMoveParams } from './MsgUpdateMoveParams'; -import { MsgWhitelist } from './MsgWhitelist'; -import { MsgDelist } from './MsgDelist'; -import { MsgGovExecute } from './MsgGovExecute'; -import { MsgGovExecuteJSON } from './MsgGovExecuteJSON'; -import { MsgGovPublish } from './MsgGovPublish'; -import { MsgGovScript } from './MsgGovScript'; -import { MsgGovScriptJSON } from './MsgGovScriptJSON'; +import { MsgPublish } from './MsgPublish' +import { MsgExecute } from './MsgExecute' +import { MsgExecuteJSON } from './MsgExecuteJSON' +import { MsgScript } from './MsgScript' +import { MsgScriptJSON } from './MsgScriptJSON' +import { MsgUpdateMoveParams } from './MsgUpdateMoveParams' +import { MsgWhitelist } from './MsgWhitelist' +import { MsgDelist } from './MsgDelist' +import { MsgGovExecute } from './MsgGovExecute' +import { MsgGovExecuteJSON } from './MsgGovExecuteJSON' +import { MsgGovPublish } from './MsgGovPublish' +import { MsgGovScript } from './MsgGovScript' +import { MsgGovScriptJSON } from './MsgGovScriptJSON' -export * from './MsgPublish'; -export * from './MsgExecute'; -export * from './MsgExecuteJSON'; -export * from './MsgScript'; -export * from './MsgScriptJSON'; -export * from './MsgUpdateMoveParams'; -export * from './MsgWhitelist'; -export * from './MsgDelist'; -export * from './MsgGovExecute'; -export * from './MsgGovExecuteJSON'; -export * from './MsgGovPublish'; -export * from './MsgGovScript'; -export * from './MsgGovScriptJSON'; +export * from './MsgPublish' +export * from './MsgExecute' +export * from './MsgExecuteJSON' +export * from './MsgScript' +export * from './MsgScriptJSON' +export * from './MsgUpdateMoveParams' +export * from './MsgWhitelist' +export * from './MsgDelist' +export * from './MsgGovExecute' +export * from './MsgGovExecuteJSON' +export * from './MsgGovPublish' +export * from './MsgGovScript' +export * from './MsgGovScriptJSON' export type MoveMsg = | MsgPublish @@ -39,7 +39,7 @@ export type MoveMsg = | MsgGovExecuteJSON | MsgGovPublish | MsgGovScript - | MsgGovScriptJSON; + | MsgGovScriptJSON export namespace MoveMsg { export type Amino = @@ -55,7 +55,7 @@ export namespace MoveMsg { | MsgGovExecuteJSON.Amino | MsgGovPublish.Amino | MsgGovScript.Amino - | MsgGovScriptJSON.Amino; + | MsgGovScriptJSON.Amino export type Data = | MsgPublish.Data @@ -70,7 +70,7 @@ export namespace MoveMsg { | MsgGovExecuteJSON.Data | MsgGovPublish.Data | MsgGovScript.Data - | MsgGovScriptJSON.Data; + | MsgGovScriptJSON.Data export type Proto = | MsgPublish.Proto @@ -85,5 +85,5 @@ export namespace MoveMsg { | MsgGovExecuteJSON.Proto | MsgGovPublish.Proto | MsgGovScript.Proto - | MsgGovScriptJSON.Proto; + | MsgGovScriptJSON.Proto } diff --git a/src/core/mstaking/Delegation.spec.ts b/src/core/mstaking/Delegation.spec.ts index c0f61ec..f1f42a5 100644 --- a/src/core/mstaking/Delegation.spec.ts +++ b/src/core/mstaking/Delegation.spec.ts @@ -1,11 +1,11 @@ -const delgsAmino = require('./Delegation.data.json'); -import { Delegation } from './Delegation'; +const delgsAmino = require('./Delegation.data.json') +import { Delegation } from './Delegation' describe('Delegation', () => { it('deserializes', () => { delgsAmino.forEach((delgExample: Delegation.Amino) => { - const delg = Delegation.fromAmino(delgExample); - expect(delg.toAmino()).toMatchObject(delgExample); - }); - }); -}); + const delg = Delegation.fromAmino(delgExample) + expect(delg.toAmino()).toMatchObject(delgExample) + }) + }) +}) diff --git a/src/core/mstaking/Delegation.ts b/src/core/mstaking/Delegation.ts index 8d5082f..15afb83 100644 --- a/src/core/mstaking/Delegation.ts +++ b/src/core/mstaking/Delegation.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress, ValAddress } from '../bech32'; -import { Coins } from '../Coins'; +import { JSONSerializable } from '../../util/json' +import { AccAddress, ValAddress } from '../bech32' +import { Coins } from '../Coins' import { DelegationResponse as DelegationResponse_pb, Delegation as Delegation_pb, -} from '@initia/initia.proto/initia/mstaking/v1/staking'; +} from '@initia/initia.proto/initia/mstaking/v1/staking' /** * Stores information about the status of a delegation between a delegator and validator, fetched from the blockchain. @@ -14,8 +14,8 @@ export class Delegation extends JSONSerializable< Delegation.Data, Delegation.Proto > { - public shares: Coins; - public balance: Coins; + public shares: Coins + public balance: Coins /** * @param delegator_address delegator's account address @@ -29,26 +29,26 @@ export class Delegation extends JSONSerializable< shares: Coins.Input, balance: Coins.Input ) { - super(); - this.shares = new Coins(shares); - this.balance = new Coins(balance); + super() + this.shares = new Coins(shares) + this.balance = new Coins(balance) } public static fromAmino(data: Delegation.Amino): Delegation { const { delegation: { delegator_address, validator_address, shares }, balance, - } = data; + } = data return new Delegation( delegator_address, validator_address, Coins.fromAmino(shares), Coins.fromAmino(balance) - ); + ) } public toAmino(): Delegation.Amino { - const { delegator_address, validator_address, shares, balance } = this; + const { delegator_address, validator_address, shares, balance } = this return { delegation: { @@ -57,24 +57,24 @@ export class Delegation extends JSONSerializable< shares: shares.toAmino(), }, balance: balance.toAmino(), - }; + } } public static fromData(data: Delegation.Data): Delegation { const { delegation: { delegator_address, validator_address, shares }, balance, - } = data; + } = data return new Delegation( delegator_address, validator_address, Coins.fromData(shares), Coins.fromData(balance) - ); + ) } public toData(): Delegation.Data { - const { delegator_address, validator_address, shares, balance } = this; + const { delegator_address, validator_address, shares, balance } = this return { delegation: { @@ -83,21 +83,21 @@ export class Delegation extends JSONSerializable< shares: shares.toData(), }, balance: balance.toData(), - }; + } } public static fromProto(proto: Delegation.Proto): Delegation { - const delegationProto = proto.delegation as Delegation_pb; + const delegationProto = proto.delegation as Delegation_pb return new Delegation( delegationProto.delegatorAddress, delegationProto.validatorAddress, Coins.fromProto(delegationProto.shares), Coins.fromProto(proto.balance as Coins.Proto) - ); + ) } public toProto(): Delegation.Proto { - const { delegator_address, validator_address, shares, balance } = this; + const { delegator_address, validator_address, shares, balance } = this return DelegationResponse_pb.fromPartial({ delegation: Delegation_pb.fromPartial({ delegatorAddress: delegator_address, @@ -105,28 +105,28 @@ export class Delegation extends JSONSerializable< shares: shares.toProto(), }), balance: balance.toProto(), - }); + }) } } export namespace Delegation { export interface Amino { delegation: { - delegator_address: AccAddress; - validator_address: ValAddress; - shares: Coins.Amino; - }; - balance: Coins.Amino; + delegator_address: AccAddress + validator_address: ValAddress + shares: Coins.Amino + } + balance: Coins.Amino } export interface Data { delegation: { - delegator_address: AccAddress; - validator_address: ValAddress; - shares: Coins.Data; - }; - balance: Coins.Data; + delegator_address: AccAddress + validator_address: ValAddress + shares: Coins.Data + } + balance: Coins.Data } - export type Proto = DelegationResponse_pb; + export type Proto = DelegationResponse_pb } diff --git a/src/core/mstaking/MstakingParams.ts b/src/core/mstaking/MstakingParams.ts index 769e836..28d4ce5 100644 --- a/src/core/mstaking/MstakingParams.ts +++ b/src/core/mstaking/MstakingParams.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { Duration } from '../Duration'; -import { Params as Params_pb } from '@initia/initia.proto/initia/mstaking/v1/staking'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Duration } from '../Duration' +import { Params as Params_pb } from '@initia/initia.proto/initia/mstaking/v1/staking' +import Long from 'long' export class MstakingParams extends JSONSerializable< MstakingParams.Amino, @@ -26,7 +26,7 @@ export class MstakingParams extends JSONSerializable< public min_voting_power: number, public min_commission_rate: string ) { - super(); + super() } public static fromAmino(data: MstakingParams.Amino): MstakingParams { @@ -40,7 +40,7 @@ export class MstakingParams extends JSONSerializable< min_voting_power, min_commission_rate, }, - } = data; + } = data return new MstakingParams( Duration.fromAmino(unbonding_time), max_validators, @@ -49,7 +49,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, Number.parseInt(min_voting_power), min_commission_rate - ); + ) } public toAmino(): MstakingParams.Amino { @@ -61,7 +61,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, min_voting_power, min_commission_rate, - } = this; + } = this return { type: 'mstaking/Params', value: { @@ -73,7 +73,7 @@ export class MstakingParams extends JSONSerializable< min_voting_power: min_voting_power.toString(), min_commission_rate, }, - }; + } } public static fromData(data: MstakingParams.Data): MstakingParams { @@ -85,7 +85,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, min_voting_power, min_commission_rate, - } = data; + } = data return new MstakingParams( Duration.fromData(unbonding_time), max_validators, @@ -94,7 +94,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, Number.parseInt(min_voting_power), min_commission_rate - ); + ) } public toData(): MstakingParams.Data { @@ -106,7 +106,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, min_voting_power, min_commission_rate, - } = this; + } = this return { '@type': '/initia.mstaking.v1.Params', unbonding_time: unbonding_time.toData(), @@ -116,7 +116,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, min_voting_power: min_voting_power.toString(), min_commission_rate, - }; + } } public static fromProto(data: MstakingParams.Proto): MstakingParams { @@ -128,7 +128,7 @@ export class MstakingParams extends JSONSerializable< data.bondDenoms, data.minVotingPower.toNumber(), data.minCommissionRate - ); + ) } public toProto(): MstakingParams.Proto { @@ -140,7 +140,7 @@ export class MstakingParams extends JSONSerializable< bond_denoms, min_voting_power, min_commission_rate, - } = this; + } = this return Params_pb.fromPartial({ unbondingTime: unbonding_time.toProto(), maxValidators: max_validators, @@ -149,34 +149,34 @@ export class MstakingParams extends JSONSerializable< bondDenoms: bond_denoms, minVotingPower: Long.fromNumber(min_voting_power), minCommissionRate: min_commission_rate, - }); + }) } } export namespace MstakingParams { export interface Amino { - type: 'mstaking/Params'; + type: 'mstaking/Params' value: { - unbonding_time: Duration.Amino; - max_validators: number; - max_entries: number; - historical_entries: number; - bond_denoms: string[]; - min_voting_power: string; - min_commission_rate: string; - }; + unbonding_time: Duration.Amino + max_validators: number + max_entries: number + historical_entries: number + bond_denoms: string[] + min_voting_power: string + min_commission_rate: string + } } export interface Data { - '@type': '/initia.mstaking.v1.Params'; - unbonding_time: Duration.Data; - max_validators: number; - max_entries: number; - historical_entries: number; - bond_denoms: string[]; - min_voting_power: string; - min_commission_rate: string; + '@type': '/initia.mstaking.v1.Params' + unbonding_time: Duration.Data + max_validators: number + max_entries: number + historical_entries: number + bond_denoms: string[] + min_voting_power: string + min_commission_rate: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/mstaking/Redelegation.ts b/src/core/mstaking/Redelegation.ts index 002a62c..974bd2f 100644 --- a/src/core/mstaking/Redelegation.ts +++ b/src/core/mstaking/Redelegation.ts @@ -1,13 +1,13 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { AccAddress, ValAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { AccAddress, ValAddress } from '../bech32' import { RedelegationResponse as RedelegationResponse_pb, Redelegation as Redelegation_pb, RedelegationEntry as RedelegationEntry_pb, RedelegationEntryResponse as RedelegationEntryResponse_pb, -} from '@initia/initia.proto/initia/mstaking/v1/staking'; -import Long from 'long'; +} from '@initia/initia.proto/initia/mstaking/v1/staking' +import Long from 'long' /** * A redelegation is when a delegator decides to stop mstaking with one validator and @@ -39,7 +39,7 @@ export class Redelegation extends JSONSerializable< public validator_dst_address: ValAddress, public entries: Redelegation.Entry[] ) { - super(); + super() } public static fromAmino(data: Redelegation.Amino): Redelegation { @@ -50,13 +50,13 @@ export class Redelegation extends JSONSerializable< validator_dst_address, }, entries, - } = data; + } = data return new Redelegation( delegator_address, validator_src_address, validator_dst_address, - entries.map(e => Redelegation.Entry.fromAmino(e)) - ); + entries.map((e) => Redelegation.Entry.fromAmino(e)) + ) } public toAmino(): Redelegation.Amino { @@ -65,15 +65,15 @@ export class Redelegation extends JSONSerializable< validator_src_address, validator_dst_address, entries, - } = this; + } = this return { redelegation: { delegator_address, validator_src_address, validator_dst_address, }, - entries: entries.map(e => e.toAmino()), - }; + entries: entries.map((e) => e.toAmino()), + } } public static fromData(data: Redelegation.Data): Redelegation { @@ -84,13 +84,13 @@ export class Redelegation extends JSONSerializable< validator_dst_address, }, entries, - } = data; + } = data return new Redelegation( delegator_address, validator_src_address, validator_dst_address, - entries.map(e => Redelegation.Entry.fromData(e)) - ); + entries.map((e) => Redelegation.Entry.fromData(e)) + ) } public toData(): Redelegation.Data { @@ -99,25 +99,25 @@ export class Redelegation extends JSONSerializable< validator_src_address, validator_dst_address, entries, - } = this; + } = this return { redelegation: { delegator_address, validator_src_address, validator_dst_address, }, - entries: entries.map(e => e.toData()), - }; + entries: entries.map((e) => e.toData()), + } } public static fromProto(data: Redelegation.Proto): Redelegation { - const redelegationProto = data.redelegation as Redelegation_pb; + const redelegationProto = data.redelegation as Redelegation_pb return new Redelegation( redelegationProto.delegatorAddress, redelegationProto.validatorDstAddress, redelegationProto.validatorDstAddress, - data.entries.map(e => Redelegation.Entry.fromProto(e)) - ); + data.entries.map((e) => Redelegation.Entry.fromProto(e)) + ) } public toProto(): Redelegation.Proto { @@ -126,51 +126,51 @@ export class Redelegation extends JSONSerializable< validator_src_address, validator_dst_address, entries, - } = this; + } = this return RedelegationResponse_pb.fromPartial({ - entries: entries.map(e => e.toProto()), + entries: entries.map((e) => e.toProto()), redelegation: Redelegation_pb.fromPartial({ delegatorAddress: delegator_address, entries: entries.map( - e => e.toProto().redelegationEntry as RedelegationEntry_pb + (e) => e.toProto().redelegationEntry as RedelegationEntry_pb ), validatorDstAddress: validator_dst_address, validatorSrcAddress: validator_src_address, }), - }); + }) } } export namespace Redelegation { export interface Amino { redelegation: { - delegator_address: AccAddress; - validator_src_address: ValAddress; - validator_dst_address: ValAddress; - }; - entries: Redelegation.Entry.Amino[]; + delegator_address: AccAddress + validator_src_address: ValAddress + validator_dst_address: ValAddress + } + entries: Redelegation.Entry.Amino[] } export interface Data { redelegation: { - delegator_address: AccAddress; - validator_src_address: ValAddress; - validator_dst_address: ValAddress; - }; - entries: Redelegation.Entry.Data[]; + delegator_address: AccAddress + validator_src_address: ValAddress + validator_dst_address: ValAddress + } + entries: Redelegation.Entry.Data[] } - export type Proto = RedelegationResponse_pb; + export type Proto = RedelegationResponse_pb export class Entry extends JSONSerializable< Entry.Amino, Entry.Data, Entry.Proto > { - public initial_balance: Coins; - public shares_dst: Coins; - public balance: Coins; + public initial_balance: Coins + public shares_dst: Coins + public balance: Coins /** * @@ -186,10 +186,10 @@ export namespace Redelegation { public creation_height: number, public completion_time: Date ) { - super(); - this.initial_balance = new Coins(initial_balance); - this.balance = new Coins(balance); - this.shares_dst = new Coins(shares_dst); + super() + this.initial_balance = new Coins(initial_balance) + this.balance = new Coins(balance) + this.shares_dst = new Coins(shares_dst) } public toAmino(): Entry.Amino { @@ -201,7 +201,7 @@ export namespace Redelegation { completion_time: this.completion_time.toISOString(), }, balance: this.balance.toAmino(), - }; + } } public static fromAmino(data: Entry.Amino): Entry { @@ -213,14 +213,14 @@ export namespace Redelegation { completion_time, }, balance, - } = data; + } = data return new Entry( Coins.fromAmino(initial_balance), Coins.fromAmino(balance), Coins.fromAmino(shares_dst), creation_height, new Date(completion_time) - ); + ) } public toData(): Entry.Data { @@ -232,7 +232,7 @@ export namespace Redelegation { completion_time: this.completion_time.toISOString(), }, balance: this.balance.toData(), - }; + } } public static fromData(data: Entry.Data): Entry { @@ -244,14 +244,14 @@ export namespace Redelegation { completion_time, }, balance, - } = data; + } = data return new Entry( Coins.fromData(initial_balance), Coins.fromData(balance), Coins.fromData(shares_dst), creation_height, new Date(completion_time) - ); + ) } public toProto(): Entry.Proto { @@ -261,7 +261,7 @@ export namespace Redelegation { shares_dst, creation_height, completion_time, - } = this; + } = this return RedelegationEntryResponse_pb.fromPartial({ balance: balance.toProto(), @@ -271,12 +271,12 @@ export namespace Redelegation { initialBalance: initial_balance.toProto(), sharesDst: shares_dst.toProto(), }), - }); + }) } public static fromProto(proto: Entry.Proto): Entry { const redelegationEntryProto = - proto.redelegationEntry as RedelegationEntry_pb; + proto.redelegationEntry as RedelegationEntry_pb return new Entry( Coins.fromProto(redelegationEntryProto.initialBalance), @@ -284,31 +284,31 @@ export namespace Redelegation { Coins.fromProto(redelegationEntryProto.sharesDst), redelegationEntryProto.creationHeight.toNumber(), redelegationEntryProto.completionTime as Date - ); + ) } } export namespace Entry { export interface Amino { redelegation_entry: { - creation_height: number; - completion_time: string; - initial_balance: Coins.Amino; - shares_dst: Coins.Amino; - }; - balance: Coins.Amino; + creation_height: number + completion_time: string + initial_balance: Coins.Amino + shares_dst: Coins.Amino + } + balance: Coins.Amino } export interface Data { redelegation_entry: { - creation_height: number; - completion_time: string; - initial_balance: Coins.Data; - shares_dst: Coins.Data; - }; - balance: Coins.Data; + creation_height: number + completion_time: string + initial_balance: Coins.Data + shares_dst: Coins.Data + } + balance: Coins.Data } - export type Proto = RedelegationEntryResponse_pb; + export type Proto = RedelegationEntryResponse_pb } } diff --git a/src/core/mstaking/UnbondingDelegation.ts b/src/core/mstaking/UnbondingDelegation.ts index d1e1b60..362d5e2 100644 --- a/src/core/mstaking/UnbondingDelegation.ts +++ b/src/core/mstaking/UnbondingDelegation.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { AccAddress, ValAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { AccAddress, ValAddress } from '../bech32' import { UnbondingDelegation as UnbondingDelegation_pb, UnbondingDelegationEntry as UnbondingDelegationEntry_pb, -} from '@initia/initia.proto/initia/mstaking/v1/staking'; -import Long from 'long'; +} from '@initia/initia.proto/initia/mstaking/v1/staking' +import Long from 'long' /** * When a delegator decides to take out their funds from the mstaking pool, they must @@ -28,54 +28,54 @@ export class UnbondingDelegation extends JSONSerializable< public validator_address: ValAddress, public entries: UnbondingDelegation.Entry[] ) { - super(); + super() } public static fromAmino( data: UnbondingDelegation.Amino ): UnbondingDelegation { - const { delegator_address, validator_address, entries } = data; + const { delegator_address, validator_address, entries } = data return new UnbondingDelegation( delegator_address, validator_address, - entries.map(e => UnbondingDelegation.Entry.fromAmino(e)) - ); + entries.map((e) => UnbondingDelegation.Entry.fromAmino(e)) + ) } public toAmino(): UnbondingDelegation.Amino { - const { delegator_address, validator_address, entries } = this; + const { delegator_address, validator_address, entries } = this return { delegator_address, validator_address, - entries: entries.map(e => e.toAmino()), - }; + entries: entries.map((e) => e.toAmino()), + } } public static fromData(data: UnbondingDelegation.Data): UnbondingDelegation { - const { delegator_address, validator_address, entries } = data; + const { delegator_address, validator_address, entries } = data return new UnbondingDelegation( delegator_address, validator_address, - entries.map(e => UnbondingDelegation.Entry.fromData(e)) - ); + entries.map((e) => UnbondingDelegation.Entry.fromData(e)) + ) } public toData(): UnbondingDelegation.Data { - const { delegator_address, validator_address, entries } = this; + const { delegator_address, validator_address, entries } = this return { delegator_address, validator_address, - entries: entries.map(e => e.toData()), - }; + entries: entries.map((e) => e.toData()), + } } public toProto(): UnbondingDelegation.Proto { - const { delegator_address, validator_address, entries } = this; + const { delegator_address, validator_address, entries } = this return UnbondingDelegation_pb.fromPartial({ delegatorAddress: delegator_address, - entries: entries.map(e => e.toProto()), + entries: entries.map((e) => e.toProto()), validatorAddress: validator_address, - }); + }) } public static fromProto( @@ -84,33 +84,33 @@ export class UnbondingDelegation extends JSONSerializable< return new UnbondingDelegation( proto.delegatorAddress, proto.validatorAddress, - proto.entries.map(e => UnbondingDelegation.Entry.fromProto(e)) - ); + proto.entries.map((e) => UnbondingDelegation.Entry.fromProto(e)) + ) } } export namespace UnbondingDelegation { export interface Amino { - delegator_address: AccAddress; - validator_address: ValAddress; - entries: UnbondingDelegation.Entry.Amino[]; + delegator_address: AccAddress + validator_address: ValAddress + entries: UnbondingDelegation.Entry.Amino[] } export interface Data { - delegator_address: AccAddress; - validator_address: ValAddress; - entries: UnbondingDelegation.Entry.Data[]; + delegator_address: AccAddress + validator_address: ValAddress + entries: UnbondingDelegation.Entry.Data[] } - export type Proto = UnbondingDelegation_pb; + export type Proto = UnbondingDelegation_pb export class Entry extends JSONSerializable< Entry.Amino, Entry.Data, Entry.Proto > { - public initial_balance: Coins; - public balance: Coins; + public initial_balance: Coins + public balance: Coins /** * Note that the size of the undelegation is `initial_balance - balance` @@ -125,9 +125,9 @@ export namespace UnbondingDelegation { public creation_height: number, public completion_time: Date ) { - super(); - this.initial_balance = new Coins(initial_balance); - this.balance = new Coins(balance); + super() + this.initial_balance = new Coins(initial_balance) + this.balance = new Coins(balance) } public toAmino(): Entry.Amino { @@ -136,18 +136,18 @@ export namespace UnbondingDelegation { balance: this.balance.toAmino(), creation_height: this.creation_height.toFixed(), completion_time: this.completion_time.toISOString(), - }; + } } public static fromAmino(data: Entry.Amino): Entry { const { initial_balance, balance, creation_height, completion_time } = - data; + data return new Entry( Coins.fromAmino(initial_balance), Coins.fromAmino(balance), Number.parseInt(creation_height), new Date(completion_time) - ); + ) } public toData(): Entry.Data { @@ -156,29 +156,29 @@ export namespace UnbondingDelegation { balance: this.balance.toData(), creation_height: this.creation_height.toFixed(), completion_time: this.completion_time.toISOString(), - }; + } } public static fromData(data: Entry.Data): Entry { const { initial_balance, balance, creation_height, completion_time } = - data; + data return new Entry( Coins.fromData(initial_balance), Coins.fromData(balance), Number.parseInt(creation_height), new Date(completion_time) - ); + ) } public toProto(): Entry.Proto { const { initial_balance, balance, creation_height, completion_time } = - this; + this return UnbondingDelegationEntry_pb.fromPartial({ balance: balance.toProto(), completionTime: completion_time, creationHeight: Long.fromNumber(creation_height), initialBalance: initial_balance.toProto(), - }); + }) } public static fromProto(proto: Entry.Proto): Entry { @@ -187,25 +187,25 @@ export namespace UnbondingDelegation { Coins.fromProto(proto.balance), proto.creationHeight.toNumber(), proto.completionTime as Date - ); + ) } } export namespace Entry { export interface Amino { - initial_balance: Coins.Amino; - balance: Coins.Amino; - creation_height: string; - completion_time: string; + initial_balance: Coins.Amino + balance: Coins.Amino + creation_height: string + completion_time: string } export interface Data { - initial_balance: Coins.Data; - balance: Coins.Data; - creation_height: string; - completion_time: string; + initial_balance: Coins.Data + balance: Coins.Data + creation_height: string + completion_time: string } - export type Proto = UnbondingDelegationEntry_pb; + export type Proto = UnbondingDelegationEntry_pb } } diff --git a/src/core/mstaking/Validator.spec.ts b/src/core/mstaking/Validator.spec.ts index 3ba93db..fd17564 100644 --- a/src/core/mstaking/Validator.spec.ts +++ b/src/core/mstaking/Validator.spec.ts @@ -1,6 +1,6 @@ -import { Validator } from './Validator'; -import { ValConsPublicKey } from '../PublicKey'; -import { Coins } from '../Coins'; +import { Validator } from './Validator' +import { ValConsPublicKey } from '../PublicKey' +import { Coins } from '../Coins' describe('Validator', () => { it('deserializes', () => { @@ -55,7 +55,7 @@ describe('Validator', () => { { denom: 'ustake', amount: '20000000' }, ], voting_power: '5745331862', - }); + }) expect(validator).toMatchObject({ operator_address: 'initvaloper1y3qwj2nf2x9gc6ctgt4vzh6e3q23cy9xz2gn99', @@ -97,6 +97,6 @@ describe('Validator', () => { ustake: 20000000, }), voting_power: '5745331862', - }); - }); -}); + }) + }) +}) diff --git a/src/core/mstaking/Validator.ts b/src/core/mstaking/Validator.ts index a10f27f..a5ab6a0 100644 --- a/src/core/mstaking/Validator.ts +++ b/src/core/mstaking/Validator.ts @@ -1,17 +1,17 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { num } from '../num'; -import { ValAddress } from '../bech32'; -import { ValConsPublicKey } from '../PublicKey'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { num } from '../num' +import { ValAddress } from '../bech32' +import { ValConsPublicKey } from '../PublicKey' import { Validator as Validator_pb, Description as Description_pb, Commission as Commission_pb, CommissionRates as CommissionRates_pb, BondStatus, -} from '@initia/initia.proto/initia/mstaking/v1/staking'; -import Long from 'long'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from '@initia/initia.proto/initia/mstaking/v1/staking' +import Long from 'long' +import { Any } from '@initia/initia.proto/google/protobuf/any' /** * Stores information fetched from the blockchain about the current status of a validator. @@ -24,9 +24,9 @@ export class Validator extends JSONSerializable< Validator.Data, Validator.Proto > { - public tokens: Coins; - public delegator_shares: Coins; - public voting_powers: Coins; + public tokens: Coins + public delegator_shares: Coins + public voting_powers: Coins /** * @@ -56,10 +56,10 @@ export class Validator extends JSONSerializable< voting_powers: Coins.Input, public voting_power: string ) { - super(); - this.tokens = new Coins(tokens); - this.delegator_shares = new Coins(delegator_shares); - this.voting_powers = new Coins(voting_powers); + super() + this.tokens = new Coins(tokens) + this.delegator_shares = new Coins(delegator_shares) + this.voting_powers = new Coins(voting_powers) } public toAmino(): Validator.Amino { @@ -76,7 +76,7 @@ export class Validator extends JSONSerializable< commission: this.commission.toAmino(), voting_powers: this.voting_powers.toAmino(), voting_power: this.voting_power, - }; + } } public static fromAmino(data: Validator.Amino): Validator { @@ -93,7 +93,7 @@ export class Validator extends JSONSerializable< Validator.Commission.fromAmino(data.commission), Coins.fromAmino(data.voting_powers), data.voting_power - ); + ) } public toData(): Validator.Data { @@ -110,7 +110,7 @@ export class Validator extends JSONSerializable< commission: this.commission.toData(), voting_powers: this.voting_powers.toData(), voting_power: this.voting_power, - }; + } } public static fromData(data: Validator.Data): Validator { @@ -127,7 +127,7 @@ export class Validator extends JSONSerializable< Validator.Commission.fromData(data.commission), Coins.fromData(data.voting_powers), data.voting_power - ); + ) } public toProto(): Validator.Proto { @@ -144,7 +144,7 @@ export class Validator extends JSONSerializable< commission, voting_powers, voting_power, - } = this; + } = this return Validator_pb.fromPartial({ operatorAddress: operator_address, consensusPubkey: consensus_pubkey.packAny(), @@ -158,7 +158,7 @@ export class Validator extends JSONSerializable< commission: commission.toProto(), votingPowers: voting_powers.toProto(), votingPower: voting_power, - }); + }) } public static fromProto(data: Validator.Proto): Validator { @@ -179,44 +179,44 @@ export class Validator extends JSONSerializable< ), Coins.fromProto(data.votingPowers), data.votingPower - ); + ) } } export namespace Validator { - export const Status = BondStatus; - export type Status = BondStatus; + export const Status = BondStatus + export type Status = BondStatus export interface Amino { - operator_address: ValAddress; - consensus_pubkey: ValConsPublicKey.Amino; - jailed: boolean; - status: BondStatus; - tokens: Coins.Amino; - delegator_shares: Coins.Amino; - description: Description.Amino; - unbonding_height: string; - unbonding_time: string; - commission: Commission.Amino; - voting_powers: Coins.Amino; - voting_power: string; + operator_address: ValAddress + consensus_pubkey: ValConsPublicKey.Amino + jailed: boolean + status: BondStatus + tokens: Coins.Amino + delegator_shares: Coins.Amino + description: Description.Amino + unbonding_height: string + unbonding_time: string + commission: Commission.Amino + voting_powers: Coins.Amino + voting_power: string } export interface Data { - operator_address: ValAddress; - consensus_pubkey: ValConsPublicKey.Data; - jailed: boolean; - status: BondStatus; - tokens: Coins.Data; - delegator_shares: Coins.Data; - description: Description.Data; - unbonding_height: string; - unbonding_time: string; - commission: Commission.Data; - voting_powers: Coins.Data; - voting_power: string; + operator_address: ValAddress + consensus_pubkey: ValConsPublicKey.Data + jailed: boolean + status: BondStatus + tokens: Coins.Data + delegator_shares: Coins.Data + description: Description.Data + unbonding_height: string + unbonding_time: string + commission: Commission.Data + voting_powers: Coins.Data + voting_power: string } - export type Proto = Validator_pb; + export type Proto = Validator_pb export class Description extends JSONSerializable< Description.Amino, @@ -237,7 +237,7 @@ export namespace Validator { public details: string, public security_contact: string ) { - super(); + super() } public toAmino(): Description.Amino { @@ -247,7 +247,7 @@ export namespace Validator { website: this.website, details: this.details, security_contact: this.security_contact, - }; + } } public static fromAmino(data: Description.Amino): Description { @@ -257,7 +257,7 @@ export namespace Validator { data.website ?? '', data.details ?? '', data.security_contact ?? '' - ); + ) } public toData(): Description.Data { @@ -267,7 +267,7 @@ export namespace Validator { website: this.website, details: this.details, security_contact: this.security_contact, - }; + } } public static fromData(data: Description.Data): Description { @@ -277,11 +277,11 @@ export namespace Validator { data.website ?? '', data.details ?? '', data.security_contact ?? '' - ); + ) } public toProto(): Description.Proto { - const { moniker, identity, website, details, security_contact } = this; + const { moniker, identity, website, details, security_contact } = this return Description_pb.fromPartial({ details, @@ -289,7 +289,7 @@ export namespace Validator { moniker, securityContact: security_contact, website, - }); + }) } public static fromProto(proto: Description.Proto): Description { @@ -299,28 +299,28 @@ export namespace Validator { proto.website, proto.details, proto.securityContact - ); + ) } } export namespace Description { export interface Amino { - moniker: string; - identity: string; - website: string; - details: string; - security_contact: string; + moniker: string + identity: string + website: string + details: string + security_contact: string } export interface Data { - moniker: string; - identity: string; - website: string; - details: string; - security_contact: string; + moniker: string + identity: string + website: string + details: string + security_contact: string } - export type Proto = Description_pb; + export type Proto = Description_pb } export class CommissionRates extends JSONSerializable< @@ -338,72 +338,68 @@ export namespace Validator { public max_rate: string, public max_change_rate: string ) { - super(); - this.rate = num(rate).toString(); - this.max_rate = num(max_rate).toString(); - this.max_change_rate = num(max_change_rate).toString(); + super() + this.rate = num(rate).toString() + this.max_rate = num(max_rate).toString() + this.max_change_rate = num(max_change_rate).toString() } public static fromAmino(data: CommissionRates.Amino): CommissionRates { - const { rate, max_rate, max_change_rate } = data; - return new CommissionRates(rate, max_rate, max_change_rate); + const { rate, max_rate, max_change_rate } = data + return new CommissionRates(rate, max_rate, max_change_rate) } public toAmino(): Validator.CommissionRates.Amino { - const { rate, max_rate, max_change_rate } = this; + const { rate, max_rate, max_change_rate } = this return { rate, max_rate, max_change_rate, - }; + } } public static fromData(data: CommissionRates.Data): CommissionRates { - const { rate, max_rate, max_change_rate } = data; - return new CommissionRates(rate, max_rate, max_change_rate); + const { rate, max_rate, max_change_rate } = data + return new CommissionRates(rate, max_rate, max_change_rate) } public toData(): Validator.CommissionRates.Data { - const { rate, max_rate, max_change_rate } = this; + const { rate, max_rate, max_change_rate } = this return { rate, max_rate, max_change_rate, - }; + } } public static fromProto(proto: CommissionRates.Proto): CommissionRates { - return new CommissionRates( - proto.rate, - proto.maxRate, - proto.maxChangeRate - ); + return new CommissionRates(proto.rate, proto.maxRate, proto.maxChangeRate) } public toProto(): Validator.CommissionRates.Proto { - const { rate, max_rate, max_change_rate } = this; + const { rate, max_rate, max_change_rate } = this return CommissionRates_pb.fromPartial({ maxChangeRate: max_change_rate, maxRate: max_rate, rate, - }); + }) } } export namespace CommissionRates { export interface Amino { - rate: string; - max_rate: string; - max_change_rate: string; + rate: string + max_rate: string + max_change_rate: string } export interface Data { - rate: string; - max_rate: string; - max_change_rate: string; + rate: string + max_rate: string + max_change_rate: string } - export type Proto = CommissionRates_pb; + export type Proto = CommissionRates_pb } export class Commission extends JSONSerializable< @@ -419,43 +415,43 @@ export namespace Validator { public commission_rates: CommissionRates, public update_time: Date ) { - super(); + super() } public toAmino(): Commission.Amino { return { commission_rates: this.commission_rates.toAmino(), update_time: this.update_time.toISOString(), - }; + } } public static fromAmino(data: Commission.Amino): Commission { return new Commission( CommissionRates.fromAmino(data.commission_rates), new Date(data.update_time) - ); + ) } public toData(): Commission.Data { return { commission_rates: this.commission_rates.toData(), update_time: this.update_time.toISOString(), - }; + } } public static fromData(data: Commission.Data): Commission { return new Commission( CommissionRates.fromData(data.commission_rates), new Date(data.update_time) - ); + ) } public toProto(): Commission.Proto { - const { commission_rates, update_time } = this; + const { commission_rates, update_time } = this return Commission_pb.fromPartial({ commissionRates: commission_rates.toProto(), updateTime: update_time, - }); + }) } public static fromProto(proto: Commission.Proto): Commission { @@ -464,21 +460,21 @@ export namespace Validator { proto.commissionRates as CommissionRates.Proto ), proto.updateTime as Date - ); + ) } } export namespace Commission { export interface Amino { - commission_rates: CommissionRates.Amino; - update_time: string; + commission_rates: CommissionRates.Amino + update_time: string } export interface Data { - commission_rates: CommissionRates.Data; - update_time: string; + commission_rates: CommissionRates.Data + update_time: string } - export type Proto = Commission_pb; + export type Proto = Commission_pb } } diff --git a/src/core/mstaking/index.ts b/src/core/mstaking/index.ts index 260ece8..d055e12 100644 --- a/src/core/mstaking/index.ts +++ b/src/core/mstaking/index.ts @@ -1,6 +1,6 @@ -export * from './msgs'; -export * from './Delegation'; -export * from './MstakingParams'; -export * from './Redelegation'; -export * from './UnbondingDelegation'; -export * from './Validator'; +export * from './msgs' +export * from './Delegation' +export * from './MstakingParams' +export * from './Redelegation' +export * from './UnbondingDelegation' +export * from './Validator' diff --git a/src/core/mstaking/msgs/MsgBeginRedelegate.spec.ts b/src/core/mstaking/msgs/MsgBeginRedelegate.spec.ts index 6db9cff..36ac625 100644 --- a/src/core/mstaking/msgs/MsgBeginRedelegate.spec.ts +++ b/src/core/mstaking/msgs/MsgBeginRedelegate.spec.ts @@ -1,15 +1,15 @@ -import { MsgBeginRedelegate } from './MsgBeginRedelegate'; -const MsgBeginRedelegateAmino = require('./MsgBeginRedelegate.data.json'); +import { MsgBeginRedelegate } from './MsgBeginRedelegate' +const MsgBeginRedelegateAmino = require('./MsgBeginRedelegate.data.json') describe('MsgBeginRedelegate', () => { it('deserializes', () => { MsgBeginRedelegateAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgBeginRedelegate') { - const e = MsgBeginRedelegate.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgBeginRedelegate.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/mstaking/msgs/MsgBeginRedelegate.ts b/src/core/mstaking/msgs/MsgBeginRedelegate.ts index 53b1b60..e94ec57 100644 --- a/src/core/mstaking/msgs/MsgBeginRedelegate.ts +++ b/src/core/mstaking/msgs/MsgBeginRedelegate.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgBeginRedelegate as MsgBeginRedelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress, ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgBeginRedelegate as MsgBeginRedelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' /** * A delegator can choose to redelegate their bonded Initia and transfer a delegation @@ -14,7 +14,7 @@ export class MsgBeginRedelegate extends JSONSerializable< MsgBeginRedelegate.Data, MsgBeginRedelegate.Proto > { - public amount: Coins; + public amount: Coins /** * @@ -29,8 +29,8 @@ export class MsgBeginRedelegate extends JSONSerializable< public validator_dst_address: ValAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgBeginRedelegate.Amino): MsgBeginRedelegate { @@ -41,13 +41,13 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_dst_address, amount, }, - } = data; + } = data return new MsgBeginRedelegate( delegator_address, validator_src_address, validator_dst_address, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgBeginRedelegate.Amino { @@ -56,7 +56,7 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_src_address, validator_dst_address, amount, - } = this; + } = this return { type: 'mstaking/MsgBeginRedelegate', value: { @@ -65,7 +65,7 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_dst_address, amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgBeginRedelegate.Data): MsgBeginRedelegate { @@ -74,13 +74,13 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_src_address, validator_dst_address, amount, - } = data; + } = data return new MsgBeginRedelegate( delegator_address, validator_src_address, validator_dst_address, Coins.fromData(amount) - ); + ) } public toData(): MsgBeginRedelegate.Data { @@ -89,14 +89,14 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_src_address, validator_dst_address, amount, - } = this; + } = this return { '@type': '/initia.mstaking.v1.MsgBeginRedelegate', delegator_address, validator_src_address, validator_dst_address, amount: amount.toData(), - }; + } } public static fromProto(proto: MsgBeginRedelegate.Proto): MsgBeginRedelegate { @@ -105,7 +105,7 @@ export class MsgBeginRedelegate extends JSONSerializable< proto.validatorSrcAddress, proto.validatorDstAddress, Coins.fromProto(proto.amount as Coins.Proto) - ); + ) } public toProto(): MsgBeginRedelegate.Proto { @@ -114,47 +114,47 @@ export class MsgBeginRedelegate extends JSONSerializable< validator_src_address, validator_dst_address, amount, - } = this; + } = this return MsgBeginRedelegate_pb.fromPartial({ amount: amount.toProto(), delegatorAddress: delegator_address, validatorDstAddress: validator_dst_address, validatorSrcAddress: validator_src_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgBeginRedelegate', value: MsgBeginRedelegate_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgBeginRedelegate { return MsgBeginRedelegate.fromProto( MsgBeginRedelegate_pb.decode(msgAny.value) - ); + ) } } export namespace MsgBeginRedelegate { export interface Amino { - type: 'mstaking/MsgBeginRedelegate'; + type: 'mstaking/MsgBeginRedelegate' value: { - delegator_address: AccAddress; - validator_src_address: ValAddress; - validator_dst_address: ValAddress; - amount: Coins.Amino; - }; + delegator_address: AccAddress + validator_src_address: ValAddress + validator_dst_address: ValAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgBeginRedelegate'; - delegator_address: AccAddress; - validator_src_address: ValAddress; - validator_dst_address: ValAddress; - amount: Coins.Data; + '@type': '/initia.mstaking.v1.MsgBeginRedelegate' + delegator_address: AccAddress + validator_src_address: ValAddress + validator_dst_address: ValAddress + amount: Coins.Data } - export type Proto = MsgBeginRedelegate_pb; + export type Proto = MsgBeginRedelegate_pb } diff --git a/src/core/mstaking/msgs/MsgCancelUnbondingDelegation.ts b/src/core/mstaking/msgs/MsgCancelUnbondingDelegation.ts index 81ec2a7..18e239d 100644 --- a/src/core/mstaking/msgs/MsgCancelUnbondingDelegation.ts +++ b/src/core/mstaking/msgs/MsgCancelUnbondingDelegation.ts @@ -1,16 +1,16 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCancelUnbondingDelegation as MsgCancelUnbondingDelegation_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; -import Long from 'long'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCancelUnbondingDelegation as MsgCancelUnbondingDelegation_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' +import Long from 'long' export class MsgCancelUnbondingDelegation extends JSONSerializable< MsgCancelUnbondingDelegation.Amino, MsgCancelUnbondingDelegation.Data, MsgCancelUnbondingDelegation.Proto > { - public amount: Coins; + public amount: Coins /** * @param delegator_address delegator's account address @@ -23,8 +23,8 @@ export class MsgCancelUnbondingDelegation extends JSONSerializable< amount: Coins.Input, public creation_height: number ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino( @@ -32,18 +32,18 @@ export class MsgCancelUnbondingDelegation extends JSONSerializable< ): MsgCancelUnbondingDelegation { const { value: { delegator_address, validator_address, amount, creation_height }, - } = data; + } = data return new MsgCancelUnbondingDelegation( delegator_address, validator_address, Coins.fromAmino(amount), Number.parseInt(creation_height) - ); + ) } public toAmino(): MsgCancelUnbondingDelegation.Amino { const { delegator_address, validator_address, amount, creation_height } = - this; + this return { type: 'mstaking/MsgCancelUnbondingDelegation', value: { @@ -52,32 +52,32 @@ export class MsgCancelUnbondingDelegation extends JSONSerializable< amount: amount.toAmino(), creation_height: creation_height.toString(), }, - }; + } } public static fromData( data: MsgCancelUnbondingDelegation.Data ): MsgCancelUnbondingDelegation { const { delegator_address, validator_address, amount, creation_height } = - data; + data return new MsgCancelUnbondingDelegation( delegator_address, validator_address, Coins.fromData(amount), Number.parseInt(creation_height) - ); + ) } public toData(): MsgCancelUnbondingDelegation.Data { const { delegator_address, validator_address, amount, creation_height } = - this; + this return { '@type': '/initia.mstaking.v1.MsgCancelUnbondingDelegation', delegator_address, validator_address, amount: amount.toData(), creation_height: creation_height.toString(), - }; + } } public static fromProto( @@ -88,52 +88,52 @@ export class MsgCancelUnbondingDelegation extends JSONSerializable< proto.validatorAddress, Coins.fromProto(proto.amount as Coins.Proto), proto.creationHeight.toNumber() - ); + ) } public toProto(): MsgCancelUnbondingDelegation.Proto { const { delegator_address, validator_address, amount, creation_height } = - this; + this return MsgCancelUnbondingDelegation_pb.fromPartial({ amount: amount.toProto(), delegatorAddress: delegator_address, validatorAddress: validator_address, creationHeight: Long.fromNumber(creation_height), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgCancelUnbondingDelegation', value: MsgCancelUnbondingDelegation_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCancelUnbondingDelegation { return MsgCancelUnbondingDelegation.fromProto( MsgCancelUnbondingDelegation_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCancelUnbondingDelegation { export interface Amino { - type: 'mstaking/MsgCancelUnbondingDelegation'; + type: 'mstaking/MsgCancelUnbondingDelegation' value: { - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Amino; - creation_height: string; - }; + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Amino + creation_height: string + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgCancelUnbondingDelegation'; - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Data; - creation_height: string; + '@type': '/initia.mstaking.v1.MsgCancelUnbondingDelegation' + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Data + creation_height: string } - export type Proto = MsgCancelUnbondingDelegation_pb; + export type Proto = MsgCancelUnbondingDelegation_pb } diff --git a/src/core/mstaking/msgs/MsgCreateValidator.spec.ts b/src/core/mstaking/msgs/MsgCreateValidator.spec.ts index bc9293b..4efc638 100644 --- a/src/core/mstaking/msgs/MsgCreateValidator.spec.ts +++ b/src/core/mstaking/msgs/MsgCreateValidator.spec.ts @@ -1,15 +1,15 @@ -import { MsgCreateValidator } from './MsgCreateValidator'; -const MsgCreateValidatorAmino = require('./MsgCreateValidator.data.json'); +import { MsgCreateValidator } from './MsgCreateValidator' +const MsgCreateValidatorAmino = require('./MsgCreateValidator.data.json') describe('MsgCreateValidator', () => { it('deserializes', () => { MsgCreateValidatorAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgCreateValidator') { - const e = MsgCreateValidator.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgCreateValidator.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/mstaking/msgs/MsgCreateValidator.ts b/src/core/mstaking/msgs/MsgCreateValidator.ts index 6e2934e..ce71747 100644 --- a/src/core/mstaking/msgs/MsgCreateValidator.ts +++ b/src/core/mstaking/msgs/MsgCreateValidator.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { ValAddress } from '../../bech32'; -import { Validator } from '../Validator'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreateValidator as MsgCreateValidator_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; -import { ValConsPublicKey, PublicKey } from '../../PublicKey'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { ValAddress } from '../../bech32' +import { Validator } from '../Validator' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreateValidator as MsgCreateValidator_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' +import { ValConsPublicKey, PublicKey } from '../../PublicKey' /** * For new validators, this message registers a validator address to be a delegate on @@ -15,7 +15,7 @@ export class MsgCreateValidator extends JSONSerializable< MsgCreateValidator.Data, MsgCreateValidator.Proto > { - public amount: Coins; + public amount: Coins /** * @@ -32,25 +32,25 @@ export class MsgCreateValidator extends JSONSerializable< public pubkey: ValConsPublicKey, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgCreateValidator.Amino): MsgCreateValidator { const { value: { description, commission, validator_address, pubkey, amount }, - } = data; + } = data return new MsgCreateValidator( description, Validator.CommissionRates.fromAmino(commission), validator_address, ValConsPublicKey.fromAmino(pubkey), Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgCreateValidator.Amino { - const { description, commission, validator_address, pubkey, amount } = this; + const { description, commission, validator_address, pubkey, amount } = this return { type: 'mstaking/MsgCreateValidator', value: { @@ -60,22 +60,22 @@ export class MsgCreateValidator extends JSONSerializable< pubkey: pubkey.toAmino(), amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgCreateValidator.Data): MsgCreateValidator { - const { description, commission, validator_address, pubkey, amount } = data; + const { description, commission, validator_address, pubkey, amount } = data return new MsgCreateValidator( description, Validator.CommissionRates.fromData(commission), validator_address, ValConsPublicKey.fromData(pubkey), Coins.fromData(amount) - ); + ) } public toData(): MsgCreateValidator.Data { - const { description, commission, validator_address, pubkey, amount } = this; + const { description, commission, validator_address, pubkey, amount } = this return { '@type': '/initia.mstaking.v1.MsgCreateValidator', description, @@ -83,7 +83,7 @@ export class MsgCreateValidator extends JSONSerializable< validator_address, pubkey: pubkey.toData(), amount: amount.toData(), - }; + } } public static fromProto(proto: MsgCreateValidator.Proto): MsgCreateValidator { @@ -97,54 +97,54 @@ export class MsgCreateValidator extends JSONSerializable< proto.validatorAddress, PublicKey.fromProto(proto.pubkey as Any) as ValConsPublicKey, Coins.fromProto(proto.amount as Coins.Proto) - ); + ) } public toProto(): MsgCreateValidator.Proto { - const { description, commission, validator_address, pubkey, amount } = this; + const { description, commission, validator_address, pubkey, amount } = this return MsgCreateValidator_pb.fromPartial({ commission: commission.toProto(), description: description.toProto(), pubkey: pubkey.packAny(), validatorAddress: validator_address, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgCreateValidator', value: MsgCreateValidator_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateValidator { return MsgCreateValidator.fromProto( MsgCreateValidator_pb.decode(msgAny.value) - ); + ) } } export namespace MsgCreateValidator { export interface Amino { - type: 'mstaking/MsgCreateValidator'; + type: 'mstaking/MsgCreateValidator' value: { - description: Validator.Description; - commission: Validator.CommissionRates.Amino; - validator_address: ValAddress; - pubkey: ValConsPublicKey.Amino; - amount: Coins.Amino; - }; + description: Validator.Description + commission: Validator.CommissionRates.Amino + validator_address: ValAddress + pubkey: ValConsPublicKey.Amino + amount: Coins.Amino + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgCreateValidator'; - description: Validator.Description; - commission: Validator.CommissionRates.Data; - validator_address: ValAddress; - pubkey: ValConsPublicKey.Data; - amount: Coins.Data; + '@type': '/initia.mstaking.v1.MsgCreateValidator' + description: Validator.Description + commission: Validator.CommissionRates.Data + validator_address: ValAddress + pubkey: ValConsPublicKey.Data + amount: Coins.Data } - export type Proto = MsgCreateValidator_pb; + export type Proto = MsgCreateValidator_pb } diff --git a/src/core/mstaking/msgs/MsgDelegate.spec.ts b/src/core/mstaking/msgs/MsgDelegate.spec.ts index a768b44..231e17e 100644 --- a/src/core/mstaking/msgs/MsgDelegate.spec.ts +++ b/src/core/mstaking/msgs/MsgDelegate.spec.ts @@ -1,15 +1,15 @@ -import { MsgDelegate } from './MsgDelegate'; -const MsgDelegateAmino = require('./MsgDelegate.data.json'); +import { MsgDelegate } from './MsgDelegate' +const MsgDelegateAmino = require('./MsgDelegate.data.json') describe('MsgDelegate', () => { it('deserializes', () => { MsgDelegateAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgDelegate') { - const e = MsgDelegate.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgDelegate.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/mstaking/msgs/MsgDelegate.ts b/src/core/mstaking/msgs/MsgDelegate.ts index 81b25b5..ca99eb3 100644 --- a/src/core/mstaking/msgs/MsgDelegate.ts +++ b/src/core/mstaking/msgs/MsgDelegate.ts @@ -1,8 +1,8 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgDelegate as MsgDelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgDelegate as MsgDelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' /** * A delegator can submit this message to send more Initia to be staked through a @@ -13,7 +13,7 @@ export class MsgDelegate extends JSONSerializable< MsgDelegate.Data, MsgDelegate.Proto > { - public amount: Coins; + public amount: Coins /** * @@ -26,23 +26,23 @@ export class MsgDelegate extends JSONSerializable< public validator_address: ValAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgDelegate.Amino): MsgDelegate { const { value: { delegator_address, validator_address, amount }, - } = data; + } = data return new MsgDelegate( delegator_address, validator_address, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgDelegate.Amino { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return { type: 'mstaking/MsgDelegate', value: { @@ -50,7 +50,7 @@ export class MsgDelegate extends JSONSerializable< validator_address, amount: amount.toAmino(), }, - }; + } } public static fromProto(proto: MsgDelegate.Proto): MsgDelegate { @@ -58,65 +58,65 @@ export class MsgDelegate extends JSONSerializable< proto.delegatorAddress, proto.validatorAddress, Coins.fromProto(proto.amount as Coins.Proto) - ); + ) } public toProto(): MsgDelegate.Proto { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return MsgDelegate_pb.fromPartial({ amount: amount.toProto(), delegatorAddress: delegator_address, validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgDelegate', value: MsgDelegate_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDelegate { - return MsgDelegate.fromProto(MsgDelegate_pb.decode(msgAny.value)); + return MsgDelegate.fromProto(MsgDelegate_pb.decode(msgAny.value)) } public static fromData(data: MsgDelegate.Data): MsgDelegate { - const { delegator_address, validator_address, amount } = data; + const { delegator_address, validator_address, amount } = data return new MsgDelegate( delegator_address, validator_address, Coins.fromData(amount) - ); + ) } public toData(): MsgDelegate.Data { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return { '@type': '/initia.mstaking.v1.MsgDelegate', delegator_address, validator_address, amount: amount.toData(), - }; + } } } export namespace MsgDelegate { export interface Amino { - type: 'mstaking/MsgDelegate'; + type: 'mstaking/MsgDelegate' value: { - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Amino; - }; + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgDelegate'; - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Data; + '@type': '/initia.mstaking.v1.MsgDelegate' + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Data } - export type Proto = MsgDelegate_pb; + export type Proto = MsgDelegate_pb } diff --git a/src/core/mstaking/msgs/MsgEditValidator.spec.ts b/src/core/mstaking/msgs/MsgEditValidator.spec.ts index 7b2515d..09278b5 100644 --- a/src/core/mstaking/msgs/MsgEditValidator.spec.ts +++ b/src/core/mstaking/msgs/MsgEditValidator.spec.ts @@ -1,15 +1,15 @@ -import { MsgEditValidator } from './MsgEditValidator'; -const MsgEditValidatorAmino = require('./MsgEditValidator.data.json'); +import { MsgEditValidator } from './MsgEditValidator' +const MsgEditValidatorAmino = require('./MsgEditValidator.data.json') describe('MsgEditValidator', () => { it('deserializes', () => { MsgEditValidatorAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgEditValidator') { - const e = MsgEditValidator.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgEditValidator.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/mstaking/msgs/MsgEditValidator.ts b/src/core/mstaking/msgs/MsgEditValidator.ts index 38a0b3f..9b1498d 100644 --- a/src/core/mstaking/msgs/MsgEditValidator.ts +++ b/src/core/mstaking/msgs/MsgEditValidator.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { ValAddress } from '../../bech32'; -import { Validator } from '../Validator'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgEditValidator as MsgEditValidator_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { ValAddress } from '../../bech32' +import { Validator } from '../Validator' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgEditValidator as MsgEditValidator_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' /** * A validator can edit its delegate information, such as moniker, website, commission @@ -27,22 +27,22 @@ export class MsgEditValidator extends JSONSerializable< public validator_address: ValAddress, public commission_rate?: string ) { - super(); + super() } public static fromAmino(data: MsgEditValidator.Amino): MsgEditValidator { const { value: { description, validator_address, commission_rate }, - } = data; + } = data return new MsgEditValidator( Validator.Description.fromAmino(description), validator_address, commission_rate - ); + ) } public toAmino(): MsgEditValidator.Amino { - const { description, validator_address, commission_rate } = this; + const { description, validator_address, commission_rate } = this return { type: 'mstaking/MsgEditValidator', value: { @@ -50,7 +50,7 @@ export class MsgEditValidator extends JSONSerializable< validator_address, commission_rate, }, - }; + } } public static fromProto(data: MsgEditValidator.Proto): MsgEditValidator { @@ -60,46 +60,46 @@ export class MsgEditValidator extends JSONSerializable< ), data.validatorAddress, data.commissionRate !== '' ? data.commissionRate : undefined - ); + ) } public toProto(): MsgEditValidator.Proto { - const { description, validator_address, commission_rate } = this; + const { description, validator_address, commission_rate } = this return MsgEditValidator_pb.fromPartial({ description: description.toProto(), commissionRate: commission_rate?.toString() ?? '', validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgEditValidator', value: MsgEditValidator_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgEditValidator { - return MsgEditValidator.fromProto(MsgEditValidator_pb.decode(msgAny.value)); + return MsgEditValidator.fromProto(MsgEditValidator_pb.decode(msgAny.value)) } public static fromData(data: MsgEditValidator.Data): MsgEditValidator { - const { description, validator_address, commission_rate } = data; + const { description, validator_address, commission_rate } = data return new MsgEditValidator( Validator.Description.fromData(description), validator_address, commission_rate - ); + ) } public toData(): MsgEditValidator.Data { - const { description, validator_address, commission_rate } = this; + const { description, validator_address, commission_rate } = this return { '@type': '/initia.mstaking.v1.MsgEditValidator', description, validator_address, commission_rate, - }; + } } } @@ -110,23 +110,23 @@ export namespace MsgEditValidator { identity: '[do-not-modify]', details: '[do-not-modify]', security_contact: '[do-not-modify]', - }; + } export interface Amino { - type: 'mstaking/MsgEditValidator'; + type: 'mstaking/MsgEditValidator' value: { - description: Validator.Description.Amino; - validator_address: ValAddress; - commission_rate?: string; - }; + description: Validator.Description.Amino + validator_address: ValAddress + commission_rate?: string + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgEditValidator'; - description: Validator.Description.Data; - validator_address: ValAddress; - commission_rate?: string; + '@type': '/initia.mstaking.v1.MsgEditValidator' + description: Validator.Description.Data + validator_address: ValAddress + commission_rate?: string } - export type Proto = MsgEditValidator_pb; + export type Proto = MsgEditValidator_pb } diff --git a/src/core/mstaking/msgs/MsgUndelegate.spec.ts b/src/core/mstaking/msgs/MsgUndelegate.spec.ts index 5b1be89..8cb8dc0 100644 --- a/src/core/mstaking/msgs/MsgUndelegate.spec.ts +++ b/src/core/mstaking/msgs/MsgUndelegate.spec.ts @@ -1,15 +1,15 @@ -import { MsgUndelegate } from './MsgUndelegate'; -const MsgUndelegateAmino = require('./MsgUndelegate.data.json'); +import { MsgUndelegate } from './MsgUndelegate' +const MsgUndelegateAmino = require('./MsgUndelegate.data.json') describe('MsgUndelegate', () => { it('deserializes', () => { MsgUndelegateAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgUndelegate') { - const e = MsgUndelegate.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgUndelegate.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/mstaking/msgs/MsgUndelegate.ts b/src/core/mstaking/msgs/MsgUndelegate.ts index 97b5685..587fd1a 100644 --- a/src/core/mstaking/msgs/MsgUndelegate.ts +++ b/src/core/mstaking/msgs/MsgUndelegate.ts @@ -1,8 +1,8 @@ -import { Coins } from '../../Coins'; -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUndelegate as MsgUndelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; +import { Coins } from '../../Coins' +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUndelegate as MsgUndelegate_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' /** * A delegator can undelegate an amount of bonded Initia, and will begin the unbonding @@ -14,7 +14,7 @@ export class MsgUndelegate extends JSONSerializable< MsgUndelegate.Data, MsgUndelegate.Proto > { - public amount: Coins; + public amount: Coins /** * @param delegator_address delegator's account address @@ -26,23 +26,23 @@ export class MsgUndelegate extends JSONSerializable< public validator_address: ValAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgUndelegate.Amino): MsgUndelegate { const { value: { delegator_address, validator_address, amount }, - } = data; + } = data return new MsgUndelegate( delegator_address, validator_address, Coins.fromAmino(amount) - ); + ) } public toAmino(): MsgUndelegate.Amino { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return { type: 'mstaking/MsgUndelegate', value: { @@ -50,7 +50,7 @@ export class MsgUndelegate extends JSONSerializable< validator_address, amount: amount.toAmino(), }, - }; + } } public static fromProto(proto: MsgUndelegate.Proto): MsgUndelegate { @@ -58,65 +58,65 @@ export class MsgUndelegate extends JSONSerializable< proto.delegatorAddress, proto.validatorAddress, Coins.fromProto(proto.amount as Coins.Proto) - ); + ) } public toProto(): MsgUndelegate.Proto { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return MsgUndelegate_pb.fromPartial({ amount: amount.toProto(), delegatorAddress: delegator_address, validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgUndelegate', value: MsgUndelegate_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUndelegate { - return MsgUndelegate.fromProto(MsgUndelegate_pb.decode(msgAny.value)); + return MsgUndelegate.fromProto(MsgUndelegate_pb.decode(msgAny.value)) } public static fromData(data: MsgUndelegate.Data): MsgUndelegate { - const { delegator_address, validator_address, amount } = data; + const { delegator_address, validator_address, amount } = data return new MsgUndelegate( delegator_address, validator_address, Coins.fromData(amount) - ); + ) } public toData(): MsgUndelegate.Data { - const { delegator_address, validator_address, amount } = this; + const { delegator_address, validator_address, amount } = this return { '@type': '/initia.mstaking.v1.MsgUndelegate', delegator_address, validator_address, amount: amount.toData(), - }; + } } } export namespace MsgUndelegate { export interface Amino { - type: 'mstaking/MsgUndelegate'; + type: 'mstaking/MsgUndelegate' value: { - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Amino; - }; + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgUndelegate'; - delegator_address: AccAddress; - validator_address: ValAddress; - amount: Coins.Data; + '@type': '/initia.mstaking.v1.MsgUndelegate' + delegator_address: AccAddress + validator_address: ValAddress + amount: Coins.Data } - export type Proto = MsgUndelegate_pb; + export type Proto = MsgUndelegate_pb } diff --git a/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts b/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts index fc5b4ed..fbe3821 100644 --- a/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts +++ b/src/core/mstaking/msgs/MsgUpdateMstakingParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MstakingParams } from '../MstakingParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/mstaking/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MstakingParams } from '../MstakingParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/mstaking/v1/tx' export class MsgUpdateMstakingParams extends JSONSerializable< MsgUpdateMstakingParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateMstakingParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/mstaking parameters to update */ - constructor(public authority: AccAddress, public params: MstakingParams) { - super(); + constructor( + public authority: AccAddress, + public params: MstakingParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateMstakingParams extends JSONSerializable< ): MsgUpdateMstakingParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateMstakingParams( authority, MstakingParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateMstakingParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'mstaking/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateMstakingParams.Data ): MsgUpdateMstakingParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateMstakingParams( authority, MstakingParams.fromData(params) - ); + ) } public toData(): MsgUpdateMstakingParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.mstaking.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,45 @@ export class MsgUpdateMstakingParams extends JSONSerializable< return new MsgUpdateMstakingParams( data.authority, MstakingParams.fromProto(data.params as MstakingParams.Proto) - ); + ) } public toProto(): MsgUpdateMstakingParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.mstaking.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateMstakingParams { return MsgUpdateMstakingParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateMstakingParams { export interface Amino { - type: 'mstaking/MsgUpdateParams'; + type: 'mstaking/MsgUpdateParams' value: { - authority: AccAddress; - params: MstakingParams.Amino; - }; + authority: AccAddress + params: MstakingParams.Amino + } } export interface Data { - '@type': '/initia.mstaking.v1.MsgUpdateParams'; - authority: AccAddress; - params: MstakingParams.Data; + '@type': '/initia.mstaking.v1.MsgUpdateParams' + authority: AccAddress + params: MstakingParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/mstaking/msgs/index.ts b/src/core/mstaking/msgs/index.ts index 1f11c2a..8f63ba6 100644 --- a/src/core/mstaking/msgs/index.ts +++ b/src/core/mstaking/msgs/index.ts @@ -1,18 +1,18 @@ -import { MsgDelegate } from './MsgDelegate'; -import { MsgUndelegate } from './MsgUndelegate'; -import { MsgBeginRedelegate } from './MsgBeginRedelegate'; -import { MsgCreateValidator } from './MsgCreateValidator'; -import { MsgEditValidator } from './MsgEditValidator'; -import { MsgCancelUnbondingDelegation } from './MsgCancelUnbondingDelegation'; -import { MsgUpdateMstakingParams } from './MsgUpdateMstakingParams'; +import { MsgDelegate } from './MsgDelegate' +import { MsgUndelegate } from './MsgUndelegate' +import { MsgBeginRedelegate } from './MsgBeginRedelegate' +import { MsgCreateValidator } from './MsgCreateValidator' +import { MsgEditValidator } from './MsgEditValidator' +import { MsgCancelUnbondingDelegation } from './MsgCancelUnbondingDelegation' +import { MsgUpdateMstakingParams } from './MsgUpdateMstakingParams' -export * from './MsgDelegate'; -export * from './MsgUndelegate'; -export * from './MsgBeginRedelegate'; -export * from './MsgCreateValidator'; -export * from './MsgEditValidator'; -export * from './MsgCancelUnbondingDelegation'; -export * from './MsgUpdateMstakingParams'; +export * from './MsgDelegate' +export * from './MsgUndelegate' +export * from './MsgBeginRedelegate' +export * from './MsgCreateValidator' +export * from './MsgEditValidator' +export * from './MsgCancelUnbondingDelegation' +export * from './MsgUpdateMstakingParams' export type MstakingMsg = | MsgDelegate @@ -21,7 +21,7 @@ export type MstakingMsg = | MsgCreateValidator | MsgEditValidator | MsgCancelUnbondingDelegation - | MsgUpdateMstakingParams; + | MsgUpdateMstakingParams export namespace MstakingMsg { export type Amino = @@ -31,7 +31,7 @@ export namespace MstakingMsg { | MsgCreateValidator.Amino | MsgEditValidator.Amino | MsgCancelUnbondingDelegation.Amino - | MsgUpdateMstakingParams.Amino; + | MsgUpdateMstakingParams.Amino export type Data = | MsgDelegate.Data | MsgUndelegate.Data @@ -39,7 +39,7 @@ export namespace MstakingMsg { | MsgCreateValidator.Data | MsgEditValidator.Data | MsgCancelUnbondingDelegation.Data - | MsgUpdateMstakingParams.Data; + | MsgUpdateMstakingParams.Data export type Proto = | MsgDelegate.Proto | MsgUndelegate.Proto @@ -47,5 +47,5 @@ export namespace MstakingMsg { | MsgCreateValidator.Proto | MsgEditValidator.Proto | MsgCancelUnbondingDelegation.Proto - | MsgUpdateMstakingParams.Proto; + | MsgUpdateMstakingParams.Proto } diff --git a/src/core/num.ts b/src/core/num.ts index f2a7167..c9367fd 100644 --- a/src/core/num.ts +++ b/src/core/num.ts @@ -1,13 +1,13 @@ -import { BigNumber } from 'bignumber.js'; +import { BigNumber } from 'bignumber.js' export function num(number: number | string): BigNumber { - return new BigNumber(number); + return new BigNumber(number) } export function checkDecimal(amount: number | string): boolean { return typeof amount === 'string' ? amount.includes('.') - : !num(amount).isInteger(); + : !num(amount).isInteger() } -export * from 'bignumber.js'; +export * from 'bignumber.js' diff --git a/src/core/opchild/BridgeInfo.ts b/src/core/opchild/BridgeInfo.ts index 329266b..33b273d 100644 --- a/src/core/opchild/BridgeInfo.ts +++ b/src/core/opchild/BridgeInfo.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { BridgeInfo as BridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/types'; -import { BridgeConfig } from '../ophost'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { BridgeInfo as BridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' +import { BridgeConfig } from '../ophost' +import Long from 'long' export class BridgeInfo extends JSONSerializable< BridgeInfo.Amino, @@ -22,55 +22,55 @@ export class BridgeInfo extends JSONSerializable< public l1_client_id: string, public bridge_config: BridgeConfig ) { - super(); + super() } public static fromAmino(data: BridgeInfo.Amino): BridgeInfo { const { bridge_id, bridge_addr, l1_chain_id, l1_client_id, bridge_config } = - data; + data return new BridgeInfo( Number.parseInt(bridge_id), bridge_addr, l1_chain_id, l1_client_id, BridgeConfig.fromAmino(bridge_config) - ); + ) } public toAmino(): BridgeInfo.Amino { const { bridge_id, bridge_addr, l1_chain_id, l1_client_id, bridge_config } = - this; + this return { bridge_id: bridge_id.toString(), bridge_addr, l1_chain_id, l1_client_id, bridge_config: bridge_config.toAmino(), - }; + } } public static fromData(data: BridgeInfo.Data): BridgeInfo { const { bridge_id, bridge_addr, l1_chain_id, l1_client_id, bridge_config } = - data; + data return new BridgeInfo( Number.parseInt(bridge_id), bridge_addr, l1_chain_id, l1_client_id, BridgeConfig.fromData(bridge_config) - ); + ) } public toData(): BridgeInfo.Data { const { bridge_id, bridge_addr, l1_chain_id, l1_client_id, bridge_config } = - this; + this return { bridge_id: bridge_id.toString(), bridge_addr, l1_chain_id, l1_client_id, bridge_config: bridge_config.toData(), - }; + } } public static fromProto(data: BridgeInfo.Proto): BridgeInfo { @@ -80,38 +80,38 @@ export class BridgeInfo extends JSONSerializable< data.l1ChainId, data.l1ClientId, BridgeConfig.fromProto(data.bridgeConfig as BridgeConfig.Proto) - ); + ) } public toProto(): BridgeInfo.Proto { const { bridge_id, bridge_addr, l1_chain_id, l1_client_id, bridge_config } = - this; + this return BridgeInfo_pb.fromPartial({ bridgeId: Long.fromNumber(bridge_id), bridgeAddr: bridge_addr, l1ChainId: l1_chain_id, l1ClientId: l1_client_id, bridgeConfig: bridge_config.toProto(), - }); + }) } } export namespace BridgeInfo { export interface Amino { - bridge_id: string; - bridge_addr: string; - l1_chain_id: string; - l1_client_id: string; - bridge_config: BridgeConfig.Amino; + bridge_id: string + bridge_addr: string + l1_chain_id: string + l1_client_id: string + bridge_config: BridgeConfig.Amino } export interface Data { - bridge_id: string; - bridge_addr: string; - l1_chain_id: string; - l1_client_id: string; - bridge_config: BridgeConfig.Data; + bridge_id: string + bridge_addr: string + l1_chain_id: string + l1_client_id: string + bridge_config: BridgeConfig.Data } - export type Proto = BridgeInfo_pb; + export type Proto = BridgeInfo_pb } diff --git a/src/core/opchild/OpValidator.ts b/src/core/opchild/OpValidator.ts index 32e4450..637a5fb 100644 --- a/src/core/opchild/OpValidator.ts +++ b/src/core/opchild/OpValidator.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../util/json'; -import { ValAddress } from '../bech32'; -import { ValConsPublicKey } from '../PublicKey'; -import { Validator as Validator_pb } from '@initia/opinit.proto/opinit/opchild/v1/types'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { ValAddress } from '../bech32' +import { ValConsPublicKey } from '../PublicKey' +import { Validator as Validator_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class OpValidator extends JSONSerializable< OpValidator.Amino, @@ -22,47 +22,47 @@ export class OpValidator extends JSONSerializable< public consensus_pubkey: ValConsPublicKey, public cons_power: number ) { - super(); + super() } public static fromAmino(data: OpValidator.Amino): OpValidator { - const { moniker, operator_address, consensus_pubkey, cons_power } = data; + const { moniker, operator_address, consensus_pubkey, cons_power } = data return new OpValidator( moniker, operator_address, ValConsPublicKey.fromAmino(consensus_pubkey), Number.parseInt(cons_power) - ); + ) } public toAmino(): OpValidator.Amino { - const { moniker, operator_address, consensus_pubkey, cons_power } = this; + const { moniker, operator_address, consensus_pubkey, cons_power } = this return { moniker, operator_address, consensus_pubkey: consensus_pubkey.toAmino(), cons_power: cons_power.toString(), - }; + } } public static fromData(data: OpValidator.Data): OpValidator { - const { moniker, operator_address, consensus_pubkey, cons_power } = data; + const { moniker, operator_address, consensus_pubkey, cons_power } = data return new OpValidator( moniker, operator_address, ValConsPublicKey.fromData(consensus_pubkey), Number.parseInt(cons_power) - ); + ) } public toData(): OpValidator.Data { - const { moniker, operator_address, consensus_pubkey, cons_power } = this; + const { moniker, operator_address, consensus_pubkey, cons_power } = this return { moniker, operator_address, consensus_pubkey: consensus_pubkey.toData(), cons_power: cons_power.toString(), - }; + } } public static fromProto(data: OpValidator.Proto): OpValidator { @@ -71,34 +71,34 @@ export class OpValidator extends JSONSerializable< data.operatorAddress, ValConsPublicKey.unpackAny(data.consensusPubkey as Any), data.consPower.toNumber() - ); + ) } public toProto(): OpValidator.Proto { - const { moniker, operator_address, consensus_pubkey, cons_power } = this; + const { moniker, operator_address, consensus_pubkey, cons_power } = this return Validator_pb.fromPartial({ moniker, operatorAddress: operator_address, consensusPubkey: consensus_pubkey.packAny(), consPower: Long.fromNumber(cons_power), - }); + }) } } export namespace OpValidator { export interface Amino { - moniker: string; - operator_address: ValAddress; - consensus_pubkey: ValConsPublicKey.Amino; - cons_power: string; + moniker: string + operator_address: ValAddress + consensus_pubkey: ValConsPublicKey.Amino + cons_power: string } export interface Data { - moniker: string; - operator_address: ValAddress; - consensus_pubkey: ValConsPublicKey.Data; - cons_power: string; + moniker: string + operator_address: ValAddress + consensus_pubkey: ValConsPublicKey.Data + cons_power: string } - export type Proto = Validator_pb; + export type Proto = Validator_pb } diff --git a/src/core/opchild/OpchildParams.ts b/src/core/opchild/OpchildParams.ts index ccdd93b..5924618 100644 --- a/src/core/opchild/OpchildParams.ts +++ b/src/core/opchild/OpchildParams.ts @@ -1,14 +1,14 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { AccAddress } from '../bech32'; -import { Params as Params_pb } from '@initia/opinit.proto/opinit/opchild/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { AccAddress } from '../bech32' +import { Params as Params_pb } from '@initia/opinit.proto/opinit/opchild/v1/types' export class OpchildParams extends JSONSerializable< OpchildParams.Amino, OpchildParams.Data, OpchildParams.Proto > { - public min_gas_prices: Coins; + public min_gas_prices: Coins /** * @param max_validators the maximum number of validators @@ -26,8 +26,8 @@ export class OpchildParams extends JSONSerializable< public admin: AccAddress, public fee_whitelist: string[] ) { - super(); - this.min_gas_prices = new Coins(min_gas_prices); + super() + this.min_gas_prices = new Coins(min_gas_prices) } public static fromAmino(data: OpchildParams.Amino): OpchildParams { @@ -40,7 +40,7 @@ export class OpchildParams extends JSONSerializable< admin, fee_whitelist, }, - } = data; + } = data return new OpchildParams( max_validators, @@ -49,7 +49,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist - ); + ) } public toAmino(): OpchildParams.Amino { @@ -60,7 +60,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist, - } = this; + } = this return { type: 'opchild/Params', @@ -72,7 +72,7 @@ export class OpchildParams extends JSONSerializable< admin, fee_whitelist, }, - }; + } } public static fromData(data: OpchildParams.Data): OpchildParams { @@ -83,7 +83,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist, - } = data; + } = data return new OpchildParams( max_validators, @@ -92,7 +92,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist - ); + ) } public toData(): OpchildParams.Data { @@ -103,7 +103,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist, - } = this; + } = this return { '@type': '/opinit.opchild.v1.Params', @@ -113,7 +113,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist, - }; + } } public static fromProto(data: OpchildParams.Proto): OpchildParams { @@ -124,7 +124,7 @@ export class OpchildParams extends JSONSerializable< data.bridgeExecutor, data.admin, data.feeWhitelist - ); + ) } public toProto(): OpchildParams.Proto { @@ -135,7 +135,7 @@ export class OpchildParams extends JSONSerializable< bridge_executor, admin, fee_whitelist, - } = this; + } = this return Params_pb.fromPartial({ maxValidators: max_validators, @@ -144,32 +144,32 @@ export class OpchildParams extends JSONSerializable< bridgeExecutor: bridge_executor, admin, feeWhitelist: fee_whitelist, - }); + }) } } export namespace OpchildParams { export interface Amino { - type: 'opchild/Params'; + type: 'opchild/Params' value: { - max_validators: number; - historical_entries: number; - min_gas_prices: Coins.Amino; - bridge_executor: AccAddress; - admin: AccAddress; - fee_whitelist: string[]; - }; + max_validators: number + historical_entries: number + min_gas_prices: Coins.Amino + bridge_executor: AccAddress + admin: AccAddress + fee_whitelist: string[] + } } export interface Data { - '@type': '/opinit.opchild.v1.Params'; - max_validators: number; - historical_entries: number; - min_gas_prices: Coins.Data; - bridge_executor: AccAddress; - admin: AccAddress; - fee_whitelist: string[]; + '@type': '/opinit.opchild.v1.Params' + max_validators: number + historical_entries: number + min_gas_prices: Coins.Data + bridge_executor: AccAddress + admin: AccAddress + fee_whitelist: string[] } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/opchild/index.ts b/src/core/opchild/index.ts index 2a57fa4..6eb7ee0 100644 --- a/src/core/opchild/index.ts +++ b/src/core/opchild/index.ts @@ -1,4 +1,4 @@ -export * from './msgs'; -export * from './BridgeInfo'; -export * from './OpchildParams'; -export * from './OpValidator'; +export * from './msgs' +export * from './BridgeInfo' +export * from './OpchildParams' +export * from './OpValidator' diff --git a/src/core/opchild/msgs/MsgAddValidator.ts b/src/core/opchild/msgs/MsgAddValidator.ts index 0589bf9..670f82c 100644 --- a/src/core/opchild/msgs/MsgAddValidator.ts +++ b/src/core/opchild/msgs/MsgAddValidator.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { ValConsPublicKey } from '../../PublicKey'; -import { MsgAddValidator as MsgAddValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { ValConsPublicKey } from '../../PublicKey' +import { MsgAddValidator as MsgAddValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgAddValidator extends JSONSerializable< MsgAddValidator.Amino, @@ -21,24 +21,24 @@ export class MsgAddValidator extends JSONSerializable< public validator_address: ValAddress, public pubkey: ValConsPublicKey ) { - super(); + super() } public static fromAmino(data: MsgAddValidator.Amino): MsgAddValidator { const { value: { authority, moniker, validator_address, pubkey }, - } = data; + } = data return new MsgAddValidator( authority, moniker, validator_address, ValConsPublicKey.fromAmino(pubkey) - ); + ) } public toAmino(): MsgAddValidator.Amino { - const { authority, moniker, validator_address, pubkey } = this; + const { authority, moniker, validator_address, pubkey } = this return { type: 'opchild/MsgAddValidator', value: { @@ -47,28 +47,28 @@ export class MsgAddValidator extends JSONSerializable< validator_address, pubkey: pubkey.toAmino(), }, - }; + } } public static fromData(data: MsgAddValidator.Data): MsgAddValidator { - const { authority, moniker, validator_address, pubkey } = data; + const { authority, moniker, validator_address, pubkey } = data return new MsgAddValidator( authority, moniker, validator_address, ValConsPublicKey.fromData(pubkey) - ); + ) } public toData(): MsgAddValidator.Data { - const { authority, moniker, validator_address, pubkey } = this; + const { authority, moniker, validator_address, pubkey } = this return { '@type': '/opinit.opchild.v1.MsgAddValidator', authority, moniker, validator_address, pubkey: pubkey.toData(), - }; + } } public static fromProto(data: MsgAddValidator.Proto): MsgAddValidator { @@ -77,49 +77,49 @@ export class MsgAddValidator extends JSONSerializable< data.moniker, data.validatorAddress, ValConsPublicKey.unpackAny(data.pubkey as Any) - ); + ) } public toProto(): MsgAddValidator.Proto { - const { authority, moniker, validator_address, pubkey } = this; + const { authority, moniker, validator_address, pubkey } = this return MsgAddValidator_pb.fromPartial({ authority, moniker, validatorAddress: validator_address, pubkey: pubkey.packAny(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgAddValidator', value: MsgAddValidator_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgAddValidator { - return MsgAddValidator.fromProto(MsgAddValidator_pb.decode(msgAny.value)); + return MsgAddValidator.fromProto(MsgAddValidator_pb.decode(msgAny.value)) } } export namespace MsgAddValidator { export interface Amino { - type: 'opchild/MsgAddValidator'; + type: 'opchild/MsgAddValidator' value: { - authority: AccAddress; - moniker: string; - validator_address: ValAddress; - pubkey: ValConsPublicKey.Amino; - }; + authority: AccAddress + moniker: string + validator_address: ValAddress + pubkey: ValConsPublicKey.Amino + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgAddValidator'; - authority: AccAddress; - moniker: string; - validator_address: ValAddress; - pubkey: ValConsPublicKey.Data; + '@type': '/opinit.opchild.v1.MsgAddValidator' + authority: AccAddress + moniker: string + validator_address: ValAddress + pubkey: ValConsPublicKey.Data } - export type Proto = MsgAddValidator_pb; + export type Proto = MsgAddValidator_pb } diff --git a/src/core/opchild/msgs/MsgExecuteMessages.ts b/src/core/opchild/msgs/MsgExecuteMessages.ts index b37eaf7..8a1af07 100644 --- a/src/core/opchild/msgs/MsgExecuteMessages.ts +++ b/src/core/opchild/msgs/MsgExecuteMessages.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Msg } from '../../Msg'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgExecuteMessages as MsgExecuteMessages_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Msg } from '../../Msg' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgExecuteMessages as MsgExecuteMessages_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' export class MsgExecuteMessages extends JSONSerializable< MsgExecuteMessages.Amino, @@ -13,85 +13,85 @@ export class MsgExecuteMessages extends JSONSerializable< * @param sender the actor that signed the messages * @param messages the arbitrary messages to be executed */ - constructor(public sender: AccAddress, public messages: Msg[]) { - super(); + constructor( + public sender: AccAddress, + public messages: Msg[] + ) { + super() } public static fromAmino(data: MsgExecuteMessages.Amino): MsgExecuteMessages { const { value: { sender, messages }, - } = data; - return new MsgExecuteMessages(sender, messages.map(Msg.fromAmino)); + } = data + return new MsgExecuteMessages(sender, messages.map(Msg.fromAmino)) } public toAmino(): MsgExecuteMessages.Amino { - const { sender, messages } = this; + const { sender, messages } = this return { type: 'opchild/MsgExecuteMessages', value: { sender, - messages: messages.map(msg => msg.toAmino()), + messages: messages.map((msg) => msg.toAmino()), }, - }; + } } public static fromData(data: MsgExecuteMessages.Data): MsgExecuteMessages { - const { sender, messages } = data; - return new MsgExecuteMessages(sender, messages.map(Msg.fromData)); + const { sender, messages } = data + return new MsgExecuteMessages(sender, messages.map(Msg.fromData)) } public toData(): MsgExecuteMessages.Data { - const { sender, messages } = this; + const { sender, messages } = this return { '@type': '/opinit.opchild.v1.MsgExecuteMessages', sender, - messages: messages.map(msg => msg.toData()), - }; + messages: messages.map((msg) => msg.toData()), + } } public static fromProto(data: MsgExecuteMessages.Proto): MsgExecuteMessages { - return new MsgExecuteMessages( - data.sender, - data.messages.map(Msg.fromProto) - ); + return new MsgExecuteMessages(data.sender, data.messages.map(Msg.fromProto)) } public toProto(): MsgExecuteMessages.Proto { - const { sender, messages } = this; + const { sender, messages } = this return MsgExecuteMessages_pb.fromPartial({ sender, - messages: messages.map(msg => msg.packAny()), - }); + messages: messages.map((msg) => msg.packAny()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgExecuteMessages', value: MsgExecuteMessages_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgExecuteMessages { return MsgExecuteMessages.fromProto( MsgExecuteMessages_pb.decode(msgAny.value) - ); + ) } } export namespace MsgExecuteMessages { export interface Amino { - type: 'opchild/MsgExecuteMessages'; + type: 'opchild/MsgExecuteMessages' value: { - sender: AccAddress; - messages: Msg.Amino[]; - }; + sender: AccAddress + messages: Msg.Amino[] + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgExecuteMessages'; - sender: AccAddress; - messages: Msg.Data[]; + '@type': '/opinit.opchild.v1.MsgExecuteMessages' + sender: AccAddress + messages: Msg.Data[] } - export type Proto = MsgExecuteMessages_pb; + export type Proto = MsgExecuteMessages_pb } diff --git a/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts b/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts index 49ca070..5aadb67 100644 --- a/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts +++ b/src/core/opchild/msgs/MsgFinalizeTokenDeposit.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { Denom } from '../../Denom'; -import { MsgFinalizeTokenDeposit as MsgFinalizeTokenDeposit_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { Denom } from '../../Denom' +import { MsgFinalizeTokenDeposit as MsgFinalizeTokenDeposit_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgFinalizeTokenDeposit extends JSONSerializable< MsgFinalizeTokenDeposit.Amino, @@ -30,7 +30,7 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< public base_denom: Denom, public data?: string ) { - super(); + super() } public static fromAmino( @@ -38,7 +38,7 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< ): MsgFinalizeTokenDeposit { const { value: { sender, from, to, amount, sequence, height, base_denom, data }, - } = msgAmino; + } = msgAmino return new MsgFinalizeTokenDeposit( sender, from, @@ -48,12 +48,12 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< Number.parseInt(height), base_denom, data - ); + ) } public toAmino(): MsgFinalizeTokenDeposit.Amino { const { sender, from, to, amount, sequence, height, base_denom, data } = - this; + this return { type: 'opchild/MsgFinalizeTokenDeposit', value: { @@ -66,14 +66,14 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< base_denom, data, }, - }; + } } public static fromData( msgData: MsgFinalizeTokenDeposit.Data ): MsgFinalizeTokenDeposit { const { sender, from, to, amount, sequence, height, base_denom, data } = - msgData; + msgData return new MsgFinalizeTokenDeposit( sender, from, @@ -83,12 +83,12 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< Number.parseInt(height), base_denom, data - ); + ) } public toData(): MsgFinalizeTokenDeposit.Data { const { sender, from, to, amount, sequence, height, base_denom, data } = - this; + this return { '@type': '/opinit.opchild.v1.MsgFinalizeTokenDeposit', sender, @@ -99,7 +99,7 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< height: height.toString(), base_denom, data, - }; + } } public static fromProto( @@ -116,12 +116,12 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< msgProto.data.length ? Buffer.from(msgProto.data).toString('base64') : undefined - ); + ) } public toProto(): MsgFinalizeTokenDeposit.Proto { const { sender, from, to, amount, sequence, height, base_denom, data } = - this; + this return MsgFinalizeTokenDeposit_pb.fromPartial({ sender, from, @@ -131,49 +131,49 @@ export class MsgFinalizeTokenDeposit extends JSONSerializable< height: Long.fromNumber(height), baseDenom: base_denom, data: data ? Buffer.from(data, 'base64') : undefined, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgFinalizeTokenDeposit', value: MsgFinalizeTokenDeposit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgFinalizeTokenDeposit { return MsgFinalizeTokenDeposit.fromProto( MsgFinalizeTokenDeposit_pb.decode(msgAny.value) - ); + ) } } export namespace MsgFinalizeTokenDeposit { export interface Amino { - type: 'opchild/MsgFinalizeTokenDeposit'; + type: 'opchild/MsgFinalizeTokenDeposit' value: { - sender: AccAddress; - from: AccAddress; - to: AccAddress; - amount: Coin.Amino; - sequence: string; - height: string; - base_denom: Denom; - data?: string; - }; + sender: AccAddress + from: AccAddress + to: AccAddress + amount: Coin.Amino + sequence: string + height: string + base_denom: Denom + data?: string + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgFinalizeTokenDeposit'; - sender: AccAddress; - from: AccAddress; - to: AccAddress; - amount: Coin.Data; - sequence: string; - height: string; - base_denom: Denom; - data?: string; + '@type': '/opinit.opchild.v1.MsgFinalizeTokenDeposit' + sender: AccAddress + from: AccAddress + to: AccAddress + amount: Coin.Data + sequence: string + height: string + base_denom: Denom + data?: string } - export type Proto = MsgFinalizeTokenDeposit_pb; + export type Proto = MsgFinalizeTokenDeposit_pb } diff --git a/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts b/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts index 1c538c0..32075b6 100644 --- a/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts +++ b/src/core/opchild/msgs/MsgInitiateTokenWithdrawal.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { MsgInitiateTokenWithdrawal as MsgInitiateTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { MsgInitiateTokenWithdrawal as MsgInitiateTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgInitiateTokenWithdrawal extends JSONSerializable< MsgInitiateTokenWithdrawal.Amino, @@ -19,7 +19,7 @@ export class MsgInitiateTokenWithdrawal extends JSONSerializable< public to: AccAddress, public amount: Coin ) { - super(); + super() } public static fromAmino( @@ -27,12 +27,12 @@ export class MsgInitiateTokenWithdrawal extends JSONSerializable< ): MsgInitiateTokenWithdrawal { const { value: { sender, to, amount }, - } = data; - return new MsgInitiateTokenWithdrawal(sender, to, Coin.fromAmino(amount)); + } = data + return new MsgInitiateTokenWithdrawal(sender, to, Coin.fromAmino(amount)) } public toAmino(): MsgInitiateTokenWithdrawal.Amino { - const { sender, to, amount } = this; + const { sender, to, amount } = this return { type: 'opchild/MsgInitiateTokenWithdrawal', value: { @@ -40,24 +40,24 @@ export class MsgInitiateTokenWithdrawal extends JSONSerializable< to, amount: amount.toAmino(), }, - }; + } } public static fromData( data: MsgInitiateTokenWithdrawal.Data ): MsgInitiateTokenWithdrawal { - const { sender, to, amount } = data; - return new MsgInitiateTokenWithdrawal(sender, to, Coin.fromData(amount)); + const { sender, to, amount } = data + return new MsgInitiateTokenWithdrawal(sender, to, Coin.fromData(amount)) } public toData(): MsgInitiateTokenWithdrawal.Data { - const { sender, to, amount } = this; + const { sender, to, amount } = this return { '@type': '/opinit.opchild.v1.MsgInitiateTokenWithdrawal', sender, to, amount: amount.toData(), - }; + } } public static fromProto( @@ -67,48 +67,48 @@ export class MsgInitiateTokenWithdrawal extends JSONSerializable< data.sender, data.to, Coin.fromProto(data.amount as Coin) - ); + ) } public toProto(): MsgInitiateTokenWithdrawal.Proto { - const { sender, to, amount } = this; + const { sender, to, amount } = this return MsgInitiateTokenWithdrawal_pb.fromPartial({ sender, to, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgInitiateTokenWithdrawal', value: MsgInitiateTokenWithdrawal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgInitiateTokenWithdrawal { return MsgInitiateTokenWithdrawal.fromProto( MsgInitiateTokenWithdrawal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgInitiateTokenWithdrawal { export interface Amino { - type: 'opchild/MsgInitiateTokenWithdrawal'; + type: 'opchild/MsgInitiateTokenWithdrawal' value: { - sender: AccAddress; - to: AccAddress; - amount: Coin.Amino; - }; + sender: AccAddress + to: AccAddress + amount: Coin.Amino + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgInitiateTokenWithdrawal'; - sender: AccAddress; - to: AccAddress; - amount: Coin.Data; + '@type': '/opinit.opchild.v1.MsgInitiateTokenWithdrawal' + sender: AccAddress + to: AccAddress + amount: Coin.Data } - export type Proto = MsgInitiateTokenWithdrawal_pb; + export type Proto = MsgInitiateTokenWithdrawal_pb } diff --git a/src/core/opchild/msgs/MsgRemoveValidator.ts b/src/core/opchild/msgs/MsgRemoveValidator.ts index 9b40790..34e6923 100644 --- a/src/core/opchild/msgs/MsgRemoveValidator.ts +++ b/src/core/opchild/msgs/MsgRemoveValidator.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress, ValAddress } from '../../bech32'; -import { MsgRemoveValidator as MsgRemoveValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress, ValAddress } from '../../bech32' +import { MsgRemoveValidator as MsgRemoveValidator_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgRemoveValidator extends JSONSerializable< MsgRemoveValidator.Amino, @@ -16,81 +16,81 @@ export class MsgRemoveValidator extends JSONSerializable< public authority: AccAddress, public validator_address: ValAddress ) { - super(); + super() } public static fromAmino(data: MsgRemoveValidator.Amino): MsgRemoveValidator { const { value: { authority, validator_address }, - } = data; - return new MsgRemoveValidator(authority, validator_address); + } = data + return new MsgRemoveValidator(authority, validator_address) } public toAmino(): MsgRemoveValidator.Amino { - const { authority, validator_address } = this; + const { authority, validator_address } = this return { type: 'opchild/MsgRemoveValidator', value: { authority, validator_address, }, - }; + } } public static fromData(data: MsgRemoveValidator.Data): MsgRemoveValidator { - const { authority, validator_address } = data; - return new MsgRemoveValidator(authority, validator_address); + const { authority, validator_address } = data + return new MsgRemoveValidator(authority, validator_address) } public toData(): MsgRemoveValidator.Data { - const { authority, validator_address } = this; + const { authority, validator_address } = this return { '@type': '/opinit.opchild.v1.MsgRemoveValidator', authority, validator_address, - }; + } } public static fromProto(data: MsgRemoveValidator.Proto): MsgRemoveValidator { - return new MsgRemoveValidator(data.authority, data.validatorAddress); + return new MsgRemoveValidator(data.authority, data.validatorAddress) } public toProto(): MsgRemoveValidator.Proto { - const { authority, validator_address } = this; + const { authority, validator_address } = this return MsgRemoveValidator_pb.fromPartial({ authority, validatorAddress: validator_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgRemoveValidator', value: MsgRemoveValidator_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRemoveValidator { return MsgRemoveValidator.fromProto( MsgRemoveValidator_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRemoveValidator { export interface Amino { - type: 'opchild/MsgRemoveValidator'; + type: 'opchild/MsgRemoveValidator' value: { - authority: AccAddress; - validator_address: ValAddress; - }; + authority: AccAddress + validator_address: ValAddress + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgRemoveValidator'; - authority: AccAddress; - validator_address: ValAddress; + '@type': '/opinit.opchild.v1.MsgRemoveValidator' + authority: AccAddress + validator_address: ValAddress } - export type Proto = MsgRemoveValidator_pb; + export type Proto = MsgRemoveValidator_pb } diff --git a/src/core/opchild/msgs/MsgSetBridgeInfo.ts b/src/core/opchild/msgs/MsgSetBridgeInfo.ts index 3c7a5fa..9aab80e 100644 --- a/src/core/opchild/msgs/MsgSetBridgeInfo.ts +++ b/src/core/opchild/msgs/MsgSetBridgeInfo.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { BridgeInfo } from '../BridgeInfo'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetBridgeInfo as MsgSetBridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { BridgeInfo } from '../BridgeInfo' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetBridgeInfo as MsgSetBridgeInfo_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' export class MsgSetBridgeInfo extends JSONSerializable< MsgSetBridgeInfo.Amino, @@ -13,83 +13,86 @@ export class MsgSetBridgeInfo extends JSONSerializable< * @param sender the sender address * @param bridge_info the bridge information to be set */ - constructor(public sender: AccAddress, public bridge_info: BridgeInfo) { - super(); + constructor( + public sender: AccAddress, + public bridge_info: BridgeInfo + ) { + super() } public static fromAmino(data: MsgSetBridgeInfo.Amino): MsgSetBridgeInfo { const { value: { sender, bridge_info }, - } = data; - return new MsgSetBridgeInfo(sender, BridgeInfo.fromAmino(bridge_info)); + } = data + return new MsgSetBridgeInfo(sender, BridgeInfo.fromAmino(bridge_info)) } public toAmino(): MsgSetBridgeInfo.Amino { - const { sender, bridge_info } = this; + const { sender, bridge_info } = this return { type: 'opchild/MsgSetBridgeInfo', value: { sender, bridge_info: bridge_info.toAmino(), }, - }; + } } public static fromData(data: MsgSetBridgeInfo.Data): MsgSetBridgeInfo { - const { sender, bridge_info } = data; - return new MsgSetBridgeInfo(sender, BridgeInfo.fromData(bridge_info)); + const { sender, bridge_info } = data + return new MsgSetBridgeInfo(sender, BridgeInfo.fromData(bridge_info)) } public toData(): MsgSetBridgeInfo.Data { - const { sender, bridge_info } = this; + const { sender, bridge_info } = this return { '@type': '/opinit.opchild.v1.MsgSetBridgeInfo', sender, bridge_info: bridge_info.toData(), - }; + } } public static fromProto(data: MsgSetBridgeInfo.Proto): MsgSetBridgeInfo { return new MsgSetBridgeInfo( data.sender, BridgeInfo.fromProto(data.bridgeInfo as BridgeInfo.Proto) - ); + ) } public toProto(): MsgSetBridgeInfo.Proto { - const { sender, bridge_info } = this; + const { sender, bridge_info } = this return MsgSetBridgeInfo_pb.fromPartial({ sender, bridgeInfo: bridge_info.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgSetBridgeInfo', value: MsgSetBridgeInfo_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetBridgeInfo { - return MsgSetBridgeInfo.fromProto(MsgSetBridgeInfo_pb.decode(msgAny.value)); + return MsgSetBridgeInfo.fromProto(MsgSetBridgeInfo_pb.decode(msgAny.value)) } } export namespace MsgSetBridgeInfo { export interface Amino { - type: 'opchild/MsgSetBridgeInfo'; + type: 'opchild/MsgSetBridgeInfo' value: { - sender: AccAddress; - bridge_info: BridgeInfo.Amino; - }; + sender: AccAddress + bridge_info: BridgeInfo.Amino + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgSetBridgeInfo'; - sender: AccAddress; - bridge_info: BridgeInfo.Data; + '@type': '/opinit.opchild.v1.MsgSetBridgeInfo' + sender: AccAddress + bridge_info: BridgeInfo.Data } - export type Proto = MsgSetBridgeInfo_pb; + export type Proto = MsgSetBridgeInfo_pb } diff --git a/src/core/opchild/msgs/MsgSpendFeePool.ts b/src/core/opchild/msgs/MsgSpendFeePool.ts index 0341157..8ecda5f 100644 --- a/src/core/opchild/msgs/MsgSpendFeePool.ts +++ b/src/core/opchild/msgs/MsgSpendFeePool.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coins } from '../../Coins'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSpendFeePool as MsgSpendFeePool_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coins } from '../../Coins' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSpendFeePool as MsgSpendFeePool_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' export class MsgSpendFeePool extends JSONSerializable< MsgSpendFeePool.Amino, MsgSpendFeePool.Data, MsgSpendFeePool.Proto > { - public amount: Coins; + public amount: Coins /** * @param authority the address that controls the module @@ -21,19 +21,19 @@ export class MsgSpendFeePool extends JSONSerializable< public recipient: AccAddress, amount: Coins.Input ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: MsgSpendFeePool.Amino): MsgSpendFeePool { const { value: { authority, recipient, amount }, - } = data; - return new MsgSpendFeePool(authority, recipient, Coins.fromAmino(amount)); + } = data + return new MsgSpendFeePool(authority, recipient, Coins.fromAmino(amount)) } public toAmino(): MsgSpendFeePool.Amino { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return { type: 'opchild/MsgSpendFeePool', value: { @@ -41,22 +41,22 @@ export class MsgSpendFeePool extends JSONSerializable< recipient, amount: amount.toAmino(), }, - }; + } } public static fromData(data: MsgSpendFeePool.Data): MsgSpendFeePool { - const { authority, recipient, amount } = data; - return new MsgSpendFeePool(authority, recipient, Coins.fromData(amount)); + const { authority, recipient, amount } = data + return new MsgSpendFeePool(authority, recipient, Coins.fromData(amount)) } public toData(): MsgSpendFeePool.Data { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return { '@type': '/opinit.opchild.v1.MsgSpendFeePool', authority, recipient, amount: amount.toData(), - }; + } } public static fromProto(data: MsgSpendFeePool.Proto): MsgSpendFeePool { @@ -64,46 +64,46 @@ export class MsgSpendFeePool extends JSONSerializable< data.authority, data.recipient, Coins.fromProto(data.amount) - ); + ) } public toProto(): MsgSpendFeePool.Proto { - const { authority, recipient, amount } = this; + const { authority, recipient, amount } = this return MsgSpendFeePool_pb.fromPartial({ authority, recipient, amount: amount.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgSpendFeePool', value: MsgSpendFeePool_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSpendFeePool { - return MsgSpendFeePool.fromProto(MsgSpendFeePool_pb.decode(msgAny.value)); + return MsgSpendFeePool.fromProto(MsgSpendFeePool_pb.decode(msgAny.value)) } } export namespace MsgSpendFeePool { export interface Amino { - type: 'opchild/MsgSpendFeePool'; + type: 'opchild/MsgSpendFeePool' value: { - authority: AccAddress; - recipient: AccAddress; - amount: Coins.Amino; - }; + authority: AccAddress + recipient: AccAddress + amount: Coins.Amino + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgSpendFeePool'; - authority: AccAddress; - recipient: AccAddress; - amount: Coins.Data; + '@type': '/opinit.opchild.v1.MsgSpendFeePool' + authority: AccAddress + recipient: AccAddress + amount: Coins.Data } - export type Proto = MsgSpendFeePool_pb; + export type Proto = MsgSpendFeePool_pb } diff --git a/src/core/opchild/msgs/MsgUpdateOpchildParams.ts b/src/core/opchild/msgs/MsgUpdateOpchildParams.ts index 058ee7e..3d7c1a2 100644 --- a/src/core/opchild/msgs/MsgUpdateOpchildParams.ts +++ b/src/core/opchild/msgs/MsgUpdateOpchildParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { OpchildParams } from '../OpchildParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { OpchildParams } from '../OpchildParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' export class MsgUpdateOpchildParams extends JSONSerializable< MsgUpdateOpchildParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateOpchildParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/move parameters to update */ - constructor(public authority: AccAddress, public params: OpchildParams) { - super(); + constructor( + public authority: AccAddress, + public params: OpchildParams + ) { + super() } public static fromAmino( @@ -22,41 +25,38 @@ export class MsgUpdateOpchildParams extends JSONSerializable< ): MsgUpdateOpchildParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateOpchildParams( authority, OpchildParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateOpchildParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'opchild/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateOpchildParams.Data ): MsgUpdateOpchildParams { - const { authority, params } = data; - return new MsgUpdateOpchildParams( - authority, - OpchildParams.fromData(params) - ); + const { authority, params } = data + return new MsgUpdateOpchildParams(authority, OpchildParams.fromData(params)) } public toData(): MsgUpdateOpchildParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/opinit.opchild.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +65,45 @@ export class MsgUpdateOpchildParams extends JSONSerializable< return new MsgUpdateOpchildParams( data.authority, OpchildParams.fromProto(data.params as OpchildParams.Proto) - ); + ) } public toProto(): MsgUpdateOpchildParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateOpchildParams { return MsgUpdateOpchildParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateOpchildParams { export interface Amino { - type: 'opchild/MsgUpdateParams'; + type: 'opchild/MsgUpdateParams' value: { - authority: AccAddress; - params: OpchildParams.Amino; - }; + authority: AccAddress + params: OpchildParams.Amino + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgUpdateParams'; - authority: AccAddress; - params: OpchildParams.Data; + '@type': '/opinit.opchild.v1.MsgUpdateParams' + authority: AccAddress + params: OpchildParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/opchild/msgs/MsgUpdateOracle.ts b/src/core/opchild/msgs/MsgUpdateOracle.ts index 31a51f4..275eaf9 100644 --- a/src/core/opchild/msgs/MsgUpdateOracle.ts +++ b/src/core/opchild/msgs/MsgUpdateOracle.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgUpdateOracle as MsgUpdateOracle_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgUpdateOracle as MsgUpdateOracle_pb } from '@initia/opinit.proto/opinit/opchild/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgUpdateOracle extends JSONSerializable< MsgUpdateOracle.Amino, @@ -19,7 +19,7 @@ export class MsgUpdateOracle extends JSONSerializable< public height: number, public data: string ) { - super(); + super() } public static fromAmino(data: MsgUpdateOracle.Amino): MsgUpdateOracle { @@ -27,11 +27,11 @@ export class MsgUpdateOracle extends JSONSerializable< data.value.sender, Number.parseInt(data.value.height), data.value.data - ); + ) } public toAmino(): MsgUpdateOracle.Amino { - const { sender, height, data } = this; + const { sender, height, data } = this return { type: 'opchild/MsgUpdateOracle', value: { @@ -39,7 +39,7 @@ export class MsgUpdateOracle extends JSONSerializable< height: height.toString(), data, }, - }; + } } public static fromData(data: MsgUpdateOracle.Data): MsgUpdateOracle { @@ -47,17 +47,17 @@ export class MsgUpdateOracle extends JSONSerializable< data.sender, Number.parseInt(data.height), data.data - ); + ) } public toData(): MsgUpdateOracle.Data { - const { sender, height, data } = this; + const { sender, height, data } = this return { '@type': '/opinit.opchild.v1.MsgUpdateOracle', sender, height: height.toString(), data, - }; + } } public static fromProto(data: MsgUpdateOracle.Proto): MsgUpdateOracle { @@ -65,46 +65,46 @@ export class MsgUpdateOracle extends JSONSerializable< data.sender, data.height.toNumber(), Buffer.from(data.data).toString('base64') - ); + ) } public toProto(): MsgUpdateOracle.Proto { - const { sender, height, data } = this; + const { sender, height, data } = this return MsgUpdateOracle_pb.fromPartial({ sender, height: Long.fromNumber(height), data: Buffer.from(data, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.opchild.v1.MsgUpdateOracle', value: MsgUpdateOracle_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateOracle { - return MsgUpdateOracle.fromProto(MsgUpdateOracle_pb.decode(msgAny.value)); + return MsgUpdateOracle.fromProto(MsgUpdateOracle_pb.decode(msgAny.value)) } } export namespace MsgUpdateOracle { export interface Amino { - type: 'opchild/MsgUpdateOracle'; + type: 'opchild/MsgUpdateOracle' value: { - sender: AccAddress; - height: string; - data: string; - }; + sender: AccAddress + height: string + data: string + } } export interface Data { - '@type': '/opinit.opchild.v1.MsgUpdateOracle'; - sender: AccAddress; - height: string; - data: string; + '@type': '/opinit.opchild.v1.MsgUpdateOracle' + sender: AccAddress + height: string + data: string } - export type Proto = MsgUpdateOracle_pb; + export type Proto = MsgUpdateOracle_pb } diff --git a/src/core/opchild/msgs/index.ts b/src/core/opchild/msgs/index.ts index 75c8bf6..85ac8ef 100644 --- a/src/core/opchild/msgs/index.ts +++ b/src/core/opchild/msgs/index.ts @@ -1,22 +1,22 @@ -import { MsgAddValidator } from './MsgAddValidator'; -import { MsgRemoveValidator } from './MsgRemoveValidator'; -import { MsgFinalizeTokenDeposit } from './MsgFinalizeTokenDeposit'; -import { MsgInitiateTokenWithdrawal } from './MsgInitiateTokenWithdrawal'; -import { MsgExecuteMessages } from './MsgExecuteMessages'; -import { MsgSpendFeePool } from './MsgSpendFeePool'; -import { MsgSetBridgeInfo } from './MsgSetBridgeInfo'; -import { MsgUpdateOracle } from './MsgUpdateOracle'; -import { MsgUpdateOpchildParams } from './MsgUpdateOpchildParams'; +import { MsgAddValidator } from './MsgAddValidator' +import { MsgRemoveValidator } from './MsgRemoveValidator' +import { MsgFinalizeTokenDeposit } from './MsgFinalizeTokenDeposit' +import { MsgInitiateTokenWithdrawal } from './MsgInitiateTokenWithdrawal' +import { MsgExecuteMessages } from './MsgExecuteMessages' +import { MsgSpendFeePool } from './MsgSpendFeePool' +import { MsgSetBridgeInfo } from './MsgSetBridgeInfo' +import { MsgUpdateOracle } from './MsgUpdateOracle' +import { MsgUpdateOpchildParams } from './MsgUpdateOpchildParams' -export * from './MsgAddValidator'; -export * from './MsgRemoveValidator'; -export * from './MsgFinalizeTokenDeposit'; -export * from './MsgInitiateTokenWithdrawal'; -export * from './MsgExecuteMessages'; -export * from './MsgSpendFeePool'; -export * from './MsgSetBridgeInfo'; -export * from './MsgUpdateOracle'; -export * from './MsgUpdateOpchildParams'; +export * from './MsgAddValidator' +export * from './MsgRemoveValidator' +export * from './MsgFinalizeTokenDeposit' +export * from './MsgInitiateTokenWithdrawal' +export * from './MsgExecuteMessages' +export * from './MsgSpendFeePool' +export * from './MsgSetBridgeInfo' +export * from './MsgUpdateOracle' +export * from './MsgUpdateOpchildParams' export type OpchildMsg = | MsgAddValidator @@ -27,7 +27,7 @@ export type OpchildMsg = | MsgSpendFeePool | MsgSetBridgeInfo | MsgUpdateOracle - | MsgUpdateOpchildParams; + | MsgUpdateOpchildParams export namespace OpchildMsg { export type Amino = @@ -39,7 +39,7 @@ export namespace OpchildMsg { | MsgSpendFeePool.Amino | MsgSetBridgeInfo.Amino | MsgUpdateOracle.Amino - | MsgUpdateOpchildParams.Amino; + | MsgUpdateOpchildParams.Amino export type Data = | MsgAddValidator.Data @@ -50,7 +50,7 @@ export namespace OpchildMsg { | MsgSpendFeePool.Data | MsgSetBridgeInfo.Data | MsgUpdateOracle.Data - | MsgUpdateOpchildParams.Data; + | MsgUpdateOpchildParams.Data export type Proto = | MsgAddValidator.Proto @@ -61,5 +61,5 @@ export namespace OpchildMsg { | MsgSpendFeePool.Proto | MsgSetBridgeInfo.Proto | MsgUpdateOracle.Proto - | MsgUpdateOpchildParams.Proto; + | MsgUpdateOpchildParams.Proto } diff --git a/src/core/ophost/BatchInfo.ts b/src/core/ophost/BatchInfo.ts index ac0091d..012222a 100644 --- a/src/core/ophost/BatchInfo.ts +++ b/src/core/ophost/BatchInfo.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { BatchInfo as BatchInfo_pb } from '@initia/opinit.proto/opinit/ophost/v1/types'; +import { JSONSerializable } from '../../util/json' +import { BatchInfo as BatchInfo_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' export class BatchInfo extends JSONSerializable< BatchInfo.Amino, @@ -10,53 +10,56 @@ export class BatchInfo extends JSONSerializable< * @param submitter the address of the batch submitter * @param chain the target chain */ - constructor(public submitter: string, public chain: string) { - super(); + constructor( + public submitter: string, + public chain: string + ) { + super() } public static fromAmino(data: BatchInfo.Amino): BatchInfo { - const { submitter, chain } = data; - return new BatchInfo(submitter, chain); + const { submitter, chain } = data + return new BatchInfo(submitter, chain) } public toAmino(): BatchInfo.Amino { - const { submitter, chain } = this; - return { submitter, chain }; + const { submitter, chain } = this + return { submitter, chain } } public static fromData(data: BatchInfo.Data): BatchInfo { - const { submitter, chain } = data; - return new BatchInfo(submitter, chain); + const { submitter, chain } = data + return new BatchInfo(submitter, chain) } public toData(): BatchInfo.Data { - const { submitter, chain } = this; - return { submitter, chain }; + const { submitter, chain } = this + return { submitter, chain } } public static fromProto(data: BatchInfo.Proto): BatchInfo { - return new BatchInfo(data.submitter, data.chain); + return new BatchInfo(data.submitter, data.chain) } public toProto(): BatchInfo.Proto { - const { submitter, chain } = this; + const { submitter, chain } = this return BatchInfo_pb.fromPartial({ submitter, chain, - }); + }) } } export namespace BatchInfo { export interface Amino { - submitter: string; - chain: string; + submitter: string + chain: string } export interface Data { - submitter: string; - chain: string; + submitter: string + chain: string } - export type Proto = BatchInfo_pb; + export type Proto = BatchInfo_pb } diff --git a/src/core/ophost/BridgeConfig.ts b/src/core/ophost/BridgeConfig.ts index 480191d..e4215fb 100644 --- a/src/core/ophost/BridgeConfig.ts +++ b/src/core/ophost/BridgeConfig.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; -import { Duration } from '../Duration'; -import { BridgeConfig as BridgeConfig_pb } from '@initia/opinit.proto/opinit/ophost/v1/types'; -import { BatchInfo } from './BatchInfo'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' +import { Duration } from '../Duration' +import { BridgeConfig as BridgeConfig_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' +import { BatchInfo } from './BatchInfo' export class BridgeConfig extends JSONSerializable< BridgeConfig.Amino, @@ -27,7 +27,7 @@ export class BridgeConfig extends JSONSerializable< public submission_start_time: Date, public metadata?: string ) { - super(); + super() } public static fromAmino(data: BridgeConfig.Amino): BridgeConfig { @@ -39,7 +39,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period, submission_start_time, metadata, - } = data; + } = data return new BridgeConfig( challenger, @@ -49,7 +49,7 @@ export class BridgeConfig extends JSONSerializable< Duration.fromAmino(finalization_period), new Date(submission_start_time), metadata - ); + ) } public toAmino(): BridgeConfig.Amino { @@ -61,7 +61,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period, submission_start_time, metadata, - } = this; + } = this return { challenger, @@ -71,7 +71,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period: finalization_period.toAmino(), submission_start_time: submission_start_time.toISOString(), metadata, - }; + } } public static fromData(data: BridgeConfig.Data): BridgeConfig { @@ -83,7 +83,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period, submission_start_time, metadata, - } = data; + } = data return new BridgeConfig( challenger, @@ -93,7 +93,7 @@ export class BridgeConfig extends JSONSerializable< Duration.fromData(finalization_period), new Date(submission_start_time), metadata - ); + ) } public toData(): BridgeConfig.Data { @@ -105,7 +105,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period, submission_start_time, metadata, - } = this; + } = this return { challenger, @@ -115,7 +115,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period: finalization_period.toData(), submission_start_time: submission_start_time.toISOString(), metadata, - }; + } } public static fromProto(data: BridgeConfig.Proto): BridgeConfig { @@ -127,7 +127,7 @@ export class BridgeConfig extends JSONSerializable< Duration.fromProto(data.finalizationPeriod as Duration.Proto), data.submissionStartTime as Date, Buffer.from(data.metadata).toString('base64') - ); + ) } public toProto(): BridgeConfig.Proto { @@ -139,7 +139,7 @@ export class BridgeConfig extends JSONSerializable< finalization_period, submission_start_time, metadata, - } = this; + } = this return BridgeConfig_pb.fromPartial({ challenger, @@ -149,30 +149,30 @@ export class BridgeConfig extends JSONSerializable< finalizationPeriod: finalization_period.toProto(), submissionStartTime: submission_start_time, metadata: metadata ? Buffer.from(metadata, 'base64') : undefined, - }); + }) } } export namespace BridgeConfig { export interface Amino { - challenger: AccAddress; - proposer: AccAddress; - batch_info: BatchInfo.Amino; - submission_interval: Duration.Amino; - finalization_period: Duration.Amino; - submission_start_time: string; - metadata?: string; + challenger: AccAddress + proposer: AccAddress + batch_info: BatchInfo.Amino + submission_interval: Duration.Amino + finalization_period: Duration.Amino + submission_start_time: string + metadata?: string } export interface Data { - challenger: AccAddress; - proposer: AccAddress; - batch_info: BatchInfo.Data; - submission_interval: Duration.Data; - finalization_period: Duration.Data; - submission_start_time: string; - metadata?: string; + challenger: AccAddress + proposer: AccAddress + batch_info: BatchInfo.Data + submission_interval: Duration.Data + finalization_period: Duration.Data + submission_start_time: string + metadata?: string } - export type Proto = BridgeConfig_pb; + export type Proto = BridgeConfig_pb } diff --git a/src/core/ophost/OphostParams.ts b/src/core/ophost/OphostParams.ts index c9ce6c0..76d7baa 100644 --- a/src/core/ophost/OphostParams.ts +++ b/src/core/ophost/OphostParams.ts @@ -1,24 +1,24 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { Params as Params_pb } from '@initia/opinit.proto/opinit/ophost/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { Params as Params_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' export class OphostParams extends JSONSerializable< OphostParams.Amino, OphostParams.Data, OphostParams.Proto > { - public registration_fee: Coins; + public registration_fee: Coins /** * @param registration_fee the amount to be paid by l2 creator */ constructor(registration_fee: Coins.Input) { - super(); - this.registration_fee = new Coins(registration_fee); + super() + this.registration_fee = new Coins(registration_fee) } public static fromAmino(data: OphostParams.Amino): OphostParams { - return new OphostParams(Coins.fromAmino(data.value.registration_fee)); + return new OphostParams(Coins.fromAmino(data.value.registration_fee)) } public toAmino(): OphostParams.Amino { @@ -27,43 +27,43 @@ export class OphostParams extends JSONSerializable< value: { registration_fee: this.registration_fee.toAmino(), }, - }; + } } public static fromData(data: OphostParams.Data): OphostParams { - return new OphostParams(Coins.fromData(data.registration_fee)); + return new OphostParams(Coins.fromData(data.registration_fee)) } public toData(): OphostParams.Data { return { '@type': '/opinit.ophost.v1.Params', registration_fee: this.registration_fee.toData(), - }; + } } public static fromProto(data: OphostParams.Proto): OphostParams { - return new OphostParams(Coins.fromProto(data.registrationFee)); + return new OphostParams(Coins.fromProto(data.registrationFee)) } public toProto(): OphostParams.Proto { return Params_pb.fromPartial({ registrationFee: this.registration_fee.toProto(), - }); + }) } } export namespace OphostParams { export interface Amino { - type: 'ophost/Params'; + type: 'ophost/Params' value: { - registration_fee: Coins.Amino; - }; + registration_fee: Coins.Amino + } } export interface Data { - '@type': '/opinit.ophost.v1.Params'; - registration_fee: Coins.Data; + '@type': '/opinit.ophost.v1.Params' + registration_fee: Coins.Data } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/ophost/Output.ts b/src/core/ophost/Output.ts index 095e045..eba1cf7 100644 --- a/src/core/ophost/Output.ts +++ b/src/core/ophost/Output.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Output as Output_pb } from '@initia/opinit.proto/opinit/ophost/v1/types'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Output as Output_pb } from '@initia/opinit.proto/opinit/ophost/v1/types' +import Long from 'long' export class Output extends JSONSerializable< Output.Amino, @@ -17,43 +17,43 @@ export class Output extends JSONSerializable< public l1_block_time: Date, public l2_block_number: number ) { - super(); + super() } public static fromAmino(data: Output.Amino): Output { - const { output_root, l1_block_time, l2_block_number } = data; + const { output_root, l1_block_time, l2_block_number } = data return new Output( output_root, new Date(l1_block_time), Number.parseInt(l2_block_number) - ); + ) } public toAmino(): Output.Amino { - const { output_root, l1_block_time, l2_block_number } = this; + const { output_root, l1_block_time, l2_block_number } = this return { output_root, l1_block_time: l1_block_time.toISOString(), l2_block_number: l2_block_number.toString(), - }; + } } public static fromData(data: Output.Data): Output { - const { output_root, l1_block_time, l2_block_number } = data; + const { output_root, l1_block_time, l2_block_number } = data return new Output( output_root, new Date(l1_block_time), Number.parseInt(l2_block_number) - ); + ) } public toData(): Output.Data { - const { output_root, l1_block_time, l2_block_number } = this; + const { output_root, l1_block_time, l2_block_number } = this return { output_root, l1_block_time: l1_block_time.toISOString(), l2_block_number: l2_block_number.toString(), - }; + } } public static fromProto(data: Output.Proto): Output { @@ -61,31 +61,31 @@ export class Output extends JSONSerializable< Buffer.from(data.outputRoot).toString('base64'), data.l1BlockTime as Date, data.l2BlockNumber.toNumber() - ); + ) } public toProto(): Output.Proto { - const { output_root, l1_block_time, l2_block_number } = this; + const { output_root, l1_block_time, l2_block_number } = this return Output_pb.fromPartial({ outputRoot: Buffer.from(output_root, 'base64'), l1BlockTime: l1_block_time, l2BlockNumber: Long.fromNumber(l2_block_number), - }); + }) } } export namespace Output { export interface Amino { - output_root: string; - l1_block_time: string; - l2_block_number: string; + output_root: string + l1_block_time: string + l2_block_number: string } export interface Data { - output_root: string; - l1_block_time: string; - l2_block_number: string; + output_root: string + l1_block_time: string + l2_block_number: string } - export type Proto = Output_pb; + export type Proto = Output_pb } diff --git a/src/core/ophost/index.ts b/src/core/ophost/index.ts index 042c398..543c1f6 100644 --- a/src/core/ophost/index.ts +++ b/src/core/ophost/index.ts @@ -1,5 +1,5 @@ -export * from './msgs'; -export * from './BatchInfo'; -export * from './BridgeConfig'; -export * from './OphostParams'; -export * from './Output'; +export * from './msgs' +export * from './BatchInfo' +export * from './BridgeConfig' +export * from './OphostParams' +export * from './Output' diff --git a/src/core/ophost/msgs/MsgCreateBridge.ts b/src/core/ophost/msgs/MsgCreateBridge.ts index 5141f05..e242e88 100644 --- a/src/core/ophost/msgs/MsgCreateBridge.ts +++ b/src/core/ophost/msgs/MsgCreateBridge.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { BridgeConfig } from '../BridgeConfig'; -import { MsgCreateBridge as MsgCreateBridge_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { BridgeConfig } from '../BridgeConfig' +import { MsgCreateBridge as MsgCreateBridge_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MsgCreateBridge extends JSONSerializable< MsgCreateBridge.Amino, @@ -13,84 +13,87 @@ export class MsgCreateBridge extends JSONSerializable< * @param creator * @param config */ - constructor(public creator: AccAddress, public config: BridgeConfig) { - super(); + constructor( + public creator: AccAddress, + public config: BridgeConfig + ) { + super() } public static fromAmino(data: MsgCreateBridge.Amino): MsgCreateBridge { const { value: { creator, config }, - } = data; + } = data - return new MsgCreateBridge(creator, BridgeConfig.fromAmino(config)); + return new MsgCreateBridge(creator, BridgeConfig.fromAmino(config)) } public toAmino(): MsgCreateBridge.Amino { - const { creator, config } = this; + const { creator, config } = this return { type: 'ophost/MsgCreateBridge', value: { creator, config: config.toAmino(), }, - }; + } } public static fromData(data: MsgCreateBridge.Data): MsgCreateBridge { - const { creator, config } = data; - return new MsgCreateBridge(creator, BridgeConfig.fromData(config)); + const { creator, config } = data + return new MsgCreateBridge(creator, BridgeConfig.fromData(config)) } public toData(): MsgCreateBridge.Data { - const { creator, config } = this; + const { creator, config } = this return { '@type': '/opinit.ophost.v1.MsgCreateBridge', creator, config: config.toData(), - }; + } } public static fromProto(data: MsgCreateBridge.Proto): MsgCreateBridge { return new MsgCreateBridge( data.creator, BridgeConfig.fromProto(data.config as BridgeConfig.Proto) - ); + ) } public toProto(): MsgCreateBridge.Proto { - const { creator, config } = this; + const { creator, config } = this return MsgCreateBridge_pb.fromPartial({ creator, config: config.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgCreateBridge', value: MsgCreateBridge_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateBridge { - return MsgCreateBridge.fromProto(MsgCreateBridge_pb.decode(msgAny.value)); + return MsgCreateBridge.fromProto(MsgCreateBridge_pb.decode(msgAny.value)) } } export namespace MsgCreateBridge { export interface Amino { - type: 'ophost/MsgCreateBridge'; + type: 'ophost/MsgCreateBridge' value: { - creator: AccAddress; - config: BridgeConfig.Amino; - }; + creator: AccAddress + config: BridgeConfig.Amino + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgCreateBridge'; - creator: AccAddress; - config: BridgeConfig.Data; + '@type': '/opinit.ophost.v1.MsgCreateBridge' + creator: AccAddress + config: BridgeConfig.Data } - export type Proto = MsgCreateBridge_pb; + export type Proto = MsgCreateBridge_pb } diff --git a/src/core/ophost/msgs/MsgDeleteOutput.ts b/src/core/ophost/msgs/MsgDeleteOutput.ts index 2967387..0290bd9 100644 --- a/src/core/ophost/msgs/MsgDeleteOutput.ts +++ b/src/core/ophost/msgs/MsgDeleteOutput.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgDeleteOutput as MsgDeleteOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgDeleteOutput as MsgDeleteOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgDeleteOutput extends JSONSerializable< MsgDeleteOutput.Amino, @@ -19,22 +19,22 @@ export class MsgDeleteOutput extends JSONSerializable< public bridge_id: number, public output_index: number ) { - super(); + super() } public static fromAmino(data: MsgDeleteOutput.Amino): MsgDeleteOutput { const { value: { challenger, bridge_id, output_index }, - } = data; + } = data return new MsgDeleteOutput( challenger, Number.parseInt(bridge_id), Number.parseInt(output_index) - ); + ) } public toAmino(): MsgDeleteOutput.Amino { - const { challenger, bridge_id, output_index } = this; + const { challenger, bridge_id, output_index } = this return { type: 'ophost/MsgDeleteOutput', value: { @@ -42,26 +42,26 @@ export class MsgDeleteOutput extends JSONSerializable< bridge_id: bridge_id.toString(), output_index: output_index.toString(), }, - }; + } } public static fromData(data: MsgDeleteOutput.Data): MsgDeleteOutput { - const { challenger, bridge_id, output_index } = data; + const { challenger, bridge_id, output_index } = data return new MsgDeleteOutput( challenger, Number.parseInt(bridge_id), Number.parseInt(output_index) - ); + ) } public toData(): MsgDeleteOutput.Data { - const { challenger, bridge_id, output_index } = this; + const { challenger, bridge_id, output_index } = this return { '@type': '/opinit.ophost.v1.MsgDeleteOutput', challenger, bridge_id: bridge_id.toString(), output_index: output_index.toString(), - }; + } } public static fromProto(data: MsgDeleteOutput.Proto): MsgDeleteOutput { @@ -69,46 +69,46 @@ export class MsgDeleteOutput extends JSONSerializable< data.challenger, data.bridgeId.toNumber(), data.outputIndex.toNumber() - ); + ) } public toProto(): MsgDeleteOutput.Proto { - const { challenger, bridge_id, output_index } = this; + const { challenger, bridge_id, output_index } = this return MsgDeleteOutput_pb.fromPartial({ challenger, bridgeId: Long.fromNumber(bridge_id), outputIndex: Long.fromNumber(output_index), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgDeleteOutput', value: MsgDeleteOutput_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgDeleteOutput { - return MsgDeleteOutput.fromProto(MsgDeleteOutput_pb.decode(msgAny.value)); + return MsgDeleteOutput.fromProto(MsgDeleteOutput_pb.decode(msgAny.value)) } } export namespace MsgDeleteOutput { export interface Amino { - type: 'ophost/MsgDeleteOutput'; + type: 'ophost/MsgDeleteOutput' value: { - challenger: AccAddress; - bridge_id: string; - output_index: string; - }; + challenger: AccAddress + bridge_id: string + output_index: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgDeleteOutput'; - challenger: AccAddress; - bridge_id: string; - output_index: string; + '@type': '/opinit.ophost.v1.MsgDeleteOutput' + challenger: AccAddress + bridge_id: string + output_index: string } - export type Proto = MsgDeleteOutput_pb; + export type Proto = MsgDeleteOutput_pb } diff --git a/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts b/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts index c8b2a11..d2795d5 100644 --- a/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts +++ b/src/core/ophost/msgs/MsgFinalizeTokenWithdrawal.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { MsgFinalizeTokenWithdrawal as MsgFinalizeTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { MsgFinalizeTokenWithdrawal as MsgFinalizeTokenWithdrawal_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgFinalizeTokenWithdrawal extends JSONSerializable< MsgFinalizeTokenWithdrawal.Amino, @@ -36,7 +36,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< public storage_root: string, public latest_block_hash: string ) { - super(); + super() } public static fromAmino( @@ -56,7 +56,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< storage_root, latest_block_hash, }, - } = data; + } = data return new MsgFinalizeTokenWithdrawal( Number.parseInt(bridge_id), @@ -70,7 +70,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash - ); + ) } public toAmino(): MsgFinalizeTokenWithdrawal.Amino { @@ -86,7 +86,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash, - } = this; + } = this return { type: 'ophost/MsgFinalizeTokenWithdrawal', @@ -103,7 +103,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< storage_root, latest_block_hash, }, - }; + } } public static fromData( @@ -121,7 +121,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash, - } = data; + } = data return new MsgFinalizeTokenWithdrawal( Number.parseInt(bridge_id), @@ -135,7 +135,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash - ); + ) } public toData(): MsgFinalizeTokenWithdrawal.Data { @@ -151,7 +151,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash, - } = this; + } = this return { '@type': '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal', @@ -166,7 +166,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash, - }; + } } public static fromProto( @@ -175,7 +175,9 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< return new MsgFinalizeTokenWithdrawal( data.bridgeId.toNumber(), data.outputIndex.toNumber(), - data.withdrawalProofs.map(proof => Buffer.from(proof).toString('base64')), + data.withdrawalProofs.map((proof) => + Buffer.from(proof).toString('base64') + ), data.sender, data.receiver, data.sequence.toNumber(), @@ -184,7 +186,7 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< Buffer.from(data.stateRoot).toString('base64'), Buffer.from(data.storageRoot).toString('base64'), Buffer.from(data.latestBlockHash).toString('base64') - ); + ) } public toProto(): MsgFinalizeTokenWithdrawal.Proto { @@ -200,12 +202,12 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< state_root, storage_root, latest_block_hash, - } = this; + } = this return MsgFinalizeTokenWithdrawal_pb.fromPartial({ bridgeId: Long.fromNumber(bridge_id), outputIndex: Long.fromNumber(output_index), - withdrawalProofs: withdrawal_proofs.map(proof => + withdrawalProofs: withdrawal_proofs.map((proof) => Buffer.from(proof, 'base64') ), sender, @@ -216,55 +218,55 @@ export class MsgFinalizeTokenWithdrawal extends JSONSerializable< stateRoot: Buffer.from(state_root, 'base64'), storageRoot: Buffer.from(storage_root, 'base64'), latestBlockHash: Buffer.from(latest_block_hash, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal', value: MsgFinalizeTokenWithdrawal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgFinalizeTokenWithdrawal { return MsgFinalizeTokenWithdrawal.fromProto( MsgFinalizeTokenWithdrawal_pb.decode(msgAny.value) - ); + ) } } export namespace MsgFinalizeTokenWithdrawal { export interface Amino { - type: 'ophost/MsgFinalizeTokenWithdrawal'; + type: 'ophost/MsgFinalizeTokenWithdrawal' value: { - bridge_id: string; - output_index: string; - withdrawal_proofs: string[]; - sender: AccAddress; - receiver: AccAddress; - sequence: string; - amount: Coin.Amino; - version: string; - state_root: string; - storage_root: string; - latest_block_hash: string; - }; + bridge_id: string + output_index: string + withdrawal_proofs: string[] + sender: AccAddress + receiver: AccAddress + sequence: string + amount: Coin.Amino + version: string + state_root: string + storage_root: string + latest_block_hash: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal'; - bridge_id: string; - output_index: string; - withdrawal_proofs: string[]; - sender: AccAddress; - receiver: AccAddress; - sequence: string; - amount: Coin.Data; - version: string; - state_root: string; - storage_root: string; - latest_block_hash: string; + '@type': '/opinit.ophost.v1.MsgFinalizeTokenWithdrawal' + bridge_id: string + output_index: string + withdrawal_proofs: string[] + sender: AccAddress + receiver: AccAddress + sequence: string + amount: Coin.Data + version: string + state_root: string + storage_root: string + latest_block_hash: string } - export type Proto = MsgFinalizeTokenWithdrawal_pb; + export type Proto = MsgFinalizeTokenWithdrawal_pb } diff --git a/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts b/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts index 101f41c..fa2d444 100644 --- a/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts +++ b/src/core/ophost/msgs/MsgInitiateTokenDeposit.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Coin } from '../../Coin'; -import { MsgInitiateTokenDeposit as MsgInitiateTokenDeposit_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Coin } from '../../Coin' +import { MsgInitiateTokenDeposit as MsgInitiateTokenDeposit_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgInitiateTokenDeposit extends JSONSerializable< MsgInitiateTokenDeposit.Amino, @@ -24,7 +24,7 @@ export class MsgInitiateTokenDeposit extends JSONSerializable< public amount: Coin, public data?: string ) { - super(); + super() } public static fromAmino( @@ -32,18 +32,18 @@ export class MsgInitiateTokenDeposit extends JSONSerializable< ): MsgInitiateTokenDeposit { const { value: { sender, bridge_id, to, amount, data }, - } = msgAmino; + } = msgAmino return new MsgInitiateTokenDeposit( sender, Number.parseInt(bridge_id), to, Coin.fromAmino(amount), data - ); + ) } public toAmino(): MsgInitiateTokenDeposit.Amino { - const { sender, bridge_id, to, amount, data } = this; + const { sender, bridge_id, to, amount, data } = this return { type: 'ophost/MsgInitiateTokenDeposit', value: { @@ -53,24 +53,24 @@ export class MsgInitiateTokenDeposit extends JSONSerializable< amount: amount.toAmino(), data, }, - }; + } } public static fromData( msgData: MsgInitiateTokenDeposit.Data ): MsgInitiateTokenDeposit { - const { sender, bridge_id, to, amount, data } = msgData; + const { sender, bridge_id, to, amount, data } = msgData return new MsgInitiateTokenDeposit( sender, Number.parseInt(bridge_id), to, Coin.fromData(amount), data - ); + ) } public toData(): MsgInitiateTokenDeposit.Data { - const { sender, bridge_id, to, amount, data } = this; + const { sender, bridge_id, to, amount, data } = this return { '@type': '/opinit.ophost.v1.MsgInitiateTokenDeposit', sender, @@ -78,7 +78,7 @@ export class MsgInitiateTokenDeposit extends JSONSerializable< to, amount: amount.toData(), data, - }; + } } public static fromProto( @@ -92,54 +92,54 @@ export class MsgInitiateTokenDeposit extends JSONSerializable< msgProto.data.length ? Buffer.from(msgProto.data).toString('base64') : undefined - ); + ) } public toProto(): MsgInitiateTokenDeposit.Proto { - const { sender, bridge_id, to, amount, data } = this; + const { sender, bridge_id, to, amount, data } = this return MsgInitiateTokenDeposit_pb.fromPartial({ sender, bridgeId: Long.fromNumber(bridge_id), to, amount: amount.toProto(), data: data ? Buffer.from(data, 'base64') : undefined, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgInitiateTokenDeposit', value: MsgInitiateTokenDeposit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgInitiateTokenDeposit { return MsgInitiateTokenDeposit.fromProto( MsgInitiateTokenDeposit_pb.decode(msgAny.value) - ); + ) } } export namespace MsgInitiateTokenDeposit { export interface Amino { - type: 'ophost/MsgInitiateTokenDeposit'; + type: 'ophost/MsgInitiateTokenDeposit' value: { - sender: AccAddress; - bridge_id: string; - to: AccAddress; - amount: Coin.Amino; - data?: string; - }; + sender: AccAddress + bridge_id: string + to: AccAddress + amount: Coin.Amino + data?: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgInitiateTokenDeposit'; - sender: AccAddress; - bridge_id: string; - to: AccAddress; - amount: Coin.Data; - data?: string; + '@type': '/opinit.ophost.v1.MsgInitiateTokenDeposit' + sender: AccAddress + bridge_id: string + to: AccAddress + amount: Coin.Data + data?: string } - export type Proto = MsgInitiateTokenDeposit_pb; + export type Proto = MsgInitiateTokenDeposit_pb } diff --git a/src/core/ophost/msgs/MsgProposeOutput.ts b/src/core/ophost/msgs/MsgProposeOutput.ts index 802056a..2691d53 100644 --- a/src/core/ophost/msgs/MsgProposeOutput.ts +++ b/src/core/ophost/msgs/MsgProposeOutput.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgProposeOutput as MsgProposeOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgProposeOutput as MsgProposeOutput_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgProposeOutput extends JSONSerializable< MsgProposeOutput.Amino, @@ -21,23 +21,23 @@ export class MsgProposeOutput extends JSONSerializable< public l2_block_number: number, public output_root: string ) { - super(); + super() } public static fromAmino(data: MsgProposeOutput.Amino): MsgProposeOutput { const { value: { proposer, bridge_id, l2_block_number, output_root }, - } = data; + } = data return new MsgProposeOutput( proposer, Number.parseInt(bridge_id), Number.parseInt(l2_block_number), output_root - ); + ) } public toAmino(): MsgProposeOutput.Amino { - const { proposer, bridge_id, l2_block_number, output_root } = this; + const { proposer, bridge_id, l2_block_number, output_root } = this return { type: 'ophost/MsgProposeOutput', value: { @@ -46,28 +46,28 @@ export class MsgProposeOutput extends JSONSerializable< l2_block_number: l2_block_number.toString(), output_root, }, - }; + } } public static fromData(data: MsgProposeOutput.Data): MsgProposeOutput { - const { proposer, bridge_id, l2_block_number, output_root } = data; + const { proposer, bridge_id, l2_block_number, output_root } = data return new MsgProposeOutput( proposer, Number.parseInt(bridge_id), Number.parseInt(l2_block_number), output_root - ); + ) } public toData(): MsgProposeOutput.Data { - const { proposer, bridge_id, l2_block_number, output_root } = this; + const { proposer, bridge_id, l2_block_number, output_root } = this return { '@type': '/opinit.ophost.v1.MsgProposeOutput', proposer, bridge_id: bridge_id.toString(), l2_block_number: l2_block_number.toString(), output_root, - }; + } } public static fromProto(data: MsgProposeOutput.Proto): MsgProposeOutput { @@ -76,49 +76,49 @@ export class MsgProposeOutput extends JSONSerializable< data.bridgeId.toNumber(), data.l2BlockNumber.toNumber(), Buffer.from(data.outputRoot).toString('base64') - ); + ) } public toProto(): MsgProposeOutput.Proto { - const { proposer, bridge_id, l2_block_number, output_root } = this; + const { proposer, bridge_id, l2_block_number, output_root } = this return MsgProposeOutput_pb.fromPartial({ proposer, bridgeId: Long.fromNumber(bridge_id), l2BlockNumber: Long.fromNumber(l2_block_number), outputRoot: output_root ? Buffer.from(output_root, 'base64') : undefined, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgProposeOutput', value: MsgProposeOutput_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgProposeOutput { - return MsgProposeOutput.fromProto(MsgProposeOutput_pb.decode(msgAny.value)); + return MsgProposeOutput.fromProto(MsgProposeOutput_pb.decode(msgAny.value)) } } export namespace MsgProposeOutput { export interface Amino { - type: 'ophost/MsgProposeOutput'; + type: 'ophost/MsgProposeOutput' value: { - proposer: AccAddress; - bridge_id: string; - l2_block_number: string; - output_root: string; - }; + proposer: AccAddress + bridge_id: string + l2_block_number: string + output_root: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgProposeOutput'; - proposer: AccAddress; - bridge_id: string; - l2_block_number: string; - output_root: string; + '@type': '/opinit.ophost.v1.MsgProposeOutput' + proposer: AccAddress + bridge_id: string + l2_block_number: string + output_root: string } - export type Proto = MsgProposeOutput_pb; + export type Proto = MsgProposeOutput_pb } diff --git a/src/core/ophost/msgs/MsgRecordBatch.ts b/src/core/ophost/msgs/MsgRecordBatch.ts index 76cee0b..09f62eb 100644 --- a/src/core/ophost/msgs/MsgRecordBatch.ts +++ b/src/core/ophost/msgs/MsgRecordBatch.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgRecordBatch as MsgRecordBatch_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgRecordBatch as MsgRecordBatch_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgRecordBatch extends JSONSerializable< MsgRecordBatch.Amino, @@ -19,22 +19,22 @@ export class MsgRecordBatch extends JSONSerializable< public bridge_id: number, public batch_bytes: string ) { - super(); + super() } public static fromAmino(data: MsgRecordBatch.Amino): MsgRecordBatch { const { value: { submitter, bridge_id, batch_bytes }, - } = data; + } = data return new MsgRecordBatch( submitter, Number.parseInt(bridge_id), batch_bytes - ); + ) } public toAmino(): MsgRecordBatch.Amino { - const { submitter, bridge_id, batch_bytes } = this; + const { submitter, bridge_id, batch_bytes } = this return { type: 'ophost/MsgRecordBatch', value: { @@ -42,26 +42,26 @@ export class MsgRecordBatch extends JSONSerializable< bridge_id: bridge_id.toString(), batch_bytes, }, - }; + } } public static fromData(data: MsgRecordBatch.Data): MsgRecordBatch { - const { submitter, bridge_id, batch_bytes } = data; + const { submitter, bridge_id, batch_bytes } = data return new MsgRecordBatch( submitter, Number.parseInt(bridge_id), batch_bytes - ); + ) } public toData(): MsgRecordBatch.Data { - const { submitter, bridge_id, batch_bytes } = this; + const { submitter, bridge_id, batch_bytes } = this return { '@type': '/opinit.ophost.v1.MsgRecordBatch', submitter, bridge_id: bridge_id.toString(), batch_bytes, - }; + } } public static fromProto(data: MsgRecordBatch.Proto): MsgRecordBatch { @@ -69,46 +69,46 @@ export class MsgRecordBatch extends JSONSerializable< data.submitter, data.bridgeId.toNumber(), Buffer.from(data.batchBytes).toString('base64') - ); + ) } public toProto(): MsgRecordBatch.Proto { - const { submitter, bridge_id, batch_bytes } = this; + const { submitter, bridge_id, batch_bytes } = this return MsgRecordBatch_pb.fromPartial({ submitter, bridgeId: Long.fromNumber(bridge_id), batchBytes: batch_bytes ? Buffer.from(batch_bytes, 'base64') : undefined, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgRecordBatch', value: MsgRecordBatch_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRecordBatch { - return MsgRecordBatch.fromProto(MsgRecordBatch_pb.decode(msgAny.value)); + return MsgRecordBatch.fromProto(MsgRecordBatch_pb.decode(msgAny.value)) } } export namespace MsgRecordBatch { export interface Amino { - type: 'ophost/MsgRecordBatch'; + type: 'ophost/MsgRecordBatch' value: { - submitter: AccAddress; - bridge_id: string; - batch_bytes: string; - }; + submitter: AccAddress + bridge_id: string + batch_bytes: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgRecordBatch'; - submitter: AccAddress; - bridge_id: string; - batch_bytes: string; + '@type': '/opinit.ophost.v1.MsgRecordBatch' + submitter: AccAddress + bridge_id: string + batch_bytes: string } - export type Proto = MsgRecordBatch_pb; + export type Proto = MsgRecordBatch_pb } diff --git a/src/core/ophost/msgs/MsgUpdateBatchInfo.ts b/src/core/ophost/msgs/MsgUpdateBatchInfo.ts index 1756b03..be69ef1 100644 --- a/src/core/ophost/msgs/MsgUpdateBatchInfo.ts +++ b/src/core/ophost/msgs/MsgUpdateBatchInfo.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgUpdateBatchInfo as MsgUpdateBatchInfo_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { BatchInfo } from '../BatchInfo'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgUpdateBatchInfo as MsgUpdateBatchInfo_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { BatchInfo } from '../BatchInfo' +import Long from 'long' export class MsgUpdateBatchInfo extends JSONSerializable< MsgUpdateBatchInfo.Amino, @@ -20,23 +20,23 @@ export class MsgUpdateBatchInfo extends JSONSerializable< public bridge_id: number, public new_batch_info: BatchInfo ) { - super(); + super() } public static fromAmino(data: MsgUpdateBatchInfo.Amino): MsgUpdateBatchInfo { const { value: { authority, bridge_id, new_batch_info }, - } = data; + } = data return new MsgUpdateBatchInfo( authority, Number.parseInt(bridge_id), BatchInfo.fromAmino(new_batch_info) - ); + ) } public toAmino(): MsgUpdateBatchInfo.Amino { - const { authority, bridge_id, new_batch_info } = this; + const { authority, bridge_id, new_batch_info } = this return { type: 'ophost/MsgUpdateBatchInfo', value: { @@ -44,26 +44,26 @@ export class MsgUpdateBatchInfo extends JSONSerializable< bridge_id: bridge_id.toString(), new_batch_info: new_batch_info.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateBatchInfo.Data): MsgUpdateBatchInfo { - const { authority, bridge_id, new_batch_info } = data; + const { authority, bridge_id, new_batch_info } = data return new MsgUpdateBatchInfo( authority, Number.parseInt(bridge_id), BatchInfo.fromData(new_batch_info) - ); + ) } public toData(): MsgUpdateBatchInfo.Data { - const { authority, bridge_id, new_batch_info } = this; + const { authority, bridge_id, new_batch_info } = this return { '@type': '/opinit.ophost.v1.MsgUpdateBatchInfo', authority, bridge_id: bridge_id.toString(), new_batch_info: new_batch_info.toData(), - }; + } } public static fromProto(data: MsgUpdateBatchInfo.Proto): MsgUpdateBatchInfo { @@ -71,48 +71,48 @@ export class MsgUpdateBatchInfo extends JSONSerializable< data.authority, data.bridgeId.toNumber(), BatchInfo.fromProto(data.newBatchInfo as BatchInfo.Proto) - ); + ) } public toProto(): MsgUpdateBatchInfo.Proto { - const { authority, bridge_id, new_batch_info } = this; + const { authority, bridge_id, new_batch_info } = this return MsgUpdateBatchInfo_pb.fromPartial({ authority, bridgeId: Long.fromNumber(bridge_id), newBatchInfo: new_batch_info.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgUpdateBatchInfo', value: MsgUpdateBatchInfo_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateBatchInfo { return MsgUpdateBatchInfo.fromProto( MsgUpdateBatchInfo_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateBatchInfo { export interface Amino { - type: 'ophost/MsgUpdateBatchInfo'; + type: 'ophost/MsgUpdateBatchInfo' value: { - authority: AccAddress; - bridge_id: string; - new_batch_info: BatchInfo.Amino; - }; + authority: AccAddress + bridge_id: string + new_batch_info: BatchInfo.Amino + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgUpdateBatchInfo'; - authority: AccAddress; - bridge_id: string; - new_batch_info: BatchInfo.Data; + '@type': '/opinit.ophost.v1.MsgUpdateBatchInfo' + authority: AccAddress + bridge_id: string + new_batch_info: BatchInfo.Data } - export type Proto = MsgUpdateBatchInfo_pb; + export type Proto = MsgUpdateBatchInfo_pb } diff --git a/src/core/ophost/msgs/MsgUpdateChallenger.ts b/src/core/ophost/msgs/MsgUpdateChallenger.ts index e1f4d55..621c672 100644 --- a/src/core/ophost/msgs/MsgUpdateChallenger.ts +++ b/src/core/ophost/msgs/MsgUpdateChallenger.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgUpdateChallenger as MsgUpdateChallenger_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgUpdateChallenger as MsgUpdateChallenger_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgUpdateChallenger extends JSONSerializable< MsgUpdateChallenger.Amino, @@ -19,7 +19,7 @@ export class MsgUpdateChallenger extends JSONSerializable< public bridge_id: number, public new_challenger: AccAddress ) { - super(); + super() } public static fromAmino( @@ -27,17 +27,17 @@ export class MsgUpdateChallenger extends JSONSerializable< ): MsgUpdateChallenger { const { value: { authority, bridge_id, new_challenger }, - } = data; + } = data return new MsgUpdateChallenger( authority, Number.parseInt(bridge_id), new_challenger - ); + ) } public toAmino(): MsgUpdateChallenger.Amino { - const { authority, bridge_id, new_challenger } = this; + const { authority, bridge_id, new_challenger } = this return { type: 'ophost/MsgUpdateChallenger', value: { @@ -45,26 +45,26 @@ export class MsgUpdateChallenger extends JSONSerializable< bridge_id: bridge_id.toString(), new_challenger, }, - }; + } } public static fromData(data: MsgUpdateChallenger.Data): MsgUpdateChallenger { - const { authority, bridge_id, new_challenger } = data; + const { authority, bridge_id, new_challenger } = data return new MsgUpdateChallenger( authority, Number.parseInt(bridge_id), new_challenger - ); + ) } public toData(): MsgUpdateChallenger.Data { - const { authority, bridge_id, new_challenger } = this; + const { authority, bridge_id, new_challenger } = this return { '@type': '/opinit.ophost.v1.MsgUpdateChallenger', authority, bridge_id: bridge_id.toString(), new_challenger, - }; + } } public static fromProto( @@ -74,48 +74,48 @@ export class MsgUpdateChallenger extends JSONSerializable< data.authority, data.bridgeId.toNumber(), data.newChallenger - ); + ) } public toProto(): MsgUpdateChallenger.Proto { - const { authority, bridge_id, new_challenger } = this; + const { authority, bridge_id, new_challenger } = this return MsgUpdateChallenger_pb.fromPartial({ authority, bridgeId: Long.fromNumber(bridge_id), newChallenger: new_challenger, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgUpdateChallenger', value: MsgUpdateChallenger_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateChallenger { return MsgUpdateChallenger.fromProto( MsgUpdateChallenger_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateChallenger { export interface Amino { - type: 'ophost/MsgUpdateChallenger'; + type: 'ophost/MsgUpdateChallenger' value: { - authority: AccAddress; - bridge_id: string; - new_challenger: AccAddress; - }; + authority: AccAddress + bridge_id: string + new_challenger: AccAddress + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgUpdateChallenger'; - authority: AccAddress; - bridge_id: string; - new_challenger: AccAddress; + '@type': '/opinit.ophost.v1.MsgUpdateChallenger' + authority: AccAddress + bridge_id: string + new_challenger: AccAddress } - export type Proto = MsgUpdateChallenger_pb; + export type Proto = MsgUpdateChallenger_pb } diff --git a/src/core/ophost/msgs/MsgUpdateMetadata.ts b/src/core/ophost/msgs/MsgUpdateMetadata.ts index d75f9c0..95e8294 100644 --- a/src/core/ophost/msgs/MsgUpdateMetadata.ts +++ b/src/core/ophost/msgs/MsgUpdateMetadata.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgUpdateMetadata as MsgUpdateMetadata_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgUpdateMetadata as MsgUpdateMetadata_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgUpdateMetadata extends JSONSerializable< MsgUpdateMetadata.Amino, @@ -19,23 +19,23 @@ export class MsgUpdateMetadata extends JSONSerializable< public bridge_id: number, public metadata: string ) { - super(); + super() } public static fromAmino(data: MsgUpdateMetadata.Amino): MsgUpdateMetadata { const { value: { authority, bridge_id, metadata }, - } = data; + } = data return new MsgUpdateMetadata( authority, Number.parseInt(bridge_id), metadata - ); + ) } public toAmino(): MsgUpdateMetadata.Amino { - const { authority, bridge_id, metadata } = this; + const { authority, bridge_id, metadata } = this return { type: 'ophost/MsgUpdateMetadata', value: { @@ -43,26 +43,26 @@ export class MsgUpdateMetadata extends JSONSerializable< bridge_id: bridge_id.toString(), metadata, }, - }; + } } public static fromData(data: MsgUpdateMetadata.Data): MsgUpdateMetadata { - const { authority, bridge_id, metadata } = data; + const { authority, bridge_id, metadata } = data return new MsgUpdateMetadata( authority, Number.parseInt(bridge_id), metadata - ); + ) } public toData(): MsgUpdateMetadata.Data { - const { authority, bridge_id, metadata } = this; + const { authority, bridge_id, metadata } = this return { '@type': '/opinit.ophost.v1.MsgUpdateMetadata', authority, bridge_id: bridge_id.toString(), metadata, - }; + } } public static fromProto(data: MsgUpdateMetadata.Proto): MsgUpdateMetadata { @@ -70,48 +70,48 @@ export class MsgUpdateMetadata extends JSONSerializable< data.authority, data.bridgeId.toNumber(), Buffer.from(data.metadata).toString('base64') - ); + ) } public toProto(): MsgUpdateMetadata.Proto { - const { authority, bridge_id, metadata } = this; + const { authority, bridge_id, metadata } = this return MsgUpdateMetadata_pb.fromPartial({ authority, bridgeId: Long.fromNumber(bridge_id), metadata: Buffer.from(metadata, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgUpdateMetadata', value: MsgUpdateMetadata_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateMetadata { return MsgUpdateMetadata.fromProto( MsgUpdateMetadata_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateMetadata { export interface Amino { - type: 'ophost/MsgUpdateMetadata'; + type: 'ophost/MsgUpdateMetadata' value: { - authority: AccAddress; - bridge_id: string; - metadata: string; - }; + authority: AccAddress + bridge_id: string + metadata: string + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgUpdateMetadata'; - authority: AccAddress; - bridge_id: string; - metadata: string; + '@type': '/opinit.ophost.v1.MsgUpdateMetadata' + authority: AccAddress + bridge_id: string + metadata: string } - export type Proto = MsgUpdateMetadata_pb; + export type Proto = MsgUpdateMetadata_pb } diff --git a/src/core/ophost/msgs/MsgUpdateOphostParams.ts b/src/core/ophost/msgs/MsgUpdateOphostParams.ts index 304f574..b10664e 100644 --- a/src/core/ophost/msgs/MsgUpdateOphostParams.ts +++ b/src/core/ophost/msgs/MsgUpdateOphostParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { OphostParams } from '../OphostParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { OphostParams } from '../OphostParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' export class MsgUpdateOphostParams extends JSONSerializable< MsgUpdateOphostParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateOphostParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/move parameters to update */ - constructor(public authority: AccAddress, public params: OphostParams) { - super(); + constructor( + public authority: AccAddress, + public params: OphostParams + ) { + super() } public static fromAmino( @@ -22,35 +25,35 @@ export class MsgUpdateOphostParams extends JSONSerializable< ): MsgUpdateOphostParams { const { value: { authority, params }, - } = data; - return new MsgUpdateOphostParams(authority, OphostParams.fromAmino(params)); + } = data + return new MsgUpdateOphostParams(authority, OphostParams.fromAmino(params)) } public toAmino(): MsgUpdateOphostParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'ophost/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateOphostParams.Data ): MsgUpdateOphostParams { - const { authority, params } = data; - return new MsgUpdateOphostParams(authority, OphostParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateOphostParams(authority, OphostParams.fromData(params)) } public toData(): MsgUpdateOphostParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/opinit.ophost.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -59,45 +62,45 @@ export class MsgUpdateOphostParams extends JSONSerializable< return new MsgUpdateOphostParams( data.authority, OphostParams.fromProto(data.params as OphostParams.Proto) - ); + ) } public toProto(): MsgUpdateOphostParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateOphostParams { return MsgUpdateOphostParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateOphostParams { export interface Amino { - type: 'ophost/MsgUpdateParams'; + type: 'ophost/MsgUpdateParams' value: { - authority: AccAddress; - params: OphostParams.Amino; - }; + authority: AccAddress + params: OphostParams.Amino + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgUpdateParams'; - authority: AccAddress; - params: OphostParams.Data; + '@type': '/opinit.ophost.v1.MsgUpdateParams' + authority: AccAddress + params: OphostParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/ophost/msgs/MsgUpdateProposer.ts b/src/core/ophost/msgs/MsgUpdateProposer.ts index 9f32031..08d7870 100644 --- a/src/core/ophost/msgs/MsgUpdateProposer.ts +++ b/src/core/ophost/msgs/MsgUpdateProposer.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { MsgUpdateProposer as MsgUpdateProposer_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { MsgUpdateProposer as MsgUpdateProposer_pb } from '@initia/opinit.proto/opinit/ophost/v1/tx' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MsgUpdateProposer extends JSONSerializable< MsgUpdateProposer.Amino, @@ -19,23 +19,23 @@ export class MsgUpdateProposer extends JSONSerializable< public bridge_id: number, public new_proposer: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgUpdateProposer.Amino): MsgUpdateProposer { const { value: { authority, bridge_id, new_proposer }, - } = data; + } = data return new MsgUpdateProposer( authority, Number.parseInt(bridge_id), new_proposer - ); + ) } public toAmino(): MsgUpdateProposer.Amino { - const { authority, bridge_id, new_proposer } = this; + const { authority, bridge_id, new_proposer } = this return { type: 'ophost/MsgUpdateProposer', value: { @@ -43,26 +43,26 @@ export class MsgUpdateProposer extends JSONSerializable< bridge_id: bridge_id.toString(), new_proposer, }, - }; + } } public static fromData(data: MsgUpdateProposer.Data): MsgUpdateProposer { - const { authority, bridge_id, new_proposer } = data; + const { authority, bridge_id, new_proposer } = data return new MsgUpdateProposer( authority, Number.parseInt(bridge_id), new_proposer - ); + ) } public toData(): MsgUpdateProposer.Data { - const { authority, bridge_id, new_proposer } = this; + const { authority, bridge_id, new_proposer } = this return { '@type': '/opinit.ophost.v1.MsgUpdateProposer', authority, bridge_id: bridge_id.toString(), new_proposer, - }; + } } public static fromProto(data: MsgUpdateProposer.Proto): MsgUpdateProposer { @@ -70,48 +70,48 @@ export class MsgUpdateProposer extends JSONSerializable< data.authority, data.bridgeId.toNumber(), data.newProposer - ); + ) } public toProto(): MsgUpdateProposer.Proto { - const { authority, bridge_id, new_proposer } = this; + const { authority, bridge_id, new_proposer } = this return MsgUpdateProposer_pb.fromPartial({ authority, bridgeId: Long.fromNumber(bridge_id), newProposer: new_proposer, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/opinit.ophost.v1.MsgUpdateProposer', value: MsgUpdateProposer_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateProposer { return MsgUpdateProposer.fromProto( MsgUpdateProposer_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateProposer { export interface Amino { - type: 'ophost/MsgUpdateProposer'; + type: 'ophost/MsgUpdateProposer' value: { - authority: AccAddress; - bridge_id: string; - new_proposer: AccAddress; - }; + authority: AccAddress + bridge_id: string + new_proposer: AccAddress + } } export interface Data { - '@type': '/opinit.ophost.v1.MsgUpdateProposer'; - authority: AccAddress; - bridge_id: string; - new_proposer: AccAddress; + '@type': '/opinit.ophost.v1.MsgUpdateProposer' + authority: AccAddress + bridge_id: string + new_proposer: AccAddress } - export type Proto = MsgUpdateProposer_pb; + export type Proto = MsgUpdateProposer_pb } diff --git a/src/core/ophost/msgs/index.ts b/src/core/ophost/msgs/index.ts index 9a43cc9..136fc97 100644 --- a/src/core/ophost/msgs/index.ts +++ b/src/core/ophost/msgs/index.ts @@ -1,26 +1,26 @@ -import { MsgRecordBatch } from './MsgRecordBatch'; -import { MsgCreateBridge } from './MsgCreateBridge'; -import { MsgProposeOutput } from './MsgProposeOutput'; -import { MsgDeleteOutput } from './MsgDeleteOutput'; -import { MsgInitiateTokenDeposit } from './MsgInitiateTokenDeposit'; -import { MsgFinalizeTokenWithdrawal } from './MsgFinalizeTokenWithdrawal'; -import { MsgUpdateProposer } from './MsgUpdateProposer'; -import { MsgUpdateChallenger } from './MsgUpdateChallenger'; -import { MsgUpdateBatchInfo } from './MsgUpdateBatchInfo'; -import { MsgUpdateMetadata } from './MsgUpdateMetadata'; -import { MsgUpdateOphostParams } from './MsgUpdateOphostParams'; +import { MsgRecordBatch } from './MsgRecordBatch' +import { MsgCreateBridge } from './MsgCreateBridge' +import { MsgProposeOutput } from './MsgProposeOutput' +import { MsgDeleteOutput } from './MsgDeleteOutput' +import { MsgInitiateTokenDeposit } from './MsgInitiateTokenDeposit' +import { MsgFinalizeTokenWithdrawal } from './MsgFinalizeTokenWithdrawal' +import { MsgUpdateProposer } from './MsgUpdateProposer' +import { MsgUpdateChallenger } from './MsgUpdateChallenger' +import { MsgUpdateBatchInfo } from './MsgUpdateBatchInfo' +import { MsgUpdateMetadata } from './MsgUpdateMetadata' +import { MsgUpdateOphostParams } from './MsgUpdateOphostParams' -export * from './MsgRecordBatch'; -export * from './MsgCreateBridge'; -export * from './MsgProposeOutput'; -export * from './MsgDeleteOutput'; -export * from './MsgInitiateTokenDeposit'; -export * from './MsgFinalizeTokenWithdrawal'; -export * from './MsgUpdateProposer'; -export * from './MsgUpdateChallenger'; -export * from './MsgUpdateBatchInfo'; -export * from './MsgUpdateMetadata'; -export * from './MsgUpdateOphostParams'; +export * from './MsgRecordBatch' +export * from './MsgCreateBridge' +export * from './MsgProposeOutput' +export * from './MsgDeleteOutput' +export * from './MsgInitiateTokenDeposit' +export * from './MsgFinalizeTokenWithdrawal' +export * from './MsgUpdateProposer' +export * from './MsgUpdateChallenger' +export * from './MsgUpdateBatchInfo' +export * from './MsgUpdateMetadata' +export * from './MsgUpdateOphostParams' export type OphostMsg = | MsgRecordBatch @@ -33,7 +33,7 @@ export type OphostMsg = | MsgUpdateChallenger | MsgUpdateBatchInfo | MsgUpdateMetadata - | MsgUpdateOphostParams; + | MsgUpdateOphostParams export namespace OphostMsg { export type Amino = @@ -47,7 +47,7 @@ export namespace OphostMsg { | MsgUpdateChallenger.Amino | MsgUpdateBatchInfo.Amino | MsgUpdateMetadata.Amino - | MsgUpdateOphostParams.Amino; + | MsgUpdateOphostParams.Amino export type Data = | MsgRecordBatch.Data @@ -60,7 +60,7 @@ export namespace OphostMsg { | MsgUpdateChallenger.Data | MsgUpdateBatchInfo.Data | MsgUpdateMetadata.Data - | MsgUpdateOphostParams.Data; + | MsgUpdateOphostParams.Data export type Proto = | MsgRecordBatch.Proto @@ -73,5 +73,5 @@ export namespace OphostMsg { | MsgUpdateChallenger.Proto | MsgUpdateBatchInfo.Proto | MsgUpdateMetadata.Proto - | MsgUpdateOphostParams.Proto; + | MsgUpdateOphostParams.Proto } diff --git a/src/core/oracle/CurrencyPair.ts b/src/core/oracle/CurrencyPair.ts index 431cb4e..f08813f 100644 --- a/src/core/oracle/CurrencyPair.ts +++ b/src/core/oracle/CurrencyPair.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { CurrencyPair as CurrencyPair_pb } from '@initia/initia.proto/slinky/types/v1/currency_pair'; +import { JSONSerializable } from '../../util/json' +import { CurrencyPair as CurrencyPair_pb } from '@initia/initia.proto/slinky/types/v1/currency_pair' export class CurrencyPair extends JSONSerializable< CurrencyPair.Amino, @@ -10,58 +10,61 @@ export class CurrencyPair extends JSONSerializable< * @param Base * @param Quote */ - constructor(public Base: string, public Quote: string) { - super(); + constructor( + public Base: string, + public Quote: string + ) { + super() } public toString(): string { - return `${this.Base}/${this.Quote}`; + return `${this.Base}/${this.Quote}` } public static fromAmino(data: CurrencyPair.Amino): CurrencyPair { - return new CurrencyPair(data.Base, data.Quote); + return new CurrencyPair(data.Base, data.Quote) } public toAmino(): CurrencyPair.Amino { return { Base: this.Base, Quote: this.Quote, - }; + } } public static fromData(data: CurrencyPair.Data): CurrencyPair { - return new CurrencyPair(data.Base, data.Quote); + return new CurrencyPair(data.Base, data.Quote) } public toData(): CurrencyPair.Data { return { Base: this.Base, Quote: this.Quote, - }; + } } public static fromProto(proto: CurrencyPair.Proto): CurrencyPair { - return new CurrencyPair(proto.Base, proto.Quote); + return new CurrencyPair(proto.Base, proto.Quote) } public toProto(): CurrencyPair.Proto { return CurrencyPair_pb.fromPartial({ Base: this.Base, Quote: this.Quote, - }); + }) } } export namespace CurrencyPair { export interface Amino { - Base: string; - Quote: string; + Base: string + Quote: string } export interface Data { - Base: string; - Quote: string; + Base: string + Quote: string } - export type Proto = CurrencyPair_pb; + export type Proto = CurrencyPair_pb } diff --git a/src/core/oracle/QuotePrice.ts b/src/core/oracle/QuotePrice.ts index e5ddb28..a6b1179 100644 --- a/src/core/oracle/QuotePrice.ts +++ b/src/core/oracle/QuotePrice.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { QuotePrice as QuotePrice_pb } from '@initia/initia.proto/slinky/oracle/v1/genesis'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { QuotePrice as QuotePrice_pb } from '@initia/initia.proto/slinky/oracle/v1/genesis' +import Long from 'long' export class QuotePrice extends JSONSerializable< QuotePrice.Amino, @@ -17,43 +17,43 @@ export class QuotePrice extends JSONSerializable< public block_timestamp: Date, public block_height: number ) { - super(); + super() } public static fromAmino(data: QuotePrice.Amino): QuotePrice { - const { price, block_timestamp, block_height } = data; + const { price, block_timestamp, block_height } = data return new QuotePrice( price, new Date(block_timestamp), Number.parseInt(block_height) - ); + ) } public toAmino(): QuotePrice.Amino { - const { price, block_timestamp, block_height } = this; + const { price, block_timestamp, block_height } = this return { price, block_timestamp: block_timestamp.toISOString(), block_height: block_height.toString(), - }; + } } public static fromData(data: QuotePrice.Data): QuotePrice { - const { price, block_timestamp, block_height } = data; + const { price, block_timestamp, block_height } = data return new QuotePrice( price, new Date(block_timestamp), Number.parseInt(block_height) - ); + ) } public toData(): QuotePrice.Data { - const { price, block_timestamp, block_height } = this; + const { price, block_timestamp, block_height } = this return { price, block_timestamp: block_timestamp.toISOString(), block_height: block_height.toString(), - }; + } } public static fromProto(proto: QuotePrice.Proto): QuotePrice { @@ -61,31 +61,31 @@ export class QuotePrice extends JSONSerializable< proto.price, proto.blockTimestamp as Date, proto.blockHeight.toNumber() - ); + ) } public toProto(): QuotePrice.Proto { - const { price, block_timestamp, block_height } = this; + const { price, block_timestamp, block_height } = this return QuotePrice_pb.fromPartial({ price, blockTimestamp: block_timestamp, blockHeight: Long.fromNumber(block_height), - }); + }) } } export namespace QuotePrice { export interface Amino { - price: string; - block_timestamp: string; - block_height: string; + price: string + block_timestamp: string + block_height: string } export interface Data { - price: string; - block_timestamp: string; - block_height: string; + price: string + block_timestamp: string + block_height: string } - export type Proto = QuotePrice_pb; + export type Proto = QuotePrice_pb } diff --git a/src/core/oracle/index.ts b/src/core/oracle/index.ts index 62bc474..df13c2e 100644 --- a/src/core/oracle/index.ts +++ b/src/core/oracle/index.ts @@ -1,3 +1,3 @@ -export * from './msgs'; -export * from './CurrencyPair'; -export * from './QuotePrice'; +export * from './msgs' +export * from './CurrencyPair' +export * from './QuotePrice' diff --git a/src/core/oracle/msgs/MsgAddCurrencyPairs.ts b/src/core/oracle/msgs/MsgAddCurrencyPairs.ts index 032318a..b000127 100644 --- a/src/core/oracle/msgs/MsgAddCurrencyPairs.ts +++ b/src/core/oracle/msgs/MsgAddCurrencyPairs.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgAddCurrencyPairs as MsgAddCurrencyPairs_pb } from '@initia/initia.proto/slinky/oracle/v1/tx'; -import { CurrencyPair } from '../CurrencyPair'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgAddCurrencyPairs as MsgAddCurrencyPairs_pb } from '@initia/initia.proto/slinky/oracle/v1/tx' +import { CurrencyPair } from '../CurrencyPair' export class MsgAddCurrencyPairs extends JSONSerializable< MsgAddCurrencyPairs.Amino, @@ -17,7 +17,7 @@ export class MsgAddCurrencyPairs extends JSONSerializable< public authority: AccAddress, public currency_pairs: CurrencyPair[] ) { - super(); + super() } public static fromAmino( @@ -25,39 +25,39 @@ export class MsgAddCurrencyPairs extends JSONSerializable< ): MsgAddCurrencyPairs { const { value: { authority, currency_pairs }, - } = data; + } = data return new MsgAddCurrencyPairs( authority, currency_pairs.map(CurrencyPair.fromAmino) - ); + ) } public toAmino(): MsgAddCurrencyPairs.Amino { - const { authority, currency_pairs } = this; + const { authority, currency_pairs } = this return { type: 'slinky/x/oracle/MsgAddCurrencyPairs', value: { authority, - currency_pairs: currency_pairs.map(msg => msg.toAmino()), + currency_pairs: currency_pairs.map((msg) => msg.toAmino()), }, - }; + } } public static fromData(data: MsgAddCurrencyPairs.Data): MsgAddCurrencyPairs { - const { authority, currency_pairs } = data; + const { authority, currency_pairs } = data return new MsgAddCurrencyPairs( authority, currency_pairs.map(CurrencyPair.fromData) - ); + ) } public toData(): MsgAddCurrencyPairs.Data { - const { authority, currency_pairs } = this; + const { authority, currency_pairs } = this return { '@type': '/slinky.oracle.v1.MsgAddCurrencyPairs', authority, - currency_pairs: currency_pairs.map(msg => msg.toData()), - }; + currency_pairs: currency_pairs.map((msg) => msg.toData()), + } } public static fromProto( @@ -66,45 +66,45 @@ export class MsgAddCurrencyPairs extends JSONSerializable< return new MsgAddCurrencyPairs( data.authority, data.currencyPairs.map(CurrencyPair.fromProto) - ); + ) } public toProto(): MsgAddCurrencyPairs.Proto { - const { authority, currency_pairs } = this; + const { authority, currency_pairs } = this return MsgAddCurrencyPairs_pb.fromPartial({ authority, - currencyPairs: currency_pairs.map(c => c.toProto()), - }); + currencyPairs: currency_pairs.map((c) => c.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.oracle.v1.MsgAddCurrencyPairs', value: MsgAddCurrencyPairs_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgAddCurrencyPairs { return MsgAddCurrencyPairs.fromProto( MsgAddCurrencyPairs_pb.decode(msgAny.value) - ); + ) } } export namespace MsgAddCurrencyPairs { export interface Amino { - type: 'slinky/x/oracle/MsgAddCurrencyPairs'; + type: 'slinky/x/oracle/MsgAddCurrencyPairs' value: { - authority: AccAddress; - currency_pairs: CurrencyPair.Amino[]; - }; + authority: AccAddress + currency_pairs: CurrencyPair.Amino[] + } } export interface Data { - '@type': '/slinky.oracle.v1.MsgAddCurrencyPairs'; - authority: AccAddress; - currency_pairs: CurrencyPair.Data[]; + '@type': '/slinky.oracle.v1.MsgAddCurrencyPairs' + authority: AccAddress + currency_pairs: CurrencyPair.Data[] } - export type Proto = MsgAddCurrencyPairs_pb; + export type Proto = MsgAddCurrencyPairs_pb } diff --git a/src/core/oracle/msgs/MsgRemoveCurrencyPairs.ts b/src/core/oracle/msgs/MsgRemoveCurrencyPairs.ts index c64c9e8..5d3bcb2 100644 --- a/src/core/oracle/msgs/MsgRemoveCurrencyPairs.ts +++ b/src/core/oracle/msgs/MsgRemoveCurrencyPairs.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRemoveCurrencyPairs as MsgRemoveCurrencyPairs_pb } from '@initia/initia.proto/slinky/oracle/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRemoveCurrencyPairs as MsgRemoveCurrencyPairs_pb } from '@initia/initia.proto/slinky/oracle/v1/tx' export class MsgRemoveCurrencyPairs extends JSONSerializable< MsgRemoveCurrencyPairs.Amino, @@ -16,7 +16,7 @@ export class MsgRemoveCurrencyPairs extends JSONSerializable< public authority: AccAddress, public currency_pair_ids: string[] ) { - super(); + super() } public static fromAmino( @@ -24,79 +24,79 @@ export class MsgRemoveCurrencyPairs extends JSONSerializable< ): MsgRemoveCurrencyPairs { const { value: { authority, currency_pair_ids }, - } = data; - return new MsgRemoveCurrencyPairs(authority, currency_pair_ids); + } = data + return new MsgRemoveCurrencyPairs(authority, currency_pair_ids) } public toAmino(): MsgRemoveCurrencyPairs.Amino { - const { authority, currency_pair_ids } = this; + const { authority, currency_pair_ids } = this return { type: 'slinky/x/oracle/MsgSetCurrencyPairs', value: { authority, currency_pair_ids, }, - }; + } } public static fromData( data: MsgRemoveCurrencyPairs.Data ): MsgRemoveCurrencyPairs { - const { authority, currency_pair_ids } = data; - return new MsgRemoveCurrencyPairs(authority, currency_pair_ids); + const { authority, currency_pair_ids } = data + return new MsgRemoveCurrencyPairs(authority, currency_pair_ids) } public toData(): MsgRemoveCurrencyPairs.Data { - const { authority, currency_pair_ids } = this; + const { authority, currency_pair_ids } = this return { '@type': '/slinky.oracle.v1.MsgRemoveCurrencyPairs', authority, currency_pair_ids, - }; + } } public static fromProto( data: MsgRemoveCurrencyPairs.Proto ): MsgRemoveCurrencyPairs { - return new MsgRemoveCurrencyPairs(data.authority, data.currencyPairIds); + return new MsgRemoveCurrencyPairs(data.authority, data.currencyPairIds) } public toProto(): MsgRemoveCurrencyPairs.Proto { - const { authority, currency_pair_ids } = this; + const { authority, currency_pair_ids } = this return MsgRemoveCurrencyPairs_pb.fromPartial({ authority, currencyPairIds: currency_pair_ids, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/slinky.oracle.v1.MsgRemoveCurrencyPairs', value: MsgRemoveCurrencyPairs_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRemoveCurrencyPairs { return MsgRemoveCurrencyPairs.fromProto( MsgRemoveCurrencyPairs_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRemoveCurrencyPairs { export interface Amino { - type: 'slinky/x/oracle/MsgSetCurrencyPairs'; + type: 'slinky/x/oracle/MsgSetCurrencyPairs' value: { - authority: AccAddress; - currency_pair_ids: string[]; - }; + authority: AccAddress + currency_pair_ids: string[] + } } export interface Data { - '@type': '/slinky.oracle.v1.MsgRemoveCurrencyPairs'; - authority: AccAddress; - currency_pair_ids: string[]; + '@type': '/slinky.oracle.v1.MsgRemoveCurrencyPairs' + authority: AccAddress + currency_pair_ids: string[] } - export type Proto = MsgRemoveCurrencyPairs_pb; + export type Proto = MsgRemoveCurrencyPairs_pb } diff --git a/src/core/oracle/msgs/index.ts b/src/core/oracle/msgs/index.ts index 52fa4cd..064bc6b 100644 --- a/src/core/oracle/msgs/index.ts +++ b/src/core/oracle/msgs/index.ts @@ -1,13 +1,13 @@ -import { MsgAddCurrencyPairs } from './MsgAddCurrencyPairs'; -import { MsgRemoveCurrencyPairs } from './MsgRemoveCurrencyPairs'; +import { MsgAddCurrencyPairs } from './MsgAddCurrencyPairs' +import { MsgRemoveCurrencyPairs } from './MsgRemoveCurrencyPairs' -export * from './MsgAddCurrencyPairs'; -export * from './MsgRemoveCurrencyPairs'; +export * from './MsgAddCurrencyPairs' +export * from './MsgRemoveCurrencyPairs' -export type OracleMsg = MsgAddCurrencyPairs | MsgRemoveCurrencyPairs; +export type OracleMsg = MsgAddCurrencyPairs | MsgRemoveCurrencyPairs export namespace OracleMsg { - export type Amino = MsgAddCurrencyPairs.Amino | MsgRemoveCurrencyPairs.Amino; - export type Data = MsgAddCurrencyPairs.Data | MsgRemoveCurrencyPairs.Data; - export type Proto = MsgAddCurrencyPairs.Proto | MsgRemoveCurrencyPairs.Proto; + export type Amino = MsgAddCurrencyPairs.Amino | MsgRemoveCurrencyPairs.Amino + export type Data = MsgAddCurrencyPairs.Data | MsgRemoveCurrencyPairs.Data + export type Proto = MsgAddCurrencyPairs.Proto | MsgRemoveCurrencyPairs.Proto } diff --git a/src/core/params/ParamChange.ts b/src/core/params/ParamChange.ts index a320d42..68c8456 100644 --- a/src/core/params/ParamChange.ts +++ b/src/core/params/ParamChange.ts @@ -1,5 +1,5 @@ -import { JSONSerializable } from '../../util/json'; -import { ParamChange as ParamChange_pb } from '@initia/initia.proto/cosmos/params/v1beta1/params'; +import { JSONSerializable } from '../../util/json' +import { ParamChange as ParamChange_pb } from '@initia/initia.proto/cosmos/params/v1beta1/params' export class ParamChanges extends JSONSerializable< ParamChanges.Amino, @@ -7,38 +7,38 @@ export class ParamChanges extends JSONSerializable< ParamChanges.Proto > { constructor(public paramChanges: ParamChange[]) { - super(); + super() } public static fromAmino(proto?: ParamChanges.Amino): ParamChanges { - return new ParamChanges((proto ?? []).map(ParamChange.fromAmino)); + return new ParamChanges((proto ?? []).map(ParamChange.fromAmino)) } public toAmino(): ParamChanges.Amino { - return this.paramChanges.map(c => c.toAmino()); + return this.paramChanges.map((c) => c.toAmino()) } public static fromData(proto?: ParamChanges.Data): ParamChanges { - return new ParamChanges((proto ?? []).map(ParamChange.fromData)); + return new ParamChanges((proto ?? []).map(ParamChange.fromData)) } public toData(): ParamChanges.Data { - return this.paramChanges.map(c => c.toData()); + return this.paramChanges.map((c) => c.toData()) } public static fromProto(proto?: ParamChanges.Proto): ParamChanges { - return new ParamChanges((proto ?? []).map(ParamChange.fromProto)); + return new ParamChanges((proto ?? []).map(ParamChange.fromProto)) } public toProto(): ParamChanges.Proto { - return this.paramChanges.map(c => c.toProto()); + return this.paramChanges.map((c) => c.toProto()) } } export namespace ParamChanges { - export type Amino = ParamChange.Amino[]; - export type Data = ParamChange.Data[]; - export type Proto = ParamChange.Proto[]; + export type Amino = ParamChange.Amino[] + export type Data = ParamChange.Data[] + export type Proto = ParamChange.Proto[] } export class ParamChange extends JSONSerializable< @@ -51,63 +51,63 @@ export class ParamChange extends JSONSerializable< public key: string, public value: string ) { - super(); + super() } public static fromAmino(data: ParamChange.Amino): ParamChange { - const { subspace, key, value } = data; - return new ParamChange(subspace, key, value); + const { subspace, key, value } = data + return new ParamChange(subspace, key, value) } public toAmino(): ParamChange.Amino { - const { subspace, key, value } = this; + const { subspace, key, value } = this return { subspace, key, value, - }; + } } public static fromData(data: ParamChange.Data): ParamChange { - const { subspace, key, value } = data; - return new ParamChange(subspace, key, value); + const { subspace, key, value } = data + return new ParamChange(subspace, key, value) } public toData(): ParamChange.Data { - const { subspace, key, value } = this; + const { subspace, key, value } = this return { subspace, key, value, - }; + } } public static fromProto(proto: ParamChange.Proto): ParamChange { - return new ParamChange(proto.subspace, proto.key, proto.value); + return new ParamChange(proto.subspace, proto.key, proto.value) } public toProto(): ParamChange.Proto { - const { subspace, key, value } = this; + const { subspace, key, value } = this return ParamChange_pb.fromPartial({ key, subspace, value, - }); + }) } } export namespace ParamChange { export interface Amino { - subspace: string; - key: string; - value: string; + subspace: string + key: string + value: string } export interface Data { - subspace: string; - key: string; - value: string; + subspace: string + key: string + value: string } - export type Proto = ParamChange_pb; + export type Proto = ParamChange_pb } diff --git a/src/core/params/index.ts b/src/core/params/index.ts index 8901de8..d9467f6 100644 --- a/src/core/params/index.ts +++ b/src/core/params/index.ts @@ -1,2 +1,2 @@ -export * from './proposals'; -export * from './ParamChange'; +export * from './proposals' +export * from './ParamChange' diff --git a/src/core/params/proposals/ParameterChangeProposal.spec.ts b/src/core/params/proposals/ParameterChangeProposal.spec.ts index cc4f640..72ab19f 100644 --- a/src/core/params/proposals/ParameterChangeProposal.spec.ts +++ b/src/core/params/proposals/ParameterChangeProposal.spec.ts @@ -1,4 +1,4 @@ -import { ParameterChangeProposal } from './ParameterChangeProposal'; +import { ParameterChangeProposal } from './ParameterChangeProposal' const aminoJson: ParameterChangeProposal.Amino = { type: 'cosmos-sdk/ParameterChangeProposal', @@ -100,26 +100,26 @@ const aminoJson: ParameterChangeProposal.Amino = { }, ], }, -}; +} describe('ParameterChangeProposal', () => { it('parses parameter change proposals (amino)', () => { - expect(ParameterChangeProposal.fromAmino(aminoJson)).toBeTruthy(); - }); + expect(ParameterChangeProposal.fromAmino(aminoJson)).toBeTruthy() + }) it('parses parameter change proposals (data)', () => { const p = new ParameterChangeProposal( 'testing params', 'yay!', aminoJson.value.changes - ); - const data = p.toData(); + ) + const data = p.toData() - expect(ParameterChangeProposal.fromData(data)).toEqual(p); // check that serialization / deserialization is consistent + expect(ParameterChangeProposal.fromData(data)).toEqual(p) // check that serialization / deserialization is consistent // check that output is consistent with json expect(data).toMatchObject({ '@type': '/cosmos.params.v1beta1.ParameterChangeProposal', ...aminoJson.value, - }); - }); -}); + }) + }) +}) diff --git a/src/core/params/proposals/ParameterChangeProposal.ts b/src/core/params/proposals/ParameterChangeProposal.ts index 2a2510f..12e03e3 100644 --- a/src/core/params/proposals/ParameterChangeProposal.ts +++ b/src/core/params/proposals/ParameterChangeProposal.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ParamChange, ParamChanges } from '../ParamChange'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { ParameterChangeProposal as ParameterChangeProposal_pb } from '@initia/initia.proto/cosmos/params/v1beta1/params'; +import { JSONSerializable } from '../../../util/json' +import { ParamChange, ParamChanges } from '../ParamChange' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { ParameterChangeProposal as ParameterChangeProposal_pb } from '@initia/initia.proto/cosmos/params/v1beta1/params' /** * Describes a proposal for directly altering the value of the module parameters. @@ -31,7 +31,7 @@ export class ParameterChangeProposal extends JSONSerializable< ParameterChangeProposal.Data, ParameterChangeProposal.Proto > { - public changes: ParamChanges; + public changes: ParamChanges /** * @param title proposal's title @@ -44,11 +44,11 @@ export class ParameterChangeProposal extends JSONSerializable< public description: string, changes: ParamChange.Data[] | ParamChanges ) { - super(); + super() if (Array.isArray(changes)) { - this.changes = ParamChanges.fromData(changes); + this.changes = ParamChanges.fromData(changes) } else { - this.changes = changes; + this.changes = changes } } @@ -57,16 +57,16 @@ export class ParameterChangeProposal extends JSONSerializable< ): ParameterChangeProposal { const { value: { title, description, changes }, - } = data; + } = data return new ParameterChangeProposal( title, description, ParamChanges.fromAmino(changes) - ); + ) } public toAmino(): ParameterChangeProposal.Amino { - const { title, description, changes } = this; + const { title, description, changes } = this return { type: 'cosmos-sdk/ParameterChangeProposal', value: { @@ -74,28 +74,28 @@ export class ParameterChangeProposal extends JSONSerializable< description, changes: changes.toAmino(), }, - }; + } } public static fromData( proto: ParameterChangeProposal.Data ): ParameterChangeProposal { - const { title, description, changes } = proto; + const { title, description, changes } = proto return new ParameterChangeProposal( title, description, ParamChanges.fromData(changes) - ); + ) } public toData(): ParameterChangeProposal.Data { - const { title, description, changes } = this; + const { title, description, changes } = this return { '@type': '/cosmos.params.v1beta1.ParameterChangeProposal', title, description, changes: changes.toData(), - }; + } } public static fromProto( @@ -105,48 +105,48 @@ export class ParameterChangeProposal extends JSONSerializable< proto.title, proto.description, ParamChanges.fromProto(proto.changes) - ); + ) } public toProto(): ParameterChangeProposal.Proto { - const { title, description, changes } = this; + const { title, description, changes } = this return ParameterChangeProposal_pb.fromPartial({ changes: changes.toProto(), description, title, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.params.v1beta1.ParameterChangeProposal', value: ParameterChangeProposal_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): ParameterChangeProposal { return ParameterChangeProposal.fromProto( ParameterChangeProposal_pb.decode(msgAny.value) - ); + ) } } export namespace ParameterChangeProposal { export interface Amino { - type: 'cosmos-sdk/ParameterChangeProposal'; + type: 'cosmos-sdk/ParameterChangeProposal' value: { - title: string; - description: string; - changes: ParamChange.Amino[]; - }; + title: string + description: string + changes: ParamChange.Amino[] + } } export interface Data { - '@type': '/cosmos.params.v1beta1.ParameterChangeProposal'; - title: string; - description: string; - changes: ParamChange.Data[]; + '@type': '/cosmos.params.v1beta1.ParameterChangeProposal' + title: string + description: string + changes: ParamChange.Data[] } - export type Proto = ParameterChangeProposal_pb; + export type Proto = ParameterChangeProposal_pb } diff --git a/src/core/params/proposals/index.ts b/src/core/params/proposals/index.ts index e66920a..1ec8ac3 100644 --- a/src/core/params/proposals/index.ts +++ b/src/core/params/proposals/index.ts @@ -1 +1 @@ -export * from './ParameterChangeProposal'; +export * from './ParameterChangeProposal' diff --git a/src/core/reward/RewardParams.ts b/src/core/reward/RewardParams.ts index f254c72..411b5c1 100644 --- a/src/core/reward/RewardParams.ts +++ b/src/core/reward/RewardParams.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Duration } from '../Duration'; -import { Params as Params_pb } from '@initia/initia.proto/initia/reward/v1/types'; +import { JSONSerializable } from '../../util/json' +import { Duration } from '../Duration' +import { Params as Params_pb } from '@initia/initia.proto/initia/reward/v1/types' export class RewardParams extends JSONSerializable< RewardParams.Amino, @@ -21,7 +21,7 @@ export class RewardParams extends JSONSerializable< public dilution_rate: string, public release_enabled: boolean ) { - super(); + super() } public static fromAmino(data: RewardParams.Amino): RewardParams { @@ -33,7 +33,7 @@ export class RewardParams extends JSONSerializable< dilution_rate, release_enabled, }, - } = data; + } = data return new RewardParams( reward_denom, @@ -41,7 +41,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled - ); + ) } public toAmino(): RewardParams.Amino { @@ -51,7 +51,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled, - } = this; + } = this return { type: 'reward/Params', @@ -62,7 +62,7 @@ export class RewardParams extends JSONSerializable< dilution_rate, release_enabled, }, - }; + } } public static fromData(data: RewardParams.Data): RewardParams { @@ -72,7 +72,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled, - } = data; + } = data return new RewardParams( reward_denom, @@ -80,7 +80,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled - ); + ) } public toData(): RewardParams.Data { @@ -90,7 +90,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled, - } = this; + } = this return { '@type': '/initia.reward.v1.Params', @@ -99,7 +99,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled, - }; + } } public static fromProto(data: RewardParams.Proto): RewardParams { @@ -109,7 +109,7 @@ export class RewardParams extends JSONSerializable< data.releaseRate, data.dilutionRate, data.releaseEnabled - ); + ) } public toProto(): RewardParams.Proto { @@ -119,7 +119,7 @@ export class RewardParams extends JSONSerializable< release_rate, dilution_rate, release_enabled, - } = this; + } = this return Params_pb.fromPartial({ rewardDenom: reward_denom, @@ -127,30 +127,30 @@ export class RewardParams extends JSONSerializable< releaseRate: release_rate, dilutionRate: dilution_rate, releaseEnabled: release_enabled, - }); + }) } } export namespace RewardParams { export interface Amino { - type: 'reward/Params'; + type: 'reward/Params' value: { - reward_denom: string; - dilution_period: Duration.Amino; - release_rate: string; - dilution_rate: string; - release_enabled: boolean; - }; + reward_denom: string + dilution_period: Duration.Amino + release_rate: string + dilution_rate: string + release_enabled: boolean + } } export interface Data { - '@type': '/initia.reward.v1.Params'; - reward_denom: string; - dilution_period: Duration.Data; - release_rate: string; - dilution_rate: string; - release_enabled: boolean; + '@type': '/initia.reward.v1.Params' + reward_denom: string + dilution_period: Duration.Data + release_rate: string + dilution_rate: string + release_enabled: boolean } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/reward/index.ts b/src/core/reward/index.ts index e5a898d..87f98b3 100644 --- a/src/core/reward/index.ts +++ b/src/core/reward/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './RewardParams'; +export * from './msgs' +export * from './RewardParams' diff --git a/src/core/reward/msgs/MsgUpdateRewardParams.ts b/src/core/reward/msgs/MsgUpdateRewardParams.ts index 5a240a4..8b549b4 100644 --- a/src/core/reward/msgs/MsgUpdateRewardParams.ts +++ b/src/core/reward/msgs/MsgUpdateRewardParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { RewardParams } from '../RewardParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/reward/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { RewardParams } from '../RewardParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/initia/reward/v1/tx' export class MsgUpdateRewardParams extends JSONSerializable< MsgUpdateRewardParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateRewardParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/reward parameters to update */ - constructor(public authority: AccAddress, public params: RewardParams) { - super(); + constructor( + public authority: AccAddress, + public params: RewardParams + ) { + super() } public static fromAmino( @@ -22,35 +25,35 @@ export class MsgUpdateRewardParams extends JSONSerializable< ): MsgUpdateRewardParams { const { value: { authority, params }, - } = data; - return new MsgUpdateRewardParams(authority, RewardParams.fromAmino(params)); + } = data + return new MsgUpdateRewardParams(authority, RewardParams.fromAmino(params)) } public toAmino(): MsgUpdateRewardParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'reward/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateRewardParams.Data ): MsgUpdateRewardParams { - const { authority, params } = data; - return new MsgUpdateRewardParams(authority, RewardParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateRewardParams(authority, RewardParams.fromData(params)) } public toData(): MsgUpdateRewardParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/initia.reward.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -59,45 +62,45 @@ export class MsgUpdateRewardParams extends JSONSerializable< return new MsgUpdateRewardParams( data.authority, RewardParams.fromProto(data.params as RewardParams.Proto) - ); + ) } public toProto(): MsgUpdateRewardParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/initia.reward.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateRewardParams { return MsgUpdateRewardParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateRewardParams { export interface Amino { - type: 'reward/MsgUpdateParams'; + type: 'reward/MsgUpdateParams' value: { - authority: AccAddress; - params: RewardParams.Amino; - }; + authority: AccAddress + params: RewardParams.Amino + } } export interface Data { - '@type': '/initia.reward.v1.MsgUpdateParams'; - authority: AccAddress; - params: RewardParams.Data; + '@type': '/initia.reward.v1.MsgUpdateParams' + authority: AccAddress + params: RewardParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/reward/msgs/index.ts b/src/core/reward/msgs/index.ts index afec24c..975e365 100644 --- a/src/core/reward/msgs/index.ts +++ b/src/core/reward/msgs/index.ts @@ -1,10 +1,10 @@ -import { MsgUpdateRewardParams } from './MsgUpdateRewardParams'; +import { MsgUpdateRewardParams } from './MsgUpdateRewardParams' -export * from './MsgUpdateRewardParams'; +export * from './MsgUpdateRewardParams' -export type RewardMsg = MsgUpdateRewardParams; +export type RewardMsg = MsgUpdateRewardParams export namespace RewardMsg { - export type Amino = MsgUpdateRewardParams.Amino; - export type Data = MsgUpdateRewardParams.Data; - export type Proto = MsgUpdateRewardParams.Proto; + export type Amino = MsgUpdateRewardParams.Amino + export type Data = MsgUpdateRewardParams.Data + export type Proto = MsgUpdateRewardParams.Proto } diff --git a/src/core/slashing/SlashingParams.ts b/src/core/slashing/SlashingParams.ts index b3f3a2e..0ec42b2 100644 --- a/src/core/slashing/SlashingParams.ts +++ b/src/core/slashing/SlashingParams.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../util/json'; -import { Duration } from '../Duration'; -import { Params as Params_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/slashing'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Duration } from '../Duration' +import { Params as Params_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/slashing' +import Long from 'long' export class SlashingParams extends JSONSerializable< SlashingParams.Amino, @@ -22,7 +22,7 @@ export class SlashingParams extends JSONSerializable< public slash_fraction_double_sign: number, public slash_fraction_downtime: number ) { - super(); + super() } public static fromAmino(data: SlashingParams.Amino): SlashingParams { @@ -34,7 +34,7 @@ export class SlashingParams extends JSONSerializable< slash_fraction_double_sign, slash_fraction_downtime, }, - } = data; + } = data return new SlashingParams( Number.parseInt(signed_blocks_window), @@ -42,7 +42,7 @@ export class SlashingParams extends JSONSerializable< Duration.fromAmino(downtime_jail_duration), Number.parseInt(slash_fraction_double_sign), Number.parseInt(slash_fraction_downtime) - ); + ) } public toAmino(): SlashingParams.Amino { @@ -52,7 +52,7 @@ export class SlashingParams extends JSONSerializable< downtime_jail_duration, slash_fraction_double_sign, slash_fraction_downtime, - } = this; + } = this return { type: 'cosmos-sdk/x/slashing/Params', @@ -63,7 +63,7 @@ export class SlashingParams extends JSONSerializable< slash_fraction_double_sign: slash_fraction_double_sign.toString(), slash_fraction_downtime: slash_fraction_downtime.toString(), }, - }; + } } public static fromData(data: SlashingParams.Data): SlashingParams { @@ -73,7 +73,7 @@ export class SlashingParams extends JSONSerializable< downtime_jail_duration, slash_fraction_double_sign, slash_fraction_downtime, - } = data; + } = data return new SlashingParams( Number.parseInt(signed_blocks_window), @@ -81,7 +81,7 @@ export class SlashingParams extends JSONSerializable< Duration.fromData(downtime_jail_duration), Number.parseInt(slash_fraction_double_sign), Number.parseInt(slash_fraction_downtime) - ); + ) } public toData(): SlashingParams.Data { @@ -91,7 +91,7 @@ export class SlashingParams extends JSONSerializable< downtime_jail_duration, slash_fraction_double_sign, slash_fraction_downtime, - } = this; + } = this return { '@type': '/cosmos.slashing.v1beta1.Params', @@ -100,7 +100,7 @@ export class SlashingParams extends JSONSerializable< downtime_jail_duration: downtime_jail_duration.toData(), slash_fraction_double_sign: slash_fraction_double_sign.toString(), slash_fraction_downtime: slash_fraction_downtime.toString(), - }; + } } public static fromProto(data: SlashingParams.Proto): SlashingParams { @@ -110,7 +110,7 @@ export class SlashingParams extends JSONSerializable< Duration.fromProto(data.downtimeJailDuration as Duration.Proto), Number.parseFloat(data.slashFractionDoubleSign.toString()), Number.parseFloat(data.slashFractionDowntime.toString()) - ); + ) } public toProto(): SlashingParams.Proto { @@ -120,7 +120,7 @@ export class SlashingParams extends JSONSerializable< downtime_jail_duration, slash_fraction_double_sign, slash_fraction_downtime, - } = this; + } = this return Params_pb.fromPartial({ signedBlocksWindow: Long.fromNumber(signed_blocks_window), @@ -130,30 +130,30 @@ export class SlashingParams extends JSONSerializable< slash_fraction_double_sign.toString() ), slashFractionDowntime: Buffer.from(slash_fraction_downtime.toString()), - }); + }) } } export namespace SlashingParams { export interface Amino { - type: 'cosmos-sdk/x/slashing/Params'; + type: 'cosmos-sdk/x/slashing/Params' value: { - signed_blocks_window: string; - min_signed_per_window: string; - downtime_jail_duration: Duration.Amino; - slash_fraction_double_sign: string; - slash_fraction_downtime: string; - }; + signed_blocks_window: string + min_signed_per_window: string + downtime_jail_duration: Duration.Amino + slash_fraction_double_sign: string + slash_fraction_downtime: string + } } export interface Data { - '@type': '/cosmos.slashing.v1beta1.Params'; - signed_blocks_window: string; - min_signed_per_window: string; - downtime_jail_duration: Duration.Data; - slash_fraction_double_sign: string; - slash_fraction_downtime: string; + '@type': '/cosmos.slashing.v1beta1.Params' + signed_blocks_window: string + min_signed_per_window: string + downtime_jail_duration: Duration.Data + slash_fraction_double_sign: string + slash_fraction_downtime: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/slashing/index.ts b/src/core/slashing/index.ts index 0110d2a..41867d3 100644 --- a/src/core/slashing/index.ts +++ b/src/core/slashing/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './SlashingParams'; +export * from './msgs' +export * from './SlashingParams' diff --git a/src/core/slashing/msgs/MsgUnjail.spec.ts b/src/core/slashing/msgs/MsgUnjail.spec.ts index e7f5b5c..16ca08c 100644 --- a/src/core/slashing/msgs/MsgUnjail.spec.ts +++ b/src/core/slashing/msgs/MsgUnjail.spec.ts @@ -1,15 +1,15 @@ -import { MsgUnjail } from './MsgUnjail'; -const MsgUnjailAmino = require('./MsgUnjail.data.json'); +import { MsgUnjail } from './MsgUnjail' +const MsgUnjailAmino = require('./MsgUnjail.data.json') describe('MsgUnjail', () => { it('deserializes', () => { MsgUnjailAmino.txs.forEach((txinfo: any) => { txinfo.tx.value.msg.forEach((msg: any) => { if (msg.type == 'cosmos-sdk/MsgUnjail') { - const e = MsgUnjail.fromAmino(msg); - expect(e.toAmino()).toEqual(msg); + const e = MsgUnjail.fromAmino(msg) + expect(e.toAmino()).toEqual(msg) } - }); - }); - }); -}); + }) + }) + }) +}) diff --git a/src/core/slashing/msgs/MsgUnjail.ts b/src/core/slashing/msgs/MsgUnjail.ts index 9aaabae..d7553c8 100644 --- a/src/core/slashing/msgs/MsgUnjail.ts +++ b/src/core/slashing/msgs/MsgUnjail.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ValAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUnjail as MsgUnjail_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { ValAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUnjail as MsgUnjail_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/tx' /** * A validator can be jailed by the blockchain if misbehavior is detected, such as @@ -20,74 +20,74 @@ export class MsgUnjail extends JSONSerializable< * @param address validator's operator address */ constructor(public address: ValAddress) { - super(); + super() } public static fromAmino(data: MsgUnjail.Amino): MsgUnjail { const { value: { address }, - } = data; - return new MsgUnjail(address); + } = data + return new MsgUnjail(address) } public toAmino(): MsgUnjail.Amino { - const { address } = this; + const { address } = this return { type: 'cosmos-sdk/MsgUnjail', value: { address, }, - }; + } } public static fromData(proto: MsgUnjail.Data): MsgUnjail { - const { address } = proto; - return new MsgUnjail(address); + const { address } = proto + return new MsgUnjail(address) } public toData(): MsgUnjail.Data { - const { address } = this; + const { address } = this return { '@type': '/cosmos.slashing.v1beta1.MsgUnjail', address, - }; + } } public static fromProto(proto: MsgUnjail.Proto): MsgUnjail { - return new MsgUnjail(proto.validatorAddr); + return new MsgUnjail(proto.validatorAddr) } public toProto(): MsgUnjail.Proto { - const { address } = this; + const { address } = this return MsgUnjail_pb.fromPartial({ validatorAddr: address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.slashing.v1beta1.MsgUnjail', value: MsgUnjail_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUnjail { - return MsgUnjail.fromProto(MsgUnjail_pb.decode(msgAny.value)); + return MsgUnjail.fromProto(MsgUnjail_pb.decode(msgAny.value)) } } export namespace MsgUnjail { export interface Amino { - type: 'cosmos-sdk/MsgUnjail'; + type: 'cosmos-sdk/MsgUnjail' value: { - address: ValAddress; - }; + address: ValAddress + } } export interface Data { - '@type': '/cosmos.slashing.v1beta1.MsgUnjail'; - address: ValAddress; + '@type': '/cosmos.slashing.v1beta1.MsgUnjail' + address: ValAddress } - export type Proto = MsgUnjail_pb; + export type Proto = MsgUnjail_pb } diff --git a/src/core/slashing/msgs/MsgUpdateSlashingParams.ts b/src/core/slashing/msgs/MsgUpdateSlashingParams.ts index aa4e212..0887c1a 100644 --- a/src/core/slashing/msgs/MsgUpdateSlashingParams.ts +++ b/src/core/slashing/msgs/MsgUpdateSlashingParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { SlashingParams } from '../SlashingParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { SlashingParams } from '../SlashingParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmos/slashing/v1beta1/tx' export class MsgUpdateSlashingParams extends JSONSerializable< MsgUpdateSlashingParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateSlashingParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/slashing parameters to update */ - constructor(public authority: AccAddress, public params: SlashingParams) { - super(); + constructor( + public authority: AccAddress, + public params: SlashingParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateSlashingParams extends JSONSerializable< ): MsgUpdateSlashingParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateSlashingParams( authority, SlashingParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateSlashingParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'cosmos-sdk/x/slashing/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateSlashingParams.Data ): MsgUpdateSlashingParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateSlashingParams( authority, SlashingParams.fromData(params) - ); + ) } public toData(): MsgUpdateSlashingParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/cosmos.slashing.v1beta1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,45 @@ export class MsgUpdateSlashingParams extends JSONSerializable< return new MsgUpdateSlashingParams( data.authority, SlashingParams.fromProto(data.params as SlashingParams.Proto) - ); + ) } public toProto(): MsgUpdateSlashingParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.slashing.v1beta1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateSlashingParams { return MsgUpdateSlashingParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateSlashingParams { export interface Amino { - type: 'cosmos-sdk/x/slashing/MsgUpdateParams'; + type: 'cosmos-sdk/x/slashing/MsgUpdateParams' value: { - authority: AccAddress; - params: SlashingParams.Amino; - }; + authority: AccAddress + params: SlashingParams.Amino + } } export interface Data { - '@type': '/cosmos.slashing.v1beta1.MsgUpdateParams'; - authority: AccAddress; - params: SlashingParams.Data; + '@type': '/cosmos.slashing.v1beta1.MsgUpdateParams' + authority: AccAddress + params: SlashingParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/slashing/msgs/index.ts b/src/core/slashing/msgs/index.ts index 4928bc1..44b0876 100644 --- a/src/core/slashing/msgs/index.ts +++ b/src/core/slashing/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgUnjail } from './MsgUnjail'; -import { MsgUpdateSlashingParams } from './MsgUpdateSlashingParams'; +import { MsgUnjail } from './MsgUnjail' +import { MsgUpdateSlashingParams } from './MsgUpdateSlashingParams' -export * from './MsgUnjail'; -export * from './MsgUpdateSlashingParams'; +export * from './MsgUnjail' +export * from './MsgUpdateSlashingParams' -export type SlashingMsg = MsgUnjail | MsgUpdateSlashingParams; +export type SlashingMsg = MsgUnjail | MsgUpdateSlashingParams export namespace SlashingMsg { - export type Amino = MsgUnjail.Amino | MsgUpdateSlashingParams.Amino; - export type Data = MsgUnjail.Data | MsgUpdateSlashingParams.Data; - export type Proto = MsgUnjail.Proto | MsgUpdateSlashingParams.Proto; + export type Amino = MsgUnjail.Amino | MsgUpdateSlashingParams.Amino + export type Data = MsgUnjail.Data | MsgUpdateSlashingParams.Data + export type Proto = MsgUnjail.Proto | MsgUpdateSlashingParams.Proto } diff --git a/src/core/tokenfactory/TokenfactoryParams.ts b/src/core/tokenfactory/TokenfactoryParams.ts index b1e4fbf..bed6a7c 100644 --- a/src/core/tokenfactory/TokenfactoryParams.ts +++ b/src/core/tokenfactory/TokenfactoryParams.ts @@ -1,14 +1,14 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { Params as Params_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/params'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { Params as Params_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/params' +import Long from 'long' export class TokenfactoryParams extends JSONSerializable< TokenfactoryParams.Amino, TokenfactoryParams.Data, TokenfactoryParams.Proto > { - public denom_creation_fee: Coins; + public denom_creation_fee: Coins /** * @param denom_creation_fee the fee to be charged on the creation of a new denom * @param denom_creation_gas_consume the gas cost for creating a new denom @@ -17,68 +17,68 @@ export class TokenfactoryParams extends JSONSerializable< denom_creation_fee: Coins.Input, public denom_creation_gas_consume: number ) { - super(); - this.denom_creation_fee = new Coins(denom_creation_fee); + super() + this.denom_creation_fee = new Coins(denom_creation_fee) } public static fromAmino(data: TokenfactoryParams.Amino): TokenfactoryParams { - const { denom_creation_fee, denom_creation_gas_consume } = data; + const { denom_creation_fee, denom_creation_gas_consume } = data return new TokenfactoryParams( Coins.fromAmino(denom_creation_fee), Number.parseInt(denom_creation_gas_consume) - ); + ) } public toAmino(): TokenfactoryParams.Amino { - const { denom_creation_fee, denom_creation_gas_consume } = this; + const { denom_creation_fee, denom_creation_gas_consume } = this return { denom_creation_fee: denom_creation_fee.toAmino(), denom_creation_gas_consume: denom_creation_gas_consume.toString(), - }; + } } public static fromData(data: TokenfactoryParams.Data): TokenfactoryParams { - const { denom_creation_fee, denom_creation_gas_consume } = data; + const { denom_creation_fee, denom_creation_gas_consume } = data return new TokenfactoryParams( Coins.fromData(denom_creation_fee), Number.parseInt(denom_creation_gas_consume) - ); + ) } public toData(): TokenfactoryParams.Data { - const { denom_creation_fee, denom_creation_gas_consume } = this; + const { denom_creation_fee, denom_creation_gas_consume } = this return { denom_creation_fee: denom_creation_fee.toData(), denom_creation_gas_consume: denom_creation_gas_consume.toString(), - }; + } } public static fromProto(data: TokenfactoryParams.Proto): TokenfactoryParams { return new TokenfactoryParams( Coins.fromProto(data.denomCreationFee), data.denomCreationGasConsume.toNumber() - ); + ) } public toProto(): TokenfactoryParams.Proto { - const { denom_creation_fee, denom_creation_gas_consume } = this; + const { denom_creation_fee, denom_creation_gas_consume } = this return Params_pb.fromPartial({ denomCreationFee: denom_creation_fee.toProto(), denomCreationGasConsume: Long.fromNumber(denom_creation_gas_consume), - }); + }) } } export namespace TokenfactoryParams { export interface Amino { - denom_creation_fee: Coins.Amino; - denom_creation_gas_consume: string; + denom_creation_fee: Coins.Amino + denom_creation_gas_consume: string } export interface Data { - denom_creation_fee: Coins.Data; - denom_creation_gas_consume: string; + denom_creation_fee: Coins.Data + denom_creation_gas_consume: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/tokenfactory/index.ts b/src/core/tokenfactory/index.ts index 9ee51cf..ff6fb25 100644 --- a/src/core/tokenfactory/index.ts +++ b/src/core/tokenfactory/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './TokenfactoryParams'; +export * from './msgs' +export * from './TokenfactoryParams' diff --git a/src/core/tokenfactory/msgs/MsgBurn.ts b/src/core/tokenfactory/msgs/MsgBurn.ts index e259cdb..dbcff42 100644 --- a/src/core/tokenfactory/msgs/MsgBurn.ts +++ b/src/core/tokenfactory/msgs/MsgBurn.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coin } from '../../Coin'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgBurn as MsgBurn_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coin } from '../../Coin' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgBurn as MsgBurn_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgBurn extends JSONSerializable< MsgBurn.Amino, @@ -19,19 +19,19 @@ export class MsgBurn extends JSONSerializable< public amount: Coin, public burn_from_address: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgBurn.Amino): MsgBurn { const { value: { sender, amount, burn_from_address }, - } = data; + } = data - return new MsgBurn(sender, Coin.fromAmino(amount), burn_from_address); + return new MsgBurn(sender, Coin.fromAmino(amount), burn_from_address) } public toAmino(): MsgBurn.Amino { - const { sender, amount, burn_from_address } = this; + const { sender, amount, burn_from_address } = this return { type: 'tokenfactory/MsgBurn', value: { @@ -39,22 +39,22 @@ export class MsgBurn extends JSONSerializable< amount: amount.toAmino(), burn_from_address, }, - }; + } } public static fromData(data: MsgBurn.Data): MsgBurn { - const { sender, amount, burn_from_address } = data; - return new MsgBurn(sender, Coin.fromData(amount), burn_from_address); + const { sender, amount, burn_from_address } = data + return new MsgBurn(sender, Coin.fromData(amount), burn_from_address) } public toData(): MsgBurn.Data { - const { sender, amount, burn_from_address } = this; + const { sender, amount, burn_from_address } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgBurn', sender, amount: amount.toData(), burn_from_address, - }; + } } public static fromProto(data: MsgBurn.Proto): MsgBurn { @@ -62,46 +62,46 @@ export class MsgBurn extends JSONSerializable< data.sender, Coin.fromProto(data.amount as Coin.Proto), data.burnFromAddress - ); + ) } public toProto(): MsgBurn.Proto { - const { sender, amount, burn_from_address } = this; + const { sender, amount, burn_from_address } = this return MsgBurn_pb.fromPartial({ sender, amount: amount.toProto(), burnFromAddress: burn_from_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgBurn', value: MsgBurn_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgBurn { - return MsgBurn.fromProto(MsgBurn_pb.decode(msgAny.value)); + return MsgBurn.fromProto(MsgBurn_pb.decode(msgAny.value)) } } export namespace MsgBurn { export interface Amino { - type: 'tokenfactory/MsgBurn'; + type: 'tokenfactory/MsgBurn' value: { - sender: AccAddress; - amount: Coin.Amino; - burn_from_address: AccAddress; - }; + sender: AccAddress + amount: Coin.Amino + burn_from_address: AccAddress + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgBurn'; - sender: AccAddress; - amount: Coin.Data; - burn_from_address: AccAddress; + '@type': '/miniwasm.tokenfactory.v1.MsgBurn' + sender: AccAddress + amount: Coin.Data + burn_from_address: AccAddress } - export type Proto = MsgBurn_pb; + export type Proto = MsgBurn_pb } diff --git a/src/core/tokenfactory/msgs/MsgChangeAdmin.ts b/src/core/tokenfactory/msgs/MsgChangeAdmin.ts index 95f7cc5..0b51136 100644 --- a/src/core/tokenfactory/msgs/MsgChangeAdmin.ts +++ b/src/core/tokenfactory/msgs/MsgChangeAdmin.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgChangeAdmin as MsgChangeAdmin_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgChangeAdmin as MsgChangeAdmin_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgChangeAdmin extends JSONSerializable< MsgChangeAdmin.Amino, @@ -18,19 +18,19 @@ export class MsgChangeAdmin extends JSONSerializable< public denom: string, public new_admin: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgChangeAdmin.Amino): MsgChangeAdmin { const { value: { sender, denom, new_admin }, - } = data; + } = data - return new MsgChangeAdmin(sender, denom, new_admin); + return new MsgChangeAdmin(sender, denom, new_admin) } public toAmino(): MsgChangeAdmin.Amino { - const { sender, denom, new_admin } = this; + const { sender, denom, new_admin } = this return { type: 'tokenfactory/MsgChangeAdmin', value: { @@ -38,65 +38,65 @@ export class MsgChangeAdmin extends JSONSerializable< denom, new_admin, }, - }; + } } public static fromData(data: MsgChangeAdmin.Data): MsgChangeAdmin { - const { sender, denom, new_admin } = data; - return new MsgChangeAdmin(sender, denom, new_admin); + const { sender, denom, new_admin } = data + return new MsgChangeAdmin(sender, denom, new_admin) } public toData(): MsgChangeAdmin.Data { - const { sender, denom, new_admin } = this; + const { sender, denom, new_admin } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgChangeAdmin', sender, denom, new_admin, - }; + } } public static fromProto(data: MsgChangeAdmin.Proto): MsgChangeAdmin { - return new MsgChangeAdmin(data.sender, data.denom, data.newAdmin); + return new MsgChangeAdmin(data.sender, data.denom, data.newAdmin) } public toProto(): MsgChangeAdmin.Proto { - const { sender, denom, new_admin } = this; + const { sender, denom, new_admin } = this return MsgChangeAdmin_pb.fromPartial({ sender, denom, newAdmin: new_admin, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgChangeAdmin', value: MsgChangeAdmin_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgChangeAdmin { - return MsgChangeAdmin.fromProto(MsgChangeAdmin_pb.decode(msgAny.value)); + return MsgChangeAdmin.fromProto(MsgChangeAdmin_pb.decode(msgAny.value)) } } export namespace MsgChangeAdmin { export interface Amino { - type: 'tokenfactory/MsgChangeAdmin'; + type: 'tokenfactory/MsgChangeAdmin' value: { - sender: AccAddress; - denom: string; - new_admin: AccAddress; - }; + sender: AccAddress + denom: string + new_admin: AccAddress + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgChangeAdmin'; - sender: AccAddress; - denom: string; - new_admin: AccAddress; + '@type': '/miniwasm.tokenfactory.v1.MsgChangeAdmin' + sender: AccAddress + denom: string + new_admin: AccAddress } - export type Proto = MsgChangeAdmin_pb; + export type Proto = MsgChangeAdmin_pb } diff --git a/src/core/tokenfactory/msgs/MsgCreateDenom.ts b/src/core/tokenfactory/msgs/MsgCreateDenom.ts index e5a8590..0ca3215 100644 --- a/src/core/tokenfactory/msgs/MsgCreateDenom.ts +++ b/src/core/tokenfactory/msgs/MsgCreateDenom.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCreateDenom as MsgCreateDenom_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCreateDenom as MsgCreateDenom_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgCreateDenom extends JSONSerializable< MsgCreateDenom.Amino, @@ -12,81 +12,84 @@ export class MsgCreateDenom extends JSONSerializable< * @param sender the actor that signed the messages * @param subdenom can be up to 44 "alphanumeric" characters long */ - constructor(public sender: AccAddress, public subdenom: string) { - super(); + constructor( + public sender: AccAddress, + public subdenom: string + ) { + super() } public static fromAmino(data: MsgCreateDenom.Amino): MsgCreateDenom { const { value: { sender, subdenom }, - } = data; + } = data - return new MsgCreateDenom(sender, subdenom); + return new MsgCreateDenom(sender, subdenom) } public toAmino(): MsgCreateDenom.Amino { - const { sender, subdenom } = this; + const { sender, subdenom } = this return { type: 'tokenfactory/MsgCreateDenom', value: { sender, subdenom, }, - }; + } } public static fromData(data: MsgCreateDenom.Data): MsgCreateDenom { - const { sender, subdenom } = data; - return new MsgCreateDenom(sender, subdenom); + const { sender, subdenom } = data + return new MsgCreateDenom(sender, subdenom) } public toData(): MsgCreateDenom.Data { - const { sender, subdenom } = this; + const { sender, subdenom } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgCreateDenom', sender, subdenom, - }; + } } public static fromProto(data: MsgCreateDenom.Proto): MsgCreateDenom { - return new MsgCreateDenom(data.sender, data.subdenom); + return new MsgCreateDenom(data.sender, data.subdenom) } public toProto(): MsgCreateDenom.Proto { - const { sender, subdenom } = this; + const { sender, subdenom } = this return MsgCreateDenom_pb.fromPartial({ sender, subdenom, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgCreateDenom', value: MsgCreateDenom_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCreateDenom { - return MsgCreateDenom.fromProto(MsgCreateDenom_pb.decode(msgAny.value)); + return MsgCreateDenom.fromProto(MsgCreateDenom_pb.decode(msgAny.value)) } } export namespace MsgCreateDenom { export interface Amino { - type: 'tokenfactory/MsgCreateDenom'; + type: 'tokenfactory/MsgCreateDenom' value: { - sender: AccAddress; - subdenom: string; - }; + sender: AccAddress + subdenom: string + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgCreateDenom'; - sender: AccAddress; - subdenom: string; + '@type': '/miniwasm.tokenfactory.v1.MsgCreateDenom' + sender: AccAddress + subdenom: string } - export type Proto = MsgCreateDenom_pb; + export type Proto = MsgCreateDenom_pb } diff --git a/src/core/tokenfactory/msgs/MsgForceTransfer.ts b/src/core/tokenfactory/msgs/MsgForceTransfer.ts index cfb56e6..aaa522f 100644 --- a/src/core/tokenfactory/msgs/MsgForceTransfer.ts +++ b/src/core/tokenfactory/msgs/MsgForceTransfer.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coin } from '../../Coin'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgForceTransfer as MsgForceTransfer_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coin } from '../../Coin' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgForceTransfer as MsgForceTransfer_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgForceTransfer extends JSONSerializable< MsgForceTransfer.Amino, @@ -21,24 +21,24 @@ export class MsgForceTransfer extends JSONSerializable< public transfer_from_address: AccAddress, public transfer_to_address: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgForceTransfer.Amino): MsgForceTransfer { const { value: { sender, amount, transfer_from_address, transfer_to_address }, - } = data; + } = data return new MsgForceTransfer( sender, Coin.fromAmino(amount), transfer_from_address, transfer_to_address - ); + ) } public toAmino(): MsgForceTransfer.Amino { - const { sender, amount, transfer_from_address, transfer_to_address } = this; + const { sender, amount, transfer_from_address, transfer_to_address } = this return { type: 'tokenfactory/MsgForceTransfer', value: { @@ -47,28 +47,28 @@ export class MsgForceTransfer extends JSONSerializable< transfer_from_address, transfer_to_address, }, - }; + } } public static fromData(data: MsgForceTransfer.Data): MsgForceTransfer { - const { sender, amount, transfer_from_address, transfer_to_address } = data; + const { sender, amount, transfer_from_address, transfer_to_address } = data return new MsgForceTransfer( sender, Coin.fromData(amount), transfer_from_address, transfer_to_address - ); + ) } public toData(): MsgForceTransfer.Data { - const { sender, amount, transfer_from_address, transfer_to_address } = this; + const { sender, amount, transfer_from_address, transfer_to_address } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgForceTransfer', sender, amount: amount.toData(), transfer_from_address, transfer_to_address, - }; + } } public static fromProto(data: MsgForceTransfer.Proto): MsgForceTransfer { @@ -77,49 +77,49 @@ export class MsgForceTransfer extends JSONSerializable< Coin.fromProto(data.amount as Coin.Proto), data.transferFromAddress, data.transferToAddress - ); + ) } public toProto(): MsgForceTransfer.Proto { - const { sender, amount, transfer_from_address, transfer_to_address } = this; + const { sender, amount, transfer_from_address, transfer_to_address } = this return MsgForceTransfer_pb.fromPartial({ sender, amount: amount.toProto(), transferFromAddress: transfer_from_address, transferToAddress: transfer_to_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgForceTransfer', value: MsgForceTransfer_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgForceTransfer { - return MsgForceTransfer.fromProto(MsgForceTransfer_pb.decode(msgAny.value)); + return MsgForceTransfer.fromProto(MsgForceTransfer_pb.decode(msgAny.value)) } } export namespace MsgForceTransfer { export interface Amino { - type: 'tokenfactory/MsgForceTransfer'; + type: 'tokenfactory/MsgForceTransfer' value: { - sender: AccAddress; - amount: Coin.Amino; - transfer_from_address: AccAddress; - transfer_to_address: AccAddress; - }; + sender: AccAddress + amount: Coin.Amino + transfer_from_address: AccAddress + transfer_to_address: AccAddress + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgForceTransfer'; - sender: AccAddress; - amount: Coin.Data; - transfer_from_address: AccAddress; - transfer_to_address: AccAddress; + '@type': '/miniwasm.tokenfactory.v1.MsgForceTransfer' + sender: AccAddress + amount: Coin.Data + transfer_from_address: AccAddress + transfer_to_address: AccAddress } - export type Proto = MsgForceTransfer_pb; + export type Proto = MsgForceTransfer_pb } diff --git a/src/core/tokenfactory/msgs/MsgMint.ts b/src/core/tokenfactory/msgs/MsgMint.ts index 43973fd..0b085df 100644 --- a/src/core/tokenfactory/msgs/MsgMint.ts +++ b/src/core/tokenfactory/msgs/MsgMint.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coin } from '../../Coin'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgMint as MsgMint_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coin } from '../../Coin' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgMint as MsgMint_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgMint extends JSONSerializable< MsgMint.Amino, @@ -19,19 +19,19 @@ export class MsgMint extends JSONSerializable< public amount: Coin, public mint_to_address: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgMint.Amino): MsgMint { const { value: { sender, amount, mint_to_address }, - } = data; + } = data - return new MsgMint(sender, Coin.fromAmino(amount), mint_to_address); + return new MsgMint(sender, Coin.fromAmino(amount), mint_to_address) } public toAmino(): MsgMint.Amino { - const { sender, amount, mint_to_address } = this; + const { sender, amount, mint_to_address } = this return { type: 'tokenfactory/MsgMint', value: { @@ -39,22 +39,22 @@ export class MsgMint extends JSONSerializable< amount: amount.toAmino(), mint_to_address, }, - }; + } } public static fromData(data: MsgMint.Data): MsgMint { - const { sender, amount, mint_to_address } = data; - return new MsgMint(sender, Coin.fromData(amount), mint_to_address); + const { sender, amount, mint_to_address } = data + return new MsgMint(sender, Coin.fromData(amount), mint_to_address) } public toData(): MsgMint.Data { - const { sender, amount, mint_to_address } = this; + const { sender, amount, mint_to_address } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgMint', sender, amount: amount.toData(), mint_to_address, - }; + } } public static fromProto(data: MsgMint.Proto): MsgMint { @@ -62,46 +62,46 @@ export class MsgMint extends JSONSerializable< data.sender, Coin.fromProto(data.amount as Coin.Proto), data.mintToAddress - ); + ) } public toProto(): MsgMint.Proto { - const { sender, amount, mint_to_address } = this; + const { sender, amount, mint_to_address } = this return MsgMint_pb.fromPartial({ sender, amount: amount.toProto(), mintToAddress: mint_to_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgMint', value: MsgMint_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgMint { - return MsgMint.fromProto(MsgMint_pb.decode(msgAny.value)); + return MsgMint.fromProto(MsgMint_pb.decode(msgAny.value)) } } export namespace MsgMint { export interface Amino { - type: 'tokenfactory/MsgMint'; + type: 'tokenfactory/MsgMint' value: { - sender: AccAddress; - amount: Coin.Amino; - mint_to_address: AccAddress; - }; + sender: AccAddress + amount: Coin.Amino + mint_to_address: AccAddress + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgMint'; - sender: AccAddress; - amount: Coin.Data; - mint_to_address: AccAddress; + '@type': '/miniwasm.tokenfactory.v1.MsgMint' + sender: AccAddress + amount: Coin.Data + mint_to_address: AccAddress } - export type Proto = MsgMint_pb; + export type Proto = MsgMint_pb } diff --git a/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts b/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts index bcd5fbb..d1c41f5 100644 --- a/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts +++ b/src/core/tokenfactory/msgs/MsgSetBeforeSendHook.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetBeforeSendHook as MsgSetBeforeSendHook_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetBeforeSendHook as MsgSetBeforeSendHook_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgSetBeforeSendHook extends JSONSerializable< MsgSetBeforeSendHook.Amino, @@ -18,7 +18,7 @@ export class MsgSetBeforeSendHook extends JSONSerializable< public denom: string, public cosmwasm_address: AccAddress ) { - super(); + super() } public static fromAmino( @@ -26,13 +26,13 @@ export class MsgSetBeforeSendHook extends JSONSerializable< ): MsgSetBeforeSendHook { const { value: { sender, denom, cosmwasm_address }, - } = data; + } = data - return new MsgSetBeforeSendHook(sender, denom, cosmwasm_address); + return new MsgSetBeforeSendHook(sender, denom, cosmwasm_address) } public toAmino(): MsgSetBeforeSendHook.Amino { - const { sender, denom, cosmwasm_address } = this; + const { sender, denom, cosmwasm_address } = this return { type: 'tokenfactory/MsgSetBeforeSendHook', value: { @@ -40,24 +40,24 @@ export class MsgSetBeforeSendHook extends JSONSerializable< denom, cosmwasm_address, }, - }; + } } public static fromData( data: MsgSetBeforeSendHook.Data ): MsgSetBeforeSendHook { - const { sender, denom, cosmwasm_address } = data; - return new MsgSetBeforeSendHook(sender, denom, cosmwasm_address); + const { sender, denom, cosmwasm_address } = data + return new MsgSetBeforeSendHook(sender, denom, cosmwasm_address) } public toData(): MsgSetBeforeSendHook.Data { - const { sender, denom, cosmwasm_address } = this; + const { sender, denom, cosmwasm_address } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook', sender, denom, cosmwasm_address, - }; + } } public static fromProto( @@ -67,48 +67,48 @@ export class MsgSetBeforeSendHook extends JSONSerializable< data.sender, data.denom, data.cosmwasmAddress - ); + ) } public toProto(): MsgSetBeforeSendHook.Proto { - const { sender, denom, cosmwasm_address } = this; + const { sender, denom, cosmwasm_address } = this return MsgSetBeforeSendHook_pb.fromPartial({ sender, denom, cosmwasmAddress: cosmwasm_address, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook', value: MsgSetBeforeSendHook_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetBeforeSendHook { return MsgSetBeforeSendHook.fromProto( MsgSetBeforeSendHook_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetBeforeSendHook { export interface Amino { - type: 'tokenfactory/MsgSetBeforeSendHook'; + type: 'tokenfactory/MsgSetBeforeSendHook' value: { - sender: AccAddress; - denom: string; - cosmwasm_address: AccAddress; - }; + sender: AccAddress + denom: string + cosmwasm_address: AccAddress + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook'; - sender: AccAddress; - denom: string; - cosmwasm_address: AccAddress; + '@type': '/miniwasm.tokenfactory.v1.MsgSetBeforeSendHook' + sender: AccAddress + denom: string + cosmwasm_address: AccAddress } - export type Proto = MsgSetBeforeSendHook_pb; + export type Proto = MsgSetBeforeSendHook_pb } diff --git a/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts b/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts index 2515ee2..039046b 100644 --- a/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts +++ b/src/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { DenomMetadata } from '../../bank/DenomMetadata'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { DenomMetadata } from '../../bank/DenomMetadata' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSetDenomMetadata as MsgSetDenomMetadata_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgSetDenomMetadataWasm extends JSONSerializable< MsgSetDenomMetadataWasm.Amino, @@ -13,8 +13,11 @@ export class MsgSetDenomMetadataWasm extends JSONSerializable< * @param sender * @param metadata */ - constructor(public sender: AccAddress, public metadata: DenomMetadata) { - super(); + constructor( + public sender: AccAddress, + public metadata: DenomMetadata + ) { + super() } public static fromAmino( @@ -22,41 +25,38 @@ export class MsgSetDenomMetadataWasm extends JSONSerializable< ): MsgSetDenomMetadataWasm { const { value: { sender, metadata }, - } = data; + } = data return new MsgSetDenomMetadataWasm( sender, DenomMetadata.fromAmino(metadata) - ); + ) } public toAmino(): MsgSetDenomMetadataWasm.Amino { - const { sender, metadata } = this; + const { sender, metadata } = this return { type: 'tokenfactory/MsgSetDenomMetadata', value: { sender, metadata: metadata.toAmino(), }, - }; + } } public static fromData( data: MsgSetDenomMetadataWasm.Data ): MsgSetDenomMetadataWasm { - const { sender, metadata } = data; - return new MsgSetDenomMetadataWasm( - sender, - DenomMetadata.fromData(metadata) - ); + const { sender, metadata } = data + return new MsgSetDenomMetadataWasm(sender, DenomMetadata.fromData(metadata)) } public toData(): MsgSetDenomMetadataWasm.Data { - const { sender, metadata } = this; + const { sender, metadata } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata', sender, metadata: metadata.toData(), - }; + } } public static fromProto( @@ -65,45 +65,45 @@ export class MsgSetDenomMetadataWasm extends JSONSerializable< return new MsgSetDenomMetadataWasm( data.sender, DenomMetadata.fromProto(data.metadata as DenomMetadata.Proto) - ); + ) } public toProto(): MsgSetDenomMetadataWasm.Proto { - const { sender, metadata } = this; + const { sender, metadata } = this return MsgSetDenomMetadata_pb.fromPartial({ sender, metadata: metadata.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata', value: MsgSetDenomMetadata_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSetDenomMetadataWasm { return MsgSetDenomMetadataWasm.fromProto( MsgSetDenomMetadata_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSetDenomMetadataWasm { export interface Amino { - type: 'tokenfactory/MsgSetDenomMetadata'; + type: 'tokenfactory/MsgSetDenomMetadata' value: { - sender: AccAddress; - metadata: DenomMetadata.Amino; - }; + sender: AccAddress + metadata: DenomMetadata.Amino + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata'; - sender: AccAddress; - metadata: DenomMetadata.Data; + '@type': '/miniwasm.tokenfactory.v1.MsgSetDenomMetadata' + sender: AccAddress + metadata: DenomMetadata.Data } - export type Proto = MsgSetDenomMetadata_pb; + export type Proto = MsgSetDenomMetadata_pb } diff --git a/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts b/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts index 3c8f94b..83942ee 100644 --- a/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts +++ b/src/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { TokenfactoryParams } from '../TokenfactoryParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { TokenfactoryParams } from '../TokenfactoryParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/miniwasm/tokenfactory/v1/tx' export class MsgUpdateTokenfactoryParams extends JSONSerializable< MsgUpdateTokenfactoryParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateTokenfactoryParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/tokenfactory parameters to update */ - constructor(public authority: AccAddress, public params: TokenfactoryParams) { - super(); + constructor( + public authority: AccAddress, + public params: TokenfactoryParams + ) { + super() } public static fromAmino( @@ -22,41 +25,41 @@ export class MsgUpdateTokenfactoryParams extends JSONSerializable< ): MsgUpdateTokenfactoryParams { const { value: { authority, params }, - } = data; + } = data return new MsgUpdateTokenfactoryParams( authority, TokenfactoryParams.fromAmino(params) - ); + ) } public toAmino(): MsgUpdateTokenfactoryParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'tokenfactory/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateTokenfactoryParams.Data ): MsgUpdateTokenfactoryParams { - const { authority, params } = data; + const { authority, params } = data return new MsgUpdateTokenfactoryParams( authority, TokenfactoryParams.fromData(params) - ); + ) } public toData(): MsgUpdateTokenfactoryParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/miniwasm.tokenfactory.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -65,45 +68,45 @@ export class MsgUpdateTokenfactoryParams extends JSONSerializable< return new MsgUpdateTokenfactoryParams( data.authority, TokenfactoryParams.fromProto(data.params as TokenfactoryParams.Proto) - ); + ) } public toProto(): MsgUpdateTokenfactoryParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/miniwasm.tokenfactory.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateTokenfactoryParams { return MsgUpdateTokenfactoryParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateTokenfactoryParams { export interface Amino { - type: 'tokenfactory/MsgUpdateParams'; + type: 'tokenfactory/MsgUpdateParams' value: { - authority: AccAddress; - params: TokenfactoryParams.Amino; - }; + authority: AccAddress + params: TokenfactoryParams.Amino + } } export interface Data { - '@type': '/miniwasm.tokenfactory.v1.MsgUpdateParams'; - authority: AccAddress; - params: TokenfactoryParams.Data; + '@type': '/miniwasm.tokenfactory.v1.MsgUpdateParams' + authority: AccAddress + params: TokenfactoryParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/tokenfactory/msgs/index.ts b/src/core/tokenfactory/msgs/index.ts index cc7d57d..f7008c0 100644 --- a/src/core/tokenfactory/msgs/index.ts +++ b/src/core/tokenfactory/msgs/index.ts @@ -1,20 +1,20 @@ -import { MsgCreateDenom } from './MsgCreateDenom'; -import { MsgMint } from './MsgMint'; -import { MsgBurn } from './MsgBurn'; -import { MsgChangeAdmin } from './MsgChangeAdmin'; -import { MsgSetDenomMetadataWasm } from './MsgSetDenomMetadataWasm'; -import { MsgSetBeforeSendHook } from './MsgSetBeforeSendHook'; -import { MsgForceTransfer } from './MsgForceTransfer'; -import { MsgUpdateTokenfactoryParams } from './MsgUpdateTokenfactoryParams'; +import { MsgCreateDenom } from './MsgCreateDenom' +import { MsgMint } from './MsgMint' +import { MsgBurn } from './MsgBurn' +import { MsgChangeAdmin } from './MsgChangeAdmin' +import { MsgSetDenomMetadataWasm } from './MsgSetDenomMetadataWasm' +import { MsgSetBeforeSendHook } from './MsgSetBeforeSendHook' +import { MsgForceTransfer } from './MsgForceTransfer' +import { MsgUpdateTokenfactoryParams } from './MsgUpdateTokenfactoryParams' -export * from './MsgCreateDenom'; -export * from './MsgMint'; -export * from './MsgBurn'; -export * from './MsgChangeAdmin'; -export * from './MsgSetDenomMetadataWasm'; -export * from './MsgSetBeforeSendHook'; -export * from './MsgForceTransfer'; -export * from './MsgUpdateTokenfactoryParams'; +export * from './MsgCreateDenom' +export * from './MsgMint' +export * from './MsgBurn' +export * from './MsgChangeAdmin' +export * from './MsgSetDenomMetadataWasm' +export * from './MsgSetBeforeSendHook' +export * from './MsgForceTransfer' +export * from './MsgUpdateTokenfactoryParams' export type TokenfactoryMsg = | MsgCreateDenom @@ -24,7 +24,7 @@ export type TokenfactoryMsg = | MsgSetDenomMetadataWasm | MsgSetBeforeSendHook | MsgForceTransfer - | MsgUpdateTokenfactoryParams; + | MsgUpdateTokenfactoryParams export namespace TokenfactoryMsg { export type Amino = @@ -35,7 +35,7 @@ export namespace TokenfactoryMsg { | MsgSetDenomMetadataWasm.Amino | MsgSetBeforeSendHook.Amino | MsgForceTransfer.Amino - | MsgUpdateTokenfactoryParams.Amino; + | MsgUpdateTokenfactoryParams.Amino export type Data = | MsgCreateDenom.Data @@ -45,7 +45,7 @@ export namespace TokenfactoryMsg { | MsgSetDenomMetadataWasm.Data | MsgSetBeforeSendHook.Data | MsgForceTransfer.Data - | MsgUpdateTokenfactoryParams.Data; + | MsgUpdateTokenfactoryParams.Data export type Proto = | MsgCreateDenom.Proto @@ -55,5 +55,5 @@ export namespace TokenfactoryMsg { | MsgSetDenomMetadataWasm.Proto | MsgSetBeforeSendHook.Proto | MsgForceTransfer.Proto - | MsgUpdateTokenfactoryParams.Proto; + | MsgUpdateTokenfactoryParams.Proto } diff --git a/src/core/tx/CompactBitArray.ts b/src/core/tx/CompactBitArray.ts index 6a98600..f21f2f3 100644 --- a/src/core/tx/CompactBitArray.ts +++ b/src/core/tx/CompactBitArray.ts @@ -1,79 +1,81 @@ -import { CompactBitArray as CompactBitArray_pb } from '@initia/initia.proto/cosmos/crypto/multisig/v1beta1/multisig'; +import { CompactBitArray as CompactBitArray_pb } from '@initia/initia.proto/cosmos/crypto/multisig/v1beta1/multisig' export class CompactBitArray { - constructor(public extra_bits_stored: number, public elems: Buffer) {} + constructor( + public extra_bits_stored: number, + public elems: Buffer + ) {} public static fromBits(bits: number): CompactBitArray { if (bits <= 0) { - throw new Error('CompactBitArray bits must be bigger than 0'); + throw new Error('CompactBitArray bits must be bigger than 0') } - const num_elems = (bits + 7) / 8; + const num_elems = (bits + 7) / 8 if (num_elems <= 0 || num_elems > Math.pow(2, 32) - 1) { // We encountered an overflow here, and shouldn't pass negatives // to make, nor should we allow unreasonable limits > maxint32. // See https://github.com/cosmos/cosmos-sdk/issues/9162 - throw new Error('CompactBitArray overflow'); + throw new Error('CompactBitArray overflow') } - return new CompactBitArray(bits % 8, Buffer.alloc(num_elems)); + return new CompactBitArray(bits % 8, Buffer.alloc(num_elems)) } // returns the number of bits in the bitarray public count(): number { if (this.extra_bits_stored == 0) { - return this.elems.length * 8; + return this.elems.length * 8 } - return (this.elems.length - 1) * 8 + this.extra_bits_stored; + return (this.elems.length - 1) * 8 + this.extra_bits_stored } // returns true if the bit at index i is set; returns false otherwise. // The behavior is undefined if i >= bA.Count() public getIndex(i: number): boolean { if (i < 0 || i >= this.count()) { - return false; + return false } - return (this.elems.readUInt8(i >> 3) & (1 << (7 - (i % 8)))) > 0; + return (this.elems.readUInt8(i >> 3) & (1 << (7 - (i % 8)))) > 0 } // sets the bit at index i within the bit array. Returns true if and only if the // operation succeeded. The behavior is undefined if i >= bA.Count() public setIndex(i: number, v: boolean): boolean { if (i < 0 || i >= this.count()) { - return false; + return false } if (v) { - this.elems[i >> 3] |= 1 << (7 - (i % 8)); + this.elems[i >> 3] |= 1 << (7 - (i % 8)) } else { - this.elems[i >> 3] &= ~(1 << (7 - (i % 8))); + this.elems[i >> 3] &= ~(1 << (7 - (i % 8))) } - return true; + return true } // returns the number of bits set to true before the // given index. e.g. if bA = _XX__XX, NumOfTrueBitsBefore(4) = 2, since // there are two bits set to true before index 4. public numTrueBitsBefore(index: number): number { - const countOneBits = (n: number) => - n.toString(2).split('0').join('').length; + const countOneBits = (n: number) => n.toString(2).split('0').join('').length - let ones_count = 0; - const max = this.count(); + let ones_count = 0 + const max = this.count() if (index > max) { - index = max; + index = max } // below we iterate over the bytes then over bits (in low endian) and count bits set to 1 for (let elem = 0; ; elem++) { if (elem * 8 + 7 >= index) { - ones_count += countOneBits(this.elems[elem] >> (7 - (index % 8) + 1)); - return ones_count; + ones_count += countOneBits(this.elems[elem] >> (7 - (index % 8) + 1)) + return ones_count } - ones_count += countOneBits(this.elems[elem]); + ones_count += countOneBits(this.elems[elem]) } } @@ -81,33 +83,33 @@ export class CompactBitArray { return new CompactBitArray( data.extra_bits_stored, Buffer.from(data.elems, 'base64') - ); + ) } public toData(): CompactBitArray.Data { return { elems: this.elems.toString('base64'), extra_bits_stored: this.extra_bits_stored, - }; + } } public static fromProto(proto: CompactBitArray.Proto): CompactBitArray { - return new CompactBitArray(proto.extraBitsStored, Buffer.from(proto.elems)); + return new CompactBitArray(proto.extraBitsStored, Buffer.from(proto.elems)) } public toProto(): CompactBitArray.Proto { return CompactBitArray_pb.fromPartial({ elems: this.elems, extraBitsStored: this.extra_bits_stored, - }); + }) } } export namespace CompactBitArray { export interface Data { - extra_bits_stored: number; - elems: string; + extra_bits_stored: number + elems: string } - export type Proto = CompactBitArray_pb; + export type Proto = CompactBitArray_pb } diff --git a/src/core/tx/Fee.ts b/src/core/tx/Fee.ts index 07850b1..1fb792e 100644 --- a/src/core/tx/Fee.ts +++ b/src/core/tx/Fee.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../util/json'; -import { Coins } from '../Coins'; -import { num } from '../num'; -import { AccAddress } from '../bech32'; -import { Fee as Fee_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Coins } from '../Coins' +import { num } from '../num' +import { AccAddress } from '../bech32' +import { Fee as Fee_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx' +import Long from 'long' /** * A transaction must include a fee, otherwise it will be rejected. */ export class Fee extends JSONSerializable { /** Fee amount to be paid */ - public readonly amount: Coins; + public readonly amount: Coins /** * Creates a new Fee object. @@ -23,20 +23,20 @@ export class Fee extends JSONSerializable { public payer?: AccAddress, public granter?: AccAddress ) { - super(); - this.amount = new Coins(amount); + super() + this.amount = new Coins(amount) } public static fromAmino(data: Fee.Amino): Fee { - const { gas, amount } = data; - return new Fee(Number.parseInt(gas), Coins.fromAmino(amount), '', ''); + const { gas, amount } = data + return new Fee(Number.parseInt(gas), Coins.fromAmino(amount), '', '') } public toAmino(): Fee.Amino { return { gas: num(this.gas_limit).toFixed(0), amount: this.amount.toAmino(), - }; + } } public static fromData(data: Fee.Data): Fee { @@ -45,17 +45,17 @@ export class Fee extends JSONSerializable { Coins.fromData(data.amount), data.payer, data.granter - ); + ) } public toData(): Fee.Data { - const { amount, gas_limit, payer, granter } = this; + const { amount, gas_limit, payer, granter } = this return { amount: amount.toData(), gas_limit: gas_limit.toFixed(), granter: granter ?? '', payer: payer ?? '', - }; + } } public static fromProto(proto: Fee.Proto): Fee { @@ -64,39 +64,39 @@ export class Fee extends JSONSerializable { Coins.fromProto(proto.amount), proto.payer, proto.granter - ); + ) } public toProto(): Fee.Proto { - const { amount, gas_limit, payer, granter } = this; + const { amount, gas_limit, payer, granter } = this return Fee_pb.fromPartial({ amount: amount.toProto(), gasLimit: Long.fromNumber(gas_limit), granter, payer, - }); + }) } /** * Gets the minimum gas prices implied by the fee. Minimum gas prices are `fee amount / gas`. */ public gasPrices(): Coins { - return this.amount.toDecCoins().div(this.gas_limit); + return this.amount.toDecCoins().div(this.gas_limit) } } export namespace Fee { export interface Amino { - gas: string; - amount: Coins.Amino; + gas: string + amount: Coins.Amino } export interface Data { - gas_limit: string; - payer: string; - granter: string; - amount: Coins.Data; + gas_limit: string + payer: string + granter: string + amount: Coins.Data } - export type Proto = Fee_pb; + export type Proto = Fee_pb } diff --git a/src/core/tx/MultiSignature.ts b/src/core/tx/MultiSignature.ts index a70f3e8..fffd573 100644 --- a/src/core/tx/MultiSignature.ts +++ b/src/core/tx/MultiSignature.ts @@ -1,42 +1,42 @@ -import { LegacyAminoMultisigPublicKey, SimplePublicKey } from '../PublicKey'; -import { CompactBitArray } from './CompactBitArray'; -import { SignatureV2 } from './SignatureV2'; +import { LegacyAminoMultisigPublicKey, SimplePublicKey } from '../PublicKey' +import { CompactBitArray } from './CompactBitArray' +import { SignatureV2 } from './SignatureV2' export class MultiSignature { - public bitarray: CompactBitArray; - public signatures: SignatureV2.Descriptor[]; + public bitarray: CompactBitArray + public signatures: SignatureV2.Descriptor[] /** * MultiSignature constructor * public_keys order must be guaranteed */ constructor(public multisig_pubkey: LegacyAminoMultisigPublicKey) { - const n = multisig_pubkey.pubkeys.length; - this.bitarray = CompactBitArray.fromBits(n); - this.signatures = []; + const n = multisig_pubkey.pubkeys.length + this.bitarray = CompactBitArray.fromBits(n) + this.signatures = [] } public appendSignature( signature_data: SignatureV2.Descriptor, index: number ) { - const newSigIndex = this.bitarray.numTrueBitsBefore(index); + const newSigIndex = this.bitarray.numTrueBitsBefore(index) // Signature already exists, just replace the value there if (this.bitarray.getIndex(index)) { - this.signatures[newSigIndex] = signature_data; - return; + this.signatures[newSigIndex] = signature_data + return } - this.bitarray.setIndex(index, true); + this.bitarray.setIndex(index, true) // Optimization if the index is the greatest index if (newSigIndex == this.signatures.length) { - this.signatures.push(signature_data); - return; + this.signatures.push(signature_data) + return } - this.signatures.splice(newSigIndex, 0, signature_data); + this.signatures.splice(newSigIndex, 0, signature_data) } // adds a signature to the multisig, at the index in @@ -46,28 +46,28 @@ export class MultiSignature { public_key: SimplePublicKey ) { const index = this.multisig_pubkey.pubkeys.findIndex( - v => v.key === public_key.key - ); + (v) => v.key === public_key.key + ) if (index == -1) { - throw new Error("provided key doesn't exist in public_keys"); + throw new Error("provided key doesn't exist in public_keys") } - this.appendSignature(signature_data, index); + this.appendSignature(signature_data, index) } public appendSignatureV2s(signatures: SignatureV2[]) { for (const signature of signatures) { if (!(signature.public_key instanceof SimplePublicKey)) { - throw new Error('non-SimplePublicKey cannot be used to sign multisig'); + throw new Error('non-SimplePublicKey cannot be used to sign multisig') } - this.appendSignatureFromPubKey(signature.data, signature.public_key); + this.appendSignatureFromPubKey(signature.data, signature.public_key) } } public toSignatureDescriptor(): SignatureV2.Descriptor { return new SignatureV2.Descriptor( new SignatureV2.Descriptor.Multi(this.bitarray, this.signatures) - ); + ) } } diff --git a/src/core/tx/SignDoc.ts b/src/core/tx/SignDoc.ts index f29c2a5..0c7eae4 100644 --- a/src/core/tx/SignDoc.ts +++ b/src/core/tx/SignDoc.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../util/json'; -import { Fee } from './Fee'; -import { Msg } from '../Msg'; -import Long from 'long'; -import { SignDoc as SignDoc_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx'; -import { TxBody, AuthInfo, Tx } from './Tx'; +import { JSONSerializable } from '../../util/json' +import { Fee } from './Fee' +import { Msg } from '../Msg' +import Long from 'long' +import { SignDoc as SignDoc_pb } from '@initia/initia.proto/cosmos/tx/v1beta1/tx' +import { TxBody, AuthInfo, Tx } from './Tx' /** * A sign message is a data structure that is used to create a [[StdSignature]] to be later * appended to the list of signatures in an [[StdTx]]. Essentially, it contains all the @@ -34,7 +34,7 @@ export class SignDoc extends JSONSerializable< public auth_info: AuthInfo, public tx_body: TxBody ) { - super(); + super() } public toAmino(): SignDoc.Amino { @@ -44,7 +44,7 @@ export class SignDoc extends JSONSerializable< sequence, tx_body: { memo, messages, timeout_height }, auth_info: { fee }, - } = this; + } = this return { chain_id, @@ -55,57 +55,57 @@ export class SignDoc extends JSONSerializable< ? timeout_height.toString() : undefined, fee: fee.toAmino(), - msgs: messages.map(m => m.toAmino()), + msgs: messages.map((m) => m.toAmino()), memo: memo ?? '', - }; + } } public toData(): SignDoc.Data { - const { account_number, chain_id, tx_body, auth_info } = this; + const { account_number, chain_id, tx_body, auth_info } = this return { body_bytes: Buffer.from(tx_body.toBytes()).toString('base64'), auth_info_bytes: Buffer.from(auth_info.toBytes()).toString('base64'), account_number: account_number.toFixed(), chain_id, - }; + } } public toProto(): SignDoc.Proto { - const { account_number, chain_id, tx_body, auth_info } = this; + const { account_number, chain_id, tx_body, auth_info } = this return SignDoc_pb.fromPartial({ bodyBytes: tx_body.toBytes(), authInfoBytes: auth_info.toBytes(), accountNumber: Long.fromNumber(account_number), chainId: chain_id, - }); + }) } public toUnSignedTx(): Tx { - return new Tx(this.tx_body, this.auth_info, []); + return new Tx(this.tx_body, this.auth_info, []) } public toBytes(): Uint8Array { - return SignDoc_pb.encode(this.toProto()).finish(); + return SignDoc_pb.encode(this.toProto()).finish() } } export namespace SignDoc { export interface Amino { - chain_id: string; - account_number: string; - sequence: string; - timeout_height?: string; - fee: Fee.Amino; - msgs: Msg.Amino[]; - memo: string; + chain_id: string + account_number: string + sequence: string + timeout_height?: string + fee: Fee.Amino + msgs: Msg.Amino[] + memo: string } export interface Data { - body_bytes: string; - auth_info_bytes: string; - chain_id: string; - account_number: string; + body_bytes: string + auth_info_bytes: string + chain_id: string + account_number: string } - export type Proto = SignDoc_pb; + export type Proto = SignDoc_pb } diff --git a/src/core/tx/SignatureV2.spec.ts b/src/core/tx/SignatureV2.spec.ts index 6fd91d8..1537e7c 100644 --- a/src/core/tx/SignatureV2.spec.ts +++ b/src/core/tx/SignatureV2.spec.ts @@ -1,13 +1,13 @@ -import { CompactBitArray } from './CompactBitArray'; -import { SimplePublicKey } from '../PublicKey'; -import { SignatureV2 } from './SignatureV2'; +import { CompactBitArray } from './CompactBitArray' +import { SimplePublicKey } from '../PublicKey' +import { SignatureV2 } from './SignatureV2' describe('SignatureV2', () => { it('conversion: single sign', () => { - const sequence = 1234; + const sequence = 1234 //const data = new SignatureV2.Descriptor( - const signMode = SignatureV2.SignMode.SIGN_MODE_DIRECT; - const signature = 'fakesignature'; + const signMode = SignatureV2.SignMode.SIGN_MODE_DIRECT + const signature = 'fakesignature' const sigv2 = new SignatureV2( new SimplePublicKey('A/PwvW/JLEnhb0/o5g+AnOqMN+FFT24gjJfDtA1tBsBv'), @@ -15,25 +15,25 @@ describe('SignatureV2', () => { new SignatureV2.Descriptor.Single(signMode, signature) ), sequence - ); + ) - const toData = sigv2.toData(); - const fromData = SignatureV2.fromData(toData); - const toData2 = fromData.toData(); + const toData = sigv2.toData() + const fromData = SignatureV2.fromData(toData) + const toData2 = fromData.toData() - expect(toData.public_key).toEqual(toData2.public_key); - expect(toData.sequence).toEqual(toData2.sequence); - expect(toData.data).toEqual(toData2.data); - }); + expect(toData.public_key).toEqual(toData2.public_key) + expect(toData.sequence).toEqual(toData2.sequence) + expect(toData.data).toEqual(toData2.data) + }) it('conversion: multi sign', () => { - const sequence = 1234; + const sequence = 1234 //const data = new SignatureV2.Descriptor( - const signMode = SignatureV2.SignMode.SIGN_MODE_LEGACY_AMINO_JSON; - const signature = 'fakesignature'; + const signMode = SignatureV2.SignMode.SIGN_MODE_LEGACY_AMINO_JSON + const signature = 'fakesignature' const single = new SignatureV2.Descriptor( new SignatureV2.Descriptor.Single(signMode, signature) - ); + ) const sigv2 = new SignatureV2( new SimplePublicKey('A/PwvW/JLEnhb0/o5g+AnOqMN+FFT24gjJfDtA1tBsBv'), @@ -44,14 +44,14 @@ describe('SignatureV2', () => { ]) ), sequence - ); + ) - const toData = sigv2.toData(); - const fromData = SignatureV2.fromData(toData); - const toData2 = fromData.toData(); + const toData = sigv2.toData() + const fromData = SignatureV2.fromData(toData) + const toData2 = fromData.toData() - expect(toData.public_key).toEqual(toData2.public_key); - expect(toData.sequence).toEqual(toData2.sequence); - expect(toData.data).toEqual(toData2.data); - }); -}); + expect(toData.public_key).toEqual(toData2.public_key) + expect(toData.sequence).toEqual(toData2.sequence) + expect(toData.data).toEqual(toData2.data) + }) +}) diff --git a/src/core/tx/SignatureV2.ts b/src/core/tx/SignatureV2.ts index fa206c4..bdf8adc 100644 --- a/src/core/tx/SignatureV2.ts +++ b/src/core/tx/SignatureV2.ts @@ -1,12 +1,12 @@ -import { PublicKey } from '../PublicKey'; -import { ModeInfo } from './Tx'; -import { CompactBitArray } from './CompactBitArray'; +import { PublicKey } from '../PublicKey' +import { ModeInfo } from './Tx' +import { CompactBitArray } from './CompactBitArray' import { SignMode as SignMode_pb, signModeFromJSON, signModeToJSON, -} from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing'; -import { MultiSignature } from '@initia/initia.proto/cosmos/crypto/multisig/v1beta1/multisig'; +} from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing' +import { MultiSignature } from '@initia/initia.proto/cosmos/crypto/multisig/v1beta1/multisig' export class SignatureV2 { constructor( @@ -20,7 +20,7 @@ export class SignatureV2 { PublicKey.fromData(data.public_key), SignatureV2.Descriptor.fromData(data.data), Number.parseInt(data.sequence) - ); + ) } public toData(): SignatureV2.Data { @@ -28,7 +28,7 @@ export class SignatureV2 { public_key: this.public_key.toData(), data: this.data.toData(), sequence: this.sequence.toFixed(), - }; + } } public static fromAmino(data: SignatureV2.Amino): SignatureV2 { @@ -41,123 +41,126 @@ export class SignatureV2 { ) ), 0 - ); + ) } } export namespace SignatureV2 { - export const SignMode = SignMode_pb; - export type SignMode = SignMode_pb; + export const SignMode = SignMode_pb + export type SignMode = SignMode_pb export interface Amino { - signature: string; - pub_key: PublicKey.Amino; + signature: string + pub_key: PublicKey.Amino } export interface Data { - public_key: PublicKey.Data; - data: Descriptor.Data; - sequence: string; + public_key: PublicKey.Data + data: Descriptor.Data + sequence: string } export class Descriptor { - public single?: Descriptor.Single; - public multi?: Descriptor.Multi; + public single?: Descriptor.Single + public multi?: Descriptor.Multi constructor(data: Descriptor.Single | Descriptor.Multi) { data instanceof Descriptor.Single ? (this.single = data) - : (this.multi = data); + : (this.multi = data) } public static fromData(data: Descriptor.Data): Descriptor { if (data.single) { - return new Descriptor(Descriptor.Single.fromData(data.single)); + return new Descriptor(Descriptor.Single.fromData(data.single)) } if (data.multi) { - return new Descriptor(Descriptor.Multi.fromData(data.multi)); + return new Descriptor(Descriptor.Multi.fromData(data.multi)) } - throw new Error('must be one of single or multi'); + throw new Error('must be one of single or multi') } public toData(): Descriptor.Data { if (this.single) { return { single: this.single.toData(), - }; + } } if (this.multi) { return { multi: this.multi.toData(), - }; + } } - throw new Error('must be one of single or multi'); + throw new Error('must be one of single or multi') } public toModeInfoAndSignature(): [ModeInfo, Uint8Array] { if (this.single) { - const sigData = this.single; + const sigData = this.single return [ new ModeInfo(new ModeInfo.Single(sigData.mode)), Buffer.from(sigData.signature, 'base64'), - ]; + ] } if (this.multi) { - const sigData = this.multi; - const modeInfos: ModeInfo[] = []; - const signatures: Uint8Array[] = []; + const sigData = this.multi + const modeInfos: ModeInfo[] = [] + const signatures: Uint8Array[] = [] for (const signature of sigData.signatures) { - const [modeInfo, sigBytes] = signature.toModeInfoAndSignature(); - modeInfos.push(modeInfo); - signatures.push(sigBytes); + const [modeInfo, sigBytes] = signature.toModeInfoAndSignature() + modeInfos.push(modeInfo) + signatures.push(sigBytes) } const multisigBytes = MultiSignature.encode( MultiSignature.fromPartial({ signatures: signatures, }) - ).finish(); + ).finish() return [ new ModeInfo(new ModeInfo.Multi(sigData.bitarray, modeInfos)), multisigBytes, - ]; + ] } - throw new Error('invalid signature descriptor'); + throw new Error('invalid signature descriptor') } } export namespace Descriptor { export interface Data { - single?: Descriptor.Single.Data; - multi?: Descriptor.Multi.Data; + single?: Descriptor.Single.Data + multi?: Descriptor.Multi.Data } export class Single { - constructor(public mode: SignMode, public signature: string) {} + constructor( + public mode: SignMode, + public signature: string + ) {} public static fromData(data: Single.Data): Single { - return new Single(signModeFromJSON(data.mode), data.signature); + return new Single(signModeFromJSON(data.mode), data.signature) } public toData(): Single.Data { - const { mode, signature } = this; + const { mode, signature } = this return { mode: signModeToJSON(mode), signature, - }; + } } } export namespace Single { export interface Data { - mode: string; - signature: string; + mode: string + signature: string } } @@ -170,22 +173,22 @@ export namespace SignatureV2 { public static fromData(data: Multi.Data): Multi { return new Multi( CompactBitArray.fromData(data.bitarray), - data.signatures.map(v => Descriptor.fromData(v)) - ); + data.signatures.map((v) => Descriptor.fromData(v)) + ) } public toData(): Multi.Data { return { bitarray: this.bitarray.toData(), - signatures: this.signatures.map(sig => sig.toData()), - }; + signatures: this.signatures.map((sig) => sig.toData()), + } } } export namespace Multi { export interface Data { - bitarray: CompactBitArray.Data; - signatures: Descriptor.Data[]; + bitarray: CompactBitArray.Data + signatures: Descriptor.Data[] } } } diff --git a/src/core/tx/Tx.ts b/src/core/tx/Tx.ts index b7ab7b3..298facb 100644 --- a/src/core/tx/Tx.ts +++ b/src/core/tx/Tx.ts @@ -2,13 +2,13 @@ import { PublicKey, SimplePublicKey, LegacyAminoMultisigPublicKey, -} from '../PublicKey'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from '../PublicKey' +import { Any } from '@initia/initia.proto/google/protobuf/any' import { SignMode as SignMode_pb, signModeFromJSON, signModeToJSON, -} from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing'; +} from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing' import { Tx as Tx_pb, TxBody as TxBody_pb, @@ -17,13 +17,13 @@ import { AuthInfo as AuthInfo_pb, ModeInfo_Single as ModeInfoSingle_pb, ModeInfo_Multi as ModeInfoMulti_pb, -} from '@initia/initia.proto/cosmos/tx/v1beta1/tx'; -import { CompactBitArray } from './CompactBitArray'; -import { Msg } from '../Msg'; -import { Fee } from './Fee'; -import Long from 'long'; -import { SignatureV2 } from './SignatureV2'; -import { SignerData } from '../../client/lcd/api/TxAPI'; +} from '@initia/initia.proto/cosmos/tx/v1beta1/tx' +import { CompactBitArray } from './CompactBitArray' +import { Msg } from '../Msg' +import { Fee } from './Fee' +import Long from 'long' +import { SignatureV2 } from './SignatureV2' +import { SignerData } from '../../client/lcd/api/TxAPI' export class Tx { constructor( @@ -33,17 +33,19 @@ export class Tx { ) {} public static fromAmino(data: Tx.Amino): Tx { - const signatures = data.value.signatures.map(s => SignatureV2.fromAmino(s)); + const signatures = data.value.signatures.map((s) => + SignatureV2.fromAmino(s) + ) return new Tx( new TxBody( - data.value.msg.map(m => Msg.fromAmino(m)), + data.value.msg.map((m) => Msg.fromAmino(m)), data.value.memo, Number.parseInt(data.value.timeout_height) ), new AuthInfo([], Fee.fromAmino(data.value.fee)), - signatures.map(s => s.data.single?.signature ?? '') - ); + signatures.map((s) => s.data.single?.signature ?? '') + ) } public static fromData(data: Tx.Data): Tx { @@ -51,7 +53,7 @@ export class Tx { TxBody.fromData(data.body), AuthInfo.fromData(data.auth_info), data.signatures - ); + ) } public toData(): Tx.Data { @@ -59,40 +61,40 @@ export class Tx { body: this.body.toData(), auth_info: this.auth_info.toData(), signatures: this.signatures, - }; + } } public static unpackAny(anyProto: Any): Tx { - return this.fromProto(Tx_pb.decode(anyProto.value)); + return this.fromProto(Tx_pb.decode(anyProto.value)) } public static fromProto(proto: Tx.Proto): Tx { return new Tx( TxBody.fromProto(proto.body as TxBody_pb), AuthInfo.fromProto(proto.authInfo as AuthInfo_pb), - proto.signatures.map(sig => Buffer.from(sig).toString('base64')) - ); + proto.signatures.map((sig) => Buffer.from(sig).toString('base64')) + ) } public toProto(): Tx.Proto { return Tx_pb.fromPartial({ body: this.body.toProto(), authInfo: this.auth_info.toProto(), - signatures: this.signatures.map(s => Buffer.from(s, 'base64')), - }); + signatures: this.signatures.map((s) => Buffer.from(s, 'base64')), + }) } public toBytes(): Uint8Array { - return Tx_pb.encode(this.toProto()).finish(); + return Tx_pb.encode(this.toProto()).finish() } public static fromBuffer(buf: Buffer): Tx { - return Tx.fromProto(Tx_pb.decode(buf)); + return Tx.fromProto(Tx_pb.decode(buf)) } public appendEmptySignatures(signers: SignerData[]) { - signers.forEach(signer => { - let signerInfo: SignerInfo; + signers.forEach((signer) => { + let signerInfo: SignerInfo if (signer.publicKey) { if (signer.publicKey instanceof LegacyAminoMultisigPublicKey) { signerInfo = new SignerInfo( @@ -104,7 +106,7 @@ export class Tx { [] ) ) - ); + ) } else { signerInfo = new SignerInfo( signer.publicKey, @@ -112,56 +114,56 @@ export class Tx { new ModeInfo( new ModeInfo.Single(ModeInfo.SignMode.SIGN_MODE_DIRECT) ) - ); + ) } } else { signerInfo = new SignerInfo( new SimplePublicKey(''), signer.sequenceNumber, new ModeInfo(new ModeInfo.Single(ModeInfo.SignMode.SIGN_MODE_DIRECT)) - ); + ) } - this.auth_info.signer_infos.push(signerInfo); - this.signatures.push(''); - }); + this.auth_info.signer_infos.push(signerInfo) + this.signatures.push('') + }) } public clearSignatures() { - this.auth_info.signer_infos = []; - this.signatures = []; + this.auth_info.signer_infos = [] + this.signatures = [] } public appendSignatures(signatures: SignatureV2[]) { for (const signature of signatures) { - const [modeInfo, sigBytes] = signature.data.toModeInfoAndSignature(); + const [modeInfo, sigBytes] = signature.data.toModeInfoAndSignature() - this.signatures.push(Buffer.from(sigBytes).toString('base64')); + this.signatures.push(Buffer.from(sigBytes).toString('base64')) this.auth_info.signer_infos.push( new SignerInfo(signature.public_key, signature.sequence, modeInfo) - ); + ) } } } export namespace Tx { export interface Amino { - type: 'cosmos-sdk/StdTx'; + type: 'cosmos-sdk/StdTx' value: { - msg: Msg.Amino[]; - fee: Fee.Amino; - signatures: SignatureV2.Amino[]; - memo: string; - timeout_height: string; - }; + msg: Msg.Amino[] + fee: Fee.Amino + signatures: SignatureV2.Amino[] + memo: string + timeout_height: string + } } export interface Data { - body: TxBody.Data; - auth_info: AuthInfo.Data; - signatures: string[]; + body: TxBody.Data + auth_info: AuthInfo.Data + signatures: string[] } - export type Proto = Tx_pb; + export type Proto = Tx_pb } export class TxBody { @@ -173,92 +175,95 @@ export class TxBody { public static fromData(data: TxBody.Data): TxBody { return new TxBody( - data.messages.map(m => Msg.fromData(m)), + data.messages.map((m) => Msg.fromData(m)), data.memo, Number.parseInt(data.timeout_height) - ); + ) } public toData(): TxBody.Data { return { memo: this.memo ?? '', - messages: this.messages.map(m => m.toData()), + messages: this.messages.map((m) => m.toData()), timeout_height: (this.timeout_height ?? 0).toFixed(), - }; + } } public static fromProto(proto: TxBody.Proto): TxBody { return new TxBody( - proto.messages.map(m => Msg.fromProto(m)), + proto.messages.map((m) => Msg.fromProto(m)), proto.memo, proto.timeoutHeight.toNumber() - ); + ) } public toProto(): TxBody.Proto { return TxBody_pb.fromPartial({ memo: this.memo, - messages: this.messages.map(m => m.packAny()), + messages: this.messages.map((m) => m.packAny()), timeoutHeight: Long.fromNumber(this.timeout_height ?? 0), - }); + }) } public toBytes(): Uint8Array { - return TxBody_pb.encode(this.toProto()).finish(); + return TxBody_pb.encode(this.toProto()).finish() } } export namespace TxBody { export interface Data { - messages: Msg.Data[]; - memo: string; - timeout_height: string; + messages: Msg.Data[] + memo: string + timeout_height: string } - export type Proto = TxBody_pb; + export type Proto = TxBody_pb } export class AuthInfo { - constructor(public signer_infos: SignerInfo[], public fee: Fee) {} + constructor( + public signer_infos: SignerInfo[], + public fee: Fee + ) {} public static fromData(data: AuthInfo.Data): AuthInfo { return new AuthInfo( - data.signer_infos.map(s => SignerInfo.fromData(s)), - Fee.fromData(data.fee as Fee.Data) - ); + data.signer_infos.map((s) => SignerInfo.fromData(s)), + Fee.fromData(data.fee) + ) } public toData(): AuthInfo.Data { return { fee: this.fee.toData(), - signer_infos: this.signer_infos.map(info => info.toData()), - }; + signer_infos: this.signer_infos.map((info) => info.toData()), + } } public static fromProto(proto: AuthInfo.Proto): AuthInfo { return new AuthInfo( - proto.signerInfos.map(s => SignerInfo.fromProto(s)), + proto.signerInfos.map((s) => SignerInfo.fromProto(s)), Fee.fromProto(proto.fee as Fee.Proto) - ); + ) } public toProto(): AuthInfo.Proto { return AuthInfo_pb.fromPartial({ fee: this.fee.toProto(), - signerInfos: this.signer_infos.map(info => info.toProto()), - }); + signerInfos: this.signer_infos.map((info) => info.toProto()), + }) } public toBytes(): Uint8Array { - return AuthInfo_pb.encode(this.toProto()).finish(); + return AuthInfo_pb.encode(this.toProto()).finish() } } export namespace AuthInfo { export interface Data { - signer_infos: SignerInfo.Data[]; - fee: Fee.Data; + signer_infos: SignerInfo.Data[] + fee: Fee.Data } - export type Proto = AuthInfo_pb; + export type Proto = AuthInfo_pb } export class SignerInfo { @@ -273,16 +278,16 @@ export class SignerInfo { PublicKey.fromData(data.public_key ?? new SimplePublicKey('').toData()), Number.parseInt(data.sequence), ModeInfo.fromData(data.mode_info) - ); + ) } public toData(): SignerInfo.Data { - const { public_key, sequence, mode_info } = this; + const { public_key, sequence, mode_info } = this return { mode_info: mode_info.toData(), public_key: public_key?.toData(), sequence: sequence.toFixed(), - }; + } } public static fromProto(proto: SignerInfo.Proto): SignerInfo { @@ -290,117 +295,117 @@ export class SignerInfo { PublicKey.fromProto(proto.publicKey ?? new SimplePublicKey('').packAny()), proto.sequence.toNumber(), ModeInfo.fromProto(proto.modeInfo as ModeInfo_pb) - ); + ) } public toProto(): SignerInfo.Proto { - const { public_key, sequence, mode_info } = this; + const { public_key, sequence, mode_info } = this return SignerInfo_pb.fromPartial({ modeInfo: mode_info.toProto(), publicKey: public_key?.packAny(), sequence: Long.fromNumber(sequence), - }); + }) } } export namespace SignerInfo { export interface Data { - public_key?: PublicKey.Data; - mode_info: ModeInfo.Data; - sequence: string; + public_key?: PublicKey.Data + mode_info: ModeInfo.Data + sequence: string } - export type Proto = SignerInfo_pb; + export type Proto = SignerInfo_pb } export class ModeInfo { - public single?: ModeInfo.Single; - public multi?: ModeInfo.Multi; + public single?: ModeInfo.Single + public multi?: ModeInfo.Multi constructor(mode_info: ModeInfo.Single | ModeInfo.Multi) { if (mode_info instanceof ModeInfo.Single) { - this.single = mode_info; + this.single = mode_info } else { - this.multi = mode_info; + this.multi = mode_info } } public static fromData(data: ModeInfo.Data): ModeInfo { if (data.single) { - return new ModeInfo(ModeInfo.Single.fromData(data.single)); + return new ModeInfo(ModeInfo.Single.fromData(data.single)) } if (data.multi) { - return new ModeInfo(ModeInfo.Multi.fromData(data.multi)); + return new ModeInfo(ModeInfo.Multi.fromData(data.multi)) } - throw new Error('must be one of single or multi'); + throw new Error('must be one of single or multi') } public toData(): ModeInfo.Data { return { single: this.single?.toData(), multi: this.multi?.toData(), - }; + } } public static fromProto(proto: ModeInfo.Proto): ModeInfo { - const singleMode = proto.single; - const multiMode = proto.multi; + const singleMode = proto.single + const multiMode = proto.multi return new ModeInfo( singleMode ? ModeInfo.Single.fromProto(singleMode) : ModeInfo.Multi.fromProto(multiMode as ModeInfoMulti_pb) - ); + ) } public toProto(): ModeInfo.Proto { return ModeInfo_pb.fromPartial({ multi: this.multi?.toProto(), single: this.single?.toProto(), - }); + }) } } export namespace ModeInfo { export interface Data { - single?: Single.Data; - multi?: Multi.Data; + single?: Single.Data + multi?: Multi.Data } - export type Proto = ModeInfo_pb; - export const SignMode = SignMode_pb; - export type SignMode = SignMode_pb; + export type Proto = ModeInfo_pb + export const SignMode = SignMode_pb + export type SignMode = SignMode_pb export class Single { constructor(public mode: SignMode) {} public static fromData(data: Single.Data): Single { - return new Single(signModeFromJSON(data.mode)); + return new Single(signModeFromJSON(data.mode)) } public toData(): Single.Data { return { mode: signModeToJSON(this.mode), - }; + } } public static fromProto(proto: Single.Proto): Single { - return new Single(proto.mode); + return new Single(proto.mode) } public toProto(): Single.Proto { return ModeInfoSingle_pb.fromPartial({ mode: this.mode, - }); + }) } } export namespace Single { export interface Data { - mode: string; + mode: string } - export type Proto = ModeInfoSingle_pb; + export type Proto = ModeInfoSingle_pb } export class Multi { @@ -411,38 +416,38 @@ export namespace ModeInfo { public static fromData(proto: Multi.Data): Multi { return new Multi( - CompactBitArray.fromData(proto.bitarray as CompactBitArray.Data), - proto.mode_infos.map(m => ModeInfo.fromData(m)) - ); + CompactBitArray.fromData(proto.bitarray), + proto.mode_infos.map((m) => ModeInfo.fromData(m)) + ) } public toData(): Multi.Data { return { bitarray: this.bitarray.toData(), - mode_infos: this.modeInfos.map(m => m.toData()), - }; + mode_infos: this.modeInfos.map((m) => m.toData()), + } } public static fromProto(proto: Multi.Proto): Multi { return new Multi( CompactBitArray.fromProto(proto.bitarray as CompactBitArray.Proto), - proto.modeInfos.map(m => ModeInfo.fromProto(m)) - ); + proto.modeInfos.map((m) => ModeInfo.fromProto(m)) + ) } public toProto(): Multi.Proto { return ModeInfoMulti_pb.fromPartial({ bitarray: this.bitarray.toProto(), - modeInfos: this.modeInfos.map(m => m.toProto()), - }); + modeInfos: this.modeInfos.map((m) => m.toProto()), + }) } } export namespace Multi { export interface Data { - bitarray: CompactBitArray.Data; - mode_infos: ModeInfo.Data[]; + bitarray: CompactBitArray.Data + mode_infos: ModeInfo.Data[] } - export type Proto = ModeInfoMulti_pb; + export type Proto = ModeInfoMulti_pb } } diff --git a/src/core/tx/TxInfo.ts b/src/core/tx/TxInfo.ts index 92971b3..13c2f02 100644 --- a/src/core/tx/TxInfo.ts +++ b/src/core/tx/TxInfo.ts @@ -1,9 +1,9 @@ -import { Tx } from './Tx'; +import { Tx } from './Tx' import { ABCIMessageLog as ABCIMessageLog_pb, TxResponse as TxResponse_pb, -} from '@initia/initia.proto/cosmos/base/abci/v1beta1/abci'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +} from '@initia/initia.proto/cosmos/base/abci/v1beta1/abci' +import { Any } from '@initia/initia.proto/google/protobuf/any' /** * A TxInfo data structure is used to capture information from a transaction lookup for @@ -43,7 +43,7 @@ export class TxInfo { proto.height.toNumber(), proto.txhash, proto.rawLog, - proto.logs.map(log => TxLog.fromProto(log)), + proto.logs.map((log) => TxLog.fromProto(log)), proto.gasWanted.toNumber(), proto.gasUsed.toNumber(), Tx.unpackAny(proto.tx as Any), @@ -51,7 +51,7 @@ export class TxInfo { proto.events, proto.code, proto.codespace - ); + ) } public static fromData(data: TxInfo.Data): TxInfo { @@ -59,7 +59,7 @@ export class TxInfo { Number.parseInt(data.height), data.txhash, data.raw_log, - data.logs.map(log => TxLog.fromData(log)), + data.logs.map((log) => TxLog.fromData(log)), Number.parseInt(data.gas_wanted), Number.parseInt(data.gas_used), Tx.fromData(data.tx), @@ -67,138 +67,134 @@ export class TxInfo { data.events, data.code, data.codespace - ); + ) } } export interface EventKV { - key: string; - value: string; + key: string + value: string } export interface Event { - type: string; - attributes: EventKV[]; + type: string + attributes: EventKV[] } -export interface EventsByType { - [type: string]: { - [key: string]: string[]; - }; -} +export type EventsByType = Record> export namespace EventsByType { export function parse(eventAmino: Event[]): EventsByType { - const events: EventsByType = {}; - eventAmino.forEach(ev => { - ev.attributes.forEach(attr => { + const events: EventsByType = {} + eventAmino.forEach((ev) => { + ev.attributes.forEach((attr) => { if (!(ev.type in events)) { - events[ev.type] = {}; + events[ev.type] = {} } if (!(attr.key in events[ev.type])) { - events[ev.type][attr.key] = []; + events[ev.type][attr.key] = [] } - events[ev.type][attr.key].push(attr.value); - }); - }); - return events; + events[ev.type][attr.key].push(attr.value) + }) + }) + return events } } export class TxLog { - public eventsByType: EventsByType; + public eventsByType: EventsByType constructor( public msg_index: number, public log: string, public events: Event[] ) { - this.eventsByType = EventsByType.parse(this.events); + this.eventsByType = EventsByType.parse(this.events) } public static fromData(data: TxLog.Data): TxLog { return new TxLog( data.msg_index, data.log, - data.events.map(e => { + data.events.map((e) => { return { type: e.type, - attributes: e.attributes.map(attr => { + attributes: e.attributes.map((attr) => { return { key: attr.key, value: attr.value, - }; + } }), - }; + } }) - ); + ) } public toData(): TxLog.Data { - const { msg_index, log, events, eventsByType } = this; + const { msg_index, log, events, eventsByType } = this return { msg_index, log, events, eventsByType, - }; + } } public static fromProto(proto: TxLog.Proto): TxLog { return new TxLog( proto.msgIndex, proto.log, - proto.events.map(e => { + proto.events.map((e) => { return { type: e.type, - attributes: e.attributes.map(attr => { + attributes: e.attributes.map((attr) => { return { key: attr.key, value: attr.value, - }; + } }), - }; + } }) - ); + ) } public toProto(): TxLog.Proto { - const { msg_index, log, events } = this; + const { msg_index, log, events } = this return ABCIMessageLog_pb.fromPartial({ msgIndex: msg_index, log: log, events, - }); + }) } } export namespace TxLog { export interface Data { - msg_index: number; - log: string; - events: { type: string; attributes: { key: string; value: string }[] }[]; - eventsByType: EventsByType; + msg_index: number + log: string + events: { type: string; attributes: { key: string; value: string }[] }[] + eventsByType: EventsByType } - export type Proto = ABCIMessageLog_pb; + export type Proto = ABCIMessageLog_pb } export namespace TxInfo { export interface Data { - height: string; - txhash: string; - codespace: string; - code: number; - data: string; - raw_log: string; - logs: TxLog.Data[]; - info: string; - gas_wanted: string; - gas_used: string; - tx: Tx.Data; - timestamp: string; - events: Event[]; + height: string + txhash: string + codespace: string + code: number + data: string + raw_log: string + logs: TxLog.Data[] + info: string + gas_wanted: string + gas_used: string + tx: Tx.Data + timestamp: string + events: Event[] } - export type Proto = TxResponse_pb; + export type Proto = TxResponse_pb } diff --git a/src/core/tx/index.ts b/src/core/tx/index.ts index 7461917..90dad5d 100644 --- a/src/core/tx/index.ts +++ b/src/core/tx/index.ts @@ -1,6 +1,6 @@ -export * from './Fee'; -export * from './MultiSignature'; -export * from './SignatureV2'; -export * from './SignDoc'; -export * from './Tx'; -export * from './TxInfo'; +export * from './Fee' +export * from './MultiSignature' +export * from './SignatureV2' +export * from './SignDoc' +export * from './Tx' +export * from './TxInfo' diff --git a/src/core/upgrade/Plan.spec.ts b/src/core/upgrade/Plan.spec.ts index 115c20a..98a8a4f 100644 --- a/src/core/upgrade/Plan.spec.ts +++ b/src/core/upgrade/Plan.spec.ts @@ -1,4 +1,4 @@ -import { Plan } from './Plan'; +import { Plan } from './Plan' describe('Plan', () => { it('deserializes', () => { @@ -8,7 +8,7 @@ describe('Plan', () => { height: '5330001', info: 'testinfo', upgraded_client_state: 'deprecated', - }); + }) expect(plan).toMatchObject({ name: `v0.5.2`, @@ -16,6 +16,6 @@ describe('Plan', () => { height: '5330001', info: 'testinfo', upgraded_client_state: 'deprecated', - }); - }); -}); + }) + }) +}) diff --git a/src/core/upgrade/Plan.ts b/src/core/upgrade/Plan.ts index c52bf98..06236da 100644 --- a/src/core/upgrade/Plan.ts +++ b/src/core/upgrade/Plan.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { Plan as Plan_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/upgrade'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { Plan as Plan_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/upgrade' +import Long from 'long' /* * Plan specifies information about a planned upgrade and when it should occur. @@ -11,64 +11,68 @@ export class Plan extends JSONSerializable { * @param height the height at which the upgrade must be performed * @param info any application specific upgrade info to be included on-chain */ - constructor(public name: string, public height: number, public info: string) { - super(); + constructor( + public name: string, + public height: number, + public info: string + ) { + super() } public static fromAmino(data: Plan.Amino): Plan { - const { name, height, info } = data; - return new Plan(name, Number.parseInt(height), info); + const { name, height, info } = data + return new Plan(name, Number.parseInt(height), info) } public toAmino(): Plan.Amino { - const { name, height, info } = this; + const { name, height, info } = this return { name, height: height.toString(), info, - }; + } } public static fromData(data: Plan.Data): Plan { - const { name, height, info } = data; - return new Plan(name, Number.parseInt(height), info); + const { name, height, info } = data + return new Plan(name, Number.parseInt(height), info) } public toData(): Plan.Data { - const { name, height, info } = this; + const { name, height, info } = this return { name, height: height.toString(), info, - }; + } } public static fromProto(proto: Plan.Proto): Plan { - return new Plan(proto.name, proto.height.toNumber(), proto.info); + return new Plan(proto.name, proto.height.toNumber(), proto.info) } public toProto(): Plan.Proto { - const { name, height, info } = this; + const { name, height, info } = this return Plan_pb.fromPartial({ name, height: Long.fromNumber(height), info, - }); + }) } } export namespace Plan { export interface Amino { - name: string; - height: string; - info: string; + name: string + height: string + info: string } export interface Data { - name: string; - height: string; - info: string; + name: string + height: string + info: string } - export type Proto = Plan_pb; + export type Proto = Plan_pb } diff --git a/src/core/upgrade/index.ts b/src/core/upgrade/index.ts index 9cb682a..d4a0cd4 100644 --- a/src/core/upgrade/index.ts +++ b/src/core/upgrade/index.ts @@ -1,2 +1,2 @@ -export * from './msgs'; -export * from './Plan'; +export * from './msgs' +export * from './Plan' diff --git a/src/core/upgrade/msgs/MsgCancelUpgrade.ts b/src/core/upgrade/msgs/MsgCancelUpgrade.ts index 478dd5a..c91df06 100644 --- a/src/core/upgrade/msgs/MsgCancelUpgrade.ts +++ b/src/core/upgrade/msgs/MsgCancelUpgrade.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgCancelUpgrade as MsgCancelUpgrade_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgCancelUpgrade as MsgCancelUpgrade_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/tx' /** * MsgCancelUpgrade is a governance operation for cancelling a previously approved software upgrade @@ -16,72 +16,72 @@ export class MsgCancelUpgrade extends JSONSerializable< * @param authority the address that controls the module */ constructor(public authority: AccAddress) { - super(); + super() } public static fromAmino(data: MsgCancelUpgrade.Amino): MsgCancelUpgrade { const { value: { authority }, - } = data; - return new MsgCancelUpgrade(authority); + } = data + return new MsgCancelUpgrade(authority) } public toAmino(): MsgCancelUpgrade.Amino { - const { authority } = this; + const { authority } = this return { type: 'cosmos-sdk/MsgCancelUpgrade', value: { authority }, - }; + } } public static fromData(data: MsgCancelUpgrade.Data): MsgCancelUpgrade { - const { authority } = data; - return new MsgCancelUpgrade(authority); + const { authority } = data + return new MsgCancelUpgrade(authority) } public toData(): MsgCancelUpgrade.Data { - const { authority } = this; + const { authority } = this return { '@type': '/cosmos.upgrade.v1beta1.MsgCancelUpgrade', authority, - }; + } } public static fromProto(proto: MsgCancelUpgrade.Proto): MsgCancelUpgrade { - return new MsgCancelUpgrade(proto.authority); + return new MsgCancelUpgrade(proto.authority) } public toProto(): MsgCancelUpgrade.Proto { - const { authority } = this; + const { authority } = this return MsgCancelUpgrade_pb.fromPartial({ authority, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.upgrade.v1beta1.MsgCancelUpgrade', value: MsgCancelUpgrade_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgCancelUpgrade { - return MsgCancelUpgrade.fromProto(MsgCancelUpgrade_pb.decode(msgAny.value)); + return MsgCancelUpgrade.fromProto(MsgCancelUpgrade_pb.decode(msgAny.value)) } } export namespace MsgCancelUpgrade { export interface Amino { - type: 'cosmos-sdk/MsgCancelUpgrade'; + type: 'cosmos-sdk/MsgCancelUpgrade' value: { - authority: AccAddress; - }; + authority: AccAddress + } } export interface Data { - '@type': '/cosmos.upgrade.v1beta1.MsgCancelUpgrade'; - authority: AccAddress; + '@type': '/cosmos.upgrade.v1beta1.MsgCancelUpgrade' + authority: AccAddress } - export type Proto = MsgCancelUpgrade_pb; + export type Proto = MsgCancelUpgrade_pb } diff --git a/src/core/upgrade/msgs/MsgSoftwareUpgrade.ts b/src/core/upgrade/msgs/MsgSoftwareUpgrade.ts index 2c1a0b8..62bdeef 100644 --- a/src/core/upgrade/msgs/MsgSoftwareUpgrade.ts +++ b/src/core/upgrade/msgs/MsgSoftwareUpgrade.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Plan } from '../Plan'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSoftwareUpgrade as MsgSoftwareUpgrade_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Plan } from '../Plan' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSoftwareUpgrade as MsgSoftwareUpgrade_pb } from '@initia/initia.proto/cosmos/upgrade/v1beta1/tx' /** * MsgSoftwareUpgrade is a governance operation for initiating a software upgrade @@ -17,86 +17,89 @@ export class MsgSoftwareUpgrade extends JSONSerializable< * @param authority the address that controls the module * @param plan the upgrade plan */ - constructor(public authority: AccAddress, public plan: Plan) { - super(); + constructor( + public authority: AccAddress, + public plan: Plan + ) { + super() } public static fromAmino(data: MsgSoftwareUpgrade.Amino): MsgSoftwareUpgrade { const { value: { authority, plan }, - } = data; + } = data - return new MsgSoftwareUpgrade(authority, Plan.fromAmino(plan)); + return new MsgSoftwareUpgrade(authority, Plan.fromAmino(plan)) } public toAmino(): MsgSoftwareUpgrade.Amino { - const { authority, plan } = this; + const { authority, plan } = this return { type: 'cosmos-sdk/MsgSoftwareUpgrade', value: { authority, plan: plan.toAmino(), }, - }; + } } public static fromData(data: MsgSoftwareUpgrade.Data): MsgSoftwareUpgrade { - const { authority, plan } = data; - return new MsgSoftwareUpgrade(authority, Plan.fromData(plan)); + const { authority, plan } = data + return new MsgSoftwareUpgrade(authority, Plan.fromData(plan)) } public toData(): MsgSoftwareUpgrade.Data { - const { authority, plan } = this; + const { authority, plan } = this return { '@type': '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade', authority, plan: plan.toData(), - }; + } } public static fromProto(proto: MsgSoftwareUpgrade.Proto): MsgSoftwareUpgrade { return new MsgSoftwareUpgrade( proto.authority, Plan.fromProto(proto.plan as Plan.Proto) - ); + ) } public toProto(): MsgSoftwareUpgrade.Proto { - const { authority, plan } = this; + const { authority, plan } = this return MsgSoftwareUpgrade_pb.fromPartial({ authority, plan: plan.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade', value: MsgSoftwareUpgrade_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSoftwareUpgrade { return MsgSoftwareUpgrade.fromProto( MsgSoftwareUpgrade_pb.decode(msgAny.value) - ); + ) } } export namespace MsgSoftwareUpgrade { export interface Amino { - type: 'cosmos-sdk/MsgSoftwareUpgrade'; + type: 'cosmos-sdk/MsgSoftwareUpgrade' value: { - authority: AccAddress; - plan: Plan.Amino; - }; + authority: AccAddress + plan: Plan.Amino + } } export interface Data { - '@type': '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade'; - authority: AccAddress; - plan: Plan.Data; + '@type': '/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade' + authority: AccAddress + plan: Plan.Data } - export type Proto = MsgSoftwareUpgrade_pb; + export type Proto = MsgSoftwareUpgrade_pb } diff --git a/src/core/upgrade/msgs/index.ts b/src/core/upgrade/msgs/index.ts index 9bd188f..f44bcf8 100644 --- a/src/core/upgrade/msgs/index.ts +++ b/src/core/upgrade/msgs/index.ts @@ -1,12 +1,12 @@ -import { MsgSoftwareUpgrade } from './MsgSoftwareUpgrade'; -import { MsgCancelUpgrade } from './MsgCancelUpgrade'; +import { MsgSoftwareUpgrade } from './MsgSoftwareUpgrade' +import { MsgCancelUpgrade } from './MsgCancelUpgrade' -export * from './MsgSoftwareUpgrade'; -export * from './MsgCancelUpgrade'; +export * from './MsgSoftwareUpgrade' +export * from './MsgCancelUpgrade' -export type UpgradeMsg = MsgSoftwareUpgrade | MsgCancelUpgrade; +export type UpgradeMsg = MsgSoftwareUpgrade | MsgCancelUpgrade export namespace UpgradeMsg { - export type Amino = MsgSoftwareUpgrade.Amino | MsgCancelUpgrade.Amino; - export type Data = MsgSoftwareUpgrade.Data | MsgCancelUpgrade.Data; - export type Proto = MsgSoftwareUpgrade.Proto | MsgCancelUpgrade.Proto; + export type Amino = MsgSoftwareUpgrade.Amino | MsgCancelUpgrade.Amino + export type Data = MsgSoftwareUpgrade.Data | MsgCancelUpgrade.Data + export type Proto = MsgSoftwareUpgrade.Proto | MsgCancelUpgrade.Proto } diff --git a/src/core/wasm/AbsoluteTxPosition.ts b/src/core/wasm/AbsoluteTxPosition.ts index e12038c..3a8cffa 100644 --- a/src/core/wasm/AbsoluteTxPosition.ts +++ b/src/core/wasm/AbsoluteTxPosition.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../util/json'; -import { AbsoluteTxPosition as AbsoluteTxPosition_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/types'; -import Long from 'long'; +import { JSONSerializable } from '../../util/json' +import { AbsoluteTxPosition as AbsoluteTxPosition_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/types' +import Long from 'long' export class AbsoluteTxPosition extends JSONSerializable< AbsoluteTxPosition.Amino, @@ -11,68 +11,71 @@ export class AbsoluteTxPosition extends JSONSerializable< * @param block_height the block the contract was created at * @param tx_index a monotonic counter within the block (actual transaction index, or gas consumed) */ - constructor(public block_height: number, public tx_index: number) { - super(); + constructor( + public block_height: number, + public tx_index: number + ) { + super() } public static fromAmino(data: AbsoluteTxPosition.Amino): AbsoluteTxPosition { - const { block_height, tx_index } = data; + const { block_height, tx_index } = data return new AbsoluteTxPosition( Number.parseInt(block_height), Number.parseInt(tx_index) - ); + ) } public toAmino(): AbsoluteTxPosition.Amino { - const { block_height, tx_index } = this; + const { block_height, tx_index } = this return { block_height: block_height.toString(), tx_index: tx_index.toString(), - }; + } } public static fromData(data: AbsoluteTxPosition.Data): AbsoluteTxPosition { - const { block_height, tx_index } = data; + const { block_height, tx_index } = data return new AbsoluteTxPosition( Number.parseInt(block_height), Number.parseInt(tx_index) - ); + ) } public toData(): AbsoluteTxPosition.Data { - const { block_height, tx_index } = this; + const { block_height, tx_index } = this return { block_height: block_height.toString(), tx_index: tx_index.toString(), - }; + } } public static fromProto(data: AbsoluteTxPosition.Proto): AbsoluteTxPosition { return new AbsoluteTxPosition( data.blockHeight.toNumber(), data.txIndex.toNumber() - ); + ) } public toProto(): AbsoluteTxPosition.Proto { - const { block_height, tx_index } = this; + const { block_height, tx_index } = this return AbsoluteTxPosition_pb.fromPartial({ blockHeight: Long.fromNumber(block_height), txIndex: Long.fromNumber(tx_index), - }); + }) } } export namespace AbsoluteTxPosition { export interface Amino { - block_height: string; - tx_index: string; + block_height: string + tx_index: string } export interface Data { - block_height: string; - tx_index: string; + block_height: string + tx_index: string } - export type Proto = AbsoluteTxPosition_pb; + export type Proto = AbsoluteTxPosition_pb } diff --git a/src/core/wasm/AccessConfig.ts b/src/core/wasm/AccessConfig.ts index dbcffa2..d17241f 100644 --- a/src/core/wasm/AccessConfig.ts +++ b/src/core/wasm/AccessConfig.ts @@ -1,11 +1,11 @@ -import { JSONSerializable } from '../../util/json'; -import { AccAddress } from '../bech32'; +import { JSONSerializable } from '../../util/json' +import { AccAddress } from '../bech32' import { AccessConfig as AccessConfig_pb, AccessType, accessTypeFromJSON, accessTypeToJSON, -} from '@initia/initia.proto/cosmwasm/wasm/v1/types'; +} from '@initia/initia.proto/cosmwasm/wasm/v1/types' export class AccessConfig extends JSONSerializable< AccessConfig.Amino, @@ -16,62 +16,65 @@ export class AccessConfig extends JSONSerializable< * @param permission * @param addresses */ - constructor(public permission: AccessType, public addresses: AccAddress[]) { - super(); + constructor( + public permission: AccessType, + public addresses: AccAddress[] + ) { + super() } public static fromAmino(data: AccessConfig.Amino): AccessConfig { - const { permission, addresses } = data; - return new AccessConfig(accessTypeFromJSON(permission), addresses); + const { permission, addresses } = data + return new AccessConfig(accessTypeFromJSON(permission), addresses) } public toAmino(): AccessConfig.Amino { - const { permission, addresses } = this; + const { permission, addresses } = this return { permission: accessTypeToJSON(permission), addresses, - }; + } } public static fromData(data: AccessConfig.Data): AccessConfig { - const { permission, addresses } = data; - return new AccessConfig(accessTypeFromJSON(permission), addresses); + const { permission, addresses } = data + return new AccessConfig(accessTypeFromJSON(permission), addresses) } public toData(): AccessConfig.Data { - const { permission, addresses } = this; + const { permission, addresses } = this return { permission: accessTypeToJSON(permission), addresses, - }; + } } public static fromProto(data: AccessConfig.Proto): AccessConfig { - return new AccessConfig(data.permission, data.addresses); + return new AccessConfig(data.permission, data.addresses) } public toProto(): AccessConfig.Proto { - const { permission, addresses } = this; + const { permission, addresses } = this return AccessConfig_pb.fromPartial({ permission, addresses, - }); + }) } } export namespace AccessConfig { - export type Type = AccessType; - export const Type = AccessType; + export type Type = AccessType + export const Type = AccessType export interface Amino { - permission: string; - addresses: AccAddress[]; + permission: string + addresses: AccAddress[] } export interface Data { - permission: string; - addresses: AccAddress[]; + permission: string + addresses: AccAddress[] } - export type Proto = AccessConfig_pb; + export type Proto = AccessConfig_pb } diff --git a/src/core/wasm/WasmParams.ts b/src/core/wasm/WasmParams.ts index adcaa4d..d6c3c87 100644 --- a/src/core/wasm/WasmParams.ts +++ b/src/core/wasm/WasmParams.ts @@ -1,10 +1,10 @@ -import { JSONSerializable } from '../../util/json'; +import { JSONSerializable } from '../../util/json' import { Params as Params_pb, accessTypeFromJSON, accessTypeToJSON, -} from '@initia/initia.proto/cosmwasm/wasm/v1/types'; -import { AccessConfig } from './AccessConfig'; +} from '@initia/initia.proto/cosmwasm/wasm/v1/types' +import { AccessConfig } from './AccessConfig' export class WasmParams extends JSONSerializable< WasmParams.Amino, @@ -19,22 +19,22 @@ export class WasmParams extends JSONSerializable< public code_upload_access: AccessConfig, public instantiate_default_permission: AccessConfig.Type ) { - super(); + super() } public static fromAmino(data: WasmParams.Amino): WasmParams { const { value: { code_upload_access, instantiate_default_permission }, - } = data; + } = data return new WasmParams( AccessConfig.fromAmino(code_upload_access), accessTypeFromJSON(instantiate_default_permission) - ); + ) } public toAmino(): WasmParams.Amino { - const { code_upload_access, instantiate_default_permission } = this; + const { code_upload_access, instantiate_default_permission } = this return { type: 'wasm/Params', @@ -44,20 +44,20 @@ export class WasmParams extends JSONSerializable< instantiate_default_permission ), }, - }; + } } public static fromData(data: WasmParams.Data): WasmParams { - const { code_upload_access, instantiate_default_permission } = data; + const { code_upload_access, instantiate_default_permission } = data return new WasmParams( AccessConfig.fromData(code_upload_access), accessTypeFromJSON(instantiate_default_permission) - ); + ) } public toData(): WasmParams.Data { - const { code_upload_access, instantiate_default_permission } = this; + const { code_upload_access, instantiate_default_permission } = this return { '@type': '/cosmwasm.wasm.v1.Params', @@ -65,40 +65,40 @@ export class WasmParams extends JSONSerializable< instantiate_default_permission: accessTypeToJSON( instantiate_default_permission ), - }; + } } public static fromProto(data: WasmParams.Proto): WasmParams { return new WasmParams( AccessConfig.fromProto(data.codeUploadAccess as AccessConfig.Proto), data.instantiateDefaultPermission - ); + ) } public toProto(): WasmParams.Proto { - const { code_upload_access, instantiate_default_permission } = this; + const { code_upload_access, instantiate_default_permission } = this return Params_pb.fromPartial({ codeUploadAccess: code_upload_access.toProto(), instantiateDefaultPermission: instantiate_default_permission, - }); + }) } } export namespace WasmParams { export interface Amino { - type: 'wasm/Params'; + type: 'wasm/Params' value: { - code_upload_access: AccessConfig.Amino; - instantiate_default_permission: string; - }; + code_upload_access: AccessConfig.Amino + instantiate_default_permission: string + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.Params'; - code_upload_access: AccessConfig.Data; - instantiate_default_permission: string; + '@type': '/cosmwasm.wasm.v1.Params' + code_upload_access: AccessConfig.Data + instantiate_default_permission: string } - export type Proto = Params_pb; + export type Proto = Params_pb } diff --git a/src/core/wasm/authorizations/AcceptedMessageKeysFilter.ts b/src/core/wasm/authorizations/AcceptedMessageKeysFilter.ts index 47046e5..abb2c2f 100644 --- a/src/core/wasm/authorizations/AcceptedMessageKeysFilter.ts +++ b/src/core/wasm/authorizations/AcceptedMessageKeysFilter.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { AcceptedMessageKeysFilter as AcceptedMessageKeysFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AcceptedMessageKeysFilter as AcceptedMessageKeysFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class AcceptedMessageKeysFilter extends JSONSerializable< AcceptedMessageKeysFilter.Amino, @@ -8,69 +8,69 @@ export class AcceptedMessageKeysFilter extends JSONSerializable< AcceptedMessageKeysFilter.Proto > { constructor(public keys: string[]) { - super(); + super() } public static fromAmino( data: AcceptedMessageKeysFilter.Amino ): AcceptedMessageKeysFilter { - return new AcceptedMessageKeysFilter(data.value.keys); + return new AcceptedMessageKeysFilter(data.value.keys) } public toAmino(): AcceptedMessageKeysFilter.Amino { return { type: 'wasm/AcceptedMessageKeysFilter', value: { keys: this.keys }, - }; + } } public static fromData( data: AcceptedMessageKeysFilter.Data ): AcceptedMessageKeysFilter { - return new AcceptedMessageKeysFilter(data.keys); + return new AcceptedMessageKeysFilter(data.keys) } public toData(): AcceptedMessageKeysFilter.Data { return { '@type': '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter', keys: this.keys, - }; + } } public static fromProto( data: AcceptedMessageKeysFilter.Proto ): AcceptedMessageKeysFilter { - return new AcceptedMessageKeysFilter(data.keys); + return new AcceptedMessageKeysFilter(data.keys) } public toProto(): AcceptedMessageKeysFilter.Proto { - return AcceptedMessageKeysFilter_pb.fromPartial({ keys: this.keys }); + return AcceptedMessageKeysFilter_pb.fromPartial({ keys: this.keys }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter', value: AcceptedMessageKeysFilter_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): AcceptedMessageKeysFilter { return AcceptedMessageKeysFilter.fromProto( AcceptedMessageKeysFilter_pb.decode(msgAny.value) - ); + ) } } export namespace AcceptedMessageKeysFilter { export interface Amino { - type: 'wasm/AcceptedMessageKeysFilter'; - value: { keys: string[] }; + type: 'wasm/AcceptedMessageKeysFilter' + value: { keys: string[] } } export interface Data { - '@type': '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter'; - keys: string[]; + '@type': '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter' + keys: string[] } - export type Proto = AcceptedMessageKeysFilter_pb; + export type Proto = AcceptedMessageKeysFilter_pb } diff --git a/src/core/wasm/authorizations/AcceptedMessagesFilter.ts b/src/core/wasm/authorizations/AcceptedMessagesFilter.ts index a45050f..f0ebd2c 100644 --- a/src/core/wasm/authorizations/AcceptedMessagesFilter.ts +++ b/src/core/wasm/authorizations/AcceptedMessagesFilter.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { AcceptedMessagesFilter as AcceptedMessagesFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AcceptedMessagesFilter as AcceptedMessagesFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class AcceptedMessagesFilter extends JSONSerializable< AcceptedMessagesFilter.Amino, @@ -8,73 +8,73 @@ export class AcceptedMessagesFilter extends JSONSerializable< AcceptedMessagesFilter.Proto > { constructor(public messages: string[]) { - super(); + super() } public static fromAmino( data: AcceptedMessagesFilter.Amino ): AcceptedMessagesFilter { - return new AcceptedMessagesFilter(data.value.messages); + return new AcceptedMessagesFilter(data.value.messages) } public toAmino(): AcceptedMessagesFilter.Amino { return { type: 'wasm/AcceptedMessagesFilter', value: { messages: this.messages }, - }; + } } public static fromData( data: AcceptedMessagesFilter.Data ): AcceptedMessagesFilter { - return new AcceptedMessagesFilter(data.messages); + return new AcceptedMessagesFilter(data.messages) } public toData(): AcceptedMessagesFilter.Data { return { '@type': '/cosmwasm.wasm.v1.AcceptedMessagesFilter', messages: this.messages, - }; + } } public static fromProto( data: AcceptedMessagesFilter.Proto ): AcceptedMessagesFilter { return new AcceptedMessagesFilter( - data.messages.map(msg => Buffer.from(msg).toString('base64')) - ); + data.messages.map((msg) => Buffer.from(msg).toString('base64')) + ) } public toProto(): AcceptedMessagesFilter.Proto { return AcceptedMessagesFilter_pb.fromPartial({ - messages: this.messages.map(msg => Buffer.from(msg, 'base64')), - }); + messages: this.messages.map((msg) => Buffer.from(msg, 'base64')), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.AcceptedMessagesFilter', value: AcceptedMessagesFilter_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): AcceptedMessagesFilter { return AcceptedMessagesFilter.fromProto( AcceptedMessagesFilter_pb.decode(msgAny.value) - ); + ) } } export namespace AcceptedMessagesFilter { export interface Amino { - type: 'wasm/AcceptedMessagesFilter'; - value: { messages: string[] }; + type: 'wasm/AcceptedMessagesFilter' + value: { messages: string[] } } export interface Data { - '@type': '/cosmwasm.wasm.v1.AcceptedMessagesFilter'; - messages: string[]; + '@type': '/cosmwasm.wasm.v1.AcceptedMessagesFilter' + messages: string[] } - export type Proto = AcceptedMessagesFilter_pb; + export type Proto = AcceptedMessagesFilter_pb } diff --git a/src/core/wasm/authorizations/AllowAllMessagesFilter.ts b/src/core/wasm/authorizations/AllowAllMessagesFilter.ts index 9fab1a0..cef8f20 100644 --- a/src/core/wasm/authorizations/AllowAllMessagesFilter.ts +++ b/src/core/wasm/authorizations/AllowAllMessagesFilter.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { AllowAllMessagesFilter as AllowAllMessagesFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AllowAllMessagesFilter as AllowAllMessagesFilter_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class AllowAllMessagesFilter extends JSONSerializable< AllowAllMessagesFilter.Amino, @@ -8,70 +8,70 @@ export class AllowAllMessagesFilter extends JSONSerializable< AllowAllMessagesFilter.Proto > { constructor() { - super(); + super() } public static fromAmino( _: AllowAllMessagesFilter.Amino ): AllowAllMessagesFilter { - _; - return new AllowAllMessagesFilter(); + _ + return new AllowAllMessagesFilter() } public toAmino(): AllowAllMessagesFilter.Amino { return { type: 'wasm/AllowAllMessagesFilter', value: {}, - }; + } } public static fromData( _: AllowAllMessagesFilter.Data ): AllowAllMessagesFilter { - _; - return new AllowAllMessagesFilter(); + _ + return new AllowAllMessagesFilter() } public toData(): AllowAllMessagesFilter.Data { return { '@type': '/cosmwasm.wasm.v1.AllowAllMessagesFilter', - }; + } } public static fromProto( _: AllowAllMessagesFilter.Proto ): AllowAllMessagesFilter { - _; - return new AllowAllMessagesFilter(); + _ + return new AllowAllMessagesFilter() } public toProto(): AllowAllMessagesFilter.Proto { - return AllowAllMessagesFilter_pb.fromPartial({}); + return AllowAllMessagesFilter_pb.fromPartial({}) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.AllowAllMessagesFilter', value: AllowAllMessagesFilter_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): AllowAllMessagesFilter { return AllowAllMessagesFilter.fromProto( AllowAllMessagesFilter_pb.decode(msgAny.value) - ); + ) } } export namespace AllowAllMessagesFilter { export interface Amino { - type: 'wasm/AllowAllMessagesFilter'; - value: {}; + type: 'wasm/AllowAllMessagesFilter' + value: object } export interface Data { - '@type': '/cosmwasm.wasm.v1.AllowAllMessagesFilter'; + '@type': '/cosmwasm.wasm.v1.AllowAllMessagesFilter' } - export type Proto = AllowAllMessagesFilter_pb; + export type Proto = AllowAllMessagesFilter_pb } diff --git a/src/core/wasm/authorizations/CodeGrant.ts b/src/core/wasm/authorizations/CodeGrant.ts index 2289e65..310572c 100644 --- a/src/core/wasm/authorizations/CodeGrant.ts +++ b/src/core/wasm/authorizations/CodeGrant.ts @@ -1,6 +1,6 @@ -import { JSONSerializable } from '../../../util/json'; -import { CodeGrant as CodeGrant_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { AccessConfig } from '../AccessConfig'; +import { JSONSerializable } from '../../../util/json' +import { CodeGrant as CodeGrant_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { AccessConfig } from '../AccessConfig' export class CodeGrant extends JSONSerializable< CodeGrant.Amino, @@ -11,43 +11,43 @@ export class CodeGrant extends JSONSerializable< public code_hash: string, public instantiate_permission?: AccessConfig ) { - super(); + super() } public static fromAmino(data: CodeGrant.Amino): CodeGrant { - const { code_hash, instantiate_permission } = data; + const { code_hash, instantiate_permission } = data return new CodeGrant( code_hash, instantiate_permission ? AccessConfig.fromAmino(instantiate_permission) : undefined - ); + ) } public toAmino(): CodeGrant.Amino { - const { code_hash, instantiate_permission } = this; + const { code_hash, instantiate_permission } = this return { code_hash, instantiate_permission: instantiate_permission?.toAmino(), - }; + } } public static fromData(data: CodeGrant.Data): CodeGrant { - const { code_hash, instantiate_permission } = data; + const { code_hash, instantiate_permission } = data return new CodeGrant( code_hash, instantiate_permission ? AccessConfig.fromData(instantiate_permission) : undefined - ); + ) } public toData(): CodeGrant.Data { - const { code_hash, instantiate_permission } = this; + const { code_hash, instantiate_permission } = this return { code_hash, instantiate_permission: instantiate_permission?.toData(), - }; + } } public static fromProto(data: CodeGrant.Proto): CodeGrant { @@ -56,28 +56,28 @@ export class CodeGrant extends JSONSerializable< data.instantiatePermission ? AccessConfig.fromProto(data.instantiatePermission) : undefined - ); + ) } public toProto(): CodeGrant.Proto { - const { code_hash, instantiate_permission } = this; + const { code_hash, instantiate_permission } = this return CodeGrant_pb.fromPartial({ codeHash: Buffer.from(code_hash, 'base64'), instantiatePermission: instantiate_permission?.toProto(), - }); + }) } } export namespace CodeGrant { export interface Amino { - code_hash: string; - instantiate_permission?: AccessConfig.Amino; + code_hash: string + instantiate_permission?: AccessConfig.Amino } export interface Data { - code_hash: string; - instantiate_permission?: AccessConfig.Data; + code_hash: string + instantiate_permission?: AccessConfig.Data } - export type Proto = CodeGrant_pb; + export type Proto = CodeGrant_pb } diff --git a/src/core/wasm/authorizations/CombinedLimit.ts b/src/core/wasm/authorizations/CombinedLimit.ts index 935ea03..7d5cfad 100644 --- a/src/core/wasm/authorizations/CombinedLimit.ts +++ b/src/core/wasm/authorizations/CombinedLimit.ts @@ -1,100 +1,103 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { CombinedLimit as CombinedLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { CombinedLimit as CombinedLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class CombinedLimit extends JSONSerializable< CombinedLimit.Amino, CombinedLimit.Data, CombinedLimit.Proto > { - public amounts: Coins; + public amounts: Coins - constructor(public calls_remaining: number, amounts: Coins.Input) { - super(); - this.amounts = new Coins(amounts); + constructor( + public calls_remaining: number, + amounts: Coins.Input + ) { + super() + this.amounts = new Coins(amounts) } public static fromAmino(data: CombinedLimit.Amino): CombinedLimit { const { value: { calls_remaining, amounts }, - } = data; + } = data return new CombinedLimit( Number.parseInt(calls_remaining), Coins.fromAmino(amounts) - ); + ) } public toAmino(): CombinedLimit.Amino { - const { calls_remaining, amounts } = this; + const { calls_remaining, amounts } = this return { type: 'wasm/CombinedLimit', value: { calls_remaining: calls_remaining.toString(), amounts: amounts.toAmino(), }, - }; + } } public static fromData(data: CombinedLimit.Data): CombinedLimit { - const { calls_remaining, amounts } = data; + const { calls_remaining, amounts } = data return new CombinedLimit( Number.parseInt(calls_remaining), Coins.fromData(amounts) - ); + ) } public toData(): CombinedLimit.Data { - const { calls_remaining, amounts } = this; + const { calls_remaining, amounts } = this return { '@type': '/cosmwasm.wasm.v1.CombinedLimit', calls_remaining: calls_remaining.toString(), amounts: amounts.toData(), - }; + } } public static fromProto(data: CombinedLimit.Proto): CombinedLimit { return new CombinedLimit( data.callsRemaining.toNumber(), Coins.fromProto(data.amounts) - ); + ) } public toProto(): CombinedLimit.Proto { - const { calls_remaining, amounts } = this; + const { calls_remaining, amounts } = this return CombinedLimit_pb.fromPartial({ callsRemaining: Long.fromNumber(calls_remaining), amounts: amounts.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.CombinedLimit', value: CombinedLimit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): CombinedLimit { - return CombinedLimit.fromProto(CombinedLimit_pb.decode(msgAny.value)); + return CombinedLimit.fromProto(CombinedLimit_pb.decode(msgAny.value)) } } export namespace CombinedLimit { export interface Amino { - type: 'wasm/CombinedLimit'; + type: 'wasm/CombinedLimit' value: { - calls_remaining: string; - amounts: Coins.Amino; - }; + calls_remaining: string + amounts: Coins.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.CombinedLimit'; - calls_remaining: string; - amounts: Coins.Data; + '@type': '/cosmwasm.wasm.v1.CombinedLimit' + calls_remaining: string + amounts: Coins.Data } - export type Proto = CombinedLimit_pb; + export type Proto = CombinedLimit_pb } diff --git a/src/core/wasm/authorizations/ContractExecutionAuthorization.ts b/src/core/wasm/authorizations/ContractExecutionAuthorization.ts index 5bb5313..054a69b 100644 --- a/src/core/wasm/authorizations/ContractExecutionAuthorization.ts +++ b/src/core/wasm/authorizations/ContractExecutionAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ContractExecutionAuthorization as ContractExecutionAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { ContractGrant } from './ContractGrant'; +import { JSONSerializable } from '../../../util/json' +import { ContractExecutionAuthorization as ContractExecutionAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { ContractGrant } from './ContractGrant' export class ContractExecutionAuthorization extends JSONSerializable< ContractExecutionAuthorization.Amino, @@ -9,7 +9,7 @@ export class ContractExecutionAuthorization extends JSONSerializable< ContractExecutionAuthorization.Proto > { constructor(public grants: ContractGrant[]) { - super(); + super() } public static fromAmino( @@ -17,14 +17,14 @@ export class ContractExecutionAuthorization extends JSONSerializable< ): ContractExecutionAuthorization { return new ContractExecutionAuthorization( data.value.grants.map(ContractGrant.fromAmino) - ); + ) } public toAmino(): ContractExecutionAuthorization.Amino { return { type: 'wasm/ContractExecutionAuthorization', - value: { grants: this.grants.map(grant => grant.toAmino()) }, - }; + value: { grants: this.grants.map((grant) => grant.toAmino()) }, + } } public static fromData( @@ -32,14 +32,14 @@ export class ContractExecutionAuthorization extends JSONSerializable< ): ContractExecutionAuthorization { return new ContractExecutionAuthorization( data.grants.map(ContractGrant.fromData) - ); + ) } public toData(): ContractExecutionAuthorization.Data { return { '@type': '/cosmwasm.wasm.v1.ContractExecutionAuthorization', - grants: this.grants.map(grant => grant.toData()), - }; + grants: this.grants.map((grant) => grant.toData()), + } } public static fromProto( @@ -47,41 +47,41 @@ export class ContractExecutionAuthorization extends JSONSerializable< ): ContractExecutionAuthorization { return new ContractExecutionAuthorization( data.grants.map(ContractGrant.fromProto) - ); + ) } public toProto(): ContractExecutionAuthorization.Proto { return ContractExecutionAuthorization_pb.fromPartial({ - grants: this.grants.map(grant => grant.toProto()), - }); + grants: this.grants.map((grant) => grant.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.ContractExecutionAuthorization', value: ContractExecutionAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): ContractExecutionAuthorization { return ContractExecutionAuthorization.fromProto( ContractExecutionAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace ContractExecutionAuthorization { export interface Amino { - type: 'wasm/ContractExecutionAuthorization'; + type: 'wasm/ContractExecutionAuthorization' value: { - grants: ContractGrant.Amino[]; - }; + grants: ContractGrant.Amino[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.ContractExecutionAuthorization'; - grants: ContractGrant.Data[]; + '@type': '/cosmwasm.wasm.v1.ContractExecutionAuthorization' + grants: ContractGrant.Data[] } - export type Proto = ContractExecutionAuthorization_pb; + export type Proto = ContractExecutionAuthorization_pb } diff --git a/src/core/wasm/authorizations/ContractFilter.ts b/src/core/wasm/authorizations/ContractFilter.ts index 6aab147..55651c7 100644 --- a/src/core/wasm/authorizations/ContractFilter.ts +++ b/src/core/wasm/authorizations/ContractFilter.ts @@ -1,60 +1,60 @@ -import { AllowAllMessagesFilter } from './AllowAllMessagesFilter'; -import { AcceptedMessageKeysFilter } from './AcceptedMessageKeysFilter'; -import { AcceptedMessagesFilter } from './AcceptedMessagesFilter'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { AllowAllMessagesFilter } from './AllowAllMessagesFilter' +import { AcceptedMessageKeysFilter } from './AcceptedMessageKeysFilter' +import { AcceptedMessagesFilter } from './AcceptedMessagesFilter' +import { Any } from '@initia/initia.proto/google/protobuf/any' export type ContractFilter = | AllowAllMessagesFilter | AcceptedMessageKeysFilter - | AcceptedMessagesFilter; + | AcceptedMessagesFilter export namespace ContractFilter { export type Amino = | AllowAllMessagesFilter.Amino | AcceptedMessageKeysFilter.Amino - | AcceptedMessagesFilter.Amino; + | AcceptedMessagesFilter.Amino export type Data = | AllowAllMessagesFilter.Data | AcceptedMessageKeysFilter.Data - | AcceptedMessagesFilter.Data; + | AcceptedMessagesFilter.Data export type Proto = | AllowAllMessagesFilter.Proto | AcceptedMessageKeysFilter.Proto - | AcceptedMessagesFilter.Proto; + | AcceptedMessagesFilter.Proto export function fromAmino(data: ContractFilter.Amino): ContractFilter { switch (data.type) { case 'wasm/AllowAllMessagesFilter': - return AllowAllMessagesFilter.fromAmino(data); + return AllowAllMessagesFilter.fromAmino(data) case 'wasm/AcceptedMessageKeysFilter': - return AcceptedMessageKeysFilter.fromAmino(data); + return AcceptedMessageKeysFilter.fromAmino(data) case 'wasm/AcceptedMessagesFilter': - return AcceptedMessagesFilter.fromAmino(data); + return AcceptedMessagesFilter.fromAmino(data) } } export function fromData(data: ContractFilter.Data): ContractFilter { switch (data['@type']) { case '/cosmwasm.wasm.v1.AllowAllMessagesFilter': - return AllowAllMessagesFilter.fromData(data); + return AllowAllMessagesFilter.fromData(data) case '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter': - return AcceptedMessageKeysFilter.fromData(data); + return AcceptedMessageKeysFilter.fromData(data) case '/cosmwasm.wasm.v1.AcceptedMessagesFilter': - return AcceptedMessagesFilter.fromData(data); + return AcceptedMessagesFilter.fromData(data) } } export function fromProto(proto: Any): ContractFilter { - const typeUrl = proto.typeUrl; + const typeUrl = proto.typeUrl switch (typeUrl) { case '/cosmwasm.wasm.v1.AllowAllMessagesFilter': - return AllowAllMessagesFilter.unpackAny(proto); + return AllowAllMessagesFilter.unpackAny(proto) case '/cosmwasm.wasm.v1.AcceptedMessageKeysFilter': - return AcceptedMessageKeysFilter.unpackAny(proto); + return AcceptedMessageKeysFilter.unpackAny(proto) case '/cosmwasm.wasm.v1.AcceptedMessagesFilter': - return AcceptedMessagesFilter.unpackAny(proto); + return AcceptedMessagesFilter.unpackAny(proto) } - throw new Error(`ContractFilter type ${typeUrl} not recognized`); + throw new Error(`ContractFilter type ${typeUrl} not recognized`) } } diff --git a/src/core/wasm/authorizations/ContractGrant.ts b/src/core/wasm/authorizations/ContractGrant.ts index b0e5e60..bf7f748 100644 --- a/src/core/wasm/authorizations/ContractGrant.ts +++ b/src/core/wasm/authorizations/ContractGrant.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { ContractLimit } from './ContractLimit'; -import { ContractFilter } from './ContractFilter'; -import { ContractGrant as ContractGrant_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { ContractLimit } from './ContractLimit' +import { ContractFilter } from './ContractFilter' +import { ContractGrant as ContractGrant_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class ContractGrant extends JSONSerializable< ContractGrant.Amino, @@ -20,43 +20,43 @@ export class ContractGrant extends JSONSerializable< public limit: ContractLimit, public filter: ContractFilter ) { - super(); + super() } public static fromAmino(data: ContractGrant.Amino): ContractGrant { - const { contract, limit, filter } = data; + const { contract, limit, filter } = data return new ContractGrant( contract, ContractLimit.fromAmino(limit), ContractFilter.fromAmino(filter) - ); + ) } public toAmino(): ContractGrant.Amino { - const { contract, limit, filter } = this; + const { contract, limit, filter } = this return { contract, limit: limit.toAmino(), filter: filter.toAmino(), - }; + } } public static fromData(data: ContractGrant.Data): ContractGrant { - const { contract, limit, filter } = data; + const { contract, limit, filter } = data return new ContractGrant( contract, ContractLimit.fromData(limit), ContractFilter.fromData(filter) - ); + ) } public toData(): ContractGrant.Data { - const { contract, limit, filter } = this; + const { contract, limit, filter } = this return { contract, limit: limit.toData(), filter: filter.toData(), - }; + } } public static fromProto(data: ContractGrant.Proto): ContractGrant { @@ -64,31 +64,31 @@ export class ContractGrant extends JSONSerializable< data.contract, ContractLimit.fromProto(data.limit as Any), ContractFilter.fromProto(data.filter as Any) - ); + ) } public toProto(): ContractGrant.Proto { - const { contract, limit, filter } = this; + const { contract, limit, filter } = this return ContractGrant_pb.fromPartial({ contract, limit: limit.packAny(), filter: filter.packAny(), - }); + }) } } export namespace ContractGrant { export interface Amino { - contract: AccAddress; - limit: ContractLimit.Amino; - filter: ContractFilter.Amino; + contract: AccAddress + limit: ContractLimit.Amino + filter: ContractFilter.Amino } export interface Data { - contract: AccAddress; - limit: ContractLimit.Data; - filter: ContractFilter.Data; + contract: AccAddress + limit: ContractLimit.Data + filter: ContractFilter.Data } - export type Proto = ContractGrant_pb; + export type Proto = ContractGrant_pb } diff --git a/src/core/wasm/authorizations/ContractLimit.ts b/src/core/wasm/authorizations/ContractLimit.ts index dff4392..6af8ba9 100644 --- a/src/core/wasm/authorizations/ContractLimit.ts +++ b/src/core/wasm/authorizations/ContractLimit.ts @@ -1,57 +1,57 @@ -import { MaxCallsLimit } from './MaxCallsLimit'; -import { MaxFundsLimit } from './MaxFundsLimit'; -import { CombinedLimit } from './CombinedLimit'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { MaxCallsLimit } from './MaxCallsLimit' +import { MaxFundsLimit } from './MaxFundsLimit' +import { CombinedLimit } from './CombinedLimit' +import { Any } from '@initia/initia.proto/google/protobuf/any' -export type ContractLimit = MaxCallsLimit | MaxFundsLimit | CombinedLimit; +export type ContractLimit = MaxCallsLimit | MaxFundsLimit | CombinedLimit export namespace ContractLimit { export type Amino = | MaxCallsLimit.Amino | MaxFundsLimit.Amino - | CombinedLimit.Amino; + | CombinedLimit.Amino export type Data = | MaxCallsLimit.Data | MaxFundsLimit.Data - | CombinedLimit.Data; + | CombinedLimit.Data export type Proto = | MaxCallsLimit.Proto | MaxFundsLimit.Proto - | CombinedLimit.Proto; + | CombinedLimit.Proto export function fromAmino(data: ContractLimit.Amino): ContractLimit { switch (data.type) { case 'wasm/MaxCallsLimit': - return MaxCallsLimit.fromAmino(data); + return MaxCallsLimit.fromAmino(data) case 'wasm/MaxFundsLimit': - return MaxFundsLimit.fromAmino(data); + return MaxFundsLimit.fromAmino(data) case 'wasm/CombinedLimit': - return CombinedLimit.fromAmino(data); + return CombinedLimit.fromAmino(data) } } export function fromData(data: ContractLimit.Data): ContractLimit { switch (data['@type']) { case '/cosmwasm.wasm.v1.MaxCallsLimit': - return MaxCallsLimit.fromData(data); + return MaxCallsLimit.fromData(data) case '/cosmwasm.wasm.v1.MaxFundsLimit': - return MaxFundsLimit.fromData(data); + return MaxFundsLimit.fromData(data) case '/cosmwasm.wasm.v1.CombinedLimit': - return CombinedLimit.fromData(data); + return CombinedLimit.fromData(data) } } export function fromProto(proto: Any): ContractLimit { - const typeUrl = proto.typeUrl; + const typeUrl = proto.typeUrl switch (typeUrl) { case '/cosmwasm.wasm.v1.MaxCallsLimit': - return MaxCallsLimit.unpackAny(proto); + return MaxCallsLimit.unpackAny(proto) case '/cosmwasm.wasm.v1.MaxFundsLimit': - return MaxFundsLimit.unpackAny(proto); + return MaxFundsLimit.unpackAny(proto) case '/cosmwasm.wasm.v1.CombinedLimit': - return CombinedLimit.unpackAny(proto); + return CombinedLimit.unpackAny(proto) } - throw new Error(`ContractLimit type ${typeUrl} not recognized`); + throw new Error(`ContractLimit type ${typeUrl} not recognized`) } } diff --git a/src/core/wasm/authorizations/ContractMigrationAuthorization.ts b/src/core/wasm/authorizations/ContractMigrationAuthorization.ts index 7433c35..e0ff9f6 100644 --- a/src/core/wasm/authorizations/ContractMigrationAuthorization.ts +++ b/src/core/wasm/authorizations/ContractMigrationAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { ContractMigrationAuthorization as ContractMigrationAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { ContractGrant } from './ContractGrant'; +import { JSONSerializable } from '../../../util/json' +import { ContractMigrationAuthorization as ContractMigrationAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { ContractGrant } from './ContractGrant' export class ContractMigrationAuthorization extends JSONSerializable< ContractMigrationAuthorization.Amino, @@ -9,7 +9,7 @@ export class ContractMigrationAuthorization extends JSONSerializable< ContractMigrationAuthorization.Proto > { constructor(public grants: ContractGrant[]) { - super(); + super() } public static fromAmino( @@ -17,14 +17,14 @@ export class ContractMigrationAuthorization extends JSONSerializable< ): ContractMigrationAuthorization { return new ContractMigrationAuthorization( data.value.grants.map(ContractGrant.fromAmino) - ); + ) } public toAmino(): ContractMigrationAuthorization.Amino { return { type: 'wasm/ContractMigrationAuthorization', - value: { grants: this.grants.map(grant => grant.toAmino()) }, - }; + value: { grants: this.grants.map((grant) => grant.toAmino()) }, + } } public static fromData( @@ -32,14 +32,14 @@ export class ContractMigrationAuthorization extends JSONSerializable< ): ContractMigrationAuthorization { return new ContractMigrationAuthorization( data.grants.map(ContractGrant.fromData) - ); + ) } public toData(): ContractMigrationAuthorization.Data { return { '@type': '/cosmwasm.wasm.v1.ContractMigrationAuthorization', - grants: this.grants.map(grant => grant.toData()), - }; + grants: this.grants.map((grant) => grant.toData()), + } } public static fromProto( @@ -47,41 +47,41 @@ export class ContractMigrationAuthorization extends JSONSerializable< ): ContractMigrationAuthorization { return new ContractMigrationAuthorization( data.grants.map(ContractGrant.fromProto) - ); + ) } public toProto(): ContractMigrationAuthorization.Proto { return ContractMigrationAuthorization_pb.fromPartial({ - grants: this.grants.map(grant => grant.toProto()), - }); + grants: this.grants.map((grant) => grant.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.ContractMigrationAuthorization', value: ContractMigrationAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): ContractMigrationAuthorization { return ContractMigrationAuthorization.fromProto( ContractMigrationAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace ContractMigrationAuthorization { export interface Amino { - type: 'wasm/ContractMigrationAuthorization'; + type: 'wasm/ContractMigrationAuthorization' value: { - grants: ContractGrant.Amino[]; - }; + grants: ContractGrant.Amino[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.ContractMigrationAuthorization'; - grants: ContractGrant.Data[]; + '@type': '/cosmwasm.wasm.v1.ContractMigrationAuthorization' + grants: ContractGrant.Data[] } - export type Proto = ContractMigrationAuthorization_pb; + export type Proto = ContractMigrationAuthorization_pb } diff --git a/src/core/wasm/authorizations/MaxCallsLimit.ts b/src/core/wasm/authorizations/MaxCallsLimit.ts index 98c5b27..0528673 100644 --- a/src/core/wasm/authorizations/MaxCallsLimit.ts +++ b/src/core/wasm/authorizations/MaxCallsLimit.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { MaxCallsLimit as MaxCallsLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { MaxCallsLimit as MaxCallsLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import Long from 'long' export class MaxCallsLimit extends JSONSerializable< MaxCallsLimit.Amino, @@ -9,63 +9,63 @@ export class MaxCallsLimit extends JSONSerializable< MaxCallsLimit.Proto > { constructor(public remaining: number) { - super(); + super() } public static fromAmino(data: MaxCallsLimit.Amino): MaxCallsLimit { - return new MaxCallsLimit(Number.parseInt(data.value.remaining)); + return new MaxCallsLimit(Number.parseInt(data.value.remaining)) } public toAmino(): MaxCallsLimit.Amino { return { type: 'wasm/MaxCallsLimit', value: { remaining: this.remaining.toString() }, - }; + } } public static fromData(data: MaxCallsLimit.Data): MaxCallsLimit { - return new MaxCallsLimit(Number.parseInt(data.remaining)); + return new MaxCallsLimit(Number.parseInt(data.remaining)) } public toData(): MaxCallsLimit.Data { return { '@type': '/cosmwasm.wasm.v1.MaxCallsLimit', remaining: this.remaining.toString(), - }; + } } public static fromProto(data: MaxCallsLimit.Proto): MaxCallsLimit { - return new MaxCallsLimit(data.remaining.toNumber()); + return new MaxCallsLimit(data.remaining.toNumber()) } public toProto(): MaxCallsLimit.Proto { return MaxCallsLimit_pb.fromPartial({ remaining: Long.fromNumber(this.remaining), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MaxCallsLimit', value: MaxCallsLimit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MaxCallsLimit { - return MaxCallsLimit.fromProto(MaxCallsLimit_pb.decode(msgAny.value)); + return MaxCallsLimit.fromProto(MaxCallsLimit_pb.decode(msgAny.value)) } } export namespace MaxCallsLimit { export interface Amino { - type: 'wasm/MaxCallsLimit'; - value: { remaining: string }; + type: 'wasm/MaxCallsLimit' + value: { remaining: string } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MaxCallsLimit'; - remaining: string; + '@type': '/cosmwasm.wasm.v1.MaxCallsLimit' + remaining: string } - export type Proto = MaxCallsLimit_pb; + export type Proto = MaxCallsLimit_pb } diff --git a/src/core/wasm/authorizations/MaxFundsLimit.ts b/src/core/wasm/authorizations/MaxFundsLimit.ts index c8bf10f..f699eec 100644 --- a/src/core/wasm/authorizations/MaxFundsLimit.ts +++ b/src/core/wasm/authorizations/MaxFundsLimit.ts @@ -1,72 +1,72 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { MaxFundsLimit as MaxFundsLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { MaxFundsLimit as MaxFundsLimit_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' export class MaxFundsLimit extends JSONSerializable< MaxFundsLimit.Amino, MaxFundsLimit.Data, MaxFundsLimit.Proto > { - public amounts: Coins; + public amounts: Coins constructor(amounts: Coins.Input) { - super(); - this.amounts = new Coins(amounts); + super() + this.amounts = new Coins(amounts) } public static fromAmino(data: MaxFundsLimit.Amino): MaxFundsLimit { - return new MaxFundsLimit(Coins.fromAmino(data.value.amounts)); + return new MaxFundsLimit(Coins.fromAmino(data.value.amounts)) } public toAmino(): MaxFundsLimit.Amino { return { type: 'wasm/MaxFundsLimit', value: { amounts: this.amounts.toAmino() }, - }; + } } public static fromData(data: MaxFundsLimit.Data): MaxFundsLimit { - return new MaxFundsLimit(Coins.fromData(data.amounts)); + return new MaxFundsLimit(Coins.fromData(data.amounts)) } public toData(): MaxFundsLimit.Data { return { '@type': '/cosmwasm.wasm.v1.MaxFundsLimit', amounts: this.amounts.toData(), - }; + } } public static fromProto(data: MaxFundsLimit.Proto): MaxFundsLimit { - return new MaxFundsLimit(Coins.fromProto(data.amounts)); + return new MaxFundsLimit(Coins.fromProto(data.amounts)) } public toProto(): MaxFundsLimit.Proto { - return MaxFundsLimit_pb.fromPartial({ amounts: this.amounts.toProto() }); + return MaxFundsLimit_pb.fromPartial({ amounts: this.amounts.toProto() }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MaxFundsLimit', value: MaxFundsLimit_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MaxFundsLimit { - return MaxFundsLimit.fromProto(MaxFundsLimit_pb.decode(msgAny.value)); + return MaxFundsLimit.fromProto(MaxFundsLimit_pb.decode(msgAny.value)) } } export namespace MaxFundsLimit { export interface Amino { - type: 'wasm/MaxFundsLimit'; - value: { amounts: Coins.Amino }; + type: 'wasm/MaxFundsLimit' + value: { amounts: Coins.Amino } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MaxFundsLimit'; - amounts: Coins.Data; + '@type': '/cosmwasm.wasm.v1.MaxFundsLimit' + amounts: Coins.Data } - export type Proto = MaxFundsLimit_pb; + export type Proto = MaxFundsLimit_pb } diff --git a/src/core/wasm/authorizations/StoreCodeAuthorization.ts b/src/core/wasm/authorizations/StoreCodeAuthorization.ts index c3a8f32..44b0b49 100644 --- a/src/core/wasm/authorizations/StoreCodeAuthorization.ts +++ b/src/core/wasm/authorizations/StoreCodeAuthorization.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { StoreCodeAuthorization as StoreCodeAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { CodeGrant } from './CodeGrant'; +import { JSONSerializable } from '../../../util/json' +import { StoreCodeAuthorization as StoreCodeAuthorization_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/authz' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { CodeGrant } from './CodeGrant' export class StoreCodeAuthorization extends JSONSerializable< StoreCodeAuthorization.Amino, @@ -9,7 +9,7 @@ export class StoreCodeAuthorization extends JSONSerializable< StoreCodeAuthorization.Proto > { constructor(public grants: CodeGrant[]) { - super(); + super() } public static fromAmino( @@ -17,67 +17,67 @@ export class StoreCodeAuthorization extends JSONSerializable< ): StoreCodeAuthorization { return new StoreCodeAuthorization( data.value.grants.map(CodeGrant.fromAmino) - ); + ) } public toAmino(): StoreCodeAuthorization.Amino { return { type: 'wasm/StoreCodeAuthorization', - value: { grants: this.grants.map(grant => grant.toAmino()) }, - }; + value: { grants: this.grants.map((grant) => grant.toAmino()) }, + } } public static fromData( data: StoreCodeAuthorization.Data ): StoreCodeAuthorization { - return new StoreCodeAuthorization(data.grants.map(CodeGrant.fromData)); + return new StoreCodeAuthorization(data.grants.map(CodeGrant.fromData)) } public toData(): StoreCodeAuthorization.Data { return { '@type': '/cosmwasm.wasm.v1.StoreCodeAuthorization', - grants: this.grants.map(grant => grant.toData()), - }; + grants: this.grants.map((grant) => grant.toData()), + } } public static fromProto( data: StoreCodeAuthorization.Proto ): StoreCodeAuthorization { - return new StoreCodeAuthorization(data.grants.map(CodeGrant.fromProto)); + return new StoreCodeAuthorization(data.grants.map(CodeGrant.fromProto)) } public toProto(): StoreCodeAuthorization.Proto { return StoreCodeAuthorization_pb.fromPartial({ - grants: this.grants.map(grant => grant.toProto()), - }); + grants: this.grants.map((grant) => grant.toProto()), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.StoreCodeAuthorization', value: StoreCodeAuthorization_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): StoreCodeAuthorization { return StoreCodeAuthorization.fromProto( StoreCodeAuthorization_pb.decode(msgAny.value) - ); + ) } } export namespace StoreCodeAuthorization { export interface Amino { - type: 'wasm/StoreCodeAuthorization'; + type: 'wasm/StoreCodeAuthorization' value: { - grants: CodeGrant.Amino[]; - }; + grants: CodeGrant.Amino[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.StoreCodeAuthorization'; - grants: CodeGrant.Data[]; + '@type': '/cosmwasm.wasm.v1.StoreCodeAuthorization' + grants: CodeGrant.Data[] } - export type Proto = StoreCodeAuthorization_pb; + export type Proto = StoreCodeAuthorization_pb } diff --git a/src/core/wasm/authorizations/index.ts b/src/core/wasm/authorizations/index.ts index 8ab0c52..549e1c5 100644 --- a/src/core/wasm/authorizations/index.ts +++ b/src/core/wasm/authorizations/index.ts @@ -1,11 +1,11 @@ -export * from './StoreCodeAuthorization'; -export * from './ContractExecutionAuthorization'; -export * from './ContractMigrationAuthorization'; -export * from './CodeGrant'; -export * from './ContractGrant'; -export * from './MaxCallsLimit'; -export * from './MaxFundsLimit'; -export * from './CombinedLimit'; -export * from './AllowAllMessagesFilter'; -export * from './AcceptedMessageKeysFilter'; -export * from './AcceptedMessagesFilter'; +export * from './StoreCodeAuthorization' +export * from './ContractExecutionAuthorization' +export * from './ContractMigrationAuthorization' +export * from './CodeGrant' +export * from './ContractGrant' +export * from './MaxCallsLimit' +export * from './MaxFundsLimit' +export * from './CombinedLimit' +export * from './AllowAllMessagesFilter' +export * from './AcceptedMessageKeysFilter' +export * from './AcceptedMessagesFilter' diff --git a/src/core/wasm/index.ts b/src/core/wasm/index.ts index 4fe5e5a..ec69570 100644 --- a/src/core/wasm/index.ts +++ b/src/core/wasm/index.ts @@ -1,5 +1,5 @@ -export * from './authorizations'; -export * from './msgs'; -export * from './AbsoluteTxPosition'; -export * from './AccessConfig'; -export * from './WasmParams'; +export * from './authorizations' +export * from './msgs' +export * from './AbsoluteTxPosition' +export * from './AccessConfig' +export * from './WasmParams' diff --git a/src/core/wasm/msgs/MsgAddCodeUploadParamsAddresses.ts b/src/core/wasm/msgs/MsgAddCodeUploadParamsAddresses.ts index 661ff94..dd9c9af 100644 --- a/src/core/wasm/msgs/MsgAddCodeUploadParamsAddresses.ts +++ b/src/core/wasm/msgs/MsgAddCodeUploadParamsAddresses.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgAddCodeUploadParamsAddresses as MsgAddCodeUploadParamsAddresses_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgAddCodeUploadParamsAddresses as MsgAddCodeUploadParamsAddresses_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgAddCodeUploadParamsAddresses extends JSONSerializable< MsgAddCodeUploadParamsAddresses.Amino, @@ -12,8 +12,11 @@ export class MsgAddCodeUploadParamsAddresses extends JSONSerializable< * @param authority the address of the governance account * @param addresses */ - constructor(public authority: AccAddress, public addresses: AccAddress[]) { - super(); + constructor( + public authority: AccAddress, + public addresses: AccAddress[] + ) { + super() } public static fromAmino( @@ -21,79 +24,79 @@ export class MsgAddCodeUploadParamsAddresses extends JSONSerializable< ): MsgAddCodeUploadParamsAddresses { const { value: { authority, addresses }, - } = data; - return new MsgAddCodeUploadParamsAddresses(authority, addresses); + } = data + return new MsgAddCodeUploadParamsAddresses(authority, addresses) } public toAmino(): MsgAddCodeUploadParamsAddresses.Amino { - const { authority, addresses } = this; + const { authority, addresses } = this return { type: 'wasm/MsgAddCodeUploadParamsAddresses', value: { authority, addresses, }, - }; + } } public static fromData( data: MsgAddCodeUploadParamsAddresses.Data ): MsgAddCodeUploadParamsAddresses { - const { authority, addresses } = data; - return new MsgAddCodeUploadParamsAddresses(authority, addresses); + const { authority, addresses } = data + return new MsgAddCodeUploadParamsAddresses(authority, addresses) } public toData(): MsgAddCodeUploadParamsAddresses.Data { - const { authority, addresses } = this; + const { authority, addresses } = this return { '@type': '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses', authority, addresses, - }; + } } public static fromProto( data: MsgAddCodeUploadParamsAddresses.Proto ): MsgAddCodeUploadParamsAddresses { - return new MsgAddCodeUploadParamsAddresses(data.authority, data.addresses); + return new MsgAddCodeUploadParamsAddresses(data.authority, data.addresses) } public toProto(): MsgAddCodeUploadParamsAddresses.Proto { - const { authority, addresses } = this; + const { authority, addresses } = this return MsgAddCodeUploadParamsAddresses_pb.fromPartial({ authority, addresses, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses', value: MsgAddCodeUploadParamsAddresses_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgAddCodeUploadParamsAddresses { return MsgAddCodeUploadParamsAddresses.fromProto( MsgAddCodeUploadParamsAddresses_pb.decode(msgAny.value) - ); + ) } } export namespace MsgAddCodeUploadParamsAddresses { export interface Amino { - type: 'wasm/MsgAddCodeUploadParamsAddresses'; + type: 'wasm/MsgAddCodeUploadParamsAddresses' value: { - authority: AccAddress; - addresses: AccAddress[]; - }; + authority: AccAddress + addresses: AccAddress[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses'; - authority: AccAddress; - addresses: AccAddress[]; + '@type': '/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses' + authority: AccAddress + addresses: AccAddress[] } - export type Proto = MsgAddCodeUploadParamsAddresses_pb; + export type Proto = MsgAddCodeUploadParamsAddresses_pb } diff --git a/src/core/wasm/msgs/MsgClearAdmin.ts b/src/core/wasm/msgs/MsgClearAdmin.ts index f0bfb6e..097d2f0 100644 --- a/src/core/wasm/msgs/MsgClearAdmin.ts +++ b/src/core/wasm/msgs/MsgClearAdmin.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgClearAdmin as MsgClearAdmin_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgClearAdmin as MsgClearAdmin_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgClearAdmin extends JSONSerializable< MsgClearAdmin.Amino, @@ -12,81 +12,84 @@ export class MsgClearAdmin extends JSONSerializable< * @param sender the actor that signed the messages * @param contract the address of the smart contract */ - constructor(public sender: AccAddress, public contract: AccAddress) { - super(); + constructor( + public sender: AccAddress, + public contract: AccAddress + ) { + super() } public static fromAmino(data: MsgClearAdmin.Amino): MsgClearAdmin { const { value: { sender, contract }, - } = data; + } = data - return new MsgClearAdmin(sender, contract); + return new MsgClearAdmin(sender, contract) } public toAmino(): MsgClearAdmin.Amino { - const { sender, contract } = this; + const { sender, contract } = this return { type: 'wasm/MsgClearAdmin', value: { sender, contract, }, - }; + } } public static fromData(data: MsgClearAdmin.Data): MsgClearAdmin { - const { sender, contract } = data; - return new MsgClearAdmin(sender, contract); + const { sender, contract } = data + return new MsgClearAdmin(sender, contract) } public toData(): MsgClearAdmin.Data { - const { sender, contract } = this; + const { sender, contract } = this return { '@type': '/cosmwasm.wasm.v1.MsgClearAdmin', sender, contract, - }; + } } public static fromProto(data: MsgClearAdmin.Proto): MsgClearAdmin { - return new MsgClearAdmin(data.sender, data.contract); + return new MsgClearAdmin(data.sender, data.contract) } public toProto(): MsgClearAdmin.Proto { - const { sender, contract } = this; + const { sender, contract } = this return MsgClearAdmin_pb.fromPartial({ sender, contract, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgClearAdmin', value: MsgClearAdmin_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgClearAdmin { - return MsgClearAdmin.fromProto(MsgClearAdmin_pb.decode(msgAny.value)); + return MsgClearAdmin.fromProto(MsgClearAdmin_pb.decode(msgAny.value)) } } export namespace MsgClearAdmin { export interface Amino { - type: 'wasm/MsgClearAdmin'; + type: 'wasm/MsgClearAdmin' value: { - sender: AccAddress; - contract: AccAddress; - }; + sender: AccAddress + contract: AccAddress + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgClearAdmin'; - sender: AccAddress; - contract: AccAddress; + '@type': '/cosmwasm.wasm.v1.MsgClearAdmin' + sender: AccAddress + contract: AccAddress } - export type Proto = MsgClearAdmin_pb; + export type Proto = MsgClearAdmin_pb } diff --git a/src/core/wasm/msgs/MsgExecuteContract.ts b/src/core/wasm/msgs/MsgExecuteContract.ts index 161e139..653c2eb 100644 --- a/src/core/wasm/msgs/MsgExecuteContract.ts +++ b/src/core/wasm/msgs/MsgExecuteContract.ts @@ -1,15 +1,15 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgExecuteContract as MsgExecuteContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgExecuteContract as MsgExecuteContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgExecuteContract extends JSONSerializable< MsgExecuteContract.Amino, MsgExecuteContract.Data, MsgExecuteContract.Proto > { - public funds: Coins; + public funds: Coins /** * @param sender the actor that signed the messages * @param contract the address of the smart contract @@ -22,25 +22,20 @@ export class MsgExecuteContract extends JSONSerializable< public msg: string, funds: Coins.Input ) { - super(); - this.funds = new Coins(funds); + super() + this.funds = new Coins(funds) } public static fromAmino(data: MsgExecuteContract.Amino): MsgExecuteContract { const { value: { sender, contract, msg, funds }, - } = data; + } = data - return new MsgExecuteContract( - sender, - contract, - msg, - Coins.fromAmino(funds) - ); + return new MsgExecuteContract(sender, contract, msg, Coins.fromAmino(funds)) } public toAmino(): MsgExecuteContract.Amino { - const { sender, contract, msg, funds } = this; + const { sender, contract, msg, funds } = this return { type: 'wasm/MsgExecuteContract', value: { @@ -49,23 +44,23 @@ export class MsgExecuteContract extends JSONSerializable< msg, funds: funds.toAmino(), }, - }; + } } public static fromData(data: MsgExecuteContract.Data): MsgExecuteContract { - const { sender, contract, msg, funds } = data; - return new MsgExecuteContract(sender, contract, msg, Coins.fromData(funds)); + const { sender, contract, msg, funds } = data + return new MsgExecuteContract(sender, contract, msg, Coins.fromData(funds)) } public toData(): MsgExecuteContract.Data { - const { sender, contract, msg, funds } = this; + const { sender, contract, msg, funds } = this return { '@type': '/cosmwasm.wasm.v1.MsgExecuteContract', sender, contract, msg, funds: funds.toData(), - }; + } } public static fromProto(data: MsgExecuteContract.Proto): MsgExecuteContract { @@ -74,51 +69,51 @@ export class MsgExecuteContract extends JSONSerializable< data.contract, Buffer.from(data.msg).toString('base64'), Coins.fromProto(data.funds) - ); + ) } public toProto(): MsgExecuteContract.Proto { - const { sender, contract, msg, funds } = this; + const { sender, contract, msg, funds } = this return MsgExecuteContract_pb.fromPartial({ sender, contract, msg: Buffer.from(msg, 'base64'), funds: funds.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgExecuteContract', value: MsgExecuteContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgExecuteContract { return MsgExecuteContract.fromProto( MsgExecuteContract_pb.decode(msgAny.value) - ); + ) } } export namespace MsgExecuteContract { export interface Amino { - type: 'wasm/MsgExecuteContract'; + type: 'wasm/MsgExecuteContract' value: { - sender: AccAddress; - contract: AccAddress; - msg: string; - funds: Coins.Amino; - }; + sender: AccAddress + contract: AccAddress + msg: string + funds: Coins.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgExecuteContract'; - sender: AccAddress; - contract: AccAddress; - msg: string; - funds: Coins.Data; + '@type': '/cosmwasm.wasm.v1.MsgExecuteContract' + sender: AccAddress + contract: AccAddress + msg: string + funds: Coins.Data } - export type Proto = MsgExecuteContract_pb; + export type Proto = MsgExecuteContract_pb } diff --git a/src/core/wasm/msgs/MsgInstantiateContract.ts b/src/core/wasm/msgs/MsgInstantiateContract.ts index 6f42513..53c5322 100644 --- a/src/core/wasm/msgs/MsgInstantiateContract.ts +++ b/src/core/wasm/msgs/MsgInstantiateContract.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgInstantiateContract as MsgInstantiateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgInstantiateContract as MsgInstantiateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import Long from 'long' export class MsgInstantiateContract extends JSONSerializable< MsgInstantiateContract.Amino, MsgInstantiateContract.Data, MsgInstantiateContract.Proto > { - public funds: Coins; + public funds: Coins /** * @param sender the actor that signed the messages * @param admin an optional address that can execute migrations @@ -27,8 +27,8 @@ export class MsgInstantiateContract extends JSONSerializable< public msg: string, funds: Coins.Input ) { - super(); - this.funds = new Coins(funds); + super() + this.funds = new Coins(funds) } public static fromAmino( @@ -36,7 +36,7 @@ export class MsgInstantiateContract extends JSONSerializable< ): MsgInstantiateContract { const { value: { sender, admin, code_id, label, msg, funds }, - } = data; + } = data return new MsgInstantiateContract( sender, @@ -45,11 +45,11 @@ export class MsgInstantiateContract extends JSONSerializable< label, msg, Coins.fromAmino(funds) - ); + ) } public toAmino(): MsgInstantiateContract.Amino { - const { sender, admin, code_id, label, msg, funds } = this; + const { sender, admin, code_id, label, msg, funds } = this return { type: 'wasm/MsgInstantiateContract', value: { @@ -60,13 +60,13 @@ export class MsgInstantiateContract extends JSONSerializable< msg, funds: funds.toAmino(), }, - }; + } } public static fromData( data: MsgInstantiateContract.Data ): MsgInstantiateContract { - const { sender, admin, code_id, label, msg, funds } = data; + const { sender, admin, code_id, label, msg, funds } = data return new MsgInstantiateContract( sender, admin, @@ -74,11 +74,11 @@ export class MsgInstantiateContract extends JSONSerializable< label, msg, Coins.fromData(funds) - ); + ) } public toData(): MsgInstantiateContract.Data { - const { sender, admin, code_id, label, msg, funds } = this; + const { sender, admin, code_id, label, msg, funds } = this return { '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract', sender, @@ -87,7 +87,7 @@ export class MsgInstantiateContract extends JSONSerializable< label, msg, funds: funds.toData(), - }; + } } public static fromProto( @@ -100,11 +100,11 @@ export class MsgInstantiateContract extends JSONSerializable< data.label, Buffer.from(data.msg).toString('base64'), Coins.fromProto(data.funds) - ); + ) } public toProto(): MsgInstantiateContract.Proto { - const { sender, admin, code_id, label, msg, funds } = this; + const { sender, admin, code_id, label, msg, funds } = this return MsgInstantiateContract_pb.fromPartial({ sender, admin, @@ -112,45 +112,45 @@ export class MsgInstantiateContract extends JSONSerializable< label, msg: Buffer.from(msg, 'base64'), funds: funds.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgInstantiateContract', value: MsgInstantiateContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgInstantiateContract { return MsgInstantiateContract.fromProto( MsgInstantiateContract_pb.decode(msgAny.value) - ); + ) } } export namespace MsgInstantiateContract { export interface Amino { - type: 'wasm/MsgInstantiateContract'; + type: 'wasm/MsgInstantiateContract' value: { - sender: AccAddress; - admin?: AccAddress; - code_id: string; - label?: string; - msg: string; - funds: Coins.Amino; - }; + sender: AccAddress + admin?: AccAddress + code_id: string + label?: string + msg: string + funds: Coins.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract'; - sender: AccAddress; - admin?: AccAddress; - code_id: string; - label?: string; - msg: string; - funds: Coins.Data; + '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract' + sender: AccAddress + admin?: AccAddress + code_id: string + label?: string + msg: string + funds: Coins.Data } - export type Proto = MsgInstantiateContract_pb; + export type Proto = MsgInstantiateContract_pb } diff --git a/src/core/wasm/msgs/MsgInstantiateContractV2.ts b/src/core/wasm/msgs/MsgInstantiateContractV2.ts index 373785a..002d831 100644 --- a/src/core/wasm/msgs/MsgInstantiateContractV2.ts +++ b/src/core/wasm/msgs/MsgInstantiateContractV2.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgInstantiateContract2 as MsgInstantiateContract2_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgInstantiateContract2 as MsgInstantiateContract2_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import Long from 'long' export class MsgInstantiateContractV2 extends JSONSerializable< MsgInstantiateContractV2.Amino, MsgInstantiateContractV2.Data, MsgInstantiateContractV2.Proto > { - public funds: Coins; + public funds: Coins /** * @param sender the actor that signed the messages * @param admin an optional address that can execute migrations @@ -31,8 +31,8 @@ export class MsgInstantiateContractV2 extends JSONSerializable< public salt: string, public fix_msg: boolean ) { - super(); - this.funds = new Coins(funds); + super() + this.funds = new Coins(funds) } public static fromAmino( @@ -40,7 +40,7 @@ export class MsgInstantiateContractV2 extends JSONSerializable< ): MsgInstantiateContractV2 { const { value: { sender, admin, code_id, label, msg, funds, salt, fix_msg }, - } = data; + } = data return new MsgInstantiateContractV2( sender, @@ -51,11 +51,11 @@ export class MsgInstantiateContractV2 extends JSONSerializable< Coins.fromAmino(funds), salt, fix_msg - ); + ) } public toAmino(): MsgInstantiateContractV2.Amino { - const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this; + const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this return { type: 'wasm/MsgInstantiateContract2', value: { @@ -68,13 +68,13 @@ export class MsgInstantiateContractV2 extends JSONSerializable< salt, fix_msg, }, - }; + } } public static fromData( data: MsgInstantiateContractV2.Data ): MsgInstantiateContractV2 { - const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = data; + const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = data return new MsgInstantiateContractV2( sender, admin, @@ -84,11 +84,11 @@ export class MsgInstantiateContractV2 extends JSONSerializable< Coins.fromData(funds), salt, fix_msg - ); + ) } public toData(): MsgInstantiateContractV2.Data { - const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this; + const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this return { '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract2', sender, @@ -99,7 +99,7 @@ export class MsgInstantiateContractV2 extends JSONSerializable< funds: funds.toData(), salt, fix_msg, - }; + } } public static fromProto( @@ -114,11 +114,11 @@ export class MsgInstantiateContractV2 extends JSONSerializable< Coins.fromProto(data.funds), Buffer.from(data.salt).toString('base64'), data.fixMsg - ); + ) } public toProto(): MsgInstantiateContractV2.Proto { - const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this; + const { sender, admin, code_id, label, msg, funds, salt, fix_msg } = this return MsgInstantiateContract2_pb.fromPartial({ sender, admin, @@ -128,49 +128,49 @@ export class MsgInstantiateContractV2 extends JSONSerializable< funds: funds.toProto(), salt: Buffer.from(salt, 'base64'), fixMsg: fix_msg, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgInstantiateContract2', value: MsgInstantiateContract2_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgInstantiateContractV2 { return MsgInstantiateContractV2.fromProto( MsgInstantiateContract2_pb.decode(msgAny.value) - ); + ) } } export namespace MsgInstantiateContractV2 { export interface Amino { - type: 'wasm/MsgInstantiateContract2'; + type: 'wasm/MsgInstantiateContract2' value: { - sender: AccAddress; - admin?: AccAddress; - code_id: string; - label?: string; - msg: string; - funds: Coins.Amino; - salt: string; - fix_msg: boolean; - }; + sender: AccAddress + admin?: AccAddress + code_id: string + label?: string + msg: string + funds: Coins.Amino + salt: string + fix_msg: boolean + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract2'; - sender: AccAddress; - admin?: AccAddress; - code_id: string; - label?: string; - msg: string; - funds: Coins.Data; - salt: string; - fix_msg: boolean; + '@type': '/cosmwasm.wasm.v1.MsgInstantiateContract2' + sender: AccAddress + admin?: AccAddress + code_id: string + label?: string + msg: string + funds: Coins.Data + salt: string + fix_msg: boolean } - export type Proto = MsgInstantiateContract2_pb; + export type Proto = MsgInstantiateContract2_pb } diff --git a/src/core/wasm/msgs/MsgMigrateContract.ts b/src/core/wasm/msgs/MsgMigrateContract.ts index 509d761..3523e69 100644 --- a/src/core/wasm/msgs/MsgMigrateContract.ts +++ b/src/core/wasm/msgs/MsgMigrateContract.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgMigrateContract as MsgMigrateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgMigrateContract as MsgMigrateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import Long from 'long' export class MsgMigrateContract extends JSONSerializable< MsgMigrateContract.Amino, @@ -21,24 +21,24 @@ export class MsgMigrateContract extends JSONSerializable< public code_id: number, public msg: string ) { - super(); + super() } public static fromAmino(data: MsgMigrateContract.Amino): MsgMigrateContract { const { value: { sender, contract, code_id, msg }, - } = data; + } = data return new MsgMigrateContract( sender, contract, Number.parseInt(code_id), msg - ); + ) } public toAmino(): MsgMigrateContract.Amino { - const { sender, contract, code_id, msg } = this; + const { sender, contract, code_id, msg } = this return { type: 'wasm/MsgMigrateContract', value: { @@ -47,28 +47,28 @@ export class MsgMigrateContract extends JSONSerializable< code_id: code_id.toString(), msg, }, - }; + } } public static fromData(data: MsgMigrateContract.Data): MsgMigrateContract { - const { sender, contract, code_id, msg } = data; + const { sender, contract, code_id, msg } = data return new MsgMigrateContract( sender, contract, Number.parseInt(code_id), msg - ); + ) } public toData(): MsgMigrateContract.Data { - const { sender, contract, code_id, msg } = this; + const { sender, contract, code_id, msg } = this return { '@type': '/cosmwasm.wasm.v1.MsgMigrateContract', sender, contract, code_id: code_id.toString(), msg, - }; + } } public static fromProto(data: MsgMigrateContract.Proto): MsgMigrateContract { @@ -77,51 +77,51 @@ export class MsgMigrateContract extends JSONSerializable< data.contract, data.codeId.toNumber(), Buffer.from(data.msg).toString('base64') - ); + ) } public toProto(): MsgMigrateContract.Proto { - const { sender, contract, code_id, msg } = this; + const { sender, contract, code_id, msg } = this return MsgMigrateContract_pb.fromPartial({ sender, contract, codeId: Long.fromNumber(code_id), msg: Buffer.from(msg, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgMigrateContract', value: MsgMigrateContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgMigrateContract { return MsgMigrateContract.fromProto( MsgMigrateContract_pb.decode(msgAny.value) - ); + ) } } export namespace MsgMigrateContract { export interface Amino { - type: 'wasm/MsgMigrateContract'; + type: 'wasm/MsgMigrateContract' value: { - sender: AccAddress; - contract: AccAddress; - code_id: string; - msg: string; - }; + sender: AccAddress + contract: AccAddress + code_id: string + msg: string + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgMigrateContract'; - sender: AccAddress; - contract: AccAddress; - code_id: string; - msg: string; + '@type': '/cosmwasm.wasm.v1.MsgMigrateContract' + sender: AccAddress + contract: AccAddress + code_id: string + msg: string } - export type Proto = MsgMigrateContract_pb; + export type Proto = MsgMigrateContract_pb } diff --git a/src/core/wasm/msgs/MsgPinCodes.ts b/src/core/wasm/msgs/MsgPinCodes.ts index efafd81..07daf98 100644 --- a/src/core/wasm/msgs/MsgPinCodes.ts +++ b/src/core/wasm/msgs/MsgPinCodes.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgPinCodes as MsgPinCodes_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgPinCodes as MsgPinCodes_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import Long from 'long' export class MsgPinCodes extends JSONSerializable< MsgPinCodes.Amino, @@ -13,83 +13,86 @@ export class MsgPinCodes extends JSONSerializable< * @param authority the address of the governance account * @param code_ids references the new WASM codes */ - constructor(public authority: AccAddress, public code_ids: number[]) { - super(); + constructor( + public authority: AccAddress, + public code_ids: number[] + ) { + super() } public static fromAmino(data: MsgPinCodes.Amino): MsgPinCodes { const { value: { authority, code_ids }, - } = data; - return new MsgPinCodes(authority, code_ids.map(Number.parseInt)); + } = data + return new MsgPinCodes(authority, code_ids.map(Number.parseInt)) } public toAmino(): MsgPinCodes.Amino { - const { authority, code_ids } = this; + const { authority, code_ids } = this return { type: 'wasm/MsgPinCodes', value: { authority, - code_ids: code_ids.map(id => id.toString()), + code_ids: code_ids.map((id) => id.toString()), }, - }; + } } public static fromData(data: MsgPinCodes.Data): MsgPinCodes { - const { authority, code_ids } = data; - return new MsgPinCodes(authority, code_ids.map(Number.parseInt)); + const { authority, code_ids } = data + return new MsgPinCodes(authority, code_ids.map(Number.parseInt)) } public toData(): MsgPinCodes.Data { - const { authority, code_ids } = this; + const { authority, code_ids } = this return { '@type': '/cosmwasm.wasm.v1.MsgPinCodes', authority, - code_ids: code_ids.map(id => id.toString()), - }; + code_ids: code_ids.map((id) => id.toString()), + } } public static fromProto(data: MsgPinCodes.Proto): MsgPinCodes { return new MsgPinCodes( data.authority, - data.codeIds.map(id => id.toNumber()) - ); + data.codeIds.map((id) => id.toNumber()) + ) } public toProto(): MsgPinCodes.Proto { - const { authority, code_ids } = this; + const { authority, code_ids } = this return MsgPinCodes_pb.fromPartial({ authority, - codeIds: code_ids.map(id => Long.fromNumber(id)), - }); + codeIds: code_ids.map((id) => Long.fromNumber(id)), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgPinCodes', value: MsgPinCodes_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgPinCodes { - return MsgPinCodes.fromProto(MsgPinCodes_pb.decode(msgAny.value)); + return MsgPinCodes.fromProto(MsgPinCodes_pb.decode(msgAny.value)) } } export namespace MsgPinCodes { export interface Amino { - type: 'wasm/MsgPinCodes'; + type: 'wasm/MsgPinCodes' value: { - authority: AccAddress; - code_ids: string[]; - }; + authority: AccAddress + code_ids: string[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgPinCodes'; - authority: AccAddress; - code_ids: string[]; + '@type': '/cosmwasm.wasm.v1.MsgPinCodes' + authority: AccAddress + code_ids: string[] } - export type Proto = MsgPinCodes_pb; + export type Proto = MsgPinCodes_pb } diff --git a/src/core/wasm/msgs/MsgRemoveCodeUploadParamsAddresses.ts b/src/core/wasm/msgs/MsgRemoveCodeUploadParamsAddresses.ts index 7142d85..c484cfa 100644 --- a/src/core/wasm/msgs/MsgRemoveCodeUploadParamsAddresses.ts +++ b/src/core/wasm/msgs/MsgRemoveCodeUploadParamsAddresses.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgRemoveCodeUploadParamsAddresses as MsgRemoveCodeUploadParamsAddresses_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgRemoveCodeUploadParamsAddresses as MsgRemoveCodeUploadParamsAddresses_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgRemoveCodeUploadParamsAddresses extends JSONSerializable< MsgRemoveCodeUploadParamsAddresses.Amino, @@ -12,8 +12,11 @@ export class MsgRemoveCodeUploadParamsAddresses extends JSONSerializable< * @param authority the address of the governance account * @param addresses */ - constructor(public authority: AccAddress, public addresses: AccAddress[]) { - super(); + constructor( + public authority: AccAddress, + public addresses: AccAddress[] + ) { + super() } public static fromAmino( @@ -21,35 +24,35 @@ export class MsgRemoveCodeUploadParamsAddresses extends JSONSerializable< ): MsgRemoveCodeUploadParamsAddresses { const { value: { authority, addresses }, - } = data; - return new MsgRemoveCodeUploadParamsAddresses(authority, addresses); + } = data + return new MsgRemoveCodeUploadParamsAddresses(authority, addresses) } public toAmino(): MsgRemoveCodeUploadParamsAddresses.Amino { - const { authority, addresses } = this; + const { authority, addresses } = this return { type: 'wasm/MsgRemoveCodeUploadParamsAddresses', value: { authority, addresses, }, - }; + } } public static fromData( data: MsgRemoveCodeUploadParamsAddresses.Data ): MsgRemoveCodeUploadParamsAddresses { - const { authority, addresses } = data; - return new MsgRemoveCodeUploadParamsAddresses(authority, addresses); + const { authority, addresses } = data + return new MsgRemoveCodeUploadParamsAddresses(authority, addresses) } public toData(): MsgRemoveCodeUploadParamsAddresses.Data { - const { authority, addresses } = this; + const { authority, addresses } = this return { '@type': '/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses', authority, addresses, - }; + } } public static fromProto( @@ -58,15 +61,15 @@ export class MsgRemoveCodeUploadParamsAddresses extends JSONSerializable< return new MsgRemoveCodeUploadParamsAddresses( data.authority, data.addresses - ); + ) } public toProto(): MsgRemoveCodeUploadParamsAddresses.Proto { - const { authority, addresses } = this; + const { authority, addresses } = this return MsgRemoveCodeUploadParamsAddresses_pb.fromPartial({ authority, addresses, - }); + }) } public packAny(): Any { @@ -75,30 +78,30 @@ export class MsgRemoveCodeUploadParamsAddresses extends JSONSerializable< value: MsgRemoveCodeUploadParamsAddresses_pb.encode( this.toProto() ).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgRemoveCodeUploadParamsAddresses { return MsgRemoveCodeUploadParamsAddresses.fromProto( MsgRemoveCodeUploadParamsAddresses_pb.decode(msgAny.value) - ); + ) } } export namespace MsgRemoveCodeUploadParamsAddresses { export interface Amino { - type: 'wasm/MsgRemoveCodeUploadParamsAddresses'; + type: 'wasm/MsgRemoveCodeUploadParamsAddresses' value: { - authority: AccAddress; - addresses: AccAddress[]; - }; + authority: AccAddress + addresses: AccAddress[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses'; - authority: AccAddress; - addresses: AccAddress[]; + '@type': '/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses' + authority: AccAddress + addresses: AccAddress[] } - export type Proto = MsgRemoveCodeUploadParamsAddresses_pb; + export type Proto = MsgRemoveCodeUploadParamsAddresses_pb } diff --git a/src/core/wasm/msgs/MsgStoreAndInstantiateContract.ts b/src/core/wasm/msgs/MsgStoreAndInstantiateContract.ts index af7bedf..f8913dc 100644 --- a/src/core/wasm/msgs/MsgStoreAndInstantiateContract.ts +++ b/src/core/wasm/msgs/MsgStoreAndInstantiateContract.ts @@ -1,16 +1,16 @@ -import { JSONSerializable } from '../../../util/json'; -import { Coins } from '../../Coins'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgStoreAndInstantiateContract as MsgStoreAndInstantiateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import { AccessConfig } from '../AccessConfig'; +import { JSONSerializable } from '../../../util/json' +import { Coins } from '../../Coins' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgStoreAndInstantiateContract as MsgStoreAndInstantiateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import { AccessConfig } from '../AccessConfig' export class MsgStoreAndInstantiateContract extends JSONSerializable< MsgStoreAndInstantiateContract.Amino, MsgStoreAndInstantiateContract.Data, MsgStoreAndInstantiateContract.Proto > { - public funds: Coins; + public funds: Coins /** * @param authority the address of the governance account * @param wasm_byte_code can be raw or gzip compressed @@ -37,8 +37,8 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< public builder: string, public code_hash: string ) { - super(); - this.funds = new Coins(funds); + super() + this.funds = new Coins(funds) } public static fromAmino( @@ -58,7 +58,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< builder, code_hash, }, - } = data; + } = data return new MsgStoreAndInstantiateContract( authority, @@ -74,7 +74,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash - ); + ) } public toAmino(): MsgStoreAndInstantiateContract.Amino { @@ -90,7 +90,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash, - } = this; + } = this return { type: 'wasm/MsgStoreAndInstantiateContract', @@ -107,7 +107,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< builder, code_hash, }, - }; + } } public static fromData( @@ -125,7 +125,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash, - } = data; + } = data return new MsgStoreAndInstantiateContract( authority, @@ -141,7 +141,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash - ); + ) } public toData(): MsgStoreAndInstantiateContract.Data { @@ -157,7 +157,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash, - } = this; + } = this return { '@type': '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract', @@ -172,7 +172,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash, - }; + } } public static fromProto( @@ -192,7 +192,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< data.source, data.builder, Buffer.from(data.codeHash).toString('base64') - ); + ) } public toProto(): MsgStoreAndInstantiateContract.Proto { @@ -208,7 +208,7 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, code_hash, - } = this; + } = this return MsgStoreAndInstantiateContract_pb.fromPartial({ authority, @@ -222,55 +222,55 @@ export class MsgStoreAndInstantiateContract extends JSONSerializable< source, builder, codeHash: Buffer.from(code_hash, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract', value: MsgStoreAndInstantiateContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgStoreAndInstantiateContract { return MsgStoreAndInstantiateContract.fromProto( MsgStoreAndInstantiateContract_pb.decode(msgAny.value) - ); + ) } } export namespace MsgStoreAndInstantiateContract { export interface Amino { - type: 'wasm/MsgStoreAndInstantiateContract'; + type: 'wasm/MsgStoreAndInstantiateContract' value: { - authority: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Amino; - unpin_code?: boolean; - admin?: AccAddress; - label?: string; - msg: string; - funds: Coins.Amino; - source: string; - builder: string; - code_hash: string; - }; + authority: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Amino + unpin_code?: boolean + admin?: AccAddress + label?: string + msg: string + funds: Coins.Amino + source: string + builder: string + code_hash: string + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract'; - authority: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Data; - unpin_code?: boolean; - admin?: AccAddress; - label?: string; - msg: string; - funds: Coins.Amino; - source: string; - builder: string; - code_hash: string; + '@type': '/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract' + authority: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Data + unpin_code?: boolean + admin?: AccAddress + label?: string + msg: string + funds: Coins.Amino + source: string + builder: string + code_hash: string } - export type Proto = MsgStoreAndInstantiateContract_pb; + export type Proto = MsgStoreAndInstantiateContract_pb } diff --git a/src/core/wasm/msgs/MsgStoreAndMigrateContract.ts b/src/core/wasm/msgs/MsgStoreAndMigrateContract.ts index d4b82f2..6cf7d12 100644 --- a/src/core/wasm/msgs/MsgStoreAndMigrateContract.ts +++ b/src/core/wasm/msgs/MsgStoreAndMigrateContract.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgStoreAndMigrateContract as MsgStoreAndMigrateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import { AccessConfig } from '../AccessConfig'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgStoreAndMigrateContract as MsgStoreAndMigrateContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import { AccessConfig } from '../AccessConfig' export class MsgStoreAndMigrateContract extends JSONSerializable< MsgStoreAndMigrateContract.Amino, @@ -23,7 +23,7 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< public contract: AccAddress, public msg: string ) { - super(); + super() } public static fromAmino( @@ -37,7 +37,7 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< contract, msg, }, - } = data; + } = data return new MsgStoreAndMigrateContract( authority, @@ -47,12 +47,12 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< : undefined, contract, msg - ); + ) } public toAmino(): MsgStoreAndMigrateContract.Amino { const { authority, wasm_byte_code, instantiate_permission, contract, msg } = - this; + this return { type: 'wasm/MsgStoreAndMigrateContract', @@ -63,14 +63,14 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< contract, msg, }, - }; + } } public static fromData( data: MsgStoreAndMigrateContract.Data ): MsgStoreAndMigrateContract { const { authority, wasm_byte_code, instantiate_permission, contract, msg } = - data; + data return new MsgStoreAndMigrateContract( authority, @@ -80,12 +80,12 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< : undefined, contract, msg - ); + ) } public toData(): MsgStoreAndMigrateContract.Data { const { authority, wasm_byte_code, instantiate_permission, contract, msg } = - this; + this return { '@type': '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract', @@ -94,7 +94,7 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< instantiate_permission: instantiate_permission?.toData(), contract, msg, - }; + } } public static fromProto( @@ -108,12 +108,12 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< : undefined, data.contract, Buffer.from(data.msg).toString('base64') - ); + ) } public toProto(): MsgStoreAndMigrateContract.Proto { const { authority, wasm_byte_code, instantiate_permission, contract, msg } = - this; + this return MsgStoreAndMigrateContract_pb.fromPartial({ authority, @@ -121,43 +121,43 @@ export class MsgStoreAndMigrateContract extends JSONSerializable< instantiatePermission: instantiate_permission?.toProto(), contract, msg: Buffer.from(msg, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract', value: MsgStoreAndMigrateContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgStoreAndMigrateContract { return MsgStoreAndMigrateContract.fromProto( MsgStoreAndMigrateContract_pb.decode(msgAny.value) - ); + ) } } export namespace MsgStoreAndMigrateContract { export interface Amino { - type: 'wasm/MsgStoreAndMigrateContract'; + type: 'wasm/MsgStoreAndMigrateContract' value: { - authority: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Amino; - contract: AccAddress; - msg: string; - }; + authority: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Amino + contract: AccAddress + msg: string + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract'; - authority: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Data; - contract: AccAddress; - msg: string; + '@type': '/cosmwasm.wasm.v1.MsgStoreAndMigrateContract' + authority: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Data + contract: AccAddress + msg: string } - export type Proto = MsgStoreAndMigrateContract_pb; + export type Proto = MsgStoreAndMigrateContract_pb } diff --git a/src/core/wasm/msgs/MsgStoreCode.ts b/src/core/wasm/msgs/MsgStoreCode.ts index e7d1c3c..5532a57 100644 --- a/src/core/wasm/msgs/MsgStoreCode.ts +++ b/src/core/wasm/msgs/MsgStoreCode.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgStoreCode as MsgStoreCode_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import { AccessConfig } from '../AccessConfig'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgStoreCode as MsgStoreCode_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import { AccessConfig } from '../AccessConfig' export class MsgStoreCode extends JSONSerializable< MsgStoreCode.Amino, @@ -19,24 +19,24 @@ export class MsgStoreCode extends JSONSerializable< public wasm_byte_code: string, public instantiate_permission?: AccessConfig ) { - super(); + super() } public static fromAmino(data: MsgStoreCode.Amino): MsgStoreCode { const { value: { sender, wasm_byte_code, instantiate_permission }, - } = data; + } = data return new MsgStoreCode( sender, wasm_byte_code, instantiate_permission ? AccessConfig.fromAmino(instantiate_permission) : undefined - ); + ) } public toAmino(): MsgStoreCode.Amino { - const { sender, wasm_byte_code, instantiate_permission } = this; + const { sender, wasm_byte_code, instantiate_permission } = this return { type: 'wasm/MsgStoreCode', value: { @@ -44,28 +44,28 @@ export class MsgStoreCode extends JSONSerializable< wasm_byte_code, instantiate_permission: instantiate_permission?.toAmino(), }, - }; + } } public static fromData(data: MsgStoreCode.Data): MsgStoreCode { - const { sender, wasm_byte_code, instantiate_permission } = data; + const { sender, wasm_byte_code, instantiate_permission } = data return new MsgStoreCode( sender, wasm_byte_code, instantiate_permission ? AccessConfig.fromData(instantiate_permission) : undefined - ); + ) } public toData(): MsgStoreCode.Data { - const { sender, wasm_byte_code, instantiate_permission } = this; + const { sender, wasm_byte_code, instantiate_permission } = this return { '@type': '/cosmwasm.wasm.v1.MsgStoreCode', sender, wasm_byte_code, instantiate_permission: instantiate_permission?.toData(), - }; + } } public static fromProto(data: MsgStoreCode.Proto): MsgStoreCode { @@ -75,46 +75,46 @@ export class MsgStoreCode extends JSONSerializable< data.instantiatePermission ? AccessConfig.fromProto(data.instantiatePermission) : undefined - ); + ) } public toProto(): MsgStoreCode.Proto { - const { sender, wasm_byte_code, instantiate_permission } = this; + const { sender, wasm_byte_code, instantiate_permission } = this return MsgStoreCode_pb.fromPartial({ sender, wasmByteCode: Buffer.from(wasm_byte_code, 'base64'), instantiatePermission: instantiate_permission?.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgStoreCode', value: MsgStoreCode_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgStoreCode { - return MsgStoreCode.fromProto(MsgStoreCode_pb.decode(msgAny.value)); + return MsgStoreCode.fromProto(MsgStoreCode_pb.decode(msgAny.value)) } } export namespace MsgStoreCode { export interface Amino { - type: 'wasm/MsgStoreCode'; + type: 'wasm/MsgStoreCode' value: { - sender: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Amino; - }; + sender: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgStoreCode'; - sender: AccAddress; - wasm_byte_code: string; - instantiate_permission?: AccessConfig.Data; + '@type': '/cosmwasm.wasm.v1.MsgStoreCode' + sender: AccAddress + wasm_byte_code: string + instantiate_permission?: AccessConfig.Data } - export type Proto = MsgStoreCode_pb; + export type Proto = MsgStoreCode_pb } diff --git a/src/core/wasm/msgs/MsgSudoContract.ts b/src/core/wasm/msgs/MsgSudoContract.ts index 6abcbb8..8320d54 100644 --- a/src/core/wasm/msgs/MsgSudoContract.ts +++ b/src/core/wasm/msgs/MsgSudoContract.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgSudoContract as MsgSudoContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgSudoContract as MsgSudoContract_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgSudoContract extends JSONSerializable< MsgSudoContract.Amino, @@ -18,18 +18,18 @@ export class MsgSudoContract extends JSONSerializable< public contract: AccAddress, public msg: string ) { - super(); + super() } public static fromAmino(data: MsgSudoContract.Amino): MsgSudoContract { const { value: { authority, contract, msg }, - } = data; - return new MsgSudoContract(authority, contract, msg); + } = data + return new MsgSudoContract(authority, contract, msg) } public toAmino(): MsgSudoContract.Amino { - const { authority, contract, msg } = this; + const { authority, contract, msg } = this return { type: 'wasm/MsgSudoContract', value: { @@ -37,22 +37,22 @@ export class MsgSudoContract extends JSONSerializable< contract, msg, }, - }; + } } public static fromData(data: MsgSudoContract.Data): MsgSudoContract { - const { authority, contract, msg } = data; - return new MsgSudoContract(authority, contract, msg); + const { authority, contract, msg } = data + return new MsgSudoContract(authority, contract, msg) } public toData(): MsgSudoContract.Data { - const { authority, contract, msg } = this; + const { authority, contract, msg } = this return { '@type': '/cosmwasm.wasm.v1.MsgSudoContract', authority, contract, msg, - }; + } } public static fromProto(data: MsgSudoContract.Proto): MsgSudoContract { @@ -60,46 +60,46 @@ export class MsgSudoContract extends JSONSerializable< data.authority, data.contract, Buffer.from(data.msg).toString('base64') - ); + ) } public toProto(): MsgSudoContract.Proto { - const { authority, contract, msg } = this; + const { authority, contract, msg } = this return MsgSudoContract_pb.fromPartial({ authority, contract, msg: Buffer.from(msg, 'base64'), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgSudoContract', value: MsgSudoContract_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgSudoContract { - return MsgSudoContract.fromProto(MsgSudoContract_pb.decode(msgAny.value)); + return MsgSudoContract.fromProto(MsgSudoContract_pb.decode(msgAny.value)) } } export namespace MsgSudoContract { export interface Amino { - type: 'wasm/MsgSudoContract'; + type: 'wasm/MsgSudoContract' value: { - authority: AccAddress; - contract: AccAddress; - msg: string; - }; + authority: AccAddress + contract: AccAddress + msg: string + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgSudoContract'; - authority: AccAddress; - contract: AccAddress; - msg: string; + '@type': '/cosmwasm.wasm.v1.MsgSudoContract' + authority: AccAddress + contract: AccAddress + msg: string } - export type Proto = MsgSudoContract_pb; + export type Proto = MsgSudoContract_pb } diff --git a/src/core/wasm/msgs/MsgUnpinCodes.ts b/src/core/wasm/msgs/MsgUnpinCodes.ts index 8c5e432..25a6699 100644 --- a/src/core/wasm/msgs/MsgUnpinCodes.ts +++ b/src/core/wasm/msgs/MsgUnpinCodes.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUnpinCodes as MsgUnpinCodes_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUnpinCodes as MsgUnpinCodes_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import Long from 'long' export class MsgUnpinCodes extends JSONSerializable< MsgUnpinCodes.Amino, @@ -13,83 +13,86 @@ export class MsgUnpinCodes extends JSONSerializable< * @param authority the address of the governance account * @param code_ids references the WASM codes */ - constructor(public authority: AccAddress, public code_ids: number[]) { - super(); + constructor( + public authority: AccAddress, + public code_ids: number[] + ) { + super() } public static fromAmino(data: MsgUnpinCodes.Amino): MsgUnpinCodes { const { value: { authority, code_ids }, - } = data; - return new MsgUnpinCodes(authority, code_ids.map(Number.parseInt)); + } = data + return new MsgUnpinCodes(authority, code_ids.map(Number.parseInt)) } public toAmino(): MsgUnpinCodes.Amino { - const { authority, code_ids } = this; + const { authority, code_ids } = this return { type: 'wasm/MsgUnpinCodes', value: { authority, - code_ids: code_ids.map(id => id.toString()), + code_ids: code_ids.map((id) => id.toString()), }, - }; + } } public static fromData(data: MsgUnpinCodes.Data): MsgUnpinCodes { - const { authority, code_ids } = data; - return new MsgUnpinCodes(authority, code_ids.map(Number.parseInt)); + const { authority, code_ids } = data + return new MsgUnpinCodes(authority, code_ids.map(Number.parseInt)) } public toData(): MsgUnpinCodes.Data { - const { authority, code_ids } = this; + const { authority, code_ids } = this return { '@type': '/cosmwasm.wasm.v1.MsgUnpinCodes', authority, - code_ids: code_ids.map(id => id.toString()), - }; + code_ids: code_ids.map((id) => id.toString()), + } } public static fromProto(data: MsgUnpinCodes.Proto): MsgUnpinCodes { return new MsgUnpinCodes( data.authority, - data.codeIds.map(id => id.toNumber()) - ); + data.codeIds.map((id) => id.toNumber()) + ) } public toProto(): MsgUnpinCodes.Proto { - const { authority, code_ids } = this; + const { authority, code_ids } = this return MsgUnpinCodes_pb.fromPartial({ authority, - codeIds: code_ids.map(id => Long.fromNumber(id)), - }); + codeIds: code_ids.map((id) => Long.fromNumber(id)), + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgUnpinCodes', value: MsgUnpinCodes_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUnpinCodes { - return MsgUnpinCodes.fromProto(MsgUnpinCodes_pb.decode(msgAny.value)); + return MsgUnpinCodes.fromProto(MsgUnpinCodes_pb.decode(msgAny.value)) } } export namespace MsgUnpinCodes { export interface Amino { - type: 'wasm/MsgUnpinCodes'; + type: 'wasm/MsgUnpinCodes' value: { - authority: AccAddress; - code_ids: string[]; - }; + authority: AccAddress + code_ids: string[] + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgUnpinCodes'; - authority: AccAddress; - code_ids: string[]; + '@type': '/cosmwasm.wasm.v1.MsgUnpinCodes' + authority: AccAddress + code_ids: string[] } - export type Proto = MsgUnpinCodes_pb; + export type Proto = MsgUnpinCodes_pb } diff --git a/src/core/wasm/msgs/MsgUpdateAdmin.ts b/src/core/wasm/msgs/MsgUpdateAdmin.ts index b0065fa..5d041fd 100644 --- a/src/core/wasm/msgs/MsgUpdateAdmin.ts +++ b/src/core/wasm/msgs/MsgUpdateAdmin.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateAdmin as MsgUpdateAdmin_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateAdmin as MsgUpdateAdmin_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgUpdateAdmin extends JSONSerializable< MsgUpdateAdmin.Amino, @@ -18,19 +18,19 @@ export class MsgUpdateAdmin extends JSONSerializable< public new_admin: AccAddress, public contract: AccAddress ) { - super(); + super() } public static fromAmino(data: MsgUpdateAdmin.Amino): MsgUpdateAdmin { const { value: { sender, new_admin, contract }, - } = data; + } = data - return new MsgUpdateAdmin(sender, new_admin, contract); + return new MsgUpdateAdmin(sender, new_admin, contract) } public toAmino(): MsgUpdateAdmin.Amino { - const { sender, new_admin, contract } = this; + const { sender, new_admin, contract } = this return { type: 'wasm/MsgUpdateAdmin', value: { @@ -38,65 +38,65 @@ export class MsgUpdateAdmin extends JSONSerializable< new_admin, contract, }, - }; + } } public static fromData(data: MsgUpdateAdmin.Data): MsgUpdateAdmin { - const { sender, new_admin, contract } = data; - return new MsgUpdateAdmin(sender, new_admin, contract); + const { sender, new_admin, contract } = data + return new MsgUpdateAdmin(sender, new_admin, contract) } public toData(): MsgUpdateAdmin.Data { - const { sender, new_admin, contract } = this; + const { sender, new_admin, contract } = this return { '@type': '/cosmwasm.wasm.v1.MsgUpdateAdmin', sender, new_admin, contract, - }; + } } public static fromProto(data: MsgUpdateAdmin.Proto): MsgUpdateAdmin { - return new MsgUpdateAdmin(data.sender, data.newAdmin, data.contract); + return new MsgUpdateAdmin(data.sender, data.newAdmin, data.contract) } public toProto(): MsgUpdateAdmin.Proto { - const { sender, new_admin, contract } = this; + const { sender, new_admin, contract } = this return MsgUpdateAdmin_pb.fromPartial({ sender, newAdmin: new_admin, contract, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgUpdateAdmin', value: MsgUpdateAdmin_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateAdmin { - return MsgUpdateAdmin.fromProto(MsgUpdateAdmin_pb.decode(msgAny.value)); + return MsgUpdateAdmin.fromProto(MsgUpdateAdmin_pb.decode(msgAny.value)) } } export namespace MsgUpdateAdmin { export interface Amino { - type: 'wasm/MsgUpdateAdmin'; + type: 'wasm/MsgUpdateAdmin' value: { - sender: AccAddress; - new_admin: AccAddress; - contract: AccAddress; - }; + sender: AccAddress + new_admin: AccAddress + contract: AccAddress + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgUpdateAdmin'; - sender: AccAddress; - new_admin: AccAddress; - contract: AccAddress; + '@type': '/cosmwasm.wasm.v1.MsgUpdateAdmin' + sender: AccAddress + new_admin: AccAddress + contract: AccAddress } - export type Proto = MsgUpdateAdmin_pb; + export type Proto = MsgUpdateAdmin_pb } diff --git a/src/core/wasm/msgs/MsgUpdateContractLabel.ts b/src/core/wasm/msgs/MsgUpdateContractLabel.ts index 6d4a455..f6dc10d 100644 --- a/src/core/wasm/msgs/MsgUpdateContractLabel.ts +++ b/src/core/wasm/msgs/MsgUpdateContractLabel.ts @@ -1,7 +1,7 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateContractLabel as MsgUpdateContractLabel_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateContractLabel as MsgUpdateContractLabel_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgUpdateContractLabel extends JSONSerializable< MsgUpdateContractLabel.Amino, @@ -18,7 +18,7 @@ export class MsgUpdateContractLabel extends JSONSerializable< public new_label: string, public contract: AccAddress ) { - super(); + super() } public static fromAmino( @@ -26,13 +26,13 @@ export class MsgUpdateContractLabel extends JSONSerializable< ): MsgUpdateContractLabel { const { value: { sender, new_label, contract }, - } = data; + } = data - return new MsgUpdateContractLabel(sender, new_label, contract); + return new MsgUpdateContractLabel(sender, new_label, contract) } public toAmino(): MsgUpdateContractLabel.Amino { - const { sender, new_label, contract } = this; + const { sender, new_label, contract } = this return { type: 'wasm/MsgUpdateContractLabel', value: { @@ -40,75 +40,71 @@ export class MsgUpdateContractLabel extends JSONSerializable< new_label, contract, }, - }; + } } public static fromData( data: MsgUpdateContractLabel.Data ): MsgUpdateContractLabel { - const { sender, new_label, contract } = data; - return new MsgUpdateContractLabel(sender, new_label, contract); + const { sender, new_label, contract } = data + return new MsgUpdateContractLabel(sender, new_label, contract) } public toData(): MsgUpdateContractLabel.Data { - const { sender, new_label, contract } = this; + const { sender, new_label, contract } = this return { '@type': '/cosmwasm.wasm.v1.MsgUpdateContractLabel', sender, new_label, contract, - }; + } } public static fromProto( data: MsgUpdateContractLabel.Proto ): MsgUpdateContractLabel { - return new MsgUpdateContractLabel( - data.sender, - data.newLabel, - data.contract - ); + return new MsgUpdateContractLabel(data.sender, data.newLabel, data.contract) } public toProto(): MsgUpdateContractLabel.Proto { - const { sender, new_label, contract } = this; + const { sender, new_label, contract } = this return MsgUpdateContractLabel_pb.fromPartial({ sender, newLabel: new_label, contract, - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgUpdateContractLabel', value: MsgUpdateContractLabel_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateContractLabel { return MsgUpdateContractLabel.fromProto( MsgUpdateContractLabel_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateContractLabel { export interface Amino { - type: 'wasm/MsgUpdateContractLabel'; + type: 'wasm/MsgUpdateContractLabel' value: { - sender: AccAddress; - new_label: string; - contract: AccAddress; - }; + sender: AccAddress + new_label: string + contract: AccAddress + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgUpdateContractLabel'; - sender: AccAddress; - new_label: string; - contract: AccAddress; + '@type': '/cosmwasm.wasm.v1.MsgUpdateContractLabel' + sender: AccAddress + new_label: string + contract: AccAddress } - export type Proto = MsgUpdateContractLabel_pb; + export type Proto = MsgUpdateContractLabel_pb } diff --git a/src/core/wasm/msgs/MsgUpdateInstantiateConfig.ts b/src/core/wasm/msgs/MsgUpdateInstantiateConfig.ts index a7854eb..2017829 100644 --- a/src/core/wasm/msgs/MsgUpdateInstantiateConfig.ts +++ b/src/core/wasm/msgs/MsgUpdateInstantiateConfig.ts @@ -1,9 +1,9 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateInstantiateConfig as MsgUpdateInstantiateConfig_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; -import { AccessConfig } from '../AccessConfig'; -import Long from 'long'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateInstantiateConfig as MsgUpdateInstantiateConfig_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' +import { AccessConfig } from '../AccessConfig' +import Long from 'long' export class MsgUpdateInstantiateConfig extends JSONSerializable< MsgUpdateInstantiateConfig.Amino, @@ -20,7 +20,7 @@ export class MsgUpdateInstantiateConfig extends JSONSerializable< public code_id: number, public new_instantiate_permission: AccessConfig ) { - super(); + super() } public static fromAmino( @@ -28,16 +28,16 @@ export class MsgUpdateInstantiateConfig extends JSONSerializable< ): MsgUpdateInstantiateConfig { const { value: { sender, code_id, new_instantiate_permission }, - } = data; + } = data return new MsgUpdateInstantiateConfig( sender, Number.parseInt(code_id), AccessConfig.fromAmino(new_instantiate_permission) - ); + ) } public toAmino(): MsgUpdateInstantiateConfig.Amino { - const { sender, code_id, new_instantiate_permission } = this; + const { sender, code_id, new_instantiate_permission } = this return { type: 'wasm/MsgUpdateInstantiateConfig', value: { @@ -45,28 +45,28 @@ export class MsgUpdateInstantiateConfig extends JSONSerializable< code_id: code_id.toString(), new_instantiate_permission: new_instantiate_permission.toAmino(), }, - }; + } } public static fromData( data: MsgUpdateInstantiateConfig.Data ): MsgUpdateInstantiateConfig { - const { sender, code_id, new_instantiate_permission } = data; + const { sender, code_id, new_instantiate_permission } = data return new MsgUpdateInstantiateConfig( sender, Number.parseInt(code_id), AccessConfig.fromData(new_instantiate_permission) - ); + ) } public toData(): MsgUpdateInstantiateConfig.Data { - const { sender, code_id, new_instantiate_permission } = this; + const { sender, code_id, new_instantiate_permission } = this return { '@type': '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig', sender, code_id: code_id.toString(), new_instantiate_permission: new_instantiate_permission.toData(), - }; + } } public static fromProto( @@ -78,48 +78,48 @@ export class MsgUpdateInstantiateConfig extends JSONSerializable< AccessConfig.fromProto( data.newInstantiatePermission as AccessConfig.Proto ) - ); + ) } public toProto(): MsgUpdateInstantiateConfig.Proto { - const { sender, code_id, new_instantiate_permission } = this; + const { sender, code_id, new_instantiate_permission } = this return MsgUpdateInstantiateConfig_pb.fromPartial({ sender, codeId: Long.fromNumber(code_id), newInstantiatePermission: new_instantiate_permission.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig', value: MsgUpdateInstantiateConfig_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateInstantiateConfig { return MsgUpdateInstantiateConfig.fromProto( MsgUpdateInstantiateConfig_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateInstantiateConfig { export interface Amino { - type: 'wasm/MsgUpdateInstantiateConfig'; + type: 'wasm/MsgUpdateInstantiateConfig' value: { - sender: AccAddress; - code_id: string; - new_instantiate_permission: AccessConfig.Amino; - }; + sender: AccAddress + code_id: string + new_instantiate_permission: AccessConfig.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig'; - sender: AccAddress; - code_id: string; - new_instantiate_permission: AccessConfig.Data; + '@type': '/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig' + sender: AccAddress + code_id: string + new_instantiate_permission: AccessConfig.Data } - export type Proto = MsgUpdateInstantiateConfig_pb; + export type Proto = MsgUpdateInstantiateConfig_pb } diff --git a/src/core/wasm/msgs/MsgUpdateWasmParams.ts b/src/core/wasm/msgs/MsgUpdateWasmParams.ts index 9ef4088..9cd0d38 100644 --- a/src/core/wasm/msgs/MsgUpdateWasmParams.ts +++ b/src/core/wasm/msgs/MsgUpdateWasmParams.ts @@ -1,8 +1,8 @@ -import { JSONSerializable } from '../../../util/json'; -import { AccAddress } from '../../bech32'; -import { WasmParams } from '../WasmParams'; -import { Any } from '@initia/initia.proto/google/protobuf/any'; -import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx'; +import { JSONSerializable } from '../../../util/json' +import { AccAddress } from '../../bech32' +import { WasmParams } from '../WasmParams' +import { Any } from '@initia/initia.proto/google/protobuf/any' +import { MsgUpdateParams as MsgUpdateParams_pb } from '@initia/initia.proto/cosmwasm/wasm/v1/tx' export class MsgUpdateWasmParams extends JSONSerializable< MsgUpdateWasmParams.Amino, @@ -13,8 +13,11 @@ export class MsgUpdateWasmParams extends JSONSerializable< * @param authority the address that controls the module * @param params params defines the x/move parameters to update */ - constructor(public authority: AccAddress, public params: WasmParams) { - super(); + constructor( + public authority: AccAddress, + public params: WasmParams + ) { + super() } public static fromAmino( @@ -22,33 +25,33 @@ export class MsgUpdateWasmParams extends JSONSerializable< ): MsgUpdateWasmParams { const { value: { authority, params }, - } = data; - return new MsgUpdateWasmParams(authority, WasmParams.fromAmino(params)); + } = data + return new MsgUpdateWasmParams(authority, WasmParams.fromAmino(params)) } public toAmino(): MsgUpdateWasmParams.Amino { - const { authority, params } = this; + const { authority, params } = this return { type: 'wasm/MsgUpdateParams', value: { authority, params: params.toAmino(), }, - }; + } } public static fromData(data: MsgUpdateWasmParams.Data): MsgUpdateWasmParams { - const { authority, params } = data; - return new MsgUpdateWasmParams(authority, WasmParams.fromData(params)); + const { authority, params } = data + return new MsgUpdateWasmParams(authority, WasmParams.fromData(params)) } public toData(): MsgUpdateWasmParams.Data { - const { authority, params } = this; + const { authority, params } = this return { '@type': '/cosmwasm.wasm.v1.MsgUpdateParams', authority, params: params.toData(), - }; + } } public static fromProto( @@ -57,45 +60,45 @@ export class MsgUpdateWasmParams extends JSONSerializable< return new MsgUpdateWasmParams( data.authority, WasmParams.fromProto(data.params as WasmParams.Proto) - ); + ) } public toProto(): MsgUpdateWasmParams.Proto { - const { authority, params } = this; + const { authority, params } = this return MsgUpdateParams_pb.fromPartial({ authority, params: params.toProto(), - }); + }) } public packAny(): Any { return Any.fromPartial({ typeUrl: '/cosmwasm.wasm.v1.MsgUpdateParams', value: MsgUpdateParams_pb.encode(this.toProto()).finish(), - }); + }) } public static unpackAny(msgAny: Any): MsgUpdateWasmParams { return MsgUpdateWasmParams.fromProto( MsgUpdateParams_pb.decode(msgAny.value) - ); + ) } } export namespace MsgUpdateWasmParams { export interface Amino { - type: 'wasm/MsgUpdateParams'; + type: 'wasm/MsgUpdateParams' value: { - authority: AccAddress; - params: WasmParams.Amino; - }; + authority: AccAddress + params: WasmParams.Amino + } } export interface Data { - '@type': '/cosmwasm.wasm.v1.MsgUpdateParams'; - authority: AccAddress; - params: WasmParams.Data; + '@type': '/cosmwasm.wasm.v1.MsgUpdateParams' + authority: AccAddress + params: WasmParams.Data } - export type Proto = MsgUpdateParams_pb; + export type Proto = MsgUpdateParams_pb } diff --git a/src/core/wasm/msgs/index.ts b/src/core/wasm/msgs/index.ts index 5849dc2..bd4e09d 100644 --- a/src/core/wasm/msgs/index.ts +++ b/src/core/wasm/msgs/index.ts @@ -1,38 +1,38 @@ -import { MsgStoreCode } from './MsgStoreCode'; -import { MsgInstantiateContract } from './MsgInstantiateContract'; -import { MsgInstantiateContractV2 } from './MsgInstantiateContractV2'; -import { MsgExecuteContract } from './MsgExecuteContract'; -import { MsgMigrateContract } from './MsgMigrateContract'; -import { MsgUpdateAdmin } from './MsgUpdateAdmin'; -import { MsgClearAdmin } from './MsgClearAdmin'; -import { MsgUpdateInstantiateConfig } from './MsgUpdateInstantiateConfig'; -import { MsgUpdateWasmParams } from './MsgUpdateWasmParams'; -import { MsgSudoContract } from './MsgSudoContract'; -import { MsgPinCodes } from './MsgPinCodes'; -import { MsgUnpinCodes } from './MsgUnpinCodes'; -import { MsgStoreAndInstantiateContract } from './MsgStoreAndInstantiateContract'; -import { MsgStoreAndMigrateContract } from './MsgStoreAndMigrateContract'; -import { MsgAddCodeUploadParamsAddresses } from './MsgAddCodeUploadParamsAddresses'; -import { MsgRemoveCodeUploadParamsAddresses } from './MsgRemoveCodeUploadParamsAddresses'; -import { MsgUpdateContractLabel } from './MsgUpdateContractLabel'; +import { MsgStoreCode } from './MsgStoreCode' +import { MsgInstantiateContract } from './MsgInstantiateContract' +import { MsgInstantiateContractV2 } from './MsgInstantiateContractV2' +import { MsgExecuteContract } from './MsgExecuteContract' +import { MsgMigrateContract } from './MsgMigrateContract' +import { MsgUpdateAdmin } from './MsgUpdateAdmin' +import { MsgClearAdmin } from './MsgClearAdmin' +import { MsgUpdateInstantiateConfig } from './MsgUpdateInstantiateConfig' +import { MsgUpdateWasmParams } from './MsgUpdateWasmParams' +import { MsgSudoContract } from './MsgSudoContract' +import { MsgPinCodes } from './MsgPinCodes' +import { MsgUnpinCodes } from './MsgUnpinCodes' +import { MsgStoreAndInstantiateContract } from './MsgStoreAndInstantiateContract' +import { MsgStoreAndMigrateContract } from './MsgStoreAndMigrateContract' +import { MsgAddCodeUploadParamsAddresses } from './MsgAddCodeUploadParamsAddresses' +import { MsgRemoveCodeUploadParamsAddresses } from './MsgRemoveCodeUploadParamsAddresses' +import { MsgUpdateContractLabel } from './MsgUpdateContractLabel' -export * from './MsgStoreCode'; -export * from './MsgInstantiateContract'; -export * from './MsgInstantiateContractV2'; -export * from './MsgExecuteContract'; -export * from './MsgMigrateContract'; -export * from './MsgUpdateAdmin'; -export * from './MsgClearAdmin'; -export * from './MsgUpdateInstantiateConfig'; -export * from './MsgUpdateWasmParams'; -export * from './MsgSudoContract'; -export * from './MsgPinCodes'; -export * from './MsgUnpinCodes'; -export * from './MsgStoreAndInstantiateContract'; -export * from './MsgStoreAndMigrateContract'; -export * from './MsgAddCodeUploadParamsAddresses'; -export * from './MsgRemoveCodeUploadParamsAddresses'; -export * from './MsgUpdateContractLabel'; +export * from './MsgStoreCode' +export * from './MsgInstantiateContract' +export * from './MsgInstantiateContractV2' +export * from './MsgExecuteContract' +export * from './MsgMigrateContract' +export * from './MsgUpdateAdmin' +export * from './MsgClearAdmin' +export * from './MsgUpdateInstantiateConfig' +export * from './MsgUpdateWasmParams' +export * from './MsgSudoContract' +export * from './MsgPinCodes' +export * from './MsgUnpinCodes' +export * from './MsgStoreAndInstantiateContract' +export * from './MsgStoreAndMigrateContract' +export * from './MsgAddCodeUploadParamsAddresses' +export * from './MsgRemoveCodeUploadParamsAddresses' +export * from './MsgUpdateContractLabel' export type WasmMsg = | MsgStoreCode @@ -51,7 +51,7 @@ export type WasmMsg = | MsgStoreAndMigrateContract | MsgAddCodeUploadParamsAddresses | MsgRemoveCodeUploadParamsAddresses - | MsgUpdateContractLabel; + | MsgUpdateContractLabel export namespace WasmMsg { export type Amino = @@ -71,7 +71,7 @@ export namespace WasmMsg { | MsgStoreAndMigrateContract.Amino | MsgAddCodeUploadParamsAddresses.Amino | MsgRemoveCodeUploadParamsAddresses.Amino - | MsgUpdateContractLabel.Amino; + | MsgUpdateContractLabel.Amino export type Data = | MsgStoreCode.Data | MsgInstantiateContract.Data @@ -89,7 +89,7 @@ export namespace WasmMsg { | MsgStoreAndMigrateContract.Data | MsgAddCodeUploadParamsAddresses.Data | MsgRemoveCodeUploadParamsAddresses.Data - | MsgUpdateContractLabel.Data; + | MsgUpdateContractLabel.Data export type Proto = | MsgStoreCode.Proto | MsgInstantiateContract.Proto @@ -107,5 +107,5 @@ export namespace WasmMsg { | MsgStoreAndMigrateContract.Proto | MsgAddCodeUploadParamsAddresses.Proto | MsgRemoveCodeUploadParamsAddresses.Proto - | MsgUpdateContractLabel.Proto; + | MsgUpdateContractLabel.Proto } diff --git a/src/index.ts b/src/index.ts index 972777d..78c2d0d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -export * from './client'; -export * from './core'; -export * from './key'; -export * from './util'; +export * from './client' +export * from './core' +export * from './key' +export * from './util' diff --git a/src/key/Key.ts b/src/key/Key.ts index 9518357..6442094 100644 --- a/src/key/Key.ts +++ b/src/key/Key.ts @@ -1,4 +1,4 @@ -import { bech32 } from 'bech32'; +import { bech32 } from 'bech32' import { AccAddress, ValAddress, @@ -9,8 +9,8 @@ import { AuthInfo, PublicKey, SignatureV2, -} from '../core'; -import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing'; +} from '../core' +import { SignMode } from '@initia/initia.proto/cosmos/tx/signing/v1beta1/signing' /** * Abstract key interface that provides transaction signing features and Bech32 address @@ -26,7 +26,7 @@ export abstract class Key { * * @param payload the data to be signed */ - public abstract sign(payload: Buffer): Promise; // needs to be async for ledger key signing + public abstract sign(payload: Buffer): Promise // needs to be async for ledger key signing /** * You will need to supply `signWithKeccak256`, which produces a signature for an arbitrary bytes payload @@ -34,17 +34,17 @@ export abstract class Key { * * @param payload the data to be signed */ - public abstract signWithKeccak256(payload: Buffer): Promise; // needs to be async for ledger key signing + public abstract signWithKeccak256(payload: Buffer): Promise // needs to be async for ledger key signing /** * Initia account address. `init-` prefixed. */ public get accAddress(): AccAddress { if (!this.publicKey) { - throw new Error('Could not compute accAddress: missing rawAddress'); + throw new Error('Could not compute accAddress: missing rawAddress') } - return this.publicKey.address(); + return this.publicKey.address() } /** @@ -52,13 +52,13 @@ export abstract class Key { */ public get valAddress(): ValAddress { if (!this.publicKey) { - throw new Error('Could not compute valAddress: missing rawAddress'); + throw new Error('Could not compute valAddress: missing rawAddress') } return bech32.encode( 'initvaloper', bech32.toWords(this.publicKey.rawAddress()) - ); + ) } /** @@ -79,7 +79,7 @@ export abstract class Key { if (!this.publicKey) { throw new Error( 'Signature could not be created: Key instance missing publicKey' - ); + ) } return new SignatureV2( @@ -91,7 +91,7 @@ export abstract class Key { ) ), tx.sequence - ); + ) } /** @@ -103,25 +103,25 @@ export abstract class Key { if (!this.publicKey) { throw new Error( 'Signature could not be created: Key instance missing publicKey' - ); + ) } // backup for restore - const signerInfos = signDoc.auth_info.signer_infos; + const signerInfos = signDoc.auth_info.signer_infos signDoc.auth_info.signer_infos = [ new SignerInfo( this.publicKey, signDoc.sequence, new ModeInfo(new ModeInfo.Single(SignMode.SIGN_MODE_DIRECT)) ), - ]; + ] const sigBytes = (await this.sign(Buffer.from(signDoc.toBytes()))).toString( 'base64' - ); + ) // restore signDoc to origin - signDoc.auth_info.signer_infos = signerInfos; + signDoc.auth_info.signer_infos = signerInfos return new SignatureV2( this.publicKey, @@ -129,7 +129,7 @@ export abstract class Key { new SignatureV2.Descriptor.Single(SignMode.SIGN_MODE_DIRECT, sigBytes) ), signDoc.sequence - ); + ) } /** @@ -142,16 +142,16 @@ export abstract class Key { if (!this.publicKey) { throw new Error( 'Signature could not be created: Key instance missing publicKey' - ); + ) } - const message = Buffer.from(tx.toAminoJSON()); - const EIP191MessagePrefix = '\x19Ethereum Signed Message:\n'; + const message = Buffer.from(tx.toAminoJSON()) + const EIP191MessagePrefix = '\x19Ethereum Signed Message:\n' const signBytes = Buffer.concat([ Buffer.from(EIP191MessagePrefix), Buffer.from(message.length.toString()), message, - ]); + ]) return new SignatureV2( this.publicKey, @@ -162,7 +162,7 @@ export abstract class Key { ) ), tx.sequence - ); + ) } /** @@ -170,28 +170,28 @@ export abstract class Key { * @param tx */ public async signTx(tx: Tx, options: SignOptions): Promise { - const copyTx = new Tx(tx.body, new AuthInfo([], tx.auth_info.fee), []); + const copyTx = new Tx(tx.body, new AuthInfo([], tx.auth_info.fee), []) const sign_doc = new SignDoc( options.chainId, options.accountNumber, options.sequence, copyTx.auth_info, copyTx.body - ); + ) - let signature: SignatureV2; + let signature: SignatureV2 if (options.signMode === SignMode.SIGN_MODE_LEGACY_AMINO_JSON) { - signature = await this.createSignatureAmino(sign_doc); + signature = await this.createSignatureAmino(sign_doc) } else if (options.signMode == SignMode.SIGN_MODE_DIRECT) { - signature = await this.createSignature(sign_doc); + signature = await this.createSignature(sign_doc) } else if (options.signMode == SignMode.SIGN_MODE_EIP_191) { - signature = await this.createSignatureEIP191(sign_doc); + signature = await this.createSignatureEIP191(sign_doc) } else { - throw new Error('not supported sign mode'); + throw new Error('not supported sign mode') } - const sigData = signature.data.single as SignatureV2.Descriptor.Single; - copyTx.signatures.push(...tx.signatures, sigData.signature); + const sigData = signature.data.single as SignatureV2.Descriptor.Single + copyTx.signatures.push(...tx.signatures, sigData.signature) copyTx.auth_info.signer_infos.push( ...tx.auth_info.signer_infos, new SignerInfo( @@ -199,15 +199,15 @@ export abstract class Key { signature.sequence, new ModeInfo(new ModeInfo.Single(sigData.mode)) ) - ); + ) - return copyTx; + return copyTx } } export interface SignOptions { - accountNumber: number; - sequence: number; - signMode: SignMode; - chainId: string; + accountNumber: number + sequence: number + signMode: SignMode + chainId: string } diff --git a/src/key/MnemonicKey.spec.ts b/src/key/MnemonicKey.spec.ts index f9dfe26..2c0f30d 100644 --- a/src/key/MnemonicKey.spec.ts +++ b/src/key/MnemonicKey.spec.ts @@ -1,4 +1,4 @@ -import { MnemonicKey } from './MnemonicKey'; +import { MnemonicKey } from './MnemonicKey' import { MsgSend, MsgMultiSend, @@ -8,7 +8,7 @@ import { TxBody, SignDoc, SimplePublicKey, -} from '../core'; +} from '../core' describe('MnemonicKey', () => { it('derives correct Key information', () => { @@ -34,82 +34,82 @@ describe('MnemonicKey', () => { 'AtBxnfDCovu59noUv6GOh7eXkumkzja6bbp8uPhm12Op' ), }, - ]; - examples.forEach(example => { - const { mnemonic } = example; - const mk = new MnemonicKey({ mnemonic }); - expect(mk).toMatchObject(example); - }); - }); + ] + examples.forEach((example) => { + const { mnemonic } = example + const mk = new MnemonicKey({ mnemonic }) + expect(mk).toMatchObject(example) + }) + }) it('generates random mnemonic', () => { - const mk = new MnemonicKey(); - const mk2 = new MnemonicKey(); - expect(mk.mnemonic).not.toEqual(mk2.mnemonic); - }); + const mk = new MnemonicKey() + const mk2 = new MnemonicKey() + expect(mk.mnemonic).not.toEqual(mk2.mnemonic) + }) it('signature', async () => { const mk = new MnemonicKey({ mnemonic: 'island relax shop such yellow opinion find know caught erode blue dolphin behind coach tattoo light focus snake common size analyst imitate employ walnut', - }); - const { accAddress } = mk; + }) + const { accAddress } = mk const msgSend = new MsgSend( accAddress, 'init1wlvk4e083pd3nddlfe5quy56e68atra3gu9xfs', new Coins({ uinit: '100000000' }) - ); + ) - const fee = new Fee(46467, new Coins({ uinit: '698' })); + const fee = new Fee(46467, new Coins({ uinit: '698' })) const signDoc = new SignDoc( 'testnet', 45, 0, new AuthInfo([], fee), new TxBody([msgSend]) - ); + ) const { data: { single }, - } = await mk.createSignatureAmino(signDoc); + } = await mk.createSignatureAmino(signDoc) expect((single as any).signature).toEqual( '1Ilhp30yhTh0ehXYA1cenO+Vmg5X+7/EPTs56jSTq71stuUS+UyqcCUV3Li6LLMMsWQz0of4UaggtNcB0ghsDg==' - ); - }); + ) + }) it('multisig', async () => { - const receiverAddr = 'init1ptdx6akgk7wwemlk5j73artt5t6j8am08ql3qv'; - const multisigAddr = 'init16ddrexknvk2e443jsnle4n6s2ewjc6z3mjcu6d'; - const multisigAccountNumber = 46; - const multisigSequenceNumber = 0; + const receiverAddr = 'init1ptdx6akgk7wwemlk5j73artt5t6j8am08ql3qv' + const multisigAddr = 'init16ddrexknvk2e443jsnle4n6s2ewjc6z3mjcu6d' + const multisigAccountNumber = 46 + const multisigSequenceNumber = 0 const a1Key = new MnemonicKey({ mnemonic: 'swamp increase solar renew twelve easily possible pig ostrich harvest more indicate lion denial kind target small dumb mercy under proud arrive gentle field', - }); + }) expect(a1Key.accAddress).toEqual( 'init1gknfqc7lr2djyf0ttzp6mmdvq3wp5gf0rd2h6s' - ); + ) const a2Key = new MnemonicKey({ mnemonic: 'service frozen keen unveil luggage initial surge name conduct mesh soup escape weather gas clown brand holiday result protect chat plug false pitch little', - }); + }) expect(a2Key.accAddress).toEqual( 'init1cz7urn9f27kelsam6m4tlsegfcapp2hwhtjmqe' - ); + ) const a3Key = new MnemonicKey({ mnemonic: 'corn peasant blue sight spy three stove confirm night brother vote dish reduce sick observe outside vacant arena laugh devote exotic wasp supply rally', - }); + }) expect(a3Key.accAddress).toEqual( 'init1hkehyn7dlvwssrhf3kwxf9azwm3pn8wjqhfpld' - ); + ) const msgSend = new MsgSend( multisigAddr, receiverAddr, new Coins({ uinit: 100000000 }) - ); + ) const signDoc = new SignDoc( 'testnet', @@ -117,29 +117,29 @@ describe('MnemonicKey', () => { multisigSequenceNumber, new AuthInfo([], new Fee(50000, { uinit: 750 })), new TxBody([msgSend]) - ); + ) - const a1Signature = await a1Key.createSignatureAmino(signDoc); + const a1Signature = await a1Key.createSignatureAmino(signDoc) expect((a1Signature.data.single as any).signature).toEqual( 'pM+jWKC0Ks4OaHkk/czkpndbw0C1GkbqYuCLBjBa+3ZtdSa3ydwjPMHCSbBn3seXLJde00xN+O0l++jZRiuelg==' - ); + ) - const a2Signature = await a2Key.createSignatureAmino(signDoc); + const a2Signature = await a2Key.createSignatureAmino(signDoc) expect((a2Signature.data.single as any).signature).toEqual( 'FHkESKoEjtoEKLT6/GvU5bSorJiWrcNC+rvvTnuJizdSz0Vukp1PmFSzbqNNga7pjfT5bUI1yYKJVavocsk9bA==' - ); + ) - const a3Signature = await a3Key.createSignatureAmino(signDoc); + const a3Signature = await a3Key.createSignatureAmino(signDoc) expect((a3Signature.data.single as any).signature).toEqual( 'a4DpYLsiAjiQO67bqgy0QW858u4B6b8mG/e0CG7AjD1g90qestY9k8223AJ2KbGEeif4svZXCfIUnDMf+0qU3w==' - ); - }); + ) + }) it('multisend', async () => { const key = new MnemonicKey({ mnemonic: 'spatial fantasy weekend romance entire million celery final moon solid route theory way hockey north trigger advice balcony melody fabric alter bullet twice push', - }); + }) const signDoc = new SignDoc( 'testnet', @@ -172,11 +172,11 @@ describe('MnemonicKey', () => { ], '1234' ) - ); + ) - const signature = await key.createSignatureAmino(signDoc); + const signature = await key.createSignatureAmino(signDoc) expect((signature.data.single as any).signature).toEqual( 'co8B8a2H4JLWfSrn7+rKmV4sMG/xmKxkEBe66xpDFgceZoyt9wWWPkQKfN1hg4tssz+p0+4rQgfqjBEJUxDAfA==' - ); - }); -}); + ) + }) +}) diff --git a/src/key/MnemonicKey.ts b/src/key/MnemonicKey.ts index 73f962c..437e538 100644 --- a/src/key/MnemonicKey.ts +++ b/src/key/MnemonicKey.ts @@ -1,36 +1,36 @@ -import * as bip32 from 'bip32'; -import * as bip39 from 'bip39'; -import { RawKey } from './RawKey'; +import * as bip32 from 'bip32' +import * as bip39 from 'bip39' +import { RawKey } from './RawKey' -export const INIT_COIN_TYPE = 118; +export const INIT_COIN_TYPE = 118 interface MnemonicKeyOptions { /** * Space-separated list of words for the mnemonic key. */ - mnemonic?: string; + mnemonic?: string /** * BIP44 account number. */ - account?: number; + account?: number /** * BIP44 index number */ - index?: number; + index?: number /** * Coin type. Default is INIT, 118. */ - coinType?: number; + coinType?: number } const DEFAULT_OPTIONS = { account: 0, index: 0, coinType: INIT_COIN_TYPE, -}; +} /** * Implements a BIP39 mnemonic wallet with standard key derivation from a word list. Note @@ -41,7 +41,7 @@ export class MnemonicKey extends RawKey { /** * Space-separated mnemonic phrase. */ - public mnemonic: string; + public mnemonic: string /** * Creates a new signing key from a mnemonic phrase. If no mnemonic is provided, one @@ -69,22 +69,22 @@ export class MnemonicKey extends RawKey { const { account, index, coinType } = { ...DEFAULT_OPTIONS, ...options, - }; - let { mnemonic } = options; + } + let { mnemonic } = options if (mnemonic === undefined) { - mnemonic = bip39.generateMnemonic(256); + mnemonic = bip39.generateMnemonic(256) } - const seed: Buffer = bip39.mnemonicToSeedSync(mnemonic); - const masterKey = bip32.fromSeed(seed); - const hdPathInitia = `m/44'/${coinType}'/${account}'/0/${index}`; - const initiaHD = masterKey.derivePath(hdPathInitia); - const privateKey = initiaHD.privateKey; + const seed: Buffer = bip39.mnemonicToSeedSync(mnemonic) + const masterKey = bip32.fromSeed(seed) + const hdPathInitia = `m/44'/${coinType}'/${account}'/0/${index}` + const initiaHD = masterKey.derivePath(hdPathInitia) + const privateKey = initiaHD.privateKey if (!privateKey) { - throw new Error('Failed to derive key pair'); + throw new Error('Failed to derive key pair') } - super(privateKey); - this.mnemonic = mnemonic; + super(privateKey) + this.mnemonic = mnemonic } } diff --git a/src/key/RawKey.ts b/src/key/RawKey.ts index 12989fd..4ddff2d 100644 --- a/src/key/RawKey.ts +++ b/src/key/RawKey.ts @@ -1,8 +1,8 @@ -import { SHA256, Word32Array } from 'jscrypto'; -import * as secp256k1 from 'secp256k1'; -import { Key } from './Key'; -import { SimplePublicKey } from '../core'; -import keccak256 from 'keccak256'; +import { SHA256, Word32Array } from 'jscrypto' +import * as secp256k1 from 'secp256k1' +import { Key } from './Key' +import { SimplePublicKey } from '../core' +import keccak256 from 'keccak256' /** * An implementation of the Key interfaces that uses a raw private key. @@ -11,45 +11,45 @@ export class RawKey extends Key { /** * Raw private key, in bytes. */ - public privateKey: Buffer; + public privateKey: Buffer constructor(privateKey: Buffer) { const publicKey = secp256k1.publicKeyCreate( new Uint8Array(privateKey), true - ); - super(new SimplePublicKey(Buffer.from(publicKey).toString('base64'))); - this.privateKey = privateKey; + ) + super(new SimplePublicKey(Buffer.from(publicKey).toString('base64'))) + this.privateKey = privateKey } public static fromHex(key: string): RawKey { - const hex = key.startsWith('0x') ? key.slice(2) : key; - if (hex.length !== 64) throw new Error('Invalid private key length'); - return new RawKey(Buffer.from(hex, 'hex')); + const hex = key.startsWith('0x') ? key.slice(2) : key + if (hex.length !== 64) throw new Error('Invalid private key length') + return new RawKey(Buffer.from(hex, 'hex')) } public async sign(payload: Buffer): Promise { const hash = Buffer.from( SHA256.hash(new Word32Array(payload)).toString(), 'hex' - ); + ) const { signature } = secp256k1.ecdsaSign( Uint8Array.from(hash), Uint8Array.from(this.privateKey) - ); + ) - return Buffer.from(signature); + return Buffer.from(signature) } public async signWithKeccak256(payload: Buffer): Promise { - const hash = keccak256(payload); + const hash = keccak256(payload) const { signature } = secp256k1.ecdsaSign( Uint8Array.from(hash), Uint8Array.from(this.privateKey) - ); + ) - return Buffer.from(signature); + return Buffer.from(signature) } } diff --git a/src/key/index.ts b/src/key/index.ts index ed4363c..c9b95e3 100644 --- a/src/key/index.ts +++ b/src/key/index.ts @@ -1,4 +1,4 @@ -export * from './ledger'; -export * from './Key'; -export * from './MnemonicKey'; -export * from './RawKey'; +export * from './ledger' +export * from './Key' +export * from './MnemonicKey' +export * from './RawKey' diff --git a/src/key/ledger/LedgerKey.ts b/src/key/ledger/LedgerKey.ts index d960480..84833ca 100644 --- a/src/key/ledger/LedgerKey.ts +++ b/src/key/ledger/LedgerKey.ts @@ -1,34 +1,34 @@ -import * as semver from 'semver'; -import Transport from '@ledgerhq/hw-transport'; -import InitiaApp from './app'; -import { AccAddress, SimplePublicKey, SignatureV2, SignDoc } from '../..'; -import { Key } from '../Key'; -import { INIT_COIN_TYPE } from '../MnemonicKey'; -import { signatureImport } from 'secp256k1'; +import * as semver from 'semver' +import Transport from '@ledgerhq/hw-transport' +import InitiaApp from './app' +import { AccAddress, SimplePublicKey, SignatureV2, SignDoc } from '../..' +import { Key } from '../Key' +import { INIT_COIN_TYPE } from '../MnemonicKey' +import { signatureImport } from 'secp256k1' import { AppInfoResponse, CommonResponse, DeviceInfoResponse, PublicKeyResponse, VersionResponse, -} from './types'; +} from './types' -const INTERACTION_TIMEOUT = 120; -const REQUIRED_APP_VERSION = '1.0.0'; +const INTERACTION_TIMEOUT = 120 +const REQUIRED_APP_VERSION = '1.0.0' declare global { interface Window { - google: any; + google: any } interface Navigator { - hid: any; + hid: any } } export class LedgerError extends Error { constructor(message: string) { - super(message); - this.name = 'LedgerError'; + super(message) + this.name = 'LedgerError' } } @@ -37,16 +37,16 @@ export class LedgerError extends Error { * in Ledger device */ export class LedgerKey extends Key { - private app: InitiaApp; - private path: number[] = [44, INIT_COIN_TYPE, 0, 0, 0]; + private app: InitiaApp + private path: number[] = [44, INIT_COIN_TYPE, 0, 0, 0] /** * * @param transport transporter for LedgerKey */ constructor(private transport?: Transport) { - super(); - this.app = new InitiaApp(this.transport); + super() + this.app = new InitiaApp(this.transport) } /** @@ -54,10 +54,10 @@ export class LedgerKey extends Key { */ public get accAddress(): AccAddress { if (!this.publicKey) { - throw new Error('Ledger is unintialized. Initialize it first.'); + throw new Error('Ledger is unintialized. Initialize it first.') } - return this.publicKey.address(); + return this.publicKey.address() } /** @@ -68,23 +68,23 @@ export class LedgerKey extends Key { index?: number ): Promise { if (!transport) { - transport = await createTransport(); + transport = await createTransport() } - const key = new LedgerKey(transport); + const key = new LedgerKey(transport) if (index != undefined) { - key.path[4] = index; + key.path[4] = index } if (transport && typeof transport.on === 'function') { transport.on('disconnect', () => { - key.transport = undefined; - }); + key.transport = undefined + }) } - await key.initialize().catch(handleConnectError); - return key; + await key.initialize().catch(handleConnectError) + return key } /** @@ -92,100 +92,100 @@ export class LedgerKey extends Key { * it loads accAddress and publicKey from connected Ledger */ private async initialize() { - const res = await this.app.initialize(); + const res = await this.app.initialize() - const { app_name: appName } = this.app.getInfo(); + const { app_name: appName } = this.app.getInfo() if (appName !== 'Initia') { - throw new LedgerError('Open the Initia app in the Ledger'); + throw new LedgerError('Open the Initia app in the Ledger') } - const { major, minor, patch } = this.app.getVersion(); - const version = `${major}.${minor}.${patch}`; + const { major, minor, patch } = this.app.getVersion() + const version = `${major}.${minor}.${patch}` if (appName === 'Initia' && semver.lt(version, REQUIRED_APP_VERSION)) { throw new LedgerError( 'Outdated version: Update Ledger Initia App to the latest version' - ); + ) } - checkLedgerErrors(res); - await this.loadAccountDetails(); + checkLedgerErrors(res) + await this.loadAccountDetails() } /** * get Address and Pubkey from Ledger */ public async loadAccountDetails(): Promise { - const res = await this.app.getAddressAndPubKey(this.path, 'init'); - checkLedgerErrors(res); + const res = await this.app.getAddressAndPubKey(this.path, 'init') + checkLedgerErrors(res) this.publicKey = new SimplePublicKey( Buffer.from(res.compressed_pk.data).toString('base64') - ); - return this; + ) + return this } public async sign(message: Buffer): Promise { if (!this.publicKey) { - this.loadAccountDetails(); + await this.loadAccountDetails() } - const res = await this.app.sign(this.path, message); - checkLedgerErrors(res); + const res = await this.app.sign(this.path, message) + checkLedgerErrors(res) - return Buffer.from(signatureImport(Buffer.from(res.signature as any))); + return Buffer.from(signatureImport(Buffer.from(res.signature as any))) } public async signWithKeccak256(): Promise { - throw new Error('LedgerKey does not support signWithKeccak256()'); + throw new Error('LedgerKey does not support signWithKeccak256()') } // eslint-disable-next-line @typescript-eslint/no-unused-vars public async createSignature(_tx: SignDoc): Promise { - throw new Error('direct sign mode is not supported'); + throw new Error('direct sign mode is not supported') } public async getAppAddressAndPubKey(): Promise { - return this.app.getAddressAndPubKey(this.path, 'init'); + return this.app.getAddressAndPubKey(this.path, 'init') } public getAppInfo(): AppInfoResponse { - return this.app.getInfo(); + return this.app.getInfo() } public async getAppDeviceInfo(): Promise { - return this.app.getDeviceInfo(); + return this.app.getDeviceInfo() } public async getAppPublicKey(): Promise { - return this.app.getPublicKey(this.path); + return this.app.getPublicKey(this.path) } public getAppVersion(): VersionResponse { - return this.app.getVersion(); + return this.app.getVersion() } public async showAddressAndPubKey(): Promise { - return this.app.showAddressAndPubKey(this.path, 'init'); + return this.app.showAddressAndPubKey(this.path, 'init') } } const handleConnectError = (err: Error) => { - const message = err.message.trim(); + const message = err.message.trim() if (message.startsWith('The device is already open')) { // ignore this error - return; //transport + return //transport } if (err.name === 'TransportOpenUserCancelled') { throw new LedgerError( "Couldn't find the Ledger. Check the Ledger is plugged in and unlocked." - ); + ) } /* istanbul ignore next: specific error rewrite */ if (message.startsWith('No WebUSB interface found for the Ledger device')) { throw new LedgerError( `Couldn't connect to a Ledger device. Use Ledger Live to upgrade the Ledger firmware to version ${REQUIRED_APP_VERSION} or later.` - ); + ) } /* istanbul ignore next: specific error rewrite */ @@ -193,7 +193,7 @@ const handleConnectError = (err: Error) => { // apparently can't use it in several tabs in parallel throw new LedgerError( "Couldn't access Ledger device. Is it being used in another tab?" - ); + ) } /* istanbul ignore next: specific error rewrite */ @@ -201,111 +201,111 @@ const handleConnectError = (err: Error) => { // apparently can't use it in several tabs in parallel throw new LedgerError( "Couldn't access Ledger device. Is it being used in another tab?" - ); + ) } /* istanbul ignore next: specific error rewrite */ if (message.startsWith('Not supported')) { throw new LedgerError( "This browser doesn't support WebUSB yet. Update it to the latest version." - ); + ) } /* istanbul ignore next: specific error rewrite */ if (message.startsWith('No device selected')) { throw new LedgerError( "Couldn't find the Ledger. Check the Ledger is plugged in and unlocked." - ); + ) } // throw unknown error - throw err; -}; + throw err +} const checkLedgerErrors = (response?: CommonResponse) => { if (!response) { - return; + return } - const { error_message, device_locked } = response; + const { error_message, device_locked } = response if (device_locked) { - throw new LedgerError("Ledger's screensaver mode is on"); + throw new LedgerError("Ledger's screensaver mode is on") } if (error_message.startsWith('TransportRaceCondition')) { - throw new LedgerError('Finish previous action in Ledger'); + throw new LedgerError('Finish previous action in Ledger') } else if (error_message.startsWith('DisconnectedDeviceDuringOperation')) { - throw new LedgerError('Open the Initia app in the Ledger'); + throw new LedgerError('Open the Initia app in the Ledger') } switch (error_message) { case 'U2F: Timeout': throw new LedgerError( "Couldn't find a connected and unlocked Ledger device" - ); + ) case 'App does not seem to be open': - throw new LedgerError('Open the Initia app in the Ledger'); + throw new LedgerError('Open the Initia app in the Ledger') case 'Command not allowed': - throw new LedgerError('Transaction rejected'); + throw new LedgerError('Transaction rejected') case 'Transaction rejected': - throw new LedgerError('User rejected the transaction'); + throw new LedgerError('User rejected the transaction') case 'Unknown Status Code: 26628': - throw new LedgerError("Ledger's screensaver mode is on"); + throw new LedgerError("Ledger's screensaver mode is on") case 'Instruction not supported': throw new LedgerError( 'Check the Ledger is running latest version of Initia' - ); + ) case 'No errors': - break; + break default: - throw new LedgerError(error_message); + throw new LedgerError(error_message) } -}; +} -const isWindows = (platform: string) => platform.indexOf('Win') > -1; +const isWindows = (platform: string) => platform.indexOf('Win') > -1 const checkBrowser = (userAgent: string): string => { - const ua = userAgent.toLowerCase(); - const isChrome = /chrome|crios/.test(ua) && !/edge|opr\//.test(ua); - const isBrave = isChrome && !window.google; + const ua = userAgent.toLowerCase() + const isChrome = /chrome|crios/.test(ua) && !/edge|opr\//.test(ua) + const isBrave = isChrome && !window.google if (!isChrome && !isBrave) { - throw new LedgerError("This browser doesn't support Ledger devices"); + throw new LedgerError("This browser doesn't support Ledger devices") } - return isChrome ? 'chrome' : 'brave'; -}; + return isChrome ? 'chrome' : 'brave' +} async function createTransport(): Promise { - let transport; + let transport: Transport - checkBrowser(navigator.userAgent); + checkBrowser(navigator.userAgent) if (isWindows(navigator.platform)) { // For Windows if (!navigator.hid) { throw new LedgerError( "This browser doesn't have HID enabled. Enable this feature by visiting: chrome://flags/#enable-experimental-web-platform-features" - ); + ) } - const TransportWebHid = require('@ledgerhq/hw-transport-webhid').default; - transport = await TransportWebHid.create(INTERACTION_TIMEOUT * 1000).catch( - handleConnectError - ); + const { default: TransportWebHid } = await import( + '@ledgerhq/hw-transport-webhid' + ) + transport = await TransportWebHid.create(INTERACTION_TIMEOUT * 1000) } else { // For other than Windows - const TransportWebUsb = require('@ledgerhq/hw-transport-webusb').default; - transport = await TransportWebUsb.create(INTERACTION_TIMEOUT * 1000).catch( - handleConnectError - ); + const { default: TransportWebUsb } = await import( + '@ledgerhq/hw-transport-webusb' + ) + transport = await TransportWebUsb.create(INTERACTION_TIMEOUT * 1000) } - return transport; + return transport } diff --git a/src/key/ledger/app.ts b/src/key/ledger/app.ts index 1819f0d..97d1769 100644 --- a/src/key/ledger/app.ts +++ b/src/key/ledger/app.ts @@ -15,10 +15,10 @@ * limitations under the License. ******************************************************************************* */ -import * as crypto from 'crypto'; -import Ripemd160 from 'ripemd160'; -import Transport from '@ledgerhq/hw-transport'; -import { bech32 } from 'bech32'; +import * as crypto from 'crypto' +import Ripemd160 from 'ripemd160' +import Transport from '@ledgerhq/hw-transport' +import { bech32 } from 'bech32' import { publicKey, serializePath, @@ -28,7 +28,7 @@ import { getDeviceInfo, getAddressAndPubKey, showAddressAndPubKey, -} from './device'; +} from './device' import { CommonResponse, AppInfoResponse, @@ -36,65 +36,65 @@ import { PublicKeyResponse, DeviceInfoResponse, SignResponse, -} from './types'; +} from './types' -const APP_NAME_INITIA = 'Initia'; -const APP_NAME_COSMOS = 'Cosmos'; +const APP_NAME_INITIA = 'Initia' +const APP_NAME_COSMOS = 'Cosmos' export default class InitiaApp { - private transport: Transport; - private info!: AppInfoResponse; - private version!: VersionResponse; + private transport: Transport + private info!: AppInfoResponse + private version!: VersionResponse constructor(transport?: Transport) { if (!transport) { - throw new Error('Transport has not been defined'); + throw new Error('Transport has not been defined') } - this.transport = transport; + this.transport = transport } static serializeHRP(hrp: string): Buffer { if (!hrp?.length || hrp.length < 3 || hrp.length > 83) { - throw new Error('Invalid HRP'); + throw new Error('Invalid HRP') } - const buf = Buffer.alloc(1 + hrp.length); - buf.writeUInt8(hrp.length, 0); - buf.write(hrp, 1); - return buf; + const buf = Buffer.alloc(1 + hrp.length) + buf.writeUInt8(hrp.length, 0) + buf.write(hrp, 1) + return buf } static getBech32FromPK(hrp: string, pk: Buffer): string { if (pk.length !== 33) { - throw new Error('expected compressed public key [31 bytes]'); + throw new Error('expected compressed public key [31 bytes]') } - const hashSha256 = crypto.createHash('sha256').update(pk).digest(); - const hashRip = new Ripemd160().update(hashSha256).digest(); - return bech32.encode(hrp, bech32.toWords(hashRip)); + const hashSha256 = crypto.createHash('sha256').update(pk).digest() + const hashRip = new Ripemd160().update(hashSha256).digest() + return bech32.encode(hrp, bech32.toWords(hashRip)) } private validateCompatibility(): CommonResponse | undefined { if (this.info && this.version) { if (this.info.return_code !== 0x9000) { - return this.info; + return this.info } if (this.version.return_code !== 0x9000) { - return this.version; + return this.version } if ( (this.info.app_name === APP_NAME_INITIA && this.version.major === 1) || (this.info.app_name === APP_NAME_COSMOS && this.version.major === 2) ) { - return; + return } } return { return_code: 0x6400, error_message: 'App Version is not supported', - }; + } } /** @@ -102,50 +102,50 @@ export default class InitiaApp { */ async initialize(): Promise { return getAppInfo(this.transport) - .then(appInfo => { - this.info = appInfo; - return getVersion(this.transport); + .then((appInfo) => { + this.info = appInfo + return getVersion(this.transport) + }) + .then((version) => { + this.version = version + return this.validateCompatibility() }) - .then(version => { - this.version = version; - return this.validateCompatibility(); - }); } getInfo(): AppInfoResponse { - return this.info; + return this.info } getVersion(): VersionResponse { - return this.version; + return this.version } getDeviceInfo(): Promise { - return getDeviceInfo(this.transport); + return getDeviceInfo(this.transport) } getPublicKey(path: number[]): Promise { - const result = serializePath(path); - const data = Buffer.concat([InitiaApp.serializeHRP('init'), result]); - return publicKey(this.transport, data); + const result = serializePath(path) + const data = Buffer.concat([InitiaApp.serializeHRP('init'), result]) + return publicKey(this.transport, data) } getAddressAndPubKey(path: number[], hrp: string): Promise { - const result = serializePath(path); - const data = Buffer.concat([InitiaApp.serializeHRP(hrp), result]); - return getAddressAndPubKey(this.transport, data); + const result = serializePath(path) + const data = Buffer.concat([InitiaApp.serializeHRP(hrp), result]) + return getAddressAndPubKey(this.transport, data) } showAddressAndPubKey( path: number[], hrp: string ): Promise { - const result = serializePath(path); - const data = Buffer.concat([InitiaApp.serializeHRP(hrp), result]); - return showAddressAndPubKey(this.transport, data); + const result = serializePath(path) + const data = Buffer.concat([InitiaApp.serializeHRP(hrp), result]) + return showAddressAndPubKey(this.transport, data) } sign(path: number[], message: Buffer): Promise { - return sign(this.transport, path, message); + return sign(this.transport, path, message) } } diff --git a/src/key/ledger/constants.ts b/src/key/ledger/constants.ts index d5d0dda..3c3a65c 100644 --- a/src/key/ledger/constants.ts +++ b/src/key/ledger/constants.ts @@ -1,30 +1,30 @@ -export const CLA = 0x55; -export const CHUNK_SIZE = 250; -export const APP_KEY = 'CSM'; +export const CLA = 0x55 +export const CHUNK_SIZE = 250 +export const APP_KEY = 'CSM' export const INS = { GET_VERSION: 0x00, INS_PUBLIC_KEY_SECP256K1: 0x01, // Obsolete SIGN_SECP256K1: 0x02, GET_ADDR_SECP256K1: 0x04, -}; +} export const PAYLOAD_TYPE = { INIT: 0x00, ADD: 0x01, LAST: 0x02, -}; +} export const P1_VALUES = { ONLY_RETRIEVE: 0x00, SHOW_ADDRESS_IN_DEVICE: 0x01, -}; +} export const ERROR_CODE = { NoError: 0x9000, -}; +} -export const ERROR_DESCRIPTION: { [key: number]: string } = { +export const ERROR_DESCRIPTION: Record = { 1: 'U2F: Unknown', 2: 'U2F: Bad request', 3: 'U2F: Configuration unsupported', @@ -48,4 +48,4 @@ export const ERROR_DESCRIPTION: { [key: number]: string } = { 0x6e00: 'App does not seem to be open', 0x6f00: 'Unknown error', 0x6f01: 'Sign/verify error', -}; +} diff --git a/src/key/ledger/device.ts b/src/key/ledger/device.ts index e925a16..edb9a87 100644 --- a/src/key/ledger/device.ts +++ b/src/key/ledger/device.ts @@ -1,4 +1,4 @@ -import Transport from '@ledgerhq/hw-transport'; +import Transport from '@ledgerhq/hw-transport' import { CLA, ERROR_CODE, @@ -7,21 +7,21 @@ import { PAYLOAD_TYPE, CHUNK_SIZE, ERROR_DESCRIPTION, -} from './constants'; +} from './constants' import { AppInfoResponse, VersionResponse, DeviceInfoResponse, PublicKeyResponse, SignResponse, -} from './types'; +} from './types' function errorCodeToString(statusCode: number): string { if (statusCode in ERROR_DESCRIPTION) { - return ERROR_DESCRIPTION[statusCode]; + return ERROR_DESCRIPTION[statusCode] } - return `Unknown Status Code: ${statusCode}`; + return `Unknown Status Code: ${statusCode}` } function isDict(v: any): boolean { @@ -30,7 +30,7 @@ function isDict(v: any): boolean { v !== null && !(v instanceof Array) && !(v instanceof Date) - ); + ) } function processErrorResponse(response: any) { @@ -40,42 +40,42 @@ function processErrorResponse(response: any) { return { return_code: response.statusCode, error_message: errorCodeToString(response.statusCode), - }; + } } if ( Object.prototype.hasOwnProperty.call(response, 'return_code') && Object.prototype.hasOwnProperty.call(response, 'error_message') ) { - return response; + return response } } return { return_code: 0xffff, error_message: response.toString(), - }; + } } return { return_code: 0xffff, error_message: response.toString(), - }; + } } export function serializePath(path: number[]): Buffer { if (path?.length !== 5) { - throw new TypeError('Invalid path.'); + throw new TypeError('Invalid path.') } - const buf = Buffer.alloc(20); + const buf = Buffer.alloc(20) - buf.writeUInt32LE(0x80000000 + path[0], 0); - buf.writeUInt32LE(0x80000000 + path[1], 4); - buf.writeUInt32LE(0x80000000 + path[2], 8); - buf.writeUInt32LE(path[3], 12); - buf.writeUInt32LE(path[4], 16); - return buf; + buf.writeUInt32LE(0x80000000 + path[0], 0) + buf.writeUInt32LE(0x80000000 + path[1], 4) + buf.writeUInt32LE(0x80000000 + path[2], 8) + buf.writeUInt32LE(path[3], 12) + buf.writeUInt32LE(path[4], 16) + return buf } export async function getVersion( @@ -83,18 +83,18 @@ export async function getVersion( ): Promise { return transport .send(CLA, INS.GET_VERSION, 0, 0) - .then(response => { - const errorCodeData = response.slice(-2); - const return_code = errorCodeData[0] * 256 + errorCodeData[1]; + .then((response) => { + const errorCodeData = response.slice(-2) + const return_code = errorCodeData[0] * 256 + errorCodeData[1] - let targetId = 0; + let targetId = 0 if (response.length >= 9) { /* eslint-disable no-bitwise */ targetId = (response[5] << 24) + (response[6] << 16) + (response[7] << 8) + - (response[8] << 0); + (response[8] << 0) /* eslint-enable no-bitwise */ } @@ -108,9 +108,9 @@ export async function getVersion( patch: response[3], device_locked: response[4] === 1, target_id: targetId.toString(16), - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function getAppInfo( @@ -118,35 +118,33 @@ export async function getAppInfo( ): Promise { return transport .send(0xb0, 0x01, 0, 0) - .then(response => { - const errorCodeData = response.slice(-2); - let return_code: number = errorCodeData[0] * 256 + errorCodeData[1]; - let error_message: string; + .then((response) => { + const errorCodeData = response.slice(-2) + let return_code: number = errorCodeData[0] * 256 + errorCodeData[1] + let error_message: string - let app_name = 'err'; - let app_version = 'err'; - let flag_len = 0; - let flags_value = 0; + let app_name = 'err' + let app_version = 'err' + let flag_len = 0 + let flags_value = 0 if (response[0] !== 1) { // Ledger responds with format ID 1. There is no spec for any format != 1 - error_message = 'response format ID not recognized'; - return_code = 0x9001; + error_message = 'response format ID not recognized' + return_code = 0x9001 } else { - error_message = 'No errors'; - const appNameLen = response[1]; - app_name = response.slice(2, 2 + appNameLen).toString('ascii'); - let idx = 2 + appNameLen; - const appVersionLen = response[idx]; - idx += 1; - app_version = response - .slice(idx, idx + appVersionLen) - .toString('ascii'); - idx += appVersionLen; - const appFlagsLen = response[idx]; - idx += 1; - flag_len = appFlagsLen; - flags_value = response[idx]; + error_message = 'No errors' + const appNameLen = response[1] + app_name = response.slice(2, 2 + appNameLen).toString('ascii') + let idx = 2 + appNameLen + const appVersionLen = response[idx] + idx += 1 + app_version = response.slice(idx, idx + appVersionLen).toString('ascii') + idx += appVersionLen + const appFlagsLen = response[idx] + idx += 1 + flag_len = appFlagsLen + flags_value = response[idx] } return { @@ -165,9 +163,9 @@ export async function getAppInfo( flag_onboarded: (flags_value & 4) !== 0, // eslint-disable-next-line no-bitwise flag_pin_validated: (flags_value & 128) !== 0, - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function getDeviceInfo( @@ -175,40 +173,40 @@ export async function getDeviceInfo( ): Promise { return transport .send(0xe0, 0x01, 0, 0, Buffer.from([]), [ERROR_CODE.NoError, 0x6e00]) - .then(response => { - const errorCodeData = response.slice(-2); - const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; + .then((response) => { + const errorCodeData = response.slice(-2) + const returnCode = errorCodeData[0] * 256 + errorCodeData[1] if (returnCode === 0x6e00) { return { return_code: returnCode, error_message: 'This command is only available in the Dashboard', - }; + } } - const target_id = response.slice(0, 4).toString('hex'); + const target_id = response.slice(0, 4).toString('hex') - let pos = 4; - const secureElementVersionLen = response[pos]; - pos += 1; + let pos = 4 + const secureElementVersionLen = response[pos] + pos += 1 const se_version = response .slice(pos, pos + secureElementVersionLen) - .toString(); - pos += secureElementVersionLen; + .toString() + pos += secureElementVersionLen - const flagsLen = response[pos]; - pos += 1; - const flag = response.slice(pos, pos + flagsLen).toString('hex'); - pos += flagsLen; + const flagsLen = response[pos] + pos += 1 + const flag = response.slice(pos, pos + flagsLen).toString('hex') + pos += flagsLen - const mcuVersionLen = response[pos]; - pos += 1; + const mcuVersionLen = response[pos] + pos += 1 // Patch issue in mcu version - let tmp = response.slice(pos, pos + mcuVersionLen); + let tmp = response.slice(pos, pos + mcuVersionLen) if (tmp[mcuVersionLen - 1] === 0) { - tmp = response.slice(pos, pos + mcuVersionLen - 1); + tmp = response.slice(pos, pos + mcuVersionLen - 1) } - const mcu_version = tmp.toString(); + const mcu_version = tmp.toString() return { return_code: returnCode, @@ -218,9 +216,9 @@ export async function getDeviceInfo( se_version, flag, mcu_version, - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function publicKey( @@ -229,19 +227,19 @@ export async function publicKey( ): Promise { return transport .send(CLA, INS.GET_ADDR_SECP256K1, 0, 0, data, [ERROR_CODE.NoError]) - .then(response => { - const errorCodeData = response.slice(-2); - const returnCode: number = errorCodeData[0] * 256 + errorCodeData[1]; - const compressedPk = response ? Buffer.from(response.slice(0, 33)) : null; + .then((response) => { + const errorCodeData = response.slice(-2) + const returnCode: number = errorCodeData[0] * 256 + errorCodeData[1] + const compressedPk = response ? Buffer.from(response.slice(0, 33)) : null return { pk: 'OBSOLETE PROPERTY', compressed_pk: compressedPk ? compressedPk.toJSON() : compressedPk, return_code: returnCode, error_message: errorCodeToString(returnCode), - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function getAddressAndPubKey( @@ -252,21 +250,21 @@ export async function getAddressAndPubKey( .send(CLA, INS.GET_ADDR_SECP256K1, P1_VALUES.ONLY_RETRIEVE, 0, data, [ ERROR_CODE.NoError, ]) - .then(response => { - const errorCodeData = response.slice(-2); - const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; + .then((response) => { + const errorCodeData = response.slice(-2) + const returnCode = errorCodeData[0] * 256 + errorCodeData[1] - const compressedPk = Buffer.from(response.slice(0, 33)); - const bech32Address = Buffer.from(response.slice(33, -2)).toString(); + const compressedPk = Buffer.from(response.slice(0, 33)) + const bech32Address = Buffer.from(response.slice(33, -2)).toString() return { bech32_address: bech32Address, compressed_pk: compressedPk.toJSON(), return_code: returnCode, error_message: errorCodeToString(returnCode), - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function showAddressAndPubKey( @@ -282,41 +280,41 @@ export async function showAddressAndPubKey( data, [ERROR_CODE.NoError] ) - .then(response => { - const errorCodeData = response.slice(-2); - const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; + .then((response) => { + const errorCodeData = response.slice(-2) + const returnCode = errorCodeData[0] * 256 + errorCodeData[1] - const compressedPk = Buffer.from(response.slice(0, 33)); - const bech32Address = Buffer.from(response.slice(33, -2)).toString(); + const compressedPk = Buffer.from(response.slice(0, 33)) + const bech32Address = Buffer.from(response.slice(33, -2)).toString() return { bech32_address: bech32Address, compressed_pk: compressedPk.toJSON(), return_code: returnCode, error_message: errorCodeToString(returnCode), - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } function signGetChunks(path: number[], message: Buffer): Buffer[] { - const result = serializePath(path); - const chunks: Buffer[] = []; + const result = serializePath(path) + const chunks: Buffer[] = [] if (result instanceof Buffer) { - chunks.push(result); - const buffer = Buffer.from(message); + chunks.push(result) + const buffer = Buffer.from(message) for (let i = 0; i < buffer.length; i += CHUNK_SIZE) { - let end = i + CHUNK_SIZE; + let end = i + CHUNK_SIZE if (i > buffer.length) { - end = buffer.length; + end = buffer.length } - chunks.push(buffer.slice(i, end)); + chunks.push(buffer.slice(i, end)) } } - return chunks; + return chunks } async function signSendChunk( @@ -325,14 +323,14 @@ async function signSendChunk( chunkNum: number, chunk: Buffer ): Promise { - let payloadType = PAYLOAD_TYPE.ADD; + let payloadType = PAYLOAD_TYPE.ADD if (chunkIdx === 1) { - payloadType = PAYLOAD_TYPE.INIT; + payloadType = PAYLOAD_TYPE.INIT } if (chunkIdx === chunkNum) { - payloadType = PAYLOAD_TYPE.LAST; + payloadType = PAYLOAD_TYPE.LAST } return transport @@ -341,30 +339,30 @@ async function signSendChunk( 0x6984, 0x6a80, ]) - .then(response => { - const errorCodeData = response.slice(-2); - const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; - let errorMessage = errorCodeToString(returnCode); + .then((response) => { + const errorCodeData = response.slice(-2) + const returnCode = errorCodeData[0] * 256 + errorCodeData[1] + let errorMessage = errorCodeToString(returnCode) if (returnCode === 0x6a80 || returnCode === 0x6984) { errorMessage = `${errorMessage} : ${response .slice(0, response.length - 2) - .toString('ascii')}`; + .toString('ascii')}` } - let signature: Buffer = Buffer.from([]); + let signature: Buffer = Buffer.from([]) if (response.length > 2) { - signature = response.slice(0, response.length - 2); + signature = response.slice(0, response.length - 2) } return { signature: signature.toJSON(), return_code: returnCode, error_message: errorMessage, - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } export async function sign( @@ -372,26 +370,21 @@ export async function sign( path: number[], message: Buffer ): Promise { - const chunks = signGetChunks(path, message); + const chunks = signGetChunks(path, message) return signSendChunk(transport, 1, chunks.length, chunks[0]) - .then(async response => { + .then(async (response) => { let result: SignResponse = { return_code: response.return_code, error_message: response.error_message, signature: { type: 'Buffer', data: [] }, - }; + } for (let i = 1; i < chunks.length; i += 1) { - result = await signSendChunk( - transport, - 1 + i, - chunks.length, - chunks[i] - ); + result = await signSendChunk(transport, 1 + i, chunks.length, chunks[i]) if (result.return_code !== ERROR_CODE.NoError) { - break; + break } } @@ -399,7 +392,7 @@ export async function sign( return_code: result.return_code, error_message: result.error_message, signature: result.signature, - }; + } }) - .catch(processErrorResponse); + .catch(processErrorResponse) } diff --git a/src/key/ledger/index.ts b/src/key/ledger/index.ts index 58d26a5..2458882 100644 --- a/src/key/ledger/index.ts +++ b/src/key/ledger/index.ts @@ -1,6 +1,6 @@ -import InitiaApp from './app'; -export * from './types'; -export * from './constants'; -export * from './LedgerKey'; +import InitiaApp from './app' +export * from './types' +export * from './constants' +export * from './LedgerKey' -export default InitiaApp; +export default InitiaApp diff --git a/src/key/ledger/types.ts b/src/key/ledger/types.ts index 4d8c66d..70cf585 100644 --- a/src/key/ledger/types.ts +++ b/src/key/ledger/types.ts @@ -1,51 +1,51 @@ export interface JSONBuffer { - type: 'Buffer'; - data: number[]; + type: 'Buffer' + data: number[] } export interface CommonResponse { - return_code: number; - error_message: string; - device_locked?: boolean; + return_code: number + error_message: string + device_locked?: boolean } export interface PublicKeyResponse extends CommonResponse { - bech32_address: string; - pk: 'OBSOLETE PROPERTY'; - compressed_pk: JSONBuffer; + bech32_address: string + pk: 'OBSOLETE PROPERTY' + compressed_pk: JSONBuffer } export interface AddressResponse extends CommonResponse { - bech32_address: string; - compressed_pk: JSONBuffer; + bech32_address: string + compressed_pk: JSONBuffer } export interface SignResponse extends CommonResponse { - signature: JSONBuffer; + signature: JSONBuffer } export interface AppInfoResponse extends CommonResponse { - app_name: string; - app_version: string; - flag_len: number; - flags_value: number; - flag_recovery: boolean; - flag_signed_mcu_code: boolean; - flag_onboarded: boolean; - flag_pin_validated: Boolean; + app_name: string + app_version: string + flag_len: number + flags_value: number + flag_recovery: boolean + flag_signed_mcu_code: boolean + flag_onboarded: boolean + flag_pin_validated: boolean } export interface VersionResponse extends CommonResponse { - test_mode: boolean; - major: number; - minor: number; - patch: number; - target_id: string; + test_mode: boolean + major: number + minor: number + patch: number + target_id: string } export interface DeviceInfoResponse extends CommonResponse { - target_id: string; // '31100004', - se_version: string; // '1.6.0', - flag: string; // 'a6000000', - mcu_version: string; // '1.11' + target_id: string // '31100004', + se_version: string // '1.6.0', + flag: string // 'a6000000', + mcu_version: string // '1.11' } diff --git a/src/util/bcs.ts b/src/util/bcs.ts index c4f295b..6434c1f 100644 --- a/src/util/bcs.ts +++ b/src/util/bcs.ts @@ -1,5 +1,5 @@ -import { BcsTypeOptions, bcs as mystenBcs } from '@mysten/bcs'; -import { AccAddress, BigNumber, num } from '../core'; +import { BcsTypeOptions, bcs as mystenBcs } from '@mysten/bcs' +import { AccAddress, BigNumber, num } from '../core' const initiaAddress = ( options?: BcsTypeOptions> @@ -7,21 +7,21 @@ const initiaAddress = ( mystenBcs.bytes(32, options).transform({ input: (val: string) => { if (val.startsWith('init1')) { - val = AccAddress.toHex(val); + val = AccAddress.toHex(val) } if (val.startsWith('0x')) { - val = val.slice(2).padStart(64, '0'); + val = val.slice(2).padStart(64, '0') } if (!val.match(/[0-9a-f]+$/i)) { - throw new Error('invalid address'); + throw new Error('invalid address') } - return Buffer.from(val, 'hex'); + return Buffer.from(val, 'hex') }, - output: val => `0x${Buffer.from(val).toString('hex')}`, - }); + output: (val) => `0x${Buffer.from(val).toString('hex')}`, + }) // initia specific types const initiaBcs = { @@ -49,11 +49,11 @@ const initiaBcs = { fixed_point32: (options?: BcsTypeOptions) => mystenBcs.u64(options).transform({ input: (val: number | string) => { - const n = num(val).times(new BigNumber('4294967296')); + const n = num(val).times(new BigNumber('4294967296')) - return n.toFixed(0, BigNumber.ROUND_DOWN); + return n.toFixed(0, BigNumber.ROUND_DOWN) }, - output: val => num(val).div(new BigNumber('4294967296')).toNumber(), + output: (val) => num(val).div(new BigNumber('4294967296')).toNumber(), }), /** @@ -64,11 +64,11 @@ const initiaBcs = { fixed_point64: (options?: BcsTypeOptions) => mystenBcs.u128(options).transform({ input: (val: number | string) => { - const n = num(val).times(new BigNumber('18446744073709551616')); + const n = num(val).times(new BigNumber('18446744073709551616')) - return n.toFixed(0, BigNumber.ROUND_DOWN); + return n.toFixed(0, BigNumber.ROUND_DOWN) }, - output: val => + output: (val) => num(val).div(new BigNumber('18446744073709551616')).toNumber(), }), @@ -80,11 +80,11 @@ const initiaBcs = { decimal128: (options?: BcsTypeOptions) => mystenBcs.u128(options).transform({ input: (val: number | string) => { - const n = num(val).times(new BigNumber('1000000000000000000')); + const n = num(val).times(new BigNumber('1000000000000000000')) - return n.toFixed(0, BigNumber.ROUND_DOWN); + return n.toFixed(0, BigNumber.ROUND_DOWN) }, - output: val => + output: (val) => num(val).div(new BigNumber('1000000000000000000')).toNumber(), }), @@ -96,16 +96,16 @@ const initiaBcs = { decimal256: (options?: BcsTypeOptions) => mystenBcs.u256(options).transform({ input: (val: number | string) => { - const n = num(val).times(new BigNumber('1000000000000000000')); + const n = num(val).times(new BigNumber('1000000000000000000')) - return n.toFixed(0, BigNumber.ROUND_DOWN); + return n.toFixed(0, BigNumber.ROUND_DOWN) }, - output: val => + output: (val) => num(val).div(new BigNumber('1000000000000000000')).toNumber(), }), -}; +} export const bcs = { ...mystenBcs, ...initiaBcs, -}; +} diff --git a/src/util/hash.spec.ts b/src/util/hash.spec.ts index 265aafb..4550006 100644 --- a/src/util/hash.spec.ts +++ b/src/util/hash.spec.ts @@ -1,4 +1,4 @@ -import { hashToHex } from './hash'; +import { hashToHex } from './hash' describe('hashToHex', () => { it('hashes correctly', () => { @@ -8,6 +8,6 @@ describe('hashToHex', () => { ) ).toEqual( 'E2969CFC525D852234EAF30F7F2A71ACC1A89261543E0343220FD4030F58A140' - ); - }); -}); + ) + }) +}) diff --git a/src/util/hash.ts b/src/util/hash.ts index dec0719..b14a8b8 100644 --- a/src/util/hash.ts +++ b/src/util/hash.ts @@ -1,8 +1,8 @@ -import { SHA256 } from 'jscrypto/SHA256'; -import { RIPEMD160 } from 'jscrypto/RIPEMD160'; -import { Base64 } from 'jscrypto/Base64'; -import { Word32Array } from 'jscrypto'; -import KECCAK256 from 'keccak256'; +import { SHA256 } from 'jscrypto/SHA256' +import { RIPEMD160 } from 'jscrypto/RIPEMD160' +import { Base64 } from 'jscrypto/Base64' +import { Word32Array } from 'jscrypto' +import KECCAK256 from 'keccak256' /* DEPRECATED (was used by crypto-js) @@ -19,7 +19,7 @@ function byteArrayToWordArray(ba: Uint8Array): CryptoJS.LibWordArray { * @param data Amino-encoded string (base64) */ export function hashToHex(data: string): string { - return SHA256.hash(Base64.parse(data)).toString().toUpperCase(); + return SHA256.hash(Base64.parse(data)).toString().toUpperCase() } /** @@ -27,13 +27,13 @@ export function hashToHex(data: string): string { * @param data raw bytes */ export function sha256(data: Uint8Array): Uint8Array { - return SHA256.hash(new Word32Array(data)).toUint8Array(); + return SHA256.hash(new Word32Array(data)).toUint8Array() } export function keccak256(data: Uint8Array): Uint8Array { - return KECCAK256(Buffer.from(data)); + return KECCAK256(Buffer.from(data)) } export function ripemd160(data: Uint8Array): Uint8Array { - return RIPEMD160.hash(new Word32Array(data)).toUint8Array(); + return RIPEMD160.hash(new Word32Array(data)).toUint8Array() } diff --git a/src/util/index.ts b/src/util/index.ts index b80c2da..0df55bb 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -1,3 +1,3 @@ -export * from './bcs'; -export * from './hash'; -export * from './json'; +export * from './bcs' +export * from './hash' +export * from './json' diff --git a/src/util/json.spec.ts b/src/util/json.spec.ts index 6d1234b..b5894b0 100644 --- a/src/util/json.spec.ts +++ b/src/util/json.spec.ts @@ -1,4 +1,4 @@ -import { removeNull } from './json'; +import { removeNull } from './json' describe('removeNull', () => { const object = { @@ -16,10 +16,10 @@ describe('removeNull', () => { }, b: 123, }, - }; + } it('removes null values from object', () => { - const newObject = removeNull(object); + const newObject = removeNull(object) expect(newObject).toEqual({ a: 'abc', b: { @@ -32,21 +32,21 @@ describe('removeNull', () => { }, b: 123, }, - }); - }); + }) + }) it('does not mutate object', () => { - removeNull(object); - expect(object).toEqual(object); - }); + removeNull(object) + expect(object).toEqual(object) + }) it('returns object or primitive if not Object', () => { - const string = 'string'; - const number = 1; - const boolean = false; + const string = 'string' + const number = 1 + const boolean = false - expect(removeNull(string)).toEqual(string); - expect(removeNull(number)).toEqual(number); - expect(removeNull(boolean)).toEqual(boolean); - }); -}); + expect(removeNull(string)).toEqual(string) + expect(removeNull(number)).toEqual(number) + expect(removeNull(boolean)).toEqual(boolean) + }) +}) diff --git a/src/util/json.ts b/src/util/json.ts index 9fb301b..c402293 100644 --- a/src/util/json.ts +++ b/src/util/json.ts @@ -1,33 +1,33 @@ export function prepareSignBytes(obj: any): any { if (Array.isArray(obj)) { - return obj.map(prepareSignBytes); + return obj.map(prepareSignBytes) } // string, number, or null if (typeof obj !== `object` || obj === null) { - return obj; + return obj } - const sorted: any = {}; + const sorted: any = {} Object.keys(obj) .sort() - .forEach(key => { - if (obj[key] === undefined || obj[key] === null) return; - sorted[key] = prepareSignBytes(obj[key]); - }); - return sorted; + .forEach((key) => { + if (obj[key] === undefined || obj[key] === null) return + sorted[key] = prepareSignBytes(obj[key]) + }) + return sorted } export abstract class JSONSerializable { - public abstract toAmino(): A; - public abstract toData(): D; - public abstract toProto(): P; + public abstract toAmino(): A + public abstract toData(): D + public abstract toProto(): P public toJSON(): string { - return JSON.stringify(prepareSignBytes(this.toData())); + return JSON.stringify(prepareSignBytes(this.toData())) } public toAminoJSON(): string { - return JSON.stringify(prepareSignBytes(this.toAmino())); + return JSON.stringify(prepareSignBytes(this.toAmino())) } } @@ -41,8 +41,8 @@ export function removeNull(obj: any): any { [k]: v === Object(v) && !Array.isArray(v) ? removeNull(v) : v, }), {} - ); + ) } - return obj; + return obj } diff --git a/tsconfig.json b/tsconfig.json index 7eac51c..86d2a69 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,28 +2,33 @@ "include": ["src", "types"], "exclude": ["/node_modules/", "./src/**/*.spec.ts"], "compilerOptions": { - "allowSyntheticDefaultImports": true, - "alwaysStrict": true, - "baseUrl": "./", - "declaration": true, - "esModuleInterop": true, - "lib": ["es2015", "es2016", "es2017", "dom"], "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "allowSyntheticDefaultImports": true, + "target": "es2022", "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, + "lib": ["es2019", "esnext", "dom"], + "sourceMap": true, + "outDir": "./dist", + "rootDir": "src", + "baseUrl": "./", + "incremental": true, + "strict": false, "noImplicitAny": true, + "alwaysStrict": true, + "strictNullChecks": true, "noImplicitReturns": true, "noImplicitThis": true, "noUnusedLocals": false, + "noFallthroughCasesInSwitch": true, + "skipLibCheck": true, + "esModuleInterop": true, "noUnusedParameters": true, - "outDir": "dist", - "rootDir": "src", - "sourceMap": true, - "strict": true, "strictFunctionTypes": true, - "strictNullChecks": true, "strictPropertyInitialization": true, - "target": "es2015", "paths": { "*": ["src/*"] } diff --git a/typedoc.json b/typedoc.json deleted file mode 100644 index 686b963..0000000 --- a/typedoc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "entryPoints": ["./src/index.ts"], - "out": "docs", - "excludeExternals": true, - "exclude": ["**/*+(index|.spec|.e2e).ts"], - "theme": "default", - "name": "initia.js", - "excludePrivate": true, - "excludeProtected": true, - "media": "img", - "hideGenerator": true -}