bot

package module
v3.16.8 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: Apache-2.0 Imports: 46 Imported by: 9

README

Installation

go get github.com/MixinNetwork/bot-api-go-client/v3

Fo more info, see api.

Documentation

Index

Constants

View Source
const (
	BTC           = "c6d0c728-2624-429b-8e0d-d9d19b6592fa"
	ETH           = "43d61dcd-e413-450d-80b8-101d5e903357"
	USDT_ERC20    = "4d8c508b-91c5-375b-92b0-ee702ed2dac5"
	USDT_TRC20    = "b91e18ff-a9ae-3dc7-8679-e935d9a4b34b"
	USDT_POLYGON  = "218bc6f4-7927-3f8e-8568-3a3725b74361"
	USDT_BSC      = "94213408-4ee7-3150-a9c4-9c5cce421c78"
	USDT_SOLANA   = "cb54aed4-1893-3977-b739-ec7b2e04f0c5"
	USDT_OPTIMISM = "65f137d4-50ba-3090-920b-b360f7da8eee"
	USDT_ARBITRUM = "66e12fe3-50fe-3308-9426-7b2f47f6a66f"

	USDC_ERC20    = "9b180ab6-6abe-3dc0-a13f-04169eb34bfa"
	USDC_SOLANA   = "de6fa523-c596-398e-b12f-6d6980544b59"
	USDC_BSC      = "3d3d69f1-6742-34cf-95fe-3f8964e6d307"
	USDC_BASE     = "2f845564-3898-3d17-8c24-3275e96235b5"
	USDC_OPTIMISM = "2adae45c-5077-3b96-b810-0da15bcc3097"
	USDC_ARBITRUM = "d2d80f2c-0ac5-3d8c-82c2-e0a1aa25f928"
)
View Source
const (
	MessageCategoryPlainText             = "PLAIN_TEXT"
	MessageCategoryPlainImage            = "PLAIN_IMAGE"
	MessageCategoryPlainData             = "PLAIN_DATA"
	MessageCategoryPlainSticker          = "PLAIN_STICKER"
	MessageCategoryPlainLive             = "PLAIN_LIVE"
	MessageCategoryPlainContact          = "PLAIN_CONTACT"
	MessageCategoryPlainPost             = "PLAIN_POST"
	MessageCategoryPlainLocation         = "PLAIN_LOCATION"
	MessageCategoryPlainTranscript       = "PLAIN_TRANSCRIPT"
	MessageCategorySystemConversation    = "SYSTEM_CONVERSATION"
	MessageCategorySystemAccountSnapshot = "SYSTEM_ACCOUNT_SNAPSHOT"
	MessageCategoryMessageRecall         = "MESSAGE_RECALL"
	MessageCategoryMessagePin            = "MESSAGE_PIN"
	MessageCategoryAppButtonGroup        = "APP_BUTTON_GROUP"
	MessageCategoryAppCard               = "APP_CARD"

	MessageCategorySystemSafeSnapshot    = "SYSTEM_SAFE_SNAPSHOT"
	MessageCategorySystemSafeInscription = "SYSTEM_SAFE_INSCRIPTION"
)
View Source
const (
	LightningChainId       = "59c09123-95cc-3ffd-a659-0f9169074cee"
	BitcoinChainId         = "c6d0c728-2624-429b-8e0d-d9d19b6592fa"
	BitcoinCashChainId     = "fd11b6e3-0b87-41f1-a41f-f0e9b49e5bf0"
	BitcoinSVChainId       = "574388fd-b93f-4034-a682-01c2bc095d17"
	LitecoinChainId        = "76c802a2-7c88-447f-a93e-c29c9e5dd9c8"
	EthereumChainId        = "43d61dcd-e413-450d-80b8-101d5e903357"
	EthereumClassicChainId = "2204c1ee-0ea2-4add-bb9a-b3719cfff93a"
	BSCChainId             = "1949e683-6a08-49e2-b087-d6b72398588f"
	PolygonChainId         = "b7938396-3f94-4e0a-9179-d3440718156f"
	BaseChainId            = "3fb612c5-6844-3979-ae4a-5a84e79da870"
	OptimismChainId        = "60360611-370c-3b69-9826-b13db93f6aba"
	ArbitrumChainId        = "8c590110-1abc-3697-84f2-05214e6516aa"
	MVMChainId             = "a0ffd769-5850-4b48-9651-d2ae44a3e64d"
	DecredChainId          = "8f5caf2a-283d-4c85-832a-91e83bbf290b"
	RippleChainId          = "23dfb5a5-5d7b-48b6-905f-3970e3176e27"
	SiacoinChainId         = "990c4c29-57e9-48f6-9819-7d986ea44985"
	EOSChainId             = "6cfe566e-4aad-470b-8c9a-2fd35b49c68d"
	DogecoinChainId        = "6770a1e5-6086-44d5-b60f-545f9d9e8ffd"
	DashChainId            = "6472e7e3-75fd-48b6-b1dc-28d294ee1476"
	ZcashChainId           = "c996abc9-d94e-4494-b1cf-2a3fd3ac5714"
	NEMChainId             = "27921032-f73e-434e-955f-43d55672ee31"
	ArweaveChainId         = "882eb041-64ea-465f-a4da-817bd3020f52"
	HorizenChainId         = "a2c5d22b-62a2-4c13-b3f0-013290dbac60"
	TRONChainId            = "25dabac5-056a-48ff-b9f9-f67395dc407c"
	StellarChainId         = "56e63c06-b506-4ec5-885a-4a5ac17b83c1"
	MassGridChainId        = "b207bce9-c248-4b8e-b6e3-e357146f3f4c"
	BytomChainId           = "443e1ef5-bc9b-47d3-be77-07f328876c50"
	BytomPoSChainId        = "71a0e8b5-a289-4845-b661-2b70ff9968aa"
	CosmosChainId          = "7397e9f1-4e42-4dc8-8a3b-171daaadd436"
	AkashChainId           = "9c612618-ca59-4583-af34-be9482f5002d"
	BinanceChainId         = "17f78d7c-ed96-40ff-980c-5dc62fecbc85"
	MoneroChainId          = "05c5ac01-31f9-4a69-aa8a-ab796de1d041"
	StarcoinChainId        = "c99a3779-93df-404d-945d-eddc440aa0b2"
	BitSharesChainId       = "05891083-63d2-4f3d-bfbe-d14d7fb9b25a"
	RavencoinChainId       = "6877d485-6b64-4225-8d7e-7333393cb243"
	GrinChainId            = "1351e6bd-66cf-40c1-8105-8a8fe518a222"
	VCashChainId           = "c3b9153a-7fab-4138-a3a4-99849cadc073"
	HandshakeChainId       = "13036886-6b83-4ced-8d44-9f69151587bf"
	NervosChainId          = "d243386e-6d84-42e6-be03-175be17bf275"
	TezosChainId           = "5649ca42-eb5f-4c0e-ae28-d9a4e77eded3"
	NamecoinChainId        = "f8b77dc0-46fd-4ea1-9821-587342475869"
	SolanaChainId          = "64692c23-8971-4cf4-84a7-4dd1271dd887"
	NearChainId            = "d6ac94f7-c932-4e11-97dd-617867f0669e"
	FilecoinChainId        = "08285081-e1d8-4be6-9edc-e203afa932da"
	MobileCoinChainId      = "eea900a8-b327-488c-8d8d-1428702fe240"
	PolkadotChainId        = "54c61a72-b982-4034-a556-0d99e3c21e39"
	KusamaChainId          = "9d29e4f6-d67c-4c4b-9525-604b04afbe9f"
	AlgorandChainId        = "706b6f84-3333-4e55-8e89-275e71ce9803"
	AvalancheChainId       = "cbc77539-0a20-4666-8c8a-4ded62b36f0a"
	XDCChainId             = "b12bb04a-1cea-401c-a086-0be61f544889"
	AptosChainId           = "d2c1c7e1-a1a9-4f88-b282-d93b0a08b42b"
	TONChainId             = "ef660437-d915-4e27-ad3f-632bfb6ba0ee"

	XINAssetId    = "c94ac88f-4671-3976-b60a-09064f1811e8"
	VaultaAssetId = "ac2b79f3-ec9c-3d87-b4ca-3e825228dda5"
)
View Source
const (
	OperationTypeAddUser     = 1
	OperationTypeSystemCall  = 2
	OperationTypeUserDeposit = 3
)
View Source
const (
	InscriptionModeInstant = 1
	InscriptionModeDone    = 2
)
View Source
const (
	MixinInvoiceVersion = byte(0)
	MixinInvoicePrefix  = "MIN"
)
View Source
const (
	MixAddressPrefix  = "MIX"
	MixAddressVersion = byte(2)
)
View Source
const (
	TIPVerify                   = "TIP:VERIFY:"
	TIPAddressAdd               = "TIP:ADDRESS:ADD:"
	TIPAddressRemove            = "TIP:ADDRESS:REMOVE:"
	TIPUserDeactivate           = "TIP:USER:DEACTIVATE:"
	TIPEmergencyContactCreate   = "TIP:EMERGENCY:CONTACT:CREATE:"
	TIPEmergencyContactRead     = "TIP:EMERGENCY:CONTACT:READ:"
	TIPEmergencyContactRemove   = "TIP:EMERGENCY:CONTACT:REMOVE:"
	TIPPhoneNumberUpdate        = "TIP:PHONE:NUMBER:UPDATE:"
	TIPMultisigRequestSign      = "TIP:MULTISIG:REQUEST:SIGN:"
	TIPMultisigRequestUnlock    = "TIP:MULTISIG:REQUEST:UNLOCK:"
	TIPCollectibleRequestSign   = "TIP:COLLECTIBLE:REQUEST:SIGN:"
	TIPCollectibleRequestUnlock = "TIP:COLLECTIBLE:REQUEST:UNLOCK:"
	TIPTransferCreate           = "TIP:TRANSFER:CREATE:"
	TIPWithdrawalCreate         = "TIP:WITHDRAWAL:CREATE:"
	TIPRawTransactionCreate     = "TIP:TRANSACTION:CREATE:"
	TIPOAuthApprove             = "TIP:OAUTH:APPROVE:"
	TIPProvisioningUpdate       = "TIP:PROVISIONING:UPDATE:"
	TIPOwnershipTransfer        = "TIP:APP:OWNERSHIP:TRANSFER:"
	TIPSequencerRegister        = "SEQUENCER:REGISTER:"
)
View Source
const (
	RelationshipActionAdd     = "ADD"
	RelationshipActionUpdate  = "UPDATE"
	RelationshipActionRemove  = "REMOVE"
	RelationshipActionBlock   = "BLOCK"
	RelationshipActionUnblock = "UNBLOCK"

	PreferenceSourceAll      = "EVERYBODY"
	PreferenceSourceContacts = "CONTACTS"
	PreferenceSourceNobody   = "NOBODY"
)
View Source
const (
	MixinFeeUserId = "674d6776-d600-4346-af46-58e77d8df185"
)

