Authorization
Authenticating using NFTs
const allRecords = await (wallet?.adapter as LeoWalletAdapter).requestRecords(NFTProgramId);
const nftRecords = allRecords.filter((record: any) => record.data.edition && record.spent === false);const aleoTransaction = Transaction.createTransaction(
publicKey!,
WalletAdapterNetwork.Testnet,
NFTProgramId,
'authorize',
[nftRecords[0], '101u64'], // This should be a random number in production, generated on the back end of a DApp
0,
);
const txId = await (wallet?.adapter as LeoWalletAdapter).requestExecution(aleoTransaction);const newStatus = await (wallet?.adapter as LeoWalletAdapter).transactionStatus(txId);
if (newStatus === 'Finalized') {
const execution = await (window as any).leoWallet.getExecution(
transactionId
);
console.log(execution);
}Last updated