mixin

package module
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 49 Imported by: 121

README

mixin-sdk-go

Golang sdk for Mixin Network & Mixin Messenger

Install

go get -u github.com/fox-one/mixin-sdk-go

Features

  • Comprehensive most of the Mixin Network & Mixin Messenger api supported
  • Security verify Response X-Request-ID & signature automatically
  • Flexible initialize Client from keystore, ed25519_oauth_token or access_token

Examples

See _examples/ for a variety of examples.

Quick Start

package main

import (
	"context"
	"log"

	"github.com/fox-one/mixin-sdk-go"
)

func main() {
	ctx := context.Background()
	s := &mixin.Keystore{
		ClientID:   "",
		SessionID:  "",
		PrivateKey: "",
		PinToken: "",
	}

	client, err := mixin.NewFromKeystore(s)
	if err != nil {
		log.Panicln(err)
	}

	user, err := client.UserMe(ctx)
	if err != nil {
		log.Printf("UserMe: %v", err)
		return
	}

	log.Println("user id", user.UserID)
}

Error handling?

check error code by mixin.IsErrorCodes

if _, err := client.UserMe(ctx); err != nil {
    switch {
    case mixin.IsErrorCodes(err,mixin.Unauthorized,mixin.EndpointNotFound):
    	// handle unauthorized error
    case mixin.IsErrorCodes(err,mixin.InsufficientBalance):
        // handle insufficient balance error
    default:
    }
}

Documentation

Index

Constants

View Source
const (
	ScopeProfileRead   = "PROFILE:READ"
	ScopePhoneRead     = "PHONE:READ"
	ScopeContactRead   = "CONTACTS:READ"
	ScopeAssetsRead    = "ASSETS:READ"
	ScopeSnapshotsRead = "SNAPSHOTS:READ"

	ScopeFull = "FULL"
)
View Source
const (
	CreateMessageAction      = "CREATE_MESSAGE"
	AcknowledgeReceiptAction = "ACKNOWLEDGE_MESSAGE_RECEIPT"
)
View Source
const (
	CircleActionAdd    = "ADD"
	CircleActionRemove = "REMOVE"

	CircleItemTypeUsers         = "users"
	CircleItemTypeConversations = "conversations"
)
View Source
const (
	// CollectibleOutputState
	CollectibleOutputStateUnspent = "unspent"
	CollectibleOutputStateSigned  = "signed"
	CollectibleOutputStateSpent   = "spent"

	// CollectibleRequestAction
	CollectibleRequestActionSign   = "sign"
	CollectibleRequestActionUnlock = "unlock"

	// CollectibleRequestState
	CollectibleRequestStateInitial = "initial"
	CollectibleRequestStateSigned  = "signed"
)
View Source
const (
	ConversationCategoryContact = "CONTACT"
	ConversationCategoryGroup   = "GROUP"

	ParticipantActionCreate = "CREATE"
	ParticipantActionUpdate = "UPDATE"
	ParticipantActionAdd    = "ADD"
	ParticipantActionRemove = "REMOVE"
	ParticipantActionJoin   = "JOIN"
	ParticipantActionExit   = "EXIT"
	ParticipantActionRole   = "ROLE"

	ParticipantRoleOwner  = "OWNER"
	ParticipantRoleAdmin  = "ADMIN"
	ParticipantRoleMember = ""
)
View Source
const (
	DefaultApiHost   = "https://api.mixin.one"
	DefaultBlazeHost = "blaze.mixin.one"

	ZeromeshApiHost   = "https://mixin-api.zeromesh.net"
	ZeromeshBlazeHost = "mixin-blaze.zeromesh.net"

	EchoApiHost = "https://echo.yiplee.com"
)
View Source
const (
	Unauthorized        = 401
	EndpointNotFound    = 404
	InsufficientBalance = 20117
	PinIncorrect        = 20119
	InsufficientFee     = 20124
	InvalidTraceID      = 20125
	InvalidReceivers    = 20150

	InvalidOutputKey = 2000001
	InputLocked      = 2000002
	InvalidSignature = 2000003
)

mixin error codes https://developers.mixin.one/api/alpha-mixin-network/errors/

View Source
const (
	MessageCategoryPlainText             = "PLAIN_TEXT"
	MessageCategoryPlainPost             = "PLAIN_POST"
	MessageCategoryPlainImage            = "PLAIN_IMAGE"
	MessageCategoryPlainAudio            = "PLAIN_AUDIO"
	MessageCategoryPlainData             = "PLAIN_DATA"
	MessageCategoryPlainSticker          = "PLAIN_STICKER"
	MessageCategoryPlainLive             = "PLAIN_LIVE"
	MessageCategoryPlainVideo            = "PLAIN_VIDEO"
	MessageCategoryPlainContact          = "PLAIN_CONTACT"
	MessageCategoryPlainTranscript       = "PLAIN_TRANSCRIPT"
	MessageCategoryPlainLocation         = "PLAIN_LOCATION"
	MessageCategoryAppCard               = "APP_CARD"
	MessageCategoryAppButtonGroup        = "APP_BUTTON_GROUP"
	MessageCategoryMessageRecall         = "MESSAGE_RECALL"
	MessageCategorySystemConversation    = "SYSTEM_CONVERSATION"
	MessageCategorySystemAccountSnapshot = "SYSTEM_ACCOUNT_SNAPSHOT"

	MessageStatusSent      = "SENT"
	MessageStatusDelivered = "DELIVERED"
	MessageStatusRead      = "READ"
)
View Source
const (
	EncryptedMessageReceiptStateSuccess = "SUCCESS"
	EncryptedMessageReceiptStateFailed  = "FAILED"
)
View Source
const (
	MixAddressPrefix  = "MIX"
	MixAddressVersion = byte(2)
)
View Source
const (
	MinimumEncodingVersion = 0x1
	MaximumEncodingInt     = 0xFFFF

	AggregatedSignaturePrefix      = 0xFF01
	AggregatedSignatureSparseMask  = byte(0x01)
	AggregatedSignatureOrdinayMask = byte(0x00)
)
View Source
const (
	TxMethodSend = "sendrawtransaction"
	TxMethodGet  = "gettransaction"
)
View Source
const (
	TxVersionCommonEncoding = 0x02
	TxVersionBlake3Hash     = 0x03
	TxVersionReferences     = 0x04
	TxVersionHashSignature  = 0x05

	TxVersion = TxVersionHashSignature
)
View Source
const (
	OutputTypeScript           = 0x00
	OutputTypeWithdrawalSubmit = 0xa1
	OutputTypeWithdrawalFuel   = 0xa2
	OutputTypeNodePledge       = 0xa3
	OutputTypeNodeAccept       = 0xa4

	OutputTypeNodeRemove          = 0xa6
	OutputTypeDomainAccept        = 0xa7
	OutputTypeDomainRemove        = 0xa8
	OutputTypeWithdrawalClaim     = 0xa9
	OutputTypeNodeCancel          = 0xaa
	OutputTypeCustodianEvolution  = 0xb1
	OutputTypeCustodianMigration  = 0xb2
	OutputTypeCustodianDeposit    = 0xb3
	OutputTypeCustodianWithdrawal = 0xb4
)
View Source
const (
	TransactionTypeScript           = 0x00
	TransactionTypeMint             = 0x01
	TransactionTypeDeposit          = 0x02
	TransactionTypeWithdrawalSubmit = 0x03
	TransactionTypeWithdrawalFuel   = 0x04
	TransactionTypeWithdrawalClaim  = 0x05
	TransactionTypeNodePledge       = 0x06
	TransactionTypeNodeAccept       = 0x07

	TransactionTypeNodeRemove           = 0x09
	TransactionTypeDomainAccept         = 0x10
	TransactionTypeDomainRemove         = 0x11
	TransactionTypeNodeCancel           = 0x12
	TransactionTypeCustodianUpdateNodes = 0x13
	TransactionTypeCustodianSlashNodes  = 0x14
	TransactionTypeUnknown              = 0xff
)
View Source
const (
	Operator0   = 0x00
	Operator64  = 0x40
	OperatorSum = 0xfe
	OperatorCmp = 0xff
)
View Source
const (
	ExtraSizeGeneralLimit    = 256
	ExtraSizeStorageStep     = 1024
	ExtraSizeStorageCapacity = 1024 * 1024 * 4
	ExtraStoragePriceStep    = "0.001"
	SliceCountLimit          = 256
	ReferencesCountLimit     = 2
)
View Source
const (
	UTXOStateUnspent = "unspent"
	UTXOStateSigned  = "signed"
	UTXOStateSpent   = "spent"
)
View Source
const (
	MultisigActionSign   = "sign"
	MultisigActionUnlock = "unlock"
)
View Source
const (
	MultisigStateInitial = "initial"
	MultisigStateSigned  = "signed"
)
View Source
const (
	PaymentStatusPending = "pending"
	PaymentStatusPaid    = "paid"
)
View Source
const (
	RelationshipActionAdd     = "ADD"
	RelationshipActionRemove  = "Remove"
	RelationshipActionUpdate  = "UPDATE"
	RelationshipActionBlock   = "BLOCK"
	RelationshipActionUnblock = "UNBLOCK"
)
View Source
const (
	SessionPlatformIOS     = "iOS"
	SessionPlatformAndroid = "Android"
	SessionPlatformDesktop = "Desktop"
)
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:"
	TIPAppOwnershipTransfer     = "TIP:APP:OWNERSHIP:TRANSFER:"
	TIPSequencerRegister        = "SEQUENCER:REGISTER:"
)
View Source
const MainNetworkID = "XIN"
View Source
const Precision = 8
View Source
const Scheme = "mixin"

Variables

View Source
var (
	ErrResponseVerifyFailed = errors.New("response verify failed")
)
View Source
var URL urlScheme

Functions

func AuthorizeToken

func AuthorizeToken(ctx context.Context, clientID, clientSecret string, code string, verifier string) (string, string, error)

func BuildMintCollectibleMemo added in v1.5.4

func BuildMintCollectibleMemo(collectionID string, token int64, metaHash []byte) string

func CallMixinNetRPC added in v1.3.4

func CallMixinNetRPC(ctx context.Context, resp interface{}, method string, params ...interface{}) error

func CancelCollectibleRequest added in v1.6.7

func CancelCollectibleRequest(ctx context.Context, accessToken, reqID string) error

CancelCollectible cancel a collectibles request with accessToken

func CodeChallenge added in v1.7.5

func CodeChallenge(b []byte) (verifier, challange string)

func DecodeMixinNetResponse added in v1.0.12

func DecodeMixinNetResponse(resp *resty.Response) ([]byte, error)

func DecodeResponse

func DecodeResponse(resp *resty.Response) ([]byte, error)

func DecryptAttachment added in v1.6.16

func DecryptAttachment(data, keys, digest []byte) ([]byte, error)

func DecryptMessageCategory added in v1.5.10

func DecryptMessageCategory(category string) string

func DecryptMessageData added in v1.5.10

func DecryptMessageData(data []byte, sessionID string, private ed25519.PrivateKey) ([]byte, error)

func EncryptMessageCategory added in v1.5.10

func EncryptMessageCategory(category string) string

func EncryptMessageData added in v1.5.10

func EncryptMessageData(data []byte, sessions []*Session, private ed25519.PrivateKey) ([]byte, error)

func GenerateCollectibleTokenID added in v1.6.8

func GenerateCollectibleTokenID(collectionID string, token int64) string

func GenerateEd25519Key

func GenerateEd25519Key() ed25519.PrivateKey

func GenerateSessionChecksum added in v1.5.10

func GenerateSessionChecksum(sessions []*Session) string

func GetClient added in v1.0.8

func GetClient() *http.Client

func GetRestyClient added in v1.4.1

func GetRestyClient() *resty.Client

func HashMembers added in v1.1.6

func HashMembers(ids []string) string

func HashScalar added in v1.9.0

func HashScalar(k *edwards25519.Point, outputIndex uint64, hashFuncs ...func([]byte) Hash) *edwards25519.Scalar

func IsEncryptedMessageCategory added in v1.5.10

func IsEncryptedMessageCategory(category string) bool

func IsEncryptedMessageSupported added in v1.5.10

func IsEncryptedMessageSupported(sessions []*Session) bool

func IsErrorCodes

func IsErrorCodes(err error, codes ...int) bool

func IsPlainMessageCategory added in v1.5.10

func IsPlainMessageCategory(category string) bool

func KeyMultPubPriv added in v1.2.0

func KeyMultPubPriv(pub, priv *Key) *edwards25519.Point

func MetaHash added in v1.6.10

func MetaHash(content []byte) []byte

func MixinNetClientFromContext added in v1.2.1

func MixinNetClientFromContext(ctx context.Context) *resty.Client

