diff --git a/src/classes/mnemonicSigner.ts b/src/classes/mnemonicSigner.ts index 10cf15a..b889ef8 100644 --- a/src/classes/mnemonicSigner.ts +++ b/src/classes/mnemonicSigner.ts @@ -1,5 +1,5 @@ import { AccountData, DirectSignResponse, OfflineDirectSigner } from '@cosmjs/proto-signing' -import { AminoSignResponse, StdSignDoc, OfflineAminoSigner } from '@cosmjs/amino' +import { AminoSignResponse, OfflineAminoSigner, StdSignDoc } from '@cosmjs/amino' import { IMnemonicSigner, ISignDoc } from '@/interfaces' export class MnemonicSigner implements IMnemonicSigner { diff --git a/src/classes/storageHandler.ts b/src/classes/storageHandler.ts index be378ca..fa5e464 100644 --- a/src/classes/storageHandler.ts +++ b/src/classes/storageHandler.ts @@ -2207,7 +2207,7 @@ export class StorageHandler extends EncodingHandler implements IStorageHandler { }) if (providerIps.length >= copies) { const fakeResponse: IProviderUploadResponse = { - merkle: hexToBuffer(merkle), + merkle: hexToBuffer(merkle), owner: this.jklAddress, start: uploadHeight, } diff --git a/src/interfaces/classes/IRnsHandler.ts b/src/interfaces/classes/IRnsHandler.ts index 3b41920..7d62b0e 100644 --- a/src/interfaces/classes/IRnsHandler.ts +++ b/src/interfaces/classes/IRnsHandler.ts @@ -19,6 +19,7 @@ import { IPageRequest, IRegisterOptions, IRemoveSubRnsOptions, + ISetNewPrimaryOptions, ITransferOptions, IUpdateOptions, IWrappedEncodeObject, diff --git a/src/interfaces/classes/IWasmHandler.ts b/src/interfaces/classes/IWasmHandler.ts index 9f6dfca..1cd469b 100644 --- a/src/interfaces/classes/IWasmHandler.ts +++ b/src/interfaces/classes/IWasmHandler.ts @@ -4,13 +4,13 @@ export interface IWasmHandler { instantiateICA ( contractAddress: string, connectionIdA: string, - connectionIdB: string + connectionIdB: string, ): Promise reOpenChannel ( contractAddress: string, connectionIdA: string, - connectionIdB: string + connectionIdB: string, ): Promise getICAContractAddress (contractAddress: string): Promise diff --git a/src/utils/converters.ts b/src/utils/converters.ts index 4b1934d..de31bd1 100644 --- a/src/utils/converters.ts +++ b/src/utils/converters.ts @@ -252,48 +252,48 @@ async function extractThumbnailFromVideo (file: File): Promise { const processor: Promise = new Promise((resolve, reject) => { const video = document.createElement('video') - video.src = URL.createObjectURL(file) - video.muted = true // Mute the video to prevent sound playing - video.playsInline = true - - video.onloadedmetadata = () => { - const duration = video.duration - const randomTime = Math.random() * duration // Select a random time point in the video - video.currentTime = randomTime // Seek to the random time - - video.onseeked = () => { - // Set the maximum dimension to 256 - const maxSize = 256 - let { videoWidth: width, videoHeight: height } = video - - // Maintain aspect ratio when resizing - if (width > height) { - if (width > maxSize) { - height *= maxSize / width - width = maxSize - } - } else { - if (height > maxSize) { - width *= maxSize / height - height = maxSize - } + video.src = URL.createObjectURL(file) + video.muted = true // Mute the video to prevent sound playing + video.playsInline = true + + video.onloadedmetadata = () => { + const duration = video.duration + const randomTime = Math.random() * duration // Select a random time point in the video + video.currentTime = randomTime // Seek to the random time + + video.onseeked = () => { + // Set the maximum dimension to 256 + const maxSize = 256 + let { videoWidth: width, videoHeight: height } = video + + // Maintain aspect ratio when resizing + if (width > height) { + if (width > maxSize) { + height *= maxSize / width + width = maxSize } + } else { + if (height > maxSize) { + width *= maxSize / height + height = maxSize + } + } - const canvas = document.createElement('canvas') - const ctx = canvas.getContext('2d') + const canvas = document.createElement('canvas') + const ctx = canvas.getContext('2d') - // Set canvas dimensions to the resized dimensions - canvas.width = width - canvas.height = height + // Set canvas dimensions to the resized dimensions + canvas.width = width + canvas.height = height - // Draw the current video frame onto the resized canvas - ctx?.drawImage(video, 0, 0, width, height) + // Draw the current video frame onto the resized canvas + ctx?.drawImage(video, 0, 0, width, height) - // Convert the canvas to a WebP image - const base64String = canvas.toDataURL('image/webp', 0.25) // 25% compression - resolve(base64String) - } + // Convert the canvas to a WebP image + const base64String = canvas.toDataURL('image/webp', 0.25) // 25% compression + resolve(base64String) } + } video.onerror = reject }) @@ -306,7 +306,7 @@ async function extractThumbnailFromVideo (file: File): Promise { } /** - * + * * @param {File} file * @returns {Promise} */ @@ -317,44 +317,44 @@ async function convertToWebP (file: File): Promise { const img = new Image() img.src = event.target?.result as string - img.onload = () => { - const maxSize = 256 - let { width, height } = img - - // Calculate new dimensions while maintaining aspect ratio - if (width > height) { - if (width > maxSize) { - height *= maxSize / width - width = maxSize - } - } else { - if (height > maxSize) { - width *= maxSize / height - height = maxSize - } + img.onload = () => { + const maxSize = 256 + let { width, height } = img + + // Calculate new dimensions while maintaining aspect ratio + if (width > height) { + if (width > maxSize) { + height *= maxSize / width + width = maxSize } + } else { + if (height > maxSize) { + width *= maxSize / height + height = maxSize + } + } - const canvas = document.createElement('canvas') - const ctx = canvas.getContext('2d') + const canvas = document.createElement('canvas') + const ctx = canvas.getContext('2d') - if (!ctx) { - return reject('Canvas context is unavailable') - } + if (!ctx) { + return reject('Canvas context is unavailable') + } - // Set canvas dimensions to the resized dimensions - canvas.width = width - canvas.height = height + // Set canvas dimensions to the resized dimensions + canvas.width = width + canvas.height = height - // Draw resized image onto the canvas - ctx.drawImage(img, 0, 0, width, height) + // Draw resized image onto the canvas + ctx.drawImage(img, 0, 0, width, height) - // Convert canvas to WebP format and get Base64 string - canvas.toDataURL('image/webp', 0.25) // 25% compression - const base64String = canvas.toDataURL('image/webp', 0.25) - // console.log(base64String) - resolve(base64String) - } + // Convert canvas to WebP format and get Base64 string + canvas.toDataURL('image/webp', 0.25) // 25% compression + const base64String = canvas.toDataURL('image/webp', 0.25) + // console.log(base64String) + resolve(base64String) } + } reader.onerror = reject reader.readAsDataURL(file) diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 2a65e0d..9a15ed9 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -7,5 +7,6 @@ declare global { interface Window extends KeplrWindow, LeapWindow { mnemonicWallet?: MnemonicWallet } + var mnemonicWallet: MnemonicWallet }