Variables

View Source
var (
	DefaultApiHost   = "https://api.mixin.one"
	DefaultBlazeHost = "blaze.mixin.one"
)
View Source
var Nil = uuid.Nil

Functions

func AesDecrypt

func AesDecrypt(secret, b []byte) ([]byte, error)

func AesEncrypt

func AesEncrypt(secret, b []byte) ([]byte, error)

func AssetBalance

func AssetBalance(ctx context.Context, assetId, uid, sid, sessionKey string) (common.Integer, error)

func AssetBalanceWithSafeUser

func AssetBalanceWithSafeUser(ctx context.Context, kernelAssetId string, su *SafeUser) (common.Integer, error)

func BuildRawTransaction added in v3.6.0

func BuildRawTransaction(ctx context.Context, asset crypto.Hash, utxos []*Output, recipients []*TransactionRecipient, extra []byte, references []string, traceId string, u *SafeUser) (*common.Transaction, error)

func BuildSystemCallExtra added in v3.16.2

func BuildSystemCallExtra(uid, cid string, skipProcess bool, fid string) ([]byte, error)

func CallKernelRPC

func CallKernelRPC(ctx context.Context, user *SafeUser, method string, params ...any) ([]byte, error)

func CancelMultisig

func CancelMultisig(ctx context.Context, id string, su *SafeUser) error

func Chunked

func Chunked(source []any, size int) [][]any

func ComputerDeployExternalAsset added in v3.16.0

func ComputerDeployExternalAsset(ctx context.Context, assets []string) error

func ComputerUserIDToBytes added in v3.16.2

func ComputerUserIDToBytes(id string) ([]byte, error)

func CreateMultisigRawTx added in v3.8.1

func CreateMultisigRawTx(ctx context.Context, asset crypto.Hash, senders, receivers []string, threshold byte, inputs []*common.UTXO, amount common.Integer, traceId, extra string, su *SafeUser) (string, error)

func DecryptMessageData

func DecryptMessageData(data string, sessionId, private string) (string, error)

func DeleteAddress

func DeleteAddress(ctx context.Context, addressId string, user *SafeUser) error

func EncodeMtgExtra added in v3.16.0

func EncodeMtgExtra(appID string, extra []byte) string

func EncodeOperationMemo added in v3.16.0

func EncodeOperationMemo(operation byte, extra []byte) []byte

func EncryptEd25519PIN

func EncryptEd25519PIN(pin string, iterator uint64, current *SafeUser) (string, error)

func EncryptMessageData

func EncryptMessageData(data string, sessions []*Session, privateKey string) (string, error)

func EstimateStorageCost added in v3.11.0

func EstimateStorageCost(extra []byte) common.Integer

func GenerateUserChecksum

func GenerateUserChecksum(sessions []*Session) string

func GetChainName

func GetChainName(chainId string) string

func GetFullChains

func GetFullChains() map[string]bool

func HashMembers

func HashMembers(ids []string) string

func HmacSha1 added in v3.8.1

func HmacSha1(hmacKey string, data []byte) string

func HmacSha256 added in v3.8.1

func HmacSha256(key, data []byte) string

func IsChainId

func IsChainId(id string) bool

func MakeUniqueStringSlice

func MakeUniqueStringSlice(ss []string) []string

func NewTransport

func NewTransport(
	roundTripper http.RoundTripper,
	uid,
	sid,
	privateKey string) (*transport, error)

NewTransport returns a new transport based on the given inputs.

func OAuthGetAccessToken

func OAuthGetAccessToken(ctx context.Context, clientID, clientSecret string, authorizationCode string, codeVerifier string, ed25519 string) (string, string, string, error)

OAuthGetAccessToken get the access token of a user ed25519 is optional, only use it when you want to sign OAuth access token locally

func PostAcknowledgements

func PostAcknowledgements(ctx context.Context, requests []*ReceiptAcknowledgementRequest, user *SafeUser) error

func PostMessage

func PostMessage(ctx context.Context, conversationId, recipientId, messageId, category, dataBase64 string, user *SafeUser) error

func PostMessageRequest added in v3.4.0

func PostMessageRequest(ctx context.Context, message *MessageRequest, user *SafeUser) error

func PostMessages

func PostMessages(ctx context.Context, messages []*MessageRequest, user *SafeUser) error

func PrivateKeyToCurve25519

func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey ed25519.PrivateKey)

func PublicKeyToCurve25519

func PublicKeyToCurve25519(publicKey ed25519.PublicKey) ([]byte, error)

func ReadCode

func ReadCode[C Code](ctx context.Context, codeId string) (C, error)

func Request

func Request(ctx context.Context, method, path string, body []byte, accessToken string) ([]byte, error)

func RequestGhostRecipientsWithTraceId added in v3.7.0

func RequestGhostRecipientsWithTraceId(ctx context.Context, recipients []*TransactionRecipient, traceId string, u *SafeUser) (map[int]*GhostKeys, error)

func RequestWithId

func RequestWithId(ctx context.Context, method, path string, body []byte, accessToken, requestID string) ([]byte, error)

func SchemeApps

func SchemeApps(appID, action string, params map[string]string) string

SchemeApps scheme of an app

appID required, userID of an app
action optional, action about this scheme, default is "open"
params optional, parameters of any name or type can be passed when opening the bot homepage to facilitate the development of features like invitation codes, visitor tracking, etc

https://developers.mixin.one/docs/schema#popups-bot-profile

func SchemeCodes

func SchemeCodes(codeId string) string

SchemeCodes scheme of a code

code required

https://developers.mixin.one/docs/schema#popus-code-info

func SchemeConversations

func SchemeConversations(conversationID, userID string) string

SchemeConversations scheme of a conversation

userID optional, for user conversation only, if there's not conversation with the user, messenger will create the conversation first

https://developers.mixin.one/docs/schema#open-an-conversation

func SchemePay

func SchemePay(assetId, traceId, recipientId, memo string, amount number.Decimal) string

SchemePay scheme of a pay

assetId required
recipientId required, receiver's user id
amount require, transfer amount
traceId optional, UUID, prevent duplicate payment
memo optional, transaction memo

https://developers.mixin.one/docs/schema#invoke-payment-page

func SchemeSend

func SchemeSend(category SendSchemeCategory, data []byte, conversationID string) string

SchemeSend scheme of a share

category required, category of shared content
data required, shared content
conversationID optional, If you specify conversation and it is the conversation of the user's current session, the confirmation box shown above will appear, the message will be sent after the user clicks the confirmation; if the conversation is not specified or is not the conversation of the current session, an interface where the user chooses which session to share with will show up.

https://developers.mixin.one/docs/schema#sharing

func SchemeSnapshots

func SchemeSnapshots(snapshotId, traceId string) string

SchemeSnapshots scheme of a snapshot

snapshotId required if no traceId
traceId required if no snapshotId

https://developers.mixin.one/docs/schema#transfer-details-interface

func SchemeTransfer

func SchemeTransfer(userId string) string

SchemeTransfer scheme of a transfer

userId required

https://developers.mixin.one/docs/schema#invoke-transfer-page

func SchemeUsers

func SchemeUsers(userId string) string

SchemeUsers scheme of a user

userId required

https://developers.mixin.one/docs/schema#popups-user-profile

func SendKernelTransactionFromAccount added in v3.7.0

func SendKernelTransactionFromAccount(ctx context.Context, asset crypto.Hash, receivers []string, threshold byte, amount common.Integer, inputs []*common.UTXO, account *common.Address, traceId, extra string, safeUser *SafeUser) string

this function send a raw transaction to mixin api users from a kernel account this account should have private view key and private spend key

func SetBaseUri

func SetBaseUri(base string)

func SetBlazeUri

func SetBlazeUri(blaze string)

func SetUserAgent

func SetUserAgent(ua string)

func SharedKey

func SharedKey(public ed25519.PublicKey, private ed25519.PrivateKey) ([32]byte, error)

func SignAuthenticationToken

func SignAuthenticationToken(method, uri, body string, su *SafeUser) (string, error)

func SignAuthenticationTokenWithRequestID added in v3.7.9

func SignAuthenticationTokenWithRequestID(method, uri, body, requestID string, su *SafeUser) (string, error)

func SignAuthenticationTokenWithoutBody

func SignAuthenticationTokenWithoutBody(method, uri string, user *SafeUser) (string, error)

func SignOauthAccessToken

func SignOauthAccessToken(appID, authorizationID, privateKey, method, uri, body, scp string, requestID string) (string, error)

