feature/driver indexed db (#12)

* fix: update commitizen version

* feat: add WASM build tags to db actions

* feat: Update all actions to follow `AddAsset` for error handling

* feat: remove database dependency in dwn and motr commands

* feat: add basic info form to registration view

* feat: implement basic browser navigation component

* refactor: move database related files to middleware

* fix: remove unused test command

* fix: update source directory for buf-publish workflow
This commit is contained in:
Prad Nukala
2024-09-16 01:06:00 -04:00
committed by GitHub
parent 7bdf6c3eb4
commit 8022428e37
118 changed files with 388 additions and 1007 deletions
-330
View File
@@ -1,330 +0,0 @@
package db
import (
"fmt"
"github.com/onsonr/sonr/internal/db/orm"
"gorm.io/gorm"
)
// createInitialTables creates the initial tables in the database.
func createInitialTables(db *gorm.DB) (*DB, error) {
err := db.AutoMigrate(
&orm.Account{},
&orm.Asset{},
&orm.Credential{},
&orm.Keyshare{},
&orm.Permission{},
&orm.Profile{},
&orm.Property{},
)
if err != nil {
return nil, fmt.Errorf("failed to create table: %w", err)
}
return &DB{db}, nil
}
// AddAccount adds a new account to the database
func (db *DB) AddAccount(account *orm.Account) error {
tx := db.Create(account)
if tx.Error != nil {
return fmt.Errorf("failed to add account: %w", tx.Error)
}
return nil
}
// GetAccount gets an account from the database
func (db *DB) GetAccount(account *orm.Account) error {
tx := db.First(account)
if tx.Error != nil {
return fmt.Errorf("failed to get account: %w", tx.Error)
}
return nil
}
// UpdateAccount updates an existing account in the database
func (db *DB) UpdateAccount(account *orm.Account) error {
tx := db.Save(account)
if tx.Error != nil {
return fmt.Errorf("failed to update account: %w", tx.Error)
}
return nil
}
// DeleteAccount deletes an existing account from the database
func (db *DB) DeleteAccount(account *orm.Account) error {
tx := db.Delete(account)
if tx.Error != nil {
return fmt.Errorf("failed to delete account: %w", tx.Error)
}
return nil
}
// AddAsset adds a new asset to the database
func (db *DB) AddAsset(asset *orm.Asset) error {
tx := db.Create(asset)
if tx.Error != nil {
return fmt.Errorf("failed to add asset: %w", tx.Error)
}
return nil
}
// GetAsset gets an asset from the database
func (db *DB) GetAsset(asset *orm.Asset) error {
tx := db.First(asset)
if tx.Error != nil {
return fmt.Errorf("failed to get asset: %w", tx.Error)
}
return nil
}
// UpdateAsset updates an existing asset in the database
func (db *DB) UpdateAsset(asset *orm.Asset) error {
tx := db.Save(asset)
if tx.Error != nil {
return fmt.Errorf("failed to update asset: %w", tx.Error)
}
return nil
}
// DeleteAsset deletes an existing asset from the database
func (db *DB) DeleteAsset(asset *orm.Asset) error {
tx := db.Delete(asset)
if tx.Error != nil {
return fmt.Errorf("failed to delete asset: %w", tx.Error)
}
return nil
}
// AddCredential adds a new credential to the database
func (db *DB) AddCredential(credential *orm.Credential) error {
tx := db.Create(credential)
if tx.Error != nil {
return fmt.Errorf("failed to add credential: %w", tx.Error)
}
return nil
}
// GetCredential gets an credential from the database
func (db *DB) GetCredential(credential *orm.Credential) error {
tx := db.First(credential)
if tx.Error != nil {
return fmt.Errorf("failed to get credential: %w", tx.Error)
}
return nil
}
// UpdateCredential updates an existing credential in the database
func (db *DB) UpdateCredential(credential *orm.Credential) error {
tx := db.Save(credential)
if tx.Error != nil {
return fmt.Errorf("failed to update credential: %w", tx.Error)
}
return nil
}
// DeleteCredential deletes an existing credential from the database
func (db *DB) DeleteCredential(credential *orm.Credential) error {
tx := db.Delete(credential)
if tx.Error != nil {
return fmt.Errorf("failed to delete credential: %w", tx.Error)
}
return nil
}
// AddKeyshare adds a new keyshare to the database
func (db *DB) AddKeyshare(keyshare *orm.Keyshare) error {
tx := db.Create(keyshare)
if tx.Error != nil {
return fmt.Errorf("failed to add keyshare: %w", tx.Error)
}
return nil
}
// GetKeyshare gets an keyshare from the database
func (db *DB) GetKeyshare(keyshare *orm.Keyshare) error {
tx := db.First(keyshare)
if tx.Error != nil {
return fmt.Errorf("failed to get keyshare: %w", tx.Error)
}
return nil
}
// UpdateKeyshare updates an existing keyshare in the database
func (db *DB) UpdateKeyshare(keyshare *orm.Keyshare) error {
tx := db.Save(keyshare)
if tx.Error != nil {
return fmt.Errorf("failed to update keyshare: %w", tx.Error)
}
return nil
}
// DeleteKeyshare deletes an existing keyshare from the database
func (db *DB) DeleteKeyshare(keyshare *orm.Keyshare) error {
tx := db.Delete(keyshare)
if tx.Error != nil {
return fmt.Errorf("failed to delete keyshare: %w", tx.Error)
}
return nil
}
// AddPermission adds a new permission to the database
func (db *DB) AddPermission(permission *orm.Permission) error {
tx := db.Create(permission)
if tx.Error != nil {
return fmt.Errorf("failed to add permission: %w", tx.Error)
}
return nil
}
// GetPermission gets an permission from the database
func (db *DB) GetPermission(permission *orm.Permission) error {
tx := db.First(permission)
if tx.Error != nil {
return fmt.Errorf("failed to get permission: %w", tx.Error)
}
return nil
}
// UpdatePermission updates an existing permission in the database
func (db *DB) UpdatePermission(permission *orm.Permission) error {
tx := db.Save(permission)
if tx.Error != nil {
return fmt.Errorf("failed to update permission: %w", tx.Error)
}
return nil
}
// DeletePermission deletes an existing permission from the database
func (db *DB) DeletePermission(permission *orm.Permission) error {
tx := db.Delete(permission)
if tx.Error != nil {
return fmt.Errorf("failed to delete permission: %w", tx.Error)
}
return nil
}
// AddProfile adds a new profile to the database
func (db *DB) AddProfile(profile *orm.Profile) error {
tx := db.Create(profile)
if tx.Error != nil {
return fmt.Errorf("failed to add profile: %w", tx.Error)
}
return nil
}
// GetProfile gets an profile from the database
func (db *DB) GetProfile(profile *orm.Profile) error {
tx := db.First(profile)
if tx.Error != nil {
return fmt.Errorf("failed to get profile: %w", tx.Error)
}
return nil
}
// UpdateProfile updates an existing profile in the database
func (db *DB) UpdateProfile(profile *orm.Profile) error {
tx := db.Save(profile)
if tx.Error != nil {
return fmt.Errorf("failed to update profile: %w", tx.Error)
}
return nil
}
// DeleteProfile deletes an existing profile from the database
func (db *DB) DeleteProfile(profile *orm.Profile) error {
tx := db.Delete(profile)
if tx.Error != nil {
return fmt.Errorf("failed to delete profile: %w", tx.Error)
}
return nil
}
// AddProperty adds a new property to the database
func (db *DB) AddProperty(property *orm.Property) error {
tx := db.Create(property)
if tx.Error != nil {
return fmt.Errorf("failed to add property: %w", tx.Error)
}
return nil
}
// GetProperty gets an property from the database
func (db *DB) GetProperty(property *orm.Property) error {
tx := db.First(property)
if tx.Error != nil {
return fmt.Errorf("failed to get property: %w", tx.Error)
}
return nil
}
// UpdateProperty updates an existing property in the database
func (db *DB) UpdateProperty(property *orm.Property) error {
tx := db.Save(property)
if tx.Error != nil {
return fmt.Errorf("failed to update property: %w", tx.Error)
}
return nil
}
// DeleteProperty deletes an existing property from the database
func (db *DB) DeleteProperty(property *orm.Property) error {
tx := db.Delete(property)
if tx.Error != nil {
return fmt.Errorf("failed to delete property: %w", tx.Error)
}
return nil
}
-54
View File
@@ -1,54 +0,0 @@
package db
import (
"crypto/rand"
"github.com/ncruces/go-sqlite3/gormlite"
"golang.org/x/crypto/argon2"
"gorm.io/gorm"
"lukechampine.com/adiantum/hbsh"
"lukechampine.com/adiantum/hpolyc"
)
type DB struct {
*gorm.DB
}
func New(opts ...DBOption) (*DB, error) {
config := &DBConfig{
fileName: "vault.db",
}
for _, opt := range opts {
opt(config)
}
gormdb, err := gorm.Open(gormlite.Open(config.ConnectionString()))
if err != nil {
return nil, err
}
db, err := createInitialTables(gormdb)
if err != nil {
return nil, err
}
return db, nil
}
// HBSH creates an HBSH cipher given a key.
func (c *DB) HBSH(key []byte) *hbsh.HBSH {
if len(key) != 32 {
// Key is not appropriate, return nil.
return nil
}
return hpolyc.New(key)
}
// KDF gets a key from a secret.
func (c *DB) KDF(secret string) []byte {
if secret == "" {
// No secret is given, generate a random key.
key := make([]byte, 32)
n, _ := rand.Read(key)
return key[:n]
}
// Hash the secret with a KDF.
return argon2.IDKey([]byte(secret), []byte("hpolyc"), 3, 64*1024, 4, 32)
}
-195
View File
@@ -1,195 +0,0 @@
package db
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/db/orm"
)
func (db *DB) ServeEcho(e *echo.Group) {
e.GET("/accounts", db.HandleAccount)
e.GET("/assets", db.HandleAsset)
e.GET("/credentials", db.HandleCredential)
e.GET("/keyshares", db.HandleKeyshare)
e.GET("/permissions", db.HandlePermission)
e.GET("/profiles", db.HandleProfile)
e.GET("/properties", db.HandleProperty)
}
func (db *DB) HandleAccount(c echo.Context) error {
data := new(orm.Account)
if err := c.Bind(data); err != nil {
return err
}
// Check the method for GET, POST, PUT, DELETE
switch c.Request().Method {
case echo.POST:
if err := db.AddAccount(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateAccount(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteAccount(data); err != nil {
return err
}
return c.JSON(200, nil)
}
return c.JSON(200, data)
}
func (db *DB) HandleAsset(c echo.Context) error {
data := new(orm.Asset)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddAsset(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateAsset(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteAsset(data); err != nil {
return err
}
return c.JSON(200, "OK")
}
return c.JSON(200, data)
}
func (db *DB) HandleCredential(c echo.Context) error {
data := new(orm.Credential)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddCredential(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateCredential(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteCredential(data); err != nil {
return err
}
}
return c.JSON(200, data)
}
func (db *DB) HandleKeyshare(c echo.Context) error {
data := new(orm.Keyshare)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddKeyshare(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateKeyshare(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteKeyshare(data); err != nil {
return err
}
}
return c.JSON(200, data)
}
func (db *DB) HandlePermission(c echo.Context) error {
data := new(orm.Permission)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddPermission(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdatePermission(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeletePermission(data); err != nil {
return err
}
}
return c.JSON(200, data)
}
func (db *DB) HandleProfile(c echo.Context) error {
data := new(orm.Profile)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddProfile(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateProfile(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteProfile(data); err != nil {
return err
}
}
return c.JSON(200, data)
}
func (db *DB) HandleProperty(c echo.Context) error {
data := new(orm.Property)
if err := c.Bind(data); err != nil {
return err
}
switch c.Request().Method {
case echo.POST:
if err := db.AddProperty(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.PUT:
if err := db.UpdateProperty(data); err != nil {
return err
}
return c.JSON(200, "OK")
case echo.DELETE:
if err := db.DeleteProperty(data); err != nil {
return err
}
}
return c.JSON(200, data)
}
-40
View File
@@ -1,40 +0,0 @@
package db
import (
_ "github.com/ncruces/go-sqlite3/embed"
"github.com/onsonr/sonr/internal/db/orm"
)
type DBOption func(config *DBConfig)
func WitDir(dir string) DBOption {
return func(config *DBConfig) {
config.Dir = dir
}
}
func WithSecretKey(secretKey string) DBOption {
return func(config *DBConfig) {
config.SecretKey = secretKey
}
}
type DBConfig struct {
Dir string
SecretKey string
fileName string
initialAccounts []*orm.Account
initialAssets []*orm.Asset
initialCredentials []*orm.Credential
initialKeyshares []*orm.Keyshare
initialPermissions []*orm.Permission
initialProfiles []*orm.Profile
initialProperties []*orm.Property
}
func (config *DBConfig) ConnectionString() string {
connStr := "file:"
connStr += config.fileName
return connStr
}
-16
View File
@@ -1,16 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("orm", Orm{})
pkl.RegisterMapping("orm#Account", Account{})
pkl.RegisterMapping("orm#Asset", Asset{})
pkl.RegisterMapping("orm#Chain", Chain{})
pkl.RegisterMapping("orm#Credential", Credential{})
pkl.RegisterMapping("orm#Profile", Profile{})
pkl.RegisterMapping("orm#Property", Property{})
pkl.RegisterMapping("orm#Keyshare", Keyshare{})
pkl.RegisterMapping("orm#Permission", Permission{})
}
+47
View File
@@ -0,0 +1,47 @@
//go:build js && wasm
// +build js,wasm
package main
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/dwn/wasm"
svc "github.com/onsonr/sonr/internal/dwn/handlers"
mdw "github.com/onsonr/sonr/internal/dwn/middleware"
"github.com/onsonr/sonr/internal/dwn/views"
)
func main() {
e := New()
wasm.Serve(e)
}
func registerFrontend(e *echo.Echo) {
// Add Public Pages
e.GET("/", views.HomeView)
e.GET("/login", views.LoginView)
e.POST("/login/:identifier", svc.HandleCredentialAssertion)
e.GET("/register", views.RegisterView)
e.POST("/register/:subject", svc.HandleCredentialCreation)
e.POST("/register/:subject/check", svc.CheckSubjectIsValid)
e.GET("/profile", views.ProfileView)
}
func registerOpenID(g *echo.Group) {
// Add Authenticated Pages
g.Use(mdw.MacaroonMiddleware("test", "test"))
g.GET("/", views.AuthorizeView)
g.GET("/discovery", svc.GetDiscovery)
g.GET("/jwks", svc.GetJWKS)
g.GET("/token", svc.GetToken)
g.POST("/:origin/grant/:subject", svc.GrantAuthorization)
}
func New() *echo.Echo {
e := echo.New()
e.Use(mdw.UseSession)
registerFrontend(e)
registerOpenID(e.Group("/authorize"))
return e
}
@@ -53,7 +53,7 @@ func alertElement(attrs templ.Attributes, title, message string, icon templ.Comp
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 10, Col: 66}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/alert.templ`, Line: 10, Col: 66}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -66,7 +66,7 @@ func alertElement(attrs templ.Attributes, title, message string, icon templ.Comp
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(message)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/alert.templ`, Line: 11, Col: 43}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/alert.templ`, Line: 11, Col: 43}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -92,7 +92,7 @@ func breadcrumbItem(title string, active bool) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/breadcrumbs.templ`, Line: 23, Col: 126}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/breadcrumbs.templ`, Line: 23, Col: 126}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -110,7 +110,7 @@ func breadcrumbItem(title string, active bool) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/breadcrumbs.templ`, Line: 25, Col: 118}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/breadcrumbs.templ`, Line: 25, Col: 118}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -151,7 +151,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxGet)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 86, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -164,7 +164,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 86, Col: 69}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 69}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -177,7 +177,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 86, Col: 96}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 96}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -190,7 +190,7 @@ func renderHxGetButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 86, Col: 117}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 86, Col: 117}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -245,7 +245,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxPost)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 92, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
@@ -258,7 +258,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTarget)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 92, Col: 52}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 52}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -271,7 +271,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxTrigger)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 92, Col: 79}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 79}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
@@ -284,7 +284,7 @@ func renderHxPostButton(c *button, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(c.hxSwap)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/button.templ`, Line: 92, Col: 100}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/button.templ`, Line: 92, Col: 100}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -37,7 +37,7 @@ func renderCard(id string, attrs templ.Attributes) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(id)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/card.templ`, Line: 8, Col: 13}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/card.templ`, Line: 8, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -19,15 +19,15 @@ func Text(content string) templ.Component {
templ renderText(level int, text string) {
switch level {
case 1:
<h1 class="text-2xl lg:text-3xl font-bold">
<h1 class="text-2xl lg:text-3xl font-bold pb-3">
{ text }
</h1>
case 2:
<h2 class="text-xl lg:text-2xl font-bold">
<h2 class="text-xl lg:text-2xl font-bold pb-2">
{ text }
</h2>
case 3:
<h3 class="text-md lg:text-xl font-semibold">
<h3 class="text-md lg:text-xl font-semibold pb-1">
{ text }
</h3>
default:
@@ -44,14 +44,14 @@ func renderText(level int, text string) templ.Component {
ctx = templ.ClearChildren(ctx)
switch level {
case 1:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1 class=\"text-2xl lg:text-3xl font-bold\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1 class=\"text-2xl lg:text-3xl font-bold pb-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 23, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 23, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -62,14 +62,14 @@ func renderText(level int, text string) templ.Component {
return templ_7745c5c3_Err
}
case 2:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2 class=\"text-xl lg:text-2xl font-bold\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2 class=\"text-xl lg:text-2xl font-bold pb-2\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 27, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 27, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -80,14 +80,14 @@ func renderText(level int, text string) templ.Component {
return templ_7745c5c3_Err
}
case 3:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h3 class=\"text-md lg:text-xl font-semibold\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h3 class=\"text-md lg:text-xl font-semibold pb-1\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 31, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 31, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -105,7 +105,7 @@ func renderText(level int, text string) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 35, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 35, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -153,7 +153,7 @@ func renderLink(attrs templ.Attributes, text string) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 42, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 42, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@@ -200,7 +200,7 @@ func renderStrong(attrs templ.Attributes, text string) templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 48, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 48, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
@@ -247,7 +247,7 @@ func renderEmphasis(attrs templ.Attributes, text string) templ.Component {
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 54, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 54, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
@@ -294,7 +294,7 @@ func renderCode(attrs templ.Attributes, text string) templ.Component {
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/fonts.templ`, Line: 60, Col: 8}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/fonts.templ`, Line: 60, Col: 8}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
@@ -41,7 +41,7 @@ func Layout(title string) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/global.templ`, Line: 8, Col: 17}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/global.templ`, Line: 8, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -43,7 +43,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/inputs.templ`, Line: 15, Col: 128}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 15, Col: 128}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -61,7 +61,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/inputs.templ`, Line: 20, Col: 128}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 20, Col: 128}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -79,7 +79,7 @@ func TextInput(state InputState, label string, placeholder string) templ.Compone
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(label)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gui/elements/inputs.templ`, Line: 25, Col: 128}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/dwn/elements/inputs.templ`, Line: 25, Col: 128}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
+6
View File
@@ -0,0 +1,6 @@
package elements
import "github.com/labstack/echo/v4"
templ Panel(c echo.Context, id string) {
}
+35
View File
@@ -0,0 +1,35 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.771
package elements
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/labstack/echo/v4"
func Panel(c echo.Context, id string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/labstack/echo/v4"
oidc "github.com/onsonr/sonr/x/did/types/oidc"
oidc "github.com/onsonr/sonr/internal/dwn/models"
)
func GrantAuthorization(e echo.Context) error {
@@ -1,4 +1,4 @@
package forms
package islands
import (
"bytes"
@@ -1,4 +1,4 @@
package forms
package islands
import "github.com/labstack/echo/v4"
@@ -18,8 +18,8 @@ templ BasicInfo(c echo.Context, state FormState) {
}
}
templ CreateCredentials(state FormState) {
templ CreateCredentials(c echo.Context, state FormState) {
}
templ PrivacyTerms(state FormState) {
templ PrivacyTerms(c echo.Context, state FormState) {
}
@@ -1,7 +1,7 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.771
package forms
package islands
//lint:file-ignore SA4006 This context is only used if a nested component is present.
@@ -39,7 +39,7 @@ func BasicInfo(c echo.Context, state FormState) templ.Component {
})
}
func CreateCredentials(state FormState) templ.Component {
func CreateCredentials(c echo.Context, state FormState) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
@@ -61,7 +61,7 @@ func CreateCredentials(state FormState) templ.Component {
})
}
func PrivacyTerms(state FormState) templ.Component {
func PrivacyTerms(c echo.Context, state FormState) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
+28
View File
@@ -0,0 +1,28 @@
//go:build js && wasm
// +build js,wasm
package mdw
import (
"github.com/donseba/go-htmx"
"github.com/labstack/echo/v4"
)
type Browser struct {
echo.Context
isMobile bool
userAgent string
width int
olc string
ksuid string
// HTMX Specific
htmx *htmx.HTMX
// WebAPIs
credentials CredentialsAPI
indexedDB IndexedDBAPI
localStorage LocalStorageAPI
push PushAPI
sessionStorage SessionStorageAPI
}
+6
View File
@@ -0,0 +1,6 @@
//go:build js && wasm
// +build js,wasm
package mdw
type CredentialsAPI interface{}
@@ -1,7 +1,7 @@
//go:build js && wasm
// +build js,wasm
package idb
package mdw
import (
"context"
@@ -12,6 +12,8 @@ import (
"github.com/hack-pad/go-indexeddb/idb"
)
type IndexedDBAPI interface{}
// Model is an interface that must be implemented by types used with Table
type Model interface {
Table() string
@@ -27,12 +29,11 @@ type Table[T Model] struct {
// NewTable creates a new Table instance
func NewTable[T Model](dbName string, version uint, keyPath string) (*Table[T], error) {
ctx := context.Background()
factory := idb.Global()
var model T
tableName := model.Table()
openRequest, err := factory.Open(ctx, dbName, version, func(db *idb.Database, oldVersion, newVersion uint) error {
openRequest, err := idb.Global().Open(ctx, dbName, version, func(db *idb.Database, oldVersion, newVersion uint) error {
_, err := db.CreateObjectStore(tableName, idb.ObjectStoreOptions{
KeyPath: js.ValueOf(keyPath),
})
@@ -107,6 +108,36 @@ func (t *Table[T]) Query(key interface{}) (T, error) {
return result, err
}
// First retrieves the first record from the table
func (t *Table[T]) First(data T) error {
tx, err := t.db.Transaction(idb.TransactionReadOnly, data.Table())
if err != nil {
return err
}
defer tx.Commit()
objectStore, err := tx.ObjectStore(data.Table())
if err != nil {
return err
}
request, err := objectStore.Get(js.ValueOf(t.keyPath))
if err != nil {
return err
}
value, err := request.Await(context.Background())
if err != nil {
return err
}
if value.IsUndefined() || value.IsNull() {
return errors.New("record not found")
}
err = json.Unmarshal([]byte(value.String()), &data)
return err
}
// Delete removes a record from the table based on a key
func (t *Table[T]) Delete(key interface{}) error {
var model T
@@ -125,6 +156,28 @@ func (t *Table[T]) Delete(key interface{}) error {
return err
}
// Save updates a record in the table based on a key
func (t *Table[T]) Save(data T) error {
tx, err := t.db.Transaction(idb.TransactionReadWrite, data.Table())
if err != nil {
return err
}
defer tx.Commit()
objectStore, err := tx.ObjectStore(data.Table())
if err != nil {
return err
}
jsonData, err := json.Marshal(data)
if err != nil {
return err
}
_, err = objectStore.Put(js.ValueOf(string(jsonData)))
return err
}
// Close closes the database connection
func (t *Table[T]) Close() error {
return t.db.Close()
+6
View File
@@ -0,0 +1,6 @@
//go:build js && wasm
// +build js,wasm
package mdw
type PushAPI interface{}
@@ -6,14 +6,12 @@ import (
"github.com/donseba/go-htmx"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/db"
"github.com/segmentio/ksuid"
)
type Session struct {
echo.Context
htmx *htmx.HTMX
dB *db.DB
}
// GetSession returns the current Session
@@ -31,10 +29,6 @@ func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
}
}
func (c *Session) DB() *db.DB {
return c.dB
}
func (c *Session) Htmx() *htmx.HTMX {
return c.htmx
}
+8
View File
@@ -0,0 +1,8 @@
//go:build js && wasm
// +build js,wasm
package mdw
type LocalStorageAPI interface{}
type SessionStorageAPI interface{}
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Account struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Asset struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Chain struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Credential struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -0,0 +1,34 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type DiscoveryDocument struct {
Issuer string `pkl:"issuer" json:"issuer,omitempty" param:"issuer"`
AuthorizationEndpoint string `pkl:"authorization_endpoint" json:"authorization_endpoint,omitempty" param:"authorization_endpoint"`
TokenEndpoint string `pkl:"token_endpoint" json:"token_endpoint,omitempty" param:"token_endpoint"`
UserinfoEndpoint string `pkl:"userinfo_endpoint" json:"userinfo_endpoint,omitempty" param:"userinfo_endpoint"`
JwksUri string `pkl:"jwks_uri" json:"jwks_uri,omitempty" param:"jwks_uri"`
RegistrationEndpoint string `pkl:"registration_endpoint" json:"registration_endpoint,omitempty" param:"registration_endpoint"`
ScopesSupported []string `pkl:"scopes_supported" json:"scopes_supported,omitempty" param:"scopes_supported"`
ResponseTypesSupported []string `pkl:"response_types_supported" json:"response_types_supported,omitempty" param:"response_types_supported"`
ResponseModesSupported []string `pkl:"response_modes_supported" json:"response_modes_supported,omitempty" param:"response_modes_supported"`
SubjectTypesSupported []string `pkl:"subject_types_supported" json:"subject_types_supported,omitempty" param:"subject_types_supported"`
IdTokenSigningAlgValuesSupported []string `pkl:"id_token_signing_alg_values_supported" json:"id_token_signing_alg_values_supported,omitempty" param:"id_token_signing_alg_values_supported"`
ClaimsSupported []string `pkl:"claims_supported" json:"claims_supported,omitempty" param:"claims_supported"`
GrantTypesSupported []string `pkl:"grant_types_supported" json:"grant_types_supported,omitempty" param:"grant_types_supported"`
AcrValuesSupported []string `pkl:"acr_values_supported" json:"acr_values_supported,omitempty" param:"acr_values_supported"`
TokenEndpointAuthMethodsSupported []string `pkl:"token_endpoint_auth_methods_supported" json:"token_endpoint_auth_methods_supported,omitempty" param:"token_endpoint_auth_methods_supported"`
}
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Keyshare struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
+36
View File
@@ -0,0 +1,36 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import (
"context"
"github.com/apple/pkl-go/pkl"
)
type Models struct {
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
func LoadFromPath(ctx context.Context, path string) (ret *Models, 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 Models
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
var ret Models
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
return &ret, nil
}
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Permission struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Profile struct {
Id string `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Property struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
+17
View File
@@ -0,0 +1,17 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
pkl.RegisterMapping("models#Account", Account{})
pkl.RegisterMapping("models#Asset", Asset{})
pkl.RegisterMapping("models#Chain", Chain{})
pkl.RegisterMapping("models#Credential", Credential{})
pkl.RegisterMapping("models#Profile", Profile{})
pkl.RegisterMapping("models#Property", Property{})
pkl.RegisterMapping("models#Keyshare", Keyshare{})
pkl.RegisterMapping("models#Permission", Permission{})
pkl.RegisterMapping("models#DiscoveryDocument", DiscoveryDocument{})
}
@@ -1,4 +1,4 @@
package orm
package models
func (a *Account) Table() string {
return "accounts"
+6
View File
@@ -0,0 +1,6 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
type Msg interface {
GetTypeUrl() string
}
@@ -0,0 +1,44 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidAllocateVault interface {
Msg
GetAuthority() string
GetSubject() string
GetToken() *pkl.Object
}
var _ MsgDidAllocateVault = (*MsgDidAllocateVaultImpl)(nil)
type MsgDidAllocateVaultImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Authority string `pkl:"authority"`
Subject string `pkl:"subject"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidAllocateVaultImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidAllocateVaultImpl) GetAuthority() string {
return rcv.Authority
}
func (rcv *MsgDidAllocateVaultImpl) GetSubject() string {
return rcv.Subject
}
func (rcv *MsgDidAllocateVaultImpl) GetToken() *pkl.Object {
return rcv.Token
}
+60
View File
@@ -0,0 +1,60 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidAuthorize interface {
Msg
GetAuthority() string
GetController() string
GetAddress() string
GetOrigin() string
GetToken() *pkl.Object
}
var _ MsgDidAuthorize = (*MsgDidAuthorizeImpl)(nil)
type MsgDidAuthorizeImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Authority string `pkl:"authority"`
Controller string `pkl:"controller"`
Address string `pkl:"address"`
Origin string `pkl:"origin"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidAuthorizeImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidAuthorizeImpl) GetAuthority() string {
return rcv.Authority
}
func (rcv *MsgDidAuthorizeImpl) GetController() string {
return rcv.Controller
}
func (rcv *MsgDidAuthorizeImpl) GetAddress() string {
return rcv.Address
}
func (rcv *MsgDidAuthorizeImpl) GetOrigin() string {
return rcv.Origin
}
func (rcv *MsgDidAuthorizeImpl) GetToken() *pkl.Object {
return rcv.Token
}
@@ -0,0 +1,52 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidProveWitness interface {
Msg
GetAuthority() string
GetProperty() string
GetWitness() []int
GetToken() *pkl.Object
}
var _ MsgDidProveWitness = (*MsgDidProveWitnessImpl)(nil)
type MsgDidProveWitnessImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Authority string `pkl:"authority"`
Property string `pkl:"property"`
Witness []int `pkl:"witness"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidProveWitnessImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidProveWitnessImpl) GetAuthority() string {
return rcv.Authority
}
func (rcv *MsgDidProveWitnessImpl) GetProperty() string {
return rcv.Property
}
func (rcv *MsgDidProveWitnessImpl) GetWitness() []int {
return rcv.Witness
}
func (rcv *MsgDidProveWitnessImpl) GetToken() *pkl.Object {
return rcv.Token
}
@@ -0,0 +1,60 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidRegisterController interface {
Msg
GetAuthority() string
GetCid() string
GetOrigin() string
GetAuthentication() []*pkl.Object
GetToken() *pkl.Object
}
var _ MsgDidRegisterController = (*MsgDidRegisterControllerImpl)(nil)
type MsgDidRegisterControllerImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Authority string `pkl:"authority"`
Cid string `pkl:"cid"`
Origin string `pkl:"origin"`
Authentication []*pkl.Object `pkl:"authentication"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidRegisterControllerImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidRegisterControllerImpl) GetAuthority() string {
return rcv.Authority
}
func (rcv *MsgDidRegisterControllerImpl) GetCid() string {
return rcv.Cid
}
func (rcv *MsgDidRegisterControllerImpl) GetOrigin() string {
return rcv.Origin
}
func (rcv *MsgDidRegisterControllerImpl) GetAuthentication() []*pkl.Object {
return rcv.Authentication
}
func (rcv *MsgDidRegisterControllerImpl) GetToken() *pkl.Object {
return rcv.Token
}
@@ -0,0 +1,76 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidRegisterService interface {
Msg
GetController() string
GetOriginUri() string
GetScopes() *pkl.Object
GetDescription() string
GetServiceEndpoints() map[string]string
GetMetadata() *pkl.Object
GetToken() *pkl.Object
}
var _ MsgDidRegisterService = (*MsgDidRegisterServiceImpl)(nil)
type MsgDidRegisterServiceImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Controller string `pkl:"controller"`
OriginUri string `pkl:"originUri"`
Scopes *pkl.Object `pkl:"scopes"`
Description string `pkl:"description"`
ServiceEndpoints map[string]string `pkl:"serviceEndpoints"`
Metadata *pkl.Object `pkl:"metadata"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidRegisterServiceImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidRegisterServiceImpl) GetController() string {
return rcv.Controller
}
func (rcv *MsgDidRegisterServiceImpl) GetOriginUri() string {
return rcv.OriginUri
}
func (rcv *MsgDidRegisterServiceImpl) GetScopes() *pkl.Object {
return rcv.Scopes
}
func (rcv *MsgDidRegisterServiceImpl) GetDescription() string {
return rcv.Description
}
func (rcv *MsgDidRegisterServiceImpl) GetServiceEndpoints() map[string]string {
return rcv.ServiceEndpoints
}
func (rcv *MsgDidRegisterServiceImpl) GetMetadata() *pkl.Object {
return rcv.Metadata
}
func (rcv *MsgDidRegisterServiceImpl) GetToken() *pkl.Object {
return rcv.Token
}
+36
View File
@@ -0,0 +1,36 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidSyncVault interface {
Msg
GetController() string
GetToken() *pkl.Object
}
var _ MsgDidSyncVault = (*MsgDidSyncVaultImpl)(nil)
type MsgDidSyncVaultImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Controller string `pkl:"controller"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidSyncVaultImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidSyncVaultImpl) GetController() string {
return rcv.Controller
}
func (rcv *MsgDidSyncVaultImpl) GetToken() *pkl.Object {
return rcv.Token
}
@@ -0,0 +1,44 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgDidUpdateParams interface {
Msg
GetAuthority() string
GetParams() *pkl.Object
GetToken() *pkl.Object
}
var _ MsgDidUpdateParams = (*MsgDidUpdateParamsImpl)(nil)
type MsgDidUpdateParamsImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Authority string `pkl:"authority"`
Params *pkl.Object `pkl:"params"`
Token *pkl.Object `pkl:"token"`
}
// The type URL for the message
func (rcv *MsgDidUpdateParamsImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgDidUpdateParamsImpl) GetAuthority() string {
return rcv.Authority
}
func (rcv *MsgDidUpdateParamsImpl) GetParams() *pkl.Object {
return rcv.Params
}
func (rcv *MsgDidUpdateParamsImpl) GetToken() *pkl.Object {
return rcv.Token
}
+44
View File
@@ -0,0 +1,44 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgGovDeposit interface {
Msg
GetProposalId() int
GetDepositor() string
GetAmount() []*pkl.Object
}
var _ MsgGovDeposit = (*MsgGovDepositImpl)(nil)
type MsgGovDepositImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
ProposalId int `pkl:"proposalId"`
Depositor string `pkl:"depositor"`
Amount []*pkl.Object `pkl:"amount"`
}
// The type URL for the message
func (rcv *MsgGovDepositImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGovDepositImpl) GetProposalId() int {
return rcv.ProposalId
}
func (rcv *MsgGovDepositImpl) GetDepositor() string {
return rcv.Depositor
}
func (rcv *MsgGovDepositImpl) GetAmount() []*pkl.Object {
return rcv.Amount
}
@@ -0,0 +1,45 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgGovSubmitProposal interface {
Msg
GetContent() *Proposal
GetInitialDeposit() []*pkl.Object
GetProposer() string
}
var _ MsgGovSubmitProposal = (*MsgGovSubmitProposalImpl)(nil)
// Gov module messages
type MsgGovSubmitProposalImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Content *Proposal `pkl:"content"`
InitialDeposit []*pkl.Object `pkl:"initialDeposit"`
Proposer string `pkl:"proposer"`
}
// The type URL for the message
func (rcv *MsgGovSubmitProposalImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGovSubmitProposalImpl) GetContent() *Proposal {
return rcv.Content
}
func (rcv *MsgGovSubmitProposalImpl) GetInitialDeposit() []*pkl.Object {
return rcv.InitialDeposit
}
func (rcv *MsgGovSubmitProposalImpl) GetProposer() string {
return rcv.Proposer
}
+42
View File
@@ -0,0 +1,42 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
type MsgGovVote interface {
Msg
GetProposalId() int
GetVoter() string
GetOption() int
}
var _ MsgGovVote = (*MsgGovVoteImpl)(nil)
type MsgGovVoteImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
ProposalId int `pkl:"proposalId"`
Voter string `pkl:"voter"`
Option int `pkl:"option"`
}
// The type URL for the message
func (rcv *MsgGovVoteImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGovVoteImpl) GetProposalId() int {
return rcv.ProposalId
}
func (rcv *MsgGovVoteImpl) GetVoter() string {
return rcv.Voter
}
func (rcv *MsgGovVoteImpl) GetOption() int {
return rcv.Option
}
@@ -0,0 +1,45 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgGroupCreateGroup interface {
Msg
GetAdmin() string
GetMembers() []*pkl.Object
GetMetadata() string
}
var _ MsgGroupCreateGroup = (*MsgGroupCreateGroupImpl)(nil)
// Group module messages
type MsgGroupCreateGroupImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Admin string `pkl:"admin"`
Members []*pkl.Object `pkl:"members"`
Metadata string `pkl:"metadata"`
}
// The type URL for the message
func (rcv *MsgGroupCreateGroupImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGroupCreateGroupImpl) GetAdmin() string {
return rcv.Admin
}
func (rcv *MsgGroupCreateGroupImpl) GetMembers() []*pkl.Object {
return rcv.Members
}
func (rcv *MsgGroupCreateGroupImpl) GetMetadata() string {
return rcv.Metadata
}
@@ -0,0 +1,60 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgGroupSubmitProposal interface {
Msg
GetGroupPolicyAddress() string
GetProposers() []string
GetMetadata() string
GetMessages() []*pkl.Object
GetExec() int
}
var _ MsgGroupSubmitProposal = (*MsgGroupSubmitProposalImpl)(nil)
type MsgGroupSubmitProposalImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
GroupPolicyAddress string `pkl:"groupPolicyAddress"`
Proposers []string `pkl:"proposers"`
Metadata string `pkl:"metadata"`
Messages []*pkl.Object `pkl:"messages"`
Exec int `pkl:"exec"`
}
// The type URL for the message
func (rcv *MsgGroupSubmitProposalImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGroupSubmitProposalImpl) GetGroupPolicyAddress() string {
return rcv.GroupPolicyAddress
}
func (rcv *MsgGroupSubmitProposalImpl) GetProposers() []string {
return rcv.Proposers
}
func (rcv *MsgGroupSubmitProposalImpl) GetMetadata() string {
return rcv.Metadata
}
func (rcv *MsgGroupSubmitProposalImpl) GetMessages() []*pkl.Object {
return rcv.Messages
}
func (rcv *MsgGroupSubmitProposalImpl) GetExec() int {
return rcv.Exec
}
+58
View File
@@ -0,0 +1,58 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
type MsgGroupVote interface {
Msg
GetProposalId() int
GetVoter() string
GetOption() int
GetMetadata() string
GetExec() int
}
var _ MsgGroupVote = (*MsgGroupVoteImpl)(nil)
type MsgGroupVoteImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
ProposalId int `pkl:"proposalId"`
Voter string `pkl:"voter"`
Option int `pkl:"option"`
Metadata string `pkl:"metadata"`
Exec int `pkl:"exec"`
}
// The type URL for the message
func (rcv *MsgGroupVoteImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgGroupVoteImpl) GetProposalId() int {
return rcv.ProposalId
}
func (rcv *MsgGroupVoteImpl) GetVoter() string {
return rcv.Voter
}
func (rcv *MsgGroupVoteImpl) GetOption() int {
return rcv.Option
}
func (rcv *MsgGroupVoteImpl) GetMetadata() string {
return rcv.Metadata
}
func (rcv *MsgGroupVoteImpl) GetExec() int {
return rcv.Exec
}
@@ -0,0 +1,52 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgStakingBeginRedelegate interface {
Msg
GetDelegatorAddress() string
GetValidatorSrcAddress() string
GetValidatorDstAddress() string
GetAmount() *pkl.Object
}
var _ MsgStakingBeginRedelegate = (*MsgStakingBeginRedelegateImpl)(nil)
type MsgStakingBeginRedelegateImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
DelegatorAddress string `pkl:"delegatorAddress"`
ValidatorSrcAddress string `pkl:"validatorSrcAddress"`
ValidatorDstAddress string `pkl:"validatorDstAddress"`
Amount *pkl.Object `pkl:"amount"`
}
// The type URL for the message
func (rcv *MsgStakingBeginRedelegateImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgStakingBeginRedelegateImpl) GetDelegatorAddress() string {
return rcv.DelegatorAddress
}
func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorSrcAddress() string {
return rcv.ValidatorSrcAddress
}
func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorDstAddress() string {
return rcv.ValidatorDstAddress
}
func (rcv *MsgStakingBeginRedelegateImpl) GetAmount() *pkl.Object {
return rcv.Amount
}
@@ -0,0 +1,77 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgStakingCreateValidator interface {
Msg
GetDescription() *pkl.Object
GetCommission() *pkl.Object
GetMinSelfDelegation() string
GetDelegatorAddress() string
GetValidatorAddress() string
GetPubkey() *pkl.Object
GetValue() *pkl.Object
}
var _ MsgStakingCreateValidator = (*MsgStakingCreateValidatorImpl)(nil)
// Staking module messages
type MsgStakingCreateValidatorImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
Description *pkl.Object `pkl:"description"`
Commission *pkl.Object `pkl:"commission"`
MinSelfDelegation string `pkl:"minSelfDelegation"`
DelegatorAddress string `pkl:"delegatorAddress"`
ValidatorAddress string `pkl:"validatorAddress"`
Pubkey *pkl.Object `pkl:"pubkey"`
Value *pkl.Object `pkl:"value"`
}
// The type URL for the message
func (rcv *MsgStakingCreateValidatorImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgStakingCreateValidatorImpl) GetDescription() *pkl.Object {
return rcv.Description
}
func (rcv *MsgStakingCreateValidatorImpl) GetCommission() *pkl.Object {
return rcv.Commission
}
func (rcv *MsgStakingCreateValidatorImpl) GetMinSelfDelegation() string {
return rcv.MinSelfDelegation
}
func (rcv *MsgStakingCreateValidatorImpl) GetDelegatorAddress() string {
return rcv.DelegatorAddress
}
func (rcv *MsgStakingCreateValidatorImpl) GetValidatorAddress() string {
return rcv.ValidatorAddress
}
func (rcv *MsgStakingCreateValidatorImpl) GetPubkey() *pkl.Object {
return rcv.Pubkey
}
func (rcv *MsgStakingCreateValidatorImpl) GetValue() *pkl.Object {
return rcv.Value
}
@@ -0,0 +1,44 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgStakingDelegate interface {
Msg
GetDelegatorAddress() string
GetValidatorAddress() string
GetAmount() *pkl.Object
}
var _ MsgStakingDelegate = (*MsgStakingDelegateImpl)(nil)
type MsgStakingDelegateImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
DelegatorAddress string `pkl:"delegatorAddress"`
ValidatorAddress string `pkl:"validatorAddress"`
Amount *pkl.Object `pkl:"amount"`
}
// The type URL for the message
func (rcv *MsgStakingDelegateImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgStakingDelegateImpl) GetDelegatorAddress() string {
return rcv.DelegatorAddress
}
func (rcv *MsgStakingDelegateImpl) GetValidatorAddress() string {
return rcv.ValidatorAddress
}
func (rcv *MsgStakingDelegateImpl) GetAmount() *pkl.Object {
return rcv.Amount
}
@@ -0,0 +1,44 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
type MsgStakingUndelegate interface {
Msg
GetDelegatorAddress() string
GetValidatorAddress() string
GetAmount() *pkl.Object
}
var _ MsgStakingUndelegate = (*MsgStakingUndelegateImpl)(nil)
type MsgStakingUndelegateImpl struct {
// The type URL for the message
TypeUrl string `pkl:"typeUrl"`
DelegatorAddress string `pkl:"delegatorAddress"`
ValidatorAddress string `pkl:"validatorAddress"`
Amount *pkl.Object `pkl:"amount"`
}
// The type URL for the message
func (rcv *MsgStakingUndelegateImpl) GetTypeUrl() string {
return rcv.TypeUrl
}
func (rcv *MsgStakingUndelegateImpl) GetDelegatorAddress() string {
return rcv.DelegatorAddress
}
func (rcv *MsgStakingUndelegateImpl) GetValidatorAddress() string {
return rcv.ValidatorAddress
}
func (rcv *MsgStakingUndelegateImpl) GetAmount() *pkl.Object {
return rcv.Amount
}
+11
View File
@@ -0,0 +1,11 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
// Base class for all proposals
type Proposal struct {
// The title of the proposal
Title string `pkl:"title"`
// The description of the proposal
Description string `pkl:"description"`
}
+17
View File
@@ -0,0 +1,17 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
// Represents a transaction body
type TxBody struct {
Messages []Msg `pkl:"messages"`
Memo *string `pkl:"memo"`
TimeoutHeight *int `pkl:"timeoutHeight"`
ExtensionOptions *[]*pkl.Object `pkl:"extensionOptions"`
NonCriticalExtensionOptions *[]*pkl.Object `pkl:"nonCriticalExtensionOptions"`
}
@@ -1,5 +1,5 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import (
"context"
@@ -7,11 +7,11 @@ import (
"github.com/apple/pkl-go/pkl"
)
type Orm struct {
type Txns struct {
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Orm
func LoadFromPath(ctx context.Context, path string) (ret *Orm, err error) {
// LoadFromPath loads the pkl module at the given path and evaluates it into a Txns
func LoadFromPath(ctx context.Context, path string) (ret *Txns, err error) {
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
if err != nil {
return nil, err
@@ -26,9 +26,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *Orm, err error) {
return ret, err
}
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Orm
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Orm, error) {
var ret Orm
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Txns
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Txns, error) {
var ret Txns
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
+27
View File
@@ -0,0 +1,27 @@
// Code generated from Pkl module `txns`. DO NOT EDIT.
package txns
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("txns", Txns{})
pkl.RegisterMapping("txns#Proposal", Proposal{})
pkl.RegisterMapping("txns#MsgGovSubmitProposal", MsgGovSubmitProposalImpl{})
pkl.RegisterMapping("txns#MsgGovVote", MsgGovVoteImpl{})
pkl.RegisterMapping("txns#MsgGovDeposit", MsgGovDepositImpl{})
pkl.RegisterMapping("txns#MsgGroupCreateGroup", MsgGroupCreateGroupImpl{})
pkl.RegisterMapping("txns#MsgGroupSubmitProposal", MsgGroupSubmitProposalImpl{})
pkl.RegisterMapping("txns#MsgGroupVote", MsgGroupVoteImpl{})
pkl.RegisterMapping("txns#MsgStakingCreateValidator", MsgStakingCreateValidatorImpl{})
pkl.RegisterMapping("txns#MsgStakingDelegate", MsgStakingDelegateImpl{})
pkl.RegisterMapping("txns#MsgStakingUndelegate", MsgStakingUndelegateImpl{})
pkl.RegisterMapping("txns#MsgStakingBeginRedelegate", MsgStakingBeginRedelegateImpl{})
pkl.RegisterMapping("txns#MsgDidUpdateParams", MsgDidUpdateParamsImpl{})
pkl.RegisterMapping("txns#MsgDidAllocateVault", MsgDidAllocateVaultImpl{})
pkl.RegisterMapping("txns#MsgDidProveWitness", MsgDidProveWitnessImpl{})
pkl.RegisterMapping("txns#MsgDidSyncVault", MsgDidSyncVaultImpl{})
pkl.RegisterMapping("txns#MsgDidRegisterController", MsgDidRegisterControllerImpl{})
pkl.RegisterMapping("txns#MsgDidAuthorize", MsgDidAuthorizeImpl{})
pkl.RegisterMapping("txns#MsgDidRegisterService", MsgDidRegisterServiceImpl{})
pkl.RegisterMapping("txns#TxBody", TxBody{})
}
@@ -2,7 +2,7 @@ package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func HomeView(c echo.Context) error {
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func HomeView(c echo.Context) error {
@@ -2,7 +2,7 @@ package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func LoginView(c echo.Context) error {
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func LoginView(c echo.Context) error {
@@ -2,7 +2,7 @@ package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func AuthorizeView(c echo.Context) error {
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func AuthorizeView(c echo.Context) error {
@@ -2,7 +2,7 @@ package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func ProfileView(c echo.Context) error {
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/dwn/elements"
)
func ProfileView(c echo.Context) error {
@@ -2,8 +2,8 @@ package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/gui/forms"
"github.com/onsonr/sonr/internal/dwn/elements"
"github.com/onsonr/sonr/internal/dwn/islands"
)
func RegisterView(c echo.Context) error {
@@ -16,7 +16,7 @@ templ renderRegisterView(c echo.Context) {
@elements.H2("Account Registration")
@elements.Spacer()
@elements.Breadcrumbs()
@forms.BasicInfo(c, forms.InitialForm)
@islands.BasicInfo(c, islands.InitialForm)
@elements.Spacer()
@elements.Button(elements.GET("/", "#register-view")) {
@elements.Text("Cancel")
@@ -10,8 +10,8 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/gui/forms"
"github.com/onsonr/sonr/internal/dwn/elements"
"github.com/onsonr/sonr/internal/dwn/islands"
)
func RegisterView(c echo.Context) error {
@@ -84,7 +84,7 @@ func renderRegisterView(c echo.Context) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = forms.BasicInfo(c, forms.InitialForm).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = islands.BasicInfo(c, islands.InitialForm).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
Binary file not shown.