feat: add vault module

This commit is contained in:
Prad Nukala 2024-09-25 19:49:16 -04:00
parent 94f1a7e581
commit 607af1e76d
354 changed files with 22222 additions and 20921 deletions

15
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM jetpackio/devbox:latest
# Installing your devbox project
WORKDIR /code
USER root:root
RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
RUN devbox run -- echo "Installed Packages."
RUN devbox shellenv --init-hook >> ~/.profile

View File

@ -0,0 +1,16 @@
{
"name": "Devbox Remote Container",
"build": {
"dockerfile": "./Dockerfile",
"context": ".."
},
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"jetpack-io.devbox"
]
}
},
"remoteUser": "devbox"
}

View File

@ -1,65 +0,0 @@
name: self-hosted testnet
#
# Setup a runner on your own hardware or in a public cloud like GCP, Hetzner, etc.
# This is required if your chain is closed source but you want a dev/semi-public testnet
# - https://github.com/<org>/<repo>/settings/actions/runners/new?arch=x64&os=linux
#
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc
env:
GO_VERSION: 1.21.0
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
LOCALIC_PORT: 8080
LOCALIC_AUTH_KEY: ""
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
launch-testnet:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Setup System
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt -y install make gcc jq bison ca-certificates curl
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
export PATH=$PATH:/usr/local/go/bin
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y containerd.io || true
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install docker.io docker-compose
sudo apt-get update
wget https://github.com/strangelove-ventures/interchaintest/releases/download/v8.2.0/local-ic && chmod +x local-ic
sudo mv local-ic /usr/local/bin
git clone https://github.com/strangelove-ventures/heighliner.git && cd heighliner
go build && chmod +x heighliner
sudo mv heighliner /usr/local/bin
cd .. && rm -rf heighliner
- name: Build + Run Testnet
run: |
killall local-ic || true
docker kill $(docker ps -q) || true
export PATH=$PATH:/usr/local/go/bin
make local-image
sudo screen -S testnet-${{ github.ref_name }} -d -m local-ic start ibc-testnet --api-address=0.0.0.0 --api-port=${{ env.LOCALIC_PORT }} --auth-key=${{ env.LOCALIC_AUTH_KEY }}
# Add other commands here you perform for setup once local-ic has started (poll on LOCALIC_PORT) such as contract upload.

View File

@ -9,7 +9,7 @@ RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
RUN devbox run -- echo "Installed Packages."
@ -26,7 +26,7 @@ RUN mkdir -p /code && chown ${DEVBOX_USER}:${DEVBOX_USER} /code
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} deploy/process-compose.yaml process-compose.yaml
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} process-compose.yaml process-compose.yaml
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} . .
RUN devbox run -- echo "Installed Packages."

View File

@ -301,11 +301,7 @@ sh-testnet: mod-tidy
dwn:
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
GOOS=js GOARCH=wasm go build -o ./pkg/vault/app.wasm ./internal/dwn/main.go
motr:
@echo "(web) Building app.wasm -> Deploy to Cloudflare Workers"
GOOS=js GOARCH=wasm go build -o ./web/build/app.wasm ./web/src/main.go
GOOS=js GOARCH=wasm go build -o ./x/vault/internal/app.wasm ./x/vault/client/dwn/main.go
templ:
@echo "(templ) Generating templ files"
@ -316,15 +312,13 @@ pkl:
@echo "(pkl) Building PKL"
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/dwn.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/orm.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/web.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./config/pkl/txns.pkl
air:
@echo "(air) Building air"
go install github.com/air-verse/air@latest
air -c ./deploy/air.toml
ipfs-cluster-start:
ipfs:
@echo "(ipfs) Starting ipfs-cluster"
ipfs-cluster-service init --consensus crdt
ipfs-cluster-service daemon

View File

