Documentation ¶
Overview ¶
Copyright (c) 2020-2022 Blockwatch Data Inc. Author: alex@blockwatch.cc
Index ¶
- Variables
- type CallArguments
- type CallOptions
- 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 *CallOptions) (*rpc.Receipt, error)
- func (c *Contract) CallMulti(ctx context.Context, args []CallArguments, opts *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 *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) IsFA1() bool
- func (c Contract) IsFA12() bool
- func (c Contract) IsFA2() bool
- func (c Contract) IsManagerTz() 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) 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) 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) 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) GetMetadata(ctx context.Context) (TokenMetadata, error)
- func (t FA1Token) GetTotalSupply(ctx context.Context) (tezos.Z, error)
- 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
- 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
- type Tz16
- type Tz16CodeAnnotation
- type Tz16Error
- type Tz16License
- type Tz16RestView
- type Tz16Source
- type Tz16StorageView
- type Tz16View
- type Tz16ViewImpl
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = CallOptions{
Confirmations: 6,
TTL: 120,
MaxFee: 1000000,
}
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 CallOptions ¶ added in v1.12.0
type CallOptions struct { Confirmations int64 // number of confirmations to wait after broadcast TTL int64 // max number of blocks to wait in total Limits tezos.Limits // optional gas, storage and fee limits to override estimations MaxFee int64 // max acceptable fee, optional (default = 0) Signer signer.Signer // optional signer interface to use for signing the transaction Observer *rpc.Observer // optional custom block observer for waiting on confirmations }
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
func (*Contract) Call ¶
func (c *Contract) Call(ctx context.Context, args CallArguments, opts *CallOptions) (*rpc.Receipt, error)
func (*Contract) CallMulti ¶
func (c *Contract) CallMulti(ctx context.Context, args []CallArguments, opts *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) IsManagerTz ¶
func (*Contract) ResolveMetadata ¶
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 ¶
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) GetMetadata ¶ added in v1.12.0
func (t FA1Token) GetMetadata(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) GetBalances ¶
func (t FA2Token) GetBalances(ctx context.Context, req []FA2BalanceRequest) ([]FA2BalanceResponse, error)
func (FA2Token) GetMetadata ¶ added in v1.12.0
func (t FA2Token) GetMetadata(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 { Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` }
Represents Tzip12 token metadata used by FA1 and FA2 tokens
type TxArgs ¶
func (*TxArgs) WithAmount ¶
func (*TxArgs) WithDestination ¶
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 ¶
type Tz16RestView ¶
type Tz16Source ¶
type Tz16StorageView ¶
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"` }