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
This commit is contained in:
Prad Nukala
2024-12-22 17:01:11 -05:00
committed by GitHub
parent c9004e75df
commit d69c2a9d53
153 changed files with 3515 additions and 2428 deletions
+5 -6
View File
@@ -3,7 +3,7 @@ open module matrix.net.Homeserver
version = 2
global = new {
server_name = read("env:MATRIX_SERVER_NAME") ?? ""
server_name = read("env:MATRIX_SERVER_NAME") ?? "mx.sonr.id"
private_key = "matrix_key.pem"
old_private_keys = new Listing {}
key_validity_period = "168h0m0s"
@@ -21,10 +21,9 @@ max_size_estimated = "1gb"
max_age = "1h"
}
well_known_server_name = ""
well_known_client_name = read("env:MATRIX_CLIENT_NAME") ?? ""
well_known_sliding_sync_proxy = ""
well_known_server_name = "sonr.id"
well_known_client_name = read("env:MATRIX_CLIENT_NAME") ?? "sonr.id"
well_known_sliding_sync_proxy = read("env:MATRIX_SLIDING_SYNC_PROXY") ?? ""
trusted_third_party_id_servers = new Listing {
"matrix.org"
"vector.im"
@@ -54,7 +53,7 @@ jetstream = new {
addresses = new Listing {}
disable_tls_validation = false
storage_path = "./"
topic_prefix = "Dendrite"
topic_prefix = "_matrix"
}
metrics = new {
+78
View File
@@ -0,0 +1,78 @@
module sonr.net.App
import "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0#/toml.pkl"
`minimum-gas-prices` = "0usnr"
`query-gas-limit` = "0"
pruning = "default"
`pruning-keep-recent` = "0"
`pruning-interval` = "0"
`halt-height` = 0
`halt-time` = 0
`min-retain-blocks` = 0
`inter-block-cache` = true
`index-events` = new Listing {}
`iavl-cache-size` = 781250
`iavl-disable-fastnode` = false
`app-db-backend` = ""
telemetry = new {
`service-name` = ""
enabled = true
`enable-hostname` = true
`enable-hostname-label` = false
`enable-service-label` = false
`prometheus-retention-time` = 60
`global-labels` = new Listing {
new Listing {
"chain_id"
"sonr-testnet-1"
}
}
`metrics-sink` = ""
`statsd-addr` = ""
`datadog-hostname` = ""
}
api = new {
enable = true
swagger = false
address = "tcp://0.0.0.0:1317"
`max-open-connections` = 1000
`rpc-read-timeout` = 10
`rpc-write-timeout` = 0
`rpc-max-body-bytes` = 1000000
`enabled-unsafe-cors` = false
}
grpc = new {
enable = true
address = "0.0.0.0:9090"
`max-recv-msg-size` = "10485760"
`max-send-msg-size` = "2147483647"
}
`grpc-web` = new {
enable = true
}
`state-sync` = new {
`snapshot-interval` = 0
`snapshot-keep-recent` = 2
}
streaming = new {
abci = new {
keys = new Listing {}
plugin = ""
`stop-node-on-err` = true
}
}
mempool = new {
`max-txs` = 5000
}
output {
renderer = new toml.Renderer {}
}
+145
View File
@@ -0,0 +1,145 @@
module sonr.net.Config
import "package://pkg.pkl-lang.org/pkl-pantry/pkl.toml@1.0.0#/toml.pkl"
version = "0.38.12"
proxy_app = "tcp://127.0.0.1:26658"
moniker = read("env:MONIKER") ?? "florence"
db_backend = "goleveldb"
db_dir = "data"
log_level = "info"
log_format = "plain"
genesis_file = "config/genesis.json"
priv_validator_key_file = "config/priv_validator_key.json"
priv_validator_state_file = "data/priv_validator_state.json"
priv_validator_laddr = ""
node_key_file = "config/node_key.json"
abci = "socket"
filter_peers = false
rpc = new {
laddr = "tcp://0.0.0.0:26657"
cors_allowed_origins = new Listing {}
cors_allowed_methods = new Listing {
"HEAD"
"GET"
"POST"
}
cors_allowed_headers = new Listing {
"Origin"
"Accept"
"Content-Type"
"X-Requested-With"
"X-Server-Time"
}
grpc_laddr = ""
grpc_max_open_connections = 900
unsafe = false
max_open_connections = 900
max_subscription_clients = 100
max_subscriptions_per_client = 5
experimental_subscription_buffer_size = 200
experimental_websocket_write_buffer_size = 200
experimental_close_on_slow_client = false
timeout_broadcast_tx_commit = "10s"
max_request_batch_size = 10
max_body_bytes = 1000000
max_header_bytes = 1048576
tls_cert_file = ""
tls_key_file = ""
pprof_laddr = "localhost:6060"
}
p2p = new {
laddr = "tcp://0.0.0.0:26656"
external_address = ""
seeds = ""
persistent_peers = ""
addr_book_file = "config/addrbook.json"
addr_book_strict = true
max_num_inbound_peers = 40
max_num_outbound_peers = 10
unconditional_peer_ids = ""
persistent_peers_max_dial_period = "0s"
flush_throttle_timeout = "100ms"
max_packet_msg_payload_size = 1024
send_rate = 5120000
recv_rate = 5120000
pex = true
seed_mode = false
private_peer_ids = ""
allow_duplicate_ip = false
handshake_timeout = "20s"
dial_timeout = "3s"
}
mempool = new {
type = "flood"
recheck = true
recheck_timeout = "1s"
broadcast = true
wal_dir = ""
size = 5000
max_txs_bytes = 1073741824
cache_size = 10000
`keep-invalid-txs-in-cache` = false
max_tx_bytes = 1048576
max_batch_bytes = 0
experimental_max_gossip_connections_to_persistent_peers = 0
experimental_max_gossip_connections_to_non_persistent_peers = 0
}
statesync = new {
enable = false
rpc_servers = ""
trust_height = 0
trust_hash = ""
trust_period = "168h0m0s"
discovery_time = "15s"
temp_dir = ""
chunk_request_timeout = "10s"
chunk_fetchers = "4"
}
blocksync = new {
version = "v0"
}
consensus = new {
wal_file = "data/cs.wal/wal"
timeout_propose = "3s"
timeout_propose_delta = "500ms"
timeout_prevote = "1s"
timeout_prevote_delta = "500ms"
timeout_precommit = "1s"
timeout_precommit_delta = "500ms"
timeout_commit = "5000ms"
double_sign_check_height = 0
skip_timeout_commit = false
create_empty_blocks = true
create_empty_blocks_interval = "0s"
peer_gossip_sleep_duration = "100ms"
peer_query_maj23_sleep_duration = "2s"
}
storage = new {
discard_abci_responses = false
}
tx_index = new {
indexer = read("env:TX_INDEX_INDEXER") ?? "kv"
`psql-conn` = read("env:TX_INDEX_PSQL_CONN") ?? ""
}
instrumentation = new {
prometheus = false
prometheus_listen_addr = ":26660"
max_open_connections = 3
namespace = "cometbft"
}
output {
renderer = new toml.Renderer {}
}
+1 -2
View File
@@ -1,6 +1,5 @@
@go.Package { name = "github.com/onsonr/sonr/internal/config/hway" }
open module sonr.net.Hway
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
@@ -14,4 +13,4 @@ sonrApiUrl: String = "http://localhost:1317"
sonrGrpcUrl: String = "http://localhost:9090"
sonrRpcUrl: String = "http://localhost:26657"
psqlDSN: String
turnstileSiteKey: String = read("env:TURNSTILE_SITE_KEY") ?? ""
-17
View File
@@ -32,20 +32,3 @@ class Config {
sonrChainId: String
}
class Environment {
@JsonField
isDevelopment: Boolean
@JsonField
cacheVersion: String
@JsonField
httpserverPath: String
@JsonField
wasmExecPath: String
@JsonField
wasmPath: String
}
+1 -1
View File
@@ -18,5 +18,5 @@ amends "../basePklProject.pkl"
package {
name = "sonr.net"
version = "0.0.1"
version = "0.0.2"
}
@@ -1,6 +1,6 @@
@go.Package { name = "github.com/onsonr/sonr/crypto/ucan/attns" }
module sonr.orm.UCAN
module sonr.net.UCAN
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
@@ -31,10 +31,16 @@ import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
// └─ TRANSFER/SEND
// TODO: Move to x/dwn
typealias CapVault = "crud/asset" | "crud/authzgrant" | "crud/profile" | "crud/record" | "use/recovery" | "use/sync" | "use/signer"
// TODO: Move to x/did
typealias CapAccount = "exec/broadcast" | "exec/query" | "exec/simulate" | "exec/vote" | "exec/delegate" | "exec/invoke" | "exec/send"
// TODO: Move to x/svc
typealias CapInterchain = "transfer/swap" | "transfer/send" | "transfer/atomic" | "transfer/batch" | "transfer/p2p" | "transfer/send"
// TODO: Move to x/dwn
typealias ResVault = "ks/enclave" | "loc/cid" | "loc/entity" | "loc/ipns" | "addr/sonr" | "chain/code"
// TODO: Move to x/did
typealias ResAccount = "acc/sequence" | "acc/number" | "chain/id" | "asset/code" | "authz/grant"
// TODO: Move to x/svc
typealias ResInterchain = "channnel/port" | "chain/id" | "chain/name" | "acc/host" | "acc/controller"
-22
View File
@@ -1,22 +0,0 @@
//===----------------------------------------------------------------------===//
// Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//===----------------------------------------------------------------------===//
/// Common types for operations across the sonr ecosystem
amends "../basePklProject.pkl"
package {
name = "sonr.orm"
version = "0.0.1"
}
-4
View File
@@ -1,4 +0,0 @@
{
"schemaVersion": 1,
"resolvedDependencies": {}
}