Documentation ¶
Index ¶
- Constants
- type AXTUnit
- type Balance
- type ChainDapp
- type ChainDappList
- type DAppAxtConsume
- type DAppAxtConsumes
- type DAppAxtTotal
- type DAppIssuedToken
- type DAppIssuedTokens
- type DAppList
- type DAppLists
- type DAppNum
- type DAppTotal
- type DAppUsersList
- type DAppUsersLists
- type DAppUsersTotal
- type Fee
- type Growth
- type Growths
- type HotAsset
- type HotAssets
- type HotToken
- type HotTokens
- type IWalletClient
- type IndexGetPayload
- type IndexSetPayload
- type IndexTags
- type IssueAssetBody
- type IssueBody
- type IssueCTokenPrepareResponse
- type KeyPair
- type OffchainMetadata
- type POEBody
- type POEPayload
- type ProcessTxBody
- type RegisterSubWalletBody
- type RegisterWalletBody
- type SNMetadata
- type SNRequest
- type TokenAmount
- type TopAssetUser
- type TopAssetUsers
- type TopTokenUser
- type TopTokenUsers
- type Total
- type TransferAssetBody
- type TransferCTokenBody
- type UploadResponse
- type WalletBalance
- type WalletInfo
- type WalletRequest
- type WalletResponse
Constants ¶
const ( // OffchainPOEID poe did when invoke upload file api formdata param OffchainPOEID = "poe_id" // OffchainPOEFile poe binary file when invoke upload file api formdata param OffchainPOEFile = "poe_file" // OffchainPOEFile poe file read/write attribute when upload file api formdata param OffchainReadOnly = "read_only" // DownloadUrl url link to download poe file related to POE instance DownloadUrl = "url" )
const ( // SignatureCreator issuer did SignatureCreator = "signature.creator" // SignatureCreated timestamp SignatureCreated = "signature.created" // SignatureNonce nonce SignatureNonce = "signature.nonce" // SignatureSignatureValue sign value SignatureSignatureValue = "signature.signatureValue" )
signature const for the formdata
const ( ATOM AXTUnit = 1 MicroAXT = 1000 * ATOM AXT = 1000 * MicroAXT )
const ( // TxnLogTypeIn is the type of imported transaction logs TxLogTypeIn string = "in" // TxnLogTypeOut is the type of outputed transaction logs TxLogTypeOut string = "out" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balance ¶
type Balance struct { Id string `json:"id,omitempty"` //ctoken id Amount int64 `json:"amount,omitempty"` //ctoken amount }
Balance ...
type ChainDapp ¶
type ChainDapp struct { Name string `json:"name"` //应用链的名称 Version string `json:"version"` //版本 Description string `json:"description"` //DAPP的描述 Logo string `json:"logo"` //DAPP的Logo路径 }
ChainDapp define ChainDapp struct
type DAppAxtConsume ¶
type DAppAxtConsume struct { Datetime string `json:"datetime"` //日期 ConsumeAmount int64 `json:"consume_amount"` //消耗AXT的数量 }
DAppAxtConsume define DApp Axt Consume struct
type DAppAxtConsumes ¶
type DAppAxtConsumes []*DAppAxtConsume
type DAppAxtTotal ¶
type DAppAxtTotal struct { AssignAmount int64 `json:"assign_amount"` // AXT分配总量 RemainAmount int64 `json:"remain_amount"` //AXT剩余总量 }
DAppAxtTotal define DApp Axt Total struct
type DAppIssuedToken ¶
type DAppIssuedToken struct { IssuedAmount int64 `json:"issued_amount"` //发行的总量 RemainAmount int64 `json:"remain_amount"` //剩余的总量 }
DAppIssuedToken define DApp Issued Token struct
type DAppIssuedTokens ¶
type DAppIssuedTokens map[string]*DAppIssuedToken // key is token_id
DApp issued/remain amount
type DAppList ¶
type DAppList struct { Name string `json:"name"` //DAPP的名称 Description string `json:"description"` //DAPP的描述 Logo string `json:"logo"` //DAPP的Logo路径 }
DAppList define DApp's List struct
type DAppNum ¶
type DAppNum struct {
Num int64 `json:"num"` //DAPP的数量
}
DAppNum define DApp's Number struct
type DAppTotal ¶
type DAppTotal struct { TotalAssets int64 `json:"total_assets"` //企业用户拥有数字资产的数量 TotalTokens int64 `json:"total_tokens"` //企业用户拥有数字凭证的数量 TotalTxs int64 `json:"total_txs"` //企业用户交易的总量 TotalIncomeTxs int64 `json:"total_income_txs"` //企业用户输入的交易总量 TotalSpendingTxs int64 `json:"total_spending_txs"` //企业用户输出的交易总量 TotalAxtConsumedTxs int64 `json:"total_axt_consumed_txs"` //企业用户消耗AXT的交易总量 TotalIncomeAssets int64 `json:"total_income_assets"` //企业用户输入的数字资产总量 TotalSpendingAssets int64 `json:"total_spending_assets"` //企业用户输出的数字资产总量 TotalIncomeTokens int64 `json:"total_income_tokens"` //企业用户输入的数字凭证总量 TotalSpendingTokens int64 `json:"total_spending_tokens"` //企业用户输出的数字凭证总量 }
DAppTotal define DApp Total struct
type DAppUsersList ¶
type DAppUsersList struct { Id int64 `json:"id"` //用户Id Name string `json:"name"` //用户名称 Email string `json:"email"` //用户邮箱 Phone string `json:"phone"` //用户电话 }
DAppUsersList define DApp Users List struct
type DAppUsersLists ¶
type DAppUsersLists []*DAppUsersList
type DAppUsersTotal ¶
type DAppUsersTotal struct {
TotalUsers int64 `json:"total_users"` //应用用户的数量
}
DAppUsersTotal define DApp Uesrs Total struct
type Growth ¶
type Growth struct { Datetime string `json:"datetime"` //日期 GrowthAmount int64 `json:"growth_amount"` //增长量 }
Growth define Growth struct
type HotAsset ¶
type HotAsset struct { AssetId string `json:"asset_id"` //数字资产ID TxsNum int64 `json:"txs_num"` //该数字资产总的交易数量 }
HotAsset define Hot Asset stuct
type HotToken ¶
type HotToken struct { TokenId string `json:"token_id"` //数字凭证ID TxsNum int64 `json:"txs_num"` //该数字凭证总的交易数量 }
HotToken define Hot Token struct
type IWalletClient ¶
type IWalletClient interface { // Register is used to register user wallet. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will return the key pair. // If you want to trust the key pair, it will return the security code. // Register(http.Header, *RegisterWalletBody) (*WalletResponse, error) // RegisterSubWallet is used to register user subwallet. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will return the key pair. // If you want to trust the key pair, it will return the security code. // RegisterSubWallet(http.Header, *RegisterSubWalletBody) (*WalletResponse, error) // GetWalletBalance is used to get wallet balances. // GetWalletBalance(http.Header, commdid.Identifier) (*WalletBalance, error) // GetWalletInfo is used to get wallet base information. // GetWalletInfo(http.Header, commdid.Identifier) (*WalletInfo, error) // CreatePOE is used to create POE digital asset. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // CreatePOE(http.Header, *POEBody, *pki.SignatureParam) (*WalletResponse, error) // UpdatePOE is used to update POE digital asset. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // UpdatePOE(http.Header, *POEBody, *pki.SignatureParam) (*WalletResponse, error) // QueryPOE is used to query POE digital asset. // QueryPOE(http.Header, commdid.Identifier) (*POEPayload, error) // UploadPOEFile is used to upload file for specified POE digital asset // // poeID parameter is the POE digital asset ID pre-created using CreatePOE API. // // poeFile parameter is the path to file to be uploaded. // UploadPOEFile(header http.Header, poeID string, poeFile string, readOnly bool) (*UploadResponse, error) // IssueCToken is used to issue colored token. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // IssueCToken(http.Header, *IssueBody, *pki.SignatureParam) (*WalletResponse, error) // IssueAsset is used to issue digital asset. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // IssueAsset(http.Header, *IssueAssetBody, *pki.SignatureParam) (*WalletResponse, error) // TransferCToken is used to transfer colored tokens from one user to another. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // TransferCToken(http.Header, *TransferCTokenBody, *pki.SignatureParam) (*WalletResponse, error) // TransferAsset is used to transfer assets from one user to another. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // TransferAsset(http.Header, *TransferAssetBody, *pki.SignatureParam) (*WalletResponse, error) // SendIssueCTokenProposal is used to send issue ctoken proposal to get wallet.Tx to be signed. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // SendIssueCTokenProposal(http.Header, *IssueBody) (*IssueCTokenPrepareResponse, error) // SendIssueAssetProposal is used to send issue asset proposal to get wallet.Tx to be signed. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // SendIssueAssetProposal(http.Header, *IssueAssetBody) ([]*wallet.TX, error) // SendTransferCTokenProposal is used to send transfer colored tokens proposal to get wallet.Tx to be signed. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // SendTransferCTokenProposal(http.Header, *TransferCTokenBody) ([]*wallet.TX, error) // SendTransferAssetProposal is used to send transfer asset proposal to get wallet.Tx to be signed. // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The default key pair trust mode does not trust, it will required key pair. // If you had trust the key pair, it will required security code. // SendTransferAssetProposal(http.Header, *TransferAssetBody) ([]*wallet.TX, error) // ProcessTx is used to transfer formally with signature TX . // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // ProcessTx(http.Header, []*wallet.TX) (*WalletResponse, error) // QueryTransactionLogs is used to query transaction logs. // // txType: // in: query income type transaction // out: query spending type transaction // num, page: count, page of logs that to be returned // QueryTransactionLogs(http.Header, commdid.Identifier, string, int32, int32) ([]*wallet.UTXO, error) // QueryTransactionUTXO is used to query transaction utxo logs. // num, page: count, page of logs that to be returned // QueryTransactionUTXO(http.Header, commdid.Identifier, int32, int32) ([]*wallet.UTXO, error) // QueryTransactionUTXO is used to query transaction stxo logs. // num, page: count, page of logs that to be returned // QueryTransactionSTXO(http.Header, commdid.Identifier, int32, int32) ([]*wallet.UTXO, error) // IndexSet is used to create indexs for object-id // // The default invoking mode is asynchronous, it will return // without waiting for blockchain transaction confirmation. // // If you want to switch to synchronous invoking mode, set // 'BC-Invoke-Mode' header to 'sync' value. In synchronous mode, // it will not return until the blockchain transaction is confirmed. // // The response result is the blockchain transaction id list // IndexSet(http.Header, *IndexSetPayload) ([]string, error) // IndexGet is used to query object-id via indexs // // The response result is the query hit object-id list // IndexGet(http.Header, *IndexGetPayload) ([]string, error) // SignTx is used to sign multiple UTXOs // // using the given private key in signParams // param: transactions to be signed // param: private key userd for signature // return: err not nil if failed SignTx(*wallet.TX, *pki.SignatureParam) error }
IWalletClient defines the behaviors implemented by wallet sdk
type IndexGetPayload ¶
type IndexGetPayload struct {
Indexs *IndexTags `json:"indexs,omitempty"`
}
IndexGetPayload represents the payload of IndexGet interface
type IndexSetPayload ¶
type IndexSetPayload struct { Id commdid.Identifier `json:"id,omitempty"` Indexs *IndexTags `json:"indexs,omitempty"` }
IndexSetPayload represents the payload of IndexSet interface
type IndexTags ¶
type IndexTags struct { CombinedIndex []string `json:"combined_index,omitempty"` IndividualIndex []string `json:"individual_index,omitempty"` }
IndexTags ...
type IssueAssetBody ¶
type IssueAssetBody struct { Issuer string `json:"issuer,omitempty"` Owner string `json:"owner,omitempty"` AssetId string `json:"asset_id,omitempty"` Fee *Fee `json:"fee,omitempty"` }
Issue Asset Request Structure
type IssueBody ¶
type IssueBody struct { Issuer string `json:"issuer,omitempty"` Owner string `json:"owner,omitempty"` AssetId string `json:"asset_id,omitempty"` TokenId string `json:"token_id,omitempty"` Amount int64 `json:"amount,omitempty"` Fee *Fee `json:"fee,omitempty"` }
Issue Colored Token Request Structure
type OffchainMetadata ¶
type OffchainMetadata struct { Filename string `json:"filename,omitempty"` Endpoint string `json:"endpoint,omitempty"` StorageType string `json:"storageType,omitempty"` ContentHash string `json:"contentHash,omitempty"` Size int `json:"size,omitempty"` ReadOnly bool `json:"read_only,omitempty"` }
OffchainMetadata offchain storage metadata
type POEBody ¶
type POEBody struct { Id commdid.Identifier `json:"id,omitempty"` Name string `json:"name,omitempty"` ParentId commdid.Identifier `json:"parent_id,omitempty"` Owner commdid.Identifier `json:"owner,omitempty"` ExpireTime int64 `json:"expire_time,omitempty"` Hash string `json:"hash,omitempty"` Metadata []byte `json:"metadata,omitempty"` Indexs *IndexTags `json:"indexs,omitempty"` }
POEBody POE request body structure definition
type POEPayload ¶
type POEPayload struct { Id commdid.Identifier `json:"id,omitempty"` Name string `json:"name,omitempty"` ParentId commdid.Identifier `json:"parent_id,omitempty"` Owner commdid.Identifier `json:"owner,omitempty"` ExpireTime int64 `json:"expire_time,omitempty"` Hash string `json:"hash,omitempty"` Metadata []byte `json:"metadata,omitempty"` OffchainMetadata OffchainMetadata `json:"offchain_metadata,omitempty"` Created int64 `json:"created,omitempty"` Updated int64 `json:"updated,omitempty"` Status pw.Status `json:"status,omitempty"` }
POEPayload POE query payload structure definition
type ProcessTxBody ¶
Transfer to process Tx Request Structure
type RegisterSubWalletBody ¶
type RegisterSubWalletBody struct { Id commdid.Identifier `json:"id,omitempty"` //main wallet id Type pw.DidType `json:"type,omitempty"` //Subwallet Type: 4: Independent type; 5: Dependent type; 11: Cash type; 12: Fee type; 13: Loan type; 14: Interest type; 21: DAPP type Symbol string `json:"symbol,omitempty"` //Subwallet symbol Metadata []byte `json:"metadata,omitempty"` //Subwallet metadata Indexs *IndexTags `json:"indexs,omitempty"` //Register user indexs IsPlain bool `json:"is_plain,omitempty"` //Optional, if false, wallet will generate keypair; else, user upload his own keypair PublicKey *ed25519.PublicKey `json:"public_key,omitempty"` //User public key. Optional, if empty, keypaire auto generated by wallet service }
Register subwallet request structure
type RegisterWalletBody ¶
type RegisterWalletBody struct { Id commdid.Identifier `json:"id,omitempty"` //Wallet ID. Optional, if empty, generated by wallet service Type pw.DidType `json:"type,omitempty"` //Wallet Type: 1: Common type; 2: Organization; 3: Personal Access string `json:"access,omitempty"` //Register user name Phone string `json:"phone,omitempty"` //Register user phone Email string `json:"email,omitempty"` //Register user email Secret string `json:"secret,omitempty"` //Register user passwd AuthInfo interface{} `json:"auth_info,omitempty"` //Register user auth info Metadata []byte `json:"metadata,omitempty"` //Wallet Metadata Indexs *IndexTags `json:"indexs,omitempty"` //Wallet indexs IsPlain bool `json:"is_plain,omitempty"` //Optional, if false, wallet will generate keypair; else, user upload his own keypair PublicKey *ed25519.PublicKey `json:"public_key,omitempty"` //Wallet public key. Optional, if empty, keypaire auto generated by wallet service }
Register wallet request structure
type SNMetadata ¶
type SNMetadata struct { ActivedCount int `json:"actived_count,omitempty"` MaxActiveCount int `json:"max_active_count,omitempty"` }
SNMetadata service number metadata struct definition
type SNRequest ¶
type SNRequest struct { Id string `json:"id,omitempty"` Name string `json:"name,omitempty"` Owner string `json:"owner,omitempty"` ActiveCount int `json:"active_count,omitempty"` ExpireTime int64 `json:"expire_time,omitempty"` }
SNRequest struct for create SN
type TokenAmount ¶
type TokenAmount struct { TokenId string `json:"token_id,omitempty"` Amount int64 `json:"amount,omitempty"` }
Colored Token Amount Structure
type TopAssetUser ¶
type TopAssetUser struct { UserId string `json:"user_id"` //用户DID AssetsNum int64 `json:"assets_num"` //用户拥有的数字资产数量 }
TopAssetUser define Top Asset User struct
type TopAssetUsers ¶
type TopAssetUsers []*TopAssetUser
type TopTokenUser ¶
type TopTokenUser struct { UserId string `json:"user_id"` //用户DID TokensNum int64 `json:"tokens_num"` //用户拥有的数字凭证数量 }
TopTokenUser define Top Token User struct
type TopTokenUsers ¶
type TopTokenUsers []*TopTokenUser
type Total ¶
type Total struct { TotalDApps int64 `json:"total_dapps"` //平台上所有DAPP的数量 TotalUsers int64 `json:"total_users"` //平台上所有应用用户的数量 TotalAssets int64 `json:"total_assets"` //平台上所有数字资产的数量 TotalTokens int64 `json:"total_tokens"` //平台上所有数字凭证的数量 }
Total define Total struct
type TransferAssetBody ¶
type TransferAssetBody struct { From string `json:"from,omitempty"` To string `json:"to,omitempty"` Assets []string `json:"assets,omitempty"` Fee *Fee `json:"fee,omitempty"` }
Transfer Asset Request Structure
type TransferCTokenBody ¶
type TransferCTokenBody struct { From string `json:"from,omitempty"` To string `json:"to,omitempty"` AssetId string `json:"asset_id,omitempty"` Tokens []*TokenAmount `json:"tokens,omitempty"` Fee *Fee `json:"fee,omitempty"` }
Transfer Colored Token Request Structure
type UploadResponse ¶
type UploadResponse struct { Id commdid.Identifier `json:"id,omitempty"` OffchainMetadata *OffchainMetadata `json:"offchain_metadata,omitempty"` TransactionIds []string `json:"transaction_ids,omitempty"` }
UploadResponse Upload POE file response payload
type WalletBalance ¶
type WalletInfo ¶
type WalletInfo struct { Id commdid.Identifier `json:"id,omitempty"` Type pw.DidType `json:"type,omitempty"` Endpoint commdid.DidEndpoint `json:"endpoint,omitempty"` Status pw.Status `json:"status,omitempty"` Created int64 `json:"created,omitempty"` Updated int64 `json:"updated,omitempty"` HDS map[commdid.Identifier]*WalletInfo `json:"hds,omitempty"` }
type WalletRequest ¶
type WalletRequest struct { Payload string `json:"payload,omitempty"` Signature *pki.SignatureBody `json:"signature,omitempty"` }
WalletRequest common struct for transfer
type WalletResponse ¶
type WalletResponse struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Id commdid.Identifier `json:"id,omitempty"` Endpoint string `json:"endpoint,omitempty"` KeyPair *KeyPair `json:"key_pair,omitempty"` SecurityCode string `json:"security_code,omitempty"` Created int64 `json:"created,omitempty"` TokenId string `json:"token_id,omitempty"` TransactionIds []string `json:"transaction_ids,omitempty"` }
WalletResponse common struct for wallet API response