func RandomCodeChallenge added in v1.7.5

func RandomCodeChallenge() (verifier, challange string)

func RandomMixinNetHost added in v1.2.1

func RandomMixinNetHost() string

func RandomPin

func RandomPin() string

func RandomTraceID

func RandomTraceID() string

func Request

func Request(ctx context.Context) *resty.Request

func RequestIdFromContext

func RequestIdFromContext(ctx context.Context) string

func SafeHashScalar added in v1.9.0

func SafeHashScalar(k *edwards25519.Point, outputIndex uint64) *edwards25519.Scalar

func SignRaw

func SignRaw(method, uri string, body []byte) string

func SignRequest

func SignRequest(r *http.Request) string

func SignResponse

func SignResponse(r *resty.Response) string

func UniqueConversationID

func UniqueConversationID(userID, recipientID string) string

func UnmarshalMixinNetResponse added in v1.0.12

func UnmarshalMixinNetResponse(resp *resty.Response, v interface{}) error

func UnmarshalResponse

func UnmarshalResponse(resp *resty.Response, v interface{}) (err error)

func UploadAttachment

func UploadAttachment(ctx context.Context, attachment *Attachment, file []byte) error

func UploadAttachmentTo added in v1.0.4

func UploadAttachmentTo(ctx context.Context, uploadURL string, file []byte) error

func UseApiHost

func UseApiHost(host string)

func UseAutoFasterRoute added in v1.5.9

func UseAutoFasterRoute()

func UseBlazeHost

func UseBlazeHost(host string)

func UseBlazeURL added in v1.3.8

func UseBlazeURL(rawURL string)

func UseLegacyMixinNetHosts added in v1.9.0

func UseLegacyMixinNetHosts()

func UseMixinNetHosts added in v1.2.1

func UseMixinNetHosts(hosts []string)

func UseSafeMixinNetHosts added in v1.9.0

func UseSafeMixinNetHosts()

func ValidatePinPattern added in v1.0.5

func ValidatePinPattern(pin string) error

ValidatePinPattern validate the pin with pinRegex

func VerifyTransaction added in v1.2.0

func VerifyTransaction(ctx context.Context, addr *MixinnetAddress, txHash Hash) (bool, error)

检查 transaction 是否是由该主网地址签发。满足以下所有条件则返回 true:

  1. 所有 input 对应的 utxo 只有一个 keys, 即 不是多签地址 转出
  2. 该 input 的 mask & keys 可以使用该地址的 private view 和 public spend 碰撞通过

func WithMixinNetHost added in v1.2.1

func WithMixinNetHost(ctx context.Context, host string) context.Context

func WithRequestID

func WithRequestID(ctx context.Context, requestID string) context.Context

WithRequestID bind request id to context request id must be uuid

func WithSigner

func WithSigner(ctx context.Context, s Signer) context.Context

func WithVerifier

func WithVerifier(ctx context.Context, v Verifier) context.Context

func WrapErrWithRequestID added in v1.2.7

func WrapErrWithRequestID(err error, id string) error

Types

type AckQueue added in v1.4.7

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

type AcknowledgementRequest

type AcknowledgementRequest struct {
	MessageID string `json:"message_id,omitempty"`
	Status    string `json:"status,omitempty"`
}

type Address

type Address struct {
	AddressID   string          `json:"address_id,omitempty"`
	AssetID     string          `json:"asset_id"`
	Label       string          `json:"label,omitempty"`
	Destination string          `json:"destination,omitempty"`
	Tag         string          `json:"tag,omitempty"`
	Fee         decimal.Decimal `json:"fee,omitempty"`
	Dust        decimal.Decimal `json:"dust,omitempty"`
}

func ReadAddress

func ReadAddress(ctx context.Context, accessToken, addressID string) (*Address, error)

func ReadAddresses

func ReadAddresses(ctx context.Context, accessToken, assetID string) ([]*Address, error)

type AggregatedSignature added in v1.4.2

type AggregatedSignature struct {
	Signers   []int      `json:"signers"`
	Signature *Signature `json:"signature"`
}

type App

type App struct {
	UpdatedAt        time.Time `json:"updated_at,omitempty"`
	AppID            string    `json:"app_id,omitempty"`
	AppNumber        string    `json:"app_number,omitempty"`
	RedirectURI      string    `json:"redirect_uri,omitempty"`
	HomeURI          string    `json:"home_uri,omitempty"`
	Name             string    `json:"name,omitempty"`
	IconURL          string    `json:"icon_url,omitempty"`
	Description      string    `json:"description,omitempty"`
	Capabilities     []string  `json:"capabilities,omitempty"`
	ResourcePatterns []string  `json:"resource_patterns,omitempty"`
	Category         string    `json:"category,omitempty"`
	CreatorID        string    `json:"creator_id,omitempty"`
	AppSecret        string    `json:"app_secret,omitempty"`
}

type AppButtonGroupMessage

type AppButtonGroupMessage []AppButtonMessage

type AppButtonMessage

type AppButtonMessage struct {
	Label  string `json:"label,omitempty"`
	Action string `json:"action,omitempty"`
	Color  string `json:"color,omitempty"`
}

type AppCardMessage

type AppCardMessage struct {
	AppID       string `json:"app_id,omitempty"`
	IconURL     string `json:"icon_url,omitempty"`
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Action      string `json:"action,omitempty"`
	Shareable   bool   `json:"shareable,omitempty"`
}

type Asset

type Asset struct {
	AssetID        string          `json:"asset_id"`
	ChainID        string          `json:"chain_id"`
	AssetKey       string          `json:"asset_key,omitempty"`
	MixinID        string          `json:"mixin_id,omitempty"`
	Symbol         string          `json:"symbol,omitempty"`
	Name           string          `json:"name,omitempty"`
	IconURL        string          `json:"icon_url,omitempty"`
	PriceBTC       decimal.Decimal `json:"price_btc,omitempty"`
	ChangeBTC      decimal.Decimal `json:"change_btc,omitempty"`
	PriceUSD       decimal.Decimal `json:"price_usd,omitempty"`
	ChangeUsd      decimal.Decimal `json:"change_usd,omitempty"`
	Balance        decimal.Decimal `json:"balance,omitempty"`
	Destination    string          `json:"destination,omitempty"`
	Tag            string          `json:"tag,omitempty"`
	Confirmations  int             `json:"confirmations,omitempty"`
	Capitalization float64         `json:"capitalization,omitempty"`
	DepositEntries []DepositEntry  `json:"deposit_entries"`
}

func ReadAsset

func ReadAsset(ctx context.Context, accessToken, assetID string) (*Asset, error)

func ReadAssets

func ReadAssets(ctx context.Context, accessToken string) ([]*Asset, error)

func ReadMultisigAssets added in v1.3.7

func ReadMultisigAssets(ctx context.Context) ([]*Asset, error)

func ReadNetworkAsset

func ReadNetworkAsset(ctx context.Context, assetID string) (*Asset, error)

ReadNetworkAsset read mixin network asset by asset id

func ReadNetworkAssetsBySymbol added in v1.5.6

func ReadNetworkAssetsBySymbol(ctx context.Context, symbol string) ([]*Asset, error)

ReadNetworkAssetsBySymbol read mixin network assets by symbol

func ReadTopNetworkAssets

func ReadTopNetworkAssets(ctx context.Context) ([]*Asset, error)

ReadTopNetworkAssets read top network assets

type Attachment

type Attachment struct {
	AttachmentID string `json:"attachment_id"`
	UploadURL    string `json:"upload_url"`
	ViewURL      string `json:"view_url"`
}

type AttachmentMessageEncrypt added in v1.6.16

type AttachmentMessageEncrypt struct {
	Key    []byte `json:"key"`
	Digest []byte `json:"digest"`
}

type AudioMessage

type AudioMessage struct {
	AttachmentID string `json:"attachment_id,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	WaveForm     string `json:"wave_form,omitempty"`
	Size         int    `json:"size,omitempty"`
	Duration     int    `json:"duration,omitempty"`
	*AttachmentMessageEncrypt
}

type Authorization added in v1.7.5

type Authorization struct {
	CreatedAt         time.Time `json:"created_at"`
	AccessedAt        time.Time `json:"accessed_at"`
	AuthorizationID   string    `json:"authorization_id"`
	AuthorizationCode string    `json:"authorization_code"`
	Scopes            []string  `json:"scopes"`
	CodeID            string    `json:"code_id"`
	App               App       `json:"app"`
	User              User      `json:"user"`
}

func RequestAuthorization added in v1.7.5

func RequestAuthorization(ctx context.Context, clientID string, scopes []string, challenge string) (*Authorization, error)

type BlazeListenFunc

type BlazeListenFunc func(ctx context.Context, msg *MessageView, userID string) error

func (BlazeListenFunc) OnAckReceipt

func (f BlazeListenFunc) OnAckReceipt(ctx context.Context, msg *MessageView, userID string) error

func (BlazeListenFunc) OnMessage

func (f BlazeListenFunc) OnMessage(ctx context.Context, msg *MessageView, userID string) error

type BlazeListener

type BlazeListener interface {
	OnAckReceipt(ctx context.Context, msg *MessageView, userID string) error
	OnMessage(ctx context.Context, msg *MessageView, userID string) error
}

type BlazeMessage

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

type BlazeOption added in v1.4.1

type BlazeOption func(dialer *websocket.Dialer)

type Circle added in v1.7.1

type Circle struct {
	ID        string    `json:"circle_id,omitempty"`
	Name      string    `json:"name,omitempty"`
	UserID    string    `json:"user_id,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
}

type CircleItem added in v1.7.1

type CircleItem struct {
	CreatedAt      time.Time `json:"created_at,omitempty"`
	CircleID       string    `json:"circle_id,omitempty"`
	ConversationID string    `json:"conversation_id,omitempty"`
	UserID         string    `json:"user_id,omitempty"`
}

type Client

type Client struct {
	Signer
	Verifier
	MessageLocker

	ClientID string
}

func NewFromAccessToken

func NewFromAccessToken(accessToken string) *Client

func NewFromKeystore

func NewFromKeystore(keystore *Keystore) (*Client, error)

func NewFromOauthKeystore

func NewFromOauthKeystore(keystore *OauthKeystore) (*Client, error)

func (*Client) AddFriend added in v1.5.1

func (c *Client) AddFriend(ctx context.Context, userID, remark string) (*User, error)

func (*Client) AddParticipants

func (c *Client) AddParticipants(ctx context.Context, conversationID string, users ...string) (*Conversation, error)

func (*Client) AdminParticipants

func (c *Client) AdminParticipants(ctx context.Context, conversationID string, users ...string) (*Conversation, error)

func (*Client) Authorize added in v1.7.5

func (c *Client) Authorize(ctx context.Context, authorizationID string, scopes []string, pin string) (*Authorization, error)

func (*Client) BatchReadGhostKeys added in v1.2.5

func (c *Client) BatchReadGhostKeys(ctx context.Context, inputs []*GhostInput) ([]*GhostKeys, error)

func (*Client) BlockUser added in v1.5.1

func (c *Client) BlockUser(ctx context.Context, userID string) (*User, error)

func (*Client) CallMixinNetRPC added in v1.7.7

func (c *Client) CallMixinNetRPC(ctx context.Context, method string, params ...interface{}) (*resty.Response, error)

func (*Client) CancelCollectibleRequest added in v1.5.4

func (c *Client) CancelCollectibleRequest(ctx context.Context, reqID string) error

CancelCollectible cancel a collectibles request

func (*Client) CancelMultisig added in v1.0.12

func (c *Client) CancelMultisig(ctx context.Context, reqID string) error

CancelMultisig cancel a multisig request

func (*Client) CreateAddress

func (c *Client) CreateAddress(ctx context.Context, input CreateAddressInput, pin string) (*Address, error)

func (*Client) CreateAttachment

func (c *Client) CreateAttachment(ctx context.Context) (*Attachment, error)

func (*Client) CreateCircle added in v1.7.1

func (c *Client) CreateCircle(ctx context.Context, args CreateCircleParams) (*Circle, error)

func (*Client) CreateCollectibleRequest added in v1.5.4

func (c *Client) CreateCollectibleRequest(ctx context.Context, action, raw string) (*CollectibleRequest, error)

CreateCollectibleRequest create a collectibles request

func (*Client) CreateContactConversation

func (c *Client) CreateContactConversation(ctx context.Context, userID string) (*Conversation, error)

CreateContactConversation create a conversation with a mixin messenger user

func (*Client) CreateConversation

func (c *Client) CreateConversation(ctx context.Context, input *CreateConversationInput) (*Conversation, error)

CreateConversation crate conversation

func (*Client) CreateGroupConversation

func (c *Client) CreateGroupConversation(ctx context.Context, conversationID, name string, participants []*Participant) (*Conversation, error)

