feature/refactor types (#1101)

- **docs: remove discord badge from README**
- **fix: ensure go version is up-to-date**
- **<no value>**
- **refactor: update import paths for blocks to components**
- **feat: add Hero component template**
- **fix: update footer logo to svg**
- **feat: add Query/Sign and Query/Verify RPC methods**
- **refactor: rename Keyshares to KsVal in did/v1/state.proto**
This commit is contained in:
Prad Nukala
2024-09-29 14:40:36 -04:00
committed by GitHub
parent 91d8f523dd
commit d04c87de43
124 changed files with 7895 additions and 1072 deletions
+14
View File
@@ -31,3 +31,17 @@ func (k Querier) Params(goCtx context.Context, req *types.QueryRequest) (*types.
func (k Querier) Resolve(goCtx context.Context, req *types.QueryRequest) (*types.QueryResolveResponse, error) {
return &types.QueryResolveResponse{}, nil
}
// Sign implements types.QueryServer.
func (k Querier) Sign(goCtx context.Context, req *types.QuerySignRequest) (*types.QuerySignResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("Sign is unimplemented")
return &types.QuerySignResponse{}, nil
}
// Verify implements types.QueryServer.
func (k Querier) Verify(goCtx context.Context, req *types.QueryVerifyRequest) (*types.QueryVerifyResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("Verify is unimplemented")
return &types.QueryVerifyResponse{}, nil
}
+1
View File
@@ -4,6 +4,7 @@ import (
fmt "fmt"
"github.com/onsonr/crypto/mpc"
didv1 "github.com/onsonr/sonr/api/did/v1"
)
-20
View File
@@ -1,20 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Account struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty"`
Address any `pkl:"address" json:"address,omitempty"`
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty"`
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
Index int `pkl:"index" json:"index,omitempty"`
Controller string `pkl:"controller" json:"controller,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
}
-16
View File
@@ -1,16 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Asset struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty"`
Symbol string `pkl:"symbol" json:"symbol,omitempty"`
Decimals int `pkl:"decimals" json:"decimals,omitempty"`
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
}
-14
View File
@@ -1,14 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Chain struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Name string `pkl:"name" json:"name,omitempty"`
NetworkId string `pkl:"networkId" json:"networkId,omitempty"`
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
}
-40
View File
@@ -1,40 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Credential struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Subject string `pkl:"subject" json:"subject,omitempty"`
Controller string `pkl:"controller" json:"controller,omitempty"`
AttestationType string `pkl:"attestationType" json:"attestationType,omitempty"`
Origin string `pkl:"origin" json:"origin,omitempty"`
Label *string `pkl:"label" json:"label,omitempty"`
DeviceId *string `pkl:"deviceId" json:"deviceId,omitempty"`
CredentialId string `pkl:"credentialId" json:"credentialId,omitempty"`
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty"`
Transport []string `pkl:"transport" json:"transport,omitempty"`
SignCount uint `pkl:"signCount" json:"signCount,omitempty"`
UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty"`
UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty"`
BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty"`
BackupState bool `pkl:"backupState" json:"backupState,omitempty"`
CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
}
-20
View File
@@ -1,20 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Grant struct {
Id uint `pkl:"id" json:"id,omitempty" query:"id"`
Subject string `pkl:"subject" json:"subject,omitempty"`
Controller string `pkl:"controller" json:"controller,omitempty"`
Origin string `pkl:"origin" json:"origin,omitempty"`
Token string `pkl:"token" json:"token,omitempty"`
Scopes []string `pkl:"scopes" json:"scopes,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
}
-16
View File
@@ -1,16 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type JWK struct {
Kty string `pkl:"kty" json:"kty,omitempty"`
Crv string `pkl:"crv" json:"crv,omitempty"`
X string `pkl:"x" json:"x,omitempty"`
Y string `pkl:"y" json:"y,omitempty"`
N string `pkl:"n" json:"n,omitempty"`
E string `pkl:"e" json:"e,omitempty"`
}
-14
View File
@@ -1,14 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Keyshare struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Data string `pkl:"data" json:"data,omitempty"`
Role int `pkl:"role" json:"role,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
LastRefreshed *string `pkl:"lastRefreshed" json:"lastRefreshed,omitempty"`
}
-39
View File
@@ -1,39 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
import (
"context"
"github.com/apple/pkl-go/pkl"
)
type Models struct {
DbName string `pkl:"db_name"`
DbVersion int `pkl:"db_version"`
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) {
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
if err != nil {
return nil, err
}
defer func() {
cerr := evaluator.Close()
if err == nil {
err = cerr
}
}()
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
return ret, err
}
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
var ret Models
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
return &ret, nil
}
-20
View File
@@ -1,20 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
type Profile struct {
Id string `pkl:"id" json:"id,omitempty" query:"id"`
Subject string `pkl:"subject" json:"subject,omitempty"`
Controller string `pkl:"controller" json:"controller,omitempty"`
OriginUri *string `pkl:"originUri" json:"originUri,omitempty"`
PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty"`
PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty"`
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
}
-26
View File
@@ -1,26 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
import (
"github.com/onsonr/sonr/x/did/types/orm/keyalgorithm"
"github.com/onsonr/sonr/x/did/types/orm/keycurve"
"github.com/onsonr/sonr/x/did/types/orm/keyencoding"
"github.com/onsonr/sonr/x/did/types/orm/keyrole"
"github.com/onsonr/sonr/x/did/types/orm/keytype"
)
type PublicKey struct {
Role keyrole.KeyRole `pkl:"role" json:"role,omitempty" query:"role"`
Algorithm keyalgorithm.KeyAlgorithm `pkl:"algorithm"`
Encoding keyencoding.KeyEncoding `pkl:"encoding"`
Curve keycurve.KeyCurve `pkl:"curve"`
KeyType keytype.KeyType `pkl:"key_type"`
Raw string `pkl:"raw"`
Jwk *JWK `pkl:"jwk"`
}
@@ -1,46 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package assettype
import (
"encoding"
"fmt"
)
type AssetType string
const (
Native AssetType = "native"
Wrapped AssetType = "wrapped"
Staking AssetType = "staking"
Pool AssetType = "pool"
Ibc AssetType = "ibc"
Cw20 AssetType = "cw20"
)
// String returns the string representation of AssetType
func (rcv AssetType) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(AssetType)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for AssetType.
func (rcv *AssetType) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "native":
*rcv = Native
case "wrapped":
*rcv = Wrapped
case "staking":
*rcv = Staking
case "pool":
*rcv = Pool
case "ibc":
*rcv = Ibc
case "cw20":
*rcv = Cw20
default:
return fmt.Errorf(`illegal: "%s" is not a valid AssetType`, str)
}
return nil
}
@@ -1,52 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package didmethod
import (
"encoding"
"fmt"
)
type DIDMethod string
const (
Ipfs DIDMethod = "ipfs"
Sonr DIDMethod = "sonr"
Bitcoin DIDMethod = "bitcoin"
Ethereum DIDMethod = "ethereum"
Ibc DIDMethod = "ibc"
Webauthn DIDMethod = "webauthn"
Dwn DIDMethod = "dwn"
Service DIDMethod = "service"
)
// String returns the string representation of DIDMethod
func (rcv DIDMethod) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(DIDMethod)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for DIDMethod.
func (rcv *DIDMethod) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "ipfs":
*rcv = Ipfs
case "sonr":
*rcv = Sonr
case "bitcoin":
*rcv = Bitcoin
case "ethereum":
*rcv = Ethereum
case "ibc":
*rcv = Ibc
case "webauthn":
*rcv = Webauthn
case "dwn":
*rcv = Dwn
case "service":
*rcv = Service
default:
return fmt.Errorf(`illegal: "%s" is not a valid DIDMethod`, str)
}
return nil
}
-17
View File
@@ -1,17 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package orm
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
pkl.RegisterMapping("models#Account", Account{})
pkl.RegisterMapping("models#Asset", Asset{})
pkl.RegisterMapping("models#Chain", Chain{})
pkl.RegisterMapping("models#Credential", Credential{})
pkl.RegisterMapping("models#JWK", JWK{})
pkl.RegisterMapping("models#Grant", Grant{})
pkl.RegisterMapping("models#Keyshare", Keyshare{})
pkl.RegisterMapping("models#PublicKey", PublicKey{})
pkl.RegisterMapping("models#Profile", Profile{})
}
@@ -1,46 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keyalgorithm
import (
"encoding"
"fmt"
)
type KeyAlgorithm string
const (
Es256 KeyAlgorithm = "es256"
Es384 KeyAlgorithm = "es384"
Es512 KeyAlgorithm = "es512"
Eddsa KeyAlgorithm = "eddsa"
Es256k KeyAlgorithm = "es256k"
Ecdsa KeyAlgorithm = "ecdsa"
)
// String returns the string representation of KeyAlgorithm
func (rcv KeyAlgorithm) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyAlgorithm)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyAlgorithm.
func (rcv *KeyAlgorithm) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "es256":
*rcv = Es256
case "es384":
*rcv = Es384
case "es512":
*rcv = Es512
case "eddsa":
*rcv = Eddsa
case "es256k":
*rcv = Es256k
case "ecdsa":
*rcv = Ecdsa
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyAlgorithm`, str)
}
return nil
}
-58
View File
@@ -1,58 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keycurve
import (
"encoding"
"fmt"
)
type KeyCurve string
const (
P256 KeyCurve = "p256"
P384 KeyCurve = "p384"
P521 KeyCurve = "p521"
X25519 KeyCurve = "x25519"
X448 KeyCurve = "x448"
Ed25519 KeyCurve = "ed25519"
Ed448 KeyCurve = "ed448"
Secp256k1 KeyCurve = "secp256k1"
Bls12381 KeyCurve = "bls12381"
Keccak256 KeyCurve = "keccak256"
)
// String returns the string representation of KeyCurve
func (rcv KeyCurve) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyCurve)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyCurve.
func (rcv *KeyCurve) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "p256":
*rcv = P256
case "p384":
*rcv = P384
case "p521":
*rcv = P521
case "x25519":
*rcv = X25519
case "x448":
*rcv = X448
case "ed25519":
*rcv = Ed25519
case "ed448":
*rcv = Ed448
case "secp256k1":
*rcv = Secp256k1
case "bls12381":
*rcv = Bls12381
case "keccak256":
*rcv = Keccak256
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyCurve`, str)
}
return nil
}
@@ -1,37 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keyencoding
import (
"encoding"
"fmt"
)
type KeyEncoding string
const (
Raw KeyEncoding = "raw"
Hex KeyEncoding = "hex"
Multibase KeyEncoding = "multibase"
)
// String returns the string representation of KeyEncoding
func (rcv KeyEncoding) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyEncoding)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyEncoding.
func (rcv *KeyEncoding) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "raw":
*rcv = Raw
case "hex":
*rcv = Hex
case "multibase":
*rcv = Multibase
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyEncoding`, str)
}
return nil
}
-40
View File
@@ -1,40 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keyrole
import (
"encoding"
"fmt"
)
type KeyRole string
const (
Authentication KeyRole = "authentication"
Assertion KeyRole = "assertion"
Delegation KeyRole = "delegation"
Invocation KeyRole = "invocation"
)
// String returns the string representation of KeyRole
func (rcv KeyRole) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyRole)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyRole.
func (rcv *KeyRole) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "authentication":
*rcv = Authentication
case "assertion":
*rcv = Assertion
case "delegation":
*rcv = Delegation
case "invocation":
*rcv = Invocation
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyRole`, str)
}
return nil
}
@@ -1,34 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keysharerole
import (
"encoding"
"fmt"
)
type KeyShareRole string
const (
User KeyShareRole = "user"
Validator KeyShareRole = "validator"
)
// String returns the string representation of KeyShareRole
func (rcv KeyShareRole) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyShareRole)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyShareRole.
func (rcv *KeyShareRole) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "user":
*rcv = User
case "validator":
*rcv = Validator
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyShareRole`, str)
}
return nil
}
-55
View File
@@ -1,55 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package keytype
import (
"encoding"
"fmt"
)
type KeyType string
const (
Octet KeyType = "octet"
Elliptic KeyType = "elliptic"
Rsa KeyType = "rsa"
Symmetric KeyType = "symmetric"
Hmac KeyType = "hmac"
Mpc KeyType = "mpc"
Zk KeyType = "zk"
Webauthn KeyType = "webauthn"
Bip32 KeyType = "bip32"
)
// String returns the string representation of KeyType
func (rcv KeyType) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(KeyType)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyType.
func (rcv *KeyType) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "octet":
*rcv = Octet
case "elliptic":
*rcv = Elliptic
case "rsa":
*rcv = Rsa
case "symmetric":
*rcv = Symmetric
case "hmac":
*rcv = Hmac
case "mpc":
*rcv = Mpc
case "zk":
*rcv = Zk
case "webauthn":
*rcv = Webauthn
case "bip32":
*rcv = Bip32
default:
return fmt.Errorf(`illegal: "%s" is not a valid KeyType`, str)
}
return nil
}
@@ -1,46 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package permissiongrant
import (
"encoding"
"fmt"
)
type PermissionGrant string
const (
None PermissionGrant = "none"
Read PermissionGrant = "read"
Write PermissionGrant = "write"
Verify PermissionGrant = "verify"
Broadcast PermissionGrant = "broadcast"
Admin PermissionGrant = "admin"
)
// String returns the string representation of PermissionGrant
func (rcv PermissionGrant) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(PermissionGrant)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for PermissionGrant.
func (rcv *PermissionGrant) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "none":
*rcv = None
case "read":
*rcv = Read
case "write":
*rcv = Write
case "verify":
*rcv = Verify
case "broadcast":
*rcv = Broadcast
case "admin":
*rcv = Admin
default:
return fmt.Errorf(`illegal: "%s" is not a valid PermissionGrant`, str)
}
return nil
}
@@ -1,49 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package permissionscope
import (
"encoding"
"fmt"
)
type PermissionScope string
const (
Profile PermissionScope = "profile"
Metadata PermissionScope = "metadata"
Permissions PermissionScope = "permissions"
Wallets PermissionScope = "wallets"
Transactions PermissionScope = "transactions"
User PermissionScope = "user"
Validator PermissionScope = "validator"
)
// String returns the string representation of PermissionScope
func (rcv PermissionScope) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(PermissionScope)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for PermissionScope.
func (rcv *PermissionScope) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "profile":
*rcv = Profile
case "metadata":
*rcv = Metadata
case "permissions":
*rcv = Permissions
case "wallets":
*rcv = Wallets
case "transactions":
*rcv = Transactions
case "user":
*rcv = User
case "validator":
*rcv = Validator
default:
return fmt.Errorf(`illegal: "%s" is not a valid PermissionScope`, str)
}
return nil
}
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"encoding/json"
fmt "fmt"
"github.com/onsonr/sonr/x/did/types/orm/keyalgorithm"
"github.com/onsonr/sonr/x/did/types/orm/keycurve"
"github.com/onsonr/sonr/x/did/types/orm/keyencoding"
"github.com/onsonr/sonr/x/did/types/orm/keyrole"
"github.com/onsonr/sonr/pkg/orm/keyalgorithm"
"github.com/onsonr/sonr/pkg/orm/keycurve"
"github.com/onsonr/sonr/pkg/orm/keyencoding"
"github.com/onsonr/sonr/pkg/orm/keyrole"
)
// DefaultParams returns default module parameters.
+1253 -33
View File
File diff suppressed because it is too large Load Diff
+238
View File
@@ -141,6 +141,150 @@ func local_request_Query_Resolve_0(ctx context.Context, marshaler runtime.Marsha
}
var (
filter_Query_Sign_0 = &utilities.DoubleArray{Encoding: map[string]int{"did": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_Sign_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySignRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sign_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Sign(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Sign_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QuerySignRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Sign_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Sign(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Query_Verify_0 = &utilities.DoubleArray{Encoding: map[string]int{"did": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}}
)
func request_Query_Verify_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryVerifyRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Verify_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Verify(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Query_Verify_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryVerifyRequest
var metadata runtime.ServerMetadata
var (
val string
ok bool
err error
_ = err
)
val, ok = pathParams["did"]
if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "did")
}
protoReq.Did, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "did", err)
}
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Verify_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Verify(ctx, &protoReq)
return msg, metadata, err
}
// RegisterQueryHandlerServer registers the http handlers for service Query to "mux".
// UnaryRPC :call QueryServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -193,6 +337,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
})
mux.Handle("POST", pattern_Query_Sign_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Sign_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Sign_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_Verify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Query_Verify_0(rctx, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Verify_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -274,6 +464,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
})
mux.Handle("POST", pattern_Query_Sign_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Sign_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Sign_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Query_Verify_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Query_Verify_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_Query_Verify_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
@@ -281,10 +511,18 @@ var (
pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"params"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Resolve_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0}, []string{"did"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Sign_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "sign"}, "", runtime.AssumeColonVerbOpt(false)))
pattern_Query_Verify_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 0, 2, 1}, []string{"did", "verify"}, "", runtime.AssumeColonVerbOpt(false)))
)
var (
forward_Query_Params_0 = runtime.ForwardResponseMessage
forward_Query_Resolve_0 = runtime.ForwardResponseMessage
forward_Query_Sign_0 = runtime.ForwardResponseMessage
forward_Query_Verify_0 = runtime.ForwardResponseMessage
)
+820 -69
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -34,3 +34,10 @@ func (ms msgServer) AuthorizeService(ctx context.Context, msg *types.MsgIssueMac
panic("AuthorizeService is unimplemented")
return &types.MsgIssueMacaroonResponse{}, nil
}
// IssueMacaroon implements types.MsgServer.
func (ms msgServer) IssueMacaroon(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
// ctx := sdk.UnwrapSDKContext(goCtx)
panic("IssueMacaroon is unimplemented")
return &types.MsgIssueMacaroonResponse{}, nil
}
+49 -49
View File
@@ -129,7 +129,7 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
// MsgIssueMacaroon is the message type for the AuthorizeService RPC.
// MsgIssueMacaroon is the message type for the IssueMacaroon RPC.
type MsgIssueMacaroon struct {
// Controller is the address of the controller to authenticate.
Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"`
@@ -202,7 +202,7 @@ func (m *MsgIssueMacaroon) GetToken() string {
return ""
}
// MsgIssueMacaroonResponse is the response type for the AuthorizeService
// MsgIssueMacaroonResponse is the response type for the IssueMacaroon
// RPC.
type MsgIssueMacaroonResponse struct {
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
@@ -267,39 +267,39 @@ func init() {
func init() { proto.RegisterFile("macaroon/v1/tx.proto", fileDescriptor_68f908349d9da51a) }
var fileDescriptor_68f908349d9da51a = []byte{
// 507 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0x4f, 0x6b, 0x13, 0x4f,
0x18, 0xce, 0x24, 0x6d, 0x7e, 0xbf, 0x4c, 0xc4, 0x86, 0x31, 0xd8, 0xed, 0xa2, 0x6b, 0x08, 0x8a,
0xa1, 0xe0, 0x2e, 0x89, 0x20, 0x25, 0x07, 0x21, 0x01, 0x0f, 0x0a, 0x81, 0xb0, 0x45, 0x10, 0x2f,
0xb2, 0xdd, 0x0c, 0xd3, 0xa1, 0xd9, 0x99, 0x65, 0xde, 0xd9, 0xd0, 0x78, 0x12, 0xcf, 0x1e, 0xfc,
0x02, 0x7e, 0x87, 0x1e, 0x3c, 0xf9, 0x09, 0x7a, 0x2c, 0x9e, 0x3c, 0x89, 0x24, 0x87, 0x7e, 0x0d,
0xd9, 0x7f, 0xcd, 0x76, 0x0f, 0xf1, 0x12, 0xe6, 0x99, 0xf7, 0x7d, 0x9e, 0xf7, 0x79, 0x9f, 0xec,
0xe0, 0x76, 0xe0, 0xf9, 0x9e, 0x92, 0x52, 0x38, 0x8b, 0xbe, 0xa3, 0xcf, 0xed, 0x50, 0x49, 0x2d,
0x49, 0x33, 0xbf, 0xb5, 0x17, 0x7d, 0x73, 0xdf, 0x97, 0x10, 0x48, 0x70, 0x02, 0x60, 0x71, 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x01, 0x00,
0x00, 0xff, 0xff, 0x0d, 0x7b, 0xef, 0xfd, 0xa6, 0x03, 0x00, 0x00,
// 497 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcf, 0x6b, 0x13, 0x41,
0x14, 0xce, 0x24, 0x6d, 0x34, 0x13, 0xb5, 0x61, 0x0c, 0x76, 0xbb, 0xe8, 0x1a, 0x82, 0x62, 0x28,
0xb8, 0x4b, 0x22, 0x48, 0xc9, 0x41, 0x68, 0xc0, 0x83, 0x42, 0x20, 0xac, 0xf4, 0xe2, 0x45, 0xb6,
0x9b, 0x61, 0xba, 0x34, 0x3b, 0x6f, 0x99, 0x37, 0x09, 0xcd, 0x4d, 0x3c, 0x7b, 0xf0, 0x1f, 0xf0,
0x7f, 0xe8, 0x41, 0xf0, 0x5f, 0xe8, 0xb1, 0x78, 0xf2, 0x24, 0x92, 0x1c, 0xfa, 0x6f, 0x48, 0xf6,
0x47, 0xb3, 0xd9, 0x43, 0xbc, 0x84, 0xf9, 0xe6, 0xbd, 0xef, 0x7b, 0xdf, 0xfb, 0xb2, 0x43, 0x9b,
0xa1, 0xe7, 0x7b, 0x0a, 0x40, 0x3a, 0xb3, 0xae, 0xa3, 0x2f, 0xec, 0x48, 0x81, 0x06, 0x56, 0xcf,
0x6e, 0xed, 0x59, 0xd7, 0xdc, 0xf7, 0x01, 0x43, 0x40, 0x27, 0x44, 0xb1, 0x6a, 0x0a, 0x51, 0x24,
0x5d, 0xe6, 0x41, 0x52, 0xf8, 0x14, 0x23, 0x27, 0x01, 0x69, 0xa9, 0x29, 0x40, 0x40, 0x72, 0xbf,
0x3a, 0x65, 0x84, 0xfc, 0x30, 0xc1, 0x25, 0xc7, 0x20, 0x25, 0xb4, 0xbf, 0x12, 0xba, 0x37, 0x44,
0x71, 0x12, 0x8d, 0x3d, 0xcd, 0x47, 0x9e, 0xf2, 0x42, 0x64, 0x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xa4, 0xbf, 0xb7, 0x4a, 0x2e, 0xb7, 0x50, 0xfb, 0x3d, 0x35, 0x8a, 0xc6, 0xb2,
0xec, 0x98, 0x41, 0xef, 0xe0, 0xd4, 0xf7, 0x39, 0x62, 0x2c, 0x7e, 0xd7, 0xcd, 0xe0, 0xda, 0x5c,
0x39, 0x67, 0xae, 0xf7, 0x93, 0xd0, 0xca, 0x10, 0x05, 0x73, 0xe9, 0xbd, 0x8d, 0x2f, 0xe3, 0x71,
0x31, 0x87, 0x7c, 0xd5, 0x7c, 0xb6, 0xad, 0x7a, 0xeb, 0xe5, 0x84, 0xde, 0xdf, 0xfc, 0x0f, 0x9f,
0x6c, 0x0d, 0xd7, 0x7c, 0xbe, 0xb5, 0x9c, 0xc9, 0x9a, 0xbb, 0x9f, 0x6f, 0x2e, 0x0f, 0xc9, 0xe0,
0xf8, 0x6a, 0x61, 0x91, 0xeb, 0x85, 0x45, 0xfe, 0x2e, 0x2c, 0xf2, 0x6d, 0x69, 0x95, 0xae, 0x97,
0x56, 0xe9, 0xf7, 0xd2, 0x2a, 0x7d, 0x7c, 0x21, 0x02, 0x7d, 0x36, 0x3d, 0xb5, 0x7d, 0x08, 0x1d,
0x90, 0x08, 0x52, 0x39, 0xf1, 0xcf, 0x85, 0x73, 0xfb, 0x3a, 0xf4, 0x3c, 0xe2, 0x78, 0x5a, 0x8d,
0x5f, 0xc6, 0xab, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x0f, 0x46, 0xf7, 0xa3, 0x03, 0x00,
0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@@ -318,9 +318,9 @@ type MsgClient interface {
//
// 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
// IssueMacaroon asserts the given controller is the owner of the given
// address.
AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error)
IssueMacaroon(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error)
}
type msgClient struct {
@@ -340,9 +340,9 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
return out, nil
}
func (c *msgClient) AuthorizeService(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) {
func (c *msgClient) IssueMacaroon(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) {
out := new(MsgIssueMacaroonResponse)
err := c.cc.Invoke(ctx, "/macaroon.v1.Msg/AuthorizeService", in, out, opts...)
err := c.cc.Invoke(ctx, "/macaroon.v1.Msg/IssueMacaroon", in, out, opts...)
if err != nil {
return nil, err
}
@@ -355,9 +355,9 @@ type MsgServer interface {
//
// Since: cosmos-sdk 0.47
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
// AuthorizeService asserts the given controller is the owner of the given
// IssueMacaroon asserts the given controller is the owner of the given
// address.
AuthorizeService(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error)
IssueMacaroon(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@@ -367,8 +367,8 @@ type UnimplementedMsgServer struct {
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
}
func (*UnimplementedMsgServer) AuthorizeService(ctx context.Context, req *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method AuthorizeService not implemented")
func (*UnimplementedMsgServer) IssueMacaroon(ctx context.Context, req *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IssueMacaroon not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
@@ -393,20 +393,20 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _Msg_AuthorizeService_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _Msg_IssueMacaroon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgIssueMacaroon)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).AuthorizeService(ctx, in)
return srv.(MsgServer).IssueMacaroon(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/macaroon.v1.Msg/AuthorizeService",
FullMethod: "/macaroon.v1.Msg/IssueMacaroon",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).AuthorizeService(ctx, req.(*MsgIssueMacaroon))
return srv.(MsgServer).IssueMacaroon(ctx, req.(*MsgIssueMacaroon))
}
return interceptor(ctx, in, info, handler)
}
@@ -420,8 +420,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
Handler: _Msg_UpdateParams_Handler,
},
{
MethodName: "AuthorizeService",
Handler: _Msg_AuthorizeService_Handler,
MethodName: "IssueMacaroon",
Handler: _Msg_IssueMacaroon_Handler,
},
},
Streams: []grpc.StreamDesc{},
+1 -1
View File
@@ -1,7 +1,7 @@
package types
import (
"github.com/onsonr/sonr/x/did/types/orm/assettype"
"github.com/onsonr/sonr/pkg/orm/assettype"
)
// this line is used by starport scaffolding # genesis/types/import
+7 -11
View File
@@ -4,24 +4,20 @@ import (
"context"
"time"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"cosmossdk.io/collections"
storetypes "cosmossdk.io/core/store"
"cosmossdk.io/log"
"cosmossdk.io/orm/model/ormdb"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/ipfs/kubo/client/rpc"
apiv1 "github.com/onsonr/sonr/api/vault/v1"
"github.com/onsonr/sonr/app/config/dwn"
"github.com/onsonr/sonr/x/vault/types"
"github.com/onsonr/sonr/pkg/dwn"
didkeeper "github.com/onsonr/sonr/x/did/keeper"
"github.com/onsonr/sonr/x/vault/types"
)
type Keeper struct {
+1 -18
View File
@@ -3,7 +3,6 @@ package keeper_test
import (
"testing"
apiv1 "github.com/onsonr/sonr/api/vault/v1"
"github.com/stretchr/testify/require"
)
@@ -11,21 +10,5 @@ func TestORM(t *testing.T) {
f := SetupTest(t)
dt := f.k.OrmDB.DWNTable()
acc := []byte("test_acc")
amt := uint64(7)
err := dt.Insert(f.ctx, &apiv1.DWN{
Account: acc,
Amount: amt,
})
require.NoError(t, err)
d, err := dt.Has(f.ctx, []byte("test_acc"))
require.NoError(t, err)
require.True(t, d)
res, err := dt.Get(f.ctx, []byte("test_acc"))
require.NoError(t, err)
require.NotNil(t, res)
require.EqualValues(t, amt, res.Amount)
require.NotNil(t, dt)
}
Binary file not shown.
+2 -1
View File
@@ -8,7 +8,8 @@ import (
"github.com/a-h/templ"
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/app/config/dwn"
"github.com/onsonr/sonr/pkg/dwn"
)
//go:embed app.wasm
+98 -48
View File
@@ -24,8 +24,9 @@ var _ = math.Inf
const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type DWN struct {
Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
Alias string `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
Cid string `protobuf:"bytes,3,opt,name=cid,proto3" json:"cid,omitempty"`
}
func (m *DWN) Reset() { *m = DWN{} }
@@ -61,20 +62,27 @@ func (m *DWN) XXX_DiscardUnknown() {
var xxx_messageInfo_DWN proto.InternalMessageInfo
func (m *DWN) GetAccount() []byte {
func (m *DWN) GetId() uint64 {
if m != nil {
return m.Account
}
return nil
}
func (m *DWN) GetAmount() uint64 {
if m != nil {
return m.Amount
return m.Id
}
return 0
}
func (m *DWN) GetAlias() string {
if m != nil {
return m.Alias
}
return ""
}
func (m *DWN) GetCid() string {
if m != nil {
return m.Cid
}
return ""
}
func init() {
proto.RegisterType((*DWN)(nil), "vault.v1.DWN")
}
@@ -82,20 +90,21 @@ func init() {
func init() { proto.RegisterFile("vault/v1/state.proto", fileDescriptor_2ad3e71ba384142e) }
var fileDescriptor_2ad3e71ba384142e = []byte{
// 198 bytes of a gzipped FileDescriptorProto
// 221 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4b, 0x2c, 0xcd,
0x29, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9,
0x17, 0xe2, 0x00, 0x8b, 0xea, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb,
0xe7, 0x17, 0xe5, 0x82, 0x14, 0xe5, 0x17, 0xe5, 0x42, 0x94, 0x28, 0x45, 0x70, 0x31, 0xbb, 0x84,
0xfb, 0x09, 0x49, 0x70, 0xb1, 0x27, 0x26, 0x27, 0xe7, 0x97, 0xe6, 0x95, 0x48, 0x30, 0x2a, 0x30,
0x6a, 0xf0, 0x04, 0xc1, 0xb8, 0x42, 0x62, 0x5c, 0x6c, 0x89, 0x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xdc,
0x50, 0x7d, 0x02, 0x8c, 0x12, 0x8c, 0x42, 0x9c, 0x60, 0xe5, 0x02, 0x4c, 0x12, 0x8c, 0x12, 0x8c,
0x4e, 0x76, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84,
0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x92, 0x9e, 0x59,
0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, 0x9f, 0x57, 0x9c, 0x9f, 0x57, 0xa4, 0x0f,
0x26, 0x2a, 0xf4, 0x21, 0x9e, 0x2a, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xd7, 0x18,
0x10, 0x00, 0x00, 0xff, 0xff, 0xf5, 0xfb, 0x2a, 0xb2, 0xea, 0x00, 0x00, 0x00,
}
func (m *DWN) Marshal() (dAtA []byte, err error) {
@@ -118,17 +127,24 @@ func (m *DWN) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if m.Amount != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Amount))
if len(m.Cid) > 0 {
i -= len(m.Cid)
copy(dAtA[i:], m.Cid)
i = encodeVarintState(dAtA, i, uint64(len(m.Cid)))
i--
dAtA[i] = 0x10
dAtA[i] = 0x1a
}
if len(m.Account) > 0 {
i -= len(m.Account)
copy(dAtA[i:], m.Account)
i = encodeVarintState(dAtA, i, uint64(len(m.Account)))
if len(m.Alias) > 0 {
i -= len(m.Alias)
copy(dAtA[i:], m.Alias)
i = encodeVarintState(dAtA, i, uint64(len(m.Alias)))
i--
dAtA[i] = 0xa
dAtA[i] = 0x12
}
if m.Id != 0 {
i = encodeVarintState(dAtA, i, uint64(m.Id))
i--
dAtA[i] = 0x8
}
return len(dAtA) - i, nil
}
@@ -150,12 +166,16 @@ func (m *DWN) Size() (n int) {
}
var l int
_ = l
l = len(m.Account)
if m.Id != 0 {
n += 1 + sovState(uint64(m.Id))
}
l = len(m.Alias)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
if m.Amount != 0 {
n += 1 + sovState(uint64(m.Amount))
l = len(m.Cid)
if l > 0 {
n += 1 + l + sovState(uint64(l))
}
return n
}
@@ -196,10 +216,10 @@ func (m *DWN) Unmarshal(dAtA []byte) error {
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Account", wireType)
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
}
var byteLen int
m.Id = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -209,31 +229,48 @@ func (m *DWN) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= int(b&0x7F) << shift
m.Id |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Alias", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + byteLen
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Account = append(m.Account[:0], dAtA[iNdEx:postIndex]...)
if m.Account == nil {
m.Account = []byte{}
}
m.Alias = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType)
}
m.Amount = 0
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowState
@@ -243,11 +280,24 @@ func (m *DWN) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Amount |= uint64(b&0x7F) << shift
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthState
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthState
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Cid = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipState(dAtA[iNdEx:])
+1 -1
View File
@@ -3,7 +3,7 @@ package types
import (
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/app/config/dwn"
"github.com/onsonr/sonr/pkg/dwn"
vault "github.com/onsonr/sonr/x/vault/types/internal"
)