Skip to content

Commit

Permalink
v3.0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Oct 4, 2024
1 parent 43b0798 commit b9b5eea
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions changelogs/3.0.27.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.26",
"version": "3.0.27",
"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.26
3.0.27
15 changes: 9 additions & 6 deletions src/api/chains/ton/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type { TonWallet } from './util/tonCore';
import { ApiCommonError, ApiTransactionDraftError, ApiTransactionError } from '../../types';

import {
DEFAULT_FEE, DIESEL_ADDRESS, DIESEL_TOKENS, ONE_TON, TOKENS_WITH_STARS_FEE, TONCOIN,
DEFAULT_FEE, DIESEL_ADDRESS, DIESEL_TOKENS, ONE_TON, TINY_TOKENS, TOKENS_WITH_STARS_FEE, TONCOIN,
} from '../../../config';
import { parseAccountId } from '../../../util/account';
import { bigintMultiplyToNumber } from '../../../util/bigint';
Expand Down Expand Up @@ -72,6 +72,7 @@ import {
FEE_FACTOR,
STAKE_COMMENT,
TINY_TOKEN_TRANSFER_AMOUNT,
TOKEN_TRANSFER_AMOUNT,
TRANSFER_TIMEOUT_SEC,
UNSTAKE_COMMENT,
} from './constants';
Expand Down Expand Up @@ -283,13 +284,13 @@ export async function checkTransactionDraft(
}
}

function estimateDiesel(address: string, tokenAddress: string, toncoinAmount: string, isW5: boolean) {
function estimateDiesel(address: string, tokenAddress: string, toncoinAmount: string, isW5: boolean, isStars: boolean) {
return callBackendGet<{
status: DieselStatus;
amount?: string;
pendingCreatedAt?: string;
}>('/diesel/estimate', {
address, tokenAddress, toncoinAmount, isW5,
address, tokenAddress, toncoinAmount, isW5, isStars,
});
}

Expand Down Expand Up @@ -1245,14 +1246,16 @@ export async function fetchEstimateDiesel(

if (balance >= MAX_BALANCE_WITH_CHECK_DIESEL) return undefined;

const multiplier = TOKENS_WITH_STARS_FEE.has(tokenAddress) ? 1n : 2n;
const toncoinAmount = toDecimal((TINY_TOKEN_TRANSFER_AMOUNT + DEFAULT_FEE) * multiplier);
const isStars = TOKENS_WITH_STARS_FEE.has(tokenAddress);
const multiplier = isStars ? 1n : 2n;
const transferAmount = TINY_TOKENS.has(tokenAddress) ? TINY_TOKEN_TRANSFER_AMOUNT : TOKEN_TRANSFER_AMOUNT;
const toncoinAmount = toDecimal((transferAmount + DEFAULT_FEE) * multiplier);

const {
status,
amount,
pendingCreatedAt,
} = await estimateDiesel(address, tokenAddress, toncoinAmount, isW5);
} = await estimateDiesel(address, tokenAddress, toncoinAmount, isW5, isStars);

const { decimals } = getTokenByAddress(tokenAddress)!;

Expand Down
5 changes: 3 additions & 2 deletions src/api/common/backend.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BRILLIANT_API_BASE_URL } from '../../config';
import { APP_VERSION, BRILLIANT_API_BASE_URL } from '../../config';
import { fetchJson, handleFetchErrors } from '../../util/fetch';

const BAD_REQUEST_CODE = 400;
Expand All @@ -15,6 +15,7 @@ export async function callBackendPost<T>(path: string, data: AnyLiteral, options
headers: {
'Content-Type': 'application/json',
...(authToken && { 'X-Auth-Token': authToken }),
'X-App-Version': APP_VERSION,
},
body: JSON.stringify(data),
});
Expand All @@ -27,5 +28,5 @@ export async function callBackendPost<T>(path: string, data: AnyLiteral, options
export function callBackendGet<T = any>(path: string, data?: AnyLiteral, headers?: HeadersInit): Promise<T> {
const url = new URL(`${BRILLIANT_API_BASE_URL}${path}`);

return fetchJson(url, data, { headers });
return fetchJson(url, data, { headers: { ...headers, 'X-App-Version': APP_VERSION } });
}
5 changes: 2 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,16 +454,15 @@ export const DIESEL_TOKENS = new Set([
'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', // USDT
'EQCvxJy4eG8hyHBFsZ7eePxrRsUQSFE_jpptRAYBmcG_DOGS', // DOGS
'EQD-cvR0Nz6XAyRBvbhz-abTrRC6sI5tvHvvpeQraV9UAAD7', // CATI
'EQAJ8uWd7EBqsmpSWaRdf_I-8R8-XHwh3gsNKhy-UrdrPcUo', // HAMSTER
]);

export const TINY_TOKENS = new Set([
'EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT', // NOT
'EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs', // USDT
'EQCvxJy4eG8hyHBFsZ7eePxrRsUQSFE_jpptRAYBmcG_DOGS', // DOGS
]);
export const TOKENS_WITH_STARS_FEE = new Set([
'EQAJ8uWd7EBqsmpSWaRdf_I-8R8-XHwh3gsNKhy-UrdrPcUo', // HASMTER
]);
export const TOKENS_WITH_STARS_FEE = new Set<string>([]);

export const STARS_SYMBOL = '⭐️';

Expand Down

0 comments on commit b9b5eea

Please sign in to comment.