@ -1268,60 +1268,58 @@ func (x *_Params_2_map) IsValid() bool {
return x.m != nil
}
var _ protoreflect.List = (*_Params_6_list)(nil)
var _ protoreflect.List = (*_Params_4_list)(nil)
type _Params_6_list struct {
type _Params_4_list struct {
list *[]string
}
func (x *_Params_6_list) Len() int {
func (x *_Params_4_list) Len() int {
if x.list == nil {
return 0
}
return len(*x.list)
}
func (x *_Params_6_list) Get(i int) protoreflect.Value {
func (x *_Params_4_list) Get(i int) protoreflect.Value {
return protoreflect.ValueOfString((*x.list)[i])
}
func (x *_Params_6_list) Set(i int, value protoreflect.Value) {
func (x *_Params_4_list) Set(i int, value protoreflect.Value) {
valueUnwrapped := value.String()
concreteValue := valueUnwrapped
(*x.list)[i] = concreteValue
}
func (x *_Params_6_list) Append(value protoreflect.Value) {
func (x *_Params_4_list) Append(value protoreflect.Value) {
valueUnwrapped := value.String()
concreteValue := valueUnwrapped
*x.list = append(*x.list, concreteValue)
}
func (x *_Params_6_list) AppendMutable() protoreflect.Value {
func (x *_Params_4_list) AppendMutable() protoreflect.Value {
panic(fmt.Errorf("AppendMutable can not be called on message Params at list field AttestationFormats as it is not of Message kind"))
}
func (x *_Params_6_list) Truncate(n int) {
func (x *_Params_4_list) Truncate(n int) {
*x.list = (*x.list)[:n]
}
func (x *_Params_6_list) NewElement() protoreflect.Value {
func (x *_Params_4_list) NewElement() protoreflect.Value {
v := ""
return protoreflect.ValueOfString(v)
}
func (x *_Params_6_list) IsValid() bool {
func (x *_Params_4_list) IsValid() bool {
return x.list != nil
}
var (
md_Params protoreflect.MessageDescriptor
fd_Params_whitelisted_assets protoreflect.FieldDescriptor
fd_Params_allowed_public_keys protoreflect.FieldDescriptor
fd_Params_ipfs_active protoreflect.FieldDescriptor
fd_Params_localhost_registration_enabled protoreflect.FieldDescriptor
fd_Params_conveyance_preference protoreflect.FieldDescriptor
fd_Params_attestation_formats protoreflect.FieldDescriptor
md_Params protoreflect.MessageDescriptor
fd_Params_whitelisted_assets protoreflect.FieldDescriptor
fd_Params_allowed_public_keys protoreflect.FieldDescriptor
fd_Params_conveyance_preference protoreflect.FieldDescriptor
fd_Params_attestation_formats protoreflect.FieldDescriptor
)
func init() {
@ -1329,8 +1327,6 @@ func init() {
md_Params = File_did_v1_genesis_proto.Messages().ByName("Params")
fd_Params_whitelisted_assets = md_Params.Fields().ByName("whitelisted_assets")
fd_Params_allowed_public_keys = md_Params.Fields().ByName("allowed_public_keys")
fd_Params_ipfs_active = md_Params.Fields().ByName("ipfs_active")
fd_Params_localhost_registration_enabled = md_Params.Fields().ByName("localhost_registration_enabled")
fd_Params_conveyance_preference = md_Params.Fields().ByName("conveyance_preference")
fd_Params_attestation_formats = md_Params.Fields().ByName("attestation_formats")
}
@ -1412,18 +1408,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto
return
}
}
if x.IpfsActive != false {
value := protoreflect.ValueOfBool(x.IpfsActive)
if !f(fd_Params_ipfs_active, value) {
return
}
}
if x.LocalhostRegistrationEnabled != false {
value := protoreflect.ValueOfBool(x.LocalhostRegistrationEnabled)
if !f(fd_Params_localhost_registration_enabled, value) {
return
}
}
if x.ConveyancePreference != "" {
value := protoreflect.ValueOfString(x.ConveyancePreference)
if !f(fd_Params_conveyance_preference, value) {
@ -1431,7 +1415,7 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto
}
}
if len(x.AttestationFormats) != 0 {
value := protoreflect.ValueOfList(&_Params_6_list{list: &x.AttestationFormats})
value := protoreflect.ValueOfList(&_Params_4_list{list: &x.AttestationFormats})
if !f(fd_Params_attestation_formats, value) {
return
}
@ -1455,10 +1439,6 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool {
return len(x.WhitelistedAssets) != 0
case "did.v1.Params.allowed_public_keys":
return len(x.AllowedPublicKeys) != 0
case "did.v1.Params.ipfs_active":
return x.IpfsActive != false
case "did.v1.Params.localhost_registration_enabled":
return x.LocalhostRegistrationEnabled != false
case "did.v1.Params.conveyance_preference":
return x.ConveyancePreference != ""
case "did.v1.Params.attestation_formats":
@ -1483,10 +1463,6 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) {
x.WhitelistedAssets = nil
case "did.v1.Params.allowed_public_keys":
x.AllowedPublicKeys = nil
case "did.v1.Params.ipfs_active":
x.IpfsActive = false
case "did.v1.Params.localhost_registration_enabled":
x.LocalhostRegistrationEnabled = false
case "did.v1.Params.conveyance_preference":
x.ConveyancePreference = ""
case "did.v1.Params.attestation_formats":
@ -1519,20 +1495,14 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro
}
mapValue := &_Params_2_map{m: &x.AllowedPublicKeys}
return protoreflect.ValueOfMap(mapValue)
case "did.v1.Params.ipfs_active":
value := x.IpfsActive
return protoreflect.ValueOfBool(value)
case "did.v1.Params.localhost_registration_enabled":
value := x.LocalhostRegistrationEnabled
return protoreflect.ValueOfBool(value)
case "did.v1.Params.conveyance_preference":
value := x.ConveyancePreference
return protoreflect.ValueOfString(value)
case "did.v1.Params.attestation_formats":
if len(x.AttestationFormats) == 0 {
return protoreflect.ValueOfList(&_Params_6_list{})
return protoreflect.ValueOfList(&_Params_4_list{})
}
listValue := &_Params_6_list{list: &x.AttestationFormats}
listValue := &_Params_4_list{list: &x.AttestationFormats}
return protoreflect.ValueOfList(listValue)
default:
if descriptor.IsExtension() {
@ -1562,15 +1532,11 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto
mv := value.Map()
cmv := mv.(*_Params_2_map)
x.AllowedPublicKeys = *cmv.m
case "did.v1.Params.ipfs_active":
x.IpfsActive = value.Bool()
case "did.v1.Params.localhost_registration_enabled":
x.LocalhostRegistrationEnabled = value.Bool()
case "did.v1.Params.conveyance_preference":
x.ConveyancePreference = value.Interface().(string)
case "did.v1.Params.attestation_formats":
lv := value.List()
clv := lv.(*_Params_6_list)
clv := lv.(*_Params_4_list)
x.AttestationFormats = *clv.list
default:
if fd.IsExtension() {
@ -1608,12 +1574,8 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore
if x.AttestationFormats == nil {
x.AttestationFormats = []string{}
}
value := &_Params_6_list{list: &x.AttestationFormats}
value := &_Params_4_list{list: &x.AttestationFormats}
return protoreflect.ValueOfList(value)
case "did.v1.Params.ipfs_active":
panic(fmt.Errorf("field ipfs_active of message did.v1.Params is not mutable"))
case "did.v1.Params.localhost_registration_enabled":
panic(fmt.Errorf("field localhost_registration_enabled of message did.v1.Params is not mutable"))
case "did.v1.Params.conveyance_preference":
panic(fmt.Errorf("field conveyance_preference of message did.v1.Params is not mutable"))
default:
@ -1635,15 +1597,11 @@ func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protor
case "did.v1.Params.allowed_public_keys":
m := make(map[string]*KeyInfo)
return protoreflect.ValueOfMap(&_Params_2_map{m: &m})
case "did.v1.Params.ipfs_active":
return protoreflect.ValueOfBool(false)
case "did.v1.Params.localhost_registration_enabled":
return protoreflect.ValueOfBool(false)
case "did.v1.Params.conveyance_preference":
return protoreflect.ValueOfString("")
case "did.v1.Params.attestation_formats":
list := []string{}
return protoreflect.ValueOfList(&_Params_6_list{list: &list})
return protoreflect.ValueOfList(&_Params_4_list{list: &list})
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: did.v1.Params"))
@ -1745,12 +1703,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
}
}
if x.IpfsActive {
n += 2
}
if x.LocalhostRegistrationEnabled {
n += 2
}
l = len(x.ConveyancePreference)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
@ -1796,7 +1748,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], x.AttestationFormats[iNdEx])
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AttestationFormats[iNdEx])))
i--
dAtA[i] = 0x32
dAtA[i] = 0x22
}
}
if len(x.ConveyancePreference) > 0 {
@ -1804,27 +1756,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
copy(dAtA[i:], x.ConveyancePreference)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ConveyancePreference)))
i--
dAtA[i] = 0x2a
}
if x.LocalhostRegistrationEnabled {
i--
if x.LocalhostRegistrationEnabled {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x20
}
if x.IpfsActive {
i--
if x.IpfsActive {
dAtA[i] = 1
} else {
dAtA[i] = 0
}
i--
dAtA[i] = 0x18
dAtA[i] = 0x1a
}
if len(x.AllowedPublicKeys) > 0 {
MaRsHaLmAp := func(k string, v *KeyInfo) (protoiface.MarshalOutput, error) {
@ -2105,46 +2037,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
x.AllowedPublicKeys[mapkey] = mapvalue
iNdEx = postIndex
case 3:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field IpfsActive", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
x.IpfsActive = bool(v != 0)
case 4:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LocalhostRegistrationEnabled", wireType)
}
var v int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
v |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
x.LocalhostRegistrationEnabled = bool(v != 0)
case 5:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ConveyancePreference", wireType)
}
@ -2176,7 +2068,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
}
x.ConveyancePreference = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 6:
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AttestationFormats", wireType)
}
@ -7721,14 +7613,10 @@ type Params struct {
WhitelistedAssets []*AssetInfo `protobuf:"bytes,1,rep,name=whitelisted_assets,json=whitelistedAssets,proto3" json:"whitelisted_assets,omitempty"`
// Whitelisted Key Types
AllowedPublicKeys map[string]*KeyInfo `protobuf:"bytes,2,rep,name=allowed_public_keys,json=allowedPublicKeys,proto3" json:"allowed_public_keys,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// IpfsActive is a flag to enable/disable ipfs
IpfsActive bool `protobuf:"varint,3,opt,name=ipfs_active,json=ipfsActive,proto3" json:"ipfs_active,omitempty"`
// Localhost Registration Enabled
LocalhostRegistrationEnabled bool `protobuf:"varint,4,opt,name=localhost_registration_enabled,json=localhostRegistrationEnabled,proto3" json:"localhost_registration_enabled,omitempty"`
// ConveyancePreference defines the conveyance preference
ConveyancePreference string `protobuf:"bytes,5,opt,name=conveyance_preference,json=conveyancePreference,proto3" json:"conveyance_preference,omitempty"`
ConveyancePreference string `protobuf:"bytes,3,opt,name=conveyance_preference,json=conveyancePreference,proto3" json:"conveyance_preference,omitempty"`
// AttestationFormats defines the attestation formats
AttestationFormats []string `protobuf:"bytes,6,rep,name=attestation_formats,json=attestationFormats,proto3" json:"attestation_formats,omitempty"`
AttestationFormats []string `protobuf:"bytes,4,rep,name=attestation_formats,json=attestationFormats,proto3" json:"attestation_formats,omitempty"`
}
func (x *Params) Reset() {
@ -7765,20 +7653,6 @@ func (x *Params) GetAllowedPublicKeys() map[string]*KeyInfo {
return nil
}
func (x *Params) GetIpfsActive() bool {
if x != nil {
return x.IpfsActive
}
return false
}
func (x *Params) GetLocalhostRegistrationEnabled() bool {
if x != nil {
return x.LocalhostRegistrationEnabled
}
return false
}
func (x *Params) GetConveyancePreference() string {
if x != nil {
return x.ConveyancePreference
@ -7968,8 +7842,9 @@ type KeyInfo struct {
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
Algorithm string `protobuf:"bytes,2,opt,name=algorithm,proto3" json:"algorithm,omitempty"` // e.g., "ES256", "EdDSA", "ES256K"
Encoding string `protobuf:"bytes,3,opt,name=encoding,proto3" json:"encoding,omitempty"` // e.g., "hex", "base64", "multibase"
Curve string `protobuf:"bytes,4,opt,name=curve,proto3" json:"curve,omitempty"` // e.g., "P256", "P384", "P521", "X25519", "X448", "Ed25519", "Ed448", "secp256k1"
Type_ string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` // e.g., "Octet", "Elliptic", "RSA", "Symmetric", "HMAC"
Curve string `protobuf:"bytes,4,opt,name=curve,proto3" json:"curve,omitempty"` // e.g., "P256", "P384", "P521", "X25519", "X448",
// "Ed25519", "Ed448", "secp256k1"
Type_ string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"` // e.g., "Octet", "Elliptic", "RSA", "Symmetric", "HMAC"
}
func (x *KeyInfo) Reset() {
@ -8282,7 +8157,7 @@ var file_did_v1_genesis_proto_rawDesc = []byte{
0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31,
0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xde, 0x03, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0xf7, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x12, 0x40, 0x0a, 0x12, 0x77, 0x68, 0x69, 0x74, 0x65, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x5f,
0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x64,
0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52,
@ -8292,116 +8167,110 @@ var file_did_v1_genesis_proto_rawDesc = []byte{
0x25, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e,
0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x50,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x70, 0x66,
0x73, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a,
0x69, 0x70, 0x66, 0x73, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x44, 0x0a, 0x1e, 0x6c, 0x6f,
0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01,
0x28, 0x08, 0x52, 0x1c, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x67,
0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64,
0x12, 0x33, 0x0a, 0x15, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x79, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x70,
0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x14, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x79, 0x61, 0x6e, 0x63, 0x65, 0x50, 0x72, 0x65, 0x66, 0x65,
0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2f, 0x0a, 0x13, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03,
0x28, 0x09, 0x52, 0x12, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46,
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x73, 0x1a, 0x55, 0x0a, 0x16, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65,
0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x6f, 0x6e,
0x76, 0x65, 0x79, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x79,
0x61, 0x6e, 0x63, 0x65, 0x50, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x2f,
0x0a, 0x13, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x61, 0x74, 0x74,
0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x73, 0x1a,
0x55, 0x0a, 0x16, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x4b, 0x65, 0x79, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x64, 0x69, 0x64,
0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x17, 0x98, 0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01,
0x8a, 0xe7, 0xb0, 0x2a, 0x0a, 0x64, 0x69, 0x64, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22,
0x99, 0x01, 0x0a, 0x09, 0x41, 0x73, 0x73, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a,
0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e,
0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x72, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x68, 0x72, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18,
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1d, 0x0a,
0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04,
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x12, 0x19, 0x0a, 0x08, 0x69, 0x63, 0x6f, 0x6e, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x69, 0x63, 0x6f, 0x6e, 0x55, 0x72, 0x6c, 0x22, 0x91, 0x02, 0x0a, 0x08,
0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74,
0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f,
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68,
0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09,
0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x29, 0x0a, 0x10, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65,
0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65,
0x72, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63,
0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69,
0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52,
0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22,
0x81, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x72,
0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12,
0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x1a, 0x0a,
0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72,
0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74,
0x79, 0x70, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x12,
0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f,
0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18,
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d,
0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05,
0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x75, 0x72,
0x76, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x72, 0x61, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x72, 0x61, 0x77, 0x12,
0x24, 0x0a, 0x03, 0x6a, 0x77, 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64,
0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x2e, 0x4a, 0x57, 0x4b,
0x52, 0x03, 0x6a, 0x77, 0x6b, 0x1a, 0x61, 0x0a, 0x03, 0x4a, 0x57, 0x4b, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x74, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x63, 0x72, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x72, 0x76,
0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x78, 0x12, 0x0c,
0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x79, 0x12, 0x0c, 0x0a, 0x01,
0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x65, 0x18,
0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x65, 0x22, 0xb1, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f,
0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68,
0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x20, 0x0a,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x52, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x64, 0x69, 0x64,
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x52, 0x10, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69,
0x6e, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76,
0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d,
0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x43, 0x0a, 0x15, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0f, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x4b, 0x65, 0x79, 0x49, 0x6e,
0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x17, 0x98,
0xa0, 0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0a, 0x64, 0x69, 0x64, 0x2f,
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x99, 0x01, 0x0a, 0x09, 0x41, 0x73, 0x73, 0x65, 0x74,
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x10, 0x0a, 0x03, 0x68, 0x72,
0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x68, 0x72, 0x70, 0x12, 0x16, 0x0a, 0x06,
0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x79,
0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x74, 0x79,
0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x54,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x69, 0x63, 0x6f, 0x6e, 0x5f,
0x75, 0x72, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x63, 0x6f, 0x6e, 0x55,
0x72, 0x6c, 0x22, 0x91, 0x02, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12,
0x26, 0x0a, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74,
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x73, 0x73, 0x65, 0x72,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28,
0x09, 0x52, 0x0f, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x68,
0x6f, 0x64, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79,
0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x03, 0x28,
0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x44, 0x65, 0x6c,
0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x0a, 0x15, 0x63, 0x61, 0x70, 0x61, 0x62,
0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x69, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x14, 0x63, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69,
0x74, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x81, 0x01, 0x0a, 0x07, 0x4b, 0x65, 0x79, 0x49, 0x6e,
0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69,
0x74, 0x68, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72,
0x69, 0x74, 0x68, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xa2, 0x02, 0x0a, 0x06, 0x50,
0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67,
0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x6c,
0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64,
0x69, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64,
0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79,
0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77, 0x18, 0x06, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x03, 0x72, 0x61, 0x77, 0x12, 0x24, 0x0a, 0x03, 0x6a, 0x77, 0x6b, 0x18, 0x07, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x75, 0x62,
0x4b, 0x65, 0x79, 0x2e, 0x4a, 0x57, 0x4b, 0x52, 0x03, 0x6a, 0x77, 0x6b, 0x1a, 0x61, 0x0a, 0x03,
0x4a, 0x57, 0x4b, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x74, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x72, 0x76, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x63, 0x72, 0x76, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x01, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01,
0x6e, 0x12, 0x0c, 0x0a, 0x01, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x65, 0x22,
0xb1, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x73,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c,
0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06,
0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72,
0x69, 0x67, 0x69, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74,
0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x52, 0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x5f, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x25, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69,
0x63, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69,
0x6e, 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x42, 0x0a, 0x0b, 0x70, 0x65,
0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x20, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
0x2e, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x43,
0x0a, 0x15, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
0x02, 0x38, 0x01, 0x42, 0x7c, 0x0a, 0x0a, 0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76,
0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e,
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69,
0x64, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x69, 0x64, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x44, 0x58, 0x58,
0xaa, 0x02, 0x06, 0x44, 0x69, 0x64, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x06, 0x44, 0x69, 0x64, 0x5c,
0x56, 0x31, 0xe2, 0x02, 0x12, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x07, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10,
0x50, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x7c, 0x0a, 0x0a,
0x63, 0x6f, 0x6d, 0x2e, 0x64, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65,
0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x27, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f,
0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x3b, 0x64, 0x69,
0x64, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x44, 0x58, 0x58, 0xaa, 0x02, 0x06, 0x44, 0x69, 0x64, 0x2e,
0x56, 0x31, 0xca, 0x02, 0x06, 0x44, 0x69, 0x64, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x12, 0x44, 0x69,
0x64, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0xea, 0x02, 0x07, 0x44, 0x69, 0x64, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,6 @@ const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/did.v1.Query/Params"
Query_Resolve_FullMethodName = "/did.v1.Query/Resolve"
Query_Sync_FullMethodName = "/did.v1.Query/Sync"
)
// QueryClient is the client API for Query service.
@ -32,8 +31,6 @@ type QueryClient interface {
Params(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// Resolve queries the DID document by its id.
Resolve(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error)
// Sync queries the DID document by its id. And returns the required PKL information
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
}
type queryClient struct {
@ -62,15 +59,6 @@ func (c *queryClient) Resolve(ctx context.Context, in *QueryRequest, opts ...grp
return out, nil
}
func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
out := new(SyncResponse)
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
@ -79,8 +67,6 @@ type QueryServer interface {
Params(context.Context, *QueryRequest) (*QueryParamsResponse, error)
// Resolve queries the DID document by its id.
Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error)
// Sync queries the DID document by its id. And returns the required PKL information
Sync(context.Context, *SyncRequest) (*SyncResponse, error)
mustEmbedUnimplementedQueryServer()
}
@ -94,9 +80,6 @@ func (UnimplementedQueryServer) Params(context.Context, *QueryRequest) (*QueryPa
func (UnimplementedQueryServer) Resolve(context.Context, *QueryRequest) (*QueryResolveResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Resolve not implemented")
}
func (UnimplementedQueryServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
@ -146,24 +129,6 @@ func _Query_Resolve_Handler(srv interface{}, ctx context.Context, dec func(inter
return interceptor(ctx, in, info, handler)
}
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Sync(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Sync_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Sync(ctx, req.(*SyncRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -179,10 +144,6 @@ var Query_ServiceDesc = grpc.ServiceDesc{
MethodName: "Resolve",
Handler: _Query_Resolve_Handler,
},
{
MethodName: "Sync",
Handler: _Query_Sync_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "did/v1/query.proto",

View File

@ -168,12 +168,14 @@ func NewAliasTable(db ormtable.Schema) (AliasTable, error) {
type ControllerTable interface {
Insert(ctx context.Context, controller *Controller) error
InsertReturningNumber(ctx context.Context, controller *Controller) (uint64, error)
LastInsertedSequence(ctx context.Context) (uint64, error)
Update(ctx context.Context, controller *Controller) error
Save(ctx context.Context, controller *Controller) error
Delete(ctx context.Context, controller *Controller) error
Has(ctx context.Context, id string) (found bool, err error)
Has(ctx context.Context, number uint64) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Controller, error)
Get(ctx context.Context, number uint64) (*Controller, error)
HasBySonrAddress(ctx context.Context, sonr_address string) (found bool, err error)
// GetBySonrAddress returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySonrAddress(ctx context.Context, sonr_address string) (*Controller, error)
@ -183,12 +185,9 @@ type ControllerTable interface {
HasByBtcAddress(ctx context.Context, btc_address string) (found bool, err error)
// GetByBtcAddress returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByBtcAddress(ctx context.Context, btc_address string) (*Controller, error)
HasByVaultCid(ctx context.Context, vault_cid string) (found bool, err error)
// GetByVaultCid returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByVaultCid(ctx context.Context, vault_cid string) (*Controller, error)
HasByStatusVaultCid(ctx context.Context, status string, vault_cid string) (found bool, err error)
// GetByStatusVaultCid returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByStatusVaultCid(ctx context.Context, status string, vault_cid string) (*Controller, error)
HasByDid(ctx context.Context, did string) (found bool, err error)
// GetByDid returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByDid(ctx context.Context, did string) (*Controller, error)
List(ctx context.Context, prefixKey ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
ListRange(ctx context.Context, from, to ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
DeleteBy(ctx context.Context, prefixKey ControllerIndexKey) error
@ -214,18 +213,18 @@ type ControllerIndexKey interface {
}
// primary key starting index..
type ControllerPrimaryKey = ControllerIdIndexKey
type ControllerPrimaryKey = ControllerNumberIndexKey
type ControllerIdIndexKey struct {
type ControllerNumberIndexKey struct {
vs []interface{}
}
func (x ControllerIdIndexKey) id() uint32 { return 0 }
func (x ControllerIdIndexKey) values() []interface{} { return x.vs }
func (x ControllerIdIndexKey) controllerIndexKey() {}
func (x ControllerNumberIndexKey) id() uint32 { return 0 }
func (x ControllerNumberIndexKey) values() []interface{} { return x.vs }
func (x ControllerNumberIndexKey) controllerIndexKey() {}
func (this ControllerIdIndexKey) WithId(id string) ControllerIdIndexKey {
this.vs = []interface{}{id}
func (this ControllerNumberIndexKey) WithNumber(number uint64) ControllerNumberIndexKey {
this.vs = []interface{}{number}
return this
}
@ -268,39 +267,21 @@ func (this ControllerBtcAddressIndexKey) WithBtcAddress(btc_address string) Cont
return this
}
type ControllerVaultCidIndexKey struct {
type ControllerDidIndexKey struct {
vs []interface{}
}
func (x ControllerVaultCidIndexKey) id() uint32 { return 4 }
func (x ControllerVaultCidIndexKey) values() []interface{} { return x.vs }
func (x ControllerVaultCidIndexKey) controllerIndexKey() {}
func (x ControllerDidIndexKey) id() uint32 { return 4 }
func (x ControllerDidIndexKey) values() []interface{} { return x.vs }
func (x ControllerDidIndexKey) controllerIndexKey() {}
func (this ControllerVaultCidIndexKey) WithVaultCid(vault_cid string) ControllerVaultCidIndexKey {
this.vs = []interface{}{vault_cid}
return this
}
type ControllerStatusVaultCidIndexKey struct {
vs []interface{}
}
func (x ControllerStatusVaultCidIndexKey) id() uint32 { return 5 }
func (x ControllerStatusVaultCidIndexKey) values() []interface{} { return x.vs }
func (x ControllerStatusVaultCidIndexKey) controllerIndexKey() {}
func (this ControllerStatusVaultCidIndexKey) WithStatus(status string) ControllerStatusVaultCidIndexKey {
this.vs = []interface{}{status}
return this
}
func (this ControllerStatusVaultCidIndexKey) WithStatusVaultCid(status string, vault_cid string) ControllerStatusVaultCidIndexKey {
this.vs = []interface{}{status, vault_cid}
func (this ControllerDidIndexKey) WithDid(did string) ControllerDidIndexKey {
this.vs = []interface{}{did}
return this
}
type controllerTable struct {
table ormtable.Table
table ormtable.AutoIncrementTable
}
func (this controllerTable) Insert(ctx context.Context, controller *Controller) error {
@ -319,13 +300,21 @@ func (this controllerTable) Delete(ctx context.Context, controller *Controller)
return this.table.Delete(ctx, controller)
}
func (this controllerTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
func (this controllerTable) InsertReturningNumber(ctx context.Context, controller *Controller) (uint64, error) {
return this.table.InsertReturningPKey(ctx, controller)
}
func (this controllerTable) Get(ctx context.Context, id string) (*Controller, error) {
func (this controllerTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
return this.table.LastInsertedSequence(ctx)
}
func (this controllerTable) Has(ctx context.Context, number uint64) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, number)
}
func (this controllerTable) Get(ctx context.Context, number uint64) (*Controller, error) {
var controller Controller
found, err := this.table.PrimaryKey().Get(ctx, &controller, id)
found, err := this.table.PrimaryKey().Get(ctx, &controller, number)
if err != nil {
return nil, err
}
@ -395,38 +384,16 @@ func (this controllerTable) GetByBtcAddress(ctx context.Context, btc_address str
return &controller, nil
}
func (this controllerTable) HasByVaultCid(ctx context.Context, vault_cid string) (found bool, err error) {
func (this controllerTable) HasByDid(ctx context.Context, did string) (found bool, err error) {
return this.table.GetIndexByID(4).(ormtable.UniqueIndex).Has(ctx,
vault_cid,
did,
)
}
func (this controllerTable) GetByVaultCid(ctx context.Context, vault_cid string) (*Controller, error) {
func (this controllerTable) GetByDid(ctx context.Context, did string) (*Controller, error) {
var controller Controller
found, err := this.table.GetIndexByID(4).(ormtable.UniqueIndex).Get(ctx, &controller,
vault_cid,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &controller, nil
}
func (this controllerTable) HasByStatusVaultCid(ctx context.Context, status string, vault_cid string) (found bool, err error) {
return this.table.GetIndexByID(5).(ormtable.UniqueIndex).Has(ctx,
status,
vault_cid,
)
}
func (this controllerTable) GetByStatusVaultCid(ctx context.Context, status string, vault_cid string) (*Controller, error) {
var controller Controller
found, err := this.table.GetIndexByID(5).(ormtable.UniqueIndex).Get(ctx, &controller,
status,
vault_cid,
did,
)
if err != nil {
return nil, err
@ -464,7 +431,7 @@ func NewControllerTable(db ormtable.Schema) (ControllerTable, error) {
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Controller{}).ProtoReflect().Descriptor().FullName()))
}
return controllerTable{table}, nil
return controllerTable{table.(ormtable.AutoIncrementTable)}, nil
}
type VerificationTable interface {
@ -472,9 +439,9 @@ type VerificationTable interface {
Update(ctx context.Context, verification *Verification) error
Save(ctx context.Context, verification *Verification) error
Delete(ctx context.Context, verification *Verification) error
Has(ctx context.Context, id string) (found bool, err error)
Has(ctx context.Context, did string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Verification, error)
Get(ctx context.Context, did string) (*Verification, error)
HasByIssuerSubject(ctx context.Context, issuer string, subject string) (found bool, err error)
// GetByIssuerSubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByIssuerSubject(ctx context.Context, issuer string, subject string) (*Verification, error)
@ -509,18 +476,18 @@ type VerificationIndexKey interface {
}
// primary key starting index..
type VerificationPrimaryKey = VerificationIdIndexKey
type VerificationPrimaryKey = VerificationDidIndexKey
type VerificationIdIndexKey struct {
type VerificationDidIndexKey struct {
vs []interface{}
}
func (x VerificationIdIndexKey) id() uint32 { return 0 }
func (x VerificationIdIndexKey) values() []interface{} { return x.vs }
func (x VerificationIdIndexKey) verificationIndexKey() {}
func (x VerificationDidIndexKey) id() uint32 { return 0 }
func (x VerificationDidIndexKey) values() []interface{} { return x.vs }
func (x VerificationDidIndexKey) verificationIndexKey() {}
func (this VerificationIdIndexKey) WithId(id string) VerificationIdIndexKey {
this.vs = []interface{}{id}
func (this VerificationDidIndexKey) WithDid(did string) VerificationDidIndexKey {
this.vs = []interface{}{did}
return this
}
@ -608,13 +575,13 @@ func (this verificationTable) Delete(ctx context.Context, verification *Verifica
return this.table.Delete(ctx, verification)
}
func (this verificationTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
func (this verificationTable) Has(ctx context.Context, did string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, did)
}
func (this verificationTable) Get(ctx context.Context, id string) (*Verification, error) {
func (this verificationTable) Get(ctx context.Context, did string) (*Verification, error) {
var verification Verification
found, err := this.table.PrimaryKey().Get(ctx, &verification, id)
found, err := this.table.PrimaryKey().Get(ctx, &verification, did)
if err != nil {
return nil, err
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,30 +19,31 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
Msg_AuthorizeService_FullMethodName = "/did.v1.Msg/AuthorizeService"
Msg_AllocateVault_FullMethodName = "/did.v1.Msg/AllocateVault"
Msg_ExecuteTx_FullMethodName = "/did.v1.Msg/ExecuteTx"
Msg_RegisterController_FullMethodName = "/did.v1.Msg/RegisterController"
Msg_RegisterService_FullMethodName = "/did.v1.Msg/RegisterService"
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MsgClient interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given address.
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error)
// AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database.
// this operation is called by services initiating a controller registration.
AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error)
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error)
// RegisterController initializes a controller with the given authentication
// set, address, cid, publicKey, and user-defined alias.
RegisterController(ctx context.Context, in *MsgRegisterController, opts ...grpc.CallOption) (*MsgRegisterControllerResponse, error)
// RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key.
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(ctx context.Context, in *MsgRegisterService, opts ...grpc.CallOption) (*MsgRegisterServiceResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
@ -53,15 +54,6 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeService, opts ...grpc.CallOption) (*MsgAuthorizeServiceResponse, error) {
out := new(MsgAuthorizeServiceResponse)
err := c.cc.Invoke(ctx, Msg_AuthorizeService_FullMethodName, in, out, opts...)
@ -71,9 +63,9 @@ func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgAuthorizeServic
return out, nil
}
func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) {
out := new(MsgAllocateVaultResponse)
err := c.cc.Invoke(ctx, Msg_AllocateVault_FullMethodName, in, out, opts...)
func (c *msgClient) ExecuteTx(ctx context.Context, in *MsgExecuteTx, opts ...grpc.CallOption) (*MsgExecuteTxResponse, error) {
out := new(MsgExecuteTxResponse)
err := c.cc.Invoke(ctx, Msg_ExecuteTx_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
@ -98,23 +90,33 @@ func (c *msgClient) RegisterService(ctx context.Context, in *MsgRegisterService,
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
type MsgServer interface {
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given address.
// AuthorizeService asserts the given controller is the owner of the given
// address.
AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error)
// AllocateVault assembles a sqlite3 database in a local directory and returns the CID of the database.
// this operation is called by services initiating a controller registration.
AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error)
// RegisterController initializes a controller with the given authentication set, address, cid, publicKey, and user-defined alias.
// ExecuteTx executes a transaction on the Sonr Blockchain. It leverages
// Macaroon for verification.
ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error)
// RegisterController initializes a controller with the given authentication
// set, address, cid, publicKey, and user-defined alias.
RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error)
// RegisterService initializes a Service with a given permission scope and URI. The domain must have a valid TXT record containing the public key.
// RegisterService initializes a Service with a given permission scope and
// URI. The domain must have a valid TXT record containing the public key.
RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
@ -122,14 +124,11 @@ type MsgServer interface {
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) AuthorizeService(context.Context, *MsgAuthorizeService) (*MsgAuthorizeServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
}
func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented")
func (UnimplementedMsgServer) ExecuteTx(context.Context, *MsgExecuteTx) (*MsgExecuteTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ExecuteTx not implemented")
}
func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterController) (*MsgRegisterControllerResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterController not implemented")
@ -137,6 +136,9 @@ func (UnimplementedMsgServer) RegisterController(context.Context, *MsgRegisterCo
func (UnimplementedMsgServer) RegisterService(context.Context, *MsgRegisterService) (*MsgRegisterServiceResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method RegisterService not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
@ -150,24 +152,6 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAuthorizeService)
if err := dec(in); err != nil {
@ -186,20 +170,20 @@ func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAllocateVault)
func _Msg_ExecuteTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgExecuteTx)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AllocateVault(ctx, in)
return srv.(MsgServer).ExecuteTx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AllocateVault_FullMethodName,
FullMethod: Msg_ExecuteTx_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault))
return srv.(MsgServer).ExecuteTx(ctx, req.(*MsgExecuteTx))
}
return interceptor(ctx, in, info, handler)
}
@ -240,6 +224,24 @@ func _Msg_RegisterService_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -247,17 +249,13 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "did.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
},
{
MethodName: "AllocateVault",
Handler: _Msg_AllocateVault_Handler,
MethodName: "ExecuteTx",
Handler: _Msg_ExecuteTx_Handler,
},
{
MethodName: "RegisterController",
@ -267,6 +265,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
MethodName: "RegisterService",
Handler: _Msg_RegisterService_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "did/v1/tx.proto",

View File

@ -0,0 +1,499 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package modulev1
import (
_ "cosmossdk.io/api/cosmos/app/v1alpha1"
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
md_Module protoreflect.MessageDescriptor
)
func init() {
file_vault_module_v1_module_proto_init()
md_Module = File_vault_module_v1_module_proto.Messages().ByName("Module")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
type fastReflection_Module Module
func (x *Module) ProtoReflect() protoreflect.Message {
return (*fastReflection_Module)(x)
}
func (x *Module) slowProtoReflect() protoreflect.Message {
mi := &file_vault_module_v1_module_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_Module_messageType fastReflection_Module_messageType
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
type fastReflection_Module_messageType struct{}
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
return (*fastReflection_Module)(nil)
}
func (x fastReflection_Module_messageType) New() protoreflect.Message {
return new(fastReflection_Module)
}
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_Module) Type() protoreflect.MessageType {
return _fastReflection_Module_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Module) New() protoreflect.Message {
return new(fastReflection_Module)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
return (*Module)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.module.v1.Module"))
}
panic(fmt.Errorf("message vault.module.v1.Module does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in vault.module.v1.Module", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_Module) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: vault/module/v1/module.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Module is the app config object of the module.
// Learn more: https://docs.cosmos.network/main/building-modules/depinject
type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Module) Reset() {
*x = Module{}
if protoimpl.UnsafeEnabled {
mi := &file_vault_module_v1_module_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Module) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Module) ProtoMessage() {}
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) {
return file_vault_module_v1_module_proto_rawDescGZIP(), []int{0}
}
var File_vault_module_v1_module_proto protoreflect.FileDescriptor
var file_vault_module_v1_module_proto_rawDesc = []byte{
0x0a, 0x1c, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76,
0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f,
0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a,
0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c,
0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0x28, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x1e, 0xba, 0xc0, 0x96,
0xda, 0x01, 0x18, 0x0a, 0x16, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x42, 0xb5, 0x01, 0x0a, 0x13,
0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
0x61, 0x75, 0x6c, 0x74, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x3b, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x56, 0x4d, 0x58, 0xaa, 0x02, 0x0f,
0x56, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca,
0x02, 0x0f, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56,
0x31, 0xe2, 0x02, 0x1b, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
0x02, 0x11, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_vault_module_v1_module_proto_rawDescOnce sync.Once
file_vault_module_v1_module_proto_rawDescData = file_vault_module_v1_module_proto_rawDesc
)
func file_vault_module_v1_module_proto_rawDescGZIP() []byte {
file_vault_module_v1_module_proto_rawDescOnce.Do(func() {
file_vault_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_vault_module_v1_module_proto_rawDescData)
})
return file_vault_module_v1_module_proto_rawDescData
}
var file_vault_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_vault_module_v1_module_proto_goTypes = []interface{}{
(*Module)(nil), // 0: vault.module.v1.Module
}
var file_vault_module_v1_module_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_vault_module_v1_module_proto_init() }
func file_vault_module_v1_module_proto_init() {
if File_vault_module_v1_module_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_vault_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vault_module_v1_module_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_vault_module_v1_module_proto_goTypes,
DependencyIndexes: file_vault_module_v1_module_proto_depIdxs,
MessageInfos: file_vault_module_v1_module_proto_msgTypes,
}.Build()
File_vault_module_v1_module_proto = out.File
file_vault_module_v1_module_proto_rawDesc = nil
file_vault_module_v1_module_proto_goTypes = nil
file_vault_module_v1_module_proto_depIdxs = nil
}

File diff suppressed because it is too large Load Diff

3881
api/vault/v1/query.pulsar.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,191 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: vault/v1/query.proto
package vaultv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Query_Params_FullMethodName = "/vault.v1.Query/Params"
Query_BuildTx_FullMethodName = "/vault.v1.Query/BuildTx"
Query_Sync_FullMethodName = "/vault.v1.Query/Sync"
)
// QueryClient is the client API for Query service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type QueryClient interface {
// Params queries all parameters of the module.
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
// BuildTx builds an unsigned transaction message for the given PKL.
BuildTx(ctx context.Context, in *BuildTxRequest, opts ...grpc.CallOption) (*BuildTxResponse, error)
// Sync queries the DID document by its id. And returns the required PKL
// information
Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
}
type queryClient struct {
cc grpc.ClientConnInterface
}
func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
out := new(QueryParamsResponse)
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) BuildTx(ctx context.Context, in *BuildTxRequest, opts ...grpc.CallOption) (*BuildTxResponse, error) {
out := new(BuildTxResponse)
err := c.cc.Invoke(ctx, Query_BuildTx_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Sync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
out := new(SyncResponse)
err := c.cc.Invoke(ctx, Query_Sync_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// QueryServer is the server API for Query service.
// All implementations must embed UnimplementedQueryServer
// for forward compatibility
type QueryServer interface {
// Params queries all parameters of the module.
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
// BuildTx builds an unsigned transaction message for the given PKL.
BuildTx(context.Context, *BuildTxRequest) (*BuildTxResponse, error)
// Sync queries the DID document by its id. And returns the required PKL
// information
Sync(context.Context, *SyncRequest) (*SyncResponse, error)
mustEmbedUnimplementedQueryServer()
}
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
type UnimplementedQueryServer struct {
}
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
}
func (UnimplementedQueryServer) BuildTx(context.Context, *BuildTxRequest) (*BuildTxResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BuildTx not implemented")
}
func (UnimplementedQueryServer) Sync(context.Context, *SyncRequest) (*SyncResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented")
}
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to QueryServer will
// result in compilation errors.
type UnsafeQueryServer interface {
mustEmbedUnimplementedQueryServer()
}
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
s.RegisterService(&Query_ServiceDesc, srv)
}
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(QueryParamsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Params(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Params_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_BuildTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(BuildTxRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).BuildTx(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_BuildTx_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).BuildTx(ctx, req.(*BuildTxRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SyncRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).Sync(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Query_Sync_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).Sync(ctx, req.(*SyncRequest))
}
return interceptor(ctx, in, info, handler)
}
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Query_ServiceDesc = grpc.ServiceDesc{
ServiceName: "vault.v1.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Params",
Handler: _Query_Params_Handler,
},
{
MethodName: "BuildTx",
Handler: _Query_BuildTx_Handler,
},
{
MethodName: "Sync",
Handler: _Query_Sync_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "vault/v1/query.proto",
}

View File

@ -0,0 +1,166 @@
// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
package vaultv1
import (
context "context"
ormlist "cosmossdk.io/orm/model/ormlist"
ormtable "cosmossdk.io/orm/model/ormtable"
ormerrors "cosmossdk.io/orm/types/ormerrors"
)
type DWNTable interface {
Insert(ctx context.Context, dWN *DWN) error
Update(ctx context.Context, dWN *DWN) error
Save(ctx context.Context, dWN *DWN) error
Delete(ctx context.Context, dWN *DWN) error
Has(ctx context.Context, account []byte) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, account []byte) (*DWN, error)
List(ctx context.Context, prefixKey DWNIndexKey, opts ...ormlist.Option) (DWNIterator, error)
ListRange(ctx context.Context, from, to DWNIndexKey, opts ...ormlist.Option) (DWNIterator, error)
DeleteBy(ctx context.Context, prefixKey DWNIndexKey) error
DeleteRange(ctx context.Context, from, to DWNIndexKey) error
doNotImplement()
}
type DWNIterator struct {
ormtable.Iterator
}
func (i DWNIterator) Value() (*DWN, error) {
var dWN DWN
err := i.UnmarshalMessage(&dWN)
return &dWN, err
}
type DWNIndexKey interface {
id() uint32
values() []interface{}
dWNIndexKey()
}
// primary key starting index..
type DWNPrimaryKey = DWNAccountIndexKey
type DWNAccountIndexKey struct {
vs []interface{}
}
func (x DWNAccountIndexKey) id() uint32 { return 0 }
func (x DWNAccountIndexKey) values() []interface{} { return x.vs }
func (x DWNAccountIndexKey) dWNIndexKey() {}
func (this DWNAccountIndexKey) WithAccount(account []byte) DWNAccountIndexKey {
this.vs = []interface{}{account}
return this
}
type DWNAmountIndexKey struct {
vs []interface{}
}
func (x DWNAmountIndexKey) id() uint32 { return 1 }
func (x DWNAmountIndexKey) values() []interface{} { return x.vs }
func (x DWNAmountIndexKey) dWNIndexKey() {}
func (this DWNAmountIndexKey) WithAmount(amount uint64) DWNAmountIndexKey {
this.vs = []interface{}{amount}
return this
}
type dWNTable struct {
table ormtable.Table
}
func (this dWNTable) Insert(ctx context.Context, dWN *DWN) error {
return this.table.Insert(ctx, dWN)
}
func (this dWNTable) Update(ctx context.Context, dWN *DWN) error {
return this.table.Update(ctx, dWN)
}
func (this dWNTable) Save(ctx context.Context, dWN *DWN) error {
return this.table.Save(ctx, dWN)
}
func (this dWNTable) Delete(ctx context.Context, dWN *DWN) error {
return this.table.Delete(ctx, dWN)
}
func (this dWNTable) Has(ctx context.Context, account []byte) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, account)
}
func (this dWNTable) Get(ctx context.Context, account []byte) (*DWN, error) {
var dWN DWN
found, err := this.table.PrimaryKey().Get(ctx, &dWN, account)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &dWN, nil
}
func (this dWNTable) List(ctx context.Context, prefixKey DWNIndexKey, opts ...ormlist.Option) (DWNIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return DWNIterator{it}, err
}
func (this dWNTable) ListRange(ctx context.Context, from, to DWNIndexKey, opts ...ormlist.Option) (DWNIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return DWNIterator{it}, err
}
func (this dWNTable) DeleteBy(ctx context.Context, prefixKey DWNIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this dWNTable) DeleteRange(ctx context.Context, from, to DWNIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this dWNTable) doNotImplement() {}
var _ DWNTable = dWNTable{}
func NewDWNTable(db ormtable.Schema) (DWNTable, error) {
table := db.GetTable(&DWN{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&DWN{}).ProtoReflect().Descriptor().FullName()))
}
return dWNTable{table}, nil
}
type StateStore interface {
DWNTable() DWNTable
doNotImplement()
}
type stateStore struct {
dWN DWNTable
}
func (x stateStore) DWNTable() DWNTable {
return x.dWN
}
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
dWNTable, err := NewDWNTable(db)
if err != nil {
return nil, err
}
return stateStore{
dWNTable,
}, nil
}

View File

@ -0,0 +1,627 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package vaultv1
import (
_ "cosmossdk.io/api/cosmos/orm/v1"
fmt "fmt"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
io "io"
reflect "reflect"
sync "sync"
)
var (
md_DWN protoreflect.MessageDescriptor
fd_DWN_account protoreflect.FieldDescriptor
fd_DWN_amount protoreflect.FieldDescriptor
)
func init() {
file_vault_v1_state_proto_init()
md_DWN = File_vault_v1_state_proto.Messages().ByName("DWN")
fd_DWN_account = md_DWN.Fields().ByName("account")
fd_DWN_amount = md_DWN.Fields().ByName("amount")
}
var _ protoreflect.Message = (*fastReflection_DWN)(nil)
type fastReflection_DWN DWN
func (x *DWN) ProtoReflect() protoreflect.Message {
return (*fastReflection_DWN)(x)
}
func (x *DWN) slowProtoReflect() protoreflect.Message {
mi := &file_vault_v1_state_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_DWN_messageType fastReflection_DWN_messageType
var _ protoreflect.MessageType = fastReflection_DWN_messageType{}
type fastReflection_DWN_messageType struct{}
func (x fastReflection_DWN_messageType) Zero() protoreflect.Message {
return (*fastReflection_DWN)(nil)
}
func (x fastReflection_DWN_messageType) New() protoreflect.Message {
return new(fastReflection_DWN)
}
func (x fastReflection_DWN_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_DWN
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_DWN) Descriptor() protoreflect.MessageDescriptor {
return md_DWN
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_DWN) Type() protoreflect.MessageType {
return _fastReflection_DWN_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_DWN) New() protoreflect.Message {
return new(fastReflection_DWN)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_DWN) Interface() protoreflect.ProtoMessage {
return (*DWN)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_DWN) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
if len(x.Account) != 0 {
value := protoreflect.ValueOfBytes(x.Account)
if !f(fd_DWN_account, value) {
return
}
}
if x.Amount != uint64(0) {
value := protoreflect.ValueOfUint64(x.Amount)
if !f(fd_DWN_amount, value) {
return
}
}
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_DWN) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
case "vault.v1.DWN.account":
return len(x.Account) != 0
case "vault.v1.DWN.amount":
return x.Amount != uint64(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_DWN) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
case "vault.v1.DWN.account":
x.Account = nil
case "vault.v1.DWN.amount":
x.Amount = uint64(0)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_DWN) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
case "vault.v1.DWN.account":
value := x.Account
return protoreflect.ValueOfBytes(value)
case "vault.v1.DWN.amount":
value := x.Amount
return protoreflect.ValueOfUint64(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_DWN) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
case "vault.v1.DWN.account":
x.Account = value.Bytes()
case "vault.v1.DWN.amount":
x.Amount = value.Uint()
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_DWN) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "vault.v1.DWN.account":
panic(fmt.Errorf("field account of message vault.v1.DWN is not mutable"))
case "vault.v1.DWN.amount":
panic(fmt.Errorf("field amount of message vault.v1.DWN is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_DWN) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
case "vault.v1.DWN.account":
return protoreflect.ValueOfBytes(nil)
case "vault.v1.DWN.amount":
return protoreflect.ValueOfUint64(uint64(0))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: vault.v1.DWN"))
}
panic(fmt.Errorf("message vault.v1.DWN does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_DWN) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in vault.v1.DWN", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_DWN) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_DWN) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_DWN) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_DWN) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*DWN)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
l = len(x.Account)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.Amount != 0 {
n += 1 + runtime.Sov(uint64(x.Amount))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*DWN)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if x.Amount != 0 {
i = runtime.EncodeVarint(dAtA, i, uint64(x.Amount))
i--
dAtA[i] = 0x10
}
if len(x.Account) > 0 {
i -= len(x.Account)
copy(dAtA[i:], x.Account)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Account)))
i--
dAtA[i] = 0xa
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*DWN)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DWN: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: DWN: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + byteLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.Account = append(x.Account[:0], dAtA[iNdEx:postIndex]...)
if x.Account == nil {
x.Account = []byte{}
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
}
x.Amount = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
x.Amount |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: vault/v1/state.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type DWN struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
}
func (x *DWN) Reset() {
*x = DWN{}
if protoimpl.UnsafeEnabled {
mi := &file_vault_v1_state_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DWN) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DWN) ProtoMessage() {}
// Deprecated: Use DWN.ProtoReflect.Descriptor instead.
func (*DWN) Descriptor() ([]byte, []int) {
return file_vault_v1_state_proto_rawDescGZIP(), []int{0}
}
func (x *DWN) GetAccount() []byte {
if x != nil {
return x.Account
}
return nil
}
func (x *DWN) GetAmount() uint64 {
if x != nil {
return x.Amount
}
return 0
}
var File_vault_v1_state_proto protoreflect.FileDescriptor
var file_vault_v1_state_proto_rawDesc = []byte{
0x0a, 0x14, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x76, 0x31,
0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x6d, 0x2f, 0x76, 0x31, 0x2f,
0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x03, 0x44, 0x57, 0x4e,
0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d,
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75,
0x6e, 0x74, 0x3a, 0x1f, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x19, 0x0a, 0x09, 0x0a, 0x07, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0a, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x10,
0x01, 0x18, 0x01, 0x42, 0x88, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x61, 0x75, 0x6c,
0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
0x50, 0x01, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
0x61, 0x75, 0x6c, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x76, 0x61, 0x75, 0x6c, 0x74, 0x76, 0x31, 0xa2,
0x02, 0x03, 0x56, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x2e, 0x56, 0x31,
0xca, 0x02, 0x08, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x14, 0x56, 0x61,
0x75, 0x6c, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0xea, 0x02, 0x09, 0x56, 0x61, 0x75, 0x6c, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_vault_v1_state_proto_rawDescOnce sync.Once
file_vault_v1_state_proto_rawDescData = file_vault_v1_state_proto_rawDesc
)
func file_vault_v1_state_proto_rawDescGZIP() []byte {
file_vault_v1_state_proto_rawDescOnce.Do(func() {
file_vault_v1_state_proto_rawDescData = protoimpl.X.CompressGZIP(file_vault_v1_state_proto_rawDescData)
})
return file_vault_v1_state_proto_rawDescData
}
var file_vault_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_vault_v1_state_proto_goTypes = []interface{}{
(*DWN)(nil), // 0: vault.v1.DWN
}
var file_vault_v1_state_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_vault_v1_state_proto_init() }
func file_vault_v1_state_proto_init() {
if File_vault_v1_state_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_vault_v1_state_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DWN); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_vault_v1_state_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_vault_v1_state_proto_goTypes,
DependencyIndexes: file_vault_v1_state_proto_depIdxs,
MessageInfos: file_vault_v1_state_proto_msgTypes,
}.Build()
File_vault_v1_state_proto = out.File
file_vault_v1_state_proto_rawDesc = nil
file_vault_v1_state_proto_goTypes = nil
file_vault_v1_state_proto_depIdxs = nil
}

2388
api/vault/v1/tx.pulsar.go Normal file

File diff suppressed because it is too large Load Diff

158
api/vault/v1/tx_grpc.pb.go Normal file
View File

@ -0,0 +1,158 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc (unknown)
// source: vault/v1/tx.proto
package vaultv1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
Msg_AllocateVault_FullMethodName = "/vault.v1.Msg/AllocateVault"
Msg_UpdateParams_FullMethodName = "/vault.v1.Msg/UpdateParams"
)
// MsgClient is the client API for Msg service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type MsgClient interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
}
type msgClient struct {
cc grpc.ClientConnInterface
}
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
return &msgClient{cc}
}
func (c *msgClient) AllocateVault(ctx context.Context, in *MsgAllocateVault, opts ...grpc.CallOption) (*MsgAllocateVaultResponse, error) {
out := new(MsgAllocateVaultResponse)
err := c.cc.Invoke(ctx, Msg_AllocateVault_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
out := new(MsgUpdateParamsResponse)
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
// All implementations must embed UnimplementedMsgServer
// for forward compatibility
type MsgServer interface {
// AllocateVault assembles a sqlite3 database in a local directory and returns
// the CID of the database. this operation is called by services initiating a
// controller registration.
AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error)
// UpdateParams defines a governance operation for updating the parameters.
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
mustEmbedUnimplementedMsgServer()
}
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
type UnimplementedMsgServer struct {
}
func (UnimplementedMsgServer) AllocateVault(context.Context, *MsgAllocateVault) (*MsgAllocateVaultResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AllocateVault not implemented")
}
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MsgServer will
// result in compilation errors.
type UnsafeMsgServer interface {
mustEmbedUnimplementedMsgServer()
}
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
s.RegisterService(&Msg_ServiceDesc, srv)
}
func _Msg_AllocateVault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgAllocateVault)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AllocateVault(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_AllocateVault_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AllocateVault(ctx, req.(*MsgAllocateVault))
}
return interceptor(ctx, in, info, handler)
}
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgUpdateParams)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).UpdateParams(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Msg_UpdateParams_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
}
return interceptor(ctx, in, info, handler)
}
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Msg_ServiceDesc = grpc.ServiceDesc{
ServiceName: "vault.v1.Msg",
HandlerType: (*MsgServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "AllocateVault",
Handler: _Msg_AllocateVault_Handler,
},
{
MethodName: "UpdateParams",
Handler: _Msg_UpdateParams_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "vault/v1/tx.proto",
}

View File

@ -57,7 +57,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
// ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
globalfeeante.NewFeeDecorator(options.BypassMinFeeMsgTypes, options.GlobalFeeKeeper, options.StakingKeeper, 2_000_000),
// ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators

View File

@ -134,6 +134,12 @@ import (
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
did "github.com/onsonr/sonr/x/did"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
didtypes "github.com/onsonr/sonr/x/did/types"
vault "github.com/onsonr/sonr/x/vault"
vaultkeeper "github.com/onsonr/sonr/x/vault/keeper"
vaulttypes "github.com/onsonr/sonr/x/vault/types"
"github.com/spf13/cast"
globalfee "github.com/strangelove-ventures/globalfee/x/globalfee"
globalfeekeeper "github.com/strangelove-ventures/globalfee/x/globalfee/keeper"
@ -144,10 +150,6 @@ import (
tokenfactory "github.com/strangelove-ventures/tokenfactory/x/tokenfactory"
tokenfactorykeeper "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/keeper"
tokenfactorytypes "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"
did "github.com/onsonr/sonr/x/did"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
didtypes "github.com/onsonr/sonr/x/did/types"
)
const appName = "sonr"
@ -226,6 +228,7 @@ type SonrApp struct {
CrisisKeeper *crisiskeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
legacyAmino *codec.LegacyAmino
VaultKeeper vaultkeeper.Keeper
sm *module.SimulationManager
BasicModuleManager module.BasicManager
ModuleManager *module.Manager
@ -358,6 +361,7 @@ func NewChainApp(
globalfeetypes.StoreKey,
packetforwardtypes.StoreKey,
didtypes.StoreKey,
vaulttypes.StoreKey,
)
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
@ -606,6 +610,15 @@ func NewChainApp(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper
// Create the vault Keeper
app.VaultKeeper = vaultkeeper.NewKeeper(
appCodec,
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
logger,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.DidKeeper,
)
// Create the did Keeper
app.DidKeeper = didkeeper.NewKeeper(
appCodec,
@ -874,6 +887,7 @@ func NewChainApp(
),
did.NewAppModule(appCodec, app.DidKeeper, app.NFTKeeper),
vault.NewAppModule(appCodec, app.VaultKeeper),
)
// BasicModuleManager defines the module BasicManager is in charge of setting up basic,
@ -922,6 +936,7 @@ func NewChainApp(
tokenfactorytypes.ModuleName,
packetforwardtypes.ModuleName,
didtypes.ModuleName,
vaulttypes.ModuleName,
)
app.ModuleManager.SetOrderEndBlockers(
@ -941,6 +956,7 @@ func NewChainApp(
tokenfactorytypes.ModuleName,
packetforwardtypes.ModuleName,
didtypes.ModuleName,
vaulttypes.ModuleName,
)
// NOTE: The genutils module must occur after staking so that pools are
@ -969,6 +985,7 @@ func NewChainApp(
globalfeetypes.ModuleName,
packetforwardtypes.ModuleName,
didtypes.ModuleName,
vaulttypes.ModuleName,
}
app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...)
app.ModuleManager.SetOrderExportGenesis(genesisModuleOrder...)
@ -1127,6 +1144,8 @@ func GetDefaultBypassFeeMessages() []string {
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenTry{}),
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenConfirm{}),
sdk.MsgTypeURL(&ibcchanneltypes.MsgChannelOpenAck{}),
sdk.MsgTypeURL(&vaulttypes.MsgAllocateVault{}),
sdk.MsgTypeURL(&didtypes.MsgRegisterController{}),
}
}
@ -1426,6 +1445,7 @@ func initParamsKeeper(
paramsKeeper.Subspace(packetforwardtypes.ModuleName).
WithKeyTable(packetforwardtypes.ParamKeyTable())
paramsKeeper.Subspace(didtypes.ModuleName)
paramsKeeper.Subspace(vaulttypes.ModuleName)
return paramsKeeper
}

View File

@ -5,17 +5,12 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/onsonr/sonr/internal/cli/dexmodel"
"github.com/onsonr/sonr/internal/cli/txmodel"
"github.com/onsonr/sonr/app/cli/dexmodel"
"github.com/onsonr/sonr/app/cli/txmodel"
"github.com/spf13/cobra"
)
func AddTUICmds(rootCmd *cobra.Command) {
rootCmd.AddCommand(newBuildTxnTUICmd())
rootCmd.AddCommand(newExplorerTUICmd())
}
func newBuildTxnTUICmd() *cobra.Command {
func NewBuildTxnTUICmd() *cobra.Command {
return &cobra.Command{
Use: "dash",
Short: "TUI for managing the local Sonr validator node",
@ -40,7 +35,7 @@ func newBuildTxnTUICmd() *cobra.Command {
}
}
func newExplorerTUICmd() *cobra.Command {
func NewExplorerTUICmd() *cobra.Command {
return &cobra.Command{
Use: "cosmos-explorer",
Short: "A terminal-based Cosmos blockchain explorer",

View File

@ -1,23 +0,0 @@
package app
import (
"context"
"github.com/go-webauthn/webauthn/protocol"
)
// Default Key in gRPC Metadata for the Session ID
const MetadataSessionIDKey = "sonr-session-id"
// SonrContext is the context for the Sonr API
type SonrContext struct {
Context context.Context
SessionID string `json:"session_id"`
UserAddress string `json:"user_address"`
ValidatorAddress string `json:"validator_address"`
ServiceOrigin string `json:"service_origin"`
PeerID string `json:"peer_id"`
ChainID string `json:"chain_id"`
Token string `json:"token"`
Challenge protocol.URLEncodedBase64 `json:"challenge"`
}

56
app/proxy/command.go Normal file
View File

@ -0,0 +1,56 @@
package proxy
import (
"context"
"net/http"
"os"
"os/signal"
"time"
"github.com/labstack/echo/v4"
"github.com/labstack/gommon/log"
"github.com/onsonr/sonr/nebula/pages"
"github.com/spf13/cobra"
)
func NewProxyCmd() *cobra.Command {
return &cobra.Command{
Use: "dwn-proxy",
Short: "Starts the DWN proxy server for the local IPFS node",
Run: func(cmd *cobra.Command, args []string) {
// Echo instance
e := echo.New()
e.Logger.SetLevel(log.INFO)
// Load config
_, err := LoadConfig("./")
if err != nil {
e.Logger.Error(err)
}
// Configure the server
e.GET("/", pages.Home)
e.GET("/allocate", pages.Profile)
// Start server
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
defer stop()
// Start server
go func() {
if err := e.Start(":1323"); err != nil && err != http.ErrServerClosed {
e.Logger.Fatal("shutting down the server")
}
}()
// Wait for interrupt signal to gracefully shutdown the server with a timeout of 10 seconds.
<-ctx.Done()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
// Shutdown the server with 10 seconds timeout.
if err := e.Shutdown(ctx); err != nil {
e.Logger.Fatal(err)
}
},
}
}

31
app/proxy/config.go Normal file
View File

@ -0,0 +1,31 @@
package proxy
import "github.com/spf13/viper"
type Config struct {
Host string `mapstructure:"HOST"`
Port string `mapstructure:"PORT"`
SSL bool `mapstructure:"SSL"`
CertFile string `mapstructure:"CERT_FILE"`
KeyFile string `mapstructure:"KEY_FILE"`
}
func (c *Config) GetHostname() string {
return c.Host + ":" + c.Port
}
func LoadConfig(path string) (config Config, err error) {
viper.AddConfigPath(path)
viper.SetConfigName("app")
viper.SetConfigType("env")
viper.AutomaticEnv()
err = viper.ReadInConfig()
if err != nil {
return
}
err = viper.Unmarshal(&config)
return
}

View File

@ -1,40 +0,0 @@
//go:build js && wasm
// +build js,wasm
package main
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/vfs/wasm"
"github.com/onsonr/sonr/internal/db"
)
var dwn *DWN
type DWN struct {
*echo.Echo
DB *db.DB
}
func main() {
dwn = initRails()
wasm.Serve(dwn.Echo)
}
// initRails initializes the Rails application
func initRails() *DWN {
// Open the database
e := echo.New()
db, err := db.New()
if err != nil {
panic(err.Error())
}
db.ServeEcho(e.Group("/dwn"))
// Initialize the htmx handler
return &DWN{
Echo: e,
DB: db,
}
}

View File

@ -1,61 +0,0 @@
//go:build wasm
package main
import (
"github.com/labstack/echo/v4"
"github.com/syumai/workers"
"github.com/onsonr/sonr/internal/db"
"github.com/onsonr/sonr/internal/gui/views"
"github.com/onsonr/sonr/internal/mdw"
"github.com/onsonr/sonr/internal/svc"
)
func main() {
// Configure the server
e := echo.New()
// Use Middlewares
e.Use(mdw.UseSession)
// Setup routes
registerFrontend(e)
registerOpenID(e.Group("/authorize"))
registerVault(e.Group("/vault"))
// Serve Worker
workers.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 registerVault(g *echo.Group) {
// Add Authenticated Pages
g.Use(mdw.MacaroonMiddleware("test", "test"))
vault, err := db.New(db.WitDir("vault"))
if err != nil {
// panic(err)
}
vault.ServeEcho(g)
}

View File

@ -1,10 +0,0 @@
name = "sonr-id"
main = "./build/worker.mjs"
compatibility_date = "2024-07-26"
[dev]
ip = "localhost"
port = 4202
[build]
command = "devbox run build:motr"

View File

@ -8,12 +8,15 @@ import (
_ "github.com/joho/godotenv/autoload"
"github.com/onsonr/sonr/app"
"github.com/onsonr/sonr/internal/cli"
"github.com/onsonr/sonr/app/cli"
"github.com/onsonr/sonr/app/proxy"
)
func main() {
rootCmd := NewRootCmd()
cli.AddTUICmds(rootCmd)
rootCmd.AddCommand(cli.NewBuildTxnTUICmd())
rootCmd.AddCommand(cli.NewExplorerTUICmd())
rootCmd.AddCommand(proxy.NewProxyCmd())
if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil {
log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err)

1
cmd/sonrd/motr.go Normal file
View File

@ -0,0 +1 @@
package main

View File

@ -1,6 +1,6 @@
@go.Package { name = "github.com/onsonr/sonr/internal/orm" }
@go.Package { name = "github.com/onsonr/sonr/x/did/types/orm" }
module orm
module models
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"

View File

@ -1,72 +0,0 @@
@go.Package { name = "github.com/onsonr/sonr/internal/orm/browser" }
module browser
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
class PublicKeyCredentialRequestOptions {
challenge: String
timeout: Int
rpId: String
allowCredentials: List<PublicKeyCredentialDescriptor>
userVerification: String
extensions: List<PublicKeyCredentialParameters>
}
class PublicKeyCredentialDescriptor {
id: String
transports: List<String>
type: String
}
class PublicKeyCredentialParameters {
type: String
alg: Int?
}
class AuthenticatorSelectionCriteria {
authenticatorAttachment: String
requireResidentKey: Boolean
userVerification: String
}
class PublicKeyCredentialCreationOptions {
rp: RpEntity
user: UserEntity
challenge: String
pubKeyCredParams: List<PublicKeyCredentialParameters>
timeout: Int
excludeCredentials: List<PublicKeyCredentialDescriptor>
authenticatorSelection: AuthenticatorSelectionCriteria?
attestation: String
extensions: List<PublicKeyCredentialParameters>
}
class RpEntity {
id: String
name: String?
icon: String?
}
class UserEntity {
id: String
displayName: String?
name: String?
}
class SWT {
origin: String
location: String
identifier: String
scopes: List<String>
properties: Map<String, String>
expiryBlock: Int
}

View File

@ -1,50 +0,0 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
delay = 1000
cmd = "devbox run build:motr"
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go", ".pk.go", "_templ.go", ".pb.go"]
exclude_unchanged = true
follow_symlink = false
full_bin = "bunx wrangler -c ./web/wrangler.toml dev"
include_dir = ["web", "internal/dwn", "pkl"]
include_ext = ["go", "templ", "html", "pkl", "js", "mjs"]
include_file = [
"wrangler.toml",
"Dockerfile",
".goreleaser.yaml",
"go.mod",
"devbox.json",
".air.toml",
]
kill_delay = "2s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = ["templ generate", "devbox run gen:pkl"]
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false
[color]
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
main_only = true
time = true
[misc]
clean_on_exit = true
[screen]
clear_on_rebuild = true
keep_scroll = true

View File

@ -1,30 +0,0 @@
version: "3"
services:
sonr-node:
build:
context: .
dockerfile: Dockerfile
volumes:
- /home/prad/.scnr:/root/.sonr
ports:
- "26657:26657"
- "1317:1317"
- "9090:9090"
environment:
- CHAIN_ID=local-1
- MONIKER=localvalidator
- KEYRING=test
- KEY=user1
- KEY2=user2
- DENOM=usnr
- CLEAN=true
- BLOCK_TIME=5s
command: "start --pruning=nothing"
restart: always
networks:
- sonr-network
networks:
sonr-network:
name: sonr-network

View File

@ -1,25 +0,0 @@
version: "0.6"
processes:
sonr:
namespace: testnet
command: "devbox run serve:sonr"
restart: on_failure
max_restarts: 3
depends:
caddy:
namespace: testnet
command: "devbox run serve:xcaddy"
restart: on_failure
max_restarts: 3
depends:
- sonr
air:
namespace: testnet
command: "devbox run serve:air"
restart: on_failure
max_restarts: 3
depends:
- sonr

View File

@ -1,17 +0,0 @@
version: "0.6"
processes:
sonr:
namespace: testnet
command: "devbox run serve:sonr"
restart: on_failure
max_restarts: 3
depends:
caddy:
namespace: testnet
command: "devbox run serve:xcaddy"
restart: on_failure
max_restarts: 3
depends:
- sonr

View File

@ -1,9 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
"packages": [
"go@1.22",
"bun@latest",
"process-compose@latest"
"go@1.22"
],
"env": {
"CLOUDFLARE_API_TOKEN": "$CLOUDFLARE_API_TOKEN",
@ -30,9 +28,6 @@
"build:image": [
"make local-image"
],
"build:motr": [
"make motr"
],
"gen:proto": [
"make proto-gen"
],
@ -45,17 +40,17 @@
"serve:air": [
"make air"
],
"serve:ipfs": [
"make ipfs"
],
"serve:xcaddy": [
"make xcaddy"
],
"serve:sonr": [
"make sh-testnet"
],
"local": [
"process-compose -f ./deploy/process-compose.dev.yaml"
],
"testnet": [
"process-compose -f ./deploy/process-compose.yaml"
"serve:proxy": [
"make sh-testnet"
]
}
}

7
go.mod
View File

@ -48,7 +48,6 @@ require (
cosmossdk.io/x/upgrade v0.1.1
github.com/a-h/templ v0.2.778
github.com/apple/pkl-go v0.8.0
github.com/btcsuite/btcd/btcec/v2 v2.3.3
github.com/charmbracelet/bubbles v0.19.0
github.com/charmbracelet/bubbletea v1.1.0
github.com/charmbracelet/huh v0.5.3
@ -66,11 +65,13 @@ require (
github.com/ethereum/go-ethereum v1.14.6
github.com/go-webauthn/webauthn v0.10.2
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/ipfs/boxo v0.21.0
github.com/ipfs/kubo v0.29.0
github.com/joho/godotenv v1.5.1
github.com/labstack/echo/v4 v4.10.2
github.com/labstack/gommon v0.4.0
github.com/nlepage/go-js-promise v1.0.0
github.com/onsonr/crypto v1.32.0
github.com/segmentio/ksuid v1.0.4
@ -82,7 +83,6 @@ require (
github.com/strangelove-ventures/poa v0.50.0
github.com/strangelove-ventures/tokenfactory v0.50.0
github.com/stretchr/testify v1.9.0
github.com/syumai/workers v0.26.3
golang.org/x/crypto v0.26.0
google.golang.org/genproto/googleapis/api v0.0.0-20240617180043-68d350f18fd4
google.golang.org/grpc v1.64.0
@ -110,6 +110,7 @@ require (
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/bwesterb/go-ristretto v1.2.3 // indirect
@ -181,7 +182,6 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
@ -235,7 +235,6 @@ require (
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect

2
go.sum
View File

@ -2071,8 +2071,6 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/syumai/workers v0.26.3 h1:AF+IBaRccbR4JIj2kNJLJblruPFMD/pAbzkopejGcP8=
github.com/syumai/workers v0.26.3/go.mod h1:ZnqmdiHNBrbxOLrZ/HJ5jzHy6af9cmiNZk10R9NrIEA=
github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E=
github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
github.com/tetratelabs/wazero v1.8.0 h1:iEKu0d4c2Pd+QSRieYbnQC9yiFlMS9D+Jr0LsRmcF4g=

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
}

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)
}

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)
}

View File

@ -1,131 +0,0 @@
//go:build js && wasm
// +build js,wasm
package idb
import (
"context"
"encoding/json"
"errors"
"syscall/js"
"github.com/hack-pad/go-indexeddb/idb"
)
// Model is an interface that must be implemented by types used with Table
type Model interface {
Table() string
}
// Table is a generic wrapper around IDB for easier database operations on a specific table
type Table[T Model] struct {
db *idb.Database
dbName string
keyPath string
}
// 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 {
_, err := db.CreateObjectStore(tableName, idb.ObjectStoreOptions{
KeyPath: js.ValueOf(keyPath),
})
return err
})
if err != nil {
return nil, err
}
db, err := openRequest.Await(ctx)
if err != nil {
return nil, err
}
return &Table[T]{
db: db,
dbName: dbName,
keyPath: keyPath,
}, nil
}
// Insert adds a new record to the table
func (t *Table[T]) Insert(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.Add(js.ValueOf(string(jsonData)))
return err
}
// Query retrieves a record from the table based on a key
func (t *Table[T]) Query(key interface{}) (T, error) {
var result T
tx, err := t.db.Transaction(idb.TransactionReadOnly, result.Table())
if err != nil {
return result, err
}
defer tx.Commit()
objectStore, err := tx.ObjectStore(result.Table())
if err != nil {
return result, err
}
request, err := objectStore.Get(js.ValueOf(key))
if err != nil {
return result, err
}
value, err := request.Await(context.Background())
if err != nil {
return result, err
}
if value.IsUndefined() || value.IsNull() {
return result, errors.New("record not found")
}
err = json.Unmarshal([]byte(value.String()), &result)
return result, err
}
// Delete removes a record from the table based on a key
func (t *Table[T]) Delete(key interface{}) error {
var model T
tx, err := t.db.Transaction(idb.TransactionReadWrite, model.Table())
if err != nil {
return err
}
defer tx.Commit()
objectStore, err := tx.ObjectStore(model.Table())
if err != nil {
return err
}
_, err = objectStore.Delete(js.ValueOf(key))
return err
}
// Close closes the database connection
func (t *Table[T]) Close() error {
return t.db.Close()
}

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
}

View File

@ -1,14 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Account struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty" param:"name"`
Address string `pkl:"address" json:"address,omitempty" param:"address"`
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
}

View File

@ -1,16 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Asset struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty" param:"name"`
Symbol string `pkl:"symbol" json:"symbol,omitempty" param:"symbol"`
Decimals int `pkl:"decimals" json:"decimals,omitempty" param:"decimals"`
ChainId *int `pkl:"chainId" json:"chainId,omitempty" param:"chainId"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
}

View File

@ -1,12 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Chain struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty" param:"name"`
NetworkId string `pkl:"networkId" json:"networkId,omitempty" param:"networkId"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
}

View File

@ -1,36 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Credential struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"`
Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"`
AttestationType string `pkl:"attestationType" json:"attestationType,omitempty" param:"attestationType"`
Origin string `pkl:"origin" json:"origin,omitempty" param:"origin"`
CredentialId string `pkl:"credentialId" json:"credentialId,omitempty" param:"credentialId"`
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty" param:"publicKey"`
Transport string `pkl:"transport" json:"transport,omitempty" param:"transport"`
SignCount uint `pkl:"signCount" json:"signCount,omitempty" param:"signCount"`
UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty" param:"userPresent"`
UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty" param:"userVerified"`
BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty" param:"backupEligible"`
BackupState bool `pkl:"backupState" json:"backupState,omitempty" param:"backupState"`
CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty" param:"cloneWarning"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
}

