response

package
v1.0.0-beta.39 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DraftStatusDraft is when the transaction is a draft
	DraftStatusDraft string = "draft"

	// DraftStatusCanceled is when the draft is canceled
	DraftStatusCanceled string = "canceled"

	// DraftStatusExpired is when the draft has expired
	DraftStatusExpired string = "expired"

	// DraftStatusComplete is when the draft transaction is complete
	DraftStatusComplete string = "complete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessKey

type AccessKey struct {
	// Model is a common model that contains common fields for all models.
	Model
	// ID is an hash of the compressed public key.
	ID string `json:"id" example:"874b86d6fd1d6c85a857e73180164203d8d23211bfd9d04d210f9f7fde5b82d8"`
	// XpubID is an access key's xpub related id.
	XpubID string `json:"xpubId" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// RevokedAt is a time when access key was revoked.
	RevokedAt *time.Time `json:"revokedAt,omitempty" example:"2024-02-26T11:02:28.069911Z"`
	// Key is a string representation of an access key.
	Key string `json:"key,omitempty" example:"3fd870d6bf1725f04084cf31209c04be5bd9bed001a390ad3bc632a55a3ee078"`
}

AccessKey is a model that represents an access key.

type AdminStats

type AdminStats struct {
	// Balance is a total balance of all xpubs.
	Balance int64 `json:"balance"`
	// Destinations is a total number of destinations.
	Destinations int64 `json:"destinations"`
	// PaymailAddresses is a total number of paymail addresses.
	PaymailAddresses int64 `json:"paymailAddresses"`
	// Transactions is a total number of committed transactions.
	Transactions int64 `json:"transactions"`
	// TransactionsPerDay is a total number of committed transactions per day.
	TransactionsPerDay map[string]interface{} `json:"transactionsPerDay"`
	// Utxos is a total number of utxos.
	Utxos int64 `json:"utxos"`
	// UtxosPerType are utxos grouped by type.
	UtxosPerType map[string]interface{} `json:"utxosPerType"`
	// Xpubs is a total number of xpubs.
	XPubs int64 `json:"xpubs"`
}

AdminStats is a model that represents admin stats.

type Contact

type Contact struct {
	Model

	// ID is a unique identifier of contact.
	ID string `json:"id" example:"68af358bde7d8641621c7dd3de1a276c9a62cfa9e2d0740494519f1ba61e2f4a"`
	// FullName is name which could be shown instead of whole paymail address.
	FullName string `json:"fullName" example:"Test User"`
	// Paymail is a paymail address related to contact.
	Paymail string `json:"paymail" example:"test@spv-wallet.com"`
	// PubKey is a public key related to contact (receiver).
	PubKey string `json:"pubKey" example:"xpub661MyMwAqRbcGpZVrSHU..."`
	// Status is a contact's current status.
	Status ContactStatus `json:"status" example:"unconfirmed"`
}

Contact is a model for contact.

type ContactStatus

type ContactStatus string

ContactStatus is a type for contact status.

const (
	ContactNotConfirmed ContactStatus = "unconfirmed"
	ContactAwaitAccept  ContactStatus = "awaiting"
	ContactConfirmed    ContactStatus = "confirmed"
	ContactRejected     ContactStatus = "rejected"
)

Enum values for ContactStatus.

type CreateContactResponse

type CreateContactResponse struct {
	Contact        *Contact          `json:"contact"`
	AdditionalInfo map[string]string `json:"additionalInfo"`
}

CreateContactResponse is a model for response on contact creation.

func (*CreateContactResponse) AddAdditionalInfo

func (m *CreateContactResponse) AddAdditionalInfo(k, v string)

AddAdditionalInfo adds additional information (as key-value map) to the response.

type Destination

type Destination struct {
	// Model is a common model that contains common fields for all models.
	Model

	// ID is a destination id which is the hash of the LockingScript.
	ID string `json:"id" example:"82a5d848f997819a478b05fb713208d7f3aa66da5ba00953b9845fb1701f9b98"`
	// XpubID is a destination's xpub related id used to register destination.
	XpubID string `json:"xpubId" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// LockingScript is a destination's locking script.
	LockingScript string `json:"lockingScript" example:"76a9147b05764a97f3b4b981471492aa703b188e45979b88ac"`
	// Type is a destination's type.
	Type string `json:"type" example:"pubkeyhash"`
	// Chain is a destination's chain representation.
	Chain uint32 `json:"chain" example:"0"`
	// Num is a destination's num representation.
	Num uint32 `json:"num" example:"0"`
	// PaymailExternalDerivationNum is the chain/num/(ext_derivation_num) location of the address related to the xPub.
	PaymailExternalDerivationNum *uint32 `json:"paymailExternalDerivationNum" example:"0"`
	// Address is a destination's address.
	Address string `json:"address" example:"1CDUf7CKu8ocTTkhcYUbq75t14Ft168K65"`
	// DraftID is a destination's draft id.
	DraftID string `json:"draftId" example:"b356f7fa00cd3f20cce6c21d704cd13e871d28d714a5ebd0532f5a0e0cde63f7"`
}

