Skip to main content

EvmERC721RouterSDK

The EvmERC721RouterSDK class is an extension of the SDK designed to interact with ERC721 routers in the Ethereum environment. This class facilitates the management and operation of ERC721 tokens, including functionalities for approving tokens, querying balances, and handling cross-chain transactions.

This module will be registered by default when using the TeleportFactory, so you can access its methods through the dapp function.

We recommend using typescript, so that you can specify the expected module type, in order to access all module-specific methods and properties.

import { ERC721RouterSDK } from "@stichting-allianceblock-foundation/abridge-sdk";

const erc721Module = await sdk.dapp<ERC721RouterSDK>(ERC721RouterSDK.DAPP_NAME);

Now that you have an instance of your module, you can use all of its methods and properties. Remember that each module can have different methods and properties, as defined by the developer.

Methods

approveNfts

approveNfts(collectionAddress: string): PayableCall

Approves a specific NFT collection for transfer or other operations by the smart contract, requiring a transaction to be signed and sent.

getNativeTokenByWrappedAddress

async getNativeTokenByWrappedAddress(wrappedTokenAddress: string): Promise<NativeTokenInfo>

Retrieves information about the native token that corresponds to a wrapped token address on a different blockchain.

getWrappedForNativeToken

async getWrappedForNativeToken(nativeChainId: number, nativeToken: string): Promise<string>

Determines the wrapped token address for a native token on another blockchain, facilitating cross-chain token transfers.

getProviderFee

async getProviderFee({targetChainId, assets, userAddress, extraArgs, providerAddress }: SendNftTokensOptions): Promise<BigNumber>

Calculates the provider's fee for a transaction involving NFT assets based on the specified chain, assets, and additional parameters.

getServiceFee

async getServiceFee({targetChainId, assets, userAddress, extraArgs, providerAddress }: SendNftTokensOptions): Promise<BigNumber>

Estimates the service fee for processing an NFT transaction on a specific target chain, taking into account the assets and transaction details.

getUserCollections

async getUserCollections(userAddress: string, chainIdent: string, openseaApiKey?: string)

Fetches all NFT collections owned by a user on a specific blockchain, optionally utilizing an OpenSea API key for enhanced data retrieval.

getUserAssets

async getUserAssets(userAddress: string, chainIdent: string, openseaApiKey?: string)

Retrieves all NFT assets owned by a user on a specified chain, with an option to enhance the query using an OpenSea API key.

getUserAssetsByCollection

async getUserAssetsByCollection(userAddress: string, collectionAddress: string, chainIdent: string, openseaApiKey?: string)

Fetches all NFTs from a specific collection that are owned by a user on a designated chain, optionally using an OpenSea API key for data access.

isNftsApproved

async isNftsApproved(userAddress: string, collectionAddress: string): Promise<boolean>

Checks whether a user has approved a specific NFT collection for use by the smart contract, returning a boolean result.

loadTokenByAddressAndId

async loadTokenByAddressAndId(collectionAddress: string, id: string, userAddress: string, skipOwnerCheck = false)

Loads a specific token by its contract address and ID, with an option to skip the owner verification step if not necessary.

loadTokensByCollectionAddress

async loadTokensByCollectionAddress(collectionAddress: string)

Retrieves all tokens within a specific NFT collection based on the contract address.

supportInterface

async supportInterface(collectionAddress: string)

Determines if the given collection address supports a specific ERC interface, facilitating interactions with various ERC standards.

getTargetERC721RouterContract

async getTargetERC721RouterContract(targetChainId: number, defaultRpc?: boolean)

Retrieves the ERC721 router contract on the target blockchain, allowing interactions such as transfers and queries.

getERC721RouterDeliveryGas

async getERC721RouterDeliveryGas(sourceChainId: number, targetChainId: number, collections: any): Promise<number>

Estimates the gas costs associated with delivering NFTs via the ERC721 router between two specified chains.

estimateDeliveryGas

async estimateDeliveryGas(sourceChainId: number, targetChainId: number, collections: any)

Calculates the total gas required for delivering NFT collections across blockchain networks.

calculateExtraArg

async calculateExtraArg({ targetChainId, collections })

Computes additional arguments needed for NFT transactions, typically involving gas calculations or other specific parameters.

sendNftTokens

sendNftTokens({ targetChainId, assets, userAddress, fee, extraArgs, providerAddress}: SendNftTokensOptions): PayableCall

Executes a transaction to send ERC721 tokens across chains, handling various transaction types including those that require permits and additional fee handling, configurable by extensive options.