func SimpleRequest

func SimpleRequest(ctx context.Context, method, path string, body []byte) ([]byte, error)

func TIPBodyForSequencerRegister

func TIPBodyForSequencerRegister(userId, publicKey string) []byte

func TIPBodyForVerify

func TIPBodyForVerify(timestamp int64) []byte

func TIPMigrateBody

func TIPMigrateBody(pub ed25519.PublicKey) string

func TipBody

func TipBody(s string) []byte

func TipBodyForAddressAdd

func TipBodyForAddressAdd(assetId string, publicKey, keyTag, name string) []byte

func TipBodyForEmergencyContactCreate

func TipBodyForEmergencyContactCreate(verificationId, code string) []byte

func TipBodyForOwnershipTransfer

func TipBodyForOwnershipTransfer(userId string) []byte

func TipBodyForPhoneNumberUpdate

func TipBodyForPhoneNumberUpdate(verificationId, code string) []byte

func TipBodyForProvisioningUpdate

func TipBodyForProvisioningUpdate(deviceId string, secret string) []byte

func TipBodyForRawTransactionCreate

func TipBodyForRawTransactionCreate(assetId string, opponentKey string, opponentReceivers []string, opponentThreshold int64, amount number.Decimal, traceId, memo string) []byte

func TipBodyForTransfer

func TipBodyForTransfer(assetId string, counterUserId string, amount number.Decimal, traceId, memo string) []byte

func TipBodyForWithdrawalCreate

func TipBodyForWithdrawalCreate(addressId string, amount, fee number.Decimal, traceId, memo string) []byte

func UniqueConversationId

func UniqueConversationId(userId, recipientId string) string

func UniqueObjectId

func UniqueObjectId(args ...string) string

func UnlockMultisig

func UnlockMultisig(ctx context.Context, id, pin string, su *SafeUser) error

func UpdatePin

func UpdatePin(ctx context.Context, oldEncryptedPin, encryptedPin string, su *SafeUser) error

func UpdateTipPin

func UpdateTipPin(ctx context.Context, pin, pubTip string, su *SafeUser) error

func UserAssetBalance added in v3.7.3

func UserAssetBalance(ctx context.Context, userID, assetID, accessToken string) (common.Integer, error)

func UuidFromBytes

func UuidFromBytes(input []byte) (uuid.UUID, error)

func UuidFromString

func UuidFromString(id string) (uuid.UUID, error)

func UuidNewV4

func UuidNewV4() uuid.UUID

func WithAPIKey

func WithAPIKey(userId, sessionId, p string)

Types

type Address

type Address struct {
	AddressId   string    `json:"address_id"`
	AssetId     string    `json:"asset_id"`
	Label       string    `json:"label"`
	Destination string    `json:"destination"`
	Tag         string    `json:"tag"`
	Fee         string    `json:"fee"`
	Dust        string    `json:"dust"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func CreateAddress

func CreateAddress(ctx context.Context, in *AddressInput, user *SafeUser) (*Address, error)

func GetAddressesByAssetId

func GetAddressesByAssetId(ctx context.Context, assetId string, user *SafeUser) ([]*Address, error)

func ReadAddress

func ReadAddress(ctx context.Context, addressId string, user *SafeUser) (*Address, error)

type AddressInput

type AddressInput struct {
	AssetId     string
	Label       string
	Destination string
	Tag         string
}

type App

type App struct {
	Type             string    `json:"type"`
	AppId            string    `json:"app_id"`
	AppNumber        string    `json:"app_number"`
	RedirectURI      string    `json:"redirect_uri"`
	HomeURI          string    `json:"home_uri"`
	Name             string    `json:"name"`
	IconURL          string    `json:"icon_url"`
	Description      string    `json:"description"`
	Capabilities     []string  `json:"capabilities"`
	ResourcePatterns []string  `json:"resource_patterns"`
	Category         string    `json:"category"`
	CreatorId        string    `json:"creator_id"`
	UpdatedAt        time.Time `json:"updated_at"`
	IsVerified       bool      `json:"is_verified"`
}

func Migrate

func Migrate(ctx context.Context, receiver string, user *SafeUser) (*App, error)

type AppButtonView

type AppButtonView struct {
	Label  string `json:"label"`
	Action string `json:"action"`
	Color  string `json:"color"`
}

type AppCardAction added in v3.7.1

type AppCardAction = AppButtonView

type AppCardView added in v3.7.1

type AppCardView struct {
	AppID       string          `json:"app_id"`
	CoverURL    string          `json:"cover_url"`
	Title       string          `json:"title"`
	Description string          `json:"description"`
	Actions     []AppCardAction `json:"actions"`
	Shareable   bool            `json:"shareable"`
}

type Asset

type Asset struct {
	Type           string  `json:"type"`
	AssetID        string  `json:"asset_id"`
	ChainID        string  `json:"chain_id"`
	AssetKey       string  `json:"asset_key"`
	Precision      int     `json:"precision"`
	KernelAssetId  string  `json:"kernel_asset_id"`
	DisplaySymbol  string  `json:"display_symbol"`
	DisplayName    string  `json:"display_name"`
	Symbol         string  `json:"symbol"`
	Name           string  `json:"name"`
	IconURL        string  `json:"icon_url"`
	Amount         string  `json:"amount"`
	PriceBTC       string  `json:"price_btc"`
	PriceUSD       string  `json:"price_usd"`
	ChangeBTC      string  `json:"change_btc"`
	ChangeUSD      string  `json:"change_usd"`
	Confirmations  int64   `json:"confirmations"`
	Fee            string  `json:"fee"`
	Reserve        string  `json:"reserve"`
	SnapshotsCount int64   `json:"snapshots_count"`
	Capitalization float64 `json:"capitalization"`
	Liquidity      string  `json:"liquidity"`
	Level          int64   `json:"level"`

	CollectionHash string `json:"collection_hash,omitempty"`
}

func FetchAssets added in v3.8.1

func FetchAssets(ctx context.Context, assetIds []string, safeUser *SafeUser) ([]*Asset, error)

func ListAssetWithBalance added in v3.8.2

func ListAssetWithBalance(ctx context.Context, su *SafeUser) ([]*Asset, error)

func (*Asset) GetSymbol added in v3.8.3

func (asset *Asset) GetSymbol() string

type AssetFee added in v3.4.5

type AssetFee struct {
	Type    string `json:"type"`
	AssetID string `json:"asset_id"`
	Amount  string `json:"amount"`
}

func ReadAssetFee added in v3.4.5

func ReadAssetFee(ctx context.Context, assetId, destination string, su *SafeUser) ([]*AssetFee, error)

type AssetNetwork added in v3.4.2

type AssetNetwork struct {
	AssetID                   string    `json:"asset_id"`
	ChainID                   string    `json:"chain_id"`
	FeeAssetID                string    `json:"fee_asset_id"`
	DisplaySymbol             string    `json:"display_symbol"`
	DisplayName               string    `json:"display_name"`
	Symbol                    string    `json:"symbol"`
	Name                      string    `json:"name"`
	IconURL                   string    `json:"icon_url"`
	Balance                   string    `json:"balance"`
	Destination               string    `json:"destination"`
	Tag                       string    `json:"tag"`
	PriceBTC                  string    `json:"price_btc"`
	PriceUSD                  string    `json:"price_usd"`
	ChangeBTC                 string    `json:"change_btc"`
	ChangeUSD                 string    `json:"change_usd"`
	AssetKey                  string    `json:"asset_key"`
	Precision                 int       `json:"precision"`
	MixinID                   string    `json:"mixin_id"`
	KernelAssetID             string    `json:"kernel_asset_id"`
	Reserve                   string    `json:"reserve"`
	Dust                      string    `json:"dust"`
	Confirmations             int64     `json:"confirmations"`
	Capitalization            float64   `json:"capitalization"`
	Liquidity                 string    `json:"liquidity"`
	PriceUpdatedAt            time.Time `json:"price_updated_at"`
	WithdrawalMemoPossibility string    `json:"withdrawal_memo_possibility"`
	PrimitiveAssetId          string    `json:"primitive_asset_id,omitempty"`
	Level                     int64     `json:"level"`
	CollectionHash            string    `json:"collection_hash,omitempty"`
}

func AssetSearch

func AssetSearch(ctx context.Context, name string) ([]*AssetNetwork, error)

func ReadAsset

func ReadAsset(ctx context.Context, name string) (*AssetNetwork, error)

func ReadNetworkAssets added in v3.4.2

func ReadNetworkAssets(ctx context.Context) ([]*AssetNetwork, error)

func ReadNetworkAssetsTop added in v3.4.3

func ReadNetworkAssetsTop(ctx context.Context) ([]*AssetNetwork, error)

func (*AssetNetwork) GetSymbol added in v3.10.1

func (asset *AssetNetwork) GetSymbol() string

type AssetTicker

type AssetTicker struct {
	Type     string `json:"type"`
	PriceBTC string `json:"price_btc"`
	PriceUSD string `json:"price_usd"`
}

func ReadAssetTicker

func ReadAssetTicker(ctx context.Context, assetId string) (*AssetTicker, error)

func ReadAssetTickerWithOffset added in v3.9.8

func ReadAssetTickerWithOffset(ctx context.Context, assetId string, offset string) (*AssetTicker, error)

type Attachment

type Attachment struct {
	Type         string `json:"type"`
	AttachmentId string `json:"attachment_id"`
	ViewURL      string `json:"view_url"`
	UploadUrl    string `json:"upload_url"`
}

func AttachmentShow

func AttachmentShow(ctx context.Context, id string, user *SafeUser) (*Attachment, error)

func CreateAttachment

func CreateAttachment(ctx context.Context, user *SafeUser) (*Attachment, error)

type Authenticator

type Authenticator struct {
	Uid        string
	Sid        string
	PrivateKey string
}

func NewAuthenticator

func NewAuthenticator(uid, sid, privateKey string) *Authenticator

func (*Authenticator) BuildJWT

func (a *Authenticator) BuildJWT(method, uri, body string) (string, error)

type BareUserKeyStore added in v3.16.3

type BareUserKeyStore struct {
	AppId             string `json:"app_id"`
	SessionId         string `json:"session_id"`
	ServerPublicKey   string `json:"server_public_key"`
	SessionPrivateKey string `json:"session_private_key"`
	SpentPrivateKey   string `json:"spent_private_key"`
}

type BlazeClient

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

func NewBlazeClient

func NewBlazeClient(uid, sid, key string) *BlazeClient

func NewBlazeClientWithSafeUser added in v3.8.1

func NewBlazeClientWithSafeUser(user *SafeUser) *BlazeClient

func (*BlazeClient) Loop

func (b *BlazeClient) Loop(ctx context.Context, listener BlazeListener) error

func (*BlazeClient) SendAppButton

func (b *BlazeClient) SendAppButton(ctx context.Context, conversationId, recipientId, label, action, color string) error

func (*BlazeClient) SendAppCard

func (b *BlazeClient) SendAppCard(ctx context.Context, conversationId, recipientId, title, description, action, iconUrl string) error

func (*BlazeClient) SendContact

func (b *BlazeClient) SendContact(ctx context.Context, conversationId, recipientId, contactId string) error

func (*BlazeClient) SendGroupAppButton

func (b *BlazeClient) SendGroupAppButton(ctx context.Context, conversationId, recipientId string, buttons []*AppButtonView) error

func (*BlazeClient) SendMessage

func (b *BlazeClient) SendMessage(ctx context.Context, conversationId, recipientId, messageId, category, content, representativeId string) error

func (*BlazeClient) SendPlainText

func (b *BlazeClient) SendPlainText(ctx context.Context, msg MessageView, content string) error

func (*BlazeClient) SendPost

func (b *BlazeClient) SendPost(ctx context.Context, msg MessageView, content string) error

func (*BlazeClient) SendRecallMessage

func (b *BlazeClient) SendRecallMessage(ctx context.Context, conversationId, recipientId, recallMessageId string) error

func (*BlazeClient) SetupDailer

func (b *BlazeClient) SetupDailer(dailer *websocket.Dialer)

type BlazeListener

type BlazeListener interface {
	OnMessage(ctx context.Context, msg MessageView, userId string) error
	OnAckReceipt(ctx context.Context, msg MessageView, userId string) error
	SyncAck() bool
}

type BlazeMessage

type BlazeMessage struct {
	Id     string          `json:"id"`
	Action string          `json:"action"`
	Params map[string]any  `json:"params,omitempty"`
	Data   json.RawMessage `json:"data,omitempty"`
	Error  *Error          `json:"error,omitempty"`
}

type BotAuthCache added in v3.9.2

type BotAuthCache interface {
	Get(key string) ([]byte, error)
	Put(key string, value []byte) error
	Delete(key string) error
}

type BotAuthClient added in v3.9.2

type BotAuthClient struct {
	Cache    BotAuthCache
	SafeUser *SafeUser
	Logger   *slog.Logger
}

func NewBotAuthClient added in v3.9.2

func NewBotAuthClient(cache BotAuthCache, su *SafeUser, logger *slog.Logger) *BotAuthClient

func NewDefaultClient added in v3.9.2

func NewDefaultClient(su *SafeUser, logger *slog.Logger) *BotAuthClient

func (*BotAuthClient) SignRequest added in v3.9.2

func (c *BotAuthClient) SignRequest(ctx context.Context, ts int64, botUserId string, r *http.Request) (string, error)

type Code

type Code interface {
	*MultisigRequest | *User | *Conversation
}

type Collection added in v3.15.0

type Collection struct {
	AssetKey       string    `json:"asset_key"`
	CollectionHash string    `json:"collection_hash"`
	KernelAssetID  string    `json:"kernel_asset_id"`
	Name           string    `json:"name"`
	Symbol         string    `json:"symbol"`
	Description    string    `json:"description"`
	IconURL        string    `json:"icon_url"`
	Supply         string    `json:"supply"`
	Unit           string    `json:"unit"`
	MinimumPrice   string    `json:"minimum_price"`
	Treasury       *Treasury `json:"treasury,omitempty"`
	Type           string    `json:"type"`
	CreatedAt      time.Time `json:"created_at"`
	UpdatedAt      time.Time `json:"updated_at"`
}

Collection represents the API response structure for collection data

func ReadCollection added in v3.15.0

func ReadCollection(ctx context.Context, collectionHash string) (*Collection, error)

ReadCollection reads collection information from Mixin API

type ComputerDeployedAsset added in v3.16.0

type ComputerDeployedAsset struct {
	AssetID  string `json:"asset_id"`
	ChainID  string `json:"chain_id"`
	Address  string `json:"address"`
	Name     string `json:"name"`
	Symbol   string `json:"symbol"`
	Decimals int64  `json:"decimals"`
	PriceUsd string `json:"price_usd"`
	IconURL  string `json:"uri"`
}

func GetComputerDeployedAssets added in v3.16.0

func GetComputerDeployedAssets(ctx context.Context) ([]*ComputerDeployedAsset, error)

func (ComputerDeployedAsset) GetSolanaAssetId added in v3.16.7

func (c ComputerDeployedAsset) GetSolanaAssetId() string

type ComputerFeeResponse added in v3.16.0

type ComputerFeeResponse struct {
	FeeID     string `json:"fee_id"`
	XINAmount string `json:"xin_amount"`

	Error `json:"error"`
}

func GetFeeOnXINBasedOnSOL added in v3.16.0

func GetFeeOnXINBasedOnSOL(ctx context.Context, solAmount string) (*ComputerFeeResponse, error)

type ComputerInfoResponse added in v3.16.0

type ComputerInfoResponse struct {
	ObserverId string `json:"observer"`
	Payer      string `json:"payer"`
	Height     int64  `json:"height"`
	Members    struct {
		AppId     string   `json:"app_id"`
		Members   []string `json:"members"`
		Threshold int      `json:"threshold"`
	} `json:"members"`
	Params struct {
		Operation struct {
			Asset string `json:"asset"`
			Price string `json:"price"`
		} `json:"operation"`
	} `json:"params"`

	Error `json:"error"`
}

func GetComputerInfo added in v3.16.0

func GetComputerInfo(ctx context.Context) (*ComputerInfoResponse, error)

type ComputerNonceAccountResponse added in v3.16.0

type ComputerNonceAccountResponse struct {
	Mix          string `json:"mix"`
	NonceAddress string `json:"nonce_address"`
	NonceHash    string `json:"nonce_hash"`

	Error `json:"error"`
}

func LockComputerNonceAccount added in v3.16.0

func LockComputerNonceAccount(ctx context.Context, mix string) (*ComputerNonceAccountResponse, error)

type ComputerSystemCall added in v3.16.1

type ComputerSystemCall struct {
	ID           string `json:"id"`
	Type         string `json:"type"`
	UserID       string `json:"user_id"`
	NonceAccount string `json:"nonce_account"`
	Raw          string `json:"raw"`
	State        string `json:"state"`
	Hash         string `json:"hash"`
}

type ComputerSystemCallResponse added in v3.16.0

type ComputerSystemCallResponse struct {
	ComputerSystemCall
	Reason   string               `json:"reason"`
	SubCalls []ComputerSystemCall `json:"subs"`

	Error `json:"error"`
}

func GetComputerSystemCall added in v3.16.0

func GetComputerSystemCall(ctx context.Context, id string) (*ComputerSystemCallResponse, error)

type ComputerUserResponse added in v3.16.0

type ComputerUserResponse struct {
	ID           string `json:"id"`
	ChainAddress string `json:"chain_address"`
	MixAddress   string `json:"mix_address"`

	Error `json:"error"`
}

func GetComputerUser added in v3.16.0

func GetComputerUser(ctx context.Context, addr string) (*ComputerUserResponse, error)

type Conversation

type Conversation struct {
	ConversationId string    `json:"conversation_id"`
	CreatorId      string    `json:"creator_id"`
	Category       string    `json:"category"`
	Name           string    `json:"name"`
	IconURL        string    `json:"icon_url"`
	Announcement   string    `json:"announcement"`
	CreatedAt      time.Time `json:"created_at"`
	CodeUrl        string    `json:"code_url"`

	Participants        []Participant            `json:"participants"`
	ParticipantSessions []ParticipantSessionView `json:"participant_sessions"`
}

func ConversationShow

func ConversationShow(ctx context.Context, conversationId string, user *SafeUser) (*Conversation, error)

func ConversationShowByToken

func ConversationShowByToken(ctx context.Context, conversationId string, accessToken string) (*Conversation, error)

func CreateContactConversation

func CreateContactConversation(ctx context.Context, participantID string, user *SafeUser) (*Conversation, error)

func CreateConversation

func CreateConversation(ctx context.Context, category, conversationId string, name, announcement string, participants []Participant, user *SafeUser) (*Conversation, error)

func JoinConversation

func JoinConversation(ctx context.Context, conversationId string, user *SafeUser) (*Conversation, error)

func RotateConversation added in v3.7.4

func RotateConversation(ctx context.Context, conversationId string, user *SafeUser) (*Conversation, error)

func UpdateParticipants added in v3.7.5

func UpdateParticipants(ctx context.Context, conversationId, action string, requests []Participant, user *SafeUser) (*Conversation, error)

type DepositEntryView

type DepositEntryView struct {
	Type          string   `json:"type"`
	EntryID       string   `json:"entry_id"`
	Threshold     int64    `json:"threshold"`
	Members       []string `json:"members"`
	Destination   string   `json:"destination"`
	Tag           string   `json:"tag"`
	SafeSignature string   `json:"signature"`
	ChainID       string   `json:"chain_id"`
	IsPrimary     bool     `json:"is_primary"`
}

func CreateDepositEntry

func CreateDepositEntry(ctx context.Context, chainID string, members []string, threshold int64, user *SafeUser) ([]*DepositEntryView, error)

type Error

type Error struct {
	Status      int    `json:"status"`
	Code        int    `json:"code"`
	Description string `json:"description"`
	Extra       any    `json:"extra,omitempty"`
	// contains filtered or unexported fields
}

func AuthorizationError

func AuthorizationError(ctx context.Context) Error

func BadDataError

func BadDataError(ctx context.Context) Error

func BlazeServerError

func BlazeServerError(ctx context.Context, err error) Error

func ForbiddenError

func ForbiddenError(ctx context.Context) Error

func NotFoundError added in v3.4.4

func NotFoundError(ctx context.Context) Error

func ServerError

func ServerError(ctx context.Context, err error) Error

func (Error) Error

func (sessionError Error) Error() string

type Fiat

type Fiat struct {
	Code string  `json:"code"`
	Rate float64 `json:"rate"`
}

func Fiats

func Fiats(ctx context.Context) ([]*Fiat, error)

func GetFiats

func GetFiats(ctx context.Context) ([]*Fiat, error)

type GhostKeyRequest

type GhostKeyRequest struct {
	Receivers []string `json:"receivers"`
	Index     uint     `json:"index"`
	Hint      string   `json:"hint"`
}

type GhostKeys

type GhostKeys struct {
	Type string   `json:"type"`
	Mask string   `json:"mask"`
	Keys []string `json:"keys"`
}

func RequestSafeGhostKeys

func RequestSafeGhostKeys(ctx context.Context, gkr []*GhostKeyRequest, user *SafeUser) ([]*GhostKeys, error)

func (GhostKeys) KeysSlice

func (g GhostKeys) KeysSlice() []*crypto.Key

type ImageMessagePayload

type ImageMessagePayload struct {
	AttachmentId string `json:"attachment_id"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
	MimeType     string `json:"mime_type"`
	Thumbnail    string `json:"thumbnail"`
	Size         int64  `json:"size"`
}