Destination is a model that represents a destination - registered in a spv-wallet with xpub.

type DraftTransaction

type DraftTransaction struct {
	// Model is a common model that contains common fields for all models.
	Model
	// ID is a draft transaction id.
	ID string `json:"id" example:"b356f7fa00cd3f20cce6c21d704cd13e871d28d714a5ebd0532f5a0e0cde63f7"`
	// Hex is a draft transaction hex.
	Hex string `json:"hex" example:"0100000002..."`
	// XpubID is a draft transaction's xpub used to sign transaction.
	XpubID string `json:"xpubId" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// ExpiresAt is a time when draft transaction expired.
	ExpiresAt time.Time `json:"expiresAt" example:"2024-02-26T11:00:28.069911Z"`
	// Configuration contains draft transaction configuration.
	Configuration TransactionConfig `json:"configuration"`
	// Status is a draft transaction lastly monitored status.
	Status string `json:"status" example:"complete"`
	// FinalTxID is a final transaction id.
	FinalTxID string `json:"finalTxId" example:"cfe30797f0b5fc098b32194e857569a7a1edd829fddf3df4567796b738de386d"`
}

DraftTransaction is a model that represents a draft transaction.

type FeeUnit

type FeeUnit struct {
	// Satoshis is a fee unit satoshis amount.
	Satoshis bsv.Satoshis `json:"satoshis" example:"1"`
	// Bytes is a fee unit bytes representation.
	Bytes int `json:"bytes" example:"1000"`
}

FeeUnit is a model that represents a fee unit (simplified version of fee unit from go-bt).

type MapProtocol

type MapProtocol struct {
	// App is a map protocol app.
	App string `json:"app,omitempty"`
	// Keys is a map protocol keys.
	Keys map[string]interface{} `json:"keys,omitempty"`
	// Type is a map protocol type.
	Type string `json:"type,omitempty"`
}

MapProtocol is a model that represents a map protocol.

type Model

type Model struct {
	// CreatedAt is a time when outer model was created.
	CreatedAt time.Time `json:"createdAt" example:"2024-02-26T11:00:28.069911Z"`
	// UpdatedAt is a time when outer model was updated.
	UpdatedAt time.Time `json:"updatedAt" example:"2024-02-26T11:01:28.069911Z"`
	// DeletedAt is a time when outer model was deleted.
	DeletedAt *time.Time `json:"deletedAt" example:"2024-02-26T11:02:28.069911Z"`
	// Metadata is a metadata map of outer model.
	Metadata map[string]interface{} `json:"metadata" swaggertype:"object,string" example:"key:value,key2:value2"`
}

Model is a common model that contains common fields for all models.

type OpReturn

type OpReturn struct {
	// Hex is a full hex of op return.
	Hex string `json:"hex,omitempty"`
	// HexParts is a slice of splitted hex parts.
	HexParts []string `json:"hexParts,omitempty"`
	// Map is a pointer to a map protocol object.
	Map *MapProtocol `json:"map,omitempty"`
	// StringParts is a slice of string parts.
	StringParts []string `json:"stringParts,omitempty"`
}

OpReturn is a model that represents a op return.

type PageDescription

type PageDescription struct {
	// Size is the number of elements on a single page
	Size int `json:"size"`
	// Number is the number of the page returned
	Number int `json:"number"`
	// TotalElements is the total number of elements in the returned collection
	TotalElements int `json:"totalElements"`
	// TotalPages is total number of pages returned
	TotalPages int `json:"totalPages"`
}

PageDescription is a model that represents the page descriptor

type PageModel

type PageModel[T any] struct {
	// Content is the collection of elements that serves as the content
	Content []*T `json:"content"`
	// Page is the page descriptor
	Page PageDescription `json:"page"`
}

PageModel is a model that represents the full JSON response

type PaymailAddress

type PaymailAddress struct {
	// Model is a common model that contains common fields for all models.
	Model

	// ID is a paymail address id.
	ID string `json:"id" example:"c0ba4a52c89279268476a141be7569200cff2ca4892512b07ca75c25a95c16cd"`
	// XpubID is a paymail address's xpub related id used to register paymail address.
	XpubID string `json:"xpubId" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// Alias is a paymail address's alias (first part of paymail).
	Alias string `json:"alias" example:"test"`
	// Domain is a paymail address's domain (second part of paymail).
	Domain string `json:"domain" example:"spvwallet.com"`
	// PublicName is a paymail address's public name.
	PublicName string `json:"publicName" example:"Test User"`
	// Avatar is a paymail address's avatar.
	Avatar string `json:"avatar" example:"https://spvwallet.com/avatar.png"`
	// Address is a paymail address that combines alias and domain with @
	Address string `json:"address" example:"test@spvwallet.com"`
}

