Documentation ¶
Index ¶
- Constants
- func GetId(d Payload) (string, error)
- func SubnetToByte(i uint64) []byte
- func TopicToByte(i uint64) []byte
- type Authorization
- type Block
- type Channel
- type ClaimData
- type ClientHandshake
- type ClientPayload
- func (msg ClientPayload) EncodeBytes() ([]byte, error)
- func (msg ClientPayload) GetHash() ([]byte, error)
- func (msg ClientPayload) GetSigner() (DeviceString, error)
- func (eP ClientPayload) GormDataType() string
- func (eP ClientPayload) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (s *ClientPayload) MsgPack() []byte
- func (sD *ClientPayload) Scan(value interface{}) error
- func (msg ClientPayload) ToJSON() []byte
- func (msg *ClientPayload) ToString() (string, error)
- func (sD *ClientPayload) Value() (driver.Value, error)
- type ClientResponse
- type ConnectionState
- type DID
- type DIDString
- type DeliveryClaim
- type DeliveryProof
- type DeviceString
- type EntityModel
- type EntityPath
- func (eP EntityPath) GormDataType() string
- func (eP EntityPath) GormValue(ctx context.Context, db *gorm.DB) clause.Expr
- func (e *EntityPath) MsgPack() []byte
- func (sD *EntityPath) Scan(value interface{}) error
- func (e *EntityPath) ToString() string
- func (sD *EntityPath) Value() (driver.Value, error)
- type ErrorResponse
- type Event
- func (d *Event) BeforeCreate(tx *gorm.DB) (err error)
- func (e Event) EncodeBytes() ([]byte, error)
- func (e *Event) GetDataModelType() EntityModel
- func (e Event) GetHash() ([]byte, error)
- func (e *Event) GetPath() *EventPath
- func (e Event) GetSignature() string
- func (e Event) GetValidator() PublicKeyString
- func (e *Event) Key() string
- func (e *Event) MsgPack() []byte
- func (e *Event) ToJSON() []byte
- func (e Event) ToString() string
- type EventInterface
- type EventPath
- type MainStat
- type Message
- func (msg Message) EncodeBytes() ([]byte, error)
- func (entity Message) GetAgent() DeviceString
- func (entity Message) GetEvent() EventPath
- func (msg Message) GetHash() ([]byte, error)
- func (msg *Message) MsgPack() []byte
- func (msg *Message) ToJSON() string
- func (chatMessage Message) ToString() string
- type MessageAction
- type MessageAttachment
- type Meta
- type Payload
- type Presence
- type ProofData
- type PubKeyType
- type PubSubMessage
- type PublicKeyString
- type RegisterationData
- type ResponseInterval
- type ResponseMeta
- type ResponsePayload
- type RewardBatch
- func (msg *RewardBatch) Append(subnetCount SubnetCount)
- func (msg *RewardBatch) Clear()
- func (msg *RewardBatch) EncodeBytes() ([]byte, error)
- func (rb *RewardBatch) GetHash(chainId configs.ChainId) ([32]byte, error)
- func (msg *RewardBatch) GetProofData(chainId configs.ChainId) *ProofData
- func (msg *RewardBatch) MsgPack() []byte
- type ServerIdentity
- type SignatureData
- type SignatureRequestData
- type Stats
- type Subnet
- func (p *Subnet) CanSend(channel string, sender DIDString) bool
- func (item Subnet) EncodeBytes() ([]byte, error)
- func (entity Subnet) GetAgent() DeviceString
- func (entity Subnet) GetEvent() EventPath
- func (item Subnet) GetHash() ([]byte, error)
- func (p *Subnet) IsMember(channel string, sender DIDString) bool
- func (item *Subnet) Key() string
- func (item *Subnet) MsgPack() []byte
- func (item *Subnet) ToJSON() []byte
- func (item Subnet) ToString() string
- type SubnetCount
- type Subscription
- func (sub Subscription) EncodeBytes() ([]byte, error)
- func (sub Subscription) GetAgent() DeviceString
- func (sub Subscription) GetEvent() EventPath
- func (sub Subscription) GetHash() ([]byte, error)
- func (sub *Subscription) Key() string
- func (sub Subscription) MsgPack() []byte
- func (sub Subscription) ToJSON() []byte
- func (subscription Subscription) ToString() string
- type SuccessResponse
- type SyncRequest
- type SyncResponse
- type Topic
- func (p *Topic) CanSend(channel string, sender DIDString) bool
- func (topic Topic) EncodeBytes() ([]byte, error)
- func (topic Topic) GetAgent() DeviceString
- func (topic Topic) GetEvent() EventPath
- func (topic Topic) GetHash() ([]byte, error)
- func (p *Topic) IsMember(channel string, sender DIDString) bool
- func (topic *Topic) Key() string
- func (topic *Topic) MsgPack() []byte
- func (topic *Topic) ToJSON() []byte
- func (topic Topic) ToString() string
- type TopicResponse
- type Wallet
- func (d *Wallet) BeforeCreate(tx *gorm.DB) (err error)
- func (e Wallet) EncodeBytes() ([]byte, error)
- func (entity Wallet) GetAgent() DeviceString
- func (entity Wallet) GetEvent() EventPath
- func (e Wallet) GetHash() ([]byte, error)
- func (e *Wallet) MsgPack() []byte
- func (e *Wallet) ToJSON() []byte
- func (e Wallet) ToString() string
- type WalletBalance
- func (d *WalletBalance) BeforeCreate(tx *gorm.DB) (err error)
- func (e WalletBalance) EncodeBytes() ([]byte, error)
- func (entity WalletBalance) GetAgent() DeviceString
- func (entity WalletBalance) GetEvent() EventPath
- func (e WalletBalance) GetHash() ([]byte, error)
- func (e *WalletBalance) MsgPack() []byte
- func (e *WalletBalance) ToJSON() []byte
- func (e WalletBalance) ToString() string
Constants ¶
View Source
const ( PlatformEthereum string = "ethereum" PlatformBitcoin string = "bitcoin" PlatformSolana = "solana" PlatformCosmos = "cosmos" )
View Source
const MaxBatchSize = 100
Variables ¶
This section is empty.
Functions ¶
func SubnetToByte ¶
func TopicToByte ¶
Types ¶
type Authorization ¶
type Authorization struct { ID string `json:"id" gorm:"type:uuid;not null;primaryKey"` Agent DeviceString `json:"agt" gorm:"uniqueIndex:idx_agent_account_subnet;index:idx_authorization_states_agent"` Meta string `json:"meta,omitempty"` Account DIDString `json:"acct" gorm:"varchar(40);"` Grantor DIDString `json:"gr" gorm:"index"` Priviledge *constants.AuthorizationPrivilege `json:"privi" gorm:""` TopicIds string `json:"topIds"` Timestamp *uint64 `json:"ts"` Duration *uint64 `json:"du"` SignatureData SignatureData `json:"sigD" gorm:"json;"` Hash string `json:"h" gorm:"unique" ` Event EventPath `json:"e,omitempty" gorm:"index;varchar;"` Subnet string `json:"snet" gorm:"uniqueIndex:idx_agent_account_subnet;char(36)"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` }
func UnpackAuthorization ¶ added in v1.2.0
func UnpackAuthorization(b []byte) (Authorization, error)
func (Authorization) EncodeBytes ¶
func (g Authorization) EncodeBytes() ([]byte, error)
func (Authorization) GetAgent ¶
func (entity Authorization) GetAgent() DeviceString
func (Authorization) GetEvent ¶
func (entity Authorization) GetEvent() EventPath
func (Authorization) GetHash ¶
func (g Authorization) GetHash() ([]byte, error)
func (Authorization) ToJSON ¶
func (g Authorization) ToJSON() []byte
func (Authorization) ToString ¶
func (g Authorization) ToString() string
type Block ¶
type Block struct { BlockId string `json:"blId"` Size int `json:"s"` Closed bool `json:"c"` NodeHeight uint64 `json:"nh"` Hash string `json:"h"` Timestamp int `json:"ts"` sync.Mutex }
Block
func BlockFromBytes ¶
func UnpackBlock ¶
type Channel ¶ added in v1.2.0
type Channel struct { // Messages is a channel of messages received from other peers in the chat channel Messages chan PubSubMessage Ctx context.Context Topic *pubsub.Topic ChannelName string ID peer.ID Wallet string // contains filtered or unexported fields }
var AuthorizationPubSub Channel
var MessagePubSub Channel
var SubnetPubSub Channel
var SubscriptionPubSub Channel
var TopicPubSub Channel
var WalletPubSub Channel
func JoinChannel ¶ added in v1.2.0
func (*Channel) Publish ¶ added in v1.2.0
func (cr *Channel) Publish(m PubSubMessage) error
Publish sends a message to the pubsub topic.
type ClientHandshake ¶
type ClientHandshake struct { Signature string `json:"sig"` Signer DIDString `json:"sigr"` // Message string `json:"m"` Protocol constants.Protocol `json:"proto"` ClientSocket *interface{} `json:"ws"` ChainId configs.ChainId `json:"chId"` Timestamp int64 `json:"ts"` }
func UnpackClientHandshake ¶
func UnpackClientHandshake(b []byte) (ClientHandshake, error)
func (ClientHandshake) EncodeBytes ¶
func (cs ClientHandshake) EncodeBytes() ([]byte, error)
func (*ClientHandshake) MsgPack ¶
func (hs *ClientHandshake) MsgPack() []byte
func (ClientHandshake) ToJSON ¶
func (cs ClientHandshake) ToJSON() []byte
type ClientPayload ¶
type ClientPayload struct { // Primary Data interface{} `json:"d"` Timestamp uint64 `json:"ts"` EventType uint16 `json:"ty"` Nonce uint64 `json:"nonce"` Account DIDString `json:"acct,omitempty"` // optional public key of sender ChainId configs.ChainId `json:"chId"` // optional public key of sender Validator string `json:"val,omitempty"` // Secondary AA ` qaZAA `q1aZaswq21“ ` ` Signature string `json:"sig"` Hash string `json:"h,omitempty"` Agent DeviceString `gorm:"-" json:"agt"` Subnet string `json:"snet" gorm:"index;"` Page uint16 `json:"page,omitempty" gorm:"_"` PerPage uint16 `json:"perPage,omitempty" gorm:"_"` }
func ClientPayloadFromBytes ¶
func ClientPayloadFromBytes(b []byte) (ClientPayload, error)
func MsgUnpackClientPayload ¶
func MsgUnpackClientPayload(b []byte) (ClientPayload, error)
func (ClientPayload) EncodeBytes ¶
func (msg ClientPayload) EncodeBytes() ([]byte, error)
func (ClientPayload) GetHash ¶
func (msg ClientPayload) GetHash() ([]byte, error)
func (ClientPayload) GetSigner ¶
func (msg ClientPayload) GetSigner() (DeviceString, error)
func (ClientPayload) GormDataType ¶ added in v1.2.16
func (eP ClientPayload) GormDataType() string
func (*ClientPayload) MsgPack ¶
func (s *ClientPayload) MsgPack() []byte
func (*ClientPayload) Scan ¶ added in v1.2.16
func (sD *ClientPayload) Scan(value interface{}) error
func (ClientPayload) ToJSON ¶
func (msg ClientPayload) ToJSON() []byte
func (*ClientPayload) ToString ¶
func (msg *ClientPayload) ToString() (string, error)
type ClientResponse ¶
type ClientResponse struct { Data any `json:"data"` Error string `json:"error,omitempty"` Meta ResponseMeta `json:"_meta"` }
func NewClientResponse ¶
func NewClientResponse(cr ClientResponse) ClientResponse
func (ClientResponse) ToMap ¶
func (cr ClientResponse) ToMap() map[string]any
type ConnectionState ¶
type ConnectionState uint8
const ( OfflineState ConnectionState = 0 OnlineState ConnectionState = 1 )
type DID ¶
type DID struct { Prefix string `json:"pre"` Addr string `json:"addr"` // Platform string `json:"p"` Chain string `json:"ch"` }
func AddressFromBytes ¶
func AddressFromString ¶
func (DID) ToDeviceString ¶
func (address DID) ToDeviceString() DeviceString
type DeliveryClaim ¶
type DeliveryClaim struct { NodeHeight int `json:"nh"` Signature string `json:"sig"` Amount string `json:"a"` Proofs []string `json:"prs"` }
DeliveryClaim
func DeliveryClaimFromBytes ¶
func DeliveryClaimFromBytes(b []byte) (DeliveryClaim, error)
func UnpackDelvieryClaim ¶
func UnpackDelvieryClaim(b []byte) (DeliveryClaim, error)
func (*DeliveryClaim) ToJSON ¶
func (msg *DeliveryClaim) ToJSON() []byte
type DeliveryProof ¶
type DeliveryProof struct { MessageHash string `json:"mH"` MessageSender string `json:"mS"` OperatorAddress string `json:"nA"` Timestamp int `json:"ts"` Signature string `json:"sig"` Block string `json:"bl"` Index int `json:"i"` }
DeliveryProof
func DeliveryProofFromBytes ¶
func DeliveryProofFromBytes(b []byte) (DeliveryProof, error)
func (*DeliveryProof) BlockKey ¶
func (msg *DeliveryProof) BlockKey() string
func (DeliveryProof) EncodeBytes ¶
func (msg DeliveryProof) EncodeBytes() ([]byte, error)
func (*DeliveryProof) Key ¶
func (msg *DeliveryProof) Key() string
func (*DeliveryProof) MsgPack ¶
func (msg *DeliveryProof) MsgPack() []byte
func (*DeliveryProof) ToJSON ¶
func (msg *DeliveryProof) ToJSON() []byte
func (DeliveryProof) ToString ¶
func (msg DeliveryProof) ToString() string
type DeviceString ¶
type DeviceString DIDString
func StringToDeviceString ¶ added in v1.2.0
func StringToDeviceString(str string) DeviceString
type EntityModel ¶ added in v1.2.0
type EntityModel string
const ( AuthModel EntityModel = "auth" TopicModel EntityModel = "top" SubscriptionModel EntityModel = "sub" MessageModel EntityModel = "msg" SubnetModel EntityModel = "snet" WalletModel EntityModel = "wal" )
func GetModel ¶ added in v1.2.0
func GetModel(ent any) EntityModel
type EntityPath ¶ added in v1.2.0
type EntityPath struct { Model EntityModel `json:"mod"` Hash string `json:"h"` Validator PublicKeyString `json:"val"` }
* Event paths define the unique path to an event and its relation to the entitie
*
func EntityPathFromString ¶ added in v1.2.0
func EntityPathFromString(path string) *EntityPath
func NewEntityPath ¶ added in v1.2.0
func NewEntityPath(validator PublicKeyString, model EntityModel, hash string) *EntityPath
func UnpackEntityPath ¶ added in v1.2.0
func UnpackEntityPath(b []byte) (*EntityPath, error)
func (EntityPath) GormDataType ¶ added in v1.2.0
func (eP EntityPath) GormDataType() string
func (*EntityPath) MsgPack ¶ added in v1.2.0
func (e *EntityPath) MsgPack() []byte
func (*EntityPath) Scan ¶ added in v1.2.0
func (sD *EntityPath) Scan(value interface{}) error
func (*EntityPath) ToString ¶ added in v1.2.0
func (e *EntityPath) ToString() string
type ErrorResponse ¶
type ErrorResponse struct {
// contains filtered or unexported fields
}
func ReturnError ¶
func ReturnError(msg string, code int) *ErrorResponse
type Event ¶
type Event struct { // Primary ID string `gorm:"primaryKey;type:uuid;not null" json:"id,omitempty"` Payload ClientPayload `json:"pld" msgpack:",noinline"` Nonce string `json:"nonce" gorm:"type:varchar(80);default:null" msgpack:",noinline"` Timestamp uint64 `json:"ts"` EventType uint16 `json:"t"` Associations []string `json:"assoc" gorm:"type:text[]"` PreviousEventHash EventPath `json:"preE" gorm:"type:varchar;default:null"` AuthEventHash EventPath `json:"authE" gorm:"type:varchar;default:null"` PayloadHash string `json:"pH" gorm:"type:char(64);unique"` // StateHash string `json:"sh"` // Secondary Error string `json:"err"` Hash string `json:"h" gorm:"type:char(64)"` Signature string `json:"sig"` Broadcasted bool `json:"br"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` IsValid bool `json:"isVal" gorm:"default:false"` Synced bool `json:"sync" gorm:"default:false"` Validator PublicKeyString `json:"val"` Subnet string `json:"snet"` Total int `json:"total"` }
func EventFromJSON ¶
func GetEventEntityFromModel ¶ added in v1.2.0
func GetEventEntityFromModel(eventType EntityModel) *Event
func UnpackEvent ¶
func UnpackEvent(b []byte, model EntityModel) (*Event, error)
func WalletBalanceFromJSON ¶
func WalletFromJSON ¶
func (Event) EncodeBytes ¶
func (*Event) GetDataModelType ¶ added in v1.2.0
func (e *Event) GetDataModelType() EntityModel
func (Event) GetSignature ¶
func (Event) GetValidator ¶
func (e Event) GetValidator() PublicKeyString
type EventInterface ¶
type EventInterface interface { EncodeBytes() ([]byte, error) GetValidator() PublicKeyString GetSignature() string ValidateData(config *configs.MainConfiguration) (authState any, err error) }
type EventPath ¶
type EventPath struct {
EntityPath
}
func EventPathFromString ¶
func NewEventPath ¶
func NewEventPath(validator PublicKeyString, model EntityModel, hash string) *EventPath
func UnpackEventPath ¶ added in v1.2.0
type Message ¶
type Message struct { ID string `json:"id" gorm:"type:uuid;primaryKey;not null"` // Timestamp uint64 `json:"ts"` Topic string `json:"top,omitempty"` Sender DIDString `json:"s"` // OwnerAddress string `json:"oA"` Receiver DIDString `json:"r,omitempty"` Data string `json:"d"` DataType constants.DataType `json:"dTy"` Actions []MessageAction `json:"a" gorm:"json;"` // Length int `json:"len"` Agent DeviceString `json:"agt,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` Nonce uint64 `json:"nonce,omitempty" binding:"required"` /// DERIVED Event EventPath `json:"e,omitempty" gorm:"index;char(64);"` Hash string `json:"h"` // Attachments []MessageAttachment `json:"atts" gorm:"json;"` // Subject string `json:"s"` Signature string `json:"sig"` // Origin string `json:"o"` DataHash string `json:"dH"` Url string `json:"url"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` // DEPRECATED COLUMNS TopicId string `json:"-" gorm:"-" msgpack:"-"` Attachments string `json:"-" gorm:"-" msgpack:"-"` }
func MessageFromBytes ¶
func MessageFromString ¶
func UnpackMessage ¶ added in v1.2.0
func (Message) EncodeBytes ¶
func (Message) GetAgent ¶
func (entity Message) GetAgent() DeviceString
type MessageAction ¶
type MessageAction struct { Contract string `json:"c"` Abi string `json:"abi"` Action string `json:"a"` Parameters []string `json:"pa"` }
func (MessageAction) EncodeBytes ¶
func (a MessageAction) EncodeBytes() []byte
type MessageAttachment ¶
func (MessageAttachment) EncodeBytes ¶
func (b MessageAttachment) EncodeBytes() []byte
type Presence ¶
type Presence struct { Account DIDString `json:"acct"` MetaData json.RawMessage `json:"metaD"` ConnectionState ConnectionState `json:"connS"` ActiveAgo uint64 `json:"actA"` }
type ProofData ¶ added in v1.2.0
type ProofData struct { DataHash json.RawMessage `json:"bH"` ChainId configs.ChainId `json:"chId"` Cycle uint64 `json:"cyc"` Index int `json:"idx"` Validator json.RawMessage `json:"val"` Signature json.RawMessage `json:"sig"` Signers [][]byte `json:"signers"` Commitment json.RawMessage `json:"com"` TotalCost json.RawMessage `json:"mCo"` }
func UnpackProofData ¶ added in v1.2.0
func (*ProofData) EncodeBytes ¶ added in v1.2.0
type PubKeyType ¶
type PubKeyType string
const ( TendermintsSecp256k1PubKey PubKeyType = "tendermint/PubKeySecp256k1" EthereumPubKey PubKeyType = "eth" )
type PubSubMessage ¶
type PubSubMessage struct {
Data msgpack.RawMessage `json:"d"`
}
PubSubMessage
func NewPubSubMessage ¶
func NewPubSubMessage(data []byte) PubSubMessage
func PubSubMessageFromBytes ¶
func PubSubMessageFromBytes(b []byte) (PubSubMessage, error)
func UnpackPubSubMessage ¶
func UnpackPubSubMessage(b []byte) (PubSubMessage, error)
func (*PubSubMessage) EncodeBytes ¶
func (msg *PubSubMessage) EncodeBytes() ([]byte, error)
func (*PubSubMessage) MsgPack ¶
func (msg *PubSubMessage) MsgPack() []byte
func (*PubSubMessage) ToJSON ¶
func (msg *PubSubMessage) ToJSON() []byte
func (*PubSubMessage) ToString ¶
func (msg *PubSubMessage) ToString() string
type PublicKeyString ¶
type PublicKeyString string
func (PublicKeyString) Bytes ¶ added in v1.2.0
func (s PublicKeyString) Bytes() []byte
type RegisterationData ¶ added in v1.2.0
type RegisterationData struct { ChainId configs.ChainId `json:"cId"` Timestamp uint64 `json:"ts"` PubKeyEDD json.RawMessage `json:"pubEDD"` }
func (RegisterationData) EncodeBytes ¶ added in v1.2.0
func (regData RegisterationData) EncodeBytes() ([]byte, error)
func (*RegisterationData) GetHash ¶ added in v1.2.0
func (regData *RegisterationData) GetHash() []byte
func (*RegisterationData) Sign ¶ added in v1.2.0
func (regData *RegisterationData) Sign(privkBytes []byte) ([]byte, schnorr.EthAddress, error)
type ResponseInterval ¶
type ResponseMeta ¶
type ResponsePayload ¶
type RewardBatch ¶ added in v1.2.0
type RewardBatch struct { Id string `json:"id"` Index int `json:"idx"` Data []SubnetCount `json:"d"` DataBoundary [2]SubnetCount `json:"dBound"` DataHash json.RawMessage `json:"dH"` ChainId configs.ChainId `json:"pre"` Closed bool `json:"cl"` Cycle uint64 `json:"nh"` MessageCost json.RawMessage `json:"cost"` TotalValue json.RawMessage `json:"tv"` // Proofs Proof `json:"proof"` Timestamp uint64 `json:"ts"` Validator json.RawMessage `json:"val"` // contains filtered or unexported fields }
RewardBatch
func NewRewardBatch ¶ added in v1.2.0
func NewRewardBatch(config *configs.MainConfiguration, cycle uint64, index int, cycleMessageCost *big.Int, cycleSize int, validator []byte) *RewardBatch
func RewardBatchFromBytes ¶ added in v1.2.0
func RewardBatchFromBytes(b []byte) (*RewardBatch, error)
func UnpackRewardBatch ¶ added in v1.2.0
func UnpackRewardBatch(b []byte) (*RewardBatch, error)
func (*RewardBatch) Append ¶ added in v1.2.0
func (msg *RewardBatch) Append(subnetCount SubnetCount)
func (*RewardBatch) Clear ¶ added in v1.2.0
func (msg *RewardBatch) Clear()
func (*RewardBatch) EncodeBytes ¶ added in v1.2.0
func (msg *RewardBatch) EncodeBytes() ([]byte, error)
func (*RewardBatch) GetHash ¶ added in v1.2.0
func (rb *RewardBatch) GetHash(chainId configs.ChainId) ([32]byte, error)
func (*RewardBatch) GetProofData ¶ added in v1.2.0
func (msg *RewardBatch) GetProofData(chainId configs.ChainId) *ProofData
func (*RewardBatch) MsgPack ¶ added in v1.2.0
func (msg *RewardBatch) MsgPack() []byte
type ServerIdentity ¶
type ServerIdentity struct { Signature string `json:"sig"` Signer string `json:"sigr"` Message string `json:"m"` Address string `json:"addr"` }
func UnpackServerIdentity ¶
func UnpackServerIdentity(b []byte) (ServerIdentity, error)
func (*ServerIdentity) MsgPack ¶
func (hs *ServerIdentity) MsgPack() []byte
type SignatureData ¶
type SignatureData struct { Type PubKeyType `json:"ty"` PublicKey string `json:"pubK,omitempty"` Signature string `json:"sig"` }
func (SignatureData) GormDataType ¶
func (sD SignatureData) GormDataType() string
func (*SignatureData) Scan ¶
func (sD *SignatureData) Scan(value interface{}) error
type SignatureRequestData ¶ added in v1.2.0
type SignatureRequestData struct { ProofHash json.RawMessage `json:"pH"` Challenge json.RawMessage `json:"chal"` }
func UnpackSignatureRequestData ¶ added in v1.2.0
func UnpackSignatureRequestData(b []byte) (*SignatureRequestData, error)
func (*SignatureRequestData) MsgPack ¶ added in v1.2.0
func (sr *SignatureRequestData) MsgPack() []byte
type Stats ¶
type Stats struct { ID string `json:"id" gorm:"type:uuid;primaryKey;not null"` BlockNumber uint64 `json:"blk"` EventCount uint64 `json:"eC"` MessageCount uint64 `json:"mC"` TopicCount uint64 `json:"tC"` AuthorizationCount uint64 `json:"authC"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` MessageCost string `json:"mCo"` }
type Subnet ¶
type Subnet struct { ID string `json:"id" gorm:"type:uuid;primaryKey;not null"` Meta string `json:"meta,omitempty"` Ref string `json:"ref,omitempty" binding:"required" gorm:"unique;type:varchar(64);default:null"` Categories pq.Int32Array `gorm:"type:integer[]"` SignatureData SignatureData `json:"sigD" gorm:"json;"` Status *uint8 `json:"st" gorm:"boolean;default:0"` Timestamp uint64 `json:"ts,omitempty" binding:"required"` Balance uint64 `json:"bal" gorm:"default:0"` // Readonly Account DIDString `json:"acct,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` // CreateTopicPrivilege *constants.AuthorizationPrivilege `json:"cTopPriv"` // DefaultAuthPrivilege *constants.AuthorizationPrivilege `json:"dAuthPriv"` // privilege for external users who joins the subnet. 0 indicates people cant join // Derived Event EventPath `json:"e,omitempty" gorm:"index;varchar;"` Hash string `json:"h,omitempty" gorm:"type:char(64)"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` Agent DeviceString `json:"agent" gorm:"agent" msgpack:"agent"` //Deprecated Owner string `json:"-" gorm:"-" msgpack:"-"` }
func SubnetFromBytes ¶
func UnpackSubnet ¶
func (Subnet) EncodeBytes ¶
func (Subnet) GetAgent ¶
func (entity Subnet) GetAgent() DeviceString
type SubnetCount ¶ added in v1.2.0
type SubnetCount struct { Subnet string `json:"sNet"` EventCount uint64 `json:"eC"` Cost json.RawMessage `json:"cost"` }
func (*SubnetCount) EncodeBytes ¶ added in v1.2.0
func (msg *SubnetCount) EncodeBytes() ([]byte, error)
type Subscription ¶
type Subscription struct { ID string `gorm:"primaryKey;type:char(36);not null" json:"id,omitempty"` Topic string `json:"top" binding:"required" gorm:"not null;uniqueIndex:idx_sub_topic;type:char(36);index"` Ref string `json:"ref" gorm:"uniqueIndex:idx_ref_subnet;type:varchar(100);default:null"` Meta string `json:"meta" gorm:"type:varchar(100);"` Subnet string `json:"snet" binding:"required" gorm:"not null;uniqueIndex:idx_ref_subnet;type:varchar(36)"` Subscriber DIDString `json:"sub" gorm:"not null;uniqueIndex:idx_sub_topic;type:varchar(100);index"` // Device DeviceString `json:"dev,omitempty" binding:"required" gorm:"not null;uniqueIndex:idx_acct_dev_topic;type:varchar(100);index"` Status *constants.SubscriptionStatus `json:"st" gorm:"not null;type:smallint;default:2"` Role *constants.SubscriberRole `json:"rol" gorm:"default:0"` //Signature string `json:"sig"` Timestamp *uint64 `json:"ts"` Hash string `json:"h" gorm:"unique" ` Event EventPath `json:"e" gorm:"index;char(64);"` Agent DeviceString `json:"agt,omitempty" binding:"required" gorm:"not null;type:varchar(100);index"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` }
func SubscriptionFromBytes ¶
func SubscriptionFromBytes(b []byte) (Subscription, error)
func UnpackSubscription ¶
func UnpackSubscription(b []byte) (Subscription, error)
func (Subscription) EncodeBytes ¶
func (sub Subscription) EncodeBytes() ([]byte, error)
func (Subscription) GetAgent ¶
func (sub Subscription) GetAgent() DeviceString
func (Subscription) GetEvent ¶
func (sub Subscription) GetEvent() EventPath
func (Subscription) GetHash ¶
func (sub Subscription) GetHash() ([]byte, error)
func (*Subscription) Key ¶
func (sub *Subscription) Key() string
func (Subscription) MsgPack ¶
func (sub Subscription) MsgPack() []byte
func (Subscription) ToJSON ¶
func (sub Subscription) ToJSON() []byte
func (Subscription) ToString ¶
func (subscription Subscription) ToString() string
type SuccessResponse ¶
type SuccessResponse struct { Body ClientPayload Meta Meta }
type SyncRequest ¶
type SyncRequest struct { Interval ResponseInterval `json:"inter"` TopicIds string `json:"topIds"` }
* SYNC REQUEST PAYLOAD *
type SyncResponse ¶
type SyncResponse struct { TimeFrame ResponseInterval `json:"time,omitempty"` Authorization []Authorization `json:"auths,omitempty"` Presence []Presence `json:"presence,omitempty"` Topics map[string]TopicResponse `json:"topics,omitempty"` }
type Topic ¶
type Topic struct { ID string `json:"id" gorm:"type:uuid;primaryKey;not null"` // Name string `json:"n,omitempty" binding:"required"` Ref string `json:"ref,omitempty" binding:"required" gorm:"uniqueIndex:idx_unique_subnet_ref;type:varchar(64);default:null"` Meta string `json:"meta,omitempty"` ParentTopicHash string `json:"pTH,omitempty" gorm:"type:char(64)"` SubscriberCount uint64 `json:"sC,omitempty"` Account DIDString `json:"acct,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` Agent DeviceString `json:"agt,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` // Public *bool `json:"pub,omitempty" gorm:"default:false"` DefaultSubscriberRole *constants.SubscriberRole `json:"dSubRol,omitempty"` ReadOnly *bool `json:"rO,omitempty" gorm:"default:false"` // Derived Event EventPath `json:"e,omitempty" gorm:"index;varchar;"` Hash string `json:"h,omitempty" gorm:"type:char(64)"` // Signature string `json:"sig,omitempty" binding:"required" gorm:"non null;"` // Broadcasted bool `json:"br,omitempty" gorm:"default:false;"` Timestamp uint64 `json:"ts,omitempty" binding:"required"` Subnet string `json:"snet" gorm:"uniqueIndex:idx_unique_subnet_ref;type:char(36);"` // Subnet string `json:"snet" gorm:"index;varchar(36)"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` }
func TopicFromBytes ¶
func UnpackTopic ¶
func (Topic) EncodeBytes ¶
func (Topic) GetAgent ¶
func (topic Topic) GetAgent() DeviceString
type TopicResponse ¶
type Wallet ¶
type Wallet struct { // Primary ID string `gorm:"primaryKey;type:uuid;not null" json:"id,omitempty"` Account DIDString `json:"acct"` Subnet string `json:"snet" gorm:"type:varchar(32);index;not null" msgpack:",noinline"` Name string `json:"n" gorm:"type:varchar(12);not null"` Symbol string `json:"sym" gorm:"type:varchar(8);not null"` Timestamp uint64 `json:"ts"` Agent DeviceString `json:"agt,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` // Derived Event EventPath `json:"e,omitempty" gorm:"index;varchar;"` Hash string `json:"h,omitempty" gorm:"type:char(64)"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` }
func (Wallet) EncodeBytes ¶
func (Wallet) GetAgent ¶
func (entity Wallet) GetAgent() DeviceString
type WalletBalance ¶
type WalletBalance struct { // Primary ID string `gorm:"primaryKey;type:uuid;not null" json:"id,omitempty"` Account DIDString `json:"acct" gorm:"type:varchar(64);uniqueIndex:idx_wallet_acct;not null"` Wallet string `json:"wal" gorm:"type:char(36);uniqueIndex:idx_wallet_acct;not null"` Balance big.Int `json:"bal" gorm:"index;not null;default:0"` Agent DeviceString `json:"agt,omitempty" binding:"required" gorm:"not null;type:varchar(100)"` // Derived Event EventPath `json:"e,omitempty" gorm:"index;not null;varchar;"` Timestamp uint64 `json:"ts"` BlockNumber uint64 `json:"blk"` Cycle uint64 `json:"cy"` Epoch uint64 `json:"ep"` }
func (*WalletBalance) BeforeCreate ¶
func (d *WalletBalance) BeforeCreate(tx *gorm.DB) (err error)
func (WalletBalance) EncodeBytes ¶
func (e WalletBalance) EncodeBytes() ([]byte, error)
func (WalletBalance) GetAgent ¶
func (entity WalletBalance) GetAgent() DeviceString
func (WalletBalance) GetEvent ¶
func (entity WalletBalance) GetEvent() EventPath
func (WalletBalance) GetHash ¶
func (e WalletBalance) GetHash() ([]byte, error)
func (*WalletBalance) MsgPack ¶
func (e *WalletBalance) MsgPack() []byte
func (*WalletBalance) ToJSON ¶
func (e *WalletBalance) ToJSON() []byte
func (WalletBalance) ToString ¶
func (e WalletBalance) ToString() string
Source Files ¶
- RegistrationData.go
- address.go
- authorization.go
- block.go
- block_stat.go
- claim-data.go
- client_payload.go
- client_response.go
- delivery_proof.go
- event.go
- handshake.go
- main_stat.go
- message.go
- pub_sub_message.go
- pubsub.go
- reward.go
- signature_data.go
- subnet.go
- subscription.go
- topic.go
- wallet.go
- wallet_balance.go
Click to show internal directories.
Click to hide internal directories.