CreateGroupConversation create a group in mixin messenger with given participants

func (*Client) CreateMultisig added in v1.0.12

func (c *Client) CreateMultisig(ctx context.Context, action, raw string) (*MultisigRequest, error)

CreateMultisig create a multisig request

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, key crypto.Signer, fullname string) (*User, *Keystore, error)

func (*Client) DeleteAddress

func (c *Client) DeleteAddress(ctx context.Context, addressID, pin string) error

func (*Client) DeleteCircle added in v1.7.1

func (c *Client) DeleteCircle(ctx context.Context, circleID string) error

func (*Client) EncryptMessageRequest added in v1.5.10

func (c *Client) EncryptMessageRequest(req *MessageRequest, sessions []*Session) error

func (*Client) EncryptTipPin added in v1.7.3

func (c *Client) EncryptTipPin(key Key, action string, params ...string) string

func (*Client) FavoriteApp added in v1.0.3

func (c *Client) FavoriteApp(ctx context.Context, appID string) (*FavoriteApp, error)

func (*Client) FetchSessions added in v1.5.10

func (c *Client) FetchSessions(ctx context.Context, ids []string) ([]*Session, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, uri string, params map[string]string, resp interface{}) error

func (*Client) GetCode added in v1.7.4

func (c *Client) GetCode(ctx context.Context, codeString string) (*Code, error)

func (*Client) GetRawTransaction added in v1.3.4

func (c *Client) GetRawTransaction(ctx context.Context, hash Hash) (*Transaction, error)

func (*Client) ListBlockingUsers added in v1.6.14

func (c *Client) ListBlockingUsers(ctx context.Context) ([]*User, error)

func (*Client) ListCircleItems added in v1.7.1

func (c *Client) ListCircleItems(ctx context.Context, args ListCircleItemsParams) ([]*CircleItem, error)

func (*Client) ListCircles added in v1.7.1

func (c *Client) ListCircles(ctx context.Context) ([]*Circle, error)

func (*Client) ListMultisigOutputs added in v1.6.6

func (c *Client) ListMultisigOutputs(ctx context.Context, opt ListMultisigOutputsOption) ([]*MultisigUTXO, error)

ListMultisigOutputs return a list of multisig outputs of special members & threshold

func (*Client) LoopBlaze

func (c *Client) LoopBlaze(ctx context.Context, listener BlazeListener, opts ...BlazeOption) error

func (*Client) MakeCollectibleTransaction added in v1.5.4

func (c *Client) MakeCollectibleTransaction(
	ctx context.Context,
	output *CollectibleOutput,
	token *CollectibleToken,
	receivers []string,
	threshold uint8,
) (*Transaction, error)

func (*Client) MakeMultisigTransaction added in v1.1.1

func (c *Client) MakeMultisigTransaction(ctx context.Context, input *TransactionInput) (*Transaction, error)

func (*Client) ManageCircle added in v1.7.1

func (c *Client) ManageCircle(ctx context.Context, args ManageCircleParams) (*CircleItem, error)

func (*Client) ManageConversation

func (c *Client) ManageConversation(ctx context.Context, conversationID, action string, participants []*Participant) (*Conversation, error)

func (*Client) ModifyPin

func (c *Client) ModifyPin(ctx context.Context, pin, newPin string) error

func (*Client) ModifyProfile

func (c *Client) ModifyProfile(ctx context.Context, fullname, avatarBase64 string) (*User, error)

func (*Client) Post

func (c *Client) Post(ctx context.Context, uri string, body interface{}, resp interface{}) error

func (*Client) ReadAddress

func (c *Client) ReadAddress(ctx context.Context, addressID string) (*Address, error)

func (*Client) ReadAddresses

func (c *Client) ReadAddresses(ctx context.Context, assetID string) ([]*Address, error)

func (*Client) ReadApp

func (c *Client) ReadApp(ctx context.Context, appID string) (*App, error)

func (*Client) ReadAsset

func (c *Client) ReadAsset(ctx context.Context, assetID string) (*Asset, error)

func (*Client) ReadAssetFee

func (c *Client) ReadAssetFee(ctx context.Context, assetID string) (decimal.Decimal, error)

func (*Client) ReadAssets

func (c *Client) ReadAssets(ctx context.Context) ([]*Asset, error)

func (*Client) ReadCircle added in v1.7.1

func (c *Client) ReadCircle(ctx context.Context, circleID string) (*Circle, error)

func (*Client) ReadCollectibleCollection added in v1.6.7

func (c *Client) ReadCollectibleCollection(ctx context.Context, collectionID string) (*CollectibleCollection, error)

ReadCollectibleCollection request collectible collection

func (*Client) ReadCollectibleOutputs added in v1.5.4

func (c *Client) ReadCollectibleOutputs(ctx context.Context, members []string, threshold uint8, state string, offset time.Time, limit int) ([]*CollectibleOutput, error)

ReadCollectibleOutputs return a list of collectibles outputs

func (*Client) ReadCollectiblesToken added in v1.5.4

func (c *Client) ReadCollectiblesToken(ctx context.Context, id string) (*CollectibleToken, error)

ReadCollectiblesToken return the detail of CollectibleToken

func (*Client) ReadConsensusInfo added in v1.3.4

func (c *Client) ReadConsensusInfo(ctx context.Context) (*ConsensusInfo, error)

func (*Client) ReadConversation

func (c *Client) ReadConversation(ctx context.Context, conversationID string) (*Conversation, error)

ReadConversation read conversation

func (*Client) ReadExchangeRates

func (c *Client) ReadExchangeRates(ctx context.Context) ([]ExchangeRate, error)

ReadExchangeRates returns the exchange rates between two currencies deprecated: use ReadFiats instead

func (*Client) ReadFavoriteApps

func (c *Client) ReadFavoriteApps(ctx context.Context, userID string) ([]*FavoriteApp, error)

func (*Client) ReadFiats added in v1.5.7

func (c *Client) ReadFiats(ctx context.Context) ([]Fiat, error)

ReadFiats returns the exchange rates between two currencies

func (*Client) ReadFriends

func (c *Client) ReadFriends(ctx context.Context) ([]*User, error)

func (*Client) ReadGhostKeys added in v1.0.12

func (c *Client) ReadGhostKeys(ctx context.Context, receivers []string, index int) (*GhostKeys, error)

func (*Client) ReadMultisigOutput added in v1.6.13

func (c *Client) ReadMultisigOutput(ctx context.Context, id string) (*MultisigUTXO, error)

ReadMultisigOutput read a multisig output by utxo_id

func (*Client) ReadMultisigOutputs added in v1.0.12

func (c *Client) ReadMultisigOutputs(ctx context.Context, members []string, threshold uint8, offset time.Time, limit int) ([]*MultisigUTXO, error)

ReadMultisigOutputs return a list of multisig outputs order by updated_at, including unspent, signed, spent utxos

func (*Client) ReadMultisigs added in v1.0.12

func (c *Client) ReadMultisigs(ctx context.Context, offset time.Time, limit int) ([]*MultisigUTXO, error)

ReadMultisigs return a list of multisig utxos

func (*Client) ReadNetworkSnapshot

func (c *Client) ReadNetworkSnapshot(ctx context.Context, snapshotID string) (*Snapshot, error)

func (*Client) ReadNetworkSnapshots

func (c *Client) ReadNetworkSnapshots(ctx context.Context, assetID string, offset time.Time, order string, limit int) ([]*Snapshot, error)

func (*Client) ReadSafeSnapshot added in v1.9.0

func (c *Client) ReadSafeSnapshot(ctx context.Context, snapshotID string) (*SafeSnapshot, error)

func (*Client) ReadSafeSnapshots added in v1.9.0

func (c *Client) ReadSafeSnapshots(ctx context.Context, assetID string, offset time.Time, order string, limit int) ([]*SafeSnapshot, error)

func (*Client) ReadSnapshot

func (c *Client) ReadSnapshot(ctx context.Context, snapshotID string) (*Snapshot, error)

func (*Client) ReadSnapshotByTraceID added in v1.6.1

func (c *Client) ReadSnapshotByTraceID(ctx context.Context, traceID string) (*Snapshot, error)

func (*Client) ReadSnapshots

func (c *Client) ReadSnapshots(ctx context.Context, assetID string, offset time.Time, order string, limit int) ([]*Snapshot, error)

ReadSnapshots return a list of snapshots order must be `ASC` or `DESC` Deprecated: use ReadSnapshotsWithOptions instead.

func (*Client) ReadSnapshotsWithOptions added in v1.6.5

func (c *Client) ReadSnapshotsWithOptions(ctx context.Context, offset time.Time, limit int, input ReadSnapshotsOptions) ([]*Snapshot, error)

ReadSnapshotsWithOptions returns a list of snapshots

func (*Client) ReadTransfer

func (c *Client) ReadTransfer(ctx context.Context, traceID string) (*Snapshot, error)

func (*Client) ReadTurnServers

func (c *Client) ReadTurnServers(ctx context.Context) ([]*Turn, error)

func (*Client) ReadUser

func (c *Client) ReadUser(ctx context.Context, userIdOrIdentityNumber string) (*User, error)

func (*Client) ReadUsers

func (c *Client) ReadUsers(ctx context.Context, ids ...string) ([]*User, error)

func (*Client) RemarkFriend added in v1.5.1

func (c *Client) RemarkFriend(ctx context.Context, userID, remark string) (*User, error)

func (*Client) RemoveFriend added in v1.5.1

func (c *Client) RemoveFriend(ctx context.Context, userID string) (*User, error)

func (*Client) RemoveParticipants

func (c *Client) RemoveParticipants(ctx context.Context, conversationID string, users ...string) (*Conversation, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context) *resty.Request

func (*Client) RotateConversation

func (c *Client) RotateConversation(ctx context.Context, conversationID string) (*Conversation, error)

func (*Client) SafeBuildTransaction added in v1.9.0

func (c *Client) SafeBuildTransaction(ctx context.Context, input *SafeTransactionInput) (*Transaction, error)

func (*Client) SafeCreateDepositEntries added in v1.9.0

func (c *Client) SafeCreateDepositEntries(ctx context.Context, receivers []string, threshold int, chain string) ([]*SafeDepositEntry, error)

func (*Client) SafeCreateGhostKeys added in v1.9.0

func (c *Client) SafeCreateGhostKeys(ctx context.Context, inputs []*GhostKeyInput) ([]*GhostKeys, error)

func (*Client) SafeCreateMixAddressGhostKeys added in v1.9.0

func (c *Client) SafeCreateMixAddressGhostKeys(ctx context.Context, trace string, ma *MixAddress, outputIndex uint) (*GhostKeys, error)

func (*Client) SafeCreateTransactionRequest added in v1.9.0

func (c *Client) SafeCreateTransactionRequest(ctx context.Context, inputs []*SafeTransactionRequestInput) ([]*SafeTransactionRequest, error)

func (*Client) SafeListDeposits added in v1.9.0

func (c *Client) SafeListDeposits(ctx context.Context, entry *SafeDepositEntry, asset string, offset time.Time, limit int) ([]*SafeDeposit, error)

func (*Client) SafeListUtxos added in v1.9.0

func (c *Client) SafeListUtxos(ctx context.Context, opt SafeListUtxoOption) ([]*SafeUtxo, error)

func (*Client) SafeMigrate added in v1.9.0

func (c *Client) SafeMigrate(ctx context.Context, priv string, pin string) (*User, error)

func (*Client) SafeReadAsset added in v1.9.0

func (c *Client) SafeReadAsset(ctx context.Context, assetID string) (*SafeAsset, error)

func (*Client) SafeReadAssets added in v1.9.0

func (c *Client) SafeReadAssets(ctx context.Context) ([]*SafeAsset, error)

func (*Client) SafeReadTransactionRequest added in v1.9.0

func (c *Client) SafeReadTransactionRequest(ctx context.Context, requestID string) (*SafeTransactionRequest, error)

func (*Client) SafeSubmitTransactionRequest added in v1.9.0

func (c *Client) SafeSubmitTransactionRequest(ctx context.Context, inputs []*SafeTransactionRequestInput) ([]*SafeTransactionRequest, error)

func (*Client) SearchUser

func (c *Client) SearchUser(ctx context.Context, identityNumberOrPhoneNumber string) (*User, error)

func (*Client) SendAcknowledgement

func (c *Client) SendAcknowledgement(ctx context.Context, request *AcknowledgementRequest) error

func (*Client) SendAcknowledgements

func (c *Client) SendAcknowledgements(ctx context.Context, requests []*AcknowledgementRequest) error

func (*Client) SendEncryptedMessages added in v1.5.10

func (c *Client) SendEncryptedMessages(ctx context.Context, messages []*MessageRequest) ([]*EncryptedMessageReceipt, error)

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, message *MessageRequest) error

