types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FeeDefaultPolicy = &types.Policy{
	Rules: []*types.Rule{
		{
			Resource: "ethereum.send",
			Effect:   types.Effect_EFFECT_ALLOW,
			ParameterConstraints: []*types.ParameterConstraint{
				{
					ParameterName: "asset",
					Constraint: &types.Constraint{
						Type: types.ConstraintType_CONSTRAINT_TYPE_FIXED,
						Value: &types.Constraint_FixedValue{
							FixedValue: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
						},
						Required: false,
					},
				},
				{
					ParameterName: "from_address",
					Constraint: &types.Constraint{
						Type:     types.ConstraintType_CONSTRAINT_TYPE_ANY,
						Required: true,
					},
				},
				{
					ParameterName: "amount",
					Constraint: &types.Constraint{
						Type:     types.ConstraintType_CONSTRAINT_TYPE_ANY,
						Required: true,
					},
				},
				{
					ParameterName: "to_address",
					Constraint: &types.Constraint{
						Type: types.ConstraintType_CONSTRAINT_TYPE_MAGIC_CONSTANT,
						Value: &types.Constraint_MagicConstantValue{
							MagicConstantValue: types.MagicConstant_VULTISIG_TREASURY,
						},
						Required: true,
					},
				},
			},
		},
	},
}

TODO: Temporary solution for testing purposes. This will be replaced by integrating the fee policy into every relevant policy.

Functions

This section is empty.

Types

type APIKey

type APIKey struct {
	ID        string         `json:"id"`
	ApiKey    string         `json:"apiKey"`
	PluginID  types.PluginID `json:"pluginId"`
	Status    int64          `json:"status"`
	ExpiresAt *time.Time     `json:"expires_at"`
}

type CreditMetadata

type CreditMetadata struct {
	DebitFeeID      uint64 `json:"debit_fee_id"`     // ID of the debit transaction
	TransactionHash string `json:"transaction_hash"` // Transaction hash in blockchain
	Network         string `json:"network"`          // Blockchain network (e.g., "ethereum", "polygon")
}

type FAQItem

type FAQItem struct {
	Question string `json:"question"`
	Answer   string `json:"answer"`
}

type Plugin

type Plugin struct {
	ID             types.PluginID  `json:"id" validate:"required"`
	Title          string          `json:"title" validate:"required"`
	Description    string          `json:"description" validate:"required"`
	ServerEndpoint string          `json:"server_endpoint" validate:"required"`
	Category       PluginCategory  `json:"category_id" validate:"required"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	Pricing        []types.Pricing `json:"pricing,omitempty"`       // New field for multiple pricing options
	LogoURL        string          `json:"logo_url,omitempty"`      // New field, should be validated once plugins have this data in db.
	ThumbnailURL   string          `json:"thumbnail_url,omitempty"` // New field, should be validated once plugins have this data in db.
	Images         []PluginImage   `json:"images,omitempty"`        // New field, should be validated once plugins have this data in db.
	FAQs           []FAQItem       `json:"faqs,omitempty"`
	Features       []string        `json:"features,omitempty"`
	Audited        bool            `json:"audited"`
	RatesCount     int             `json:"rates_count"`
	AvgRating      float64         `json:"avg_rating"`
	Installations  int             `json:"installations"`
}

type PluginAvgRatingDto

type PluginAvgRatingDto struct {
	PluginID  string  `json:"plugin_id"`
	AvgRating float64 `json:"avg_rating"`
}

type PluginCategory

type PluginCategory string
const (
	PluginCategoryAIAgent PluginCategory = "ai-agent"
	PluginCategoryPlugin  PluginCategory = "plugin"
)

func (PluginCategory) IsValid

func (pc PluginCategory) IsValid() bool

IsValid checks if the plugin category is valid

func (PluginCategory) String

func (pc PluginCategory) String() string

String returns the string representation of the plugin category

type PluginCreateDto

type PluginCreateDto struct {
	Type           string                       `json:"type" validate:"required"`
	Title          string                       `json:"title" validate:"required"`
	Description    string                       `json:"description" validate:"required"`
	Metadata       json.RawMessage              `json:"metadata" validate:"required"`
	ServerEndpoint string                       `json:"server_endpoint" validate:"required"`
	LogoURL        string                       `json:"logo_url"`
	CategoryID     uuid.UUID                    `json:"category_id" validate:"required"`
	PricingData    []types.PricingCreateDataDto `json:"pricing_data" validate:"required"`
}

type PluginFilters

type PluginFilters struct {
	Term       *string    `json:"term"`
	TagID      *uuid.UUID `json:"tag_id"`
	CategoryID *string    `json:"category_id"`
}

type PluginImage

type PluginImage struct {
	URL       string `json:"url"`
	Caption   string `json:"caption"`
	AltText   string `json:"alt_text"`
	SortOrder int    `json:"sort_order"` // for carousels
	ZIndex    int    `json:"z_index"`    // for overlays
}

type PluginPolicyPaginatedList

type PluginPolicyPaginatedList struct {
	Policies   []types.PluginPolicy `json:"policies" validate:"required"`
	TotalCount int                  `json:"total_count" validate:"required"`
}

type PluginPolicySync

type PluginPolicySync struct {
	ID         uuid.UUID        `json:"id" validate:"required"`
	PolicyID   uuid.UUID        `json:"policy_id" validate:"required"`
	PluginID   ptypes.PluginID  `json:"plugin_id" validate:"required"`
	Signature  string           `json:"signature" validate:"required"`
	SyncType   PolicySyncType   `json:"sync_type" validate:"required"`
	Status     PolicySyncStatus `json:"status" validate:"required"`
	FailReason string           `json:"fail_reason"` // when synced is false, this field contains the reason for the failure
}

type PluginRating

type PluginRating struct {
	PluginID string `json:"plugin_id"`
	Rating   int    `json:"rating"`
	Count    int    `json:"count"`
}

type PluginRatingDto

type PluginRatingDto struct {
	Rating int `json:"rating"`
	Count  int `json:"count"`
}

type PluginTotalCount

type PluginTotalCount struct {
	ID         types.PluginID `json:"id" validate:"required"`
	TotalCount int            `json:"total_count" validate:"required"`
}

type PluginUpdateDto

type PluginUpdateDto struct {
	Title          string                       `json:"title"`
	Description    string                       `json:"description"`
	Metadata       json.RawMessage              `json:"metadata"`
	ServerEndpoint string                       `json:"server_endpoint"`
	LogoURL        string                       `json:"logo_url"`
	PricingData    []types.PricingCreateDataDto `json:"pricing_data"`
	CategoryID     uuid.UUID                    `json:"category_id"`
}

using references on struct fields allows us to process partially field DTOs

type PluginWithRatings

type PluginWithRatings struct {
	Plugin
	Ratings []PluginRatingDto `json:"ratings,omitempty"`
}

PluginWithRatings is used for API responses that include rating statistics

type PluginsPaginatedList

type PluginsPaginatedList struct {
	Plugins    []Plugin `json:"plugins"`
	TotalCount int      `json:"total_count"`
}

type PolicySyncStatus

type PolicySyncStatus int
const (
	NotSynced PolicySyncStatus = iota
	Synced    PolicySyncStatus = iota + 1
	Failed    PolicySyncStatus = iota + 2
)

type PolicySyncType

type PolicySyncType int
const (
	AddPolicy PolicySyncType = iota
	UpdatePolicy
	RemovePolicy
)

type RecipeFunctions

type RecipeFunctions struct {
	ID        string   `json:"id"`
	Functions []string `json:"functions"`
}

type Review

type Review struct {
	ID        string    `json:"id" validate:"required"`
	Address   string    `json:"address" validate:"required"`
	Rating    int       `json:"rating" validate:"required,min=1,max=5"`
	Comment   string    `json:"comment,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	PluginId  string    `json:"plugin_id" validate:"required"`
}

