Skip to content

Commit

Permalink
v3.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Aug 6, 2024
1 parent 6ccc97b commit 6ba51cb
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 23 deletions.
1 change: 1 addition & 0 deletions changelogs/3.0.5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fixes and performance improvements
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "3.0.4",
"version": "3.0.5",
"description": "The most feature-rich web wallet and browser extension for TON – with support of multi-accounts, tokens (jettons), NFT, TON DNS, TON Sites, TON Proxy, and TON Magic.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.4
3.0.5
19 changes: 14 additions & 5 deletions src/api/blockchains/ton/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,27 @@ export async function pickBestWallet(network: ApiNetwork, publicKey: Uint8Array)
balance: bigint;
}> {
const allWallets = await getWalletVersionInfos(network, publicKey);
const defaultWallet = allWallets.filter(({ version }) => version === DEFAULT_WALLET_VERSION)[0];

if (defaultWallet.lastTxId) {
return defaultWallet;
}

const withBiggestBalance = allWallets.reduce<typeof allWallets[0] | undefined>((best, current) => {
return best && best.balance > current.balance ? best : current;
}, undefined);

if (!withBiggestBalance || !withBiggestBalance.balance) {
const version = DEFAULT_WALLET_VERSION;
const wallet = buildWallet(network, publicKey, version);
return { wallet, version, balance: 0n };
if (withBiggestBalance) {
return withBiggestBalance;
}

const withLastTx = allWallets.find(({ lastTxId }) => !!lastTxId);

if (withLastTx) {
return withLastTx;
}

return withBiggestBalance;
return defaultWallet;
}

export function getWalletVersionInfos(
Expand Down
22 changes: 13 additions & 9 deletions src/lib/rlottie/rlottie.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ import type { CancellableCallback } from '../../util/PostMessageConnector';

import { createPostMessageInterface } from '../../util/createPostMessageInterface';

const {
Module,
allocate,
intArrayFromString,
}: {
Module: any;
allocate(...args: any[]): string;
intArrayFromString(str: String): string;
} = require('./rlottie-wasm.js');
declare const Module: any;

declare function allocate(...args: any[]): string;

declare function intArrayFromString(str: String): string;

declare const self: WorkerGlobalScope;

try {
self.importScripts('rlottie-wasm.js');
} catch (err) {
throw new Error('Failed to import rlottie-wasm.js');
}

let rLottieApi: Record<string, Function>;
const rLottieApiPromise = new Promise<void>((resolve) => {
Expand Down
11 changes: 9 additions & 2 deletions src/util/handleError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ function handleErrorEvent(e: ErrorEvent | PromiseRejectionEvent) {
handleError(e instanceof ErrorEvent ? (e.error || e.message) : e.reason);
}

export function handleError(err: Error) {
export function handleError(err: Error | string) {
// eslint-disable-next-line no-console
console.error(err);

const message = typeof err === 'string' ? err : err.message;
const stack = typeof err === 'object' ? err.stack : undefined;

if (message.endsWith('Failed to import rlottie-wasm.js')) {
return;
}

if (APP_ENV === 'development' || APP_ENV === 'staging') {
throttledAlert(`${DEBUG_ALERT_MSG}\n\n${(err?.message) || err}\n${err?.stack}`);
throttledAlert(`${DEBUG_ALERT_MSG}\n\n${(message) || err}\n${stack}`);
}
}
3 changes: 0 additions & 3 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ export default function createConfig(
extensions: ['.js', '.ts', '.tsx'],
fallback: {
crypto: false,
path: false,
fs: false,
browser: false,
},
alias: {
// It is used to remove duplicate dependencies
Expand Down

0 comments on commit 6ba51cb

Please sign in to comment.