services

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: AGPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const ERC20ABI = `` /* 7075-byte string literal not displayed */

ERC20ABI represents a standard ERC20 smart contract

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyService

type APIKeyService struct{}

APIKeyService provides functionality related to API keys.

func NewAPIKeyService

func NewAPIKeyService() *APIKeyService

NewAPIKeyService creates a new instance of APIKeyService.

func (*APIKeyService) GenerateAPIKey

func (s *APIKeyService) GenerateAPIKey(
	ctx context.Context,
	tx *ent.Tx,
	sender *ent.SenderProfile,
	provider *ent.ProviderProfile,
) (*ent.APIKey, string, error)

GenerateAPIKey generates a new API key for the user.

func (*APIKeyService) GetAPIKey

func (s *APIKeyService) GetAPIKey(
	ctx context.Context,
	sender *ent.SenderProfile,
	provider *ent.ProviderProfile,
) (*types.APIKeyResponse, error)

GetAPIKey gets the API key for a user profile.

type BalanceManagementService added in v0.0.2

type BalanceManagementService struct {
	// contains filtered or unexported fields
}

BalanceManagementService handles provider balance operations

func NewBalanceManagementService added in v0.0.2

func NewBalanceManagementService() *BalanceManagementService

NewBalanceManagementService creates a new instance of BalanceManagementService

func (*BalanceManagementService) CheckBalanceSufficiency added in v0.0.2

func (svc *BalanceManagementService) CheckBalanceSufficiency(ctx context.Context, providerID string, currencyCode string, amount decimal.Decimal) (bool, error)

CheckBalanceSufficiency checks if a provider has sufficient available balance for a given amount

func (*BalanceManagementService) GetProviderBalance added in v0.0.2

func (svc *BalanceManagementService) GetProviderBalance(ctx context.Context, providerID string, currencyCode string) (*ent.ProviderCurrencies, error)

GetProviderBalance retrieves the balance for a specific provider and currency

func (*BalanceManagementService) GetProviderBalances added in v0.0.2

func (svc *BalanceManagementService) GetProviderBalances(ctx context.Context, providerID string) ([]*ent.ProviderCurrencies, error)

GetProviderBalances retrieves all balances for a specific provider

func (*BalanceManagementService) ReleaseReservedBalance added in v0.0.2

func (svc *BalanceManagementService) ReleaseReservedBalance(ctx context.Context, providerID string, currencyCode string, amount decimal.Decimal, tx *ent.Tx) error

ReleaseReservedBalance releases a previously reserved amount If tx is provided, the operation will be performed within that transaction

func (*BalanceManagementService) ReserveBalance added in v0.0.2

func (svc *BalanceManagementService) ReserveBalance(ctx context.Context, providerID string, currencyCode string, amount decimal.Decimal) error

ReserveBalance reserves a specific amount for a provider and currency

func (*BalanceManagementService) UpdateProviderBalance added in v0.0.2

func (svc *BalanceManagementService) UpdateProviderBalance(ctx context.Context, providerID string, currencyCode string, availableBalance, totalBalance, reservedBalance decimal.Decimal) error

UpdateProviderBalance updates the balance for a specific provider and currency

type EngineService

type EngineService struct {
	// contains filtered or unexported fields
}

EngineService provides functionality for interacting with the engine/thirdweb API

func NewEngineService

func NewEngineService() *EngineService

NewEngineService creates a new instance of EngineService

func (*EngineService) CreateGatewayWebhook

func (s *EngineService) CreateGatewayWebhook() error

CreateGatewayWebhook creates webhooks for gateway contract events across all supported chains for the environment

func (*EngineService) CreateServerWallet

func (s *EngineService) CreateServerWallet(ctx context.Context, label string) (string, error)

CreateServerWallet creates a new EIP-4337 smart contract account address

func (*EngineService) CreateTransferWebhook

func (s *EngineService) CreateTransferWebhook(ctx context.Context, chainID int64, contractAddress string, toAddress string, orderID string) (string, string, error)

CreateTransferWebhook creates webhooks to listen to transfer events to a specific address on a specific chain

func (*EngineService) DeleteWebhook

func (s *EngineService) DeleteWebhook(ctx context.Context, webhookID string) error

DeleteWebhook deletes a webhook by its ID

func (*EngineService) DeleteWebhookAndRecord