PaymailAddress is a model that represents a paymail address.

type PaymailP4

type PaymailP4 struct {
	// Alias is a paymail p4 alias.
	Alias string `json:"alias,omitempty"`
	// Domain is a paymail p4 domain.
	Domain string `json:"domain,omitempty"`
	// FromPaymail is a paymail p4 from paymail.
	FromPaymail string `json:"fromPaymail,omitempty"`
	// Note is a paymail p4 note.
	Note string `json:"note,omitempty"`
	// PubKey is a paymail p4 pub key.
	PubKey string `json:"pubKey,omitempty"`
	// ReceiveEndpoint is a paymail p4 receive endpoint.
	ReceiveEndpoint string `json:"receiveEndpoint,omitempty"`
	// ReferenceID is a paymail p4 reference id.
	ReferenceID string `json:"referenceId,omitempty"`
	// ResolutionType is a paymail p4 resolution type.
	ResolutionType string `json:"resolutionType,omitempty"`
}

PaymailP4 is a model that represents a paymail p4.

type ScriptOutput

type ScriptOutput struct {
	// Address is a script output address.
	Address string `json:"address,omitempty"`
	// Satoshis is a script output satoshis.
	Satoshis uint64 `json:"satoshis,omitempty"`
	// Script is a script output script.
	Script string `json:"script"`
	// ScriptType is a script output script type.
	ScriptType string `json:"scriptType"`
}

ScriptOutput is a model that represents a script output.

type SharedConfig

type SharedConfig struct {
	// PaymailDomains is a list of paymail domains handled by spv-wallet.
	PaymailDomains []string `json:"paymailDomains" example:"spv-wallet.com"`
	// ExperimentalFeatures is a map of experimental features handled by spv-wallet.
	ExperimentalFeatures map[string]bool `json:"experimentalFeatures" example:"pikeEnabled:true"`
}

SharedConfig with fields which can ba shared across the application components. Please be aware NOT to add ANY SENSITIVE information here.

type SyncConfig

type SyncConfig struct {
	// Broadcast is a flag that indicates whether to broadcast transaction or not.
	Broadcast bool `json:"broadcast"`
	// BroadcastInstant is a flag that indicates whether to broadcast transaction instantly or not.
	BroadcastInstant bool `json:"broadcastInstant"`
	// PaymailP2P is a flag that indicates whether to use paymail p2p or not.
	PaymailP2P bool `json:"paymailP2p"`
	// SyncOnChain is a flag that indicates whether to sync transaction on chain or not.
	SyncOnChain bool `json:"syncOnChain"`
}

SyncConfig contains sync configuration flags.

type Transaction

