Documentation
¶
Index ¶
- Constants
- type AkhiraSDK
- func (sdk *AkhiraSDK) GetContract(address string) (*SmartContract, error)
- func (sdk *AkhiraSDK) GetContractFromAbi(address string, abi string) (*SmartContract, error)
- func (sdk *AkhiraSDK) GetEdition(address string) (*Edition, error)
- func (sdk *AkhiraSDK) GetEditionDrop(address string) (*EditionDrop, error)
- func (sdk *AkhiraSDK) GetMultiwrap(address string) (*Multiwrap, error)
- func (sdk *AkhiraSDK) GetNFTCollection(address string) (*NFTCollection, error)
- func (sdk *AkhiraSDK) GetNFTDrop(address string) (*NFTDrop, error)
- func (sdk *AkhiraSDK) GetToken(address string) (*Token, error)
- type ChainID
- type ChainName
- type ClaimCondition
- type ClaimConditionOutput
- type ClaimVerification
- type Currency
- type CurrencyValue
- type ERC1155
- func (erc1155 *ERC1155) Balance(tokenId int) (*big.Int, error)
- func (erc1155 *ERC1155) BalanceOf(address string, tokenId int) (*big.Int, error)
- func (erc1155 *ERC1155) Burn(tokenId int, amount int) (*types.Transaction, error)
- func (erc1155 *ERC1155) Get(tokenId int) (*EditionMetadata, error)
- func (erc1155 *ERC1155) GetAll() ([]*EditionMetadata, error)
- func (erc1155 *ERC1155) GetOwned(address string) ([]*EditionMetadataOwner, error)
- func (erc1155 *ERC1155) GetTotalCount() (*big.Int, error)
- func (erc1155 *ERC1155) IsApproved(address string, operator string) (bool, error)
- func (erc1155 *ERC1155) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)
- func (erc1155 *ERC1155) TotalSupply(tokenId int) (*big.Int, error)
- func (erc1155 *ERC1155) Transfer(to string, tokenId int, amount int) (*types.Transaction, error)
- type ERC1155SignatureMinting
- func (signature *ERC1155SignatureMinting) Generate(payloadToSign *Signature1155PayloadInput) (*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateBatch(payloadsToSign []*Signature1155PayloadInput) ([]*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateBatchFromTokenIds(payloadsToSign []*Signature1155PayloadInputWithTokenId) ([]*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) GenerateFromTokenId(payloadToSign *Signature1155PayloadInputWithTokenId) (*SignedPayload1155, error)
- func (signature *ERC1155SignatureMinting) Mint(signedPayload *SignedPayload1155) (*types.Transaction, error)
- func (signature *ERC1155SignatureMinting) MintBatch(signedPayloads []*SignedPayload1155) (*types.Transaction, error)
- func (signature *ERC1155SignatureMinting) Verify(signedPayload *SignedPayload1155) (bool, error)
- type ERC20
- func (erc20 *ERC20) Allowance(spender string) (*CurrencyValue, error)
- func (erc20 *ERC20) AllowanceOf(owner string, spender string) (*CurrencyValue, error)
- func (erc20 *ERC20) Balance() (*CurrencyValue, error)
- func (erc20 *ERC20) BalanceOf(address string) (*CurrencyValue, error)
- func (erc20 *ERC20) Burn(amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) BurnFrom(holder string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) Get() (*Currency, error)
- func (erc20 *ERC20) SetAllowance(spender string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) TotalSupply() (*CurrencyValue, error)
- func (erc20 *ERC20) Transfer(to string, amount float64) (*types.Transaction, error)
- func (erc20 *ERC20) TransferBatch(args []*TokenAmount) (*types.Transaction, error)
- func (erc20 *ERC20) TransferFrom(from string, to string, amount float64) (*types.Transaction, error)
- type ERC721
- func (erc721 *ERC721) Balance() (int, error)
- func (erc721 *ERC721) BalanceOf(address string) (int, error)
- func (erc721 *ERC721) Burn(tokenId int) (*types.Transaction, error)
- func (erc721 *ERC721) Get(tokenId int) (*NFTMetadataOwner, error)
- func (erc721 *ERC721) GetAll() ([]*NFTMetadataOwner, error)
- func (erc721 *ERC721) GetTotalCount() (*big.Int, error)
- func (erc721 *ERC721) IsApproved(address string, operator string) (bool, error)
- func (erc721 *ERC721) OwnerOf(tokenId int) (string, error)
- func (erc721 *ERC721) SetApprovalForAll(operator string, approved bool) (*types.Transaction, error)
- func (erc721 *ERC721) SetApprovalForToken(operator string, tokenId int) (*types.Transaction, error)
- func (erc721 *ERC721) TotalSupply() (*big.Int, error)
- func (erc721 *ERC721) Transfer(to string, tokenId int) (*types.Transaction, error)
- type ERC721SignatureMinting
- func (signature *ERC721SignatureMinting) Generate(payloadToSign *Signature721PayloadInput) (*SignedPayload721, error)
- func (signature *ERC721SignatureMinting) GenerateBatch(payloadsToSign []*Signature721PayloadInput) ([]*SignedPayload721, error)
- func (signature *ERC721SignatureMinting) Mint(signedPayload *SignedPayload721) (*types.Transaction, error)
- func (signature *ERC721SignatureMinting) MintBatch(signedPayloads []*SignedPayload721) (*types.Transaction, error)
- func (signature *ERC721SignatureMinting) Verify(signedPayload *SignedPayload721) (bool, error)
- type Edition
- func (edition *Edition) Mint(metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
- func (edition *Edition) MintAdditionalSupply(tokenId int, additionalSupply int) (*types.Transaction, error)
- func (edition *Edition) MintAdditionalSupplyTo(to string, tokenId int, additionalSupply int) (*types.Transaction, error)
- func (edition *Edition) MintBatchTo(to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
- func (edition *Edition) MintTo(address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
- type EditionDrop
- type EditionMetadata
- type EditionMetadataInput
- type EditionMetadataOwner
- type EditionResult
- type IpfsStorage
- func (ipfs *IpfsStorage) Get(uri string) ([]byte, error)
- func (ipfs *IpfsStorage) Upload(data interface{}, contractAddress string, signerAddress string) (string, error)
- func (ipfs *IpfsStorage) UploadBatch(data []interface{}, fileStartNumber int, contractAddress string, ...) (*baseUriWithUris, error)
- type Metadata
- type Multiwrap
- func (multiwrap *Multiwrap) GetWrappedContents(wrappedTokenId int) (*MultiwrapBundle, error)
- func (multiwrap *Multiwrap) Unwrap(wrappedTokenId int, recipientAddress string) (*types.Transaction, error)
- func (multiwrap *Multiwrap) Wrap(contents *MultiwrapBundle, wrappedTokenMetadata interface{}, ...) (*types.Transaction, error)
- type MultiwrapBundle
- type MultiwrapERC1155
- type MultiwrapERC20
- type MultiwrapERC721
- type NFTCollection
- func (nft *NFTCollection) GetOwned(address string) ([]*NFTMetadataOwner, error)
- func (nft *NFTCollection) GetOwnedTokenIDs(address string) ([]*big.Int, error)
- func (nft *NFTCollection) Mint(metadata *NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintBatchTo(address string, metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (nft *NFTCollection) MintTo(address string, metadata *NFTMetadataInput) (*types.Transaction, error)
- type NFTDrop
- func (drop *NFTDrop) Claim(quantity int) (*types.Transaction, error)
- func (drop *NFTDrop) ClaimTo(destinationAddress string, quantity int) (*types.Transaction, error)
- func (drop *NFTDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
- func (drop *NFTDrop) GetAllClaimed() ([]*NFTMetadataOwner, error)
- func (drop *NFTDrop) GetAllUnclaimed() ([]*NFTMetadata, error)
- func (nft *NFTDrop) GetOwned(address string) ([]*NFTMetadataOwner, error)
- func (nft *NFTDrop) GetOwnedTokenIDs(address string) ([]*big.Int, error)
- type NFTMetadata
- type NFTMetadataInput
- type NFTMetadataOwner
- type NFTResult
- type NativeToken
- type ProviderHandler
- func (handler *ProviderHandler) GetChainID() (*big.Int, error)
- func (handler *ProviderHandler) GetPrivateKey() *ecdsa.PrivateKey
- func (handler *ProviderHandler) GetProvider() *ethclient.Client
- func (handler *ProviderHandler) GetRawPrivateKey() string
- func (handler *ProviderHandler) GetSignerAddress() common.Address
- func (handler *ProviderHandler) UpdatePrivateKey(privateKey string) error
- func (handler *ProviderHandler) UpdateProvider(provider *ethclient.Client)
- type SDKOptions
- type Signature1155PayloadInput
- type Signature1155PayloadInputWithTokenId
- type Signature1155PayloadOutput
- type Signature721PayloadInput
- type Signature721PayloadOutput
- type SignedPayload1155
- type SignedPayload721
- type SmartContract
- type Token
- func (token *Token) DelegateTo(delegatreeAddress string) (*types.Transaction, error)
- func (token *Token) GetDelegation() (string, error)
- func (token *Token) GetDelegationOf(address string) (string, error)
- func (token *Token) GetVoteBalance() (*CurrencyValue, error)
- func (token *Token) GetVoteBalanceOf(address string) (*CurrencyValue, error)
- func (token *Token) Mint(amount float64) (*types.Transaction, error)
- func (token *Token) MintBatchTo(args []*TokenAmount) (*types.Transaction, error)
- func (token *Token) MintTo(to string, amount float64) (*types.Transaction, error)
- type TokenAmount
- type WrappedToken
Constants ¶
const ( MAINNET ChainID = 1 RINKEBY = 4 GOERLI = 5 POLYGON = 137 FANTOM = 250 AVALANCHE = 43114 MUMBAI = 80001 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AkhiraSDK ¶
type AkhiraSDK struct { *ProviderHandler Storage IpfsStorage }
func NewAkhiraSDK ¶
func NewAkhiraSDK(rpcUrlOrChainName string, options *SDKOptions) (*AkhiraSDK, error)
NewAkhiraSDK
Create a new instance of the Thirdweb SDK ¶
rpcUrlOrName: the name of the chain to connection to (e.g. "rinkeby", "mumbai", "polygon", "mainnet", "fantom", "avalanche") or the RPC URL to connect to
options: an SDKOptions instance to specify a private key and/or an IPFS gateway URL
func (*AkhiraSDK) GetContract ¶
func (sdk *AkhiraSDK) GetContract(address string) (*SmartContract, error)
GetContract
Get an instance of a custom contract deployed with akhira deploy ¶
address: the address of the contract
func (*AkhiraSDK) GetContractFromAbi ¶
func (sdk *AkhiraSDK) GetContractFromAbi(address string, abi string) (*SmartContract, error)
GetContractFromABI
Get an instance of ant custom contract from its ABI ¶
address: the address of the contract
abi: the ABI of the contract
func (*AkhiraSDK) GetEdition ¶
GetEdition
Get an Edition contract SDK instance ¶
address: the address of the Edition contract
func (*AkhiraSDK) GetEditionDrop ¶
func (sdk *AkhiraSDK) GetEditionDrop(address string) (*EditionDrop, error)
GetEditionDrop
Get an Edition Drop contract SDK instance ¶
address: the address of the Edition Drop contract
func (*AkhiraSDK) GetMultiwrap ¶
GetMultiwrap
Get a Multiwrap contract SDK instance ¶
address: the address of the Multiwrap contract
func (*AkhiraSDK) GetNFTCollection ¶
func (sdk *AkhiraSDK) GetNFTCollection(address string) (*NFTCollection, error)
GetNFTCollection
Get an NFT Collection contract SDK instance ¶
address: the address of the NFT Collection contract
func (*AkhiraSDK) GetNFTDrop ¶
GetNFTDrop
Get an NFT Drop contract SDK instance ¶
address: the address of the NFT Drop contract
type ClaimCondition ¶
type ClaimCondition struct {
// contains filtered or unexported fields
}
type ClaimConditionOutput ¶
type ClaimConditionOutput struct {
// contains filtered or unexported fields
}
type ClaimVerification ¶
type ClaimVerification struct {
// contains filtered or unexported fields
}
type CurrencyValue ¶
type ERC1155 ¶
type ERC1155 struct {
// contains filtered or unexported fields
}
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.
func (*ERC1155) Balance ¶
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 ¶
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 ¶
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 ¶
Get the total number of NFTs on this contract.
returns: the total number of NFTs on this contract
func (*ERC1155) IsApproved ¶
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 ¶
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 ¶
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)
type ERC1155SignatureMinting ¶
type ERC1155SignatureMinting struct {
// contains filtered or unexported fields
}
You can access this interface from the edition contract under the signature interface
func (*ERC1155SignatureMinting) Generate ¶
func (signature *ERC1155SignatureMinting) Generate(payloadToSign *Signature1155PayloadInput) (*SignedPayload1155, error)
Generate a payload to mint a new token ID
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &akhira.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", // address to mint to Price: 0, // cost of minting CurrencyAddress: "0x0000000000000000000000000000000000000000", // currency to pay in order to mint MintStartTime: 0, // time where minting is allowed to start (epoch seconds) MintEndTime: 100000000000000, // time when this signature expires (epoch seconds) PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", // address to receive the primary sales of this mint Metadata: &akhira.NFTMetadataInput{ // metadata of the NFT to mint Name: "ERC721 Sigmint!", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", // address to receive royalties of this mint RoyaltyBps: 0, // royalty cut of this mint in basis points Quantity: 1, // number of tokens to mint } signedPayload, err := contract.Signature.Generate(payload)
func (*ERC1155SignatureMinting) GenerateBatch ¶
func (signature *ERC1155SignatureMinting) GenerateBatch(payloadsToSign []*Signature1155PayloadInput) ([]*SignedPayload1155, error)
Generate a batch of payloads to mint multiple new token IDs
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*akhira.Signature1155PayloadInput{ &akhira.Signature1155PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &akhira.NFTMetadataInput{ Name: "ERC1155 Sigmint 1", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, }, &akhira.Signature1155PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &akhira.NFTMetadataInput{ Name: "ERC1155 Sigmint 2", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, }, } signedPayload, err := contract.Signature.GenerateBatch(payload)
func (*ERC1155SignatureMinting) GenerateBatchFromTokenIds ¶
func (signature *ERC1155SignatureMinting) GenerateBatchFromTokenIds(payloadsToSign []*Signature1155PayloadInputWithTokenId) ([]*SignedPayload1155, error)
Generate a batch of payloads to mint multiple new token IDs
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*akhira.Signature1155PayloadInputWithTokenId{ &akhira.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &akhira.NFTMetadataInput{ Name: "ERC1155 Sigmint 1", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 0, }, &akhira.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: nil RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 1, }, } signedPayload, err := contract.Signature.GenerateBatchFromTokenIds(payload)
func (*ERC1155SignatureMinting) GenerateFromTokenId ¶
func (signature *ERC1155SignatureMinting) GenerateFromTokenId(payloadToSign *Signature1155PayloadInputWithTokenId) (*SignedPayload1155, error)
Generate a new payload to mint additionaly supply to an existing token ID
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &akhira.Signature1155PayloadInputWithTokenId{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: nil, // we don't need to pass NFT metadata since we are minting an existing token RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, Quantity: 1, TokenId: 0, // now we need to specify the token ID to mint supply to } signedPayload, err := contract.Signature.GenerateFromTokenId(payload)
func (*ERC1155SignatureMinting) Mint ¶
func (signature *ERC1155SignatureMinting) Mint(signedPayload *SignedPayload1155) (*types.Transaction, error)
Mint a token with the data in given payload.
signedPayload: the payload signed by the minters private key being used to mint
returns: the transaction receipt of the mint
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) tx, err := contract.Signature.Mint(signedPayload)
func (*ERC1155SignatureMinting) MintBatch ¶
func (signature *ERC1155SignatureMinting) MintBatch(signedPayloads []*SignedPayload1155) (*types.Transaction, error)
Mint a batch of token with the data in given payload.
signedPayload: the list of payloads signed by the minters private key being used to mint
returns: the transaction receipt of the batch mint
Example
// Learn more about how to craft multiple payloads in the GenerateBatch() function signedPayloads, err := contract.Signature.GenerateBatch(payloads) tx, err := contract.Signature.MintBatch(signedPayloads)
func (*ERC1155SignatureMinting) Verify ¶
func (signature *ERC1155SignatureMinting) Verify(signedPayload *SignedPayload1155) (bool, error)
Verify that a signed payload is valid
signedPayload: the payload to verify
returns: true if the payload is valid, otherwise false.
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) isValid, err := contract.Signature.Verify(signedPayload)
type ERC20 ¶
type ERC20 struct {
// contains filtered or unexported fields
}
This interface is currently support by the Token contract. You can access all of its functions through a Token contract instance.
func (*ERC20) Allowance ¶
func (erc20 *ERC20) Allowance(spender string) (*CurrencyValue, error)
Get a specified spenders allowance for the connected wallets tokens.
spender: wallet address to check the allowance of
returns: allowance of the spender for the connected wallets tokens
Example
spender := "0x..." allowance, err := contract.Allowance(spender) allowanceValue := allowance.DisplayValue
func (*ERC20) AllowanceOf ¶
func (erc20 *ERC20) AllowanceOf(owner string, spender string) (*CurrencyValue, error)
Get a specified spenders allowance for the a specific wallets tokens.
owner: wallet address who owns the assets
spender: wallet address to check the allowance of
returns: allowance of the spender for the connected wallets tokens
Example
address := "{{wallet_address}}" spender := "0x..." allowance, err := contract.AllowanceOf(address, spender) allowanceValue := allowance.DisplayValue
func (*ERC20) Balance ¶
func (erc20 *ERC20) Balance() (*CurrencyValue, error)
Get the token balance of the connected wallet.
returns: balance of the connected wallet
Example
balance, err := contract.Balance() balanceValue := balance.DisplayValue
func (*ERC20) BalanceOf ¶
func (erc20 *ERC20) BalanceOf(address string) (*CurrencyValue, error)
Get the balance of the specified wallet.
address: wallet address to check the balance of
returns: balance of the specified wallet
Example
address := "{{wallet_address}}" balance, err := contract.BalanceOf() balanceValue := balance.DisplayValue
func (*ERC20) Burn ¶
func (erc20 *ERC20) Burn(amount float64) (*types.Transaction, error)
Burn a specified amount of tokens from the connected wallet.
amount: amount of tokens to burn
returns: transaction receipt of the burn
Example
amount := 1 tx, err := contract.Burn(amount)
func (*ERC20) BurnFrom ¶
Burn a specified amount of tokens from a specific wallet.
holder: wallet address to burn the tokens from
amount: amount of tokens to burn
returns: transaction receipt of the burn
Example
holder := "0x..." amount := 1 tx, err := contract.BurnFrom(holder, amount)
func (*ERC20) Get ¶
Get token metadata including name, symbol, decimals, etc.
returns: the metadata for the token
Example
currency, err := contract.Get() symbol := currency.Symbol
func (*ERC20) SetAllowance ¶
Sets the allowance of a wallet to spend the connected wallets funds.
spender: wallet address to set the allowance of
amount: amount of tokens to grant the spender allowance of
returns: transaction receipt of the allowance set
Example
spender := "0x..." amount := 1 tx, err := contract.SetAllowance(spender, amount)
func (*ERC20) TotalSupply ¶
func (erc20 *ERC20) TotalSupply() (*CurrencyValue, error)
Get the total minted supply of the token.
returns: total minted supply of the token
func (*ERC20) Transfer ¶
Transfer a specified amount of tokens from the connected wallet to a specified address.
to: address to transfer the tokens to
amount: amount of tokens to transfer
returns: transaction receipt of the transfer
Example
to := "0x..." amount := 1 tx, err := contract.Transfer(to, amount)
func (*ERC20) TransferBatch ¶
func (erc20 *ERC20) TransferBatch(args []*TokenAmount) (*types.Transaction, error)
Transfer tokens from the connected wallet to many wallets.
args: list of token amounts with amounts and addresses to transfer to
returns: transaction receipt of the transfers
Example
args = []*akhira.TokenAmount{ &akhira.TokenAmount{ ToAddress: "0x...", Amount: 1 } &akhira.TokenAmount{ ToAddress: "0x...", Amount: 2 } } tx, err := contract.TransferBatch(args)
func (*ERC20) TransferFrom ¶
func (erc20 *ERC20) TransferFrom(from string, to string, amount float64) (*types.Transaction, error)
Transfer a specified amount of tokens from one specified address to another.
from: address to transfer the tokens from
to: address to transfer the tokens to
amount: amount of tokens to transfer
returns: transaction receipt of the transfer
Example
from := "{{wallet_address}}" to := "0x..." amount := 1 tx, err := contract.TransferFrom(from, to, amount)
type ERC721 ¶
type ERC721 struct {
// contains filtered or unexported fields
}
This interface is currently support by the NFT Collection and NFT Drop contracts. You can access all of its functions through an NFT Collection or NFT Drop contract instance.
func (*ERC721) Balance ¶
Get the NFT balance of the connected wallet.
returns: the number of NFTs on this contract owned by the connected wallet
func (*ERC721) BalanceOf ¶
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 on this contract owned by the specified wallet
Example
address := "{{wallet_address}}" balance, err := contract.BalanceOf(address)
func (*ERC721) Burn ¶
func (erc721 *ERC721) Burn(tokenId int) (*types.Transaction, error)
Burn a specified NFT from the connected wallet.
tokenId: tokenID of the token to burn
returns: the transaction receipt of the burn
Example
tokenId := 0 tx, err := contract.Burn(tokenId)
func (*ERC721) Get ¶
func (erc721 *ERC721) Get(tokenId int) (*NFTMetadataOwner, 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 owner
Example
nft, err := contract.Get(0) owner := nft.Owner name := nft.Metadata.Name
func (*ERC721) GetAll ¶
func (erc721 *ERC721) GetAll() ([]*NFTMetadataOwner, error)
Get the metadata of all the NFTs on this contract.
returns: the metadata of all the NFTs on this contract
Example
nfts, err := contract.GetAll() ownerOne := nfts[0].Owner nameOne := nfts[0].Metadata.Name
func (*ERC721) GetTotalCount ¶
Get the total number of NFTs on this contract.
returns: the total number of NFTs on this contract
func (*ERC721) IsApproved ¶
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 (*ERC721) OwnerOf ¶
Get the owner of an NFT.
tokenId: the token ID of the NFT to get the owner of
returns: the owner of the NFT
func (*ERC721) SetApprovalForAll ¶
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 (*ERC721) SetApprovalForToken ¶
Approve an operator for the NFT owner, which allows the operator to call transferFrom or safeTransferFrom for the specified token.
operator: the address of the operator to approve
tokenId: the token ID of the NFT to approve
returns: the transaction receipt of the approval
func (*ERC721) TotalSupply ¶
Get the total number of NFTs on this contract.
returns: the supply of NFTs on this contract
func (*ERC721) Transfer ¶
Transfer a specified token 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
returns: the transaction of the NFT transfer
Example
to := "0x..." tokenId := 0 tx, err := contract.Transfer(to, tokenId)
type ERC721SignatureMinting ¶
type ERC721SignatureMinting struct {
// contains filtered or unexported fields
}
You can access this interface from the NFT Collection contract under the signature interface.
func (*ERC721SignatureMinting) Generate ¶
func (signature *ERC721SignatureMinting) Generate(payloadToSign *Signature721PayloadInput) (*SignedPayload721, error)
Generate a new payload from the given data
payloadToSign: the payload containing the data for the signature mint
returns: the payload signed by the minter's private key
Example
payload := &akhira.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", // address to mint to Price: 0, // cost of minting CurrencyAddress: "0x0000000000000000000000000000000000000000", // currency to pay in order to mint MintStartTime: 0, // time where minting is allowed to start (epoch seconds) MintEndTime: 100000000000000, // time when this signature expires (epoch seconds) PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", // address to receive the primary sales of this mint Metadata: &akhira.NFTMetadataInput{ // metadata of the NFT to mint Name: "ERC721 Sigmint!", }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", // address to receive royalties of this mint RoyaltyBps: 0, // royalty cut of this mint in basis points } signedPayload, err := contract.Signature.Generate(payload)
func (*ERC721SignatureMinting) GenerateBatch ¶
func (signature *ERC721SignatureMinting) GenerateBatch(payloadsToSign []*Signature721PayloadInput) ([]*SignedPayload721, error)
Generate a batch of new payload from the given data
payloadToSign: the payloads containing the data for the signature mint
returns: the payloads signed by the minter's private key
Example
payload := []*akhira.Signature721PayloadInput{ &akhira.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &akhira.NFTMetadataInput{ Name: "ERC721 Sigmint!", Image: imageFile, }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, }, &akhira.Signature721PayloadInput{ To: "0x9e1b8A86fFEE4a7175DAE4bDB1cC12d111Dcb3D6", Price: 0, CurrencyAddress: "0x0000000000000000000000000000000000000000", MintStartTime: 0, MintEndTime: 100000000000000, PrimarySaleRecipient: "0x0000000000000000000000000000000000000000", Metadata: &akhira.NFTMetadataInput{ Name: "ERC721 Sigmint!", Image: imageFile, }, RoyaltyRecipient: "0x0000000000000000000000000000000000000000", RoyaltyBps: 0, }, } signedPayload, err := contract.Signature.GenerateBatch(payload)
func (*ERC721SignatureMinting) Mint ¶
func (signature *ERC721SignatureMinting) Mint(signedPayload *SignedPayload721) (*types.Transaction, error)
Mint a token with the data in given payload.
signedPayload: the payload signed by the minters private key being used to mint
returns: the transaction receipt of the mint
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) tx, err := contract.Signature.Mint(signedPayload)
func (*ERC721SignatureMinting) MintBatch ¶
func (signature *ERC721SignatureMinting) MintBatch(signedPayloads []*SignedPayload721) (*types.Transaction, error)
Mint a batch of token with the data in given payload.
signedPayload: the list of payloads signed by the minters private key being used to mint
returns: the transaction receipt of the batch mint
Example
// Learn more about how to craft multiple payloads in the GenerateBatch() function signedPayloads, err := contract.Signature.GenerateBatch(payloads) tx, err := contract.Signature.MintBatch(signedPayloads)
func (*ERC721SignatureMinting) Verify ¶
func (signature *ERC721SignatureMinting) Verify(signedPayload *SignedPayload721) (bool, error)
Verify that a signed payload is valid
signedPayload: the payload to verify
returns: true if the payload is valid, otherwise false.
Example
// Learn more about how to craft a payload in the Generate() function signedPayload, err := contract.Signature.Generate(payload) isValid, err := contract.Signature.Verify(signedPayload)
type Edition ¶
type Edition struct { *ERC1155 Signature *ERC1155SignatureMinting // contains filtered or unexported fields }
You can access the Edition interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetEdition("{{contract_address}}")
func (*Edition) Mint ¶
func (edition *Edition) Mint(metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint an NFT to the connected wallet.
metadataWithSupply: nft metadata with supply of the NFT to mint
returns: the transaction receipt of the mint
func (*Edition) MintAdditionalSupply ¶
func (edition *Edition) MintAdditionalSupply(tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additionaly supply of a token to the connected wallet.
tokenId: token ID to mint additional supply of
additionalSupply: additional supply to mint
returns: the transaction receipt of the mint
func (*Edition) MintAdditionalSupplyTo ¶
func (edition *Edition) MintAdditionalSupplyTo(to string, tokenId int, additionalSupply int) (*types.Transaction, error)
Mint additional supply of a token to the specified wallet.
to: address of the wallet to mint NFTs to
tokenId: token Id to mint additional supply of
additionalySupply: additional supply to mint
returns: the transaction receipt of the mint
func (*Edition) MintBatchTo ¶
func (edition *Edition) MintBatchTo(to string, metadatasWithSupply []*EditionMetadataInput) (*types.Transaction, error)
Mint a batch of tokens to various wallets.
to: address of the wallet to mint NFTs to
metadatasWithSupply: list of NFT metadatas with supplies to mint
returns: the transaction receipt of the mint
Example
metadatasWithSupply := []*akhira.EditionMetadataInput{ &akhira.EditionMetadataInput{ Metadata: &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", }, Supply: 100, }, &akhira.EditionMetadataInput{ Metadata: &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", }, Supply: 100, }, } tx, err := contract.MintBatchTo("{{wallet_address}}", metadatasWithSupply)
func (*Edition) MintTo ¶
func (edition *Edition) MintTo(address string, metadataWithSupply *EditionMetadataInput) (*types.Transaction, error)
Mint a new NFT to the specified wallet.
address: the wallet address to mint the NFT to
metadataWithSupply: nft metadata with supply of the NFT to mint
returns: the transaction receipt of the mint
Example
image, err := os.Open("path/to/image.jpg") defer image.Close() metadataWithSupply := &akhira.EditionMetadataInput{ Metadata: &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image, }, Supply: 100, } tx, err := contract.MintTo("{{wallet_address}}", metadataWithSupply)
type EditionDrop ¶
type EditionDrop struct { *ERC1155 // contains filtered or unexported fields }
You can access the Edition Drop interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetEditionDrop("{{contract_address}}")
func (*EditionDrop) Claim ¶
func (drop *EditionDrop) Claim(tokenId int, quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
tokenId: the token ID of the NFT to claim
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
func (*EditionDrop) ClaimTo ¶
func (drop *EditionDrop) ClaimTo(destinationAddress string, tokenId int, quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
tokenId: the token ID of the NFT to claim
destinationAddress: the address of the wallet to claim the NFTs to
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
Example
address = "{{wallet_address}}" tokenId = 0 quantity = 1 tx, err := contract.ClaimTo(address, tokenId, quantity)
func (*EditionDrop) CreateBatch ¶
func (drop *EditionDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Create a batch of NFTs on this contract.
metadatas: a list of the metadatas of the NFTs to create
returns: the transaction receipt of the batch creation
Example
image0, err := os.Open("path/to/image/0.jpg") defer image0.Close() image1, err := os.Open("path/to/image/1.jpg") defer image1.Close() metadatasWithSupply := []*akhira.EditionMetadataInput{ &akhira.EditionMetadataInput{ Metadata: &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image0, }, Supply: 100, }, &akhira.EditionMetadataInput{ Metadata: &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image1, }, Supply: 100, }, } tx, err := contract.MintBatchTo("{{wallet_address}}", metadatasWithSupply)
type EditionMetadata ¶
type EditionMetadata struct { Metadata *NFTMetadata Supply int }
type EditionMetadataInput ¶
type EditionMetadataInput struct { Metadata *NFTMetadataInput Supply int }
type EditionMetadataOwner ¶
type EditionMetadataOwner struct { Metadata *NFTMetadata Supply int Owner string QuantityOwned int }
type EditionResult ¶
type EditionResult struct {
// contains filtered or unexported fields
}
type IpfsStorage ¶
type IpfsStorage struct {
Url string
}
func (*IpfsStorage) Get ¶
func (ipfs *IpfsStorage) Get(uri string) ([]byte, error)
Get
Get IPFS data at a given hash and return it as byte data ¶
uri: the IPFS URI to fetch data from
returns: byte data of the IPFS data at the URI
func (*IpfsStorage) Upload ¶
func (ipfs *IpfsStorage) Upload(data interface{}, contractAddress string, signerAddress string) (string, error)
Upload
Upload method can be used to upload a generic payload to IPFS.
data: the individual data to upload to IPFS
contractAddress: the optional contractAddress upload is being called from
signerAddress: the optional signerAddress upload is being called from
returns: the URI of the IPFS upload
func (*IpfsStorage) UploadBatch ¶
func (ipfs *IpfsStorage) UploadBatch(data []interface{}, fileStartNumber int, contractAddress string, signerAddress string) (*baseUriWithUris, error)
UploadBatch
UploadBatch method can be used to upload a batch of generic payloads to IPFS.
data: the array of data to upload to IPFS
contractAddress: the optional contractAddress upload is being called from
signerAddress: the optional signerAddress upload is being called from
returns: the base URI of the IPFS upload folder with the URIs of each subfile
type Multiwrap ¶
type Multiwrap struct { *ERC721 // contains filtered or unexported fields }
You can access the Multiwrap interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetMultiwrap("{{contract_address}}")
func (*Multiwrap) GetWrappedContents ¶
func (multiwrap *Multiwrap) GetWrappedContents(wrappedTokenId int) (*MultiwrapBundle, error)
Get the contents of a wrapped token bundle.
wrappedTokenId: the ID of the wrapped token bundle
returns: the contents of the wrapped token bundle
Example
tokenId := 0 contents, err := contract.GetWrappedContents(tokenId) erc20Tokens := contents.Erc20Tokens erc721Tokens := contents.Erc721Tokens erc1155Tokens := contents.Erc1155Tokens
func (*Multiwrap) Unwrap ¶
func (multiwrap *Multiwrap) Unwrap(wrappedTokenId int, recipientAddress string) (*types.Transaction, error)
Unwrap a wrapped token bundle into its contents
wrappedTokenId: the ID of the wrapped token bundle
recipientAddress: the optional address to send the wrapped token to
returns: the contents of the wrapped token bundle
Example
tokenId := 0 tx, err := contract.Unwrap(tokenId, "")
func (*Multiwrap) Wrap ¶
func (multiwrap *Multiwrap) Wrap(contents *MultiwrapBundle, wrappedTokenMetadata interface{}, recipientAddress string) (*types.Transaction, error)
Wrap any number of ERC20, ERC721, or ERC1155 tokens into a single wrapped token
contents: the tokens to wrap into a single wrapped token
wrappedTokenMetadata: the NFT Metadata or URI to as the metadata for the wrapped token
recipientAddress: the optional address to send the wrapped token to
returns: the transaction receipt of the wrapping
Example
contents := &akhira.MultiwrapBundle{ ERC20Tokens: []*akhira.MultiwrapERC20{ &akhira.MultiwrapERC20{ ContractAddress: "0x...", Quantity: 1, }, }, ERC721Tokens: []*akhira.MultiwrapERC721{ &akhira.MultiwrapERC721{ ContractAddress: "0x...", TokenId: 1, }, }, ERC1155Tokens: []*akhira.MultiwrapERC1155{ &akhira.MultiwrapERC1155{ ContractAddress: "0x...", TokenId: 1, Quantity: 1, }, }, } wrappedTokenMetadata := &akhira.NFTMetadataInput{ Name: "Wrapped Token" } // This will mint the wrapped token to the connected wallet tx, err := contract.Wrap(contents, wrappedTokenMetadata, "")
type MultiwrapBundle ¶
type MultiwrapBundle struct { ERC20Tokens []*MultiwrapERC20 ERC721Tokens []*MultiwrapERC721 ERC1155Tokens []*MultiwrapERC1155 }
type MultiwrapERC1155 ¶
type MultiwrapERC20 ¶
type MultiwrapERC721 ¶
type NFTCollection ¶
type NFTCollection struct { *ERC721 Signature *ERC721SignatureMinting // contains filtered or unexported fields }
You can access the NFT Collection interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetNFTCollection("{{contract_address}}")
func (*NFTCollection) GetOwned ¶
func (nft *NFTCollection) GetOwned(address string) ([]*NFTMetadataOwner, error)
Get the metadatas of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the metadata of all the NFTs owned by the address
Example
owner := "{{wallet_address}}" nfts, err := contract.GetOwned(owner) name := nfts[0].Metadata.Name
func (*NFTCollection) GetOwnedTokenIDs ¶
func (nft *NFTCollection) GetOwnedTokenIDs(address string) ([]*big.Int, error)
Get the tokenIds of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the tokenIds of all the NFTs owned by the address
func (*NFTCollection) Mint ¶
func (nft *NFTCollection) Mint(metadata *NFTMetadataInput) (*types.Transaction, error)
Mint a new NFT to the connected wallet.
metadata: metadata of the NFT to mint
returns: the transaction receipt of the mint
func (*NFTCollection) MintBatch ¶
func (nft *NFTCollection) MintBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Mint a batch of new NFTs to the connected wallet.
metadatas: list of metadata of the NFTs to mint
returns: the transaction receipt of the mint
func (*NFTCollection) MintBatchTo ¶
func (nft *NFTCollection) MintBatchTo(address string, metadatas []*NFTMetadataInput) (*types.Transaction, error)
Mint a batch of new NFTs to the specified wallet.
to: the wallet address to mint to
metadatas: list of metadata of the NFTs to mint
returns: the transaction receipt of the mint
Example
metadatas := []*akhira.NFTMetadataInput{ &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", } &akhira.NFTMetadataInput{ Name: "Cool NFT 2", Description: "This is also a cool NFT", } } tx, err := contract.MintBatchTo("{{wallet_address}}", metadatas)
func (*NFTCollection) MintTo ¶
func (nft *NFTCollection) MintTo(address string, metadata *NFTMetadataInput) (*types.Transaction, error)
Mint a new NFT to the specified wallet.
address: the wallet address to mint to
metadata: metadata of the NFT to mint
returns: the transaction receipt of the mint
Example
image, err := os.Open("path/to/image.jpg") defer image.Close() metadata := &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image, } tx, err := contract.MintTo("{{wallet_address}}", metadata)
type NFTDrop ¶
type NFTDrop struct { *ERC721 // contains filtered or unexported fields }
You can access the NFT Drop interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetNFTDrop("{{contract_address}}")
func (*NFTDrop) Claim ¶
func (drop *NFTDrop) Claim(quantity int) (*types.Transaction, error)
Claim NFTs from this contract to the connect wallet.
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
func (*NFTDrop) ClaimTo ¶
Claim NFTs from this contract to the connect wallet.
destinationAddress: the address of the wallet to claim the NFTs to
quantity: the number of NFTs to claim
returns: the transaction receipt of the claim
Example
address := "{{wallet_address}}" quantity = 1 tx, err := contract.ClaimTo(address, quantity)
func (*NFTDrop) CreateBatch ¶
func (drop *NFTDrop) CreateBatch(metadatas []*NFTMetadataInput) (*types.Transaction, error)
Create a batch of NFTs on this contract.
metadatas: a list of the metadatas of the NFTs to create
returns: the transaction receipt of the batch creation
Example
image0, err := os.Open("path/to/image/0.jpg") defer image0.Close() image1, err := os.Open("path/to/image/1.jpg") defer image1.Close() metadatas := []*akhira.NFTMetadataInput{ &akhira.NFTMetadataInput{ Name: "Cool NFT", Description: "This is a cool NFT", Image: image1 } &akhira.NFTMetadataInput{ Name: "Cool NFT 2", Description: "This is also a cool NFT", Image: image2 } } tx, err := contract.CreateBatch(metadatas)
func (*NFTDrop) GetAllClaimed ¶
func (drop *NFTDrop) GetAllClaimed() ([]*NFTMetadataOwner, error)
Get a list of all the NFTs that have been claimed from this contract.
returns: a list of the metadatas of the claimed NFTs
Example
claimedNfts, err := contract.GetAllClaimed() firstOwner := claimedNfts[0].Owner
func (*NFTDrop) GetAllUnclaimed ¶
func (drop *NFTDrop) GetAllUnclaimed() ([]*NFTMetadata, error)
Get a list of all the NFTs on this contract that have not yet been claimed.
returns: a list of the metadatas of the unclaimed NFTs
Example
unclaimedNfts, err := contract.GetAllUnclaimed() firstNftName := unclaimedNfts[0].Name
func (*NFTDrop) GetOwned ¶
func (nft *NFTDrop) GetOwned(address string) ([]*NFTMetadataOwner, error)
Get the metadatas of all the NFTs owned by a specific address.
address: the address of the owner of the NFTs
returns: the metadata of all the NFTs owned by the address
Example
owner := "{{wallet_address}}" nfts, err := contract.GetOwned(owner) name := nfts[0].Metadata.Name
type NFTMetadata ¶
type NFTMetadata struct { Id *big.Int `json:"id"` Uri string `json:"uri"` Name string `json:"name"` Description string `json:"description"` Image interface{} `json:"image"` ExternalUrl string `json:"external_url"` AnimationUrl string `json:"animation_url"` BackgroundColor string `json:"background_color"` Properties interface{} `json:"properties,omitempty"` }
type NFTMetadataInput ¶
type NFTMetadataInput struct { Name string `json:"name"` Description string `json:"description"` Image interface{} `json:"image"` ExternalUrl string `json:"external_url"` AnimationUrl string `json:"animation_url"` BackgroundColor string `json:"background_color"` Properties interface{} `json:"properties,omitempty"` }
type NFTMetadataOwner ¶
type NFTMetadataOwner struct { Metadata *NFTMetadata Owner string }
type NativeToken ¶
type NativeToken struct {
// contains filtered or unexported fields
}
type ProviderHandler ¶
type ProviderHandler struct {
// contains filtered or unexported fields
}
func NewProviderHandler ¶
func NewProviderHandler(provider *ethclient.Client, privateKey string) (*ProviderHandler, error)
func (*ProviderHandler) GetChainID ¶
func (handler *ProviderHandler) GetChainID() (*big.Int, error)
func (*ProviderHandler) GetPrivateKey ¶
func (handler *ProviderHandler) GetPrivateKey() *ecdsa.PrivateKey
func (*ProviderHandler) GetProvider ¶
func (handler *ProviderHandler) GetProvider() *ethclient.Client
func (*ProviderHandler) GetRawPrivateKey ¶
func (handler *ProviderHandler) GetRawPrivateKey() string
func (*ProviderHandler) GetSignerAddress ¶
func (handler *ProviderHandler) GetSignerAddress() common.Address
func (*ProviderHandler) UpdatePrivateKey ¶
func (handler *ProviderHandler) UpdatePrivateKey(privateKey string) error
func (*ProviderHandler) UpdateProvider ¶
func (handler *ProviderHandler) UpdateProvider(provider *ethclient.Client)
type SDKOptions ¶
type SignedPayload1155 ¶
type SignedPayload1155 struct { Payload *Signature1155PayloadOutput Signature []byte }
type SignedPayload721 ¶
type SignedPayload721 struct { Payload *Signature721PayloadOutput Signature []byte }
type SmartContract ¶
type SmartContract struct {
// contains filtered or unexported fields
}
Custom Contracts
With the akhira SDK, you can get a contract instance for any contract. Additionally, if you deployed your contract using akhira deploy, you can get a more explicit and intuitive interface to interact with your contracts.
Getting a Custom Contract Instance ¶
Let's take a look at how you can get a custom contract instance for one of your contracts deployed using the akhira deploy flow:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) // You can replace your own contract address here contractAddress := "{{contract_address}}" // Now you have a contract instance ready to go contract, err := sdk.GetContract(contractAddress)
Alternatively, if you didn't deploy your contract with akhira deploy, you can still get a contract instance for any contract using your contracts ABI:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) // You can replace your own contract address here contractAddress := "{{contract_address}}" // Add your contract ABI here abi := "[...]" // Now you have a contract instance ready to go contract, err := sdk.GetContractFromAbi(contractAddress, abi)
Calling Contract Functions ¶
Now that you have an SDK instance for your contract, you can easily call any function on your contract with the contract "call" method as follows:
// The first parameter to the call function is the method name // All other parameters to the call function get passed as arguments to your contract balance, err := contract.Call("balanceOf", "{{wallet_address}}") // You can also make a transaction to your contract with the call method tx, err := contract.Call("mintTo", "{{wallet_address}}", "ipfs://...")
func (*SmartContract) Call ¶
func (c *SmartContract) Call(method string, args ...interface{}) (interface{}, error)
Call any function on your contract.
method: the name of the method on your contract you want to call
args: the arguments to pass to the method
Example
// The first parameter to the call function is the method name // All other parameters to the call function get passed as arguments to your contract balance, err := contract.Call("balanceOf", "{{wallet_address}}") // You can also make a transaction to your contract with the call method tx, err := contract.Call("mintTo", "{{wallet_address}}", "ipfs://...")
type Token ¶
type Token struct { *ERC20 // contains filtered or unexported fields }
You can access the Token interface from the SDK as follows:
import ( "github.com/akhirachain/go-sdk/akhira" ) privateKey = "..." sdk, err := akhira.NewAkhiraSDK("mumbai", &akhira.SDKOptions{ PrivateKey: privateKey, }) contract, err := sdk.GetToken("{{contract_address}}")
func (*Token) DelegateTo ¶
func (token *Token) DelegateTo(delegatreeAddress string) (*types.Transaction, error)
Delegate the connected wallets tokens to a specified wallet.
delegateeAddress: wallet address to delegate tokens to
returns: transaction receipt of the delegation
func (*Token) GetDelegation ¶
Get the connected wallets delegatee address for this token.
returns: delegation address of the connected wallet
func (*Token) GetDelegationOf ¶
Get a specified wallets delegatee for this token.
returns: delegation address of the connected wallet
func (*Token) GetVoteBalance ¶
func (token *Token) GetVoteBalance() (*CurrencyValue, error)
Get the connected wallets voting power in this token.
returns: vote balance of the connected wallet
func (*Token) GetVoteBalanceOf ¶
func (token *Token) GetVoteBalanceOf(address string) (*CurrencyValue, error)
Get the voting power of the specified wallet in this token.
address: wallet address to check the vote balance of
returns: vote balance of the specified wallet
func (*Token) Mint ¶
func (token *Token) Mint(amount float64) (*types.Transaction, error)
Mint tokens to the connected wallet.
amount: amount of tokens to mint
returns: transaction receipt of the mint
func (*Token) MintBatchTo ¶
func (token *Token) MintBatchTo(args []*TokenAmount) (*types.Transaction, error)
Mint tokens to a list of wallets.
args: list of wallet addresses and amounts to mint
returns: transaction receipt of the mint
Example
args = []*akhira.TokenAmount{ &akhira.TokenAmount{ ToAddress: "{{wallet_address}}", Amount: 1 } &akhira.TokenAmount{ ToAddress: "{{wallet_address}}", Amount: 2 } } tx, err := contract.MintBatchTo(args)
type TokenAmount ¶
type WrappedToken ¶
type WrappedToken struct {
// contains filtered or unexported fields
}
Source Files
¶
- common.go
- constants.go
- contract_helper.go
- edition.go
- edition_drop.go
- edition_drop_claim_conditions.go
- erc1155.go
- erc1155_signature_minting.go
- erc20.go
- erc721.go
- erc721_signature_minting.go
- error.go
- ipfs_storage.go
- multiwrap.go
- nft_collection.go
- nft_drop.go
- nft_drop_claim_conditions.go
- provider_handler.go
- sdk.go
- smart_contract.go
- token.go
- types.go