OnceSyncERC721
ERC721 related APIs
https://docs.openzeppelin.com/contracts/4.x/api/token/erc721#ERC721
export interface OneSyncERC721Client extends ERC721Client {
connectProvider(
address: string,
provider: Provider
): Promise<OneSyncERC721Client>;
connectSigner(signer: Signer): OneSyncERC721Client;
setWaitConfirmations(num: number): void;
owner(config?: CallOverrides): Promise<string>;
implementationVersion(config?: CallOverrides): Promise<string>;
tokenVersion(tokenId: BigNumber, config?: CallOverrides): Promise<BigNumber>;
locked(tokenId: BigNumber, config?: CallOverrides): Promise<boolean>;
lock(tokenId: BigNumber, config?: PayableOverrides): Promise<ContractReceipt>;
unLock(
tokenId: BigNumber,
version: BigNumber,
signature: string,
config?: PayableOverrides
): Promise<ContractReceipt>;
mintWithSignature(
to: string,
tokenId: BigNumber,
isLocked: boolean,
nonce: string,
signature: string,
config?: PayableOverrides
): Promise<ContractReceipt>;
mintBatchWithSignature(
to: string,
tokenIds: Array<BigNumber>,
isLocked: boolean,
nonce: string,
signature: string,
config?: PayableOverrides
): Promise<ContractReceipt>;
burn(tokenId: BigNumber, config?: PayableOverrides): Promise<ContractReceipt>;
burnBatch(tokenIds: Array<BigNumber>, config?: PayableOverrides): Promise<ContractReceipt>;
burnBatchWithSignature(
tokenIds: Array<BigNumber>,
nonce: string,
signature: string,
config?: PayableOverrides
): Promise<ContractReceipt>;
}
Usage:
Browser:
const web3Provider = new ethers.providers.Web3Provider(window.ethereum);
await web3Provider.current.send('eth_requestAccounts', []);
const signer = ethProvider.current.getSigner();
const contractAddress = '0x......';
const nftClient = EtherOneSyncERC721Client();
await nftClient.connectProvider(contractAddress, web3Provider);
nftClient.connectSigner(signer);
nftClient.setWaitConfirmations(1);