func (s *EngineService) DeleteWebhookAndRecord(ctx context.Context, webhookID string) error

DeleteWebhookAndRecord deletes a webhook from thirdweb and removes the PaymentWebhook record from our database

func (*EngineService) GetAddressTransactionHistory

func (s *EngineService) GetAddressTransactionHistory(ctx context.Context, chainID int64, walletAddress string, limit int, fromBlock int64, toBlock int64) ([]map[string]interface{}, error)

GetAddressTransactionHistory fetches transaction history for any address from thirdweb insight API

func (*EngineService) GetContractEvents

func (s *EngineService) GetContractEvents(ctx context.Context, chainID int64, contractAddress string, payload map[string]string) ([]interface{}, error)

GetContractEvents fetches contract events

func (*EngineService) GetContractEventsRPC

func (s *EngineService) GetContractEventsRPC(ctx context.Context, rpcEndpoint string, contractAddress string, fromBlock int64, toBlock int64, topics []string, txHash string) ([]interface{}, error)

GetContractEventsRPC fetches contract events using RPC for networks not supported by Thirdweb Insight It fetches all events and filters for specified event signatures (gateway events or transfer events)

func (*EngineService) GetContractEventsWithFallback

func (s *EngineService) GetContractEventsWithFallback(ctx context.Context, network *ent.Network, contractAddress string, fromBlock int64, toBlock int64, topics []string, txHash string, eventPayload map[string]string) ([]interface{}, error)

GetContractEventsWithFallback tries RPC first and falls back to ThirdWeb if RPC fails

func (*EngineService) GetLatestBlock

func (s *EngineService) GetLatestBlock(ctx context.Context, chainID int64) (int64, error)

GetLatestBlock fetches the latest block number for a given chain ID

func (*EngineService) GetTransactionStatus

func (s *EngineService) GetTransactionStatus(ctx context.Context, queueId string) (result map[string]interface{}, err error)

GetTransactionStatus gets the status of a transaction

func (*EngineService) GetWebhookByID

func (s *EngineService) GetWebhookByID(ctx context.Context, webhookID string, chainID int64) (*WebhookInfo, error)

GetWebhookByID fetches a webhook by its ID from thirdweb

func (*EngineService) ParseUserOpErrorJSON

func (s *EngineService) ParseUserOpErrorJSON(errorJSON map[string]interface{}) string

ParseUserOpErrorJSON parses a UserOperation error JSON and returns the decoded error string

func (*EngineService) SendTransactionBatch

func (s *EngineService) SendTransactionBatch(ctx context.Context, chainID int64, address string, txPayload []map[string]interface{}) (queueID string, err error)

SendTransactionBatch sends a batch of transactions

func (*EngineService) UpdateWebhook

func (s *EngineService) UpdateWebhook(ctx context.Context, webhookID string, webhookPayload map[string]interface{}) error

UpdateWebhook updates an existing webhook with new filters

func (*EngineService) WaitForTransactionMined

func (s *EngineService) WaitForTransactionMined(ctx context.Context, queueId string, timeout time.Duration) (result map[string]interface{}, err error)

WaitForTransactionMined waits for a transaction to be mined

type EtherscanService

type EtherscanService struct {
	// contains filtered or unexported fields
}

EtherscanService provides functionality for interacting with Etherscan API

func NewEtherscanService

func NewEtherscanService() (*EtherscanService, error)

NewEtherscanService creates a new instance of EtherscanService

func (*EtherscanService) GetAddressTransactionHistory

func (s *EtherscanService) GetAddressTransactionHistory(ctx context.Context, chainID int64, walletAddress string, limit int, fromBlock int64, toBlock int64) ([]map[string]interface{}, error)

GetAddressTransactionHistory fetches transaction history for any address from Etherscan API

type PriorityQueueService

type PriorityQueueService struct {
	// contains filtered or unexported fields
}

func NewPriorityQueueService

func NewPriorityQueueService() *PriorityQueueService

NewPriorityQueueService creates a new instance of PriorityQueueService

func (*PriorityQueueService) AssignLockPaymentOrder

func (s *PriorityQueueService) AssignLockPaymentOrder(ctx context.Context, order types.LockPaymentOrderFields) error

AssignLockPaymentOrders assigns lock payment orders to providers

func (*PriorityQueueService) CreatePriorityQueueForBucket