func (*Client) SendMessages

func (c *Client) SendMessages(ctx context.Context, messages []*MessageRequest) error

func (*Client) SendRawMessage added in v1.4.5

func (c *Client) SendRawMessage(ctx context.Context, message json.RawMessage) error

func (*Client) SendRawMessages

func (c *Client) SendRawMessages(ctx context.Context, messages []json.RawMessage) error

func (*Client) SendRawTransaction added in v1.3.4

func (c *Client) SendRawTransaction(ctx context.Context, raw string) (*Hash, error)

func (*Client) ShowAttachment

func (c *Client) ShowAttachment(ctx context.Context, id string) (*Attachment, error)

func (*Client) SignCollectibleRequest added in v1.5.4

func (c *Client) SignCollectibleRequest(ctx context.Context, reqID, pin string) (*CollectibleRequest, error)

SignCollectibleRequest sign a collectibles request

func (*Client) SignMultisig added in v1.0.12

func (c *Client) SignMultisig(ctx context.Context, reqID, pin string) (*MultisigRequest, error)

SignMultisig sign a multisig request

func (*Client) Transaction

func (c *Client) Transaction(ctx context.Context, in *TransferInput, pin string) (*RawTransaction, error)

func (*Client) Transfer

func (c *Client) Transfer(ctx context.Context, input *TransferInput, pin string) (*Snapshot, error)

func (*Client) TransferOwnership added in v1.7.6

func (c *Client) TransferOwnership(ctx context.Context, newOwner, pin string) error

func (*Client) UnblockUser added in v1.5.1

func (c *Client) UnblockUser(ctx context.Context, userID string) (*User, error)

func (*Client) UnfavoriteApp added in v1.3.10

func (c *Client) UnfavoriteApp(ctx context.Context, appID string) error

func (*Client) UnlockCollectibleRequest added in v1.5.4

func (c *Client) UnlockCollectibleRequest(ctx context.Context, reqID, pin string) error

UnlockCollectibleRequest unlock a collectibles request

func (*Client) UnlockMultisig added in v1.0.12

func (c *Client) UnlockMultisig(ctx context.Context, reqID, pin string) error

UnlockMultisig unlock a multisig request

func (*Client) UpdateApp added in v1.0.9

func (c *Client) UpdateApp(ctx context.Context, appID string, req UpdateAppRequest) (*App, error)

func (*Client) UpdateCircle added in v1.7.1

func (c *Client) UpdateCircle(ctx context.Context, args UpdateCircleParams) (*Circle, error)

func (*Client) UpdateConversation added in v1.3.2

func (c *Client) UpdateConversation(ctx context.Context, conversationID string, input ConversationUpdate) (*Conversation, error)

UpdateConversation update conversation

func (*Client) UpdateConversationAnnouncement added in v1.3.1

func (c *Client) UpdateConversationAnnouncement(ctx context.Context, conversationID, announcement string) (*Conversation, error)

Update conversation announcement

func (*Client) UpdateProfile added in v1.6.15

func (c *Client) UpdateProfile(ctx context.Context, input UserUpdate) (*User, error)

func (*Client) UpdateRelationship added in v1.5.1

func (c *Client) UpdateRelationship(ctx context.Context, req RelationshipRequest) (*User, error)

func (*Client) UserMe

func (c *Client) UserMe(ctx context.Context) (*User, error)

func (*Client) VerifyPayment

func (c *Client) VerifyPayment(ctx context.Context, input TransferInput) (*Payment, error)

func (*Client) VerifyPin

func (c *Client) VerifyPin(ctx context.Context, pin string) error

func (*Client) Withdraw

func (c *Client) Withdraw(ctx context.Context, input WithdrawInput, pin string) (*Snapshot, error)

type Code added in v1.7.4

type Code struct {
	Type    CodeType `json:"type"`
	RawData json.RawMessage
}

func (*Code) Authorization added in v1.7.5

func (c *Code) Authorization() *Authorization

func (*Code) Collectible added in v1.7.4

func (c *Code) Collectible() *CollectibleRequest

func (*Code) Conversation added in v1.7.4

func (c *Code) Conversation() *Conversation

func (*Code) Multisig added in v1.7.4

func (c *Code) Multisig() *MultisigRequest

func (*Code) Payment added in v1.7.4

func (c *Code) Payment() *Payment

func (*Code) User added in v1.7.4

func (c *Code) User() *User

type CodeType added in v1.7.4

type CodeType string
const (
	TypeUser          CodeType = "user"
	TypeConversation  CodeType = "conversation"
	TypePayment       CodeType = "payment"
	TypeMultisig      CodeType = "multisig_request"
	TypeCollectible   CodeType = "non_fungible_request"
	TypeAuthorization CodeType = "authorization"
)

type CollectibleCollection added in v1.6.7

type CollectibleCollection struct {
	CollectionID string    `json:"collection_id,omitempty"`
	Name         string    `json:"name,omitempty"`
	Type         string    `json:"type,omitempty"`
	IconUrl      string    `json:"icon_url,omitempty"`
	Description  string    `json:"description,omitempty"`
	CreatedAt    time.Time `json:"created_at,omitempty"`
}

func ReadCollectibleCollection added in v1.6.7

func ReadCollectibleCollection(ctx context.Context, accessToken, collectionID string) (*CollectibleCollection, error)

ReadCollectibleCollection request collectible collection with accessToken

type CollectibleOutput added in v1.5.4

type CollectibleOutput struct {
	Type               string          `json:"type,omitempty"`
	CreatedAt          time.Time       `json:"created_at,omitempty"`
	UpdatedAt          time.Time       `json:"updated_at,omitempty"`
	UserID             string          `json:"user_id,omitempty"`
	OutputID           string          `json:"output_id,omitempty"`
	TokenID            string          `json:"token_id,omitempty"`
	Extra              string          `json:"extra,omitempty"`
	TransactionHash    Hash            `json:"transaction_hash,omitempty"`
	OutputIndex        int             `json:"output_index,omitempty"`
	Amount             decimal.Decimal `json:"amount,omitempty"`
	Senders            []string        `json:"senders,omitempty"`
	SendersThreshold   uint8           `json:"senders_threshold,omitempty"`
	Receivers          []string        `json:"receivers,omitempty"`
	ReceiversThreshold uint8           `json:"receivers_threshold,omitempty"`
	State              string          `json:"state,omitempty"`
	SignedBy           string          `json:"signed_by,omitempty"`
	SignedTx           string          `json:"signed_tx,omitempty"`
}

func ReadCollectibleOutputs added in v1.6.7

func ReadCollectibleOutputs(ctx context.Context, accessToken string, members []string, threshold uint8, state string, offset time.Time, limit int) ([]*CollectibleOutput, error)

ReadCollectibleOutputs request with accessToken and returns a list of collectibles outputs

type CollectibleRequest added in v1.5.4

type CollectibleRequest struct {
	Type               string          `json:"type,omitempty"`
	CreatedAt          time.Time       `json:"created_at,omitempty"`
	UpdatedAt          time.Time       `json:"updated_at,omitempty"`
	RequestID          string          `json:"request_id,omitempty"`
	UserID             string          `json:"user_id,omitempty"`
	TokenID            string          `json:"token_id,omitempty"`
	Amount             decimal.Decimal `json:"amount,omitempty"`
	Senders            []string        `json:"senders,omitempty"`
	SendersThreshold   uint8           `json:"senders_threshold,omitempty"`
	Receivers          []string        `json:"receivers,omitempty"`
	ReceiversThreshold uint8           `json:"receivers_threshold,omitempty"`
	Signers            []string        `json:"signers,omitempty"`
	Action             string          `json:"action,omitempty"`
	State              string          `json:"state,omitempty"`
	TransactionHash    Hash            `json:"transaction_hash,omitempty"`
	RawTransaction     string          `json:"raw_transaction,omitempty"`
	CodeID             string          `json:"code_id"`
}

func CreateCollectibleRequest added in v1.6.7

func CreateCollectibleRequest(ctx context.Context, accessToken, action, raw string) (*CollectibleRequest, error)

CreateCollectibleRequest create a collectibles request with accessToken

type CollectibleToken added in v1.5.4

type CollectibleToken struct {
	Type         string               `json:"type,omitempty"`
	CreatedAt    time.Time            `json:"created_at,omitempty"`
	CollectionID string               `json:"collection_id,omitempty"`
	TokenID      string               `json:"token_id,omitempty"`
	Group        string               `json:"group,omitempty"`
	Token        string               `json:"token,omitempty"`
	MixinID      Hash                 `json:"mixin_id,omitempty"`
	NFO          TransactionExtra     `json:"nfo,omitempty"`
	Meta         CollectibleTokenMeta `json:"meta,omitempty"`
}

func ReadCollectiblesToken added in v1.6.7

func ReadCollectiblesToken(ctx context.Context, accessToken, tokenID string) (*CollectibleToken, error)

ReadCollectiblesToken request with access token and returns the detail of CollectibleToken

type CollectibleTokenMeta added in v1.5.4

type CollectibleTokenMeta struct {
	Group       string `json:"group,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	IconURL     string `json:"icon_url,omitempty"`
	MediaURL    string `json:"media_url,omitempty"`
	Mime        string `json:"mime,omitempty"`
	Hash        Hash   `json:"hash,omitempty"`
}

type ConsensusInfo added in v1.3.4

type ConsensusInfo struct {
	Network   Hash      `json:"network"`
	Node      Hash      `json:"node"`
	Version   string    `json:"version"`
	Uptime    string    `json:"uptime"`
	Epoch     time.Time `json:"epoch"`
	Timestamp time.Time `json:"timestamp"`
	Mint      Mint      `json:"mint"`
	Queue     Queue     `json:"queue"`
	Graph     Graph     `json:"graph"`
}

func ReadConsensusInfo added in v1.3.4

func ReadConsensusInfo(ctx context.Context) (*ConsensusInfo, error)

type ConsensusNode added in v1.3.4

type ConsensusNode struct {
	Node        Hash            `json:"node"`
	Signer      MixinnetAddress `json:"signer"`
	Payee       MixinnetAddress `json:"payee"`
	State       string          `json:"state"`
	Timestamp   int64           `json:"timestamp"`
	Transaction Hash            `json:"transaction"`
	Aggregator  uint64          `json:"aggregator"`
	Works       [2]uint64       `json:"works"`
}

type ContactMessage

type ContactMessage struct {
	UserID string `json:"user_id,omitempty"`
}

type Conversation

type Conversation struct {
	ConversationID string `json:"conversation_id,omitempty"`
	CreatorID      string `json:"creator_id,omitempty"`
	Category       string `json:"category,omitempty"`
	Name           string `json:"name,omitempty"`
	IconURL        string `json:"icon_url,omitempty"`
	Announcement   string `json:"announcement,omitempty"`
	CreatedAt      string `json:"created_at,omitempty"`
	CodeID         string `json:"code_id,omitempty"`
	CodeURL        string `json:"code_url,omitempty"`

	Participants []*Participant `json:"participants,omitempty"`
}

Conversation conversation

type ConversationUpdate added in v1.3.2

type ConversationUpdate struct {
	Name         string `json:"name,omitempty"`
	Announcement string `json:"announcement,omitempty"`
}

type CreateAddressInput

type CreateAddressInput struct {
	AssetID     string `json:"asset_id"`
	Destination string `json:"destination,omitempty"`
	Tag         string `json:"tag,omitempty"`
	Label       string `json:"label,omitempty"`
}

type CreateCircleParams added in v1.7.1

type CreateCircleParams struct {
	Name string `json:"name,omitempty"`
}

type CreateConversationInput

type CreateConversationInput struct {
	Category       string         `json:"category,omitempty"`
	ConversationID string         `json:"conversation_id,omitempty"`
	Name           string         `json:"name,omitempty"`
	Participants   []*Participant `json:"participants,omitempty"`
}

type DataMessage

type DataMessage struct {
	AttachmentID string `json:"attachment_id,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	Size         int    `json:"size,omitempty"`
	Name         string `json:"name,omitempty"`
	*AttachmentMessageEncrypt
}

type Decoder added in v1.3.4

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

func NewDecoder added in v1.3.4

func NewDecoder(b []byte) *Decoder

func NewMinimumDecoder added in v1.7.6

func NewMinimumDecoder(b []byte) (*Decoder, error)

func (*Decoder) DecodeTransaction added in v1.3.4

func (dec *Decoder) DecodeTransaction() (*Transaction, error)

func (*Decoder) Read added in v1.3.4

func (dec *Decoder) Read(b []byte) error

func (*Decoder) ReadAggregatedSignature added in v1.4.2

func (dec *Decoder) ReadAggregatedSignature() (*AggregatedSignature, error)