type Transaction struct {
	// Model is a common model that contains common fields for all models.
	Model
	// ID is a transaction id.
	ID string `json:"id" example:"01d0d0067652f684c6acb3683763f353fce55f6496521c7d99e71e1d27e53f5c"`
	// Hex is a transaction hex.
	Hex string `json:"hex" example:"0100000002..."`
	// XpubInIDs is a slice of xpub input ids.
	XpubInIDs []string `json:"xpubInIds" example:"[bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50]"`
	// XpubOutIDs is a slice of xpub output ids.
	XpubOutIDs []string `json:"xpubOutIds" example:"[2075eca10bf2688b38cd7fdad6c24562463a9a26ae505d66c480fd53165dbaa2]"`
	// BlockHash is a block hash that transaction is in.
	BlockHash string `json:"blockHash" example:"0000000000000000046e81025ca6cfbd2f45c7331f650c77edc99a14d5a1f0d0"`
	// BlockHeight is a block height that transaction is in.
	BlockHeight uint64 `json:"blockHeight" example:"833505"`
	// Fee is a transaction fee.
	Fee uint64 `json:"fee" example:"1"`
	// NumberOfInputs is a number of transaction inputs.
	NumberOfInputs uint32 `json:"numberOfInputs" example:"3"`
	// NumberOfOutputs is a number of transaction outputs.
	NumberOfOutputs uint32 `json:"numberOfOutputs" example:"2"`
	// DraftID is a transaction related draft id.
	DraftID string `json:"draftId" example:"b356f7fa00cd3f20cce6c21d704cd13e871d28d714a5ebd0532f5a0e0cde63f7"`
	// TotalValue is a total input value.
	TotalValue uint64 `json:"totalValue" example:"51"`
	// OutputValue is a total output value.
	OutputValue int64 `json:"outputValue,omitempty" example:"50"`
	// Outputs represents all spv-wallet-transaction outputs. Will be shown only for admin.
	Outputs map[string]int64 `` /* 171-byte string literal not displayed */
	// Status is a transaction status.
	Status string `json:"status" example:"MINED"`
	// TransactionDirection is a transaction direction (incoming/outgoing).
	TransactionDirection string `json:"direction" example:"outgoing"`
}

Transaction is a model that represents a transaction.

type TransactionConfig

type TransactionConfig struct {
	// ChangeDestinations is a slice of change destinations.
	ChangeDestinations []*Destination `json:"changeDestinations"`
	// ChangeStrategy is a change strategy.
	ChangeStrategy string `json:"changeDestinationsStrategy"`
	// ChangeMinimumSatoshis is a minimum satoshis for change.
	ChangeMinimumSatoshis uint64 `json:"changeMinimumSatoshis" example:"0"`
	// ChangeNumberOfDestinations is a number of change destinations.
	ChangeNumberOfDestinations int `json:"changeNumberOfDestinations" example:"1"`
	// ChangeSatoshis is a change satoshis.
	ChangeSatoshis uint64 `json:"changeSatoshis" example:"49"`
	// ExpiresAt is a time when transaction expires.
	ExpiresIn time.Duration `json:"expiresIn" example:"1000" swaggertype:"string"`
	// Fee is a fee amount.
	Fee uint64 `json:"fee" example:"1"`
	// FeeUnit is a pointer to a fee unit object.
	FeeUnit *FeeUnit `json:"feeUnit"`
	// FromUtxos is a slice of from utxos used to build transaction.
	FromUtxos []*UtxoPointer `json:"fromUtxos"`
	// IncludeUtxos is a slice of utxos to include in transaction.
	IncludeUtxos []*UtxoPointer `json:"includeUtxos"`
	// Inputs is a slice of transaction inputs.
	Inputs []*TransactionInput `json:"inputs"`
	// Outputs is a slice of transaction outputs.
	Outputs []*TransactionOutput `json:"outputs"`
	// SendAllTo is a pointer to a transaction output object.
	SendAllTo *TransactionOutput `json:"sendAllTo"`
	// Sync contains sync configuration.
	Sync *SyncConfig `json:"sync"`
}

TransactionConfig is a model that represents a transaction config.

type TransactionInput