func (s *PriorityQueueService) CreatePriorityQueueForBucket(ctx context.Context, bucket *ent.ProvisionBucket)

CreatePriorityQueueForBucket creates a priority queue for a bucket and saves it to redis

func (*PriorityQueueService) GetProviderRate

func (s *PriorityQueueService) GetProviderRate(ctx context.Context, provider *ent.ProviderProfile, tokenSymbol string, currency string) (decimal.Decimal, error)

GetProviderRate returns the rate for a provider

func (*PriorityQueueService) GetProvisionBuckets

func (s *PriorityQueueService) GetProvisionBuckets(ctx context.Context) ([]*ent.ProvisionBucket, error)

GetProvisionBuckets returns a list of buckets with their providers

func (*PriorityQueueService) ProcessBucketQueues

func (s *PriorityQueueService) ProcessBucketQueues() error

ProcessBucketQueues creates a priority queue for each bucket and saves it to redis

type ReceiveAddressService

type ReceiveAddressService struct {
	// contains filtered or unexported fields
}

ReceiveAddressService provides functionality related to managing receive addresses

func NewReceiveAddressService

func NewReceiveAddressService() *ReceiveAddressService

NewReceiveAddressService creates a new instance of ReceiveAddressService.

func (*ReceiveAddressService) CreateSmartAddress

func (s *ReceiveAddressService) CreateSmartAddress(ctx context.Context, label string) (string, error)

CreateSmartAddress function generates and saves a new EIP-4337 smart contract account address

func (*ReceiveAddressService) CreateTronAddress

func (s *ReceiveAddressService) CreateTronAddress(ctx context.Context) (string, []byte, error)

CreateTronAddress generates and saves a new Tron address

type SlackService

type SlackService struct {
	SlackWebhookURL string
}

func NewSlackService

func NewSlackService(webhookURL string) *SlackService

func (*SlackService) SendActionFeedbackNotification

func (s *SlackService) SendActionFeedbackNotification(firstName, email, submissionID, actionType, reasonForDecline string) error

SendActionFeedbackNotification sends a Slack notification for an action taken on a KYB submission

func (*SlackService) SendSubmissionNotification

func (s *SlackService) SendSubmissionNotification(firstName, email, submissionID string) error

SendSubmissionNotification sends a Slack notification for a new KYB submission

func (*SlackService) SendUserSignupNotification

func (s *SlackService) SendUserSignupNotification(user *ent.User, scopes []string, providerCurrencies []string) error

SendUserSignupNotification sends a Slack notification when a new user signs up

type TurnstileResponse

type TurnstileResponse struct {
	Success     bool     `json:"success"`
	ErrorCodes  []string `json:"error-codes,omitempty"`
	ChallengeTS string   `json:"challenge_ts,omitempty"`
	Hostname    string   `json:"hostname,omitempty"`
}

TurnstileResponse represents the response from Cloudflare Turnstile verification

type TurnstileService

type TurnstileService struct{}

TurnstileService handles Cloudflare Turnstile token validation

func NewTurnstileService

func NewTurnstileService() *TurnstileService

NewTurnstileService creates a new instance of TurnstileService

func (*TurnstileService) VerifyToken

func (s *TurnstileService) VerifyToken(token, remoteIP string) error

VerifyToken validates a Turnstile token with Cloudflare

type WebhookInfo

type WebhookInfo struct {
	ID            string                 `json:"id"`
	Name          string                 `json:"name"`
	WebhookURL    string                 `json:"webhook_url"`
	WebhookSecret string                 `json:"webhook_secret"`
	Disabled      bool                   `json:"disabled"`
	CreatedAt     string                 `json:"created_at"`
	UpdatedAt     string                 `json:"updated_at"`
	ProjectID     string                 `json:"project_id"`
	Filters       map[string]interface{} `json:"filters"`
}

WebhookInfo represents a webhook from thirdweb API

type WebhookListResponse

type WebhookListResponse struct {
	Data []WebhookInfo `json:"data"`
	Meta struct {
		Page       int `json:"page"`
		Limit      int `json:"limit"`
		TotalItems int `json:"total_items"`
		TotalPages int `json:"total_pages"`
	} `json:"meta"`
}

WebhookListResponse represents the response from GET /v1/webhooks

Directories

Path Synopsis
kyc

Jump to

Keyboard shortcuts

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