diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..81af5de --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,101 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL - prerelease and revision PRs ()" + +on: + push: + branches: [ "releasing" ] + pull_request: + branches: [ "revision", "releasing" ] + # schedule: + # - cron: '28 16 * * 0' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: javascript-typescript + build-mode: none + # CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Add any setup steps before running the `github/codeql-action/init` action. + # This includes steps like installing compilers or runtimes (`actions/setup-node` + # or others). This is typically only required for manual builds. + # - name: Setup runtime (example) + # uses: actions/setup-example@v1 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: | + echo 'If you are using a "manual" build mode for one or more of the' \ + 'languages you are analyzing, replace this with the commands to build' \ + 'your code, for example:' + echo ' make bootstrap' + echo ' make release' + exit 1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v4 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/npm-publish-github-packages.yml b/.github/workflows/npm-publish-github-packages.yml new file mode 100644 index 0000000..964b4e7 --- /dev/null +++ b/.github/workflows/npm-publish-github-packages.yml @@ -0,0 +1,38 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Package at npm.pkg.github.com + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-gpr: + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://npm.pkg.github.com/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..b061ab3 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,36 @@ +# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created +# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages + +name: Package at registry.npmjs.org + +on: + release: + types: [created] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm ci + - run: npm test + + publish-npm: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/.husky/applypatch-msg b/.husky/applypatch-msg new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/applypatch-msg @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/post-applypatch b/.husky/post-applypatch new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/post-applypatch @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/post-checkout b/.husky/post-checkout new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/post-checkout @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/post-commit b/.husky/post-commit new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/post-commit @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/post-merge b/.husky/post-merge new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/post-merge @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/post-rewrite b/.husky/post-rewrite new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/post-rewrite @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/pre-applypatch b/.husky/pre-applypatch new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/pre-applypatch @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/pre-auto-gc b/.husky/pre-auto-gc new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/pre-auto-gc @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit index 689d6da..4c7ee8f 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -# npm test +echo $0 \ No newline at end of file diff --git a/.husky/pre-merge-commit b/.husky/pre-merge-commit new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/pre-merge-commit @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..c6ac3ba --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,2 @@ + +echo $0 \ No newline at end of file diff --git a/.husky/pre-rebase b/.husky/pre-rebase new file mode 100755 index 0000000..c6ac3ba --- /dev/null +++ b/.husky/pre-rebase @@ -0,0 +1,2 @@ + +echo $0 \ No newline at end of file diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100755 index 0000000..4c7ee8f --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1 @@ +echo $0 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ab529df..82bd0e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,12 @@ "license": "Apache-2.0", "dependencies": { "@cosmjs/cosmwasm": "^0.39.0", + "@cosmjs/cosmwasm-stargate": "^0.38.1", "@cosmjs/crypto": "^0.39.0", + "@cosmjs/proto-signing": "^0.39.0", "@cosmjs/stargate": "^0.39.0", + "@passwordless-id/webauthn": "^2.4.0", + "cosmiconfig": "^9.0.1", "socket.io": "^4.8.3", "ssh2": "^1.17.0" }, @@ -23,6 +27,29 @@ "snyk": "^1.1304.3" } }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@cosmjs/amino": { "version": "0.39.0", "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.39.0.tgz", @@ -52,6 +79,222 @@ "cosmjs-types": "^0.11.0" } }, + "node_modules/@cosmjs/cosmwasm-stargate": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/cosmwasm-stargate/-/cosmwasm-stargate-0.38.1.tgz", + "integrity": "sha512-uiDaN1FHjcOYfStv6fuTp2g7F7ktwjlUdbVyNtOnaG/NO77s4vGOdITz5iJRJocaDUUwKAJT3pEdlzWVrAA0Rg==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/cosmwasm": "^0.38.1" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/amino": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.38.1.tgz", + "integrity": "sha512-WaThDpq2JwUyKuazq08Xa+FHzQ3jh1HcYnGL4xsyfqFwOlAvnl0EDvSSz9WSwz1oopIxFE9Qtf3OUKOlxBZbYA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/crypto": "^0.38.1", + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/utils": "^0.38.1" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/cosmwasm": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/cosmwasm/-/cosmwasm-0.38.1.tgz", + "integrity": "sha512-HeGBMV9IjSCr6r0LzJshJq1SH+Ryot496g/dmHBA41p95NMY8H103qfVOmpH/7XkVs9oRlGKHl4xxMBnNlW6jA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.38.1", + "@cosmjs/crypto": "^0.38.1", + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/proto-signing": "^0.38.1", + "@cosmjs/stargate": "^0.38.1", + "@cosmjs/tendermint-rpc": "^0.38.1", + "@cosmjs/utils": "^0.38.1", + "cosmjs-types": "^0.11.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/crypto": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.38.1.tgz", + "integrity": "sha512-r1KQCjKAdMga2aZ/nkgULRF4fisPZMF6ErucVsMmkASBgDl0k9/vD9K9fHUdGClMv0oOYEfwOT/UTBR7K2OuYA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/utils": "^0.38.1", + "@noble/ciphers": "^1.3.0", + "@noble/curves": "^1.9.2", + "@noble/hashes": "^1.8.0", + "@scure/bip39": "^1.6.0", + "hash-wasm": "^4.12.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/encoding": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.38.1.tgz", + "integrity": "sha512-i5jGgJhiXs7boePGA48xzYxnCbf3MS5nT/R2HvnvSQyVAG2A99NyL96lBgmz6etOJSGOiwVrB8uh1Qp5bq6WKQ==", + "license": "Apache-2.0", + "dependencies": { + "@scure/base": "^2.0.0", + "base64-js": "^1.3.0", + "readonly-date-esm": "^2.0.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/json-rpc": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.38.1.tgz", + "integrity": "sha512-h+ejJeh+Men8upheRcIETGLAGhsGzIQW03BFvCsCenQOoewpxnbxN1mjfLE7M8UtOTNUsb0uQ1yEnhaTKPTRPg==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/stream": "^0.38.1", + "xstream": "^11.14.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/math": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.38.1.tgz", + "integrity": "sha512-MBk7p6kPNULi0TusD8O3xoBskFIkRzOtpmnea3sXbTVnguX7epNPVDITXM4tlsg8kAQrEOEIA0g5zAJxzH3Ikw==", + "license": "Apache-2.0" + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/proto-signing": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.38.1.tgz", + "integrity": "sha512-J7jELTwk39wYAZUan48eTLBKzx3/max1NIQSlaerdrUkIqhk9ZzC2+p94RnlFUBkvsWZ4ORbhNLYPjwuf2oM0g==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.38.1", + "@cosmjs/crypto": "^0.38.1", + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/utils": "^0.38.1", + "cosmjs-types": "^0.11.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/socket": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.38.1.tgz", + "integrity": "sha512-r58RplrHOoO9oDCPiFZu+oBTgeTqE6/HMW+JSAko2Dyv3AocdPhBV16SJQriumGxVRmFUdcczkK2L+6OwngoOA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/stream": "^0.38.1", + "isomorphic-ws": "^4.0.1", + "ws": "^7", + "xstream": "^11.14.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/stargate": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.38.1.tgz", + "integrity": "sha512-HxLMJxvjN8neJcN382ir1X+nrsmfYYzJ9RpibEOgzN50Ir3D1qW1q6pumjCZb4s834iB0FOlMA1F0LIklaRong==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/amino": "^0.38.1", + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/proto-signing": "^0.38.1", + "@cosmjs/stream": "^0.38.1", + "@cosmjs/tendermint-rpc": "^0.38.1", + "@cosmjs/utils": "^0.38.1", + "cosmjs-types": "^0.11.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/stream": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.38.1.tgz", + "integrity": "sha512-YIruJ6XfPQooMZzy7fTMx1/JnAMgiGMg785Zxja+RntbxrsHyWYUdWGi9ji8uOHEgZNYErHlK2NnbF8VlCo1ew==", + "license": "Apache-2.0", + "dependencies": { + "xstream": "^11.14.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/tendermint-rpc": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.38.1.tgz", + "integrity": "sha512-yoGfI1wcw986qqCJkD544HXB4YxVOvne5s1RZkO437RtgvpLgVVdTBvCB1JcgLDw25gpHMFe1dWe5Sn9LPzQxA==", + "license": "Apache-2.0", + "dependencies": { + "@cosmjs/crypto": "^0.38.1", + "@cosmjs/encoding": "^0.38.1", + "@cosmjs/json-rpc": "^0.38.1", + "@cosmjs/math": "^0.38.1", + "@cosmjs/socket": "^0.38.1", + "@cosmjs/stream": "^0.38.1", + "@cosmjs/utils": "^0.38.1", + "readonly-date-esm": "^2.0.0", + "xstream": "^11.14.0" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@cosmjs/utils": { + "version": "0.38.1", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.38.1.tgz", + "integrity": "sha512-ccQ5in6IvsQ+o/SstUdQH1jCJ2+MkJPZK7A/EYwMAFcjV8vzOgJ97LVy6AT24nwdi0/iVa2nbAG+fitUEsgLcA==", + "license": "Apache-2.0" + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@noble/ciphers": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-1.3.0.tgz", + "integrity": "sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@noble/curves": { + "version": "1.9.7", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.9.7.tgz", + "integrity": "sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "1.8.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@scure/bip39": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.6.0.tgz", + "integrity": "sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.8.0", + "@scure/base": "~1.2.5" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@cosmjs/cosmwasm-stargate/node_modules/@scure/bip39/node_modules/@scure/base": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.6.tgz", + "integrity": "sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@cosmjs/crypto": { "version": "0.39.0", "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.39.0.tgz", @@ -604,6 +847,15 @@ "node": ">= 20" } }, + "node_modules/@passwordless-id/webauthn": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@passwordless-id/webauthn/-/webauthn-2.4.0.tgz", + "integrity": "sha512-xOuI2/7nSgxEt6aFnJYOayoq2SHNplqEsHf1A40rTfmU/7LKs97LiyAumFzqxymHPc/eZNeHpJtqFcr3WFN9JQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/passwordless-id" + } + }, "node_modules/@scure/base": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@scure/base/-/base-2.2.0.tgz", @@ -787,6 +1039,12 @@ "node": ">= 20" } }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/asn1": { "version": "0.2.6", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", @@ -986,6 +1244,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/chownr": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", @@ -1050,6 +1317,32 @@ "url": "https://opencollective.com/express" } }, + "node_modules/cosmiconfig": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.1.tgz", + "integrity": "sha512-hr4ihw+DBqcvrsEDioRO31Z17x71pUYoNe/4h6Z0wB72p7MU7/9gH8Q3s12NFhHPfYBBOV3qyfUxmr/Yn3shnQ==", + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/cosmjs-types": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.11.0.tgz", @@ -1261,6 +1554,24 @@ } } }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", @@ -1572,6 +1883,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hash-wasm": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.12.0.tgz", + "integrity": "sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==", + "license": "MIT" + }, "node_modules/hasown": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", @@ -1667,6 +1984,22 @@ "dev": true, "license": "MIT" }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", @@ -1684,6 +2017,12 @@ "node": ">= 12" } }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" + }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -1803,6 +2142,40 @@ "ws": "*" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", + "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" + }, "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -1850,6 +2223,12 @@ "immediate": "~3.0.5" } }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "license": "MIT" + }, "node_modules/localforage": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz", @@ -2097,6 +2476,42 @@ "dev": true, "license": "(MIT AND Zlib)" }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", @@ -2193,6 +2608,15 @@ "integrity": "sha512-adlyzz144ofU22kjnnRIN0HPPqIbc5IZvMmMuVtEgMY4mKgNyKqOVb4Fa2GUzE2By4TEPOYoGqDoKRyqmeEuPQ==", "license": "Apache-2.0" }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/roarr": { "version": "2.15.4", "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", diff --git a/package.json b/package.json index 68c9fb6..2ecc192 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipi-wallet-core", - "version": "0.1.0", + "version": "0.1.1", "description": "IPI core of wallet package", "keywords": [ "IPI" @@ -16,7 +16,7 @@ "license": "Apache-2.0", "author": "Sett Sarverott", "type": "module", - "main": "src/main.js", + "main": "src/main.mjs", "scripts": { "test": "task test-all", "start": "node src/index.js --repl", @@ -31,9 +31,53 @@ }, "dependencies": { "@cosmjs/cosmwasm": "^0.39.0", + "@cosmjs/cosmwasm-stargate": "^0.38.1", "@cosmjs/crypto": "^0.39.0", + "@cosmjs/proto-signing": "^0.39.0", "@cosmjs/stargate": "^0.39.0", + "@passwordless-id/webauthn": "^2.4.0", + "cosmiconfig": "^9.0.1", "socket.io": "^4.8.3", "ssh2": "^1.17.0" + }, + "chain": { + "chainId": "ipi-mainnet-2", + "chainName": "IPI Mainnet 2", + "rpc": "https://ipicoin.eu/rpc", + "rest": "https://ipicoin.eu/api", + "bip44": { + "coinType": 118 + }, + "bech32Config": { + "bech32PrefixAccAddr": "ipi", + "bech32PrefixAccPub": "ipipub", + "bech32PrefixValAddr": "ipivaloper", + "bech32PrefixValPub": "ipivaloperpub", + "bech32PrefixConsAddr": "ipivalcons", + "bech32PrefixConsPub": "ipivalconspub" + }, + "currencies": [ + { + "coinDenom": "IPI", + "coinMinimalDenom": "nipi", + "coinDecimals": 9 + } + ], + "feeCurrencies": [ + { + "coinDenom": "IPI", + "coinMinimalDenom": "nipi", + "coinDecimals": 9 + } + ], + "stakeCurrency": { + "coinDenom": "IPI", + "coinMinimalDenom": "nipi", + "coinDecimals": 9 + }, + "features": [ + "stargate", + "cosmwasm" + ] } } diff --git a/src/models/_index.mjs b/src/models/_index.mjs new file mode 100644 index 0000000..e9caf70 --- /dev/null +++ b/src/models/_index.mjs @@ -0,0 +1,44 @@ +import Address from "./address.mjs" +import Wallet from "./wallet.mjs" +import Contract from "./contract.mjs" +import Request from "./request.mjs" +import Transaction from "./transaction.mjs" + +export default class IPI_Models{ + static check(instance, checkname){ + switch(checkname){ + case "is-wallet": + return instance instanceof Wallet + // break; + case "is-address": + return instance instanceof Address + // break; + case "is-contract": + return instance instanceof Contract + // break; + case "is-transaction": + return instance instanceof Transaction + // break; + case "is-request": + return instance instanceof Request + // break; + default: + throw TypeError("not valid type of model") + } + } + static get Address(){ + return Address + } + static get Wallet(){ + return Wallet + } + static get Contract(){ + return Contract + } + static get Request(){ + return Request + } + static get Transaction(){ + return Transaction + } +} \ No newline at end of file diff --git a/src/models/request.mjs b/src/models/request.mjs index 6b4771f..ae01e89 100644 --- a/src/models/request.mjs +++ b/src/models/request.mjs @@ -3,4 +3,6 @@ class Request{ constructor(){ } -} \ No newline at end of file +} + +export default Request \ No newline at end of file diff --git a/src/models/wallet.mjs b/src/models/wallet.mjs index e57dca3..9a89b2b 100644 --- a/src/models/wallet.mjs +++ b/src/models/wallet.mjs @@ -9,7 +9,7 @@ class Wallet{ readAddress(){ } - saveKeyfile(keyPath=){ + saveKeyfile(keyPath){ return } @@ -40,4 +40,6 @@ class Wallet{ static create(){ return new Wallet() } -} \ No newline at end of file +} + +export default Wallet \ No newline at end of file diff --git a/src/operations/send-amount.mjs b/src/operations/send-amount.cjs similarity index 87% rename from src/operations/send-amount.mjs rename to src/operations/send-amount.cjs index 20a8366..6aaf1d9 100644 --- a/src/operations/send-amount.mjs +++ b/src/operations/send-amount.cjs @@ -1,6 +1,6 @@ - +import IPI_Models from '../models/_index.mjs'; const { readFile } = require('fs/promises'); const { DirectSecp256k1HdWallet } = require("@cosmjs/proto-signing"); @@ -8,7 +8,9 @@ const { SigningStargateClient, GasPrice } = require("@cosmjs/stargate"); async function sendAmount(fromWallet, toAddress, tokenAmount, chainConfig, feeCalc="auto") { - if(fromWallet instanceof ) + if(IPI_Models.check(fromWallet,)){ + + } const [firstAccount] = await fromWallet.walletHook.getAccounts(); @@ -27,5 +29,6 @@ async function sendAmount(fromWallet, toAddress, tokenAmount, chainConfig, feeCa console.log("Transaction Hash:", result.transactionHash); } +module.exports=sendAmount main().catch(console.error); \ No newline at end of file