type ReviewCreateDto

type ReviewCreateDto struct {
	Address string `json:"address" validate:"required"`
	Rating  int    `json:"rating" validate:"required"`
	Comment string `json:"comment,omitempty"`
}

type ReviewDto

type ReviewDto struct {
	ID        string            `json:"id" validate:"required"`
	Address   string            `json:"address" validate:"required"`
	Rating    int               `json:"rating" validate:"required"`
	Comment   string            `json:"comment,omitempty"`
	CreatedAt time.Time         `json:"created_at"`
	PluginId  string            `json:"plugin_id" validate:"required"`
	Ratings   []PluginRatingDto `json:"ratings,omitempty"`
}

type ReviewsDto

type ReviewsDto struct {
	Reviews    []Review `json:"reviews"`
	TotalCount int      `json:"total_count"`
}

type Tag

type Tag struct {
	ID        string    `json:"id" validate:"required"`
	Name      string    `json:"name" validate:"required,min=2,max=50"`
	CreatedAt time.Time `json:"created_at" validate:"required"`
}

Tag represents a plugin tag with unique identifier, name

type TimeTrigger

type TimeTrigger struct {
	PolicyID       string            `json:"policy_id"`
	CronExpression string            `json:"cron_expression"`
	StartTime      time.Time         `json:"start_time"`
	EndTime        *time.Time        `json:"end_time"`
	Frequency      string            `json:"frequency"`
	Interval       int               `json:"interval"`
	LastExecution  *time.Time        `json:"last_execution"`
	Status         TimeTriggerStatus `json:"status"`
}

type TimeTriggerStatus

type TimeTriggerStatus string
const (
	StatusTimeTriggerPending TimeTriggerStatus = "PENDING"
	StatusTimeTriggerRunning TimeTriggerStatus = "RUNNING"
)

type TransactionHistoryPaginatedList

type TransactionHistoryPaginatedList struct {
	History    []tx_indexer_storage.Tx `json:"history"`
	TotalCount uint32                  `json:"total_count"`
}

type VaultToken

type VaultToken struct {
	ID         string     `json:"id"`
	TokenID    string     `json:"token_id"`
	PublicKey  string     `json:"public_key"`
	ExpiresAt  time.Time  `json:"expires_at"`
	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	LastUsedAt time.Time  `json:"last_used_at"`
	RevokedAt  *time.Time `json:"revoked_at"`
}

VaultToken represents a token stored in the database

func (*VaultToken) IsRevoked

func (t *VaultToken) IsRevoked() bool

type VaultTokenCreate

type VaultTokenCreate struct {
	PublicKey string    `json:"public_key"`
	TokenID   string    `json:"token_id"`
	ExpiresAt time.Time `json:"expires_at"`
}

VaultTokenCreate represents the data needed to create a new vault token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL