Documentation ¶
Overview ¶
Copyright (c) 2020-2022 Blockwatch Data Inc. Author: alex@blockwatch.cc
Index ¶
- Constants
- type CallArguments
- type Contract
- func (c Contract) Address() tezos.Address
- func (c *Contract) AsFA1() *FA1Token
- func (c *Contract) AsFA2(id int64) *FA2Token
- func (c *Contract) Call(ctx context.Context, args CallArguments, opts *rpc.CallOptions) (*rpc.Receipt, error)
- func (c *Contract) CallMulti(ctx context.Context, args []CallArguments, opts *rpc.CallOptions) (*rpc.Receipt, error)
- func (c *Contract) DecodeScript(data []byte) error
- func (c *Contract) DecodeStorage(data []byte) error
- func (c *Contract) Deploy(ctx context.Context, opts *rpc.CallOptions) (*rpc.Receipt, error)
- func (c *Contract) DeployExt(ctx context.Context, delegate tezos.Address, balance tezos.N, ...) (*rpc.Receipt, error)
- func (c *Contract) Entrypoint(name string) (micheline.Entrypoint, bool)
- func (c *Contract) GetBigmapValue(ctx context.Context, path string, args micheline.Prim) (*micheline.Value, error)
- func (c Contract) IsFA1() bool
- func (c Contract) IsFA12() bool
- func (c Contract) IsFA2() bool
- func (c Contract) IsManagerTz() bool
- func (c Contract) IsToken() bool
- func (c *Contract) Metadata() *Tz16
- func (c *Contract) Resolve(ctx context.Context) error
- func (c *Contract) ResolveMetadata(ctx context.Context) (*Tz16, error)
- func (c *Contract) ResolveTz16Uri(ctx context.Context, uri string, result interface{}, checksum []byte) error
- func (c *Contract) RunView(ctx context.Context, name string, args micheline.Prim) (micheline.Prim, error)
- func (c *Contract) RunViewExt(ctx context.Context, name string, args micheline.Prim, ...) (micheline.Prim, error)
- func (c Contract) Script() *micheline.Script
- func (c Contract) Storage() *micheline.Prim
- func (c Contract) StorageValue() micheline.Value
- func (c Contract) TokenKind() TokenKind
- func (c *Contract) View(name string) (micheline.View, bool)
- func (c *Contract) WithScript(script *micheline.Script) *Contract
- func (c *Contract) WithStorage(store *micheline.Prim) *Contract
- type FA1Approval
- type FA1ApprovalArgs
- type FA1Token
- func (t FA1Token) Approve(spender tezos.Address, amount tezos.Z) *FA1ApprovalArgs
- func (t FA1Token) Contract() *Contract
- func (t FA1Token) Equal(v FA1Token) bool
- func (t FA1Token) GetAllowance(ctx context.Context, owner, spender tezos.Address) (tezos.Z, error)
- func (t FA1Token) GetBalance(ctx context.Context, owner tezos.Address) (tezos.Z, error)
- func (t FA1Token) GetTotalSupply(ctx context.Context) (tezos.Z, error)
- func (t FA1Token) ResolveMetadata(ctx context.Context) (*TokenMetadata, error)
- func (t FA1Token) Revoke(spender tezos.Address) *FA1ApprovalArgs
- func (t FA1Token) Transfer(from, to tezos.Address, amount tezos.Z) *FA1TransferArgs
- type FA1Transfer
- type FA1TransferArgs
- type FA1TransferReceipt
- type FA2Approval
- type FA2ApprovalArgs
- func (p *FA2ApprovalArgs) AddOperator(owner, operator tezos.Address, id tezos.Z) *FA2ApprovalArgs
- func (p FA2ApprovalArgs) Encode() *codec.Transaction
- func (p FA2ApprovalArgs) Parameters() *micheline.Parameters
- func (p *FA2ApprovalArgs) RemoveOperator(owner, operator tezos.Address, id tezos.Z) *FA2ApprovalArgs
- type FA2BalanceRequest
- type FA2BalanceResponse
- type FA2Token
- func (t FA2Token) AddOperator(owner, operator tezos.Address) *FA2ApprovalArgs
- func (t FA2Token) Contract() *Contract
- func (t FA2Token) Equal(v FA2Token) bool
- func (t FA2Token) GetBalances(ctx context.Context, req []FA2BalanceRequest) ([]FA2BalanceResponse, error)
- func (t FA2Token) RemoveOperator(owner, operator tezos.Address) *FA2ApprovalArgs
- func (t FA2Token) ResolveMetadata(ctx context.Context) (*TokenMetadata, error)
- func (t FA2Token) Transfer(from, to tezos.Address, amount tezos.Z) *FA2TransferArgs
- type FA2Transfer
- type FA2TransferArgs
- type FA2TransferList
- type FA2TransferReceipt
- type NftBalance
- type NftBalanceTyp1
- type NftBalanceTyp2
- type NftBalanceTyp3
- type NftLedger
- type NftLedgerSchema
- type TokenBalance
- type TokenKind
- type TokenMetadata
- type TxArgs
- func (a *TxArgs) Encode() *codec.Transaction
- func (a *TxArgs) Parameters() *micheline.Parameters
- func (a *TxArgs) WithAmount(amount tezos.N)
- func (a *TxArgs) WithDestination(addr tezos.Address)
- func (a *TxArgs) WithParameters(params micheline.Parameters)
- func (a *TxArgs) WithSource(addr tezos.Address)
- type Tz16
- type Tz16CodeAnnotation
- type Tz16Error
- type Tz16License
- type Tz16RestView
- type Tz16Source
- type Tz16StorageView
- type Tz16View
- type Tz16ViewImpl
Constants ¶
const TOKEN_METADATA = "token_metadata"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallArguments ¶
type CallArguments interface { WithSource(tezos.Address) WithDestination(tezos.Address) WithAmount(tezos.N) Encode() *codec.Transaction Parameters() *micheline.Parameters }
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func NewEmptyContract ¶
func (*Contract) Call ¶
func (c *Contract) Call(ctx context.Context, args CallArguments, opts *rpc.CallOptions) (*rpc.Receipt, error)
func (*Contract) CallMulti ¶
func (c *Contract) CallMulti(ctx context.Context, args []CallArguments, opts *rpc.CallOptions) (*rpc.Receipt, error)
func (*Contract) DecodeScript ¶
func (*Contract) DecodeStorage ¶
func (*Contract) Entrypoint ¶
func (c *Contract) Entrypoint(name string) (micheline.Entrypoint, bool)
entrypoints and callbacks
func (*Contract) GetBigmapValue ¶
func (Contract) IsManagerTz ¶
func (*Contract) ResolveMetadata ¶
func (*Contract) ResolveTz16Uri ¶
func (*Contract) RunView ¶
func (c *Contract) RunView(ctx context.Context, name string, args micheline.Prim) (micheline.Prim, error)
Executes TZIP-4 fake views from callback entrypoints
func (*Contract) RunViewExt ¶
func (Contract) StorageValue ¶
type FA1Approval ¶
type FA1ApprovalArgs ¶
type FA1ApprovalArgs struct { TxArgs Approval FA1Approval `json:"approve"` }
func (FA1ApprovalArgs) Encode ¶
func (p FA1ApprovalArgs) Encode() *codec.Transaction
func (FA1ApprovalArgs) Parameters ¶
func (a FA1ApprovalArgs) Parameters() *micheline.Parameters
type FA1Token ¶
Represents a generic FA1 (tzip5) or FA1.2 (tzip7) token
func (FA1Token) GetAllowance ¶
func (FA1Token) GetBalance ¶
func (FA1Token) GetTotalSupply ¶
func (FA1Token) ResolveMetadata ¶
func (t FA1Token) ResolveMetadata(ctx context.Context) (*TokenMetadata, error)
type FA1Transfer ¶
type FA1Transfer struct { From tezos.Address `json:"from"` To tezos.Address `json:"to"` Amount tezos.Z `json:"value"` }
func (*FA1Transfer) UnmarshalJSON ¶
func (t *FA1Transfer) UnmarshalJSON(data []byte) error
compatible with micheline.Value.Unmarshal()
type FA1TransferArgs ¶
type FA1TransferArgs struct { TxArgs Transfer FA1Transfer }
func (FA1TransferArgs) Encode ¶
func (p FA1TransferArgs) Encode() *codec.Transaction
func (FA1TransferArgs) Parameters ¶
func (t FA1TransferArgs) Parameters() *micheline.Parameters
type FA1TransferReceipt ¶
type FA1TransferReceipt struct {
// contains filtered or unexported fields
}
func NewFA1TransferReceipt ¶
func NewFA1TransferReceipt(tx *rpc.Transaction) (*FA1TransferReceipt, error)
func (FA1TransferReceipt) BalanceUpdates ¶
func (r FA1TransferReceipt) BalanceUpdates() []TokenBalance
func (FA1TransferReceipt) Costs ¶
func (r FA1TransferReceipt) Costs() tezos.Costs
func (FA1TransferReceipt) IsSuccess ¶
func (r FA1TransferReceipt) IsSuccess() bool
func (FA1TransferReceipt) Request ¶
func (r FA1TransferReceipt) Request() FA1Transfer
func (FA1TransferReceipt) Result ¶
func (r FA1TransferReceipt) Result() *rpc.Transaction
type FA2Approval ¶
type FA2Approval struct { Owner tezos.Address `json:"owner"` Operator tezos.Address `json:"operator"` TokenId tezos.Z `json:"token_id"` Add bool `json:"-"` }
func (*FA2Approval) UnmarshalJSON ¶
func (p *FA2Approval) UnmarshalJSON(data []byte) error
type FA2ApprovalArgs ¶
type FA2ApprovalArgs struct { TxArgs Approvals []FA2Approval `json:"update_operators"` }
func NewFA2ApprovalArgs ¶
func NewFA2ApprovalArgs() *FA2ApprovalArgs
func (*FA2ApprovalArgs) AddOperator ¶
func (p *FA2ApprovalArgs) AddOperator(owner, operator tezos.Address, id tezos.Z) *FA2ApprovalArgs
func (FA2ApprovalArgs) Encode ¶
func (p FA2ApprovalArgs) Encode() *codec.Transaction
func (FA2ApprovalArgs) Parameters ¶
func (p FA2ApprovalArgs) Parameters() *micheline.Parameters
func (*FA2ApprovalArgs) RemoveOperator ¶
func (p *FA2ApprovalArgs) RemoveOperator(owner, operator tezos.Address, id tezos.Z) *FA2ApprovalArgs
type FA2BalanceRequest ¶
type FA2BalanceResponse ¶
type FA2BalanceResponse struct { Request FA2BalanceRequest `json:"request"` Balance tezos.Z `json:"balance"` }
type FA2Token ¶
type FA2Token struct { Address tezos.Address TokenId tezos.Z // contains filtered or unexported fields }
Represents a generic FA2 (tzip12) token
func (FA2Token) AddOperator ¶
func (t FA2Token) AddOperator(owner, operator tezos.Address) *FA2ApprovalArgs
func (FA2Token) GetBalances ¶
func (t FA2Token) GetBalances(ctx context.Context, req []FA2BalanceRequest) ([]FA2BalanceResponse, error)
func (FA2Token) RemoveOperator ¶
func (t FA2Token) RemoveOperator(owner, operator tezos.Address) *FA2ApprovalArgs
func (FA2Token) ResolveMetadata ¶
func (t FA2Token) ResolveMetadata(ctx context.Context) (*TokenMetadata, error)
type FA2Transfer ¶
func (FA2Transfer) Prim ¶
func (t FA2Transfer) Prim() micheline.Prim
type FA2TransferArgs ¶
type FA2TransferArgs struct { TxArgs Transfers FA2TransferList }
func NewFA2TransferArgs ¶
func NewFA2TransferArgs() *FA2TransferArgs
func (FA2TransferArgs) Encode ¶
func (p FA2TransferArgs) Encode() *codec.Transaction
func (*FA2TransferArgs) Optimize ¶
func (p *FA2TransferArgs) Optimize() *FA2TransferArgs
func (FA2TransferArgs) Parameters ¶
func (t FA2TransferArgs) Parameters() *micheline.Parameters
func (*FA2TransferArgs) WithTransfer ¶
func (p *FA2TransferArgs) WithTransfer(from, to tezos.Address, id, amount tezos.Z) *FA2TransferArgs
type FA2TransferList ¶
type FA2TransferList []FA2Transfer
func (FA2TransferList) Len ¶
func (l FA2TransferList) Len() int
func (FA2TransferList) Less ¶
func (l FA2TransferList) Less(i, j int) bool
func (FA2TransferList) Swap ¶
func (l FA2TransferList) Swap(i, j int)
func (*FA2TransferList) UnmarshalJSON ¶
func (t *FA2TransferList) UnmarshalJSON(data []byte) error
compatible with micheline.Value.Unmarshal()
type FA2TransferReceipt ¶
type FA2TransferReceipt struct {
// contains filtered or unexported fields
}
TODO: make it work for internal results as well (so we can use it for crawling)
func NewFA2TransferReceipt ¶
func NewFA2TransferReceipt(tx *rpc.Transaction) (*FA2TransferReceipt, error)
func (FA2TransferReceipt) BalanceUpdates ¶
func (r FA2TransferReceipt) BalanceUpdates() []TokenBalance
func (FA2TransferReceipt) Costs ¶
func (r FA2TransferReceipt) Costs() tezos.Costs
func (FA2TransferReceipt) IsSuccess ¶
func (r FA2TransferReceipt) IsSuccess() bool
func (FA2TransferReceipt) Request ¶
func (r FA2TransferReceipt) Request() FA2TransferList
func (FA2TransferReceipt) Result ¶
func (r FA2TransferReceipt) Result() *rpc.Transaction
type NftBalance ¶ added in v1.12.0
type NftBalance struct { Owner tezos.Address TokenId tezos.Z Balance tezos.Z // contains filtered or unexported fields }
func (*NftBalance) UnmarshalPrim ¶ added in v1.12.0
func (b *NftBalance) UnmarshalPrim(prim micheline.Prim) error
type NftBalanceTyp1 ¶ added in v1.12.0
type NftBalanceTyp1 NftBalance
1 @key: {0: address, 1: nat} @value: nat
func (*NftBalanceTyp1) UnmarshalPrim ¶ added in v1.12.0
func (b *NftBalanceTyp1) UnmarshalPrim(prim micheline.Prim) error
type NftBalanceTyp2 ¶ added in v1.12.0
type NftBalanceTyp2 NftBalance
2 @key: nat @value: address
func (*NftBalanceTyp2) UnmarshalPrim ¶ added in v1.12.0
func (b *NftBalanceTyp2) UnmarshalPrim(prim micheline.Prim) error
type NftBalanceTyp3 ¶ added in v1.12.0
type NftBalanceTyp3 NftBalance
3 @key: {0: nat, 1: address} @value: nat
func (*NftBalanceTyp3) UnmarshalPrim ¶ added in v1.12.0
func (b *NftBalanceTyp3) UnmarshalPrim(prim micheline.Prim) error
type NftLedger ¶
type NftLedger struct { Address tezos.Address Schema NftLedgerSchema Bigmap int64 }
func (NftLedger) DecodeBalance ¶ added in v1.12.0
func (l NftLedger) DecodeBalance(prim micheline.Prim) (bal NftBalance, err error)
type NftLedgerSchema ¶
type NftLedgerSchema byte
const ( NftLedgerSchemaInvalid NftLedgerSchema = iota NftLedgerSchema1 NftLedgerSchema2 NftLedgerSchema3 )
func DetectNftLedger ¶
func DetectNftLedger(key, val micheline.Prim) NftLedgerSchema
Detect NFT legder schema from bigmap key + value type.
func (NftLedgerSchema) IsValid ¶
func (s NftLedgerSchema) IsValid() bool
type TokenBalance ¶
type TokenMetadata ¶
type TokenMetadata struct { // normative (only decimals is required) Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` // non-standard (people mix this in from Tzip21) Description string `json:"description,omitempty"` ThumbnailUri string `json:"thumbnailUri,omitempty"` ShouldPreferSymbol bool `json:"shouldPreferSymbol,omitempty"` IsBooleanAmount bool `json:"is_boolean_amount,omitempty"` IsTransferable bool `json:"is_transferable,omitempty"` // contains filtered or unexported fields }
Represents Tzip12 token metadata used by FA1 and FA2 tokens
func ResolveTokenMetadata ¶
func (*TokenMetadata) UnmarshalPrim ¶
func (t *TokenMetadata) UnmarshalPrim(prim micheline.Prim) error
(pair (nat %token_id) (map %token_info string bytes))
type TxArgs ¶
type TxArgs struct { Source tezos.Address Destination tezos.Address Amount tezos.N Params micheline.Parameters }
func (*TxArgs) Encode ¶
func (a *TxArgs) Encode() *codec.Transaction
func (*TxArgs) Parameters ¶
func (a *TxArgs) Parameters() *micheline.Parameters
func (*TxArgs) WithAmount ¶
func (*TxArgs) WithDestination ¶
func (*TxArgs) WithParameters ¶
func (a *TxArgs) WithParameters(params micheline.Parameters)
func (*TxArgs) WithSource ¶
type Tz16 ¶
type Tz16 struct { Name string `json:"name"` Description string `json:"description,omitempty"` Version string `json:"version,omitempty"` License *Tz16License `json:"license,omitempty"` Authors []string `json:"authors,omitempty"` Homepage string `json:"homepage,omitempty"` Source *Tz16Source `json:"source,omitempty"` Interfaces []string `json:"interfaces,omitempty"` Errors []Tz16Error `json:"errors,omitempty"` Views []Tz16View `json:"views,omitempty"` }
Represents Tzip16 contract metadata
type Tz16CodeAnnotation ¶
type Tz16License ¶
func (*Tz16License) UnmarshalJSON ¶
func (l *Tz16License) UnmarshalJSON(data []byte) error
type Tz16RestView ¶
type Tz16Source ¶
type Tz16StorageView ¶
type Tz16StorageView struct { ParamType micheline.Prim `json:"parameter"` ReturnType micheline.Prim `json:"returnType"` Code micheline.Prim `json:"code"` Annotations []Tz16CodeAnnotation `json:"annotations,omitempty"` Version string `json:"version,omitempty"` }
func (*Tz16StorageView) Run ¶
func (v *Tz16StorageView) Run(ctx context.Context, contract *Contract, args micheline.Prim) (micheline.Prim, error)
Run executes the TZIP-16 off-chain view using script and storage from contract and passed args. Returns the result as primitive which matches the view's return type. Note this method does not check or patch the view code to replace illegal instructions or inject current context.
type Tz16View ¶
type Tz16View struct { Name string `json:"name"` Description string `json:"description,omitempty"` Pure bool `json:"pure,omitempty"` Implementations []Tz16ViewImpl `json:"implementations,omitempty"` }
type Tz16ViewImpl ¶
type Tz16ViewImpl struct { Storage *Tz16StorageView `json:"michelsonStorageView,omitempty"` Rest *Tz16RestView `json:"restApiQuery,omitempty"` }