toolslib

package
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJWT

func AddJWT(requestPayload interface{}, privKey *btcec.PrivateKey) (_jwtPayload interface{}, _err error)

Add a JWT token to the specified request payload interface using a provided private key.

Here's an example on how this can be used to execute a request as an admin: payload := routes.AdminUpdateUserGlobalMetadataRequest{ ... } mPayload, _ := toolslib.AddJWT(payload, adminPrivKey) postBody, _ := json.Marshal(mPayload) postBuffer := bytes.NewBuffer(postBody) resp, _ := http.Post(endpoint, "application/json", postBuffer)

func BuyCreator

func BuyCreator(buyerPubKey *btcec.PublicKey, buyerPrivKey *btcec.PrivateKey, creatorPubKey *btcec.PublicKey,
	amountNanos uint64, params *lib.DeSoParams, node string) error

BuyCreator...

func GenerateJWTToken

func GenerateJWTToken(privKey *btcec.PrivateKey) (_JWT string, _err error)

Generate a JWT Token for the provided private key. This can be added to the payload for requests that require JWT token authentication.

func GenerateMnemonicPublicPrivate

func GenerateMnemonicPublicPrivate(params *lib.DeSoParams) (mnemonic string, pubKey *btcec.PublicKey, privKey *btcec.PrivateKey)

GenerateMnemonicPublicPrivate,,,

func GetBestChainFromBadger

func GetBestChainFromBadger(syncedDBHandle *badger.DB) ([]*lib.BlockNode, error)

Returns the best chain associated with a badgerDB handle.

func OpenDataDir

func OpenDataDir(dataDir string) (*badger.DB, error)

Returns the badgerDB handler associated with a dataDir path.

func SendDeSo

func SendDeSo(senderPubKey *btcec.PublicKey,
	senderPrivKey *btcec.PrivateKey,
	recipientPubKey *btcec.PublicKey, amountNanos int64, params *lib.DeSoParams, node string) error

SendDeSo...

func SendDiamonds

func SendDiamonds(senderPubKey *btcec.PublicKey, senderPrivKey *btcec.PrivateKey, postHashHex string,
	receiverPublicKeyBase58Check string, diamondLevel int64, params *lib.DeSoParams, node string) error

SendDiamonds

func SendMessage

func SendMessage(senderPubKey *btcec.PublicKey, senderPrivKey *btcec.PrivateKey,
	recipientPubKey *btcec.PublicKey, message string, params *lib.DeSoParams, node string) error

func SubmitTransactionToNode

func SubmitTransactionToNode(txn *lib.MsgDeSoTxn, node string) error

SubmitTransactionToNode...

func UpdateBitcoinUSDExchangeRate

func UpdateBitcoinUSDExchangeRate(updaterPubKey *btcec.PublicKey, updaterPrivKey *btcec.PrivateKey, newUSDCentsPerBitcoin uint64,
	params *lib.DeSoParams, node string) error

UpdateBitcoinUSDExchangeRate...

func UpdateProfile

func UpdateProfile(updaterPubKey *btcec.PublicKey, updaterPrivKey *btcec.PrivateKey, newUsername string, newDescription string,
	newProfilePic string, newCreatorBasisPoints uint64, params *lib.DeSoParams, node string) error

UpdateProfile...

Types

This section is empty.

Jump to

Keyboard shortcuts

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