feat: add Motr support

This commit is contained in:
Prad Nukala
2024-10-06 11:39:23 -04:00
parent b1e5464843
commit 62628ed0d8
12 changed files with 62 additions and 117 deletions
+3 -22
View File
@@ -43,6 +43,9 @@
"build:nebula": [
"make nebula"
],
"build:motr": [
"make motr"
],
"build:sonrd": [
"make motr",
"make build"
@@ -61,33 +64,11 @@
"gen:templ": [
"make templ"
],
"start:hway": [
"make templ",
"make hway",
"make start-hway"
],
"start:testnet": [
"make templ",
"make install",
"make sh-testnet"
],
"start": [
"process-compose up -f ./deploy/testnet/process-compose.yaml"
],
"stop": [
"process-compose down -f ./deploy/testnet/process-compose.yaml"
],
"test:e2e": [
"make templ",
"make test-e2e"
],
"test:unit": [
"make templ",
"make test-unit"
],
"test": [
"make templ",
"make test"
]
}
}
+5 -5
View File
@@ -2,13 +2,13 @@
package dwn
type Config struct {
Ipfs *IPFS `pkl:"ipfs" json:"ipfs,omitempty"`
Ipfs *IPFS `pkl:"ipfs"`
Sonr *Sonr `pkl:"sonr" json:"sonr,omitempty"`
Sonr *Sonr `pkl:"sonr"`
Motr *Motr `pkl:"motr" json:"motr,omitempty"`
Motr *Motr `pkl:"motr"`
Schema *Schema `pkl:"schema" json:"schema,omitempty"`
Schema *Schema `pkl:"schema"`
ProxyUrl string `pkl:"proxyUrl" json:"proxyUrl,omitempty"`
ProxyUrl string `pkl:"proxyUrl"`
}
+2 -2
View File
@@ -2,7 +2,7 @@
package dwn
type IPFS struct {
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
ApiUrl string `pkl:"apiUrl"`
GatewayUrl string `pkl:"gatewayUrl" json:"gatewayUrl,omitempty"`
GatewayUrl string `pkl:"gatewayUrl"`
}
+3 -3
View File
@@ -2,9 +2,9 @@
package dwn
type Motr struct {
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
Keyshare string `pkl:"keyshare"`
Address string `pkl:"address" json:"address,omitempty"`
Address string `pkl:"address"`
Origin string `pkl:"origin" json:"origin,omitempty"`
Origin string `pkl:"origin"`
}
+8 -8
View File
@@ -4,19 +4,19 @@ package dwn
type Schema struct {
Version int `pkl:"version"`
Account string `pkl:"account" json:"account,omitempty"`
Account string `pkl:"account"`
Asset string `pkl:"asset" json:"asset,omitempty"`
Asset string `pkl:"asset"`
Chain string `pkl:"chain" json:"chain,omitempty"`
Chain string `pkl:"chain"`
Credential string `pkl:"credential" json:"credential,omitempty"`
Credential string `pkl:"credential"`
Jwk string `pkl:"jwk" json:"jwk,omitempty"`
Jwk string `pkl:"jwk"`
Grant string `pkl:"grant" json:"grant,omitempty"`
Grant string `pkl:"grant"`
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
Keyshare string `pkl:"keyshare"`
Profile string `pkl:"profile" json:"profile,omitempty"`
Profile string `pkl:"profile"`
}
+5 -5
View File
@@ -2,13 +2,13 @@
package dwn
type Sonr struct {
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
ApiUrl string `pkl:"apiUrl"`
GrpcUrl string `pkl:"grpcUrl" json:"grpcUrl,omitempty"`
GrpcUrl string `pkl:"grpcUrl"`
RpcUrl string `pkl:"rpcUrl" json:"rpcUrl,omitempty"`
RpcUrl string `pkl:"rpcUrl"`
WebSocketUrl string `pkl:"webSocketUrl" json:"webSocketUrl,omitempty"`
WebSocketUrl string `pkl:"webSocketUrl"`
ChainId string `pkl:"chainId" json:"chainId,omitempty"`
ChainId string `pkl:"chainId"`
}
+31
View File
@@ -0,0 +1,31 @@
amends "https://pkl.sh/DWN.pkl";
dwn = new Config {
ipfs = new IPFS {
apiUrl = "https://api.sonr-ipfs.land";
gatewayUrl = "https://ipfs.sonr.land";
};
sonr = new Sonr {
apiUrl = "https://api.sonr.land";
grpcUrl = "https://grpc.sonr.land";
rpcUrl = "https://rpc.sonr.land";
webSocketUrl = "wss://rpc.sonr.land/ws";
chainId = "sonr";
};
motr = new Motr {
keyshare = JSON.parse(keyshare);
address = address;
origin = "sonr.id";
};
schema = new Schema {
version = 1;
account = "account";
asset = "asset";
chain = "chain";
credential = "credential";
jwk = "jwk";
grant = "grant";
keyshare = "keyshare";
profile = "profile";
};
};
+1 -1
View File
@@ -6,7 +6,7 @@ type Feature struct {
Description string `pkl:"description"`
Icon string `pkl:"icon"`
Icon *string `pkl:"icon"`
Image *Image `pkl:"image"`
}
+1 -1
View File
@@ -6,5 +6,5 @@ type Highlights struct {
Subheading string `pkl:"subheading"`
Highlights []*Highlight `pkl:"highlights"`
Highlights []*Feature `pkl:"highlights"`
}
-12
View File
@@ -3,16 +3,4 @@ package models
type Home struct {
Hero *Hero `pkl:"hero"`
Highlights []*Highlight `pkl:"highlights"`
Features []*Features `pkl:"features"`
Bento *Bento `pkl:"bento"`
Lowlights []*Lowlights `pkl:"lowlights"`
CallToAction *CallToAction `pkl:"callToAction"`
Footer *Footer `pkl:"footer"`
}
+2 -8
View File
@@ -10,15 +10,9 @@ func init() {
pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#Highlight", Highlight{})
pkl.RegisterMapping("models#Features", Features{})
pkl.RegisterMapping("models#Bento", Bento{})
pkl.RegisterMapping("models#Lowlights", Lowlights{})
pkl.RegisterMapping("models#CallToAction", CallToAction{})
pkl.RegisterMapping("models#Footer", Footer{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Feature", Feature{})
pkl.RegisterMapping("models#Highlights", Highlights{})
}
+1 -50
View File
@@ -6,92 +6,43 @@ import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias JSON = String
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
class Config {
@JsonField
ipfs: IPFS
@JsonField
sonr: Sonr
@JsonField
motr: Motr
@JsonField
schema: Schema
@JsonField
proxyUrl: String
}
class IPFS {
@JsonField
apiUrl: String
@JsonField
gatewayUrl: String
}
class Motr {
@JsonField
keyshare: JSON
@JsonField
address: String
@JsonField
origin: String
}
class Schema {
version: Int
@JsonField
account: String
@JsonField
asset: String
@JsonField
chain: String
@JsonField
credential: String
@JsonField
jwk: String
@JsonField
grant: String
@JsonField
keyshare: String
@JsonField
profile: String
}
class Sonr {
@JsonField
apiUrl: String
@JsonField
grpcUrl: String
@JsonField
rpcUrl: String
@JsonField
webSocketUrl: String
@JsonField
chainId: String
}
dwn : Config