Skip to content

Solidity API

ISpanningERC721

Interface of ERC721 in the Spanning Protocol NOTE: Spanning uses receiverAddress in favor of operatorAddress. This pattern matches the language used to represent approvals elsewhere.

balanceOf

function balanceOf(bytes32 accountAddress) external view returns (uint256)

Returns the number of tokens owned by an account.

NameTypeDescription
accountAddressbytes32- Address to be queried
NameTypeDescription
[0]uint256uint256 - Number of tokens owned by an account

ownerOfSpanning

function ownerOfSpanning(uint256 tokenId) external view returns (bytes32)

Returns the owner of the queried token.

NameTypeDescription
tokenIduint256- Token to be queried
NameTypeDescription
[0]bytes32bytes32 - Address of the owner of the queried token

safeTransferFrom

function safeTransferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId, bytes payload) external

Safely moves requested tokens between accounts, including data.

NameTypeDescription
senderAddressbytes32- Address of the sender
receiverAddressbytes32- Address of the receiver
tokenIduint256- Token to be transferred
payloadbytes- Additional, unstructured data to be included

safeTransferFrom

function safeTransferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) external

Safely moves requested tokens between accounts.

NameTypeDescription
senderAddressbytes32- Address of the sender
receiverAddressbytes32- Address of the receiver
tokenIduint256- Token to be transferred

transferFrom

function transferFrom(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId) external

Moves requested tokens between accounts.

NameTypeDescription
senderAddressbytes32- Address of the sender
receiverAddressbytes32- Address of the receiver
tokenIduint256- Token to be transferred

approve

function approve(bytes32 receiverAddress, uint256 tokenId) external

Sets a token allowance for a pair of addresses (sender and receiver).

NameTypeDescription
receiverAddressbytes32- Address of the allowance receiver
tokenIduint256- Token allowance to be approved

setApprovalForAll

function setApprovalForAll(bytes32 receiverAddress, bool shouldApprove) external

Allows an account to have control over another account's tokens.

NameTypeDescription
receiverAddressbytes32- Address of the allowance receiver (gains control)
shouldApprovebool- Whether to approve or revoke the approval

getApprovedSpanning

function getApprovedSpanning(uint256 tokenId) external view returns (bytes32)

Returns the account approved for a token.

NameTypeDescription
tokenIduint256- Token to be queried
NameTypeDescription
[0]bytes32bytes32 - Address of the account approved for a token

isApprovedForAll

function isApprovedForAll(bytes32 senderAddress, bytes32 receiverAddress) external view returns (bool)

Indicates if an account has total control over another's assets.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender (cede control)
receiverAddressbytes32- Address of the allowance receiver (gains control)
NameTypeDescription
[0]boolbool - Indicates whether the account is approved for all

SpanningTransfer

event SpanningTransfer(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId)

_Emitted tokens are transferred

Note that amount may be zero._

NameTypeDescription
senderAddressbytes32- Address initiating the transfer
receiverAddressbytes32- Address receiving the transfer
tokenIduint256- Token under transfer

SpanningApproval

event SpanningApproval(bytes32 senderAddress, bytes32 receiverAddress, uint256 tokenId)

Emitted when an allowance pair changes.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender
receiverAddressbytes32- Address of the allowance receiver
tokenIduint256- Token under allowance

SpanningApprovalForAll

event SpanningApprovalForAll(bytes32 senderAddress, bytes32 receiverAddress, bool approved)

Emitted when an account gives control to another account's tokens.

NameTypeDescription
senderAddressbytes32- Address of the allowance sender (cede control)
receiverAddressbytes32- Address of the allowance receiver (gains control)
approvedbool- Whether the approval was approved or revoked