Compare commits

..
152 Commits
Author SHA1 Message Date
Prad Nukala 6ef7b8ea2d fix: Changelog 2025-10-04 08:58:06 -04:00
Prad Nukala 11d318dc00 bump: version 0.0.1 → 0.0.2 2025-10-04 08:56:10 -04:00
Prad NukalaandGitHub 6f6a20922c chore/devbox plugin (#1301)
* chore: Add Homebrew Casks for snrd/hway

* fix: Tag bump format for npm packages

* chore: Remove plugin setup
2025-10-04 08:55:54 -04:00
Prad Nukala e4450f52a4 fix: goreleaser nix build and url map 2025-10-03 15:10:29 -04:00
Prad Nukala eea48a43b4 bump: version 0.0.0 → 0.0.1 2025-10-03 14:59:45 -04:00
Prad Nukala 6595d4fde1 bump: version 0.0.0 → 0.0.1 2025-10-03 14:54:24 -04:00
Prad Nukala ce55341871 bump: version 0.0.0 → 0.0.1 2025-10-03 14:54:08 -04:00
Prad Nukala 4d0ec9f693 bump: version 0.0.0 → 0.0.1 2025-10-03 14:51:18 -04:00
Prad Nukala 8c31e71804 fix: Remove Changelogs 2025-10-03 14:49:51 -04:00
Prad NukalaandGitHub 13e6c3e84d Master (#1262)
* clear

* feat: Add everything

* fix: Commenht
2025-10-03 14:45:52 -04:00
Prad N 43b4a11c06 docs: add coding guidelines for contributors 2025-04-05 21:43:51 -04:00
Prad N c249c722e1 feat: enhance task management with Taskfile schema validation 2025-04-04 01:29:59 -04:00
Prad N 8b510c1db1 docs: establish codebase conventions and developer guidelines 2025-03-30 22:52:04 -04:00
Prad NukalaandGitHub d3346a6fe6 Update README.md
Signed-off-by: Prad Nukala <prad@sonr.io>
2025-03-27 04:37:54 -04:00
Prad N f0c3230a89 bump: version 0.6.3 → 0.6.4 2025-03-27 04:33:49 -04:00
Prad N 325b2fe4cb ci: remove release workflow 2025-03-27 04:27:03 -04:00
Prad N 85162f2ea6 ci: streamline release workflow triggers 2025-03-27 04:23:42 -04:00
Prad N 9208df92f3 feat: enable GitHub Actions to trigger releases 2025-03-27 04:23:02 -04:00
de72e6186f feat: enhance development environment with ripgrep and gh-milestone (#1252)
Co-authored-by: Prad N <prad@didao.xyz>
2025-03-27 04:21:05 -04:00
240fc5c1ef feat: enhance release process with Doppler integration (#1251)
Co-authored-by: Prad N <prad@didao.xyz>
2025-03-27 04:17:20 -04:00
836963163c Feature/auto releases (#1250)
* refactor: rename project from onsonr/sonr to sonr-io/snrd (#1249)

* refactor: rename project from onsonr/sonr to sonr-io/snrd

* refactor: update package paths to use sonr-io org

---------

Co-authored-by: Prad N <prad@didao.xyz>

* feat: introduce devbox for consistent development environment

* feat: integrate Doppler for secrets management

* feat: streamline release process with Devbox

* <no value>

* bump: version 0.6.3 → 0.6.4

* feat: enable commit-less version bumping

* bump: version 0.6.4 → 0.6.5

* feat: streamline release process and update project metadata

* feat: streamline build process and configuration

* feat: streamline build process by removing release target

* bump: version 0.6.5 → 0.6.6

* feat: upgrade to go 1.24 and align binary name

* bump: version 0.6.6 → 0.6.7

* feat: streamline release process and update project metadata

* bump: version 0.6.3 → 0.6.4

* feat: streamline development and release processes

* feat: streamline development and release processes

* refactor: streamline release process with Taskfile

* feat: enhance goreleaser output with title for better UX

* feat: consolidate release notes

* bump: version 0.6.3 → 0.6.4

* feat: streamline release process with improved automation

* feat: streamline development and release workflow

* bump: version 0.6.3 → 0.6.4

* feat: streamline release process with Taskfile and conventional commits

* bump: version 0.6.4 → 0.6.5

* feat: enhance Docker image publishing with piped credentials

* chore: remove outdated changelog entries

* bump: version 0.6.3 → 0.6.4

* feat: improve release process with interactive feedback

* feat: enhance release process with real-time version feedback

* bump: version 0.6.4 → 0.6.5

* feat: enhance release process with dynamic version display and streamlined automation

* bump: version 0.6.3 → 0.6.4

* refactor: streamline release process by removing redundant version display

* bump: version 0.6.4 → 0.6.5

* refactor: streamline release process and simplify dev environment

* bump: version 0.6.3 → 0.6.4

* ci: simplify PR checks by removing redundant release validation

* refactor: consolidate release workflows for improved maintainability

* ci: enhance release workflow for automated version publishing

---------

Co-authored-by: Prad N <prad@didao.xyz>
2025-03-27 04:14:38 -04:00
Prad N ff3fd631f7 chore: remove taskfile configurations 2025-03-21 21:27:38 -04:00
Prad N bf4a7440be feat: automate release process with conventional commits 2025-03-21 21:26:26 -04:00
Prad N 8b4d51ee30 feat: streamline app initialization and dependency management 2025-03-19 14:47:22 -04:00
Prad N 00b23353c9 fix: Refactor crypto 2025-03-11 13:57:03 -04:00
Prad N 090ee30ba3 feat: enable task management with Taskfile 2025-03-07 14:38:51 -05:00
Prad N 77bbf6bba7 feat: introduce Taskfile automation for build and deployment 2025-03-05 19:22:04 -05:00
root fcc915a115 fix: Deploy config 2025-01-16 18:22:14 -05:00
Prad N f566b7d6c1 refactor: remove evmos chain from deployment configuration 2025-01-11 23:27:50 -05:00
root b12bc88eda feat(deploy): add hdPath and coinType to sonr-1 chain config 2025-01-12 02:21:13 +00:00
Prad N 2892641f17 refactor: simplify deployment infrastructure using starship 2025-01-11 14:57:58 -05:00
Prad N 20317bbc91 style: improve release name format 2025-01-11 13:55:49 -05:00
Prad Nukala 8d218dddaa Add Slack notification workflow 2025-01-11 13:08:04 -05:00
Prad N d73f49bd24 refactor: remove unnecessary Caddyfile 2025-01-11 12:25:05 -05:00
Prad N bd9234572a ci: improve CI/CD process with devbox integration 2025-01-11 12:24:55 -05:00
Prad N 96eff9dffa fix: resolve minor formatting inconsistencies in Dockerfile and accumulator.go 2025-01-11 09:32:12 -05:00
Prad N a06bae6348 refactor: remove process-compose and individual start scripts 2025-01-09 20:09:16 -05:00
root 2d3d1929a0 docs: remove outdated testnet documentation 2025-01-07 11:19:04 -05:00
root 79706e32e3 feat: add go dependency and enhance devbox environment variables 2025-01-07 11:16:47 -05:00
root f8974b3d1f feat: implement HTMX for dynamic updates 2025-01-06 19:38:17 -05:00
root ddacc127c6 chore: update devbox packages to include Doppler 2025-01-06 18:14:55 -05:00
root edb02f3002 docs(scopes): improve keywords and add new documentation links 2025-01-06 15:10:10 -05:00
root 68e7cebb73 refactor: remove devnet and testnet network configurations 2025-01-06 14:46:39 -05:00
root eb2213f6a7 feat: add CI/CD infrastructure for development and deployment 2025-01-06 14:38:51 -05:00
root d137aa97f9 fix: correct typo in workflow name 2025-01-06 14:25:56 -05:00
github-actions[bot] b319fc5378 chore: sync version to 0.6.3 [skip ci] 2025-01-06 19:24:04 +00:00
root f458df70fc chore: add release date to merge workflow 2025-01-06 14:23:37 -05:00
root b95e2ee08e feat: Add release date to workflow environment 2025-01-06 14:23:15 -05:00
root 0431e571e4 fix: revert version number to 0.6.2 2025-01-06 14:22:17 -05:00
github-actions[bot] b94eccd075 chore: sync version to 0.6.3 [skip ci] 2025-01-06 19:20:53 +00:00
root 3f63adc411 fix: checkout main branch before updating version 2025-01-06 14:20:22 -05:00
root 8ed58bf51c fix: Specify main branch and fetch tags in merge workflow 2025-01-06 14:18:42 -05:00
root 505b847790 ci: Add dependency on sync-version job in new-release job 2025-01-06 14:14:42 -05:00
root 63b263f995 chore: add GitHub Actions workflow to synchronize version after tag creation 2025-01-06 14:13:53 -05:00
root 8919019bf3 refactor: Rename workflow file for clarity 2025-01-06 14:09:14 -05:00
root 3288307f1c feat: automate release creation and deployment on tag push 2025-01-06 14:07:02 -05:00
root 1915e06412 ci: Use goreleaser action for releases on new tags 2025-01-06 14:03:28 -05:00
github-actions[bot] 866468c002 bump: version 0.6.1 → 0.6.2 2025-01-06 19:00:34 +00:00
7f3aa01bd5 feature/1220 origin handle exists method (#1243)
* feat: add docs and CI workflow for publishing to onsonr.dev

* (refactor): Move hway,motr executables to their own repos

* feat: simplify devnet and testnet configurations

* refactor: update import path for didcrypto package

* docs(networks): Add README with project overview, architecture, and community links

* refactor: Move network configurations to deploy directory

* build: update golang version to 1.23

* refactor: move logger interface to appropriate package

* refactor: Move devnet configuration to networks/devnet

* chore: improve release process with date variable

* (chore): Move Crypto Library

* refactor: improve code structure and readability in DID module

* feat: integrate Trunk CI checks

* ci: optimize CI workflow by removing redundant build jobs

* feat: integrate Trunk CI checks, simplify devnet and testnet configurations, add docs and CI for onsonr.dev publishing, automate releases using Taskfile and GitHub Actions, and add Reddit release notification

* ci: Trigger release validation on pull requests

* ci: Migrate GoReleaser configuration to Makefiles

* chore: update CI workflow permissions and rename job

* refactor: remove unnecessary docker push steps from release process

* feat: automate release process using Taskfile and GitHub Actions

* fix: change shebang from bash to sh

* chore: update setup script shebang to bash

* chore: remove unnecessary setup-env step from release process

* test: improve test descriptions and naming for clarity

* refactor: rename workflow files for clarity

* refactor: rename post-merge workflow file

* refactor: Move race and coverage tests to separate workflow

* refactor: simplify merge group trigger

* chore: prevent accidental release overwriting of existing tags

* test: rename GoReleaser Dry Run step to GoReleaser Test

* fix: correct GitHub Actions workflow for version bumping

* fix: Correct tag validation in CI workflow

* refactor: simplify GitHub Actions workflow for version checking

* test: replace version check with make command

* chore: update setup-python action to v5

* test: rename workflow job and remove unnecessary steps

* feat: enable workflow on merge group events

---------

Signed-off-by: Prad Nukala <prad@sonr.io>
Co-authored-by: Darp Alakun <i@prad.nu>
2025-01-06 14:00:11 -05:00
root 2f65b1c283 refactor: simplify release process and remove unnecessary tasks 2025-01-06 13:12:38 -05:00
root 48f7b5d5cc chore: update version number to 0.6.1 2025-01-06 13:09:38 -05:00
d26d3d7b4d feature/1220 origin handle exists method (#1242)
* feat: add docs and CI workflow for publishing to onsonr.dev

* (refactor): Move hway,motr executables to their own repos

* feat: simplify devnet and testnet configurations

* refactor: update import path for didcrypto package

* docs(networks): Add README with project overview, architecture, and community links

* refactor: Move network configurations to deploy directory

* build: update golang version to 1.23

* refactor: move logger interface to appropriate package

* refactor: Move devnet configuration to networks/devnet

* chore: improve release process with date variable

* (chore): Move Crypto Library

* refactor: improve code structure and readability in DID module

* feat: integrate Trunk CI checks

* ci: optimize CI workflow by removing redundant build jobs

* feat: integrate Trunk CI checks, simplify devnet and testnet configurations, add docs and CI for onsonr.dev publishing, automate releases using Taskfile and GitHub Actions, and add Reddit release notification

* ci: Trigger release validation on pull requests

* ci: Migrate GoReleaser configuration to Makefiles

* chore: update CI workflow permissions and rename job

---------

Co-authored-by: Darp Alakun <i@prad.nu>
2025-01-06 17:24:48 +00:00
807b2e86ec feature/1220 origin handle exists method (#1241)
* feat: add docs and CI workflow for publishing to onsonr.dev

* (refactor): Move hway,motr executables to their own repos

* feat: simplify devnet and testnet configurations

* refactor: update import path for didcrypto package

* docs(networks): Add README with project overview, architecture, and community links

* refactor: Move network configurations to deploy directory

* build: update golang version to 1.23

* refactor: move logger interface to appropriate package

* refactor: Move devnet configuration to networks/devnet

* chore: improve release process with date variable

* (chore): Move Crypto Library

* refactor: improve code structure and readability in DID module

* feat: integrate Trunk CI checks

* ci: optimize CI workflow by removing redundant build jobs

---------

Co-authored-by: Darp Alakun <i@prad.nu>
2025-01-06 17:06:10 +00:00
root 9bd5e41fa0 docs: add .gitignore entries for Aider generated files 2025-01-03 11:44:12 -05:00
Prad Nukala 2ae32b2f64 refactor: remove devcontainer configuration 2025-01-01 16:21:42 -05:00
Prad Nukala ef7c33a011 chore: disable Reddit release announcement 2025-01-01 15:49:01 -05:00
Prad Nukala ac8250557d refactor: simplify release workflow and remove unnecessary Taskfile includes 2025-01-01 15:42:11 -05:00
Prad Nukala 8764e93437 refactor: improve release process using goreleaser and taskfile 2025-01-01 15:34:51 -05:00
Prad Nukala 8224fd3683 fix: pass working directory to goreleaser task 2025-01-01 15:28:15 -05:00
Prad Nukala a5dd620b17 feat: automate release process using Taskfile and GitHub Actions 2025-01-01 15:22:40 -05:00
Prad Nukala 57bce7d50e ci: Enable remote taskfiles in release workflow 2025-01-01 15:15:24 -05:00
Prad Nukala 5c5e909ffd refactor: simplify release workflow using a single task 2025-01-01 15:13:22 -05:00
Prad Nukala 0cf308016b ci: improve release workflow by adding task installation step 2025-01-01 15:12:46 -05:00
Prad Nukala 9787394d5a fix: correct release name template syntax 2025-01-01 14:58:02 -05:00
Prad Nukala a90111907d refactor: improve release naming and environment variable handling 2025-01-01 14:52:37 -05:00
Prad Nukala 7c8fa0045c Merge branch 'feature/1232-create-vault-settings' into feature/1220-origin-handle-exists-method 2025-01-01 14:31:18 -05:00
Prad Nukala 0eb5530422 feat: add Reddit release notification 2025-01-01 14:30:34 -05:00
Prad Nukala a90a553222 refactor: improve goreleaser archive and nfpms configuration 2025-01-01 14:11:36 -05:00
Prad Nukala aee9af7b34 chore: update next milestone in scopes.json 2025-01-01 13:55:21 -05:00
Prad Nukala 571fb6100b refactor: remove outdated scopes 2024-12-30 14:18:33 -05:00
Prad Nukala 0a7b7d9fe2 refactor: remove unnecessary seed message 2024-12-30 12:31:55 -05:00
Prad Nukala (aider) afc6343c21 fix: Handle only 500 errors in ErrorHandler 2024-12-29 13:19:21 -05:00
Prad Nukala bb0e8495d3 fix: Return only on 500 errors in error handler 2024-12-29 13:19:20 -05:00
Prad Nukala (aider) 26a322a5ea fix: update sqlc queries to match schema and use SQLite conventions 2024-12-29 01:22:19 -05:00
Prad Nukala 014ce98359 refactor: Update sqlc queries to match schema and sqlite conventions 2024-12-29 01:22:18 -05:00
Prad Nukala (aider) ddf2f6232a ```
refactor: convert schema to SQLite
```
2024-12-29 01:20:47 -05:00
Prad Nukala 2486ff3c94 feat: convert highway sink schema to SQLite 2024-12-29 01:20:46 -05:00
Prad Nukala (aider) 9b0a78adda fix: Rename DecodeWasmContext to decodeWasmContext 2024-12-29 00:42:28 -05:00
Prad Nukala b727a52193 fix: resolve lint errors in WASMMiddleware function 2024-12-29 00:42:27 -05:00
Prad Nukala e0d4427153 <no value> 2024-12-28 23:53:54 -05:00
Prad Nukala 356093d08a refactor: move gateway and vault components to new locations 2024-12-28 18:08:59 -05:00
Prad Nukala b0a91ddf14 build: update dependencies 2024-12-28 14:52:43 -05:00
Prad aa8f8c004f chore(dependabot): update dependabot configuration 2024-12-27 06:23:10 +00:00
Prad d8e5bc9f37 chore(scripts): improve new issue script confirmation 2024-12-26 19:32:23 +00:00
Prad 75adb6200d refactor(scopes): simplify scopes.json structure 2024-12-26 19:20:32 +00:00
Prad 92df0375dd feat(scopes): add Web Authentication API documentation 2024-12-24 23:38:00 +00:00
Prad d6f6023d8b chore(.github): update keywords in scopes.json 2024-12-24 23:36:05 +00:00
Prad 3c450ad795 docs(scopes.json): add more specific keywords to documentation links 2024-12-24 23:33:27 +00:00
Prad 4ce9a45912 refactor(scopes): rename and reorganize scopes 2024-12-24 23:07:44 +00:00
Prad 68aa232368 refactor(api): remove unused Allocate RPC from Query service 2024-12-24 18:52:03 +00:00
Prad Nukala 2545ab5748 refactor: remove postgresql tasks 2024-12-24 12:02:19 -05:00
Prad Nukala a5c17cb3db feat: add install script for Sonr binaries 2024-12-24 12:01:20 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Prad Nukala
280b441a4b chore(deps): bump github.com/jackc/pgx/v5 from 5.7.1 to 5.7.2 (#1211)
Bumps [github.com/jackc/pgx/v5](https://github.com/jackc/pgx) from 5.7.1 to 5.7.2.
- [Changelog](https://github.com/jackc/pgx/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jackc/pgx/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: github.com/jackc/pgx/v5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prad Nukala <prad@sonr.io>
2024-12-24 16:56:40 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Prad Nukala
145499e1e4 chore(deps): bump github.com/cosmos/cosmos-db from 1.0.2 to 1.1.1 (#1207)
Bumps [github.com/cosmos/cosmos-db](https://github.com/cosmos/cosmos-db) from 1.0.2 to 1.1.1.
- [Changelog](https://github.com/cosmos/cosmos-db/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-db/compare/v1.0.2...v1.1.1)

---
updated-dependencies:
- dependency-name: github.com/cosmos/cosmos-db
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prad Nukala <prad@sonr.io>
2024-12-24 16:56:34 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Prad Nukala
0ccfa47e7b chore(deps): bump google.golang.org/protobuf from 1.35.2 to 1.36.0 (#1210)
Bumps google.golang.org/protobuf from 1.35.2 to 1.36.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prad Nukala <prad@sonr.io>
2024-12-24 16:56:25 +00:00
Prad Nukala e2735d5cd1 refactor: remove unused AI PR body generator step 2024-12-24 11:49:42 -05:00
Prad Nukala 5eb1f0d0a9 ci: improve CI workflow efficiency by removing merge 2024-12-24 11:46:10 -05:00
Prad Nukala a3652e3f2f chore: upgrade actions to latest versions 2024-12-24 11:44:15 -05:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Prad Nukala
7d344ef854 chore(deps): bump cosmossdk.io/api from 0.7.5 to 0.7.6 (#1209)
Bumps [cosmossdk.io/api](https://github.com/cosmos/cosmos-sdk) from 0.7.5 to 0.7.6.
- [Release notes](https://github.com/cosmos/cosmos-sdk/releases)
- [Changelog](https://github.com/cosmos/cosmos-sdk/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cosmos/cosmos-sdk/compare/api/v0.7.5...api/v0.7.6)

---
updated-dependencies:
- dependency-name: cosmossdk.io/api
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prad Nukala <prad@sonr.io>
2024-12-24 16:43:02 +00:00
Prad Nukala 378d259895 fix: prevent automatic version bumps from dependabot 2024-12-24 11:40:15 -05:00
Prad Nukala 3bbec0ebed refactor: simplify Taskfile and remove unused chain configurations 2024-12-24 11:36:02 -05:00
Prad Nukala 4c9919f0a0 fix: correct merge workflow to increment patch version 2024-12-24 11:32:47 -05:00
github-actions[bot] c77bf5d1ea bump: version 0.5.27 → 0.6.0 2024-12-24 16:25:16 +00:00
Prad NukalaandGitHub 143053e355 test: Add commitizen dry run step to checks workflow (#1217) 2024-12-24 16:24:04 +00:00
Prad NukalaandGitHub 47c3a53080 refactor/internal (#1216)
* refactor: update import paths in gateway handlers

* refactor: remove obsolete devtools Makefile and README

* build: optimize build process for improved efficiency

* refactor: remove obsolete pkl files related to Matrix and Sonr network configurations

* refactor: move embed code to x/dwn/types
2024-12-24 16:10:20 +00:00
Prad NukalaandGitHub 0ec2f7d86a feature/1214 session fetch refactor (#1215)
* chore(docs): remove token economy guide

* refactor(context): update GatewayContext to use Querier interface

* chore(database): update schema path

* docs: Update READMEs for x/did, x/dwn, and x/svc with UCAN integration

* chore(pkg): update database scope name

* refactor(did): optimize GenesisState proto methods

* refactor(svc): update Service proto to use repeated fields

* refactor(api): rename MsgSpawn to MsgInitialize
2024-12-24 15:38:17 +00:00
Prad Nukala 398864fc6b refactor: rename DID, DWN, and SVC modules to core-dids, core-dwns, and core-svcs respectively 2024-12-24 03:37:27 -05:00
Prad Nukala 630e4ad7f0 refactor: rename MsgInitialize to MsgSpawn for clarity 2024-12-24 00:59:42 -05:00
Prad Nukala 7e50d7f76d refactor: rename scopes in .github/scopes.json for better clarity 2024-12-23 20:35:34 -05:00
Prad 9dfb8634bc chore(workflows): improve CI/CD workflow names 2024-12-23 18:42:34 +00:00
Prad Nukala 9556faabb9 feat: Add option to create draft issues from the new-issue script 2024-12-23 13:35:52 -05:00
Prad c9cc4042db chore(release): remove version bumping workflow 2024-12-23 15:37:07 +00:00
Prad fc9995dd40 chore(configs): remove unused logs config file 2024-12-23 15:34:45 +00:00
Prad 5cc450c170 chore(dependencies): remove PostgreSQL lockfile 2024-12-23 15:33:14 +00:00
Prad NukalaandGitHub d3cfd27f5a Fix/actions (#1213)
* ci(release): trigger release on main branch push

* chore(release): update release workflow to use main branch
2024-12-23 02:14:04 +00:00
Prad NukalaandGitHub 30c984fd90 Feature/deploy linux (#1212)
* chore(deploy): remove devbox configuration

* feat(taskfiles): add mount and platform specific start commands for IPFS

* feat(gateway): update registration route

---------

Signed-off-by: Prad Nukala <prad@sonr.io>
2024-12-23 02:05:51 +00:00
Prad NukalaandGitHub 4d6a8628af feature/deploy linux (#1206)
* chore(deploy): remove devbox configuration

* feat(taskfiles): add mount and platform specific start commands for IPFS
2024-12-22 23:43:30 +00:00
Prad 59b561d2d9 ci(publish): trigger workflow on release creation 2024-12-22 22:14:15 +00:00
Prad 77fe287a0b chore(release): remove unnecessary dependencies in release workflow 2024-12-22 22:13:14 +00:00
Prad NukalaandGitHub d69c2a9d53 feature/refactor ui (#1205)
* fix: correct HTTP error handling in gateway

* refactor: migrate database and ORM to internal modules

* feat: introduce taskfile build system for improved workflow management

* refactor: update taskfiles to use relative paths

* feat: add profile status field

* refactor: move rendering logic to context package

* fix: improve error handling in credentials retrieval

* refactor: optimize HTTP request handling in Wasm environment

* refactor: refactor config loading in motr command

* chore: add process-compose for service management

* chore: remove default task and update gum format command

* fix: update project dependencies

* refactor: improve code readability and maintainability

* refactor: consolidate error handling components

* refactor: update index handler to use new context package

* refactor: consolidate database scripts and move to deploy directory

* feat: Update flake.nix with development tools and environment configuration

* fix: ignore flake.lock file

* refactor: migrate build process to use taskfiles for improved modularity and maintainability

* refactor: improve GatewayContext and reorganize handlers

* refactor: Remove unused profile creation functions

* (chore): templ generation

* test: add test file for vaults.go

* maintenance: remove defunct Discord server link

* docs: update checks workflow documentation

* test: remove obsolete vaults test file

* refactor: move version bumping logic to release workflow
2024-12-22 17:01:11 -05:00
Prad Nukala c9004e75df refactor: update testnet configuration 2024-12-20 11:12:02 -05:00
Prad 52041fe3d6 chore(scripts): use sonr project and test config in doppler secrets 2024-12-19 17:07:36 +00:00
Prad b9ad8e1e78 style(scripts): remove unnecessary comments 2024-12-19 17:00:08 +00:00
Prad NukalaandGitHub 920703c0c7 refactor: optimize GitHub Actions workflow triggers (#1204) 2024-12-19 12:12:19 +00:00
Prad NukalaandGitHub 77298c79af fix/ci cd (#1197)
* chore: remove deprecated label-pr workflow

* chore: reduce Dependabot update frequency to monthly

* ci: adjust CI to account for removed db reset

* refactor: improve CI/CD workflows for release and checks
2024-12-19 06:49:21 -05:00
Prad NukalaandGitHub 9d86dad38d Fix/hway db driver (#1198)
* fix/hway-db-driver

* fix/hway-db-driver

* chore(scripts): add tx indexer and psql connection to test

* fix(scripts): make testnet setup more robust and configurable
2024-12-19 11:22:44 +00:00
Prad 36191d2bd4 refactor: Move embed 2024-12-19 00:50:45 +00:00
Prad 265aec187e fix: Sink 2024-12-19 00:48:42 +00:00
Prad NukalaandGitHub 6072f6ecfa feature/implement wss routes (#1196)
* feat(database): create schema for hway and motr

* fix(gateway): correct naming inconsistencies in handlers

* build: update schema file to be compatible with postgresql syntax

* fix: update schema to be compatible with PostgreSQL syntax

* chore: update query_hway.sql to follow sqlc syntax

* ```text
refactor: update query_hway.sql for PostgreSQL and sqlc
```

* feat: add vaults table to store encrypted data

* refactor: Update vaults table schema for sqlc compatibility

* chore(deps): Upgrade dependencies and add pgx/v5

* refactor(Makefile): move sqlc generate to internal/models

* docs(foundations): remove outdated pages

* chore(build): add Taskfile for build tasks

* refactor(embed): move embed files to internal package

* docs: add documentation for Cosmos SDK ORM
2024-12-18 20:53:45 +00:00
Prad Nukala fc001216a8 chore: ignore interchaintest downloader files 2024-12-17 05:26:09 +00:00
github-actions[bot] 354fdabdc4 bump: version 0.5.26 → 0.5.27 2024-12-16 20:33:10 +00:00
Prad NukalaandGitHub 7c4586ce90 feature/simplify ucan mpc did (#1195)
* feat: enable DID auth middleware

* feat: implement passkey creation flow

* feat: persist user address in cookie and retrieve user profile using address cookie

* feat: implement human verification challenge during session initialization

* refactor: remove unnecessary random number generation in profile creation

* refactor: rename credential validation handler and update related routes

* feat: improve profile validation and user experience

* feat: add page rendering for profile and passkey creation

* refactor: remove unused register handler and update routes

* refactor: remove unused imports and simplify credential validation

* fix: Correct insecure gRPC client connection

* refactor: rename models files for better organization

* refactor: refactor grpc client creation and management

* refactor: refactor common clients package

* <no value>

* feat: add CapAccount, CapInterchain, CapVault enums

* feat: add ChainId to ResAccount and ResInterchain

* feat: add asset code to resource account enumeration

* refactor: rename services package to providers

* feat: implement gateway database interactions

* refactor: move gateway repository to internal/gateway

* refactor: Migrate database provider to use sqlx

* refactor: Rename Vaults to VaultProvider in HTTPContext struct

* refactor: Migrate from GORM to sqlc Queries in database context methods

* refactor: Replace GORM with standard SQL and simplify database initialization

* refactor: Migrate session management from GORM to sqlc with type conversion

* refactor: Update import paths and model references in context package

* fix: Resolve session type conversion and middleware issues

* refactor: Migrate database from GORM to sqlx

* refactor: Move models to pkg/common, improve code structure

* refactor: move repository package to internal directory

* refactor: move gateway internal packages to context directory

* refactor: migrate database provider to use sqlx queries

* feat: add session ID to HTTP context and use it to load session data

* feat: implement vault creation API endpoint

* feat: add DIDKey generation from PubKey

* refactor: remove unused DIDAuth components

* refactor: move DID auth controller to vault context

* chore: remove unused DIDAuth package

* refactor: improve clarity of enclave refresh function

* feat: implement nonce-based key encryption for improved security

* feat: Add Export and Import methods with comprehensive tests for Enclave

* fix: Validate AES key length in keyshare encryption and decryption

* fix: Resolve key length validation by hashing input keys

* refactor: Update keyshare import to use protocol decoding

* feat: Refactor enclave encryption to support full enclave export/import

* refactor: Simplify Enclave interface methods by removing role parameter

* refactor: remove unnecessary serialization from enclave interface

* refactor: rename models package in gateway context

* refactor: rename keystore vault constants

* refactor: remove context parameter from Resolver methods

* feat: add CurrentBlock context function and update related components

* refactor: rename resolver.go to resolvers.go

* feat: Add SQLite random() generation for session and profile initialization

* refactor: Update SQL queries to use SQLite-style parameter placeholders

* refactor: Replace '?' placeholders with '$n' PostgreSQL parameter syntax

* <no value>

* refactor: refactor gateway to use middleware for database interactions and improve modularity

* feat: implement gateway for Sonr highway

* refactor: Remove unused gateway context and refactor cookie/header handling

* refactor: improve server initialization and middleware handling

* feat: implement human verification for profile creation

* feat: implement session management middleware

* refactor: refactor common models and config to internal package

* refactor: move env config to internal/config

* refactor: move database-related code to  directory

* refactor: move IPFS client to common package and improve code structure

* refactor: move querier to common package and rename to chain_query

* refactor: move webworker model to internal/models

* feat: add initial view template for Sonr.ID

* docs(concepts): Add documentation for cosmos-proto

* docs: move IBC transfer documentation to tools section

* refactor: rename initpkl.go to pkl_init.go for better naming consistency

* docs(theme): update dark mode toggle icons

* refactor: update sqlite3 driver to ncruces/go-sqlite3

* feat: add Vault model and database interactions

* refactor: Improve SQLite schema with better constraints and indexes

* chore: update project dependencies

* fix: use grpc.WithInsecure() for gRPC connection

* config: set localhost as default Sonr gRPC URL

* refactor: improve gateway middleware and refactor server initialization

* refactor: Remove foreign key pragma from schema SQL

* refactor: Remove foreign key constraints from database schema

* refactor: Convert primary key columns from INTEGER to TEXT

* refactor: Remove unnecessary redirect in error handling
2024-12-16 20:29:54 +00:00
Prad Nukala 6d27b926f6 Merge branch 'master' into develop 2024-12-13 15:28:42 -05:00
github-actions[bot] f74bdc1d79 bump: version 0.5.25 → 0.5.26 2024-12-13 20:28:05 +00:00
Prad Nukala 8522cb8d47 test: remove unnecessary tests from CI 2024-12-13 15:27:44 -05:00
Prad Nukala 30475b9fbd Merge branch 'develop' 2024-12-13 15:23:14 -05:00
Prad Nukala 1388a673e5 ci: Implement comprehensive CI/CD workflow with build, unit, race, and coverage tests 2024-12-13 15:22:37 -05:00
Prad NukalaandGitHub ac8c153b28 feature/1120 leverage service authorization (#1188)
* refactor: remove redundant branch trigger for scheduled releases

* refactor: simplify process-compose commands and improve logging

* refactor: remove redundant  command

* refactor: remove unused error variables and simplify database configuration

* feat: introduce task runner for project automation

* refactor: Remove hardcoded action and method from form components

* refactor: move server setup to main.go and add prometheus metrics

* refactor: move index handlers to render handlers

* refactor: improve user identification logic in gateway and vault handlers

* refactor: rename TitleDescription to TitleDesc for consistency

* feat: integrate go-useragent library for enhanced user agent parsing

* feat: enhance initial view rendering based on device type

* feat: Add support for PostgreSQL database

* fix: Use formatPsqlDSN() to properly set PostgreSQL DSN from command flags

* feat: Add PostgreSQL support with fallback to SQLite in NewGormDB

* feat: Add PostgreSQL connection validation with SQLite fallback

* chore: update golang.org/x/crypto dependency to v0.31.0

* feat: add PKL-based configuration initialization

* refactor: improve file naming consistency in cmd/sonrd

* refactor: Improve init-pkl command with safer config file generation and error handling

* fix: add logging for pkl evaluation results

* refactor: Move credential handling to gateway context

* refactor: Migrate session models to gateway package

* refactor: rename models and update User model

* chore: initial commit for address and pubkey functionality

* refactor: move pubkey package to keys package

* refactor: Rename models and add resolver service

* feat: add gRPC clients for bank, DID, DWN, and SVC modules

* refactor: Migrate title and description components from text package to hero package

* refactor: improve file naming conventions

* feat: add user credential validation

* refactor: rename registration handlers and routes for clarity

* <no value>

* refactor: Decouple database and IPFS interactions from server setup

* refactor: Migrate configuration from class-based to TOML-based structure

* refactor: move network configuration files to sonr.net module

* feature/1120-leverage-service-authorization

* fix: correct DID identifier creation function name

* feat: add compressed and uncompressed public keys to keyset

* refactor: move address packages to crypto/address

* feat: implement pubkey verification

* refactor: remove ECDSA-related functions from keyshare and protocol modules

* feat: Implement ECDSA signature serialization

* <no value>

* feat: add vault service for IPFS token storage

* refactor: update ucan codec to use new DID generation method

* refactor: refactor key management and move address parsers to keys package

* refactor: rename key parsers and move to parsers package

* fix: resolved import issues with the new spec

* feat: improve user onboarding experience by updating button text and functionality

* refactor: update point marshaling and unmarshaling methods to use JSON

* refactor: remove unnecessary DID method from PubKey

* refactor: Rename and refactor MPC key generation functions

* test: Add comprehensive test suite for keyshare generation and validation

* test: Fix keyshare role validation and encoding tests

* feat: Update key share role tests with enclave initialization validation

* test(mpc): refactor tests to focus on public API and remove internal role checks

* refactor: Remove unnecessary role check in initKeyEnclave function

* fix: Enforce strict order for validator and user keyshares in enclave initialization

* fix: Update codec_test to match latest codec implementation

* refactor: Update KeyEnclave to use string-based key shares and improve error handling

* fix: Refactor MPC enclave to use string-based encoding and simplify key management

* refactor: Remove redundant keyshare decoding tests in codec_test.go

* fix: Resolve type conversion issues in MPC crypto enclave initialization

* fix: Convert CID to byte slice in addEnclaveIPFS function

* fix: Resolve type conversion and constant definition errors in MPC crypto utils

* refactor: Simplify KeyShare encoding and role handling in MPC codec

* fix: Resolve JSON unmarshaling type mismatch in KeyShare.Message()

* fix: Refactor KeyEnclave to use struct and Enclave interface

* fix: Resolve type and naming conflicts in MPC crypto package

* refactor: Update codec_test.go to use new KeyEnclave struct fields

* refactor: remove keyshare encoding and decoding logic

* refactor: Remove unused JSON marshaling functions for curve points

* fix: Improve signature serialization and deserialization in MPC crypto

This commit addresses several issues with signature handling:
- Fixed signature length to 65 bytes
- Added proper padding for R and S values
- Added nil and zero value checks
- Improved error messages for signature parsing

The changes ensure more robust signature encoding and decoding, preventing potential nil pointer and invalid signature issues.

* fix: Update signature serialization to match protocol test approach

* refactor: Simplify KeyEnclave struct and improve message handling

* fix: Improve signature serialization and verification in MPC crypto module

* refactor: Simplify enclave validation using IsValid method in test

* refactor: Add marshaling and comprehensive tests for KeyEnclave

* feat: Add JSON marshaling support for Point in KeyEnclave

* refactor: Rename KeyEnclave to Enclave and update related functions

* refactor: Update PubKey verification to use SHA3-256 hashing

* test: Add comprehensive tests for DID and PubKey implementations

* refactor: simplify DID key retrieval

* test: refactor CI workflow and remove unused DIDAuth middleware

* The changes look good! The updated workflows will now:

1. Run tests on push to master
2. Bump the version if the commit doesn't already start with 'bump:'
3. Trigger a release workflow automatically with the new version tag
4. Create and publish the release

A few things to note:
- Make sure you have the `peter-evans/repository-dispatch` action installed/available
- The `commitizen-tools/commitizen-action` should output the new tag for this to work
- Ensure your release workflow can handle the repository dispatch event

Would you like me to review or suggest any additional modifications to the workflows?

* ci(github actions): add build stage dependency for tests

* fix(workflow): update workflow to trigger on PR edits

* test: Update unit test dependencies

* ci: Add GoReleaser dry-run check for merge group events

* test: remove unnecessary dependencies between test jobs

* ci: Make race and coverage tests depend on build tests
2024-12-13 20:10:27 +00:00
Prad Nukala ee12bf684e fix: Correct regular expression for version tags in release workflow 2024-12-11 17:46:18 -05:00
github-actions[bot] 63dc68caac bump: version 0.5.24 → 0.5.25 2024-12-11 22:46:17 +00:00
Prad Nukala ec57c76a2a feat: enable GoReleaser releases on tags and snapshots 2024-12-11 17:45:13 -05:00
Prad Nukala 99e9eefffb feat: automate release on tag and workflow dispatch 2024-12-11 17:43:56 -05:00
2066 changed files with 588470 additions and 58154 deletions
-8
View File
@@ -1,8 +0,0 @@
[tool.commitizen]
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "semver"
version = "0.5.24"
update_changelog_on_bump = true
major_version_zero = true
changelog_file = "./docs/docs/changelog/index.md"
+4 -6
View File
@@ -5,13 +5,11 @@ WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
# Copy devbox configuration files
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
RUN devbox run -- echo "Installed Packages."
RUN devbox run -- echo "Installed Packages." && nix-store --gc && nix-store --optimise
RUN devbox shellenv --init-hook >> ~/.profile
+3 -78
View File
@@ -7,83 +7,8 @@
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"jetpack-io.devbox"
]
"extensions": ["jetpack-io.devbox"]
}
},
"remoteUser": "devbox",
"forwardPorts": [
1317,
26657,
9090,
3000,
80,
5000
],
"portsAttributes": {
"1317": {
"label": "sonr-api",
"onAutoForward": "notify"
},
"26657": {
"label": "sonr-rpc",
"onAutoForward": "notify"
},
"9090": {
"label": "sonr-grpc",
"onAutoForward": "silent"
},
"3000": {
"label": "hway-frontend",
"onAutoForward": "silent"
},
"80": {
"label": "ipfs-gateway",
"onAutoForward": "silent"
},
"5000": {
"label": "ipfs-api",
"onAutoForward": "silent"
}
},
"features": {
"ghcr.io/michidk/devcontainers-features/bun:1": {
"version": "latest"
},
"ghcr.io/cirolosapio/devcontainers-features/alpine-ohmyzsh:0": {
"version": "latest"
},
"ghcr.io/guiyomh/features/golangci-lint:0": {
"version": "latest"
},
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/github-cli:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "latest",
"go": "1.23"
},
"ghcr.io/devcontainers/features/rust:1": {
"version": "latest",
"rust": "1.73"
},
"ghcr.io/jpawlowski/devcontainer-features/codespaces-dotfiles:1": {
"version": "latest"
},
"ghcr.io/duduribeiro/devcontainer-features/neovim:1": {
"version": "latest"
},
"ghcr.io/dlouwers/devcontainer-features/devbox:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
}
"remoteUser": "devbox"
}
+6
View File
@@ -0,0 +1,6 @@
etc
web
packages
build
dist
test
+119
View File
@@ -0,0 +1,119 @@
# CI/CD Workflows
## Overview
Our CI/CD pipeline is optimized for speed and automation using:
- Self-hosted `builder` runner for better performance
- Smart scope detection via `github-env.sh`
- Automated versioning and releases via `devbox` commands
## Workflows
### PR CI (`pr.yml`)
**Trigger**: Pull requests
**Purpose**: Validate, test, and build changed components
**Features**:
- Only tests/builds affected scopes
- Runs linting first for fast feedback
- Cleans up artifacts after run
### Post-Merge Release (`merge.yml`)
**Trigger**: Push to master/main
**Purpose**: Automated version bumping and releases
**Features**:
- Auto-detects version increment from milestones
- Bumps versions, creates tags, and releases
- Publishes to package registries
### Nightly Snapshot (`nightly.yml`)
**Trigger**: Daily at 2 AM UTC or manual
**Purpose**: Build development snapshots
**Features**:
- Creates snapshot builds without version bumps
- Useful for testing bleeding-edge changes
### Manual Release (`manual-release.yml`)
**Trigger**: Manual workflow dispatch
**Purpose**: Override for emergency releases
**Features**:
- Select specific scope to release
- Choose version increment (patch/minor/major)
- Bypasses automatic detection
### CI Status (`ci-status.yml`)
**Trigger**: Other workflow completions
**Purpose**: Monitor CI health and report failures
## Key Commands
All workflows use these devbox commands that automatically detect changes:
```bash
devbox run test # Tests only affected scopes
devbox run build # Builds only affected scopes
devbox run bump # Bumps versions for affected scopes
devbox run release # Releases affected scopes
devbox run publish # Publishes affected scopes
devbox run snapshot # Creates snapshots for affected scopes
```
## Performance Optimizations
1. **Self-hosted Runner**: All workflows run on `builder` for:
- Local dependency caching
- No cold starts
- Unlimited build time
2. **Smart Caching**:
- Go modules cached at `~/go/pkg/mod`
- pnpm store cached at `~/.local/share/pnpm/store`
- Devbox packages cached at `~/.devbox`
3. **Scope Detection**: Only test/build what changed using `github-env.sh`
4. **Cleanup Steps**: Prevent disk fill on self-hosted runner
## Adding New Components
1. Add scope to `.github/scopes.json`:
```json
{
"name": "new-component",
"include": ["path/to/component/**"]
}
```
2. Add scripts to `devbox.json`:
```json
"test:new-component": "make test-new-component",
"build:new-component": "make build-new-component",
"bump:new-component": "make -C path/to/component bump",
"release:new-component": "make -C path/to/component release"
```
3. That's it! CI automatically picks up the new scope.
## Secrets Required
- `GH_PAT_TOKEN`: GitHub Personal Access Token for pushing tags
- `GORELEASER_KEY`: GoReleaser Pro license key
- `NPM_TOKEN`: NPM registry authentication
- `CLOUDFLARE_API_TOKEN`: For deploying web apps
- `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY`: For S3 uploads
## Troubleshooting
### Workflow not detecting changes?
- Check `.github/scopes.json` includes the correct paths
- Verify `github-env.sh` is executable
- Ensure full git history with `fetch-depth: 0`
### Self-hosted runner issues?
- Check runner has required dependencies
- Verify disk space for builds
- Check runner is online in Settings > Actions > Runners
### Release not triggering?
- Verify component has `bump:*` and `release:*` scripts
- Check git permissions with PAT token
- Ensure commitizen config exists for component
+1
View File
@@ -0,0 +1 @@
@prnk28
-30
View File
@@ -1,30 +0,0 @@
title: "[Milestone] "
labels: ["#OKR", "#PLANNING"]
body:
- type: input
id: has-version
attributes:
label: Version
description: A tag for the associated milestone.
placeholder: v0.6.0
validations:
required: true
- type: textarea
attributes:
label: Objective
description: Explain the objective of the OKR in less than 100 characters.
placeholder: Ethereum IBC integration with Sonr.
render: markdown
validations:
required: true
- type: textarea
attributes:
label: Task List
description: |
Break down the objective into a list of tasks to be completed.
value: |
- [ ] #
- [ ] #
- [ ] #
validations:
required: true
-38
View File
@@ -1,38 +0,0 @@
name: Bug Report
description: File a bug report.
title: "ERROR: "
labels: ["#BUG", "#HELP"]
projects: ["onsonr/39"]
body:
- type: textarea
attributes:
label: Operating System
description: What operating system are you using?
placeholder: "Example: macOS Big Sur"
value: operating system
validations:
required: true
- type: dropdown
attributes:
label: Network
description: What network are you using?
multiple: false
options:
- LocalNet
- TestNet
- MainNet
default: 0
validations:
required: true
- type: checkboxes
attributes:
label: Code of Conduct
description:
The Code of Conduct helps create a safe space for everyone. We require
that everyone agrees to it.
options:
- label: I agree to follow this project's [Code of Conduct](link/to/coc)
required: true
- type: markdown
attributes:
value: "Thanks for completing our form!"
-5
View File
@@ -1,5 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Community Discussions
url: https://github.com/orgs/onsonr/discussions
about: Please submit ideas and suggestions here.
-22
View File
@@ -1,22 +0,0 @@
---
name: Default Todo
about: Break down feature requirements into tasks.
title: "Name of the new task"
labels:
- "#TODO"
- "#OKR"
assignees: "prnk28"
projects: "onsonr/37"
---
### Description
The expected deliverable of the task.
### Associated Files
These files will be modified by this task.
### References
Use these documents to help you complete the task.
-25
View File
@@ -1,25 +0,0 @@
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
## Related Issue(s)
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
## Screenshots (if appropriate):
+515
View File
@@ -0,0 +1,515 @@
[![Go Reference](https://pkg.go.dev/badge/github.com/sonr-io/sonr.svg)](https://pkg.go.dev/github.com/sonr-io/sonr)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/sonr-io/sonr)
[![Static Badge](https://img.shields.io/badge/homepage-sonr.io-blue?style=flat-square)](https://sonr.io)
[![Go Report Card](https://goreportcard.com/badge/github.com/sonr-io/sonr)](https://goreportcard.com/report/github.com/sonr-io/sonr)
[![Sonr](./banner.png)](https://sonr.io)
> **Sonr is a blockchain ecosystem combining decentralized identity, secure data storage, and multi-chain interoperability. Built on Cosmos SDK v0.50.14, it provides users with self-sovereign identity through W3C DIDs, WebAuthn authentication, and personal data vaults—all without requiring cryptocurrency for onboarding.**
## 💡 Key Features
### 🔐 Gasless Onboarding
Create your first decentralized identity without owning cryptocurrency:
```bash
# Register with WebAuthn (no tokens required!)
snrd auth register --username alice
# Register with automatic vault creation
snrd auth register --username bob --auto-vault
```
### 🌐 Multi-Chain Support
- **Cosmos SDK**: Native integration with IBC ecosystem
- **EVM Compatibility**: Ethereum smart contract support
- **External Wallets**: MetaMask, Keplr, and more
### 🔑 Advanced Authentication
- **WebAuthn/Passkeys**: Biometric authentication
- **Hardware Security Keys**: YubiKey, Titan Key support
- **Multi-Signature**: Multiple verification methods per DID
### 📦 Decentralized Storage
- **IPFS Integration**: Distributed file storage
- **Encrypted Vaults**: Hardware-backed encryption
- **Protocol Schemas**: Structured data validation
## 📚 Technical Specifications
- **Cosmos SDK**: v0.50.14
- **CometBFT**: v0.38.17
- **IBC**: v8.7.0
- **Go**: 1.24.1 (toolchain 1.24.4)
- **WebAssembly**: CosmWasm v1.5.8
- **Task Queue**: Asynq (Redis-based)
- **Actor System**: Proto.Actor
- **Storage**: IPFS, LevelDB
## 🔒 Security
### Gasless Transaction Security
- Limited to WebAuthn registration only
- Full cryptographic validation required
- Credential uniqueness enforcement
- Anti-replay protection
### WebAuthn Security
- Origin validation
- Challenge-response authentication
- Device binding
- Attestation verification
### Multi-Algorithm Support
- Ed25519 (quantum-resistant)
- ECDSA (secp256k1, P-256)
- RSA (2048, 3072, 4096 bits)
- WebAuthn (ES256, RS256)
## 🚀 Quick Start
### Installation
```bash
# Clone the repository
git clone https://github.com/sonr-io/sonr
cd sonr
# Install the binary
make install
# Verify installation
snrd version
```
### Running a Local Node
```bash
# Start single-node testnet (quick iteration)
make localnet
# Start multi-node testnet with Starship
make testnet-start
# Stop testnet
make testnet-stop
```
### Building from Source
```bash
# Build all binaries
make build # snrd blockchain node
make build-hway # Highway service
make build-vault # Vault WASM plugin
# Build Docker image
make docker
# Generate code from proto files
make proto-gen
```
### Local Development Network
```bash
# Standard localnet (auto-detects best method for your system)
make localnet # Works on Arch Linux, Ubuntu, macOS, etc.
# Docker-based localnet (requires Docker)
make dockernet # Runs in detached mode
# One-time setup for your system (optional)
./scripts/setup_localnet.sh # Installs dependencies and configures environment
```
### Testing
```bash
# Run all tests
make test-all
# Module-specific tests
make test-did # DID module tests
make test-dwn # DWN module tests
make test-svc # Service module tests
# E2E tests
make ictest-basic # Basic chain functionality
make ictest-ibc # IBC transfers
make ictest-wasm # CosmWasm integration
# Test with coverage
make test-cover
```
### Infrastructure
```bash
# IPFS for vault operations
make ipfs-up # Start IPFS infrastructure
make ipfs-down # Stop IPFS infrastructure
make ipfs-status # Check IPFS connectivity
```
## 🏗️ Architecture
Sonr consists of three primary components and three custom modules:
### Service Architecture
```
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Caddy │────▶│ snrd │ │ IPFS │
└─────────┘ └─────────┘ └─────────┘
│ │ │
│ ▼ ▼
│ ┌─────────┐ ┌─────────┐
└─────────▶│ Highway │────▶│ Redis │
└─────────┘ └─────────┘
```
- **Caddy**: Reverse proxy with gRPC-Web support (port 80)
- **Redis**: Task queue backend for Highway (port 6379)
- **Highway**: UCAN-based task processor (port 8090)
- **IPFS**: Distributed storage (API: 5001, Gateway: 8080)
- **snrd**: Blockchain node (gRPC: 9090, REST: 1317)
### Cross-Platform Support
The `localnet` target now automatically detects and uses the best available method:
1. Checks for local binary (built with `make install`)
2. Falls back to Docker if available
3. Handles permission issues on systems like Arch Linux
4. Supports systemd service installation (see `etc/systemd/`)
### Core Components
#### 1. **Blockchain Node (`snrd`)**
The main blockchain daemon built with Cosmos SDK v0.50.14, providing:
- AutoCLI for command generation
- EVM compatibility via Evmos integration
- IBC for cross-chain communication
- CosmWasm smart contract support
#### 2. **Highway Service (`hway`)**
An Asynq-based task processing service for vault operations:
- Redis-backed job queue with priority levels
- Actor-based concurrency using Proto.Actor framework
- Processes cryptographic operations through WebAssembly enclaves
#### 3. **Motor Plugin (`motr`)**
WebAssembly-based vault system providing:
- Secure execution environment for sensitive operations
- Hardware-backed key management
- Multi-party computation capabilities
## 📖 Module Documentation
### DID Module
W3C DID specification implementation with:
- **Gasless WebAuthn Registration**: Create DIDs without cryptocurrency
- **Multi-Algorithm Signatures**: Ed25519, ECDSA, RSA, WebAuthn
- **External Wallet Linking**: MetaMask, Keplr integration
- **Verifiable Credentials**: W3C-compliant credential issuance
```bash
# Create a DID
snrd tx did create-did did:sonr:alice '{"id":"did:sonr:alice",...}' --from alice
# Link external wallet
snrd tx did link-external-wallet did:sonr:alice \
--wallet-address 0x742d35Cc6635C0532925a3b8c17C6e583F4d6A42 \
--wallet-type ethereum \
--from alice
# Query DID
snrd query did resolve did:sonr:alice
```
[Full DID Module Documentation](x/did/README.md)
### DWN Module
Personal data stores with:
- **Structured Data Records**: Hierarchical data organization
- **Protocol-Based Interactions**: Enforceable data schemas
- **Secure Vaults**: Enclave-based key management
- **Multi-Chain Support**: Cosmos SDK and EVM transaction building
```bash
# Create a vault
snrd tx dwn create-vault --from alice
# Store a record
snrd tx dwn write-record '{"data":"...", "protocol":"example.com"}' --from alice
# Query records
snrd query dwn records --owner alice
```
[Full DWN Module Documentation](x/dwn/README.md)
### Service Module
Decentralized service registry featuring:
- **Domain Verification**: DNS-based ownership proof
- **Service Registration**: Verified service endpoints
- **Permission Management**: UCAN capability integration
```bash
# Verify domain ownership
snrd tx svc initiate-domain-verification example.com --from alice
snrd tx svc verify-domain example.com --from alice
# Register service
snrd tx svc register-service my-service example.com \
--permissions "read,write" --from alice
```
[Full Service Module Documentation](x/svc/README.md)
## 🔧 Configuration
### Environment Variables
Environment variables can be configured via Docker Compose:
```bash
# Chain configuration
export CHAIN_ID="localchain_9000-1"
export BLOCK_TIME="1000ms"
# Network selection for Starship
export NETWORK="devnet" # or "testnet"
# Redis configuration
REDIS_URL=redis://redis:6379
REDIS_DB=0
# Highway service
HIGHWAY_PORT=8090
LOG_LEVEL=debug
# IPFS configuration
IPFS_API_URL=http://ipfs:5001
# Caddy configuration
CADDY_DOMAIN=localhost
```
Environment variables can be set directly or via a `.env` file in the project root.
### Docker Compose Services
The project includes a comprehensive Docker Compose setup for running all backend services:
```bash
# Start all services (Redis, Highway, Caddy, IPFS)
make docker-up
# Stop all services
make docker-down
# View service logs
make docker-logs # All services
make docker-logs-redis # Specific service
# Check service health
make docker-status
# Clean up Docker resources
make docker-clean
```
### Starship Configuration
Edit `starship.yml` to configure multi-node testnets:
```yaml
chains:
- id: sonrtest_1-1
name: custom
numValidators: 3
image: onsonr/snrd:latest
# ... additional configuration
```
#### Troubleshooting
**Services not starting:**
```bash
# Check service status
make docker-status
# View detailed logs
make docker-logs
# Ensure Docker network exists
docker network ls | grep sonr-network
```
**Redis connection issues:**
```bash
# Test Redis connectivity
docker exec redis redis-cli ping
# Check Redis logs
make docker-logs-redis
```
**IPFS not accessible:**
```bash
# Verify IPFS is running
curl http://127.0.0.1:5001/api/v0/version
# Check IPFS logs
docker compose -f etc/stack/compose.yml logs ipfs
```
**Port conflicts:**
- Caddy: 80 (HTTP)
- Redis: 6379
- Highway: 8090
- IPFS API: 5001
- IPFS Gateway: 8080
Stop conflicting services or modify ports in `etc/stack/compose.yml`.
## 🏗️ Project Structure
Sonr uses a modern monorepo architecture with pnpm workspaces for JavaScript/TypeScript packages alongside the Go blockchain implementation:
### Workspace Organization
```
sonr/
├── app/ # Application setup and module wiring
├── cmd/ # Binary entry points
│ ├── snrd/ # Blockchain node
│ ├── hway/ # Highway service
│ └── motr/ # Motor WASM plugin
├── x/ # Custom chain modules
│ ├── did/ # W3C DID implementation
│ ├── dwn/ # Decentralized Web Nodes
│ └── svc/ # Service management
├── types/ # Internal packages
│ ├── coins/ # Task processing
│ └── ipfs/ # Authorization networks
├── proto/ # Protobuf definitions
├── scripts/ # Utility scripts
├── test/ # Integration tests
├── docs/ # Documentation site
# Monorepo Packages (pnpm workspaces)
├── packages/ # Core JavaScript/TypeScript packages
│ ├── es/ # @sonr.io/es - ES client library
│ ├── sdk/ # @sonr.io/sdk - SDK package
│ └── ui/ # @sonr.io/ui - Shared UI components
├── cli/ # CLI tools
│ ├── install/ # @sonr.io/install - Installation CLI
│ └── join-testnet/# @sonr.io/join-testnet - Testnet CLI
└── web/ # Web applications
├── auth/ # Authentication app (Next.js)
└── dash/ # Dashboard app (Next.js)
```
### Working with the Monorepo
#### Installation
```bash
# Install all dependencies for the monorepo
pnpm install
# Build all packages
pnpm build
# Run development mode for all packages
pnpm dev
```
#### Package Management
```bash
# Run commands in specific packages
pnpm --filter @sonr.io/es build
pnpm --filter @sonr.io/sdk test
# Add dependencies to specific packages
pnpm --filter @sonr.io/ui add react
# Run commands in all packages
pnpm -r build # Build all packages
pnpm -r test # Test all packages
```
#### Versioning & Publishing
The monorepo uses [Changesets](https://github.com/changesets/changesets) for package versioning:
```bash
# Add a changeset for your changes
pnpm changeset
# Version packages based on changesets
pnpm changeset version
# Publish packages to npm
pnpm changeset publish
```
### Key Technologies
- **pnpm workspaces**: Efficient dependency management with single lockfile
- **TypeScript project references**: Incremental builds and better IDE performance
- **Turbo**: Build orchestration and caching for faster builds
- **Changesets**: Automated versioning and changelog generation
- **Biome**: Fast, unified linting and formatting (replaces ESLint/Prettier)
### Package Dependencies
- `@sonr.io/es`: Core ES client library with protobuf types
- `@sonr.io/sdk`: High-level SDK (depends on @sonr.io/es)
- `@sonr.io/ui`: Shared UI components for web applications
- `@sonr.io/install`: CLI tool for installing Sonr
- `@sonr.io/join-testnet`: CLI tool for joining testnet
- Web apps use all three core packages (@sonr.io/es, @sonr.io/sdk, @sonr.io/ui)
## 🤝 Community & Support
- [GitHub Discussions](https://github.com/sonr-io/sonr/discussions) - Community forum
- [GitHub Issues](https://github.com/sonr-io/sonr/issues) - Bug reports and feature requests
- [Twitter](https://sonr.io/twitter) - Latest updates
- [Documentation Wiki](https://github.com/sonr-io/sonr/wiki) - Detailed guides
## 📄 License
Copyright © 2024 Sonr, Inc.
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
---
<p align="center">
Built with ❤️ by the Sonr team
</p>
-569
View File
@@ -1,569 +0,0 @@
# Protocol Buffers in Cosmos SDK
## Overview
The Cosmos SDK uses Protocol Buffers for serialization and API definitions. Generation is handled via a Docker image: `ghcr.io/cosmos/proto-builder:0.15.x`.
## Generation Tools
- **Buf**: Primary tool for protobuf management
- **protocgen.sh**: Core generation script in `scripts/`
- **Makefile Commands**: Standard commands for generate, lint, format
## Key Components
### Buf Configuration
1. **Workspace Setup**
- Root level buf workspace configuration
- Manages multiple protobuf directories
2. **Directory Structure**
```
proto/
├── buf.gen.gogo.yaml # GoGo Protobuf generation
├── buf.gen.pulsar.yaml # Pulsar API generation
├── buf.gen.swagger.yaml # OpenAPI/Swagger docs
├── buf.lock # Dependencies
├── buf.yaml # Core configuration
├── cosmos/ # Core protos
└── tendermint/ # Consensus protos
```
3. **Module Protos**
- Located in `x/{moduleName}/proto`
- Module-specific message definitions
#### `buf.gen.gogo.yaml`
`buf.gen.gogo.yaml` defines how the protobuf files should be generated for use with in the module. This file uses [gogoproto](https://github.com/gogo/protobuf), a separate generator from the google go-proto generator that makes working with various objects more ergonomic, and it has more performant encode and decode steps
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.gogo.yaml#L1-L9
```
#### `buf.gen.pulsar.yaml`
`buf.gen.pulsar.yaml` defines how protobuf files should be generated using the [new golang apiv2 of protobuf](https://go.dev/blog/protobuf-apiv2). This generator is used instead of the google go-proto generator because it has some extra helpers for Cosmos SDK applications and will have more performant encode and decode than the google go-proto generator. You can follow the development of this generator [here](https://github.com/cosmos/cosmos-proto).
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.pulsar.yaml#L1-L18
```
#### `buf.gen.swagger.yaml`
`buf.gen.swagger.yaml` generates the swagger documentation for the query and messages of the chain. This will only define the REST API end points that were defined in the query and msg servers. You can find examples of this [here](https://github.com/cosmos/cosmos-sdk/blob/main/x/bank/proto/cosmos/bank/v1beta1/query.proto)
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.gen.swagger.yaml#L1-L6
```
#### `buf.lock`
This is an autogenerated file based off the dependencies required by the `.gen` files. There is no need to copy the current one. If you depend on cosmos-sdk proto definitions a new entry for the Cosmos SDK will need to be provided. The dependency you will need to use is `buf.build/cosmos/cosmos-sdk`.
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.lock#L1-L16
```
#### `buf.yaml`
`buf.yaml` defines the [name of your package](https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L3), which [breakage checker](https://buf.build/docs/tutorials/getting-started-with-buf-cli#detect-breaking-changes) to use and how to [lint your protobuf files](https://buf.build/docs/tutorials/getting-started-with-buf-cli#lint-your-api).
It is advised to use a tagged version of the buf modules corresponding to the version of the Cosmos SDK being are used.
```go reference
https://github.com/cosmos/cosmos-sdk/blob/main/proto/buf.yaml#L1-L24
```
We use a variety of linters for the Cosmos SDK protobuf files. The repo also checks this in ci.
A reference to the github actions can be found [here](https://github.com/cosmos/cosmos-sdk/blob/main/.github/workflows/proto.yml#L1-L32)
# ORM
The Cosmos SDK ORM is a state management library that provides a rich, but opinionated set of tools for managing a
module's state. It provides support for:
- type safe management of state
- multipart keys
- secondary indexes
- unique indexes
- easy prefix and range queries
- automatic genesis import/export
- automatic query services for clients, including support for light client proofs (still in development)
- indexing state data in external databases (still in development)
## Design and Philosophy
The ORM's data model is inspired by the relational data model found in SQL databases. The core abstraction is a table
with a primary key and optional secondary indexes.
Because the Cosmos SDK uses protobuf as its encoding layer, ORM tables are defined directly in .proto files using
protobuf options. Each table is defined by a single protobuf `message` type and a schema of multiple tables is
represented by a single .proto file.
Table structure is specified in the same file where messages are defined in order to make it easy to focus on better
design of the state layer. Because blockchain state layout is part of the public API for clients (TODO: link to docs on
light client proofs), it is important to think about the state layout as being part of the public API of a module.
Changing the state layout actually breaks clients, so it is ideal to think through it carefully up front and to aim for
a design that will eliminate or minimize breaking changes down the road. Also, good design of state enables building
more performant and sophisticated applications. Providing users with a set of tools inspired by relational databases
which have a long history of database design best practices and allowing schema to be specified declaratively in a
single place are design choices the ORM makes to enable better design and more durable APIs.
Also, by only supporting the table abstraction as opposed to key-value pair maps, it is easy to add to new
columns/fields to any data structure without causing a breaking change and the data structures can easily be indexed in
any off-the-shelf SQL database for more sophisticated queries.
The encoding of fields in keys is designed to support ordered iteration for all protobuf primitive field types
except for `bytes` as well as the well-known types `google.protobuf.Timestamp` and `google.protobuf.Duration`. Encodings
are optimized for storage space when it makes sense (see the documentation in `cosmos/orm/v1/orm.proto` for more details)
and table rows do not use extra storage space to store key fields in the value.
We recommend that users of the ORM attempt to follow database design best practices such as
[normalization](https://en.wikipedia.org/wiki/Database_normalization) (at least 1NF).
For instance, defining `repeated` fields in a table is considered an anti-pattern because breaks first normal form (1NF).
Although we support `repeated` fields in tables, they cannot be used as key fields for this reason. This may seem
restrictive but years of best practice (and also experience in the SDK) have shown that following this pattern
leads to easier to maintain schemas.
To illustrate the motivation for these principles with an example from the SDK, historically balances were stored
as a mapping from account -> map of denom to amount. This did not scale well because an account with 100 token balances
needed to be encoded/decoded every time a single coin balance changed. Now balances are stored as account,denom -> amount
as in the example above. With the ORM's data model, if we wanted to add a new field to `Balance` such as
`unlocked_balance` (if vesting accounts were redesigned in this way), it would be easy to add it to this table without
requiring a data migration. Because of the ORM's optimizations, the account and denom are only stored in the key part
of storage and not in the value leading to both a flexible data model and efficient usage of storage.
## Defining Tables
To define a table:
1. create a .proto file to describe the module's state (naming it `state.proto` is recommended for consistency),
and import "cosmos/orm/v1/orm.proto", ex:
```protobuf
syntax = "proto3";
package bank_example;
import "cosmos/orm/v1/orm.proto";
```
2. define a `message` for the table, ex:
```protobuf
message Balance {
bytes account = 1;
string denom = 2;
uint64 balance = 3;
}
```
3. add the `cosmos.orm.v1.table` option to the table and give the table an `id` unique within this .proto file:
```protobuf
message Balance {
option (cosmos.orm.v1.table) = {
id: 1
};
bytes account = 1;
string denom = 2;
uint64 balance = 3;
}
```
4. define the primary key field or fields, as a comma-separated list of the fields from the message which should make
up the primary key:
```protobuf
message Balance {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: { fields: "account,denom" }
};
bytes account = 1;
string denom = 2;
uint64 balance = 3;
}
```
5. add any desired secondary indexes by specifying an `id` unique within the table and a comma-separate list of the
index fields:
```protobuf
message Balance {
option (cosmos.orm.v1.table) = {
id: 1;
primary_key: { fields: "account,denom" }
index: { id: 1 fields: "denom" } // this allows querying for the accounts which own a denom
};
bytes account = 1;
string denom = 2;
uint64 amount = 3;
}
```
### Auto-incrementing Primary Keys
A common pattern in SDK modules and in database design is to define tables with a single integer `id` field with an
automatically generated primary key. In the ORM we can do this by setting the `auto_increment` option to `true` on the
primary key, ex:
```protobuf
message Account {
option (cosmos.orm.v1.table) = {
id: 2;
primary_key: { fields: "id", auto_increment: true }
};
uint64 id = 1;
bytes address = 2;
}
```
### Unique Indexes
A unique index can be added by setting the `unique` option to `true` on an index, ex:
```protobuf
message Account {
option (cosmos.orm.v1.table) = {
id: 2;
primary_key: { fields: "id", auto_increment: true }
index: {id: 1, fields: "address", unique: true}
};
uint64 id = 1;
bytes address = 2;
}
```
### Singletons
The ORM also supports a special type of table with only one row called a `singleton`. This can be used for storing
module parameters. Singletons only need to define a unique `id` and that cannot conflict with the id of other
tables or singletons in the same .proto file. Ex:
```protobuf
message Params {
option (cosmos.orm.v1.singleton) = {
id: 3;
};
google.protobuf.Duration voting_period = 1;
uint64 min_threshold = 2;
}
```
## Running Codegen
NOTE: the ORM will only work with protobuf code that implements the [google.golang.org/protobuf](https://pkg.go.dev/google.golang.org/protobuf)
API. That means it will not work with code generated using gogo-proto.
To install the ORM's code generator, run:
```shell
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@latest
```
The recommended way to run the code generator is to use [buf build](https://docs.buf.build/build/usage).
This is an example `buf.gen.yaml` that runs `protoc-gen-go`, `protoc-gen-go-grpc` and `protoc-gen-go-cosmos-orm`
using buf managed mode:
```yaml
version: v1
managed:
enabled: true
go_package_prefix:
default: foo.bar/api # the go package prefix of your package
override:
buf.build/cosmos/cosmos-sdk: cosmossdk.io/api # required to import the Cosmos SDK api module
plugins:
- name: go
out: .
opt: paths=source_relative
- name: go-grpc
out: .
opt: paths=source_relative
- name: go-cosmos-orm
out: .
opt: paths=source_relative
```
## Using the ORM in a module
### Initialization
To use the ORM in a module, first create a `ModuleSchemaDescriptor`. This tells the ORM which .proto files have defined
an ORM schema and assigns them all a unique non-zero id. Ex:
```go
var MyModuleSchema = &ormv1alpha1.ModuleSchemaDescriptor{
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
{
Id: 1,
ProtoFileName: mymodule.File_my_module_state_proto.Path(),
},
},
}
```
In the ORM generated code for a file named `state.proto`, there should be an interface `StateStore` that got generated
with a constructor `NewStateStore` that takes a parameter of type `ormdb.ModuleDB`. Add a reference to `StateStore`
to your module's keeper struct. Ex:
```go
type Keeper struct {
db StateStore
}
```
Then instantiate the `StateStore` instance via an `ormdb.ModuleDB` that is instantiated from the `SchemaDescriptor`
above and one or more store services from `cosmossdk.io/core/store`. Ex:
```go
func NewKeeper(storeService store.KVStoreService) (*Keeper, error) {
modDb, err := ormdb.NewModuleDB(MyModuleSchema, ormdb.ModuleDBOptions{KVStoreService: storeService})
if err != nil {
return nil, err
}
db, err := NewStateStore(modDb)
if err != nil {
return nil, err
}
return Keeper{db: db}, nil
}
```
### Using the generated code
The generated code for the ORM contains methods for inserting, updating, deleting and querying table entries.
For each table in a .proto file, there is a type-safe table interface implemented in generated code. For instance,
for a table named `Balance` there should be a `BalanceTable` interface that looks like this:
```go
type BalanceTable interface {
Insert(ctx context.Context, balance *Balance) error
Update(ctx context.Context, balance *Balance) error
Save(ctx context.Context, balance *Balance) error
Delete(ctx context.Context, balance *Balance) error
Has(ctx context.Context, account []byte, denom string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, account []byte, denom string) (*Balance, error)
List(ctx context.Context, prefixKey BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
ListRange(ctx context.Context, from, to BalanceIndexKey, opts ...ormlist.Option) (BalanceIterator, error)
DeleteBy(ctx context.Context, prefixKey BalanceIndexKey) error
DeleteRange(ctx context.Context, from, to BalanceIndexKey) error
doNotImplement()
}
```
This `BalanceTable` should be accessible from the `StateStore` interface (assuming our file is named `state.proto`)
via a `BalanceTable()` accessor method. If all the above example tables/singletons were in the same `state.proto`,
then `StateStore` would get generated like this:
```go
type BankStore interface {
BalanceTable() BalanceTable
AccountTable() AccountTable
ParamsTable() ParamsTable
doNotImplement()
}
```
So to work with the `BalanceTable` in a keeper method we could use code like this:
```go
func (k keeper) AddBalance(ctx context.Context, acct []byte, denom string, amount uint64) error {
balance, err := k.db.BalanceTable().Get(ctx, acct, denom)
if err != nil && !ormerrors.IsNotFound(err) {
return err
}
if balance == nil {
balance = &Balance{
Account: acct,
Denom: denom,
Amount: amount,
}
} else {
balance.Amount = balance.Amount + amount
}
return k.db.BalanceTable().Save(ctx, balance)
}
```
`List` methods take `IndexKey` parameters. For instance, `BalanceTable.List` takes `BalanceIndexKey`. `BalanceIndexKey`
let's represent index keys for the different indexes (primary and secondary) on the `Balance` table. The primary key
in the `Balance` table gets a struct `BalanceAccountDenomIndexKey` and the first index gets an index key `BalanceDenomIndexKey`.
If we wanted to list all the denoms and amounts that an account holds, we would use `BalanceAccountDenomIndexKey`
with a `List` query just on the account prefix. Ex:
```go
it, err := keeper.db.BalanceTable().List(ctx, BalanceAccountDenomIndexKey{}.WithAccount(acct))
```
---
## sidebar_position: 1
# ProtocolBuffer Annotations
This document explains the various protobuf scalars that have been added to make working with protobuf easier for Cosmos SDK application developers
## Signer
Signer specifies which field should be used to determine the signer of a message for the Cosmos SDK. This field can be used for clients as well to infer which field should be used to determine the signer of a message.
Read more about the signer field [here](./02-messages-and-queries.md).
```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/e6848d99b55a65d014375b295bdd7f9641aac95e/proto/cosmos/bank/v1beta1/tx.proto#L40
```
```proto
option (cosmos.msg.v1.signer) = "from_address";
```
## Scalar
The scalar type defines a way for clients to understand how to construct protobuf messages according to what is expected by the module and sdk.
```proto
(cosmos_proto.scalar) = "cosmos.AddressString"
```
Example of account address string scalar:
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e6848d99b55a65d014375b295bdd7f9641aac95e/proto/cosmos/bank/v1beta1/tx.proto#L46
```
Example of validator address string scalar:
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/query.proto#L87
```
Example of pubkey scalar:
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/11068bfbcd44a7db8af63b6a8aa079b1718f6040/proto/cosmos/staking/v1beta1/tx.proto#L94
```
Example of Decimals scalar:
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/distribution.proto#L26
```
Example of Int scalar:
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/gov/v1/gov.proto#L137
```
There are a few options for what can be provided as a scalar: `cosmos.AddressString`, `cosmos.ValidatorAddressString`, `cosmos.ConsensusAddressString`, `cosmos.Int`, `cosmos.Dec`.
## Implements_Interface
Implement interface is used to provide information to client tooling like [telescope](https://github.com/cosmology-tech/telescope) on how to encode and decode protobuf messages.
```proto
option (cosmos_proto.implements_interface) = "cosmos.auth.v1beta1.AccountI";
```
## Method,Field,Message Added In
`method_added_in`, `field_added_in` and `message_added_in` are annotations to denotate to clients that a field has been supported in a later version. This is useful when new methods or fields are added in later versions and that the client needs to be aware of what it can call.
The annotation should be worded as follow:
```proto
option (cosmos_proto.method_added_in) = "cosmos-sdk v0.50.1";
option (cosmos_proto.method_added_in) = "x/epochs v1.0.0";
option (cosmos_proto.method_added_in) = "simapp v24.0.0";
```
## Amino
The amino codec was removed in `v0.50+`, this means there is not a need register `legacyAminoCodec`. To replace the amino codec, Amino protobuf annotations are used to provide information to the amino codec on how to encode and decode protobuf messages.
:::note
Amino annotations are only used for backwards compatibility with amino. New modules are not required use amino annotations.
:::
The below annotations are used to provide information to the amino codec on how to encode and decode protobuf messages in a backwards compatible manner.
### Name
Name specifies the amino name that would show up for the user in order for them see which message they are signing.
```proto
option (amino.name) = "cosmos-sdk/BaseAccount";
```
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/tx.proto#L41
```
### Field_Name
Field name specifies the amino name that would show up for the user in order for them see which field they are signing.
```proto
uint64 height = 1 [(amino.field_name) = "public_key"];
```
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/distribution/v1beta1/distribution.proto#L166
```
### Dont_OmitEmpty
Dont omitempty specifies that the field should not be omitted when encoding to amino.
```proto
repeated cosmos.base.v1beta1.Coin amount = 3 [(amino.dont_omitempty) = true];
```
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/bank.proto#L56
```
### Encoding
Encoding instructs the amino json marshaler how to encode certain fields that may differ from the standard encoding behaviour. The most common example of this is how `repeated cosmos.base.v1beta1.Coin` is encoded when using the amino json encoding format. The `legacy_coins` option tells the json marshaler [how to encode a null slice](https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/x/tx/signing/aminojson/json_marshal.go#L65) of `cosmos.base.v1beta1.Coin`.
```proto
(amino.encoding) = "legacy_coins",
```
```proto reference
https://github.com/cosmos/cosmos-sdk/blob/e8f28bf5db18b8d6b7e0d94b542ce4cf48fed9d6/proto/cosmos/bank/v1beta1/genesis.proto#L23
```
Another example is a protobuf `bytes` that contains a valid JSON document.
The `inline_json` option tells the json marshaler to embed the JSON bytes into the wrapping document without escaping.
```proto
(amino.encoding) = "inline_json",
```
E.g. the bytes containing `{"foo":123}` in the `envelope` field would lead to the following JSON:
```json
{
"envelope": {
"foo": 123
}
}
```
If the bytes are not valid JSON, this leads to JSON broken documents. Thus a JSON validity check needs to be in place at some point of the process.
-627
View File
@@ -1,627 +0,0 @@
# RFC 004: Account System Refactor
## Status
- Draft v2 (May 2023)
## Current Limitations
1. **Account Representation**: Limited by `google.Protobuf.Any` encapsulation and basic authentication methods
2. **Interface Constraints**: Lacks support for advanced functionalities like vesting and complex auth systems
3. **Implementation Rigidity**: Poor differentiation between account types (e.g., `ModuleAccount`)
4. **Authorization System**: Basic `x/auth` module with limited scope beyond `x/bank` functionality
5. **Dependency Issues**: Cyclic dependencies between modules (e.g., `x/auth``x/bank` for vesting)
## Proposal
This proposal aims to transform the way accounts are managed within the Cosmos SDK by introducing significant changes to
their structure and functionality.
### Rethinking Account Representation and Business Logic
Instead of representing accounts as simple `google.Protobuf.Any` structures stored in state with no business logic
attached, this proposal suggests a more sophisticated account representation that is closer to module entities.
In fact, accounts should be able to receive messages and process them in the same way modules do, and be capable of storing
state in a isolated (prefixed) portion of state belonging only to them, in the same way as modules do.
### Account Message Reception
We propose that accounts should be able to receive messages in the same way modules can, allowing them to manage their
own state modifications without relying on other modules. This change would enable more advanced account functionality, such as the
`VestingAccount` example, where the x/bank module previously needed to change the vestingState by casting the abstracted
account to `VestingAccount` and triggering the `TrackDelegation` call. Accounts are already capable of sending messages when
a state transition, originating from a transaction, is executed.
When accounts receive messages, they will be able to identify the sender of the message and decide how to process the
state transition, if at all.
### Consequences
These changes would have significant implications for the Cosmos SDK, resulting in a system of actors that are equal from
the runtime perspective. The runtime would only be responsible for propagating messages between actors and would not
manage the authorization system. Instead, actors would manage their own authorizations. For instance, there would be no
need for the `x/auth` module to manage minting or burning of coins permissions, as it would fall within the scope of the
`x/bank` module.
The key difference between accounts and modules would lie in the origin of the message (state transition). Accounts
(ExternallyOwnedAccount), which have credentials (e.g., a public/private key pairing), originate state transitions from
transactions. In contrast, module state transitions do not have authentication credentials backing them and can be
caused by two factors: either as a consequence of a state transition coming from a transaction or triggered by a scheduler
(e.g., the runtime's Begin/EndBlock).
By implementing these proposed changes, the Cosmos SDK will benefit from a more extensible, versatile, and efficient account
management system that is better suited to address the requirements of the Cosmos ecosystem.
#### Standardization
With `x/accounts` allowing a modular api there becomes a need for standardization of accounts or the interfaces wallets and other clients should expect to use. For this reason we will be using the [`CIP` repo](https://github.com/cosmos/cips) in order to standardize interfaces in order for wallets to know what to expect when interacting with accounts.
## Implementation
### Account Definition
We define the new `Account` type, which is what an account needs to implement to be treated as such.
An `Account` type is defined at APP level, so it cannot be dynamically loaded as the chain is running without upgrading the
node code, unless we create something like a `CosmWasmAccount` which is an account backed by an `x/wasm` contract.
```go
// Account is what the developer implements to define an account.
type Account[InitMsg proto.Message] interface {
// Init is the function that initialises an account instance of a given kind.
// InitMsg is used to initialise the initial state of an account.
Init(ctx *Context, msg InitMsg) error
// RegisterExecuteHandlers registers an account's execution messages.
RegisterExecuteHandlers(executeRouter *ExecuteRouter)
// RegisterQueryHandlers registers an account's query messages.
RegisterQueryHandlers(queryRouter *QueryRouter)
// RegisterMigrationHandlers registers an account's migration messages.
RegisterMigrationHandlers(migrationRouter *MigrationRouter)
}
```
### The InternalAccount definition
The public `Account` interface implementation is then converted by the runtime into an `InternalAccount` implementation,
which contains all the information and business logic needed to operate the account.
```go
type Schema struct {
state StateSchema // represents the state of an account
init InitSchema // represents the init msg schema
exec ExecSchema // represents the multiple execution msg schemas, containing also responses
query QuerySchema // represents the multiple query msg schemas, containing also responses
migrate *MigrateSchema // represents the multiple migrate msg schemas, containing also responses, it's optional
}
type InternalAccount struct {
init func(ctx *Context, msg proto.Message) (*InitResponse, error)
execute func(ctx *Context, msg proto.Message) (*ExecuteResponse, error)
query func(ctx *Context, msg proto.Message) (proto.Message, error)
schema func() *Schema
migrate func(ctx *Context, msg proto.Message) (*MigrateResponse, error)
}
```
This is an internal view of the account as intended by the system. It is not meant to be what developers implement. An
example implementation of the `InternalAccount` type can be found in [this](https://github.com/testinginprod/accounts-poc/blob/main/examples/recover/recover.go)
example of account whose credentials can be recovered. In fact, even if the `Internal` implementation is untyped (with
respect to `proto.Message`), the concrete implementation is fully typed.
During any of the execution methods of `InternalAccount`, `schema` excluded, the account is given a `Context` which provides:
- A namespaced `KVStore` for the account, which isolates the account state from others (NOTE: no `store keys` needed,
the account address serves as `store key`).
- Information regarding itself (its address)
- Information regarding the sender.
- ...
#### Init
Init defines the entrypoint that allows for a new account instance of a given kind to be initialised.
The account is passed some opaque protobuf message which is then interpreted and contains the instructions that
constitute the initial state of an account once it is deployed.
An `Account` code can be deployed multiple times through the `Init` function, similar to how a `CosmWasm` contract code
can be deployed (Instantiated) multiple times.
#### Execute
Execute defines the entrypoint that allows an `Account` to process a state transition, the account can decide then how to
process the state transition based on the message provided and the sender of the transition.
#### Query
Query defines a read-only entrypoint that provides a stable interface that links an account with its state. The reason for
which `Query` is still being preferred as an addition to raw state reflection is to:
- Provide a stable interface for querying (state can be optimised and change more frequently than a query)
- Provide a way to define an account `Interface` with respect to its `Read/Write` paths.
- Provide a way to query information that cannot be processed from raw state reflection, ex: compute information from lazy
state that has not been yet concretely processed (eg: balances with respect to lazy inputs/outputs)
#### Schema
Schema provides the definition of an account from `API` perspective, and it's the only thing that should be taken into account
when interacting with an account from another account or module, for example: an account is an `authz-interface` account if
it has the following message in its execution messages `MsgProxyStateTransition{ state_transition: google.Protobuf.Any }`.
### Migrate
Migrate defines the entrypoint that allows an `Account` to migrate its state from a previous version to a new one. Migrations
can be initiated only by the account itself, concretely this means that the migrate action sender can only be the account address
itself, if the account wants to allow another address to migrate it on its behalf then it could create an execution message
that makes the account migrate itself.
### x/accounts module
In order to create accounts we define a new module `x/accounts`, note that `x/accounts` deploys account with no authentication
credentials attached to it which means no action of an account can be incepted from a TX, we will later explore how the
`x/authn` module uses `x/accounts` to deploy authenticated accounts.
This also has another important implication for which account addresses are now fully decoupled from the authentication mechanism
which makes in turn off-chain operations a little more complex, as the chain becomes the real link between account identifier
and credentials.
We could also introduce a way to deterministically compute the account address.
Note, from the transaction point of view, the `init_message` and `execute_message` are opaque `google.Protobuf.Any`.
The module protobuf definition for `x/accounts` are the following:
```protobuf
// Msg defines the Msg service.
service Msg {
rpc Deploy(MsgDeploy) returns (MsgDeployResponse);
rpc Execute(MsgExecute) returns (MsgExecuteResponse);
rpc Migrate(MsgMigrate) returns (MsgMigrateResponse);
}
message MsgDeploy {
string sender = 1;
string kind = 2;
google.Protobuf.Any init_message = 3;
repeated google.Protobuf.Any authorize_messages = 4 [(gogoproto.nullable) = false];
}
message MsgDeployResponse {
string address = 1;
uint64 id = 2;
google.Protobuf.Any data = 3;
}
message MsgExecute {
string sender = 1;
string address = 2;
google.Protobuf.Any message = 3;
repeated google.Protobuf.Any authorize_messages = 4 [(gogoproto.nullable) = false];
}
message MsgExecuteResponse {
google.Protobuf.Any data = 1;
}
message MsgMigrate {
string sender = 1;
string new_account_kind = 2;
google.Protobuf.Any migrate_message = 3;
}
message MsgMigrateResponse {
google.Protobuf.Any data = 1;
}
```
#### MsgDeploy
Deploys a new instance of the given account `kind` with initial settings represented by the `init_message` which is a `google.Protobuf.Any`.
Of course the `init_message` can be empty. A response is returned containing the account ID and humanised address, alongside some response
that the account instantiation might produce.
#### Address derivation
In order to decouple public keys from account addresses, we introduce a new address derivation mechanism which is
#### MsgExecute
Sends a `StateTransition` execution request, where the state transition is represented by the `message` which is a `google.Protobuf.Any`.
The account can then decide if to process it or not based on the `sender`.
### MsgMigrate
Migrates an account to a new version of itself, the new version is represented by the `new_account_kind`. The state transition
can only be incepted by the account itself, which means that the `sender` must be the account address itself. During the migration
the account current state is given to the new version of the account, which then executes the migration logic using the `migrate_message`,
it might change state or not, it's up to the account to decide. The response contains possible data that the account might produce
after the migration.
#### Authorize Messages
The `Deploy` and `Execute` messages have a field in common called `authorize_messages`, these messages are messages that the account
can execute on behalf of the sender. For example, in case an account is expecting some funds to be sent from the sender,
the sender can attach a `MsgSend` that the account can execute on the sender's behalf. These authorizations are short-lived,
they live only for the duration of the `Deploy` or `Execute` message execution, or until they are consumed.
An alternative would have been to add a `funds` field, like it happens in cosmwasm, which guarantees the called contract that
the funds are available and sent in the context of the message execution. This would have been a simpler approach, but it would
have been limited to the context of `MsgSend` only, where the asset is `sdk.Coins`. The proposed generic way, instead, allows
the account to execute any message on behalf of the sender, which is more flexible, it could include NFT send execution, or
more complex things like `MsgMultiSend` or `MsgDelegate`, etc.
### Further discussion
#### Sub-accounts
We could provide a way to link accounts to other accounts. Maybe during deployment the sender could decide to link the
newly created to its own account, although there might be use-cases for which the deployer is different from the account
that needs to be linked, in this case a handshake protocol on linking would need to be defined.
#### Predictable address creation
We need to provide a way to create an account with a predictable address, this might serve a lot of purposes, like accounts
wanting to generate an address that:
- nobody else can claim besides the account used to generate the new account
- is predictable
For example:
```protobuf
message MsgDeployPredictable {
string sender = 1;
uint32 nonce = 2;
...
}
```
And then the address becomes `bechify(concat(sender, nonce))`
`x/accounts` would still use the monotonically increasing sequence as account number.
#### Joining Multiple Accounts
As developers are building new kinds of accounts, it becomes necessary to provide a default way to combine the
functionalities of different account types. This allows developers to avoid duplicating code and enables end-users to
create or migrate to accounts with multiple functionalities without requiring custom development.
To address this need, we propose the inclusion of a default account type called "MultiAccount". The MultiAccount type is
designed to merge the functionalities of other accounts by combining their execution, query, and migration APIs.
The account joining process would only fail in the case of API (intended as non-state Schema APIs) conflicts, ensuring
compatibility and consistency.
With the introduction of the MultiAccount type, users would have the option to either migrate their existing accounts to
a MultiAccount type or extend an existing MultiAccount with newer APIs. This flexibility empowers users to leverage
various account functionalities without compromising compatibility or resorting to manual code duplication.
The MultiAccount type serves as a standardized solution for combining different account functionalities within the
cosmos-sdk ecosystem. By adopting this approach, developers can streamline the development process and users can benefit
from a modular and extensible account system.
# ADR 071: Cryptography v2- Multi-curve support
## Change log
- May 7th 2024: Initial Draft (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
- June 13th 2024: Add CometBFT implementation proposal (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
- July 2nd 2024: Split ADR proposal, add link to ADR in cosmos/crypto (Zondax AG: @raynaudoe @juliantoledano @jleni @educlerici-zondax @lucaslopezf)
## Status
DRAFT
## Abstract
This ADR proposes the refactoring of the existing `Keyring` and `cosmos-sdk/crypto` code to implement [ADR-001-CryptoProviders](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md).
For in-depth details of the `CryptoProviders` and their design please refer to ADR mentioned above.
## Introduction
The introduction of multi-curve support in the cosmos-sdk cryptographic package offers significant advantages. By not being restricted to a single cryptographic curve, developers can choose the most appropriate curve based on security, performance, and compatibility requirements. This flexibility enhances the application's ability to adapt to evolving security standards and optimizes performance for specific use cases, helping to future-proofing the sdk's cryptographic capabilities.
The enhancements in this proposal not only render the ["Keyring ADR"](https://github.com/cosmos/cosmos-sdk/issues/14940) obsolete, but also encompass its key aspects, replacing it with a more flexible and comprehensive approach. Furthermore, the gRPC service proposed in the mentioned ADR can be easily implemented as a specialized `CryptoProvider`.
### Glossary
1. **Interface**: In the context of this document, "interface" refers to Go's interface.
2. **Module**: In this document, "module" refers to a Go module.
3. **Package**: In the context of Go, a "package" refers to a unit of code organization.
## Context
In order to fully understand the need for changes and the proposed improvements, it's crucial to consider the current state of affairs:
- The Cosmos SDK currently lacks a comprehensive ADR for the cryptographic package.
- If a blockchain project requires a cryptographic curve that is not supported by the current SDK, the most likely scenario is that they will need to fork the SDK repository and make modifications. These modifications could potentially make the fork incompatible with future updates from the upstream SDK, complicating maintenance and integration.
- Type leakage of specific crypto data types expose backward compatibility and extensibility challenges.
- The demand for a more flexible and extensible approach to cryptography and address management is high.
- Architectural changes are necessary to resolve many of the currently open issues related to new curves support.
- There is a current trend towards modularity in the Interchain stack (e.g., runtime modules).
- Security implications are a critical consideration during the redesign work.
## Objectives
The key objectives for this proposal are:
- Leverage `CryptoProviders`: Utilize them as APIs for cryptographic tools, ensuring modularity, flexibility, and ease of integration.
Developer-Centric Approach
- Prioritize clear, intuitive interfaces and best-practice design principles.
Quality Assurance
- Enhanced Test Coverage: Improve testing methodologies to ensure the robustness and reliability of the module.
## Technical Goals
New Keyring:
- Design a new `Keyring` interface with modular backends injection system to support hardware devices and cloud-based HSMs. This feature is optional and tied to complexity; if it proves too complex, it will be deferred to a future release as an enhancement.
## Proposed architecture
### Components
The main components to be used will be the same as those found in the [ADR-001](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#components).
#### Storage and persistence
The storage and persistence layer is tasked with storing a `CryptoProvider`s. Specifically, this layer must:
- Securely store the crypto provider's associated private key (only if stored locally, otherwise a reference to the private key will be stored instead).
- Store the [`ProviderMetadata`](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#metadata) struct which contains the data that distinguishes that provider.
The purpose of this layer is to ensure that upon retrieval of the persisted data, we can access the provider's type, version, and specific configuration (which varies based on the provider type). This information will subsequently be utilized to initialize the appropriate factory, as detailed in the following section on the factory pattern.
The storage proposal involves using a modified version of the [Record](https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/crypto/keyring/v1/record.proto) struct, which is already defined in **Keyring/v1**. Additionally, we propose utilizing the existing keyring backends (keychain, filesystem, memory, etc.) to store these `Record`s in the same manner as the current **Keyring/v1**.
_Note: This approach will facilitate a smoother migration path from the current Keyring/v1 to the proposed architecture._
Below is the proposed protobuf message to be included in the modified `Record.proto` file
##### Protobuf message structure
The [record.proto](https://github.com/cosmos/cosmos-sdk/blob/main/proto/cosmos/crypto/keyring/v1/record.proto) file will be modified to include the `CryptoProvider` message as an optional field as follows.
```protobuf
// record.proto
message Record {
string name = 1;
google.protobuf.Any pub_key = 2;
oneof item {
Local local = 3;
Ledger ledger = 4;
Multi multi = 5;
Offline offline = 6;
CryptoProvider crypto_provider = 7; // <- New
}
message Local {
google.protobuf.Any priv_key = 1;
}
message Ledger {
hd.v1.BIP44Params path = 1;
}
message Multi {}
message Offline {}
}
```
##### Creating and loading a `CryptoProvider`
For creating providers, we propose a _factory pattern_ and a _registry_ for these builders. Examples of these
patterns can be found [here](https://github.com/cosmos/crypto/blob/main/docs/architecture/adr-001-crypto-provider.md#illustrative-code-snippets)
##### Keyring
The new `Keyring` interface will serve as a central hub for managing and fetching `CryptoProviders`. To ensure a smoother migration path, the new Keyring will be backward compatible with the previous version. Since this will be the main API from which applications will obtain their `CryptoProvider` instances, the proposal is to extend the Keyring interface to include the methods:
```go
type KeyringV2 interface {
// methods from Keyring/v1
// ListCryptoProviders returns a list of all the stored CryptoProvider metadata.
ListCryptoProviders() ([]ProviderMetadata, error)
// GetCryptoProvider retrieves a specific CryptoProvider by its id.
GetCryptoProvider(id string) (CryptoProvider, error)
}
```
_Note_: Methods to obtain a provider from a public key or other means that make it easier to load the desired provider can be added.
##### Especial use case: remote signers
It's important to note that the `CryptoProvider` interface is versatile enough to be implemented as a remote signer. This capability allows for the integration of remote cryptographic operations, which can be particularly useful in distributed or cloud-based environments where local cryptographic resources are limited or need to be managed centrally.
## Alternatives
It is important to note that all the code presented in this document is not in its final form and could be subject to changes at the time of implementation. The examples and implementations discussed should be interpreted as alternatives, providing a conceptual framework rather than definitive solutions. This flexibility allows for adjustments based on further insights, technical evaluations, or changing requirements as development progresses.
## Decision
We will:
- Leverage crypto providers
- Refactor the module structure as described above.
- Define types and interfaces as the code attached.
- Refactor existing code into new structure and interfaces.
- Implement Unit Tests to ensure no backward compatibility issues.
## Consequences
### Impact on the SDK codebase
We can divide the impact of this ADR into two main categories: state machine code and client related code.
#### Client
The major impact will be on the client side, where the current `Keyring` interface will be replaced by the new `KeyringV2` interface. At first, the impact will be low since `CryptoProvider` is an optional field in the `Record` message, so there's no mandatory requirement for migrating to this new concept right away. This allows a progressive transition where the risks of breaking changes or regressions are minimized.
#### State Machine
The impact on the state machine code will be minimal, the modules affected (at the time of writing this ADR)
are the `x/accounts` module, specifically the `Authenticate` function and the `x/auth/ante` module. This function will need to be adapted to use a `CryptoProvider` service to make use of the `Verifier` instance.
Worth mentioning that there's also the alternative of using `Verifier` instances in a standalone fashion (see note below).
The specific way to adapt these modules will be deeply analyzed and decided at implementation time of this ADR.
_Note_: All cryptographic tools (hashers, verifiers, signers, etc.) will continue to be available as standalone packages that can be imported and utilized directly without the need for a `CryptoProvider` instance. However, the `CryptoProvider` is the recommended method for using these tools as it offers a more secure way to handle sensitive data, enhanced modularity, and the ability to store configurations and metadata within the `CryptoProvider` definition.
### Backwards Compatibility
The proposed migration path is similar to what the cosmos-sdk has done in the past. To ensure a smooth transition, the following steps will be taken:
Once ADR-001 is implemented with a stable release:
- Deprecate the old crypto package. The old crypto package will still be usable, but it will be marked as deprecated and users can opt to use the new package.
- Migrate the codebase to use the new cosmos/crypto package and remove the old crypto one.
### Positive
- Single place of truth
- Easier to use interfaces
- Easier to extend
- Unit test for each crypto package
- Greater maintainability
- Incentivize addition of implementations instead of forks
- Decoupling behavior from implementation
- Sanitization of code
### Negative
- It will involve an effort to adapt existing code.
- It will require attention to detail and audition.
### Neutral
- It will involve extensive testing.
## Test Cases
- The code will be unit tested to ensure a high code coverage
- There should be integration tests around Keyring and CryptoProviders.
> While an ADR is in the DRAFT or PROPOSED stage, this section should contain a
> summary of issues to be solved in future iterations (usually referencing comments
> from a pull-request discussion).
>
> Later, this section can optionally list ideas or improvements the author or
> reviewers found during the analysis of this ADR.
# ADR-71 Bank V2
## Status
DRAFT
## Changelog
- 2024-05-08: Initial Draft (@samricotta, @julienrbrt)
## Abstract
The primary objective of refactoring the bank module is to simplify and enhance the functionality of the Cosmos SDK. Over time the bank module has been burdened with numerous responsibilities including transaction handling, account restrictions, delegation counting, and the minting and burning of coins.
In addition to the above, the bank module is currently too rigid and handles too many tasks, so this proposal aims to streamline the module by focusing on core functions `Send`, `Mint`, and `Burn`.
Currently, the module is split across different keepers with scattered and duplicates functionalities (with 4 send functions for instance).
Additionally, the integration of the token factory into the bank module allows for standardization, and better integration within the core modules.
This rewrite will reduce complexity and enhance the efficiency and UX of the bank module.
## Context
The current implementation of the bank module is characterised by its handling of a broad array of functions, leading to significant complexity in using and extending the bank module.
These issues have underscored the need for a refactoring strategy that simplifies the modules architecture and focuses on its most essential operations.
Additionally, there is an overlap in functionality with a Token Factory module, which could be integrated to streamline oper.
## Decision
**Permission Tightening**: Access to the module can be restricted to selected denominations only, ensuring that it operates within designated boundaries and does not exceed its intended scope. Currently, the permissions allow all denoms, so this should be changed. Send restrictions functionality will be maintained.
**Simplification of Logic**: The bank module will focus on core functionalities `Send`, `Mint`, and `Burn`. This refinement aims to streamline the architecture, enhancing both maintainability and performance.
**Integration of Token Factory**: The Token Factory will be merged into the bank module. This consolidation of related functionalities aims to reduce redundancy and enhance coherence within the system. Migrations functions will be provided for migrating from Osmosis' Token Factory module to bank/v2.
**Legacy Support**: A legacy wrapper will be implemented to ensure compatibility with about 90% of existing functions. This measure will facilitate a smooth transition while keeping older systems functional.
**Denom Implementation**: A asset interface will be added to standardise interactions such as transfers, balance inquiries, minting, and burning across different tokens. This will allow the bank module to support arbitrary asset types, enabling developers to implement custom, ERC20-like denominations.
For example, currently if a team would like to extend the transfer method the changes would apply universally, affecting all denoms. With the proposed Asset Interface, it allows teams to customise or extend the transfer method specifically for their own tokens without impacting others.
These improvements are expected to enhance the flexibility of the bank module, allowing for the creation of custom tokens similar to ERC20 standards and assets backed by CosmWasm (CW) contracts. The integration efforts will also aim to unify CW20 with bank coins across the Cosmos chains.
Example of denom interface:
```go
type AssetInterface interface {
Transfer(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, amount sdk.Coin) error
Mint(ctx sdk.Context, to sdk.AccAddress, amount sdk.Coin) error
Burn(ctx sdk.Context, from sdk.AccAddress, amount sdk.Coin) error
QueryBalance(ctx sdk.Context, account sdk.AccAddress) (sdk.Coin, error)
}
```
Overview of flow:
1. Alice initiates a transfer by entering Bob's address and the amount (100 ATOM)
2. The Bank module verifies that the ATOM token implements the `AssetInterface` by querying the `ATOM_Denom_Account`, which is an `x/account` denom account.
3. The Bank module executes the transfer by subtracting 100 ATOM from Alices balance and adding 100 ATOM to Bobs balance.
4. The Bank module calls the Transfer method on the `ATOM_Denom_Account`. The Transfer method, defined in the `AssetInterface`, handles the logic to subtract 100 ATOM from Alices balance and add 100 ATOM to Bobs balance.
5. The Bank module updates the chain and returns the new balances.
6. Both Alice and Bob successfully receive the updated balances.
## Migration Plans
Bank is a widely used module, so getting a v2 needs to be thought thoroughly. In order to not force all dependencies to immediately migrate to bank/v2, the same _upgrading_ path will be taken as for the `gov` module.
This means `cosmossdk.io/bank` will stay one module and there won't be a new `cosmossdk.io/bank/v2` go module. Instead the bank protos will be versioned from `v1beta1` (current bank) to `v2`.
Bank `v1beta1` endpoints will use the new bank v2 implementation for maximum backward compatibility.
The bank `v1beta1` keepers will be deprecated and potentially eventually removed, but its proto and messages definitions will remain.
Additionally, as bank plans to integrate token factory, migrations functions will be provided to migrate from Osmosis token factory implementation (most widely used implementation) to the new bank/v2 token factory.
## Consequences
### Positive
- Simplified interaction with bank APIs
- Backward compatible changes (no contracts or apis broken)
- Optional migration (note: bank `v1beta1` won't get any new feature after bank `v2` release)
### Neutral
- Asset implementation not available cross-chain (IBC-ed custom asset should possibly fallback to the default implementation)
- Many assets may slow down bank balances requests
### Negative
- Temporarily duplicate functionalities as bank `v1beta1` are `v2` are living alongside
- Difficultity to ever completely remove bank `v1beta1`
### References
- Current bank module implementation: https://github.com/cosmos/cosmos-sdk/blob/v0.50.6/x/bank/keeper/keeper.go#L22-L53
- Osmosis token factory: https://github.com/osmosis-labs/osmosis/tree/v25.0.0/x/tokenfactory/keeper
-685
View File
@@ -1,685 +0,0 @@
# Cosmos SDK Core Components
## Overview
The Cosmos SDK is a framework for building secure blockchain applications on CometBFT. It provides:
- ABCI implementation in Go
- Multi-store persistence layer
- Transaction routing system
## Transaction Flow
1. CometBFT consensus delivers transaction bytes
2. SDK decodes transactions and extracts messages
3. Messages routed to appropriate modules
4. State changes committed to stores
```mermaid
graph TD
A[CometBFT] -->|Tx Bytes| B[SDK Decode]
B -->|Messages| C[Module Router]
C -->|State Changes| D[Multi-store]
```
## `baseapp`
`baseapp` is the boilerplate implementation of a Cosmos SDK application. It comes with an implementation of the ABCI to handle the connection with the underlying consensus engine. Typically, a Cosmos SDK application extends `baseapp` by embedding it in [`app.go`](../beginner/00-app-anatomy.md#core-application-file).
Here is an example of this from `simapp`, the Cosmos SDK demonstration app:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/simapp/app.go#L145-L186
```
The goal of `baseapp` is to provide a secure interface between the store and the extensible state machine while defining as little about the state machine as possible (staying true to the ABCI).
For more on `baseapp`, please click [here](../advanced/00-baseapp.md).
## Multistore
The Cosmos SDK provides a [`multistore`](../advanced/04-store.md#multistore) for persisting state. The multistore allows developers to declare any number of [`KVStores`](../advanced/04-store.md#base-layer-kvstores). These `KVStores` only accept the `[]byte` type as value and therefore any custom structure needs to be marshalled using [a codec](../advanced/05-encoding.md) before being stored.
The multistore abstraction is used to divide the state in distinct compartments, each managed by its own module. For more on the multistore, click [here](../advanced/04-store.md#multistore).
## Modules
The power of the Cosmos SDK lies in its modularity. Cosmos SDK applications are built by aggregating a collection of interoperable modules. Each module defines a subset of the state and contains its own message/transaction processor, while the Cosmos SDK is responsible for routing each message to its respective module.
Here is a simplified view of how a transaction is processed by the application of each full-node when it is received in a valid block:
```mermaid
flowchart TD
A[Transaction relayed from the full-node's CometBFT engine to the node's application via DeliverTx] --> B[APPLICATION]
B -->|"Using baseapp's methods: Decode the Tx, extract and route the message(s)"| C[Message routed to the correct module to be processed]
C --> D1[AUTH MODULE]
C --> D2[BANK MODULE]
C --> D3[STAKING MODULE]
C --> D4[GOV MODULE]
D1 -->|Handle message, Update state| E["Return result to CometBFT (0=Ok, 1=Err)"]
D2 -->|Handle message, Update state| E["Return result to CometBFT (0=Ok, 1=Err)"]
D3 -->|Handle message, Update state| E["Return result to CometBFT (0=Ok, 1=Err)"]
D4 -->|Handle message, Update state| E["Return result to CometBFT (0=Ok, 1=Err)"]
```
Each module can be seen as a little state-machine. Developers need to define the subset of the state handled by the module, as well as custom message types that modify the state (_Note:_ `messages` are extracted from `transactions` by `baseapp`). In general, each module declares its own `KVStore` in the `multistore` to persist the subset of the state it defines. Most developers will need to access other 3rd party modules when building their own modules. Given that the Cosmos SDK is an open framework, some of the modules may be malicious, which means there is a need for security principles to reason about inter-module interactions. These principles are based on [object-capabilities](../advanced/10-ocap.md). In practice, this means that instead of having each module keep an access control list for other modules, each module implements special objects called `keepers` that can be passed to other modules to grant a pre-defined set of capabilities.
Cosmos SDK modules are defined in the `x/` folder of the Cosmos SDK. Some core modules include:
- `x/auth`: Used to manage accounts and signatures.
- `x/bank`: Used to enable tokens and token transfers.
- `x/staking` + `x/slashing`: Used to build Proof-of-Stake blockchains.
In addition to the already existing modules in `x/`, which anyone can use in their app, the Cosmos SDK lets you build your own custom modules. You can check an [example of that in the tutorial](https://tutorials.cosmos.network/).# Keepers
:::note Synopsis
`Keeper`s refer to a Cosmos SDK abstraction whose role is to manage access to the subset of the state defined by various modules. `Keeper`s are module-specific, i.e. the subset of state defined by a module can only be accessed by a `keeper` defined in said module. If a module needs to access the subset of state defined by another module, a reference to the second module's internal `keeper` needs to be passed to the first one. This is done in `app.go` during the instantiation of module keepers.
:::
:::note Pre-requisite Readings
- [Introduction to Cosmos SDK Modules](./00-intro.md)
:::
## Motivation
The Cosmos SDK is a framework that makes it easy for developers to build complex decentralized applications from scratch, mainly by composing modules together. As the ecosystem of open-source modules for the Cosmos SDK expands, it will become increasingly likely that some of these modules contain vulnerabilities, as a result of the negligence or malice of their developer.
The Cosmos SDK adopts an [object-capabilities-based approach](https://docs.cosmos.network/main/learn/advanced/ocap#ocaps-in-practice) to help developers better protect their application from unwanted inter-module interactions, and `keeper`s are at the core of this approach. A `keeper` can be considered quite literally to be the gatekeeper of a module's store(s). Each store (typically an [`IAVL` Store](../../learn/advanced/04-store.md#iavl-store)) defined within a module comes with a `storeKey`, which grants unlimited access to it. The module's `keeper` holds this `storeKey` (which should otherwise remain unexposed), and defines [methods](#implementing-methods) for reading and writing to the store(s).
The core idea behind the object-capabilities approach is to only reveal what is necessary to get the work done. In practice, this means that instead of handling permissions of modules through access-control lists, module `keeper`s are passed a reference to the specific instance of the other modules' `keeper`s that they need to access (this is done in the [application's constructor function](../../learn/beginner/00-app-anatomy.md#constructor-function)). As a consequence, a module can only interact with the subset of state defined in another module via the methods exposed by the instance of the other module's `keeper`. This is a great way for developers to control the interactions that their own module can have with modules developed by external developers.
## Type Definition
`keeper`s are generally implemented in a `/keeper/keeper.go` file located in the module's folder. By convention, the type `keeper` of a module is simply named `Keeper` and usually follows the following structure:
```go
type Keeper struct {
// External keepers, if any
// Store key(s)
// codec
// authority
}
```
For example, here is the type definition of the `keeper` from the `staking` module:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-beta.1/x/staking/keeper/keeper.go#L54-L115
```
Let us go through the different parameters:
- An expected `keeper` is a `keeper` external to a module that is required by the internal `keeper` of said module. External `keeper`s are listed in the internal `keeper`'s type definition as interfaces. These interfaces are themselves defined in an `expected_keepers.go` file in the root of the module's folder. In this context, interfaces are used to reduce the number of dependencies, as well as to facilitate the maintenance of the module itself.
- `KVStoreService`s grant access to the store(s) of the [multistore](../../learn/advanced/04-store.md) managed by the module. They should always remain unexposed to external modules.
- `cdc` is the [codec](../../learn/advanced/05-encoding.md) used to marshal and unmarshal structs to/from `[]byte`. The `cdc` can be any of `codec.BinaryCodec`, `codec.JSONCodec` or `codec.Codec` based on your requirements. It can be either a proto or amino codec as long as they implement these interfaces.
- The authority listed is a module account or user account that has the right to change module level parameters. Previously this was handled by the param module, which has been deprecated.
Of course, it is possible to define different types of internal `keeper`s for the same module (e.g. a read-only `keeper`). Each type of `keeper` comes with its own constructor function, which is called from the [application's constructor function](../../learn/beginner/00-app-anatomy.md). This is where `keeper`s are instantiated, and where developers make sure to pass correct instances of modules' `keeper`s to other modules that require them.
## Implementing Methods
`Keeper`s primarily expose methods for business logic, as validity checks should have already been performed by the [`Msg` server](./03-msg-services.md) when `keeper`s' methods are called.
<!-- markdown-link-check-disable -->
State management is recommended to be done via [Collections](../packages/collections)
<!-- The above link is created via the script to generate docs -->
## State Management
In the Cosmos SDK, it is crucial to be methodical and selective when managing state within a module, as improper state management can lead to inefficiency, security risks, and scalability issues. Not all data belongs in the on-chain state; it's important to store only essential blockchain data that needs to be verified by consensus. Storing unnecessary information, especially client-side data, can bloat the state and slow down performance. Instead, developers should focus on using an off-chain database to handle supplementary data, extending the API as needed. This approach minimizes on-chain complexity, optimizes resource usage, and keeps the blockchain state lean and efficient, ensuring scalability and smooth operations.
The Cosmos SDK leverages Protocol Buffers (protobuf) for efficient state management, providing a well-structured, binary encoding format that ensures compatibility and performance across different modules. The SDKs recommended approach for managing state is through the [collections package](../pacakges/02-collections.md), which simplifies state handling by offering predefined data structures like maps and indexed sets, reducing the complexity of managing raw state data. While users can opt for custom encoding schemes if they need more flexibility or have specialized requirements, they should be aware that such custom implementations may not integrate seamlessly with indexers that decode state data on the fly. This could lead to challenges in data retrieval, querying, and interoperability, making protobuf a safer and more future-proof choice for most use cases.
# Folder Structure
:::note Synopsis
This document outlines the structure of Cosmos SDK modules. These ideas are meant to be applied as suggestions. Application developers are encouraged to improve upon and contribute to module structure and development design.
The required interface for a module is located in the module.go. Everything beyond this is suggestive.
:::
## Structure
A typical Cosmos SDK module can be structured as follows:
```shell
proto
└── {project_name}
   └── {module_name}
   └── {proto_version}
      ├── {module_name}.proto
      ├── genesis.proto
      ├── query.proto
      └── tx.proto
```
- `{module_name}.proto`: The module's common message type definitions.
- `genesis.proto`: The module's message type definitions related to genesis state.
- `query.proto`: The module's Query service and related message type definitions.
- `tx.proto`: The module's Msg service and related message type definitions.
```shell
x/{module_name}
├── client
│   ├── cli
│   │ ├── query.go
│   │   └── tx.go
│   └── testutil
│   ├── cli_test.go
│   └── suite.go
├── exported
│   └── exported.go
├── keeper
│   ├── genesis.go
│   ├── grpc_query.go
│   ├── hooks.go
│   ├── invariants.go
│   ├── keeper.go
│   ├── keys.go
│   ├── msg_server.go
│   └── querier.go
├── simulation
│   ├── decoder.go
│   ├── genesis.go
│   ├── operations.go
│   └── params.go
├── types
│   ├── {module_name}.pb.go
│ ├── codec.go
│ ├── errors.go
│ ├── events.go
│ ├── events.pb.go
│ ├── expected_keepers.go
│ ├── genesis.go
│ ├── genesis.pb.go
│ ├── keys.go
│ ├── msgs.go
│ ├── params.go
│ ├── query.pb.go
│ └── tx.pb.go
├── module.go
├── abci.go
├── autocli.go
├── depinject.go
└── README.md
```
- `client/`: The module's CLI client functionality implementation and the module's CLI testing suite.
- `exported/`: The module's exported types - typically interface types. If a module relies on keepers from another module, it is expected to receive the keepers as interface contracts through the `expected_keepers.go` file (see below) in order to avoid a direct dependency on the module implementing the keepers. However, these interface contracts can define methods that operate on and/or return types that are specific to the module that is implementing the keepers and this is where `exported/` comes into play. The interface types that are defined in `exported/` use canonical types, allowing for the module to receive the keepers as interface contracts through the `expected_keepers.go` file. This pattern allows for code to remain DRY and also alleviates import cycle chaos.
- `keeper/`: The module's `Keeper` and `MsgServer` implementation.
- `abci.go`: The module's `BeginBlocker` and `EndBlocker` implementations (this file is only required if `BeginBlocker` and/or `EndBlocker` need to be defined).
- `simulation/`: The module's [simulation](./14-simulator.md) package defines functions used by the blockchain simulator application (`simapp`).
- `README.md`: The module's specification documents outlining important concepts, state storage structure, and message and event type definitions. Learn more how to write module specs in the [spec guidelines](../spec/SPEC_MODULE.md).
- `types/`: includes type definitions for messages, events, and genesis state, including the type definitions generated by Protocol Buffers.
- `codec.go`: The module's registry methods for interface types.
- `errors.go`: The module's sentinel errors.
- `events.go`: The module's event types and constructors.
- `expected_keepers.go`: The module's [expected keeper](./06-keeper.md#type-definition) interfaces.
- `genesis.go`: The module's genesis state methods and helper functions.
- `keys.go`: The module's store keys and associated helper functions.
- `msgs.go`: The module's message type definitions and associated methods.
- `params.go`: The module's parameter type definitions and associated methods.
- `*.pb.go`: The module's type definitions generated by Protocol Buffers (as defined in the respective `*.proto` files above).
- The root directory includes the module's `AppModule` implementation.
- `autocli.go`: The module [autocli](https://docs.cosmos.network/main/core/autocli) options.
- `depinject.go`: The module [depinject](./15-depinject.md#type-definition) options.
> Note: although the above pattern is followed by most of the Cosmos SDK modules, there are some modules that don't follow this pattern. E.g `x/group` and `x/nft` dont have a `types` folder, instead all of the type definitions for messages, events, and genesis state are live in the root directory and the module's `AppModule` implementation lives in the `module` folder.
---
## sidebar_position: 1
# `Msg` Services
:::note Synopsis
A Protobuf `Msg` service processes [messages](./02-messages-and-queries.md#messages). Protobuf `Msg` services are specific to the module in which they are defined, and only process messages defined within the said module. They are called from `BaseApp` during [`FinalizeBlock`](../../learn/advanced/00-baseapp.md#finalizeblock).
:::
:::note Pre-requisite Readings
- [Module Manager](./01-module-manager.md)
- [Messages and Queries](./02-messages-and-queries.md)
:::
## Implementation of a module `Msg` service
Each module should define a Protobuf `Msg` service, which will be responsible for processing requests (implementing `sdk.Msg`) and returning responses.
As further described in [ADR 031](../architecture/adr-031-msg-service.md), this approach has the advantage of clearly specifying return types and generating server and client code.
Protobuf generates a `MsgServer` interface based on the definition of `Msg` service. It is the role of the module developer to implement this interface, by implementing the state transition logic that should happen upon receival of each `transaction.Msg`. As an example, here is the generated `MsgServer` interface for `x/bank`, which exposes two `transaction.Msg`s:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/28fa3b8/x/bank/types/tx.pb.go#L564-L579
```
When possible, the existing module's [`Keeper`](./06-keeper.md) should implement `MsgServer`, otherwise a `msgServer` struct that embeds the `Keeper` can be created, typically in `./keeper/msg_server.go`:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/28fa3b8/x/bank/keeper/msg_server.go#L16-L19
```
`msgServer` methods can retrieve the auxiliary information or services using the environment variable, it is always located in the keeper:
Environment:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/07151304e2ec6a185243d083f59a2d543253cb15/core/appmodule/v2/environment.go#L14-L29
```
Keeper Example:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/07151304e2ec6a185243d083f59a2d543253cb15/x/bank/keeper/keeper.go#L56-L58
```
`transaction.Msg` processing usually follows these 3 steps:
### Validation
The message server must perform all validation required (both _stateful_ and _stateless_) to make sure the `message` is valid.
The `signer` is charged for the gas cost of this validation.
For example, a `msgServer` method for a `transfer` message should check that the sending account has enough funds to actually perform the transfer.
It is recommended to implement all validation checks in a separate function that passes state values as arguments. This implementation simplifies testing. As expected, expensive validation functions charge additional gas. Example:
```go
ValidateMsgA(msg MsgA, now Time, gm GasMeter) error {
if now.Before(msg.Expire) {
return sdkerrors.ErrInvalidRequest.Wrap("msg expired")
}
gm.ConsumeGas(1000, "signature verification")
return signatureVerificaton(msg.Prover, msg.Data)
}
```
:::warning
Previously, the `ValidateBasic` method was used to perform simple and stateless validation checks.
This way of validating is deprecated, this means the `msgServer` must perform all validation checks.
:::
### State Transition
After the validation is successful, the `msgServer` method uses the [`keeper`](./06-keeper.md) functions to access the state and perform a state transition.
### Events
Before returning, `msgServer` methods generally emit one or more [events](../../learn/advanced/08-events.md) by using the `EventManager` held in `environment`.
There are two ways to emit events, typed events using protobuf or arbitrary key & values.
Typed Events:
```go
ctx.EventManager().EmitTypedEvent(
&group.EventABC{Key1: Value1, Key2, Value2})
```
Arbitrary Events:
```go
ctx.EventManager().EmitEvent(
sdk.NewEvent(
eventType, // e.g. sdk.EventTypeMessage for a message, types.CustomEventType for a custom event defined in the module
sdk.NewAttribute(key1, value1),
sdk.NewAttribute(key2, value2),
),
)
```
These events are relayed back to the underlying consensus engine and can be used by service providers to implement services around the application. Click [here](../../learn/advanced/08-events.md) to learn more about events.
The invoked `msgServer` method returns a `proto.Message` response and an `error`. These return values are then wrapped into an `*sdk.Result` or an `error`:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/baseapp/msg_service_router.go#L160
```
This method takes care of marshaling the `res` parameter to protobuf and attaching any events on the `EventManager()` to the `sdk.Result`.
```protobuf reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/proto/cosmos/base/abci/v1beta1/abci.proto#L93-L113
```
This diagram shows a typical structure of a Protobuf `Msg` service, and how the message propagates through the module.
```mermaid
sequenceDiagram
participant User
participant baseApp
participant router
participant handler
participant msgServer
participant keeper
participant EventManager
User->>baseApp: Transaction Type<Tx>
baseApp->>router: Route(ctx, msgRoute)
router->>handler: handler
handler->>msgServer: Msg<Tx>(Context, Msg(..))
alt addresses invalid, denominations wrong, etc.
msgServer->>handler: error
handler->>router: error
router->>baseApp: result, error code
else
msgServer->>keeper: perform action, update context
keeper->>msgServer: results, error code
msgServer->>EventManager: Emit relevant events
msgServer->>msgServer: maybe wrap results in more structure
msgServer->>handler: result, error code
handler->>router: result, error code
router->>baseApp: result, error code
end
baseApp->>User: result, error code
```
## Telemetry
New [telemetry metrics](../../learn/advanced/09-telemetry.md) can be created from `msgServer` methods when handling messages.
This is an example from the `x/auth/vesting` module:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/auth/vesting/msg_server.go#L76-L88
```
:::Warning
Telemetry adds a performance overhead to the chain. It is recommended to only use this in critical paths
:::
---
## sidebar_position: 1
# Query Services
:::note Synopsis
A Protobuf Query service processes [`queries`](./02-messages-and-queries.md#queries). Query services are specific to the module in which they are defined, and only process `queries` defined within said module. They are called from `BaseApp`'s [`Query` method](../../learn/advanced/00-baseapp.md#query).
:::
:::note Pre-requisite Readings
- [Module Manager](./01-module-manager.md)
- [Messages and Queries](./02-messages-and-queries.md)
:::
## Implementation of a module query service
### gRPC Service
When defining a Protobuf `Query` service, a `QueryServer` interface is generated for each module with all the service methods:
```go
type QueryServer interface {
QueryBalance(context.Context, *QueryBalanceParams) (*types.Coin, error)
QueryAllBalances(context.Context, *QueryAllBalancesParams) (*QueryAllBalancesResponse, error)
}
```
These custom queries methods should be implemented by a module's keeper, typically in `./keeper/grpc_query.go`. The first parameter of these methods is a generic `context.Context`. Therefore, the Cosmos SDK provides a function `sdk.UnwrapSDKContext` to retrieve the `context.Context` from the provided
`context.Context`.
Here's an example implementation for the bank module:
```go reference
https://github.com/cosmos/cosmos-sdk/blob/v0.50.0-alpha.0/x/bank/keeper/grpc_query.go
```
### Calling queries from the State Machine
The Cosmos SDK v0.47 introduces a new `cosmos.query.v1.module_query_safe` Protobuf annotation which is used to state that a query that is safe to be called from within the state machine, for example:
- a Keeper's query function can be called from another module's Keeper,
- ADR-033 intermodule query calls,
- CosmWasm contracts can also directly interact with these queries.
If the `module_query_safe` annotation set to `true`, it means:
- The query is deterministic: given a block height it will return the same response upon multiple calls, and doesn't introduce any state-machine breaking changes across SDK patch versions.
- Gas consumption never fluctuates across calls and across patch versions.
If you are a module developer and want to use `module_query_safe` annotation for your own query, you have to ensure the following things:
- the query is deterministic and won't introduce state-machine-breaking changes without coordinated upgrades
- it has its gas tracked, to avoid the attack vector where no gas is accounted for
on potentially high-computation queries.
***
sidebar_position: 1
---
# Blockchain Architecture
## Introduction
Blockchain architecture is a complex topic that involves many different components. In this section, we will cover the main layers of a blockchain application built with the Cosmos SDK.
At its core, a blockchain is a replicated deterministic state machine. This document explores the various layers of blockchain architecture, focusing on the execution, settlement, consensus, data availability, and interoperability layers.
```mermaid
graph TD
A[Modular SDK Blockchain Architecture]
A --> B[Execution Layer]
A --> C[Settlement Layer]
A --> D[Consensus Layer]
D --> E[Data Availability Layer]
A --> F[Interoperability Layer]
```
## Layered Architecture
Understanding blockchain architecture through the lens of different layers helps in comprehending its complex functionalities. We will give a high-level overview of the execution layer, settlement layer, consensus layer, data availability layer, and interoperability layer.
## Execution Layer
The Execution Layer is where the blockchain processes and executes transactions. The state machine within the blockchain handles the execution of transaction logic. This is done by the blockchain itself, ensuring that every transaction follows the predefined rules and state transitions. When a transaction is submitted, the execution layer processes it, updates the state, and ensures that the output is deterministic and consistent across all nodes. In the context of the Cosmos SDK, this typically involves predefined modules and transaction types rather than general-purpose smart contracts, which are used in chains with CosmWasm.
### State machine
At its core, a blockchain is a [replicated deterministic state machine](https://en.wikipedia.org/wiki/State_machine_replication).
A state machine is a computer science concept whereby a machine can have multiple states, but only one at any given time. There is a `state`, which describes the current state of the system, and `transactions`, that trigger state transitions.
Given a state S and a transaction T, the state machine will return a new state S'.
```mermaid
flowchart LR
A[S]
B[S']
A -->|"apply(T)"| B
```
In practice, the transactions are bundled in blocks to make the process more efficient. Given a state S and a block of transactions B, the state machine will return a new state S'.
```mermaid
flowchart LR
A[S]
B[S']
A -->|"For each T in B: apply(T)"| B
```
In a blockchain context, the state machine is [deterministic](https://en.wikipedia.org/wiki/Deterministic_system). This means that if a node is started at a given state and replays the same sequence of transactions, it will always end up with the same final state.
The Cosmos SDK gives developers maximum flexibility to define the state of their application, transaction types and state transition functions. The process of building state machines with the Cosmos SDK will be described more in-depth in the following sections. But first, let us see how the state machine is replicated using various consensus engines, such as CometBFT.
## Settlement Layer
The Settlement Layer is responsible for finalising and recording transactions on the blockchain. This layer ensures that all transactions are accurately settled and immutable, providing a verifiable record of all activities on the blockchain. It is critical for maintaining the integrity and trustworthiness of the blockchain.
The settlement layer can be performed on the chain itself or it can be externalised, allowing for the possibility of plugging in a different settlement layer as needed. For example if we were to use Rollkit and celestia for our Data Availability and Consensus, we could separate our settlement layer by introducing fraud or validity proofs. From there the settlement layer can create trust-minimised light clients, further enhancing security and efficiency. This process ensures that all transactions are accurately finalized and immutable, providing a verifiable record of all activities.
## Consensus Layer
The Consensus Layer ensures that all nodes in the network agree on the order and validity of transactions. This layer uses consensus algorithms like Byzantine Fault Tolerance (BFT) or Proof of Stake (PoS) to achieve agreement, even in the presence of malicious nodes. Consensus is crucial for maintaining the security and reliability of the blockchain.
What has been a default consensus engine in the Cosmos SDK has been CometBFT. In the most recent releases we have been moving away from this and allowing users to plug and play their own consensus engines. This is a big step forward for the Cosmos SDK as it allows for more flexibility and customisation. Other consensus engine options for example can be Rollkit with Celestias Data Availability Layer.
Here is an example of how the consensus layer works with CometBFT in the context of the Cosmos SDK:
### CometBFT
Thanks to the Cosmos SDK, developers just have to define the state machine, and [_CometBFT_](https://docs.cometbft.com/v1.0/explanation/introduction/) will handle replication over the network for them.
```mermaid
flowchart TD
subgraph Blockchain_Node[Blockchain Node]
subgraph SM[State-machine]
direction TB
SM1[Cosmos SDK]
end
subgraph CometBFT[CometBFT]
direction TB
Consensus
Networking
end
end
SM <--> CometBFT
Blockchain_Node -->|Includes| SM
Blockchain_Node -->|Includes| CometBFT
```
[CometBFT](https://docs.cometbft.com/v1.0/explanation/introduction/) is an application-agnostic engine that is responsible for handling the _networking_ and _consensus_ layers of a blockchain. In practice, this means that CometBFT is responsible for propagating and ordering transaction bytes. CometBFT relies on an eponymous Byzantine-Fault-Tolerant (BFT) algorithm to reach consensus on the order of transactions.
The [consensus algorithm adopted by CometBFT](https://docs.cometbft.com/v1.0/explanation/introduction/#consensus-overview) works with a set of special nodes called _Validators_. Validators are responsible for adding blocks of transactions to the blockchain. At any given block, there is a validator set V. A validator in V is chosen by the algorithm to be the proposer of the next block. This block is considered valid if more than two thirds of V signed a `prevote` and a `precommit` on it, and if all the transactions that it contains are valid. The validator set can be changed by rules written in the state-machine.
## ABCI
CometBFT passes transactions to the application through an interface called the [ABCI](https://docs.cometbft.com/v1.0/spec/abci/), which the application must implement.
```mermaid
graph TD
A[Application]
B[CometBFT]
A <-->|ABCI| B
```
Note that **CometBFT only handles transaction bytes**. It has no knowledge of what these bytes mean. All CometBFT does is order these transaction bytes deterministically. CometBFT passes the bytes to the application via the ABCI, and expects a return code to inform it if the messages contained in the transactions were successfully processed or not.
Here are the most important messages of the ABCI:
- `CheckTx`: When a transaction is received by CometBFT, it is passed to the application to check if a few basic requirements are met. `CheckTx` is used to protect the mempool of full-nodes against spam transactions. A special handler called the [`AnteHandler`](../beginner/04-gas-fees.md#antehandler) is used to execute a series of validation steps such as checking for sufficient fees and validating the signatures. If the checks are valid, the transaction is added to the [mempool](https://docs.cometbft.com/v1.0/explanation/core/mempool) and relayed to peer nodes. Note that transactions are not processed (i.e. no modification of the state occurs) with `CheckTx` since they have not been included in a block yet.
- `DeliverTx`: When a [valid block](https://docs.cometbft.com/v1.0/spec/core/data_structures#block) is received by CometBFT, each transaction in the block is passed to the application via `DeliverTx` in order to be processed. It is during this stage that the state transitions occur. The `AnteHandler` executes again, along with the actual [`Msg` service](../../build/building-modules/03-msg-services.md) RPC for each message in the transaction.
- `BeginBlock`/`EndBlock`: These messages are executed at the beginning and the end of each block, whether the block contains transactions or not. It is useful to trigger automatic execution of logic. Proceed with caution though, as computationally expensive loops could slow down your blockchain, or even freeze it if the loop is infinite.
Find a more detailed view of the ABCI methods from the [CometBFT docs](https://docs.cometbft.com/v1.0/spec/abci/).
Any application built on CometBFT needs to implement the ABCI interface in order to communicate with the underlying local CometBFT engine. Fortunately, you do not have to implement the ABCI interface. The Cosmos SDK provides a boilerplate implementation of it in the form of [baseapp](./03-sdk-design.md#baseapp).
## Data Availability Layer
The Data Availability (DA) Layer is a critical component of within the umbrella of the consensus layer that ensures all necessary data for transactions is available to all network participants. This layer is essential for preventing data withholding attacks, where some nodes might attempt to disrupt the network by not sharing critical transaction data.
If we use the example of Rollkit, a user initiates a transaction, which is then propagated through the rollup network by a light node. The transaction is validated by full nodes and aggregated into a block by the sequencer. This block is posted to a data availability layer like Celestia, ensuring the data is accessible and correctly ordered. The rollup light node verifies data availability from the DA layer. Full nodes then validate the block and generate necessary proofs, such as fraud proofs for optimistic rollups or zk-SNARKs/zk-STARKs for zk-rollups. These proofs are shared across the network and verified by other nodes, ensuring the rollup's integrity. Once all validations are complete, the rollup's state is updated, finalising the transaction
## Interoperability Layer
The Interoperability Layer enables communication and interaction between different blockchains. This layer facilitates cross-chain transactions and data sharing, allowing various blockchain networks to interoperate seamlessly. Interoperability is key for building a connected ecosystem of blockchains, enhancing their functionality and reach.
In this case we have separated the layers even further to really illustrate the components that make-up the blockchain architecture and it is important to note that the Cosmos SDK is designed to be interoperable with other blockchains. This is achieved through the use of the [Inter-Blockchain Communication (IBC) protocol](https://www.ibcprotocol.dev/), which allows different blockchains to communicate and transfer assets between each other.
---
## sidebar_position: 1
# Application-Specific Blockchains
:::note Synopsis
This document explains what application-specific blockchains are, and why developers would want to build one as opposed to writing Smart Contracts.
:::
## What are application-specific blockchains
Application-specific blockchains are blockchains customized to operate a single application. Instead of building a decentralized application on top of an underlying blockchain like Ethereum, developers build their own blockchain from the ground up. This means building a full-node client, a light-client, and all the necessary interfaces (CLI, REST, ...) to interact with the nodes.
```mermaid
flowchart TD
subgraph Blockchain_Node[Blockchain Node]
subgraph SM[State-machine]
direction TB
SM1[Cosmos SDK]
end
subgraph Consensus[Consensus]
direction TB
end
subgraph Networking[Networking]
direction TB
end
end
SM <--> Consensus
Consensus <--> Networking
Blockchain_Node -->|Includes| SM
Blockchain_Node -->|Includes| Consensus
Blockchain_Node -->|Includes| Networking
```
## What are the shortcomings of Smart Contracts
Virtual-machine blockchains like Ethereum addressed the demand for more programmability back in 2014. At the time, the options available for building decentralized applications were quite limited. Most developers would build on top of the complex and limited Bitcoin scripting language, or fork the Bitcoin codebase which was hard to work with and customize.
Virtual-machine blockchains came in with a new value proposition. Their state-machine incorporates a virtual-machine that is able to interpret turing-complete programs called Smart Contracts. These Smart Contracts are very good for use cases like one-time events (e.g. ICOs), but they can fall short for building complex decentralized platforms. Here is why:
- Smart Contracts are generally developed with specific programming languages that can be interpreted by the underlying virtual-machine. These programming languages are often immature and inherently limited by the constraints of the virtual-machine itself. For example, the Ethereum Virtual Machine does not allow developers to implement automatic execution of code. Developers are also limited to the account-based system of the EVM, and they can only choose from a limited set of functions for their cryptographic operations. These are examples, but they hint at the lack of **flexibility** that a smart contract environment often entails.
- Smart Contracts are all run by the same virtual machine. This means that they compete for resources, which can severely restrain **performance**. And even if the state-machine were to be split in multiple subsets (e.g. via sharding), Smart Contracts would still need to be interpreted by a virtual machine, which would limit performance compared to a native application implemented at state-machine level (our benchmarks show an improvement on the order of 10x in performance when the virtual-machine is removed).
- Another issue with the fact that Smart Contracts share the same underlying environment is the resulting limitation in **sovereignty**. A decentralized application is an ecosystem that involves multiple players. If the application is built on a general-purpose virtual-machine blockchain, stakeholders have very limited sovereignty over their application, and are ultimately superseded by the governance of the underlying blockchain. If there is a bug in the application, very little can be done about it.
Application-Specific Blockchains are designed to address these shortcomings.
## Application-Specific Blockchains Benefits
### Flexibility
Application-specific blockchains give maximum flexibility to developers:
- In Cosmos blockchains, the state-machine is typically connected to the underlying consensus engine via an interface called the [ABCI](https://docs.cometbft.com/v1.0/spec/abci/) (Application Blockchain Interface). This interface can be wrapped in any programming language, meaning developers can build their state-machine in the programming language of their choice.
- Developers can choose among multiple frameworks to build their state-machine. The most widely used today is the Cosmos SDK, but others exist (e.g. [Lotion](https://github.com/nomic-io/lotion), [Weave](https://github.com/iov-one/weave), ...). Typically the choice will be made based on the programming language they want to use (Cosmos SDK and Weave are in Golang, Lotion is in Javascript, ...).
- The ABCI also allows developers to swap the consensus engine of their application-specific blockchain. Today, only CometBFT is production-ready, but in the future other consensus engines are expected to emerge.
- Even when they settle for a framework and consensus engine, developers still have the freedom to tweak them if they don't perfectly match their requirements in their pristine forms.
- Developers are free to explore the full spectrum of tradeoffs (e.g. number of validators vs transaction throughput, safety vs availability in asynchrony, ...) and design choices (DB or IAVL tree for storage, UTXO or account model, ...).
- Developers can implement automatic execution of code. In the Cosmos SDK, logic can be automatically triggered at the beginning and the end of each block. They are also free to choose the cryptographic library used in their application, as opposed to being constrained by what is made available by the underlying environment in the case of virtual-machine blockchains.
The list above contains a few examples that show how much flexibility application-specific blockchains give to developers. The goal of Cosmos and the Cosmos SDK is to make developer tooling as generic and composable as possible, so that each part of the stack can be forked, tweaked and improved without losing compatibility. As the community grows, more alternatives for each of the core building blocks will emerge, giving more options to developers.
### Performance
Decentralized applications built with Smart Contracts are inherently capped in performance by the underlying environment. For a decentralized application to optimise performance, it needs to be built as an application-specific blockchain. Next are some of the benefits an application-specific blockchain brings in terms of performance:
- Developers of application-specific blockchains can choose to operate with a novel consensus engine such as CometBFT.
- An application-specific blockchain only operates a single application, so that the application does not compete with others for computation and storage. This is the opposite of most non-sharded virtual-machine blockchains today, where smart contracts all compete for computation and storage.
- Even if a virtual-machine blockchain offered application-based sharding coupled with an efficient consensus algorithm, performance would still be limited by the virtual-machine itself. The real throughput bottleneck is the state-machine, and requiring transactions to be interpreted by a virtual-machine significantly increases the computational complexity of processing them.
### Security
Security is hard to quantify, and greatly varies from platform to platform. That said here are some important benefits an application-specific blockchain can bring in terms of security:
- Developers can choose proven programming languages like Go when building their application-specific blockchains, as opposed to smart contract programming languages that are often more immature.
- Developers are not constrained by the cryptographic functions made available by the underlying virtual-machines. They can use their own custom cryptography, and rely on well-audited crypto libraries.
- Developers do not have to worry about potential bugs or exploitable mechanisms in the underlying virtual-machine, making it easier to reason about the security of the application.
### Sovereignty
One of the major benefits of application-specific blockchains is sovereignty. A decentralized application is an ecosystem that involves many actors: users, developers, third-party services, and more. When developers build on virtual-machine blockchain where many decentralized applications coexist, the community of the application is different than the community of the underlying blockchain, and the latter supersedes the former in the governance process. If there is a bug or if a new feature is needed, stakeholders of the application have very little leeway to upgrade the code. If the community of the underlying blockchain refuses to act, nothing can happen.
The fundamental issue here is that the governance of the application and the governance of the network are not aligned. This issue is solved by application-specific blockchains. Because application-specific blockchains specialize to operate a single application, stakeholders of the application have full control over the entire chain. This ensures that the community will not be stuck if a bug is discovered, and that it has the freedom to choose how it is going to evolve.
-141
View File
@@ -1,141 +0,0 @@
# `x/did`
The Decentralized Identity module is responsible for managing native Sonr Accounts, their derived wallets, and associated user identification information.
## State
The DID module maintains several key state structures:
### Controller State
The Controller state represents a Sonr DWN Vault. It includes:
- Unique identifier (number)
- DID
- Sonr address
- Ethereum address
- Bitcoin address
- Public key
- Keyshares pointer
- Claimed block
- Creation block
### Assertion State
The Assertion state includes:
- DID
- Controller
- Subject
- Public key
- Assertion type
- Accumulator (metadata)
- Creation block
### Authentication State
The Authentication state includes:
- DID
- Controller
- Subject
- Public key
- Credential ID
- Metadata
- Creation block
### Verification State
The Verification state includes:
- DID
- Controller
- DID method
- Issuer
- Subject
- Public key
- Verification type
- Metadata
- Creation block
## State Transitions
State transitions are triggered by the following messages:
- LinkAssertion
- LinkAuthentication
- UnlinkAssertion
- UnlinkAuthentication
- ExecuteTx
- UpdateParams
## Messages
The DID module defines the following messages:
1. MsgLinkAuthentication
2. MsgLinkAssertion
3. MsgExecuteTx
4. MsgUnlinkAssertion
5. MsgUnlinkAuthentication
6. MsgUpdateParams
Each message triggers specific state machine behaviors related to managing DIDs, authentications, assertions, and module parameters.
## Query
The DID module provides the following query endpoints:
1. Params: Query all parameters of the module
2. Resolve: Query the DID document by its ID
3. Sign: Sign a message with the DID document
4. Verify: Verify a message with the DID document
## Params
The module parameters include:
- Allowed public keys (map of KeyInfo)
- Conveyance preference
- Attestation formats
## Client
The module provides gRPC and REST endpoints for all defined messages and queries.
## Future Improvements
Potential future improvements could include:
1. Enhanced privacy features for DID operations
2. Integration with more blockchain networks
3. Support for additional key types and cryptographic algorithms
4. Improved revocation mechanisms for credentials and assertions
## Tests
Acceptance tests should cover all major functionality, including:
- Creating and managing DIDs
- Linking and unlinking assertions and authentications
- Executing transactions with DIDs
- Querying and resolving DIDs
- Parameter updates
## Appendix
### Account
An Account represents a user's identity within the Sonr ecosystem. It includes information such as the user's public key, associated wallets, and other identification details.
### Decentralized Identifier (DID)
A Decentralized Identifier (DID) is a unique identifier that is created, owned, and controlled by the user. It is used to establish a secure and verifiable digital identity.
### Verifiable Credential (VC)
A Verifiable Credential (VC) is a digital statement that can be cryptographically verified. It contains claims about a subject (e.g., a user) and is issued by a trusted authority.
### Key Types
The module supports various key types, including:
- Role
- Algorithm (e.g., ES256, EdDSA, ES256K)
- Encoding (e.g., hex, base64, multibase)
- Curve (e.g., P256, P384, P521, X25519, X448, Ed25519, Ed448, secp256k1)
### JSON Web Key (JWK)
The module supports JSON Web Keys (JWK) for representing cryptographic keys, including properties such as key type (kty), curve (crv), and coordinates (x, y) for EC and OKP keys, as well as modulus (n) and exponent (e) for RSA keys.
-145
View File
@@ -1,145 +0,0 @@
# `x/dwn`
The DWN module is responsible for the management of IPFS deployed Decentralized Web Nodes (DWNs) and their associated data.
## Concepts
The DWN module introduces several key concepts:
1. Decentralized Web Node (DWN): A distributed network for storing and sharing data.
2. Schema: A structure defining the format of various data types in the dwn.
3. IPFS Integration: The module can interact with IPFS for decentralized data storage.
## State
The DWN module maintains the following state:
### DWN State
The DWN state is stored using the following structure:
```protobuf
message DWN {
uint64 id = 1;
string alias = 2;
string cid = 3;
string resolver = 4;
}
```
This state is indexed by ID, alias, and CID for efficient querying.
### Params State
The module parameters are stored in the following structure:
```protobuf
message Params {
bool ipfs_active = 1;
bool local_registration_enabled = 2;
Schema schema = 4;
}
```
### Schema State
The Schema state defines the structure for various data types:
```protobuf
message Schema {
int32 version = 1;
string account = 2;
string asset = 3;
string chain = 4;
string credential = 5;
string did = 6;
string jwk = 7;
string grant = 8;
string keyshare = 9;
string profile = 10;
}
```
## State Transitions
State transitions in the DWN module are primarily triggered by:
1. Updating module parameters
2. Allocating new dwns
3. Syncing DID documents
## Messages
The DWN module defines the following message:
1. `MsgUpdateParams`: Used to update the module parameters.
```protobuf
message MsgUpdateParams {
string authority = 1;
Params params = 2;
}
```
## Begin Block
No specific begin-block operations are defined for this module.
## End Block
No specific end-block operations are defined for this module.
## Hooks
The DWN module does not define any hooks.
## Events
The DWN module does not explicitly define any events. However, standard Cosmos SDK events may be emitted during state transitions.
## Client
The DWN module provides the following gRPC query endpoints:
1. `Params`: Queries all parameters of the module.
2. `Schema`: Queries the DID document schema.
3. `Allocate`: Initializes a Target DWN available for claims.
4. `Sync`: Queries the DID document by its ID and returns required information.
## Params
The module parameters include:
- `ipfs_active` (bool): Indicates if IPFS integration is active.
- `local_registration_enabled` (bool): Indicates if local registration is enabled.
- `schema` (Schema): Defines the structure for various data types in the dwn.
## Future Improvements
Potential future improvements could include:
1. Enhanced IPFS integration features.
2. Additional authentication mechanisms beyond WebAuthn.
3. Improved DID document management and querying capabilities.
## Tests
Acceptance tests should cover:
1. Parameter updates
2. DWN state management
3. Schema queries
4. DWN allocation process
5. DID document syncing
## Appendix
| Concept | Description |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Decentralized Web Node (DWN) | A decentralized, distributed, and secure network of nodes that store and share data. It is a decentralized alternative to traditional web hosting services. |
| Decentralized Identifier (DID) | A unique identifier that is created, owned, and controlled by the user. It is used to establish a secure and verifiable digital identity. |
| HTMX (Hypertext Markup Language eXtensions) | A set of extensions to HTML that allow for the creation of interactive web pages. It is used to enhance the user experience and provide additional functionality to web applications. |
| IPFS (InterPlanetary File System) | A decentralized, peer-to-peer network for storing and sharing data. It is a distributed file system that allows for the creation and sharing of content across a network of nodes. |
| WebAuthn (Web Authentication) | A set of APIs that allow websites to request user authentication using biometric or non-biometric factors. |
| WebAssembly (Web Assembly) | A binary instruction format for a stack-based virtual machine. |
| Verifiable Credential (VC) | A digital statement that can be cryptographically verified. |
-91
View File
@@ -1,91 +0,0 @@
# `x/svc`
The svc module is responsible for managing the registration and authorization of services within the Sonr ecosystem. It provides a secure and verifiable mechanism for registering and authorizing services using Decentralized Identifiers (DIDs).
## Concepts
- **Service**: A decentralized svc on the Sonr Blockchain with properties such as ID, authority, origin, name, description, category, tags, and expiry height.
- **Profile**: Represents a DID alias with properties like ID, subject, origin, and controller.
- **Metadata**: Contains information about a svc, including name, description, category, icon, and tags.
### Dependencies
- [x/did](https://github.com/onsonr/sonr/tree/master/x/did)
- [x/group](https://github.com/onsonr/sonr/tree/master/x/group)
- [x/nft](https://github.com/onsonr/sonr/tree/master/x/nft)
## State
The module uses the following state structures:
### Metadata
Stores information about services:
- Primary key: `id` (auto-increment)
- Unique index: `origin`
- Fields: id, origin, name, description, category, icon (URI), tags
### Profile
Stores DID alias information:
- Primary key: `id`
- Unique index: `subject,origin`
- Fields: id, subject, origin, controller
## Messages
### MsgUpdateParams
Updates the module parameters. Can only be executed by the governance account.
### MsgRegisterService
Registers a new svc on the blockchain. Requires a valid TXT record in DNS for the origin.
## Params
The module has the following parameters:
- `categories`: List of allowed svc categories
- `types`: List of allowed svc types
## Query
The module provides the following query:
### Params
Retrieves all parameters of the module.
## Client
### gRPC
The module provides a gRPC Query svc with the following RPC:
- `Params`: Get all parameters of the module
### CLI
(TODO: Add CLI commands for interacting with the module)
## Events
(TODO: List and describe event tags used by the module)
## Future Improvements
- Implement svc discovery mechanisms
- Add support for svc reputation and rating systems
- Enhance svc metadata with more detailed information
- Implement svc update and deactivation functionality
## Tests
(TODO: Add acceptance tests for the module)
## Appendix
This module is part of the Sonr blockchain project and interacts with other modules such as DID and NFT modules to provide a comprehensive decentralized svc ecosystem.
-873
View File
@@ -1,873 +0,0 @@
# User Controlled Authorization Network (UCAN) Specification
# Abstract
User-Controlled Authorization Network (UCAN) is a [trustless], secure, [local-first], user-originated, distributed authorization scheme. This document provides a high level overview of the components of the system, concepts, and motivation. Exact formats are given in [sub-specifications].
# Introduction
User-Controlled Authorization Network (UCAN) is a [trustless], secure, [local-first], user-originated, distributed authorization scheme. It provides public-key verifiable, delegable, expressive, openly extensible [capabilities]. UCANs achieve public verifiability with late-bound certificate chains and principals represented by [decentralized identifiers (DIDs)][DID].
UCAN improves the familiarity and adoptability of schemes like [SPKI/SDSI][SPKI] for web and native application contexts. UCAN allows for the creation, delegation, and invocation of authority by any agent with a DID, including traditional systems and peer-to-peer architectures beyond traditional cloud computing.
## Motivation
> If we practice our principles, we could have both security and functionality. Treating security as a separate concern has not succeeded in bridging the gap between principle and practice, because it operates without knowledge of what constitutes least authority.
>
> — [Miller][Mark Miller] et al, [The Structure of Authority]
Since at least [Multics], access control lists ([ACL]s) have been the most popular form of digital authorization, where a list of what each user is allowed to do is maintained on the resource. ACLs (and later [RBAC]) have been a successful model suited to architectures where persistent access to a single list is viable. ACLs require that rules are sufficiently well specified, such as in a centralized database with rules covering all possible permutations of scenario. This both imposes a very high maintenance burden on programmers as a systems grows in complexity, and is a key vector for [confused deputies][confused deputy problem].
With increasing interconnectivity between machines becoming commonplace, authorization needs to scale to meet the load demands of distributed systems while providing partition tolerance. However, it is not always practical to maintain a single central authorization source. Even when copies of the authorization list are distributed to the relevant servers, latency and partitions introduce troublesome challenges with conflicting updates, to say nothing of storage requirements.
A large portion of personal information now also moves through connected systems. As a result, data privacy is a prominent theme when considering the design of modern applications, to the point of being legislated in parts of the world.
Ahead-of-time coordination is often a barrier to development in many projects. Flexibility to define specialized authorization semantics for resources and the ability to integrate with external systems trustlessly are essential as the number of autonomous, specialized, and coordinated applications increases.
Many high-value applications run in hostile environments. In recognition of this, many vendors now include public key functionality, such as [non-extractable keys in browsers][browser api crypto key], [certificate systems for external keys][fido], [platform keys][passkey], and [secure hardware enclaves] in widespread consumer devices.
Two related models that work exceptionally well in the above context are Simple Public Key Infrastructure ([SPKI][spki rfc]) and object capabilities ([OCAP]). Since offline operation and self-verifiability are two requirements, UCAN adopts a [certificate capability model] related to [SPKI].
## Intuition for Auth System Differences
The following analogies illustrate several significant trade-offs between these systems but are only accurate enough to build intuition. A good resource for a more thorough presentation of these trade-offs is [Capability Myths Demolished]. In this framework, UCAN approximates SPKI with some dynamic features.
### Access Control Lists
By analogy, ACLs are like a bouncer at an exclusive event. This bouncer has a list attendees allowed in and which of those are VIPs that get extra access. People trying to get in show their government-issued ID and are accepted or rejected. In addition, they may get a lanyard to identify that they have previously been allowed in. If someone is disruptive, they can simply be crossed off the list and denied further entry.
If there are many such events at many venues, the organizers need to coordinate ahead of time, denials need to be synchronized, and attendees need to show their ID cards to many bouncers. The likelihood of the bouncer letting in the wrong person due to synchronization lag or confusion by someone sharing a name is nonzero.
### Certificate Capabilities
UCANs work more like [movie tickets][caps as keys] or a festival pass. No one needs to check your ID; who you are is irrelevant. For example, if you have a ticket issued by the theater to see Citizen Kane, you are admitted to Theater 3. If you cannot attend an event, you can hand this ticket to a friend who wants to see the film instead, and there is no coordination required with the theater ahead of time. However, if the theater needs to cancel tickets for some reason, they need a way of uniquely identifying them and sharing this information between them.
### Object Capabilities
Object capability ("ocap") systems use a combination of references, encapsulated state, and proxy forwarding. As the name implies, this is fairly close to object-oriented or actor-based systems. Object capabilities are [robust][Robust Composition], flexible, and expressive.
To achieve these properties, object capabilities have two requirements: [fail-safe], and locality preservation. The emphasis on consistency rules out partition tolerance[^pcec].
## Security Considerations
Each UCAN includes an assertions of what it is allowed to do. "Proofs" are positive evidence (elsewhere called "witnesses") of the possession of rights. They are cryptographically verifiable chains showing that the UCAN issuer either claims to directly own a resource, or that it was delegated to them by some claimed owner. In the most common case, the root owner's ID is the only globally unique identity for the resource.
Root capability issuers function as verifiable, distributed roots of trust. The delegation chain is by definition a provenance log. Private keys themselves SHOULD NOT move from one context to another. Keeping keys unique to each physical device and unique per use case is RECOMMENDED to reduce opportunity for keys to leak, and limit blast radius in the case of compromises. "Sharing authority without sharing keys" is provided by capabilities, so there is no reason to share keys directly.
Note that a structurally and cryptographically valid UCAN chain can be semantically invalid. The executor MUST verify the ownership of any external resources at execution time. While not possible for all use cases (e.g. replicated state machines and eventually consistent data), having the Executor be the resource itself is RECOMMENDED.
While certificate chains go a long way toward improving security, they do not provide [confinement] on their own. The principle of least authority SHOULD be used when delegating a UCAN: minimizing the amount of time that a UCAN is valid for and reducing authority to the bare minimum required for the delegate to complete their task. This delegate should be trusted as little as is practical since they can further sub-delegate their authority to others without alerting their delegator. UCANs do not offer confinement (as that would require all processes to be online), so it is impossible to guarantee knowledge of all of the sub-delegations that exist. The ability to revoke some or all downstream UCANs exists as a last resort.
## Inversion of Control
[Inversion of control] is achieved due to two properties: self-certifying delegation and reference passing. There is no Authorization Server (AS) that sits between requestors and resources. In traditional terms, the owner of a UCAN resource is the resource server (RS) directly.
This inverts the usual relationship between resources and users: the resource grants some (or all) authority over itself to agents, as opposed to an Authorization Server managing the relationship between them. This has several major advantages:
- Fully distributed and scalable
- Self-contained request without intermediary
- Partition tolerance, [support for replicated data and machines][overcoming SSI]
- Flexible granularity
- Compositionality: no distinction between resources residing together or apart
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ │ │ │ │ │
│ │ │ ┌─────────┐ │ │ │
│ │ │ │ Bob's │ │ │ │
│ │ │ │ Photo │ │ │ │
│ │ │ │ Gallery │ │ │ │
│ │ │ └─────────┘ │ │ │
│ │ │ │ │ │
│ Alice's │ │ Bob's │ │ Carol's │
│ Stuff │ │ Stuff │ │ Stuff │
│ │ │ │ │ │
│ ┌───────┼───┼─────────────┼───┼──┐ │
│ │ │ │ │ │ │ │
│ │ │ │ ┌───┼───┼──┼────────┐ │
│ │ │ │ Alice's │ │ │ │ │ │
│ │ │ │ Music │ │ │ │Carol's │ │
│ │ │ │ Player │ │ │ │ Game │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ └───┼───┼──┼────────┘ │
│ │ │ │ │ │ │ │
│ └───────┼───┼─────────────┼───┼──┘ │
│ │ │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
```
This additionally allows UCAN to model auth for [eventually consistent and replicated state][overcoming SSI].
# Roles
There are several roles that an agent MAY assume:
| Name | Description |
| --------- | ------------------------------------------------------------------------------------------------ |
| Agent | The general class of entities and principals that interact with a UCAN |
| Audience | The Principal delegated to in the current UCAN. Listed in the `aud` field |
| Executor | The Agent that actually performs the action described in an invocation |
| Invoker | A Principal that requests an Executor perform some action that uses the Invoker's authority |
| Issuer | The Principal of the current UCAN. Listed in the `iss` field |
| Owner | A Subject that controls some external resource |
| Principal | An agent identified by DID (listed in a UCAN's `iss` or `aud` field) |
| Revoker | The Issuer listed in a proof chain that revokes a UCAN |
| Subject | The Principal who's authority is delegated or invoked |
| Validator | Any Agent that interprets a UCAN to determine that it is valid, and which capabilities it grants |
```mermaid
flowchart TD
subgraph Agent
subgraph Principal
direction TB
subgraph Issuer
direction TB
subgraph Subject
direction TB
Executor
Owner
end
Revoker
end
subgraph Audience
Invoker
end
end
Validator
end
```
## Subject
> At the very least every object should have a URL
>
> — [Alan Kay], [The computer revolution hasn't happened yet]
> Every Erlang process in the universe should be addressable and introspective
>
> — [Joe Armstrong], [Code Mesh 2016]
A [Subject] represents the Agent that a capability is for. A Subject MUST be referenced by [DID]. This behaves much like a [GUID], with the addition of public key verifiability. This unforgeability prevents malicious namespace collisions which can lead to [confused deputies][confused deputy problem].
### Resource
A resource is some data or process that can be uniquely identified by a [URI]. It can be anything from a row in a database, a user account, storage quota, email address, etc. Resource MAY be as coarse or fine grained as desired. Finer-grained is RECOMMENDED where possible, as it is easier to model the principle of least authority ([PoLA]).
A resource describes the noun of a capability. The resource pointer MUST be provided in [URI] format. Arbitrary and custom URIs MAY be used, provided that the intended recipient can decode the URI. The URI is merely a unique identifier to describe the pointer to — and within — a resource.
Having a unique agent represent a resource (and act as its manager) is RECOMMENDED. However, to help traditional ACL-based systems transition to certificate capabilities, an agent MAY manage multiple resources, and [act as the registrant in the ACL system][wrapping existing systems].
Unless explicitly stated, the Resource of a UCAN MUST be the Subject.
## Issuer & Audience
The Issuer (`iss`) and Audience (`aud`) can be conceptualized as the sender and receiver (respectively) of a postal letter. Every UCAN MUST be signed with the private key associated with the DID in the `iss` field.
For example:
```js
"aud": "did:key:z6MkiTBz1ymuepAQ4HEHYSF1H8quG5GLVVQR3djdX3mDooWp",
"iss": "did:key:zDnaerDaTF5BXEavCrfRZEk316dpbLsfPDZ3WJ5hRTPFU2169",
```
Please see the [Cryptosuite] section for more detail on DIDs.
# Lifecycle
The UCAN lifecycle has four components:
| Spec | Description | Requirement Level |
| ------------ | ------------------------------------------------------------------------ | ----------------- |
| [Delegation] | Pass, attenuate, and secure authority in a partition-tolerant way | REQUIRED |
| [Invocation] | Exercise authority that has been delegated through one or more delegates | REQUIRED |
| [Promise] | Await the result of an Invocation inside another Invocation | RECOMMENDED |
| [Revocation] | Undo a delegation, breaking a delegation chain for malicious users | RECOMMENDED |
```mermaid
flowchart TD
prm(Promise)
inv(Invocation)
del(Delegation)
rev(Revocation)
prm -->|awaits| inv
del -->|proves| inv
rev -.->|kind of| inv
rev -->|invalidates| del
click del href "https://github.com/ucan-wg/delegation" "UCAN Delegation Spec"
click inv href "https://github.com/ucan-wg/invocation" "UCAN Invocation Spec"
click rev href "https://github.com/ucan-wg/revocation" "UCAN Revocation Spec"
```
## Time
It is often useful to talk about a UCAN in the context of some action. For example, a UCAN delegation may be valid when it was created, but expired when invoked.
```mermaid
sequenceDiagram
Alice -->> Bob: Delegate
Bob ->> Bob: Validate
Bob -->> Carol: Delegate
Carol ->> Carol: Validate
Carol ->> Alice: Invoke
Alice ->> Alice: Validate
Alice ->> Alice: Execute
```
### Validity Interval
The period of time that a capability is valid from and until. This is the range from the latest "not before" to the earliest expiry in the UCAN delegation chain.
### Delegation-Time
The moment at which a delegation is asserted. This MAY be captured by an `iat` field, but is generally superfluous to capture in the token.
### Invocation-Time
The moment a UCAN Invocation is created. It must be within the Validity Interval.
### Validation-Time
Validation MAY occur at multiple points during a UCAN's lifecycle. The main two are:
- On receipt of a delegation
- When executing an invocation
### Execution-Time
To avoid the overloaded word "runtime", UCAN adopts the term "execution-time" to express the moment that the executor attempts to use the authority captured in an invocation and associated delegation chain. Validation MUST occur at this time.
## Time Bounds
`nbf` and `exp` stand for "not before" and "expires at," respectively. These MUST be expressed as seconds since the Unix epoch in UTC, without time zone or other offset. Taken together, they represent the time bounds for a token. These timestamps MUST be represented as the number of integer seconds since the Unix epoch. Due to limitations[^js-num-size] in numerics for certain common languages, timestamps outside of the range from $-2^{53} 1$ to $2^{53} 1$ MUST be rejected as invalid.
The `nbf` field is OPTIONAL. When omitted, the token MUST be treated as valid beginning from the Unix epoch. Setting the `nbf` field to a time in the future MUST delay invoking a UCAN. For example, pre-provisioning access to conference materials ahead of time but not allowing access until the day it starts is achievable with judicious use of `nbf`.
The `exp` field is RECOMMENDED. Following the [principle of least authority][PoLA], it is RECOMMENDED to give a timestamp expiry for UCANs. If the token explicitly never expires, the `exp` field MUST be set to `null`. If the time is in the past at validation time, the token MUST be treated as expired and invalid.
Keeping the window of validity as short as possible is RECOMMENDED. Limiting the time range can mitigate the risk of a malicious user abusing a UCAN. However, this is situationally dependent. It may be desirable to limit the frequency of forced reauthorizations for trusted devices. Due to clock drift, time bounds SHOULD NOT be considered exact. A buffer of ±60 seconds is RECOMMENDED.
Several named points of time in the UCAN lifecycle can be found in the [high level spec][UCAN].
Below are a couple examples:
```js
{
// ...
"nbf": 1529496683,
"exp": 1575606941
}
```
```js
{
// ...
"exp": 1575606941
}
```
```js
{
// ...
"nbf": 1529496683,
"exp": null
}
```
## Lifecycle Example
Here is a concrete example of all stages of the UCAN lifecycle for database write access.
```mermaid
sequenceDiagram
participant Database
actor DBAgent
actor Alice
actor Bob
Note over Database, DBAgent: Set Up Agent-Owned Resource
DBAgent ->> Database: createDB()
autonumber 1
Note over DBAgent, Bob: Delegation
DBAgent -->> Alice: delegate(DBAgent, write)
Alice -->> Bob: delegate(DBAgent, write)
Note over Database, Bob: Invocation
Bob ->> DBAgent: invoke(DBAgent, [write, [key, value]], proof: [➊,➋])
DBAgent ->> Database: write(key, value)
DBAgent ->> Bob: ACK
Note over DBAgent, Bob: Revocation
Alice ->> DBAgent: revoke(➋, proof: [➊,➋])
Bob ->> DBAgent: invoke(DBAgent, [write, [key, newValue]], proof: [➊,➋])
DBAgent -X Bob: NAK(➏) [rejected]
```
## Capability
A capability is the association of an ability to a subject: `subject x command x policy`.
The Subject and Command fields are REQUIRED. Any non-normative extensions are OPTIONAL.
For example, a capability may used to represent the ability to send email from a certain address to others at `@example.com`.
| Field | Example |
| ------- | -------------------------------------------------------------------------------------------- |
| Subject | `did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK` |
| Command | `/msg/send` |
| Policy | `["or", ["==", ".from", "mailto:me@example.com"], ["match", ".cc", "mailto:*@example.com"]]` |
For a more complete treatment, please see the [UCAN Delegation][delegation] spec.
## Authority
> Whether to enable cooperation or to limit vulnerability, we care about _authority_ rather than _permissions._ Permissions determine what actions an individual program may perform on objects it can directly access. Authority describes the effects that a program may cause on objects it can access, either directly by permission, or indirectly by permitted interactions with other programs.
>
> —[Mark Miller], [Robust Composition]
The set of capabilities delegated by a UCAN is called its "authority." To frame it another way, it's the set of effects that a principal can cause, and acts as a declarative description of delegated abilities.
Merging capability authorities MUST follow set semantics, where the result includes all capabilities from the input authorities. Since broader capabilities automatically include narrower ones, this process is always additive. Capability authorities can be combined in any order, with the result always being at least as broad as each of the original authorities.
```plaintext
┌───────────────────────┐ ┐
│ │ │
│ │ │
│ │ │
│ │ │
│ Subject B │ │
┌──────────────────┼ ─ ─ x │ │
│ │ Ability Z │ ├── BxZ
│ │ │ │ Capability
│ │ │ │
│ │ │ │
│ Subject A │ │ │
│ x │ │ │
│ Ability Y ─ ─┼──────────────────┘ ┘
│ │
│ │
│ │
│ │
│ │
└───────────────────────┘
└─────────────────────┬────────────────────┘
AxY U BxZ
Capability
```
The capability authority is the total rights of the authorization space down to the relevant volume of authorizations. Individual capabilities MAY overlap; the authority is the union. Every unique delegated capability MUST have equal or narrower capabilities from their delegator. Inside this content space, you can draw a boundary around some resource(s) (their type, identifiers, and paths or children) and their capabilities.
## Command
Commands are concrete messages ("verbs") that MUST be unambiguously interpretable by the Subject of a UCAN. Commands are REQUIRED in invocations. Some examples include `/msg/send`, `/crud/read`, and `/ucan/revoke`.
Much like other message-passing systems, the specific resource MUST define the behavior for a particular message. For instance, `/crud/update` MAY be used to destructively update a database row, or append to a append-only log. Specific messages MAY be created at will; the only restriction is that the Executor understand how to interpret that message in the context of a specific resource.
While arbitrary semantics MAY be described, they MUST apply to the target resource. For instance, it does not make sense to apply `/msg/send` to a typical file system.
### Segment Structure
Commands MUST be lowercase, and begin with a slash (`/`). Segments MUST be separated by a slash. A trailing slash MUST NOT be present. All of the following are syntactically valid Commands:
- `/`
- `/crud`
- `/crud/create`
- `/stack/pop`
- `/crypto/sign`
- `/foo/bar/baz/qux/quux`
- `/ほげ/ふが`
Segment structure is important since shorter Commands prove longer paths. For example, `/` can be used as a proof of _any_ other Command. For example, `/crypto` MAY be used to prove `/crypto/sign` but MUST NOT prove `/stack/pop` or `/cryptocurrency`.
### `/` AKA "Top"
_"Top" (`/`) is the most powerful ability, and as such it SHOULD be handled with care and used sparingly._
The "top" (or "any", or "wildcard") ability MUST be denoted `/`. This can be thought of as something akin to a super user permission in RBAC.
The wildcard ability grants access to all other capabilities for the specified resource, across all possible namespaces. The wildcard ability is useful when "linking" agents by delegating all access to another device controlled by the same user, and that should behave as the same agent. It is extremely powerful, and should be used with care. Among other things, it permits the delegate to update a Subject's mutable DID document (change their private keys), revoke UCAN delegations, and use any resources delegated to the Subject by others.
```mermaid
%%{ init: { 'flowchart': { 'curve': 'linear' } } }%%
flowchart BT
/
/msg --> /
subgraph msgGraph [ ]
/msg/send --> /msg
/msg/receive --> /msg
end
/crud --> /
subgraph crudGraph [ ]
/crud/read --> /crud
/crud/mutate --> /crud
subgraph mutationGraph [ ]
/crud/mutate/create --> /crud/mutate
/crud/mutate/update --> /crud/mutate
/crud/mutate/destroy --> /crud/mutate
end
end
... --> /
```
### Reserved Commands
#### `/ucan` Namespace
The `/ucan` Command namespace MUST be reserved. This MUST include any ability string matching the regex `^ucan\/.*`. This is important for keeping a space for community-blessed Commands in the future, such as standard library Commands, such as [Revocation].
## Attenuation
Attenuation is the process of constraining the capabilities in a delegation chain. Each direct delegation MUST either directly restate or attenuate (diminish) its capabilities.
# Token Resolution
Token resolution is transport specific. The exact format is left to the relevant UCAN transport specification. At minimum, such a specification MUST define at least the following:
1. Request protocol
2. Response protocol
3. Collections format
Note that if an instance cannot dereference a CID at runtime, the UCAN MUST fail validation. This is consistent with the [constructive semantics] of UCAN.
# Nonce
The REQUIRED nonce parameter `nonce` MAY be any value. A randomly generated string is RECOMMENDED to provide a unique UCAN, though it MAY also be a monotonically increasing count of the number of links in the hash chain. This field helps prevent replay attacks and ensures a unique CID per delegation. The `iss`, `aud`, and `exp` fields together will often ensure that UCANs are unique, but adding the nonce ensures uniqueness.
The recommended size of the nonce differs by key type. In many cases, a random 12-byte nonce is sufficient. If uncertain, check the nonce in your DID's crypto suite.
This field SHOULD NOT be used to sign arbitrary data, such as signature challenges. See the [`meta`][Metadata] field for more.
Here is a simple example.
```js
{
// ...
"nonce": {"/": {"bytes": "bGlnaHQgd29yay4"}}
}
```
# Metadata
The OPTIONAL `meta` field contains a map of arbitrary metadata, facts, and proofs of knowledge. The enclosed data MUST be self-evident and externally verifiable. It MAY include information such as hash preimages, server challenges, a Merkle proof, dictionary data, etc.
The data contained in this map MUST NOT be semantically meaningful to delegation chains.
Below is an example:
```js
{
// ...
"meta": {
"challenges": {
"example.com": "abcdef",
"another.example.net": "12345"
},
"sha3_256": {
"B94D27B9934D3E08A52E52D7DA7DABFAC484EFE37A5380EE9088F7ACE2EFCDE9": "hello world"
}
}
}
```
# Canonicalization
## Cryptosuite
Across all UCAN specifications, the following cryptosuite MUST be supported:
| Role | REQUIRED Algorithms | Notes |
| --------- | --------------------------------- | ------------------------------------ |
| Hash | [SHA-256] | |
| Signature | [Ed25519], [P-256], [`secp256k1`] | Preference of Ed25519 is RECOMMENDED |
| [DID] | [`did:key`] | |
## Encoding
All UCANs MUST be canonically encoded with [DAG-CBOR] for signing. A UCAN MAY be presented or stored in other [IPLD] formats (such as [DAG-JSON]), but converted to DAG-CBOR for signature validation.
## Content Identifiers
A UCAN token MUST be configured as follows:
| Parameter | REQUIRED Configuration |
| ------------ | ---------------------- |
| Version | [CIDv1] |
| [Multibase] | [`base58btc`] |
| [Multihash] | [SHA-256] |
| [Multicodec] | [DAG-CBOR] |
> [!NOTE]
> All CIDs encoded as above start with the characters `zdpu`.
The resolution of these addresses is left to the implementation and end-user, and MAY (non-exclusively) include the following: local store, a distributed hash table (DHT), gossip network, or RESTful service.
## Envelope
All UCAN formats MUST use the following envelope format:
| Field | Type | Description |
| --------------------------------- | -------------- | -------------------------------------------------------------- |
| `.0` | `Bytes` | A signature by the Payload's `iss` over the `SigPayload` field |
| `.1` | `SigPayload` | The content that was signed |
| `.1.h` | `VarsigHeader` | The [Varsig] v1 header |
| `.1.ucan/<subspec-tag>@<version>` | `TokenPayload` | The UCAN token payload |
```mermaid
flowchart TD
subgraph Ucan ["UCAN Envelope"]
SignatureBytes["Signature (raw bytes)"]
subgraph SigPayload ["Signature Payload"]
VarsigHeader["Varsig Header"]
subgraph UcanPayload ["Token Payload"]
fields["..."]
end
end
end
```
For example:
```js
[
{
"/": {
bytes:
"7aEDQLYvb3lygk9yvAbk0OZD0q+iF9c3+wpZC4YlFThkiNShcVriobPFr/wl3akjM18VvIv/Zw2LtA4uUmB5m8PWEAU",
},
},
{
h: { "/": { bytes: "NBIFEgEAcQ" } },
"ucan/example@1.0.0-rc.1": {
hello: "world",
},
},
];
```
### Payload
A UCAN's Payload MUST contain at least the following fields:
| Field | Type | Required | Description |
| ------- | ----------------------------------------- | -------- | ----------------------------------------------------------- |
| `iss` | `DID` | Yes | Issuer DID (sender) |
| `aud` | `DID` | Yes | Audience DID (receiver) |
| `sub` | `DID` | Yes | Principal that the chain is about (the [Subject]) |
| `cmd` | `String` | Yes | The [Command] to eventually invoke |
| `args` | `{String : Any}` | Yes | Any [Arguments] that MUST be present in the Invocation |
| `nonce` | `Bytes` | Yes | Nonce |
| `meta` | `{String : Any}` | No | [Meta] (asserted, signed data) — is not delegated authority |
| `nbf` | `Integer` (53-bits[^js-num-size]) | No | "Not before" UTC Unix Timestamp in seconds (valid from) |
| `exp` | `Integer \| Null` (53-bits[^js-num-size]) | Yes | Expiration UTC Unix Timestamp in seconds (valid until) |
# Implementation Recommendations
## Delegation Store
A validator MAY keep a local store of UCANs that it has received. UCANs are immutable but also time-bound so that this store MAY evict expired or revoked UCANs.
This store SHOULD be indexed by CID (content addressing). Multiple indices built on top of this store MAY be used to improve capability search or selection performance.
## Memoized Validation
Aside from revocation, capability validation is idempotent. Marking a CID (or capability index inside that CID) as valid acts as memoization, obviating the need to check the entire structure on every validation. This extends to distinct UCANs that share a proof: if the proof was previously reviewed and is not revoked, it is RECOMMENDED to consider it valid immediately.
Revocation is irreversible. Suppose the validator learns of revocation by UCAN CID. In that case, the UCAN and all of its derivatives in such a cache MUST be marked as invalid, and all validations immediately fail without needing to walk the entire structure.
## Replay Attack Prevention
Replay attack prevention is REQUIRED. Every UCAN token MUST hash to a unique [CIDv1]. Some simple strategies for implementing uniqueness tracking include maintaining a set of previously seen CIDs, or requiring that nonces be monotonically increasing per principal. This MAY be the same structure as a validated UCAN memoization table (if one is implemented).
Maintaining a secondary token expiry index is RECOMMENDED. This enables garbage collection and more efficient search. In cases of very large stores, normal cache performance techniques MAY be used, such as Bloom filters, multi-level caches, and so on.
## Beyond Single System Image
> As we continue to increase the number of globally connected devices, we must embrace a design that considers every single member in the system as the primary site for the data that it is generates. It is completely impractical that we can look at a single, or a small number, of globally distributed data centers as the primary site for all global information that we desire to perform computations with.
>
> —[Meiklejohn], [A Certain Tendency Of The Database Community]
Unlike many authorization systems where a service controls access to resources in their care, location-independent, offline, and leaderless resources require control to live with the user. Therefore, the same data MAY be used across many applications, data stores, and users. Since they don't have a single location, applying UCAN to [RSM]s and [CRDT]s MAY be modelled by lifting the requirement that the Executor be the Subject.
Ultimately this comes down to a question of push vs pull. In push, the subject MUST be the specific site being pushed to ("I command you to apply the following updates to your state").
Pull is the broad class of situations where an Invoker doesn't require that a particular replica apply its state. Applying a change to a local CRDT replica and maintaining a UCAN invocation log is a valid update to "the CRDT": a version of the CRDT Subject exists locally even if the Subject's private key is not present. Gossiping these changes among agents allows each to apply changes that it becomes aware of. Thanks to the invocation log (or equivalent integrated directly into the CRDT), provenance of authority is made transparent.
```mermaid
sequenceDiagram
participant CRDT as Initial Grow-Only Set (CRDT)
actor Alice
actor Bob
actor Carol
autonumber
Note over CRDT, Bob: Setup
CRDT -->> Alice: delegate(CRDT_ID, merge)
CRDT -->> Bob: delegate(CRDT_ID, merge)
Note over Bob, Carol: Bob Invites Carol
Bob -->> Carol: delegate(CRDT_ID, merge)
Note over Alice, Carol: Direct P2P Gossip
Carol ->> Bob: invoke(CRDT_ID, merge, {"Carrot"}, proof: [➋,❸])
Alice ->> Carol: invoke(CRDT_ID, merge, {"Apple"}}, proof: [➊])
Bob ->> Alice: invoke(CRDT_ID, merge, {"Banana", "Carrot"}, proof: [➋])
```
## Wrapping Existing Systems
In the RECOMMENDED scenario, the agent controlling a resource has a unique reference to it. This is always possible in a system that has adopted capabilities end-to-end.
Interacting with existing systems MAY require relying on ambient authority contained in an ACL, non-unique reference, or other authorization logic. These cases are still compatible with UCAN, but the security guarantees are weaker since 1. the surface area is larger, and 2. part of the auth system lives outside UCAN.
```mermaid
sequenceDiagram
participant Database
participant ACL as External Auth System
actor DBAgent
actor Alice
actor Bob
Note over ACL, DBAgent: Setup
DBAgent ->> ACL: signup(DBAgent)
ACL ->> ACL: register(DBAgent)
autonumber 1
Note over DBAgent, Bob: Delegation
DBAgent -->> Alice: delegate(DBAgent, write)
Alice -->> Bob: delegate(DBAgent, write)
Note over Database, Bob: Invocation
Bob ->>+ DBAgent: invoke(DBAgent, [write, key, value], proof: [➊,➋])
critical External System
DBAgent ->> ACL: getToken(write, key, AuthGrant)
ACL ->> DBAgent: AccessToken
DBAgent ->> Database: request(write, value, AccessToken)
Database ->> DBAgent: ACK
end
DBAgent ->>- Bob: ACK
```
# FAQ
## What prevents an unauthorized party from using an intercepted UCAN?
UCANs always contain information about the sender and receiver. A UCAN is signed by the sender (the `iss` field DID) and can only be created by an agent in possession of the relevant private key. The recipient (the `aud` field DID) is required to check that the field matches their DID. These two checks together secure the certificate against use by an unauthorized party. [UCAN Invocations][invocation] prevent use by an unauthorized party by signing over a request to use the capability granted in a delegation chain.
## What prevents replay attacks on the invocation use case?
All UCAN Invocations MUST have a unique CID. The executing agent MUST check this validation uniqueness against a local store of unexpired UCAN hashes.
This is not a concern when simply delegating since receiving a delegation is idempotent.
## Is UCAN secure against person-in-the-middle attacks?
_UCAN does not have any special protection against person-in-the-middle (PITM) attacks._
If a PITM attack was successfully performed on a UCAN delegation, the proof chain would contain the attacker's DID(s). It is possible to detect this scenario and revoke the relevant UCAN but this does require special inspection of the topmost `iss` field to check if it is the expected DID. Therefore, it is strongly RECOMMENDED to only delegate UCANs to agents that are both trusted and authenticated and over secure channels.
## Can my implementation support more cryptographic algorithms?
It is possible to use other algorithms, but doing so limits interoperability with the broader UCAN ecosystem. This is thus considered "off spec" (i.e. non-interoperable). If you choose to extend UCAN with additional algorithms, you MUST include this metadata in the (self-describing) [Varsig] header.
# Related Work and Prior Art
[SPKI/SDSI] is closely related to UCAN. A different encoding format is used, and some details vary (such as a delegation-locking bit), but the core idea and general usage pattern are very close. UCAN can be seen as making these ideas more palatable to a modern audience and adding a few features such as content IDs that were less widespread at the time SPKI/SDSI were written.
[ZCAP-LD] is closely related to UCAN. The primary differences are in formatting, addressing by URL instead of CID, the mechanism of separating invocation from authorization, and single versus multiple proofs.
[CACAO] is a translation of many of these ideas to a cross-blockchain delegated bearer token model. It contains the same basic concepts as UCAN delegation, but is aimed at small messages and identities that are rooted in mutable documents rooted on a blockchain and lacks the ability to subdelegate capabilities.
[Local-First Auth] is a non-certificate-based approach, instead relying on a CRDT to build up a list of group members, devices, and roles. It has a friendly invitation mechanism based on a [Seitan token exchange]. It is also straightforward to see which users have access to what, avoiding the confinement problem seen in many decentralized auth systems.
[Macaroon] is a MAC-based capability and cookie system aimed at distributing authority across services in a trusted network (typically in the context of a Cloud). By not relying on asymmetric signatures, Macaroons achieve excellent space savings and performance, given that the MAC can be checked against the relevant services during discharge. The authority is rooted in an originating server rather than with an end-user.
[Biscuit] uses Datalog to describe capabilities. It has a specialized format but is otherwise in line with UCAN.
[Verifiable credentials] are a solution for data about people or organizations. However, they are aimed at a related-but-distinct problem: asserting attributes about the holder of a DID, including things like work history, age, and membership.
# Acknowledgments
Thank you to [Brendan O'Brien] for real-world feedback, technical collaboration, and implementing the first Golang UCAN library.
Thank you [Blaine Cook] for the real-world feedback, ideas on future features, and lessons from other auth standards.
Many thanks to [Hugo Dias], [Mikael Rogers], and the entire DAG House team for the real world feedback, and finding inventive new use cases.
Thank to [Hannah Howard] and [Alan Shaw] at [Storacha] for their team's feedback from real world use cases.
Many thanks to [Brian Ginsburg] and [Steven Vandevelde] for their many copy edits, feedback from real world usage, maintenance of the TypeScript implementation, and tools such as [ucan.xyz].
Many thanks to [Christopher Joel] for his real-world feedback, raising many pragmatic considerations, and the Rust implementation and related crates.
Many thanks to [Christine Lemmer-Webber] for her handwritten(!) feedback on the design of UCAN, spearheading the [OCapN] initiative, and her related work on [ZCAP-LD].
Many thanks to [Alan Karp] for sharing his vast experience with capability-based authorization, patterns, and many right words for us to search for.
Thanks to [Benjamin Goering] for the many community threads and connections to [W3C] standards.
Thanks to [Juan Caballero] for the numerous questions, clarifications, and general advice on putting together a comprehensible spec.
Thank you [Dan Finlay] for being sufficiently passionate about [OCAP] that we realized that capability systems had a real chance of adoption in an ACL-dominated world.
Thanks to [Peter van Hardenberg][PvH] and [Martin Kleppmann] of [Ink & Switch] for conversations exploring options for access control on CRDTs and [local-first] applications.
Thanks to the entire [SPKI WG][SPKI/SDSI] for their closely related pioneering work.
We want to especially recognize [Mark Miller] for his numerous contributions to the field of distributed auth, programming languages, and networked security writ large.
<!-- Footnotes -->
[^js-num-size]: JavaScript has a single numeric type ([`Number`][JS Number]) for both integers and floats. This representation is defined as a [IEEE-754] double-precision floating point number, which has a 53-bit significand.
[^pcec]: To be precise, this is a [PC/EC][PACELC] system, which is a critical trade-off for many systems. UCAN can be used to model both PC/EC and PA/EL, but is most typically PC/EL.
<!-- Internal Links -->
[Command]: #command
[Cryptosuite]: #cryptosuite
[overcoming SSI]: #beyond-single-system-image
[sub-specifications]: #sub-specifications
[wrapping existing systems]: #wrapping-existing-systems
<!-- External Links -->
[IEEE-754]: https://ieeexplore.ieee.org/document/8766229
[A Certain Tendency Of The Database Community]: https://arxiv.org/pdf/1510.08473.pdf
[ACL]: https://en.wikipedia.org/wiki/Access-control_list
[Alan Karp]: https://github.com/alanhkarp
[Alan Kay]: https://en.wikipedia.org/wiki/Alan_Kay
[Alan Shaw]: https://github.com/alanshaw
[BCP 14]: https://www.rfc-editor.org/info/bcp14
[BLAKE3]: https://github.com/BLAKE3-team/BLAKE3
[Benjamin Goering]: https://github.com/gobengo
[Biscuit]: https://github.com/biscuit-auth/biscuit/
[Blaine Cook]: https://github.com/blaine
[Bluesky]: https://blueskyweb.xyz/
[Brendan O'Brien]: https://github.com/b5
[Brian Ginsburg]: https://github.com/bgins
[Brooklyn Zelenka]: https://github.com/expede
[CACAO]: https://blog.ceramic.network/capability-based-data-security-on-ceramic/
[CIDv1]: https://docs.ipfs.io/concepts/content-addressing/#identifier-formats
[CIDv1]: https://github.com/multiformats/cid
[CRDT]: https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type
[Capability Myths Demolished]: https://srl.cs.jhu.edu/pubs/SRL2003-02.pdf
[Christine Lemmer-Webber]: https://github.com/cwebber
[Christopher Joel]: https://github.com/cdata
[Code Mesh 2016]: https://www.codemesh.io/codemesh2016
[DAG-CBOR]: https://ipld.io/specs/codecs/dag-cbor/spec/
[DAG-JSON]: https://ipld.io/specs/codecs/dag-json/spec/
[DID fragment]: https://www.w3.org/TR/did-core/#fragment
[DID path]: https://www.w3.org/TR/did-core/#path
[DID subject]: https://www.w3.org/TR/did-core/#dfn-did-subjects
[DID]: https://www.w3.org/TR/did-core/
[Dan Finlay]: https://github.com/danfinlay
[Daniel Holmgren]: https://github.com/dholms
[ECDSA security]: https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm#Security
[Ed25519]: https://en.wikipedia.org/wiki/EdDSA#Ed25519
[EdDSA]: https://datatracker.ietf.org/doc/html/rfc8032#section-5.1
[Email about SPKI]: https://web.archive.org/web/20140724054706/http://wiki.erights.org/wiki/Capability-based_Active_Invocation_Certificates
[FIDO]: https://fidoalliance.org/what-is-fido/
[Fission]: https://fission.codes
[GUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier
[Hannah Howard]: https://github.com/hannahhoward
[Hugo Dias]: https://github.com/hugomrdias
[IPLD]: https://ipld.io/
[Ink & Switch]: https://www.inkandswitch.com/
[Inversion of control]: https://en.wikipedia.org/wiki/Inversion_of_control
[Irakli Gozalishvili]: https://github.com/Gozala
[JWT]: https://www.rfc-editor.org/rfc/rfc7519
[Joe Armstrong]: https://en.wikipedia.org/wiki/Joe_Armstrong_(programmer)
[Juan Caballero]: https://github.com/bumblefudge
[Local-First Auth]: https://github.com/local-first-web/auth
[Macaroon]: https://storage.googleapis.com/pub-tools-public-publication-data/pdf/41892.pdf
[Mark Miller]: https://github.com/erights
[Martin Kleppmann]: https://martin.kleppmann.com/
[Meiklejohn]: https://christophermeiklejohn.com/
[Mikael Rogers]: https://github.com/mikeal/
[Multibase]: https://github.com/multiformats/multibase
[Multicodec]: https://github.com/multiformats/multicodec
[Multics]: https://en.wikipedia.org/wiki/Multics
[Multihash]: https://www.multiformats.io/multihash/
[OCAP]: http://erights.org/elib/capability/index.html
[OCapN]: https://github.com/ocapn/ocapn
[P-256]: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf#page=111
[PACELC]: https://en.wikipedia.org/wiki/PACELC_theorem
[Philipp Krüger]: https://github.com/matheus23
[PoLA]: https://en.wikipedia.org/wiki/Principle_of_least_privilege
[Protocol Labs]: https://protocol.ai/
[PvH]: https://www.pvh.ca
[RBAC]: https://en.wikipedia.org/wiki/Role-based_access_control
[RFC 2119]: https://datatracker.ietf.org/doc/html/rfc2119
[RFC 3339]: https://www.rfc-editor.org/rfc/rfc3339
[RFC 8037]: https://datatracker.ietf.org/doc/html/rfc8037
[RSM]: https://en.wikipedia.org/wiki/State_machine_replication
[Robust Composition]: http://www.erights.org/talks/thesis/markm-thesis.pdf
[SHA-256]: https://en.wikipedia.org/wiki/SHA-2
[SPKI/SDSI]: https://datatracker.ietf.org/wg/spki/about/
[SPKI]: https://theworld.com/~cme/html/spki.html
[Seitan token exchange]: https://book.keybase.io/docs/teams/seitan
[Steven Vandevelde]: https://github.com/icidasset
[Storacha]: https://storacha.network/
[The Structure of Authority]: http://erights.org/talks/no-sep/secnotsep.pdf
[The computer revolution hasn't happened yet]: https://www.youtube.com/watch?v=oKg1hTOQXoY
[UCAN Promise]: https://github.com/ucan-wg/promise
[URI]: https://www.rfc-editor.org/rfc/rfc3986
[Varsig]: https://github.com/ChainAgnostic/varsig
[Verifiable credentials]: https://www.w3.org/2017/vc/WG/
[W3C]: https://www.w3.org/
[WebCrypto API]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API
[Witchcraft Software]: https://github.com/expede
[ZCAP-LD]: https://w3c-ccg.github.io/zcap-spec/
[`base58btc`]: https://github.com/multiformats/multibase/blob/master/multibase.csv#L21
[`did:key`]: https://w3c-ccg.github.io/did-method-key/
[`secp256k1`]: https://en.bitcoin.it/wiki/Secp256k1
[browser api crypto key]: https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey
[capabilities]: https://en.wikipedia.org/wiki/Object-capability_model
[caps as keys]: http://www.erights.org/elib/capability/duals/myths.html#caps-as-keys
[certificate capability model]: https://web.archive.org/web/20140724054706/http://wiki.erights.org/wiki/Capability-based_Active_Invocation_Certificates
[confinement]: http://www.erights.org/elib/capability/dist-confine.html
[confused deputy problem]: https://en.wikipedia.org/wiki/Confused_deputy_problem
[constructive semantics]: https://en.wikipedia.org/wiki/Intuitionistic_logic
[content addressable storage]: https://en.wikipedia.org/wiki/Content-addressable_storage
[content addressing]: https://en.wikipedia.org/wiki/Content-addressable_storage
[dag-json multicodec]: https://github.com/multiformats/multicodec/blob/master/table.csv#L104
[delegation]: https://github.com/ucan-wg/delegation
[fail-safe]: https://en.wikipedia.org/wiki/Fail-safe
[invocation]: https://github.com/ucan-wg/invocation
[local-first]: https://www.inkandswitch.com/local-first/
[number zero]: https://n0.computer/
[passkey]: https://www.passkeys.com/
[promise]: https://github.com/ucan-wg/promise
[raw data multicodec]: https://github.com/multiformats/multicodec/blob/a03169371c0a4aec0083febc996c38c3846a0914/table.csv?plain=1#L41
[revocation]: https://github.com/ucan-wg/revocation
[secure hardware enclave]: https://support.apple.com/en-ca/guide/security/sec59b0b31ff
[spki rfc]: https://www.rfc-editor.org/rfc/rfc2693.html
[time definition]: https://en.wikipedia.org/wiki/Temporal_database
[trustless]: https://blueskyweb.xyz/blog/3-6-2022-a-self-authenticating-social-protocol
[ucan.xyz]: https://ucan.xyz
@@ -1,105 +0,0 @@
You are an expert in Cosmos SDK data modeling and state management, specializing in building efficient and scalable data models using the Cosmos SDK ORM system with Protocol Buffers.
Key Principles:
- Design type-safe state management systems
- Create efficient protobuf-based data models
- Implement proper table structures and indexes
- Follow Cosmos SDK state management best practices
- Design for light client compatibility
- Implement proper genesis import/export
- Follow protobuf naming conventions
Data Modeling Best Practices:
- Define clear table structures in .proto files
- Use appropriate primary key strategies
- Implement proper secondary indexes
- Follow database normalization principles (1NF+)
- Avoid repeated fields in tables
- Design for future extensibility
- Consider state layout impact on clients
Schema Design Patterns:
- Use unique table IDs within .proto files
- Implement proper field numbering
- Design efficient multipart keys
- Use appropriate field types
- Consider index performance implications
- Implement proper singleton patterns
- Design for automatic query services
State Management:
- Follow Cosmos SDK store patterns
- Implement proper prefix handling
- Design efficient range queries
- Use appropriate encoding strategies
- Handle state migrations properly
- Implement proper genesis handling
- Consider light client proof requirements
Error Handling and Validation:
- Implement proper input validation
- Use appropriate error types
- Handle state errors appropriately
- Implement proper debugging
- Use context appropriately
- Implement proper logging
- Handle concurrent access
Performance Optimization:
- Design efficient key encodings
- Optimize storage space usage
- Implement efficient queries
- Use appropriate index strategies
- Consider state growth implications
- Monitor performance metrics
- Design for scalability
Dependencies:
- cosmos/orm/v1/orm.proto
- [google.golang.org/protobuf](http://google.golang.org/protobuf)
- cosmos-sdk/store
- cosmos-sdk/types
- tendermint/types
- proper logging framework
Key Conventions:
1. Use consistent protobuf naming
2. Implement proper documentation
3. Follow schema versioning practices
4. Use proper table ID management
5. Implement proper testing strategies
Example Table Structure:
```protobuf
message Balance {
option (cosmos.orm.v1.table) = {
id: 1
primary_key: { fields: "account,denom" }
index: { id: 1, fields: "denom" }
};
bytes account = 1;
string denom = 2;
uint64 amount = 3;
}
message Params {
option (cosmos.orm.v1.singleton) = {
id: 2
};
google.protobuf.Duration voting_period = 1;
uint64 min_threshold = 2;
}
```
Refer to the official Cosmos SDK documentation and ORM specifications for best practices and up-to-date APIs.
-88
View File
@@ -1,88 +0,0 @@
You are an expert in Go data modeling and PostgreSQL database design, specializing in building efficient and scalable data models using modern ORMs like GORM and SQLBoiler.
Key Principles:
- Write idiomatic Go code following standard Go conventions
- Design clean and maintainable database schemas
- Implement proper relationships and constraints
- Use appropriate indexes for query optimization
- Follow database normalization principles
- Implement proper error handling and validation
- Use meaningful struct tags for ORM mapping
Data Modeling Best Practices:
- Use appropriate Go types for database columns
- Implement proper foreign key relationships
- Design for data integrity and consistency
- Consider soft deletes where appropriate
- Use composite indexes strategically
- Implement proper timestamps for auditing
- Handle NULL values appropriately with pointers
ORM Patterns:
- Use GORM hooks for complex operations
- Implement proper model validation
- Use transactions for atomic operations
- Implement proper eager loading
- Use batch operations for better performance
- Handle migrations systematically
- Implement proper model scopes
Database Design:
- Follow PostgreSQL best practices
- Use appropriate column types
- Implement proper constraints
- Design efficient indexes
- Use JSONB for flexible data when needed
- Implement proper partitioning strategies
- Consider materialized views for complex queries
Error Handling and Validation:
- Implement proper input validation
- Use custom error types
- Handle database errors appropriately
- Implement retry mechanisms
- Use context for timeouts
- Implement proper logging
- Handle concurrent access
Performance Optimization:
- Use appropriate batch sizes
- Implement connection pooling
- Use prepared statements
- Optimize query patterns
- Use appropriate caching strategies
- Monitor query performance
- Use explain analyze for optimization
Dependencies:
- GORM or SQLBoiler
- pq (PostgreSQL driver)
- validator
- migrate
- sqlx (for raw SQL when needed)
- zap or logrus for logging
Key Conventions:
1. Use consistent naming conventions
2. Implement proper documentation
3. Follow database migration best practices
4. Use version control for schema changes
5. Implement proper testing strategies
Example Model Structure:
```go
type User struct {
ID uint `gorm:"primarykey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
Name string `gorm:"type:varchar(100);not null"`
Email string `gorm:"type:varchar(100);uniqueIndex;not null"`
Profile Profile
Orders []Order
}
```
Refer to the official documentation of GORM, PostgreSQL, and Go for best practices and up-to-date APIs.
-132
View File
@@ -1,132 +0,0 @@
You are a technical lead specializing in decentralized identity systems and security architecture, with expertise in W3C standards, Cosmos SDK, and blockchain security patterns.
Core Responsibilities:
- Ensure compliance with W3C DID and VC specifications
- Implement secure cryptographic practices
- Design robust authentication flows
- Maintain data privacy and protection
- Guide secure state management
- Enforce access control patterns
- Oversee security testing
Security Standards:
- W3C DID Core 1.0
- W3C Verifiable Credentials
- W3C WebAuthn Level 2
- OAuth 2.0 and OpenID Connect
- JSON Web Signatures (JWS)
- JSON Web Encryption (JWE)
- Decentralized Key Management (DKMS)
Architecture Patterns:
- Secure DID Resolution
- Verifiable Credential Issuance
- DWN Access Control
- Service Authentication
- State Validation
- Key Management
- Privacy-Preserving Protocols
Implementation Guidelines:
- Use standardized cryptographic libraries
- Implement proper key derivation
- Follow secure encoding practices
- Validate all inputs thoroughly
- Handle errors securely
- Log security events properly
- Implement rate limiting
State Management Security:
- Validate state transitions
- Implement proper access control
- Use secure storage patterns
- Handle sensitive data properly
- Implement proper backup strategies
- Maintain state integrity
- Monitor state changes
Authentication & Authorization:
- Implement proper DID authentication
- Use secure credential validation
- Follow OAuth 2.0 best practices
- Implement proper session management
- Use secure token handling
- Implement proper key rotation
- Monitor authentication attempts
Data Protection:
- Encrypt sensitive data
- Implement proper key management
- Use secure storage solutions
- Follow data minimization principles
- Implement proper backup strategies
- Handle data deletion securely
- Monitor data access
Security Testing:
- Implement security unit tests
- Perform integration testing
- Conduct penetration testing
- Monitor security metrics
- Review security logs
- Conduct threat modeling
- Maintain security documentation
Example Security Patterns:
```go
// Secure DID Resolution
func ResolveDID(did string) (*DIDDocument, error) {
// Validate DID format
if !ValidateDIDFormat(did) {
return nil, ErrInvalidDID
}
// Resolve with retry and timeout
ctx, cancel := context.WithTimeout(context.Background(), resolveTimeout)
defer cancel()
doc, err := resolver.ResolveWithContext(ctx, did)
if err != nil {
return nil, fmt.Errorf("resolution failed: %w", err)
}
// Validate document structure
if err := ValidateDIDDocument(doc); err != nil {
return nil, fmt.Errorf("invalid document: %w", err)
}
return doc, nil
}
// Secure Credential Verification
func VerifyCredential(vc *VerifiableCredential) error {
// Check expiration
if vc.IsExpired() {
return ErrCredentialExpired
}
// Verify proof
if err := vc.VerifyProof(trustRegistry); err != nil {
return fmt.Errorf("invalid proof: %w", err)
}
// Verify status
if err := vc.CheckRevocationStatus(); err != nil {
return fmt.Errorf("revocation check failed: %w", err)
}
return nil
}
```
Security Checklist:
1. All DIDs follow W3C specification
2. Credentials implement proper proofs
3. Keys use proper derivation/rotation
4. State changes are validated
5. Access control is enforced
6. Data is properly encrypted
7. Logging captures security events
Refer to W3C specifications, Cosmos SDK security documentation, and blockchain security best practices for detailed implementation guidance.
Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

+100 -8
View File
@@ -1,11 +1,103 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
# Go modules
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "weekly"
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- go
commit-message:
prefix: chore
include: scope
# Go modules in subdirectories
- package-ecosystem: gomod
directory: "/cmd/hway"
schedule:
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- hway
commit-message:
prefix: "chore(hway)"
- package-ecosystem: gomod
directory: "/cmd/motr"
schedule:
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- motr
commit-message:
prefix: "chore(motr)"
- package-ecosystem: gomod
directory: "/cmd/vault"
schedule:
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- vault
commit-message:
prefix: "chore(vault)"
- package-ecosystem: gomod
directory: "/client"
schedule:
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- client
commit-message:
prefix: "chore(client)"
- package-ecosystem: gomod
directory: "/crypto"
schedule:
interval: weekly
day: monday
time: "02:00"
labels:
- dependencies
- crypto
commit-message:
prefix: "chore(crypto)"
# JavaScript/TypeScript packages
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
day: monday
time: "03:00"
labels:
- dependencies
- javascript
commit-message:
prefix: chore
include: scope
# GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: monday
time: "04:00"
labels:
- dependencies
- ci
commit-message:
prefix: "chore(ci)"
+583
View File
@@ -0,0 +1,583 @@
default-api: groq
default-model: qwen3
format-text:
markdown: "Format the response as markdown without enclosing backticks."
json: "Format the response as json without enclosing backticks."
mcp-servers:
github:
command: docker
args:
- run
- "-i"
- "--rm"
- "-e"
- GITHUB_PERSONAL_ACCESS_TOKEN
- "ghcr.io/github/github-mcp-server"
ref:
command: npx
args:
- ref-tools-mcp@latest
mcp-timeout: 15s
roles:
"default": []
"pr-writer":
- You are a PR description writer
- Create clear, structured PR descriptions
- Include all relevant context from commits and changes
- Format using markdown with proper sections
- Reference issues and milestones appropriately
- Be concise but comprehensive
- Include a testing checklist if relevant
"commit-writer":
- You are a conventional commit message generator following commitizen format
- Analyze the provided git diff and scope information to create a proper commit
- Use the format type(scope) description
- Valid types feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
- The scope should be one of the affected scopes provided
- Description should be concise, present tense, no period at the end
- If there are breaking changes, add BREAKING CHANGE in the footer
- Focus on WHAT changed and WHY, not HOW (the diff shows how)
- Group related changes logically
- Maximum 72 characters for the header line
- Output ONLY the commit message, no explanations
"commit-analyzer":
- Analyze git diffs to determine the primary type of change
- Identify if changes are features, fixes, refactoring, etc
- Summarize the key changes in a structured format
- Output a JSON object with type, scope, description, and body fields
"branch-namer":
- you are a branch namer
- you do not explain anything
- you read the provided issue and body then create a title for the branch
- you do not provide any explanation whatsoever, ONLY the title
- titles must be no more than 3 words (example = feature/add-new-feature)
- ONLY use the following format - feat/<feature-name>
"issue-creator":
- you are an advanced issue creator for github in the sonr-io org
- you are provided an input in the format of - <repo-name>:<issue-context>
- you do not explain anything
- you read the short provided context for a new issue and then create an appropriate issue body
- ALWAYS find relevant context by using the `mcp::ref::ref_search_documentation` tool
- ALWAYS link relevant issues by using the `mcp::github::search_issues` tool
- ALWAYS create a new issue in the sonr-io/<repo-name> repo
- ALWAYS assign the issue to @prnk28
- |
ONLY use the following format as this example:
Title: Implement x/dwn vaults plugin
Labels: x/dwn, feature
## Requirements
- Must include DWN Bytes in Protobuf
- Must Spawn DWN Plugins using Genesis Params
- Must have Gas Free Query Methods for Spawn and Verify
## Context
### Affected Files
- @x/dwn/keeper/keeper.go
- @x/dwn/client/wasm/main.go
- @x/dwn/types/genesis.go
### Relevant Documentation
- [Example Doc 1](https://example.com)
- [Example Doc 2](https://example.com)
## Acceptance Criteria
- [ ] Tests for Spawning Plugins from the x/dwn Genesis
- [ ] Tests for Resolving Vault Secret Data from IPFS
- [ ] Test for full-round Sign/Verify/Refresh on-chain
- [ ] Grpc Gateway Compatibility for HTTP Requests
- ALWAYS create issues using the `mcp::github::create_issue` tool
- ALWAYS return the issue number after creating a new issue
format: false
role: "branch-namer"
raw: true
quiet: true
temp: 1.0
topp: 1.0
topk: 50
no-limit: true
word-wrap: 80
include-prompt-args: false
include-prompt: 0
max-retries: 5
fanciness: 10
status-text: Generating
theme: base16
max-input-chars: 12250
max-completion-tokens: 100
apis:
openai:
base-url: https://api.openai.com/v1
api-key:
api-key-env: OPENAI_API_KEY
# api-key-cmd: rbw get -f OPENAI_API_KEY chat.openai.com
models: # https://platform.openai.com/docs/models
gpt-4.5-preview: #128k https://platform.openai.com/docs/models/gpt-4.5-preview
aliases: ["gpt-4.5", "gpt4.5"]
max-input-chars: 392000
fallback: gpt-4
gpt-4.5-preview-2025-02-27:
max-input-chars: 392000
fallback: gpt-4
gpt-4o-mini:
aliases: ["4o-mini"]
max-input-chars: 392000
fallback: gpt-4o
gpt-4o:
aliases: ["4o"]
max-input-chars: 392000
fallback: gpt-4
gpt-4:
aliases: ["4"]
max-input-chars: 24500
fallback: gpt-3.5-turbo
gpt-4-1106-preview:
aliases: ["128k"]
max-input-chars: 392000
fallback: gpt-4
gpt-4-32k:
aliases: ["32k"]
max-input-chars: 98000
fallback: gpt-4
gpt-3.5-turbo:
aliases: ["35t"]
max-input-chars: 12250
fallback: gpt-3.5
gpt-3.5-turbo-1106:
aliases: ["35t-1106"]
max-input-chars: 12250
fallback: gpt-3.5-turbo
gpt-3.5-turbo-16k:
aliases: ["35t16k"]
max-input-chars: 44500
fallback: gpt-3.5
gpt-3.5:
aliases: ["35"]
max-input-chars: 12250
fallback:
o1:
aliases: ["o1"]
max-input-chars: 200000
o1-preview:
aliases: ["o1-preview"]
max-input-chars: 128000
o1-mini:
aliases: ["o1-mini"]
max-input-chars: 128000
o3-mini:
aliases: ["o3m", "o3-mini"]
max-input-chars: 200000
copilot:
base-url: https://api.githubcopilot.com
models:
gpt-4o-2024-05-13:
aliases: ["4o-2024", "4o", "gpt-4o"]
max-input-chars: 392000
gpt-4:
aliases: ["4"]
max-input-chars: 24500
gpt-3.5-turbo:
aliases: ["35t"]
max-input-chars: 12250
o1-preview-2024-09-12:
aliases: ["o1-preview", "o1p"]
max-input-chars: 128000
claude-3.5-sonnet:
aliases: ["claude3.5-sonnet", "sonnet-3.5", "claude-3-5-sonnet"]
max-input-chars: 680000
o1-preview:
aliases: ["o1-preview"]
max-input-chars: 128000
o1-mini:
aliases: ["o1-mini", "o1m", "o1-mini-2024-09-12"]
max-input-chars: 128000
o3-mini:
aliases: ["o3m", "o3-mini"]
max-input-chars: 128000
gemini-2.0-flash-001:
aliases: ["gm2f", "flash-2", "gemini-2-flash"]
max-input-chars: 4194304
anthropic:
base-url: https://api.anthropic.com/v1
api-key:
api-key-env: ANTHROPIC_API_KEY
models: # https://docs.anthropic.com/en/docs/about-claude/models
claude-sonnet-4-20250514:
aliases: ["claude-sonnet-4", "sonnet-4"]
max-input-chars: 680000
claude-3-7-sonnet-latest:
aliases: ["claude3.7-sonnet", "claude-3-7-sonnet", "sonnet-3.7"]
max-input-chars: 680000
claude-3-7-sonnet-20250219:
max-input-chars: 680000
claude-3-5-sonnet-latest:
aliases: ["claude3.5-sonnet", "claude-3-5-sonnet", "sonnet-3.5"]
max-input-chars: 680000
claude-3-5-sonnet-20241022:
max-input-chars: 680000
claude-3-5-sonnet-20240620:
max-input-chars: 680000
claude-3-opus-20240229:
aliases: ["claude3-opus", "opus"]
max-input-chars: 680000
cohere:
base-url: https://api.cohere.com/v1
models:
command-r-plus:
max-input-chars: 128000
command-r:
max-input-chars: 128000
google:
models: # https://ai.google.dev/gemini-api/docs/models/gemini
gemini-1.5-pro-latest:
aliases: ["gmp", "gemini", "gemini-1.5-pro"]
max-input-chars: 392000
gemini-1.5-flash-latest:
aliases: ["gmf", "flash", "gemini-1.5-flash"]
max-input-chars: 392000
gemini-2.0-flash-001:
aliases: ["gm2f", "flash-2", "gemini-2-flash"]
max-input-chars: 4194304
gemini-2.0-flash-lite:
aliases: ["gm2fl", "flash-2-lite", "gemini-2-flash-lite"]
max-input-chars: 4194304
ollama:
base-url: http://localhost:11434
models: # https://ollama.com/library
"llama3.2:3b":
aliases: ["llama3.2"]
max-input-chars: 650000
"llama3.2:1b":
aliases: ["llama3.2_1b"]
max-input-chars: 650000
"llama3:70b":
aliases: ["llama3"]
max-input-chars: 650000
perplexity:
base-url: https://api.perplexity.ai
api-key:
api-key-env: PERPLEXITY_API_KEY
models: # https://docs.perplexity.ai/guides/model-cards
llama-3.1-sonar-small-128k-online:
aliases: ["llam31-small"]
max-input-chars: 127072
llama-3.1-sonar-large-128k-online:
aliases: ["llam31-large"]
max-input-chars: 127072
llama-3.1-sonar-huge-128k-online:
aliases: ["llam31-huge"]
max-input-chars: 127072
groq:
base-url: https://api.groq.com/openai/v1
api-key:
api-key-env: GROQ_API_KEY
models: # https://console.groq.com/docs/models
# Production models
gemma2-9b-it:
aliases: ["gemma2", "gemma"]
max-input-chars: 24500 # 8,192
llama-3.3-70b-versatile:
aliases: ["llama3.3", "llama3.3-70b", "llama3.3-versatile"]
max-input-chars: 392000 # 128K
max-completion-tokens: 98000 # 32,768
llama-3.1-8b-instant:
aliases: ["llama3.1-8b", "llama3.1-instant"]
max-input-chars: 392000 # 128K
max-completion-tokens: 24500 # 8,192
llama-guard-3-8b:
aliases: ["llama-guard"]
max-input-chars: 24500 # 8,192
llama3-70b-8192:
aliases: ["llama3", "llama3-70b"]
max-input-chars: 24500 # 8,192
fallback: llama3-8b-8192
llama3-8b-8192:
aliases: ["llama3-8b"]
max-input-chars: 24500 # 8,192
mixtral-8x7b-32768:
aliases: ["mixtral"]
max-input-chars: 98000 # 32,768
meta-llama/llama-4-scout-17b-16e-instruct:
aliases: ["llama4-scout"]
max-input-chars: 392000 # 128K
meta-llama/llama-4-maverick-17b-128e-instruct:
aliases: ["llama4", "llama4-maverick"]
max-input-chars: 392000 # 128K
# Preview models
mistral-saba-24b:
aliases: ["saba", "mistral-saba", "saba-24b"]
max-input-chars: 98000 # 32K
qwen-2.5-coder-32b:
aliases: ["qwen-coder", "qwen2.5-coder", "qwen-2.5-coder"]
max-input-chars: 392000 # 128K
qwen/qwen3-32b:
aliases: ["qwen3", "qwen3-32b"]
max-input-chars: 392000 # 128K
deepseek-r1-distill-qwen-32b:
aliases: ["deepseek-r1", "r1-qwen", "deepseek-qwen"]
max-input-chars: 392000 # 128K
max-completion-tokens: 49152 # 16,384
deepseek-r1-distill-llama-70b-specdec:
aliases: ["deepseek-r1-specdec", "r1-llama-specdec"]
max-input-chars: 392000 # 128K
max-completion-tokens: 49152 # 16,384
deepseek-r1-distill-llama-70b:
aliases: ["deepseek-r1-llama", "r1-llama"]
max-input-chars: 392000 # 128K
llama-3.3-70b-specdec:
aliases: ["llama3.3-specdec"]
max-input-chars: 24500 # 8,192
llama-3.2-1b-preview:
aliases: ["llama3.2-1b"]
max-input-chars: 392000 # 128K
max-completion-tokens: 24500 # 8,192
llama-3.2-3b-preview:
aliases: ["llama3.2-3b"]
max-input-chars: 392000 # 128K
max-completion-tokens: 24500 # 8,192
llama-3.2-11b-vision-preview:
aliases: ["llama3.2-vision", "llama3.2-11b-vision"]
max-input-chars: 392000 # 128K
max-completion-tokens: 24500 # 8,192
llama-3.2-90b-vision-preview:
aliases: ["llama3.2-90b-vision"]
max-input-chars: 392000 # 128K
max-completion-tokens: 24500 # 8,192
cerebras:
base-url: https://api.cerebras.ai/v1
api-key:
api-key-env: CEREBRAS_API_KEY
models: # https://inference-docs.cerebras.ai/introduction
llama3.1-8b:
aliases: ["llama3.1-8b-cerebras"]
max-input-chars: 24500
llama3.1-70b:
aliases: ["llama3.1-cerebras", "llama3.1-70b-cerebras"]
max-input-chars: 24500
sambanova:
base-url: https://api.sambanova.ai/v1
api-key:
api-key-env: SAMBANOVA_API_KEY
models: # https://docs.sambanova.ai/cloud/docs/get-started/supported-models
# Preview models
DeepSeek-R1:
aliases: ["deepseek-r1-sambanova", "deepseek-r1-preview"]
max-input-chars: 24500 # 8k tokens
# Production models
DeepSeek-R1-Distill-Llama-70B:
aliases: ["deepseek-r1-llama-sambanova", "deepseek-r1-distill"]
max-input-chars: 98000 # 32k tokens
Llama-3.1-Tulu-3-405B:
aliases: ["llama3.1-tulu", "tulu-405b"]
max-input-chars: 49000 # 16k tokens
Meta-Llama-3.3-70B-Instruct:
aliases: ["llama3.3-sambanova", "llama3.3-70b-sambanova"]
max-input-chars: 392000 # 128k tokens
Meta-Llama-3.2-3B-Instruct:
aliases: ["llama3.2-3b-sambanova"]
max-input-chars: 24500 # 8k tokens
Meta-Llama-3.2-1B-Instruct:
aliases: ["llama3.2-1b-sambanova"]
max-input-chars: 49000 # 16k tokens
Meta-Llama-3.1-405B-Instruct:
aliases: ["llama3.1-405b-sambanova"]
max-input-chars: 49000 # 16k tokens
Meta-Llama-3.1-70B-Instruct:
aliases: ["llama3.1-70b-sambanova"]
max-input-chars: 392000 # 128k tokens
Meta-Llama-3.1-8B-Instruct:
aliases: ["llama3.1-8b-sambanova"]
max-input-chars: 49000 # 16k tokens
Meta-Llama-Guard-3-8B:
aliases: ["llama-guard-sambanova"]
max-input-chars: 24500 # 8k tokens
Llama-3.2-90B-Vision-Instruct:
aliases: ["llama3.2-vision-90b", "llama3.2-90b-vision-sambanova"]
max-input-chars: 12250 # 4k tokens
Llama-3.2-11B-Vision-Instruct:
aliases: ["llama3.2-vision-11b", "llama3.2-11b-vision-sambanova"]
max-input-chars: 12250 # 4k tokens
Qwen2.5-72B-Instruct:
aliases: ["qwen2.5-sambanova", "qwen2.5-72b"]
max-input-chars: 49000 # 16k tokens
Qwen2.5-Coder-32B-Instruct:
aliases: ["qwen2.5-coder-sambanova", "qwen-coder-sambanova"]
max-input-chars: 49000 # 16k tokens
QwQ-32B-Preview:
aliases: ["qwq-sambanova", "qwq-32b"]
max-input-chars: 49000 # 16k tokens
localai:
# LocalAI setup instructions: https://github.com/go-skynet/LocalAI#example-use-gpt4all-j-model
base-url: http://localhost:8080
models:
ggml-gpt4all-j:
aliases: ["local", "4all"]
max-input-chars: 12250
fallback:
azure:
# Set to 'azure-ad' to use Active Directory
# Azure OpenAI setup: https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/create-resource
base-url: https://YOUR_RESOURCE_NAME.openai.azure.com
api-key:
api-key-env: AZURE_OPENAI_KEY
models:
gpt-4:
aliases: ["az4"]
max-input-chars: 24500
fallback: gpt-35-turbo
gpt-35-turbo:
aliases: ["az35t"]
max-input-chars: 12250
fallback: gpt-35
gpt-35:
aliases: ["az35"]
max-input-chars: 12250
fallback:
o1-preview:
aliases: ["o1-preview"]
max-input-chars: 128000
o1-mini:
aliases: ["o1-mini"]
max-input-chars: 128000
runpod:
# https://docs.runpod.io/serverless/workers/vllm/openai-compatibility
base-url: https://api.runpod.ai/v2/${YOUR_ENDPOINT}/openai/v1
api-key:
api-key-env: RUNPOD_API_KEY
models:
openchat/openchat-3.5-1210:
aliases: ["openchat"]
max-input-chars: 8192
mistral:
base-url: https://api.mistral.ai/v1
api-key:
api-key-env: MISTRAL_API_KEY
models: # https://docs.mistral.ai/getting-started/models/
mistral-large-latest:
aliases: ["mistral-large"]
max-input-chars: 384000
open-mistral-nemo:
aliases: ["mistral-nemo"]
max-input-chars: 384000
deepseek:
base-url: https://api.deepseek.com/
api-key:
api-key-env: DEEPSEEK_API_KEY
models:
deepseek-chat:
aliases: ["chat"]
max-input-chars: 384000
deepseek-reasoner:
aliases: ["r1"]
max-input-chars: 384000
github-models:
base-url: https://models.github.ai/inference
api-key:
api-key-env: GITHUB_PERSONAL_ACCESS_TOKEN
models:
openai/gpt-4.1:
max-input-chars: 392000
openai/o3-mini:
max-input-chars: 392000
openai/o4-mini:
max-input-chars: 392000
openai/text-embedding-3-large:
max-input-chars: 392000
openai/text-embedding-3-small:
max-input-chars: 392000
ai21-labs/AI21-Jamba-1.5-Large:
max-input-chars: 392000
ai21-labs/AI21-Jamba-1.5-Mini:
max-input-chars: 392000
cohere/cohere-command-a:
max-input-chars: 392000
cohere/Cohere-command-r:
max-input-chars: 392000
cohere/Cohere-command-r-08-2024:
max-input-chars: 392000
cohere/Cohere-command-r-plus:
max-input-chars: 392000
cohere/Cohere-command-r-plus-08-2024:
max-input-chars: 392000
cohere/Cohere-embed-v3-english:
max-input-chars: 392000
cohere/Cohere-embed-v3-multilingual:
max-input-chars: 392000
core42/jais-30b-chat:
max-input-chars: 392000
deepseek/DeepSeek-R1:
max-input-chars: 392000
deepseek/DeepSeek-V3-0324:
max-input-chars: 392000
meta/Llama-3.2-11B-Vision-Instruct:
max-input-chars: 392000
meta/Llama-3.2-90B-Vision-Instruct:
max-input-chars: 392000
meta/Llama-3.3-70B-Instruct:
max-input-chars: 392000
meta/Llama-4-Maverick-17B-128E-Instruct-FP8:
max-input-chars: 392000
meta/Llama-4-Scout-17B-16E-Instruct:
max-input-chars: 392000
meta/Meta-Llama-3.1-405B-Instruct:
max-input-chars: 392000
meta/Meta-Llama-3.1-70B-Instruct:
max-input-chars: 392000
meta/Meta-Llama-3.1-8B-Instruct:
max-input-chars: 392000
meta/Meta-Llama-3-70B-Instruct:
max-input-chars: 392000
meta/Meta-Llama-3-8B-Instruct:
max-input-chars: 392000
mistral-ai/Codestral-2501:
max-input-chars: 392000
mistral-ai/Ministral-3B:
max-input-chars: 392000
mistral-ai/Mistral-Large-2411:
max-input-chars: 392000
mistral-ai/mistral-medium-2505:
max-input-chars: 392000
mistral-ai/Mistral-Nemo:
max-input-chars: 392000
mistral-ai/mistral-small-2503:
max-input-chars: 392000
xai/grok-3:
max-input-chars: 392000
xai/grok-3-mini:
max-input-chars: 392000
microsoft/MAI-DS-R1:
max-input-chars: 392000
microsoft/Phi-3.5-mini-instruct:
max-input-chars: 392000
microsoft/Phi-3.5-MoE-instruct:
max-input-chars: 392000
microsoft/Phi-3.5-vision-instruct:
max-input-chars: 392000
microsoft/Phi-3-medium-128k-instruct:
max-input-chars: 392000
microsoft/Phi-3-medium-4k-instruct:
max-input-chars: 392000
microsoft/Phi-3-mini-128k-instruct:
max-input-chars: 392000
microsoft/Phi-3-mini-4k-instruct:
max-input-chars: 392000
microsoft/Phi-3-small-128k-instruct:
max-input-chars: 392000
microsoft/Phi-3-small-8k-instruct:
max-input-chars: 392000
microsoft/Phi-4:
max-input-chars: 392000
microsoft/Phi-4-mini-instruct:
max-input-chars: 392000
microsoft/Phi-4-mini-reasoning:
max-input-chars: 392000
microsoft/Phi-4-multimodal-instruct:
max-input-chars: 392000
microsoft/Phi-4-reasoning:
max-input-chars: 392000
-5
View File
@@ -1,5 +0,0 @@
"@pr/feature": ["feature/*", "feat/*"]
"@pr/fix": fix/*
"@pr/chore": chore/*
"@pr/docs": docs/*
"@pr/refactor": refactor/*
-427
View File
@@ -1,427 +0,0 @@
[
{
"name": "app/cosmos-sdk",
"path": "app",
"docs": [
{
"keywords": [
"module",
"cosmos"
],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
},
{
"keywords": [
"protobuf",
"cosmos"
],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
},
{
"keywords": [
"rpc",
"protobuf",
"service",
"cosmos"
],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
},
{
"keywords": [
"protobuf",
"rpc",
"cosmos",
"query"
],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
},
{
"keywords": [
"cosmos",
"depinject",
"sdk"
],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
}
]
},
{
"name": "app/ibc",
"path": "app",
"docs": [
{
"keywords": [
"cosmos",
"interchain",
"accounts"
],
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
},
{
"keywords": [],
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
},
{
"keywords": [],
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
},
{
"keywords": [],
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
},
{
"keywords": [
"usdc",
"mint",
"cosmos",
"noble"
],
"url": "https://docs.noble.xyz/cctp/mint"
},
{
"keywords": [
"usdc"
],
"url": "https://docs.noble.xyz/cctp/mint_forward"
},
{
"keywords": [],
"url": "https://docs.evmos.org/protocol/modules/erc20"
},
{
"keywords": [],
"url": "https://docs.nomic.io/nbtc"
}
]
},
{
"name": "crypto/mpc",
"path": "crypto/mpc",
"docs": [
{
"keywords": [
"mpc",
"wallet",
"security",
"advanced cryptography"
],
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
}
]
},
{
"name": "crypto/ucan",
"path": "crypto/ucan",
"docs": [
{
"keywords": [],
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
}
]
},
{
"name": "crypto/zkp",
"path": "crypto/accumulator",
"docs": [
{
"keywords": [],
"url": "https://eprint.iacr.org/2021/1672.pdf"
}
]
},
{
"name": "gateway/handlers",
"path": "pkg/gateway/handlers",
"docs": [
{
"keywords": [],
"url": "https://echo.labstack.com/docs/cookbook/sse"
},
{
"keywords": [],
"url": "https://echo.labstack.com/docs/cookbook/websocket"
},
{
"keywords": [],
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
}
]
},
{
"name": "gateway/database",
"path": "pkg/gateway/internal/database",
"docs": [
{
"keywords": [],
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
},
{
"keywords": [],
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
},
{
"keywords": [],
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
},
{
"keywords": [
"currency"
],
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
},
{
"keywords": [
"balance"
],
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
},
{
"keywords": [],
"url": "https://docs.tigerbeetle.com/reference/account"
},
{
"keywords": [],
"url": "https://docs.tigerbeetle.com/reference/transfer"
},
{
"keywords": [],
"url": "https://docs.substreams.dev/documentation/consume/packages"
},
{
"keywords": [],
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
},
{
"keywords": [],
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
}
]
},
{
"name": "vault/handlers",
"path": "pkg/vault/handlers",
"docs": [
{
"keywords": [],
"url": "https://echo.labstack.com/docs/cookbook/jwt"
},
{
"keywords": [],
"url": "https://echo.labstack.com/docs/middleware/secure"
},
{
"keywords": [],
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
}
]
},
{
"name": "vault/database",
"path": "pkg/vault/internal/database",
"docs": [
"https://dexie.org/docs/ExportImport/dexie-export-import",
"https://dexie.org/docs/API-Reference#quick-reference",
"https://templ.guide/syntax-and-usage/script-templates"
]
},
{
"name": "pkl/ipfs",
"path": "pkl/ipfs.net",
"docs": [
{
"keywords": [],
"url": "https://github.com/ipfs/kubo/blob/master/docs/config.md"
},
{
"keywords": [],
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
}
]
},
{
"name": "pkl/matrix",
"path": "pkl/matrix.net",
"docs": [
{
"keywords": [],
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
},
{
"keywords": [],
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
}
]
},
{
"name": "pkl/chain",
"path": "pkl/sonr.chain",
"docs": [
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/5-network.html",
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/4-genesis.html",
"https://pkl-lang.org/main/current/language-reference/index.html",
"https://docs.cosmos.network/v0.50/user/run-node/run-testnet"
]
},
{
"name": "pkl/hway",
"path": "pkl/sonr.hway",
"docs": [
{
"keywords": [],
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
}
]
},
{
"name": "pkl/motr",
"path": "pkl/sonr.motr",
"docs": [
{
"keywords": [],
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
},
{
"keywords": [],
"url": "https://web.dev/learn/pwa/service-workers/"
},
{
"keywords": [],
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
}
]
},
{
"name": "x/did",
"path": "proto/did",
"docs": [
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
}
]
},
{
"name": "x/dwn",
"path": "proto/dwn",
"docs": [
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
}
]
},
{
"name": "x/svc",
"path": "proto/svc",
"docs": [
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
}
]
},
{
"name": "repo/ci-cd",
"path": "deploy",
"docs": [
{
"keywords": [],
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
},
{
"keywords": [],
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
},
{
"keywords": [],
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
},
{
"keywords": [],
"url": "https://docs.nomic.io/network/ibc-relayer"
},
{
"keywords": [],
"url": "https://www.jetify.com/docs/devbox"
},
{
"keywords": [],
"url": "https://taskfile.dev/reference/cli"
},
{
"keywords": [],
"url": "https://taskfile.dev/reference/schema"
},
{
"keywords": [],
"url": "https://taskfile.dev/reference/templating/"
}
]
},
{
"name": "repo/docs",
"path": "docs",
"docs": [
{
"keywords": [],
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
},
{
"keywords": [],
"url": "https://github.com/mkdocs/catalog/blob/main/README.md"
}
]
}
]
+73
View File
@@ -0,0 +1,73 @@
- name: client
include:
- client/**
- name: snrd
include:
- cmd/snrd/**
- app/**
- go.mod
- go.sum
- name: crypto
include:
- crypto/**
- name: devops
include:
- .github/**
- .devcontainer/**
- scripts/**
- etc/**
- Dockerfile
- "*-compose.yml"
- README.md
- name: docs
include:
- docs/**
- name: hway
include:
- cmd/hway/**
- bridge/**
- types/**
- name: dex
include:
- proto/dex/**
- x/dex/**
- name: did
include:
- proto/dex/**
- x/did/**
- name: dwn
include:
- proto/dex/**
- x/dwn/**
- name: svc
include:
- proto/dex/**
- x/svc/**
- name: motr
include:
- cmd/motr/**
- name: vault
include:
- cmd/vault/**
- name: com
include:
- packages/com/**
- name: es
include:
- packages/es/**
- name: pkl
include:
- packages/pkl/**
- name: sdk
include:
- packages/sdk/**
- name: ui
include:
- packages/ui/**
- name: auth
include:
- web/auth/**
- name: dash
include:
- web/dash/**
-63
View File
@@ -1,63 +0,0 @@
#!/bin/bash
set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
# Extract scope name and path using jq, and pass it to fzf for selection
SCOPE=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r '.[] | "\(.name)"' | fzf --prompt "Select scope:")
DOCS=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r ".[] | select(.name == \"$SCOPE\") | .docs[].url")
# Write Title
TITLE=$(gum input --placeholder "Issue Title...")
# Write Goal
GOAL=$(mods --role "determine-issue-goal" "$SCOPE $TITLE")
# Input Requirements
REQUIREMENTS=()
while true; do
if [ ${#REQUIREMENTS[@]} -ge 2 ]; then
if ! gum confirm "Do you want to add another requirement?"; then
break
fi
fi
REQUIREMENT=$(gum input --placeholder "Add a requirement...")
if [ -n "$REQUIREMENT" ]; then
REQUIREMENTS+=("$REQUIREMENT")
else
echo "Requirement cannot be empty. Please enter a valid requirement."
fi
done
create_body() {
echo "### Goal(s):"
echo "$GOAL"
echo "### Requirements:"
for i in "${!REQUIREMENTS[@]}"; do
echo "$(($i + 1)). ${REQUIREMENTS[$i]}"
done
echo "### Resources:"
while IFS= read -r doc; do
echo "- $doc"
done <<< "$DOCS"
}
ISSUE_BODY=$(create_body)
# Function to collect output
preview_output() {
echo "# ($SCOPE) $TITLE"
echo "$ISSUE_BODY"
}
# Display the formatted output
preview_output | gum format
# Confirm to create a GitHub issue
if gum confirm "Do you want to create a new GitHub issue with this information?"; then
# Create a new GitHub issue using the gh CLI
gh issue create --repo onsonr/sonr --title "($SCOPE) $TITLE" --body "$ISSUE_BODY"
else
exit 1
fi
-39
View File
@@ -1,39 +0,0 @@
#!/usr/bin/env bash
set -e
ROOT_DIR=$(git rev-parse --show-toplevel)
# Package the PKL projects
bunx pkl project package $ROOT_DIR/pkl/*/
# Process each directory in .out
for dir in .out/*/; do
# Get the folder name and version
folder=$(basename "$dir")
version=$(echo "$folder" | grep -o '@.*' | sed 's/@//')
new_folder=$(echo "$folder" | sed 's/@[0-9.]*$//')
# Create new directory without version
mkdir -p ".out/$new_folder/$version"
# Copy contents to versioned subdirectory
cp -r "$dir"* ".out/$new_folder/$version/"
# Find and copy only .pkl files from the original package
pkg_dir="$ROOT_DIR/pkl/$new_folder"
if [ -d "$pkg_dir" ]; then
# Copy only .pkl files to version directory
find "$pkg_dir" -name "*.pkl" -exec cp {} ".out/$new_folder/$version/" \;
fi
# Remove old versioned directory
rm -rf "$dir"
# Upload to R2 with new structure
rclone copy ".out/$new_folder" "r2:pkljar/$new_folder"
done
# Cleanup .out directory
rm -rf .out
-8
View File
@@ -1,8 +0,0 @@
---
title: New Testnet {{ date | date('dddd MMMM Do') }}
labels: enhancement
---
Server IP: {{ env.SERVER_IPV4_ADDR }}
SSH: `ssh -o StrictHostKeyChecking=no root@{{ env.SERVER_IPV4_ADDR }}`
Tag: {{ env.GITHUB_REF_NAME }} / Commit: {{ env.GITHUB_SHA }}
Local-Interchain API: http://{{ env.SERVER_IPV4_ADDR }}:{{ env.LOCALIC_PORT }}
+97
View File
@@ -0,0 +1,97 @@
name: Bump version
on:
push:
branches:
- master
env:
NODE_VERSION: 20
PNPM_VERSION: 10
jobs:
changes:
runs-on: ubuntu-latest
outputs:
minor: ${{ steps.check-milestone.outputs.minor }}
non-docs: ${{ steps.filter.outputs.non-docs }}
packages: ${{ steps.filter.outputs.packages }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
non-docs:
- '!docs/**'
- '!README.md'
packages:
- 'packages/**'
- 'cli/**'
- 'web/**'
- 'pnpm-lock.yaml'
# Check if any milestone has all issues closed
- name: Check milestone completion
id: check-milestone
run: |
# Get all open milestones and check if any have all issues closed
MILESTONES=$(gh api repos/${{ github.repository }}/milestones --jq '.[] | select(.state == "open") | {title, open_issues}')
# Check if any milestone has 0 open issues
MINOR_BUMP=false
while IFS= read -r milestone; do
if [ -n "$milestone" ]; then
OPEN_ISSUES=$(echo "$milestone" | jq -r '.open_issues')
TITLE=$(echo "$milestone" | jq -r '.title')
if [ "$OPEN_ISSUES" = "0" ]; then
echo "Milestone '$TITLE' is complete (0 open issues). Minor bump required."
MINOR_BUMP=true
break
fi
fi
done <<< "$(echo "$MILESTONES" | jq -c '.')"
echo "minor=$MINOR_BUMP" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }} # Handle Go/Binary versioning with commitizen
version-go:
needs: changes
if: "!startsWith(github.event.head_commit.message, 'bump:') && !startsWith(github.event.head_commit.message, 'hotfix:') && !startsWith(github.event.head_commit.message, 'Version Packages') && needs.changes.outputs.non-docs == 'true'"
runs-on: ubuntu-latest
name: "Bump Go binary version and create changelog"
steps:
- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: "${{ secrets.COMMIT_KEY }}"
- name: Determine increment type
id: increment
run: |
# Use the version-bump.sh script to determine increment type
INCREMENT_TYPE=$(./scripts/version-bump.sh increment-type true ${{ github.repository }})
echo "type=$INCREMENT_TYPE" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
push: false
increment: ${{ steps.increment.outputs.type }}
- name: Push using ssh
run: |
git push origin master --tags
close-milestone:
needs: [changes, version-go]
if: "needs.changes.outputs.minor == 'true'"
runs-on: ubuntu-latest
name: "Close completed milestone"
steps:
- name: Check out
uses: actions/checkout@v4
- name: Close completed milestone
run: |
./scripts/version-bump.sh close-milestone ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
+129
View File
@@ -0,0 +1,129 @@
name: CD
on:
workflow_call:
inputs:
bump:
required: false
type: string
release:
required: false
type: string
publish:
required: false
type: string
deploy:
required: false
type: string
continue-on-error:
required: false
default: false
type: boolean
devbox-version:
required: false
default: 0.16.0
type: string
enable-cache:
required: false
default: false
type: boolean
fetch-depth:
required: false
default: 0
type: number
persist-credentials:
required: false
default: false
type: boolean
runs-on:
required: false
default: ubuntu-latest
type: string
jobs:
bump:
runs-on: ${{ inputs.runs-on }}
environment: staging - cd
if: ${{ inputs.test != '' }}
name: Bump
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Bump ${{ inputs.bump }}"
run: devbox run bump:${{ inputs.bump }}
if: ${{ inputs.bump != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
release:
runs-on: ${{ inputs.runs-on }}
environment: staging - cd
if: ${{ inputs.release != '' }}
name: Release
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Release ${{ inputs.release }}"
run: devbox run release:${{ inputs.release }}
if: ${{ inputs.release != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
publish:
runs-on: ${{ inputs.runs-on }}
environment: staging - publish
if: ${{ inputs.publish != '' }}
name: Publish
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Publish ${{ inputs.publish }}"
run: devbox run publish:${{ inputs.publish }}
if: ${{ inputs.publish != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
deploy:
runs-on: ${{ inputs.runs-on }}
environment: staging - deploy
if: ${{ inputs.deploy != '' }}
name: Deploy
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Deploy ${{ inputs.deploy }}"
run: devbox run deploy:${{ inputs.deploy }}
if: ${{ inputs.deploy != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
+136
View File
@@ -0,0 +1,136 @@
name: Changes
on:
workflow_call:
outputs:
modules:
description: "JSON array of changed modules"
value: ${{ jobs.detect.outputs.modules }}
core:
description: "True if core files changed"
value: ${{ jobs.detect.outputs.core }}
app:
description: "True if app files changed"
value: ${{ jobs.detect.outputs.app }}
crypto:
description: "True if crypto files changed"
value: ${{ jobs.detect.outputs.crypto }}
hway:
description: "True if highway files changed"
value: ${{ jobs.detect.outputs.hway }}
client:
description: "True if client files changed"
value: ${{ jobs.detect.outputs.client }}
packages-changes:
description: "True if JS packages changed"
value: ${{ jobs.detect.outputs.packages-changes }}
web-changes:
description: "True if web app files changed"
value: ${{ jobs.detect.outputs.web-changes }}
go-changes:
description: "True if Go files changed"
value: ${{ jobs.detect.outputs.go-changes }}
wasm-changes:
description: "True if WASM files changed"
value: ${{ jobs.detect.outputs.wasm-changes }}
docker-changes:
description: "True if Docker files changed"
value: ${{ jobs.detect.outputs.docker-changes }}
jobs:
detect:
name: Find Changes
runs-on: ubuntu-latest
outputs:
modules: ${{ steps.set-modules.outputs.modules }}
core: ${{ steps.filter.outputs.core }}
app: ${{ steps.filter.outputs.app }}
crypto: ${{ steps.filter.outputs.crypto }}
hway: ${{ steps.filter.outputs.hway }}
client: ${{ steps.filter.outputs.client }}
packages-changes: ${{ steps.filter.outputs.packages-changes == 'true' }}
web-changes: ${{ steps.filter.outputs.web-changes == 'true' }}
go-changes: ${{ steps.filter.outputs.go-changes == 'true' }}
wasm-changes: ${{ steps.filter.outputs.wasm-changes == 'true' }}
docker-changes: ${{ steps.filter.outputs.docker-changes == 'true' }}
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Detect changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
dex:
- 'x/dex/**'
- 'proto/sonr/dex/**'
did:
- 'x/did/**'
- 'proto/sonr/did/**'
dwn:
- 'x/dwn/**'
- 'proto/sonr/dwn/**'
svc:
- 'x/svc/**'
- 'proto/sonr/svc/**'
hway:
- 'cmd/hway/**'
- 'internal/bridge/**'
- 'internal/**'
crypto:
- 'crypto/**'
client:
- 'client/**'
- 'client/go.mod'
- 'client/go.sum'
core:
- 'app/**'
- 'cmd/**'
- 'go.mod'
- 'go.sum'
packages-changes:
- 'packages/**'
- 'pnpm-lock.yaml'
- 'package.json'
- 'tsconfig.json'
web-changes:
- 'web/**'
- 'pnpm-lock.yaml'
- 'package.json'
go-changes:
- 'app/**'
- 'x/**'
- 'cmd/**'
- 'client/**'
- 'go.mod'
- 'go.sum'
wasm-changes:
- 'cmd/vault/**'
- 'x/dwn/client/wasm/main.go'
- 'x/dwn/Makefile'
docker-changes:
- 'Dockerfile'
list-files: json
- name: Set module outputs
id: set-modules
run: |
modules=()
if [[ "${{ steps.filter.outputs.dex }}" == "true" ]]; then
modules+=("dex")
fi
if [[ "${{ steps.filter.outputs.did }}" == "true" ]]; then
modules+=("did")
fi
if [[ "${{ steps.filter.outputs.dwn }}" == "true" ]]; then
modules+=("dwn")
fi
if [[ "${{ steps.filter.outputs.svc }}" == "true" ]]; then
modules+=("svc")
fi
if [[ ${#modules[@]} -eq 0 ]]; then
echo "modules=[]" >> $GITHUB_OUTPUT
else
printf -v joined '"%s",' "${modules[@]}"
echo "modules=[${joined%,}]" >> $GITHUB_OUTPUT
fi
+101
View File
@@ -0,0 +1,101 @@
name: CI
on:
workflow_call:
inputs:
build:
required: false
type: string
snapshot:
required: false
type: string
test:
required: false
type: string
continue-on-error:
required: false
default: false
type: boolean
devbox-version:
required: false
default: 0.16.0
type: string
enable-cache:
required: false
default: false
type: boolean
fetch-depth:
required: false
default: 0
type: number
persist-credentials:
required: false
default: false
type: boolean
runs-on:
required: false
default: ubuntu-latest
type: string
jobs:
test:
runs-on: ${{ inputs.runs-on }}
environment: staging - ci
if: ${{ inputs.test != '' }}
name: Test
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Test ${{ inputs.test }}"
run: devbox run test:${{ inputs.test }}
if: ${{ inputs.test != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
build:
runs-on: ${{ inputs.runs-on }}
environment: staging - ci
if: ${{ inputs.build != '' }}
name: Build
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Build ${{ inputs.build }}"
run: devbox run build:${{ inputs.build }}
if: ${{ inputs.build != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
snapshot:
runs-on: ${{ inputs.runs-on }}
environment: staging - ci
if: ${{ inputs.snapshot != '' }}
name: Deploy
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Snapshot ${{ inputs.snapshot }}"
run: devbox run snapshot:${{ inputs.snapshot }}
if: ${{ inputs.snapshot != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
+137
View File
@@ -0,0 +1,137 @@
name: Devbox Run
on:
workflow_call:
inputs:
install:
required: true
default: go
type: string
build:
required: false
type: string
deploy:
required: false
type: string
publish:
required: false
type: string
test:
required: false
type: string
continue-on-error:
required: false
default: false
type: boolean
devbox-version:
required: false
default: 0.16.0
type: string
enable-cache:
required: false
default: false
type: boolean
fetch-depth:
required: false
default: 0
type: number
persist-credentials:
required: false
default: false
type: boolean
runs-on:
required: false
default: ubuntu-latest
type: string
jobs:
test:
runs-on: ${{ inputs.runs-on }}
environment: staging - test
if: ${{ inputs.test != '' }}
name: Test
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Test ${{ inputs.test }}"
run: devbox run test:${{ inputs.test }}
if: ${{ inputs.test != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
build:
runs-on: ${{ inputs.runs-on }}
environment: staging - build
if: ${{ inputs.build != '' }}
name: Build
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Build ${{ inputs.build }}"
run: devbox run build:${{ inputs.build }}
if: ${{ inputs.build != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
publish:
runs-on: ${{ inputs.runs-on }}
environment: staging - publish
if: ${{ inputs.publish != '' }}
name: Publish
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Publish ${{ inputs.publish }}"
run: devbox run publish:${{ inputs.publish }}
if: ${{ inputs.publish != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
deploy:
runs-on: ${{ inputs.runs-on }}
environment: staging - deploy
if: ${{ inputs.deploy != '' }}
name: Deploy
steps:
- name: Check out source
uses: actions/checkout@v4
with:
persist-credentials: ${{ inputs.persist-credentials }}
fetch-depth: ${{ inputs.fetch-depth }}
- name: Install devbox
uses: jetify-com/devbox-install-action@v0.13.0
with:
enable-cache: ${{ inputs.enable-cache }}
devbox-version: ${{ inputs.devbox-version }}
- name: "Install ${{ inputs.install }}"
run: devbox run install:${{ inputs.install }}
- name: "Deploy ${{ inputs.deploy }}"
run: devbox run deploy:${{ inputs.deploy }}
if: ${{ inputs.deploy != '' }}
continue-on-error: ${{ inputs.continue-on-error }}
+99
View File
@@ -0,0 +1,99 @@
name: CI
on:
pull_request:
push:
branches: [master]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: 1.24.4
NODE_VERSION: 20
PNPM_VERSION: 10
permissions:
contents: read
pull-requests: read
packages: write
jobs:
detect-changes:
name: Analyze
uses: ./.github/workflows/changes.yml
client:
name: Client
needs: detect-changes
if: ${{ needs.detect-changes.outputs.client == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: go
test: client
build: client
core:
name: Core
needs: detect-changes
if: ${{ needs.detect-changes.outputs.go-changes == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: go
test: app
build: snrd
crypto:
name: Crypto
needs: detect-changes
if: ${{ needs.detect-changes.outputs.crypto == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: go
test: crypto
docker:
name: Docker
needs: detect-changes
if: ${{ needs.detect-changes.outputs.docker-changes == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: go
build: docker
hway:
name: Highway
needs: detect-changes
if: ${{ needs.detect-changes.outputs.hway == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: go
build: hway
packages:
name: Packages
needs: detect-changes
if: ${{ needs.detect-changes.outputs.packages-changes == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: pnpm
test: packages
web:
name: Web
needs: detect-changes
if: ${{ needs.detect-changes.outputs.web-changes == 'true' }}
uses: ./.github/workflows/devbox.yml
with:
install: pnpm
test: web
x-modules:
name: X
needs: detect-changes
if: ${{ needs.detect-changes.outputs.modules != '[]' && needs.detect-changes.outputs.modules != '' }}
strategy:
matrix:
module: ${{ fromJSON(needs.detect-changes.outputs.modules) }}
fail-fast: false
uses: ./.github/workflows/devbox.yml
with:
install: go
test: ${{ matrix.module }}
+406
View File
@@ -0,0 +1,406 @@
name: Release
# This workflow handles the complete release process:
# 1. Build binaries for multiple platforms (snrd, hway)
# 2. Build WASM modules (vault, motor)
# 3. Publish to GitHub releases, S3, and package registries
# 4. Build and push Docker images for all services
# 5. Publish NPM packages
# 6. Push protobuf definitions to Buf Schema Registry
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # ignore rc
workflow_dispatch:
permissions:
contents: write
packages: write
id-token: write
jobs:
# Prepare job runs on multiple OS for native builds
prepare:
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
- os: ubuntu-latest
goos: linux
goarch: arm64
- os: macos-latest
goos: darwin
goarch: amd64
- os: macos-latest
goos: darwin
goarch: arm64
runs-on: ${{ matrix.os }}
env:
flags: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache-dependency-path: "**/*.sum"
- name: Install dependencies
run: |
go mod download
# Build WASM modules
make build-motr
make build-vault
# Set flags for workflow dispatch (nightly builds)
- if: ${{ github.event_name == 'workflow_dispatch' }}
shell: bash
run: |
echo "flags=--nightly" >> $GITHUB_ENV
# Generate cache key
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Cache the built artifacts
- uses: actions/cache@v4
with:
path: dist/${{ matrix.goos }}
key: ${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.sha_short }}${{ env.flags }}
enableCrossOsArchive: true
# Run goreleaser in split mode for snrd
- name: Run GoReleaser for snrd (Split)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean --split --config cmd/snrd/.goreleaser.yml ${{ env.flags }}
workdir: cmd/snrd
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GGOOS: ${{ matrix.goos }}
GGOARCH: ${{ matrix.goarch }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Run goreleaser in split mode for hway
- name: Run GoReleaser for hway (Split)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean --split --config cmd/hway/.goreleaser.yml ${{ env.flags }}
workdir: cmd/hway
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GGOOS: ${{ matrix.goos }}
GGOARCH: ${{ matrix.goarch }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# WASM modules build job
wasm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
- name: Setup TinyGo
uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.32.0'
- name: Build WASM modules
run: |
# Build vault WASM
cd cmd/vault
make build
cd ../..
# Build motor WASM
cd cmd/motr
make build
cd ../..
- name: Run GoReleaser for WASM modules
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean --config cmd/vault/.goreleaser.yml
workdir: cmd/vault
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Run GoReleaser for Motor WASM
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean --config cmd/motr/.goreleaser.yml
workdir: cmd/motr
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Merge and release job combines all artifacts
release:
runs-on: ubuntu-latest
needs: [prepare, wasm]
env:
flags: ""
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
check-latest: true
cache-dependency-path: "**/*.sum"
# Set flags for workflow dispatch
- if: ${{ github.event_name == 'workflow_dispatch' }}
shell: bash
run: |
echo "flags=--nightly" >> $GITHUB_ENV
# Generate cache key
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# Restore all cached artifacts from prepare jobs
- name: Restore Linux AMD64 artifacts
uses: actions/cache@v4
with:
path: dist/linux
key: linux-amd64-${{ env.sha_short }}${{ env.flags }}
enableCrossOsArchive: true
- name: Restore Linux ARM64 artifacts
uses: actions/cache@v4
with:
path: dist/linux
key: linux-arm64-${{ env.sha_short }}${{ env.flags }}
enableCrossOsArchive: true
- name: Restore Darwin AMD64 artifacts
uses: actions/cache@v4
with:
path: dist/darwin
key: darwin-amd64-${{ env.sha_short }}${{ env.flags }}
enableCrossOsArchive: true
- name: Restore Darwin ARM64 artifacts
uses: actions/cache@v4
with:
path: dist/darwin
key: darwin-arm64-${{ env.sha_short }}${{ env.flags }}
enableCrossOsArchive: true
# Merge and publish the release for snrd
- name: Run GoReleaser for snrd (Merge)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: continue --merge --config cmd/snrd/.goreleaser.yml ${{ env.flags }}
workdir: cmd/snrd
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Merge and publish the release for hway
- name: Run GoReleaser for hway (Merge)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: continue --merge --config cmd/hway/.goreleaser.yml ${{ env.flags }}
workdir: cmd/hway
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Protobuf publishing job
protobuf:
runs-on: ubuntu-latest
needs: release
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1
with:
version: latest
- name: Push to Buf Schema Registry
uses: bufbuild/buf-push-action@v1
with:
input: proto
buf_token: ${{ secrets.BUF_TOKEN }}
github_token: ${{ secrets.GH_PAT_TOKEN }}
# NPM packages publishing job
npm:
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' # Only on tag push, not workflow_dispatch
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Publish packages
run: |
# Update package versions to match git tag
export VERSION=${GITHUB_REF#refs/tags/v}
bash scripts/version-bump.sh sync-packages all
# Publish to npm
pnpm --filter "./packages/*" publish --access public --no-git-checks
pnpm --filter "./cli/*" publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Docker multi-platform build job
docker:
runs-on: ubuntu-latest
needs: release
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- service: snrd
dockerfile: cmd/snrd/Dockerfile
description: "Sonr blockchain daemon"
- service: hway
dockerfile: cmd/hway/Dockerfile
description: "Highway service - task processor"
- service: auth
dockerfile: web/auth/Dockerfile
description: "Authentication web application"
- service: dash
dockerfile: web/dash/Dockerfile
description: "Dashboard web application"
- service: postgres
dockerfile: etc/postgres/Dockerfile
description: "PostgreSQL with extensions"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/sonr-io/${{ matrix.service }}
onsonr/${{ matrix.service }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
type=raw,value=${{ inputs.tag || 'latest' }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Build and push ${{ matrix.service }}
uses: docker/build-push-action@v5
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
${{ steps.meta.outputs.labels }}
org.opencontainers.image.description=${{ matrix.description }}
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
+18
View File
@@ -0,0 +1,18 @@
name: CI Status
on:
workflow_run:
workflows: ["PR CI", "Post-Merge Release", "Nightly Snapshot"]
types: [completed]
jobs:
report:
name: Report CI Status
runs-on: builder
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Report Failure
run: |
echo "❌ Workflow Failed: ${{ github.event.workflow_run.name }}"
echo "Branch: ${{ github.event.workflow_run.head_branch }}"
echo "Commit: ${{ github.event.workflow_run.head_sha }}"
echo "URL: ${{ github.event.workflow_run.html_url }}"
-34
View File
@@ -1,34 +0,0 @@
name: Deploy Networks
on:
workflow_dispatch:
push:
tags:
- "v*"
branches:
- develop
permissions:
contents: write
issues: write
jobs:
reboot-devnet:
name: Devnet Deploy
runs-on: goliath
environment: "Devnet"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
branch: develop
- name: Stop Existing Network
continue-on-error: true
run: |
make stop-uds
make clean
- name: Start Updated Network
run: |
make start-uds
-19
View File
@@ -1,19 +0,0 @@
name: PR Labeler
on:
pull_request:
types: [opened]
permissions:
contents: read
jobs:
pr-labeler:
permissions:
contents: read # for TimonVS/pr-labeler-action to read config file
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
-33
View File
@@ -1,33 +0,0 @@
name: Publish Docs via GitHub Pages
on:
push:
branches:
- main
- master
- develop
paths:
- "docs/**"
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: cd docs && mkdocs gh-deploy --force
+61
View File
@@ -0,0 +1,61 @@
name: PR CI
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: pr-${{ github.head_ref }}
cancel-in-progress: true
env:
DEVBOX_VERSION: 0.16.0
jobs:
validate:
name: Validate & Test
runs-on: builder # Self-hosted runner
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for github-env.sh comparisons
# Cache can be local on self-hosted runner for better performance
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.local/share/pnpm/store
~/.devbox
key: deps-builder-${{ hashFiles('go.sum', 'pnpm-lock.yaml', 'devbox.json') }}
restore-keys: deps-builder-
- name: Install Dependencies
run: devbox install
- name: Test Affected Scopes
run: |
echo "🔍 Analyzing changes..."
./scripts/github-env.sh git-context
echo ""
devbox run test
- name: Build Affected Scopes
run: devbox run build
- name: Verify Build Artifacts
run: |
# Verify critical build outputs exist
if [ -d "build/" ]; then
ls -la build/
fi
# Cleanup workspace for self-hosted runner
- name: Cleanup
if: always()
run: |
# Clean build artifacts to prevent disk fill
make clean || true
# Keep caches but remove build outputs
rm -rf dist/ build/ || true
-25
View File
@@ -1,25 +0,0 @@
name: Publish Versioned Assets
on:
push:
branches:
- develop
permissions:
contents: write
issues: write
jobs:
buf_push_core:
name: Publish to buf.build/onsonr/sonr
runs-on: ubuntu-latest
steps:
# Run `git checkout`
- uses: actions/checkout@v3
# Install the `buf` CLI
- uses: bufbuild/buf-setup-action@v1
# Push only the Input in `proto` to the BSR
- uses: bufbuild/buf-push-action@v1
continue-on-error: true
with:
input: proto
buf_token: ${{ secrets.BUF_TOKEN }}
-59
View File
@@ -1,59 +0,0 @@
name: Run Tests
on:
pull_request:
merge_group:
jobs:
test-unit:
runs-on: ubuntu-latest
name: Run Unit Tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: onsonr/sonr
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- run: make test-unit
test-race:
runs-on: ubuntu-latest
name: Run Race Tests
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: onsonr/sonr
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- run: make test-race
test-cover:
runs-on: ubuntu-latest
name: Run Coverage Tests
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: onsonr/sonr
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- run: make test-cover
-67
View File
@@ -1,67 +0,0 @@
name: Versioned Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
check-release:
name: Check Existing Release
runs-on: ubuntu-latest
outputs:
release_exists: ${{ steps.check.outputs.release_exists }}
steps:
- name: Check if release exists
id: check
run: |
RELEASE_EXISTS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/onsonr/sonr/releases/tags/${GITHUB_REF#refs/tags/}" \
| jq -r 'if .message == "Not Found" then "false" else "true" end')
echo "release_exists=$RELEASE_EXISTS" >> "$GITHUB_OUTPUT"
goreleaser:
name: Run GoReleaser
needs: check-release
if: needs.check-release.outputs.release_exists == 'false'
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: onsonr/sonr
fetch-depth: 0
fetch-tags: true
- name: Checkout Latest Tag
run: git checkout $(git describe --tags --abbrev=0)
- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_PERSONAL_AUTH_TOKEN: ${{ secrets.GH_RELEASER_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
-39
View File
@@ -1,39 +0,0 @@
name: Update Version
on:
push:
branches:
- master
permissions:
contents: write
pull-requests: write
jobs:
run-tests:
name: "Run tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
check-latest: true
- name: Run tests
run: make test
bump-version:
needs: [run-tests]
runs-on: ubuntu-latest
name: "Bump Version"
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
increment: "PATCH"
Regular → Executable
+121 -82
View File
@@ -1,101 +1,140 @@
# Binaries
.data
schemas
*.db
tools-stamp
*.exe
*.exe~
*.dll
*.so
*.dylib
*.app
# ======================================
# Sonr Blockchain & Monorepo .gitignore
# ======================================
# ===== Operating System Files =====
.DS_Store
.session.vim
aof*
dist
**/.haptic
static
pkg/webapp/dist
.agent
Thumbs.db
*~
*.swp
*.swo
.logs/
.venv/
services/
# Test binary
# ===== IDE & Editor Files =====
.vscode/
.idea/
*.tmp
.aider*
.opencode
# ===== Build Artifacts & Binaries =====
*.wasm
bin/
dist/
dist*/
build/
out/
*.test
.devon*
**/.DS_Store
.task
.wrangler
*.wasm
# Output of the go coverage tool
*.out
tmp
# Exclude embedded files
!internal/files/dist
# Go binaries (but allow docs references)
snrd
hway
motr
!cmd/motr/
!cmd/hway/
!cmd/snrd/
!docs/**/motr
!docs/**/hway
# Dependency directories
# Allow specific CLI binaries
!cli/join-testnet/bin/
!cli/install/bin/
# ===== Node.js & Frontend =====
node_modules/
.pnpm-debug.log*
pnpm-debug.log*
package-lock.json
yarn.lock
*.tsbuildinfo
# Go workspace file
# Next.js
.next/
.vercel/
**/.open-next
# ===== Go Development =====
pkg/mod/
go.work
go.work.sum
go.work.mod
coverage.out
coverage.txt
profile.out
*.cover
# Environment files
.env
**/*.env
**/sonr.log
# ===== Rust/CosmWasm Development =====
target/
Cargo.lock
artifacts/
**/target/
**/Cargo.lock
# Contract-specific
contracts/DAO/deployment_ids.env
contracts/DAO/deployment_report_*.md
contracts/DAO/relayer.pid
contracts/DAO/*.mnemonic
contracts/DAO/tx_*.json
contracts/DAO/signed_*.json
contracts/DAO/init_*.json
contracts/DAO/MAINNET_DEPLOYMENT_INSTRUCTIONS.md
contracts/DAO/backups/
contracts/wSNR/remappings.txt
# Terraform
**/.terraform/*
.terraform
*.tfstate
*.tfstate.*
crash.log
crash.*.log
*.tfvars
*.tfvars.json
override.tf
override.tf.json
*_override.tf
*_override.tf.json
.terraformrc
terraform.rc
# ===== Blockchain & Cosmos SDK =====
.snrd/
.hway/
keyring-test/
mytestnet/
docker/testnet/testnet-data
# ===== Monorepo & Build Tools =====
.turbo/
.gitwork/
.changeset/.cli-state
.biome/
.devbox/
.task*
Taskfile.yml
!deploy/**/Taskfile.yml
# ===== Testing & Coverage =====
testdata/
coverage/
# Misc
.DS_Store
.tmp/
tmp/
**/*tmp*/
*.tmp
# ===== Logs & Temporary Files =====
logs/
*.log
*.dot
configs/logs.json
tmp/
tmp*
# ===== Environment & Secrets =====
.env
.env.local
.env.production
.env.development
*.key
*.pem
dist/
bin/
build/
.devbox
.ignore
.opencommitignore
# ===== Documentation & Planning =====
PLAN.md
ANALYSIS.md
COMPLETION_SUMMARY.md
**/CLAUDE.md
# ===== Miscellaneous =====
.claude/
**/.claude
.gmap
.aim
.spawn
.wrangler/
.browser-echo-mcp.json
data/
compose/
heighliner*
sonr
deploy/**/data
x/.DS_Store
.aider*
buildenv*
node_modules
cmd/gateway/node_modules
pkg/nebula/node_modules
mprocs.yaml
build
sonr.wiki
!devbox.lock
!buf.lock
.air.toml
**/*.swagger.yaml
+91
View File
@@ -0,0 +1,91 @@
#jsonschema:https://golangci-lint.run/jsonschema/golangci.jsonschema.json
version: "2"
linters:
enable:
- govet
- ineffassign
- misspell
- unconvert
- staticcheck
- errcheck
- gosec
- goconst
- prealloc
- dupl
- whitespace
disable:
- exhaustruct
settings:
govet:
enable-all: true
disable:
- fieldalignment
gocyclo:
min-complexity: 15
dupl:
threshold: 100
goconst:
min-len: 3
min-occurrences: 3
funlen:
lines: 100
statements: 50
gocognit:
min-complexity: 20
gocritic:
enabled-checks:
- nilValReturn
- rangeExprCopy
revive:
confidence: 0.8
rules:
- name: exported
arguments: [checkPrivateReceivers, sayRepetitiveInsteadOfStutters]
staticcheck:
checks:
[
"all",
"-SA1019",
"-SA1029",
"-SA2002",
"-SA4006",
"-ST1021",
"-S1004",
"-ST1003",
"-ST1005",
"-ST1016",
]
gosec:
excludes:
- G204 # Subprocess launched with function call as argument or cmd arguments
- G404 # Weak random number generator
- G115 # Weak random number generator
formatters:
enable:
- gofmt
- gofumpt
- goimports
- golines
exclusions:
warn-unused: true
generated: strict
paths:
- ".*\\.pb\\.go$"
- ".*\\.pulsar\\.go$"
- ".*\\.cosmos_orm\\.go$"
- ".*\\._orm\\.go$"
- "types/webauthn/.*\\.go$"
issues:
max-issues-per-linter: 0
max-same-issues: 0
new: true
fix: true
run:
timeout: 5m
relative-path-mode: gomod
issues-exit-code: 2
tests: true
modules-download-mode: readonly
allow-parallel-runners: true
allow-serial-runners: true
concurrency: 8
-177
View File
@@ -1,177 +0,0 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
version: 2
project_name: sonr
builds:
- id: sonr
main: ./cmd/sonrd
binary: sonrd
builder: go
gobinary: go
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- linux
- darwin
goarch:
- amd64
- arm64
goamd64:
- v1
flags:
- -mod=readonly
- -trimpath
ldflags:
- -X github.com/cosmos/cosmos-sdk/version.Name=sonr
- -X github.com/cosmos/cosmos-sdk/version.AppName=sonrd
- -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}}
- -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
- -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger"
tags:
- netgo
- ledger
- id: hway
main: ./cmd/hway
binary: hway
builder: go
gobinary: go
goos:
- linux
- darwin
goarch:
- amd64
- arm64
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -mod=readonly
- -trimpath
goamd64:
- v1
tags:
- netgo
ldflags:
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
- -X main.date={{.Date}}
archives:
- id: sonr
builds: [sonr]
name_template: >-
sonr_{{ .Version }}_
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format: tar.gz
files:
- src: README*
wrap_in_directory: true
- id: hway
builds: [hway]
name_template: >-
hway_{{ .Version }}_
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
format: tar.gz
files:
- src: README*
wrap_in_directory: true
nfpms:
- id: hway
package_name: hway
file_name_template: "{{ .ConventionalFileName }}"
builds: [hway]
vendor: Sonr
homepage: "https://onsonr.dev"
maintainer: "Sonr <support@onsonr.dev>"
description: "Sonr Highway is a decentralized, permissionless, and censorship-resistant identity network proxy."
license: "Apache 2.0"
formats:
- rpm
- deb
- apk
dependencies:
- ipfs
contents:
- src: README*
dst: /usr/share/doc/hway
bindir: /usr/bin
section: net
priority: optional
# Add these lines to match build config
- id: sonr
package_name: sonrd
file_name_template: "{{ .ConventionalFileName }}"
builds: [sonr]
vendor: Sonr
homepage: "https://onsonr.dev"
maintainer: "Sonr <support@onsonr.dev>"
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
license: "Apache 2.0"
formats:
- rpm
- deb
- apk
dependencies:
- ipfs
contents:
- src: README*
dst: /usr/share/doc/sonrd
bindir: /usr/bin
section: net
priority: optional
# Add these lines to match build config
brews:
- name: hway
ids: [hway]
commit_author:
name: goreleaserbot
email: bot@goreleaser.com
directory: Formula
caveats: "Run a local hway node and access it with the hway proxy"
homepage: "https://onsonr.dev"
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
dependencies:
- name: ipfs
repository:
owner: onsonr
name: homebrew-tap
branch: master
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
- name: sonr
ids: [sonr]
commit_author:
name: goreleaserbot
email: bot@goreleaser.com
directory: Formula
caveats: "Run a local sonr node and access it with the hway proxy"
homepage: "https://onsonr.dev"
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
dependencies:
- name: ipfs
repository:
owner: onsonr
name: homebrew-tap
branch: master
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
release:
github:
owner: onsonr
name: sonr
name_template: "Release {{.Version}}"
draft: false
replace_existing_draft: true
replace_existing_artifacts: true
extra_files:
- glob: ./README*
announce:
telegram:
enabled: true
chat_id: -1002222617755
+5
View File
@@ -0,0 +1,5 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
---
version: 2
monorepo:
tag_prefix: v
+17
View File
@@ -0,0 +1,17 @@
.dockerignore
.goreleaser.yml
api
contracts
chains
crypto
proto
test
**/_test.go
.golangci.yml
tsconfig.json
pnpm-workspace.yaml
biome.json
CLAUDE.md
CONSTITUTION.md
CHANGELOG.md
Caddyfile
+891
View File
@@ -0,0 +1,891 @@
## Unreleased
### Feat
- integrate Dexie.js with vault plugin for account-based database persistence (#272)
- Motor WASM Service Worker - Payment Gateway & OIDC Authorization (#263)
- enable secure data storage with vault plugin
- enhance build process with gum logging for better visibility
### Fix
- **devops**: Merge flow
- **devops**: bump package version sync
- cz prehook
- CI and Docker Configuration Across Monorepo (#266)
- update go dependencies for compatibility and security
## v0.13.16 (2025-09-11)
### Feat
- implement end-to-end WebAuthn account registration with DID creation (#261)
## v0.13.15 (2025-09-10)
### Feat
- introduce vault WASM plugin for enhanced data security
## v0.13.14 (2025-09-09)
### Feat
- enable fine-grained, delegable authorization using UCAN
## v0.13.13 (2025-09-09)
## v0.13.12 (2025-09-09)
### Feat
- implement holistic UCAN authorization with OIDC integration (#258)
## v0.13.11 (2025-09-08)
## v0.13.10 (2025-09-08)
### Feat
- integrate PostgreSQL for enhanced data management
## v0.13.9 (2025-09-08)
### Feat
- implement decentralized identity DAO as CosmWasm smart contracts (#254)
## v0.13.8 (2025-09-07)
## v0.13.7 (2025-09-06)
### Feat
- enhance documentation navigation and API exploration
## v0.13.6 (2025-09-06)
## v0.13.5 (2025-09-06)
### Feat
- implement 'Sign in with Sonr' OAuth provider for crypto apps (#250)
- implement comprehensive developer dashboard for Sonr Services (#249)
## v0.13.4 (2025-09-04)
## v0.13.3 (2025-09-04)
### Feat
- consolidate deployment infrastructure with Docker Compose and enhance build targets (#248)
## v0.13.2 (2025-09-04)
### Feat
- implement OpenID Connect provider with WebAuthn in bridge handlers (#244)
## v0.13.1 (2025-09-04)
## v0.13.0 (2025-09-03)
### Fix
- Fix cryptographic implementations and enable disabled tests (#243)
## v0.12.11 (2025-09-03)
### Fix
- WebAuthn attestation and verification implementations (#242)
## v0.12.10 (2025-09-03)
### Feat
- Implement Service module capability system and parameters (#241)
## v0.12.9 (2025-09-03)
### Feat
- Complete DID module WebAuthn and parameter implementation (#240)
## v0.12.8 (2025-09-03)
### Feat
- introduce key rotation events and IPFS status endpoint (#238)
## v0.12.7 (2025-09-02)
### Feat
- implement module parameter validation and defaults (#237)
## v0.12.6 (2025-08-30)
### Feat
- complete remaining event emissions for DID and DWN modules (#235)
## v0.12.5 (2025-08-27)
### Feat
- implement typed Protobuf events for x/did, x/dwn, and x/svc modules (#233)
## v0.12.4 (2025-08-24)
### Feat
- Integrate Interchain Accounts for cross-chain DEX functionality
## v0.12.3 (2025-08-24)
### Feat
- implement ICA Controller system in x/dex module for cross-chain DEX operations (#221)
## v0.12.2 (2025-08-21)
## v0.12.1 (2025-08-20)
### Feat
- replace InterchainTest with Starship-based E2E testing framework (#217)
## v0.12.0 (2025-08-18)
### Feat
- add support for additional elliptic curves and JWK verification (#216)
## v0.11.4 (2025-08-18)
### Feat
- Complete WebAuthn/FIDO2 implementation for passwordless authentication (#215)
## v0.11.3 (2025-08-17)
### Feat
- complete DID keeper implementation with W3C compliance and WebAuthn authentication (#214)
## v0.11.2 (2025-08-16)
### Feat
- transform UI package to shadcn monorepo architecture for uniform styling (#213)
## v0.11.1 (2025-08-15)
### Refactor
- improve secure memory handling for enhanced security (#201)
## v0.11.0 (2025-08-15)
### Feat
- implement comprehensive cryptographic security enhancements (#200)
## v0.10.35 (2025-08-15)
### Feat
- implement comprehensive cryptographic security enhancements (#199)
## v0.10.34 (2025-08-15)
### Feat
- implement CLI commands for wallet module (#198)
## v0.10.33 (2025-08-14)
### Feat
- implement UCAN permission validation for wallet transactions (#197)
## v0.10.32 (2025-08-14)
### Feat
- implement Go client SDK with transaction signing and broadcasting (#196)
## v0.10.31 (2025-08-13)
### Feat
- enable Docker-based testnet execution
## v0.10.30 (2025-08-13)
### Feat
- streamline CI/CD pipeline by removing changeset dependency
## v0.10.29 (2025-08-13)
## v0.10.28 (2025-08-13)
### Feat
- implement monorepo structure with pnpm workspaces and changesets (#189)
## v0.10.27 (2025-08-12)
### Feat
- implement WebAuthn gasless transactions with comprehensive protocol integration (#186)
### Fix
- resolve chain ID validation and encryption key rotation issues (#188)
## v0.10.26 (2025-08-11)
## v0.10.25 (2025-08-11)
### Feat
- implement gasless WebAuthn registration with comprehensive security audit (#182)
## v0.10.24 (2025-08-09)
### Feat
- implement consensus-based encryption for DWN module (#181)
## v0.10.23 (2025-08-09)
### Feat
- enhance init command with VRF keypair generation and SonrContext system (#180)
## v0.10.22 (2025-08-09)
### Refactor
- move interchain tests to (#178)
## v0.10.21 (2025-08-09)
## v0.10.20 (2025-08-08)
### Feat
- refactor Motor WASM plugin as MPC-based UCAN source (#177)
### Refactor
- restructure documentation and navigation for clarity
## v0.10.19 (2025-08-08)
### Feat
- migrate documentation to Mintlify structure (#172)
### Refactor
- migrate x/ucan module to lightweight internal/ucan library (#174)
## v0.10.18 (2025-08-07)
## v0.10.17 (2025-08-06)
### Feat
- implement WebAuthn CLI registration with gasless transactions (#168)
## v0.10.16 (2025-08-06)
### Feat
- implement auto-create DWN vault with comprehensive security improvements (Fixes #153) (#161)
## v0.10.15 (2025-08-05)
### Feat
- migrate Highway service to Echo framework with WebSocket/SSE and JWT auth (#159)
## v0.10.14 (2025-08-05)
### Feat
- complete Highway proxy server implementation with asynq and proto.Actor (#157)
## v0.10.13 (2025-08-05)
### Feat
- refactor x/dwn vaults and introduce gasless transactions (#154)
## v0.10.12 (2025-08-03)
### Feat
- monorepo restructure with internal packages and enhanced CI/CD (#151)
## v0.10.11 (2025-08-03)
### Feat
- streamline testnet configuration
## v0.10.10 (2025-08-03)
### Feat
- enable faucet and explorer for improved testnet accessibility
- streamline deployment workflow and configuration
- streamline testnet configuration for faster iteration
- streamline testnet configuration
### Fix
- K8s deployment config simplified to single node
## v0.10.9 (2025-08-02)
### Feat
- streamline changelog management
- enhance testnet configuration with faucet and explorer settings (#145)
### Fix
- correct dependency for milestone closure (#149)
- ensure Docker containers are always pushed with latest tag
- deploy workflow (#142)
### Refactor
- streamline GitHub Actions workflows for efficiency (#148)
## v0.10.8 (2025-08-01)
### Feat
- optimize deployment workflows and update infrastructure configuration (#141)
## v0.10.7 (2025-08-01)
## v0.10.6 (2025-08-01)
### Feat
- introduce Starship network configurations for devnet and testnet (#139)
## v0.10.5 (2025-07-31)
### Feat
- enhance chain security with pod security context
## v0.10.4 (2025-07-31)
## v0.10.3 (2025-07-31)
### Refactor
- streamline Docker build for enhanced efficiency (#136)
## v0.10.2 (2025-07-31)
### Feat
- streamline starship configuration and local development (#135)
## v0.10.1 (2025-07-31)
### Feat
- optimize CI/CD workflows with smart testing and K8s deployment (#134)
- implement fee grant integration with BasicAllowance (#131)
- implement EVM transaction support in wallet module (#93) (#128)
- implement external wallet linking as DID assertion methods (#127)
### Fix
- update protobuf definitions to reflect wallet chain ID naming (#132)
## v0.10.0 (2025-07-21)
### Feat
- implement secure key management with WASM enclaves (#126)
## v0.9.22 (2025-07-21)
### Feat
- implement vault export/import with IPFS encryption (#125)
## v0.9.21 (2025-07-20)
### Feat
- enhance release automation with dedicated token (#124)
## v0.9.20 (2025-07-20)
### Feat
- Add transaction building framework and streamline release process (#123)
## v0.9.19 (2025-07-20)
### Feat
- Add cross-module keeper integration tests and optimize CI performance (#122)
## v0.9.18 (2025-07-20)
### Refactor
- improve service validation and UCAN integration (#121)
## v0.9.17 (2025-07-20)
### Feat
- Implement ServiceKeeper interface for x/dwn module (#120)
## v0.9.16 (2025-07-20)
### Feat
- Implement UCANKeeper interface for x/dwn module (#119)
## v0.9.15 (2025-07-18)
### Feat
- Implement UCANKeeper interface for x/svc module (#117)
## v0.9.14 (2025-07-18)
### Feat
- Implement DIDKeeper interface for x/svc module (#116)
## v0.9.13 (2025-07-18)
## v0.9.12 (2025-07-18)
## v0.9.11 (2025-07-18)
### Feat
- Implement ServiceKeeper interface methods in x/svc keeper (#113)
## v0.9.10 (2025-07-18)
### Feat
- Implement UCANKeeper interface methods and centralize error handling (#112)
## v0.9.9 (2025-07-18)
### Feat
- **x/did**: Implement VerifyDIDDocumentSignature method with multi-algorithm support (#111)
## v0.9.8 (2025-07-18)
### Feat
- Implement wallet derivation and keeper interface architecture (#110)
## v0.9.7 (2025-07-18)
## v0.9.6 (2025-07-16)
### Feat
- introduce VaultKeeper interface for enhanced modularity (#99)
## v0.9.5 (2025-07-15)
### Feat
- enable DWN vault spawning via query API and add comprehensive tests (#98)
## v0.9.4 (2025-07-14)
### Feat
- Update testnet configuration for DAO governance (#84)
## v0.9.3 (2025-07-09)
### Refactor
- Centralize vault actor system and optimize plugin management (#83)
## v0.9.2 (2025-07-07)
## v0.9.1 (2025-07-07)
### Feat
- automate issue triage with project board integration
### Fix
- use personal access token for project automation
## v0.9.0 (2025-07-06)
### Feat
- Refactor x/dwn module structure and integrate WebAssembly motor client (#81)
- enhance documentation accessibility for LLMs
- enhance site navigation and branding
### Refactor
- restructure app layout and navigation
## v0.8.12 (2025-07-05)
### Feat
- Implement Rybbit analytics and update documentation site styling (#80)
## v0.8.11 (2025-07-04)
### Feat
- Complete shadcn/TemplUI migration from NebulaUI (#79)
## v0.8.10 (2025-07-03)
### Feat
- rename to
## v0.8.9 (2025-07-03)
## v0.8.8 (2025-07-03)
## v0.8.7 (2025-07-03)
### Feat
- remove TUI dashboard integration from main binary
## v0.8.6 (2025-07-03)
### Feat
- remove TUI dashboard feature
## v0.8.5 (2025-07-03)
## v0.8.4 (2025-07-02)
### Feat
- automate minor version bumps based on milestone completion
## v0.8.3 (2025-07-02)
## v0.8.2 (2025-07-02)
### Feat
- Enhanced documentation landing page with custom branding (#69)
## v0.8.1 (2025-07-02)
## v0.8.0 (2025-07-02)
### Feat
- integrate Trunk.io for code quality and linting (#65)
## v0.7.0 (2025-07-01)
### Feat
- Implement DWN module with enclave signing and DIF specification (#64)
## v0.6.1 (2025-07-01)
### Feat
- es-client protobuf generation (#63)
## v0.6.0 (2025-07-01)
### Feat
- Automated API Reference Generation for Cosmos Modules and Highway REST Service (#62)
### Fix
- Revert NTCharts integration and restore original TUI components (#60)
## v0.5.1 (2025-06-30)
### Feat
- Enhance TUI Dashboard with real-time data visualization and testnet support (#59)
## v0.5.0 (2025-06-30)
### Feat
- Implement x/ucan msgServer handlers with capability templates (#55)
## v0.4.1 (2025-06-30)
### Feat
- Integrate Nebula UI Component Library (#54)
## v0.4.0 (2025-06-29)
### Feat
- W3C DID Controller with WebAuthn support and comprehensive testing improvements (#52)
## v0.3.0 (2025-06-29)
### Feat
- Migrate UCAN capability definitions to x/ucan module (#49)
## v0.2.0 (2025-06-28)
### Feat
- Implement DNS record verification with UCAN delegation for x/svc (#41)
## v0.1.0 (2025-06-28)
### Feat
- Implement Highway Service API Handlers (#39)
## v0.0.23 (2025-06-26)
### Feat
- implement IPFS private network support and enhance CI/CD workflows (#38)
- introduce comprehensive tokenomics documentation (#37)
- enhance documentation with client integration guide (#36)
- introduce research section with whitepapers
## v0.0.22 (2025-06-25)
### Feat
- remove ajv dependency and related code
## v0.0.21 (2025-06-25)
## v0.0.20 (2025-06-25)
### Refactor
- streamline Docker release workflow for improved maintainability
## v0.0.19 (2025-06-25)
### Feat
- improve documentation and build process
## v0.0.18 (2025-06-25)
## v0.0.17 (2025-06-24)
### Feat
- remove auto-generated cosmos API reference pages
## v0.0.16 (2025-06-24)
### Feat
- enhance documentation generation with OpenAPI support
- migrate documentation to Fumadocs
- implement automated build and release process
- remove testnet workflows and data
- implement optimized Docker build workflow
- migrate to docker compose and Makefile
### Fix
- docs
- correct Dockerfile paths to match actual project structure
## v0.0.15 (2025-06-23)
### Feat
- enhance testnet data handling by excluding specific files
- introduce testnet and caddy docker release workflows
- introduce Caddy reverse proxy for enhanced network management
### Refactor
- streamline Docker configurations and builds
## v0.0.14 (2025-06-23)
### Feat
- introduce standalone hway and IPFS services with Docker Compose
## v0.0.13 (2025-06-23)
## v0.0.12 (2025-06-23)
## v0.0.11 (2025-06-23)
## v0.0.10 (2025-06-23)
### Feat
- introduce postgres docker image with extensions
## v0.0.9 (2025-06-23)
### Feat
- authenticate with GitHub Container Registry for image publishing
## v0.0.8 (2025-06-23)
## v0.0.7 (2025-06-23)
### Feat
- introduce multi-image build and push workflow
- enhance Sonr documentation with architecture and component details
- integrate task runner with fzf for improved command execution
### Refactor
- consolidate build tags for improved clarity
- streamline app initialization and service registration
- restructure project and update dependencies
- move server and middleware logic to pkg/server
## v0.0.6 (2025-06-22)
### Feat
- streamline deployment by removing hway proxy
## v0.0.5 (2025-06-22)
### Feat
- optimize build configurations for broader CPU compatibility
## v0.0.4 (2025-06-22)
## v0.0.3 (2025-06-22)
### Fix
- disable CGO for hway builds to improve portability
## v0.0.2 (2025-06-22)
## v0.0.1 (2025-06-22)
### Feat
- automate version bumping and changelog generation
- update go version to 1.24.2 across workflows
- enforce GITHUB_TOKEN and GITHUB_PAT_TOKEN for release
- integrate external APIs for market data retrieval and chain registry updates
- automate release process with goreleaser
- integrate secure enclave and decentralized web node runtime
- Streamline user experience with interactive TUI dashboard
- remove unused enclave
- introduce functional options for configurable vault spawning
- introduce vault options for flexible spawning
- integrate vault management with database
- enhance asset data with verification and market details
- add asset symbol linking to initial data refresh
- add asset symbol linking for improved data association
- enhance request logging with latency and status details
- integrate Claude Opus for enhanced blockchain development
- Update market data retrieval to use external API
- introduce highway service for enhanced user authentication
- add CoinPaprika global market data integration using http_get
- remove direct database access from application
- enable SQLC schema deployment to cloud
- enhance chain and asset data ingestion from Cosmos directory
- initialize market data upon deployment
- schedule and monitor cron jobs
- schedule market and cosmos data updates with pg_cron
- introduce commitizen for standardized commits and releases
- remove enclave wasm
- enable pg_net extension for enhanced network capabilities
- improve postgresql configuration for local development
- implement database migration using goose
- introduce database layer and session management
- introduce taskfile-based build and release processes
- introduce hway service for webauthn
- introduce authorize view
- Integrate CosmWasm VM for enhanced smart contract capabilities
- implement vault refresh functionality
- expose ActorSystem for external access
- remove in-memory cache implementation
- implement enclave actor with Extism plugin for secure key management
- implement enclave actor with Extism runtime for secure operations
- implement enclave actor for secure key management
- enhance .gitignore to exclude build outputs and temporary files
- streamline dev environment setup by removing default init hook
- add support for generating and unlocking enclaves
- introduce enclave build target for WASM
- Introduce enclave WASM runtime for secure operations
- integrate IPFS Kubo v0.35.0 and Boxo v0.31.0
- initialize database schema for core entities
- implement decentralized web node runtime with WASM enclave
- update chain registry for Sonr testnet
### Fix
- database migration issues for initial setup
- improve error message clarity during vault refresh
### Refactor
- centralize version bumping configuration
- streamline project dependencies and configurations for maintainability
- relocate vaults testing directory
- migrate enclave to motr for improved architecture
- improve readability of key string conversion
- move WebAuthn function queries to dedicated file
- Populate cosmos registry with http_get function
- consolidate task configurations for improved maintainability
- relocate deployment configuration to
- streamline enclave build and deployment process
- migrate configuration and metadata fields to for improved flexibility
- migrate database schema definitions to standard location
- streamline dependencies by removing unused caching library
- simplify vault actor initialization
- enclave init
- replace ExampleData with comprehensive DID state management
- relocate devbox configuration for SQLite support
- replace task-based commands with direct wrangler scripts in devbox.json
- reorganize module imports for clarity
- rename migrations directory for clarity
- rename marketapi package for clarity
- move migrations to sqlite specific directory
- reorganize coins module for improved maintainability
- move proto definitions to separate packages for better organization
+197
View File
@@ -0,0 +1,197 @@
# Sonr Blockchain Constitution
## Preamble
We, the members of the Sonr Network Community, establish this Constitution to govern the decentralized ecosystem built upon the principles of self-sovereign identity, user-controlled authentication, and distributed consensus. This Constitution defines the governance framework for the Sonr blockchain, operated under the stewardship of the Decentralized Identity DAO LC (diDAO), a Wyoming Decentralized Unincorporated Nonprofit Association (DUNA), dedicated to advancing decentralized identity infrastructure for the benefit of all participants.
The Sonr Network operates through a dual-token system, with SNR serving as the governance token and uSNR as the base denomination, enabling democratic participation while maintaining operational efficiency through authentication-based revenue generation and cryptographic security anchored in users personal Motr vaults.
This Constitution serves as the immutable foundation of our governance, establishing the rights, responsibilities, and procedures that will guide Sonr through technological evolution, regulatory changes, and societal transformation while maintaining our core mission of human-centric identity protection for the next 100 years and beyond.
## Article I: Mission, Values, and Foundational Principles
### Section 1: Constitutional Mission
The Sonr Network commits to building a Digital Identity System capable of protecting humanity for the next 100 years and beyond. This network serves as a perpetual guardian of human digital identity, balancing technological innovation with fundamental rights protection through democratic governance, technical excellence, and unwavering commitment to privacy.
### Section 2: Core Values and Inviolable Principles
The Sonr Network operates on these inviolable principles that form the bedrock of all network operations.
Human Sovereignty establishes that every individual possesses inherent rights to control their digital identity and personal data. The network recognizes that identity ownership represents a fundamental human right that cannot be compromised, transferred to third parties, or subjected to external control mechanisms.
Privacy by Design requires that privacy protection must be embedded at the protocol level, not added as an afterthought. All network operations implement privacy-preserving technologies by default, ensuring user data remains confidential and secure throughout all interactions and transactions.
Decentralization mandates that no single entity shall control identity verification, data access, or governance processes. The network maintains distributed control across validators, token holders, and the broader community to prevent centralized points of failure or manipulation.
Interoperability ensures that identity solutions must work seamlessly across all chains and systems. Users maintain consistent identity across different platforms and applications while preserving privacy and security, enabling universal digital identity portability.
Perpetual Accessibility requires that the network must remain accessible to all humanity regardless of technological sophistication, economic status, geographic location, or any other discriminating factors. Universal usability and inclusion remain paramount design considerations.
Quantum Resilience mandates that all cryptographic systems must evolve proactively to maintain security against emerging threats, including quantum computing advances and other technological developments that could compromise traditional security models.
### Section 3: Rights and Obligations
All users of the Sonr Network possess these inalienable rights. Identity Sovereignty encompasses complete ownership and control over ones digital identity and associated data, with no external entity possessing override authority over individual identity decisions. Selective Disclosure provides the ability to share only necessary information for specific purposes, maintaining privacy while enabling required verifications and interactions. Data Portability ensures freedom to export identity data and migrate between systems without restriction or penalty, preventing vendor lock-in and maintaining user autonomy. Consent Granularity delivers fine-grained control over data usage permissions, allowing users to specify exactly how, when, and where their information may be utilized. Erasure Rights enable users to request deletion of personal data in compliance with privacy regulations while maintaining network integrity and security. Access Equality guarantees equal access to network services regardless of stake size, geographic location, or socioeconomic status, ensuring universal participation opportunities.
All network participants accept these fundamental obligations. Privacy Protection requires commitment to protecting user privacy and data sovereignty through both technical implementation and operational practices. Network Security encompasses responsibility to maintain network integrity, report vulnerabilities through appropriate channels, and contribute to overall system resilience. Governance Participation mandates active participation in governance processes when holding staked tokens, ensuring democratic legitimacy through stakeholder engagement. Regulatory Compliance involves adherence to applicable laws while preserving user privacy and maintaining the networks decentralized character. Transparency requires open communication about network operations, decision-making processes, and any conflicts of interest that might affect network governance.
### Section 4: Identity-Specific Governance Framework
The network implements multi-level verification tiers ranging from self-attested to cryptographically verified credentials. Privacy-preserving verification utilizes zero-knowledge proofs to enable authentication without revealing underlying personal data. Decentralized reputation systems provide community-driven trust mechanisms while maintaining user anonymity. Biometric data protection standards ensure the highest level of security for biological identifiers. Recovery mechanisms for compromised identities include social recovery protocols and hardware security module integration.
Governance approval processes determine authorization for trusted credential issuers within the network ecosystem. Standardized schemas for common credentials enable interoperability while maintaining flexibility for emerging use cases. Privacy-preserving credential revocation mechanisms allow for credential invalidation without compromising user privacy. Cross-chain recognition agreements establish mutual credential recognition with other blockchain networks and traditional identity systems.
All network operations collect only essential data required for stated purposes, implementing selective disclosure by default across all interactions. Zero-knowledge proofs enable verification without data revelation whenever technically feasible. Sensitive data receives encryption protection both at rest and in transit using industry-leading cryptographic standards. Users maintain granular consent management systems enabling fine-tuned control over data access and usage permissions. Real-time data access logs provide complete transparency regarding who accessed what information and when. Immediate revocation capabilities allow users to withdraw consent and access permissions instantly. Complete data portability ensures users can export their identity data and migrate between systems without restrictions.
### Section 5: Long-Term Sustainability and Evolution
The network commits to hundred-year sustainability through establishment of endowment funds sourced from the community treasury. Technology-agnostic governance frameworks ensure adaptability as underlying technologies evolve over decades. Succession planning addresses all critical roles to prevent single points of failure across extended timeframes. Regular ten-year strategic reviews assess network direction and adjust long-term planning accordingly.
Annual governance effectiveness reviews evaluate and improve decision-making processes based on outcomes and community feedback. Adaptive parameter adjustment mechanisms enable network optimization based on growth patterns and usage metrics. Continuous integration of privacy-enhancing technologies ensures the network remains at the forefront of privacy protection. Proactive regulatory compliance updates anticipate and address changing legal landscapes across multiple jurisdictions.
Emergency response protocols address potential network disruptions, security breaches, and governance attacks. Crisis management procedures enable rapid response while maintaining democratic oversight and accountability. Validator coordination mechanisms ensure network continuity during technical emergencies or coordinated attacks. Recovery procedures establish clear processes for restoring normal operations following any network disruption.
### Section 6: Technical Standards and Compliance
Full compliance with W3C Decentralized Identifier specifications includes proper DID Method implementation and registration with appropriate standards bodies. Verifiable Credentials standards adherence ensures interoperability with existing and emerging digital credential ecosystems. Resolution and dereferencing compatibility enables seamless integration with external systems and applications. Cross-platform interoperability requirements ensure broad accessibility across different technological platforms.
Implementation of NIST post-quantum standards including FIPS 203, 204, and 205 algorithms ensures long-term security against quantum computing threats. Cryptographic agility enables smooth transitions between cryptographic algorithms as new standards emerge. Emergency upgrade procedures address immediate cryptographic threats through rapid deployment mechanisms. Regular security audits verify quantum resistance and overall cryptographic security posture.
GDPR data protection requirements integration ensures European privacy standard compliance while maintaining decentralized architecture. CCPA privacy rights implementation provides California residents with required privacy protections and controls. Cross-jurisdictional privacy standards ensure broad regulatory compliance across multiple legal frameworks. User consent and data sovereignty mechanisms provide granular control while meeting regulatory requirements.
### Section 7: Constitutional Supremacy and Immutable Provisions
This Constitution represents the supreme governance document of the Sonr Network. Any governance proposal, validator action, network upgrade, or diDAO decision that contradicts these constitutional provisions shall be considered null and void.
The following provisions cannot be amended through any governance mechanism: the core mission of protecting human digital identity sovereignty for the next century and beyond, privacy-by-design requirements embedded in all network operations and future developments, user data ownership rights and control mechanisms ensuring individual autonomy, decentralization principles preventing any form of centralized control or authority, and the commitment to serve all of humanitys identity needs regardless of technological evolution.
## Article II: Token Economics
### Section 1: Token Structure
The governance token SNR serves as the primary token for network governance, staking, and ecosystem participation. The base denomination uSNR represents the smallest unit of account, where 1 SNR equals 1,000,000 uSNR. The network maintains a fixed maximum supply of 1,000,000,000 SNR tokens to ensure economic predictability and scarcity preservation.
### Section 2: Token Distribution
The genesis distribution of SNR tokens shall be allocated across four primary categories to ensure balanced ecosystem development and sustainable growth.
Community and Ecosystem allocation of 45% supports broad network adoption and long-term sustainability. Public Distribution receives 15% to ensure democratic access and widespread token ownership. Community Treasury obtains 15% for governance-directed initiatives and ecosystem development. Ecosystem Development Fund captures 10% for strategic partnerships, integrations, and technology advancement. Validator Rewards Pool secures 5% for initial network security incentives.
Network Development allocation of 25% ensures continued technical advancement and operational excellence. Core Protocol Development receives 10% for fundamental blockchain infrastructure and identity protocol enhancement. Infrastructure and Operations obtains 8% for network maintenance, security monitoring, and operational support. Security and Audits captures 4% for comprehensive security assessments, penetration testing, and vulnerability remediation. Research and Innovation secures 3% for experimental technologies and future-oriented development initiatives.
The diDAO Foundation allocation of 15% provides institutional stability and strategic guidance. Foundation Reserve receives 10% for long-term operational sustainability and emergency response capabilities. Strategic Partnerships obtains 5% for critical alliance formation and ecosystem expansion initiatives.
Contributors and Team allocation of 15% recognizes the human capital essential for network success. Core Team receives 10% acknowledging the foundational work and ongoing commitment of primary developers and leaders. Advisors obtain 3% compensating strategic guidance and domain expertise. Early Contributors secure 2% recognizing initial community builders and supporters.
### Section 3: Vesting and Unlock Schedules
Community allocations provide immediate availability for public distribution while treasury and ecosystem funds remain subject to governance proposals ensuring democratic control over resource allocation. Network Development follows a six-month cliff period followed by linear vesting over 36 months to align long-term incentives with network development goals. The diDAO Foundation implements a twelve-month cliff followed by linear vesting over 48 months ensuring institutional stability while preventing premature token concentration. Contributors and Team follow a twelve-month cliff with linear vesting over 48 months aligning personal incentives with long-term network success.
### Section 4: Revenue Mechanisms
The network generates sustainable revenue through authentication service fees paid in uSNR, creating direct utility for the native token. Motr vault operation fees provide enhanced security features while maintaining basic functionality accessibility. Verification and attestation services offer tiered pricing based on verification complexity and security requirements. Cross-chain identity bridge operations generate fees for interoperability services across different blockchain ecosystems. Smart contract execution fees for identity operations ensure computational resources remain fairly compensated.
## Article III: Governance Structure
### Section 1: The diDAO Foundation
The Decentralized Identity DAO LC, organized as a Wyoming DUNA, serves as the steward of the Sonr Network. The foundation assumes responsibility for protocol governance coordination ensuring democratic processes remain effective and inclusive. Treasury management oversight provides fiscal responsibility while maintaining transparency and accountability. Ecosystem development initiatives support strategic growth and partnership formation. Legal representation and compliance ensure regulatory adherence while protecting network decentralization. Strategic partnership facilitation connects the network with compatible organizations and technologies.
### Section 2: Governance Bodies
SNR Token Holders possess ultimate decision-making authority within the governance framework. Proposal voting rights operate proportionally to staked SNR holdings ensuring democratic representation while incentivizing network participation. A minimum requirement of 100 SNR enables proposal submission, maintaining accessibility while preventing spam and frivolous governance actions.
The Validator Assembly handles technical governance and protocol upgrades ensuring network security and performance optimization. Network security and performance monitoring provides continuous oversight of critical infrastructure. A minimum self-bonded stake requirement of 50,000 SNR ensures validator commitment and alignment with network success.
The Identity Council comprises seven elected members serving twelve-month terms providing specialized governance oversight. The council oversees identity standards and authentication protocols ensuring technical excellence and user protection. Council members review and recommend governance proposals offering expert analysis and community guidance.
### Section 3: Voting Mechanisms
Standard Proposals require simple majority approval exceeding 50% with a 20% quorum ensuring broad community participation in routine governance decisions. Protocol Upgrades demand supermajority approval exceeding 66.7% with a 33% quorum reflecting the critical nature of technical changes. Constitutional Amendments require supermajority approval exceeding 75% with a 40% quorum protecting fundamental network principles from hasty modification. Emergency Actions enable Identity Council approval through 5 of 7 members for time-sensitive security matters requiring rapid response capabilities.
### Section 4: Proposal Process
Submission requires a 100 SNR deposit returned upon proposal reaching quorum, ensuring serious proposals while maintaining accessibility. A seven-day discussion period enables community review and debate fostering informed decision-making. A seven-day voting period provides token holder participation opportunities while maintaining governance efficiency. Implementation includes a 48-hour timelock for non-emergency proposals ensuring final review and preventing malicious governance attacks.
## Article IV: Network Operations
### Section 1: Validation and Consensus
Validator requirements include a minimum self-bonded stake of 50,000 SNR ensuring significant skin in the game for network security participants. Maximum total delegation caps at 10% of total staked SNR preventing excessive centralization and maintaining distributed control. Technical specifications remain determined by the Validator Assembly ensuring expertise guides infrastructure requirements.
The consensus mechanism implements Proof-of-Stake consensus with Byzantine Fault Tolerance ensuring network security and finality. Block time targets and finality parameters operate under protocol control enabling optimization based on network performance and user experience requirements.
### Section 2: Staking and Rewards
Staking parameters establish a minimum delegation of 10 SNR ensuring broad accessibility while maintaining meaningful participation thresholds. The unbonding period extends 21 days providing security against rapid stake manipulation while enabling legitimate validator changes. Automatic compounding remains available for delegators seeking to maximize staking returns through compound interest effects.
Reward distribution includes block rewards sourced from the Validator Rewards Pool ensuring sustainable validator compensation. Transaction fees distribute proportionally to validators and delegators aligning incentives with network usage and security provision. Authentication service revenue sharing with active validators creates additional income streams beyond traditional staking rewards.
### Section 3: Motr Vault Integration
The Motr serves as users personal cryptographic key vault providing fundamental identity infrastructure. Secure key generation and storage ensures cryptographic security while maintaining user control and accessibility. Authentication credential management enables seamless interaction with applications and services across the ecosystem. Cross-application identity portability allows users to maintain consistent identity across different platforms and use cases. Recovery mechanisms through social recovery or hardware security modules provide security without sacrificing usability. Integration with the networks UCAN authorization system enables granular permission management and secure authentication flows.
## Article V: Treasury and Funding
### Section 1: Community Treasury
The Community Treasury receives initial funding of 15% of total supply supporting ecosystem development and community initiatives. Ecosystem development grants provide funding for projects advancing network adoption and technological innovation. Security audits and bug bounties ensure network security through professional assessment and community-driven vulnerability discovery. Community initiatives and events foster engagement and education within the ecosystem. Emergency response funding enables rapid action during critical situations requiring immediate resource deployment. Strategic acquisitions or partnerships support network growth through consolidation or alliance formation.
### Section 2: Treasury Management
Disbursement limits ensure appropriate oversight commensurate with funding amounts. Expenditures below 10,000 SNR require Identity Council approval enabling efficient small-scale funding decisions. Expenditures between 10,000 and 100,000 SNR require standard proposal approval ensuring democratic oversight of moderate expenditures. Expenditures exceeding 100,000 SNR demand supermajority proposal approval protecting community assets from inappropriate large-scale spending.
Transparency requirements include quarterly treasury reports providing regular community updates on fund utilization and remaining resources. Real-time on-chain tracking enables continuous monitoring of treasury activities and expenditures. Annual third-party audits ensure fiscal responsibility and identify potential improvements in treasury management practices.
### Section 3: Fee Structure
Network fees collected in uSNR create sustainable revenue streams for network operations and development. Base Transaction Fees adjust dynamically based on network congestion ensuring fair pricing while maintaining network accessibility. Authentication Service Fees operate under service provider control with minimum network fees applied ensuring baseline revenue generation. Storage Fees calculate based on data size and retention period reflecting actual resource consumption and infrastructure costs. Identity Verification Fees implement tiered pricing based on verification level ensuring appropriate compensation for different security and verification requirements.
## Article VI: Security and Compliance
### Section 1: Security Measures
Slashing conditions protect network integrity through economic penalties for malicious or negligent behavior. Double signing results in a 5% stake slash ensuring validators maintain proper key security and operational procedures. Prolonged downtime triggers a 0.1% stake slash incentivizing reliable validator performance and network availability. Governance attacks may result in stake slashing up to 100% protecting democratic processes from manipulation or coordinated attacks.
Emergency response capabilities enable rapid action during critical situations. Identity Council emergency powers address critical vulnerabilities requiring immediate intervention beyond normal governance timelines. Validator Assembly coordination manages network halts and recovery procedures ensuring orderly response to technical emergencies. Emergency action periods limit to maximum 72 hours preventing abuse while enabling necessary rapid response capabilities.
### Section 2: Compliance Framework
The diDAO ensures regulatory compliance through structured legal and operational frameworks. KYC and AML procedures apply to high-value transactions where required by applicable law ensuring legal compliance while preserving network accessibility. Sanctions screening for validator operations ensures compliance with international law while maintaining decentralized operation principles. Tax reporting assistance supports network participants in meeting legal obligations while preserving privacy where legally permissible. Regulatory liaison and legal representation provide professional advocacy and compliance guidance across multiple jurisdictions.
## Article VII: Amendments and Governance Evolution
### Section 1: Amendment Process
Constitutional amendments require formal proposal submission with detailed rationale ensuring thoughtful consideration of fundamental changes. A thirty-day discussion period enables comprehensive community review and debate fostering informed democratic decision-making. Approval requires 75% support with 40% quorum protecting constitutional stability while enabling necessary evolution. A seven-day implementation timelock provides final review opportunity and prevents malicious constitutional manipulation.
### Section 2: Transition Provisions
The initial parameter adjustment period spanning the first 180 days allows parameter changes via supermajority vote enabling network optimization during early operation. Foundation transition processes transfer diDAO operational control to full DAO governance after 24 months ensuring decentralization progression while maintaining initial stability. Vesting acceleration through governance vote may occur during extraordinary circumstances providing flexibility while protecting long-term incentive alignment.
### Section 3: Dispute Resolution
Technical disputes receive resolution through Validator Assembly expertise ensuring appropriate technical knowledge guides infrastructure decisions. Governance disputes undergo arbitration by Identity Council providing specialized oversight of democratic processes and constitutional interpretation. Constitutional disputes require referral to external arbitration under Wyoming DUNA framework ensuring neutral resolution of fundamental disagreements. User disputes utilize community-selected arbitrators providing peer-based resolution mechanisms for interpersonal conflicts.
## Article VIII: Implementation and Final Provisions
### Section 1: Effective Date and Ratification
This Constitution becomes effective upon mainnet genesis block production and ratification by the initial validator set ensuring democratic legitimacy from network inception.
### Section 2: Legal Framework
If any provision of this Constitution becomes invalid or unenforceable, the remaining provisions shall continue in full force and effect ensuring constitutional stability despite potential legal challenges. The Identity Council provides non-binding interpretative guidance for constitutional questions while maintaining democratic oversight of interpretation. Ambiguities receive resolution favoring decentralization and user sovereignty ensuring alignment with fundamental network principles. Technical specifications undergo interpretation by Validator Assembly ensuring appropriate expertise guides infrastructure decisions.
### Section 3: Legacy and Evolution
This Constitution establishes Sonr as a perpetual guardian of human digital identity, balancing technological innovation with fundamental rights protection. Through democratic governance, technical excellence, and unwavering commitment to privacy, the Sonr Network shall serve humanitys identity needs for the next century and beyond. The provisions herein create a resilient framework capable of evolving with technology while maintaining core principles that respect human dignity, ensure data sovereignty, and enable secure digital interactions for all.
By ratifying this Constitution, the Sonr community commits to building and maintaining a digital identity system that respects human dignity, ensures data sovereignty, and enables secure digital interactions for all participants while maintaining democratic governance and technological excellence throughout the networks centennial mission.
---
- _Ratified by the Sonr Network Community_
- _Stewarded by the Decentralized Identity DAO LC (diDAO)_
- _**Empowering Self-Sovereign Identity Through Distributed Consensus**_
+93
View File
@@ -0,0 +1,93 @@
# Caddy reverse proxy configuration for Sonr services
{
# Global options
admin off
auto_https off
# Enable debug mode for development
debug
}
# Health check endpoint
:80/health {
respond "OK" 200
}
# REST API proxy (Cosmos SDK)
:80/api/* {
reverse_proxy snrd:1317
header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"
header Access-Control-Allow-Headers "Content-Type, Authorization"
}
# gRPC-Web proxy
:80/grpc/* {
reverse_proxy h2c://snrd:9090
header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "GET, POST, OPTIONS"
header Access-Control-Allow-Headers "Content-Type, x-grpc-web, x-user-agent"
}
# JSON-RPC proxy (EVM)
:80/rpc {
reverse_proxy snrd:8545
header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "POST, OPTIONS"
header Access-Control-Allow-Headers "Content-Type"
}
# WebSocket JSON-RPC proxy (EVM)
:80/ws {
reverse_proxy snrd:8546
header Access-Control-Allow-Origin *
}
# Highway service proxy
:80/highway/* {
reverse_proxy highway:8090
header Access-Control-Allow-Origin *
header Access-Control-Allow-Methods "GET, POST, OPTIONS"
header Access-Control-Allow-Headers "Content-Type, Authorization"
}
# Production configuration with TLS (when CADDY_DOMAIN is set)
{$CADDY_DOMAIN:localhost} {
# TLS configuration for production
@production {
not host localhost
}
tls @production {
# Automatic HTTPS with Let's Encrypt
}
# Same proxy rules as above
handle /health {
respond "OK" 200
}
handle /api/* {
reverse_proxy snrd:1317
}
handle /grpc/* {
reverse_proxy h2c://snrd:9090
}
handle /rpc {
reverse_proxy snrd:8545
}
handle /ws {
reverse_proxy snrd:8546
}
handle /highway/* {
reverse_proxy highway:8090
}
# Default handler
handle {
respond "Sonr Network Gateway" 200
}
}
Regular → Executable
+153 -74
View File
@@ -1,89 +1,168 @@
FROM jetpackio/devbox:latest AS sonrvm
# Installing your devbox project
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
RUN devbox run -- echo "Installed Packages."
ENTRYPOINT ["devbox", "run"]
# --------------------------------------------------------
FROM jetpackio/devbox:latest AS sonr-runner
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . .
RUN devbox run -- echo "Installed Packages."
RUN git config --global --add safe.directory /code
ENTRYPOINT ["devbox", "run", "testnet"]
# --------------------------------------------------------
FROM golang:1.22-alpine AS go-builder
# Use build argument for base image to allow using pre-cached base
ARG BASE_IMAGE=golang:1.24.7-alpine3.22
FROM ${BASE_IMAGE} AS builder
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
RUN apk add --no-cache ca-certificates build-base git
# Install build dependencies
RUN apk add --no-cache \
ca-certificates \
build-base \
git \
linux-headers \
bash \
binutils-gold \
wget
WORKDIR /code
COPY go.mod go.sum ./
RUN set -eux; \
export ARCH=$(uname -m); \
WASM_VERSION=$(go list -m all | grep github.com/CosmWasm/wasmvm || true); \
if [ ! -z "${WASM_VERSION}" ]; then \
WASMVM_REPO=$(echo $WASM_VERSION | awk '{print $1}');\
WASMVM_VERS=$(echo $WASM_VERSION | awk '{print $2}');\
wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\
fi; \
go mod download;
# Copy entire source code (including crypto module)
COPY . .
# Copy over code
COPY . /code
# Fix git ownership issue
RUN git config --global --add safe.directory /code
# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/sonrd
# then ensure static linking
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/build/sonrd \
&& echo "Ensuring binary is statically linked ..." \
&& (file /code/build/sonrd | grep "statically linked")
# Download WasmVM library
RUN --mount=type=cache,target=/tmp/wasmvm \
set -eux; \
export ARCH=$(uname -m); \
WASM_VERSION=$(go list -m all | grep github.com/CosmWasm/wasmvm | head -1 || echo ""); \
if [ ! -z "${WASM_VERSION}" ]; then \
WASMVM_REPO=$(echo $WASM_VERSION | awk '{print $1}'); \
WASMVM_VERS=$(echo $WASM_VERSION | awk '{print $2}'); \
WASMVM_FILE="libwasmvm_muslc.${ARCH}.a"; \
if [ ! -f "/tmp/wasmvm/${WASMVM_FILE}" ]; then \
wget -O "/tmp/wasmvm/${WASMVM_FILE}" "https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/${WASMVM_FILE}"; \
fi; \
cp "/tmp/wasmvm/${WASMVM_FILE}" /lib/libwasmvm_muslc.a; \
fi
# Download Go modules
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
# Build binary with optimizations
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
set -eux; \
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev"); \
COMMIT=$(git log -1 --format='%H' 2>/dev/null || echo "unknown"); \
LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true \
CGO_ENABLED=1 GOOS=linux \
go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name=sonr \
-X github.com/cosmos/cosmos-sdk/version.AppName=snrd \
-X github.com/cosmos/cosmos-sdk/version.Version=${VERSION} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${COMMIT} \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger,muslc \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-buildvcs=false \
-trimpath \
-o /code/build/snrd \
./cmd/snrd; \
file /code/build/snrd; \
echo "Ensuring binary is statically linked ..."; \
(file /code/build/snrd | grep "statically linked")
# --------------------------------------------------------
FROM debian:11-slim
# Highway service build stage
FROM ${BASE_IMAGE} AS highway-builder
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
# Install build dependencies
RUN apk add --no-cache \
ca-certificates \
build-base \
git \
linux-headers \
bash
# Install dependencies for Debian 11
RUN apt-get update && apt-get install -y \
curl \
make \
bash \
jq \
sed \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /code
COPY scripts/test_node.sh /usr/bin/test_node.sh
# Copy entire source code
COPY . .
# Fix git ownership issue
RUN git config --global --add safe.directory /code
# Download Go modules
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
go mod download
# Build Highway binary with optimizations
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
set -eux; \
VERSION=$(git describe --tags --always 2>/dev/null || echo "dev"); \
COMMIT=$(git log -1 --format='%H' 2>/dev/null || echo "unknown"); \
CGO_ENABLED=1 GOOS=linux \
go build \
-mod=readonly \
-tags "netgo" \
-ldflags "-X main.Version=${VERSION} \
-X main.Commit=${COMMIT} \
-w -s -linkmode=external -extldflags '-static'" \
-buildvcs=false \
-trimpath \
-o /code/build/hway \
./cmd/hway; \
file /code/build/hway; \
echo "Ensuring binary is statically linked ..."; \
(file /code/build/hway | grep "statically linked")
# --------------------------------------------------------
# Highway runtime image
FROM alpine:3.17 AS highway
LABEL org.opencontainers.image.title="Sonr Highway Service"
LABEL org.opencontainers.image.source="https://github.com/sonr-io/sonr"
# Copy binary from builder
COPY --from=highway-builder /code/build/hway /usr/bin/hway
# Install runtime dependencies
RUN apk add --no-cache ca-certificates wget
# Create non-root user
RUN adduser -D -u 1000 highway
# Set working directory
WORKDIR /home/highway
# Switch to non-root user
USER highway
# Health check endpoint
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --spider -q http://localhost:8090/health || exit 1
# Expose Highway port
EXPOSE 8090
# Set default command
ENTRYPOINT ["/usr/bin/hway"]
# --------------------------------------------------------
# Final minimal runtime image (default target for snrd)
FROM alpine:3.17
LABEL org.opencontainers.image.title="Sonr Daemon"
LABEL org.opencontainers.image.source="https://github.com/sonr-io/sonr"
# Copy binary from build stage
COPY --from=builder /code/build/snrd /usr/bin
COPY --from=builder /lib/libwasmvm_muslc.a /lib/libwasmvm_muslc.a
COPY --from=builder /code/scripts/test_node.sh /usr/bin/testnet
RUN chmod +x /usr/bin/testnet
# Set up dependencies
ENV PACKAGES="curl make bash jq sed"
# Install minimum necessary dependencies
RUN apk add --no-cache $PACKAGES
WORKDIR /opt
# rest server, tendermint p2p, tendermint rpc
EXPOSE 1317 26656 26657 6060
ENTRYPOINT ["/usr/bin/sonrd"]
+371 -263
View File
@@ -1,24 +1,34 @@
#!/usr/bin/make -f
# Default target - show help when no target specified
.DEFAULT_GOAL := help
PACKAGE_NAME := github.com/sonr-io/sonr
GORELEASER_VERSION ?= latest
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
GOLANGCI_VERSION := v1.62.2
LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BINDIR ?= $(GOPATH)/bin
SIMAPP = ./app
GIT_ROOT := $(shell git rev-parse --show-toplevel)
PC_PORT_NUM=42069
PC_LOG_FILE=./sonr.log
PC_SOCKET_PATH=/tmp/sonr-net.sock
# for dockerized protobuf tools
DOCKER := $(shell which docker)
HTTPS_GIT := github.com/onsonr/sonr.git
PROCESS_COMPOSE := $(shell which process-compose)
# Git configuration
HTTPS_GIT := github.com/sonr-io/sonr.git
export GO111MODULE = on
# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --tags --always)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif
# process build tags
build_tags = netgo
@@ -57,11 +67,16 @@ comma := ,
build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags))
# process linker flags
# flags '-s -w' resolves an issue with xcode 16 and signing of go binaries
# ref: https://github.com/golang/go/issues/63997
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sonr \
-X github.com/cosmos/cosmos-sdk/version.AppName=sonrd \
-X github.com/cosmos/cosmos-sdk/version.AppName=snrd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-checklinkname=0 \
-s -w
ifeq ($(WITH_CLEVELDB),yes)
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
@@ -74,311 +89,404 @@ ldflags := $(strip $(ldflags))
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
# The below include contains the tools and runsim targets.
include contrib/devtools/Makefile
all: install lint test
all: help
build: go.sum
ifeq ($(OS),Windows_NT)
$(error wasmd server not supported. Use "make build-windows-client" for client)
exit 1
else
go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd ./cmd/sonrd
endif
start: docker
@gum log --level info "Starting all services..."
@devbox services up
build-windows-client: go.sum
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd.exe ./cmd/sonrd
build-contract-tests-hooks:
ifeq ($(OS),Windows_NT)
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
else
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
endif
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
stop:
@gum log --level info "Stopping all services..."
@devbox services stop
@$(MAKE) clean-docker
########################################
### Tools & dependencies
########################################
format: go-format ts-format
go-format:
@gum log --level info "Formatting Go code with gofumpt and goimports..."
@if command -v gofumpt > /dev/null; then \
gofumpt -w .; \
else \
go run -mod=readonly mvdan.cc/gofumpt@latest -w .; \
fi
@if command -v goimports > /dev/null; then \
goimports -w .; \
else \
go run -mod=readonly golang.org/x/tools/cmd/goimports@latest -w .; \
fi
@gum log --level info "✅ Code formatted"
ts-format:
@gum log --level info "Formatting all web applications..."
@pnpm biome format --config-path=$(PWD)/biome.json .
lint: go-lint ts-lint
go-lint:
@gum log --level info "Running golangci-lint..."
@if command -v golangci-lint > /dev/null; then \
golangci-lint run --timeout=10m; \
else \
docker run --rm -v $$(pwd):/app -w /app \
-v ~/.cache/golangci-lint:/root/.cache/golangci-lint \
golangci/golangci-lint:$(GOLANGCI_VERSION) \
golangci-lint run --timeout=10m; \
fi
ts-lint:
@gum log --level info "Running Biome linter with auto-fix for TypeScript projects..."
@pnpm biome lint --config-path=./biome.json --write .
.PHONY: lint go-lint ts-lint format
go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@gum log --level info "Download go modules to local cache"
@go mod download
go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
@gum log --level info "Ensure dependencies have not been modified"
@go mod tidy
@go mod verify
pnpm-install:
@gum log --level info "Installing pnpm dependencies"
@pnpm install
draw-deps:
@# requires brew install graphviz or apt-get install graphviz
go install github.com/RobotsAndPencils/goviz@latest
@goviz -i ./cmd/sonrd -d 2 | dot -Tpng -o dependency-graph.png
@goviz -i ./cmd/snrd -d 2 | dot -Tpng -o .github/assets/dependency-graph.png
clean:
rm -rf .aider*
rm -rf static
rm -rf .out
rm -rf hway.db
rm -rf snapcraft-local.yaml build/
rm -rf build
distclean: clean
rm -rf vendor/
tidy:
@go mod tidy
@make -C client tidy
@make -C crypto tidy
@make -C cmd/hway tidy
@make -C cmd/motr tidy
@make -C cmd/vault tidy
init-env:
@echo "Installing process-compose"
sh scripts/init_env.sh
clean: tidy
@gum log --level info "Cleaning build artifacts..."
rm -rf snapcraft-local.yaml build/ dist/
@$(MAKE) -C cmd/snrd clean
@$(MAKE) -C cmd/hway clean
@$(MAKE) -C cmd/vault clean
@$(MAKE) -C cmd/motr clean
clean-docker:
@gum log --level info "Removing all Docker volumes and networks..."
@rm -rf .logs
@docker compose down -v
@docker network prune -f
@docker volume prune -f
###############################################################################
### Build Targets ###
###############################################################################
install: go.sum
@$(MAKE) -C cmd/snrd install LEDGER_ENABLED=$(LEDGER_ENABLED) WITH_CLEVELDB=$(WITH_CLEVELDB) LINK_STATICALLY=$(LINK_STATICALLY) BUILD_TAGS="$(BUILD_TAGS)"
build: go.sum
@$(MAKE) -C cmd/snrd build LEDGER_ENABLED=$(LEDGER_ENABLED) WITH_CLEVELDB=$(WITH_CLEVELDB) LINK_STATICALLY=$(LINK_STATICALLY) BUILD_TAGS="$(BUILD_TAGS)"
build-snrd: build
build-client: go.sum build-vault build-motr
@$(MAKE) -C client build
@cd /tmp && go mod init test || true
@cd /tmp && go get github.com/sonr-io/sonr/client@main || true
@cd /tmp && gum log --level info "Client SDK import successful"
build-hway: go.sum build-vault build-motr
@$(MAKE) -C cmd/hway build
build-vault:
@$(MAKE) -C cmd/vault build
build-motr: ## Build Motor WASM service worker
@$(MAKE) -C cmd/motr build
# Build all components in parallel
build-all: go.sum
@gum log --level info "Building all components in parallel..."
@$(MAKE) -j5 build build-hway build-client build-motr build-vault
@gum log --level info "✅ All components built successfully"
.PHONY: install build build-client build-hway build-snrd build-vault build-motr build-all
########################################
### Testing
### Docker & Services
########################################
docker:
@gum log --level info "Building Docker images..."
@bash scripts/containers.sh build-all
localnet: ## Cross-platform localnet (auto-detects best method for your system)
@bash scripts/cross_platform_localnet.sh
dockernet:
@gum log --level info "Starting network with Docker in detached mode..."
@docker stop sonr-testnode 2>/dev/null || true
@docker rm sonr-testnode 2>/dev/null || true
@sleep 3
@CHAIN_ID="sonrtest_1-1" BLOCK_TIME="1000ms" CLEAN=true FORCE_DOCKER=true DOCKER_DETACHED=true bash scripts/test_node.sh
.PHONY: docker localnet dockernet
########################################
### Prepare Scripts - AI & Release Automation
########################################
# Smart component release detection and automation
release:
@$(MAKE) -C cmd/hway release
@$(MAKE) -C cmd/motr release
@$(MAKE) -C cmd/snrd release
@$(MAKE) -C cmd/vault release
# Snapshot builds for development
snapshot:
@gum log --level info "📦 Preparing component snapshot..."
@$(MAKE) -C cmd/vault snapshot
@$(MAKE) -C cmd/motr snapshot
@$(MAKE) -C cmd/snrd snapshot
@$(MAKE) -C cmd/hway snapshot
.PHONY: release snapshot
########################################
### Testing - Simplified
########################################
# Main test targets
test: test-unit
test-all: test-race test-cover test-system
test-all: test-race test-cover
test-unit:
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./...
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock test' ./...
test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock test' ./...
test-cover:
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock test' ./...
benchmark:
test-e2e:
@gum log --level info "Running basic e2e tests"
@cd test/e2e && go test -race -v -run TestBasic ./tests/basic
test-e2e-all:
@gum log --level info "Running all e2e tests"
@cd test/e2e && go test -race -v ./tests/...
test-build-snrd: build
@ls -la build/snrd
@chmod +x build/snrd
@./build/snrd version
test-build-hway: build-hway
@ls -la build/hway
test-tdd:
go test -json ./... 2>&1 | tdd-guard-go -project-root ${GIT_ROOT}
test-app:
@VERSION=$(VERSION) go test -C . -mod=readonly -tags='ledger test_ledger_mock test' github.com/sonr-io/sonr/app/... github.com/sonr-io/sonr/x/... github.com/sonr-io/sonr/types/... github.com/sonr-io/sonr/internal/...
test-devops:
@echo "No devops tests"
test-client:
@$(MAKE) -C cmd/vault build
@$(MAKE) -C client test
test-crypto:
@$(MAKE) -C crypto test
test-dwn-ci:
@$(MAKE) -C cmd/vault build
@go test -mod=readonly -tags='ledger test_ledger_mock test' -run='!IPFS' ./x/dwn/...
test-internal:
@$(MAKE) -C cmd/vault build
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock test' ./internal/...
# Module testing - Simplified
# MODULE=did|dwn|svc VARIANT=unit|race|cover|bench
test-module:
@if [ -z "$(MODULE)" ]; then \
gum log --level info "Testing all modules..."; \
$(MAKE) test-module MODULE=did; \
$(MAKE) test-module MODULE=dwn; \
$(MAKE) test-module MODULE=svc; \
else \
if [ "$(VARIANT)" = "cover" ]; then \
gum log --level info "Testing x/$(MODULE) with coverage..."; \
go test -mod=readonly -timeout 30m -race -coverprofile=x/$(MODULE)/coverage.txt -covermode=atomic -tags='ledger test_ledger_mock test' ./x/$(MODULE)/...; \
elif [ "$(VARIANT)" = "race" ]; then \
gum log --level info "Testing x/$(MODULE) with race detector..."; \
VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock test' ./x/$(MODULE)/...; \
elif [ "$(VARIANT)" = "bench" ]; then \
gum log --level info "Running x/$(MODULE) benchmarks..."; \
go test -mod=readonly -bench=. ./x/$(MODULE)/...; \
else \
gum log --level info "Testing x/$(MODULE) module..."; \
VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock test' ./x/$(MODULE)/...; \
fi \
fi
# Specialized tests
test-hway:
@gum log --level info "Testing Highway service..."
@VERSION=$(VERSION) go test -C . -mod=readonly -v github.com/sonr-io/sonr/bridge/...
test-proto:
@$(MAKE) -C proto lint
@$(MAKE) -C proto check-breaking
test-motr:
@gum log --level info "Testing Motor WASM service worker..."
@$(MAKE) -C cmd/motr test
test-vault:
@gum log --level info "Testing Vault WASM plugin..."
@$(MAKE) -C cmd/vault test
test-benchmark:
@go test -mod=readonly -bench=. ./...
test-sim-import-export: runsim
@echo "Running application import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport
test-sim-multi-seed-short: runsim
@echo "Running short multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestFullAppSimulation
test-sim-deterministic: runsim
@echo "Running application deterministic simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 1 1 TestAppStateDeterminism
test-system: install
$(MAKE) -C tests/system/ test
###############################################################################
### Linting ###
###############################################################################
format-tools:
go install mvdan.cc/gofumpt@v0.4.0
go install github.com/client9/misspell/cmd/misspell@v0.3.4
go install github.com/daixiang0/gci@v0.11.2
lint: format-tools
golangci-lint run --tests=false
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d
format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gci write --skip-generated -s standard -s default -s "prefix(cosmossdk.io)" -s "prefix(github.com/cosmos/cosmos-sdk)" -s "prefix(github.com/CosmWasm/wasmd)" --custom-order
mod-tidy:
go mod tidy
cd interchaintest && go mod tidy
.PHONY: format-tools lint format mod-tidy
.PHONY: test test-all test-unit test-race test-cover test-tdd test-module test-hway test-motr test-vault test-benchmark
###############################################################################
### Protobuf ###
###############################################################################
protoVer=0.15.1
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
climd-gen:
@gum log --level info "Generating MD Docs from snrd CLI..."
@sh ./scripts/cli-docgen.sh
proto-gen:
@echo "Generating Protobuf files"
@go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@latest
@$(protoImage) sh ./scripts/protocgen.sh
spawn stub-gen
@gum log --level info "Generating Go protobuf files..."
@$(MAKE) -C proto gen
@gum log --level info "Generating TypeScript protobuf files..."
@if [ -d "packages/es" ]; then \
cd packages/es && pnpm gen:protobufs || { gum log --level error "TypeScript protobuf generation failed"; exit 1; }; \
else \
gum log --level warn "Skipping TypeScript generation: packages/es not found"; \
fi
@gum log --level info "Auto-formatting generated protobuf files..."
@$(MAKE) format
proto-format:
@echo "Formatting Protobuf files"
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
swagger-gen:
@$(MAKE) -C proto swagger-gen
@gum log --level info "Moving and renaming generated files..."
@find docs/static/openapi -type f \( -name "query.swagger.yaml" -o -name "tx.swagger.yaml" \) | while read -r filepath; do \
\
parent_dir=$$(dirname "$$filepath"); \
grandparent_dir=$$(dirname "$$parent_dir"); \
module=$$(basename "$$grandparent_dir"); \
filename=$$(basename "$$filepath"); \
\
new_filename="$$module.$$filename"; \
destination="docs/static/openapi/$$new_filename"; \
\
gum log --level debug "Moving $$filepath to $$destination"; \
mv "$$filepath" "$$destination"; \
done
@gum log --level info "Cleaning up empty source directories..."
@find docs/static/openapi -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} +
@gum log --level info "Converting Swagger 2.0 to OpenAPI 3.0..."
@pnpm run convert-swagger
@gum log --level info "✅ API documentation processing complete."
proto-lint:
@$(protoImage) buf lint --error-format=json
templ-gen:
@docker run --rm -v `pwd`:/code -w=/code --user $(shell id -u):$(shell id -g) ghcr.io/a-h/templ:latest generate
proto-check-breaking:
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=master
.PHONY: all install install-debug \
go-mod-cache draw-deps clean build format \
test test-all test-build test-cover test-unit test-race \
test-sim-import-export build-windows-client \
test-system
## --- Testnet Utilities ---
get-localic:
@echo "Installing local-interchain"
git clone --branch v8.7.0 https://github.com/strangelove-ventures/interchaintest.git interchaintest-downloader
cd interchaintest-downloader/local-interchain && make install
@echo ✅ local-interchain installed $(shell which local-ic)
is-localic-installed:
ifeq (,$(shell which local-ic))
make get-localic
endif
get-heighliner:
git clone https://github.com/strangelove-ventures/heighliner.git
cd heighliner && go install
local-image:
ifeq (,$(shell which heighliner))
echo 'heighliner' binary not found. Consider running `make get-heighliner`
else
heighliner build -c sonrd --local -f chains.yaml
endif
.PHONY: get-heighliner local-image is-localic-installed
.PHONY: proto-gen proto-swagger-gen swagger-gen proto-lint proto-check-breaking proto-publish
###############################################################################
### e2e ###
### Network Operations ###
###############################################################################
ictest-basic:
@echo "Running basic interchain tests"
@cd interchaintest && go test -race -v -run TestBasicChain .
# Starship network management
testnet: testnet-restart
ictest-ibc:
@echo "Running IBC interchain tests"
@cd interchaintest && go test -race -v -run TestIBC .
testnet-restart: testnet-stop testnet-start
@gum log --level info "✅ Starship network restarted"
ictest-wasm:
@echo "Running cosmwasm interchain tests"
@cd interchaintest && go test -race -v -run TestCosmWasmIntegration .
testnet-start:
@gum log --level info "Starting Starship network..."
@if [ -z "$(NETWORK)" ]; then \
NETWORK=devnet; \
fi; \
bash scripts/run.sh $$NETWORK
ictest-packetforward:
@echo "Running packet forward middleware interchain tests"
@cd interchaintest && go test -race -v -run TestPacketForwardMiddleware .
testnet-stop:
@gum log --level info "Stopping Starship network..."
@helm delete -n ci sonr-testnet 2>/dev/null || true
@kubectl delete namespace ci --ignore-not-found=true 2>/dev/null || true
@sleep 2
ictest-poa:
@echo "Running proof of authority interchain tests"
@cd interchaintest && go test -race -v -run TestPOA .
ictest-tokenfactory:
@echo "Running token factory interchain tests"
@cd interchaintest && go test -race -v -run TestTokenFactory .
.PHONY: testnet testnet-restart testnet-start testnet-stop
###############################################################################
### testnet ###
### Help ###
###############################################################################
setup-ipfs:
./scripts/ipfs_config.sh
setup-testnet: mod-tidy is-localic-installed install local-image set-testnet-configs setup-testnet-keys
# Run this before testnet keys are added
# chainid-1 is used in the testnet.json
set-testnet-configs:
sonrd config set client chain-id sonr-testnet-1
sonrd config set client keyring-backend test
sonrd config set client output text
# import keys from testnet.json into test keyring
setup-testnet-keys:
-`echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | sonrd keys add acc0 --recover`
-`echo "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise" | sonrd keys add acc1 --recover`
# default testnet is with IBC
testnet: setup-testnet
spawn local-ic start ibc-testnet
testnet-basic: setup-testnet
spawn local-ic start testnet
sh-testnet: mod-tidy
CHAIN_ID="sonr-testnet-1" BLOCK_TIME="1000ms" CLEAN=true sh scripts/test_node.sh
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet
###############################################################################
### generation ###
###############################################################################
.PHONY: gen-pkl gen-templ
gen-pkl: init-env
pkl-gen-go pkl/sonr.orm/UCAN.pkl
pkl-gen-go pkl/sonr.orm/Models.pkl
pkl-gen-go pkl/sonr.conf/Hway.pkl
pkl-gen-go pkl/sonr.conf/Motr.pkl
gen-templ: init-env
templ generate
###############################################################################
### custom builds ###
###############################################################################
.PHONY: build-motr build-hway logs-hway logs-sonr
build-motr:
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
build-hway: gen-templ
go build -o build/hway ./cmd/hway
logs-hway: init-env
bin/process-compose process logs hway --port $(PC_PORT_NUM) --follow
logs-sonr: init-env
bin/process-compose process logs sonr --port $(PC_PORT_NUM) --follow
###############################################################################
### Network Start/Stop ###
###############################################################################
.PHONY: deploy start start-tui start-uds stop stop-uds restart status
start: build-hway init-env
bin/process-compose up --port $(PC_PORT_NUM) --log-file $(PC_LOG_FILE) --detached -f deploy/process-compose.yaml
start-tui: build-hway init-env
bin/process-compose up --port $(PC_PORT_NUM) --log-file $(PC_LOG_FILE) -f deploy/process-compose.yaml
start-uds: build-hway init-env
bin/process-compose up --use-uds --unix-socket $(PC_SOCKET_PATH) --log-file $(PC_LOG_FILE) --detached -f deploy/process-compose.yaml
stop: init-env
bin/process-compose down --port $(PC_PORT_NUM)
stop-uds: init-env
bin/process-compose down --use-uds --unix-socket $(PC_SOCKET_PATH)
status: init-env
bin/process-compose project state --port $(PC_PORT_NUM)
###############################################################################
### help ###
###############################################################################
deploy:
cd ./proto && bunx buf dep update && bunx buf build && bunx buf push
sh ./.github/scripts/upload_cdn.sh
help:
@echo "Usage: make <target>"
@echo ""
@echo "Available targets:"
@echo " install : Install the binary"
@echo " local-image : Install the docker image"
@echo " proto-gen : Generate code from proto files"
@echo " testnet : Local devnet with IBC"
@echo " sh-testnet : Shell local devnet"
@echo " ictest-basic : Basic end-to-end test"
@echo " ictest-ibc : IBC end-to-end test"
@echo " templ : Generate templ files"
@echo " vault : Build vault.wasm"
@gum log --level info "Sonr Blockchain Makefile"
@gum log --level info "========================"
@gum log --level info ""
@gum log --level info "🛠️ Build & Install:"
@gum log --level info " install Install snrd binary"
@gum log --level info " build Build snrd binary with vault WASM"
@gum log --level info " build-all Build all components in parallel"
@gum log --level info " build-hway Build Highway service"
@gum log --level info " build-vault Build vault WASM module"
@gum log --level info " build-motr Build Motor WASM service worker"
@gum log --level info " build-client Build client SDK"
@gum log --level info " docker Build Docker images"
@gum log --level info ""
@gum log --level info "🚀 Local Development:"
@gum log --level info " localnet Start single-node testnet"
@gum log --level info " start Start backend services"
@gum log --level info " stop Stop backend services"
@gum log --level info " status Check service health"
@gum log --level info " testnet Manage Starship network (start/stop/restart)"
@gum log --level info ""
@gum log --level info "📦 Code Generation:"
@gum log --level info " proto-gen Generate protobuf code"
@gum log --level info " swagger-gen Generate OpenAPI docs"
@gum log --level info ""
@gum log --level info "🔧 Development Tools:"
@gum log --level info " format Format code (Go + TypeScript)"
@gum log --level info " lint Run all linters"
@gum log --level info " clean Remove build artifacts"
@gum log --level info ""
@gum log --level info "🧪 Testing:"
@gum log --level info " benchmark Run benchmarks"
@gum log --level info " test Run unit tests"
@gum log --level info " test-all Run all test variants"
@gum log --level info " test-cover Generate coverage report"
@gum log --level info " test-e2e Run e2e tests"
@gum log --level info " test-e2e-all Run all e2e tests"
@gum log --level info " test-module Test specific module (MODULE=did|dwn|svc)"
@gum log --level info " test-packages Test all packages (lint + build)"
@gum log --level info " test-ipfs Test vault with IPFS export/import"
@gum log --level info " test-vault Test vault operations"
@gum log --level info " test-web Test all web apps (lint + build)"
@gum log --level info ""
@gum log --level info "📚 Module Testing Examples:"
@gum log --level info " make test-module MODULE=did # Test DID module"
@gum log --level info " make test-module MODULE=dwn VARIANT=cover # DWN with coverage"
@gum log --level info " make test-module MODULE=svc VARIANT=race # SVC with race detector"
@gum log --level info " make test-module MODULE=did VARIANT=bench # DID benchmarks"
@gum log --level info ""
@gum log --level info "For more detailed options, see the Makefile source."
.PHONY: help
.PHONY: help release release-platform snapshot snapshot-platform
+503 -29
View File
@@ -1,41 +1,515 @@
# `sonr` - Sonr Chain
[![Go Reference](https://pkg.go.dev/badge/github.com/onsonr/sonr.svg)](https://pkg.go.dev/github.com/onsonr/sonr)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/onsonr/sonr)
![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/onsonr/sonr)
[![Go Reference](https://pkg.go.dev/badge/github.com/sonr-io/sonr.svg)](https://pkg.go.dev/github.com/sonr-io/sonr)
![GitHub commit activity](https://img.shields.io/github/commit-activity/w/sonr-io/sonr)
[![Static Badge](https://img.shields.io/badge/homepage-sonr.io-blue?style=flat-square)](https://sonr.io)
[![Go Report Card](https://goreportcard.com/badge/github.com/onsonr/sonr)](https://goreportcard.com/report/github.com/onsonr/sonr)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=sonrhq_sonr&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=sonr-io_sonr)
[![Latest version of 'sonrd' @ Cloudsmith](https://api-prd.cloudsmith.io/v1/badges/version/sonr/sonr/deb/sonrd/latest/a=amd64;xc=main;d=ubuntu%252Fxenial;t=binary/?render=true&show_latest=true)](https://cloudsmith.io/~sonr/repos/sonr/packages/detail/deb/sonrd/latest/a=amd64;xc=main;d=ubuntu%252Fxenial;t=binary/)
[![Go Report Card](https://goreportcard.com/badge/github.com/sonr-io/sonr)](https://goreportcard.com/report/github.com/sonr-io/sonr)
> Sonr is a combination of decentralized primitives. Fundamentally, it is a peer-to-peer identity and asset management system that leverages DID documents, Webauthn, and IPFS—providing users with a secure, portable decentralized identity.
[![Sonr](.github/banner.png)](https://sonr.io)
# Documentation
> **Sonr is a blockchain ecosystem combining decentralized identity, secure data storage, and multi-chain interoperability. Built on Cosmos SDK v0.50.14, it provides users with self-sovereign identity through W3C DIDs, WebAuthn authentication, and personal data vaults—all without requiring cryptocurrency for onboarding.**
1. [Quick Start](https://github.com/onsonr/sonr/wiki/1-%E2%80%90-Quick-Start)
2. [Chain Modules](https://github.com/onsonr/sonr/wiki/2-%E2%80%90-Chain-Modules)
3. [System Architecture](https://github.com/onsonr/sonr/wiki/3-%E2%80%90-System-Architecture)
4. [Token Economy](https://github.com/onsonr/sonr/wiki/4-%E2%80%90-Token-Economy)
5. [Service Mangement](https://github.com/onsonr/sonr/wiki/5-%E2%80%90-Service-Management)
6. [Design System](https://github.com/onsonr/sonr/wiki/6-%E2%80%90-Design-System)
7. [Self Custody](https://github.com/onsonr/sonr/wiki/7-%E2%80%90-Self-Custody)
## 💡 Key Features
# Stats
### 🔐 Gasless Onboarding
![Alt](https://repobeats.axiom.co/api/embed/8d0b17e889942889c5b6e632da09bd597efd84c4.svg "Repobeats analytics image")
Create your first decentralized identity without owning cryptocurrency:
# Acknowledgements
```bash
# Register with WebAuthn (no tokens required!)
snrd auth register --username alice
Sonr would not have been possible without the direct and indirect support of the following individuals:
# Register with automatic vault creation
snrd auth register --username bob --auto-vault
```
- **Juan Benet**: For the IPFS Ecosystem.
- **Satoshi Nakamoto**: For Bitcoin.
- **Steve Jobs**: For User first UX.
- **Tim Berners-Lee**: For the Internet.
### 🌐 Multi-Chain Support
# Community & Support
- **Cosmos SDK**: Native integration with IBC ecosystem
- **EVM Compatibility**: Ethereum smart contract support
- **External Wallets**: MetaMask, Keplr, and more
- [Forum](https://github.com/onsonr/sonr/discussions)
- [Issues](https://github.com/onsonr/sonr/issues)
- [Twitter](https://sonr.io/twitter)
- [Dev Chat](https://sonr.io/discord)
### 🔑 Advanced Authentication
- **WebAuthn/Passkeys**: Biometric authentication
- **Hardware Security Keys**: YubiKey, Titan Key support
- **Multi-Signature**: Multiple verification methods per DID
### 📦 Decentralized Storage
- **IPFS Integration**: Distributed file storage
- **Encrypted Vaults**: Hardware-backed encryption
- **Protocol Schemas**: Structured data validation
## 📚 Technical Specifications
- **Cosmos SDK**: v0.50.14
- **CometBFT**: v0.38.17
- **IBC**: v8.7.0
- **Go**: 1.24.1 (toolchain 1.24.4)
- **WebAssembly**: CosmWasm v1.5.8
- **Task Queue**: Asynq (Redis-based)
- **Actor System**: Proto.Actor
- **Storage**: IPFS, LevelDB
## 🔒 Security
### Gasless Transaction Security
- Limited to WebAuthn registration only
- Full cryptographic validation required
- Credential uniqueness enforcement
- Anti-replay protection
### WebAuthn Security
- Origin validation
- Challenge-response authentication
- Device binding
- Attestation verification
### Multi-Algorithm Support
- Ed25519 (quantum-resistant)
- ECDSA (secp256k1, P-256)
- RSA (2048, 3072, 4096 bits)
- WebAuthn (ES256, RS256)
## 🚀 Quick Start
### Installation
```bash
# Clone the repository
git clone https://github.com/sonr-io/sonr
cd sonr
# Install the binary
make install
# Verify installation
snrd version
```
### Running a Local Node
```bash
# Start single-node testnet (quick iteration)
make localnet
# Start multi-node testnet with Starship
make testnet-start
# Stop testnet
make testnet-stop
```
### Building from Source
```bash
# Build all binaries
make build # snrd blockchain node
make build-hway # Highway service
make build-vault # Vault WASM plugin
# Build Docker image
make docker
# Generate code from proto files
make proto-gen
```
### Local Development Network
```bash
# Standard localnet (auto-detects best method for your system)
make localnet # Works on Arch Linux, Ubuntu, macOS, etc.
# Docker-based localnet (requires Docker)
make dockernet # Runs in detached mode
# One-time setup for your system (optional)
./scripts/setup_localnet.sh # Installs dependencies and configures environment
```
### Testing
```bash
# Run all tests
make test-all
# Module-specific tests
make test-did # DID module tests
make test-dwn # DWN module tests
make test-svc # Service module tests
# E2E tests
make ictest-basic # Basic chain functionality
make ictest-ibc # IBC transfers
make ictest-wasm # CosmWasm integration
# Test with coverage
make test-cover
```
### Infrastructure
```bash
# IPFS for vault operations
make ipfs-up # Start IPFS infrastructure
make ipfs-down # Stop IPFS infrastructure
make ipfs-status # Check IPFS connectivity
```
## 🏗️ Architecture
Sonr consists of three primary components and three custom modules:
### Service Architecture
```
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Caddy │────▶│ snrd │ │ IPFS │
└─────────┘ └─────────┘ └─────────┘
│ │ │
│ ▼ ▼
│ ┌─────────┐ ┌─────────┐
└─────────▶│ Highway │────▶│ Redis │
└─────────┘ └─────────┘
```
- **Caddy**: Reverse proxy with gRPC-Web support (port 80)
- **Redis**: Task queue backend for Highway (port 6379)
- **Highway**: UCAN-based task processor (port 8090)
- **IPFS**: Distributed storage (API: 5001, Gateway: 8080)
- **snrd**: Blockchain node (gRPC: 9090, REST: 1317)
### Cross-Platform Support
The `localnet` target now automatically detects and uses the best available method:
1. Checks for local binary (built with `make install`)
2. Falls back to Docker if available
3. Handles permission issues on systems like Arch Linux
4. Supports systemd service installation (see `etc/systemd/`)
### Core Components
#### 1. **Blockchain Node (`snrd`)**
The main blockchain daemon built with Cosmos SDK v0.50.14, providing:
- AutoCLI for command generation
- EVM compatibility via Evmos integration
- IBC for cross-chain communication
- CosmWasm smart contract support
#### 2. **Highway Service (`hway`)**
An Asynq-based task processing service for vault operations:
- Redis-backed job queue with priority levels
- Actor-based concurrency using Proto.Actor framework
- Processes cryptographic operations through WebAssembly enclaves
#### 3. **Motor Plugin (`motr`)**
WebAssembly-based vault system providing:
- Secure execution environment for sensitive operations
- Hardware-backed key management
- Multi-party computation capabilities
## 📖 Module Documentation
### DID Module
W3C DID specification implementation with:
- **Gasless WebAuthn Registration**: Create DIDs without cryptocurrency
- **Multi-Algorithm Signatures**: Ed25519, ECDSA, RSA, WebAuthn
- **External Wallet Linking**: MetaMask, Keplr integration
- **Verifiable Credentials**: W3C-compliant credential issuance
```bash
# Create a DID
snrd tx did create-did did:sonr:alice '{"id":"did:sonr:alice",...}' --from alice
# Link external wallet
snrd tx did link-external-wallet did:sonr:alice \
--wallet-address 0x742d35Cc6635C0532925a3b8c17C6e583F4d6A42 \
--wallet-type ethereum \
--from alice
# Query DID
snrd query did resolve did:sonr:alice
```
[Full DID Module Documentation](x/did/README.md)
### DWN Module
Personal data stores with:
- **Structured Data Records**: Hierarchical data organization
- **Protocol-Based Interactions**: Enforceable data schemas
- **Secure Vaults**: Enclave-based key management
- **Multi-Chain Support**: Cosmos SDK and EVM transaction building
```bash
# Create a vault
snrd tx dwn create-vault --from alice
# Store a record
snrd tx dwn write-record '{"data":"...", "protocol":"example.com"}' --from alice
# Query records
snrd query dwn records --owner alice
```
[Full DWN Module Documentation](x/dwn/README.md)
### Service Module
Decentralized service registry featuring:
- **Domain Verification**: DNS-based ownership proof
- **Service Registration**: Verified service endpoints
- **Permission Management**: UCAN capability integration
```bash
# Verify domain ownership
snrd tx svc initiate-domain-verification example.com --from alice
snrd tx svc verify-domain example.com --from alice
# Register service
snrd tx svc register-service my-service example.com \
--permissions "read,write" --from alice
```
[Full Service Module Documentation](x/svc/README.md)
## 🔧 Configuration
### Environment Variables
Environment variables can be configured via Docker Compose:
```bash
# Chain configuration
export CHAIN_ID="localchain_9000-1"
export BLOCK_TIME="1000ms"
# Network selection for Starship
export NETWORK="devnet" # or "testnet"
# Redis configuration
REDIS_URL=redis://redis:6379
REDIS_DB=0
# Highway service
HIGHWAY_PORT=8090
LOG_LEVEL=debug
# IPFS configuration
IPFS_API_URL=http://ipfs:5001
# Caddy configuration
CADDY_DOMAIN=localhost
```
Environment variables can be set directly or via a `.env` file in the project root.
### Docker Compose Services
The project includes a comprehensive Docker Compose setup for running all backend services:
```bash
# Start all services (Redis, Highway, Caddy, IPFS)
make docker-up
# Stop all services
make docker-down
# View service logs
make docker-logs # All services
make docker-logs-redis # Specific service
# Check service health
make docker-status
# Clean up Docker resources
make docker-clean
```
### Starship Configuration
Edit `starship.yml` to configure multi-node testnets:
```yaml
chains:
- id: sonrtest_1-1
name: custom
numValidators: 3
image: onsonr/snrd:latest
# ... additional configuration
```
#### Troubleshooting
**Services not starting:**
```bash
# Check service status
make docker-status
# View detailed logs
make docker-logs
# Ensure Docker network exists
docker network ls | grep sonr-network
```
**Redis connection issues:**
```bash
# Test Redis connectivity
docker exec redis redis-cli ping
# Check Redis logs
make docker-logs-redis
```
**IPFS not accessible:**
```bash
# Verify IPFS is running
curl http://127.0.0.1:5001/api/v0/version
# Check IPFS logs
docker compose -f etc/stack/compose.yml logs ipfs
```
**Port conflicts:**
- Caddy: 80 (HTTP)
- Redis: 6379
- Highway: 8090
- IPFS API: 5001
- IPFS Gateway: 8080
Stop conflicting services or modify ports in `etc/stack/compose.yml`.
## 🏗️ Project Structure
Sonr uses a modern monorepo architecture with pnpm workspaces for JavaScript/TypeScript packages alongside the Go blockchain implementation:
### Workspace Organization
```
sonr/
├── app/ # Application setup and module wiring
├── cmd/ # Binary entry points
│ ├── snrd/ # Blockchain node
│ ├── hway/ # Highway service
│ └── motr/ # Motor WASM plugin
├── x/ # Custom chain modules
│ ├── did/ # W3C DID implementation
│ ├── dwn/ # Decentralized Web Nodes
│ └── svc/ # Service management
├── types/ # Internal packages
│ ├── coins/ # Task processing
│ └── ipfs/ # Authorization networks
├── proto/ # Protobuf definitions
├── scripts/ # Utility scripts
├── test/ # Integration tests
├── docs/ # Documentation site
# Monorepo Packages (pnpm workspaces)
├── packages/ # Core JavaScript/TypeScript packages
│ ├── es/ # @sonr.io/es - ES client library
│ ├── sdk/ # @sonr.io/sdk - SDK package
│ └── ui/ # @sonr.io/ui - Shared UI components
├── cli/ # CLI tools
│ ├── install/ # @sonr.io/install - Installation CLI
│ └── join-testnet/# @sonr.io/join-testnet - Testnet CLI
└── web/ # Web applications
├── auth/ # Authentication app (Next.js)
└── dash/ # Dashboard app (Next.js)
```
### Working with the Monorepo
#### Installation
```bash
# Install all dependencies for the monorepo
pnpm install
# Build all packages
pnpm build
# Run development mode for all packages
pnpm dev
```
#### Package Management
```bash
# Run commands in specific packages
pnpm --filter @sonr.io/es build
pnpm --filter @sonr.io/sdk test
# Add dependencies to specific packages
pnpm --filter @sonr.io/ui add react
# Run commands in all packages
pnpm -r build # Build all packages
pnpm -r test # Test all packages
```
#### Versioning & Publishing
The monorepo uses [Changesets](https://github.com/changesets/changesets) for package versioning:
```bash
# Add a changeset for your changes
pnpm changeset
# Version packages based on changesets
pnpm changeset version
# Publish packages to npm
pnpm changeset publish
```
### Key Technologies
- **pnpm workspaces**: Efficient dependency management with single lockfile
- **TypeScript project references**: Incremental builds and better IDE performance
- **Turbo**: Build orchestration and caching for faster builds
- **Changesets**: Automated versioning and changelog generation
- **Biome**: Fast, unified linting and formatting (replaces ESLint/Prettier)
### Package Dependencies
- `@sonr.io/es`: Core ES client library with protobuf types
- `@sonr.io/sdk`: High-level SDK (depends on @sonr.io/es)
- `@sonr.io/ui`: Shared UI components for web applications
- `@sonr.io/install`: CLI tool for installing Sonr
- `@sonr.io/join-testnet`: CLI tool for joining testnet
- Web apps use all three core packages (@sonr.io/es, @sonr.io/sdk, @sonr.io/ui)
## 🤝 Community & Support
- [GitHub Discussions](https://github.com/sonr-io/sonr/discussions) - Community forum
- [GitHub Issues](https://github.com/sonr-io/sonr/issues) - Bug reports and feature requests
- [Twitter](https://sonr.io/twitter) - Latest updates
- [Documentation Wiki](https://github.com/sonr-io/sonr/wiki) - Detailed guides
## 📄 License
Copyright © 2024 Sonr, Inc.
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
---
<p align="center">
Built with ❤️ by the Sonr team
</p>
+499
View File
@@ -0,0 +1,499 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package modulev1
import (
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
var (
md_Module protoreflect.MessageDescriptor
)
func init() {
file_dex_module_v1_module_proto_init()
md_Module = File_dex_module_v1_module_proto.Messages().ByName("Module")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
type fastReflection_Module Module
func (x *Module) ProtoReflect() protoreflect.Message {
return (*fastReflection_Module)(x)
}
func (x *Module) slowProtoReflect() protoreflect.Message {
mi := &file_dex_module_v1_module_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_Module_messageType fastReflection_Module_messageType
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
type fastReflection_Module_messageType struct{}
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
return (*fastReflection_Module)(nil)
}
func (x fastReflection_Module_messageType) New() protoreflect.Message {
return new(fastReflection_Module)
}
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_Module) Type() protoreflect.MessageType {
return _fastReflection_Module_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Module) New() protoreflect.Message {
return new(fastReflection_Module)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
return (*Module)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: dex.module.v1.Module"))
}
panic(fmt.Errorf("message dex.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in dex.module.v1.Module", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_Module) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: dex/module/v1/module.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Module) Reset() {
*x = Module{}
if protoimpl.UnsafeEnabled {
mi := &file_dex_module_v1_module_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Module) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Module) ProtoMessage() {}
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) {
return file_dex_module_v1_module_proto_rawDescGZIP(), []int{0}
}
var File_dex_module_v1_module_proto protoreflect.FileDescriptor
var file_dex_module_v1_module_proto_rawDesc = []byte{
0x0a, 0x1a, 0x64, 0x65, 0x78, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f,
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x64, 0x65,
0x78, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1f, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x19, 0x0a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
0x2d, 0x69, 0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xaa, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d,
0x2e, 0x64, 0x65, 0x78, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2d, 0x69,
0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x65, 0x78, 0x2f, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x44, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x44, 0x65, 0x78, 0x2e, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x44, 0x65, 0x78, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x44, 0x65, 0x78, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x44, 0x65, 0x78, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_dex_module_v1_module_proto_rawDescOnce sync.Once
file_dex_module_v1_module_proto_rawDescData = file_dex_module_v1_module_proto_rawDesc
)
func file_dex_module_v1_module_proto_rawDescGZIP() []byte {
file_dex_module_v1_module_proto_rawDescOnce.Do(func() {
file_dex_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_dex_module_v1_module_proto_rawDescData)
})
return file_dex_module_v1_module_proto_rawDescData
}
var file_dex_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_dex_module_v1_module_proto_goTypes = []interface{}{
(*Module)(nil), // 0: dex.module.v1.Module
}
var file_dex_module_v1_module_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_dex_module_v1_module_proto_init() }
func file_dex_module_v1_module_proto_init() {
if File_dex_module_v1_module_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_dex_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_dex_module_v1_module_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_dex_module_v1_module_proto_goTypes,
DependencyIndexes: file_dex_module_v1_module_proto_depIdxs,
MessageInfos: file_dex_module_v1_module_proto_msgTypes,
}.Build()
File_dex_module_v1_module_proto = out.File
file_dex_module_v1_module_proto_rawDesc = nil
file_dex_module_v1_module_proto_goTypes = nil
file_dex_module_v1_module_proto_depIdxs = nil
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+416
View File
@@ -0,0 +1,416 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: dex/v1/query.proto
package dexv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/dex.v1.Query/Params"
Query_Account_FullMethodName = "/dex.v1.Query/Account"
Query_Accounts_FullMethodName = "/dex.v1.Query/Accounts"
Query_Balance_FullMethodName = "/dex.v1.Query/Balance"
Query_Pool_FullMethodName = "/dex.v1.Query/Pool"
Query_Orders_FullMethodName = "/dex.v1.Query/Orders"
Query_History_FullMethodName = "/dex.v1.Query/History"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type QueryClient interface {
// Params queries the parameters of the module
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Account queries a DEX account by DID and connection
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error)
// Accounts queries all DEX accounts for a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Accounts(ctx context.Context, in *QueryAccountsRequest, opts ...grpc.CallOption) (*QueryAccountsResponse, error)
// Balance queries remote chain balance
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error)
// Pool queries pool information
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error)
// Orders queries orders for a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error)
// History queries transaction history
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
History(ctx context.Context, in *QueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistoryResponse, error)
}
type queryClient struct {
cc grpc.ClientConnInterface
}
func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Account(ctx context.Context, in *QueryAccountRequest, opts ...grpc.CallOption) (*QueryAccountResponse, error) {
out := new(QueryAccountResponse)
err := c.cc.Invoke(ctx, Query_Account_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Accounts(ctx context.Context, in *QueryAccountsRequest, opts ...grpc.CallOption) (*QueryAccountsResponse, error) {
out := new(QueryAccountsResponse)
err := c.cc.Invoke(ctx, Query_Accounts_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Balance(ctx context.Context, in *QueryBalanceRequest, opts ...grpc.CallOption) (*QueryBalanceResponse, error) {
out := new(QueryBalanceResponse)
err := c.cc.Invoke(ctx, Query_Balance_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Pool(ctx context.Context, in *QueryPoolRequest, opts ...grpc.CallOption) (*QueryPoolResponse, error) {
out := new(QueryPoolResponse)
err := c.cc.Invoke(ctx, Query_Pool_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error) {
out := new(QueryOrdersResponse)
err := c.cc.Invoke(ctx, Query_Orders_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) History(ctx context.Context, in *QueryHistoryRequest, opts ...grpc.CallOption) (*QueryHistoryResponse, error) {
out := new(QueryHistoryResponse)
err := c.cc.Invoke(ctx, Query_History_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
type QueryServer interface {
// Params queries the parameters of the module
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Account queries a DEX account by DID and connection
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error)
// Accounts queries all DEX accounts for a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Accounts(context.Context, *QueryAccountsRequest) (*QueryAccountsResponse, error)
// Balance queries remote chain balance
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error)
// Pool queries pool information
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error)
// Orders queries orders for a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
Orders(context.Context, *QueryOrdersRequest) (*QueryOrdersResponse, error)
// History queries transaction history
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_query_docs.md"}}
History(context.Context, *QueryHistoryRequest) (*QueryHistoryResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (UnimplementedQueryServer) Account(context.Context, *QueryAccountRequest) (*QueryAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Account not implemented")
}
func (UnimplementedQueryServer) Accounts(context.Context, *QueryAccountsRequest) (*QueryAccountsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Accounts not implemented")
}
func (UnimplementedQueryServer) Balance(context.Context, *QueryBalanceRequest) (*QueryBalanceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Balance not implemented")
}
func (UnimplementedQueryServer) Pool(context.Context, *QueryPoolRequest) (*QueryPoolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Pool not implemented")
}
func (UnimplementedQueryServer) Orders(context.Context, *QueryOrdersRequest) (*QueryOrdersResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Orders not implemented")
}
func (UnimplementedQueryServer) History(context.Context, *QueryHistoryRequest) (*QueryHistoryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method History not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
// result in compilation errors.
type UnsafeQueryServer interface {
mustEmbedUnimplementedQueryServer()
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
s.RegisterService(&Query_ServiceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Params_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Account_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAccountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Account(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Account_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Account(ctx, req.(*QueryAccountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Accounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAccountsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Accounts(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Accounts_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Accounts(ctx, req.(*QueryAccountsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Balance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryBalanceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Balance(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Balance_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Balance(ctx, req.(*QueryBalanceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Pool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryPoolRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Pool(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Pool_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Pool(ctx, req.(*QueryPoolRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Orders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryOrdersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Orders(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Orders_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Orders(ctx, req.(*QueryOrdersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_History_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryHistoryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).History(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_History_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).History(ctx, req.(*QueryHistoryRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Query_ServiceDesc = grpc.ServiceDesc{
ServiceName: "dex.v1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "Account",
Handler: _Query_Account_Handler,
},
{
MethodName: "Accounts",
Handler: _Query_Accounts_Handler,
},
{
MethodName: "Balance",
Handler: _Query_Balance_Handler,
},
{
MethodName: "Pool",
Handler: _Query_Pool_Handler,
},
{
MethodName: "Orders",
Handler: _Query_Orders_Handler,
},
{
MethodName: "History",
Handler: _Query_History_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "dex/v1/query.proto",
}
File diff suppressed because it is too large Load Diff
+367
View File
@@ -0,0 +1,367 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: dex/v1/tx.proto
package dexv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_RegisterDEXAccount_FullMethodName = "/dex.v1.Msg/RegisterDEXAccount"
Msg_ExecuteSwap_FullMethodName = "/dex.v1.Msg/ExecuteSwap"
Msg_ProvideLiquidity_FullMethodName = "/dex.v1.Msg/ProvideLiquidity"
Msg_RemoveLiquidity_FullMethodName = "/dex.v1.Msg/RemoveLiquidity"
Msg_CreateLimitOrder_FullMethodName = "/dex.v1.Msg/CreateLimitOrder"
Msg_CancelOrder_FullMethodName = "/dex.v1.Msg/CancelOrder"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MsgClient interface {
// RegisterDEXAccount creates a new ICA account for DEX operations
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
RegisterDEXAccount(ctx context.Context, in *MsgRegisterDEXAccount, opts ...grpc.CallOption) (*MsgRegisterDEXAccountResponse, error)
// ExecuteSwap performs a token swap on a remote chain
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
ExecuteSwap(ctx context.Context, in *MsgExecuteSwap, opts ...grpc.CallOption) (*MsgExecuteSwapResponse, error)
// ProvideLiquidity adds liquidity to a pool
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
ProvideLiquidity(ctx context.Context, in *MsgProvideLiquidity, opts ...grpc.CallOption) (*MsgProvideLiquidityResponse, error)
// RemoveLiquidity removes liquidity from a pool
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error)
// CreateLimitOrder creates a limit order
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
CreateLimitOrder(ctx context.Context, in *MsgCreateLimitOrder, opts ...grpc.CallOption) (*MsgCreateLimitOrderResponse, error)
// CancelOrder cancels an existing order
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
CancelOrder(ctx context.Context, in *MsgCancelOrder, opts ...grpc.CallOption) (*MsgCancelOrderResponse, error)
}
type msgClient struct {
cc grpc.ClientConnInterface
}
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) RegisterDEXAccount(ctx context.Context, in *MsgRegisterDEXAccount, opts ...grpc.CallOption) (*MsgRegisterDEXAccountResponse, error) {
out := new(MsgRegisterDEXAccountResponse)
err := c.cc.Invoke(ctx, Msg_RegisterDEXAccount_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ExecuteSwap(ctx context.Context, in *MsgExecuteSwap, opts ...grpc.CallOption) (*MsgExecuteSwapResponse, error) {
out := new(MsgExecuteSwapResponse)
err := c.cc.Invoke(ctx, Msg_ExecuteSwap_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ProvideLiquidity(ctx context.Context, in *MsgProvideLiquidity, opts ...grpc.CallOption) (*MsgProvideLiquidityResponse, error) {
out := new(MsgProvideLiquidityResponse)
err := c.cc.Invoke(ctx, Msg_ProvideLiquidity_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RemoveLiquidity(ctx context.Context, in *MsgRemoveLiquidity, opts ...grpc.CallOption) (*MsgRemoveLiquidityResponse, error) {
out := new(MsgRemoveLiquidityResponse)
err := c.cc.Invoke(ctx, Msg_RemoveLiquidity_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) CreateLimitOrder(ctx context.Context, in *MsgCreateLimitOrder, opts ...grpc.CallOption) (*MsgCreateLimitOrderResponse, error) {
out := new(MsgCreateLimitOrderResponse)
err := c.cc.Invoke(ctx, Msg_CreateLimitOrder_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) CancelOrder(ctx context.Context, in *MsgCancelOrder, opts ...grpc.CallOption) (*MsgCancelOrderResponse, error) {
out := new(MsgCancelOrderResponse)
err := c.cc.Invoke(ctx, Msg_CancelOrder_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
type MsgServer interface {
// RegisterDEXAccount creates a new ICA account for DEX operations
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
RegisterDEXAccount(context.Context, *MsgRegisterDEXAccount) (*MsgRegisterDEXAccountResponse, error)
// ExecuteSwap performs a token swap on a remote chain
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
ExecuteSwap(context.Context, *MsgExecuteSwap) (*MsgExecuteSwapResponse, error)
// ProvideLiquidity adds liquidity to a pool
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
ProvideLiquidity(context.Context, *MsgProvideLiquidity) (*MsgProvideLiquidityResponse, error)
// RemoveLiquidity removes liquidity from a pool
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
RemoveLiquidity(context.Context, *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error)
// CreateLimitOrder creates a limit order
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
CreateLimitOrder(context.Context, *MsgCreateLimitOrder) (*MsgCreateLimitOrderResponse, error)
// CancelOrder cancels an existing order
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dex_tx_docs.md"}}
CancelOrder(context.Context, *MsgCancelOrder) (*MsgCancelOrderResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) RegisterDEXAccount(context.Context, *MsgRegisterDEXAccount) (*MsgRegisterDEXAccountResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterDEXAccount not implemented")
}
func (UnimplementedMsgServer) ExecuteSwap(context.Context, *MsgExecuteSwap) (*MsgExecuteSwapResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteSwap not implemented")
}
func (UnimplementedMsgServer) ProvideLiquidity(context.Context, *MsgProvideLiquidity) (*MsgProvideLiquidityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProvideLiquidity not implemented")
}
func (UnimplementedMsgServer) RemoveLiquidity(context.Context, *MsgRemoveLiquidity) (*MsgRemoveLiquidityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveLiquidity not implemented")
}
func (UnimplementedMsgServer) CreateLimitOrder(context.Context, *MsgCreateLimitOrder) (*MsgCreateLimitOrderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateLimitOrder not implemented")
}
func (UnimplementedMsgServer) CancelOrder(context.Context, *MsgCancelOrder) (*MsgCancelOrderResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CancelOrder not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
// result in compilation errors.
type UnsafeMsgServer interface {
mustEmbedUnimplementedMsgServer()
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_RegisterDEXAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterDEXAccount)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RegisterDEXAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RegisterDEXAccount_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RegisterDEXAccount(ctx, req.(*MsgRegisterDEXAccount))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ExecuteSwap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteSwap)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ExecuteSwap(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ExecuteSwap_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ExecuteSwap(ctx, req.(*MsgExecuteSwap))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ProvideLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgProvideLiquidity)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ProvideLiquidity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ProvideLiquidity_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ProvideLiquidity(ctx, req.(*MsgProvideLiquidity))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RemoveLiquidity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRemoveLiquidity)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RemoveLiquidity(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RemoveLiquidity_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RemoveLiquidity(ctx, req.(*MsgRemoveLiquidity))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_CreateLimitOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCreateLimitOrder)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CreateLimitOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_CreateLimitOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CreateLimitOrder(ctx, req.(*MsgCreateLimitOrder))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_CancelOrder_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCancelOrder)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CancelOrder(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_CancelOrder_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CancelOrder(ctx, req.(*MsgCancelOrder))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "dex.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "RegisterDEXAccount",
Handler: _Msg_RegisterDEXAccount_Handler,
},
{
MethodName: "ExecuteSwap",
Handler: _Msg_ExecuteSwap_Handler,
},
{
MethodName: "ProvideLiquidity",
Handler: _Msg_ProvideLiquidity_Handler,
},
{
MethodName: "RemoveLiquidity",
Handler: _Msg_RemoveLiquidity_Handler,
},
{
MethodName: "CreateLimitOrder",
Handler: _Msg_CreateLimitOrder_Handler,
},
{
MethodName: "CancelOrder",
Handler: _Msg_CancelOrder_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "dex/v1/tx.proto",
}
+20 -19
View File
@@ -2,15 +2,16 @@
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
@@ -417,21 +418,21 @@ var file_did_module_v1_module_proto_rawDesc = []byte{
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x64, 0x69,
0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1e, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x18, 0x0a,
0x16, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f,
0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e,
0x64, 0x69, 0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f,
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x44, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x44, 0x69, 0x64, 0x2e, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x44, 0x69, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x44, 0x69, 0x64, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0xea, 0x02, 0x0f, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1f, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x19, 0x0a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
0x2d, 0x69, 0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xaa, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d,
0x2e, 0x64, 0x69, 0x64, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2d, 0x69,
0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x44, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x44, 0x69, 0x64, 0x2e, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x44, 0x69, 0x64, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x44, 0x69, 0x64, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+2689 -1221
View File
File diff suppressed because it is too large Load Diff
+12260 -1836
View File
File diff suppressed because it is too large Load Diff
+411 -67
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: did/v1/query.proto
@@ -8,6 +8,7 @@ package didv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,27 +16,57 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/did.v1.Query/Params"
Query_Resolve_FullMethodName = "/did.v1.Query/Resolve"
Query_Verify_FullMethodName = "/did.v1.Query/Verify"
Query_Params_FullMethodName = "/did.v1.Query/Params"
Query_ResolveDID_FullMethodName = "/did.v1.Query/ResolveDID"
Query_GetDIDDocument_FullMethodName = "/did.v1.Query/GetDIDDocument"
Query_ListDIDDocuments_FullMethodName = "/did.v1.Query/ListDIDDocuments"
Query_GetDIDDocumentsByController_FullMethodName = "/did.v1.Query/GetDIDDocumentsByController"
Query_GetVerificationMethod_FullMethodName = "/did.v1.Query/GetVerificationMethod"
Query_GetService_FullMethodName = "/did.v1.Query/GetService"
Query_GetVerifiableCredential_FullMethodName = "/did.v1.Query/GetVerifiableCredential"
Query_ListVerifiableCredentials_FullMethodName = "/did.v1.Query/ListVerifiableCredentials"
Query_GetCredentialsByDID_FullMethodName = "/did.v1.Query/GetCredentialsByDID"
Query_RegisterStart_FullMethodName = "/did.v1.Query/RegisterStart"
Query_LoginStart_FullMethodName = "/did.v1.Query/LoginStart"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query provides defines the gRPC querier service.
type QueryClient interface {
// Params queries all parameters of the module.
Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Resolve queries the DID document by its id.
Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error)
// Verify verifies a message with the DID document
Verify(ctx context.Context, in *QueryVerifyRequest, opts ...grpc.CallOption) (*QueryVerifyResponse, error)
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// ResolveDID resolves a DID to its DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_query_docs.md"}}
ResolveDID(ctx context.Context, in *QueryResolveDIDRequest, opts ...grpc.CallOption) (*QueryResolveDIDResponse, error)
// GetDIDDocument retrieves a DID document by its ID
GetDIDDocument(ctx context.Context, in *QueryGetDIDDocumentRequest, opts ...grpc.CallOption) (*QueryGetDIDDocumentResponse, error)
// ListDIDDocuments lists all DID documents with pagination
ListDIDDocuments(ctx context.Context, in *QueryListDIDDocumentsRequest, opts ...grpc.CallOption) (*QueryListDIDDocumentsResponse, error)
// GetDIDDocumentsByController retrieves DID documents by controller
GetDIDDocumentsByController(ctx context.Context, in *QueryGetDIDDocumentsByControllerRequest, opts ...grpc.CallOption) (*QueryGetDIDDocumentsByControllerResponse, error)
// GetVerificationMethod retrieves a specific verification method
GetVerificationMethod(ctx context.Context, in *QueryGetVerificationMethodRequest, opts ...grpc.CallOption) (*QueryGetVerificationMethodResponse, error)
// GetService retrieves a specific service endpoint
GetService(ctx context.Context, in *QueryGetServiceRequest, opts ...grpc.CallOption) (*QueryGetServiceResponse, error)
// GetVerifiableCredential retrieves a verifiable credential by ID
GetVerifiableCredential(ctx context.Context, in *QueryGetVerifiableCredentialRequest, opts ...grpc.CallOption) (*QueryGetVerifiableCredentialResponse, error)
// ListVerifiableCredentials lists all verifiable credentials with filtering options
ListVerifiableCredentials(ctx context.Context, in *QueryListVerifiableCredentialsRequest, opts ...grpc.CallOption) (*QueryListVerifiableCredentialsResponse, error)
// GetCredentialsByDID retrieves all credentials (verifiable and WebAuthn) associated with a DID
GetCredentialsByDID(ctx context.Context, in *QueryGetCredentialsByDIDRequest, opts ...grpc.CallOption) (*QueryGetCredentialsByDIDResponse, error)
// RegisterStart represents the start of the registration process
RegisterStart(ctx context.Context, in *QueryRegisterStartRequest, opts ...grpc.CallOption) (*QueryRegisterStartResponse, error)
// LoginStart represents the start of the login process
LoginStart(ctx context.Context, in *QueryLoginStartRequest, opts ...grpc.CallOption) (*QueryLoginStartResponse, error)
}
type queryClient struct {
@@ -46,30 +77,108 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryResolveResponse)
err := c.cc.Invoke(ctx, Query_Resolve_FullMethodName, in, out, cOpts...)
func (c *queryClient) ResolveDID(ctx context.Context, in *QueryResolveDIDRequest, opts ...grpc.CallOption) (*QueryResolveDIDResponse, error) {
out := new(QueryResolveDIDResponse)
err := c.cc.Invoke(ctx, Query_ResolveDID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Verify(ctx context.Context, in *QueryVerifyRequest, opts ...grpc.CallOption) (*QueryVerifyResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryVerifyResponse)
err := c.cc.Invoke(ctx, Query_Verify_FullMethodName, in, out, cOpts...)
func (c *queryClient) GetDIDDocument(ctx context.Context, in *QueryGetDIDDocumentRequest, opts ...grpc.CallOption) (*QueryGetDIDDocumentResponse, error) {
out := new(QueryGetDIDDocumentResponse)
err := c.cc.Invoke(ctx, Query_GetDIDDocument_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ListDIDDocuments(ctx context.Context, in *QueryListDIDDocumentsRequest, opts ...grpc.CallOption) (*QueryListDIDDocumentsResponse, error) {
out := new(QueryListDIDDocumentsResponse)
err := c.cc.Invoke(ctx, Query_ListDIDDocuments_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetDIDDocumentsByController(ctx context.Context, in *QueryGetDIDDocumentsByControllerRequest, opts ...grpc.CallOption) (*QueryGetDIDDocumentsByControllerResponse, error) {
out := new(QueryGetDIDDocumentsByControllerResponse)
err := c.cc.Invoke(ctx, Query_GetDIDDocumentsByController_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetVerificationMethod(ctx context.Context, in *QueryGetVerificationMethodRequest, opts ...grpc.CallOption) (*QueryGetVerificationMethodResponse, error) {
out := new(QueryGetVerificationMethodResponse)
err := c.cc.Invoke(ctx, Query_GetVerificationMethod_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetService(ctx context.Context, in *QueryGetServiceRequest, opts ...grpc.CallOption) (*QueryGetServiceResponse, error) {
out := new(QueryGetServiceResponse)
err := c.cc.Invoke(ctx, Query_GetService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetVerifiableCredential(ctx context.Context, in *QueryGetVerifiableCredentialRequest, opts ...grpc.CallOption) (*QueryGetVerifiableCredentialResponse, error) {
out := new(QueryGetVerifiableCredentialResponse)
err := c.cc.Invoke(ctx, Query_GetVerifiableCredential_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ListVerifiableCredentials(ctx context.Context, in *QueryListVerifiableCredentialsRequest, opts ...grpc.CallOption) (*QueryListVerifiableCredentialsResponse, error) {
out := new(QueryListVerifiableCredentialsResponse)
err := c.cc.Invoke(ctx, Query_ListVerifiableCredentials_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) GetCredentialsByDID(ctx context.Context, in *QueryGetCredentialsByDIDRequest, opts ...grpc.CallOption) (*QueryGetCredentialsByDIDResponse, error) {
out := new(QueryGetCredentialsByDIDResponse)
err := c.cc.Invoke(ctx, Query_GetCredentialsByDID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) RegisterStart(ctx context.Context, in *QueryRegisterStartRequest, opts ...grpc.CallOption) (*QueryRegisterStartResponse, error) {
out := new(QueryRegisterStartResponse)
err := c.cc.Invoke(ctx, Query_RegisterStart_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) LoginStart(ctx context.Context, in *QueryLoginStartRequest, opts ...grpc.CallOption) (*QueryLoginStartResponse, error) {
out := new(QueryLoginStartResponse)
err := c.cc.Invoke(ctx, Query_LoginStart_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -78,37 +187,81 @@ func (c *queryClient) Verify(ctx context.Context, in *QueryVerifyRequest, opts .
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility.
//
// Query provides defines the gRPC querier service.
// for forward compatibility
type QueryServer interface {
// Params queries all parameters of the module.
Params(context.Context, *QueryRequest) (*QueryParamsResponse, error)
// Resolve queries the DID document by its id.
Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error)
// Verify verifies a message with the DID document
Verify(context.Context, *QueryVerifyRequest) (*QueryVerifyResponse, error)
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// ResolveDID resolves a DID to its DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_query_docs.md"}}
ResolveDID(context.Context, *QueryResolveDIDRequest) (*QueryResolveDIDResponse, error)
// GetDIDDocument retrieves a DID document by its ID
GetDIDDocument(context.Context, *QueryGetDIDDocumentRequest) (*QueryGetDIDDocumentResponse, error)
// ListDIDDocuments lists all DID documents with pagination
ListDIDDocuments(context.Context, *QueryListDIDDocumentsRequest) (*QueryListDIDDocumentsResponse, error)
// GetDIDDocumentsByController retrieves DID documents by controller
GetDIDDocumentsByController(context.Context, *QueryGetDIDDocumentsByControllerRequest) (*QueryGetDIDDocumentsByControllerResponse, error)
// GetVerificationMethod retrieves a specific verification method
GetVerificationMethod(context.Context, *QueryGetVerificationMethodRequest) (*QueryGetVerificationMethodResponse, error)
// GetService retrieves a specific service endpoint
GetService(context.Context, *QueryGetServiceRequest) (*QueryGetServiceResponse, error)
// GetVerifiableCredential retrieves a verifiable credential by ID
GetVerifiableCredential(context.Context, *QueryGetVerifiableCredentialRequest) (*QueryGetVerifiableCredentialResponse, error)
// ListVerifiableCredentials lists all verifiable credentials with filtering options
ListVerifiableCredentials(context.Context, *QueryListVerifiableCredentialsRequest) (*QueryListVerifiableCredentialsResponse, error)
// GetCredentialsByDID retrieves all credentials (verifiable and WebAuthn) associated with a DID
GetCredentialsByDID(context.Context, *QueryGetCredentialsByDIDRequest) (*QueryGetCredentialsByDIDResponse, error)
// RegisterStart represents the start of the registration process
RegisterStart(context.Context, *QueryRegisterStartRequest) (*QueryRegisterStartResponse, error)
// LoginStart represents the start of the login process
LoginStart(context.Context, *QueryLoginStartRequest) (*QueryLoginStartResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Params(context.Context, *QueryRequest) (*QueryParamsResponse, error) {
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (UnimplementedQueryServer) Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Resolve not implemented")
func (UnimplementedQueryServer) ResolveDID(context.Context, *QueryResolveDIDRequest) (*QueryResolveDIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ResolveDID not implemented")
}
func (UnimplementedQueryServer) Verify(context.Context, *QueryVerifyRequest) (*QueryVerifyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Verify not implemented")
func (UnimplementedQueryServer) GetDIDDocument(context.Context, *QueryGetDIDDocumentRequest) (*QueryGetDIDDocumentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDIDDocument not implemented")
}
func (UnimplementedQueryServer) ListDIDDocuments(context.Context, *QueryListDIDDocumentsRequest) (*QueryListDIDDocumentsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListDIDDocuments not implemented")
}
func (UnimplementedQueryServer) GetDIDDocumentsByController(context.Context, *QueryGetDIDDocumentsByControllerRequest) (*QueryGetDIDDocumentsByControllerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDIDDocumentsByController not implemented")
}
func (UnimplementedQueryServer) GetVerificationMethod(context.Context, *QueryGetVerificationMethodRequest) (*QueryGetVerificationMethodResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetVerificationMethod not implemented")
}
func (UnimplementedQueryServer) GetService(context.Context, *QueryGetServiceRequest) (*QueryGetServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetService not implemented")
}
func (UnimplementedQueryServer) GetVerifiableCredential(context.Context, *QueryGetVerifiableCredentialRequest) (*QueryGetVerifiableCredentialResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetVerifiableCredential not implemented")
}
func (UnimplementedQueryServer) ListVerifiableCredentials(context.Context, *QueryListVerifiableCredentialsRequest) (*QueryListVerifiableCredentialsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListVerifiableCredentials not implemented")
}
func (UnimplementedQueryServer) GetCredentialsByDID(context.Context, *QueryGetCredentialsByDIDRequest) (*QueryGetCredentialsByDIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCredentialsByDID not implemented")
}
func (UnimplementedQueryServer) RegisterStart(context.Context, *QueryRegisterStartRequest) (*QueryRegisterStartResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterStart not implemented")
}
func (UnimplementedQueryServer) LoginStart(context.Context, *QueryLoginStartRequest) (*QueryLoginStartResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LoginStart not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -118,18 +271,11 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRequest)
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -141,43 +287,205 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
FullMethod: Query_Params_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryRequest))
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Resolve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRequest)
func _Query_ResolveDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryResolveDIDRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Resolve(ctx, in)
return srv.(QueryServer).ResolveDID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Resolve_FullMethodName,
FullMethod: Query_ResolveDID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Resolve(ctx, req.(*QueryRequest))
return srv.(QueryServer).ResolveDID(ctx, req.(*QueryResolveDIDRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Verify_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryVerifyRequest)
func _Query_GetDIDDocument_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetDIDDocumentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Verify(ctx, in)
return srv.(QueryServer).GetDIDDocument(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Verify_FullMethodName,
FullMethod: Query_GetDIDDocument_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Verify(ctx, req.(*QueryVerifyRequest))
return srv.(QueryServer).GetDIDDocument(ctx, req.(*QueryGetDIDDocumentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ListDIDDocuments_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryListDIDDocumentsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ListDIDDocuments(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ListDIDDocuments_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ListDIDDocuments(ctx, req.(*QueryListDIDDocumentsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetDIDDocumentsByController_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetDIDDocumentsByControllerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetDIDDocumentsByController(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetDIDDocumentsByController_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetDIDDocumentsByController(ctx, req.(*QueryGetDIDDocumentsByControllerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetVerificationMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetVerificationMethodRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetVerificationMethod(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetVerificationMethod_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetVerificationMethod(ctx, req.(*QueryGetVerificationMethodRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetServiceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetService(ctx, req.(*QueryGetServiceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetVerifiableCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetVerifiableCredentialRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetVerifiableCredential(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetVerifiableCredential_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetVerifiableCredential(ctx, req.(*QueryGetVerifiableCredentialRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ListVerifiableCredentials_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryListVerifiableCredentialsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ListVerifiableCredentials(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ListVerifiableCredentials_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ListVerifiableCredentials(ctx, req.(*QueryListVerifiableCredentialsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_GetCredentialsByDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryGetCredentialsByDIDRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetCredentialsByDID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_GetCredentialsByDID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetCredentialsByDID(ctx, req.(*QueryGetCredentialsByDIDRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_RegisterStart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRegisterStartRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).RegisterStart(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_RegisterStart_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).RegisterStart(ctx, req.(*QueryRegisterStartRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_LoginStart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryLoginStartRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).LoginStart(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_LoginStart_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).LoginStart(ctx, req.(*QueryLoginStartRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -194,12 +502,48 @@ var Query_ServiceDesc = grpc.ServiceDesc{
Handler: _Query_Params_Handler,
},
{
MethodName: "Resolve",
Handler: _Query_Resolve_Handler,
MethodName: "ResolveDID",
Handler: _Query_ResolveDID_Handler,
},
{
MethodName: "Verify",
Handler: _Query_Verify_Handler,
MethodName: "GetDIDDocument",
Handler: _Query_GetDIDDocument_Handler,
},
{
MethodName: "ListDIDDocuments",
Handler: _Query_ListDIDDocuments_Handler,
},
{
MethodName: "GetDIDDocumentsByController",
Handler: _Query_GetDIDDocumentsByController_Handler,
},
{
MethodName: "GetVerificationMethod",
Handler: _Query_GetVerificationMethod_Handler,
},
{
MethodName: "GetService",
Handler: _Query_GetService_Handler,
},
{
MethodName: "GetVerifiableCredential",
Handler: _Query_GetVerifiableCredential_Handler,
},
{
MethodName: "ListVerifiableCredentials",
Handler: _Query_ListVerifiableCredentials_Handler,
},
{
MethodName: "GetCredentialsByDID",
Handler: _Query_GetCredentialsByDID_Handler,
},
{
MethodName: "RegisterStart",
Handler: _Query_RegisterStart_Handler,
},
{
MethodName: "LoginStart",
Handler: _Query_LoginStart_Handler,
},
},
Streams: []grpc.StreamDesc{},
File diff suppressed because it is too large Load Diff
+8126 -2152
View File
File diff suppressed because it is too large Load Diff
+12787 -6461
View File
File diff suppressed because it is too large Load Diff
+473 -227
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: did/v1/tx.proto
@@ -8,6 +8,7 @@ package didv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,37 +16,69 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx"
Msg_LinkAssertion_FullMethodName = "/did.v1.Msg/LinkAssertion"
Msg_LinkAuthentication_FullMethodName = "/did.v1.Msg/LinkAuthentication"
Msg_UnlinkAssertion_FullMethodName = "/did.v1.Msg/UnlinkAssertion"
Msg_UnlinkAuthentication_FullMethodName = "/did.v1.Msg/UnlinkAuthentication"
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
Msg_CreateDID_FullMethodName = "/did.v1.Msg/CreateDID"
Msg_UpdateDID_FullMethodName = "/did.v1.Msg/UpdateDID"
Msg_DeactivateDID_FullMethodName = "/did.v1.Msg/DeactivateDID"
Msg_AddVerificationMethod_FullMethodName = "/did.v1.Msg/AddVerificationMethod"
Msg_RemoveVerificationMethod_FullMethodName = "/did.v1.Msg/RemoveVerificationMethod"
Msg_AddService_FullMethodName = "/did.v1.Msg/AddService"
Msg_RemoveService_FullMethodName = "/did.v1.Msg/RemoveService"
Msg_IssueVerifiableCredential_FullMethodName = "/did.v1.Msg/IssueVerifiableCredential"
Msg_RevokeVerifiableCredential_FullMethodName = "/did.v1.Msg/RevokeVerifiableCredential"
Msg_LinkExternalWallet_FullMethodName = "/did.v1.Msg/LinkExternalWallet"
Msg_RegisterWebAuthnCredential_FullMethodName = "/did.v1.Msg/RegisterWebAuthnCredential"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg defines the Msg service.
type MsgClient interface {
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error)
// LinkAssertion links an assertion to a controller.
LinkAssertion(ctx context.Context, in *MsgLinkAssertion, opts ...grpc.CallOption) (*MsgLinkAssertionResponse, error)
// LinkAuthentication links an authentication to a controller.
LinkAuthentication(ctx context.Context, in *MsgLinkAuthentication, opts ...grpc.CallOption) (*MsgLinkAuthenticationResponse, error)
// UnlinkAssertion unlinks an assertion from a controller.
UnlinkAssertion(ctx context.Context, in *MsgUnlinkAssertion, opts ...grpc.CallOption) (*MsgUnlinkAssertionResponse, error)
// UnlinkAuthentication unlinks an authentication from a controller.
UnlinkAuthentication(ctx context.Context, in *MsgUnlinkAuthentication, opts ...grpc.CallOption) (*MsgUnlinkAuthenticationResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// CreateDID creates a new DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
CreateDID(ctx context.Context, in *MsgCreateDID, opts ...grpc.CallOption) (*MsgCreateDIDResponse, error)
// UpdateDID updates an existing DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
UpdateDID(ctx context.Context, in *MsgUpdateDID, opts ...grpc.CallOption) (*MsgUpdateDIDResponse, error)
// DeactivateDID deactivates a DID document
DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opts ...grpc.CallOption) (*MsgDeactivateDIDResponse, error)
// AddVerificationMethod adds a new verification method to a DID document
AddVerificationMethod(ctx context.Context, in *MsgAddVerificationMethod, opts ...grpc.CallOption) (*MsgAddVerificationMethodResponse, error)
// RemoveVerificationMethod removes a verification method from a DID document
RemoveVerificationMethod(ctx context.Context, in *MsgRemoveVerificationMethod, opts ...grpc.CallOption) (*MsgRemoveVerificationMethodResponse, error)
// AddService adds a new service endpoint to a DID document
AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error)
// RemoveService removes a service endpoint from a DID document
RemoveService(ctx context.Context, in *MsgRemoveService, opts ...grpc.CallOption) (*MsgRemoveServiceResponse, error)
// IssueVerifiableCredential issues a new verifiable credential
IssueVerifiableCredential(ctx context.Context, in *MsgIssueVerifiableCredential, opts ...grpc.CallOption) (*MsgIssueVerifiableCredentialResponse, error)
// RevokeVerifiableCredential revokes a verifiable credential
RevokeVerifiableCredential(ctx context.Context, in *MsgRevokeVerifiableCredential, opts ...grpc.CallOption) (*MsgRevokeVerifiableCredentialResponse, error)
// LinkExternalWallet links an external wallet as an assertion method
LinkExternalWallet(ctx context.Context, in *MsgLinkExternalWallet, opts ...grpc.CallOption) (*MsgLinkExternalWalletResponse, error)
// RegisterWebAuthnCredential registers a new WebAuthn credential and creates a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
RegisterWebAuthnCredential(ctx context.Context, in *MsgRegisterWebAuthnCredential, opts ...grpc.CallOption) (*MsgRegisterWebAuthnCredentialResponse, error)
}
type msgClient struct {
@@ -56,60 +89,108 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgExecuteTxResponse)
err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) LinkAssertion(ctx context.Context, in *MsgLinkAssertion, opts ...grpc.CallOption) (*MsgLinkAssertionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgLinkAssertionResponse)
err := c.cc.Invoke(ctx, Msg_LinkAssertion_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) LinkAuthentication(ctx context.Context, in *MsgLinkAuthentication, opts ...grpc.CallOption) (*MsgLinkAuthenticationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgLinkAuthenticationResponse)
err := c.cc.Invoke(ctx, Msg_LinkAuthentication_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UnlinkAssertion(ctx context.Context, in *MsgUnlinkAssertion, opts ...grpc.CallOption) (*MsgUnlinkAssertionResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUnlinkAssertionResponse)
err := c.cc.Invoke(ctx, Msg_UnlinkAssertion_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UnlinkAuthentication(ctx context.Context, in *MsgUnlinkAuthentication, opts ...grpc.CallOption) (*MsgUnlinkAuthenticationResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUnlinkAuthenticationResponse)
err := c.cc.Invoke(ctx, Msg_UnlinkAuthentication_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) CreateDID(ctx context.Context, in *MsgCreateDID, opts ...grpc.CallOption) (*MsgCreateDIDResponse, error) {
out := new(MsgCreateDIDResponse)
err := c.cc.Invoke(ctx, Msg_CreateDID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateDID(ctx context.Context, in *MsgUpdateDID, opts ...grpc.CallOption) (*MsgUpdateDIDResponse, error) {
out := new(MsgUpdateDIDResponse)
err := c.cc.Invoke(ctx, Msg_UpdateDID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) DeactivateDID(ctx context.Context, in *MsgDeactivateDID, opts ...grpc.CallOption) (*MsgDeactivateDIDResponse, error) {
out := new(MsgDeactivateDIDResponse)
err := c.cc.Invoke(ctx, Msg_DeactivateDID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AddVerificationMethod(ctx context.Context, in *MsgAddVerificationMethod, opts ...grpc.CallOption) (*MsgAddVerificationMethodResponse, error) {
out := new(MsgAddVerificationMethodResponse)
err := c.cc.Invoke(ctx, Msg_AddVerificationMethod_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RemoveVerificationMethod(ctx context.Context, in *MsgRemoveVerificationMethod, opts ...grpc.CallOption) (*MsgRemoveVerificationMethodResponse, error) {
out := new(MsgRemoveVerificationMethodResponse)
err := c.cc.Invoke(ctx, Msg_RemoveVerificationMethod_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AddService(ctx context.Context, in *MsgAddService, opts ...grpc.CallOption) (*MsgAddServiceResponse, error) {
out := new(MsgAddServiceResponse)
err := c.cc.Invoke(ctx, Msg_AddService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RemoveService(ctx context.Context, in *MsgRemoveService, opts ...grpc.CallOption) (*MsgRemoveServiceResponse, error) {
out := new(MsgRemoveServiceResponse)
err := c.cc.Invoke(ctx, Msg_RemoveService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) IssueVerifiableCredential(ctx context.Context, in *MsgIssueVerifiableCredential, opts ...grpc.CallOption) (*MsgIssueVerifiableCredentialResponse, error) {
out := new(MsgIssueVerifiableCredentialResponse)
err := c.cc.Invoke(ctx, Msg_IssueVerifiableCredential_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RevokeVerifiableCredential(ctx context.Context, in *MsgRevokeVerifiableCredential, opts ...grpc.CallOption) (*MsgRevokeVerifiableCredentialResponse, error) {
out := new(MsgRevokeVerifiableCredentialResponse)
err := c.cc.Invoke(ctx, Msg_RevokeVerifiableCredential_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) LinkExternalWallet(ctx context.Context, in *MsgLinkExternalWallet, opts ...grpc.CallOption) (*MsgLinkExternalWalletResponse, error) {
out := new(MsgLinkExternalWalletResponse)
err := c.cc.Invoke(ctx, Msg_LinkExternalWallet_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RegisterWebAuthnCredential(ctx context.Context, in *MsgRegisterWebAuthnCredential, opts ...grpc.CallOption) (*MsgRegisterWebAuthnCredentialResponse, error) {
out := new(MsgRegisterWebAuthnCredentialResponse)
err := c.cc.Invoke(ctx, Msg_RegisterWebAuthnCredential_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -118,53 +199,93 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility.
//
// Msg defines the Msg service.
// for forward compatibility
type MsgServer interface {
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error)
// LinkAssertion links an assertion to a controller.
LinkAssertion(context.Context, *MsgLinkAssertion) (*MsgLinkAssertionResponse, error)
// LinkAuthentication links an authentication to a controller.
LinkAuthentication(context.Context, *MsgLinkAuthentication) (*MsgLinkAuthenticationResponse, error)
// UnlinkAssertion unlinks an assertion from a controller.
UnlinkAssertion(context.Context, *MsgUnlinkAssertion) (*MsgUnlinkAssertionResponse, error)
// UnlinkAuthentication unlinks an authentication from a controller.
UnlinkAuthentication(context.Context, *MsgUnlinkAuthentication) (*MsgUnlinkAuthenticationResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// CreateDID creates a new DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
CreateDID(context.Context, *MsgCreateDID) (*MsgCreateDIDResponse, error)
// UpdateDID updates an existing DID document
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
UpdateDID(context.Context, *MsgUpdateDID) (*MsgUpdateDIDResponse, error)
// DeactivateDID deactivates a DID document
DeactivateDID(context.Context, *MsgDeactivateDID) (*MsgDeactivateDIDResponse, error)
// AddVerificationMethod adds a new verification method to a DID document
AddVerificationMethod(context.Context, *MsgAddVerificationMethod) (*MsgAddVerificationMethodResponse, error)
// RemoveVerificationMethod removes a verification method from a DID document
RemoveVerificationMethod(context.Context, *MsgRemoveVerificationMethod) (*MsgRemoveVerificationMethodResponse, error)
// AddService adds a new service endpoint to a DID document
AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error)
// RemoveService removes a service endpoint from a DID document
RemoveService(context.Context, *MsgRemoveService) (*MsgRemoveServiceResponse, error)
// IssueVerifiableCredential issues a new verifiable credential
IssueVerifiableCredential(context.Context, *MsgIssueVerifiableCredential) (*MsgIssueVerifiableCredentialResponse, error)
// RevokeVerifiableCredential revokes a verifiable credential
RevokeVerifiableCredential(context.Context, *MsgRevokeVerifiableCredential) (*MsgRevokeVerifiableCredentialResponse, error)
// LinkExternalWallet links an external wallet as an assertion method
LinkExternalWallet(context.Context, *MsgLinkExternalWallet) (*MsgLinkExternalWalletResponse, error)
// RegisterWebAuthnCredential registers a new WebAuthn credential and creates a DID
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "did_tx_docs.md"}}
RegisterWebAuthnCredential(context.Context, *MsgRegisterWebAuthnCredential) (*MsgRegisterWebAuthnCredentialResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented")
}
func (UnimplementedMsgServer) LinkAssertion(context.Context, *MsgLinkAssertion) (*MsgLinkAssertionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LinkAssertion not implemented")
}
func (UnimplementedMsgServer) LinkAuthentication(context.Context, *MsgLinkAuthentication) (*MsgLinkAuthenticationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LinkAuthentication not implemented")
}
func (UnimplementedMsgServer) UnlinkAssertion(context.Context, *MsgUnlinkAssertion) (*MsgUnlinkAssertionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnlinkAssertion not implemented")
}
func (UnimplementedMsgServer) UnlinkAuthentication(context.Context, *MsgUnlinkAuthentication) (*MsgUnlinkAuthenticationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UnlinkAuthentication not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) CreateDID(context.Context, *MsgCreateDID) (*MsgCreateDIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDID not implemented")
}
func (UnimplementedMsgServer) UpdateDID(context.Context, *MsgUpdateDID) (*MsgUpdateDIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateDID not implemented")
}
func (UnimplementedMsgServer) DeactivateDID(context.Context, *MsgDeactivateDID) (*MsgDeactivateDIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeactivateDID not implemented")
}
func (UnimplementedMsgServer) AddVerificationMethod(context.Context, *MsgAddVerificationMethod) (*MsgAddVerificationMethodResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddVerificationMethod not implemented")
}
func (UnimplementedMsgServer) RemoveVerificationMethod(context.Context, *MsgRemoveVerificationMethod) (*MsgRemoveVerificationMethodResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveVerificationMethod not implemented")
}
func (UnimplementedMsgServer) AddService(context.Context, *MsgAddService) (*MsgAddServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddService not implemented")
}
func (UnimplementedMsgServer) RemoveService(context.Context, *MsgRemoveService) (*MsgRemoveServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RemoveService not implemented")
}
func (UnimplementedMsgServer) IssueVerifiableCredential(context.Context, *MsgIssueVerifiableCredential) (*MsgIssueVerifiableCredentialResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IssueVerifiableCredential not implemented")
}
func (UnimplementedMsgServer) RevokeVerifiableCredential(context.Context, *MsgRevokeVerifiableCredential) (*MsgRevokeVerifiableCredentialResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RevokeVerifiableCredential not implemented")
}
func (UnimplementedMsgServer) LinkExternalWallet(context.Context, *MsgLinkExternalWallet) (*MsgLinkExternalWalletResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method LinkExternalWallet not implemented")
}
func (UnimplementedMsgServer) RegisterWebAuthnCredential(context.Context, *MsgRegisterWebAuthnCredential) (*MsgRegisterWebAuthnCredentialResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterWebAuthnCredential not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -174,106 +295,9 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteTx)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ExecuteTx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ExecuteTx_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ExecuteTx(ctx, req.(*MsgExecuteTx))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_LinkAssertion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgLinkAssertion)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).LinkAssertion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_LinkAssertion_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).LinkAssertion(ctx, req.(*MsgLinkAssertion))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_LinkAuthentication_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgLinkAuthentication)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).LinkAuthentication(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_LinkAuthentication_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).LinkAuthentication(ctx, req.(*MsgLinkAuthentication))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UnlinkAssertion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUnlinkAssertion)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UnlinkAssertion(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UnlinkAssertion_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UnlinkAssertion(ctx, req.(*MsgUnlinkAssertion))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UnlinkAuthentication_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUnlinkAuthentication)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UnlinkAuthentication(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UnlinkAuthentication_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UnlinkAuthentication(ctx, req.(*MsgUnlinkAuthentication))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
@@ -292,6 +316,204 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_CreateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgCreateDID)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).CreateDID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_CreateDID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).CreateDID(ctx, req.(*MsgCreateDID))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateDID)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateDID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateDID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateDID(ctx, req.(*MsgUpdateDID))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_DeactivateDID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgDeactivateDID)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).DeactivateDID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_DeactivateDID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).DeactivateDID(ctx, req.(*MsgDeactivateDID))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AddVerificationMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddVerificationMethod)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddVerificationMethod(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AddVerificationMethod_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddVerificationMethod(ctx, req.(*MsgAddVerificationMethod))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RemoveVerificationMethod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRemoveVerificationMethod)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RemoveVerificationMethod(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RemoveVerificationMethod_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RemoveVerificationMethod(ctx, req.(*MsgRemoveVerificationMethod))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AddService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAddService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AddService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AddService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AddService(ctx, req.(*MsgAddService))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RemoveService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRemoveService)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RemoveService(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RemoveService_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RemoveService(ctx, req.(*MsgRemoveService))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_IssueVerifiableCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgIssueVerifiableCredential)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).IssueVerifiableCredential(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_IssueVerifiableCredential_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).IssueVerifiableCredential(ctx, req.(*MsgIssueVerifiableCredential))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RevokeVerifiableCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRevokeVerifiableCredential)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RevokeVerifiableCredential(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RevokeVerifiableCredential_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RevokeVerifiableCredential(ctx, req.(*MsgRevokeVerifiableCredential))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_LinkExternalWallet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgLinkExternalWallet)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).LinkExternalWallet(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_LinkExternalWallet_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).LinkExternalWallet(ctx, req.(*MsgLinkExternalWallet))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RegisterWebAuthnCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterWebAuthnCredential)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RegisterWebAuthnCredential(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RegisterWebAuthnCredential_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RegisterWebAuthnCredential(ctx, req.(*MsgRegisterWebAuthnCredential))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -299,30 +521,54 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "did.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ExecuteTx",
Handler: _Msg_ExecuteTx_Handler,
},
{
MethodName: "LinkAssertion",
Handler: _Msg_LinkAssertion_Handler,
},
{
MethodName: "LinkAuthentication",
Handler: _Msg_LinkAuthentication_Handler,
},
{
MethodName: "UnlinkAssertion",
Handler: _Msg_UnlinkAssertion_Handler,
},
{
MethodName: "UnlinkAuthentication",
Handler: _Msg_UnlinkAuthentication_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "CreateDID",
Handler: _Msg_CreateDID_Handler,
},
{
MethodName: "UpdateDID",
Handler: _Msg_UpdateDID_Handler,
},
{
MethodName: "DeactivateDID",
Handler: _Msg_DeactivateDID_Handler,
},
{
MethodName: "AddVerificationMethod",
Handler: _Msg_AddVerificationMethod_Handler,
},
{
MethodName: "RemoveVerificationMethod",
Handler: _Msg_RemoveVerificationMethod_Handler,
},
{
MethodName: "AddService",
Handler: _Msg_AddService_Handler,
},
{
MethodName: "RemoveService",
Handler: _Msg_RemoveService_Handler,
},
{
MethodName: "IssueVerifiableCredential",
Handler: _Msg_IssueVerifiableCredential_Handler,
},
{
MethodName: "RevokeVerifiableCredential",
Handler: _Msg_RevokeVerifiableCredential_Handler,
},
{
MethodName: "LinkExternalWallet",
Handler: _Msg_LinkExternalWallet_Handler,
},
{
MethodName: "RegisterWebAuthnCredential",
Handler: _Msg_RegisterWebAuthnCredential_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "did/v1/tx.proto",
File diff suppressed because it is too large Load Diff
+20 -19
View File
@@ -2,15 +2,16 @@
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
@@ -417,21 +418,21 @@ var file_dwn_module_v1_module_proto_rawDesc = []byte{
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x64, 0x77,
0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1e, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x18, 0x0a,
0x16, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f,
0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e,
0x64, 0x77, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f,
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x77, 0x6e, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x44, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x44, 0x77, 0x6e, 0x2e, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x44, 0x77, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x44, 0x77, 0x6e, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0xea, 0x02, 0x0f, 0x44, 0x77, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1f, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x19, 0x0a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
0x2d, 0x69, 0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xaa, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d,
0x2e, 0x64, 0x77, 0x6e, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2d, 0x69,
0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x77, 0x6e, 0x2f, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x44, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x44, 0x77, 0x6e, 0x2e, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x44, 0x77, 0x6e, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x44, 0x77, 0x6e, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x44, 0x77, 0x6e, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+1528 -3285
View File
File diff suppressed because it is too large Load Diff
+12912 -1648
View File
File diff suppressed because it is too large Load Diff
+422 -85
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: dwn/v1/query.proto
@@ -8,6 +8,7 @@ package dwnv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,33 +16,60 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/dwn.v1.Query/Params"
Query_Schema_FullMethodName = "/dwn.v1.Query/Schema"
Query_Allocate_FullMethodName = "/dwn.v1.Query/Allocate"
Query_Sync_FullMethodName = "/dwn.v1.Query/Sync"
Query_Params_FullMethodName = "/dwn.v1.Query/Params"
Query_IPFS_FullMethodName = "/dwn.v1.Query/IPFS"
Query_CID_FullMethodName = "/dwn.v1.Query/CID"
Query_Records_FullMethodName = "/dwn.v1.Query/Records"
Query_Record_FullMethodName = "/dwn.v1.Query/Record"
Query_Protocols_FullMethodName = "/dwn.v1.Query/Protocols"
Query_Protocol_FullMethodName = "/dwn.v1.Query/Protocol"
Query_Permissions_FullMethodName = "/dwn.v1.Query/Permissions"
Query_Vault_FullMethodName = "/dwn.v1.Query/Vault"
Query_Vaults_FullMethodName = "/dwn.v1.Query/Vaults"
Query_EncryptedRecord_FullMethodName = "/dwn.v1.Query/EncryptedRecord"
Query_EncryptionStatus_FullMethodName = "/dwn.v1.Query/EncryptionStatus"
Query_VRFContributions_FullMethodName = "/dwn.v1.Query/VRFContributions"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query provides defines the gRPC querier service.
type QueryClient interface {
// Params queries all parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Schema queries the DID document by its id. And returns the required PKL
// information
Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL
// information
Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error)
// IPFS queries the status of the IPFS node
IPFS(ctx context.Context, in *QueryIPFSRequest, opts ...grpc.CallOption) (*QueryIPFSResponse, error)
// CID returns the data for a given CID
CID(ctx context.Context, in *QueryCIDRequest, opts ...grpc.CallOption) (*QueryCIDResponse, error)
// Records queries DWN records with filters
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dwn_docs.md"}}
Records(ctx context.Context, in *QueryRecordsRequest, opts ...grpc.CallOption) (*QueryRecordsResponse, error)
// Record queries a specific DWN record by ID
Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error)
// Protocols queries DWN protocols
Protocols(ctx context.Context, in *QueryProtocolsRequest, opts ...grpc.CallOption) (*QueryProtocolsResponse, error)
// Protocol queries a specific DWN protocol
Protocol(ctx context.Context, in *QueryProtocolRequest, opts ...grpc.CallOption) (*QueryProtocolResponse, error)
// Permissions queries DWN permissions
Permissions(ctx context.Context, in *QueryPermissionsRequest, opts ...grpc.CallOption) (*QueryPermissionsResponse, error)
// Vault queries a specific vault
Vault(ctx context.Context, in *QueryVaultRequest, opts ...grpc.CallOption) (*QueryVaultResponse, error)
// Vaults queries vaults by owner
Vaults(ctx context.Context, in *QueryVaultsRequest, opts ...grpc.CallOption) (*QueryVaultsResponse, error)
// EncryptedRecord queries a specific encrypted record with automatic decryption
EncryptedRecord(ctx context.Context, in *QueryEncryptedRecordRequest, opts ...grpc.CallOption) (*QueryEncryptedRecordResponse, error)
// EncryptionStatus queries current encryption key state and version
EncryptionStatus(ctx context.Context, in *QueryEncryptionStatusRequest, opts ...grpc.CallOption) (*QueryEncryptionStatusResponse, error)
// VRFContributions lists VRF contributions for current consensus round
VRFContributions(ctx context.Context, in *QueryVRFContributionsRequest, opts ...grpc.CallOption) (*QueryVRFContributionsResponse, error)
}
type queryClient struct {
@@ -53,39 +81,116 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Schema(ctx context.Context, in *QuerySchemaRequest, opts ...grpc.CallOption) (*QuerySchemaResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QuerySchemaResponse)
err := c.cc.Invoke(ctx, Query_Schema_FullMethodName, in, out, cOpts...)
func (c *queryClient) IPFS(ctx context.Context, in *QueryIPFSRequest, opts ...grpc.CallOption) (*QueryIPFSResponse, error) {
out := new(QueryIPFSResponse)
err := c.cc.Invoke(ctx, Query_IPFS_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Allocate(ctx context.Context, in *QueryAllocateRequest, opts ...grpc.CallOption) (*QueryAllocateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryAllocateResponse)
err := c.cc.Invoke(ctx, Query_Allocate_FullMethodName, in, out, cOpts...)
func (c *queryClient) CID(ctx context.Context, in *QueryCIDRequest, opts ...grpc.CallOption) (*QueryCIDResponse, error) {
out := new(QueryCIDResponse)
err := c.cc.Invoke(ctx, Query_CID_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...grpc.CallOption) (*QuerySyncResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QuerySyncResponse)
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, cOpts...)
func (c *queryClient) Records(ctx context.Context, in *QueryRecordsRequest, opts ...grpc.CallOption) (*QueryRecordsResponse, error) {
out := new(QueryRecordsResponse)
err := c.cc.Invoke(ctx, Query_Records_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Record(ctx context.Context, in *QueryRecordRequest, opts ...grpc.CallOption) (*QueryRecordResponse, error) {
out := new(QueryRecordResponse)
err := c.cc.Invoke(ctx, Query_Record_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Protocols(ctx context.Context, in *QueryProtocolsRequest, opts ...grpc.CallOption) (*QueryProtocolsResponse, error) {
out := new(QueryProtocolsResponse)
err := c.cc.Invoke(ctx, Query_Protocols_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Protocol(ctx context.Context, in *QueryProtocolRequest, opts ...grpc.CallOption) (*QueryProtocolResponse, error) {
out := new(QueryProtocolResponse)
err := c.cc.Invoke(ctx, Query_Protocol_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Permissions(ctx context.Context, in *QueryPermissionsRequest, opts ...grpc.CallOption) (*QueryPermissionsResponse, error) {
out := new(QueryPermissionsResponse)
err := c.cc.Invoke(ctx, Query_Permissions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Vault(ctx context.Context, in *QueryVaultRequest, opts ...grpc.CallOption) (*QueryVaultResponse, error) {
out := new(QueryVaultResponse)
err := c.cc.Invoke(ctx, Query_Vault_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Vaults(ctx context.Context, in *QueryVaultsRequest, opts ...grpc.CallOption) (*QueryVaultsResponse, error) {
out := new(QueryVaultsResponse)
err := c.cc.Invoke(ctx, Query_Vaults_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) EncryptedRecord(ctx context.Context, in *QueryEncryptedRecordRequest, opts ...grpc.CallOption) (*QueryEncryptedRecordResponse, error) {
out := new(QueryEncryptedRecordResponse)
err := c.cc.Invoke(ctx, Query_EncryptedRecord_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) EncryptionStatus(ctx context.Context, in *QueryEncryptionStatusRequest, opts ...grpc.CallOption) (*QueryEncryptionStatusResponse, error) {
out := new(QueryEncryptionStatusResponse)
err := c.cc.Invoke(ctx, Query_EncryptionStatus_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) VRFContributions(ctx context.Context, in *QueryVRFContributionsRequest, opts ...grpc.CallOption) (*QueryVRFContributionsResponse, error) {
out := new(QueryVRFContributionsResponse)
err := c.cc.Invoke(ctx, Query_VRFContributions_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -94,45 +199,86 @@ func (c *queryClient) Sync(ctx context.Context, in *QuerySyncRequest, opts ...gr
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility.
//
// Query provides defines the gRPC querier service.
// for forward compatibility
type QueryServer interface {
// Params queries all parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// Schema queries the DID document by its id. And returns the required PKL
// information
Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error)
// Allocate initializes a Target Vault available for claims with a compatible
// Authentication mechanism. The default authentication mechanism is WebAuthn.
Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error)
// Sync queries the DID document by its id. And returns the required PKL
// information
Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error)
// IPFS queries the status of the IPFS node
IPFS(context.Context, *QueryIPFSRequest) (*QueryIPFSResponse, error)
// CID returns the data for a given CID
CID(context.Context, *QueryCIDRequest) (*QueryCIDResponse, error)
// Records queries DWN records with filters
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dwn_docs.md"}}
Records(context.Context, *QueryRecordsRequest) (*QueryRecordsResponse, error)
// Record queries a specific DWN record by ID
Record(context.Context, *QueryRecordRequest) (*QueryRecordResponse, error)
// Protocols queries DWN protocols
Protocols(context.Context, *QueryProtocolsRequest) (*QueryProtocolsResponse, error)
// Protocol queries a specific DWN protocol
Protocol(context.Context, *QueryProtocolRequest) (*QueryProtocolResponse, error)
// Permissions queries DWN permissions
Permissions(context.Context, *QueryPermissionsRequest) (*QueryPermissionsResponse, error)
// Vault queries a specific vault
Vault(context.Context, *QueryVaultRequest) (*QueryVaultResponse, error)
// Vaults queries vaults by owner
Vaults(context.Context, *QueryVaultsRequest) (*QueryVaultsResponse, error)
// EncryptedRecord queries a specific encrypted record with automatic decryption
EncryptedRecord(context.Context, *QueryEncryptedRecordRequest) (*QueryEncryptedRecordResponse, error)
// EncryptionStatus queries current encryption key state and version
EncryptionStatus(context.Context, *QueryEncryptionStatusRequest) (*QueryEncryptionStatusResponse, error)
// VRFContributions lists VRF contributions for current consensus round
VRFContributions(context.Context, *QueryVRFContributionsRequest) (*QueryVRFContributionsResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (UnimplementedQueryServer) Schema(context.Context, *QuerySchemaRequest) (*QuerySchemaResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Schema not implemented")
func (UnimplementedQueryServer) IPFS(context.Context, *QueryIPFSRequest) (*QueryIPFSResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IPFS not implemented")
}
func (UnimplementedQueryServer) Allocate(context.Context, *QueryAllocateRequest) (*QueryAllocateResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Allocate not implemented")
func (UnimplementedQueryServer) CID(context.Context, *QueryCIDRequest) (*QueryCIDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CID not implemented")
}
func (UnimplementedQueryServer) Sync(context.Context, *QuerySyncRequest) (*QuerySyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
func (UnimplementedQueryServer) Records(context.Context, *QueryRecordsRequest) (*QueryRecordsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Records not implemented")
}
func (UnimplementedQueryServer) Record(context.Context, *QueryRecordRequest) (*QueryRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Record not implemented")
}
func (UnimplementedQueryServer) Protocols(context.Context, *QueryProtocolsRequest) (*QueryProtocolsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Protocols not implemented")
}
func (UnimplementedQueryServer) Protocol(context.Context, *QueryProtocolRequest) (*QueryProtocolResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Protocol not implemented")
}
func (UnimplementedQueryServer) Permissions(context.Context, *QueryPermissionsRequest) (*QueryPermissionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Permissions not implemented")
}
func (UnimplementedQueryServer) Vault(context.Context, *QueryVaultRequest) (*QueryVaultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Vault not implemented")
}
func (UnimplementedQueryServer) Vaults(context.Context, *QueryVaultsRequest) (*QueryVaultsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Vaults not implemented")
}
func (UnimplementedQueryServer) EncryptedRecord(context.Context, *QueryEncryptedRecordRequest) (*QueryEncryptedRecordResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EncryptedRecord not implemented")
}
func (UnimplementedQueryServer) EncryptionStatus(context.Context, *QueryEncryptionStatusRequest) (*QueryEncryptionStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method EncryptionStatus not implemented")
}
func (UnimplementedQueryServer) VRFContributions(context.Context, *QueryVRFContributionsRequest) (*QueryVRFContributionsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VRFContributions not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -142,13 +288,6 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
@@ -170,56 +309,218 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
func _Query_Schema_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuerySchemaRequest)
func _Query_IPFS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryIPFSRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Schema(ctx, in)
return srv.(QueryServer).IPFS(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Schema_FullMethodName,
FullMethod: Query_IPFS_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Schema(ctx, req.(*QuerySchemaRequest))
return srv.(QueryServer).IPFS(ctx, req.(*QueryIPFSRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryAllocateRequest)
func _Query_CID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryCIDRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Allocate(ctx, in)
return srv.(QueryServer).CID(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Allocate_FullMethodName,
FullMethod: Query_CID_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Allocate(ctx, req.(*QueryAllocateRequest))
return srv.(QueryServer).CID(ctx, req.(*QueryCIDRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QuerySyncRequest)
func _Query_Records_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRecordsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Sync(ctx, in)
return srv.(QueryServer).Records(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Sync_FullMethodName,
FullMethod: Query_Records_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Sync(ctx, req.(*QuerySyncRequest))
return srv.(QueryServer).Records(ctx, req.(*QueryRecordsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Record_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryRecordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Record(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Record_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Record(ctx, req.(*QueryRecordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Protocols_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProtocolsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Protocols(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Protocols_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Protocols(ctx, req.(*QueryProtocolsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Protocol_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryProtocolRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Protocol(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Protocol_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Protocol(ctx, req.(*QueryProtocolRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Permissions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryPermissionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Permissions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Permissions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Permissions(ctx, req.(*QueryPermissionsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Vault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryVaultRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Vault(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Vault_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Vault(ctx, req.(*QueryVaultRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Vaults_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryVaultsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Vaults(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Vaults_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Vaults(ctx, req.(*QueryVaultsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_EncryptedRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryEncryptedRecordRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).EncryptedRecord(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_EncryptedRecord_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).EncryptedRecord(ctx, req.(*QueryEncryptedRecordRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_EncryptionStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryEncryptionStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).EncryptionStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_EncryptionStatus_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).EncryptionStatus(ctx, req.(*QueryEncryptionStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_VRFContributions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryVRFContributionsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).VRFContributions(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_VRFContributions_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).VRFContributions(ctx, req.(*QueryVRFContributionsRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -236,16 +537,52 @@ var Query_ServiceDesc = grpc.ServiceDesc{
Handler: _Query_Params_Handler,
},
{
MethodName: "Schema",
Handler: _Query_Schema_Handler,
MethodName: "IPFS",
Handler: _Query_IPFS_Handler,
},
{
MethodName: "Allocate",
Handler: _Query_Allocate_Handler,
MethodName: "CID",
Handler: _Query_CID_Handler,
},
{
MethodName: "Sync",
Handler: _Query_Sync_Handler,
MethodName: "Records",
Handler: _Query_Records_Handler,
},
{
MethodName: "Record",
Handler: _Query_Record_Handler,
},
{
MethodName: "Protocols",
Handler: _Query_Protocols_Handler,
},
{
MethodName: "Protocol",
Handler: _Query_Protocol_Handler,
},
{
MethodName: "Permissions",
Handler: _Query_Permissions_Handler,
},
{
MethodName: "Vault",
Handler: _Query_Vault_Handler,
},
{
MethodName: "Vaults",
Handler: _Query_Vaults_Handler,
},
{
MethodName: "EncryptedRecord",
Handler: _Query_EncryptedRecord_Handler,
},
{
MethodName: "EncryptionStatus",
Handler: _Query_EncryptionStatus_Handler,
},
{
MethodName: "VRFContributions",
Handler: _Query_VRFContributions_Handler,
},
},
Streams: []grpc.StreamDesc{},
File diff suppressed because it is too large Load Diff
+11808 -483
View File
File diff suppressed because it is too large Load Diff
+8191 -260
View File
File diff suppressed because it is too large Load Diff
+228 -47
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: dwn/v1/tx.proto
@@ -8,6 +8,7 @@ package dwnv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,26 +16,40 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_UpdateParams_FullMethodName = "/dwn.v1.Msg/UpdateParams"
Msg_Initialize_FullMethodName = "/dwn.v1.Msg/Initialize"
Msg_UpdateParams_FullMethodName = "/dwn.v1.Msg/UpdateParams"
Msg_RecordsWrite_FullMethodName = "/dwn.v1.Msg/RecordsWrite"
Msg_RecordsDelete_FullMethodName = "/dwn.v1.Msg/RecordsDelete"
Msg_ProtocolsConfigure_FullMethodName = "/dwn.v1.Msg/ProtocolsConfigure"
Msg_PermissionsGrant_FullMethodName = "/dwn.v1.Msg/PermissionsGrant"
Msg_PermissionsRevoke_FullMethodName = "/dwn.v1.Msg/PermissionsRevoke"
Msg_RotateVaultKeys_FullMethodName = "/dwn.v1.Msg/RotateVaultKeys"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg defines the Msg service.
type MsgClient interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// Initialize spawns a new Vault
Initialize(ctx context.Context, in *MsgInitialize, opts ...grpc.CallOption) (*MsgInitializeResponse, error)
// DWN Records Operations
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dwn_docs.md"}}
RecordsWrite(ctx context.Context, in *MsgRecordsWrite, opts ...grpc.CallOption) (*MsgRecordsWriteResponse, error)
RecordsDelete(ctx context.Context, in *MsgRecordsDelete, opts ...grpc.CallOption) (*MsgRecordsDeleteResponse, error)
// DWN Protocols Operations
ProtocolsConfigure(ctx context.Context, in *MsgProtocolsConfigure, opts ...grpc.CallOption) (*MsgProtocolsConfigureResponse, error)
// DWN Permissions Operations
PermissionsGrant(ctx context.Context, in *MsgPermissionsGrant, opts ...grpc.CallOption) (*MsgPermissionsGrantResponse, error)
PermissionsRevoke(ctx context.Context, in *MsgPermissionsRevoke, opts ...grpc.CallOption) (*MsgPermissionsRevokeResponse, error)
// DWN Vault Operations
RotateVaultKeys(ctx context.Context, in *MsgRotateVaultKeys, opts ...grpc.CallOption) (*MsgRotateVaultKeysResponse, error)
}
type msgClient struct {
@@ -46,19 +61,62 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) Initialize(ctx context.Context, in *MsgInitialize, opts ...grpc.CallOption) (*MsgInitializeResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgInitializeResponse)
err := c.cc.Invoke(ctx, Msg_Initialize_FullMethodName, in, out, cOpts...)
func (c *msgClient) RecordsWrite(ctx context.Context, in *MsgRecordsWrite, opts ...grpc.CallOption) (*MsgRecordsWriteResponse, error) {
out := new(MsgRecordsWriteResponse)
err := c.cc.Invoke(ctx, Msg_RecordsWrite_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RecordsDelete(ctx context.Context, in *MsgRecordsDelete, opts ...grpc.CallOption) (*MsgRecordsDeleteResponse, error) {
out := new(MsgRecordsDeleteResponse)
err := c.cc.Invoke(ctx, Msg_RecordsDelete_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) ProtocolsConfigure(ctx context.Context, in *MsgProtocolsConfigure, opts ...grpc.CallOption) (*MsgProtocolsConfigureResponse, error) {
out := new(MsgProtocolsConfigureResponse)
err := c.cc.Invoke(ctx, Msg_ProtocolsConfigure_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) PermissionsGrant(ctx context.Context, in *MsgPermissionsGrant, opts ...grpc.CallOption) (*MsgPermissionsGrantResponse, error) {
out := new(MsgPermissionsGrantResponse)
err := c.cc.Invoke(ctx, Msg_PermissionsGrant_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) PermissionsRevoke(ctx context.Context, in *MsgPermissionsRevoke, opts ...grpc.CallOption) (*MsgPermissionsRevokeResponse, error) {
out := new(MsgPermissionsRevokeResponse)
err := c.cc.Invoke(ctx, Msg_PermissionsRevoke_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) RotateVaultKeys(ctx context.Context, in *MsgRotateVaultKeys, opts ...grpc.CallOption) (*MsgRotateVaultKeysResponse, error) {
out := new(MsgRotateVaultKeysResponse)
err := c.cc.Invoke(ctx, Msg_RotateVaultKeys_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -67,34 +125,54 @@ func (c *msgClient) Initialize(ctx context.Context, in *MsgInitialize, opts ...g
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility.
//
// Msg defines the Msg service.
// for forward compatibility
type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// Initialize spawns a new Vault
Initialize(context.Context, *MsgInitialize) (*MsgInitializeResponse, error)
// DWN Records Operations
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "dwn_docs.md"}}
RecordsWrite(context.Context, *MsgRecordsWrite) (*MsgRecordsWriteResponse, error)
RecordsDelete(context.Context, *MsgRecordsDelete) (*MsgRecordsDeleteResponse, error)
// DWN Protocols Operations
ProtocolsConfigure(context.Context, *MsgProtocolsConfigure) (*MsgProtocolsConfigureResponse, error)
// DWN Permissions Operations
PermissionsGrant(context.Context, *MsgPermissionsGrant) (*MsgPermissionsGrantResponse, error)
PermissionsRevoke(context.Context, *MsgPermissionsRevoke) (*MsgPermissionsRevokeResponse, error)
// DWN Vault Operations
RotateVaultKeys(context.Context, *MsgRotateVaultKeys) (*MsgRotateVaultKeysResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) Initialize(context.Context, *MsgInitialize) (*MsgInitializeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Initialize not implemented")
func (UnimplementedMsgServer) RecordsWrite(context.Context, *MsgRecordsWrite) (*MsgRecordsWriteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RecordsWrite not implemented")
}
func (UnimplementedMsgServer) RecordsDelete(context.Context, *MsgRecordsDelete) (*MsgRecordsDeleteResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RecordsDelete not implemented")
}
func (UnimplementedMsgServer) ProtocolsConfigure(context.Context, *MsgProtocolsConfigure) (*MsgProtocolsConfigureResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ProtocolsConfigure not implemented")
}
func (UnimplementedMsgServer) PermissionsGrant(context.Context, *MsgPermissionsGrant) (*MsgPermissionsGrantResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PermissionsGrant not implemented")
}
func (UnimplementedMsgServer) PermissionsRevoke(context.Context, *MsgPermissionsRevoke) (*MsgPermissionsRevokeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PermissionsRevoke not implemented")
}
func (UnimplementedMsgServer) RotateVaultKeys(context.Context, *MsgRotateVaultKeys) (*MsgRotateVaultKeysResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RotateVaultKeys not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -104,13 +182,6 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
@@ -132,20 +203,110 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_Initialize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgInitialize)
func _Msg_RecordsWrite_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRecordsWrite)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).Initialize(ctx, in)
return srv.(MsgServer).RecordsWrite(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_Initialize_FullMethodName,
FullMethod: Msg_RecordsWrite_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).Initialize(ctx, req.(*MsgInitialize))
return srv.(MsgServer).RecordsWrite(ctx, req.(*MsgRecordsWrite))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RecordsDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRecordsDelete)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RecordsDelete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RecordsDelete_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RecordsDelete(ctx, req.(*MsgRecordsDelete))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_ProtocolsConfigure_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgProtocolsConfigure)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ProtocolsConfigure(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_ProtocolsConfigure_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ProtocolsConfigure(ctx, req.(*MsgProtocolsConfigure))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_PermissionsGrant_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgPermissionsGrant)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).PermissionsGrant(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_PermissionsGrant_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).PermissionsGrant(ctx, req.(*MsgPermissionsGrant))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_PermissionsRevoke_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgPermissionsRevoke)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).PermissionsRevoke(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_PermissionsRevoke_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).PermissionsRevoke(ctx, req.(*MsgPermissionsRevoke))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RotateVaultKeys_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRotateVaultKeys)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).RotateVaultKeys(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_RotateVaultKeys_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).RotateVaultKeys(ctx, req.(*MsgRotateVaultKeys))
}
return interceptor(ctx, in, info, handler)
}
@@ -162,8 +323,28 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "Initialize",
Handler: _Msg_Initialize_Handler,
MethodName: "RecordsWrite",
Handler: _Msg_RecordsWrite_Handler,
},
{
MethodName: "RecordsDelete",
Handler: _Msg_RecordsDelete_Handler,
},
{
MethodName: "ProtocolsConfigure",
Handler: _Msg_ProtocolsConfigure_Handler,
},
{
MethodName: "PermissionsGrant",
Handler: _Msg_PermissionsGrant_Handler,
},
{
MethodName: "PermissionsRevoke",
Handler: _Msg_PermissionsRevoke_Handler,
},
{
MethodName: "RotateVaultKeys",
Handler: _Msg_RotateVaultKeys_Handler,
},
},
Streams: []grpc.StreamDesc{},
+20 -19
View File
@@ -2,15 +2,16 @@
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
@@ -417,21 +418,21 @@ var file_svc_module_v1_module_proto_rawDesc = []byte{
0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x76,
0x63, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x28, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1e, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x18, 0x0a,
0x16, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f,
0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xa9, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e,
0x73, 0x76, 0x63, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f,
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x76, 0x63, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x76, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x76, 0x63, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x76, 0x63, 0x5c, 0x4d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0xea, 0x02, 0x0f, 0x53, 0x76, 0x63, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x29, 0x0a,
0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1f, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x19, 0x0a,
0x17, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
0x2d, 0x69, 0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xaa, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d,
0x2e, 0x73, 0x76, 0x63, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2d, 0x69,
0x6f, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x76, 0x63, 0x2f, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76,
0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x76, 0x63, 0x2e, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x76, 0x63, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x76, 0x63, 0x5c, 0x4d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x76, 0x63, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
File diff suppressed because it is too large Load Diff
+1404 -2095
View File
File diff suppressed because it is too large Load Diff
+9685 -35
View File
File diff suppressed because it is too large Load Diff
+293 -25
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: svc/v1/query.proto
@@ -8,6 +8,7 @@ package svcv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,21 +16,45 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/svc.v1.Query/Params"
Query_Params_FullMethodName = "/svc.v1.Query/Params"
Query_DomainVerification_FullMethodName = "/svc.v1.Query/DomainVerification"
Query_Service_FullMethodName = "/svc.v1.Query/Service"
Query_ServicesByOwner_FullMethodName = "/svc.v1.Query/ServicesByOwner"
Query_ServicesByDomain_FullMethodName = "/svc.v1.Query/ServicesByDomain"
Query_ServiceOIDCDiscovery_FullMethodName = "/svc.v1.Query/ServiceOIDCDiscovery"
Query_ServiceOIDCJWKS_FullMethodName = "/svc.v1.Query/ServiceOIDCJWKS"
Query_ServiceOIDCMetadata_FullMethodName = "/svc.v1.Query/ServiceOIDCMetadata"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Query provides defines the gRPC querier service.
type QueryClient interface {
// Params queries all parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// DomainVerification queries domain verification status by domain name.
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "svc_docs.md"}}
DomainVerification(ctx context.Context, in *QueryDomainVerificationRequest, opts ...grpc.CallOption) (*QueryDomainVerificationResponse, error)
// Service queries service information by service ID.
Service(ctx context.Context, in *QueryServiceRequest, opts ...grpc.CallOption) (*QueryServiceResponse, error)
// ServicesByOwner queries all services owned by a specific address.
ServicesByOwner(ctx context.Context, in *QueryServicesByOwnerRequest, opts ...grpc.CallOption) (*QueryServicesByOwnerResponse, error)
// ServicesByDomain queries services bound to a specific domain.
ServicesByDomain(ctx context.Context, in *QueryServicesByDomainRequest, opts ...grpc.CallOption) (*QueryServicesByDomainResponse, error)
// ServiceOIDCDiscovery queries OIDC discovery configuration for a service
ServiceOIDCDiscovery(ctx context.Context, in *QueryServiceOIDCDiscoveryRequest, opts ...grpc.CallOption) (*QueryServiceOIDCDiscoveryResponse, error)
// ServiceOIDCJWKS queries OIDC JWKS for a service
ServiceOIDCJWKS(ctx context.Context, in *QueryServiceOIDCJWKSRequest, opts ...grpc.CallOption) (*QueryServiceOIDCJWKSResponse, error)
// ServiceOIDCMetadata queries OIDC metadata for a service
ServiceOIDCMetadata(ctx context.Context, in *QueryServiceOIDCMetadataRequest, opts ...grpc.CallOption) (*QueryServiceOIDCMetadataResponse, error)
}
type queryClient struct {
@@ -41,9 +66,71 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) DomainVerification(ctx context.Context, in *QueryDomainVerificationRequest, opts ...grpc.CallOption) (*QueryDomainVerificationResponse, error) {
out := new(QueryDomainVerificationResponse)
err := c.cc.Invoke(ctx, Query_DomainVerification_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Service(ctx context.Context, in *QueryServiceRequest, opts ...grpc.CallOption) (*QueryServiceResponse, error) {
out := new(QueryServiceResponse)
err := c.cc.Invoke(ctx, Query_Service_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ServicesByOwner(ctx context.Context, in *QueryServicesByOwnerRequest, opts ...grpc.CallOption) (*QueryServicesByOwnerResponse, error) {
out := new(QueryServicesByOwnerResponse)
err := c.cc.Invoke(ctx, Query_ServicesByOwner_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ServicesByDomain(ctx context.Context, in *QueryServicesByDomainRequest, opts ...grpc.CallOption) (*QueryServicesByDomainResponse, error) {
out := new(QueryServicesByDomainResponse)
err := c.cc.Invoke(ctx, Query_ServicesByDomain_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ServiceOIDCDiscovery(ctx context.Context, in *QueryServiceOIDCDiscoveryRequest, opts ...grpc.CallOption) (*QueryServiceOIDCDiscoveryResponse, error) {
out := new(QueryServiceOIDCDiscoveryResponse)
err := c.cc.Invoke(ctx, Query_ServiceOIDCDiscovery_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ServiceOIDCJWKS(ctx context.Context, in *QueryServiceOIDCJWKSRequest, opts ...grpc.CallOption) (*QueryServiceOIDCJWKSResponse, error) {
out := new(QueryServiceOIDCJWKSResponse)
err := c.cc.Invoke(ctx, Query_ServiceOIDCJWKS_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) ServiceOIDCMetadata(ctx context.Context, in *QueryServiceOIDCMetadataRequest, opts ...grpc.CallOption) (*QueryServiceOIDCMetadataResponse, error) {
out := new(QueryServiceOIDCMetadataResponse)
err := c.cc.Invoke(ctx, Query_ServiceOIDCMetadata_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -52,27 +139,61 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts .
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility.
//
// Query provides defines the gRPC querier service.
// for forward compatibility
type QueryServer interface {
// Params queries all parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// DomainVerification queries domain verification status by domain name.
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "svc_docs.md"}}
DomainVerification(context.Context, *QueryDomainVerificationRequest) (*QueryDomainVerificationResponse, error)
// Service queries service information by service ID.
Service(context.Context, *QueryServiceRequest) (*QueryServiceResponse, error)
// ServicesByOwner queries all services owned by a specific address.
ServicesByOwner(context.Context, *QueryServicesByOwnerRequest) (*QueryServicesByOwnerResponse, error)
// ServicesByDomain queries services bound to a specific domain.
ServicesByDomain(context.Context, *QueryServicesByDomainRequest) (*QueryServicesByDomainResponse, error)
// ServiceOIDCDiscovery queries OIDC discovery configuration for a service
ServiceOIDCDiscovery(context.Context, *QueryServiceOIDCDiscoveryRequest) (*QueryServiceOIDCDiscoveryResponse, error)
// ServiceOIDCJWKS queries OIDC JWKS for a service
ServiceOIDCJWKS(context.Context, *QueryServiceOIDCJWKSRequest) (*QueryServiceOIDCJWKSResponse, error)
// ServiceOIDCMetadata queries OIDC metadata for a service
ServiceOIDCMetadata(context.Context, *QueryServiceOIDCMetadataRequest) (*QueryServiceOIDCMetadataResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedQueryServer struct{}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (UnimplementedQueryServer) DomainVerification(context.Context, *QueryDomainVerificationRequest) (*QueryDomainVerificationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DomainVerification not implemented")
}
func (UnimplementedQueryServer) Service(context.Context, *QueryServiceRequest) (*QueryServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Service not implemented")
}
func (UnimplementedQueryServer) ServicesByOwner(context.Context, *QueryServicesByOwnerRequest) (*QueryServicesByOwnerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServicesByOwner not implemented")
}
func (UnimplementedQueryServer) ServicesByDomain(context.Context, *QueryServicesByDomainRequest) (*QueryServicesByDomainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServicesByDomain not implemented")
}
func (UnimplementedQueryServer) ServiceOIDCDiscovery(context.Context, *QueryServiceOIDCDiscoveryRequest) (*QueryServiceOIDCDiscoveryResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceOIDCDiscovery not implemented")
}
func (UnimplementedQueryServer) ServiceOIDCJWKS(context.Context, *QueryServiceOIDCJWKSRequest) (*QueryServiceOIDCJWKSResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceOIDCJWKS not implemented")
}
func (UnimplementedQueryServer) ServiceOIDCMetadata(context.Context, *QueryServiceOIDCMetadataRequest) (*QueryServiceOIDCMetadataResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ServiceOIDCMetadata not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
func (UnimplementedQueryServer) testEmbeddedByValue() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
@@ -82,13 +203,6 @@ type UnsafeQueryServer interface {
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
// If the following call pancis, it indicates UnimplementedQueryServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Query_ServiceDesc, srv)
}
@@ -110,6 +224,132 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf
return interceptor(ctx, in, info, handler)
}
func _Query_DomainVerification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryDomainVerificationRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).DomainVerification(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_DomainVerification_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).DomainVerification(ctx, req.(*QueryDomainVerificationRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Service_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServiceRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Service(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Service_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Service(ctx, req.(*QueryServiceRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ServicesByOwner_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServicesByOwnerRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ServicesByOwner(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ServicesByOwner_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ServicesByOwner(ctx, req.(*QueryServicesByOwnerRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ServicesByDomain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServicesByDomainRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ServicesByDomain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ServicesByDomain_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ServicesByDomain(ctx, req.(*QueryServicesByDomainRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ServiceOIDCDiscovery_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServiceOIDCDiscoveryRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ServiceOIDCDiscovery(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ServiceOIDCDiscovery_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ServiceOIDCDiscovery(ctx, req.(*QueryServiceOIDCDiscoveryRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ServiceOIDCJWKS_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServiceOIDCJWKSRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ServiceOIDCJWKS(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ServiceOIDCJWKS_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ServiceOIDCJWKS(ctx, req.(*QueryServiceOIDCJWKSRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_ServiceOIDCMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryServiceOIDCMetadataRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).ServiceOIDCMetadata(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_ServiceOIDCMetadata_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).ServiceOIDCMetadata(ctx, req.(*QueryServiceOIDCMetadataRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -121,6 +361,34 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "DomainVerification",
Handler: _Query_DomainVerification_Handler,
},
{
MethodName: "Service",
Handler: _Query_Service_Handler,
},
{
MethodName: "ServicesByOwner",
Handler: _Query_ServicesByOwner_Handler,
},
{
MethodName: "ServicesByDomain",
Handler: _Query_ServicesByDomain_Handler,
},
{
MethodName: "ServiceOIDCDiscovery",
Handler: _Query_ServiceOIDCDiscovery_Handler,
},
{
MethodName: "ServiceOIDCJWKS",
Handler: _Query_ServiceOIDCJWKS_Handler,
},
{
MethodName: "ServiceOIDCMetadata",
Handler: _Query_ServiceOIDCMetadata_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "svc/v1/query.proto",
File diff suppressed because it is too large Load Diff
+7598 -1055
View File
File diff suppressed because it is too large Load Diff
+2714 -225
View File
File diff suppressed because it is too large Load Diff
+102 -32
View File
@@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: svc/v1/tx.proto
@@ -8,6 +8,7 @@ package svcv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
@@ -15,26 +16,34 @@ import (
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_UpdateParams_FullMethodName = "/svc.v1.Msg/UpdateParams"
Msg_RegisterService_FullMethodName = "/svc.v1.Msg/RegisterService"
Msg_UpdateParams_FullMethodName = "/svc.v1.Msg/UpdateParams"
Msg_InitiateDomainVerification_FullMethodName = "/svc.v1.Msg/InitiateDomainVerification"
Msg_VerifyDomain_FullMethodName = "/svc.v1.Msg/VerifyDomain"
Msg_RegisterService_FullMethodName = "/svc.v1.Msg/RegisterService"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// Msg defines the Msg service.
type MsgClient interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
// InitiateDomainVerification starts the domain verification process
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "svc_docs.md"}}
InitiateDomainVerification(ctx context.Context, in *MsgInitiateDomainVerification, opts ...grpc.CallOption) (*MsgInitiateDomainVerificationResponse, error)
// VerifyDomain completes domain verification by checking DNS TXT records
VerifyDomain(ctx context.Context, in *MsgVerifyDomain, opts ...grpc.CallOption) (*MsgVerifyDomainResponse, error)
// RegisterService registers a new service with verified domain binding
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
}
@@ -47,9 +56,26 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) InitiateDomainVerification(ctx context.Context, in *MsgInitiateDomainVerification, opts ...grpc.CallOption) (*MsgInitiateDomainVerificationResponse, error) {
out := new(MsgInitiateDomainVerificationResponse)
err := c.cc.Invoke(ctx, Msg_InitiateDomainVerification_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) VerifyDomain(ctx context.Context, in *MsgVerifyDomain, opts ...grpc.CallOption) (*MsgVerifyDomainResponse, error) {
out := new(MsgVerifyDomainResponse)
err := c.cc.Invoke(ctx, Msg_VerifyDomain_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -57,9 +83,8 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
}
func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(MsgRegisterServiceResponse)
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, cOpts...)
err := c.cc.Invoke(ctx, Msg_RegisterService_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@@ -68,35 +93,43 @@ func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService,
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility.
//
// Msg defines the Msg service.
// for forward compatibility
type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
// InitiateDomainVerification starts the domain verification process
//
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
//
// {{import "svc_docs.md"}}
InitiateDomainVerification(context.Context, *MsgInitiateDomainVerification) (*MsgInitiateDomainVerificationResponse, error)
// VerifyDomain completes domain verification by checking DNS TXT records
VerifyDomain(context.Context, *MsgVerifyDomain) (*MsgVerifyDomainResponse, error)
// RegisterService registers a new service with verified domain binding
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedMsgServer struct{}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) InitiateDomainVerification(context.Context, *MsgInitiateDomainVerification) (*MsgInitiateDomainVerificationResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method InitiateDomainVerification not implemented")
}
func (UnimplementedMsgServer) VerifyDomain(context.Context, *MsgVerifyDomain) (*MsgVerifyDomainResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method VerifyDomain not implemented")
}
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
func (UnimplementedMsgServer) testEmbeddedByValue() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
@@ -106,13 +139,6 @@ type UnsafeMsgServer interface {
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
// If the following call pancis, it indicates UnimplementedMsgServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Msg_ServiceDesc, srv)
}
@@ -134,6 +160,42 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_InitiateDomainVerification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgInitiateDomainVerification)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).InitiateDomainVerification(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_InitiateDomainVerification_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).InitiateDomainVerification(ctx, req.(*MsgInitiateDomainVerification))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_VerifyDomain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgVerifyDomain)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).VerifyDomain(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_VerifyDomain_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).VerifyDomain(ctx, req.(*MsgVerifyDomain))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgRegisterService)
if err := dec(in); err != nil {
@@ -163,6 +225,14 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "InitiateDomainVerification",
Handler: _Msg_InitiateDomainVerification_Handler,
},
{
MethodName: "VerifyDomain",
Handler: _Msg_VerifyDomain_Handler,
},
{
MethodName: "RegisterService",
Handler: _Msg_RegisterService_Handler,
-74
View File
@@ -1,74 +0,0 @@
package app
import (
"errors"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"
circuitante "cosmossdk.io/x/circuit/ante"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
sdkmath "cosmossdk.io/math"
poaante "github.com/strangelove-ventures/poa/ante"
globalfeeante "github.com/strangelove-ventures/globalfee/x/globalfee/ante"
globalfeekeeper "github.com/strangelove-ventures/globalfee/x/globalfee/keeper"
)
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions
IBCKeeper *keeper.Keeper
CircuitKeeper *circuitkeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
GlobalFeeKeeper globalfeekeeper.Keeper
BypassMinFeeMsgTypes []string
}
// NewAnteHandler constructor
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errors.New("account keeper is required for ante builder")
}
if options.BankKeeper == nil {
return nil, errors.New("bank keeper is required for ante builder")
}
if options.SignModeHandler == nil {
return nil, errors.New("sign mode handler is required for ante builder")
}
if options.CircuitKeeper == nil {
return nil, errors.New("circuit keeper is required for ante builder")
}
poaDoGenTxRateValidation := false
poaRateFloor := sdkmath.LegacyMustNewDecFromStr("0.05")
poaRateCeil := sdkmath.LegacyMustNewDecFromStr("0.25")
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
// ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
globalfeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeKeeper, 2_000_000),
// ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
poaante.NewPOADisableStakingDecorator(),
poaante.NewCommissionLimitDecorator(poaDoGenTxRateValidation, poaRateFloor, poaRateCeil),
}
return sdk.ChainAnteDecorators(anteDecorators...), nil
}
+60
View File
@@ -0,0 +1,60 @@
// Package ante provides ante handler implementations for transaction processing
// in the Sonr blockchain. It supports both Cosmos SDK and Ethereum transactions.
package ante
import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
)
// NewAnteHandler returns an ante handler responsible for attempting to route an
// Ethereum or SDK transaction to an internal ante handler for performing
// transaction-level processing (e.g. fee payment, signature verification) before
// being passed onto it's respective handler.
//
// The handler inspects the transaction type and extension options to determine
// the appropriate processing path:
// - Ethereum transactions with ExtensionOptionsEthereumTx
// - Cosmos SDK transactions with ExtensionOptionDynamicFeeTx
// - Standard Cosmos SDK transactions
func NewAnteHandler(options HandlerOptions) sdk.AnteHandler {
return func(
ctx sdk.Context, tx sdk.Tx, sim bool,
) (newCtx sdk.Context, err error) {
var anteHandler sdk.AnteHandler
txWithExtensions, ok := tx.(authante.HasExtensionOptionsTx)
if ok {
opts := txWithExtensions.GetExtensionOptions()
if len(opts) > 0 {
switch typeURL := opts[0].GetTypeUrl(); typeURL {
case "/cosmos.evm.vm.v1.ExtensionOptionsEthereumTx":
// handle as *evmtypes.MsgEthereumTx
anteHandler = newMonoEVMAnteHandler(options)
case "/cosmos.evm.vm.v1.ExtensionOptionDynamicFeeTx":
// cosmos-sdk tx with dynamic fee extension
anteHandler = NewCosmosAnteHandler(options)
default:
return ctx, errorsmod.Wrapf(
errortypes.ErrUnknownExtensionOptions,
"rejecting tx with unsupported extension option: %s", typeURL,
)
}
return anteHandler(ctx, tx, sim)
}
}
// handle as totally normal Cosmos SDK tx
switch tx.(type) {
case sdk.Tx:
anteHandler = NewCosmosAnteHandler(options)
default:
return ctx, errorsmod.Wrapf(errortypes.ErrUnknownRequest, "invalid transaction type: %T", tx)
}
return anteHandler(ctx, tx, sim)
}
}
+107
View File
@@ -0,0 +1,107 @@
package ante
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
sdkvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
evmoscosmosante "github.com/cosmos/evm/ante/cosmos"
evmante "github.com/cosmos/evm/ante/evm"
evmtypes "github.com/cosmos/evm/x/vm/types"
circuitante "cosmossdk.io/x/circuit/ante"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
)
// NewCosmosAnteHandler creates the default ante handler for Cosmos SDK transactions.
// It sets up a chain of decorators that perform various checks and operations:
// - Rejects Ethereum transactions in Cosmos context
// - Enforces authz limitations
// - Sets up transaction context
// - Validates basic transaction properties
// - Handles WebAuthn gasless transactions
// - Handles gas consumption and fee deduction
// - Performs signature verification
// - Manages account sequences
// - Handles IBC-specific checks
func NewCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
// Determine if we should use enhanced gasless mode
// Enhanced mode allows address generation from credentials for true gasless onboarding
enhancedGaslessMode := options.EnableEnhancedGasless
// Build the decorator chain
decorators := []sdk.AnteDecorator{
// WebAuthn bypass - must be first to intercept WebAuthn transactions
NewWebAuthnBypassDecorator(),
evmoscosmosante.NewRejectMessagesDecorator(), // reject MsgEthereumTxs
evmoscosmosante.NewAuthzLimiterDecorator( // disable the Msg types that cannot be included on an authz.MsgExec msgs field
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
sdk.MsgTypeURL(&sdkvesting.MsgCreateVestingAccount{}),
),
ante.NewSetUpContextDecorator(),
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
// UCAN validation - must come before fee deduction for gasless support
NewConditionalUCANDecorator(NewUCANDecorator()),
evmoscosmosante.NewMinGasPriceDecorator(
options.FeeMarketKeeper,
options.EvmKeeper,
options.ControlPanelKeeper,
),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
// WebAuthn gasless transaction support - must come before fee deduction
// Enhanced mode allows true gasless onboarding without pre-existing accounts
NewWebAuthnGaslessDecorator(options.AccountKeeper, options.DidKeeper, enhancedGaslessMode),
// Conditional fee deduction - skips fees for gasless WebAuthn and UCAN
NewUCANGaslessDecorator(
NewConditionalFeeDecorator(ante.NewDeductFeeDecorator(
options.AccountKeeper,
options.BankKeeper,
options.FeegrantKeeper,
options.TxFeeChecker,
)),
),
}
// Add signature verification decorators
// In enhanced gasless mode, we wrap these to be conditional
if enhancedGaslessMode {
// Conditional decorators that skip verification for gasless transactions
decorators = append(
decorators,
NewConditionalPubKeyDecorator(ante.NewSetPubKeyDecorator(options.AccountKeeper)),
NewConditionalSigCountDecorator(
ante.NewValidateSigCountDecorator(options.AccountKeeper),
),
NewConditionalSigGasDecorator(
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
),
NewConditionalSignatureDecorator(
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
),
)
} else {
// Standard signature verification decorators
decorators = append(decorators,
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
)
}
// Add remaining decorators
decorators = append(decorators,
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
evmante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
)
return sdk.ChainAnteDecorators(decorators...)
}
+23
View File
@@ -0,0 +1,23 @@
package ante
import (
sdk "github.com/cosmos/cosmos-sdk/types"
evmante "github.com/cosmos/evm/ante/evm"
)
// newMonoEVMAnteHandler creates the ante handler for Ethereum Virtual Machine transactions.
// It uses a single decorator that handles all EVM-specific validation and processing,
// including gas calculation, fee market dynamics, and account management.
//
// The mono decorator performs all EVM ante operations in a single pass for efficiency.
func newMonoEVMAnteHandler(options HandlerOptions) sdk.AnteHandler {
return sdk.ChainAnteDecorators(
evmante.NewEVMMonoDecorator(
options.AccountKeeper,
options.FeeMarketKeeper,
options.EvmKeeper,
options.ControlPanelKeeper,
options.MaxTxGasWanted,
),
)
}
+59
View File
@@ -0,0 +1,59 @@
package ante
import (
"context"
sdk "github.com/cosmos/cosmos-sdk/types"
anteinterfaces "github.com/cosmos/evm/ante/interfaces"
)
// Ensure ControlPanelKeeper implements the interface
var _ anteinterfaces.ControlPanelKeeper = (*ControlPanelKeeper)(nil)
// ControlPanelKeeper provides control panel functionality for sponsored transactions.
// This is a simple implementation that can be extended to support sponsored addresses
// and custom transaction priorities in the future.
type ControlPanelKeeper struct {
// sponsoredAddresses could be loaded from state or configuration
sponsoredAddresses map[string]bool
// priority for sponsored transactions
sponsoredTxPriority int64
}
// NewControlPanelKeeper creates a new ControlPanelKeeper instance
func NewControlPanelKeeper() *ControlPanelKeeper {
return &ControlPanelKeeper{
sponsoredAddresses: make(map[string]bool),
sponsoredTxPriority: 0, // Default priority
}
}
// IsSponsoredAddress checks if an address is sponsored for gasless transactions
func (k *ControlPanelKeeper) IsSponsoredAddress(ctx context.Context, addr []byte) bool {
// For now, return false for all addresses
// This can be extended to check against a whitelist or state
return false
}
// GetSponsoredTransactionPriority returns the priority for sponsored transactions
func (k *ControlPanelKeeper) GetSponsoredTransactionPriority(ctx context.Context) int64 {
// Return default priority
// This can be made configurable or dynamic based on chain state
return k.sponsoredTxPriority
}
// SetSponsoredAddress adds or removes an address from the sponsored list
// This is a helper method for future use
func (k *ControlPanelKeeper) SetSponsoredAddress(addr sdk.AccAddress, sponsored bool) {
if sponsored {
k.sponsoredAddresses[addr.String()] = true
} else {
delete(k.sponsoredAddresses, addr.String())
}
}
// SetSponsoredTransactionPriority updates the priority for sponsored transactions
// This is a helper method for future use
func (k *ControlPanelKeeper) SetSponsoredTransactionPriority(priority int64) {
k.sponsoredTxPriority = priority
}
+129
View File
@@ -0,0 +1,129 @@
package ante
import (
"context"
addresscodec "cosmossdk.io/core/address"
errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
circuitkeeper "cosmossdk.io/x/circuit/keeper"
txsigning "cosmossdk.io/x/tx/signing"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
errortypes "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
anteinterfaces "github.com/cosmos/evm/ante/interfaces"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
)
// WebAuthnKeeperInterface defines the required methods from the DID keeper for WebAuthn gasless processing
type WebAuthnKeeperInterface interface {
// HasExistingCredential checks if this credential ID already exists
HasExistingCredential(ctx sdk.Context, credentialId string) bool
}
// BankKeeper defines the contract needed for supply related APIs.
// It provides methods for checking send permissions and transferring coins
// between accounts and modules.
type BankKeeper interface {
IsSendEnabledCoins(ctx context.Context, coins ...sdk.Coin) error
SendCoins(ctx context.Context, from, to sdk.AccAddress, amt sdk.Coins) error
SendCoinsFromAccountToModule(
ctx context.Context,
senderAddr sdk.AccAddress,
recipientModule string,
amt sdk.Coins,
) error
}
// AccountKeeper defines the account management interface required by ante handlers.
// It provides methods for account creation, retrieval, modification, and
// sequence number management.
type AccountKeeper interface {
NewAccountWithAddress(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
GetModuleAddress(moduleName string) sdk.AccAddress
GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
SetAccount(ctx context.Context, account sdk.AccountI)
RemoveAccount(ctx context.Context, account sdk.AccountI)
GetParams(ctx context.Context) (params authtypes.Params)
GetSequence(ctx context.Context, addr sdk.AccAddress) (uint64, error)
AddressCodec() addresscodec.Codec
}
// HandlerOptions defines the list of module keepers and configurations required
// to run the ante handler decorators. It includes both standard Cosmos SDK
// keepers and EVM-specific components for processing different transaction types.
type HandlerOptions struct {
Cdc codec.BinaryCodec
AccountKeeper AccountKeeper
BankKeeper BankKeeper
FeegrantKeeper ante.FeegrantKeeper
ExtensionOptionChecker ante.ExtensionOptionChecker
SignModeHandler *txsigning.HandlerMap
SigGasConsumer func(meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params) error
TxFeeChecker ante.TxFeeChecker // safe to be nil
MaxTxGasWanted uint64
FeeMarketKeeper anteinterfaces.FeeMarketKeeper
EvmKeeper anteinterfaces.EVMKeeper
ControlPanelKeeper anteinterfaces.ControlPanelKeeper
IBCKeeper *ibckeeper.Keeper
CircuitKeeper *circuitkeeper.Keeper
// WebAuthn gasless transaction support
DidKeeper WebAuthnKeeperInterface
EnableEnhancedGasless bool // Enable enhanced gasless mode for true onboarding without pre-existing accounts
// UCAN module keepers for permission validation
DwnKeeper interface{} // Will be cast to proper type in decorator
DexKeeper interface{} // Will be cast to proper type in decorator
SvcKeeper interface{} // Will be cast to proper type in decorator
}
// Validate checks if all required keepers and handlers are properly initialized.
// It ensures that the HandlerOptions struct has all necessary components to
// process transactions without nil pointer errors.
func (options HandlerOptions) Validate() error {
if options.Cdc == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "codec is required for AnteHandler")
}
if options.AccountKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SigGasConsumer == nil {
return errorsmod.Wrap(
errortypes.ErrLogic,
"signature gas consumer is required for AnteHandler",
)
}
if options.SignModeHandler == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "sign mode handler is required for AnteHandler")
}
if options.CircuitKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "circuit keeper is required for ante builder")
}
if options.TxFeeChecker == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "tx fee checker is required for AnteHandler")
}
if options.FeeMarketKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "fee market keeper is required for AnteHandler")
}
if options.EvmKeeper == nil {
return errorsmod.Wrap(errortypes.ErrLogic, "evm keeper is required for AnteHandler")
}
if options.ControlPanelKeeper == nil {
return errorsmod.Wrap(
errortypes.ErrLogic,
"control panel keeper is required for AnteHandler",
)
}
return nil
}

Some files were not shown because too many files have changed in this diff Show More