Skip to content

Commit

Permalink
Release 1.28 (#1081)
Browse files Browse the repository at this point in the history
Merge pull request #1081 from madfish-solutions/development
  • Loading branch information
alex-tsx authored May 21, 2024
2 parents ef72e44 + 8485e7d commit 5ee11a5
Show file tree
Hide file tree
Showing 88 changed files with 1,808 additions and 1,222 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
inputs:
version:
description: Version
default: "1.27"
default: "1.28"
required: true
build-number:
description: Build number
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testapp-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
inputs:
version:
description: Version
default: "1.27"
default: "1.28"
required: true
build-number:
description: Build number
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1027
versionName "1.27"
versionName "1.28"

missingDimensionStrategy 'react-native-camera', 'general'
}
Expand Down
7 changes: 7 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,9 @@ PODS:
- glog
- react-native-biometrics (3.0.1):
- React-Core
- react-native-blur (4.4.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-camera (4.2.1):
- React-Core
- react-native-camera/RCT (= 4.2.1)
Expand Down Expand Up @@ -800,6 +803,7 @@ DEPENDENCIES:
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- react-native-biometrics (from `../node_modules/react-native-biometrics`)
- "react-native-blur (from `../node_modules/@react-native-community/blur`)"
- react-native-camera (from `../node_modules/react-native-camera`)
- react-native-cloud-fs (from `../node_modules/react-native-cloud-fs`)
- react-native-config (from `../node_modules/react-native-config`)
Expand Down Expand Up @@ -946,6 +950,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/logger"
react-native-biometrics:
:path: "../node_modules/react-native-biometrics"
react-native-blur:
:path: "../node_modules/@react-native-community/blur"
react-native-camera:
:path: "../node_modules/react-native-camera"
react-native-cloud-fs:
Expand Down Expand Up @@ -1121,6 +1127,7 @@ SPEC CHECKSUMS:
React-jsinspector: 8e291ed0ab371314de269001d6b9b25db6aabf42
React-logger: d4010de0b0564e63637ad08373bc73b5d919974b
react-native-biometrics: 352e5a794bfffc46a0c86725ea7dc62deb085bdc
react-native-blur: 507cf3dd4434eb9d5ca5f183e49d8bcccdd66826
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-cloud-fs: cd21282c5cecaf285225e447dd7f3cf2f9015496
react-native-config: 86038147314e2e6d10ea9972022aa171e6b1d4d8
Expand Down
2 changes: 1 addition & 1 deletion ios/TempleWallet/Debug-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.27</string>
<string>1.28</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/TempleWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.27</string>
<string>1.28</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/TempleWalletTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.27</string>
<string>1.28</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "temple-wallet",
"version": "1.27",
"version": "1.28",
"private": true,
"scripts": {
"postinstall": "rn-nodeify --install 'react-native-randombytes' --hack && bash postinstall.sh",
Expand Down Expand Up @@ -38,6 +38,7 @@
"@jitsu/sdk-js": "madfish-solutions/jitsu-js#87c49de334f5747952f7beda573b95ceb5d86903",
"@react-native-async-storage/async-storage": "^1.21.0",
"@react-native-clipboard/clipboard": "^1.11.1",
"@react-native-community/blur": "^4.4.0",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^11.2.1",
"@react-native-community/push-notification-ios": "^1.11.0",
Expand Down
7 changes: 6 additions & 1 deletion src/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ const dcpTzktApi = axios.create({ baseURL: 'https://explorer-api.tlnt.net/v1' })

export const getTzktApi = (selectedRpcUrl: string) => (isDcpNode(selectedRpcUrl) ? dcpTzktApi : tzktApi);

export const templeWalletApi = axios.create({ baseURL: concatUrlPath(TEMPLE_WALLET_API_URL, '/api') });
export const templeWalletApi = axios.create({
baseURL: concatUrlPath(TEMPLE_WALLET_API_URL, '/api'),
params: {
platform: Platform.OS
}
});

export const tezosMetadataApi = axios.create({ baseURL: TEZOS_METADATA_API_URL });

Expand Down
15 changes: 13 additions & 2 deletions src/apis/kord-fi/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';
import { BigNumber } from 'bignumber.js';
import { isEqual } from 'lodash-es';
import { Observable, catchError, from, map, of } from 'rxjs';

import { EarnOpportunityTokenStandardEnum } from 'src/enums/earn-opportunity-token-standard.enum';
Expand Down Expand Up @@ -61,7 +62,9 @@ const getKordFiStats$ = (): Observable<KordFiLendStats> =>
)
);

