mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/refactor types (#1101)
- **docs: remove discord badge from README** - **fix: ensure go version is up-to-date** - **<no value>** - **refactor: update import paths for blocks to components** - **feat: add Hero component template** - **fix: update footer logo to svg** - **feat: add Query/Sign and Query/Verify RPC methods** - **refactor: rename Keyshares to KsVal in did/v1/state.proto**
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Config struct {
|
||||
Ipfs *IPFS `pkl:"ipfs" json:"ipfs,omitempty"`
|
||||
|
||||
Sonr *Sonr `pkl:"sonr" json:"sonr,omitempty"`
|
||||
|
||||
Motr *Motr `pkl:"motr" json:"motr,omitempty"`
|
||||
|
||||
Schema *Schema `pkl:"schema" json:"schema,omitempty"`
|
||||
|
||||
ProxyUrl string `pkl:"proxyUrl" json:"proxyUrl,omitempty"`
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Dwn struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Dwn
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Dwn, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
cerr := evaluator.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Dwn
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Dwn, error) {
|
||||
var ret Dwn
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type IPFS struct {
|
||||
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
|
||||
|
||||
GatewayUrl string `pkl:"gatewayUrl" json:"gatewayUrl,omitempty"`
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Motr struct {
|
||||
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
|
||||
|
||||
Address string `pkl:"address" json:"address,omitempty"`
|
||||
|
||||
Origin string `pkl:"origin" json:"origin,omitempty"`
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Schema struct {
|
||||
Version int `pkl:"version"`
|
||||
|
||||
Account string `pkl:"account" json:"account,omitempty"`
|
||||
|
||||
Asset string `pkl:"asset" json:"asset,omitempty"`
|
||||
|
||||
Chain string `pkl:"chain" json:"chain,omitempty"`
|
||||
|
||||
Credential string `pkl:"credential" json:"credential,omitempty"`
|
||||
|
||||
Jwk string `pkl:"jwk" json:"jwk,omitempty"`
|
||||
|
||||
Grant string `pkl:"grant" json:"grant,omitempty"`
|
||||
|
||||
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
Profile string `pkl:"profile" json:"profile,omitempty"`
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
type Sonr struct {
|
||||
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
|
||||
|
||||
GrpcUrl string `pkl:"grpcUrl" json:"grpcUrl,omitempty"`
|
||||
|
||||
RpcUrl string `pkl:"rpcUrl" json:"rpcUrl,omitempty"`
|
||||
|
||||
WebSocketUrl string `pkl:"webSocketUrl" json:"webSocketUrl,omitempty"`
|
||||
|
||||
ChainId string `pkl:"chainId" json:"chainId,omitempty"`
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// Code generated from Pkl module `dwn`. DO NOT EDIT.
|
||||
package dwn
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("dwn", Dwn{})
|
||||
pkl.RegisterMapping("dwn#Config", Config{})
|
||||
pkl.RegisterMapping("dwn#IPFS", IPFS{})
|
||||
pkl.RegisterMapping("dwn#Sonr", Sonr{})
|
||||
pkl.RegisterMapping("dwn#Motr", Motr{})
|
||||
pkl.RegisterMapping("dwn#Schema", Schema{})
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/app/config/dwn" }
|
||||
|
||||
module dwn
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias JSON = String
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
class Config {
|
||||
@JsonField
|
||||
ipfs: IPFS
|
||||
|
||||
@JsonField
|
||||
sonr: Sonr
|
||||
|
||||
@JsonField
|
||||
motr: Motr
|
||||
|
||||
@JsonField
|
||||
schema: Schema
|
||||
|
||||
@JsonField
|
||||
proxyUrl: String
|
||||
}
|
||||
|
||||
class IPFS {
|
||||
@JsonField
|
||||
apiUrl: String
|
||||
|
||||
@JsonField
|
||||
gatewayUrl: String
|
||||
}
|
||||
|
||||
class Motr {
|
||||
@JsonField
|
||||
keyshare: JSON
|
||||
|
||||
@JsonField
|
||||
address: String
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
}
|
||||
|
||||
class Schema {
|
||||
version: Int
|
||||
|
||||
@JsonField
|
||||
account: String
|
||||
|
||||
@JsonField
|
||||
asset: String
|
||||
|
||||
@JsonField
|
||||
chain: String
|
||||
|
||||
@JsonField
|
||||
credential: String
|
||||
|
||||
@JsonField
|
||||
jwk: String
|
||||
|
||||
@JsonField
|
||||
grant: String
|
||||
|
||||
@JsonField
|
||||
keyshare: String
|
||||
|
||||
@JsonField
|
||||
publicKey: String
|
||||
|
||||
@JsonField
|
||||
profile: String
|
||||
}
|
||||
|
||||
class Sonr {
|
||||
@JsonField
|
||||
apiUrl: String
|
||||
|
||||
@JsonField
|
||||
grpcUrl: String
|
||||
|
||||
@JsonField
|
||||
rpcUrl: String
|
||||
|
||||
@JsonField
|
||||
webSocketUrl: String
|
||||
|
||||
@JsonField
|
||||
chainId: String
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/x/did/types/orm" }
|
||||
|
||||
module models
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
typealias Base58 = String
|
||||
typealias Base64 = String
|
||||
|
||||
typealias Bech32 = String
|
||||
typealias Keccak = String
|
||||
|
||||
typealias DID = String
|
||||
typealias ChainCode = UInt
|
||||
typealias Scope = String
|
||||
|
||||
typealias Hex = String
|
||||
|
||||
class PrimaryKey extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
["query"] = "%{name}"
|
||||
}
|
||||
}
|
||||
|
||||
class JsonField extends go.Field {
|
||||
structTags {
|
||||
["json"] = "%{name},omitempty"
|
||||
}
|
||||
}
|
||||
|
||||
// Enums
|
||||
typealias AssetType = "native"|"wrapped"|"staking"|"pool"|"ibc"|"cw20"
|
||||
|
||||
typealias DIDMethod = "ipfs"|"sonr"|"bitcoin"|"ethereum"|"ibc"|"webauthn"|"dwn"|"service"
|
||||
|
||||
typealias KeyAlgorithm = "es256"|"es384"|"es512"|"eddsa"|"es256k"|"ecdsa"
|
||||
|
||||
typealias KeyCurve = "p256"|"p384"|"p521"|"x25519"|"x448"|"ed25519"|"ed448"|"secp256k1"|"bls12381"|"keccak256"
|
||||
|
||||
typealias KeyEncoding = "raw"|"hex"|"multibase"
|
||||
|
||||
typealias KeyRole = "authentication"|"assertion"|"delegation"|"invocation"
|
||||
|
||||
typealias KeyType = "octet"|"elliptic"|"rsa"|"symmetric"|"hmac"|"mpc"|"zk"|"webauthn"|"bip32"
|
||||
|
||||
typealias KeyShareRole = "user"|"validator"
|
||||
|
||||
typealias PermissionGrant = "none"|"read"|"write"|"verify"|"broadcast"|"admin"
|
||||
|
||||
typealias PermissionScope = "profile"|"metadata"|"permissions"|"wallets"|"transactions"|"user"|"validator"
|
||||
|
||||
|
||||
class Account {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
address: Bech32|Keccak|String
|
||||
|
||||
@JsonField
|
||||
publicKey: Base58
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
index: Int
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Asset {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
symbol: String
|
||||
|
||||
@JsonField
|
||||
decimals: Int
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Chain {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
name: String
|
||||
|
||||
@JsonField
|
||||
networkId: String
|
||||
|
||||
@JsonField
|
||||
chainCode: ChainCode
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
}
|
||||
|
||||
class Credential {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
attestationType: String
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
label: String?
|
||||
|
||||
@JsonField
|
||||
deviceId: String?
|
||||
|
||||
@JsonField
|
||||
credentialId: Base64
|
||||
|
||||
@JsonField
|
||||
publicKey: Base64
|
||||
|
||||
@JsonField
|
||||
transport: List<String>
|
||||
|
||||
@JsonField
|
||||
signCount: UInt
|
||||
|
||||
@JsonField
|
||||
userPresent: Boolean
|
||||
|
||||
@JsonField
|
||||
userVerified: Boolean
|
||||
|
||||
@JsonField
|
||||
backupEligible: Boolean
|
||||
|
||||
@JsonField
|
||||
backupState: Boolean
|
||||
|
||||
@JsonField
|
||||
cloneWarning: Boolean
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class JWK {
|
||||
@JsonField
|
||||
kty: String
|
||||
|
||||
@JsonField
|
||||
crv: String
|
||||
|
||||
@JsonField
|
||||
x: String
|
||||
|
||||
@JsonField
|
||||
y: String
|
||||
|
||||
@JsonField
|
||||
n: String
|
||||
|
||||
@JsonField
|
||||
e: String
|
||||
}
|
||||
|
||||
class Grant {
|
||||
@PrimaryKey
|
||||
id: UInt
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
origin: String
|
||||
|
||||
@JsonField
|
||||
token: String
|
||||
|
||||
@JsonField
|
||||
scopes: List<String>
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
class Keyshare {
|
||||
@PrimaryKey
|
||||
id: DID
|
||||
|
||||
@JsonField
|
||||
data: Base64
|
||||
|
||||
@JsonField
|
||||
role: Int
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
lastRefreshed: String?
|
||||
}
|
||||
|
||||
class PublicKey {
|
||||
@PrimaryKey
|
||||
role: KeyRole
|
||||
algorithm: KeyAlgorithm
|
||||
encoding: KeyEncoding
|
||||
curve: KeyCurve
|
||||
key_type: KeyType
|
||||
raw: Base58
|
||||
jwk: JWK
|
||||
}
|
||||
|
||||
class Profile {
|
||||
@PrimaryKey
|
||||
id: String
|
||||
|
||||
@JsonField
|
||||
subject: String
|
||||
|
||||
@JsonField
|
||||
controller: Bech32
|
||||
|
||||
@JsonField
|
||||
originUri: String?
|
||||
|
||||
@JsonField
|
||||
publicMetadata: String?
|
||||
|
||||
@JsonField
|
||||
privateMetadata: String?
|
||||
|
||||
@JsonField
|
||||
createdAt: String?
|
||||
|
||||
@JsonField
|
||||
updatedAt: String?
|
||||
}
|
||||
|
||||
|
||||
db_name: String = "vault"
|
||||
db_version: Int = 1
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
@go.Package { name = "github.com/onsonr/sonr/internal/orm/transactions" }
|
||||
|
||||
module transactions
|
||||
|
||||
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||
|
||||
/// Common Cosmos SDK types
|
||||
typealias Coin = Dynamic
|
||||
typealias AccAddress = String
|
||||
typealias ValAddress = String
|
||||
typealias Timestamp = String
|
||||
|
||||
/// Base class for all messages
|
||||
abstract class Msg {
|
||||
/// The type URL for the message
|
||||
typeUrl: String
|
||||
}
|
||||
|
||||
/// Base class for all proposals
|
||||
class Proposal {
|
||||
/// The title of the proposal
|
||||
title: String
|
||||
|
||||
/// The description of the proposal
|
||||
description: String
|
||||
}
|
||||
|
||||
/// Gov module messages
|
||||
class MsgGovSubmitProposal extends Msg {
|
||||
typeUrl = "/cosmos.gov.v1beta1.MsgSubmitProposal"
|
||||
content: Proposal
|
||||
initialDeposit: List<Coin>
|
||||
proposer: AccAddress
|
||||
}
|
||||
|
||||
class MsgGovVote extends Msg {
|
||||
typeUrl = "/cosmos.gov.v1beta1.MsgVote"
|
||||
proposalId: Int
|
||||
voter: AccAddress
|
||||
option: Int
|
||||
}
|
||||
|
||||
class MsgGovDeposit extends Msg {
|
||||
typeUrl = "/cosmos.gov.v1beta1.MsgDeposit"
|
||||
proposalId: Int
|
||||
depositor: AccAddress
|
||||
amount: List<Coin>
|
||||
}
|
||||
|
||||
/// Group module messages
|
||||
class MsgGroupCreateGroup extends Msg {
|
||||
typeUrl = "/cosmos.group.v1.MsgCreateGroup"
|
||||
admin: AccAddress
|
||||
members: List<Dynamic>
|
||||
metadata: String
|
||||
}
|
||||
|
||||
class MsgGroupSubmitProposal extends Msg {
|
||||
typeUrl = "/cosmos.group.v1.MsgSubmitProposal"
|
||||
groupPolicyAddress: AccAddress
|
||||
proposers: List<AccAddress>
|
||||
metadata: String
|
||||
messages: List<Dynamic>
|
||||
exec: Int
|
||||
}
|
||||
|
||||
class MsgGroupVote extends Msg {
|
||||
typeUrl = "/cosmos.group.v1.MsgVote"
|
||||
proposalId: Int
|
||||
voter: AccAddress
|
||||
option: Int
|
||||
metadata: String
|
||||
exec: Int
|
||||
}
|
||||
|
||||
/// Staking module messages
|
||||
class MsgStakingCreateValidator extends Msg {
|
||||
typeUrl = "/cosmos.staking.v1beta1.MsgCreateValidator"
|
||||
description: Dynamic
|
||||
commission: Dynamic
|
||||
minSelfDelegation: String
|
||||
delegatorAddress: AccAddress
|
||||
validatorAddress: ValAddress
|
||||
pubkey: Dynamic
|
||||
value: Coin
|
||||
}
|
||||
|
||||
class MsgStakingDelegate extends Msg {
|
||||
typeUrl = "/cosmos.staking.v1beta1.MsgDelegate"
|
||||
delegatorAddress: AccAddress
|
||||
validatorAddress: ValAddress
|
||||
amount: Coin
|
||||
}
|
||||
|
||||
class MsgStakingUndelegate extends Msg {
|
||||
typeUrl = "/cosmos.staking.v1beta1.MsgUndelegate"
|
||||
delegatorAddress: AccAddress
|
||||
validatorAddress: ValAddress
|
||||
amount: Coin
|
||||
}
|
||||
|
||||
class MsgStakingBeginRedelegate extends Msg {
|
||||
typeUrl = "/cosmos.staking.v1beta1.MsgBeginRedelegate"
|
||||
delegatorAddress: AccAddress
|
||||
validatorSrcAddress: ValAddress
|
||||
validatorDstAddress: ValAddress
|
||||
amount: Coin
|
||||
}
|
||||
class MsgDidUpdateParams extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgUpdateParams"
|
||||
authority: AccAddress
|
||||
params: Dynamic
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidAllocateVault extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgAllocateVault"
|
||||
authority: AccAddress
|
||||
subject: String
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidProveWitness extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgProveWitness"
|
||||
authority: AccAddress
|
||||
property: String
|
||||
witness: Listing<Int>
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidSyncVault extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgSyncVault"
|
||||
controller: AccAddress
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidRegisterController extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgRegisterController"
|
||||
authority: AccAddress
|
||||
cid: String
|
||||
origin: String
|
||||
authentication: List<Dynamic>
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidAuthorize extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgAuthorize"
|
||||
authority: AccAddress
|
||||
controller: AccAddress
|
||||
address: AccAddress
|
||||
origin: String
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
class MsgDidRegisterService extends Msg {
|
||||
typeUrl = "/sonr.did.v1.MsgRegisterService"
|
||||
controller: AccAddress
|
||||
originUri: String
|
||||
scopes: Dynamic
|
||||
description: String
|
||||
serviceEndpoints: Map<String, String>
|
||||
metadata: Dynamic
|
||||
token: Dynamic
|
||||
}
|
||||
|
||||
/// Represents a transaction body
|
||||
class TxBody {
|
||||
messages: List<Msg>
|
||||
memo: String?
|
||||
timeoutHeight: Int?
|
||||
extensionOptions: List<Dynamic>?
|
||||
nonCriticalExtensionOptions: List<Dynamic>?
|
||||
}
|
||||
|
||||
@@ -9,9 +9,10 @@ import (
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/gommon/log"
|
||||
"github.com/onsonr/sonr/nebula"
|
||||
"github.com/onsonr/sonr/nebula/pages"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/onsonr/sonr/pkg/nebula"
|
||||
"github.com/onsonr/sonr/pkg/nebula/pages"
|
||||
)
|
||||
|
||||
func NewProxyCmd() *cobra.Command {
|
||||
|
||||
Reference in New Issue
Block a user