type Inscription added in v3.15.0

type Inscription struct {
	InscriptionHash string    `json:"inscription_hash"`
	CollectionHash  string    `json:"collection_hash"`
	ContentType     string    `json:"content_type"`
	ContentURL      string    `json:"content_url"`
	CreatedAt       time.Time `json:"created_at"`
	OccupiedBy      string    `json:"occupied_by"`
	Owner           string    `json:"owner"`
	Recipient       string    `json:"recipient"`
	Sequence        int64     `json:"sequence"`
	Type            string    `json:"type"`
	UpdatedAt       time.Time `json:"updated_at"`
}

Inscription represents the API response structure for inscription data

func ReadCollectionItems added in v3.15.0

func ReadCollectionItems(ctx context.Context, collectionHash string) ([]*Inscription, error)

ReadCollectionItems reads all items in a collection from Mixin API

func ReadInscription added in v3.15.0

func ReadInscription(ctx context.Context, inscriptionHash string) (*Inscription, error)

ReadInscription reads inscription information from Mixin API

type InscriptionDeploy added in v3.4.8

type InscriptionDeploy struct {
	// the version must be 1
	Version uint8 `json:"version"`

	// 1 distribute tokens per inscription
	// 2 distribute tokens after inscription progress done
	Mode uint8 `json:"mode"`

	// supply is the total supply of all tokens
	// unit is the amount of tokens per inscription
	//
	// if supply is 1,000,000,000 and unit is 1,000,000,
	// then there should be 1,000 inscription operations
	// 1 inscription represents 1 collectible, so there will be 1,000 NFTs
	Unit   string `json:"unit"`
	Supply string `json:"supply"`

	// the token symbol and name are required and must be valid UTF8
	Symbol string `json:"symbol"`
	Name   string `json:"name"`

	// the icon must be in valid data URI scheme
	// e.g. image/webp;base64,IVVB===
	Icon string `json:"icon"`

	// only needed if the deployer wants to limit the NFT contents of all
	// inscriptions, base64 of all NFT blake3 checksums, and all checksums
	// must be different from each other
	Checksum string `json:"checksum,omitempty"`

	// ratio of each inscribed tokens will be kept in treasury
	// the treasury tokens will be distributed to the recipient MIX address
	// at the same time  as defined by the mode
	//
	// For MAO, the ratio will be 0.9, and each collectible will only cost
	// 10% of the unit tokens, so only the inscribers have NFTs, but not
	// the treasury tokens, however they can occupy a vacant NFT.
	Treasury *struct {
		Ratio     string `json:"ratio"`
		Recipient string `json:"recipient"`
	} `json:"treasury,omitempty"`
}

type InscriptionDistribute added in v3.4.8

type InscriptionDistribute struct {
	// operation must be distribute
	Operation string `json:"distribute"`

	// sequence must monoticially increase from 0
	Sequence uint64 `json:"sequence"`
}

type InscriptionInscribe added in v3.4.8

type InscriptionInscribe struct {
	// operation must be inscribe
	Operation string `json:"operation"`

	// Recipient can only be MIX address, not ghost keys, because
	// otherwise the keys may be used by others, then redeemed invalid
	Recipient string `json:"recipient"`

	// data URI scheme
	// application/octet-stream;key=fingerprint;base64,iVBO==
	// image/webp;trait=one;base64,iVBO==
	// text/plain;charset=UTF-8,cedric.mao
	// text/plain;charset=UTF-8;base64,iii==
	Content string `json:"content,omitempty"`
}

type InscriptionOccupy added in v3.4.8

type InscriptionOccupy struct {
	// operation must be occupy
	Operation string `json:"operation"`

	// the integer sequence number of the NFT inscription
	Sequence uint64 `json:"sequence"`
}

type InvoiceEntry added in v3.9.6

type InvoiceEntry struct {
	TraceId         uuid.UUID
	AssetId         uuid.UUID
	Amount          common.Integer
	Extra           []byte
	IndexReferences []byte
	HashReferences  []crypto.Hash
}

func (*InvoiceEntry) IsStorage added in v3.11.0

func (e *InvoiceEntry) IsStorage() bool

type KernelDepositView

type KernelDepositView struct {
	Chain        string `json:"chain"`
	DepositHash  string `json:"deposit_hash"`
	DepositIndex int64  `json:"deposit_index"`
}

type KernelTransactionRequestCreateRequest

type KernelTransactionRequestCreateRequest struct {
	RequestID string `json:"request_id"`
	Raw       string `json:"raw"`
}

type KeystoreLegacy added in v3.16.3

type KeystoreLegacy struct {
	Pin        string `json:"pin"`
	SessionId  string `json:"session_id"`
	PinToken   string `json:"pin_token"`
	PrivateKey string `json:"private_key"`
}

type LegacySnapshot added in v3.2.0

type LegacySnapshot struct {
	Type            string    `json:"type"`
	SnapshotId      string    `json:"snapshot_id"`
	AssetId         string    `json:"asset_id"`
	Amount          string    `json:"amount"`
	OpeningBalance  string    `json:"opening_balance"`
	ClosingBalance  string    `json:"closing_balance"`
	TransactionHash string    `json:"transaction_hash,omitempty"`
	SnapshotHash    string    `json:"snapshot_hash,omitempty"`
	SnapshotAt      time.Time `json:"snapshot_at,omitempty"`
	CreatedAt       time.Time `json:"created_at"`

	// deposit &  withdrawal
	OutputIndex int64  `json:"output_index,omitempty"` // deposit
	Sender      string `json:"sender,omitempty"`       // deposit
	OpponentId  string `json:"opponent_id,omitempty"`  // transfer
	TraceId     string `json:"trace_id,omitempty"`     // transfer & raw & withdrawal
	Memo        string `json:"memo,omitempty"`         // transfer & raw & withdrawal

	OpponentKey               string   `json:"opponent_key"`       // raw
	OpponentMultisigReceivers []string `json:"opponent_receivers"` // raw
	OpponentMultisigThreshold int64    `json:"opponent_threshold"` // raw
	State                     string   `json:"state"`              // raw & withdrawal
	// withdrawal
	Receiver      string `json:"receiver,omitempty"`
	Confirmations int64  `json:"confirmations,omitempty"`
	Fee           struct {
		Amount  string `json:"amount"`
		AssetId string `json:"asset_id"`
	} `json:"fee,omitempty"`
}

func NetworkSnapshot added in v3.2.0

func NetworkSnapshot(ctx context.Context, snapshotId string) (*LegacySnapshot, error)

func NetworkSnapshotByToken added in v3.2.0

func NetworkSnapshotByToken(ctx context.Context, snapshotId, accessToken string) (*LegacySnapshot, error)

func SnapshotById added in v3.2.0

func SnapshotById(ctx context.Context, snapshotId string, uid, sid, sessionKey string) (*LegacySnapshot, error)

func SnapshotByToken added in v3.2.0

func SnapshotByToken(ctx context.Context, snapshotId string, accessToken string) (*LegacySnapshot, error)

func SnapshotByTraceId added in v3.2.0

func SnapshotByTraceId(ctx context.Context, traceId string, uid, sid, sessionKey string) (*LegacySnapshot, error)

func Snapshots added in v3.2.0

func Snapshots(ctx context.Context, limit int, offset, assetId, order, uid, sid, sessionKey string) ([]*LegacySnapshot, error)

