refactor: move configuration files to app directory

This commit is contained in:
Prad Nukala
2024-09-27 11:03:38 -04:00
parent 049ed32e33
commit 9c768e4891
12 changed files with 3 additions and 46 deletions
+14
View File
@@ -0,0 +1,14 @@
// 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"`
}
+36
View File
@@ -0,0 +1,36 @@
// 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
}
+8
View File
@@ -0,0 +1,8 @@
// 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"`
}
+10
View File
@@ -0,0 +1,10 @@
// 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"`
}
+24
View File
@@ -0,0 +1,24 @@
// 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"`
}
+14
View File
@@ -0,0 +1,14 @@
// 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"`
}
+13
View File
@@ -0,0 +1,13 @@
// 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{})
}
+100
View File
@@ -0,0 +1,100 @@
@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
}
+276
View File
@@ -0,0 +1,276 @@
@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
+174
View File
@@ -0,0 +1,174 @@
@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>?
}