erc721

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ABIERC721 = `` /* 3286-byte string literal not displayed */

Variables

This section is empty.

Functions

func PackPayloadForErc721

func PackPayloadForErc721(function string, params []byte) (string, error)

PackPayloadForErc721 encodes the calldata for one of the ERC-721 functions the ABI above declares. Returns hex without the 0x prefix so callers can concatenate with a tx payload builder that adds its own prefix.

Unsupported function names return an error rather than a silent empty payload — an accidentally-mistyped function name would otherwise sign an empty tx that costs gas but does nothing.

func UnpackReturnsForErc721

func UnpackReturnsForErc721(function string, returns []byte) (string, error)

UnpackReturnsForErc721 decodes the return payload of a view function into a string. Non-view functions (transferFrom etc.) don't return anything meaningful — call with those returns an "unsupported function" error rather than an empty string, to catch callers that mis-wire read vs write paths.

Types

type CallErc721In

type CallErc721In struct {
	// Address is the owner / balanceOf target for read functions.
	Address string `json:"address,omitempty"`
	// Owner + Operator for isApprovedForAll.
	Owner    string `json:"owner,omitempty"`
	Operator string `json:"operator,omitempty"`
	// Approved is the isApprovedForAll flag (true = grant, false = revoke).
	Approved bool `json:"approved,omitempty"`
	// From / To for transfer* functions.
	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
	// Recipient for approve (approve grants To one specific tokenId;
	// setApprovalForAll grants Operator every tokenId).
	Recipient string `json:"recipient,omitempty"`
	// TokenId is the NFT id, decimal string. Big enough for uint256.
	TokenId string `json:"tokenId,omitempty"`
	// Index for tokenByIndex / tokenOfOwnerByIndex.
	Index string `json:"index,omitempty"`
	// Data is the onERC721Received callback payload for
	// safeTransferFromWithData; hex-encoded (with or without 0x).
	Data string `json:"data,omitempty"`
}

CallErc721In accepts every field any packed ERC-721 function can need; unused ones stay zero. Address / TokenId / Operator fields are strings on the wire so bindings can use a single JSON payload (mobile / TS FE) without depending on big.Int marshalers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL