types

package
v1.0.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: 13 Imported by: 8

Documentation

Index

Constants

View Source
const (
	FeeTypeInstallationFee = "installation_fee"
	FeeTypeTrial           = "trial"
	FeeSubscriptionFee     = "subscription_fee"
	FeeTxExecFee           = "transaction_execution_fee"
	FeeTypeBatch           = "batch"
	FeeTypeBatchFailed     = "batch_failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingPolicy

type BillingPolicy struct {
	ID        uuid.UUID         `json:"id" validate:"required"`
	Type      PricingType       `json:"type" validate:"required"`
	Frequency *PricingFrequency `json:"frequency"`
	StartDate time.Time         `json:"start_date"`                 // Number of a month, e.g., "1" for the first month. Only allow 1 for now
	Amount    uint64            `json:"amount" validate:"required"` // Amount in the smallest unit, e.g., "1000000" for 0.01 VULTI
	Asset     string            `json:"asset"`                      // The asset that the fee is denominated in, e.g., "usdc"
}

type BillingPolicyProto

type BillingPolicyProto struct {
	ID        *uuid.UUID              `json:"id" validate:"required"`
	Type      rtypes.FeeType          `json:"type" validate:"required"`
	Frequency rtypes.BillingFrequency `json:"frequency"`
	StartDate time.Time               `json:"start_date"`                 // Number of a month, e.g., "1" for the first month. Only allow 1 for now
	Amount    uint64                  `json:"amount" validate:"required"` // Amount in the smallest unit, e.g., "1000000" for 0.01 VULTI
	Asset     string                  `json:"asset"`                      // The asset that the fee is denominated in, e.g., "usdc"
}

type CreditMetadata

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

type EmailRequest

type EmailRequest struct {
	Email       string `json:"email"`
	FileName    string `json:"file_name"`
	FileContent string `json:"file_content"`
	VaultName   string `json:"vault_name"`
	Code        string `json:"code"`
}

type Fee

type Fee struct {
	ID             uint64          `json:"id"`         // The unique id of the fee incurred
	PolicyID       uuid.UUID       `json:"policy_id"`  // The policy ID that has incurred the fee
	PublicKey      string          `json:"public_key"` // The public key "account" connected to the fee
	TxType         TxType          `json:"transaction_type"`
	Amount         uint64          `json:"amount"` // The amount of the fee in the smallest unit, e.g., "1000000" for 0.01 VULTI
	CreatedAt      time.Time       `json:"created_at"`
	FeeType        string          `json:"fee_type"`
	Metadata       json.RawMessage `json:"metadata"`
	UnderlyingType string          `json:"underlying_type"`
	UnderlyingID   string          `json:"underlying_id"`
}

type HashFunction

type HashFunction string
const (
	HashFunction_SHA256 HashFunction = "SHA256"
)

type KeysignMessage

type KeysignMessage struct {
	TxIndexerID  string         `json:"tx_indexer_id"` // Tx indexer uuid
	RawMessage   string         `json:"raw_message"`   // Raw message, used to decode the transaction
	Message      string         `json:"message"`
	Hash         string         `json:"hash"`
	HashFunction HashFunction   `json:"hash_function"`
	Chain        vgcommon.Chain `json:"chain"`
}

type KeysignRequest

type KeysignRequest struct {
	PublicKey        string           `json:"public_key"` // public key, used to identify the backup file
	Messages         []KeysignMessage `json:"messages"`
	SessionID        string           `json:"session"`            // Session ID , it should be an UUID
	HexEncryptionKey string           `json:"hex_encryption_key"` // Hex encryption key, used to encrypt the keysign messages
	Parties          []string         `json:"parties"`            // parties to join the session
	PluginID         string           `json:"plugin_id"`          // plugin id
	PolicyID         uuid.UUID        `json:"policy_id"`          // policy id
}

func (KeysignRequest) IsValid

func (r KeysignRequest) IsValid() error

IsValid checks if the keysign request is valid

type PluginID

type PluginID string
const (
	PluginVultisigDCA_0000            PluginID = "vultisig-dca-0000"
	PluginVultisigRecurringSends_0000 PluginID = "vultisig-recurring-sends-0000"
	PluginVultisigPayroll_0000        PluginID = "vultisig-payroll-0000"
	PluginVultisigFees_feee           PluginID = "vultisig-fees-feee"
	PluginNBitsLabsMerkle_0000        PluginID = "nbits-labs-merkle-e93d"
)

Each plugin must reserve a unique ID.

A plugin ID is comprised of a all-lowercase string, ending with 4 random hex digits.

Example: vultisig-dca-00a1

func (PluginID) String

func (p PluginID) String() string

type PluginKeysignRequest

type PluginKeysignRequest struct {
	KeysignRequest
	Transaction     string `json:"transactions"`
	TransactionType string `json:"transaction_type"`
}

func NewPluginKeysignRequestEvm

func NewPluginKeysignRequestEvm(policy PluginPolicy, txToTrack string, chain vgcommon.Chain, tx []byte) (
	*PluginKeysignRequest, error)

type PluginPolicy

type PluginPolicy struct {
	ID            uuid.UUID       `json:"id" validate:"required"`
	PublicKey     string          `json:"public_key" validate:"required"`
	PluginID      PluginID        `json:"plugin_id" validate:"required"`
	PluginVersion string          `json:"plugin_version" validate:"required"`
	PolicyVersion int             `json:"policy_version" validate:"required"`
	Signature     string          `json:"signature" validate:"required"`
	Recipe        string          `json:"recipe" validate:"required"`  // base64 encoded recipe protobuf bytes
	Billing       []BillingPolicy `json:"billing" validate:"required"` // This will be populated later
	Active        bool            `json:"active" validate:"required"`
}

This type should be used externally when creating or updating a plugin policy. It keeps the protobuf encoded billing recipe as a string which is used to verify a signature.

func (*PluginPolicy) GetRecipe

func (p *PluginPolicy) GetRecipe() (*rtypes.Policy, error)

func (*PluginPolicy) ParseBillingFromRecipe

func (p *PluginPolicy) ParseBillingFromRecipe() error

This is used to populate the Billing field of a PluginPolicy from the Recipe field. It does not validate this information against the plugin pricing.

type Pricing

type Pricing struct {
	ID        uuid.UUID         `json:"id" validate:"required"`
	Type      PricingType       `json:"type" validate:"required"`
	Frequency *PricingFrequency `json:"frequency,omitempty"`
	Amount    uint64            `json:"amount" validate:"gte=0"`
	Asset     PricingAsset      `json:"asset" validate:"required"`
	Metric    PricingMetric     `json:"metric" validate:"required"`
	CreatedAt time.Time         `json:"created_at" validate:"required"`
	UpdatedAt time.Time         `json:"updated_at" validate:"required"`
	PluginID  PluginID          `json:"plugin_id" validate:"required"`
}

type PricingAsset

type PricingAsset string
const (
	PricingAssetUSDC PricingAsset = "usdc"
)

type PricingCreateDataDto

type PricingCreateDataDto struct {
	Type      PricingType       `json:"type" validate:"required"`
	Frequency *PricingFrequency `json:"frequency,omitempty" validate:"omitempty"`
	Amount    uint64            `json:"amount" validate:"gte=0"`
	Metric    PricingMetric     `json:"metric" validate:"required"`
}

type PricingCreateDto

type PricingCreateDto struct {
	PricingCreateDataDto
	PluginID PluginID `json:"plugin_id" validate:"required"`
}

type PricingFrequency

type PricingFrequency string
const (
	PricingFrequencyDaily    PricingFrequency = "daily"
	PricingFrequencyWeekly   PricingFrequency = "weekly"
	PricingFrequencyBiweekly PricingFrequency = "biweekly"
	PricingFrequencyMonthly  PricingFrequency = "monthly"
)

type PricingMetric

type PricingMetric string
const (
	PricingMetricFixed PricingMetric = "fixed"
)

type PricingType

type PricingType string
const (
	PricingTypeOnce      PricingType = "once"
	PricingTypeRecurring PricingType = "recurring"
	PricingTypePerTx     PricingType = "per-tx"
)

type ReshareRequest

type ReshareRequest struct {
	Name             string   `json:"name"`               // name of the vault
	PublicKey        string   `json:"public_key"`         // public key ecdsa
	SessionID        string   `json:"session_id"`         // session id
	HexEncryptionKey string   `json:"hex_encryption_key"` // hex encryption key
	HexChainCode     string   `json:"hex_chain_code"`     // hex chain code
	LocalPartyId     string   `json:"local_party_id"`     // local party id
	OldParties       []string `json:"old_parties"`        // old parties
	Email            string   `json:"email"`
	PluginID         string   `json:"plugin_id"` // plugin id
}

ReshareRequest is a struct that represents a request to reshare a vault

func (*ReshareRequest) IsValid

func (req *ReshareRequest) IsValid() error

type TxType

type TxType string
const (
	TxTypeDebit  TxType = "debit"
	TxTypeCredit TxType = "credit"
)

type UserFeeStatus

type UserFeeStatus struct {
	PublicKey    string `json:"public_key"`
	Balance      int64  `json:"balance"` // Current balance (can be negative)
	UnpaidAmount int64  `json:"unpaid_amount"`
	Fees         []*Fee `json:"fees"`
}

UserFeeStatus represents the fee status and balance for a user

Jump to

Keyboard shortcuts

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