Skip to content

Commit

Permalink
Merge pull request #594 from tonkeeper/release/3.4.2
Browse files Browse the repository at this point in the history
Release 3.4.2
  • Loading branch information
sorokin0andrey authored Oct 9, 2023
2 parents af37c5e + 4ee2e75 commit 5de10c5
Show file tree
Hide file tree
Showing 74 changed files with 1,026 additions and 973 deletions.
1 change: 1 addition & 0 deletions packages/@core-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"bignumber.js": "^9.1.1",
"ethers": "^6.7.1",
"isomorphic-webcrypto": "^2.3.8",
"nanoid": "^5.0.1",
"ton": "^13.5.0",
"ton-core": "^0.50.0",
"ton-crypto": "^3.2.0"
Expand Down
3 changes: 3 additions & 0 deletions packages/@core-js/src/TonAPI/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export class HttpClient {
format,
type,
cancelToken,
method,
}: FullRequestParams): Promise<T> => {
const queryString = query && this.toQueryString(query);
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
Expand All @@ -149,7 +150,9 @@ export class HttpClient {
const response = await this.customFetch(
`${baseUrl}${path}${queryString ? `?${queryString}` : ''}`,
{
method,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`,
},
signal: cancelToken ? this.createAbortSignal(cancelToken) : null,
Expand Down
53 changes: 50 additions & 3 deletions packages/@core-js/src/TonAPI/TonAPIGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,15 @@ export interface JettonSwapAction {
amount_in: string;
/** @example "1660050553" */
amount_out: string;
/** @example 1000000000 */
/**
* @format int64
* @example 1000000000
*/
ton_in?: number;
/** @example 2000000000 */
/**
* @format int64
* @example 2000000000
*/
ton_out?: number;
user_wallet: AccountAddress;
router: AccountAddress;
Expand Down Expand Up @@ -1323,6 +1329,8 @@ export interface PoolInfo {
* @example 5000000000
*/
validator_stake: number;
/** @format int64 */
cycle_length?: number;
}

export interface PoolImplementation {
Expand Down Expand Up @@ -1694,6 +1702,11 @@ export interface GetAccountNftHistoryParams {
}

export interface GetAccountEventsParams {
/**
* Show only events that are initiated by this account
* @default false
*/
initiator?: boolean;
/**
* filter actions where requested account is not real subject (for example sender or receiver jettons)
* @default false
Expand Down Expand Up @@ -1883,6 +1896,21 @@ export interface GetJettonsParams {
offset?: number;
}

export interface GetJettonHoldersParams {
/**
* @max 1000
* @default 1000
*/
limit?: number;
/** @default 0 */
offset?: number;
/**
* account ID
* @example "0:97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621"
*/
accountId: string;
}

export interface GetStakingPoolsParams {
/**
* account ID
Expand Down Expand Up @@ -2544,6 +2572,21 @@ export class TonAPIGenerated<SecurityDataType extends unknown> {
format: 'json',
...params,
}),

/**
* @description Get only jetton transfers in the event
*
* @tags Jettons
* @name GetJettonsEvents
* @request GET:/v2/events/{event_id}/jettons
*/
getJettonsEvents: (eventId: string, params: RequestParams = {}) =>
this.http.request<Event, Error>({
path: `/v2/events/${eventId}/jettons`,
method: 'GET',
format: 'json',
...params,
}),
};
traces = {
/**
Expand Down Expand Up @@ -3243,10 +3286,14 @@ export class TonAPIGenerated<SecurityDataType extends unknown> {
* @name GetJettonHolders
* @request GET:/v2/jettons/{account_id}/holders
*/
getJettonHolders: (accountId: string, params: RequestParams = {}) =>
getJettonHolders: (
{ accountId, ...query }: GetJettonHoldersParams,
params: RequestParams = {},
) =>
this.http.request<JettonHolders, Error>({
path: `/v2/jettons/${accountId}/holders`,
method: 'GET',
query: query,
format: 'json',
...params,
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/@core-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export * from './Tonkeeper';
export * from './service';
export * from './TronAPI';

export * from './models/ActivityModel/ActivityModelTypes';
export * from './models/ActivityModel';

export * from './utils/State';
export * from './utils/network';
Expand Down
69 changes: 58 additions & 11 deletions packages/@core-js/src/models/ActivityModel/ActivityModel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { AccountEvent, ActionStatusEnum } from '../../TonAPI';
import { differenceInCalendarMonths, format } from 'date-fns';
import { toLowerCaseFirstLetter } from '../../utils/strings';
import { TronEvent } from '../../TronAPI/TronAPIGenerated';
import { Address } from '../../formatters/Address';
import { AccountEvent } from '../../TonAPI';
import { nanoid } from 'nanoid/non-secure';
import {
AnyActionTypePayload,
ActionDestination,
Expand All @@ -12,6 +13,7 @@ import {
ActionAmount,
ActionType,
ActionItem,
AnyActionItem,
} from './ActivityModelTypes';

type CreateActionOptions = {
Expand Down Expand Up @@ -43,8 +45,8 @@ export class ActivityModel {
options: CreateActionsOptions,
iteration?: (action: ActionItem) => void,
) {
return options.events.reduce<ActionItem[]>((activityActions, event) => {
const eventActions = event.actions.reduce<ActionItem[]>((actions, _, index) => {
return options.events.reduce<AnyActionItem[]>((activityActions, event) => {
const eventActions = event.actions.reduce<AnyActionItem[]>((actions, _, index) => {
const action = ActivityModel.createAction({
ownerAddress: options.ownerAddress,
source: options.source,
Expand All @@ -71,7 +73,7 @@ export class ActivityModel {
actionIndex,
source,
event,
}: CreateActionOptions): ActionItem {
}: CreateActionOptions): AnyActionItem {
const action = event.actions[actionIndex];
const payload = action[action.type];

Expand All @@ -80,7 +82,7 @@ export class ActivityModel {
}

const type = (action as any).type as ActionType;
const destination = this.defineActionDestination(ownerAddress, payload);
const destination = this.defineActionDestination(ownerAddress, type, payload);
const amount = this.createAmount({ type, payload });

return {
Expand All @@ -99,6 +101,43 @@ export class ActivityModel {
};
}

static createMockAction<T extends ActionType>(
ownerAddress: string,
action: AnyActionTypePayload<T>,
): AnyActionItem {
const destination = this.defineActionDestination(ownerAddress, action.payload);
const amount = this.createAmount(action);

return {
status: ActionStatusEnum.Ok,
source: ActionSource.Ton,
payload: action.payload,
action_id: nanoid(),
type: (action as any).type,
isFirst: false,
isLast: false,
destination,
amount,
event: {
event_id: nanoid(),
timestamp: +new Date() / 1000,
in_progress: false,
is_scam: false,
lt: +new Date(),
extra: 0,
account: {
address: ownerAddress,
is_scam: false,
},
},
simple_preview: {
description: 'Mock Action',
name: action.type,
accounts: [],
},
};
}

static createAmount(action: AnyActionTypePayload): ActionAmount | null {
const { payload, type } = action;

Expand Down Expand Up @@ -160,13 +199,21 @@ export class ActivityModel {

static defineActionDestination(
ownerAddress: string,
action: AnyActionPayload,
actionType: ActionType,
payload: AnyActionPayload,
): ActionDestination {
if (action && 'recipient' in action) {
if (typeof action.recipient === 'object') {
return Address.compare(action.recipient?.address, ownerAddress) ? 'in' : 'out';
} else if (typeof action.recipient === 'string') {
return action.recipient === ownerAddress ? 'in' : 'out';
if (
actionType === ActionType.WithdrawStake ||
actionType === ActionType.WithdrawStakeRequest
) {
return 'in';
}

if (payload && 'recipient' in payload) {
if (typeof payload.recipient === 'object') {
return Address.compare(payload.recipient?.address, ownerAddress) ? 'in' : 'out';
} else if (typeof payload.recipient === 'string') {
return payload.recipient === ownerAddress ? 'in' : 'out';
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ android {
applicationId "com.ton_keeper"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 382
versionName "3.4.1"
versionCode 387
versionName "3.4.2"
missingDimensionStrategy 'react-native-camera', 'general'
}

Expand Down
1 change: 1 addition & 0 deletions packages/mobile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'react-native-reanimated';
import './global';
import 'react-native-console-time-polyfill';
import 'text-encoding-polyfill';
import 'react-native-url-polyfill/auto';

import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
import { AppRegistry, LogBox } from 'react-native';
Expand Down
8 changes: 4 additions & 4 deletions packages/mobile/ios/ton_keeper.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements;
CURRENT_PROJECT_VERSION = 382;
CURRENT_PROJECT_VERSION = 387;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = CT523DK2KC;
ENABLE_BITCODE = NO;
Expand All @@ -1244,7 +1244,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.4.1;
MARKETING_VERSION = 3.4.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -1269,7 +1269,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = ton_keeper/ton_keeper.entitlements;
CURRENT_PROJECT_VERSION = 382;
CURRENT_PROJECT_VERSION = 387;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = CT523DK2KC;
INFOPLIST_FILE = ton_keeper/SupportingFiles/Info.plist;
Expand All @@ -1278,7 +1278,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.4.1;
MARKETING_VERSION = 3.4.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
3 changes: 2 additions & 1 deletion packages/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@
"react-native-reanimated": "^3.5.2",
"react-native-restart": "^0.0.27",
"react-native-safe-area-context": "4.5.0",
"react-native-screens": "~3.23.0",
"react-native-screens": "3.25.0",
"react-native-scrypt": "^1.2.1",
"react-native-securerandom": "^1.0.1",
"react-native-share": "^9.4.1",
"react-native-sse": "^1.1.0",
"react-native-svg": "^13.10.0",
"react-native-svg-transformer": "^0.14.3",
"react-native-tweetnacl": "^1.0.5",
"react-native-url-polyfill": "^2.0.0",
"react-native-video": "^5.2.0",
"react-native-webview": "^11.14.0",
"react-query": "^3.39.3",
Expand Down
Loading

0 comments on commit 5de10c5

Please sign in to comment.