From 341c66bafc2bf9cc31294bc1c81272d830419179 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 16 Jul 2023 20:51:57 +0200 Subject: [PATCH 1/2] boilerplates --- boilerplates/node-typescript/.editorconfig | 12 + boilerplates/node-typescript/.eslintignore | 5 + boilerplates/node-typescript/.eslintrc.js | 71 ++++ boilerplates/node-typescript/.gitignore | 50 +++ boilerplates/node-typescript/.npmignore | 32 ++ boilerplates/node-typescript/.npmrc | 1 + boilerplates/node-typescript/.questions.json | 37 +++ .../node-typescript/.vscode/settings.json | 16 + boilerplates/node-typescript/LICENSE | 21 ++ boilerplates/node-typescript/README.md | 60 ++++ .../__tests__/contract.test.ts | 3 + .../contracts/stargaze-minter/LICENSE | 201 ++++++++++++ .../contracts/stargaze-minter/README.md | 1 + .../contracts/stargaze-minter/package.json | 21 ++ .../stargaze-minter/schema/config.json | 90 +++++ .../schema/config_response.json | 86 +++++ .../stargaze-minter/schema/execute_msg.json | 144 ++++++++ .../schema/instantiate_msg.json | 159 +++++++++ .../schema/mint_count_response.json | 19 ++ .../schema/mint_price_response.json | 48 +++ .../schema/mintable_num_tokens_response.json | 15 + .../stargaze-minter/schema/query_msg.json | 74 +++++ .../schema/start_time_response.json | 13 + .../contracts/stargaze-sg721/LICENSE | 201 ++++++++++++ .../contracts/stargaze-sg721/README.md | 1 + .../contracts/stargaze-sg721/package.json | 21 ++ .../schema/all_nft_info_response.json | 155 +++++++++ .../schema/all_operators_response.json | 97 ++++++ .../schema/all_tokens_response.json | 17 + .../schema/approval_response.json | 94 ++++++ .../schema/approvals_response.json | 97 ++++++ .../stargaze-sg721/schema/binary.json | 6 + .../schema/collection_info_response.json | 58 ++++ .../schema/contract_info_response.json | 17 + .../schema/execute_msg_for__empty.json | 308 ++++++++++++++++++ .../schema/instantiate_msg.json | 81 +++++ .../schema/minter_response.json | 14 + .../schema/nft_info_response.json | 31 ++ .../schema/num_tokens_response.json | 15 + .../schema/operators_response.json | 97 ++++++ .../schema/owner_of_response.json | 103 ++++++ .../stargaze-sg721/schema/query_msg.json | 284 ++++++++++++++++ .../schema/tokens_response.json | 17 + boilerplates/node-typescript/jest.config.cjs | 5 + boilerplates/node-typescript/package.json | 71 ++++ .../node-typescript/scripts/codegen.cjs | 29 ++ boilerplates/node-typescript/src/index.ts | 1 + boilerplates/node-typescript/tsconfig.json | 29 ++ boilerplates/telescope-module/.babelrc.js | 17 + boilerplates/telescope-module/.editorconfig | 12 + boilerplates/telescope-module/.eslintignore | 5 + boilerplates/telescope-module/.eslintrc.js | 71 ++++ boilerplates/telescope-module/.gitignore | 50 +++ boilerplates/telescope-module/.npmignore | 32 ++ boilerplates/telescope-module/.npmrc | 1 + boilerplates/telescope-module/.questions.json | 42 +++ .../telescope-module/.vscode/settings.json | 16 + boilerplates/telescope-module/LICENSE | 21 ++ boilerplates/telescope-module/README.md | 290 +++++++++++++++++ .../__tests__/messages.test.js | 43 +++ boilerplates/telescope-module/package.json | 83 +++++ .../telescope-module/scripts/aminos.js | 29 ++ .../telescope-module/scripts/codegen.js | 107 ++++++ boilerplates/telescope-module/src/index.ts | 1 + boilerplates/telescope-module/tsconfig.json | 28 ++ boilerplates/ts-codegen-module/.editorconfig | 12 + boilerplates/ts-codegen-module/.eslintignore | 5 + boilerplates/ts-codegen-module/.eslintrc.js | 71 ++++ boilerplates/ts-codegen-module/.gitignore | 50 +++ boilerplates/ts-codegen-module/.npmignore | 32 ++ boilerplates/ts-codegen-module/.npmrc | 1 + .../ts-codegen-module/.questions.json | 37 +++ .../ts-codegen-module/.vscode/settings.json | 16 + boilerplates/ts-codegen-module/LICENSE | 21 ++ boilerplates/ts-codegen-module/README.md | 60 ++++ .../__tests__/contract.test.ts | 3 + .../contracts/stargaze-minter/LICENSE | 201 ++++++++++++ .../contracts/stargaze-minter/README.md | 1 + .../contracts/stargaze-minter/package.json | 21 ++ .../stargaze-minter/schema/config.json | 90 +++++ .../schema/config_response.json | 86 +++++ .../stargaze-minter/schema/execute_msg.json | 144 ++++++++ .../schema/instantiate_msg.json | 159 +++++++++ .../schema/mint_count_response.json | 19 ++ .../schema/mint_price_response.json | 48 +++ .../schema/mintable_num_tokens_response.json | 15 + .../stargaze-minter/schema/query_msg.json | 74 +++++ .../schema/start_time_response.json | 13 + .../contracts/stargaze-sg721/LICENSE | 201 ++++++++++++ .../contracts/stargaze-sg721/README.md | 1 + .../contracts/stargaze-sg721/package.json | 21 ++ .../schema/all_nft_info_response.json | 155 +++++++++ .../schema/all_operators_response.json | 97 ++++++ .../schema/all_tokens_response.json | 17 + .../schema/approval_response.json | 94 ++++++ .../schema/approvals_response.json | 97 ++++++ .../stargaze-sg721/schema/binary.json | 6 + .../schema/collection_info_response.json | 58 ++++ .../schema/contract_info_response.json | 17 + .../schema/execute_msg_for__empty.json | 308 ++++++++++++++++++ .../schema/instantiate_msg.json | 81 +++++ .../schema/minter_response.json | 14 + .../schema/nft_info_response.json | 31 ++ .../schema/num_tokens_response.json | 15 + .../schema/operators_response.json | 97 ++++++ .../schema/owner_of_response.json | 103 ++++++ .../stargaze-sg721/schema/query_msg.json | 284 ++++++++++++++++ .../schema/tokens_response.json | 17 + .../ts-codegen-module/jest.config.cjs | 5 + boilerplates/ts-codegen-module/package.json | 70 ++++ .../ts-codegen-module/scripts/codegen.cjs | 29 ++ boilerplates/ts-codegen-module/src/index.ts | 1 + boilerplates/ts-codegen-module/tsconfig.json | 29 ++ lerna.json | 3 +- package.json | 5 +- .../create-cosmos-app/src/git-cca-template.ts | 18 +- 116 files changed, 6925 insertions(+), 4 deletions(-) create mode 100644 boilerplates/node-typescript/.editorconfig create mode 100644 boilerplates/node-typescript/.eslintignore create mode 100644 boilerplates/node-typescript/.eslintrc.js create mode 100644 boilerplates/node-typescript/.gitignore create mode 100644 boilerplates/node-typescript/.npmignore create mode 100644 boilerplates/node-typescript/.npmrc create mode 100644 boilerplates/node-typescript/.questions.json create mode 100644 boilerplates/node-typescript/.vscode/settings.json create mode 100644 boilerplates/node-typescript/LICENSE create mode 100644 boilerplates/node-typescript/README.md create mode 100644 boilerplates/node-typescript/__tests__/contract.test.ts create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/LICENSE create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/README.md create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/package.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/config.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/config_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/execute_msg.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/instantiate_msg.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_count_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_price_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/mintable_num_tokens_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/query_msg.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-minter/schema/start_time_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/LICENSE create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/README.md create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/package.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_nft_info_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_operators_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_tokens_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/approval_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/approvals_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/binary.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/collection_info_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/contract_info_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/execute_msg_for__empty.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/instantiate_msg.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/minter_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/nft_info_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/num_tokens_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/operators_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/owner_of_response.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/query_msg.json create mode 100644 boilerplates/node-typescript/contracts/stargaze-sg721/schema/tokens_response.json create mode 100644 boilerplates/node-typescript/jest.config.cjs create mode 100644 boilerplates/node-typescript/package.json create mode 100644 boilerplates/node-typescript/scripts/codegen.cjs create mode 100644 boilerplates/node-typescript/src/index.ts create mode 100644 boilerplates/node-typescript/tsconfig.json create mode 100644 boilerplates/telescope-module/.babelrc.js create mode 100644 boilerplates/telescope-module/.editorconfig create mode 100644 boilerplates/telescope-module/.eslintignore create mode 100644 boilerplates/telescope-module/.eslintrc.js create mode 100644 boilerplates/telescope-module/.gitignore create mode 100644 boilerplates/telescope-module/.npmignore create mode 100644 boilerplates/telescope-module/.npmrc create mode 100644 boilerplates/telescope-module/.questions.json create mode 100644 boilerplates/telescope-module/.vscode/settings.json create mode 100644 boilerplates/telescope-module/LICENSE create mode 100644 boilerplates/telescope-module/README.md create mode 100644 boilerplates/telescope-module/__tests__/messages.test.js create mode 100644 boilerplates/telescope-module/package.json create mode 100644 boilerplates/telescope-module/scripts/aminos.js create mode 100644 boilerplates/telescope-module/scripts/codegen.js create mode 100644 boilerplates/telescope-module/src/index.ts create mode 100644 boilerplates/telescope-module/tsconfig.json create mode 100644 boilerplates/ts-codegen-module/.editorconfig create mode 100644 boilerplates/ts-codegen-module/.eslintignore create mode 100644 boilerplates/ts-codegen-module/.eslintrc.js create mode 100644 boilerplates/ts-codegen-module/.gitignore create mode 100644 boilerplates/ts-codegen-module/.npmignore create mode 100644 boilerplates/ts-codegen-module/.npmrc create mode 100644 boilerplates/ts-codegen-module/.questions.json create mode 100644 boilerplates/ts-codegen-module/.vscode/settings.json create mode 100644 boilerplates/ts-codegen-module/LICENSE create mode 100644 boilerplates/ts-codegen-module/README.md create mode 100644 boilerplates/ts-codegen-module/__tests__/contract.test.ts create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/LICENSE create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/README.md create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/package.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/execute_msg.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/instantiate_msg.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_count_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_price_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mintable_num_tokens_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/query_msg.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/start_time_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/LICENSE create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/README.md create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/package.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_nft_info_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_operators_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_tokens_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approval_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approvals_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/binary.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/collection_info_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/contract_info_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/execute_msg_for__empty.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/instantiate_msg.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/minter_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/nft_info_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/num_tokens_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/operators_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/owner_of_response.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/query_msg.json create mode 100644 boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/tokens_response.json create mode 100644 boilerplates/ts-codegen-module/jest.config.cjs create mode 100644 boilerplates/ts-codegen-module/package.json create mode 100644 boilerplates/ts-codegen-module/scripts/codegen.cjs create mode 100644 boilerplates/ts-codegen-module/src/index.ts create mode 100644 boilerplates/ts-codegen-module/tsconfig.json diff --git a/boilerplates/node-typescript/.editorconfig b/boilerplates/node-typescript/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/boilerplates/node-typescript/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/boilerplates/node-typescript/.eslintignore b/boilerplates/node-typescript/.eslintignore new file mode 100644 index 000000000..38ba48499 --- /dev/null +++ b/boilerplates/node-typescript/.eslintignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ \ No newline at end of file diff --git a/boilerplates/node-typescript/.eslintrc.js b/boilerplates/node-typescript/.eslintrc.js new file mode 100644 index 000000000..2718e8bc4 --- /dev/null +++ b/boilerplates/node-typescript/.eslintrc.js @@ -0,0 +1,71 @@ +module.exports = { + plugins: ['prettier'], + extends: ['eslint:recommended', 'prettier'], + parser: '@babel/eslint-parser', + parserOptions: { + ecmaVersion: 11, + requireConfigFile: false, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + env: { + es6: true, + browser: true, + node: true, + jest: true + }, + rules: { + 'no-debugger': 2, + 'no-alert': 2, + 'no-await-in-loop': 0, + 'no-prototype-builtins': 0, + 'no-return-assign': ['error', 'except-parens'], + 'no-restricted-syntax': [ + 2, + 'ForInStatement', + 'LabeledStatement', + 'WithStatement' + ], + 'no-unused-vars': [ + 0, + { + ignoreSiblings: true, + argsIgnorePattern: 'React|res|next|^_' + } + ], + 'prefer-const': [ + 'error', + { + destructuring: 'all' + } + ], + 'no-unused-expressions': [ + 2, + { + allowTaggedTemplates: true + } + ], + 'no-console': 1, + 'comma-dangle': 2, + 'jsx-quotes': [2, 'prefer-double'], + 'linebreak-style': ['error', 'unix'], + quotes: [ + 2, + 'single', + { + avoidEscape: true, + allowTemplateLiterals: true + } + ], + 'prettier/prettier': [ + 'error', + { + trailingComma: 'none', + singleQuote: true, + printWidth: 80 + } + ] + } +}; diff --git a/boilerplates/node-typescript/.gitignore b/boilerplates/node-typescript/.gitignore new file mode 100644 index 000000000..9cd5f4164 --- /dev/null +++ b/boilerplates/node-typescript/.gitignore @@ -0,0 +1,50 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# dist +dist +mjs +main +module + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Editors +.idea + +# Lib +lib + +# npm package lock +package-lock.json +yarn.lock + +# others +.DS_Store \ No newline at end of file diff --git a/boilerplates/node-typescript/.npmignore b/boilerplates/node-typescript/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/boilerplates/node-typescript/.npmignore @@ -0,0 +1,32 @@ +*.log +npm-debug.log* + +# Coverage directory used by tools like istanbul +coverage +.nyc_output + +# Dependency directories +node_modules + +# npm package lock +package-lock.json +yarn.lock + +# project files +__fixtures__ +__tests__ +.babelrc +.babelrc.js +.editorconfig +.eslintignore +.eslintrc +.eslintrc.js +.gitignore +.travis.yml +.vscode +CHANGELOG.md +examples +jest.config.js +package.json +src +test \ No newline at end of file diff --git a/boilerplates/node-typescript/.npmrc b/boilerplates/node-typescript/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/boilerplates/node-typescript/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/boilerplates/node-typescript/.questions.json b/boilerplates/node-typescript/.questions.json new file mode 100644 index 000000000..c1549e7cc --- /dev/null +++ b/boilerplates/node-typescript/.questions.json @@ -0,0 +1,37 @@ +[ + { + "name": "__USERFULLNAME__", + "message": "Enter author full name", + "required": true + }, + { + "name": "__USEREMAIL__", + "message": "Enter author email", + "required": true + }, + { + "name": "__MODULENAME__", + "message": "Enter the module name", + "required": true + }, + { + "name": "__MODULEDESC__", + "message": "Enter the module description", + "required": true + }, + { + "name": "__USERNAME__", + "message": "Enter your github username", + "required": true + }, + { + "name": "__ACCESS__", + "message": "Module access?", + "choices": [ + "public", + "restricted" + ], + "type": "list", + "required": true + } +] \ No newline at end of file diff --git a/boilerplates/node-typescript/.vscode/settings.json b/boilerplates/node-typescript/.vscode/settings.json new file mode 100644 index 000000000..55c8b9bba --- /dev/null +++ b/boilerplates/node-typescript/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "[javascriptreact]": { + "editor.formatOnSave": false + }, + "[javascript]": { + "editor.formatOnSave": false + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "eslint.validate": [ + "javascript", + "javascriptreact" + ] + } \ No newline at end of file diff --git a/boilerplates/node-typescript/LICENSE b/boilerplates/node-typescript/LICENSE new file mode 100644 index 000000000..78191bf06 --- /dev/null +++ b/boilerplates/node-typescript/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 __USERFULLNAME__ <__USEREMAIL__> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/boilerplates/node-typescript/README.md b/boilerplates/node-typescript/README.md new file mode 100644 index 000000000..ead684507 --- /dev/null +++ b/boilerplates/node-typescript/README.md @@ -0,0 +1,60 @@ +# __MODULENAME__ + +

+
+ __MODULEDESC__ +

+ +## install + +```sh +npm install __MODULENAME__ +``` +## Table of contents + +- [__MODULENAME__](#__MODULENAME__) + - [Install](#install) + - [Table of contents](#table-of-contents) +- [Developing](#developing) +- [Credits](#credits) + +## Developing + +When first cloning the repo: + +``` +yarn +yarn build +``` + +### Codegen + +Contract schemas live in `./contracts`. Look inside of `scripts/codegen.js` and configure the settings for bundling your SDK and contracts into `__MODULENAME__`: + +``` +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +``` +yarn build +yarn publish +``` +## Credits + +🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator) + +Code built with the help of these related projects: + +* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes +* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. +* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos ⚛️ + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code or software using the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/boilerplates/node-typescript/__tests__/contract.test.ts b/boilerplates/node-typescript/__tests__/contract.test.ts new file mode 100644 index 000000000..3f7425dd7 --- /dev/null +++ b/boilerplates/node-typescript/__tests__/contract.test.ts @@ -0,0 +1,3 @@ +it('it works', () => { + console.log('it works!') +}); \ No newline at end of file diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/LICENSE b/boilerplates/node-typescript/contracts/stargaze-minter/LICENSE new file mode 100644 index 000000000..edc7db470 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Public Awesome LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/README.md b/boilerplates/node-typescript/contracts/stargaze-minter/README.md new file mode 100644 index 000000000..da81535ac --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/README.md @@ -0,0 +1 @@ +# Stargaze minter \ No newline at end of file diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/package.json b/boilerplates/node-typescript/contracts/stargaze-minter/package.json new file mode 100644 index 000000000..52a2c328a --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/package.json @@ -0,0 +1,21 @@ +{ + "name": "@cosmjson/stargaze-minter", + "chain": "stargaze", + "contract": "minter", + "version": "0.0.7", + "description": "stargaze", + "author": "Dan Lynch ", + "homepage": "https://github.com/cosmology-tech/cosmjson/tree/master/packages/stargaze#readme", + "license": "SEE LICENSE IN LICENSE", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/cosmjson" + }, + "bugs": { + "url": "https://github.com/cosmology-tech/cosmjson/issues" + }, + "gitHead": "2d1a7b9aa6c3ac7596dbea4211180fd5c7235513" +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/config.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/config.json new file mode 100644 index 000000000..e64ef338f --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/config.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "type": "object", + "required": [ + "admin", + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_code_id", + "start_time", + "unit_price" + ], + "properties": { + "admin": { + "$ref": "#/definitions/Addr" + }, + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/config_response.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/config_response.json new file mode 100644 index 000000000..b400751e2 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/config_response.json @@ -0,0 +1,86 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "admin", + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_address", + "sg721_code_id", + "start_time", + "unit_price" + ], + "properties": { + "admin": { + "type": "string" + }, + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_address": { + "type": "string" + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/execute_msg.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/execute_msg.json new file mode 100644 index 000000000..e0763c569 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/execute_msg.json @@ -0,0 +1,144 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_whitelist" + ], + "properties": { + "set_whitelist": { + "type": "object", + "required": [ + "whitelist" + ], + "properties": { + "whitelist": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_start_time" + ], + "properties": { + "update_start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_per_address_limit" + ], + "properties": { + "update_per_address_limit": { + "type": "object", + "required": [ + "per_address_limit" + ], + "properties": { + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_to" + ], + "properties": { + "mint_to": { + "type": "object", + "required": [ + "recipient" + ], + "properties": { + "recipient": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_for" + ], + "properties": { + "mint_for": { + "type": "object", + "required": [ + "recipient", + "token_id" + ], + "properties": { + "recipient": { + "type": "string" + }, + "token_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw" + ], + "properties": { + "withdraw": { + "type": "object" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/instantiate_msg.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/instantiate_msg.json new file mode 100644 index 000000000..a618033d4 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/instantiate_msg.json @@ -0,0 +1,159 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_code_id", + "sg721_instantiate_msg", + "start_time", + "unit_price" + ], + "properties": { + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "sg721_instantiate_msg": { + "$ref": "#/definitions/InstantiateMsg" + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CollectionInfo_for_RoyaltyInfoResponse": { + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "InstantiateMsg": { + "type": "object", + "required": [ + "collection_info", + "minter", + "name", + "symbol" + ], + "properties": { + "collection_info": { + "$ref": "#/definitions/CollectionInfo_for_RoyaltyInfoResponse" + }, + "minter": { + "type": "string" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + } + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_count_response.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_count_response.json new file mode 100644 index 000000000..dd7edbe67 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_count_response.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintCountResponse", + "type": "object", + "required": [ + "address", + "count" + ], + "properties": { + "address": { + "type": "string" + }, + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_price_response.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_price_response.json new file mode 100644 index 000000000..628d25e44 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mint_price_response.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintPriceResponse", + "type": "object", + "required": [ + "current_price", + "public_price" + ], + "properties": { + "current_price": { + "$ref": "#/definitions/Coin" + }, + "public_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/mintable_num_tokens_response.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mintable_num_tokens_response.json new file mode 100644 index 000000000..05a378f15 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/mintable_num_tokens_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintableNumTokensResponse", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/query_msg.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/query_msg.json new file mode 100644 index 000000000..c97025f73 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/query_msg.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mintable_num_tokens" + ], + "properties": { + "mintable_num_tokens": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_price" + ], + "properties": { + "mint_price": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_count" + ], + "properties": { + "mint_count": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] +} diff --git a/boilerplates/node-typescript/contracts/stargaze-minter/schema/start_time_response.json b/boilerplates/node-typescript/contracts/stargaze-minter/schema/start_time_response.json new file mode 100644 index 000000000..3dd3fe89f --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-minter/schema/start_time_response.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StartTimeResponse", + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/LICENSE b/boilerplates/node-typescript/contracts/stargaze-sg721/LICENSE new file mode 100644 index 000000000..edc7db470 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Public Awesome LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/README.md b/boilerplates/node-typescript/contracts/stargaze-sg721/README.md new file mode 100644 index 000000000..872489dfb --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/README.md @@ -0,0 +1 @@ +# Stargaze sg721 \ No newline at end of file diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/package.json b/boilerplates/node-typescript/contracts/stargaze-sg721/package.json new file mode 100644 index 000000000..8a8165d3c --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/package.json @@ -0,0 +1,21 @@ +{ + "name": "@cosmjson/stargaze-sg721", + "chain": "stargaze", + "contract": "sg721", + "version": "0.0.7", + "description": "stargaze", + "author": "Dan Lynch ", + "homepage": "https://github.com/cosmology-tech/cosmjson/tree/master/packages/stargaze#readme", + "license": "SEE LICENSE IN LICENSE", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/cosmjson" + }, + "bugs": { + "url": "https://github.com/cosmology-tech/cosmjson/issues" + }, + "gitHead": "2d1a7b9aa6c3ac7596dbea4211180fd5c7235513" +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_nft_info_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_nft_info_response.json new file mode 100644 index 000000000..930dadd44 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_nft_info_response.json @@ -0,0 +1,155 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllNftInfoResponse", + "type": "object", + "required": [ + "access", + "info" + ], + "properties": { + "access": { + "description": "Who can transfer the token", + "allOf": [ + { + "$ref": "#/definitions/OwnerOfResponse" + } + ] + }, + "info": { + "description": "Data on the token itself,", + "allOf": [ + { + "$ref": "#/definitions/NftInfoResponse_for_Empty" + } + ] + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "NftInfoResponse_for_Empty": { + "type": "object", + "required": [ + "extension" + ], + "properties": { + "extension": { + "description": "You can add any custom metadata here when you extend cw721-base", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + } + }, + "OwnerOfResponse": { + "type": "object", + "required": [ + "approvals", + "owner" + ], + "properties": { + "approvals": { + "description": "If set this address is approved to transfer/send the token as well", + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + }, + "owner": { + "description": "Owner of the token", + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_operators_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_operators_response.json new file mode 100644 index 000000000..9d4d7bd7d --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_operators_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllOperatorsResponse", + "type": "object", + "required": [ + "operators" + ], + "properties": { + "operators": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_tokens_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_tokens_response.json new file mode 100644 index 000000000..22bf5bfd3 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/all_tokens_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllTokensResponse", + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.", + "type": "array", + "items": { + "type": "string" + } + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approval_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approval_response.json new file mode 100644 index 000000000..4f45b42e9 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approval_response.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ApprovalResponse", + "type": "object", + "required": [ + "approval" + ], + "properties": { + "approval": { + "$ref": "#/definitions/Approval" + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approvals_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approvals_response.json new file mode 100644 index 000000000..8d8e39ea0 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/approvals_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ApprovalsResponse", + "type": "object", + "required": [ + "approvals" + ], + "properties": { + "approvals": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/binary.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/binary.json new file mode 100644 index 000000000..10b45584f --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/binary.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Binary", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "type": "string" +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/collection_info_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/collection_info_response.json new file mode 100644 index 000000000..d285d1113 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/collection_info_response.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CollectionInfoResponse", + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/contract_info_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/contract_info_response.json new file mode 100644 index 000000000..a16712589 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/contract_info_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractInfoResponse", + "type": "object", + "required": [ + "name", + "symbol" + ], + "properties": { + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/execute_msg_for__empty.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/execute_msg_for__empty.json new file mode 100644 index 000000000..de12218ad --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/execute_msg_for__empty.json @@ -0,0 +1,308 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg_for_Empty", + "description": "This is like Cw721ExecuteMsg but we add a Mint command for an owner to make this stand-alone. You will likely want to remove mint and use other control logic in any contract that inherits this.", + "oneOf": [ + { + "description": "Transfer is a base message to move a token to another account without triggering actions", + "type": "object", + "required": [ + "transfer_nft" + ], + "properties": { + "transfer_nft": { + "type": "object", + "required": [ + "recipient", + "token_id" + ], + "properties": { + "recipient": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Send is a base message to transfer a token to a contract and trigger an action on the receiving contract.", + "type": "object", + "required": [ + "send_nft" + ], + "properties": { + "send_nft": { + "type": "object", + "required": [ + "contract", + "msg", + "token_id" + ], + "properties": { + "contract": { + "type": "string" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Allows operator to transfer / send the token from the owner's account. If expiration is set, then this allowance has a time/height limit", + "type": "object", + "required": [ + "approve" + ], + "properties": { + "approve": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Remove previously granted Approval", + "type": "object", + "required": [ + "revoke" + ], + "properties": { + "revoke": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Allows operator to transfer / send any token from the owner's account. If expiration is set, then this allowance has a time/height limit", + "type": "object", + "required": [ + "approve_all" + ], + "properties": { + "approve_all": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "operator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Remove previously granted ApproveAll permission", + "type": "object", + "required": [ + "revoke_all" + ], + "properties": { + "revoke_all": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "operator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Mint a new NFT, can only be called by the contract minter", + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "$ref": "#/definitions/MintMsg_for_Empty" + } + }, + "additionalProperties": false + }, + { + "description": "Burn an NFT the sender has access to", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "type": "string" + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "MintMsg_for_Empty": { + "type": "object", + "required": [ + "extension", + "owner", + "token_id" + ], + "properties": { + "extension": { + "description": "Any custom extension used by this contract", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "owner": { + "description": "The owner of the newly minter NFT", + "type": "string" + }, + "token_id": { + "description": "Unique ID of the NFT", + "type": "string" + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/instantiate_msg.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/instantiate_msg.json new file mode 100644 index 000000000..fb28071b6 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/instantiate_msg.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "collection_info", + "minter", + "name", + "symbol" + ], + "properties": { + "collection_info": { + "$ref": "#/definitions/CollectionInfo_for_RoyaltyInfoResponse" + }, + "minter": { + "type": "string" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "definitions": { + "CollectionInfo_for_RoyaltyInfoResponse": { + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/minter_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/minter_response.json new file mode 100644 index 000000000..a20e0d767 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/minter_response.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MinterResponse", + "description": "Shows who can mint these tokens", + "type": "object", + "required": [ + "minter" + ], + "properties": { + "minter": { + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/nft_info_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/nft_info_response.json new file mode 100644 index 000000000..dbfef6713 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/nft_info_response.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NftInfoResponse", + "type": "object", + "required": [ + "extension" + ], + "properties": { + "extension": { + "description": "You can add any custom metadata here when you extend cw721-base", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/num_tokens_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/num_tokens_response.json new file mode 100644 index 000000000..4647c23aa --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/num_tokens_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumTokensResponse", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/operators_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/operators_response.json new file mode 100644 index 000000000..53703072c --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/operators_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OperatorsResponse", + "type": "object", + "required": [ + "operators" + ], + "properties": { + "operators": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/owner_of_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/owner_of_response.json new file mode 100644 index 000000000..1258d671f --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/owner_of_response.json @@ -0,0 +1,103 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OwnerOfResponse", + "type": "object", + "required": [ + "approvals", + "owner" + ], + "properties": { + "approvals": { + "description": "If set this address is approved to transfer/send the token as well", + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + }, + "owner": { + "description": "Owner of the token", + "type": "string" + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/query_msg.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/query_msg.json new file mode 100644 index 000000000..3cb271651 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/query_msg.json @@ -0,0 +1,284 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "owner_of" + ], + "properties": { + "owner_of": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "approval" + ], + "properties": { + "approval": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "approvals" + ], + "properties": { + "approvals": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_operators" + ], + "properties": { + "all_operators": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "num_tokens" + ], + "properties": { + "num_tokens": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "contract_info" + ], + "properties": { + "contract_info": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "nft_info" + ], + "properties": { + "nft_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_nft_info" + ], + "properties": { + "all_nft_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_tokens" + ], + "properties": { + "all_tokens": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "minter" + ], + "properties": { + "minter": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "collection_info" + ], + "properties": { + "collection_info": { + "type": "object" + } + }, + "additionalProperties": false + } + ] +} diff --git a/boilerplates/node-typescript/contracts/stargaze-sg721/schema/tokens_response.json b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/tokens_response.json new file mode 100644 index 000000000..b8e3d75b5 --- /dev/null +++ b/boilerplates/node-typescript/contracts/stargaze-sg721/schema/tokens_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokensResponse", + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.", + "type": "array", + "items": { + "type": "string" + } + } + } +} diff --git a/boilerplates/node-typescript/jest.config.cjs b/boilerplates/node-typescript/jest.config.cjs new file mode 100644 index 000000000..a58c252f8 --- /dev/null +++ b/boilerplates/node-typescript/jest.config.cjs @@ -0,0 +1,5 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node' +}; diff --git a/boilerplates/node-typescript/package.json b/boilerplates/node-typescript/package.json new file mode 100644 index 000000000..3e7eda1cc --- /dev/null +++ b/boilerplates/node-typescript/package.json @@ -0,0 +1,71 @@ +{ + "name": "__PACKAGE_IDENTIFIER__", + "version": "0.0.1", + "description": "__MODULEDESC__", + "author": "__USERFULLNAME__ <__USEREMAIL__>", + "homepage": "https://github.com/__USERNAME__/__MODULENAME__#readme", + "license": "SEE LICENSE IN LICENSE", + "type": "module", + "main": "dist/index.js", + "module": "dist/index.mjs", + "typings": "dist/index.d.ts", + "directories": { + "lib": "src" + }, + "files": [ + "dist", + "!CHANGELOG.md" + ], + "nodemonConfig": { + "ext": "js,json,ts,tsx" + }, + "scripts": { + "build:cjs": "yarn tsc -p tsconfig.json --outDir dist --module commonjs || true", + "build:mjs": "yarn tsc -p tsconfig.json --outDir mjs --module es2022 --declaration false || true", + "clean:mjs": "rimraf mjs", + "clean:dist": "rimraf dist", + "clean": "npm run clean:mjs && npm run clean:dist", + "build:rename": "publish-scripts --cmd rename --srcDir mjs --outDir dist --findExt js --replaceExt mjs --no-rmDir", + "build": "npm run clean && npm run build:cjs && npm run build:mjs && npm run build:rename", + "codegen": "node scripts/codegen.cjs", + "prepare": "npm run build", + "dev": "ts-node-esm ./src/index.ts", + "watch": "nodemon --exec \"yarn dev\"", + "lint": "eslint src --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:debug": "node --inspect node_modules/.bin/jest --runInBand" + }, + "publishConfig": { + "access": "__ACCESS__" + }, + "repository": { + "type": "git", + "url": "https://github.com/__USERNAME__/__MODULENAME__" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/__USERNAME__/__MODULENAME__/issues" + }, + "devDependencies": { + "@types/jest": "^29.5.3", + "cross-env": "^7.0.2", + "eslint": "8.45.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^5.0.0", + "jest": "^29.6.1", + "jest-in-case": "^1.0.2", + "nodemon": "^3.0.1", + "prettier": "^3.0.0", + "publish-scripts": "0.1.0", + "rimraf": "^5.0.0", + "ts-jest": "^29.1.0", + "ts-node": "^10.9.1", + "ts-node-dev": "^2.0.0", + "typescript": "^5.0.4" + }, + "dependencies": { + "@cosmjs/cosmwasm-stargate": "^0.31.0", + "@cosmwasm/ts-codegen": "^0.31.6" + } +} \ No newline at end of file diff --git a/boilerplates/node-typescript/scripts/codegen.cjs b/boilerplates/node-typescript/scripts/codegen.cjs new file mode 100644 index 000000000..af72c3f68 --- /dev/null +++ b/boilerplates/node-typescript/scripts/codegen.cjs @@ -0,0 +1,29 @@ +const codegen = require('@cosmwasm/ts-codegen').default; + +codegen({ + contracts: [ + { + name: 'SG721', + dir: './contracts/stargaze-sg721/schema' + }, + { + name: 'Minter', + dir: './contracts/stargaze-minter/schema' + } + ], + outPath: './src/', + options: { + bundle: { + bundleFile: 'index.ts', + scope: 'contracts' + }, + messageComposer: { + enabled: true + }, + useContractsHooks: { + enabled: false // if you enable this, add react! + } + } +}).then(() => { + console.log('✨ all done!'); +}); diff --git a/boilerplates/node-typescript/src/index.ts b/boilerplates/node-typescript/src/index.ts new file mode 100644 index 000000000..619fbdd60 --- /dev/null +++ b/boilerplates/node-typescript/src/index.ts @@ -0,0 +1 @@ +export { }; \ No newline at end of file diff --git a/boilerplates/node-typescript/tsconfig.json b/boilerplates/node-typescript/tsconfig.json new file mode 100644 index 000000000..6dd3cb22e --- /dev/null +++ b/boilerplates/node-typescript/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src", + "skipLibCheck": true, + "emitDeclarationOnly": false, + "declaration": true, + "esModuleInterop": true, + "target": "es2022", + "module": "es2022", + "lib": [ + "es2022", + "DOM" + ], + "sourceMap": true, + "isolatedModules": true, + "allowJs": true, + "downlevelIteration": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "jsx": "react" + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/boilerplates/telescope-module/.babelrc.js b/boilerplates/telescope-module/.babelrc.js new file mode 100644 index 000000000..4a9557f27 --- /dev/null +++ b/boilerplates/telescope-module/.babelrc.js @@ -0,0 +1,17 @@ +const useESModules = !!process.env.MODULE; + +module.exports = (api) => { + api.cache(() => process.env.MODULE); + return { + plugins: [ + ['@babel/transform-runtime', { useESModules }], + '@babel/proposal-object-rest-spread', + '@babel/proposal-class-properties', + '@babel/plugin-proposal-nullish-coalescing-operator', + '@babel/plugin-proposal-optional-chaining', + '@babel/plugin-proposal-numeric-separator', + '@babel/proposal-export-default-from' + ], + presets: useESModules ? ['@babel/typescript'] : ['@babel/typescript', '@babel/env'] + }; +}; diff --git a/boilerplates/telescope-module/.editorconfig b/boilerplates/telescope-module/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/boilerplates/telescope-module/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/boilerplates/telescope-module/.eslintignore b/boilerplates/telescope-module/.eslintignore new file mode 100644 index 000000000..38ba48499 --- /dev/null +++ b/boilerplates/telescope-module/.eslintignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ \ No newline at end of file diff --git a/boilerplates/telescope-module/.eslintrc.js b/boilerplates/telescope-module/.eslintrc.js new file mode 100644 index 000000000..2718e8bc4 --- /dev/null +++ b/boilerplates/telescope-module/.eslintrc.js @@ -0,0 +1,71 @@ +module.exports = { + plugins: ['prettier'], + extends: ['eslint:recommended', 'prettier'], + parser: '@babel/eslint-parser', + parserOptions: { + ecmaVersion: 11, + requireConfigFile: false, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + env: { + es6: true, + browser: true, + node: true, + jest: true + }, + rules: { + 'no-debugger': 2, + 'no-alert': 2, + 'no-await-in-loop': 0, + 'no-prototype-builtins': 0, + 'no-return-assign': ['error', 'except-parens'], + 'no-restricted-syntax': [ + 2, + 'ForInStatement', + 'LabeledStatement', + 'WithStatement' + ], + 'no-unused-vars': [ + 0, + { + ignoreSiblings: true, + argsIgnorePattern: 'React|res|next|^_' + } + ], + 'prefer-const': [ + 'error', + { + destructuring: 'all' + } + ], + 'no-unused-expressions': [ + 2, + { + allowTaggedTemplates: true + } + ], + 'no-console': 1, + 'comma-dangle': 2, + 'jsx-quotes': [2, 'prefer-double'], + 'linebreak-style': ['error', 'unix'], + quotes: [ + 2, + 'single', + { + avoidEscape: true, + allowTemplateLiterals: true + } + ], + 'prettier/prettier': [ + 'error', + { + trailingComma: 'none', + singleQuote: true, + printWidth: 80 + } + ] + } +}; diff --git a/boilerplates/telescope-module/.gitignore b/boilerplates/telescope-module/.gitignore new file mode 100644 index 000000000..7bba65cc8 --- /dev/null +++ b/boilerplates/telescope-module/.gitignore @@ -0,0 +1,50 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# out +dist +mjs +main +module + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Editors +.idea + +# Lib +lib + +# npm package lock +package-lock.json +yarn.lock + +# others +.DS_Store \ No newline at end of file diff --git a/boilerplates/telescope-module/.npmignore b/boilerplates/telescope-module/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/boilerplates/telescope-module/.npmignore @@ -0,0 +1,32 @@ +*.log +npm-debug.log* + +# Coverage directory used by tools like istanbul +coverage +.nyc_output + +# Dependency directories +node_modules + +# npm package lock +package-lock.json +yarn.lock + +# project files +__fixtures__ +__tests__ +.babelrc +.babelrc.js +.editorconfig +.eslintignore +.eslintrc +.eslintrc.js +.gitignore +.travis.yml +.vscode +CHANGELOG.md +examples +jest.config.js +package.json +src +test \ No newline at end of file diff --git a/boilerplates/telescope-module/.npmrc b/boilerplates/telescope-module/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/boilerplates/telescope-module/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/boilerplates/telescope-module/.questions.json b/boilerplates/telescope-module/.questions.json new file mode 100644 index 000000000..97662fb62 --- /dev/null +++ b/boilerplates/telescope-module/.questions.json @@ -0,0 +1,42 @@ +[ + { + "name": "__CHAINNAME__", + "message": "Enter chain name in all lowercase, e.g. osmosis", + "required": true + }, + { + "name": "__USERFULLNAME__", + "message": "Enter author full name", + "required": true + }, + { + "name": "__USEREMAIL__", + "message": "Enter author email", + "required": true + }, + { + "name": "__MODULENAME__", + "message": "Enter the module name", + "required": true + }, + { + "name": "__MODULEDESC__", + "message": "Enter the module description", + "required": true + }, + { + "name": "__USERNAME__", + "message": "Enter your github username", + "required": true + }, + { + "name": "__ACCESS__", + "message": "Module access?", + "choices": [ + "public", + "restricted" + ], + "type": "list", + "required": true + } +] \ No newline at end of file diff --git a/boilerplates/telescope-module/.vscode/settings.json b/boilerplates/telescope-module/.vscode/settings.json new file mode 100644 index 000000000..55c8b9bba --- /dev/null +++ b/boilerplates/telescope-module/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "[javascriptreact]": { + "editor.formatOnSave": false + }, + "[javascript]": { + "editor.formatOnSave": false + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "eslint.validate": [ + "javascript", + "javascriptreact" + ] + } \ No newline at end of file diff --git a/boilerplates/telescope-module/LICENSE b/boilerplates/telescope-module/LICENSE new file mode 100644 index 000000000..78191bf06 --- /dev/null +++ b/boilerplates/telescope-module/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 __USERFULLNAME__ <__USEREMAIL__> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/boilerplates/telescope-module/README.md b/boilerplates/telescope-module/README.md new file mode 100644 index 000000000..fe98ea8a8 --- /dev/null +++ b/boilerplates/telescope-module/README.md @@ -0,0 +1,290 @@ +# __MODULENAME__ + +

+
+ __MODULEDESC__ +

+ + +## install + +```sh +npm install __MODULENAME__ +``` +## Table of contents + +- [__MODULENAME__](#__MODULENAME__) + - [Install](#install) + - [Table of contents](#table-of-contents) +- [Usage](#usage) + - [RPC Clients](#rpc-clients) + - [Composing Messages](#composing-messages) + - Cosmos, CosmWasm, and IBC + - [CosmWasm](#cosmwasm-messages) + - [IBC](#ibc-messages) + - [Cosmos](#cosmos-messages) +- [Wallets and Signers](#connecting-with-wallets-and-signing-messages) + - [Stargate Client](#initializing-the-stargate-client) + - [Creating Signers](#creating-signers) + - [Broadcasting Messages](#broadcasting-messages) +- [Advanced Usage](#advanced-usage) +- [Developing](#developing) +- [Credits](#credits) + +## Usage +### RPC Clients + +```js +import { __CHAINNAME__ } from '__MODULENAME__'; + +const { createRPCQueryClient } = __CHAINNAME__.ClientFactory; +const client = await createRPCQueryClient({ rpcEndpoint: RPC_ENDPOINT }); + +// now you can query the cosmos modules +const balance = await client.cosmos.bank.v1beta1 + .allBalances({ address: '__CHAINNAME__1addresshere' }); + +// you can also query the __CHAINNAME__ modules +const balances = await client.__CHAINNAME__.exchange.v1beta1 + .exchangeBalances() +``` + +### Composing Messages + +Import the `__CHAINNAME__` object from `__MODULENAME__`. + +```js +import { __CHAINNAME__ } from '__MODULENAME__'; + +const { + createSpotLimitOrder, + createSpotMarketOrder, + deposit +} = __CHAINNAME__.exchange.v1beta1.MessageComposer.withTypeUrl; +``` + +#### CosmWasm Messages + +```js +import { cosmwasm } from "__MODULENAME__"; + +const { + clearAdmin, + executeContract, + instantiateContract, + migrateContract, + storeCode, + updateAdmin +} = cosmwasm.wasm.v1.MessageComposer.withTypeUrl; +``` + +#### IBC Messages + +```js +import { ibc } from '__MODULENAME__'; + +const { + transfer +} = ibc.applications.transfer.v1.MessageComposer.withTypeUrl +``` + +#### Cosmos Messages + +```js +import { cosmos } from '__MODULENAME__'; + +const { + fundCommunityPool, + setWithdrawAddress, + withdrawDelegatorReward, + withdrawValidatorCommission +} = cosmos.distribution.v1beta1.MessageComposer.fromPartial; + +const { + multiSend, + send +} = cosmos.bank.v1beta1.MessageComposer.fromPartial; + +const { + beginRedelegate, + createValidator, + delegate, + editValidator, + undelegate +} = cosmos.staking.v1beta1.MessageComposer.fromPartial; + +const { + deposit, + submitProposal, + vote, + voteWeighted +} = cosmos.gov.v1beta1.MessageComposer.fromPartial; +``` + +## Connecting with Wallets and Signing Messages + +⚡️ For web interfaces, we recommend using [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit). Continue below to see how to manually construct signers and clients. + +Here are the docs on [creating signers](https://github.com/cosmology-tech/cosmos-kit/tree/main/packages/react#signing-clients) in cosmos-kit that can be used with Keplr and other wallets. + +### Initializing the Stargate Client + +Use `getSigning__CHAINNAME__Client` to get your `SigningStargateClient`, with the proto/amino messages full-loaded. No need to manually add amino types, just require and initialize the client: + +```js +import { getSigning__CHAINNAME__Client } from '__MODULENAME__'; + +const stargateClient = await getSigning__CHAINNAME__Client({ + rpcEndpoint, + signer // OfflineSigner +}); +``` +### Creating Signers + +To broadcast messages, you can create signers with a variety of options: + +* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit/tree/main/packages/react#signing-clients) (recommended) +* [keplr](https://docs.keplr.app/api/cosmjs.html) +* [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9) +### Amino Signer + +Likely you'll want to use the Amino, so unless you need proto, you should use this one: + +```js +import { getOfflineSignerAmino as getOfflineSigner } from 'cosmjs-utils'; +``` +### Proto Signer + +```js +import { getOfflineSignerProto as getOfflineSigner } from 'cosmjs-utils'; +``` + +WARNING: NOT RECOMMENDED TO USE PLAIN-TEXT MNEMONICS. Please take care of your security and use best practices such as AES encryption and/or methods from 12factor applications. + +```js +import { chains } from 'chain-registry'; + +const mnemonic = + 'unfold client turtle either pilot stock floor glow toward bullet car science'; + const chain = chains.find(({ chain_name }) => chain_name === '__CHAINNAME__'); + const signer = await getOfflineSigner({ + mnemonic, + chain + }); +``` +### Broadcasting Messages + +Now that you have your `stargateClient`, you can broadcast messages: + +```js +const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl; + +const msg = send({ + amount: [ + { + denom: 'coin', + amount: '1000' + } + ], + toAddress: address, + fromAddress: address +}); + +const fee: StdFee = { + amount: [ + { + denom: 'coin', + amount: '864' + } + ], + gas: '86364' +}; +const response = await stargateClient.signAndBroadcast(address, [msg], fee); +``` + +## Advanced Usage + + +If you want to manually construct a stargate client + +```js +import { OfflineSigner, GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; + +import { + cosmosAminoConverters, + cosmosProtoRegistry, + cosmwasmAminoConverters, + cosmwasmProtoRegistry, + ibcProtoRegistry, + ibcAminoConverters, + __CHAINNAME__AminoConverters, + __CHAINNAME__ProtoRegistry +} from '__MODULENAME__'; + +const signer: OfflineSigner = /* create your signer (see above) */ +const rpcEndpint = 'https://rpc.cosmos.directory/__CHAINNAME__'; // or another URL + +const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosProtoRegistry, + ...cosmwasmProtoRegistry, + ...ibcProtoRegistry, + ...__CHAINNAME__ProtoRegistry +]; + +const aminoConverters = { + ...cosmosAminoConverters, + ...cosmwasmAminoConverters, + ...ibcAminoConverters, + ...__CHAINNAME__AminoConverters +}; + +const registry = new Registry(protoRegistry); +const aminoTypes = new AminoTypes(aminoConverters); + +const stargateClient = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry, + aminoTypes +}); +``` + +## Developing + +When first cloning the repo: + +``` +yarn +yarn build +``` + +### Codegen + +Contract schemas live in `./contracts`, and protos in `./proto`. Look inside of `scripts/codegen.js` and configure the settings for bundling your SDK and contracts into `__MODULENAME__`: + +``` +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +``` +yarn build +yarn publish +``` +## Credits + +🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator) + +Code built with the help of these related projects: + +* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes +* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. +* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos ⚛️ + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code or software using the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/boilerplates/telescope-module/__tests__/messages.test.js b/boilerplates/telescope-module/__tests__/messages.test.js new file mode 100644 index 000000000..d92174610 --- /dev/null +++ b/boilerplates/telescope-module/__tests__/messages.test.js @@ -0,0 +1,43 @@ +import { coin } from '@cosmjs/amino'; +import { messages } from '../src/proto/osmosis/gamm/v1beta1/tx.messages'; +import { osmosis } from '../src/proto'; + +it('messages', async () => { + expect( + messages.joinPool({ + poolId: '606', + sender: 'osmo1f4vxvvvvvvvvvv3luuddddddddddcccccccccc', + shareOutAmount: '101010101', + tokenInMaxs: [ + coin( + 10248, + 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2' + ), + coin( + 64837969, + 'ibc/B9E0A1A524E98BB407D3CED8720EFEFD186002F90C1B1B7964811DD0CCC12228' + ) + ] + }) + ).toMatchSnapshot(); +}); + +it('messages.scoped', async () => { + expect( + osmosis.gamm.v1beta1.messages.joinPool({ + poolId: '606', + sender: 'osmo1f4vxvvvvvvvvvv3luuddddddddddcccccccccc', + shareOutAmount: '101010101', + tokenInMaxs: [ + coin( + 10248, + 'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2' + ), + coin( + 64837969, + 'ibc/B9E0A1A524E98BB407D3CED8720EFEFD186002F90C1B1B7964811DD0CCC12228' + ) + ] + }) + ).toMatchSnapshot(); +}); diff --git a/boilerplates/telescope-module/package.json b/boilerplates/telescope-module/package.json new file mode 100644 index 000000000..e283d72b4 --- /dev/null +++ b/boilerplates/telescope-module/package.json @@ -0,0 +1,83 @@ +{ + "name": "__PACKAGE_IDENTIFIER__", + "version": "0.0.1", + "description": "__MODULEDESC__", + "author": "__USERFULLNAME__ <__USEREMAIL__>", + "homepage": "https://github.com/__USERNAME__/__MODULENAME__#readme", + "license": "SEE LICENSE IN LICENSE", + "main": "dist/index.js", + "module": "dist/index.mjs", + "typings": "dist/index.d.ts", + "directories": { + "lib": "src" + }, + "files": [ + "dist", + "!CHANGELOG.md" + ], + "scripts": { + "build:cjs": "yarn tsc -p tsconfig.json --outDir dist --module commonjs || true", + "build:mjs": "yarn tsc -p tsconfig.json --outDir mjs --module es2022 --declaration false || true", + "clean:mjs": "rimraf mjs", + "clean:dist": "rimraf dist", + "clean": "npm run clean:mjs && npm run clean:dist", + "build:rename": "publish-scripts --cmd rename --srcDir mjs --outDir dist --findExt js --replaceExt mjs --no-rmDir", + "build": "npm run clean && npm run build:cjs && npm run build:mjs && npm run build:rename", + "codegen": "node scripts/codegen.js", + "prepare": "npm run build", + "dev": "cross-env NODE_ENV=development babel-node src/index --extensions \".tsx,.ts,.js\"", + "watch": "cross-env NODE_ENV=development babel-watch src/index --extensions \".tsx,.ts,.js\"", + "lint": "eslint src --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:debug": "node --inspect node_modules/.bin/jest --runInBand" + }, + "publishConfig": { + "access": "__ACCESS__" + }, + "repository": { + "type": "git", + "url": "https://github.com/__USERNAME__/__MODULENAME__" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/__USERNAME__/__MODULENAME__/issues" + }, + "devDependencies": { + "@babel/cli": "7.22.9", + "@babel/core": "7.22.9", + "@babel/eslint-parser": "^7.21.3", + "@babel/node": "^7.20.7", + "@babel/plugin-proposal-class-properties": "7.18.6", + "@babel/plugin-proposal-export-default-from": "7.22.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6", + "@babel/plugin-proposal-numeric-separator": "7.18.6", + "@babel/plugin-proposal-object-rest-spread": "7.20.7", + "@babel/plugin-proposal-optional-chaining": "7.21.0", + "@babel/plugin-transform-runtime": "7.22.9", + "@babel/preset-env": "7.22.9", + "@babel/preset-typescript": "^7.21.4", + "@osmonauts/telescope": "^0.99.12", + "@types/jest": "^29.5.0", + "babel-core": "7.0.0-bridge.0", + "babel-jest": "29.6.1", + "babel-watch": "^7.7.2", + "cross-env": "^7.0.2", + "eslint": "8.45.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^4.2.1", + "jest": "^29.5.0", + "jest-in-case": "^1.0.2", + "prettier": "^2.8.7", + "publish-scripts": "0.1.0", + "rimraf": "^5.0.0", + "ts-jest": "^29.1.0", + "typescript": "^5.0.4" + }, + "dependencies": { + "@cosmjs/amino": "0.29.4", + "@cosmjs/proto-signing": "0.29.4", + "@cosmjs/stargate": "0.29.4", + "@cosmjs/tendermint-rpc": "^0.29.4" + } +} \ No newline at end of file diff --git a/boilerplates/telescope-module/scripts/aminos.js b/boilerplates/telescope-module/scripts/aminos.js new file mode 100644 index 000000000..fe7aee16c --- /dev/null +++ b/boilerplates/telescope-module/scripts/aminos.js @@ -0,0 +1,29 @@ +module.exports.AMINO_MAP = { + // PUT YOUR AMINO names here... + // Staking + // '/cosmos.staking.v1beta1.MsgCreateValidator': { + // aminoType: 'cosmos-sdk/MsgCreateValidator' + // }, + // '/cosmos.staking.v1beta1.MsgEditValidator': { + // aminoType: 'cosmos-sdk/MsgEditValidator' + // }, + // '/cosmos.staking.v1beta1.MsgDelegate': { + // aminoType: 'cosmos-sdk/MsgDelegate' + // }, + // '/cosmos.staking.v1beta1.MsgUndelegate': { + // aminoType: 'cosmos-sdk/MsgUndelegate' + // }, + // '/cosmos.staking.v1beta1.MsgBeginRedelegate': { + // aminoType: 'cosmos-sdk/MsgBeginRedelegate' + // }, + // '/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation': { + // aminoType: 'cosmos-sdk/MsgCancelUnbondingDelegation' + // }, + // '/cosmos.staking.v1beta1.MsgUpdateParams': { + // aminoType: 'cosmos-sdk/x/staking/MsgUpdateParams' + // }, + // // IBC + // '/ibc.applications.transfer.v1.MsgTransfer': { + // aminoType: 'cosmos-sdk/MsgTransfer' + // } +}; diff --git a/boilerplates/telescope-module/scripts/codegen.js b/boilerplates/telescope-module/scripts/codegen.js new file mode 100644 index 000000000..4becc1b88 --- /dev/null +++ b/boilerplates/telescope-module/scripts/codegen.js @@ -0,0 +1,107 @@ +const { join } = require('path'); +const telescope = require('@osmonauts/telescope').default; +const rimraf = require('rimraf').rimrafSync; +const { AMINO_MAP } = require('./aminos'); + +const protoDirs = [join(__dirname, '/../proto')]; +const outPath = join(__dirname, '../src/codegen'); +rimraf(outPath); + +telescope({ + protoDirs, + outPath, + options: { + tsDisable: { + files: [ + 'cosmos/authz/v1beta1/tx.amino.ts', + 'cosmos/staking/v1beta1/tx.amino.ts' + ], + patterns: ['**/*amino.ts', '**/*registry.ts'] + }, + prototypes: { + includePackageVar: false, + removeUnusedImports: true, + experimentalGlobalProtoNamespace: true, + interfaces: { + enabled: true, + useUnionTypes: false + }, + excluded: { + packages: [ + // 'ibc.applications.fee.v1', + + 'cosmos.app.v1alpha1', + 'cosmos.app.v1beta1', + 'cosmos.autocli.v1', + 'cosmos.base.kv.v1beta1', + 'cosmos.base.reflection.v1beta1', + 'cosmos.base.snapshots.v1beta1', + 'cosmos.base.store.v1beta1', + 'cosmos.base.tendermint.v1beta1', + 'cosmos.capability.v1beta1', + 'cosmos.crisis.v1beta1', + 'cosmos.evidence.v1beta1', + 'cosmos.feegrant.v1beta1', + 'cosmos.genutil.v1beta1', + 'cosmos.gov.v1', + 'cosmos.group.v1', + 'cosmos.group.v1beta1', + 'cosmos.mint.v1beta1', + 'cosmos.msg.v1', + 'cosmos.nft.v1beta1', + 'cosmos.orm.v1', + 'cosmos.orm.v1alpha1', + 'cosmos.params.v1beta1', + 'cosmos.slashing.v1beta1', + 'cosmos.vesting.v1beta1', + // 'google.api', + 'ibc.core.port.v1', + 'ibc.core.types.v1' + ] + }, + methods: { + fromJSON: false, + toJSON: false, + encode: true, + decode: true, + fromPartial: true, + toAmino: true, + fromAmino: true, + fromProto: true, + toProto: true + }, + parser: { + keepCase: false + } + }, + typingsFormat: { + duration: 'duration', + timestamp: 'date', + useExact: false, + useDeepPartial: false, + num64: 'bigint', + customTypes: { + useCosmosSDKDec: true + } + }, + aminoEncoding: { + enabled: true, + exceptions: AMINO_MAP, + useRecursiveV2encoding: true + }, + lcdClients: { + enabled: false + }, + rpcClients: { + enabled: true, + camelCase: true + } + } +}) + .then(() => { + console.log('✨ all done!'); + }) + .catch((e) => { + console.error(e); + process.exit(1); + }); diff --git a/boilerplates/telescope-module/src/index.ts b/boilerplates/telescope-module/src/index.ts new file mode 100644 index 000000000..646541b59 --- /dev/null +++ b/boilerplates/telescope-module/src/index.ts @@ -0,0 +1 @@ +export * from './codegen'; diff --git a/boilerplates/telescope-module/tsconfig.json b/boilerplates/telescope-module/tsconfig.json new file mode 100644 index 000000000..38eee4ccf --- /dev/null +++ b/boilerplates/telescope-module/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src", + "skipLibCheck": true, + "emitDeclarationOnly": false, + "declaration": true, + "esModuleInterop": true, + "target": "es2022", + "module": "es2022", + "lib": [ + "es2022", + "DOM" + ], + "sourceMap": true, + "isolatedModules": true, + "allowJs": true, + "downlevelIteration": true, + "moduleResolution": "node", + "resolveJsonModule": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.editorconfig b/boilerplates/ts-codegen-module/.editorconfig new file mode 100644 index 000000000..4a7ea3036 --- /dev/null +++ b/boilerplates/ts-codegen-module/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/boilerplates/ts-codegen-module/.eslintignore b/boilerplates/ts-codegen-module/.eslintignore new file mode 100644 index 000000000..38ba48499 --- /dev/null +++ b/boilerplates/ts-codegen-module/.eslintignore @@ -0,0 +1,5 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.eslintrc.js b/boilerplates/ts-codegen-module/.eslintrc.js new file mode 100644 index 000000000..2718e8bc4 --- /dev/null +++ b/boilerplates/ts-codegen-module/.eslintrc.js @@ -0,0 +1,71 @@ +module.exports = { + plugins: ['prettier'], + extends: ['eslint:recommended', 'prettier'], + parser: '@babel/eslint-parser', + parserOptions: { + ecmaVersion: 11, + requireConfigFile: false, + sourceType: 'module', + ecmaFeatures: { + jsx: true + } + }, + env: { + es6: true, + browser: true, + node: true, + jest: true + }, + rules: { + 'no-debugger': 2, + 'no-alert': 2, + 'no-await-in-loop': 0, + 'no-prototype-builtins': 0, + 'no-return-assign': ['error', 'except-parens'], + 'no-restricted-syntax': [ + 2, + 'ForInStatement', + 'LabeledStatement', + 'WithStatement' + ], + 'no-unused-vars': [ + 0, + { + ignoreSiblings: true, + argsIgnorePattern: 'React|res|next|^_' + } + ], + 'prefer-const': [ + 'error', + { + destructuring: 'all' + } + ], + 'no-unused-expressions': [ + 2, + { + allowTaggedTemplates: true + } + ], + 'no-console': 1, + 'comma-dangle': 2, + 'jsx-quotes': [2, 'prefer-double'], + 'linebreak-style': ['error', 'unix'], + quotes: [ + 2, + 'single', + { + avoidEscape: true, + allowTemplateLiterals: true + } + ], + 'prettier/prettier': [ + 'error', + { + trailingComma: 'none', + singleQuote: true, + printWidth: 80 + } + ] + } +}; diff --git a/boilerplates/ts-codegen-module/.gitignore b/boilerplates/ts-codegen-module/.gitignore new file mode 100644 index 000000000..9cd5f4164 --- /dev/null +++ b/boilerplates/ts-codegen-module/.gitignore @@ -0,0 +1,50 @@ +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# dist +dist +mjs +main +module + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + +# Editors +.idea + +# Lib +lib + +# npm package lock +package-lock.json +yarn.lock + +# others +.DS_Store \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.npmignore b/boilerplates/ts-codegen-module/.npmignore new file mode 100644 index 000000000..cc2605fa8 --- /dev/null +++ b/boilerplates/ts-codegen-module/.npmignore @@ -0,0 +1,32 @@ +*.log +npm-debug.log* + +# Coverage directory used by tools like istanbul +coverage +.nyc_output + +# Dependency directories +node_modules + +# npm package lock +package-lock.json +yarn.lock + +# project files +__fixtures__ +__tests__ +.babelrc +.babelrc.js +.editorconfig +.eslintignore +.eslintrc +.eslintrc.js +.gitignore +.travis.yml +.vscode +CHANGELOG.md +examples +jest.config.js +package.json +src +test \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.npmrc b/boilerplates/ts-codegen-module/.npmrc new file mode 100644 index 000000000..a21347f1b --- /dev/null +++ b/boilerplates/ts-codegen-module/.npmrc @@ -0,0 +1 @@ +scripts-prepend-node-path=true \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.questions.json b/boilerplates/ts-codegen-module/.questions.json new file mode 100644 index 000000000..c1549e7cc --- /dev/null +++ b/boilerplates/ts-codegen-module/.questions.json @@ -0,0 +1,37 @@ +[ + { + "name": "__USERFULLNAME__", + "message": "Enter author full name", + "required": true + }, + { + "name": "__USEREMAIL__", + "message": "Enter author email", + "required": true + }, + { + "name": "__MODULENAME__", + "message": "Enter the module name", + "required": true + }, + { + "name": "__MODULEDESC__", + "message": "Enter the module description", + "required": true + }, + { + "name": "__USERNAME__", + "message": "Enter your github username", + "required": true + }, + { + "name": "__ACCESS__", + "message": "Module access?", + "choices": [ + "public", + "restricted" + ], + "type": "list", + "required": true + } +] \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/.vscode/settings.json b/boilerplates/ts-codegen-module/.vscode/settings.json new file mode 100644 index 000000000..55c8b9bba --- /dev/null +++ b/boilerplates/ts-codegen-module/.vscode/settings.json @@ -0,0 +1,16 @@ +{ + "editor.formatOnSave": true, + "[javascriptreact]": { + "editor.formatOnSave": false + }, + "[javascript]": { + "editor.formatOnSave": false + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "eslint.validate": [ + "javascript", + "javascriptreact" + ] + } \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/LICENSE b/boilerplates/ts-codegen-module/LICENSE new file mode 100644 index 000000000..78191bf06 --- /dev/null +++ b/boilerplates/ts-codegen-module/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023 __USERFULLNAME__ <__USEREMAIL__> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/boilerplates/ts-codegen-module/README.md b/boilerplates/ts-codegen-module/README.md new file mode 100644 index 000000000..ead684507 --- /dev/null +++ b/boilerplates/ts-codegen-module/README.md @@ -0,0 +1,60 @@ +# __MODULENAME__ + +

+
+ __MODULEDESC__ +

+ +## install + +```sh +npm install __MODULENAME__ +``` +## Table of contents + +- [__MODULENAME__](#__MODULENAME__) + - [Install](#install) + - [Table of contents](#table-of-contents) +- [Developing](#developing) +- [Credits](#credits) + +## Developing + +When first cloning the repo: + +``` +yarn +yarn build +``` + +### Codegen + +Contract schemas live in `./contracts`. Look inside of `scripts/codegen.js` and configure the settings for bundling your SDK and contracts into `__MODULENAME__`: + +``` +yarn codegen +``` + +### Publishing + +Build the types and then publish: + +``` +yarn build +yarn publish +``` +## Credits + +🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator) + +Code built with the help of these related projects: + +* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes +* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. +* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos ⚛️ + +## Disclaimer + +AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND. + +No developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code or software using the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value. diff --git a/boilerplates/ts-codegen-module/__tests__/contract.test.ts b/boilerplates/ts-codegen-module/__tests__/contract.test.ts new file mode 100644 index 000000000..3f7425dd7 --- /dev/null +++ b/boilerplates/ts-codegen-module/__tests__/contract.test.ts @@ -0,0 +1,3 @@ +it('it works', () => { + console.log('it works!') +}); \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/LICENSE b/boilerplates/ts-codegen-module/contracts/stargaze-minter/LICENSE new file mode 100644 index 000000000..edc7db470 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Public Awesome LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/README.md b/boilerplates/ts-codegen-module/contracts/stargaze-minter/README.md new file mode 100644 index 000000000..da81535ac --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/README.md @@ -0,0 +1 @@ +# Stargaze minter \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/package.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/package.json new file mode 100644 index 000000000..52a2c328a --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/package.json @@ -0,0 +1,21 @@ +{ + "name": "@cosmjson/stargaze-minter", + "chain": "stargaze", + "contract": "minter", + "version": "0.0.7", + "description": "stargaze", + "author": "Dan Lynch ", + "homepage": "https://github.com/cosmology-tech/cosmjson/tree/master/packages/stargaze#readme", + "license": "SEE LICENSE IN LICENSE", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/cosmjson" + }, + "bugs": { + "url": "https://github.com/cosmology-tech/cosmjson/issues" + }, + "gitHead": "2d1a7b9aa6c3ac7596dbea4211180fd5c7235513" +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config.json new file mode 100644 index 000000000..e64ef338f --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config.json @@ -0,0 +1,90 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Config", + "type": "object", + "required": [ + "admin", + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_code_id", + "start_time", + "unit_price" + ], + "properties": { + "admin": { + "$ref": "#/definitions/Addr" + }, + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Addr": { + "description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.", + "type": "string" + }, + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config_response.json new file mode 100644 index 000000000..b400751e2 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/config_response.json @@ -0,0 +1,86 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "type": "object", + "required": [ + "admin", + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_address", + "sg721_code_id", + "start_time", + "unit_price" + ], + "properties": { + "admin": { + "type": "string" + }, + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_address": { + "type": "string" + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/execute_msg.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/execute_msg.json new file mode 100644 index 000000000..e0763c569 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/execute_msg.json @@ -0,0 +1,144 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "set_whitelist" + ], + "properties": { + "set_whitelist": { + "type": "object", + "required": [ + "whitelist" + ], + "properties": { + "whitelist": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_start_time" + ], + "properties": { + "update_start_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update_per_address_limit" + ], + "properties": { + "update_per_address_limit": { + "type": "object", + "required": [ + "per_address_limit" + ], + "properties": { + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_to" + ], + "properties": { + "mint_to": { + "type": "object", + "required": [ + "recipient" + ], + "properties": { + "recipient": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_for" + ], + "properties": { + "mint_for": { + "type": "object", + "required": [ + "recipient", + "token_id" + ], + "properties": { + "recipient": { + "type": "string" + }, + "token_id": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "withdraw" + ], + "properties": { + "withdraw": { + "type": "object" + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/instantiate_msg.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/instantiate_msg.json new file mode 100644 index 000000000..a618033d4 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/instantiate_msg.json @@ -0,0 +1,159 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "base_token_uri", + "num_tokens", + "per_address_limit", + "sg721_code_id", + "sg721_instantiate_msg", + "start_time", + "unit_price" + ], + "properties": { + "base_token_uri": { + "type": "string" + }, + "num_tokens": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "per_address_limit": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + }, + "sg721_code_id": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "sg721_instantiate_msg": { + "$ref": "#/definitions/InstantiateMsg" + }, + "start_time": { + "$ref": "#/definitions/Timestamp" + }, + "unit_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist": { + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "CollectionInfo_for_RoyaltyInfoResponse": { + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "InstantiateMsg": { + "type": "object", + "required": [ + "collection_info", + "minter", + "name", + "symbol" + ], + "properties": { + "collection_info": { + "$ref": "#/definitions/CollectionInfo_for_RoyaltyInfoResponse" + }, + "minter": { + "type": "string" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + } + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_count_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_count_response.json new file mode 100644 index 000000000..dd7edbe67 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_count_response.json @@ -0,0 +1,19 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintCountResponse", + "type": "object", + "required": [ + "address", + "count" + ], + "properties": { + "address": { + "type": "string" + }, + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_price_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_price_response.json new file mode 100644 index 000000000..628d25e44 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mint_price_response.json @@ -0,0 +1,48 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintPriceResponse", + "type": "object", + "required": [ + "current_price", + "public_price" + ], + "properties": { + "current_price": { + "$ref": "#/definitions/Coin" + }, + "public_price": { + "$ref": "#/definitions/Coin" + }, + "whitelist_price": { + "anyOf": [ + { + "$ref": "#/definitions/Coin" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Coin": { + "type": "object", + "required": [ + "amount", + "denom" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "denom": { + "type": "string" + } + } + }, + "Uint128": { + "description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mintable_num_tokens_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mintable_num_tokens_response.json new file mode 100644 index 000000000..05a378f15 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/mintable_num_tokens_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MintableNumTokensResponse", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/query_msg.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/query_msg.json new file mode 100644 index 000000000..c97025f73 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/query_msg.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mintable_num_tokens" + ], + "properties": { + "mintable_num_tokens": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_price" + ], + "properties": { + "mint_price": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "mint_count" + ], + "properties": { + "mint_count": { + "type": "object", + "required": [ + "address" + ], + "properties": { + "address": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ] +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/start_time_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/start_time_response.json new file mode 100644 index 000000000..3dd3fe89f --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-minter/schema/start_time_response.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "StartTimeResponse", + "type": "object", + "required": [ + "start_time" + ], + "properties": { + "start_time": { + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/LICENSE b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/LICENSE new file mode 100644 index 000000000..edc7db470 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2022 Public Awesome LLC + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/README.md b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/README.md new file mode 100644 index 000000000..872489dfb --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/README.md @@ -0,0 +1 @@ +# Stargaze sg721 \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/package.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/package.json new file mode 100644 index 000000000..8a8165d3c --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/package.json @@ -0,0 +1,21 @@ +{ + "name": "@cosmjson/stargaze-sg721", + "chain": "stargaze", + "contract": "sg721", + "version": "0.0.7", + "description": "stargaze", + "author": "Dan Lynch ", + "homepage": "https://github.com/cosmology-tech/cosmjson/tree/master/packages/stargaze#readme", + "license": "SEE LICENSE IN LICENSE", + "publishConfig": { + "access": "public" + }, + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/cosmjson" + }, + "bugs": { + "url": "https://github.com/cosmology-tech/cosmjson/issues" + }, + "gitHead": "2d1a7b9aa6c3ac7596dbea4211180fd5c7235513" +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_nft_info_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_nft_info_response.json new file mode 100644 index 000000000..930dadd44 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_nft_info_response.json @@ -0,0 +1,155 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllNftInfoResponse", + "type": "object", + "required": [ + "access", + "info" + ], + "properties": { + "access": { + "description": "Who can transfer the token", + "allOf": [ + { + "$ref": "#/definitions/OwnerOfResponse" + } + ] + }, + "info": { + "description": "Data on the token itself,", + "allOf": [ + { + "$ref": "#/definitions/NftInfoResponse_for_Empty" + } + ] + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "NftInfoResponse_for_Empty": { + "type": "object", + "required": [ + "extension" + ], + "properties": { + "extension": { + "description": "You can add any custom metadata here when you extend cw721-base", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + } + }, + "OwnerOfResponse": { + "type": "object", + "required": [ + "approvals", + "owner" + ], + "properties": { + "approvals": { + "description": "If set this address is approved to transfer/send the token as well", + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + }, + "owner": { + "description": "Owner of the token", + "type": "string" + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_operators_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_operators_response.json new file mode 100644 index 000000000..9d4d7bd7d --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_operators_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllOperatorsResponse", + "type": "object", + "required": [ + "operators" + ], + "properties": { + "operators": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_tokens_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_tokens_response.json new file mode 100644 index 000000000..22bf5bfd3 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/all_tokens_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AllTokensResponse", + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.", + "type": "array", + "items": { + "type": "string" + } + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approval_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approval_response.json new file mode 100644 index 000000000..4f45b42e9 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approval_response.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ApprovalResponse", + "type": "object", + "required": [ + "approval" + ], + "properties": { + "approval": { + "$ref": "#/definitions/Approval" + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approvals_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approvals_response.json new file mode 100644 index 000000000..8d8e39ea0 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/approvals_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ApprovalsResponse", + "type": "object", + "required": [ + "approvals" + ], + "properties": { + "approvals": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/binary.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/binary.json new file mode 100644 index 000000000..10b45584f --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/binary.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Binary", + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "type": "string" +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/collection_info_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/collection_info_response.json new file mode 100644 index 000000000..d285d1113 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/collection_info_response.json @@ -0,0 +1,58 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CollectionInfoResponse", + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + }, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/contract_info_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/contract_info_response.json new file mode 100644 index 000000000..a16712589 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/contract_info_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ContractInfoResponse", + "type": "object", + "required": [ + "name", + "symbol" + ], + "properties": { + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/execute_msg_for__empty.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/execute_msg_for__empty.json new file mode 100644 index 000000000..de12218ad --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/execute_msg_for__empty.json @@ -0,0 +1,308 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg_for_Empty", + "description": "This is like Cw721ExecuteMsg but we add a Mint command for an owner to make this stand-alone. You will likely want to remove mint and use other control logic in any contract that inherits this.", + "oneOf": [ + { + "description": "Transfer is a base message to move a token to another account without triggering actions", + "type": "object", + "required": [ + "transfer_nft" + ], + "properties": { + "transfer_nft": { + "type": "object", + "required": [ + "recipient", + "token_id" + ], + "properties": { + "recipient": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Send is a base message to transfer a token to a contract and trigger an action on the receiving contract.", + "type": "object", + "required": [ + "send_nft" + ], + "properties": { + "send_nft": { + "type": "object", + "required": [ + "contract", + "msg", + "token_id" + ], + "properties": { + "contract": { + "type": "string" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Allows operator to transfer / send the token from the owner's account. If expiration is set, then this allowance has a time/height limit", + "type": "object", + "required": [ + "approve" + ], + "properties": { + "approve": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Remove previously granted Approval", + "type": "object", + "required": [ + "revoke" + ], + "properties": { + "revoke": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Allows operator to transfer / send any token from the owner's account. If expiration is set, then this allowance has a time/height limit", + "type": "object", + "required": [ + "approve_all" + ], + "properties": { + "approve_all": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "expires": { + "anyOf": [ + { + "$ref": "#/definitions/Expiration" + }, + { + "type": "null" + } + ] + }, + "operator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Remove previously granted ApproveAll permission", + "type": "object", + "required": [ + "revoke_all" + ], + "properties": { + "revoke_all": { + "type": "object", + "required": [ + "operator" + ], + "properties": { + "operator": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "description": "Mint a new NFT, can only be called by the contract minter", + "type": "object", + "required": [ + "mint" + ], + "properties": { + "mint": { + "$ref": "#/definitions/MintMsg_for_Empty" + } + }, + "additionalProperties": false + }, + { + "description": "Burn an NFT the sender has access to", + "type": "object", + "required": [ + "burn" + ], + "properties": { + "burn": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + } + ], + "definitions": { + "Binary": { + "description": "Binary is a wrapper around Vec to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec", + "type": "string" + }, + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "MintMsg_for_Empty": { + "type": "object", + "required": [ + "extension", + "owner", + "token_id" + ], + "properties": { + "extension": { + "description": "Any custom extension used by this contract", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "owner": { + "description": "The owner of the newly minter NFT", + "type": "string" + }, + "token_id": { + "description": "Unique ID of the NFT", + "type": "string" + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + } + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/instantiate_msg.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/instantiate_msg.json new file mode 100644 index 000000000..fb28071b6 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/instantiate_msg.json @@ -0,0 +1,81 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "type": "object", + "required": [ + "collection_info", + "minter", + "name", + "symbol" + ], + "properties": { + "collection_info": { + "$ref": "#/definitions/CollectionInfo_for_RoyaltyInfoResponse" + }, + "minter": { + "type": "string" + }, + "name": { + "type": "string" + }, + "symbol": { + "type": "string" + } + }, + "definitions": { + "CollectionInfo_for_RoyaltyInfoResponse": { + "type": "object", + "required": [ + "creator", + "description", + "image" + ], + "properties": { + "creator": { + "type": "string" + }, + "description": { + "type": "string" + }, + "external_link": { + "type": [ + "string", + "null" + ] + }, + "image": { + "type": "string" + }, + "royalty_info": { + "anyOf": [ + { + "$ref": "#/definitions/RoyaltyInfoResponse" + }, + { + "type": "null" + } + ] + } + } + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "RoyaltyInfoResponse": { + "type": "object", + "required": [ + "payment_address", + "share" + ], + "properties": { + "payment_address": { + "type": "string" + }, + "share": { + "$ref": "#/definitions/Decimal" + } + } + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/minter_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/minter_response.json new file mode 100644 index 000000000..a20e0d767 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/minter_response.json @@ -0,0 +1,14 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "MinterResponse", + "description": "Shows who can mint these tokens", + "type": "object", + "required": [ + "minter" + ], + "properties": { + "minter": { + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/nft_info_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/nft_info_response.json new file mode 100644 index 000000000..dbfef6713 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/nft_info_response.json @@ -0,0 +1,31 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NftInfoResponse", + "type": "object", + "required": [ + "extension" + ], + "properties": { + "extension": { + "description": "You can add any custom metadata here when you extend cw721-base", + "allOf": [ + { + "$ref": "#/definitions/Empty" + } + ] + }, + "token_uri": { + "description": "Universal resource identifier for this NFT Should point to a JSON file that conforms to the ERC721 Metadata JSON Schema", + "type": [ + "string", + "null" + ] + } + }, + "definitions": { + "Empty": { + "description": "An empty struct that serves as a placeholder in different places, such as contracts that don't set a custom message.\n\nIt is designed to be expressable in correct JSON and JSON Schema but contains no meaningful data. Previously we used enums without cases, but those cannot represented as valid JSON Schema (https://github.com/CosmWasm/cosmwasm/issues/451)", + "type": "object" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/num_tokens_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/num_tokens_response.json new file mode 100644 index 000000000..4647c23aa --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/num_tokens_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "NumTokensResponse", + "type": "object", + "required": [ + "count" + ], + "properties": { + "count": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/operators_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/operators_response.json new file mode 100644 index 000000000..53703072c --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/operators_response.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OperatorsResponse", + "type": "object", + "required": [ + "operators" + ], + "properties": { + "operators": { + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/owner_of_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/owner_of_response.json new file mode 100644 index 000000000..1258d671f --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/owner_of_response.json @@ -0,0 +1,103 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OwnerOfResponse", + "type": "object", + "required": [ + "approvals", + "owner" + ], + "properties": { + "approvals": { + "description": "If set this address is approved to transfer/send the token as well", + "type": "array", + "items": { + "$ref": "#/definitions/Approval" + } + }, + "owner": { + "description": "Owner of the token", + "type": "string" + } + }, + "definitions": { + "Approval": { + "type": "object", + "required": [ + "expires", + "spender" + ], + "properties": { + "expires": { + "description": "When the Approval expires (maybe Expiration::never)", + "allOf": [ + { + "$ref": "#/definitions/Expiration" + } + ] + }, + "spender": { + "description": "Account that can transfer/send the token", + "type": "string" + } + } + }, + "Expiration": { + "description": "Expiration represents a point in time when some event happens. It can compare with a BlockInfo and will return is_expired() == true once the condition is hit (and for every block in the future)", + "oneOf": [ + { + "description": "AtHeight will expire when `env.block.height` >= height", + "type": "object", + "required": [ + "at_height" + ], + "properties": { + "at_height": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + }, + { + "description": "AtTime will expire when `env.block.time` >= time", + "type": "object", + "required": [ + "at_time" + ], + "properties": { + "at_time": { + "$ref": "#/definitions/Timestamp" + } + }, + "additionalProperties": false + }, + { + "description": "Never will never expire. Used to express the empty variant", + "type": "object", + "required": [ + "never" + ], + "properties": { + "never": { + "type": "object" + } + }, + "additionalProperties": false + } + ] + }, + "Timestamp": { + "description": "A point in time in nanosecond precision.\n\nThis type can represent times from 1970-01-01T00:00:00Z to 2554-07-21T23:34:33Z.\n\n## Examples\n\n``` # use cosmwasm_std::Timestamp; let ts = Timestamp::from_nanos(1_000_000_202); assert_eq!(ts.nanos(), 1_000_000_202); assert_eq!(ts.seconds(), 1); assert_eq!(ts.subsec_nanos(), 202);\n\nlet ts = ts.plus_seconds(2); assert_eq!(ts.nanos(), 3_000_000_202); assert_eq!(ts.seconds(), 3); assert_eq!(ts.subsec_nanos(), 202); ```", + "allOf": [ + { + "$ref": "#/definitions/Uint64" + } + ] + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/query_msg.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/query_msg.json new file mode 100644 index 000000000..3cb271651 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/query_msg.json @@ -0,0 +1,284 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "oneOf": [ + { + "type": "object", + "required": [ + "owner_of" + ], + "properties": { + "owner_of": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "approval" + ], + "properties": { + "approval": { + "type": "object", + "required": [ + "spender", + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "spender": { + "type": "string" + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "approvals" + ], + "properties": { + "approvals": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_operators" + ], + "properties": { + "all_operators": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "num_tokens" + ], + "properties": { + "num_tokens": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "contract_info" + ], + "properties": { + "contract_info": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "nft_info" + ], + "properties": { + "nft_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_nft_info" + ], + "properties": { + "all_nft_info": { + "type": "object", + "required": [ + "token_id" + ], + "properties": { + "include_expired": { + "type": [ + "boolean", + "null" + ] + }, + "token_id": { + "type": "string" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "type": "object", + "required": [ + "owner" + ], + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "owner": { + "type": "string" + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "all_tokens" + ], + "properties": { + "all_tokens": { + "type": "object", + "properties": { + "limit": { + "type": [ + "integer", + "null" + ], + "format": "uint32", + "minimum": 0.0 + }, + "start_after": { + "type": [ + "string", + "null" + ] + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "minter" + ], + "properties": { + "minter": { + "type": "object" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "collection_info" + ], + "properties": { + "collection_info": { + "type": "object" + } + }, + "additionalProperties": false + } + ] +} diff --git a/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/tokens_response.json b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/tokens_response.json new file mode 100644 index 000000000..b8e3d75b5 --- /dev/null +++ b/boilerplates/ts-codegen-module/contracts/stargaze-sg721/schema/tokens_response.json @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "TokensResponse", + "type": "object", + "required": [ + "tokens" + ], + "properties": { + "tokens": { + "description": "Contains all token_ids in lexicographical ordering If there are more than `limit`, use `start_from` in future queries to achieve pagination.", + "type": "array", + "items": { + "type": "string" + } + } + } +} diff --git a/boilerplates/ts-codegen-module/jest.config.cjs b/boilerplates/ts-codegen-module/jest.config.cjs new file mode 100644 index 000000000..a58c252f8 --- /dev/null +++ b/boilerplates/ts-codegen-module/jest.config.cjs @@ -0,0 +1,5 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node' +}; diff --git a/boilerplates/ts-codegen-module/package.json b/boilerplates/ts-codegen-module/package.json new file mode 100644 index 000000000..217241470 --- /dev/null +++ b/boilerplates/ts-codegen-module/package.json @@ -0,0 +1,70 @@ +{ + "name": "__PACKAGE_IDENTIFIER__", + "version": "0.0.1", + "description": "__MODULEDESC__", + "author": "__USERFULLNAME__ <__USEREMAIL__>", + "homepage": "https://github.com/__USERNAME__/__MODULENAME__#readme", + "license": "SEE LICENSE IN LICENSE", + "main": "dist/index.js", + "module": "dist/index.mjs", + "typings": "dist/index.d.ts", + "directories": { + "lib": "src" + }, + "files": [ + "dist", + "!CHANGELOG.md" + ], + "nodemonConfig": { + "ext": "js,json,ts,tsx" + }, + "scripts": { + "build:cjs": "yarn tsc -p tsconfig.json --outDir dist --module commonjs || true", + "build:mjs": "yarn tsc -p tsconfig.json --outDir mjs --module es2022 --declaration false || true", + "clean:mjs": "rimraf mjs", + "clean:dist": "rimraf dist", + "clean": "npm run clean:mjs && npm run clean:dist", + "build:rename": "publish-scripts --cmd rename --srcDir mjs --outDir dist --findExt js --replaceExt mjs --no-rmDir", + "build": "npm run clean && npm run build:cjs && npm run build:mjs && npm run build:rename", + "codegen": "node scripts/codegen.cjs", + "prepare": "npm run build", + "dev": "ts-node-esm ./src/index.ts", + "watch": "nodemon --exec \"yarn dev\"", + "lint": "eslint src --fix", + "test": "jest", + "test:watch": "jest --watch", + "test:debug": "node --inspect node_modules/.bin/jest --runInBand" + }, + "publishConfig": { + "access": "__ACCESS__" + }, + "repository": { + "type": "git", + "url": "https://github.com/__USERNAME__/__MODULENAME__" + }, + "keywords": [], + "bugs": { + "url": "https://github.com/__USERNAME__/__MODULENAME__/issues" + }, + "devDependencies": { + "@types/jest": "^29.5.3", + "cross-env": "^7.0.2", + "eslint": "8.45.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^5.0.0", + "jest": "^29.6.1", + "jest-in-case": "^1.0.2", + "nodemon": "^3.0.1", + "prettier": "^3.0.0", + "publish-scripts": "0.1.0", + "rimraf": "^5.0.0", + "ts-jest": "^29.1.0", + "ts-node": "^10.9.1", + "ts-node-dev": "^2.0.0", + "typescript": "^5.0.4" + }, + "dependencies": { + "@cosmjs/cosmwasm-stargate": "^0.31.0", + "@cosmwasm/ts-codegen": "^0.31.6" + } +} \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/scripts/codegen.cjs b/boilerplates/ts-codegen-module/scripts/codegen.cjs new file mode 100644 index 000000000..af72c3f68 --- /dev/null +++ b/boilerplates/ts-codegen-module/scripts/codegen.cjs @@ -0,0 +1,29 @@ +const codegen = require('@cosmwasm/ts-codegen').default; + +codegen({ + contracts: [ + { + name: 'SG721', + dir: './contracts/stargaze-sg721/schema' + }, + { + name: 'Minter', + dir: './contracts/stargaze-minter/schema' + } + ], + outPath: './src/', + options: { + bundle: { + bundleFile: 'index.ts', + scope: 'contracts' + }, + messageComposer: { + enabled: true + }, + useContractsHooks: { + enabled: false // if you enable this, add react! + } + } +}).then(() => { + console.log('✨ all done!'); +}); diff --git a/boilerplates/ts-codegen-module/src/index.ts b/boilerplates/ts-codegen-module/src/index.ts new file mode 100644 index 000000000..619fbdd60 --- /dev/null +++ b/boilerplates/ts-codegen-module/src/index.ts @@ -0,0 +1 @@ +export { }; \ No newline at end of file diff --git a/boilerplates/ts-codegen-module/tsconfig.json b/boilerplates/ts-codegen-module/tsconfig.json new file mode 100644 index 000000000..6dd3cb22e --- /dev/null +++ b/boilerplates/ts-codegen-module/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "rootDir": "src", + "skipLibCheck": true, + "emitDeclarationOnly": false, + "declaration": true, + "esModuleInterop": true, + "target": "es2022", + "module": "es2022", + "lib": [ + "es2022", + "DOM" + ], + "sourceMap": true, + "isolatedModules": true, + "allowJs": true, + "downlevelIteration": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "jsx": "react" + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/lerna.json b/lerna.json index 5b425ea7f..6c69f8f19 100644 --- a/lerna.json +++ b/lerna.json @@ -9,7 +9,8 @@ "packages": [ "packages/*", "examples/*", - "templates/*" + "templates/*", + "boilerplates/*" ], "version": "independent", "registry": "https://registry.npmjs.org", diff --git a/package.json b/package.json index eb91cbcd5..93098bf33 100644 --- a/package.json +++ b/package.json @@ -34,10 +34,11 @@ "workspaces": [ "packages/*", "examples/*", - "templates/*" + "templates/*", + "boilerplates/*" ], "repository": { "type": "git", "url": "https://github.com/cosmology-tech/create-cosmos-app" } -} +} \ No newline at end of file diff --git a/packages/create-cosmos-app/src/git-cca-template.ts b/packages/create-cosmos-app/src/git-cca-template.ts index e7839ea12..c4e8a3286 100644 --- a/packages/create-cosmos-app/src/git-cca-template.ts +++ b/packages/create-cosmos-app/src/git-cca-template.ts @@ -26,10 +26,26 @@ export const createGitApp = (repo: string) => { ], argv); name = name.replace(/\s/g, '-'); - let folderName: 'templates' | 'examples' = 'templates'; + let folderName: 'templates' | 'boilerplates' | 'examples' = 'templates'; + + // get example info if (argv.examples || argv.example || argv.ex) { folderName = 'examples'; + const example = argv.examples || argv.example || argv.ex; + if (typeof example === 'string') { + argv.template = example; + } + } + + // get boilerplate info + if (argv.boilerplates || argv.boilerplate || argv.ex) { + folderName = 'boilerplates'; + const boilerplate = argv.boilerplates || argv.boilerplate || argv.ex; + if (typeof boilerplate === 'string') { + argv.template = boilerplate; + } } + const tempname = Math.random().toString(36).slice(2, 7); const dir = join(argv.tmpdir || tmpdir(), tempname); mkdirp(dir); From 14899f2c615235badead5717f761b01f87132fc3 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 16 Jul 2023 20:53:13 +0200 Subject: [PATCH 2/2] remove from workspace --- lerna.json | 3 +-- package.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lerna.json b/lerna.json index 6c69f8f19..5b425ea7f 100644 --- a/lerna.json +++ b/lerna.json @@ -9,8 +9,7 @@ "packages": [ "packages/*", "examples/*", - "templates/*", - "boilerplates/*" + "templates/*" ], "version": "independent", "registry": "https://registry.npmjs.org", diff --git a/package.json b/package.json index 93098bf33..50ce61290 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "workspaces": [ "packages/*", "examples/*", - "templates/*", - "boilerplates/*" + "templates/*" ], "repository": { "type": "git",