Search
⌃K
Links

Voxlink API

This provides a generic description of all offered methods of the Voxlink JavaScript library

Methods

Voxlink.setWeb3Provider(provider): Void
This method allows you to set your own web3 provider. Note that our library performs low level calls and does not require a web3 library. You might though have implemented a tunnel (e.g. WalletConnect) in which case you would want to use a web3 provider connected to that tunnel. The passed provider will be then used to perform the calls.
async Voxlink.connect(): Void
This method is automatically called before interacting with the blockchain, but you can call it yourself in order to trigger a connection request to the web3 provider. After the connection, the connected wallet address will be populated as a checksummed string in the following attribute:
Voxlink.connectedWallet
async Voxlink.disconnect(): Void
This method resets the Voxlink.connectedWallet attribute. There is no possibility to programmatically disconnect a wallet, as this is an action that the user has to perform.
Voxlink.toChecksumAddress(address): String
This method accepts an Ethereum address as a string and returns the checksummed version of it. Mostly you need the checksummed version in order to perform low-level calls. Web3 libraries normally take care of this for you.
async Voxlink.resolveName(name): String
This method accepts a string name containing an ENS domain name (such as "voxlink.eth") and resolves the owner of that address from the ENS registry.
async Voxlink.balanceOf(collectionAddress, account): Integer
This method retrieves the amount of tokens an account owns at a specific collection address. If the given account is linked through a voxlink with a main wallet, that account is treated as a burner wallet and the result will be for the main wallet.
This methods tries to determine the type of token behind the collectionAddress (ERC721, ERC1155 and ERC20). In the case of ERC1155, the retrieval is a bit more complex as the IDs are first retrieved by scanning all transfer events emitted. The result is an integer.
async Voxlink.hasTokens(collectionAddress, account): Boolean
This method internally calls "Voxlink.balanceOf" and checks if the amount is greater than zero. This returns a boolean.