77 // @ts-ignore
88 import { createIcon } from ' @download/blockies' ;
99 import alertDialog from ' src/components/alertDialog.vue'
10+ import QrCodeDialog from ' ../qr/qrCodeScanDialog.vue' ;
1011 import type { TokenDataNFT , BcmrTokenMetadata , TokenSendRequestParams , TokenMintRequestParams , TokenBurnRequestParams } from " src/interfaces/interfaces"
1112 import { querySupplyNFTs , queryActiveMinting } from " src/queryChainGraph"
1213 import { copyToClipboard } from ' src/utils/utils' ;
4344 const startingNumberNFTs = ref (undefined as string | undefined );
4445 const totalNumberNFTs = ref (undefined as number | undefined );
4546 const hasMintingNFT = ref (undefined as boolean | undefined );
47+ const showQrCodeDialog = ref (false );
4648
4749 let fetchedMetadataChildren = false
4850
106108 displayChildNfts .value = ! displayChildNfts .value ;
107109 }
108110
111+ const qrDecode = (content : string ) => {
112+ destinationAddr .value = content ;
113+ }
114+ const qrFilter = (content : string ) => {
115+ const decoded = decodeCashAddress (content );
116+ if (typeof decoded === " string" || decoded .prefix !== store .wallet ?.networkPrefix ) {
117+ return " Not a cashaddress on current network" ;
118+ }
119+ return true ;
120+ }
109121 // NFT Group specific functionality
110122 async function sendAllNfts(){
111123 try {
497509
498510 <div v-if =" displaySendNft" style =" margin-top : 10px ;" >
499511 Send this NFT to
500- <p class =" grouped" >
501- <input v-model =" destinationAddr" name =" tokenAddress" placeholder =" token address" >
512+ <div class =" inputGroup" >
513+ <div class =" addressInputNftSend" >
514+ <input v-model =" destinationAddr" name =" tokenAddress" placeholder =" token address" >
515+ <button v-if =" settingsStore.qrScan" @click =" () => showQrCodeDialog = true" style =" padding : 12px " >
516+ <img src =" images/qrscan.svg" />
517+ </button >
518+ </div >
502519 <input @click =" sendNft()" type =" button" class =" primaryButton" value =" Send NFT" >
503- </p >
520+ </div >
504521 </div >
505522 <div v-if =" displaySendAllNfts" style =" margin-top : 10px ;" >
506523 Send all {{ tokenData.nfts?.length }} NFTs of this category to
507- <p class =" grouped" >
508- <input v-model =" destinationAddr" name =" tokenAddress" placeholder =" token address" >
524+ <div class =" inputGroup" >
525+ <div class =" addressInputNftSend" >
526+ <input v-model =" destinationAddr" name =" tokenAddress" placeholder =" token address" >
527+ <button v-if =" settingsStore.qrScan" @click =" () => showQrCodeDialog = true" style =" padding : 12px " >
528+ <img src =" images/qrscan.svg" />
529+ </button >
530+ </div >
509531 <input @click =" sendAllNfts()" type =" button" class =" primaryButton" value =" Transfer NFTs" >
510- </p >
532+ </div >
511533 </div >
512534 <div v-if =" displayMintNfts" style =" margin-top : 10px ;" >
513535 Mint a number of (unique) NFTs to a specific address
559581 </div >
560582 </div >
561583 </div >
584+ <div v-if =" showQrCodeDialog" >
585+ <QrCodeDialog @hide =" () => showQrCodeDialog = false" @decode =" qrDecode" :filter =" qrFilter" />
586+ </div >
562587</template >
0 commit comments