func SnapshotsByToken added in v3.2.0

func SnapshotsByToken(ctx context.Context, limit int, offset, assetId, order, accessToken string) ([]*LegacySnapshot, error)

type LegacySnapshotShort added in v3.2.0

type LegacySnapshotShort struct {
	Type       string `json:"type"`
	SnapshotId string `json:"snapshot_id"`
	Source     string `json:"source"`
	Amount     string `json:"amount"`
	Asset      struct {
		Type     string `json:"type"`
		AssetId  string `json:"asset_id"`
		ChainId  string `json:"chain_id"`
		MixinId  string `json:"mixin_id"`
		Symbol   string `json:"symbol"`
		Name     string `json:"name"`
		AssetKey string `json:"asset_key"`
		IconUrl  string `json:"icon_url"`
	} `json:"asset"`
	State        string    `json:"state"`
	SnapshotHash string    `json:"snapshot_hash"`
	CreatedAt    time.Time `json:"created_at"`
	TraceId      string    `json:"trace_id"`
	OpponentId   string    `json:"opponent_id"`
	Memo         string    `json:"data"`
}

func NetworkSnapshots added in v3.2.0

func NetworkSnapshots(ctx context.Context, limit int, offset, assetId, order string) ([]*LegacySnapshotShort, error)

func NetworkSnapshotsByToken added in v3.2.0

func NetworkSnapshotsByToken(ctx context.Context, limit int, offset, assetId, order, uid, sid, sessionKey string) ([]*LegacySnapshotShort, error)

type LiveMessagePayload

type LiveMessagePayload struct {
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	ThumbUrl string `json:"thumb_url"`
	Url      string `json:"url"`
}

type MapCache added in v3.9.2

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

func NewMapCache added in v3.9.2

func NewMapCache() *MapCache

func (*MapCache) Delete added in v3.9.2

func (c *MapCache) Delete(key string) error

func (*MapCache) Get added in v3.9.2

func (c *MapCache) Get(key string) ([]byte, error)

func (*MapCache) Put added in v3.9.2

func (c *MapCache) Put(key string, value []byte) error

type Membership added in v3.15.0

type Membership struct {
	Plan      string    `json:"plan"`
	ExpiredAt time.Time `json:"expired_at"`
}

type MessageRequest

type MessageRequest struct {
	ConversationId   string `json:"conversation_id"`
	RecipientId      string `json:"recipient_id"`
	MessageId        string `json:"message_id"`
	Category         string `json:"category"`
	DataBase64       string `json:"data_base64"`
	RepresentativeId string `json:"representative_id"`
	QuoteMessageId   string `json:"quote_message_id"`
}

type MessageView

