Add web wallet integration
Closed this issue · 8 comments
As an alternative to manually copy/pasting the inscription id and signature, the team at Hiro have updated their web wallet to perform BIP-322 signatures.
Essentially this will just require us passing through the unique message
that we create in #10 into await window.btc.request('signMessage', { message: '<insert here>' })
and await the signature callback from their wallet.
@rk1129 we have added a landing page that has a proper design - you can see that here: https://github.com/muncheruniverse/dev-zone/pull/1
Please complete the support for Hiro wallet by knitting it into the relevant button on this landing page.
We now have BIP-322 code from the Unisat team, you can load that with the attached zip.
unisat-chrome-v1.1.16-beta.1.zip
Call this method:
unisat.signMessage("Hello World","bip322-simple").then(v=>console.log(v))
Unisat has now been merged to their production release.
- Catch
TokenExpiredError: jwt expired
- Auto detect installed wallets and disable Verify buttons where relevant
- Add unisat wallet
- Improve the DB query when selecting an existing wallet:
Select a wallet which has multiple inscriptions and it will do the full query for each inscription id:
Executing (default): SELECT `id`, `userId`, `walletAddress`, `createdAt`, `updatedAt` FROM `UserAddresses` AS `UserAddresses` WHERE `UserAddresses`.`id` = 4;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = '987af6319b866f7e4692ab6c6a38ed738e92067f4575f6cfd83cab89c174de03i0' LIMIT 1;
Executing (default): SELECT `id`, `userAddressId`, `inscriptionId`, `createdAt`, `updatedAt`, `deletedAt` FROM `UserInscriptions` AS `UserInscriptions` WHERE (`UserInscriptions`.`deletedAt` IS NULL AND `UserInscriptions`.`inscriptionId` = 30) LIMIT 1;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = 'e59f7f15fdd974c0f15b5b4c651dcd6ff2d7fca06f6f2daf7884a25d1067aa38i0' LIMIT 1;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = '12c6d93bd199a3c3d8f84beade6f578fd47bfc176911394712f8ae5cf8b40e7bi0' LIMIT 1;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = 'c37f0d1eb4c8983e96430bd4a75821a3dac8beaf0f2773ee0517370960612761i0' LIMIT 1;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = '1cbb42eac9f1ef31570c7c67f5d7a97534d46cb4af76b09d6ff4f2cf2b499972i0' LIMIT 1;
Executing (default): SELECT `Inscriptions`.`id`, `Inscriptions`.`collectionId`, `Inscriptions`.`inscriptionRef`, `Inscriptions`.`createdAt`, `Inscriptions`.`updatedAt`, `Collection`.`id` AS `Collection.id`, `Collection`.`name` AS `Collection.name`, `Collection`.`channelId` AS `Collection.channelId`, `Collection`.`role` AS `Collection.role`, `Collection`.`deletedAt` AS `Collection.deletedAt`, `Collection`.`createdAt` AS `Collection.createdAt`, `Collection`.`updatedAt` AS `Collection.updatedAt` FROM `Inscriptions` AS `Inscriptions` INNER JOIN `Collections` AS `Collection` ON `Inscriptions`.`collectionId` = `Collection`.`id` AND (`Collection`.`deletedAt` IS NULL AND `Collection`.`channelId` = '1091309753348665354') WHERE `Inscriptions`.`inscriptionRef` = 'aeb37580e46db29e82dddedca625b855e6277e5c4040daeed75d9b09199358fei0' LIMIT 1;
Executing (default): SELECT `Collections`.`id`, `Collections`.`name`, `Collections`.`role`, COUNT(`Inscriptions`.`id`) AS `inscriptionCount` FROM `Collections` AS `Collections` LEFT OUTER JOIN ( `Inscriptions` AS `Inscriptions` INNER JOIN `UserInscriptions` AS `Inscriptions->UserInscriptions` ON `Inscriptions`.`id` = `Inscriptions->UserInscriptions`.`inscriptionId` AND (`Inscriptions->UserInscriptions`.`deletedAt` IS NULL AND `Inscriptions->UserInscriptions`.`userAddressId` = 4) ) ON `Collections`.`id` = `Inscriptions`.`collectionId` WHERE (`Collections`.`deletedAt` IS NULL AND `Collections`.`channelId` = '1091309753348665354') GROUP BY `Collections`.`id` HAVING `inscriptionCount` > 0;
This will not scale well, especially for large wallets. So this should be changed to grabbing all the matching inscription ids first, and performing a:
SELECT id, inscriptionRef FROM Inscriptions WHERE inscriptionRef IN ('aeb37580e46db29e82dddedca625b855e6277e5c4040daeed75d9b09199358fei0', '...', '...');
This can be used as the loop to determine which inscriptions should be searched.
this is sorted