Go Client
Table of contents
Overview
This is GO library used to communicate with SPV Wallet. It allows us to create an admin or normal user client and then call methods to work with transactions, xpubs, paymails and access keys.
Installation
Usage
Create SPV Wallet Go Client instance
To create a SPV Wallet Go Client instance you need to provide user xpriv and SPV Wallet url. You can also define if you want to sign requests. Below you can find examples of creating admin and normal user clients.
Admin wallet client instance
Normal wallet client instance
Register new xPub
To register new xPub we need to call RegisterNewXpub
method with new xpub.
Additional libraries which will be used in the example:
Generate new xpub
To generate your own kepair - xPub and xPriv, you can use SPV Wallet Admin Keygen tool. You can find more information about it here.
Register new xPub in SPV Wallet
Get xPub
This method returns information about xpub for the client which is calling this method.
Create paymail
Paymail is a new way of creating transaction without knowing the specific address only the paymail.
Create new access key
Access key is another way to autorize user. It can be used like xpub but it is not sufficient to sign transactions.
Get Transactions
This method return all transactions for xpub which was given during SPV Wallet client creation. You can also filter transactions by providing conditions and use pagination by providing query params.
Get Transaction
This method return specific transaction but only if the transaction is connected with user xpub (transaction is incoming or outgoing for user).
Create transaction
Transaction can be made in two different ways. First is using SendToRecipients
method, which include everything inside. Second is bycalling every method separately SendToRecipients
method
It is possible to send metadata which will be saved in transaction object. If you want to send transaction to multiple recipients you need to provide array of recipients.
Separated methods
Last updated