func (*Decoder) ReadByte added in v1.9.0

func (dec *Decoder) ReadByte() (byte, error)

func (*Decoder) ReadBytes added in v1.3.4

func (dec *Decoder) ReadBytes() ([]byte, error)

func (*Decoder) ReadInput added in v1.3.4

func (dec *Decoder) ReadInput() (*Input, error)

func (*Decoder) ReadInt added in v1.3.4

func (dec *Decoder) ReadInt() (int, error)

func (*Decoder) ReadInteger added in v1.3.4

func (dec *Decoder) ReadInteger() (Integer, error)

func (*Decoder) ReadMagic added in v1.3.4

func (dec *Decoder) ReadMagic() (bool, error)

func (*Decoder) ReadOutput added in v1.3.4

func (dec *Decoder) ReadOutput(ver uint8) (*Output, error)

func (*Decoder) ReadSignatures added in v1.3.4

func (dec *Decoder) ReadSignatures() (map[uint16]*Signature, error)

func (*Decoder) ReadUint16 added in v1.3.4

func (dec *Decoder) ReadUint16() (uint16, error)

func (*Decoder) ReadUint32 added in v1.7.6

func (dec *Decoder) ReadUint32() (uint32, error)

func (*Decoder) ReadUint64 added in v1.3.4

func (dec *Decoder) ReadUint64() (uint64, error)

type DepositData added in v1.1.5

type DepositData struct {
	Chain       Hash    `json:"chain"`
	AssetKey    string  `json:"asset"`
	Transaction string  `json:"transaction"`
	Index       uint64  `json:"index"`
	Amount      Integer `json:"amount"`
}

type DepositEntry added in v1.7.5

type DepositEntry struct {
	Destination string   `json:"destination"`
	Tag         string   `json:"tag"`
	Properties  []string `json:"properties"`
}

type EdDSASigningMethod

type EdDSASigningMethod struct{}
var Ed25519SigningMethod *EdDSASigningMethod

func (*EdDSASigningMethod) Alg

func (sm *EdDSASigningMethod) Alg() string

func (*EdDSASigningMethod) Sign

func (sm *EdDSASigningMethod) Sign(signingString string, key interface{}) (string, error)

func (*EdDSASigningMethod) Verify

func (sm *EdDSASigningMethod) Verify(signingString, signature string, key interface{}) error

type Encoder added in v1.3.4

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

func NewEncoder added in v1.3.4

func NewEncoder() *Encoder

func NewMinimumEncoder added in v1.7.6

func NewMinimumEncoder() *Encoder

func (*Encoder) EncodeAggregatedSignature added in v1.4.2

func (enc *Encoder) EncodeAggregatedSignature(js *AggregatedSignature)

func (*Encoder) EncodeInput added in v1.3.4

func (enc *Encoder) EncodeInput(in *Input)

func (*Encoder) EncodeOutput added in v1.3.4

func (enc *Encoder) EncodeOutput(o *Output, ver uint8)

func (*Encoder) EncodeSignatures added in v1.3.4

func (enc *Encoder) EncodeSignatures(sm map[uint16]*Signature)

func (*Encoder) EncodeTransaction added in v1.3.4

func (enc *Encoder) EncodeTransaction(signed *Transaction) []byte

func (*Encoder) Write added in v1.3.4

func (enc *Encoder) Write(b []byte)

func (*Encoder) WriteByte added in v1.4.2

func (enc *Encoder) WriteByte(b byte) error

func (*Encoder) WriteInt added in v1.3.4

func (enc *Encoder) WriteInt(d int)

func (*Encoder) WriteInteger added in v1.3.4

func (enc *Encoder) WriteInteger(d Integer)

func (*Encoder) WriteUint16 added in v1.3.4

func (enc *Encoder) WriteUint16(d uint16)

func (*Encoder) WriteUint32 added in v1.7.6

func (enc *Encoder) WriteUint32(d uint32)

func (*Encoder) WriteUint64 added in v1.3.4

func (enc *Encoder) WriteUint64(d uint64)

type EncryptedMessageReceipt added in v1.5.10

type EncryptedMessageReceipt struct {
	MessageID   string     `json:"message_id"`
	RecipientID string     `json:"recipient_id"`
	State       string     `json:"state"`
	Sessions    []*Session `json:"sessions"`
}

type Error

type Error struct {
	Status      int                    `json:"status"`
	Code        int                    `json:"code"`
	Description string                 `json:"description"`
	Extra       map[string]interface{} `json:"extra,omitempty"`
	RequestID   string                 `json:"request_id,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

type ExchangeRate

type ExchangeRate Fiat

ExchangeRate represent the exchange rate between two currencies deprecated: use Fiat instead

type ExternalTransaction

type ExternalTransaction struct {
	TransactionID   string          `json:"transaction_id"`
	CreatedAt       time.Time       `json:"created_at"`
	TransactionHash string          `json:"transaction_hash"`
	Sender          string          `json:"sender"`
	ChainId         string          `json:"chain_id"`
	AssetId         string          `json:"asset_id"`
	Amount          decimal.Decimal `json:"amount"`
	Destination     string          `json:"destination"`
	Tag             string          `json:"tag"`
	Confirmations   int64           `json:"confirmations"`
	Threshold       int64           `json:"threshold"`
}

func ReadExternalTransactions

func ReadExternalTransactions(ctx context.Context, assetID, destination, tag string) ([]*ExternalTransaction, error)

type FavoriteApp

type FavoriteApp struct {
	UserID    string    `json:"user_id,omitempty"`
	AppID     string    `json:"app_id,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
}

type Fiat added in v1.5.7

type Fiat struct {
	Code string          `json:"code,omitempty"`
	Rate decimal.Decimal `json:"rate,omitempty"`
}

Fiat is a struct for fiat currencies

type GhostInput added in v1.2.5

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

type GhostKeyInput added in v1.9.0

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

type GhostKeys added in v1.0.12

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

GhostKeys transaction ghost keys

func (GhostKeys) DumpOutput added in v1.1.1

func (g GhostKeys) DumpOutput(threshold uint8, amount decimal.Decimal) *Output

type Graph added in v1.3.4

type Graph struct {
	SPS       float64                `json:"sps"`
	Topology  uint64                 `json:"topology"`
	Consensus []*ConsensusNode       `json:"consensus"`
	Final     map[string]*GraphFinal `json:"final"`
	Cache     map[string]*GraphCache `json:"cache"`
}

type GraphCache added in v1.3.4

type GraphCache struct {
	Node       Hash             `json:"node"`
	References GraphReferences  `json:"references"`
	Timestamp  int64            `json:"timestamp"`
	Round      uint64           `json:"round"`
	Snapshots  []*GraphSnapshot `json:"snapshots"`
}

type GraphFinal added in v1.3.4

type GraphFinal struct {
	Node  Hash   `json:"node"`
	Hash  Hash   `json:"hash"`
	Start int64  `json:"start"`
	End   int64  `json:"end"`
	Round uint64 `json:"round"`
}

type GraphReferences added in v1.3.4

type GraphReferences struct {
	External Hash `json:"external"`
	Self     Hash `json:"self"`
}

type GraphSnapshot added in v1.3.4

type GraphSnapshot struct {
	Node        Hash            `json:"node"`
	Hash        Hash            `json:"hash"`
	References  GraphReferences `json:"references"`
	Round       uint64          `json:"round"`
	Timestamp   int64           `json:"timestamp"`
	Transaction Hash            `json:"transaction"`
	Signature   string          `json:"signature"` // CosiSignature
	Version     int             `json:"version"`
}

type Hash added in v1.1.5

type Hash [32]byte
var (
	XINAssetId Hash
)

func HashFromString added in v1.1.5

func HashFromString(src string) (Hash, error)

func NewBlake3Hash added in v1.7.6

func NewBlake3Hash(data []byte) Hash

func NewHash added in v1.1.5

func NewHash(data []byte) Hash

func (Hash) HasValue added in v1.2.0

func (h Hash) HasValue() bool

func (Hash) MarshalJSON added in v1.1.5

func (h Hash) MarshalJSON() ([]byte, error)

func (Hash) String added in v1.1.5

func (h Hash) String() string

func (*Hash) UnmarshalJSON added in v1.1.5

func (h *Hash) UnmarshalJSON(b []byte) error

type ImageMessage

type ImageMessage struct {
	AttachmentID string `json:"attachment_id,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	Width        int    `json:"width,omitempty"`
	Height       int    `json:"height,omitempty"`
	Size         int    `json:"size,omitempty"`
	Thumbnail    string `json:"thumbnail,omitempty"`
	*AttachmentMessageEncrypt
}

type Input added in v1.0.12

type Input struct {
	Hash    *Hash        `json:"hash,omitempty"`
	Index   uint64       `json:"index,omitempty"`
	Genesis []byte       `json:"genesis,omitempty"`
	Deposit *DepositData `json:"deposit,omitempty"`
	Mint    *MintData    `json:"mint,omitempty"`
}

type Integer added in v1.1.5

type Integer struct {
	// contains filtered or unexported fields
}
var Zero Integer

func NewInteger added in v1.3.4

func NewInteger(x uint64) (v Integer)

func NewIntegerFromDecimal added in v1.1.5

func NewIntegerFromDecimal(d decimal.Decimal) (v Integer)

func NewIntegerFromString added in v1.1.5

func NewIntegerFromString(x string) (v Integer)

func (Integer) Add added in v1.7.6

func (x Integer) Add(y Integer) (v Integer)

func (Integer) Cmp added in v1.7.6

func (x Integer) Cmp(y Integer) int

func (Integer) Count added in v1.7.6

func (x Integer) Count(y Integer) uint64

func (Integer) Div added in v1.7.6

func (x Integer) Div(y int) (v Integer)

func (Integer) MarshalJSON added in v1.1.5

func (x Integer) MarshalJSON() ([]byte, error)

func (Integer) MarshalMsgpack added in v1.1.5

func (x Integer) MarshalMsgpack() ([]byte, error)

func (Integer) Mul added in v1.7.6

func (x Integer) Mul(y int) (v Integer)

func (Integer) Sign added in v1.7.6

func (x Integer) Sign() int

func (Integer) String added in v1.1.5

func (x Integer) String() string

func (Integer) Sub added in v1.7.6

func (x Integer) Sub(y Integer) (v Integer)

func (*Integer) UnmarshalJSON added in v1.1.5

func (x *Integer) UnmarshalJSON(b []byte) error

func (*Integer) UnmarshalMsgpack added in v1.1.5

func (x *Integer) UnmarshalMsgpack(data []byte) error

type Key added in v1.1.5

type Key [32]byte

func DeriveGhostPrivateKey added in v1.2.0

func DeriveGhostPrivateKey(R, a, b *Key, outputIndex uint64, hashFuncs ...func([]byte) Hash) *Key

func DeriveGhostPublicKey added in v1.2.0

func DeriveGhostPublicKey(r, A, B *Key, outputIndex uint64, hashFuncs ...func([]byte) Hash) *Key

func KeyFromString added in v1.1.5

func KeyFromString(s string) (Key, error)

func NewKey added in v1.2.0

func NewKey(randReader io.Reader) Key

func NewKeyFromSeed added in v1.2.0

func NewKeyFromSeed(seed []byte) Key

func SafeDeriveGhostPrivateKey added in v1.9.0

func SafeDeriveGhostPrivateKey(R, a, b *Key, outputIndex uint64) *Key

func SafeDeriveGhostPublicKey added in v1.9.0

func SafeDeriveGhostPublicKey(r, A, B *Key, outputIndex uint64) *Key

func SafeViewGhostOutputKey added in v1.9.0

func SafeViewGhostOutputKey(P, a, R *Key, outputIndex uint64) *Key

func ViewGhostOutputKey added in v1.2.0

func ViewGhostOutputKey(P, a, R *Key, outputIndex uint64, hashFuncs ...func([]byte) Hash) *Key

func (Key) CheckKey added in v1.2.0

func (k Key) CheckKey() bool

func (Key) DeterministicHashDerive added in v1.2.0

func (k Key) DeterministicHashDerive() Key

func (Key) HasValue added in v1.2.0

func (k Key) HasValue() bool

func (Key) MarshalJSON added in v1.1.5

func (k Key) MarshalJSON() ([]byte, error)

func (Key) Public added in v1.2.0

func (k Key) Public() Key

func (*Key) Sign added in v1.2.0

func (privateKey *Key) Sign(message []byte) Signature

func (*Key) SignHash added in v1.9.0

func (privateKey *Key) SignHash(h Hash) Signature

func (Key) String added in v1.1.5

func (k Key) String() string

func (Key) ToPoint added in v1.9.0

func (k Key) ToPoint() (*edwards25519.Point, error)

func (Key) ToScalar added in v1.9.0

func (k Key) ToScalar() (*edwards25519.Scalar, error)

func (*Key) UnmarshalJSON added in v1.1.5

func (k *Key) UnmarshalJSON(b []byte) error

func (*Key) Verify added in v1.2.0

func (publicKey *Key) Verify(message []byte, sig Signature) bool

func (*Key) VerifyHash added in v1.9.0

func (publicKey *Key) VerifyHash(message Hash, sig Signature) bool

func (*Key) VerifyWithChallenge added in v1.2.0

func (publicKey *Key) VerifyWithChallenge(sig Signature, a *edwards25519.Scalar) bool

type Keystore

type Keystore struct {
	ClientID   string `json:"client_id"`
	SessionID  string `json:"session_id"`
	PrivateKey string `json:"private_key"`
	PinToken   string `json:"pin_token"`
	Scope      string `json:"scope"`
}

type KeystoreAuth

type KeystoreAuth struct {
	*Keystore
	// contains filtered or unexported fields
}

func AuthEd25519FromKeystore added in v1.1.7

func AuthEd25519FromKeystore(store *Keystore) (*KeystoreAuth, error)

AuthEd25519FromKeystore produces a signer using an ed25519 keystore. Deprecated: use AuthFromKeystore instead.

func AuthFromKeystore

func AuthFromKeystore(store *Keystore) (*KeystoreAuth, error)

AuthFromKeystore produces a signer using both ed25519 & RSA keystore.

func (*KeystoreAuth) EncryptPin

func (k *KeystoreAuth) EncryptPin(pin string) string

func (*KeystoreAuth) SignToken

func (k *KeystoreAuth) SignToken(signature, requestID string, exp time.Duration) string

func (*KeystoreAuth) SignTokenAt added in v1.6.6

func (k *KeystoreAuth) SignTokenAt(signature, requestID string, at time.Time, exp time.Duration) string

type ListCircleItemsParams added in v1.7.1

type ListCircleItemsParams struct {
	CircleID string    `json:"circle_id,omitempty"`
	Offset   time.Time `json:"offset,omitempty"`
	Limit    int       `json:"limit,omitempty"`
}

type ListMultisigOutputsOption added in v1.6.6

type ListMultisigOutputsOption struct {
	Members        []string
	Threshold      uint8
	Offset         time.Time
	Limit          int
	OrderByCreated bool
	State          string
}

type LiveMessage

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

type LocationMessage

type LocationMessage struct {
	Name      string  `json:"name,omitempty"`
	Address   string  `json:"address,omitempty"`
	Longitude float64 `json:"longitude,omitempty"`
	Latitude  float64 `json:"latitude,omitempty"`
}

type ManageCircleParams added in v1.7.1

type ManageCircleParams struct {
	CircleID string `json:"circle_id,omitempty"`
	Action   string `json:"action,omitempty"`    // ADD or REMOVE
	ItemType string `json:"item_type,omitempty"` // users or conversations
	ItemID   string `json:"item_id,omitempty"`   // user_id or conversation_id
}

type MessageLocker added in v1.5.10

type MessageLocker interface {
	Lock(data []byte, sessions []*Session) ([]byte, error)
	Unlock(data []byte) ([]byte, error)
}

type MessageRequest

type MessageRequest struct {
	ConversationID string `json:"conversation_id"`
	RecipientID    string `json:"recipient_id"`
	MessageID      string `json:"message_id"`
	Category       string `json:"category"`
	Data           string `json:"data,omitempty"`
	// DataBase64 is same as Data but encoded by base64.RawURLEncoding
	DataBase64       string `json:"data_base64,omitempty"`
	RepresentativeID string `json:"representative_id,omitempty"`
	QuoteMessageID   string `json:"quote_message_id,omitempty"`
	Silent           bool   `json:"silent,omitempty"`

	// encrypted messages
	Checksum          string             `json:"checksum,omitempty"`
	RecipientSessions []RecipientSession `json:"recipient_sessions,omitempty"`
}

type MessageView

type MessageView struct {
	ConversationID string `json:"conversation_id"`
	UserID         string `json:"user_id"`
	MessageID      string `json:"message_id"`
	Category       string `json:"category"`
	Data           string `json:"data"`
	// DataBase64 is same as Data but encoded by base64.RawURLEncoding
	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"`
	// contains filtered or unexported fields
}

