Documentation ¶
Overview ¶
SPDX-License-Identifier: ISC Copyright (c) 2014-2020 Bitmark Inc. Use of this source code is governed by an ISC license that can be found in the LICENSE file.
SPDX-License-Identifier: ISC Copyright (c) 2014-2020 Bitmark Inc. Use of this source code is governed by an ISC license that can be found in the LICENSE file.
SPDX-License-Identifier: ISC Copyright (c) 2014-2020 Bitmark Inc. Use of this source code is governed by an ISC license that can be found in the LICENSE file.
Index ¶
- func CreateShares(params *ShareParams) (string, string, error)
- func GrantShare(params *ShareGrantingParams) (string, error)
- func Issue(params *IssuanceParams) ([]string, error)
- func Offer(params *OfferParams) error
- func ReplyShareOffer(params *GrantResponseParams) (string, error)
- func Respond(params *ResponseParams) (string, error)
- func Transfer(params *TransferParams) (string, error)
- type Bitmark
- type CountersignedGrantRequest
- type CountersignedSwapRequest
- type CountersignedTransferRequest
- type GrantRequest
- type GrantResponseParams
- type IssuanceParams
- type IssueRequest
- type OfferParams
- type OfferResponseAction
- type QuantityOptions
- type QueryParamsBuilder
- func (ub *QueryParamsBuilder) At(at int) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) BitmarkIDs(bitmarkIDs []string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) Build() (string, error)
- func (ub *QueryParamsBuilder) IssuedBy(issuer string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) Limit(size int) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) LoadAsset(load bool) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) OfferFrom(sender string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) OfferTo(receiver string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) OwnedBy(owner string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) OwnedByWithTransient(owner string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) Pending(pending bool) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) ReferencedAsset(assetID string) *QueryParamsBuilder
- func (ub *QueryParamsBuilder) To(direction utils.Direction) *QueryParamsBuilder
- type ResponseParams
- type Share
- type ShareGrantingParams
- type ShareOffer
- type ShareParams
- type ShareRequest
- type ShareSwapParams
- type SwapRequest
- type SwapResponseParams
- type TransferOffer
- type TransferParams
- type TransferRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateShares ¶
func CreateShares(params *ShareParams) (string, string, error)
func GrantShare ¶
func GrantShare(params *ShareGrantingParams) (string, error)
func Issue ¶
func Issue(params *IssuanceParams) ([]string, error)
func Offer ¶
func Offer(params *OfferParams) error
func ReplyShareOffer ¶
func ReplyShareOffer(params *GrantResponseParams) (string, error)
func Respond ¶
func Respond(params *ResponseParams) (string, error)
func Transfer ¶
func Transfer(params *TransferParams) (string, error)
Types ¶
type Bitmark ¶
type Bitmark struct { ID string `json:"id"` AssetID string `json:"asset_id"` LatestTxID string `json:"head_id"` Issuer string `json:"issuer"` Owner string `json:"owner"` Status string `json:"status"` Offer *TransferOffer `json:"offer"` BlockNumber int `json:"block_number"` Edition int `json:"edition"` Offset int `json:"offset"` CreatedAt time.Time `json:"created_at"` ConfirmedAt time.Time `json:"confirmed_at"` }
type CountersignedGrantRequest ¶
type CountersignedGrantRequest struct { Quantity uint64 `json:"quantity" pack:"uint64"` Owner string `json:"owner" pack:"account"` Recipient string `json:"recipient" pack:"account"` BeforeBlock uint64 `json:"beforeBlock" pack:"uint64"` Signature string `json:"signature" pack:"hex64"` Countersignature string `json:"countersignature"` }
Copy of bitmark share granting structure with counter signature
type CountersignedSwapRequest ¶
type CountersignedSwapRequest struct { QuantityOne uint64 `json:"quantityOne" pack:"uint64"` // shares to transfer > 0 OwnerOne string `json:"ownerOne" pack:"account"` // base58 QuantityTwo uint64 `json:"quantityTwo" pack:"uint64"` // shares to transfer > 0 OwnerTwo string `json:"ownerTwo" pack:"account"` // base58 BeforeBlock uint64 `json:"beforeBlock" pack:"uint64"` // expires when chain height > before block Signature string `json:"signature" pack:"hex64"` Countersignature string `json:"countersignature"` }
Copy of bitmark share swap structure with counter signature
type CountersignedTransferRequest ¶
type CountersignedTransferRequest struct { Link string `json:"link" pack:"hex32"` Escrow *payment `json:"-" pack:"payment"` // optional escrow payment address Owner string `json:"owner" pack:"account"` Signature string `json:"signature" pack:"hex64"` Countersignature string `json:"countersignature"` }
type GrantRequest ¶
type GrantRequest struct { Quantity uint64 `json:"quantity" pack:"uint64"` Owner string `json:"owner" pack:"account"` Recipient string `json:"recipient" pack:"account"` BeforeBlock uint64 `json:"beforeBlock" pack:"uint64"` Signature string `json:"signature"` }
Copy of bitmark share granting structure
type GrantResponseParams ¶
type GrantResponseParams struct { ID string `json:"id"` Action OfferResponseAction `json:"action"` Countersignature string `json:"countersignature"` // contains filtered or unexported fields }
GrantResponseParams is the parameter for respond a share granting request
func NewGrantResponseParams ¶
func NewGrantResponseParams(id string, grant *GrantRequest, action OfferResponseAction) *GrantResponseParams
NewGrantResponseParams returns GrantResponseParams
type IssuanceParams ¶
type IssuanceParams struct {
Issuances []*IssueRequest `json:"issues"`
}
func NewIssuanceParams ¶
func NewIssuanceParams(assetID string, quantity int) (*IssuanceParams, error)
type IssueRequest ¶
type OfferParams ¶
type OfferParams struct { Offer struct { Transfer *TransferRequest `json:"record"` ExtraInfo map[string]interface{} `json:"extra_info"` } `json:"offer"` }
func NewOfferParams ¶
func NewOfferParams(receiver string, info map[string]interface{}) (*OfferParams, error)
func (*OfferParams) FromBitmark ¶
func (o *OfferParams) FromBitmark(bitmarkID string) error
FromBitmark sets link asynchronously
func (*OfferParams) FromLatestTx ¶
func (o *OfferParams) FromLatestTx(txID string)
FromLatestTx sets link synchronously
type OfferResponseAction ¶
type OfferResponseAction string
const Accept OfferResponseAction = "accept"
const Cancel OfferResponseAction = "cancel"
const Reject OfferResponseAction = "reject"
type QuantityOptions ¶
type QueryParamsBuilder ¶
type QueryParamsBuilder struct {
// contains filtered or unexported fields
}
func NewQueryParamsBuilder ¶
func NewQueryParamsBuilder() *QueryParamsBuilder
func (*QueryParamsBuilder) At ¶
func (ub *QueryParamsBuilder) At(at int) *QueryParamsBuilder
func (*QueryParamsBuilder) BitmarkIDs ¶
func (ub *QueryParamsBuilder) BitmarkIDs(bitmarkIDs []string) *QueryParamsBuilder
func (*QueryParamsBuilder) Build ¶
func (ub *QueryParamsBuilder) Build() (string, error)
func (*QueryParamsBuilder) IssuedBy ¶
func (ub *QueryParamsBuilder) IssuedBy(issuer string) *QueryParamsBuilder
func (*QueryParamsBuilder) Limit ¶
func (ub *QueryParamsBuilder) Limit(size int) *QueryParamsBuilder
func (*QueryParamsBuilder) LoadAsset ¶
func (ub *QueryParamsBuilder) LoadAsset(load bool) *QueryParamsBuilder
func (*QueryParamsBuilder) OfferFrom ¶
func (ub *QueryParamsBuilder) OfferFrom(sender string) *QueryParamsBuilder
func (*QueryParamsBuilder) OfferTo ¶
func (ub *QueryParamsBuilder) OfferTo(receiver string) *QueryParamsBuilder
func (*QueryParamsBuilder) OwnedBy ¶
func (ub *QueryParamsBuilder) OwnedBy(owner string) *QueryParamsBuilder
func (*QueryParamsBuilder) OwnedByWithTransient ¶
func (ub *QueryParamsBuilder) OwnedByWithTransient(owner string) *QueryParamsBuilder
func (*QueryParamsBuilder) Pending ¶
func (ub *QueryParamsBuilder) Pending(pending bool) *QueryParamsBuilder
func (*QueryParamsBuilder) ReferencedAsset ¶
func (ub *QueryParamsBuilder) ReferencedAsset(assetID string) *QueryParamsBuilder
func (*QueryParamsBuilder) To ¶
func (ub *QueryParamsBuilder) To(direction utils.Direction) *QueryParamsBuilder
type ResponseParams ¶
type ResponseParams struct { ID string `json:"id"` Action OfferResponseAction `json:"action"` Countersignature string `json:"countersignature"` // contains filtered or unexported fields }
func NewTransferResponseParams ¶
func NewTransferResponseParams(bitmark *Bitmark, action OfferResponseAction) *ResponseParams
type ShareGrantingParams ¶
type ShareGrantingParams struct {}
ShareGrantingParams is the parameter for granting shares to other accounts via core api
func NewShareGrantingParams ¶
func NewShareGrantingParams(shareID string, receiver string, quantity uint64, extraInfo map[string]interface{}) *ShareGrantingParams
NewShareGrantingParams returns ShareGrantingParams
func (*ShareGrantingParams) BeforeBlock ¶
func (s *ShareGrantingParams) BeforeBlock(blockNumber uint64)
BeforeBlock will assign a block number which is the deadline of this request
type ShareOffer ¶
type ShareOffer struct {}
func ListShareOffers ¶
func ListShareOffers(from, to string) ([]*ShareOffer, error)
type ShareParams ¶
type ShareParams struct {
}ShareParams is the parameter for creating shares via core api
func NewShareParams ¶
func NewShareParams(quantity uint64) *ShareParams
NewShareParams returns ShareParams
func (*ShareParams) FromBitmark ¶
func (s *ShareParams) FromBitmark(bitmarkID string) error
FromBitmark will set the latest transaction for a target bitmark
type ShareSwapParams ¶
type ShareSwapParams struct {
}ShareSwapParams is the parameter for swaping shares between two accounts via core api
func NewShareSwapParams ¶
func NewShareSwapParams(beforeBlock uint64) *ShareSwapParams
NewShareSwapParams returns ShareSwapParams
func (*ShareSwapParams) FromShare ¶
func (p *ShareSwapParams) FromShare(shareID, owner string, quantity uint64) *ShareSwapParams
FromShare will assign the first share for swaping
func (*ShareSwapParams) Sign ¶
func (p *ShareSwapParams) Sign(requester account.Account) error
Sign will generate the signature for a swaping request
func (*ShareSwapParams) ToShare ¶
func (p *ShareSwapParams) ToShare(shareID, owner string, quantity uint64) *ShareSwapParams
ToShare will assign the second share for swaping
type SwapRequest ¶
type SwapRequest struct { QuantityOne uint64 `json:"quantityOne" pack:"uint64"` // shares to transfer > 0 OwnerOne string `json:"ownerOne" pack:"account"` // base58 QuantityTwo uint64 `json:"quantityTwo" pack:"uint64"` // shares to transfer > 0 OwnerTwo string `json:"ownerTwo" pack:"account"` // base58 BeforeBlock uint64 `json:"beforeBlock" pack:"uint64"` // expires when chain height > before block Signature string `json:"signature"` // hex }
Copy of bitmark share swap structure
type SwapResponseParams ¶
type SwapResponseParams struct { ID string `json:"id"` Action OfferResponseAction `json:"action"` Countersignature string `json:"countersignature"` // contains filtered or unexported fields }
ShareSwapParams is the parameter for responding swaping shares between two accounts via core api
func NewSwapResponseParams ¶
func NewSwapResponseParams(swap *SwapRequest, action OfferResponseAction) *SwapResponseParams
NewSwapResponseParams returns SwapResponseParams
type TransferOffer ¶
type TransferParams ¶
type TransferParams struct {
Transfer *TransferRequest `json:"transfer"`
}
func NewTransferParams ¶
func NewTransferParams(receiver string) (*TransferParams, error)
func (*TransferParams) FromBitmark ¶
func (t *TransferParams) FromBitmark(bitmarkID string) error
FromBitmark sets link asynchronously
func (*TransferParams) FromLatestTx ¶
func (t *TransferParams) FromLatestTx(txID string)
FromLatestTx sets link synchronously