export const getKordFiUserDeposits$ = (address: string): Observable<{ [key: string]: UserStakeValueInterface }> =>
export const getKordFiUserDeposits$ = (
address: string
): Observable<{ [key: string]: UserStakeValueInterface | null }> =>
from(kordFiApi.post<KordFiUserDepositsResponse>('/llb-api/user-deposits/', { address })).pipe(
map(({ data: { xtz_deposit, tzbtc_deposit } }) => {
const tezosDepositAmountAtomic = tzToMutez(new BigNumber(xtz_deposit), TEZ_TOKEN_METADATA.decimals).toFixed();
Expand All @@ -88,9 +91,17 @@ export const getKordFiUserDeposits$ = (address: string): Observable<{ [key: stri
};
}),
catchError(error => {
if (
axios.isAxiosError(error) &&
error.response?.status === 404 &&
isEqual(error.response.data, { detail: 'User not found' })
) {
return of({ [KORDFI_TEZOS_CONTRACT_ADDRESS]: null, [TZBTC_CONTRACT_ADDRESS]: null });
}

console.error('Error getting Kord.Fi user deposits: ', error);

return of({});
throw error;
})
);

Expand Down
34 changes: 15 additions & 19 deletions src/apis/youves/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { catchError, firstValueFrom, forkJoin, from, map, Observable, of } from
import { EarnOpportunityTypeEnum } from 'src/enums/earn-opportunity-type.enum';
import { AccountInterface } from 'src/interfaces/account.interface';
import { SavingsItem } from 'src/interfaces/earn-opportunity/savings-item.interface';
import { UserStakeValueInterface } from 'src/interfaces/user-stake-value.interface';
import { ExchangeRateRecord } from 'src/store/currency/currency-state';
import { KNOWN_TOKENS_SLUGS } from 'src/token/data/token-slugs';
import { toTokenSlug } from 'src/token/utils/token.utils';
Expand All @@ -15,17 +16,12 @@ import { isString } from 'src/utils/is-string';
import { tzktUrl } from 'src/utils/linking';
import { fractionToPercentage } from 'src/utils/percentage.utils';
import { getReadOnlyContract } from 'src/utils/rpc/contract.utils';
import { createReadOnlyTezosToolkit } from 'src/utils/rpc/tezos-toolkit.utils';
import { mutezToTz } from 'src/utils/tezos.util';

import { INITIAL_APR_VALUE } from './constants';
import { SavingsPoolStorage } from './types';
import {
createEngineMemoized,
createUnifiedSavings,
createUnifiedStaking,
getTezosToolkit,
toEarnOpportunityToken
} from './utils';
import { createEngineMemoized, createUnifiedSavings, createUnifiedStaking, toEarnOpportunityToken } from './utils';

export const getYOUTokenApr$ = (
assetToUsdExchangeRate: BigNumber,
Expand Down Expand Up @@ -62,7 +58,7 @@ const getYOUTokenSavingItem = async (
rpcUrl: string
): Promise<SavingsItem | undefined> => {
try {
const tezos = getTezosToolkit(rpcUrl);
const tezos = createReadOnlyTezosToolkit(rpcUrl);
const unifiedStaking = createUnifiedStaking(rpcUrl);
const apr = await firstValueFrom(getYOUTokenApr$(youToUsdExchangeRate, youToUsdExchangeRate, rpcUrl));
const savingsContract = await getReadOnlyContract(unifiedStaking.stakingContract, tezos);
Expand Down Expand Up @@ -108,7 +104,7 @@ const getSavingsItemByAssetDefinition = async (
rpcUrl: string
): Promise<SavingsItem | undefined> => {
try {
const tezos = getTezosToolkit(rpcUrl);
const tezos = createReadOnlyTezosToolkit(rpcUrl);
const { id, token, SAVINGS_V3_POOL_ADDRESS } = assetDefinition;
const { decimals: tokenDecimals, contractAddress: tokenAddress, tokenId } = token;
const apr = await firstValueFrom(getYouvesTokenApr$(assetDefinition, rpcUrl));
Expand Down Expand Up @@ -163,7 +159,7 @@ export const getUserStake = async (
stakingOrSavingId: string,
type: EarnOpportunityTypeEnum,
rpcUrl: string
) => {
): Promise<UserStakeValueInterface | null> => {
const assetDefinition = contracts.mainnet.find(({ id }) => id === stakingOrSavingId);
let lastStake: UnifiedStakeExtendedItem | undefined;

Expand Down Expand Up @@ -196,13 +192,13 @@ export const getUserStake = async (
throw new Error('Unsupported savings type');
}

return (
lastStake && {
lastStakeId: lastStake.id.toFixed(),
depositAmountAtomic: lastStake.token_amount.toFixed(),
claimableRewards: lastStake.rewardNow.toFixed(),
fullReward: lastStake.rewardTotal.toFixed(),
rewardsDueDate: new Date(lastStake.endTimestamp).getTime()
}
);
return lastStake
? {
lastStakeId: lastStake.id.toFixed(),
depositAmountAtomic: lastStake.token_amount.toFixed(),
claimableRewards: lastStake.rewardNow.toFixed(),
fullReward: lastStake.rewardTotal.toFixed(),
rewardsDueDate: new Date(lastStake.endTimestamp).getTime()
}
: null;
};
13 changes: 2 additions & 11 deletions src/apis/youves/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { TezosToolkit } from '@taquito/taquito';
import {
createEngine,
contracts,
Expand All @@ -17,8 +16,6 @@ import memoize from 'memoizee';

import { EarnOpportunityTokenStandardEnum } from 'src/enums/earn-opportunity-token-standard.enum';
import { AccountInterface } from 'src/interfaces/account.interface';
import { isDefined } from 'src/utils/is-defined';
import { getFastRpcClient } from 'src/utils/rpc/fast-rpc';
import { createReadOnlyTezosToolkit } from 'src/utils/rpc/tezos-toolkit.utils';

import { INDEXER_CONFIG, YOUVES_TOKENS_ICONS } from './constants';
Expand Down Expand Up @@ -57,19 +54,13 @@ class MemoryStorage implements Storage {
}
}

export const getTezosToolkit = memoize(
(rpcUrl: string, account?: AccountInterface) =>
isDefined(account) ? createReadOnlyTezosToolkit(rpcUrl, account) : new TezosToolkit(getFastRpcClient(rpcUrl)),
{ normalizer: ([rpcUrl, account]) => [rpcUrl, account?.publicKey].join('_') }
);

const getCreateEngineCacheKey = (rpcUrl: string, token: AssetDefinition, account?: AccountInterface) =>
[rpcUrl, token.id, account?.publicKey].join('_');

export const createEngineMemoized = memoize(
(rpcUrl: string, token: AssetDefinition, account?: AccountInterface) =>
createEngine({
tezos: getTezosToolkit(rpcUrl, account),
tezos: createReadOnlyTezosToolkit(rpcUrl, account),
contracts: token,
storage: new MemoryStorage(),
indexerConfig: INDEXER_CONFIG,
Expand Down Expand Up @@ -109,7 +100,7 @@ const getCreateUnifiedStakingCacheKey = (rpcUrl: string, account?: AccountInterf

export const createUnifiedStaking = memoize(
(rpcUrl: string, account?: AccountInterface) =>
new UnifiedStaking(getTezosToolkit(rpcUrl, account), INDEXER_CONFIG, mainnetNetworkConstants),
new UnifiedStaking(createReadOnlyTezosToolkit(rpcUrl, account), INDEXER_CONFIG, mainnetNetworkConstants),
{
normalizer: ([rpcUrl, account]) => getCreateUnifiedStakingCacheKey(rpcUrl, account)
}
Expand Down
Loading

0 comments on commit 5ee11a5

Please sign in to comment.