func (*MessageView) Ack

func (m *MessageView) Ack()

Ack mark messageView as acked otherwise sdk will ack this message

type Mint added in v1.3.4

type Mint struct {
	Pool   decimal.Decimal `json:"pool"`
	Pledge decimal.Decimal `json:"pledge"`
	Batch  uint64          `json:"batch"`
}

type MintData added in v1.1.5

type MintData struct {
	Group  string  `json:"group"`
	Batch  uint64  `json:"batch"`
	Amount Integer `json:"amount"`
}

type MixAddress added in v1.9.0

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

func NewMainnetMixAddress added in v1.9.0

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

func NewMixAddress added in v1.9.0

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

func NewMixAddressFromString added in v1.9.0

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

func (*MixAddress) Members added in v1.9.0

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

func (*MixAddress) String added in v1.9.0

func (ma *MixAddress) String() string

type MixinnetAddress added in v1.2.0

type MixinnetAddress struct {
	PrivateSpendKey Key `json:"private_spend_key"`
	PrivateViewKey  Key `json:"private_view_key"`
	PublicSpendKey  Key `json:"public_spend_key"`
	PublicViewKey   Key `json:"public_view_key"`
}

func NewMixinnetAddress added in v1.2.0

func NewMixinnetAddress(rand io.Reader, public ...bool) *MixinnetAddress

func NewMixinnetAddressFromPublicSpend added in v1.2.0

func NewMixinnetAddressFromPublicSpend(publicSpend Key) *MixinnetAddress

func NewMixinnetAddressFromString added in v1.2.0

func NewMixinnetAddressFromString(s string) (MixinnetAddress, error)

func (MixinnetAddress) CreateSafeUTXO added in v1.9.0

func (a MixinnetAddress) CreateSafeUTXO(outputIndex uint64, amount decimal.Decimal) *Output

func (MixinnetAddress) CreateUTXO added in v1.2.0

func (a MixinnetAddress) CreateUTXO(outputIndex uint64, amount decimal.Decimal, hashFuncs ...func([]byte) Hash) *Output

func (MixinnetAddress) Hash added in v1.2.0

func (a MixinnetAddress) Hash() Hash

func (MixinnetAddress) MarshalJSON added in v1.2.0

func (a MixinnetAddress) MarshalJSON() ([]byte, error)

func (MixinnetAddress) String added in v1.2.0

func (a MixinnetAddress) String() string

func (*MixinnetAddress) UnmarshalJSON added in v1.2.0

func (a *MixinnetAddress) UnmarshalJSON(b []byte) error

type MultisigRequest added in v1.0.12

type MultisigRequest struct {
	Type            string          `json:"type"`
	RequestID       string          `json:"request_id"`
	UserID          string          `json:"user_id"`
	AssetID         string          `json:"asset_id"`
	Amount          decimal.Decimal `json:"amount"`
	Threshold       uint8           `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 Hash            `json:"transaction_hash"`
	RawTransaction  string          `json:"raw_transaction"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
	CodeID          string          `json:"code_id"`
}

type MultisigUTXO added in v1.0.12