type MessageView struct {
	ConversationId   string    `json:"conversation_id"`
	UserId           string    `json:"user_id"`
	MessageId        string    `json:"message_id"`
	Category         string    `json:"category"`
	DataBase64       string    `json:"data_base64"`
	RepresentativeId string    `json:"representative_id"`
	QuoteMessageId   string    `json:"quote_message_id"`
	Status           string    `json:"status"`
	Source           string    `json:"source"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

type MessageWithSession added in v3.12.2

type MessageWithSession struct {
	Type             string    `json:"type"`
	RepresentativeId string    `json:"representative_id"`
	QuoteMessageId   string    `json:"quote_message_id"`
	ConversationId   string    `json:"conversation_id"`
	UserId           string    `json:"user_id"`
	SessionId        string    `json:"session_id"`
	MessageId        string    `json:"message_id"`
	Category         string    `json:"category"`
	Data             string    `json:"data"`
	DataBase64       string    `json:"data_base64"`
	Status           string    `json:"status"`
	Source           string    `json:"source"`
	Silent           bool      `json:"silent"`
	ExpireIn         int64     `json:"expire_in"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

func SafeNotifySnapshot added in v3.12.2

func SafeNotifySnapshot(ctx context.Context, transactionHash string, outputIndex int64, receiverID string, su *SafeUser) (*MessageWithSession, error)

type MixAddress

type MixAddress struct {
	Version   byte
	Threshold byte
	// contains filtered or unexported fields
}

func NewMainnetMixAddress

func NewMainnetMixAddress(members []string, threshold byte) *MixAddress

func NewMixAddressFromBytesUnchecked added in v3.9.6

func NewMixAddressFromBytesUnchecked(payload []byte) (*MixAddress, error)

func NewMixAddressFromString

func NewMixAddressFromString(s string) (*MixAddress, error)

func NewUUIDMixAddress

func NewUUIDMixAddress(members []string, threshold byte) *MixAddress

func StorageRecipient added in v3.11.0

func StorageRecipient() *MixAddress

func (*MixAddress) BytesUnchecked added in v3.9.6

func (ma *MixAddress) BytesUnchecked() []byte

func (*MixAddress) Members

func (ma *MixAddress) Members() []string

func (*MixAddress) RequestOrGenerateGhostKeys

func (ma *MixAddress) RequestOrGenerateGhostKeys(ctx context.Context, outputIndex uint, u *SafeUser) (*GhostKeys, error)

func (*MixAddress) String

func (ma *MixAddress) String() string

type MixinInvoice added in v3.9.6

type MixinInvoice struct {
	Recipient *MixAddress
	Entries   []*InvoiceEntry
	// contains filtered or unexported fields
}

func NewMixinInvoice added in v3.9.6

func NewMixinInvoice(recipient string) *MixinInvoice

func NewMixinInvoiceFromString added in v3.9.6

func NewMixinInvoiceFromString(s string) (*MixinInvoice, error)

func (*MixinInvoice) AddEntry added in v3.9.6

func (mi *MixinInvoice) AddEntry(traceId, assetId string, amount common.Integer, extra []byte, indexReferences []byte, externalReferences []crypto.Hash)

func (*MixinInvoice) AddStorageEntry added in v3.11.0

func (mi *MixinInvoice) AddStorageEntry(traceId string, extra []byte)

func (*MixinInvoice) BytesUnchecked added in v3.9.6

func (mi *MixinInvoice) BytesUnchecked() []byte

func (*MixinInvoice) String added in v3.9.6

func (mi *MixinInvoice) String() string

type MultisigRequest

type MultisigRequest struct {
	Type            string    `json:"type"`
	RequestId       string    `json:"request_id"`
	UserId          string    `json:"user_id"`
	AssetId         string    `json:"asset_id"`
	Amount          string    `json:"amount"`
	Threshold       int64     `json:"threshold"`
	Senders         []string  `json:"senders"`
	Receivers       []string  `json:"receivers"`
	Signers         []string  `json:"signers"`
	Memo            string    `json:"memo"`
	Action          string    `json:"action"`
	State           string    `json:"state"`
	TransactionHash string    `json:"transaction_hash"`
	RawTransaction  string    `json:"raw_transaction"`
	CreatedAt       time.Time `json:"created_at"`
	CodeId          string    `json:"code_id"`
}

func CreateMultisig

func CreateMultisig(ctx context.Context, action, raw string, su *SafeUser) (*MultisigRequest, error)

CreateMultisig create a multisigs request which action is `unlock` or `sign`

func ReadMultisigByCode

func ReadMultisigByCode(ctx context.Context, codeId string) (*MultisigRequest, error)

func SignMultisig

func SignMultisig(ctx context.Context, id, pin string, su *SafeUser) (*MultisigRequest, error)

type MultisigUTXO

type MultisigUTXO struct {
	Type            string    `json:"type"`
	UserId          string    `json:"user_id"`
	UTXOId          string    `json:"utxo_id"`
	AssetId         string    `json:"asset_id"`
	TransactionHash string    `json:"transaction_hash"`
	OutputIndex     int64     `json:"output_index"`
	Amount          string    `json:"amount"`
	Threshold       int64     `json:"threshold"`
	Members         []string  `json:"members"`
	Memo            string    `json:"memo"`
	State           string    `json:"state"`
	Sender          string    `json:"sender"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	SignedBy        string    `json:"signed_by"`
	SignedTx        string    `json:"signed_tx"`
}

func ReadMultisigs

func ReadMultisigs(ctx context.Context, limit int, offset, membersHash, threshold, state string, su *SafeUser) ([]*MultisigUTXO, error)

state: spent, unspent, signed

func ReadMultisigsLegacy

func ReadMultisigsLegacy(ctx context.Context, limit int, offset string, user *SafeUser) ([]*MultisigUTXO, error)

type NetworkChain

type NetworkChain struct {
	Type                   string    `json:"type"`
	ChainId                string    `json:"chain_id"`
	Name                   string    `json:"name"`
	Symbol                 string    `json:"symbol"`
	IconURL                string    `json:"icon_url"`
	ManagedBlockHeight     int64     `json:"managed_block_height"`
	DepositBlockHeight     int64     `json:"deposit_block_height"`
	ExternalBlockHeight    int64     `json:"external_block_height"`
	Threshold              int       `json:"threshold"`
	WithdrawalTimestamp    time.Time `json:"withdrawal_timestamp"`
	WithdrawalPendingCount int64     `json:"withdrawal_pending_count"`
	WithdrawalFee          string    `json:"withdrawal_fee"`
	IsSynchronized         bool      `json:"is_synchronized"`
}

func ReadNetworkChainById

func ReadNetworkChainById(ctx context.Context, chainId string) (*NetworkChain, error)

func ReadNetworkChains

func ReadNetworkChains(ctx context.Context) ([]*NetworkChain, error)

type Output

type Output struct {
	Type               string    `json:"type"`
	OutputID           string    `json:"output_id"`
	TransactionHash    string    `json:"transaction_hash"`
	OutputIndex        uint      `json:"output_index"`
	AssetId            string    `json:"asset_id"`
	KernelAssetId      string    `json:"kernel_asset_id"`
	Amount             string    `json:"amount"`
	Mask               string    `json:"mask"`
	Keys               []string  `json:"keys"`
	SendersHash        string    `json:"senders_hash"`
	SendersThreshold   int64     `json:"senders_threshold"`
	Senders            []string  `json:"senders"`
	ReceiversHash      string    `json:"receivers_hash"`
	ReceiversThreshold int64     `json:"receivers_threshold"`
	Receivers          []string  `json:"receivers"`
	Extra              string    `json:"extra"`
	State              string    `json:"state"`
	Sequence           int64     `json:"sequence"`
	CreatedAt          time.Time `json:"created_at"`
	Signers            []string  `json:"signers"`
	SignedBy           string    `json:"signed_by"`

	InscriptionHash string             `json:"inscription_hash,omitempty"`
	Deposit         *KernelDepositView `json:"deposit,omitempty"`
	RequestId       string             `json:"request_id,omitempty"`
}

func GetOutput added in v3.7.0

func GetOutput(ctx context.Context, id string, u *SafeUser) (*Output, error)

func ListOutputs

func ListOutputs(ctx context.Context, membersHash string, threshold byte, assetId, state string, offset uint64, limit int, u *SafeUser) ([]*Output, error)

func ListOutputsByToken added in v3.7.3

func ListOutputsByToken(ctx context.Context, membersHash string, threshold byte, assetId, state string, offset uint64, limit int, accessToken string) ([]*Output, error)

func ListUnspentOutputs

func ListUnspentOutputs(ctx context.Context, membersHash string, threshold byte, kernelAssetId string, u *SafeUser) ([]*Output, error)

func ListUnspentOutputsByToken added in v3.7.3

func ListUnspentOutputsByToken(ctx context.Context, membersHash string, threshold byte, kernelAssetId string, accessToken string) ([]*Output, error)

type OutputReceiverView added in v3.6.0

type OutputReceiverView struct {
	Members     []string `json:"members"`
	MembersHash string   `json:"members_hash"`
	Threshold   int      `json:"threshold"`

	Destination    string `json:"destination"`
	Tag            string `json:"tag"`
	WithdrawalHash string `json:"withdrawal_hash"`
}

type Participant

type Participant struct {
	UserId    string    `json:"user_id"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"created_at"`
}

type ParticipantSessionView

type ParticipantSessionView struct {
	Type      string `json:"type"`
	UserId    string `json:"user_id"`
	SessionId string `json:"session_id"`
	PublicKey string `json:"public_key"`
}

type RecallMessagePayload

type RecallMessagePayload struct {
	MessageId string `json:"message_id"`
}

type ReceiptAcknowledgementRequest

type ReceiptAcknowledgementRequest struct {
	MessageId string `json:"message_id"`
	Status    string `json:"status"`
}

type SafeDepositPending added in v3.4.2

type SafeDepositPending struct {
	Amount          string    `json:"amount"`
	AssetID         string    `json:"asset_id"`
	AssetKey        string    `json:"asset_key"`
	BlockHash       string    `json:"block_hash"`
	BlockNumber     int       `json:"block_number"`
	ChainID         string    `json:"chain_id"`
	Confirmations   int       `json:"confirmations"`
	CreatedAt       time.Time `json:"created_at"`
	DepositID       string    `json:"deposit_id"`
	Destination     string    `json:"destination"`
	Extra           string    `json:"extra"`
	KernelAssetID   string    `json:"kernel_asset_id"`
	OutputIndex     int       `json:"output_index"`
	Sender          string    `json:"sender"`
	State           string    `json:"state"`
	Tag             string    `json:"tag"`
	Threshold       int       `json:"threshold"`
	TransactionHash string    `json:"transaction_hash"`
	UpdatedAt       time.Time `json:"updated_at"`
}

func FetchPendingSafeDeposits added in v3.10.1

func FetchPendingSafeDeposits(ctx context.Context) ([]*SafeDepositPending, error)

type SafeDepositView

type SafeDepositView struct {
	DepositHash  string `json:"deposit_hash"`
	DepositIndex int64  `json:"deposit_index"`
	Sender       string `json:"sender"`
	Destination  string `json:"destination"`
	Tag          string `json:"tag"`
}

type SafeMultisigRequest added in v3.6.0

type SafeMultisigRequest struct {
	Type             string    `json:"type"`
	RequestID        string    `json:"request_id"`
	TransactionHash  string    `json:"transaction_hash"`
	AssetId          string    `json:"asset_id"`
	KernelAssetID    string    `json:"kernel_asset_id"`
	Amount           string    `json:"amount"`
	SendersHash      string    `json:"senders_hash"`
	SendersThreshold int64     `json:"senders_threshold"`
	Senders          []string  `json:"senders"`
	Signers          []string  `json:"signers"`
	RevokedBy        string    `json:"revoked_by"`
	Extra            string    `json:"extra"`
	RawTransaction   string    `json:"raw_transaction"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`

	InscriptionHash string                `json:"inscription_hash,omitempty"`
	Receivers       []*OutputReceiverView `json:"receivers,omitempty"`
	Views           []string              `json:"views,omitempty"`
}

func CreateSafeMultisigRequest added in v3.8.0

func CreateSafeMultisigRequest(ctx context.Context, request []*KernelTransactionRequestCreateRequest, user *SafeUser) ([]*SafeMultisigRequest, error)

func FetchSafeMultisigRequest added in v3.6.0

func FetchSafeMultisigRequest(ctx context.Context, idOrHash string, user *SafeUser) (*SafeMultisigRequest, error)

type SafeSnapshot

type SafeSnapshot struct {
	Type            string    `json:"type"`
	SnapshotID      string    `json:"snapshot_id"`
	UserID          string    `json:"user_id"`
	OpponentID      string    `json:"opponent_id"`
	TransactionHash string    `json:"transaction_hash"`
	AssetID         string    `json:"asset_id"`
	KernelAssetID   string    `json:"kernel_asset_id"`
	Amount          string    `json:"amount"`
	Memo            string    `json:"memo"`
	RequestId       string    `json:"request_id"`
	CreatedAt       time.Time `json:"created_at"`
	Level           int64     `json:"level"`

	Deposit    *SafeDepositView    `json:"deposit,omitempty"`
	Withdrawal *SafeWithdrawalView `json:"withdrawal,omitempty"`
}

func SafeSnapshotById

func SafeSnapshotById(ctx context.Context, snapshotId string, su *SafeUser) (*SafeSnapshot, error)

func SafeSnapshotByToken

func SafeSnapshotByToken(ctx context.Context, snapshotId string, accessToken string) (*SafeSnapshot, error)

func SafeSnapshots

func SafeSnapshots(ctx context.Context, limit int, app, assetId, opponent, offset string, su *SafeUser) ([]*SafeSnapshot, error)

func SafeSnapshotsByToken

func SafeSnapshotsByToken(ctx context.Context, limit int, app, assetId, opponent, offset, accessToken string) ([]*SafeSnapshot, error)

type SafeUser

type SafeUser struct {
	// this is the app children user uuid or the app uuid of messenger api
	// user id can never change
	UserId string `json:"app_id"`

	// session id could be rotated by the app owner
	SessionId string `json:"session_id"`

	// session private key rotates with the session id
	// this key is used for all authentication of messenger api
	SessionPrivateKey string `json:"session_private_key"` // hex

	// server public key rotates with the session id
	// server public key is used to verify signature of server response
	// could also be used to do ecdh with session private key
	ServerPublicKey string `json:"server_public_key"` // hex

	// spend private key is used to query or send money
	// this is the mixin kernel spend private key
	// spend private key can never change
	SpendPrivateKey string `json:"spend_private_key"` // hex

	// for some legacy private key already hash sum
	IsSpendPrivateSum bool `json:"-"`
}

func NewSafeUser added in v3.7.0

func NewSafeUser(userId, sessionId, sessionPrivateKey string) *SafeUser

type SafeWithdrawalView

type SafeWithdrawalView struct {
	WithdrawalHash string `json:"withdrawal_hash"`
	Receiver       string `json:"receiver"`
}

type SendSchemeCategory

type SendSchemeCategory = string
const (
	SendSchemeCategoryText    SendSchemeCategory = "text"
	SendSchemeCategoryImage   SendSchemeCategory = "image"
	SendSchemeCategoryContact SendSchemeCategory = "contact"
	SendSchemeCategoryAppCard SendSchemeCategory = "app_card"
	SendSchemeCategoryLive    SendSchemeCategory = "live"
	SendSchemeCategoryPost    SendSchemeCategory = "post"
)

type SequencerTransactionRequest

type SequencerTransactionRequest struct {
	RequestID        string                 `json:"request_id"`
	TransactionHash  string                 `json:"transaction_hash"`
	Asset            string                 `json:"asset"`
	Amount           string                 `json:"amount"`
	Extra            string                 `json:"extra"`
	Receivers        []*TransactionReceiver `json:"receivers"`
	Senders          []string               `json:"senders"`
	SendersHash      string                 `json:"senders_hash"`
	SendersThreshold uint8                  `json:"senders_threshold"`
	Signers          []string               `json:"signers"`
	State            string                 `json:"state"`
	RawTransaction   string                 `json:"raw_transaction"`
	CreatedAt        time.Time              `json:"created_at"`
	UpdatedAt        time.Time              `json:"updated_at"`
	SnapshotID       string                 `json:"snapshot_id"`
	SnapshotHash     string                 `json:"snapshot_hash"`
	SnapshotAt       time.Time              `json:"snapshot_at"`

	Views []string `json:"views"`
}

func CreateObjectStorageTransaction

func CreateObjectStorageTransaction(ctx context.Context, recipients []*TransactionRecipient, utxos []*Output, extra []byte, traceId string, references []string, limit string, u *SafeUser) (*SequencerTransactionRequest, error)

func GetTransactionById

func GetTransactionById(ctx context.Context, requestId string) (*SequencerTransactionRequest, error)

func GetTransactionByIdWithSafeUser added in v3.3.0

func GetTransactionByIdWithSafeUser(ctx context.Context, requestId string, su *SafeUser) (*SequencerTransactionRequest, error)

func RegisterComputer added in v3.16.0

func RegisterComputer(ctx context.Context, su *SafeUser) (*SequencerTransactionRequest, error)

func SendRawTransaction added in v3.4.5

func SendTransaction

func SendTransaction(ctx context.Context, assetId string, recipients []*TransactionRecipient, traceId string, extra []byte, references []string, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransactionUntilSufficient added in v3.7.0

func SendTransactionUntilSufficient(ctx context.Context, assetId, receiver, amount, traceId string, extra []byte, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransactionWithChangeOutputs added in v3.7.6

func SendTransactionWithChangeOutputs(ctx context.Context, assetId string, recipients []*TransactionRecipient, traceId string, extra []byte, references []string, splitAmount string, splitCount int, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransactionWithOutputs added in v3.7.2

func SendTransactionWithOutputs(ctx context.Context, assetId string, recipients []*TransactionRecipient, utxos []*Output, traceId string, extra []byte, references []string, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransactionWithUtxosAndChangeOutputs added in v3.9.8

func SendTransactionWithUtxosAndChangeOutputs(ctx context.Context, assetId string, recipients []*TransactionRecipient, traceId string, extra []byte, references []string, splitAmount string, splitCount int, outputs []*Output, changeAmount common.Integer, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransferTransaction added in v3.1.1

func SendTransferTransaction(ctx context.Context, assetId, receiver, amount, traceId string, extra []byte, u *SafeUser) (*SequencerTransactionRequest, error)

func SendTransferTransactionWithOutputs added in v3.9.1

func SendTransferTransactionWithOutputs(ctx context.Context, assetId, receiver, amount string, utxos []*Output, traceId string, extra []byte, u *SafeUser) (*SequencerTransactionRequest, error)

func SendWithdrawal

func SendWithdrawal(ctx context.Context, assetId, destination, tag, amount, traceId string, preferAssetFeeOverChainFee bool, memo string, u *SafeUser) ([]*SequencerTransactionRequest, error)

SendWithdrawal sends a withdrawal request to the Mixin Network. preferAssetFeeOverChainFee is used to determine whether to use the asset fee or the chain fee.

func VerifyRawTransaction added in v3.4.5

func VerifyRawTransaction(ctx context.Context, requests []*KernelTransactionRequestCreateRequest, u *SafeUser) ([]*SequencerTransactionRequest, error)

func WithdrawalWithUtxos added in v3.9.7

func WithdrawalWithUtxos(ctx context.Context, traceId, feeAssetId, feeAmount, assetId, destination, tag, memo, amount string, utxos, feeUtxos []*Output, u *SafeUser) ([]*SequencerTransactionRequest, error)

type Session

type Session struct {
	UserID    string
	SessionID string
	PublicKey string
}

type SimpleAddress added in v3.8.0

type SimpleAddress struct {
	Destination string `json:"destination"`
	Tag         string `json:"tag"`
}

func CheckAddress added in v3.8.0

func CheckAddress(ctx context.Context, asset, destination, tag string) (*SimpleAddress, error)

type SystemConversationPayload added in v3.7.1

type SystemConversationPayload struct {
	Action        string `json:"action"`
	ParticipantId string `json:"participant_id"`
	UserId        string `json:"user_id,omitempty"`
	Role          string `json:"role,omitempty"`
}

type TipNodeData

type TipNodeData struct {
	Commitments []string `json:"commitments"`
	Identity    string   `json:"identity"`
}

func GetTipNodeByPath

func GetTipNodeByPath(ctx context.Context, path string) (*TipNodeData, error)

func GetTipNodeByPathWithRequestId

func GetTipNodeByPathWithRequestId(ctx context.Context, path, requestId string) (*TipNodeData, error)

type TransactionReceiver added in v3.3.0

type TransactionReceiver struct {
	Members        []string `json:"members"`
	MembersHash    string   `json:"members_hash"`
	Threshold      uint8    `json:"threshold"`
	Destination    string   `json:"destination"`
	Tag            string   `json:"tag"`
	WithdrawalHash string   `json:"withdrawal_hash"`
}

type TransactionRecipient

type TransactionRecipient struct {
	MixAddress *MixAddress
	Amount     string

	Destination string
	Tag         string
}

type TransferSafeView added in v3.7.2

type TransferSafeView struct {
	Type            string    `json:"type"`
	SnapshotId      string    `json:"snapshot_id"`
	UserId          string    `json:"user_id"`
	OpponentId      string    `json:"opponent_id"`
	TransactionHash string    `json:"transaction_hash"`
	AssetId         string    `json:"asset_id"`
	Amount          string    `json:"amount"`
	Memo            string    `json:"memo"`
	CreatedAt       time.Time `json:"created_at"`
	DepositHash     string    `json:"deposit_hash"`     // deposit only
	InscriptionHash string    `json:"inscription_hash"` // inscription only
}

type TransferView

type TransferView struct {
	Type          string    `json:"type"`
	SnapshotId    string    `json:"snapshot_id"`
	CounterUserId string    `json:"counter_user_id"`
	AssetId       string    `json:"asset_id"`
	Amount        string    `json:"amount"`
	TraceId       string    `json:"trace_id"`
	Memo          string    `json:"memo"`
	CreatedAt     time.Time `json:"created_at"`
}

type Treasury added in v3.15.1

type Treasury struct {
	Ratio     string `json:"ratio"`
	Recipient string `json:"recipient"`
}

type Turn

type Turn struct {
	Url        string `json:"url"`
	Username   string `json:"username"`
	Credential string `json:"credential"`
}

func GetTurnServer

func GetTurnServer(ctx context.Context, su *SafeUser) ([]*Turn, error)

type User

type User struct {
	UserId          string     `json:"user_id"`
	SessionId       string     `json:"session_id"`
	PinToken        string     `json:"pin_token"`
	PINTokenBase64  string     `json:"pin_token_base64"`
	IdentityNumber  string     `json:"identity_number"`
	HasSafe         bool       `json:"has_safe"`
	TIPKeyBase64    string     `json:"tip_key_base64"`
	Phone           string     `json:"phone"`
	FullName        string     `json:"full_name"`
	AvatarURL       string     `json:"avatar_url"`
	DeviceStatus    string     `json:"device_status"`
	CreatedAt       time.Time  `json:"created_at"`
	Membership      Membership `json:"membership"`
	AppId           string     `json:"app_id"`
	ServerPublicKey string     `json:"server_public_key"`
}

func CreateUser

func CreateUser(ctx context.Context, sessionSecret, fullName string, su *SafeUser) (*User, error)

func CreateUserSimple

func CreateUserSimple(ctx context.Context, sessionSecret, fullName string) (*User, error)

func GetUser

func GetUser(ctx context.Context, userId string, su *SafeUser) (*User, error)

func GetUsers added in v3.9.2

func GetUsers(ctx context.Context, userIds []string, su *SafeUser) ([]*User, error)

func RegisterSafe

func RegisterSafe(ctx context.Context, userId, spendPrivateKeySeed string, su *SafeUser) (*User, error)

If you want to register safe user, you need to call UpdateTipPin upgrade TIP PIN first.

func RegisterSafeBareUser added in v3.16.3

func RegisterSafeBareUser(ctx context.Context, su *SafeUser) (*User, error)

func Relationship

func Relationship(ctx context.Context, userId, action string, su *SafeUser) (*User, error)

func RequestUserMe

func RequestUserMe(ctx context.Context, su *SafeUser) (*User, error)

func SearchUser

func SearchUser(ctx context.Context, query string, su *SafeUser) (*User, error)

func UpdatePreference

func UpdatePreference(ctx context.Context, messageSource, conversationSource, currency string, threshold float64, su *SafeUser) (*User, error)

func UpdateUserMe

func UpdateUserMe(ctx context.Context, fullName, avatarBase64 string, su *SafeUser) (*User, error)

func UserMe

func UserMe(ctx context.Context, accessToken string) (*User, error)

func UserMeWithRequestID

func UserMeWithRequestID(ctx context.Context, accessToken, requestID string) (*User, error)

func VerifyPIN

func VerifyPIN(ctx context.Context, pin string, user *SafeUser) (*User, error)

func VerifyPINTip

func VerifyPINTip(ctx context.Context, su *SafeUser) (*User, error)

type UserSession

type UserSession struct {
	UserId    string `json:"user_id"`
	SessionId string `json:"session_id"`
	PublicKey string `json:"public_key"`
	Platform  string `json:"platform"`
}

func FetchUserSession

func FetchUserSession(ctx context.Context, users []string, su *SafeUser) ([]*UserSession, error)

type UserUpgrade added in v3.16.3

type UserUpgrade struct {
	UserId             string `json:"user_id"`
	SessionId          string `json:"session_id"`
	ServerPublicKeyHEX string `json:"server_public_key"`

	SessionPrivateKey string `json:"session_private_key"`
}

func UpgradeLegacyUser added in v3.16.3

func UpgradeLegacyUser(ctx context.Context, kl *KeystoreLegacy) (*UserUpgrade, error)

type UtxoInsufficientError added in v3.7.0

type UtxoInsufficientError struct {
	TotalInput  common.Integer
	TotalOutput common.Integer
	OutputSize  int
}

func (*UtxoInsufficientError) Error added in v3.7.0

func (ue *UtxoInsufficientError) Error() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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