Skip to content

Commit

Permalink
v3.0.26
Browse files Browse the repository at this point in the history
  • Loading branch information
mytonwalletorg committed Oct 3, 2024
1 parent 7b6a21d commit 43b0798
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelogs/3.0.26.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.25",
"version": "3.0.26",
"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.25
3.0.26
4 changes: 2 additions & 2 deletions src/api/chains/ton/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {

import { TINY_TOKENS } from '../../../config';
import { parseAccountId } from '../../../util/account';
import { fetchJson } from '../../../util/fetch';
import { fetchJsonWithProxy } from '../../../util/fetch';
import { logDebugError } from '../../../util/logs';
import { fixIpfsUrl } from '../../../util/metadata';
import {
Expand Down Expand Up @@ -293,7 +293,7 @@ export async function checkMintlessTokenWalletIsClaimed(network: ApiNetwork, tok
async function fetchMintlessTokenWalletData(customPayloadApiUrl: string, address: string) {
const rawAddress = toRawAddress(address);

return (await fetchJson(`${customPayloadApiUrl}/wallet/${rawAddress}`).catch(() => undefined)) as {
return (await fetchJsonWithProxy(`${customPayloadApiUrl}/wallet/${rawAddress}`).catch(() => undefined)) as {
custom_payload: string;
state_init: string;
compressed_info: {
Expand Down
15 changes: 14 additions & 1 deletion src/util/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { DEFAULT_ERROR_PAUSE, DEFAULT_RETRIES, DEFAULT_TIMEOUT } from '../config';
import {
BRILLIANT_API_BASE_URL, DEFAULT_ERROR_PAUSE, DEFAULT_RETRIES, DEFAULT_TIMEOUT,
} from '../config';
import { ApiServerError } from '../api/errors';
import { logDebug } from './logs';
import { pause } from './schedulers';
Expand All @@ -7,6 +9,17 @@ type QueryParams = Record<string, string | number | boolean | string[]>;

const MAX_TIMEOUT = 30000; // 30 sec

export async function fetchJsonWithProxy(url: string | URL, data?: QueryParams, init?: RequestInit) {
try {
return await fetchJson(url, data, init);
} catch (err) {
if (err instanceof ApiServerError && (!err.statusCode || err.statusCode === 403)) {
return fetchJson(`${BRILLIANT_API_BASE_URL}/proxy/?url=${url.toString()}`, data, init);
}
throw err;
}
}

export async function fetchJson(url: string | URL, data?: QueryParams, init?: RequestInit) {
const urlObject = new URL(url);
if (data) {
Expand Down

0 comments on commit 43b0798

Please sign in to comment.