View File

@ -1,12 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Keyshare struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Data string `pkl:"data" json:"data,omitempty" param:"data"`
Role int `pkl:"role" json:"role,omitempty" param:"role"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
}

View File

@ -1,36 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
import (
"context"
"github.com/apple/pkl-go/pkl"
)
type Orm 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) {
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 Orm
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Orm, error) {
var ret Orm
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
return &ret, nil
}

View File

@ -1,16 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Permission struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
ServiceId string `pkl:"serviceId" json:"serviceId,omitempty" param:"serviceId"`
Grants string `pkl:"grants" json:"grants,omitempty" param:"grants"`
Scopes string `pkl:"scopes" json:"scopes,omitempty" param:"scopes"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
}

View File

@ -1,20 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Profile struct {
Id string `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
Subject string `pkl:"subject" json:"subject,omitempty" param:"subject"`
Controller string `pkl:"controller" json:"controller,omitempty" param:"controller"`
OriginUri *string `pkl:"originUri" json:"originUri,omitempty" param:"originUri"`
PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty" param:"publicMetadata"`
PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty" param:"privateMetadata"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty" param:"createdAt"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty" param:"updatedAt"`
}

View File

@ -1,14 +0,0 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
type Property struct {
Id uint `pkl:"id" gorm:"primaryKey,autoIncrement" json:"id,omitempty" query:"id"`
ProfileId string `pkl:"profileId" json:"profileId,omitempty" param:"profileId"`
Key string `pkl:"key" json:"key,omitempty" param:"key"`
Accumulator string `pkl:"accumulator" json:"accumulator,omitempty" param:"accumulator"`
PropertyKey string `pkl:"propertyKey" json:"propertyKey,omitempty" param:"propertyKey"`
}

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{})
}

View File

@ -1,29 +0,0 @@
package orm
func (a *Account) Table() string {
return "accounts"
}
func (a *Asset) Table() string {
return "assets"
}
func (a *Credential) Table() string {
return "credentials"
}
func (a *Keyshare) Table() string {
return "keyshares"
}
func (a *Permission) Table() string {
return "permissions"
}
func (a *Profile) Table() string {
return "profiles"
}
func (a *Property) Table() string {
return "properties"
}

View File

@ -1 +0,0 @@
package handlers

View File

@ -1 +0,0 @@
package handlers

View File

@ -1 +0,0 @@
package handlers

View File

@ -1,67 +0,0 @@
package elements
func Alert(variant Variant, icon Icon, title, message string) templ.Component {
return alertElement(variant.Attributes(), title, message, icon.Render())
}
templ alertElement(attrs templ.Attributes, title, message string, icon templ.Component) {
<div { attrs... }>
@icon
<h5 class="mb-1 font-medium leading-none tracking-tight">{ title }</h5>
<div class="text-sm opacity-70">{ message }</div>
</div>
}
type AlertVariant int
const (
AlertVariant_Default AlertVariant = iota
AlertVariant_Info
AlertVariant_Error
AlertVariant_Success
AlertVariant_Warning
AlertVariant_Subtle_Info
AlertVariant_Subtle_Error
AlertVariant_Subtle_Success
AlertVariant_Subtle_Warning
)
func (v AlertVariant) Attributes() templ.Attributes {
switch v {
case AlertVariant_Info:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Error:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Success:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Warning:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Subtle_Info:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600",
}
case AlertVariant_Subtle_Error:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600",
}
case AlertVariant_Subtle_Success:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600",
}
case AlertVariant_Subtle_Warning:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600",
}
}
return templ.Attributes{
"class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900",
}
}

View File

@ -1,140 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Alert(variant Variant, icon Icon, title, message string) templ.Component {
return alertElement(variant.Attributes(), title, message, icon.Render())
}
func alertElement(attrs templ.Attributes, title, message string, icon templ.Component) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = icon.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h5 class=\"mb-1 font-medium leading-none tracking-tight\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h5><div class=\"text-sm opacity-70\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
type AlertVariant int
const (
AlertVariant_Default AlertVariant = iota
AlertVariant_Info
AlertVariant_Error
AlertVariant_Success
AlertVariant_Warning
AlertVariant_Subtle_Info
AlertVariant_Subtle_Error
AlertVariant_Subtle_Success
AlertVariant_Subtle_Warning
)
func (v AlertVariant) Attributes() templ.Attributes {
switch v {
case AlertVariant_Info:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-blue-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Error:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-red-600 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Success:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-green-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Warning:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-yellow-500 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-white",
}
case AlertVariant_Subtle_Info:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-blue-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-blue-600",
}
case AlertVariant_Subtle_Error:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-red-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-red-600",
}
case AlertVariant_Subtle_Success:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-green-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-green-600",
}
case AlertVariant_Subtle_Warning:
return templ.Attributes{
"class": "relative w-full rounded-lg border border-transparent bg-yellow-50 p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-yellow-600",
}
}
return templ.Attributes{
"class": "relative w-full rounded-lg border bg-white p-4 [&>svg]:absolute [&>svg]:text-foreground [&>svg]:left-4 [&>svg]:top-4 [&>svg+div]:translate-y-[-3px] [&:has(svg)]:pl-11 text-neutral-900",
}
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,5 +0,0 @@
package elements
templ Animation() {
<lottie-player src="https://assets5.lottiefiles.com/packages/lf20_0c0a2a8a.json" background="transparent" speed="1" style="width: 100%; height: 100%;" loop autoplay></lottie-player>
}

View File

@ -1,40 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Animation() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<lottie-player src=\"https://assets5.lottiefiles.com/packages/lf20_0c0a2a8a.json\" background=\"transparent\" speed=\"1\" style=\"width: 100%; height: 100%;\" loop autoplay></lottie-player>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,59 +0,0 @@
package elements
templ PoweredBySonr() {
<div class="mx-auto w-fit pt-8">
<div class="pt-2 pb-3 pl-4 pr-4 gap-x-3 text-sm text-gray-500 border-t border-neutral-200/70">
<div
x-data="{
hoverCardHovered: false,
hoverCardDelay: 600,
hoverCardLeaveDelay: 500,
hoverCardTimout: null,
hoverCardLeaveTimeout: null,
hoverCardEnter () {
clearTimeout(this.hoverCardLeaveTimeout);
if(this.hoverCardHovered) return;
clearTimeout(this.hoverCardTimout);
this.hoverCardTimout = setTimeout(() => {
this.hoverCardHovered = true;
}, this.hoverCardDelay);
},
hoverCardLeave () {
clearTimeout(this.hoverCardTimout);
if(!this.hoverCardHovered) return;
clearTimeout(this.hoverCardLeaveTimeout);
this.hoverCardLeaveTimeout = setTimeout(() => {
this.hoverCardHovered = false;
}, this.hoverCardLeaveDelay);
}
}"
class="relative"
@mouseover="hoverCardEnter()"
@mouseleave="hoverCardLeave()"
>
<span class="bg-transparent text-gray-500 border border-neutral-300 flex items-center text-xs font-semibold px-2.5 py-0.5 rounded-full">
<span class="mr-1">Powered by </span>
<svg class="w-3 h-3" width="164" height="164" viewBox="0 0 164 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M71.8077 133.231C74.5054 135.928 78.1636 137.443 81.978 137.443C85.7924 137.443 89.4506 135.928 92.1483 133.231L133.219 92.1638C135.909 89.4654 137.42 85.8102 137.42 81.9998C137.42 78.1895 135.909 74.5345 133.219 71.8361L112.886 51.5272L131.665 32.7499L152.031 53.1143C159.696 60.7963 164 71.2046 164 82.0559C164 92.9072 159.696 103.315 152.031 110.997L110.95 152.065C107.154 155.869 102.642 158.883 97.6739 160.931C92.7059 162.98 87.3809 164.023 82.0071 164L82.0052 164C76.622 164.019 71.2886 162.969 66.3145 160.91C61.3405 158.852 56.8247 155.826 53.0294 152.009L53.0289 152.008L48.7187 147.699L67.4974 128.921L71.8077 133.231Z" fill="currentColor"></path>
<path d="M110.95 11.9912L115.26 16.3011L96.481 35.0785L92.1707 30.7685C89.4731 28.072 85.8148 26.5572 82.0004 26.5572C78.186 26.5572 74.5277 28.072 71.8301 30.7685L30.7597 71.8359C29.4247 73.1706 28.3658 74.7552 27.6433 76.4991C26.9208 78.2431 26.549 80.1122 26.549 81.9999C26.549 83.8876 26.9208 85.7567 27.6433 87.5007C28.3658 89.2446 29.4247 90.8292 30.7597 92.1639L51.1256 112.528L32.3138 131.306L11.9923 110.941C8.19043 107.141 5.17433 102.629 3.1167 97.6635C1.05907 92.6976 0 87.3751 0 81.9999C0 76.6247 1.05907 71.3022 3.1167 66.3363C5.17433 61.3705 8.19021 56.8587 11.9921 53.0586L53.0625 11.9912C56.8629 8.18964 61.3751 5.17395 66.3413 3.11647C71.3075 1.05899 76.6304 0 82.006 0C87.3816 0 92.7045 1.05899 97.6707 3.11647C102.637 5.17395 107.149 8.18964 110.95 11.9912Z" fill="currentColor"></path>
<path d="M55.603 76.6744L76.6993 55.5798C79.6327 52.6465 84.3888 52.6465 87.3223 55.5797L108.419 76.6744C111.352 79.6077 111.352 84.3634 108.419 87.2966L87.3223 108.391C84.3888 111.325 79.6327 111.325 76.6993 108.391L55.603 87.2966C52.6696 84.3634 52.6696 79.6077 55.603 76.6744Z" fill="currentColor"></path>
</svg>
</span>
<div x-show="hoverCardHovered" class="absolute top-0 w-[365px] max-w-lg mt-5 z-30 -translate-x-1/2 translate-y-3 left-1/2" x-cloak>
<div x-show="hoverCardHovered" class="w-[full] h-auto bg-white space-x-3 p-5 flex items-start rounded-md shadow-sm border border-neutral-200/70" x-transition>
<img src="https://cdn.sonr.io/logo.svg" alt="sonr image" class="rounded-full w-14 h-14"/>
<div class="relative">
<p class="mb-1 text-sm text-gray-600">The creative platform for developers. Community, tools, products, and more</p>
<p class="flex items-center space-x-1 text-xs text-gray-400">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5">
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5m-9-6h.008v.008H12v-.008zM12 15h.008v.008H12V15zm0 2.25h.008v.008H12v-.008zM9.75 15h.008v.008H9.75V15zm0 2.25h.008v.008H9.75v-.008zM7.5 15h.008v.008H7.5V15zm0 2.25h.008v.008H7.5v-.008zm6.75-4.5h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V15zm0 2.25h.008v.008h-.008v-.008zm2.25-4.5h.008v.008H16.5v-.008zm0 2.25h.008v.008H16.5V15z"></path>
</svg>
<span>Joined June 2020</span>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
}

View File

