Skip to main content

ERC1155

This interface is currently support by the Edition and Edition Drop contracts. You can access all of its functions through an Edition or Edition Drop contract instance.

type ERC1155 struct {}

func (*ERC1155) Balance

func (erc1155 *ERC1155) Balance(tokenId int) (int, error)

Get the NFT balance of the connected wallet for a specific token ID.

tokenId: the token ID of a specific token to check the balance of

returns: the number of NFTs of the specified token ID owned by the connected wallet

func (*ERC1155) BalanceOf

func (erc1155 *ERC1155) BalanceOf(address string, tokenId int) (int, error)

Get the NFT balance of a specific wallet.

address: the address of the wallet to get the NFT balance of

returns: the number of NFTs of the specified token ID owned by the specified wallet

Example

address := "{{wallet_address}}"
tokenId := 0
balance, err := contract.BalanceOf(address, tokenId)

func (*ERC1155) Burn

func (erc1155 *ERC1155) Burn(tokenId int, amount int) (*types.Transaction, error)

Burn an amount of a specified NFT from the connected wallet.

tokenId: tokenID of the token to burn

amount: number of NFTs of the token ID to burn

returns: the transaction receipt of the burn

Example

tokenId := 0
amount := 1
tx, err := contract.Burn(tokenId, amount)

func (*ERC1155) Get

func (erc1155 *ERC1155) Get(tokenId int) (*EditionMetadata, error)

Get metadata for a token.

tokenId: token ID of the token to get the metadata for

returns: the metadata for the NFT and its supply

Example

nft, err := contract.Get(0)

supply := nft.Supply name := nft.Metadata.Name

func (*ERC1155) GetAll

func (erc1155 *ERC1155) GetAll() ([]*EditionMetadata, error)

Get the metadata of all the NFTs on this contract.

returns: the metadatas and supplies of all the NFTs on this contract

Example

nfts, err := contract.GetAll()
supplyOne := nfts[0].Supply
nameOne := nfts[0].Metadata.Name

func (*ERC1155) GetOwned

func (erc1155 *ERC1155) GetOwned(address string) ([]*EditionMetadataOwner, error)

Get the metadatas of all the NFTs owned by a specific address.

address: the address of the owner of the NFTs

returns: the metadatas and supplies of all the NFTs owned by the address

Example

owner := "{{wallet_address}}"
nfts, err := contract.GetOwned(owner)
name := nfts[0].Metadata.Name

func (*ERC1155) GetTotalCount

func (erc1155 *ERC1155) GetTotalCount() (int, error)

Get the total number of NFTs on this contract.

returns: the total number of NFTs on this contract

func (*ERC1155) IsApproved

func (erc1155 *ERC1155) IsApproved(address string, operator string) (bool, error)

Check whether an operator address is approved for all operations of a specifc addresses assets.

address: the address whose assets are to be checked

operator: the address of the operator to check

returns: true if the operator is approved for all operations of the assets, otherwise false

func (*ERC1155) SetApprovalForAll

func (erc1155 *ERC1155) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)

Set the approval for all operations of a specific address's assets.

address: the address whose assets are to be approved

operator: the address of the operator to set the approval for

approved: true if the operator is approved for all operations of the assets, otherwise false

returns: the transaction receipt of the approval

func (*ERC1155) TotalSupply

func (erc1155 *ERC1155) TotalSupply(tokenId int) (int, error)

Get the total number of NFTs of a specific token ID.

tokenId: the token ID to check the total supply of

returns: the supply of NFTs on the specified token ID

func (*ERC1155) Transfer

func (erc1155 *ERC1155) Transfer(to string, tokenId int, amount int) (*types.Transaction, error)

Transfer a specific quantity of a token ID from the connected wallet to a specified address.

to: wallet address to transfer the tokens to

tokenId: the token ID of the NFT to transfer

amount: number of NFTs of the token ID to transfer

returns: the transaction of the NFT transfer

Example

to := "0x..."
tokenId := 0
amount := 1

tx, err := contract.Transfer(to, tokenId, amount)