mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
* 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
106 lines
2.3 KiB
Go
106 lines
2.3 KiB
Go
package context
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/onsonr/sonr/pkg/common"
|
|
)
|
|
|
|
// ParamsBank returns the bank params
|
|
func (cc *GatewayContext) ParamsBank() (*common.BankParamsResponse, error) {
|
|
cl, err := common.NewBankClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cl.Params(bgCtx(), &common.BankParamsRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
// ParamsDID returns the DID params
|
|
func (cc *GatewayContext) ParamsDID() (*common.DIDParamsResponse, error) {
|
|
cl, err := common.NewDIDClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cl.Params(bgCtx(), &common.DIDParamsRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
// ParamsDWN returns the DWN params
|
|
func (cc *GatewayContext) ParamsDWN() (*common.DWNParamsResponse, error) {
|
|
cl, err := common.NewDWNClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cl.Params(bgCtx(), &common.DWNParamsRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
// ParamsSVC returns the SVC params
|
|
func (cc *GatewayContext) ParamsSVC() (*common.SVCParamsResponse, error) {
|
|
cl, err := common.NewSVCClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cl.Params(bgCtx(), &common.SVCParamsRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
// StatusBlock returns the current block
|
|
func (cc *GatewayContext) StatusBlock() string {
|
|
qc, err := common.NewNodeClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return "-1"
|
|
}
|
|
resp, err := qc.Status(bgCtx(), &common.StatusRequest{})
|
|
if err != nil {
|
|
return "-1"
|
|
}
|
|
return fmt.Sprintf("%d", resp.GetHeight())
|
|
}
|
|
|
|
// StatusNode returns the node status
|
|
func (cc *GatewayContext) StatusNode() (*common.StatusResponse, error) {
|
|
cl, err := common.NewNodeClient(cc.grpcAddr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resp, err := cl.Status(bgCtx(), &common.StatusRequest{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return resp, nil
|
|
}
|
|
|
|
// TxBroadcast broadcasts a transaction to the network
|
|
func (cc *GatewayContext) TxBroadcast() error {
|
|
return nil
|
|
}
|
|
|
|
// TxEncode encodes a transaction
|
|
func (cc *GatewayContext) TxEncode() error {
|
|
return nil
|
|
}
|
|
|
|
// TxDecode decodes a transaction
|
|
func (cc *GatewayContext) TxDecode() error {
|
|
return nil
|
|
}
|
|
|
|
// TxSimulate simulates a transaction on the network
|
|
func (cc *GatewayContext) TxSimulate() error {
|
|
return nil
|
|
}
|