@ -1,40 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func PoweredBySonr() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"mx-auto w-fit pt-8\"><div class=\"pt-2 pb-3 pl-4 pr-4 gap-x-3 text-sm text-gray-500 border-t border-neutral-200/70\"><div x-data=\"{ \n hoverCardHovered: false,\n hoverCardDelay: 600,\n hoverCardLeaveDelay: 500,\n hoverCardTimout: null,\n hoverCardLeaveTimeout: null,\n hoverCardEnter () {\n clearTimeout(this.hoverCardLeaveTimeout);\n if(this.hoverCardHovered) return;\n clearTimeout(this.hoverCardTimout);\n this.hoverCardTimout = setTimeout(() =&gt; {\n this.hoverCardHovered = true;\n }, this.hoverCardDelay);\n },\n hoverCardLeave () {\n clearTimeout(this.hoverCardTimout);\n if(!this.hoverCardHovered) return;\n clearTimeout(this.hoverCardLeaveTimeout);\n this.hoverCardLeaveTimeout = setTimeout(() =&gt; {\n this.hoverCardHovered = false;\n }, this.hoverCardLeaveDelay);\n }\n }\" class=\"relative\" @mouseover=\"hoverCardEnter()\" @mouseleave=\"hoverCardLeave()\"><span class=\"bg-transparent text-gray-500 border border-neutral-300 flex items-center text-xs font-semibold px-2.5 py-0.5 rounded-full\"><span class=\"mr-1\">Powered by </span> <svg class=\"w-3 h-3\" width=\"164\" height=\"164\" viewBox=\"0 0 164 164\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M71.8077 133.231C74.5054 135.928 78.1636 137.443 81.978 137.443C85.7924 137.443 89.4506 135.928 92.1483 133.231L133.219 92.1638C135.909 89.4654 137.42 85.8102 137.42 81.9998C137.42 78.1895 135.909 74.5345 133.219 71.8361L112.886 51.5272L131.665 32.7499L152.031 53.1143C159.696 60.7963 164 71.2046 164 82.0559C164 92.9072 159.696 103.315 152.031 110.997L110.95 152.065C107.154 155.869 102.642 158.883 97.6739 160.931C92.7059 162.98 87.3809 164.023 82.0071 164L82.0052 164C76.622 164.019 71.2886 162.969 66.3145 160.91C61.3405 158.852 56.8247 155.826 53.0294 152.009L53.0289 152.008L48.7187 147.699L67.4974 128.921L71.8077 133.231Z\" fill=\"currentColor\"></path> <path d=\"M110.95 11.9912L115.26 16.3011L96.481 35.0785L92.1707 30.7685C89.4731 28.072 85.8148 26.5572 82.0004 26.5572C78.186 26.5572 74.5277 28.072 71.8301 30.7685L30.7597 71.8359C29.4247 73.1706 28.3658 74.7552 27.6433 76.4991C26.9208 78.2431 26.549 80.1122 26.549 81.9999C26.549 83.8876 26.9208 85.7567 27.6433 87.5007C28.3658 89.2446 29.4247 90.8292 30.7597 92.1639L51.1256 112.528L32.3138 131.306L11.9923 110.941C8.19043 107.141 5.17433 102.629 3.1167 97.6635C1.05907 92.6976 0 87.3751 0 81.9999C0 76.6247 1.05907 71.3022 3.1167 66.3363C5.17433 61.3705 8.19021 56.8587 11.9921 53.0586L53.0625 11.9912C56.8629 8.18964 61.3751 5.17395 66.3413 3.11647C71.3075 1.05899 76.6304 0 82.006 0C87.3816 0 92.7045 1.05899 97.6707 3.11647C102.637 5.17395 107.149 8.18964 110.95 11.9912Z\" fill=\"currentColor\"></path> <path d=\"M55.603 76.6744L76.6993 55.5798C79.6327 52.6465 84.3888 52.6465 87.3223 55.5797L108.419 76.6744C111.352 79.6077 111.352 84.3634 108.419 87.2966L87.3223 108.391C84.3888 111.325 79.6327 111.325 76.6993 108.391L55.603 87.2966C52.6696 84.3634 52.6696 79.6077 55.603 76.6744Z\" fill=\"currentColor\"></path></svg></span><div x-show=\"hoverCardHovered\" class=\"absolute top-0 w-[365px] max-w-lg mt-5 z-30 -translate-x-1/2 translate-y-3 left-1/2\" x-cloak><div x-show=\"hoverCardHovered\" class=\"w-[full] h-auto bg-white space-x-3 p-5 flex items-start rounded-md shadow-sm border border-neutral-200/70\" x-transition><img src=\"https://cdn.sonr.io/logo.svg\" alt=\"sonr image\" class=\"rounded-full w-14 h-14\"><div class=\"relative\"><p class=\"mb-1 text-sm text-gray-600\">The creative platform for developers. Community, tools, products, and more</p><p class=\"flex items-center space-x-1 text-xs text-gray-400\"><svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-5 h-5\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5m-9-6h.008v.008H12v-.008zM12 15h.008v.008H12V15zm0 2.25h.008v.008H12v-.008zM9.75 15h.008v.008H9.75V15zm0 2.25h.008v.008H9.75v-.008zM7.5 15h.008v.008H7.5V15zm0 2.25h.008v.008H7.5v-.008zm6.75-4.5h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V15zm0 2.25h.008v.008h-.008v-.008zm2.25-4.5h.008v.008H16.5v-.008zm0 2.25h.008v.008H16.5V15z\"></path></svg> <span>Joined June 2020</span></p></div></div></div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,35 +0,0 @@
package elements
templ Breadcrumbs() {
<nav class="flex justify-between px-3.5 py-1 rounded-md pb-3">
<ol class="inline-flex items-center mb-3 space-x-1 text-xs text-neutral-500 [&_.active-breadcrumb]:text-neutral-600 [&_.active-breadcrumb]:font-medium sm:mb-0">
<li class="flex items-center h-full">
<a href="#_" class="py-1 hover:text-neutral-900">
@breadcrumbIcon()
</a>
</li>
<svg class="w-5 h-5 text-gray-400/70" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="none" stroke="none"><path d="M10 8.013l4 4-4 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
@breadcrumbItem("Policy", false)
<svg class="w-5 h-5 text-gray-400/70" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="none" stroke="none"><path d="M10 8.013l4 4-4 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
@breadcrumbItem("About You", true)
<svg class="w-5 h-5 text-gray-400/70" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g fill="none" stroke="none"><path d="M10 8.013l4 4-4 4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>
@breadcrumbItem("Generate", false)
</ol>
</nav>
}
templ breadcrumbItem(title string, active bool) {
if (active) {
<li><a class="inline-flex items-center py-1 font-normal rounded cursor-default active-breadcrumb focus:outline-none">{ title }</a></li>
} else {
<li><a href="#_" class="inline-flex items-center py-1 font-normal hover:text-neutral-900 focus:outline-none">{ title }</a></li>
}
}
templ breadcrumbIcon() {
<svg class="w-4 w-4" viewBox="0 0 164 164" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M71.8077 133.231C74.5054 135.928 78.1636 137.443 81.978 137.443C85.7924 137.443 89.4506 135.928 92.1483 133.231L133.219 92.1638C135.909 89.4654 137.42 85.8102 137.42 81.9998C137.42 78.1895 135.909 74.5345 133.219 71.8361L112.886 51.5272L131.665 32.7499L152.031 53.1143C159.696 60.7963 164 71.2046 164 82.0559C164 92.9072 159.696 103.315 152.031 110.997L110.95 152.065C107.154 155.869 102.642 158.883 97.6739 160.931C92.7059 162.98 87.3809 164.023 82.0071 164L82.0052 164C76.622 164.019 71.2886 162.969 66.3145 160.91C61.3405 158.852 56.8247 155.826 53.0294 152.009L53.0289 152.008L48.7187 147.699L67.4974 128.921L71.8077 133.231Z" fill="currentColor"></path>
<path d="M110.95 11.9912L115.26 16.3011L96.481 35.0785L92.1707 30.7685C89.4731 28.072 85.8148 26.5572 82.0004 26.5572C78.186 26.5572 74.5277 28.072 71.8301 30.7685L30.7597 71.8359C29.4247 73.1706 28.3658 74.7552 27.6433 76.4991C26.9208 78.2431 26.549 80.1122 26.549 81.9999C26.549 83.8876 26.9208 85.7567 27.6433 87.5007C28.3658 89.2446 29.4247 90.8292 30.7597 92.1639L51.1256 112.528L32.3138 131.306L11.9923 110.941C8.19043 107.141 5.17433 102.629 3.1167 97.6635C1.05907 92.6976 0 87.3751 0 81.9999C0 76.6247 1.05907 71.3022 3.1167 66.3363C5.17433 61.3705 8.19021 56.8587 11.9921 53.0586L53.0625 11.9912C56.8629 8.18964 61.3751 5.17395 66.3413 3.11647C71.3075 1.05899 76.6304 0 82.006 0C87.3816 0 92.7045 1.05899 97.6707 3.11647C102.637 5.17395 107.149 8.18964 110.95 11.9912Z" fill="currentColor"></path>
<path d="M55.603 76.6744L76.6993 55.5798C79.6327 52.6465 84.3888 52.6465 87.3223 55.5797L108.419 76.6744C111.352 79.6077 111.352 84.3634 108.419 87.2966L87.3223 108.391C84.3888 111.325 79.6327 111.325 76.6993 108.391L55.603 87.2966C52.6696 84.3634 52.6696 79.6077 55.603 76.6744Z" fill="currentColor"></path>
</svg>
}

View File

@ -1,163 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Breadcrumbs() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<nav class=\"flex justify-between px-3.5 py-1 rounded-md pb-3\"><ol class=\"inline-flex items-center mb-3 space-x-1 text-xs text-neutral-500 [&amp;_.active-breadcrumb]:text-neutral-600 [&amp;_.active-breadcrumb]:font-medium sm:mb-0\"><li class=\"flex items-center h-full\"><a href=\"#_\" class=\"py-1 hover:text-neutral-900\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = breadcrumbIcon().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li><svg class=\"w-5 h-5 text-gray-400/70\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"none\"><path d=\"M10 8.013l4 4-4 4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></g></svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = breadcrumbItem("Policy", false).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 text-gray-400/70\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"none\"><path d=\"M10 8.013l4 4-4 4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></g></svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = breadcrumbItem("About You", true).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 text-gray-400/70\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"none\"><path d=\"M10 8.013l4 4-4 4\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></path></g></svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = breadcrumbItem("Generate", false).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ol></nav>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func breadcrumbItem(title string, active bool) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
if active {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><a class=\"inline-flex items-center py-1 font-normal rounded cursor-default active-breadcrumb focus:outline-none\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><a href=\"#_\" class=\"inline-flex items-center py-1 font-normal hover:text-neutral-900 focus:outline-none\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
})
}
func breadcrumbIcon() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var5 := templ.GetChildren(ctx)
if templ_7745c5c3_Var5 == nil {
templ_7745c5c3_Var5 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-4 w-4\" viewBox=\"0 0 164 164\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M71.8077 133.231C74.5054 135.928 78.1636 137.443 81.978 137.443C85.7924 137.443 89.4506 135.928 92.1483 133.231L133.219 92.1638C135.909 89.4654 137.42 85.8102 137.42 81.9998C137.42 78.1895 135.909 74.5345 133.219 71.8361L112.886 51.5272L131.665 32.7499L152.031 53.1143C159.696 60.7963 164 71.2046 164 82.0559C164 92.9072 159.696 103.315 152.031 110.997L110.95 152.065C107.154 155.869 102.642 158.883 97.6739 160.931C92.7059 162.98 87.3809 164.023 82.0071 164L82.0052 164C76.622 164.019 71.2886 162.969 66.3145 160.91C61.3405 158.852 56.8247 155.826 53.0294 152.009L53.0289 152.008L48.7187 147.699L67.4974 128.921L71.8077 133.231Z\" fill=\"currentColor\"></path> <path d=\"M110.95 11.9912L115.26 16.3011L96.481 35.0785L92.1707 30.7685C89.4731 28.072 85.8148 26.5572 82.0004 26.5572C78.186 26.5572 74.5277 28.072 71.8301 30.7685L30.7597 71.8359C29.4247 73.1706 28.3658 74.7552 27.6433 76.4991C26.9208 78.2431 26.549 80.1122 26.549 81.9999C26.549 83.8876 26.9208 85.7567 27.6433 87.5007C28.3658 89.2446 29.4247 90.8292 30.7597 92.1639L51.1256 112.528L32.3138 131.306L11.9923 110.941C8.19043 107.141 5.17433 102.629 3.1167 97.6635C1.05907 92.6976 0 87.3751 0 81.9999C0 76.6247 1.05907 71.3022 3.1167 66.3363C5.17433 61.3705 8.19021 56.8587 11.9921 53.0586L53.0625 11.9912C56.8629 8.18964 61.3751 5.17395 66.3413 3.11647C71.3075 1.05899 76.6304 0 82.006 0C87.3816 0 92.7045 1.05899 97.6707 3.11647C102.637 5.17395 107.149 8.18964 110.95 11.9912Z\" fill=\"currentColor\"></path> <path d=\"M55.603 76.6744L76.6993 55.5798C79.6327 52.6465 84.3888 52.6465 87.3223 55.5797L108.419 76.6744C111.352 79.6077 111.352 84.3634 108.419 87.2966L87.3223 108.391C84.3888 111.325 79.6327 111.325 76.6993 108.391L55.603 87.2966C52.6696 84.3634 52.6696 79.6077 55.603 76.6744Z\" fill=\"currentColor\"></path></svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,218 +0,0 @@
package elements
type button struct {
variant Variant
hxGet string
hxPost string
hxTarget string
hxTrigger string
hxSwap string
}
type ButtonOpt func(button *button)
func PrimaryButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantPrimary
}
}
func InfoButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantInfo
}
}
func ErrorButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantError
}
}
func SuccessButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantSuccess
}
}
func WarningButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantWarning
}
}
func GET(action string, target string) ButtonOpt {
return func(button *button) {
button.hxGet = action
button.hxTarget = target
button.hxTrigger = "click"
button.hxSwap = "outerHTML"
}
}
func POST(action string, target string) ButtonOpt {
return func(button *button) {
button.hxPost = action
button.hxTarget = target
button.hxTrigger = "click"
button.hxSwap = "outerHTML"
}
}
func Button(opts ...ButtonOpt) templ.Component {
button := button{
variant: ButtonVariantDefault,
}
for _, opt := range opts {
opt(&button)
}
if button.hxGet != "" {
return renderHxGetButton(&button, button.variant.Attributes())
}
if button.hxPost != "" {
return renderHxPostButton(&button, button.variant.Attributes())
}
return renderButton(button.variant.Attributes())
}
templ renderButton(attrs templ.Attributes) {
<button { attrs... }>
{ children... }
</button>
}
templ renderHxGetButton(c *button, attrs templ.Attributes) {
<button hx-get={ c.hxGet } hx-push-url="true" hx-target={ c.hxTarget } hx-trigger={ c.hxTrigger } hx-swap={ c.hxSwap } { attrs... }>
{ children... }
</button>
}
templ renderHxPostButton(c *button, attrs templ.Attributes) {
<button hx-post={ c.hxPost } hx-target={ c.hxTarget } hx-trigger={ c.hxTrigger } hx-swap={ c.hxSwap } { attrs... }>
{ children... }
</button>
}
type ButtonVariant int
const (
ButtonVariantDefault ButtonVariant = iota
ButtonVariantPrimary
ButtonVariantInfo
ButtonVariantError
ButtonVariantSuccess
ButtonVariantWarning
)
func (v ButtonVariant) Attributes() templ.Attributes {
switch v {
case ButtonVariantPrimary:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline",
"type": "button",
}
}
type SubtleButtonVariant int
const (
SubtleButtonVariantDefault SubtleButtonVariant = iota
SubtleButtonVariantInfo
SubtleButtonVariantError
SubtleButtonVariantSuccess
SubtleButtonVariantWarning
)
func (v SubtleButtonVariant) Attributes() templ.Attributes {
switch v {
case SubtleButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100",
"type": "button",
}
case SubtleButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100",
"type": "button",
}
case SubtleButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100",
"type": "button",
}
case SubtleButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100",
"type": "button",
}
}
type OutlineButtonVariant int
const (
OutlineButtonVariantDefault OutlineButtonVariant = iota
OutlineButtonVariantInfo
OutlineButtonVariantError
OutlineButtonVariantSuccess
OutlineButtonVariantWarning
)
func (v OutlineButtonVariant) Attributes() templ.Attributes {
switch v {
case OutlineButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600",
"type": "button",
}
case OutlineButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600",
"type": "button",
}
case OutlineButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600",
"type": "button",
}
case OutlineButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900",
"type": "button",
}
}

View File

@ -1,449 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
type button struct {
variant Variant
hxGet string
hxPost string
hxTarget string
hxTrigger string
hxSwap string
}
type ButtonOpt func(button *button)
func PrimaryButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantPrimary
}
}
func InfoButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantInfo
}
}
func ErrorButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantError
}
}
func SuccessButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantSuccess
}
}
func WarningButtonStyle() ButtonOpt {
return func(button *button) {
button.variant = ButtonVariantWarning
}
}
func GET(action string, target string) ButtonOpt {
return func(button *button) {
button.hxGet = action
button.hxTarget = target
button.hxTrigger = "click"
button.hxSwap = "outerHTML"
}
}
func POST(action string, target string) ButtonOpt {
return func(button *button) {
button.hxPost = action
button.hxTarget = target
button.hxTrigger = "click"
button.hxSwap = "outerHTML"
}
}
func Button(opts ...ButtonOpt) templ.Component {
button := button{
variant: ButtonVariantDefault,
}
for _, opt := range opts {
opt(&button)
}
if button.hxGet != "" {
return renderHxGetButton(&button, button.variant.Attributes())
}
if button.hxPost != "" {
return renderHxPostButton(&button, button.variant.Attributes())
}
return renderButton(button.variant.Attributes())
}
func renderButton(attrs templ.Attributes) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func renderHxGetButton(c *button, attrs templ.Attributes) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-push-url=\"true\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var2.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func renderHxPostButton(c *button, attrs templ.Attributes) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var7 := templ.GetChildren(ctx)
if templ_7745c5c3_Var7 == nil {
templ_7745c5c3_Var7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button hx-post=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-trigger=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</button>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
type ButtonVariant int
const (
ButtonVariantDefault ButtonVariant = iota
ButtonVariantPrimary
ButtonVariantInfo
ButtonVariantError
ButtonVariantSuccess
ButtonVariantWarning
)
func (v ButtonVariant) Attributes() templ.Attributes {
switch v {
case ButtonVariantPrimary:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 bg-blue-600 rounded-md hover:bg-blue-700 focus:ring-2 focus:ring-offset-2 focus:ring-blue-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-red-600 hover:bg-red-700 focus:ring-2 focus:ring-offset-2 focus:ring-red-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-green-600 hover:bg-green-700 focus:ring-2 focus:ring-offset-2 focus:ring-green-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
case ButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-yellow-600 hover:bg-yellow-700 focus:ring-2 focus:ring-offset-2 focus:ring-yellow-700 focus:shadow-outline focus:outline-none",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-200 bg-white border rounded-md text-neutral-500 hover:text-neutral-700 border-neutral-200/70 hover:bg-neutral-100 active:bg-white focus:bg-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-200/60 focus:shadow-outline",
"type": "button",
}
}
type SubtleButtonVariant int
const (
SubtleButtonVariantDefault SubtleButtonVariant = iota
SubtleButtonVariantInfo
SubtleButtonVariantError
SubtleButtonVariantSuccess
SubtleButtonVariantWarning
)
func (v SubtleButtonVariant) Attributes() templ.Attributes {
switch v {
case SubtleButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-blue-100 bg-blue-50 hover:text-blue-600 hover:bg-blue-100",
"type": "button",
}
case SubtleButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-red-100 bg-red-50 hover:text-red-600 hover:bg-red-100",
"type": "button",
}
case SubtleButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-500 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-green-100 bg-green-50 hover:text-green-600 hover:bg-green-100",
"type": "button",
}
case SubtleButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 rounded-md focus:ring-2 focus:ring-offset-2 focus:ring-yellow-100 bg-yellow-50 hover:text-yellow-700 hover:bg-yellow-100",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 rounded-md text-neutral-500 bg-neutral-50 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-100 hover:text-neutral-600 hover:bg-neutral-100",
"type": "button",
}
}
type OutlineButtonVariant int
const (
OutlineButtonVariantDefault OutlineButtonVariant = iota
OutlineButtonVariantInfo
OutlineButtonVariantError
OutlineButtonVariantSuccess
OutlineButtonVariantWarning
)
func (v OutlineButtonVariant) Attributes() templ.Attributes {
switch v {
case OutlineButtonVariantInfo:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-blue-600 transition-colors duration-100 bg-white border-2 border-blue-600 rounded-md hover:text-white hover:bg-blue-600",
"type": "button",
}
case OutlineButtonVariantError:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-red-600 transition-colors duration-100 bg-white border-2 border-red-600 rounded-md hover:text-white hover:bg-red-600",
"type": "button",
}
case OutlineButtonVariantSuccess:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-green-600 transition-colors duration-100 bg-white border-2 border-green-600 rounded-md hover:text-white hover:bg-green-600",
"type": "button",
}
case OutlineButtonVariantWarning:
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-yellow-600 transition-colors duration-100 bg-white border-2 border-yellow-500 rounded-md hover:text-white hover:bg-yellow-500",
"type": "button",
}
}
return templ.Attributes{
"class": "inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide transition-colors duration-100 bg-white border-2 rounded-md text-neutral-900 hover:text-white border-neutral-900 hover:bg-neutral-900",
"type": "button",
}
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,47 +0,0 @@
package elements
func Card(id string, size Size) templ.Component {
return renderCard(id, size.CardAttributes())
}
templ renderCard(id string, attrs templ.Attributes) {
<div id={ id } { attrs... }>
<div class="w-full h-full">
<div class="row">
<div class="col-md-12 space-3">
{ children... }
</div>
</div>
</div>
</div>
}
templ ProfileCard() {
<div class="relative max-w-sm overflow-hidden bg-white border rounded-lg shadow-sm border-neutral-200/60">
<img src="https://cdn.devdojo.com/images/august2023/wallpaper.jpeg" class="relative z-20 object-cover w-full h-32"/>
<div class="absolute top-0 z-50 flex items-center w-full mt-2 translate-y-24 px-7 -translate-x-0">
<div class="w-20 h-20 p-1 bg-white rounded-full">
<img src="https://cdn.devdojo.com/images/august2023/adam.jpeg" class="w-full h-full rounded-full"/>
</div>
<a href="https://twitter.com/adamwathan" target="_blank" class="block mt-6 ml-2">
<h5 class="text-lg font-bold leading-none tracking-tight text-neutral-900">Adam Wathan</h5>
<small class="block mt-1 text-sm font-medium leading-none text-neutral-500">adamwathan</small>
</a>
<button class="absolute right-0 inline-flex items-center justify-center w-auto px-5 mt-6 text-sm font-medium transition-colors duration-100 rounded-full h-9 mr-7 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 bg-neutral-900 disabled:pointer-events-none hover:bg-neutral-800 text-neutral-100">
<span>Follow</span>
</button>
</div>
<div class="relative pb-6 p-7">
<p class="mt-12 mb-6 text-neutral-500 text-">Creator of @tailwindcss. Listener of Slayer. Austin 3:16. BTW, Pines UI is super cool!</p>
<div class="flex items-center justify-between pr-2 text-neutral-500">
<div class="relative flex w-16">
<img src="https://cdn.devdojo.com/images/august2023/caleb.jpeg" class="relative z-30 w-8 h-8 border-2 border-white rounded-full"/>
<img src="https://cdn.devdojo.com/images/august2023/taylor.jpeg" class="z-20 w-8 h-8 -translate-x-4 border-2 border-white rounded-full"/>
<img src="https://cdn.devdojo.com/images/august2023/adam.jpeg" class="z-10 w-8 h-8 border-2 border-white rounded-full -translate-x-7"/>
</div>
<a href="https://twitter.com/adamwathan/following" target="_blank" class="text-sm hover:underline"><strong class="text-neutral-800">673</strong> Following</a>
<a href="https://twitter.com/adamwathan/followers" target="_blank" class="text-sm hover:underline"><strong class="text-neutral-800">168.6K</strong> Followers</a>
</div>
</div>
</div>
}

View File

@ -1,102 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Card(id string, size Size) templ.Component {
return renderCard(id, size.CardAttributes())
}
func renderCard(id string, attrs templ.Attributes) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("><div class=\"w-full h-full\"><div class=\"row\"><div class=\"col-md-12 space-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func ProfileCard() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var3 := templ.GetChildren(ctx)
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"relative max-w-sm overflow-hidden bg-white border rounded-lg shadow-sm border-neutral-200/60\"><img src=\"https://cdn.devdojo.com/images/august2023/wallpaper.jpeg\" class=\"relative z-20 object-cover w-full h-32\"><div class=\"absolute top-0 z-50 flex items-center w-full mt-2 translate-y-24 px-7 -translate-x-0\"><div class=\"w-20 h-20 p-1 bg-white rounded-full\"><img src=\"https://cdn.devdojo.com/images/august2023/adam.jpeg\" class=\"w-full h-full rounded-full\"></div><a href=\"https://twitter.com/adamwathan\" target=\"_blank\" class=\"block mt-6 ml-2\"><h5 class=\"text-lg font-bold leading-none tracking-tight text-neutral-900\">Adam Wathan</h5><small class=\"block mt-1 text-sm font-medium leading-none text-neutral-500\">adamwathan</small></a> <button class=\"absolute right-0 inline-flex items-center justify-center w-auto px-5 mt-6 text-sm font-medium transition-colors duration-100 rounded-full h-9 mr-7 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 bg-neutral-900 disabled:pointer-events-none hover:bg-neutral-800 text-neutral-100\"><span>Follow</span></button></div><div class=\"relative pb-6 p-7\"><p class=\"mt-12 mb-6 text-neutral-500 text-\">Creator of @tailwindcss. Listener of Slayer. Austin 3:16. BTW, Pines UI is super cool!</p><div class=\"flex items-center justify-between pr-2 text-neutral-500\"><div class=\"relative flex w-16\"><img src=\"https://cdn.devdojo.com/images/august2023/caleb.jpeg\" class=\"relative z-30 w-8 h-8 border-2 border-white rounded-full\"> <img src=\"https://cdn.devdojo.com/images/august2023/taylor.jpeg\" class=\"z-20 w-8 h-8 -translate-x-4 border-2 border-white rounded-full\"> <img src=\"https://cdn.devdojo.com/images/august2023/adam.jpeg\" class=\"z-10 w-8 h-8 border-2 border-white rounded-full -translate-x-7\"></div><a href=\"https://twitter.com/adamwathan/following\" target=\"_blank\" class=\"text-sm hover:underline\"><strong class=\"text-neutral-800\">673</strong> Following</a> <a href=\"https://twitter.com/adamwathan/followers\" target=\"_blank\" class=\"text-sm hover:underline\"><strong class=\"text-neutral-800\">168.6K</strong> Followers</a></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,47 +0,0 @@
package elements
import (
"strings"
"github.com/a-h/templ"
)
type Icon interface {
Render() templ.Component
}
type Variant interface {
Attributes() templ.Attributes
}
func clsxMerge(variants ...Variant) templ.Attributes {
combinedAttrs := templ.Attributes{}
var classElements []string
for _, variant := range variants {
attrs := variant.Attributes()
if class, ok := attrs["class"].(string); ok {
classElements = append(classElements, strings.Fields(class)...)
}
for key, value := range attrs {
if key != "class" {
combinedAttrs[key] = value
}
}
}
if len(classElements) > 0 {
combinedAttrs["class"] = strings.Join(classElements, " ")
}
return combinedAttrs
}
func clsxBuilder(classes ...string) templ.Attributes {
if len(classes) == 0 {
return templ.Attributes{}
}
class := strings.Join(classes, " ")
return templ.Attributes{
"class": class,
}
}

View File

@ -1,62 +0,0 @@
package elements
func H1(content string) templ.Component {
return renderText(1, content)
}
func H2(content string) templ.Component {
return renderText(2, content)
}
func H3(content string) templ.Component {
return renderText(3, content)
}
func Text(content string) templ.Component {
return renderText(0, content)
}
templ renderText(level int, text string) {
switch level {
case 1:
<h1 class="text-2xl lg:text-3xl font-bold">
{ text }
</h1>
case 2:
<h2 class="text-xl lg:text-2xl font-bold">
{ text }
</h2>
case 3:
<h3 class="text-md lg:text-xl font-semibold">
{ text }
</h3>
default:
<p class="text-base font-normal">
{ text }
</p>
}
}
templ renderLink(attrs templ.Attributes, text string) {
<a { attrs... }>
{ text }
</a>
}
templ renderStrong(attrs templ.Attributes, text string) {
<strong { attrs... }>
{ text }
</strong>
}
templ renderEmphasis(attrs templ.Attributes, text string) {
<em { attrs... }>
{ text }
</em>
}
templ renderCode(attrs templ.Attributes, text string) {
<code { attrs... }>
{ text }
</code>
}

View File

@ -1,326 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func H1(content string) templ.Component {
return renderText(1, content)
}
func H2(content string) templ.Component {
return renderText(2, content)
}
func H3(content string) templ.Component {
return renderText(3, content)
}
func Text(content string) templ.Component {
return renderText(0, content)
}
func renderText(level int, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
switch level {
case 1:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1 class=\"text-2xl lg:text-3xl font-bold\">")
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h1>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case 2:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2 class=\"text-xl lg:text-2xl font-bold\">")
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h2>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case 3:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h3 class=\"text-md lg:text-xl font-semibold\">")
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</h3>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
default:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p class=\"text-base font-normal\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
})
}
func renderLink(attrs templ.Attributes, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<a")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func renderStrong(attrs templ.Attributes, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var8 := templ.GetChildren(ctx)
if templ_7745c5c3_Var8 == nil {
templ_7745c5c3_Var8 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<strong")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</strong>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func renderEmphasis(attrs templ.Attributes, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<em")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</em>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func renderCode(attrs templ.Attributes, text 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var12 := templ.GetChildren(ctx)
if templ_7745c5c3_Var12 == nil {
templ_7745c5c3_Var12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<code")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderAttributes(ctx, templ_7745c5c3_Buffer, attrs)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</code>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,54 +0,0 @@
package elements
templ Layout(title string) {
<!DOCTYPE html>
<html>
<head>
@defaultStyles()
<title>{ title }</title>
</head>
<body class="flex items-center justify-center h-full bg-neutral-50 lg:p-24 md:16 p-4">
<main class="flex-row items-center justify-center mx-auto w-fit max-w-screen-sm gap-y-3">
{ children... }
</main>
</body>
</html>
}
templ Spacer() {
<br/>
}
templ ServiceWorker(path string) {
<script>
navigator.serviceWorker.register({ path })
</script>
}
templ defaultStyles() {
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script src="https://cdn.sonr.io/js/htmx.min.js"></script>
<link href="https://cdn.sonr.io/stylesheet.css" rel="stylesheet"/>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/alpinejs" defer></script>
<style>[x-cloak]{display:none}</style>
<style>font-family: R-Flex, system-ui, Inter, Helvetica, Arial, sans-serif;</style>
}
templ Rows() {
<div class="flex flex-row w-full gap-2 md:gap-4">
{ children... }
</div>
}
templ Columns() {
<div class="flex flex-col h-full w-full gap-3 md:gap-6 md:flex-row">
{ children... }
</div>
}
css main() {
font-family: R-Flex, system-ui, Avenir, Helvetica, Arial, sans-serif;
}

View File

@ -1,240 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Layout(title 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!doctype html><html><head>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = defaultStyles().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<title>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</title></head><body class=\"flex items-center justify-center h-full bg-neutral-50 lg:p-24 md:16 p-4\"><main class=\"flex-row items-center justify-center mx-auto w-fit max-w-screen-sm gap-y-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</main></body></html>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func Spacer() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var3 := templ.GetChildren(ctx)
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<br>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func ServiceWorker(path 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n\t navigator.serviceWorker.register({ path })\n </script>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func defaultStyles() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var5 := templ.GetChildren(ctx)
if templ_7745c5c3_Var5 == nil {
templ_7745c5c3_Var5 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<meta charset=\"UTF-8\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><script src=\"https://cdn.sonr.io/js/htmx.min.js\"></script><link href=\"https://cdn.sonr.io/stylesheet.css\" rel=\"stylesheet\"><script src=\"https://cdn.tailwindcss.com\"></script><script src=\"https://unpkg.com/alpinejs\" defer></script><style>[x-cloak]{display:none}</style><style>font-family: R-Flex, system-ui, Inter, Helvetica, Arial, sans-serif;</style>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func Rows() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-row w-full gap-2 md:gap-4\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var6.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func Columns() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var7 := templ.GetChildren(ctx)
if templ_7745c5c3_Var7 == nil {
templ_7745c5c3_Var7 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col h-full w-full gap-3 md:gap-6 md:flex-row\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func main() templ.CSSClass {
templ_7745c5c3_CSSBuilder := templruntime.GetBuilder()
templ_7745c5c3_CSSBuilder.WriteString(`font-family:R-Flex, system-ui, Avenir, Helvetica, Arial, sans-serif;`)
templ_7745c5c3_CSSID := templ.CSSID(`main`, templ_7745c5c3_CSSBuilder.String())
return templ.ComponentCSSClass{
ID: templ_7745c5c3_CSSID,
Class: templ.SafeCSS(`.` + templ_7745c5c3_CSSID + `{` + templ_7745c5c3_CSSBuilder.String() + `}`),
}
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,31 +0,0 @@
package elements
type Icons int
const (
Icons_Info Icons = iota
Icons_Error
Icons_Success
Icons_Warning
)
func (v Icons) Render() templ.Component {
return renderIconVariant(v)
}
templ renderIconVariant(v Icons) {
switch v {
case Icons_Info:
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"></path></svg>
case Icons_Error:
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"></path></svg>
case Icons_Success:
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
case Icons_Warning:
<svg class="w-5 h-5 -translate-y-0.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"></path></svg>
}
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>
}
templ SonrIcon() {
}

View File

@ -1,100 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
type Icons int
const (
Icons_Info Icons = iota
Icons_Error
Icons_Success
Icons_Warning
)
func (v Icons) Render() templ.Component {
return renderIconVariant(v)
}
func renderIconVariant(v Icons) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
switch v {
case Icons_Info:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z\"></path></svg> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case Icons_Error:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z\"></path></svg> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case Icons_Success:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path></svg> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case Icons_Warning:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg class=\"w-5 h-5 -translate-y-0.5\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z\"></path></svg> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"feather feather-chevron-right\"><polyline points=\"9 18 15 12 9 6\"></polyline></svg>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func SonrIcon() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,29 +0,0 @@
package elements
type InputState int
const (
InputStateDefault InputState = iota
InputStateError
InputStateSuccess
)
templ TextInput(state InputState, label string, placeholder string) {
switch (state) {
case InputStateDefault:
<div class="flex flex-col space-y-1.5 p-6">
<label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">{ label }</label>
<input type="text" placeholder="{label}" id="name" value="{value}" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/>
</div>
case InputStateError:
<div class="flex flex-col space-y-1.5 p-6">
<label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">{ label }</label>
<input type="text" placeholder="{label}" id="name" value="{value}" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/>
</div>
case InputStateSuccess:
<div class="flex flex-col space-y-1.5 p-6">
<label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">{ label }</label>
<input type="text" placeholder="{label}" id="name" value="{value}" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/>
</div>
}
}

View File

@ -1,100 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
type InputState int
const (
InputStateDefault InputState = iota
InputStateError
InputStateSuccess
)
func TextInput(state InputState, label string, placeholder 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
switch state {
case InputStateDefault:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col space-y-1.5 p-6\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label> <input type=\"text\" placeholder=\"{label}\" id=\"name\" value=\"{value}\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case InputStateError:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col space-y-1.5 p-6\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label> <input type=\"text\" placeholder=\"{label}\" id=\"name\" value=\"{value}\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
case InputStateSuccess:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col space-y-1.5 p-6\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
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}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</label> <input type=\"text\" placeholder=\"{label}\" id=\"name\" value=\"{value}\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,37 +0,0 @@
package elements
templ RadioGroup() {
<div
x-data="{
radioGroupSelectedValue: null,
radioGroupOptions: [
{
title: 'Email Address',
description: 'Get a login code to your email address.',
value: 'email'
},
{
title: 'Phone Number',
description: 'Get a login code to your phone number.',
value: 'phone'
},
{
title: 'Passkey',
description: 'Sign in with your passkey.',
value: 'passkey'
}
]
}"
class="space-y-3"
>
<template x-for="(option, index) in radioGroupOptions" :key="index">
<label @click="radioGroupSelectedValue=option.value" class="flex items-start p-5 space-x-3 bg-white border rounded-md shadow-sm hover:bg-gray-50 border-neutral-200/70">
<input type="radio" name="radio-group" :value="option.value" class="text-gray-900 translate-y-px focus:ring-gray-700"/>
<span class="relative flex flex-col text-left space-y-1.5 leading-none">
<span x-text="option.title" class="font-semibold"></span>
<span x-text="option.description" class="text-sm opacity-50"></span>
</span>
</label>
</template>
</div>
}

View File

@ -1,40 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func RadioGroup() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div x-data=\"{\n radioGroupSelectedValue: null,\n radioGroupOptions: [\n {\n title: &#39;Email Address&#39;,\n description: &#39;Get a login code to your email address.&#39;,\n value: &#39;email&#39;\n },\n {\n title: &#39;Phone Number&#39;,\n description: &#39;Get a login code to your phone number.&#39;,\n value: &#39;phone&#39;\n },\n {\n title: &#39;Passkey&#39;,\n description: &#39;Sign in with your passkey.&#39;,\n value: &#39;passkey&#39;\n }\n ]\n}\" class=\"space-y-3\"><template x-for=\"(option, index) in radioGroupOptions\" :key=\"index\"><label @click=\"radioGroupSelectedValue=option.value\" class=\"flex items-start p-5 space-x-3 bg-white border rounded-md shadow-sm hover:bg-gray-50 border-neutral-200/70\"><input type=\"radio\" name=\"radio-group\" :value=\"option.value\" class=\"text-gray-900 translate-y-px focus:ring-gray-700\"> <span class=\"relative flex flex-col text-left space-y-1.5 leading-none\"><span x-text=\"option.title\" class=\"font-semibold\"></span> <span x-text=\"option.description\" class=\"text-sm opacity-50\"></span></span></label></template></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,61 +0,0 @@
package elements
type Size int
const (
SizeDefault Size = iota
SizeSmall
SizeMedium
SizeLarge
)
func (s Size) CardAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
case SizeLarge:
return templ.Attributes{
"class": "max-w-2xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
}
return templ.Attributes{
"class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
}
func (s Size) SvgAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"height": "16",
"width": "16",
}
case SizeLarge:
return templ.Attributes{
"height": "32",
"width": "32",
}
}
return templ.Attributes{
"height": "24",
"width": "24",
}
}
func (s Size) TextAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"class": "text-sm",
}
case SizeLarge:
return templ.Attributes{
"class": "text-lg",
}
}
return templ.Attributes{
"class": "text-md",
}
}

View File

@ -1,71 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
type Size int
const (
SizeDefault Size = iota
SizeSmall
SizeMedium
SizeLarge
)
func (s Size) CardAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"class": "max-w-lg bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
case SizeLarge:
return templ.Attributes{
"class": "max-w-2xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
}
return templ.Attributes{
"class": "max-w-xl bg-white border rounded-lg shadow-sm p-7 border-neutral-200/60",
}
}
func (s Size) SvgAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"height": "16",
"width": "16",
}
case SizeLarge:
return templ.Attributes{
"height": "32",
"width": "32",
}
}
return templ.Attributes{
"height": "24",
"width": "24",
}
}
func (s Size) TextAttributes() templ.Attributes {
switch s {
case SizeSmall:
return templ.Attributes{
"class": "text-sm",
}
case SizeLarge:
return templ.Attributes{
"class": "text-lg",
}
}
return templ.Attributes{
"class": "text-md",
}
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,109 +0,0 @@
package elements
templ Tabs() {
<div
x-data="{
tabSelected: 1,
tabId: $id('tabs'),
tabButtonClicked(tabButton){
this.tabSelected = tabButton.id.replace(this.tabId + '-', '');
this.tabRepositionMarker(tabButton);
},
tabRepositionMarker(tabButton){
this.$refs.tabMarker.style.width=tabButton.offsetWidth + 'px';
this.$refs.tabMarker.style.height=tabButton.offsetHeight + 'px';
this.$refs.tabMarker.style.left=tabButton.offsetLeft + 'px';
},
tabContentActive(tabContent){
return this.tabSelected == tabContent.id.replace(this.tabId + '-content-', '');
},
tabButtonActive(tabContent){
const tabId = tabContent.id.split('-').slice(-1);
return this.tabSelected == tabId;
}
}"
x-init="tabRepositionMarker($refs.tabButtons.firstElementChild);"
class="relative w-full max-w-sm"
>
<div x-ref="tabButtons" class="relative inline-grid items-center justify-center w-full h-10 grid-cols-3 p-1 text-gray-500 bg-white border border-gray-100 rounded-lg select-none">
<button :id="$id(tabId)" @click="tabButtonClicked($el);" type="button" :class="{ 'bg-gray-100 text-gray-700' : tabButtonActive($el) }" class="relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap">Tab1</button>
<button :id="$id(tabId)" @click="tabButtonClicked($el);" type="button" :class="{ 'bg-gray-100 text-gray-700' : tabButtonActive($el) }" class="relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap">Tab2</button>
<button :id="$id(tabId)" @click="tabButtonClicked($el);" type="button" :class="{ 'bg-gray-100 text-gray-700' : tabButtonActive($el) }" class="relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap">Tab3</button>
<div x-ref="tabMarker" class="absolute left-0 z-10 w-1/2 h-full duration-300 ease-out" x-cloak><div class="w-full h-full bg-gray-100 rounded-md shadow-sm"></div></div>
</div>
<div class="relative flex items-center justify-center w-full p-5 mt-2 text-xs text-gray-400 border rounded-md content border-gray-200/70">
<div :id="$id(tabId + '-content')" x-show="tabContentActive($el)" class="relative">
@Table()
</div>
<div :id="$id(tabId + '-content')" x-show="tabContentActive($el)" class="relative" x-cloak>
And, this is the content for Tab2
</div>
<div :id="$id(tabId + '-content')" x-show="tabContentActive($el)" class="relative" x-cloak>
Finally, this is the content for Tab3
</div>
</div>
</div>
}
templ Table() {
<div class="flex flex-col">
<div class="overflow-x-auto">
<div class="inline-block min-w-full">
<div class="overflow-hidden">
<table class="min-w-full divide-y divide-neutral-200">
<thead>
<tr class="text-neutral-500">
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Name</th>
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Age</th>
<th class="px-5 py-3 text-xs font-medium text-left uppercase">Address</th>
<th class="px-5 py-3 text-xs font-medium text-right uppercase">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-neutral-200">
<tr class="text-neutral-800">
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">Richard Hendricks</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">30</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">Pied Piper HQ, Palo Alto</td>
<td class="px-5 py-4 text-sm font-medium text-right whitespace-nowrap">
<a class="text-blue-600 hover:text-blue-700" href="#">Edit</a>
</td>
</tr>
<tr class="text-neutral-800">
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">Erlich Bachman</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">40</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">5230 Penfield Ave, Woodland Hills</td>
<td class="px-5 py-4 text-sm font-medium text-right whitespace-nowrap">
<a class="text-blue-600 hover:text-blue-700" href="#">Edit</a>
</td>
</tr>
<tr class="text-neutral-800">
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">Monica Hall</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">35</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">2030 Stewart Drive, Sunnyvale</td>
<td class="px-5 py-4 text-sm font-medium text-right whitespace-nowrap">
<a class="text-blue-600 hover:text-blue-700" href="#">Edit</a>
</td>
</tr>
<tr class="text-neutral-800">
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">Dinesh Chugtai</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">28</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">Pied Piper HQ, Palo Alto</td>
<td class="px-5 py-4 text-sm font-medium text-right whitespace-nowrap">
<a class="text-blue-600 hover:text-blue-700" href="#">Edit</a>
</td>
</tr>
<tr class="text-neutral-800">
<td class="px-5 py-4 text-sm font-medium whitespace-nowrap">Gilfoyle</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">32</td>
<td class="px-5 py-4 text-sm whitespace-nowrap">Pied Piper HQ, Palo Alto</td>
<td class="px-5 py-4 text-sm font-medium text-right whitespace-nowrap">
<a class="text-blue-600 hover:text-blue-700" href="#">Edit</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
}

View File

@ -1,77 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
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"
func Tabs() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div x-data=\"{\n tabSelected: 1,\n tabId: $id(&#39;tabs&#39;),\n tabButtonClicked(tabButton){\n this.tabSelected = tabButton.id.replace(this.tabId + &#39;-&#39;, &#39;&#39;);\n this.tabRepositionMarker(tabButton);\n },\n tabRepositionMarker(tabButton){\n this.$refs.tabMarker.style.width=tabButton.offsetWidth + &#39;px&#39;;\n this.$refs.tabMarker.style.height=tabButton.offsetHeight + &#39;px&#39;;\n this.$refs.tabMarker.style.left=tabButton.offsetLeft + &#39;px&#39;;\n },\n tabContentActive(tabContent){\n return this.tabSelected == tabContent.id.replace(this.tabId + &#39;-content-&#39;, &#39;&#39;);\n },\n tabButtonActive(tabContent){\n const tabId = tabContent.id.split(&#39;-&#39;).slice(-1);\n return this.tabSelected == tabId;\n }\n }\" x-init=\"tabRepositionMarker($refs.tabButtons.firstElementChild);\" class=\"relative w-full max-w-sm\"><div x-ref=\"tabButtons\" class=\"relative inline-grid items-center justify-center w-full h-10 grid-cols-3 p-1 text-gray-500 bg-white border border-gray-100 rounded-lg select-none\"><button :id=\"$id(tabId)\" @click=\"tabButtonClicked($el);\" type=\"button\" :class=\"{ &#39;bg-gray-100 text-gray-700&#39; : tabButtonActive($el) }\" class=\"relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap\">Tab1</button> <button :id=\"$id(tabId)\" @click=\"tabButtonClicked($el);\" type=\"button\" :class=\"{ &#39;bg-gray-100 text-gray-700&#39; : tabButtonActive($el) }\" class=\"relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap\">Tab2</button> <button :id=\"$id(tabId)\" @click=\"tabButtonClicked($el);\" type=\"button\" :class=\"{ &#39;bg-gray-100 text-gray-700&#39; : tabButtonActive($el) }\" class=\"relative z-20 inline-flex items-center justify-center w-full h-8 px-3 text-sm font-medium transition-all rounded-md cursor-pointer whitespace-nowrap\">Tab3</button><div x-ref=\"tabMarker\" class=\"absolute left-0 z-10 w-1/2 h-full duration-300 ease-out\" x-cloak><div class=\"w-full h-full bg-gray-100 rounded-md shadow-sm\"></div></div></div><div class=\"relative flex items-center justify-center w-full p-5 mt-2 text-xs text-gray-400 border rounded-md content border-gray-200/70\"><div :id=\"$id(tabId + &#39;-content&#39;)\" x-show=\"tabContentActive($el)\" class=\"relative\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = Table().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><div :id=\"$id(tabId + &#39;-content&#39;)\" x-show=\"tabContentActive($el)\" class=\"relative\" x-cloak>And, this is the content for Tab2</div><div :id=\"$id(tabId + &#39;-content&#39;)\" x-show=\"tabContentActive($el)\" class=\"relative\" x-cloak>Finally, this is the content for Tab3</div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func Table() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"flex flex-col\"><div class=\"overflow-x-auto\"><div class=\"inline-block min-w-full\"><div class=\"overflow-hidden\"><table class=\"min-w-full divide-y divide-neutral-200\"><thead><tr class=\"text-neutral-500\"><th class=\"px-5 py-3 text-xs font-medium text-left uppercase\">Name</th><th class=\"px-5 py-3 text-xs font-medium text-left uppercase\">Age</th><th class=\"px-5 py-3 text-xs font-medium text-left uppercase\">Address</th><th class=\"px-5 py-3 text-xs font-medium text-right uppercase\">Action</th></tr></thead> <tbody class=\"divide-y divide-neutral-200\"><tr class=\"text-neutral-800\"><td class=\"px-5 py-4 text-sm font-medium whitespace-nowrap\">Richard Hendricks</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">30</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">Pied Piper HQ, Palo Alto</td><td class=\"px-5 py-4 text-sm font-medium text-right whitespace-nowrap\"><a class=\"text-blue-600 hover:text-blue-700\" href=\"#\">Edit</a></td></tr><tr class=\"text-neutral-800\"><td class=\"px-5 py-4 text-sm font-medium whitespace-nowrap\">Erlich Bachman</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">40</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">5230 Penfield Ave, Woodland Hills</td><td class=\"px-5 py-4 text-sm font-medium text-right whitespace-nowrap\"><a class=\"text-blue-600 hover:text-blue-700\" href=\"#\">Edit</a></td></tr><tr class=\"text-neutral-800\"><td class=\"px-5 py-4 text-sm font-medium whitespace-nowrap\">Monica Hall</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">35</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">2030 Stewart Drive, Sunnyvale</td><td class=\"px-5 py-4 text-sm font-medium text-right whitespace-nowrap\"><a class=\"text-blue-600 hover:text-blue-700\" href=\"#\">Edit</a></td></tr><tr class=\"text-neutral-800\"><td class=\"px-5 py-4 text-sm font-medium whitespace-nowrap\">Dinesh Chugtai</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">28</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">Pied Piper HQ, Palo Alto</td><td class=\"px-5 py-4 text-sm font-medium text-right whitespace-nowrap\"><a class=\"text-blue-600 hover:text-blue-700\" href=\"#\">Edit</a></td></tr><tr class=\"text-neutral-800\"><td class=\"px-5 py-4 text-sm font-medium whitespace-nowrap\">Gilfoyle</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">32</td><td class=\"px-5 py-4 text-sm whitespace-nowrap\">Pied Piper HQ, Palo Alto</td><td class=\"px-5 py-4 text-sm font-medium text-right whitespace-nowrap\"><a class=\"text-blue-600 hover:text-blue-700\" href=\"#\">Edit</a></td></tr></tbody></table></div></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,41 +0,0 @@
package forms
import (
"bytes"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
func echoFormResponse(c echo.Context, cmp templ.Component, state FormState) error {
// Create a buffer to store the rendered HTML
buf := &bytes.Buffer{}
// Render the component to the buffer
err := cmp.Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
c.Response().Header().Set("X-Status", string(state))
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
type FormState string
const (
InitialForm FormState = "initial"
ErrorForm FormState = "error"
SuccessForm FormState = "success"
WarningForm FormState = "warning"
)
type Form struct {
State FormState
Title string
Description string
}

View File

@ -1,95 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package forms
//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 BasicInfo(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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
switch state {
default:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-neutral-900\"><div class=\"flex flex-col space-y-1.5 p-6\"><h3 class=\"text-lg font-semibold leading-none tracking-tight\">Account</h3><p class=\"text-sm text-neutral-500\">Make changes to your account here. Click save when you're done.</p></div><div class=\"p-6 pt-0 space-y-2\"><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">Name</label><input type=\"text\" id=\"name\" placeholder=\"Adam Wathan\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"username\">Handle</label><input type=\"text\" id=\"handle\" placeholder=\"angelo.snr\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-neutral-300 ring-offset-background placeholder:text-neutral-400 focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
})
}
func CreateCredentials(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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
return templ_7745c5c3_Err
})
}
func PrivacyTerms(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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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_Var3 := templ.GetChildren(ctx)
if templ_7745c5c3_Var3 == nil {
templ_7745c5c3_Var3 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,29 +0,0 @@
package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
)
func HomeView(c echo.Context) error {
return echoComponentResponse(c, renderHomeView())
}
templ renderHomeView() {
@elements.Layout("Sonr.ID") {
@elements.Card("home-view", elements.SizeLarge) {
@elements.H1("Sonr.ID")
@elements.Text("A Decentralized Web Node Client for the Sonr Network.")
@elements.Spacer()
<div class="flex flex-col gap-3">
@elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()) {
@elements.Text("Get Started")
}
@elements.Button(elements.GET("/login", "#home-view")) {
@elements.Text("Login")
}
</div>
@elements.PoweredBySonr()
}
}
}

View File

@ -1,157 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//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"
"github.com/onsonr/sonr/internal/gui/elements"
)
func HomeView(c echo.Context) error {
return echoComponentResponse(c, renderHomeView())
}
func renderHomeView() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
templ_7745c5c3_Var2 := 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_Var3 := 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_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Text("A Decentralized Web Node Client for the Sonr Network.").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"flex flex-col gap-3\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var4 := 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_Err = elements.Text("Get Started").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Button(elements.GET("/register", "#home-view"), elements.PrimaryButtonStyle()).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var5 := 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_Err = elements.Text("Login").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Button(elements.GET("/login", "#home-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.PoweredBySonr().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Card("home-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Layout("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,25 +0,0 @@
package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
)
func LoginView(c echo.Context) error {
return echoComponentResponse(c, renderLoginView())
}
templ renderLoginView() {
@elements.Layout("Login | Sonr.ID") {
@elements.Card("login-view", elements.SizeLarge) {
@elements.H1("Sonr.ID")
@elements.Text("Neo-tree is a file manager for NeoFS.")
@elements.Spacer()
@elements.RadioGroup()
@elements.Spacer()
@elements.Button(elements.GET("/", "#login-view")) {
@elements.Text("Cancel")
}
}
}
}

View File

@ -1,143 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//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"
"github.com/onsonr/sonr/internal/gui/elements"
)
func LoginView(c echo.Context) error {
return echoComponentResponse(c, renderLoginView())
}
func renderLoginView() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
templ_7745c5c3_Var2 := 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_Var3 := 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_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.RadioGroup().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var4 := 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_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Button(elements.GET("/", "#login-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Card("login-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,19 +0,0 @@
package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
)
func AuthorizeView(c echo.Context) error {
return echoComponentResponse(c, renderAuthorizeView())
}
templ renderAuthorizeView() {
@elements.Layout("Login | Sonr.ID") {
@elements.Card("authorize-view", elements.SizeMedium) {
@elements.H1("Sonr.ID")
@elements.Text("Neo-tree is a file manager for NeoFS.")
}
}
}

View File

@ -1,93 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//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"
"github.com/onsonr/sonr/internal/gui/elements"
)
func AuthorizeView(c echo.Context) error {
return echoComponentResponse(c, renderAuthorizeView())
}
func renderAuthorizeView() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
templ_7745c5c3_Var2 := 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_Var3 := 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_Err = elements.H1("Sonr.ID").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Text("Neo-tree is a file manager for NeoFS.").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Card("authorize-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Layout("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,19 +0,0 @@
package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
)
func ProfileView(c echo.Context) error {
return echoComponentResponse(c, renderProfileView())
}
templ renderProfileView() {
@elements.Layout("Profile | Sonr.ID") {
@elements.Card("profile-view", elements.SizeLarge) {
@elements.ProfileCard()
@elements.Tabs()
}
}
}

View File

@ -1,93 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//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"
"github.com/onsonr/sonr/internal/gui/elements"
)
func ProfileView(c echo.Context) error {
return echoComponentResponse(c, renderProfileView())
}
func renderProfileView() 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
templ_7745c5c3_Var2 := 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_Var3 := 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_Err = elements.ProfileCard().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Tabs().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Card("profile-view", elements.SizeLarge).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Layout("Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

View File

@ -1,26 +0,0 @@
package views
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/gui/forms"
)
func RegisterView(c echo.Context) error {
return echoComponentResponse(c, renderRegisterView(c))
}
templ renderRegisterView(c echo.Context) {
@elements.Layout("Register | Sonr.ID") {
@elements.Card("register-view", elements.SizeMedium) {
@elements.H2("Account Registration")
@elements.Spacer()
@elements.Breadcrumbs()
@forms.BasicInfo(c, forms.InitialForm)
@elements.Spacer()
@elements.Button(elements.GET("/", "#register-view")) {
@elements.Text("Cancel")
}
}
}
}

View File

@ -1,144 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package views
//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"
"github.com/onsonr/sonr/internal/gui/elements"
"github.com/onsonr/sonr/internal/gui/forms"
)
func RegisterView(c echo.Context) error {
return echoComponentResponse(c, renderRegisterView(c))
}
func renderRegisterView(c echo.Context) 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
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
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)
templ_7745c5c3_Var2 := 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_Var3 := 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_Err = elements.H2("Account Registration").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Breadcrumbs().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = forms.BasicInfo(c, forms.InitialForm).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = elements.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Var4 := 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_Err = elements.Text("Cancel").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Button(elements.GET("/", "#register-view")).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Card("register-view", elements.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = elements.Layout("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate

Some files were not shown because too many files have changed in this diff Show More