type MultisigUTXO struct {
	Type            string          `json:"type"`
	UserID          string          `json:"user_id"`
	UTXOID          string          `json:"utxo_id"`
	AssetID         string          `json:"asset_id"`
	TransactionHash Hash            `json:"transaction_hash"`
	OutputIndex     int             `json:"output_index"`
	Sender          string          `json:"sender,omitempty"`
	Amount          decimal.Decimal `json:"amount"`
	Threshold       uint8           `json:"threshold"`
	Members         []string        `json:"members"`
	Memo            string          `json:"memo"`
	State           string          `json:"state"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
	SignedBy        string          `json:"signed_by"`
	SignedTx        string          `json:"signed_tx"`
}

func (MultisigUTXO) Asset added in v1.1.5

func (utxo MultisigUTXO) Asset() Hash

type NetworkAsset

type NetworkAsset struct {
	Amount  decimal.Decimal `json:"amount"`
	AssetID string          `json:"asset_id"`
	IconURL string          `json:"icon_url"`
	Symbol  string          `json:"symbol"`
}

type NetworkChain

type NetworkChain struct {
	ChainID              string          `json:"chain_id"`
	IconURL              string          `json:"icon_url"`
	Name                 string          `json:"name"`
	Type                 string          `json:"type"`
	WithdrawFee          decimal.Decimal `json:"withdrawal_fee"`
	WithdrawTimestamp    time.Time       `json:"withdrawal_timestamp"`
	WithdrawPendingCount int64           `json:"withdrawal_pending_count"`
	DepositBlockHeight   int64           `json:"deposit_block_height"`
	ExternalBlockHeight  int64           `json:"external_block_height"`
	ManagedBlockHeight   int64           `json:"managed_block_height"`
	IsSynchronized       bool            `json:"is_synchronized"`
}

type NetworkInfo

type NetworkInfo struct {
	Assets         []*NetworkAsset `json:"assets"`
	Chains         []*NetworkChain `json:"chains"`
	AssetsCount    decimal.Decimal `json:"assets_count"`
	PeakThroughput decimal.Decimal `json:"peak_throughput"`
	SnapshotsCount decimal.Decimal `json:"snapshots_count"`
	Type           string          `json:"type"`
}

NetworkInfo mixin network info

func ReadNetworkInfo

func ReadNetworkInfo(ctx context.Context) (*NetworkInfo, error)

ReadNetworkInfo read mixin network

type OauthKeystore

type OauthKeystore struct {
	ClientID   string `json:"client_id,omitempty"`
	AuthID     string `json:"authorization_id,omitempty"`
	Scope      string `json:"scope,omitempty"`
	PrivateKey string `json:"private_key,omitempty"`
	VerifyKey  string `json:"ed25519,omitempty"`
}

func AuthorizeEd25519

func AuthorizeEd25519(ctx context.Context, clientID, clientSecret string, code string, verifier string, privateKey ed25519.PrivateKey) (*OauthKeystore, error)

type OauthKeystoreAuth

type OauthKeystoreAuth struct {
	*OauthKeystore
	// contains filtered or unexported fields
}

func AuthFromOauthKeystore

func AuthFromOauthKeystore(store *OauthKeystore) (*OauthKeystoreAuth, error)

func (*OauthKeystoreAuth) EncryptPin

func (o *OauthKeystoreAuth) EncryptPin(pin string) string

func (*OauthKeystoreAuth) SignToken

func (o *OauthKeystoreAuth) SignToken(signature, requestID string, exp time.Duration) string

func (*OauthKeystoreAuth) SignTokenAt added in v1.6.6

func (o *OauthKeystoreAuth) SignTokenAt(signature, requestID string, at time.Time, exp time.Duration) string

func (*OauthKeystoreAuth) Verify

func (o *OauthKeystoreAuth) Verify(resp *resty.Response) error

type Output added in v1.0.12

type Output struct {
	Type       uint8           `json:"type"`
	Amount     Integer         `json:"amount"`
	Keys       []Key           `json:"keys,omitempty"`
	Withdrawal *WithdrawalData `json:"withdrawal,omitempty" msgpack:",omitempty"`

	Script Script `json:"script"`
	Mask   Key    `json:"mask,omitempty"`
}

type Participant

type Participant struct {
	Action        string    `json:"action,omitempty"`
	Type          string    `json:"type,omitempty"`
	UserID        string    `json:"user_id,omitempty"`
	ParticipantID string    `json:"participant_id,omitempty"`
	Role          string    `json:"role,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty"`
}

Participant conversation participant

type Payment

type Payment struct {
	Recipient *User    `json:"recipient,omitempty"`
	Asset     *Asset   `json:"asset,omitempty"`
	AssetID   string   `json:"asset_id,omitempty"`
	Amount    string   `json:"amount,omitempty"`
	TraceID   string   `json:"trace_id,omitempty"`
	Status    string   `json:"status,omitempty"`
	Memo      string   `json:"memo,omitempty"`
	Receivers []string `json:"receivers,omitempty"`
	Threshold uint8    `json:"threshold,omitempty"`
	CodeID    string   `json:"code_id,omitempty"`
}

type Queue added in v1.3.4

type Queue struct {
	Finals uint64 `json:"finals"`
	Caches uint64 `json:"caches"`
}

type RawTransaction

type RawTransaction struct {
	Type            string    `json:"type"`
	SnapshotID      string    `json:"snapshot_id,omitempty"`
	OpponentKey     string    `json:"opponent_key,omitempty"`
	AssetID         string    `json:"asset_id"`
	Amount          string    `json:"amount"`
	TraceID         string    `json:"trace_id"`
	Memo            string    `json:"memo"`
	State           string    `json:"state"`
	CreatedAt       time.Time `json:"created_at"`
	TransactionHash string    `json:"transaction_hash,omitempty"`
	SnapshotHash    string    `json:"snapshot_hash,omitempty"`
	SnapshotAt      time.Time `json:"snapshot_at"`
}

RawTransaction raw transaction

type ReadSnapshotsOptions added in v1.6.5

type ReadSnapshotsOptions struct {
	Order         string
	AssetID       string
	OpponentID    string
	DestinationID string
	Tag           string
}

type RecallMessage

type RecallMessage struct {
	MessageID string `json:"message_id"`
}

type RecipientSession added in v1.5.10

type RecipientSession struct {
	SessionID string `json:"session_id,omitempty"`
}

type RelationshipRequest added in v1.5.1

type RelationshipRequest struct {
	UserID   string `json:"user_id,omitempty"`
	FullName string `json:"full_name,omitempty"`
	Action   string `json:"action,omitempty"`
}

type SafeAsset added in v1.9.0

type SafeAsset struct {
	AssetID        string          `json:"asset_id"`
	ChainID        string          `json:"chain_id"`
	FeeAssetID     string          `json:"fee_asset_id"`
	KernalAssetID  string          `json:"kernal_asset_id,omitempty"`
	Symbol         string          `json:"symbol,omitempty"`
	Name           string          `json:"name,omitempty"`
	IconURL        string          `json:"icon_url,omitempty"`
	PriceBTC       decimal.Decimal `json:"price_btc,omitempty"`
	PriceUSD       decimal.Decimal `json:"price_usd,omitempty"`
	ChangeBTC      decimal.Decimal `json:"change_btc,omitempty"`
	ChangeUsd      decimal.Decimal `json:"change_usd,omitempty"`
	PriceUpdatedAt time.Time       `json:"price_updated_at,omitempty"`
	AssetKey       string          `json:"asset_key,omitempty"`
	Precision      int32           `json:"precision,omitempty"`
	Dust           decimal.Decimal `json:"dust,omitempty"`
	Balance        decimal.Decimal `json:"balance,omitempty"`
	Confirmations  int             `json:"confirmations,omitempty"`
	KernelAssetID  string          `json:"kernel_asset_id,omitempty"`
}

func SafeReadAsset added in v1.9.0

func SafeReadAsset(ctx context.Context, accessToken, assetID string) (*SafeAsset, error)

func SafeReadAssets added in v1.9.0

func SafeReadAssets(ctx context.Context, accessToken string) ([]*SafeAsset, error)

type SafeDeposit added in v1.9.0

type SafeDeposit struct {
	DepositID       string          `json:"deposit_id,omitempty"`
	Destination     string          `json:"destination,omitempty"`
	Tag             string          `json:"tag,omitempty"`
	ChainID         string          `json:"chain_id,omitempty"`
	AssetID         string          `json:"asset_id,omitempty"`
	AssetKey        string          `json:"chain_key,omitempty"`
	Amount          decimal.Decimal `json:"amount,omitempty"`
	TransactionHash string          `json:"transaction_hash,omitempty"`
	OutputIndex     uint64          `json:"output_index,omitempty"`
	BlockHash       string          `json:"block_hash,omitempty"`
	Confirmations   uint64          `json:"confirmations,omitempty"`
	Threshold       uint64          `json:"threshold,omitempty"`
	CreatedAt       time.Time       `json:"created_at,omitempty"`
	UpdatedAt       time.Time       `json:"updated_at,omitempty"`
}

type SafeDepositEntry added in v1.9.0

type SafeDepositEntry struct {
	EntryID     string   `json:"entry_id,omitempty"`
	Members     []string `json:"members,omitempty"`
	Threshold   int      `json:"threshold,omitempty"`
	ChainID     string   `json:"chain_id,omitempty"`
	Destination string   `json:"destination,omitempty"`
	Tag         string   `json:"tag,omitempty"`
	Signature   string   `json:"signature,omitempty"`
}

type SafeListUtxoOption added in v1.9.0

type SafeListUtxoOption struct {
	Members   []string
	Threshold uint8
	Offset    uint64
	Asset     string
	Limit     int
	Order     string
	State     SafeUtxoState
}

type SafeSnapshot added in v1.9.0

type SafeSnapshot struct {
	SnapshotID      string          `json:"snapshot_id,omitempty"`
	RequestID       string          `json:"request_id,omitempty"`
	UserID          string          `json:"user_id,omitempty"`
	OpponentID      string          `json:"opponent_id,omitempty"`
	TransactionHash *Hash           `json:"transaction_hash,omitempty"`
	AssetID         string          `json:"asset_id,omitempty"`
	Amount          decimal.Decimal `json:"amount,omitempty"`
	Memo            string          `json:"memo,omitempty"`
	CreatedAt       time.Time       `json:"created_at"`
}

func ReadSafeSnapshot added in v1.9.0

func ReadSafeSnapshot(ctx context.Context, accessToken, snapshotID string) (*SafeSnapshot, error)

func ReadSafeSnapshots added in v1.9.0

func ReadSafeSnapshots(ctx context.Context, accessToken string, assetID string, offset time.Time, order string, limit int) ([]*SafeSnapshot, error)

type SafeTransactionInput added in v1.9.0

type SafeTransactionInput struct {
	Memo       string
	Inputs     []*SafeUtxo
	Outputs    []SafeTransactionOutput
	References []Hash
	Hint       string
}

func (*SafeTransactionInput) AppendOutput added in v1.9.0

func (i *SafeTransactionInput) AppendOutput(receivers []string, threshold uint8, amount decimal.Decimal)

func (*SafeTransactionInput) AppendUTXO added in v1.9.0

func (i *SafeTransactionInput) AppendUTXO(utxo *SafeUtxo)

func (*SafeTransactionInput) Asset added in v1.9.0

func (i *SafeTransactionInput) Asset() Hash

func (*SafeTransactionInput) TotalInputAmount added in v1.9.0

func (i *SafeTransactionInput) TotalInputAmount() decimal.Decimal

func (*SafeTransactionInput) Validate added in v1.9.0

func (i *SafeTransactionInput) Validate() error

type SafeTransactionOutput added in v1.9.0

type SafeTransactionOutput struct {
	Receivers []string
	Threshold uint8
	Amount    decimal.Decimal
}

type SafeTransactionReceiver added in v1.9.0

type SafeTransactionReceiver struct {
	Members    []string `json:"members,omitempty"`
	MemberHash Hash     `json:"members_hash,omitempty"`
	Threshold  uint8    `json:"threshold,omitempty"`
}

type SafeTransactionRequest added in v1.9.0

type SafeTransactionRequest struct {
	RequestID        string                     `json:"request_id,omitempty"`
	TransactionHash  string                     `json:"transaction_hash,omitempty"`
	UserID           string                     `json:"user_id,omitempty"`
	Asset            Hash                       `json:"asset,omitempty"`
	Amount           decimal.Decimal            `json:"amount,omitempty"`
	CreatedAt        time.Time                  `json:"created_at,omitempty"`
	UpdatedAt        time.Time                  `json:"updated_at,omitempty"`
	Extra            string                     `json:"extra,omitempty"`
	Receivers        []*SafeTransactionReceiver `json:"receivers,omitempty"`
	Senders          []string                   `json:"senders,omitempty"`
	SendersHash      string                     `json:"senders_hash,omitempty"`
	SendersThreshold uint8                      `json:"senders_threshold,omitempty"`
	Signers          []string                   `json:"signers,omitempty"`
	SnapshotHash     string                     `json:"snapshot_hash,omitempty"`
	SnapshotAt       *time.Time                 `json:"snapshot_at,omitempty"`
	State            SafeUtxoState              `json:"state,omitempty"`
	RawTransaction   string                     `json:"raw_transaction"`
	Views            []Key                      `json:"views,omitempty"`
}

type SafeTransactionRequestInput added in v1.9.0

type SafeTransactionRequestInput struct {
	RequestID      string `json:"request_id"`
	RawTransaction string `json:"raw"`
}

type SafeUtxo added in v1.9.0

type SafeUtxo struct {
	OutputID           string          `json:"output_id,omitempty"`
	RequestID          string          `json:"request_id,omitempty"`
	TransactionHash    Hash            `json:"transaction_hash,omitempty"`
	OutputIndex        uint64          `json:"output_index,omitempty"`
	Asset              Hash            `json:"asset,omitempty"`
	Amount             decimal.Decimal `json:"amount,omitempty"`
	Mask               Key             `json:"mask,omitempty"`
	Keys               []Key           `json:"keys,omitempty"`
	SendersHash        string          `json:"senders_hash,omitempty"`
	SendersThreshold   uint8           `json:"senders_threshold,omitempty"`
	Senders            []string        `json:"senders,omitempty"`
	ReceiversHash      Hash            `json:"receivers_hash,omitempty"`
	ReceiversThreshold uint8           `json:"receivers_threshold,omitempty"`
	Receivers          []string        `json:"receivers,omitempty"`
	Extra              string          `json:"extra,omitempty"`
	State              SafeUtxoState   `json:"state,omitempty"`
	Sequence           uint64          `json:"sequence,omitempty"`
	CreatedAt          time.Time       `json:"created_at,omitempty"`
	UpdatedAt          time.Time       `json:"updated_at,omitempty"`
	Signers            []string        `json:"signers,omitempty"`
	SignedBy           string          `json:"signed_by,omitempty"`
	SignedAt           *time.Time      `json:"signed_at,omitempty"`
	SpentAt            *time.Time      `json:"spent_at,omitempty"`
}

type SafeUtxoState added in v1.9.0

type SafeUtxoState string
const (
	SafeUtxoStateUnspent SafeUtxoState = "unspent"
	SafeUtxoStateSigned  SafeUtxoState = "signed"
	SafeUtxoStateSpent   SafeUtxoState = "spent"
)

type Script added in v1.1.5

type Script []uint8

func NewThresholdScript added in v1.1.5

func NewThresholdScript(threshold uint8) Script

func (Script) MarshalJSON added in v1.1.5

func (s Script) MarshalJSON() ([]byte, error)

func (Script) String added in v1.1.5

func (s Script) String() string

func (*Script) UnmarshalJSON added in v1.1.5

func (s *Script) UnmarshalJSON(b []byte) error

func (Script) Validate added in v1.1.5

func (s Script) Validate(sum int) error

func (Script) VerifyFormat added in v1.1.5

func (s Script) VerifyFormat() error

type SendSchemeCategory added in v1.8.0

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

type Session added in v1.5.10

type Session struct {
	UserID    string `json:"user_id,omitempty"`
	SessionID string `json:"session_id,omitempty"`
	PublicKey string `json:"public_key,omitempty"`
	Platform  string `json:"platform,omitempty"`
}

type Signature added in v1.1.5

type Signature [64]byte

func (Signature) MarshalJSON added in v1.1.5

func (s Signature) MarshalJSON() ([]byte, error)

func (Signature) String added in v1.1.5

func (s Signature) String() string

func (*Signature) UnmarshalJSON added in v1.1.5

func (s *Signature) UnmarshalJSON(b []byte) error

type Signer

type Signer interface {
	SignToken(signature, requestID string, exp time.Duration) string
	EncryptPin(pin string) string
}

type Snapshot

type Snapshot struct {
	SnapshotID        string          `json:"snapshot_id"`
	CreatedAt         time.Time       `json:"created_at,omitempty"`
	TraceID           string          `json:"trace_id,omitempty"`
	UserID            string          `json:"user_id,omitempty"`
	AssetID           string          `json:"asset_id,omitempty"`
	ChainID           string          `json:"chain_id,omitempty"`
	OpponentID        string          `json:"opponent_id,omitempty"`
	OpponentKey       string          `json:"opponent_key,omitempty"`
	OpponentReceivers []string        `json:"opponent_receivers,omitempty"`
	OpponentThreshold uint8           `json:"opponent_threshold,omitempty"`
	Source            string          `json:"source,omitempty"`
	Amount            decimal.Decimal `json:"amount,omitempty"`
	OpeningBalance    decimal.Decimal `json:"opening_balance,omitempty"`
	ClosingBalance    decimal.Decimal `json:"closing_balance,omitempty"`
	Memo              string          `json:"memo,omitempty"`
	Type              string          `json:"type,omitempty"`
	Sender            string          `json:"sender,omitempty"`
	Receiver          string          `json:"receiver,omitempty"`
	TransactionHash   string          `json:"transaction_hash,omitempty"`
	SnapshotHash      string          `json:"snapshot_hash,omitempty"`
	SnapshotAt        *time.Time      `json:"snapshot_at,omitempty"`

	Asset *Asset `json:"asset,omitempty"`
}

func ReadSnapshot

func ReadSnapshot(ctx context.Context, accessToken, snapshotID string) (*Snapshot, error)

ReadSnapshot by accessToken, scope SNAPSHOTS:READ required

func ReadSnapshotByTraceID added in v1.6.1

func ReadSnapshotByTraceID(ctx context.Context, accessToken, traceID string) (*Snapshot, error)

ReadSnapshotByTraceID by accessToken, scope SNAPSHOTS:READ required

func ReadSnapshots

func ReadSnapshots(ctx context.Context, accessToken string, assetID string, offset time.Time, order string, limit int) ([]*Snapshot, error)

ReadSnapshots by accessToken, scope SNAPSHOTS:READ required Deprecated: use ReadSnapshotsWithOptions instead.

func ReadSnapshotsWithOptions added in v1.6.5

func ReadSnapshotsWithOptions(ctx context.Context, accessToken string, offset time.Time, limit int, input ReadSnapshotsOptions) ([]*Snapshot, error)

ReadSnapshotsWithOptions reads snapshots by accessToken, scope SNAPSHOTS:READ required

func (*Snapshot) UnmarshalJSON

func (s *Snapshot) UnmarshalJSON(b []byte) error

type StickerMessage

type StickerMessage struct {
	Name    string `json:"name,omitempty"`
	AlbumID string `json:"album_id,omitempty"`
}

type SystemConversationPayload

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

type Ticker added in v1.5.6

type Ticker struct {
	Type     string          `json:"type"`
	PriceUSD decimal.Decimal `json:"price_usd"`
	PriceBTC decimal.Decimal `json:"price_btc"`
}

func ReadTicker added in v1.5.6

func ReadTicker(ctx context.Context, assetID string, offset time.Time) (*Ticker, error)

ReadTicker read mixin ticker of asset with offset

type Transaction added in v1.0.12

type Transaction struct {
	Hash                *Hash                   `json:"hash,omitempty" msgpack:"-"`
	Snapshot            *Hash                   `json:"snapshot,omitempty" msgpack:"-"`
	Signatures          []map[uint16]*Signature `json:"signatures,omitempty" msgpack:"-"`
	AggregatedSignature *AggregatedSignature    `json:"aggregated_signature,omitempty" msgpack:"-"`

	Version    uint8            `json:"version"`
	Asset      Hash             `json:"asset"`
	Inputs     []*Input         `json:"inputs"`
	Outputs    []*Output        `json:"outputs"`
	References []Hash           `msgpack:"-"`
	Extra      TransactionExtra `json:"extra,omitempty"`
}

func GetTransaction added in v1.0.12

func GetTransaction(ctx context.Context, hash Hash) (*Transaction, error)

func MakeCollectibleTransaction added in v1.6.7

func MakeCollectibleTransaction(
	ctx context.Context,
	accessToken string,
	output *CollectibleOutput,
	token *CollectibleToken,
	receivers []string,
	threshold uint8,
) (*Transaction, error)

MakeCollectibleTransaction make collectible transaction with accessToken

func SafeSignTransaction added in v1.9.0

func SafeSignTransaction(ctx context.Context, spendKey Key, request *SafeTransactionRequest, inputUtxos map[Hash]map[uint64]*SafeUtxo) (*Transaction, error)

func SendRawTransaction added in v1.0.12

func SendRawTransaction(ctx context.Context, raw string) (*Transaction, error)

func TransactionFromData added in v1.6.11

func TransactionFromData(data []byte) (*Transaction, error)

func TransactionFromRaw added in v1.1.1

func TransactionFromRaw(raw string) (*Transaction, error)

func (*Transaction) DumpTransaction added in v1.1.1

func (t *Transaction) DumpTransaction() (string, error)

func (*Transaction) DumpTransactionData added in v1.3.4

func (t *Transaction) DumpTransactionData() ([]byte, error)

func (Transaction) DumpTransactionPayload added in v1.1.5

func (t Transaction) DumpTransactionPayload() ([]byte, error)

func (*Transaction) TransactionHash added in v1.1.5

func (t *Transaction) TransactionHash() (Hash, error)

type TransactionExtra added in v1.2.0

type TransactionExtra []byte

func (TransactionExtra) MarshalJSON added in v1.2.0

func (e TransactionExtra) MarshalJSON() ([]byte, error)

func (TransactionExtra) String added in v1.2.0

func (e TransactionExtra) String() string

func (*TransactionExtra) UnmarshalJSON added in v1.2.0

func (e *TransactionExtra) UnmarshalJSON(b []byte) error

type TransactionInput added in v1.1.1

type TransactionInput struct {
	Memo       string
	Inputs     []*MultisigUTXO
	Outputs    []TransactionOutput
	References []Hash
	Hint       string
}

Only use in Legacy Network

func (*TransactionInput) AppendOutput added in v1.1.3

func (i *TransactionInput) AppendOutput(receivers []string, threshold uint8, amount decimal.Decimal)

func (*TransactionInput) AppendUTXO added in v1.1.3

func (i *TransactionInput) AppendUTXO(utxo *MultisigUTXO)

func (*TransactionInput) Asset added in v1.1.1

func (i *TransactionInput) Asset() Hash

func (*TransactionInput) TotalInputAmount added in v1.1.1

func (i *TransactionInput) TotalInputAmount() decimal.Decimal

func (*TransactionInput) Validate added in v1.1.1

func (i *TransactionInput) Validate() error

type TransactionOutput

type TransactionOutput struct {
	Receivers []string
	Threshold uint8
	Amount    decimal.Decimal
}

Only use in Legacy Network

type TransactionV1 added in v1.3.4

type TransactionV1 struct {
	Transaction
	Signatures [][]*Signature `json:"signatures,omitempty" msgpack:",omitempty"`
}

func (*TransactionV1) DumpTransaction added in v1.3.4

func (t *TransactionV1) DumpTransaction() (string, error)

type TranscriptMessage added in v1.4.9

type TranscriptMessage struct {
	TranscriptID   string    `json:"transcript_id,omitempty"`
	MessageID      string    `json:"message_id,omitempty"`
	UserID         string    `json:"user_id,omitempty"`
	UserFullName   string    `json:"user_full_name,omitempty"`
	Category       string    `json:"category,omitempty"`
	Content        string    `json:"content,omitempty"`
	MediaURL       string    `json:"media_url,omitempty"`
	MediaName      string    `json:"media_name,omitempty"`
	MediaSize      int       `json:"media_size,omitempty"`
	MediaWidth     int       `json:"media_width,omitempty"`
	MediaHeight    int       `json:"media_height,omitempty"`
	MediaDuration  int       `json:"media_duration,omitempty"`
	MediaMimeType  string    `json:"media_mime_type,omitempty"`
	MediaStatus    string    `json:"media_status,omitempty"`
	MediaWaveform  string    `json:"media_waveform,omitempty"`
	MediaKey       string    `json:"media_key,omitempty"`
	MediaDigest    string    `json:"media_digest,omitempty"`
	MediaCreatedAt time.Time `json:"media_created_at,omitempty"`
	ThumbImage     string    `json:"thumb_image,omitempty"`
	ThumbURL       string    `json:"thumb_url,omitempty"`
	StickerID      string    `json:"sticker_id,omitempty"`
	SharedUserID   string    `json:"shared_user_id,omitempty"`
	Mentions       string    `json:"mentions,omitempty"`
	QuoteID        string    `json:"quote_id,omitempty"`
	QuoteContent   string    `json:"quote_content,omitempty"`
	Caption        string    `json:"caption,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
}

