Documentation ¶
Index ¶
- Constants
- type API
- func (a *API) AddressCreate(chainId, callbackUrl, alias string) (*Result[ProjectAddress], error)
- func (a *API) AddressInner(chainId, address string) (*Result[AddressInner], error)
- func (a *API) AddressLegal(chainId string, address string) (*Result[AddressLegal], error)
- func (a *API) ListCoins() (*Result[ProjectCoins], error)
- func (a *API) Payout(address, currency, amount, thirdPartyId, callbackUrl, remark string) (*Result[Payout], error)
- func (a *API) PayoutQuery(cid int64) (*Result[PayoutQuery], error)
- type AddressInner
- type AddressLegal
- type CregisClientInterface
- type Payout
- type PayoutQuery
- type ProjectAddress
- type ProjectCoin
- type ProjectCoins
- type Result
Constants ¶
View Source
const ( URL_PREFIX = "/api/v1" PAYOUT = URL_PREFIX + "/payout" PAYOUT_QUERY = URL_PREFIX + "/payout/query" ADDRESS_LEGAL = URL_PREFIX + "/address/legal" ADDRESS_CREATE = URL_PREFIX + "/address/create" ADDRESS_INNER = URL_PREFIX + "/address/inner" PROJECT_COINS = URL_PREFIX + "/coins" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient user can create a client by the method *
url string host of cregis server apiKey string special key to different users pid int64 projectId
func (*API) AddressCreate ¶
func (a *API) AddressCreate(chainId, callbackUrl, alias string) (*Result[ProjectAddress], error)
AddressCreate create an address to income *
chainId string code of blockchain callbackUrl string set url to receive server event alias string nickname
func (*API) AddressInner ¶
func (a *API) AddressInner(chainId, address string) (*Result[AddressInner], error)
AddressInner whether the address is an internal address *
chainId string code of blockchain address string an address of blockchain
func (*API) AddressLegal ¶
AddressLegal Check the legality of the address format *
chainId string code of blockchain address string an address of blockchain
func (*API) ListCoins ¶
func (a *API) ListCoins() (*Result[ProjectCoins], error)
ListCoins currencies supported by the project
func (*API) Payout ¶
func (a *API) Payout(address, currency, amount, thirdPartyId, callbackUrl, remark string) (*Result[Payout], error)
Payout send tx of withdraw *
address string an address of tx toAddress currency string coin flag,like this format 195@195 amount string value of tx thirdPartyId string the business number of user,it is used to callbackUrl callbackUrl string set url to receive server event remark string to use other input data
func (*API) PayoutQuery ¶
func (a *API) PayoutQuery(cid int64) (*Result[PayoutQuery], error)
PayoutQuery query order of withdrawal tx *
cid int64 orderId
type AddressInner ¶
type AddressInner struct { /** * 地址是否合法 */ Result bool `json:"result"` }
type AddressLegal ¶
type AddressLegal struct { /** * 地址是否合法 */ Result bool `json:"result"` }
type CregisClientInterface ¶
type CregisClientInterface interface { //AddressLegal /** * 检测地址合法性 * * @param chainId 链编号 * @param address 地址 * @return 结果 */ AddressLegal(chainId string, address string) (*Result[AddressLegal], error) //AddressInner /** * 检测地址在项目中是否存在 * * @param chainId 链编号 * @param address 地址 * @return 结果 */ AddressInner(chainId, address string) (*Result[AddressInner], error) //ListCoins /** * 获取支持的币种 * @return 币种列表 */ ListCoins() (*Result[ProjectCoins], error) //Payout /** * 发送提币申请 * * @param address 提币地址 * @param currency 币种信息 * 规则参考 <a href="https://app.apifox.com/link/project/2923699/apis/doc-2804947">https://app.apifox.com/link/project/2923699/apis/doc-2804947</a> * @param amount 金额 * @param thirdPartyId 业务编号 * @param callbackUrl 回调地址 * @param remark 备注 * @return 提币结果 */ Payout(address, currency, amount, thirdPartyId, callbackUrl, remark string) (*Result[Payout], error) //PayoutQuery /** * 提币申请查看 * @param cid 业务编号 * @return 申请详细信息 */ PayoutQuery(cid int64) (*Result[PayoutQuery], error) //AddressCreate /** * 生成地址 * @param mainCoinType 主币编号 * @param callbackUrl 回调地址 * @param alias 地址别名 * @return 地址信息 */ AddressCreate(chainId, callbackUrl, alias string) (*Result[ProjectAddress], error) }
type PayoutQuery ¶
type PayoutQuery struct { /** * 项目编号 */ Pid int64 `json:"pid"` /** * 地址 */ Address string `json:"address"` /** * 链编号 */ ChainId string `json:"chain_id"` /** * 代币编号 */ TokenId string `json:"token_id"` /** * 币种标识 */ Currency string `json:"currency"` /** * 金额 */ Amount string `json:"amount"` /** * 调用方业务编号 */ ThirdPartyId string `json:"third_party_id"` /** * 备注 */ Remark string `json:"remark"` /** * 状态 */ Status int `json:"status"` /** * 交易哈希 */ TxId string `json:"txid"` /** * 区块高度 */ BlockHeight string `json:"block_height"` /** * 区块时间 */ BlockTime string `json:"block_time"` }
type ProjectAddress ¶
type ProjectAddress struct {
Address string `json:"address"`
}
type ProjectCoin ¶
type ProjectCoins ¶
type ProjectCoins struct { PayoutCoins []*ProjectCoin `json:"payout_coins"` AddressCoins []*ProjectCoin `json:"address_coins"` OrderCoins []*ProjectCoin `json:"order_coins"` }
Click to show internal directories.
Click to hide internal directories.