type TransactionInput struct {
	// Utxo is a pointer to a utxo object.
	Utxo `json:",inline"`
	// Destination is a pointer to a destination object.
	Destination Destination `json:"destination"`
}

TransactionInput is a model that represents a transaction input.

type TransactionOutput

type TransactionOutput struct {
	// OpReturn is a pointer to a op return object.
	OpReturn *OpReturn `json:"opReturn,omitempty"`
	// PaymailP4 is a pointer to a paymail p4 object.
	PaymailP4 *PaymailP4 `json:"paymailP4,omitempty"`
	// Satoshis is a satoshis amount.
	Satoshis uint64 `json:"satoshis" example:"50"`
	// Script is a transaction output string representation of script.
	Script string `json:"script" example:"76a91433ba3607a902bc022164bcb6e993f27bd040241c88ac"`
	// ScriptType is a transaction output script type.
	Scripts []*ScriptOutput `json:"scripts,omitempty"`
	// To is a transaction output destination address.
	To string `json:"to" example:"1MB8MfCyA5mGt3UBhxYr1exBfsFWgL1gCm"`
	// UseForChange is a flag that indicates if this output should be used for change.
	UseForChange bool `json:"useForChange" example:"false"`
}

TransactionOutput is a model that represents a transaction output.

type Utxo

type Utxo struct {
	// Model is a common model that contains common fields for all models.
	Model
	// UtxoPointer is a pointer to a utxo object.
	UtxoPointer `json:",inline"`

	// ID is a utxo id which is a hash from transaction id and output index.
	ID string `json:"id" example:"c706a448748d398d542cf4dfad797c9a4b123ebb72dbfb8b27f3d0f1dda99b58"`
	// XpubID is a utxo related xpub id.
	XpubID string `json:"xpubId" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// Satoshis is a utxo satoshis amount.
	Satoshis uint64 `json:"satoshis" example:"100"`
	// ScriptPubKey is a utxo script pub key.
	ScriptPubKey string `json:"scriptPubKey" example:"76a91433ba3607a902bc022164bcb6e993f27bd040241c88ac"`
	// Type is a utxo type.
	Type string `json:"type" example:"pubkeyhash"`
	// DraftID is a utxo transaction related draft id.
	DraftID string `json:"draftId" example:"b356f7fa00cd3f20cce6c21d704cd13e871d28d714a5ebd0532f5a0e0cde63f7"`
	// ReservedAt is a time utxo was reserved at.
	ReservedAt time.Time `json:"reservedAt"  example:"2024-02-26T11:00:28.069911Z"`
	// SpendingTxID is a spending transaction id - null if not spent yet.
	SpendingTxID string `json:"spendingTxId" example:"01d0d0067652f684c6acb3683763f353fce55f6496521c7d99e71e1d27e53f5c"`
	// Transaction is a transaction pointer that utxo points to.
	Transaction *Transaction `json:"transaction"`
}

Utxo is a model that represents a utxo.

type UtxoPointer

type UtxoPointer struct {
	// TransactionID is a transaction id that utxo points to.
	TransactionID string `json:"transactionId" example:"01d0d0067652f684c6acb3683763f353fce55f6496521c7d99e71e1d27e53f5c"`
	// OutputIndex is a output index that utxo points to.
	OutputIndex uint32 `json:"outputIndex" example:"0"`
}

UtxoPointer is a pointer model that represents a utxo.

type Xpub

type Xpub struct {
	// Model is a common model that contains common fields for all models.
	Model

	// ID is a hash of the xpub.
	ID string `json:"id" example:"bb8593f85ef8056a77026ad415f02128f3768906de53e9e8bf8749fe2d66cf50"`
	// CurrentBalance is a xpub's current balance.
	CurrentBalance uint64 `json:"currentBalance" example:"1234"`
	// NextInternalNum is the index derivation number use to generate NEXT internal xPub (internal xPub are used for change destinations).
	NextInternalNum uint32 `json:"nextInternalNum" example:"0"`
	// NextExternalNum is the index derivation number use to generate NEXT external xPub (external xPub are used for address destinations).
	NextExternalNum uint32 `json:"nextExternalNum" example:"0"`
}

Xpub is a model that represents a xpub.

Jump to

Keyboard shortcuts

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