Skip to content

Commit

Permalink
v3.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Feb 13, 2025
1 parent a8796d7 commit b263cb4
Show file tree
Hide file tree
Showing 84 changed files with 953 additions and 523 deletions.
1 change: 1 addition & 0 deletions changelogs/3.3.3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bug fixes and performance improvements
13 changes: 10 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const babelConfig = require('./babel.config');

module.exports = {
setupFilesAfterEnv: ['./tests/init.js'],
setupFilesAfterEnv: ['./tests/init.ts'],
moduleNameMapper: {
'\\.(css|scss|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|tgs)$':
'<rootDir>/tests/staticFileMock.js',
Expand All @@ -11,10 +13,15 @@ module.exports = {
],
testEnvironment: 'jest-environment-jsdom',
transform: {
'\\.(jsx?|tsx?)$': 'babel-jest',
'\\.(jsx?|tsx?)$': ['babel-jest', {
...babelConfig,
plugins: [...babelConfig.plugins, 'babel-plugin-transform-import-meta'],
}],
'\\.txt$': 'jest-raw-loader',
},
transformIgnorePatterns: [
'/node_modules/(?!(axios)/)',
'/node_modules/(?!(axios|@capgo)/)',
],
// Fixes https://github.com/jestjs/jest/issues/11617 (expected to be fixed properly in Jest 30.0.0)
maxWorkers: 1,
};
14 changes: 13 additions & 1 deletion mobile/plugins/native-bottom-sheet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ npx cap sync
* [`closeSelf(...)`](#closeself)
* [`toggleSelfFullSize(...)`](#toggleselffullsize)
* [`openInMain(...)`](#openinmain)
* [`isShown()`](#isshown)
* [`addListener('delegate', ...)`](#addlistenerdelegate)
* [`addListener('move', ...)`](#addlistenermove)
* [`addListener('openInMain', ...)`](#addlisteneropeninmain)
Expand Down Expand Up @@ -178,6 +179,17 @@ openInMain(options: { key: BottomSheetKeys; }) => Promise<void>
--------------------


### isShown()

```typescript
isShown() => Promise<{ value: boolean; }>
```

**Returns:** <code>Promise&lt;{ value: boolean; }&gt;</code>

--------------------


### addListener('delegate', ...)

```typescript
Expand Down Expand Up @@ -241,6 +253,6 @@ addListener(eventName: 'openInMain', handler: (options: { key: BottomSheetKeys;

#### BottomSheetKeys

<code>'initial' | 'receive' | 'invoice' | 'transfer' | 'swap' | 'stake' | 'unstake' | 'staking-info' | 'vesting-info' | 'vesting-confirm' | 'transaction-info' | 'swap-activity' | 'backup' | 'add-account' | 'settings' | 'qr-scanner' | 'dapp-connect' | 'dapp-transfer' | 'disclaimer' | 'backup-warning' | 'onramp-widget'</code>
<code>'initial' | 'receive' | 'invoice' | 'transfer' | 'swap' | 'stake' | 'unstake' | 'staking-info' | 'staking-claim' | 'vesting-info' | 'vesting-confirm' | 'transaction-info' | 'swap-activity' | 'backup' | 'add-account' | 'settings' | 'qr-scanner' | 'dapp-connect' | 'dapp-transfer' | 'disclaimer' | 'backup-warning' | 'onramp-widget'</code>

</docgen-api>
14 changes: 14 additions & 0 deletions mobile/plugins/native-bottom-sheet/dist/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,16 @@
],
"slug": "openinmain"
},
{
"name": "isShown",
"signature": "() => Promise<{ value: boolean; }>",
"parameters": [],
"returns": "Promise<{ value: boolean; }>",
"tags": [],
"docs": "",
"complexTypes": [],
"slug": "isshown"
},
{
"name": "addListener",
"signature": "(eventName: 'delegate', handler: (options: { key: BottomSheetKeys; globalJson: string; }) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
Expand Down Expand Up @@ -312,6 +322,10 @@
"text": "'staking-info'",
"complexTypes": []
},
{
"text": "'staking-claim'",
"complexTypes": []
},
{
"text": "'vesting-info'",
"complexTypes": []
Expand Down
5 changes: 4 additions & 1 deletion mobile/plugins/native-bottom-sheet/dist/esm/definitions.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginListenerHandle } from '@capacitor/core';
import type { PluginListenerHandle } from '@capacitor/core';
export declare type BottomSheetKeys = 'initial' | 'receive' | 'invoice' | 'transfer' | 'swap' | 'stake' | 'unstake' | 'staking-info' | 'staking-claim' | 'vesting-info' | 'vesting-confirm' | 'transaction-info' | 'swap-activity' | 'backup' | 'add-account' | 'settings' | 'qr-scanner' | 'dapp-connect' | 'dapp-transfer' | 'disclaimer' | 'backup-warning' | 'onramp-widget';
export interface BottomSheetPlugin {
prepare(): Promise<void>;
Expand Down Expand Up @@ -29,6 +29,9 @@ export interface BottomSheetPlugin {
openInMain(options: {
key: BottomSheetKeys;
}): Promise<void>;
isShown(): Promise<{
value: boolean;
}>;
addListener(eventName: 'delegate', handler: (options: {
key: BottomSheetKeys;
globalJson: string;
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
CAP_PLUGIN_METHOD(enable, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(hide, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(show, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(isShown, CAPPluginReturnPromise);
)
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ public class BottomSheetPlugin: CAPPlugin, FloatingPanelControllerDelegate {
}
}

@objc func isShown(_ call: CAPPluginCall) {
call.resolve(["value": fpc.state != .hidden])
}

// Extra security level, potentially redundant
private func ensureLocalOrigin() {
DispatchQueue.main.sync { [self] in
Expand Down
5 changes: 4 additions & 1 deletion mobile/plugins/native-bottom-sheet/src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PluginListenerHandle } from '@capacitor/core';
import type { PluginListenerHandle } from '@capacitor/core';

export type BottomSheetKeys =
'initial'
Expand All @@ -9,6 +9,7 @@ export type BottomSheetKeys =
| 'stake'
| 'unstake'
| 'staking-info'
| 'staking-claim'
| 'vesting-info'
| 'vesting-confirm'
| 'transaction-info'
Expand Down Expand Up @@ -50,6 +51,8 @@ export interface BottomSheetPlugin {

openInMain(options: { key: BottomSheetKeys }): Promise<void>;

isShown(): Promise<{ value: boolean }>;

addListener(
eventName: 'delegate',
handler: (options: { key: BottomSheetKeys, globalJson: string }) => void,
Expand Down
85 changes: 46 additions & 39 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mytonwallet",
"version": "3.3.2",
"version": "3.3.3",
"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 Expand Up @@ -120,6 +120,7 @@
"@webpack-cli/serve": "2.0.5",
"autoprefixer": "10.4.20",
"babel-loader": "9.2.1",
"babel-plugin-transform-import-meta": "2.3.2",
"before-build-webpack": "0.2.15",
"browserlist": "1.0.1",
"concurrently": "7.6.0",
Expand Down
2 changes: 1 addition & 1 deletion public/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.2
3.3.3
5 changes: 3 additions & 2 deletions src/api/chains/ton/swap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { assert } from '../../../util/assert';
import { fromDecimal } from '../../../util/decimals';
import { logDebugError } from '../../../util/logs';
import { pause } from '../../../util/schedulers';
import { isTokenTransferPayload } from '../../../util/ton/transfer';
import { parseTxId } from './util';
import { parsePayloadBase64 } from './util/metadata';
import { resolveTokenWalletAddress, toBase64Address } from './util/tonCore';
Expand Down Expand Up @@ -77,7 +78,7 @@ export async function validateDexSwapTransfers(
assert(mainTransfer.toAddress === token.tokenAddress);
} else {
assert(mainTransfer.toAddress === walletAddress);
assert(['tokens:transfer', 'tokens:transfer-non-standard'].includes(parsedPayload.type));
assert(isTokenTransferPayload(parsedPayload));

({ amount: tokenAmount, destination } = parsedPayload as ApiTokensTransferPayload);
assert(tokenAmount <= maxAmount);
Expand All @@ -94,7 +95,7 @@ export async function validateDexSwapTransfers(

assert(feeTransfer.amount + mainTransfer.amount < maxTonAmount);
assert(feeTransfer.toAddress === walletAddress);
assert(['tokens:transfer', 'tokens:transfer-non-standard'].includes(feePayload.type));
assert(isTokenTransferPayload(feePayload));

const { amount: tokenFeeAmount, destination: feeDestination } = feePayload as ApiTokensTransferPayload;

Expand Down
Loading

0 comments on commit b263cb4

Please sign in to comment.