type TransferInput

type TransferInput struct {
	AssetID    string          `json:"asset_id,omitempty"`
	OpponentID string          `json:"opponent_id,omitempty"`
	Amount     decimal.Decimal `json:"amount,omitempty"`
	TraceID    string          `json:"trace_id,omitempty"`
	Memo       string          `json:"memo,omitempty"`

	// OpponentKey used for raw transaction
	OpponentKey string `json:"opponent_key,omitempty"`

	OpponentMultisig struct {
		Receivers []string `json:"receivers,omitempty"`
		Threshold uint8    `json:"threshold,omitempty"`
	} `json:"opponent_multisig,omitempty"`
}

TransferInput input for transfer/verify payment request

func NewMintCollectibleTransferInput added in v1.5.4

func NewMintCollectibleTransferInput(traceID, collectionID string, token int64, metaHash []byte) TransferInput

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 Turn

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

type UpdateAppRequest added in v1.0.9

type UpdateAppRequest struct {
	RedirectURI      string   `json:"redirect_uri,omitempty"`
	HomeURI          string   `json:"home_uri,omitempty"`
	Name             string   `json:"name,omitempty"`
	Description      string   `json:"description,omitempty"`
	IconBase64       string   `json:"icon_base64,omitempty"`
	SessionSecret    string   `json:"session_secret,omitempty"`
	Category         string   `json:"category,omitempty"`
	Capabilities     []string `json:"capabilities,omitempty"`
	ResourcePatterns []string `json:"resource_patterns,omitempty"`
}

type UpdateCircleParams added in v1.7.1

type UpdateCircleParams struct {
	CircleID string `json:"circle_id,omitempty"`
	Name     string `json:"name,omitempty"`
}

type User

type User struct {
	UserID                   string    `json:"user_id,omitempty"`
	IdentityNumber           string    `json:"identity_number,omitempty"`
	Phone                    string    `json:"phone,omitempty"`
	FullName                 string    `json:"full_name,omitempty"`
	Biography                string    `json:"biography,omitempty"`
	AvatarURL                string    `json:"avatar_url,omitempty"`
	Relationship             string    `json:"relationship,omitempty"`
	MuteUntil                time.Time `json:"mute_until,omitempty"`
	CreatedAt                time.Time `json:"created_at,omitempty"`
	IsVerified               bool      `json:"is_verified,omitempty"`
	IsScam                   bool      `json:"is_scam,omitempty"`
	IsDeactivated            bool      `json:"is_deactivated,omitempty"`
	CodeID                   string    `json:"code_id,omitempty"`
	CodeURL                  string    `json:"code_url,omitempty"`
	SessionID                string    `json:"session_id,omitempty"`
	DeviceStatus             string    `json:"device_status,omitempty"`
	HasSafe                  bool      `json:"has_safe,omitempty"`
	HasPin                   bool      `json:"has_pin,omitempty"`
	HasEmergencyContact      bool      `json:"has_emergency_contact,omitempty"`
	ReceiveMessageSource     string    `json:"receive_message_source,omitempty"`
	AcceptConversationSource string    `json:"accept_conversation_source,omitempty"`
	AcceptSearchSource       string    `json:"accept_search_source,omitempty"`
	FiatCurrency             string    `json:"fiat_currency,omitempty"`
	PinToken                 string    `json:"pin_token,omitempty"`
	PinTokenBase64           string    `json:"pin_token_base64,omitempty"`
	SaltBase64               string    `json:"salt_base64,omitempty"`
	TipKeyBase64             string    `json:"tip_key_base64,omitempty"`
	TipCounter               int       `json:"tip_counter,omitempty"`

	App *App `json:"app,omitempty"`
}

func UserMe

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

type UserUpdate added in v1.6.15

type UserUpdate struct {
	FullName     string `json:"full_name,omitempty"`
	AvatarBase64 string `json:"avatar_base64,omitempty"`
	Biography    string `json:"biography,omitempty"`
}

type Verifier

type Verifier interface {
	Verify(resp *resty.Response) error
}

func NopVerifier

func NopVerifier() Verifier

type VideoMessage

type VideoMessage struct {
	AttachmentID string `json:"attachment_id,omitempty"`
	MimeType     string `json:"mime_type,omitempty"`
	WaveForm     string `json:"wave_form,omitempty"`
	Width        int    `json:"width,omitempty"`
	Height       int    `json:"height,omitempty"`
	Size         int    `json:"size,omitempty"`
	Duration     int    `json:"duration,omitempty"`
	Thumbnail    []byte `json:"thumbnail,omitempty"`
	*AttachmentMessageEncrypt
}

type WithdrawInput

type WithdrawInput struct {
	AddressID string          `json:"address_id,omitempty"`
	Amount    decimal.Decimal `json:"amount,omitempty"`
	TraceID   string          `json:"trace_id,omitempty"`
	Memo      string          `json:"memo,omitempty"`
}

type WithdrawalData added in v1.3.4

type WithdrawalData struct {
	Address string `json:"address"`
	Tag     string `json:"tag"`

	// DEPRECATED since safe, tx 5, TxVersionHashSignature
	Chain Hash `json:"chain"`
	// DEPRECATED since safe, tx 5, TxVersionHashSignature
	AssetKey string `json:"asset"`
}

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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