diff --git a/Makefile b/Makefile
index d13b4c24ac..c56a98e210 100644
--- a/Makefile
+++ b/Makefile
@@ -384,7 +384,7 @@ project: check_env kill_xcode
bazel_app_debug_arm64:
APP_VERSION="${APP_VERSION}" \
- build-system/prepare-build.sh distribution
+ build-system/prepare-build.sh Telegram distribution
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_DEBUG_FLAGS} \
-c dbg \
--ios_multi_cpus=arm64 \
@@ -394,7 +394,7 @@ bazel_app_debug_arm64:
bazel_app_arm64:
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
- build-system/prepare-build.sh distribution
+ build-system/prepare-build.sh Telegram distribution
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_OPT_FLAGS} \
-c opt \
--ios_multi_cpus=arm64 \
@@ -408,7 +408,7 @@ bazel_app_arm64:
bazel_prepare_development_build:
APP_VERSION="${APP_VERSION}" \
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
- build-system/prepare-build.sh development
+ build-system/prepare-build.sh Telegram development
bazel_project: kill_xcode bazel_prepare_development_build
APP_VERSION="${APP_VERSION}" \
diff --git a/Telegram/BUILD b/Telegram/BUILD
index 50b2dcff7d..c1bf60ae83 100644
--- a/Telegram/BUILD
+++ b/Telegram/BUILD
@@ -9,15 +9,11 @@ load("@build_bazel_rules_apple//apple:watchos.bzl",
"watchos_extension",
)
-load("@build_bazel_rules_apple//apple:versioning.bzl",
- "apple_bundle_version",
-)
-
load("@build_bazel_rules_swift//swift:swift.bzl",
"swift_library",
)
-load("//build-system:plist_fragment.bzl",
+load("//build-system/bazel-utils:plist_fragment.bzl",
"plist_fragment",
)
@@ -179,42 +175,42 @@ plist_fragment(
template =
"""
CFBundleShortVersionString
- {telegram_version}
- CFBundleVersion
- {telegram_build_number}
- CFBundleURLTypes
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {telegram_bundle_id}
- CFBundleURLSchemes
-
- telegram
-
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {telegram_bundle_id}.ton
- CFBundleURLSchemes
-
- ton
-
-
-
- CFBundleTypeRole
- Viewer
- CFBundleURLName
- {telegram_bundle_id}.compatibility
- CFBundleURLSchemes
-
- tg
-
-
-
+ {telegram_version}
+ CFBundleVersion
+ {telegram_build_number}
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ {telegram_bundle_id}
+ CFBundleURLSchemes
+
+ telegram
+
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ {telegram_bundle_id}.ton
+ CFBundleURLSchemes
+
+ ton
+
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ {telegram_bundle_id}.compatibility
+ CFBundleURLSchemes
+
+ tg
+
+
+
""".format(
telegram_version = telegram_version,
telegram_build_number = telegram_build_number,
diff --git a/Wallet.makefile b/Wallet.makefile
index 90d359969c..b2d9c44ab0 100644
--- a/Wallet.makefile
+++ b/Wallet.makefile
@@ -1,5 +1,9 @@
include Utils.makefile
+APP_VERSION="1.0"
+CORE_COUNT=$(shell sysctl -n hw.logicalcpu)
+CORE_COUNT_MINUS_ONE=$(shell expr ${CORE_COUNT} \- 1)
+
WALLET_BUCK_OPTIONS=\
--config custom.appVersion="1.0" \
--config custom.developmentCodeSignIdentity="${DEVELOPMENT_CODE_SIGN_IDENTITY}" \
@@ -21,6 +25,23 @@ WALLET_BUCK_OPTIONS=\
BAZEL=$(shell which bazel)
+ifneq ($(BAZEL_CACHE_DIR),)
+ export BAZEL_CACHE_FLAGS=\
+ --disk_cache="${BAZEL_CACHE_DIR}"
+endif
+
+BAZEL_COMMON_FLAGS=\
+ --announce_rc \
+ --features=swift.use_global_module_cache \
+
+BAZEL_DEBUG_FLAGS=\
+ --features=swift.enable_batch_mode \
+ --swiftcopt=-j${CORE_COUNT_MINUS_ONE} \
+
+BAZEL_OPT_FLAGS=\
+ --swiftcopt=-whole-module-optimization \
+ --swiftcopt='-num-threads' --swiftcopt='16' \
+
wallet_deps: check_env
$(BUCK) query "deps(//Wallet:AppPackage)" --output-attribute buck.type \
${WALLET_BUCK_OPTIONS} ${BUCK_RELEASE_OPTIONS}
@@ -51,5 +72,30 @@ wallet_package:
wallet_app: build_wallet wallet_package
-tulsi_project:
- ${HOME}/Applications/Tulsi.app/Contents/MacOS/Tulsi -- --genconfig Wallet/Wallet.tulsiproj:Default --bazel "${BAZEL}"
+bazel_wallet_debug_arm64:
+ WALLET_APP_VERSION="${APP_VERSION}" \
+ build-system/prepare-build.sh Wallet distribution
+ "${BAZEL}" build Wallet/Wallet ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_DEBUG_FLAGS} \
+ -c dbg \
+ --ios_multi_cpus=arm64 \
+ --watchos_cpus=armv7k,arm64_32 \
+ --verbose_failures
+
+bazel_wallet:
+ WALLET_APP_VERSION="${APP_VERSION}" \
+ build-system/prepare-build.sh Wallet distribution
+ "${BAZEL}" build Wallet/Wallet ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_OPT_FLAGS} \
+ -c opt \
+ --ios_multi_cpus=armv7,arm64 \
+ --watchos_cpus=armv7k,arm64_32 \
+ --verbose_failures
+
+bazel_wallet_prepare_development_build:
+ WALLET_APP_VERSION="${APP_VERSION}" \
+ BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
+ build-system/prepare-build.sh Wallet development
+
+bazel_wallet_project: kill_xcode bazel_wallet_prepare_development_build
+ WALLET_APP_VERSION="${APP_VERSION}" \
+ BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
+ build-system/generate-xcode-project.sh Wallet
diff --git a/Wallet/BUILD b/Wallet/BUILD
index a924e4a93e..b487d800c5 100644
--- a/Wallet/BUILD
+++ b/Wallet/BUILD
@@ -1,25 +1,132 @@
-load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_framework")
-load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
+load("@build_bazel_rules_apple//apple:ios.bzl",
+ "ios_application",
+ "ios_extension",
+ "ios_framework",
+)
-version_info_plist_source = """
-echo \
-'' \
-'' \
-'' \
-'' \
-' CFBundleShortVersionString' \
-' {}' \
-' CFBundleVersion' \
-' {}' \
-'' \
-'' \
-> "$@"
-""".format("1.0", "30")
+load("@build_bazel_rules_swift//swift:swift.bzl",
+ "swift_library",
+)
+
+load("//build-system/bazel-utils:plist_fragment.bzl",
+ "plist_fragment",
+)
+
+load(
+ "//build-input/data:variables.bzl",
+ "wallet_build_number",
+ "wallet_version",
+ "wallet_bundle_id",
+ "wallet_team_id",
+)
+
+config_setting(
+ name = "debug",
+ values = {
+ "compilation_mode": "dbg",
+ },
+)
genrule(
- name = "VersionInfoPlist",
- outs = ["VersionInfo.plist"],
- cmd = version_info_plist_source,
+ name = "empty",
+ outs = ["empty.swift"],
+ cmd = "touch $(OUTS)",
+)
+
+swift_library(
+ name = "_LocalDebugOptions",
+ srcs = [":empty"],
+ copts = [
+ "-Xfrontend",
+ "-serialize-debugging-options",
+ ],
+ deps = [
+ ],
+ module_name = "_LocalDebugOptions",
+ tags = ["no-remote"],
+ visibility = ["//visibility:public"],
+)
+
+debug_deps = select({
+ ":debug": [":_LocalDebugOptions"],
+ "//conditions:default": [],
+})
+
+plist_fragment(
+ name = "WalletInfoPlist",
+ extension = "plist",
+ template =
+ """
+ CFBundleShortVersionString
+ {wallet_version}
+ CFBundleVersion
+ {wallet_build_number}
+ CFBundleAllowMixedLocalizations
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleDisplayName
+ TON Wallet
+ CFBundleIdentifier
+ {wallet_bundle_id}
+ CFBundleName
+ TON Wallet
+ CFBundlePackageType
+ APPL
+ ITSAppUsesNonExemptEncryption
+
+ LSRequiresIPhoneOS
+
+ NSAppTransportSecurity
+
+ NSAllowsArbitraryLoads
+
+
+ NSCameraUsageDescription
+ Please allow TON Wallet access to your camera for scanning QR codes.
+ NSFaceIDUsageDescription
+ For better security, please allow TON Wallet to use your Face ID to authenticate payments.
+ NSPhotoLibraryUsageDescription
+ Please allow TON Wallet access to your Photo Stream in case you need to scan a QR code from a picture.
+ UIDeviceFamily
+
+ 1
+ 2
+
+ UIFileSharingEnabled
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UIRequiresPersistentWiFi
+
+ UIStatusBarStyle
+ UIStatusBarStyleLightContent
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+ UIViewEdgeAntialiasing
+
+ UIViewGroupOpacity
+
+ """.format(
+ wallet_version = wallet_version,
+ wallet_build_number = wallet_build_number,
+ wallet_bundle_id = wallet_bundle_id,
+ )
)
filegroup(
@@ -29,6 +136,13 @@ filegroup(
], exclude = ["Strings/**/.*"]),
)
+filegroup(
+ name = "Icons",
+ srcs = glob([
+ "Icons.xcassets/**/*",
+ ], exclude = ["Icons.xcassets/**/.*"]),
+)
+
objc_library(
name = "Main",
srcs = [
@@ -36,73 +150,37 @@ objc_library(
],
)
-ios_framework(
- name = "AsyncDisplayKitFramework",
- deps = ["//submodules/AsyncDisplayKit:AsyncDisplayKit"],
- bundle_id = "org.telegram.Telegram.AsyncDisplayKit",
- families = ["iphone", "ipad"],
- minimum_os_version = "9.0",
- infoplists = [
- "Info.plist"
- ],
-)
-
swift_library(
name = "Lib",
srcs = glob([
"Sources/**/*.swift",
]),
data = [
- ":Strings",
+
],
deps = [
- "//submodules/GZip:GZip",
- "//submodules/AsyncDisplayKit:AsyncDisplayKit",
- "//submodules/SSignalKit/SSignalKit:SSignalKit",
- "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
- "//submodules/ObjCRuntimeUtils:ObjCRuntimeUtils",
- "//submodules/UIKitRuntimeUtils:UIKitRuntimeUtils",
- "//submodules/Display:Display",
- "//submodules/AlertUI:AlertUI",
- "//submodules/ActivityIndicator:ActivityIndicator",
- "//submodules/OverlayStatusController:OverlayStatusController",
- "//submodules/openssl:openssl",
- "//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
+ "//submodules/WalletUI:WalletUI",
"//submodules/WalletCore:WalletCore",
"//submodules/BuildConfig:BuildConfig",
- "//submodules/AppBundle:AppBundle",
- "//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
- "//submodules/Camera:Camera",
- "//submodules/QrCode:QrCode",
- "//submodules/MergeLists:MergeLists",
- "//submodules/GlassButtonNode:GlassButtonNode",
- "//submodules/UrlEscaping:UrlEscaping",
- "//submodules/LocalAuth:LocalAuth",
- "//submodules/ScreenCaptureDetection:ScreenCaptureDetection",
- "//submodules/WalletUrl:WalletUrl",
- "//submodules/ProgressNavigationButtonNode:ProgressNavigationButtonNode",
- "//submodules/Markdown:Markdown",
- "//submodules/StringPluralization:StringPluralization",
- "//submodules/YuvConversion:YuvConversion",
- "//submodules/rlottie:RLottieBinding",
- "//submodules/AnimatedStickerNode:AnimatedStickerNode",
- "//submodules/WalletUI:WalletUI",
- "//submodules/FFMpegBinding:FFMpegBinding",
+ "//submodules/OverlayStatusController:OverlayStatusController",
],
)
ios_application(
name = "Wallet",
- bundle_id = "{wallet_bundle_id}",
+ bundle_id = wallet_bundle_id,
families = ["iphone", "ipad"],
minimum_os_version = "9.0",
- provisioning_profile = "Wallet.mobileprovision",
+ provisioning_profile = "//build-input/data/provisioning-profiles:Wallet.mobileprovision",
infoplists = [
- ":Info.plist",
- ":VersionInfoPlist",
+ ":WalletInfoPlist.plist",
],
- frameworks = [
- ":AsyncDisplayKitFramework",
+ app_icons = [
+ ":Icons",
+ ],
+ launch_storyboard = "LaunchScreen.xib",
+ strings = [
+ ":Strings",
],
deps = [
":Main",
diff --git a/Wallet/Wallet.entitlements b/Wallet/Wallet.entitlements
deleted file mode 100644
index 6631ffa6f2..0000000000
--- a/Wallet/Wallet.entitlements
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/Wallet/Wallet.mobileprovision b/Wallet/Wallet.mobileprovision
deleted file mode 100644
index 879842ec7b..0000000000
Binary files a/Wallet/Wallet.mobileprovision and /dev/null differ
diff --git a/Wallet/configuration.bzl b/build-system/bazel-utils/BUILD
similarity index 100%
rename from Wallet/configuration.bzl
rename to build-system/bazel-utils/BUILD
diff --git a/build-system/defines.bzl b/build-system/bazel-utils/defines.bzl
similarity index 100%
rename from build-system/defines.bzl
rename to build-system/bazel-utils/defines.bzl
diff --git a/build-system/plist_fragment.bzl b/build-system/bazel-utils/plist_fragment.bzl
similarity index 96%
rename from build-system/plist_fragment.bzl
rename to build-system/bazel-utils/plist_fragment.bzl
index 4b28670773..ed1bfb0f28 100644
--- a/build-system/plist_fragment.bzl
+++ b/build-system/bazel-utils/plist_fragment.bzl
@@ -1,4 +1,4 @@
-load("//build-system:defines.bzl",
+load("//build-system/bazel-utils:defines.bzl",
"string_value",
)
diff --git a/build-system/unique_directories.bzl b/build-system/bazel-utils/unique_directories.bzl
similarity index 100%
rename from build-system/unique_directories.bzl
rename to build-system/bazel-utils/unique_directories.bzl
diff --git a/build-system/copy-provisioning-profiles.sh b/build-system/copy-provisioning-profiles-Telegram.sh
similarity index 100%
rename from build-system/copy-provisioning-profiles.sh
rename to build-system/copy-provisioning-profiles-Telegram.sh
diff --git a/build-system/copy-provisioning-profiles-Wallet.sh b/build-system/copy-provisioning-profiles-Wallet.sh
new file mode 100755
index 0000000000..aecceef4d3
--- /dev/null
+++ b/build-system/copy-provisioning-profiles-Wallet.sh
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+copy_provisioning_profiles () {
+ if [ "$CODESIGNING_DATA_PATH" = "" ]; then
+ >&2 echo "CODESIGNING_DATA_PATH not defined"
+ exit 1
+ fi
+
+
+ PROFILES_TYPE="$1"
+ case "$PROFILES_TYPE" in
+ development)
+ EXPECTED_VARIABLES=(\
+ WALLET_DEVELOPMENT_PROVISIONING_PROFILE_APP \
+ )
+ ;;
+ distribution)
+ EXPECTED_VARIABLES=(\
+ WALLET_DISTRIBUTION_PROVISIONING_PROFILE_APP \
+ )
+ ;;
+ *)
+ echo "Unknown build provisioning type: $PROFILES_TYPE"
+ exit 1
+ ;;
+ esac
+
+ EXPECTED_VARIABLE_NAMES=(\
+ Wallet \
+ )
+
+ local SEARCH_NAMES=()
+
+ local MISSING_VARIABLES="0"
+ for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
+ if [ "${!VARIABLE_NAME}" = "" ]; then
+ echo "$VARIABLE_NAME not defined"
+ MISSING_VARIABLES="1"
+ fi
+ done
+
+ if [ "$MISSING_VARIABLES" == "1" ]; then
+ exit 1
+ fi
+
+ local VARIABLE_COUNT=${#EXPECTED_VARIABLES[@]}
+ for (( i=0; i<$VARIABLE_COUNT; i=i+1 )); do
+ VARIABLE_NAME="${EXPECTED_VARIABLES[$(($i))]}"
+ SEARCH_NAMES=("${SEARCH_NAMES[@]}" "${EXPECTED_VARIABLE_NAMES[$i]}" "${!VARIABLE_NAME}")
+ done
+
+ local DATA_PATH="build-input/data"
+
+ local OUTPUT_DIRECTORY="$DATA_PATH/provisioning-profiles"
+ rm -rf "$OUTPUT_DIRECTORY"
+ mkdir -p "$OUTPUT_DIRECTORY"
+
+ local BUILD_PATH="$OUTPUT_DIRECTORY/BUILD"
+ touch "$BUILD_PATH"
+
+ echo "exports_files([" >> "$BUILD_PATH"
+
+ local ELEMENT_COUNT=${#SEARCH_NAMES[@]}
+ local REMAINDER=$(($ELEMENT_COUNT % 2))
+
+ if [ $REMAINDER != 0 ]; then
+ >&2 echo "Expecting key-value pairs"
+ exit 1
+ fi
+
+ for PROFILE in `find "$CODESIGNING_DATA_PATH" -type f -name "*.mobileprovision"`; do
+ PROFILE_DATA=$(security cms -D -i "$PROFILE")
+ PROFILE_NAME=$(/usr/libexec/PlistBuddy -c "Print :Name" /dev/stdin <<< $(echo $PROFILE_DATA))
+ for (( i=0; i<$ELEMENT_COUNT; i=i+2 )); do
+ ID=${SEARCH_NAMES[$i]}
+ SEARCH_NAME=${SEARCH_NAMES[$(($i + 1))]}
+ if [ "$PROFILE_NAME" = "$SEARCH_NAME" ]; then
+ VARIABLE_NAME="FOUND_PROFILE_$ID"
+ if [ "${!VARIABLE_NAME}" = "" ]; then
+ eval "FOUND_PROFILE_$ID=\"$PROFILE\""
+ else
+ >&2 echo "Found multiple profiles with name \"$SEARCH_NAME\""
+ exit 1
+ fi
+ fi
+ done
+ done
+
+ for (( i=0; i<$ELEMENT_COUNT; i=i+2 )); do
+ ID=${SEARCH_NAMES[$i]}
+ SEARCH_NAME=${SEARCH_NAMES[$(($i + 1))]}
+ VARIABLE_NAME="FOUND_PROFILE_$ID"
+ FOUND_PROFILE="${!VARIABLE_NAME}"
+ if [ "$FOUND_PROFILE" = "" ]; then
+ >&2 echo "Profile \"$SEARCH_NAME\" not found"
+ exit 1
+ fi
+
+ cp "$FOUND_PROFILE" "$OUTPUT_DIRECTORY/$ID.mobileprovision"
+ echo " \"$ID.mobileprovision\"," >> $BUILD_PATH
+ done
+
+ echo "])" >> "$BUILD_PATH"
+}
diff --git a/build-system/generate-xcode-project.sh b/build-system/generate-xcode-project.sh
index 3fbd6091d0..2297776f25 100755
--- a/build-system/generate-xcode-project.sh
+++ b/build-system/generate-xcode-project.sh
@@ -4,7 +4,7 @@ set -e
APP_TARGET="$1"
if [ "$APP_TARGET" == "" ]; then
- echo "Usage: sh generate-xcode-project.sh app_target"
+ echo "Usage: sh generate-xcode-project.sh app_target_folder"
exit 1
fi
@@ -22,31 +22,6 @@ if [ "$INSTALLED_XCODE_VERSION" != "$XCODE_VERSION" ]; then
exit 1
fi
-EXPECTED_VARIABLES=(\
- BUILD_NUMBER \
- APP_VERSION \
- BUNDLE_ID \
- DEVELOPMENT_TEAM \
- API_ID \
- API_HASH \
- APP_CENTER_ID \
- IS_INTERNAL_BUILD \
- IS_APPSTORE_BUILD \
- APPSTORE_ID \
- APP_SPECIFIC_URL_SCHEME \
-)
-
-MISSING_VARIABLES="0"
-for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
- if [ "${!VARIABLE_NAME}" = "" ]; then
- echo "$VARIABLE_NAME not defined"
- MISSING_VARIABLES="1"
- fi
-done
-if [ "$MISSING_VARIABLES" == "1" ]; then
- exit 1
-fi
-
GEN_DIRECTORY="build-input/gen/project"
rm -rf "$GEN_DIRECTORY"
mkdir -p "$GEN_DIRECTORY"
@@ -84,18 +59,16 @@ fi
--bazel "$BAZEL" \
--outputfolder "$GEN_DIRECTORY" \
--target "$APP_TARGET":"$APP_TARGET" \
- --target "$APP_TARGET":Main \
- --target "$APP_TARGET":Lib \
PATCH_OPTIONS="BazelBuildOptionsDebug BazelBuildOptionsRelease"
for NAME in $PATCH_OPTIONS; do
- sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("'"$NAME"'" : {\n[ ]*"p" : "$(inherited)\)/\1'" ${BAZEL_OPTIONS[*]}"'/' "$GEN_DIRECTORY/$APP_TARGET.tulsiproj/Configs/$APP_TARGET.tulsigen"
+ sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("'"$NAME"'" : {\n[ ]*"p" : "$(inherited)\)/\1'" ${BAZEL_OPTIONS[*]}"'/' "$GEN_DIRECTORY/${APP_TARGET}.tulsiproj/Configs/${APP_TARGET}.tulsigen"
done
-sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("sourceFilters" : \[\n[ ]*\)"\.\/\.\.\."/\1"$APP_TARGET\/...", "submodules\/..."/' "$GEN_DIRECTORY/$APP_TARGET.tulsiproj/Configs/$APP_TARGET.tulsigen"
+sed -i "" -e '1h;2,$H;$!d;g' -e 's/\("sourceFilters" : \[\n[ ]*\)"\.\/\.\.\."/\1"'"${APP_TARGET}"'\/...", "submodules\/..."/' "$GEN_DIRECTORY/${APP_TARGET}.tulsiproj/Configs/${APP_TARGET}.tulsigen"
"$TULSI" -- \
--verbose \
- --genconfig "$GEN_DIRECTORY/$APP_TARGET.tulsiproj:$APP_TARGET" \
+ --genconfig "$GEN_DIRECTORY/${APP_TARGET}.tulsiproj:${APP_TARGET}" \
--bazel "$BAZEL" \
--outputfolder "$GEN_DIRECTORY" \
diff --git a/build-system/prepare-build-variables.sh b/build-system/prepare-build-variables-Telegram.sh
similarity index 100%
rename from build-system/prepare-build-variables.sh
rename to build-system/prepare-build-variables-Telegram.sh
diff --git a/build-system/prepare-build-variables-Wallet.sh b/build-system/prepare-build-variables-Wallet.sh
new file mode 100755
index 0000000000..d13544f966
--- /dev/null
+++ b/build-system/prepare-build-variables-Wallet.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+set -e
+
+prepare_build_variables () {
+ BUILD_TYPE="$1"
+ case "$BUILD_TYPE" in
+ development)
+ APS_ENVIRONMENT="development"
+ ;;
+ distribution)
+ APS_ENVIRONMENT="production"
+ ;;
+ *)
+ echo "Unknown build provisioning type: $BUILD_TYPE"
+ exit 1
+ ;;
+ esac
+
+ local BAZEL="$(which bazel)"
+ if [ "$BAZEL" = "" ]; then
+ echo "bazel not found in PATH"
+ exit 1
+ fi
+
+ local EXPECTED_VARIABLES=(\
+ BUILD_NUMBER \
+ WALLET_APP_VERSION \
+ WALLET_BUNDLE_ID \
+ WALLET_DEVELOPMENT_TEAM \
+ )
+
+ local MISSING_VARIABLES="0"
+ for VARIABLE_NAME in ${EXPECTED_VARIABLES[@]}; do
+ if [ "${!VARIABLE_NAME}" = "" ]; then
+ echo "$VARIABLE_NAME not defined"
+ MISSING_VARIABLES="1"
+ fi
+ done
+
+ if [ "$MISSING_VARIABLES" == "1" ]; then
+ exit 1
+ fi
+
+ local VARIABLES_DIRECTORY="build-input/data"
+ mkdir -p "$VARIABLES_DIRECTORY"
+ local VARIABLES_PATH="$VARIABLES_DIRECTORY/variables.bzl"
+ rm -f "$VARIABLES_PATH"
+
+ echo "wallet_build_number = \"$BUILD_NUMBER\"" >> "$VARIABLES_PATH"
+ echo "wallet_version = \"$WALLET_APP_VERSION\"" >> "$VARIABLES_PATH"
+ echo "wallet_bundle_id = \"$WALLET_BUNDLE_ID\"" >> "$VARIABLES_PATH"
+ echo "wallet_api_id = \"$WALLET_API_ID\"" >> "$VARIABLES_PATH"
+ echo "wallet_team_id = \"$WALLET_DEVELOPMENT_TEAM\"" >> "$VARIABLES_PATH"
+
+ echo "telegram_api_id = \"1\"" >> "$VARIABLES_PATH"
+ echo "telegram_api_hash = \"1\"" >> "$VARIABLES_PATH"
+ echo "telegram_app_center_id = \"1\"" >> "$VARIABLES_PATH"
+ echo "telegram_appstore_id = \"1\"" >> "$VARIABLES_PATH"
+ echo "telegram_is_internal_build = \"false\"" >> "$VARIABLES_PATH"
+ echo "telegram_is_appstore_build = \"true\"" >> "$VARIABLES_PATH"
+ echo "telegram_app_specific_url_scheme = \"\"" >> "$VARIABLES_PATH"
+}
diff --git a/build-system/prepare-build.sh b/build-system/prepare-build.sh
index c65df066f1..a98a5aa107 100755
--- a/build-system/prepare-build.sh
+++ b/build-system/prepare-build.sh
@@ -2,7 +2,13 @@
set -e
-BUILD_TYPE="$1"
+APP_TARGET="$1"
+if [ "$APP_TARGET" == "" ]; then
+ echo "Usage: sh prepare-build.sh app_target development|distribution"
+ exit 1
+fi
+
+BUILD_TYPE="$2"
case "$BUILD_TYPE" in
development)
PROFILES_TYPE="development"
@@ -18,13 +24,26 @@ esac
BASE_PATH=$(dirname $0)
+COPY_PROVISIONING_PROFILES_SCRIPT="$BASE_PATH/copy-provisioning-profiles-$APP_TARGET.sh"
+PREPARE_BUILD_VARIABLES_SCRIPT="$BASE_PATH/prepare-build-variables-$APP_TARGET.sh"
+
+if [ ! -f "$COPY_PROVISIONING_PROFILES_SCRIPT" ]; then
+ echo "$COPY_PROVISIONING_PROFILES_SCRIPT not found"
+ exit 1
+fi
+
+if [ ! -f "$PREPARE_BUILD_VARIABLES_SCRIPT" ]; then
+ echo "$PREPARE_BUILD_VARIABLES_SCRIPT not found"
+ exit 1
+fi
+
DATA_DIRECTORY="build-input/data"
rm -rf "$DATA_DIRECTORY"
mkdir -p "$DATA_DIRECTORY"
touch "$DATA_DIRECTORY/BUILD"
-source "$BASE_PATH/copy-provisioning-profiles.sh"
-source "$BASE_PATH/prepare-build-variables.sh"
+source "$COPY_PROVISIONING_PROFILES_SCRIPT"
+source "$PREPARE_BUILD_VARIABLES_SCRIPT"
echo "Copying provisioning profiles..."
copy_provisioning_profiles "$PROFILES_TYPE"
diff --git a/build-system/xcode_version b/build-system/xcode_version
index f226094f1f..1c7134df6c 100644
--- a/build-system/xcode_version
+++ b/build-system/xcode_version
@@ -1 +1 @@
-11.3.1
\ No newline at end of file
+11.4
diff --git a/submodules/AnimatedStickerNode/Sources/AnimatedStickerNode.swift b/submodules/AnimatedStickerNode/Sources/AnimatedStickerNode.swift
index cbff90d2f2..d072e2a7f2 100644
--- a/submodules/AnimatedStickerNode/Sources/AnimatedStickerNode.swift
+++ b/submodules/AnimatedStickerNode/Sources/AnimatedStickerNode.swift
@@ -543,7 +543,7 @@ public final class AnimatedStickerNode: ASDisplayNode {
let frameSourceHolder = self.frameSource
self.queue.async { [weak self] in
var maybeFrameSource: AnimatedStickerFrameSource?
- var notifyUpdated: (() -> Void)?
+ let notifyUpdated: (() -> Void)? = nil
if let directData = directData {
maybeFrameSource = AnimatedStickerDirectFrameSource(queue: queue, data: directData.0, width: directData.2, height: directData.3)
} else if let (cachedData, cachedDataComplete) = cachedData {
diff --git a/submodules/Display/Source/ActionSheetSwitchItem.swift b/submodules/Display/Source/ActionSheetSwitchItem.swift
index 110a4b4277..d2ca7393ad 100644
--- a/submodules/Display/Source/ActionSheetSwitchItem.swift
+++ b/submodules/Display/Source/ActionSheetSwitchItem.swift
@@ -42,7 +42,6 @@ public class ActionSheetSwitchNode: ActionSheetItemNode {
override public init(theme: ActionSheetControllerTheme) {
self.theme = theme
- let defaultFont = Font.regular(floor(theme.baseFontSize * 20.0 / 17.0))
self.button = HighlightTrackingButton()
self.button.isAccessibilityElement = false
diff --git a/submodules/Display/Source/ContainedViewLayoutTransition.swift b/submodules/Display/Source/ContainedViewLayoutTransition.swift
index 14f4bbf4bf..ec5b1a9ca0 100644
--- a/submodules/Display/Source/ContainedViewLayoutTransition.swift
+++ b/submodules/Display/Source/ContainedViewLayoutTransition.swift
@@ -152,8 +152,7 @@ public extension ContainedViewLayoutTransition {
if let completion = completion {
completion(true)
}
- case let .animated(duration, curve):
- let previousBounds = node.bounds
+ case .animated:
let previousCenter = node.frame.center
node.position = frame.center
node.bounds = CGRect(origin: node.bounds.origin, size: frame.size)
diff --git a/submodules/Display/Source/ContextContentContainerNode.swift b/submodules/Display/Source/ContextContentContainerNode.swift
index add4037501..441e100efd 100644
--- a/submodules/Display/Source/ContextContentContainerNode.swift
+++ b/submodules/Display/Source/ContextContentContainerNode.swift
@@ -1,6 +1,5 @@
import Foundation
import AsyncDisplayKit
-import Display
public final class ContextContentContainerNode: ASDisplayNode {
public var contentNode: ContextContentNode?
diff --git a/submodules/Display/Source/ContextContentSourceNode.swift b/submodules/Display/Source/ContextContentSourceNode.swift
index 7b2204cedc..b4818eb462 100644
--- a/submodules/Display/Source/ContextContentSourceNode.swift
+++ b/submodules/Display/Source/ContextContentSourceNode.swift
@@ -1,6 +1,5 @@
import Foundation
import AsyncDisplayKit
-import Display
public final class ContextExtractedContentContainingNode: ASDisplayNode {
public let contentNode: ContextExtractedContentNode
diff --git a/submodules/Display/Source/ContextControllerSourceNode.swift b/submodules/Display/Source/ContextControllerSourceNode.swift
index a9219fa485..7252986d5e 100644
--- a/submodules/Display/Source/ContextControllerSourceNode.swift
+++ b/submodules/Display/Source/ContextControllerSourceNode.swift
@@ -1,6 +1,5 @@
import Foundation
import AsyncDisplayKit
-import Display
public final class ContextControllerSourceNode: ASDisplayNode {
private var contextGesture: ContextGesture?
diff --git a/submodules/Display/Source/ContextGesture.swift b/submodules/Display/Source/ContextGesture.swift
index 5a758cc8c8..052d2be0d3 100644
--- a/submodules/Display/Source/ContextGesture.swift
+++ b/submodules/Display/Source/ContextGesture.swift
@@ -1,7 +1,6 @@
import Foundation
import UIKit
import AsyncDisplayKit
-import Display
public enum ContextGestureTransition {
case begin
@@ -207,7 +206,7 @@ public final class ContextGesture: UIGestureRecognizer, UIGestureRecognizerDeleg
override public func touchesCancelled(_ touches: Set, with event: UIEvent) {
super.touchesCancelled(touches, with: event)
- if let touch = touches.first, !self.currentProgress.isZero, self.isValidated {
+ if let _ = touches.first, !self.currentProgress.isZero, self.isValidated {
let previousProgress = self.currentProgress
self.currentProgress = 0.0
self.activationProgress?(0.0, .ended(previousProgress))
diff --git a/submodules/Display/Source/Font.swift b/submodules/Display/Source/Font.swift
index 73f987b832..0a9779afb6 100644
--- a/submodules/Display/Source/Font.swift
+++ b/submodules/Display/Source/Font.swift
@@ -34,7 +34,7 @@ public struct Font {
public static func with(size: CGFloat, design: Design = .regular, traits: Traits = []) -> UIFont {
if #available(iOS 13.0, *) {
- var descriptor = UIFont.systemFont(ofSize: size).fontDescriptor
+ let descriptor = UIFont.systemFont(ofSize: size).fontDescriptor
var symbolicTraits = descriptor.symbolicTraits
if traits.contains(.bold) {
symbolicTraits.insert(.traitBold)
diff --git a/submodules/Display/Source/GridNode.swift b/submodules/Display/Source/GridNode.swift
index 754fe54029..916d9d194b 100644
--- a/submodules/Display/Source/GridNode.swift
+++ b/submodules/Display/Source/GridNode.swift
@@ -179,13 +179,13 @@ private struct WrappedGridSection: Equatable, Hashable {
self.section = section
}
- var hashValue: Int {
- return self.section.hashValue
- }
-
static func ==(lhs: WrappedGridSection, rhs: WrappedGridSection) -> Bool {
return lhs.section.isEqual(to: rhs.section)
}
+
+ func hash(into hasher: inout Hasher) {
+ hasher.combine(self.section.hashValue)
+ }
}
public struct GridNodeVisibleItems {
@@ -200,10 +200,6 @@ public struct GridNodeVisibleItems {
private struct WrappedGridItemNode: Hashable {
let node: ASDisplayNode
- var hashValue: Int {
- return node.hashValue
- }
-
static func ==(lhs: WrappedGridItemNode, rhs: WrappedGridItemNode) -> Bool {
return lhs.node === rhs.node
}
diff --git a/submodules/Display/Source/ImageCorners.swift b/submodules/Display/Source/ImageCorners.swift
index 948a4d385d..62dbc83251 100644
--- a/submodules/Display/Source/ImageCorners.swift
+++ b/submodules/Display/Source/ImageCorners.swift
@@ -6,79 +6,24 @@ import SwiftSignalKit
private enum Corner: Hashable {
case TopLeft(Int), TopRight(Int), BottomLeft(Int), BottomRight(Int)
- var hashValue: Int {
- switch self {
- case let .TopLeft(radius):
- return radius | (1 << 24)
- case let .TopRight(radius):
- return radius | (2 << 24)
- case let .BottomLeft(radius):
- return radius | (3 << 24)
- case let .BottomRight(radius):
- return radius | (4 << 24)
- }
- }
-
var radius: Int {
switch self {
- case let .TopLeft(radius):
- return radius
- case let .TopRight(radius):
- return radius
- case let .BottomLeft(radius):
- return radius
- case let .BottomRight(radius):
- return radius
+ case let .TopLeft(radius):
+ return radius
+ case let .TopRight(radius):
+ return radius
+ case let .BottomLeft(radius):
+ return radius
+ case let .BottomRight(radius):
+ return radius
}
}
}
-private func ==(lhs: Corner, rhs: Corner) -> Bool {
- switch lhs {
- case let .TopLeft(lhsRadius):
- switch rhs {
- case let .TopLeft(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- case let .TopRight(lhsRadius):
- switch rhs {
- case let .TopRight(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- case let .BottomLeft(lhsRadius):
- switch rhs {
- case let .BottomLeft(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- case let .BottomRight(lhsRadius):
- switch rhs {
- case let .BottomRight(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- }
-}
-
private enum Tail: Hashable {
case BottomLeft(Int)
case BottomRight(Int)
- var hashValue: Int {
- switch self {
- case let .BottomLeft(radius):
- return radius | (1 << 24)
- case let .BottomRight(radius):
- return radius | (2 << 24)
- }
- }
-
var radius: Int {
switch self {
case let .BottomLeft(radius):
@@ -89,25 +34,6 @@ private enum Tail: Hashable {
}
}
-private func ==(lhs: Tail, rhs: Tail) -> Bool {
- switch lhs {
- case let .BottomLeft(lhsRadius):
- switch rhs {
- case let .BottomLeft(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- case let .BottomRight(lhsRadius):
- switch rhs {
- case let .BottomRight(rhsRadius) where rhsRadius == lhsRadius:
- return true
- default:
- return false
- }
- }
-}
-
private var cachedCorners = Atomic<[Corner: DrawingContext]>(value: [:])
private func cornerContext(_ corner: Corner) -> DrawingContext {
diff --git a/submodules/Display/Source/KeyShortcut.swift b/submodules/Display/Source/KeyShortcut.swift
index 4687d9b23d..2499500ddc 100644
--- a/submodules/Display/Source/KeyShortcut.swift
+++ b/submodules/Display/Source/KeyShortcut.swift
@@ -13,8 +13,9 @@ public struct KeyShortcut: Hashable {
self.action = action
}
- public var hashValue: Int {
- return input.hashValue ^ modifiers.hashValue
+ public func hash(into hasher: inout Hasher) {
+ hasher.combine(self.input)
+ hasher.combine(self.modifiers)
}
public static func ==(lhs: KeyShortcut, rhs: KeyShortcut) -> Bool {
diff --git a/submodules/Display/Source/ListView.swift b/submodules/Display/Source/ListView.swift
index 72927aca54..221957c580 100644
--- a/submodules/Display/Source/ListView.swift
+++ b/submodules/Display/Source/ListView.swift
@@ -882,8 +882,6 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
var completeHeight: CGFloat = 0.0
var topItemFound = false
var bottomItemFound = false
- var topItemEdge: CGFloat = 0.0
- var bottomItemEdge: CGFloat = 0.0
for i in 0 ..< self.itemNodes.count {
if let index = itemNodes[i].index {
@@ -900,25 +898,15 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
effectiveInsets.top = max(effectiveInsets.top, self.visibleSize.height - additionalInverseTopInset)
}
- if topItemFound {
- topItemEdge = itemNodes[0].apparentFrame.origin.y
- }
-
- var bottomItemNode: ListViewItemNode?
for i in (0 ..< self.itemNodes.count).reversed() {
if let index = itemNodes[i].index {
if index == self.items.count - 1 {
- bottomItemNode = itemNodes[i]
bottomItemFound = true
}
break
}
}
- if bottomItemFound {
- bottomItemEdge = itemNodes[itemNodes.count - 1].apparentFrame.maxY
- }
-
if topItemFound && bottomItemFound {
for itemNode in self.itemNodes {
completeHeight += itemNode.apparentBounds.height
@@ -1119,7 +1107,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
}
}
if topItemIndexAndMinY.0 == 0 {
- var offsetValue: CGFloat = -(topItemIndexAndMinY.1 - self.insets.top)
+ let offsetValue: CGFloat = -(topItemIndexAndMinY.1 - self.insets.top)
offset = .known(offsetValue)
} else if topItemIndexAndMinY.0 == -1 {
offset = .none
@@ -1950,7 +1938,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
private func fillMissingNodes(synchronous: Bool, synchronousLoads: Bool, animated: Bool, inputAnimatedInsertIndices: Set, insertDirectionHints: [Int: ListViewItemOperationDirectionHint], inputState: ListViewState, inputPreviousNodes: [Int: QueueLocalObject], inputOperations: [ListViewStateOperation], inputCompletion: @escaping (ListViewState, [ListViewStateOperation]) -> Void) {
let animatedInsertIndices = inputAnimatedInsertIndices
var state = inputState
- var previousNodes = inputPreviousNodes
+ let previousNodes = inputPreviousNodes
var operations = inputOperations
let completion = inputCompletion
let updateAnimation: ListViewItemUpdateAnimation = animated ? .System(duration: insertionAnimationDuration) : .None
@@ -2680,7 +2668,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
self.visibleSize = updateSizeAndInsets.size
var offsetFix: CGFloat
- var insetDeltaOffsetFix: CGFloat = 0.0
+ let insetDeltaOffsetFix: CGFloat = 0.0
if self.isTracking || isExperimentalSnapToScrollToItem {
offsetFix = 0.0
} else if self.snapToBottomInsetUntilFirstInteraction {
@@ -4009,7 +3997,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
}
public func cancelSelection() {
- if let selectionTouchLocation = self.selectionTouchLocation {
+ if let _ = self.selectionTouchLocation {
self.clearHighlightAnimated(true)
self.selectionTouchLocation = nil
}
diff --git a/submodules/Display/Source/NativeWindowHostView.swift b/submodules/Display/Source/NativeWindowHostView.swift
index b408471db7..035d3ac0e7 100644
--- a/submodules/Display/Source/NativeWindowHostView.swift
+++ b/submodules/Display/Source/NativeWindowHostView.swift
@@ -23,6 +23,8 @@ public enum WindowUserInterfaceStyle {
self = .light
case .dark:
self = .dark
+ @unknown default:
+ self = .dark
}
}
}
@@ -188,33 +190,6 @@ private final class WindowRootViewController: UIViewController, UIViewController
private var previewingContext: AnyObject?
private func updatePreviewingRegistration() {
- var shouldRegister = false
-
- var isVoiceOverRunning = false
- if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
- isVoiceOverRunning = UIAccessibility.isVoiceOverRunning
- }
- if !isVoiceOverRunning {
- shouldRegister = true
- }
-
- shouldRegister = false
-
- if shouldRegister != self.registeredForPreviewing {
- self.registeredForPreviewing = shouldRegister
- if shouldRegister {
- if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
- self.previewingContext = self.registerForPreviewing(with: self, sourceView: self.view)
- }
- } else if let previewingContext = self.previewingContext {
- self.previewingContext = nil
- if let previewingContext = previewingContext as? UIViewControllerPreviewing {
- if #available(iOSApplicationExtension 9.0, iOS 9.0, *) {
- self.unregisterForPreviewing(withContext: previewingContext)
- }
- }
- }
- }
}
private weak var previousPreviewingHostView: (UIView & PreviewingHostView)?
diff --git a/submodules/Display/Source/Navigation/NavigationContainer.swift b/submodules/Display/Source/Navigation/NavigationContainer.swift
index b5be8762d8..f8c5e7dea3 100644
--- a/submodules/Display/Source/Navigation/NavigationContainer.swift
+++ b/submodules/Display/Source/Navigation/NavigationContainer.swift
@@ -41,7 +41,7 @@ final class NavigationContainer: ASDisplayNode, UIGestureRecognizerDelegate {
update(strongSelf)
}
}))
- if let localIsReady = localIsReady {
+ if let _ = localIsReady {
self.isReady = true
} else {
localIsReady = false
@@ -170,12 +170,9 @@ final class NavigationContainer: ASDisplayNode, UIGestureRecognizerDelegate {
let topController = self.controllers[self.controllers.count - 1]
let bottomController = self.controllers[self.controllers.count - 2]
- if let topController = topController as? ViewController {
- if !topController.attemptNavigation({ [weak self] in
- //let _ = self?.popViewController(animated: true)
- }) {
- return
- }
+ if !topController.attemptNavigation({
+ }) {
+ return
}
topController.viewWillDisappear(true)
@@ -221,12 +218,11 @@ final class NavigationContainer: ASDisplayNode, UIGestureRecognizerDelegate {
if velocity > 1000 || navigationTransitionCoordinator.progress > 0.2 {
navigationTransitionCoordinator.animateCompletion(velocity, completion: { [weak self] in
- guard let strongSelf = self, let layout = strongSelf.state.layout, let transition = strongSelf.state.transition, let top = strongSelf.state.top else {
+ guard let strongSelf = self, let _ = strongSelf.state.layout, let _ = strongSelf.state.transition, let top = strongSelf.state.top else {
return
}
let topController = top.value
- let bottomController = transition.previous.value
if viewTreeContainsFirstResponder(view: top.value.view) {
strongSelf.ignoreInputHeight = true
@@ -349,7 +345,7 @@ final class NavigationContainer: ASDisplayNode, UIGestureRecognizerDelegate {
var updatedStatusBarStyle = self.statusBarStyle
if let top = self.state.top {
var updatedLayout = layout
- if let topTransition = self.state.transition, top.value.view.disableAutomaticKeyboardHandling.isEmpty {
+ if let _ = self.state.transition, top.value.view.disableAutomaticKeyboardHandling.isEmpty {
if !viewTreeContainsFirstResponder(view: top.value.view) {
updatedLayout = updatedLayout.withUpdatedInputHeight(nil)
}
diff --git a/submodules/Display/Source/Navigation/NavigationController.swift b/submodules/Display/Source/Navigation/NavigationController.swift
index 1240f957d3..e2d395ffbf 100644
--- a/submodules/Display/Source/Navigation/NavigationController.swift
+++ b/submodules/Display/Source/Navigation/NavigationController.swift
@@ -155,7 +155,7 @@ open class NavigationController: UINavigationController, ContainableController,
private var _viewControllers: [ViewController] = []
override open var viewControllers: [UIViewController] {
get {
- return self._viewControllers.map { $0 as! ViewController }
+ return self._viewControllers.map { $0 as UIViewController }
} set(value) {
self.setViewControllers(value, animated: false)
}
@@ -287,7 +287,6 @@ open class NavigationController: UINavigationController, ContainableController,
}
public func updateTheme(_ theme: NavigationControllerTheme) {
- let statusBarStyleUpdated = self.theme.statusBar != theme.statusBar
self.theme = theme
if let rootContainer = self.rootContainer {
switch rootContainer {
@@ -790,7 +789,7 @@ open class NavigationController: UINavigationController, ContainableController,
}
let rootModalFrame: NavigationModalFrame
- var modalFrameTransition: ContainedViewLayoutTransition = transition
+ let modalFrameTransition: ContainedViewLayoutTransition = transition
var forceStatusBarAnimation = false
if let current = self.rootModalFrame {
rootModalFrame = current
@@ -1165,7 +1164,7 @@ open class NavigationController: UINavigationController, ContainableController,
self.overlayContainers.append(container)
}
container.isReadyUpdated = { [weak self, weak container] in
- guard let strongSelf = self, let container = container else {
+ guard let strongSelf = self, let _ = container else {
return
}
strongSelf.updateContainersNonReentrant(transition: .immediate)
@@ -1245,7 +1244,7 @@ open class NavigationController: UINavigationController, ContainableController,
self.view.setNeedsLayout()
}
- private func requestLayout(transition: ContainedViewLayoutTransition) {
+ public func requestLayout(transition: ContainedViewLayoutTransition) {
if self.isViewLoaded, let validLayout = self.validLayout {
self.containerLayoutUpdated(validLayout, transition: transition)
}
diff --git a/submodules/Display/Source/NavigationBackButtonNode.swift b/submodules/Display/Source/NavigationBackButtonNode.swift
index b6082776f2..3a6e5176c4 100644
--- a/submodules/Display/Source/NavigationBackButtonNode.swift
+++ b/submodules/Display/Source/NavigationBackButtonNode.swift
@@ -69,7 +69,7 @@ public class NavigationBackButtonNode: ASControlNode {
}
public override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
- self.label.updateLayout(CGSize(width: max(0.0, constrainedSize.width - self.arrow.frame.size.width - self.arrowSpacing), height: constrainedSize.height))
+ let _ = self.label.updateLayout(CGSize(width: max(0.0, constrainedSize.width - self.arrow.frame.size.width - self.arrowSpacing), height: constrainedSize.height))
return CGSize(width: self.arrow.frame.size.width + self.arrowSpacing + self.label.calculatedSize.width, height: max(self.arrow.frame.size.height, self.label.calculatedSize.height))
}
diff --git a/submodules/Display/Source/NavigationBar.swift b/submodules/Display/Source/NavigationBar.swift
index f59718cc6e..217c0d133a 100644
--- a/submodules/Display/Source/NavigationBar.swift
+++ b/submodules/Display/Source/NavigationBar.swift
@@ -1059,7 +1059,7 @@ open class NavigationBar: ASDisplayNode {
node.updateManualText(self.backButtonNode.manualText)
node.color = accentColor
if let (size, defaultHeight, _, _, _, _) = self.validLayout {
- node.updateLayout(constrainedSize: CGSize(width: size.width, height: defaultHeight))
+ let _ = node.updateLayout(constrainedSize: CGSize(width: size.width, height: defaultHeight))
node.frame = self.backButtonNode.frame
}
return node
@@ -1082,7 +1082,7 @@ open class NavigationBar: ASDisplayNode {
node.updateItems(items)
node.color = accentColor
if let (size, defaultHeight, _, _, _, _) = self.validLayout {
- node.updateLayout(constrainedSize: CGSize(width: size.width, height: defaultHeight))
+ let _ = node.updateLayout(constrainedSize: CGSize(width: size.width, height: defaultHeight))
node.frame = self.backButtonNode.frame
}
return node
diff --git a/submodules/Display/Source/NavigationButtonNode.swift b/submodules/Display/Source/NavigationButtonNode.swift
index 62217eeac6..22e369a229 100644
--- a/submodules/Display/Source/NavigationButtonNode.swift
+++ b/submodules/Display/Source/NavigationButtonNode.swift
@@ -62,22 +62,15 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
} set(value) {
_image = value
- if let value = value {
+ if let _ = value {
if self.imageNode == nil {
let imageNode = ASImageNode()
imageNode.displayWithoutProcessing = true
imageNode.displaysAsynchronously = false
self.imageNode = imageNode
- if false, value.size == CGSize(width: 30.0, height: 30.0) {
- if self.imageRippleNode.supernode == nil {
- self.addSubnode(self.imageRippleNode)
- self.imageRippleNode.image = generateFilledCircleImage(diameter: 30.0, color: self.rippleColor)
- }
- } else {
- if self.imageRippleNode.supernode != nil {
- self.imageRippleNode.image = nil
- self.imageRippleNode.removeFromSupernode()
- }
+ if self.imageRippleNode.supernode != nil {
+ self.imageRippleNode.image = nil
+ self.imageRippleNode.removeFromSupernode()
}
self.addSubnode(imageNode)
diff --git a/submodules/Display/Source/NavigationTitleNode.swift b/submodules/Display/Source/NavigationTitleNode.swift
index ef3db73f23..fb87efe9a6 100644
--- a/submodules/Display/Source/NavigationTitleNode.swift
+++ b/submodules/Display/Source/NavigationTitleNode.swift
@@ -48,7 +48,7 @@ public class NavigationTitleNode: ASDisplayNode {
}
public override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
- self.label.updateLayout(constrainedSize)
+ let _ = self.label.updateLayout(constrainedSize)
return self.label.calculatedSize
}
diff --git a/submodules/Display/Source/TransformImageArguments.swift b/submodules/Display/Source/TransformImageArguments.swift
index ae8051f6ea..fd3b359d7e 100644
--- a/submodules/Display/Source/TransformImageArguments.swift
+++ b/submodules/Display/Source/TransformImageArguments.swift
@@ -54,7 +54,7 @@ public struct TransformImageArguments: Equatable {
}
public static func ==(lhs: TransformImageArguments, rhs: TransformImageArguments) -> Bool {
- var result = lhs.imageSize == rhs.imageSize && lhs.boundingSize == rhs.boundingSize && lhs.corners == rhs.corners && lhs.emptyColor == rhs.emptyColor
+ let result = lhs.imageSize == rhs.imageSize && lhs.boundingSize == rhs.boundingSize && lhs.corners == rhs.corners && lhs.emptyColor == rhs.emptyColor
if result {
if let lhsCustom = lhs.custom, let rhsCustom = rhs.custom {
return lhsCustom.serialized().isEqual(rhsCustom.serialized())
diff --git a/submodules/Display/Source/UIKitUtils.swift b/submodules/Display/Source/UIKitUtils.swift
index 19ad82264e..bb506e410b 100644
--- a/submodules/Display/Source/UIKitUtils.swift
+++ b/submodules/Display/Source/UIKitUtils.swift
@@ -316,7 +316,7 @@ public func assertNotOnMainThread(_ file: String = #file, line: Int = #line) {
}
public extension UIImage {
- public func precomposed() -> UIImage {
+ func precomposed() -> UIImage {
UIGraphicsBeginImageContextWithOptions(self.size, false, self.scale)
self.draw(at: CGPoint())
let result = UIGraphicsGetImageFromCurrentImageContext()!
diff --git a/submodules/Display/Source/ViewController.swift b/submodules/Display/Source/ViewController.swift
index 2ab2e83846..78c06097ed 100644
--- a/submodules/Display/Source/ViewController.swift
+++ b/submodules/Display/Source/ViewController.swift
@@ -562,18 +562,6 @@ public enum TabBarItemContextActionType {
@available(iOSApplicationExtension 9.0, iOS 9.0, *)
open func registerForPreviewing(with delegate: UIViewControllerPreviewingDelegate, sourceView: UIView, theme: PeekControllerTheme, onlyNative: Bool) {
- if false, self.traitCollection.forceTouchCapability == .available {
- let _ = super.registerForPreviewing(with: delegate, sourceView: sourceView)
- } else if !onlyNative {
- if self.previewingContext == nil {
- let previewingContext = SimulatedViewControllerPreviewing(theme: theme, delegate: delegate, sourceView: sourceView, node: self.displayNode, present: { [weak self] c, a in
- self?.presentInGlobalOverlay(c, with: a)
- }, customPresent: { [weak self] c, n in
- return self?.customPresentPreviewingController?(c, n)
- })
- self.previewingContext = previewingContext
- }
- }
}
@available(iOSApplicationExtension 9.0, iOS 9.0, *)
diff --git a/submodules/Display/Source/WallpaperBackgroundNode.swift b/submodules/Display/Source/WallpaperBackgroundNode.swift
index 203f3632de..65de835a13 100644
--- a/submodules/Display/Source/WallpaperBackgroundNode.swift
+++ b/submodules/Display/Source/WallpaperBackgroundNode.swift
@@ -42,7 +42,6 @@ public final class WallpaperBackgroundNode: ASDisplayNode {
public var rotation: CGFloat = 0.0 {
didSet {
- let transition: ContainedViewLayoutTransition = .animated(duration: 0.3, curve: .easeInOut)
var fromValue: CGFloat = 0.0
if let value = (self.layer.value(forKeyPath: "transform.rotation.z") as? NSNumber)?.floatValue {
fromValue = CGFloat(value)
diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift
index ba17a06b9a..1c89b1b330 100644
--- a/submodules/Display/Source/WindowContent.swift
+++ b/submodules/Display/Source/WindowContent.swift
@@ -338,10 +338,10 @@ public class Window1 {
}
strongSelf._rootController?.displayNode.accessibilityElementsHidden = strongSelf.presentationContext.hasOpaqueOverlay || strongSelf.topPresentationContext.hasOpaqueOverlay
}
- self.presentationContext.updateHasOpaqueOverlay = { [weak self] value in
+ self.presentationContext.updateHasOpaqueOverlay = { value in
updateOpaqueOverlays()
}
- self.topPresentationContext.updateHasOpaqueOverlay = { [weak self] value in
+ self.topPresentationContext.updateHasOpaqueOverlay = { value in
updateOpaqueOverlays()
}
@@ -846,7 +846,7 @@ public class Window1 {
}
private func layoutSubviews(force: Bool) {
- if self.tracingStatusBarsInvalidated, let keyboardManager = keyboardManager {
+ if self.tracingStatusBarsInvalidated, let _ = keyboardManager {
self.tracingStatusBarsInvalidated = false
var supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .all)
@@ -1226,11 +1226,11 @@ public class Window1 {
if let navigationController = self._rootController as? NavigationController {
if !excludeNavigationSubControllers {
for case let controller as ContainableController in navigationController.viewControllers {
- !f(controller)
+ let _ = f(controller)
}
}
if let controller = navigationController.topOverlayController {
- !f(controller)
+ let _ = f(controller)
}
}
for (controller, _) in self.presentationContext.controllers {
diff --git a/submodules/LocalAuth/Sources/LocalAuth.swift b/submodules/LocalAuth/Sources/LocalAuth.swift
index 6b7ef0aebf..da84d38257 100644
--- a/submodules/LocalAuth/Sources/LocalAuth.swift
+++ b/submodules/LocalAuth/Sources/LocalAuth.swift
@@ -13,12 +13,14 @@ public struct LocalAuth {
if context.canEvaluatePolicy(LAPolicy(rawValue: Int(kLAPolicyDeviceOwnerAuthenticationWithBiometrics))!, error: nil) {
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
switch context.biometryType {
- case .faceID:
- return .faceId
- case .touchID:
- return .touchId
- case .none:
- return nil
+ case .faceID:
+ return .faceId
+ case .touchID:
+ return .touchId
+ case .none:
+ return nil
+ @unknown default:
+ return nil
}
} else {
return .touchId
diff --git a/submodules/QrCode/Sources/QrCode.swift b/submodules/QrCode/Sources/QrCode.swift
index 44c53e7c60..5e26ae2357 100644
--- a/submodules/QrCode/Sources/QrCode.swift
+++ b/submodules/QrCode/Sources/QrCode.swift
@@ -13,12 +13,12 @@ public enum QrCodeIcon {
}
private func floorToContextPixels(_ value: CGFloat, scale: CGFloat? = UIScreenScale) -> CGFloat {
- var scale = scale ?? UIScreenScale
+ let scale = scale ?? UIScreenScale
return floor(value * scale) / scale
}
private func roundToContextPixels(_ value: CGFloat, scale: CGFloat? = UIScreenScale) -> CGFloat {
- var scale = scale ?? UIScreenScale
+ let scale = scale ?? UIScreenScale
return round(value * scale) / scale
}
diff --git a/submodules/RMIntro/BUILD b/submodules/RMIntro/BUILD
index 646805cab6..ac8505a76a 100644
--- a/submodules/RMIntro/BUILD
+++ b/submodules/RMIntro/BUILD
@@ -1,4 +1,4 @@
-load("//build-system:unique_directories.bzl", "unique_directories")
+load("//build-system/bazel-utils:unique_directories.bzl", "unique_directories")
private_headers = glob([
"Sources/**/*.h",
diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift
index 5287ac158b..8a9b9ce65a 100644
--- a/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift
+++ b/submodules/SSignalKit/SwiftSignalKit/Source/Disposable.swift
@@ -152,7 +152,7 @@ public final class DisposableSet : Disposable {
public func remove(_ disposable: Disposable) {
pthread_mutex_lock(&self.lock)
- if let index = self.disposables.index(where: { $0 === disposable }) {
+ if let index = self.disposables.firstIndex(where: { $0 === disposable }) {
self.disposables.remove(at: index)
}
pthread_mutex_unlock(&self.lock)
diff --git a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Dispatch.swift b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Dispatch.swift
index 2a921b2e37..f4392f460a 100644
--- a/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Dispatch.swift
+++ b/submodules/SSignalKit/SwiftSignalKit/Source/Signal_Dispatch.swift
@@ -30,19 +30,19 @@ public func deliverOn(_ threadPool: ThreadPool) -> (Signal) -> Signa
let queue = threadPool.nextQueue()
return signal.start(next: { next in
queue.addTask(ThreadPoolTask { state in
- if !state.cancelled.with { $0 } {
+ if !state.cancelled.with({ $0 }) {
subscriber.putNext(next)
}
})
}, error: { error in
queue.addTask(ThreadPoolTask { state in
- if !state.cancelled.with { $0 } {
+ if !state.cancelled.with({ $0 }) {
subscriber.putError(error)
}
})
}, completed: {
queue.addTask(ThreadPoolTask { state in
- if !state.cancelled.with { $0 } {
+ if !state.cancelled.with({ $0 }) {
subscriber.putCompletion()
}
})
@@ -97,7 +97,7 @@ public func runOn(_ threadPool: ThreadPool) -> (Signal) -> Signal Bool {
pthread_mutex_lock(&threadPool.mutex);
if queue != nil {
- if let index = threadPool.takenQueues.index(of: queue) {
+ if let index = threadPool.takenQueues.firstIndex(of: queue) {
threadPool.takenQueues.remove(at: index)
}
@@ -97,7 +97,7 @@ public func ==(lhs: ThreadPoolQueue, rhs: ThreadPoolQueue) -> Bool {
task = queue.popFirstTask()
threadPool.takenQueues.append(queue)
- if let index = threadPool.queues.index(of: queue) {
+ if let index = threadPool.queues.firstIndex(of: queue) {
threadPool.queues.remove(at: index)
}
diff --git a/submodules/ScreenCaptureDetection/Sources/ScreenCaptureDetection.swift b/submodules/ScreenCaptureDetection/Sources/ScreenCaptureDetection.swift
index 26f6bfba5b..3da80a4947 100644
--- a/submodules/ScreenCaptureDetection/Sources/ScreenCaptureDetection.swift
+++ b/submodules/ScreenCaptureDetection/Sources/ScreenCaptureDetection.swift
@@ -83,10 +83,10 @@ public final class ScreenCaptureDetectionManager {
public init(check: @escaping () -> Bool) {
self.observer = NotificationCenter.default.addObserver(forName: UIApplication.userDidTakeScreenshotNotification, object: nil, queue: .main, using: { [weak self] _ in
- guard let strongSelf = self else {
+ guard let _ = self else {
return
}
- check()
+ let _ = check()
})
self.screenRecordingDisposable = screenRecordingActive().start(next: { [weak self] value in
@@ -116,7 +116,9 @@ public final class ScreenCaptureDetectionManager {
}
deinit {
- NotificationCenter.default.removeObserver(self.observer)
+ if let observer = self.observer {
+ NotificationCenter.default.removeObserver(observer)
+ }
self.screenRecordingDisposable?.dispose()
self.screenRecordingCheckTimer?.invalidate()
self.screenRecordingCheckTimer = nil
diff --git a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
index 2bfd0b4880..d8756f5bba 100644
--- a/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
+++ b/submodules/SolidRoundedButtonNode/Sources/SolidRoundedButtonNode.swift
@@ -154,7 +154,7 @@ public final class SolidRoundedButtonNode: ASDisplayNode {
}
let spacingOffset: CGFloat = 9.0
- var verticalInset: CGFloat = self.subtitle == nil ? floor((buttonFrame.height - titleSize.height) / 2.0) : floor((buttonFrame.height - titleSize.height) / 2.0) - spacingOffset
+ let verticalInset: CGFloat = self.subtitle == nil ? floor((buttonFrame.height - titleSize.height) / 2.0) : floor((buttonFrame.height - titleSize.height) / 2.0) - spacingOffset
let titleFrame = CGRect(origin: CGPoint(x: buttonFrame.minX + nextContentOrigin, y: buttonFrame.minY + verticalInset), size: titleSize)
transition.updateFrame(node: self.titleNode, frame: titleFrame)
diff --git a/submodules/TonBinding/Sources/TON.h b/submodules/TonBinding/Sources/TON.h
index f29b344a57..5e95749e2a 100644
--- a/submodules/TonBinding/Sources/TON.h
+++ b/submodules/TonBinding/Sources/TON.h
@@ -59,11 +59,20 @@ NS_ASSUME_NONNULL_BEGIN
@end
-@interface TONTransactionMessageContentsEncryptedText : NSObject
+@interface TONEncryptedData : NSObject
+@property (nonatomic, strong, readonly) NSString * _Nonnull sourceAddress;
@property (nonatomic, strong, readonly) NSData * _Nonnull data;
-- (instancetype)initWithData:(NSData * _Nonnull)data;
+- (instancetype)initWithSourceAddress:(NSString * _Nonnull)sourceAddress data:(NSData * _Nonnull)data;
+
+@end
+
+@interface TONTransactionMessageContentsEncryptedText : NSObject
+
+@property (nonatomic, strong, readonly) TONEncryptedData * _Nonnull encryptedData;
+
+- (instancetype)initWithEncryptedData:(TONEncryptedData * _Nonnull)encryptedData;
@end
@@ -168,7 +177,7 @@ NS_ASSUME_NONNULL_BEGIN
- (SSignal *)deleteKey:(TONKey *)key;
- (SSignal *)deleteAllKeys;
- (SSignal *)getTransactionListWithAddress:(NSString * _Nonnull)address lt:(int64_t)lt hash:(NSData * _Nonnull)hash;
-- (SSignal *)decryptMessagesWithKey:(TONKey * _Nonnull)key localPassword:(NSData * _Nonnull)localPassword messages:(NSArray * _Nonnull)messages;
+- (SSignal *)decryptMessagesWithKey:(TONKey * _Nonnull)key localPassword:(NSData * _Nonnull)localPassword messages:(NSArray * _Nonnull)messages;
- (NSData *)encrypt:(NSData *)decryptedData secret:(NSData *)data;
- (NSData * __nullable)decrypt:(NSData *)encryptedData secret:(NSData *)data;
diff --git a/submodules/TonBinding/Sources/TON.mm b/submodules/TonBinding/Sources/TON.mm
index 4b7fdb6bc6..99c53cbbda 100644
--- a/submodules/TonBinding/Sources/TON.mm
+++ b/submodules/TonBinding/Sources/TON.mm
@@ -46,8 +46,8 @@ static TONTransactionMessage * _Nullable parseTransactionMessage(tonlib_api::obj
if (message == nullptr) {
return nil;
}
- NSString *source = readString(message->source_);
- NSString *destination = readString(message->destination_);
+ NSString *source = readString(message->source_->account_address_);
+ NSString *destination = readString(message->destination_->account_address_);
id contents = nil;
if (message->msg_data_->get_id() == tonlib_api::msg_dataRaw::ID) {
@@ -71,7 +71,8 @@ static TONTransactionMessage * _Nullable parseTransactionMessage(tonlib_api::obj
}
} else if (message->msg_data_->get_id() == tonlib_api::msg_dataEncryptedText::ID) {
auto msgData = tonlib_api::move_object_as(message->msg_data_);
- contents = [[TONTransactionMessageContentsEncryptedText alloc] initWithData:makeData(msgData->text_)];
+ TONEncryptedData *encryptedData = [[TONEncryptedData alloc] initWithSourceAddress:source data:makeData(msgData->text_)];
+ contents = [[TONTransactionMessageContentsEncryptedText alloc] initWithEncryptedData:encryptedData];
} else {
contents = [[TONTransactionMessageContentsRawData alloc] initWithData:[NSData data]];
}
@@ -150,10 +151,10 @@ static TONTransactionMessage * _Nullable parseTransactionMessage(tonlib_api::obj
@implementation TONTransactionMessageContentsEncryptedText
-- (instancetype)initWithData:(NSData * _Nonnull)data {
+- (instancetype)initWithEncryptedData:(TONEncryptedData * _Nonnull)encryptedData {
self = [super init];
if (self != nil) {
- _data = data;
+ _encryptedData = encryptedData;
}
return self;
}
@@ -274,6 +275,19 @@ static TONTransactionMessage * _Nullable parseTransactionMessage(tonlib_api::obj
@end
+@implementation TONEncryptedData
+
+- (instancetype)initWithSourceAddress:(NSString * _Nonnull)sourceAddress data:(NSData * _Nonnull)data {
+ self = [super init];
+ if (self != nil) {
+ _sourceAddress = sourceAddress;
+ _data = data;
+ }
+ return self;
+}
+
+@end
+
using tonlib_api::make_object;
@interface TONReceiveThreadParams : NSObject
@@ -752,6 +766,7 @@ typedef enum {
std::vector > inputMessages;
inputMessages.push_back(make_object(
make_object(address.UTF8String),
+ makeString([NSData data]),
amount,
tonlib_api::move_object_as(inputMessageData)
));
@@ -812,6 +827,7 @@ typedef enum {
std::vector > inputMessages;
inputMessages.push_back(make_object(
make_object(address.UTF8String),
+ makeString([NSData data]),
amount,
tonlib_api::move_object_as(inputMessageData)
));
@@ -1093,7 +1109,7 @@ typedef enum {
}] startOn:[SQueue mainQueue]] deliverOn:[SQueue mainQueue]];
}
-- (SSignal *)decryptMessagesWithKey:(TONKey * _Nonnull)key localPassword:(NSData * _Nonnull)localPassword messages:(NSArray * _Nonnull)messages {
+- (SSignal *)decryptMessagesWithKey:(TONKey * _Nonnull)key localPassword:(NSData * _Nonnull)localPassword messages:(NSArray * _Nonnull)messages {
return [[[[SSignal alloc] initWithGenerator:^id(SSubscriber *subscriber) {
NSData *publicKeyData = [key.publicKey dataUsingEncoding:NSUTF8StringEncoding];
if (publicKeyData == nil) {
@@ -1108,24 +1124,24 @@ typedef enum {
if (object->get_id() == tonlib_api::error::ID) {
auto error = tonlib_api::move_object_as(object);
[subscriber putError:[[TONError alloc] initWithText:[[NSString alloc] initWithUTF8String:error->message_.c_str()]]];
- } else if (object->get_id() == tonlib_api::msg_dataArray::ID) {
- auto result = tonlib_api::move_object_as(object);
+ } else if (object->get_id() == tonlib_api::msg_dataDecryptedArray::ID) {
+ auto result = tonlib_api::move_object_as(object);
if (result->elements_.size() != messages.count) {
[subscriber putError:[[TONError alloc] initWithText:@"API interaction error"]];
} else {
NSMutableArray > *resultMessages = [[NSMutableArray alloc] init];
int index = 0;
for (auto &it : result->elements_) {
- if (it->get_id() == tonlib_api::msg_dataDecryptedText::ID) {
- auto dataDecryptedText = tonlib_api::move_object_as(it);
+ if (it->data_->get_id() == tonlib_api::msg_dataDecryptedText::ID) {
+ auto dataDecryptedText = tonlib_api::move_object_as(it->data_);
NSString *decryptedString = readString(dataDecryptedText->text_);
if (decryptedString != nil) {
[resultMessages addObject:[[TONTransactionMessageContentsPlainText alloc] initWithText:decryptedString]];
} else {
- [resultMessages addObject:[[TONTransactionMessageContentsEncryptedText alloc] initWithData:messages[index]]];
+ [resultMessages addObject:[[TONTransactionMessageContentsEncryptedText alloc] initWithEncryptedData:messages[index]]];
}
} else {
- [resultMessages addObject:[[TONTransactionMessageContentsEncryptedText alloc] initWithData:messages[index]]];
+ [resultMessages addObject:[[TONTransactionMessageContentsEncryptedText alloc] initWithEncryptedData:messages[index]]];
}
index++;
}
@@ -1137,10 +1153,20 @@ typedef enum {
}
}];
- std::vector> inputData;
- for (NSData *message in messages) {
- inputData.push_back(make_object(
- makeString(message)
+ std::vector> inputData;
+ for (TONEncryptedData *message in messages) {
+ NSData *sourceAddressData = [message.sourceAddress dataUsingEncoding:NSUTF8StringEncoding];
+ if (sourceAddressData == nil) {
+ continue;
+ }
+
+ inputData.push_back(make_object(
+ make_object(
+ makeString(sourceAddressData)
+ ),
+ make_object(
+ makeString(message.data)
+ )
));
}
@@ -1152,7 +1178,7 @@ typedef enum {
),
makeSecureString(localPassword)
),
- make_object(
+ make_object(
std::move(inputData)
)
);
diff --git a/submodules/WalletCore/Sources/WalletCore.swift b/submodules/WalletCore/Sources/WalletCore.swift
index 2d14b36514..df045129e9 100644
--- a/submodules/WalletCore/Sources/WalletCore.swift
+++ b/submodules/WalletCore/Sources/WalletCore.swift
@@ -196,7 +196,7 @@ public final class TonInstance {
assertionFailure()
return
}
- let cancel = keychain.encrypt(key.secret).start(next: { encryptedSecretData in
+ let _ = keychain.encrypt(key.secret).start(next: { encryptedSecretData in
let _ = self.exportKey(key: key, localPassword: localPassword).start(next: { wordList in
subscriber.putNext((WalletInfo(publicKey: WalletPublicKey(rawValue: key.publicKey), encryptedSecret: encryptedSecretData), wordList))
subscriber.putCompletion()
@@ -231,7 +231,7 @@ public final class TonInstance {
subscriber.putError(.generic)
return
}
- let cancel = keychain.encrypt(key.secret).start(next: { encryptedSecretData in
+ let _ = keychain.encrypt(key.secret).start(next: { encryptedSecretData in
subscriber.putNext(WalletInfo(publicKey: WalletPublicKey(rawValue: key.publicKey), encryptedSecret: encryptedSecretData))
subscriber.putCompletion()
}, error: { _ in
@@ -427,20 +427,22 @@ public final class TonInstance {
}
}
- fileprivate func decryptWalletTransactions(decryptionKey: WalletTransactionDecryptionKey, encryptedMessages: [Data]) -> Signal<[WalletTransactionMessageContents], DecryptWalletTransactionsError> {
+ fileprivate func decryptWalletTransactions(decryptionKey: WalletTransactionDecryptionKey, encryptedMessages: [WalletTransactionEncryptedMessageData]) -> Signal<[WalletTransactionMessageContents], DecryptWalletTransactionsError> {
return Signal { subscriber in
let disposable = MetaDisposable()
self.impl.with { impl in
impl.withInstance { ton in
- let cancel = ton.decryptMessages(with: TONKey(publicKey: decryptionKey.walletInfo.publicKey.rawValue, secret: decryptionKey.decryptedSecret), localPassword: decryptionKey.localPassword, messages: encryptedMessages).start(next: { result in
+ let cancel = ton.decryptMessages(with: TONKey(publicKey: decryptionKey.walletInfo.publicKey.rawValue, secret: decryptionKey.decryptedSecret), localPassword: decryptionKey.localPassword, messages: encryptedMessages.map { data in
+ TONEncryptedData(sourceAddress: data.sourceAddress, data: data.data)
+ }).start(next: { result in
guard let result = result as? [TONTransactionMessageContents] else {
subscriber.putError(.generic)
return
}
subscriber.putNext(result.map(WalletTransactionMessageContents.init(tonTransactionMessageContents:)))
}, error: { error in
- if let error = error as? TONError {
+ if let _ = error as? TONError {
subscriber.putError(.generic)
} else {
subscriber.putError(.generic)
@@ -735,7 +737,7 @@ public struct CombinedWalletState: Codable, Equatable {
return CombinedWalletState(
walletState: self.walletState,
timestamp: self.timestamp,
- topTransactions: self.topTransactions,
+ topTransactions: topTransactions,
pendingTransactions: self.pendingTransactions
)
}
@@ -1093,7 +1095,6 @@ public func sendGramsFromWallet(storage: WalletStorageInterface, tonInstance: To
}
})
|> mapToSignal { _ -> Signal in
- return .complete()
}
|> then(.single(PendingWalletTransaction(timestamp: Int64(Date().timeIntervalSince1970), validUntilTimestamp: preparedQuery.validUntil, bodyHash: preparedQuery.bodyHash, address: toAddress, value: amount, comment: comment)))
|> mapToSignal { result in
@@ -1134,16 +1135,26 @@ public enum WalletTransactionMessageContentsDecodingError: Error {
case generic
}
+public struct WalletTransactionEncryptedMessageData: Codable, Equatable {
+ public let sourceAddress: String
+ public let data: Data
+
+ public init(sourceAddress: String, data: Data) {
+ self.sourceAddress = sourceAddress
+ self.data = data
+ }
+}
+
public enum WalletTransactionMessageContents: Codable, Equatable {
enum Key: CodingKey {
case raw
case plainText
- case encryptedText
+ case encryptedData
}
case raw(Data)
case plainText(String)
- case encryptedText(Data)
+ case encryptedText(WalletTransactionEncryptedMessageData)
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: Key.self)
@@ -1151,22 +1162,22 @@ public enum WalletTransactionMessageContents: Codable, Equatable {
self = .raw(data)
} else if let plainText = try? container.decode(String.self, forKey: .plainText) {
self = .plainText(plainText)
- } else if let encryptedText = try? container.decode(Data.self, forKey: .encryptedText) {
- self = .encryptedText(encryptedText)
+ } else if let encryptedData = try? container.decode(WalletTransactionEncryptedMessageData.self, forKey: .encryptedData) {
+ self = .encryptedText(encryptedData)
} else {
throw WalletTransactionMessageContentsDecodingError.generic
}
}
public func encode(to encoder: Encoder) throws {
- var container = try encoder.container(keyedBy: Key.self)
+ var container = encoder.container(keyedBy: Key.self)
switch self {
case let .raw(data):
try container.encode(data, forKey: .raw)
case let .plainText(text):
try container.encode(text, forKey: .plainText)
case let .encryptedText(data):
- try container.encode(data, forKey: .encryptedText)
+ try container.encode(data, forKey: .encryptedData)
}
}
}
@@ -1178,7 +1189,7 @@ private extension WalletTransactionMessageContents {
} else if let plainText = tonTransactionMessageContents as? TONTransactionMessageContentsPlainText {
self = .plainText(plainText.text)
} else if let encryptedText = tonTransactionMessageContents as? TONTransactionMessageContentsEncryptedText {
- self = .encryptedText(encryptedText.data)
+ self = .encryptedText(WalletTransactionEncryptedMessageData(sourceAddress: encryptedText.encryptedData.sourceAddress, data: encryptedText.encryptedData.data))
} else {
self = .raw(Data())
}
@@ -1383,7 +1394,7 @@ public func decryptWalletTransactions(decryptionKey: WalletTransactionDecryption
case inMessage
case outMessage(Int)
}
- var encryptedMessages: [(Int, EncryptedMessagePath, Data)] = []
+ var encryptedMessages: [(Int, EncryptedMessagePath, WalletTransactionEncryptedMessageData)] = []
for i in 0 ..< transactions.count {
if let inMessage = transactions[i].inMessage {
switch inMessage.contents {
@@ -1506,7 +1517,7 @@ private func getWalletTransactionsOnce(address: String, previousId: WalletTransa
case inMessage
case outMessage(Int)
}
- var encryptedMessages: [(Int, EncryptedMessagePath, Data)] = []
+ var encryptedMessages: [(Int, EncryptedMessagePath, WalletTransactionEncryptedMessageData)] = []
for i in 0 ..< transactions.count {
if let inMessage = transactions[i].inMessage {
switch inMessage.contents {
@@ -1591,7 +1602,7 @@ public enum LocalWalletConfigurationSource: Codable, Equatable {
}
public func encode(to encoder: Encoder) throws {
- var container = try encoder.container(keyedBy: Key.self)
+ var container = encoder.container(keyedBy: Key.self)
switch self {
case let .url(url):
try container.encode(url, forKey: .url)
diff --git a/submodules/WalletUI/BUILD b/submodules/WalletUI/BUILD
index 3933e3e274..a5159bc357 100644
--- a/submodules/WalletUI/BUILD
+++ b/submodules/WalletUI/BUILD
@@ -20,6 +20,10 @@ swift_library(
srcs = glob([
"Sources/**/*.swift",
]),
+ data = [
+ ":WalletUIResources",
+ ":WalletUIAssets",
+ ],
deps = [
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/AsyncDisplayKit:AsyncDisplayKit",
diff --git a/submodules/WalletUI/Sources/ItemList/Items/ItemListMultilineTextItem.swift b/submodules/WalletUI/Sources/ItemList/Items/ItemListMultilineTextItem.swift
index 93e3f4c752..d47d0e0e0c 100644
--- a/submodules/WalletUI/Sources/ItemList/Items/ItemListMultilineTextItem.swift
+++ b/submodules/WalletUI/Sources/ItemList/Items/ItemListMultilineTextItem.swift
@@ -182,16 +182,8 @@ class ItemListMultilineTextItemNode: ListViewItemNode {
}
var baseFont = titleFont
- var linkFont = titleFont
- var boldFont = titleBoldFont
- var italicFont = titleItalicFont
- var boldItalicFont = titleBoldItalicFont
if case .monospace = item.font {
baseFont = Font.monospace(17.0)
- linkFont = Font.monospace(17.0)
- boldFont = Font.semiboldMonospace(17.0)
- italicFont = Font.italicMonospace(17.0)
- boldItalicFont = Font.semiboldItalicMonospace(17.0)
}
let string = NSAttributedString(string: item.text, font: baseFont, textColor: textColor)
@@ -365,7 +357,7 @@ class ItemListMultilineTextItemNode: ListViewItemNode {
private func linkItemAtPoint(_ point: CGPoint) -> String? {
let textNodeFrame = self.textNode.frame
- if let (_, attributes) = self.textNode.attributesAtPoint(CGPoint(x: point.x - textNodeFrame.minX, y: point.y - textNodeFrame.minY)) {
+ if let (_, _) = self.textNode.attributesAtPoint(CGPoint(x: point.x - textNodeFrame.minX, y: point.y - textNodeFrame.minY)) {
return nil
}
return nil
diff --git a/submodules/WalletUI/Sources/WalletAmountItem.swift b/submodules/WalletUI/Sources/WalletAmountItem.swift
index 39049b3362..2706ecadd5 100644
--- a/submodules/WalletUI/Sources/WalletAmountItem.swift
+++ b/submodules/WalletUI/Sources/WalletAmountItem.swift
@@ -182,7 +182,6 @@ class WalletAmountItemNode: ListViewItemNode, UITextFieldDelegate, ItemListItemN
}
let leftInset: CGFloat = 16.0 + params.leftInset
- var rightInset: CGFloat = 16.0 + params.rightInset
let separatorHeight = UIScreenPixel
diff --git a/submodules/WalletUI/Sources/WalletConfgurationScreen.swift b/submodules/WalletUI/Sources/WalletConfgurationScreen.swift
index f0a723ebb1..ff6847ad08 100644
--- a/submodules/WalletUI/Sources/WalletConfgurationScreen.swift
+++ b/submodules/WalletUI/Sources/WalletConfgurationScreen.swift
@@ -108,7 +108,7 @@ private enum WalletConfigurationScreenEntry: ItemListNodeEntry, Equatable {
})
case let .modeInfo(theme, text):
return ItemListTextItem(theme: theme, text: .plain(text), sectionId: self.section)
- case let .configUrl(theme, strings, placeholder, text):
+ case let .configUrl(theme, _, placeholder, text):
return ItemListMultilineInputItem(theme: theme, text: text, placeholder: placeholder, maxLength: nil, sectionId: self.section, style: .blocks, capitalization: false, autocorrection: false, returnKeyType: .done, minimalHeight: nil, textUpdated: { value in
arguments.updateState { state in
var state = state
@@ -211,12 +211,9 @@ func walletConfigurationScreen(context: WalletContext, currentConfiguration: Loc
}
var presentControllerImpl: ((ViewController, Any?) -> Void)?
- var pushImpl: ((ViewController) -> Void)?
var dismissImpl: (() -> Void)?
var dismissInputImpl: (() -> Void)?
- var ensureItemVisibleImpl: ((WalletConfigurationScreenEntryTag, Bool) -> Void)?
- weak var currentStatusController: ViewController?
let arguments = WalletConfigurationScreenArguments(updateState: { f in
updateState(f)
}, dismissInput: {
@@ -237,9 +234,6 @@ func walletConfigurationScreen(context: WalletContext, currentConfiguration: Loc
let signal = combineLatest(queue: .mainQueue(), .single(context.presentationData), statePromise.get())
|> map { presentationData, state -> (ItemListControllerState, (ItemListNodeState, Any)) in
- let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Wallet_Navigation_Cancel), style: .regular, enabled: true, action: {
- dismissImpl?()
- })
let rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Wallet_Configuration_Apply), style: .bold, enabled: !state.isEmpty, action: {
let state = stateValue.with { $0 }
let source: LocalWalletConfigurationSource
@@ -346,9 +340,6 @@ func walletConfigurationScreen(context: WalletContext, currentConfiguration: Loc
presentControllerImpl = { [weak controller] c, a in
controller?.present(c, in: .window(.root), with: a)
}
- pushImpl = { [weak controller] c in
- controller?.push(c)
- }
dismissImpl = { [weak controller] in
controller?.view.endEditing(true)
let _ = controller?.dismiss()
@@ -356,26 +347,5 @@ func walletConfigurationScreen(context: WalletContext, currentConfiguration: Loc
dismissInputImpl = { [weak controller] in
controller?.view.endEditing(true)
}
- ensureItemVisibleImpl = { [weak controller] targetTag, animated in
- controller?.afterLayout({
- guard let controller = controller else {
- return
- }
- var resultItemNode: ListViewItemNode?
- let state = stateValue.with({ $0 })
- let _ = controller.frameForItemNode({ itemNode in
- if let itemNode = itemNode as? ItemListItemNode {
- if let tag = itemNode.tag, tag.isEqual(to: targetTag) {
- resultItemNode = itemNode as? ListViewItemNode
- return true
- }
- }
- return false
- })
- if let resultItemNode = resultItemNode {
- controller.ensureItemNodeVisible(resultItemNode, animated: animated)
- }
- })
- }
return controller
}
diff --git a/submodules/WalletUI/Sources/WalletCreateInvoiceScreen.swift b/submodules/WalletUI/Sources/WalletCreateInvoiceScreen.swift
index e8efb2c6a2..57106500c8 100644
--- a/submodules/WalletUI/Sources/WalletCreateInvoiceScreen.swift
+++ b/submodules/WalletUI/Sources/WalletCreateInvoiceScreen.swift
@@ -142,7 +142,7 @@ private enum WalletCreateInvoiceScreenEntry: ItemListNodeEntry {
arguments.updateText(WalletCreateInvoiceScreenEntryTag.comment, text)
}, shouldUpdateText: { text in
let textLength: Int = text.data(using: .utf8, allowLossyConversion: true)?.count ?? 0
- return text.count <= walletTextLimit
+ return textLength <= walletTextLimit
}, updatedFocus: { focus in
arguments.updateState { state in
var state = state
@@ -171,7 +171,7 @@ private struct WalletCreateInvoiceScreenState: Equatable {
private func walletCreateInvoiceScreenEntries(presentationData: WalletPresentationData, address: String, state: WalletCreateInvoiceScreenState) -> [WalletCreateInvoiceScreenEntry] {
var entries: [WalletCreateInvoiceScreenEntry] = []
- entries.append(.amount(presentationData.theme, state.amount ?? ""))
+ entries.append(.amount(presentationData.theme, state.amount))
entries.append(.amountInfo(presentationData.theme, presentationData.strings.Wallet_Receive_CreateInvoiceInfo))
entries.append(.commentHeader(presentationData.theme, presentationData.strings.Wallet_Receive_CommentHeader))
entries.append(.comment(presentationData.theme, presentationData.strings.Wallet_Receive_CommentInfo, state.comment))
@@ -196,13 +196,10 @@ func walletCreateInvoiceScreen(context: WalletContext, address: String) -> ViewC
statePromise.set(stateValue.modify { f($0) })
}
- var presentControllerImpl: ((ViewController, Any?) -> Void)?
var pushImpl: ((ViewController) -> Void)?
- var dismissImpl: (() -> Void)?
var dismissInputImpl: (() -> Void)?
var ensureItemVisibleImpl: ((WalletCreateInvoiceScreenEntryTag, Bool) -> Void)?
- weak var currentStatusController: ViewController?
let arguments = WalletCreateInvoiceScreenArguments(context: context, updateState: { f in
updateState(f)
}, updateText: { tag, value in
@@ -250,16 +247,9 @@ func walletCreateInvoiceScreen(context: WalletContext, address: String) -> ViewC
return state
}
}
- presentControllerImpl = { [weak controller] c, a in
- controller?.present(c, in: .window(.root), with: a)
- }
pushImpl = { [weak controller] c in
controller?.push(c)
}
- dismissImpl = { [weak controller] in
- controller?.view.endEditing(true)
- let _ = controller?.dismiss()
- }
dismissInputImpl = { [weak controller] in
controller?.view.endEditing(true)
}
@@ -269,7 +259,6 @@ func walletCreateInvoiceScreen(context: WalletContext, address: String) -> ViewC
return
}
var resultItemNode: ListViewItemNode?
- let state = stateValue.with({ $0 })
let _ = controller.frameForItemNode({ itemNode in
if let itemNode = itemNode as? ItemListItemNode {
if let tag = itemNode.tag, tag.isEqual(to: targetTag) {
diff --git a/submodules/WalletUI/Sources/WalletInfoEmptyNode.swift b/submodules/WalletUI/Sources/WalletInfoEmptyNode.swift
index 5aad2c0147..f9fde449bc 100644
--- a/submodules/WalletUI/Sources/WalletInfoEmptyNode.swift
+++ b/submodules/WalletUI/Sources/WalletInfoEmptyNode.swift
@@ -89,7 +89,7 @@ final class WalletInfoEmptyItemNode: ListViewItemNode {
super.didLoad()
let recognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapGesture(_:)))
- recognizer.tapActionAtPoint = { [weak self] point in
+ recognizer.tapActionAtPoint = { point in
return .waitForSingleTap
}
self.addressNode.view.addGestureRecognizer(recognizer)
@@ -98,7 +98,7 @@ final class WalletInfoEmptyItemNode: ListViewItemNode {
@objc func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
switch recognizer.state {
case .ended:
- if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
+ if let (gesture, _) = recognizer.lastRecognizedGestureAndLocation {
switch gesture {
case .longTap:
self.item?.displayAddressContextMenu(self, self.addressNode.frame)
@@ -129,7 +129,7 @@ final class WalletInfoEmptyItemNode: ListViewItemNode {
let contentVerticalOrigin: CGFloat = 10.0
let sideInset: CGFloat = 16.0
- var iconOffset = CGPoint()
+ let iconOffset = CGPoint()
let title = item.strings.Wallet_Info_WalletCreated
let text = item.strings.Wallet_Info_Address
diff --git a/submodules/WalletUI/Sources/WalletInfoScreen.swift b/submodules/WalletUI/Sources/WalletInfoScreen.swift
index dc9f7c7320..2f8b803232 100644
--- a/submodules/WalletUI/Sources/WalletInfoScreen.swift
+++ b/submodules/WalletUI/Sources/WalletInfoScreen.swift
@@ -122,7 +122,7 @@ public final class WalletInfoScreen: ViewController {
strongSelf.push(walletSendScreen(context: strongSelf.context, randomId: randomId, walletInfo: walletInfo))
}
}, receiveAction: { [weak self] in
- guard let strongSelf = self, let walletInfo = strongSelf.walletInfo else {
+ guard let strongSelf = self, let _ = strongSelf.walletInfo else {
return
}
strongSelf.push(WalletReceiveScreen(context: strongSelf.context, mode: .receive(address: strongSelf.address)))
@@ -221,7 +221,6 @@ final class WalletInfoBalanceNode: ASDisplayNode {
let balanceIntegralTextFrame = CGRect(origin: balanceOrigin, size: balanceIntegralTextSize)
let apparentBalanceIntegralTextFrame = CGRect(origin: balanceIntegralTextFrame.origin, size: CGSize(width: balanceIntegralTextFrame.width * integralScale, height: balanceIntegralTextFrame.height * integralScale))
var balanceFractionalTextFrame = CGRect(origin: CGPoint(x: balanceIntegralTextFrame.maxX, y: balanceIntegralTextFrame.maxY - balanceFractionalTextSize.height), size: balanceFractionalTextSize)
- let apparentBalanceFractionalTextFrame = CGRect(origin: balanceFractionalTextFrame.origin, size: CGSize(width: balanceFractionalTextFrame.width * fractionalScale, height: balanceFractionalTextFrame.height * fractionalScale))
balanceFractionalTextFrame.origin.x -= (balanceFractionalTextFrame.width / 4.0) * scaleTransition + 0.25 * (balanceFractionalTextFrame.width / 2.0) * (1.0 - scaleTransition)
balanceFractionalTextFrame.origin.y += balanceFractionalTextFrame.height * 0.5 * (0.8 - fractionalScale)
@@ -332,21 +331,9 @@ private final class WalletInfoHeaderNode: ASDisplayNode {
func update(size: CGSize, navigationHeight: CGFloat, offset: CGFloat, transition: ContainedViewLayoutTransition, isScrolling: Bool) {
let sideInset: CGFloat = 16.0
- let buttonSideInset: CGFloat = 48.0
- let titleSpacing: CGFloat = 10.0
- let termsSpacing: CGFloat = 10.0
let buttonHeight: CGFloat = 50.0
let balanceSubtitleSpacing: CGFloat = 0.0
- let alphaTransition: ContainedViewLayoutTransition
- if transition.isAnimated {
- alphaTransition = transition
- } else if isScrolling {
- alphaTransition = .animated(duration: 0.2, curve: .easeInOut)
- } else {
- alphaTransition = transition
- }
-
let minOffset = navigationHeight
let maxOffset = size.height
@@ -438,11 +425,11 @@ private final class WalletInfoHeaderNode: ASDisplayNode {
transition.updateAlpha(node: self.receiveGramsButtonNode, alpha: buttonAlpha, beginWithCurrentState: true)
transition.updateFrame(node: self.receiveButtonNode, frame: leftButtonFrame)
transition.updateAlpha(node: self.receiveButtonNode, alpha: buttonAlpha, beginWithCurrentState: true)
- self.receiveGramsButtonNode.updateLayout(width: fullButtonFrame.width, transition: transition)
- self.receiveButtonNode.updateLayout(width: leftButtonFrame.width, transition: transition)
+ let _ = self.receiveGramsButtonNode.updateLayout(width: fullButtonFrame.width, transition: transition)
+ let _ = self.receiveButtonNode.updateLayout(width: leftButtonFrame.width, transition: transition)
transition.updateFrame(node: self.sendButtonNode, frame: sendButtonFrame)
transition.updateAlpha(node: self.sendButtonNode, alpha: buttonAlpha, beginWithCurrentState: true)
- self.sendButtonNode.updateLayout(width: sendButtonFrame.width, transition: transition)
+ let _ = self.sendButtonNode.updateLayout(width: sendButtonFrame.width, transition: transition)
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
@@ -610,6 +597,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
self.listNode.verticalScrollIndicatorFollowsOverscroll = true
self.listNode.isHidden = false
self.listNode.view.disablesInteractiveModalDismiss = true
+ //self.listNode.keepMinimalScrollHeightWithTopInset = 0.0
super.init()
@@ -628,7 +616,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
}
self.listNode.updateFloatingHeaderOffset = { [weak self] offset, listTransition in
- guard let strongSelf = self, let (layout, navigationHeight) = strongSelf.validLayout else {
+ guard let strongSelf = self, let (_, navigationHeight) = strongSelf.validLayout else {
return
}
@@ -662,7 +650,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
self.listNode.didEndScrolling = { [weak self] in
canBeginRefresh = true
- guard let strongSelf = self, let (_, navigationHeight) = strongSelf.validLayout else {
+ guard let strongSelf = self, let (_, _) = strongSelf.validLayout else {
return
}
switch strongSelf.listNode.visibleContentOffset() {
@@ -765,7 +753,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
return
}
strongSelf.headerNode.refreshNode.refreshProgress = progress
- if strongSelf.headerNode.isRefreshing, strongSelf.isReady, let (layout, navigationHeight) = strongSelf.validLayout {
+ if strongSelf.headerNode.isRefreshing, strongSelf.isReady, let (_, _) = strongSelf.validLayout {
strongSelf.headerNode.refreshNode.update(state: .refreshing)
}
})
@@ -951,7 +939,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
strongSelf.headerNode.timestamp = Int32(clamping: combinedState.timestamp)
}
- if strongSelf.isReady, let (layout, navigationHeight) = strongSelf.validLayout {
+ if strongSelf.isReady, let (_, navigationHeight) = strongSelf.validLayout {
strongSelf.headerNode.update(size: strongSelf.headerNode.bounds.size, navigationHeight: navigationHeight, offset: strongSelf.listOffset ?? 0.0, transition: .immediate, isScrolling: false)
}
@@ -960,7 +948,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
strongSelf.headerNode.isRefreshing = false
- if strongSelf.isReady, let (layout, navigationHeight) = strongSelf.validLayout {
+ if strongSelf.isReady, let (_, navigationHeight) = strongSelf.validLayout {
strongSelf.headerNode.update(size: strongSelf.headerNode.bounds.size, navigationHeight: navigationHeight, offset: strongSelf.listOffset ?? 0.0, transition: .animated(duration: 0.2, curve: .easeInOut), isScrolling: false)
}
@@ -999,7 +987,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
self.headerNode.timestamp = Int32(clamping: combinedState.timestamp)
- if self.isReady, let (layout, navigationHeight) = self.validLayout {
+ if self.isReady, let (_, navigationHeight) = self.validLayout {
self.headerNode.update(size: self.headerNode.bounds.size, navigationHeight: navigationHeight, offset: self.listOffset ?? 0.0, transition: .immediate, isScrolling: false)
}
@@ -1033,7 +1021,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
self.headerNode.isRefreshing = false
}
- if self.isReady, let (layout, navigationHeight) = self.validLayout {
+ if self.isReady, let (_, navigationHeight) = self.validLayout {
self.headerNode.update(size: self.headerNode.bounds.size, navigationHeight: navigationHeight, offset: self.listOffset ?? 0.0, transition: .animated(duration: 0.2, curve: .easeInOut), isScrolling: false)
}
} else {
@@ -1090,10 +1078,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
return
}
strongSelf.transactionsLoaded(isReload: false, isEmpty: false, transactions: transactions, pendingTransactions: [])
- }, error: { [weak self] _ in
- guard let strongSelf = self else {
- return
- }
+ }, error: { _ in
}))
}
@@ -1133,7 +1118,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
var existingIds = Set()
for entry in updatedEntries {
switch entry {
- case let .transaction(_, transaction):
+ case .transaction:
existingIds.insert(entry.stableId)
case .empty:
break
@@ -1152,7 +1137,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
self.replaceEntries(updatedEntries)
- if !self.transactionDecryptionKeyRequested {
+ if !self.transactionDecryptionKeyRequested && false {
var encryptedTransactions: [WalletTransactionId: WalletTransaction] = [:]
for entry in updatedEntries {
switch entry {
@@ -1233,7 +1218,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
}
private func dequeueTransaction() {
- guard let layout = self.validLayout, let transaction = self.enqueuedTransactions.first else {
+ guard let _ = self.validLayout, let transaction = self.enqueuedTransactions.first else {
return
}
diff --git a/submodules/WalletUI/Sources/WalletInfoTransactionItem.swift b/submodules/WalletUI/Sources/WalletInfoTransactionItem.swift
index 2240a179a7..7d19d7c4e5 100644
--- a/submodules/WalletUI/Sources/WalletInfoTransactionItem.swift
+++ b/submodules/WalletUI/Sources/WalletInfoTransactionItem.swift
@@ -98,6 +98,7 @@ class WalletInfoTransactionItem: ListViewItem {
private let titleFont = Font.medium(17.0)
private let textFont = Font.monospace(15.0)
private let descriptionFont = Font.regular(15.0)
+private let descriptionMonospaceFont = Font.monospace(15.0)
private let dateFont = Font.regular(14.0)
private let directionFont = Font.regular(15.0)
@@ -222,6 +223,7 @@ class WalletInfoTransactionItemNode: ListViewItemNode {
}
var text: String = ""
var description: String = ""
+ var descriptionIsMonospace = false
if transferredValue <= 0 {
sign = ""
title = "\(formatBalanceText(-transferredValue, decimalSeparator: item.dateTimeFormat.decimalSeparator))"
@@ -246,7 +248,8 @@ class WalletInfoTransactionItemNode: ListViewItemNode {
case .raw:
break
case .encryptedText:
- description.append("")
+ description.append("Encrypted Comment")
+ descriptionIsMonospace = true
case let .plainText(text):
description.append(text)
}
@@ -279,7 +282,8 @@ class WalletInfoTransactionItemNode: ListViewItemNode {
case .raw:
description = ""
case .encryptedText:
- description = ""
+ description = "Encrypted Comment"
+ descriptionIsMonospace = true
case let .plainText(text):
description = text
}
@@ -326,7 +330,7 @@ class WalletInfoTransactionItemNode: ListViewItemNode {
let (textLayout, textApply) = makeTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: text, font: textFont, textColor: item.theme.list.itemPrimaryTextColor), backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - leftInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
- let (descriptionLayout, descriptionApply) = makeDescriptionLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: description, font: descriptionFont, textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - leftInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
+ let (descriptionLayout, descriptionApply) = makeDescriptionLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: description, font: descriptionIsMonospace ? descriptionMonospaceFont : descriptionFont, textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - leftInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let (feesLayout, feesApply) = makeFeesLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: feeText, font: descriptionFont, textColor: item.theme.list.itemSecondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - leftInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
diff --git a/submodules/WalletUI/Sources/WalletQrScanScreen.swift b/submodules/WalletUI/Sources/WalletQrScanScreen.swift
index e9df176be9..e997ce7ce5 100644
--- a/submodules/WalletUI/Sources/WalletQrScanScreen.swift
+++ b/submodules/WalletUI/Sources/WalletQrScanScreen.swift
@@ -18,7 +18,7 @@ private func generateFrameImage() -> UIImage? {
context.setLineWidth(4.0)
context.setLineCap(.round)
- var path = CGMutablePath();
+ let path = CGMutablePath()
path.move(to: CGPoint(x: 2.0, y: 2.0 + 26.0))
path.addArc(tangent1End: CGPoint(x: 2.0, y: 2.0), tangent2End: CGPoint(x: 2.0 + 26.0, y: 2.0), radius: 6.0)
path.addLine(to: CGPoint(x: 2.0 + 26.0, y: 2.0))
diff --git a/submodules/WalletUI/Sources/WalletReceiveScreen.swift b/submodules/WalletUI/Sources/WalletReceiveScreen.swift
index 881944e045..8415854ac9 100644
--- a/submodules/WalletUI/Sources/WalletReceiveScreen.swift
+++ b/submodules/WalletUI/Sources/WalletReceiveScreen.swift
@@ -232,15 +232,14 @@ private final class WalletReceiveScreenNode: ViewControllerTracingNode {
}
let textFont = Font.regular(16.0)
- let textColor = self.presentationData.theme.list.itemPrimaryTextColor
let secondaryTextColor = self.presentationData.theme.list.itemSecondaryTextColor
let url = urlForMode(self.mode)
switch self.mode {
- case let .receive(address):
+ case .receive:
self.textNode.attributedText = NSAttributedString(string: self.presentationData.strings.Wallet_Receive_ShareUrlInfo, font: textFont, textColor: secondaryTextColor)
self.buttonNode.title = self.presentationData.strings.Wallet_Receive_ShareAddress
self.secondaryButtonNode.setTitle(self.presentationData.strings.Wallet_Receive_CreateInvoice, with: Font.regular(17.0), with: self.presentationData.theme.list.itemAccentColor, for: .normal)
- case let .invoice(address, amount, comment):
+ case .invoice:
self.textNode.attributedText = NSAttributedString(string: self.presentationData.strings.Wallet_Receive_ShareUrlInfo, font: textFont, textColor: secondaryTextColor, paragraphAlignment: .center)
self.buttonNode.title = self.presentationData.strings.Wallet_Receive_ShareInvoiceUrl
}
@@ -255,7 +254,7 @@ private final class WalletReceiveScreenNode: ViewControllerTracingNode {
super.didLoad()
let addressGestureRecognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapAddressGesture(_:)))
- addressGestureRecognizer.tapActionAtPoint = { [weak self] point in
+ addressGestureRecognizer.tapActionAtPoint = { point in
return .waitForSingleTap
}
self.urlTextNode.view.addGestureRecognizer(addressGestureRecognizer)
@@ -264,7 +263,7 @@ private final class WalletReceiveScreenNode: ViewControllerTracingNode {
@objc func tapLongTapOrDoubleTapAddressGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
switch recognizer.state {
case .ended:
- if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
+ if let (gesture, _) = recognizer.lastRecognizedGestureAndLocation {
switch gesture {
case .longTap:
self.displayCopyContextMenu?(self, self.urlTextNode.frame, urlForMode(self.mode))
@@ -299,7 +298,7 @@ private final class WalletReceiveScreenNode: ViewControllerTracingNode {
let makeImageLayout = self.qrImageNode.asyncLayout()
let imageSide: CGFloat = 215.0
- var imageSize = CGSize(width: imageSide, height: imageSide)
+ let imageSize = CGSize(width: imageSide, height: imageSide)
let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: nil))
let _ = imageApply()
@@ -353,6 +352,6 @@ private final class WalletReceiveScreenNode: ViewControllerTracingNode {
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight + buttonOffset), size: CGSize(width: buttonWidth, height: buttonHeight))
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
- self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
+ let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
}
}
diff --git a/submodules/WalletUI/Sources/WalletRefreshNode.swift b/submodules/WalletUI/Sources/WalletRefreshNode.swift
index f09e55a3a8..b8874faa59 100644
--- a/submodules/WalletUI/Sources/WalletRefreshNode.swift
+++ b/submodules/WalletUI/Sources/WalletRefreshNode.swift
@@ -93,12 +93,7 @@ private func lastUpdateTimestampString(strings: WalletStrings, dateTimeFormat: W
if dayDifference == 0 || dayDifference == -1 {
let day: RelativeTimestampFormatDay
if dayDifference == 0 {
- if expanded {
- day = .today
- } else {
- let minutes = difference / (60 * 60)
- return strings.Wallet_Updated_HoursAgo(minutes)
- }
+ day = .today
} else {
day = .yesterday
}
@@ -226,13 +221,10 @@ final class WalletRefreshNode: ASDisplayNode {
let previousState = self.state
self.state = state
- var pullProgress: CGFloat = 0.0
-
let title: String
switch state {
- case let .pullToRefresh(ts, progress):
+ case let .pullToRefresh(ts, _):
title = lastUpdateTimestampString(strings: self.strings, dateTimeFormat: dateTimeFormat, statusTimestamp: ts, relativeTo: Int32(Date().timeIntervalSince1970))
- pullProgress = progress
case .refreshing:
if ignoreProgressValue {
title = self.strings.Wallet_Info_Updating
diff --git a/submodules/WalletUI/Sources/WalletSendScreen.swift b/submodules/WalletUI/Sources/WalletSendScreen.swift
index ed82929010..6018eff219 100644
--- a/submodules/WalletUI/Sources/WalletSendScreen.swift
+++ b/submodules/WalletUI/Sources/WalletSendScreen.swift
@@ -64,7 +64,7 @@ private enum WalletSendScreenEntry: ItemListNodeEntry {
case addressInfo(WalletTheme, String)
case commentHeader(WalletTheme, String)
case comment(WalletTheme, String, String, Bool)
- case commendEncryption(WalletTheme, String, Bool)
+ case commentEncryption(WalletTheme, String, Bool)
var section: ItemListSectionId {
switch self {
@@ -72,7 +72,7 @@ private enum WalletSendScreenEntry: ItemListNodeEntry {
return WalletSendScreenSection.amount.rawValue
case .addressHeader, .address, .addressInfo:
return WalletSendScreenSection.address.rawValue
- case .commentHeader, .comment, .commendEncryption:
+ case .commentHeader, .comment, .commentEncryption:
return WalletSendScreenSection.comment.rawValue
}
}
@@ -93,7 +93,7 @@ private enum WalletSendScreenEntry: ItemListNodeEntry {
return 5
case .comment:
return 6
- case .commendEncryption:
+ case .commentEncryption:
return 7
}
}
@@ -142,8 +142,8 @@ private enum WalletSendScreenEntry: ItemListNodeEntry {
} else {
return false
}
- case let .commendEncryption(lhsTheme, lhsText, lhsValue):
- if case let .commendEncryption(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsText == rhsText {
+ case let .commentEncryption(lhsTheme, lhsText, lhsValue):
+ if case let .commentEncryption(rhsTheme, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsText == rhsText, lhsValue == rhsValue {
return true
} else {
return false
@@ -268,7 +268,7 @@ private enum WalletSendScreenEntry: ItemListNodeEntry {
arguments.proceed()
}
})
- case let .commendEncryption(theme, text, value):
+ case let .commentEncryption(theme, text, value):
return ItemListSwitchItem(theme: theme, title: text, value: value, sectionId: self.section, style: .blocks, updated: { value in
arguments.updateIsEncrypted(value)
})
@@ -291,7 +291,7 @@ private func walletSendScreenEntries(presentationData: WalletPresentationData, b
let amount = amountValue(state.amount)
let balance = max(0, balance ?? 0)
- entries.append(.amount(presentationData.theme, state.amount ?? ""))
+ entries.append(.amount(presentationData.theme, state.amount))
entries.append(.balance(presentationData.theme, presentationData.strings.Wallet_Send_Balance("").0, formatBalanceText(balance, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator), balance == 0 || (amount > 0 && balance < amount)))
entries.append(.addressHeader(presentationData.theme, presentationData.strings.Wallet_Send_AddressHeader))
@@ -300,7 +300,7 @@ private func walletSendScreenEntries(presentationData: WalletPresentationData, b
entries.append(.commentHeader(presentationData.theme, presentationData.strings.Wallet_Receive_CommentHeader))
entries.append(.comment(presentationData.theme, presentationData.strings.Wallet_Receive_CommentInfo, state.comment, sendEnabled))
- entries.append(.commendEncryption(presentationData.theme, presentationData.strings.Wallet_Send_EncryptComment, state.isCommentEncrypted))
+ entries.append(.commentEncryption(presentationData.theme, presentationData.strings.Wallet_Send_EncryptComment, state.isCommentEncrypted))
return entries
}
@@ -478,7 +478,7 @@ public func walletSendScreen(context: WalletContext, randomId: Int64, walletInfo
|> deliverOnMainQueue).start(next: { serverSalt in
if let serverSalt = serverSalt {
if let commentData = state.comment.data(using: .utf8) {
- pushImpl?(WalletSplashScreen(context: context, mode: .sending(walletInfo: walletInfo, address: state.address, amount: amount, comment: commentData, encryptComment: state.isCommentEncrypted && !verificationResult.canNotEncryptComment, randomId: randomId, serverSalt: serverSalt), walletCreatedPreloadState: nil))
+ pushImpl?(WalletSplashScreen(context: context, mode: .sending(WalletSplashModeSending(walletInfo: walletInfo, address: state.address, amount: amount, comment: commentData, encryptComment: state.isCommentEncrypted && !verificationResult.canNotEncryptComment, randomId: randomId, serverSalt: serverSalt)), walletCreatedPreloadState: nil))
}
}
})
@@ -624,7 +624,7 @@ public func walletSendScreen(context: WalletContext, randomId: Int64, walletInfo
controller?.push(c)
}
popImpl = { [weak controller] in
- (controller?.navigationController as? NavigationController)?.popViewController(animated: true)
+ let _ = (controller?.navigationController as? NavigationController)?.popViewController(animated: true)
}
dismissImpl = { [weak controller] in
controller?.view.endEditing(true)
@@ -658,7 +658,6 @@ public func walletSendScreen(context: WalletContext, randomId: Int64, walletInfo
}
var resultItemNode: ListViewItemNode?
- let state = stateValue.with({ $0 })
let _ = controller.frameForItemNode({ itemNode in
if let itemNode = itemNode as? ItemListItemNode {
if let tag = itemNode.tag, tag.isEqual(to: targetTag) {
diff --git a/submodules/WalletUI/Sources/WalletSettingsScreen.swift b/submodules/WalletUI/Sources/WalletSettingsScreen.swift
index 564e68073e..b704870310 100644
--- a/submodules/WalletUI/Sources/WalletSettingsScreen.swift
+++ b/submodules/WalletUI/Sources/WalletSettingsScreen.swift
@@ -105,12 +105,7 @@ private func walletSettingsControllerEntries(presentationData: WalletPresentatio
public func walletSettingsController(context: WalletContext, walletInfo: WalletInfo) -> ViewController {
let statePromise = ValuePromise(WalletSettingsControllerState(), ignoreRepeated: true)
- let stateValue = Atomic(value: WalletSettingsControllerState())
- let updateState: ((WalletSettingsControllerState) -> WalletSettingsControllerState) -> Void = { f in
- statePromise.set(stateValue.modify { f($0) })
- }
- var dismissImpl: (() -> Void)?
var presentControllerImpl: ((ViewController, Any?) -> Void)?
var pushControllerImpl: ((ViewController) -> Void)?
@@ -181,10 +176,6 @@ public func walletSettingsController(context: WalletContext, walletInfo: WalletI
let controller = ItemListController(theme: context.presentationData.theme, strings: context.presentationData.strings, updatedPresentationData: .single((context.presentationData.theme, context.presentationData.strings)), state: signal, tabBarItem: nil)
controller.navigationPresentation = .modal
controller.enableInteractiveDismiss = true
- dismissImpl = { [weak controller] in
- controller?.view.endEditing(true)
- controller?.dismiss()
- }
presentControllerImpl = { [weak controller] c, a in
controller?.present(c, in: .window(.root), with: a)
}
diff --git a/submodules/WalletUI/Sources/WalletSplashScreen.swift b/submodules/WalletUI/Sources/WalletSplashScreen.swift
index 1d1d1804e2..32ad6c5069 100644
--- a/submodules/WalletUI/Sources/WalletSplashScreen.swift
+++ b/submodules/WalletUI/Sources/WalletSplashScreen.swift
@@ -17,12 +17,40 @@ public enum WalletSecureStorageResetReason {
case changed
}
+public struct WalletSplashModeSending {
+ public let walletInfo: WalletInfo
+ public let address: String
+ public let amount: Int64
+ public let comment: Data
+ public let encryptComment: Bool
+ public let randomId: Int64
+ public let serverSalt: Data
+
+ public init(
+ walletInfo: WalletInfo,
+ address: String,
+ amount: Int64,
+ comment: Data,
+ encryptComment: Bool,
+ randomId: Int64,
+ serverSalt: Data
+ ) {
+ self.walletInfo = walletInfo
+ self.address = address
+ self.amount = amount
+ self.comment = comment
+ self.encryptComment = encryptComment
+ self.randomId = randomId
+ self.serverSalt = serverSalt
+ }
+}
+
public enum WalletSplashMode {
case intro
case created(walletInfo: WalletInfo, words: [String]?)
case success(walletInfo: WalletInfo)
case restoreFailed
- case sending(walletInfo: WalletInfo, address: String, amount: Int64, comment: Data, encryptComment: Bool, randomId: Int64, serverSalt: Data)
+ case sending(WalletSplashModeSending)
case sent(walletInfo: WalletInfo, amount: Int64)
case secureStorageNotAvailable
case secureStorageReset(WalletSecureStorageResetReason)
@@ -81,15 +109,16 @@ public final class WalletSplashScreen: ViewController {
self.navigationBar?.intrinsicCanTransitionInline = false
switch self.mode {
- case let .intro: self.navigationItem.setRightBarButton(UIBarButtonItem(title: self.presentationData.strings.Wallet_Intro_ImportExisting, style: .plain, target: self, action: #selector(self.importPressed)), animated: false)
- case let .sending(walletInfo, address, amount, comment, encryptComment, randomId, serverSalt):
+ case .intro:
+ self.navigationItem.setRightBarButton(UIBarButtonItem(title: self.presentationData.strings.Wallet_Intro_ImportExisting, style: .plain, target: self, action: #selector(self.importPressed)), animated: false)
+ case let .sending(sending):
self.navigationItem.setLeftBarButton(UIBarButtonItem(customDisplayNode: ASDisplayNode())!, animated: false)
- let _ = (self.context.keychain.decrypt(walletInfo.encryptedSecret)
+ let _ = (self.context.keychain.decrypt(sending.walletInfo.encryptedSecret)
|> deliverOnMainQueue).start(next: { [weak self] decryptedSecret in
guard let strongSelf = self else {
return
}
- strongSelf.sendGrams(walletInfo: walletInfo, decryptedSecret: decryptedSecret, address: address, amount: amount, comment: comment, encryptComment: encryptComment, forceIfDestinationNotInitialized: true, randomId: randomId, serverSalt: serverSalt)
+ strongSelf.sendGrams(walletInfo: sending.walletInfo, decryptedSecret: decryptedSecret, address: sending.address, amount: sending.amount, comment: sending.comment, encryptComment: sending.encryptComment, forceIfDestinationNotInitialized: true, randomId: sending.randomId, serverSalt: sending.serverSalt)
}, error: { [weak self] error in
guard let strongSelf = self else {
return
@@ -242,7 +271,7 @@ public final class WalletSplashScreen: ViewController {
let controller = textAlertController(alertContext: AlertControllerContext(theme: theme.alert, themeSignal: .single(theme.alert)), title: strongSelf.presentationData.strings.Wallet_Send_UninitializedTitle, text: text, actions: [
TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Wallet_Navigation_Cancel, action: {
if let navigationController = strongSelf.navigationController as? NavigationController {
- navigationController.popViewController(animated: true)
+ let _ = navigationController.popViewController(animated: true)
}
}),
TextAlertAction(type: .defaultAction, title: "Send Anyway", action: {
@@ -258,7 +287,7 @@ public final class WalletSplashScreen: ViewController {
let theme = strongSelf.presentationData.theme
let controller = textAlertController(alertContext: AlertControllerContext(theme: theme.alert, themeSignal: .single(theme.alert)), title: title, text: text, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Wallet_Alert_OK, action: {
if let navigationController = strongSelf.navigationController as? NavigationController {
- navigationController.popViewController(animated: true)
+ let _ = navigationController.popViewController(animated: true)
}
})])
strongSelf.present(controller, in: .window(.root))
@@ -286,14 +315,14 @@ public final class WalletSplashScreen: ViewController {
return true
}
- let _ = (walletAddress(publicKey: sending.0.publicKey, tonInstance: self.context.tonInstance)
+ let _ = (walletAddress(publicKey: sending.walletInfo.publicKey, tonInstance: self.context.tonInstance)
|> deliverOnMainQueue).start(next: { [weak self] address in
guard let strongSelf = self else {
return
}
if !controllers.contains(where: { $0 is WalletInfoScreen }) {
- let infoScreen = WalletInfoScreen(context: strongSelf.context, walletInfo: sending.0, address: address, enableDebugActions: false)
+ let infoScreen = WalletInfoScreen(context: strongSelf.context, walletInfo: sending.walletInfo, address: address, enableDebugActions: false)
infoScreen.navigationPresentation = .modal
controllers.append(infoScreen)
}
@@ -498,14 +527,14 @@ public final class WalletSplashScreen: ViewController {
return true
}
- let _ = (walletAddress(publicKey: sending.0.publicKey, tonInstance: strongSelf.context.tonInstance)
+ let _ = (walletAddress(publicKey: sending.walletInfo.publicKey, tonInstance: strongSelf.context.tonInstance)
|> deliverOnMainQueue).start(next: { [weak self] address in
guard let strongSelf = self else {
return
}
if !controllers.contains(where: { $0 is WalletInfoScreen }) {
- let infoScreen = WalletInfoScreen(context: strongSelf.context, walletInfo: sending.0, address: address, enableDebugActions: false)
+ let infoScreen = WalletInfoScreen(context: strongSelf.context, walletInfo: sending.walletInfo, address: address, enableDebugActions: false)
infoScreen.navigationPresentation = .modal
controllers.append(infoScreen)
}
@@ -891,7 +920,7 @@ private final class WalletSplashScreenNode: ViewControllerTracingNode {
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight), size: CGSize(width: buttonWidth, height: buttonHeight))
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
- self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
+ let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
var maxContentVerticalOrigin = buttonFrame.minY - 12.0 - contentHeight
diff --git a/submodules/WalletUI/Sources/WalletTransactionInfoScreen.swift b/submodules/WalletUI/Sources/WalletTransactionInfoScreen.swift
index 5aea1460da..c4ca2a8bde 100644
--- a/submodules/WalletUI/Sources/WalletTransactionInfoScreen.swift
+++ b/submodules/WalletUI/Sources/WalletTransactionInfoScreen.swift
@@ -69,6 +69,33 @@ private func stringForAddress(strings: WalletStrings, address: WalletTransaction
}
}
+private extension WalletInfoTransaction {
+ var isEncrypted: Bool {
+ switch self {
+ case .pending:
+ return false
+ case let .completed(transaction):
+ if let inMessage = transaction.inMessage {
+ switch inMessage.contents {
+ case .encryptedText:
+ return true
+ default:
+ break
+ }
+ }
+ for message in transaction.outMessages {
+ switch message.contents {
+ case .encryptedText:
+ return true
+ default:
+ break
+ }
+ }
+ return false
+ }
+ }
+}
+
private func extractAddress(_ walletTransaction: WalletInfoTransaction) -> WalletTransactionAddress {
switch walletTransaction {
case let .completed(walletTransaction):
@@ -90,17 +117,17 @@ private func extractAddress(_ walletTransaction: WalletInfoTransaction) -> Walle
return .unknown
}
}
- return .none
case let .pending(pending):
return .list([pending.address])
}
}
-private func extractDescription(_ walletTransaction: WalletInfoTransaction) -> String {
+private func extractDescription(_ walletTransaction: WalletInfoTransaction) -> (string: String, isEncrypted: Bool) {
switch walletTransaction {
case let .completed(walletTransaction):
let transferredValue = walletTransaction.transferredValueWithoutFees
var text = ""
+ var isEncrypted = false
if transferredValue <= 0 {
for message in walletTransaction.outMessages {
if !text.isEmpty {
@@ -110,7 +137,8 @@ private func extractDescription(_ walletTransaction: WalletInfoTransaction) -> S
case .raw:
break
case .encryptedText:
- text.append("")
+ text.append("Encrypted Comment")
+ isEncrypted = true
case let .plainText(plainText):
text.append(plainText)
}
@@ -121,15 +149,16 @@ private func extractDescription(_ walletTransaction: WalletInfoTransaction) -> S
case .raw:
text = ""
case .encryptedText:
- text = ""
+ text = "Encrypted Comment"
+ isEncrypted = true
case let .plainText(plainText):
text = plainText
}
}
}
- return text
+ return (text, isEncrypted)
case let .pending(pending):
- return String(data: pending.comment, encoding: .utf8) ?? ""
+ return (String(data: pending.comment, encoding: .utf8) ?? "", false)
}
}
@@ -160,7 +189,7 @@ private func messageBubbleImage(incoming: Bool, fillColor: UIColor, strokeColor:
final class WalletTransactionInfoScreen: ViewController {
private let context: WalletContext
private let walletInfo: WalletInfo?
- private let walletTransaction: WalletInfoTransaction
+ private var walletTransaction: WalletInfoTransaction
private let walletState: Signal<(CombinedWalletState, Bool), NoError>
private var presentationData: WalletPresentationData
@@ -234,6 +263,39 @@ final class WalletTransactionInfoScreen: ViewController {
}
}
}
+ (self.displayNode as! WalletTransactionInfoScreenNode).requestDecryption = { [weak self] in
+ guard let strongSelf = self, let walletInfo = strongSelf.walletInfo, case let .completed(walletTransaction) = strongSelf.walletTransaction else {
+ return
+ }
+ let keychain = strongSelf.context.keychain
+ let _ = (strongSelf.context.getServerSalt()
+ |> map(Optional.init)
+ |> `catch` { _ -> Signal in
+ return .single(nil)
+ }
+ |> mapToSignal { serverSalt -> Signal in
+ guard let serverSalt = serverSalt else {
+ return .single(nil)
+ }
+ return walletTransactionDecryptionKey(keychain: keychain, walletInfo: walletInfo, localPassword: serverSalt)
+ }
+ |> deliverOnMainQueue).start(next: { decryptionKey in
+ guard let strongSelf = self else {
+ return
+ }
+ if let decryptionKey = decryptionKey {
+ let _ = (decryptWalletTransactions(decryptionKey: decryptionKey, transactions: [walletTransaction], tonInstance: strongSelf.context.tonInstance)
+ |> deliverOnMainQueue).start(next: { result in
+ guard let strongSelf = self, let updatedTransaction = result.first else {
+ return
+ }
+ strongSelf.walletTransaction = .completed(updatedTransaction)
+ (strongSelf.displayNode as! WalletTransactionInfoScreenNode).updateTransaction(strongSelf.walletTransaction)
+ (strongSelf.navigationController as? NavigationController)?.requestLayout(transition: .immediate)
+ })
+ }
+ })
+ }
(self.displayNode as! WalletTransactionInfoScreenNode).displayFeesTooltip = { [weak self] node, rect in
guard let strongSelf = self else {
return
@@ -255,7 +317,7 @@ final class WalletTransactionInfoScreen: ViewController {
}
}
strongSelf.present(controller, in: .window(.root), with: TooltipControllerPresentationArguments(sourceViewAndRect: {
- if let strongSelf = self {
+ if let _ = self {
return (node.view, rect.insetBy(dx: 0.0, dy: -4.0))
}
return nil
@@ -286,7 +348,8 @@ final class WalletTransactionInfoScreen: ViewController {
let minHeight: CGFloat = 424.0
let maxHeight: CGFloat = min(596.0, layout.size.height)
- let text = NSAttributedString(string: extractDescription(self.walletTransaction), font: Font.regular(17.0), textColor: .black)
+ let (plainText, textIsEncrypted) = extractDescription(self.walletTransaction)
+ let text = NSAttributedString(string: plainText, font: textIsEncrypted ? Font.monospace(17.0) : Font.regular(17.0), textColor: .black)
let makeTextLayout = TextNode.asyncLayout(self.measureTextNode)
let (textLayout, _) = makeTextLayout(TextNodeLayoutArguments(attributedString: text, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: layout.size.width - 36.0 * 2.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
@@ -296,7 +359,13 @@ final class WalletTransactionInfoScreen: ViewController {
let minOverscroll: CGFloat = 42.0
let maxOverscroll: CGFloat = 148.0
- let contentHeight = minHeight + textHeight
+ var contentHeight = minHeight + textHeight
+
+ if textIsEncrypted {
+ let (decryptTextLayout, _) = TextNode.asyncLayout(nil)(TextNodeLayoutArguments(attributedString: NSAttributedString(string: "Decrypt", font: Font.regular(17.0), textColor: presentationData.theme.list.itemAccentColor), maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: layout.size.width - 40.0, height: .greatestFiniteMagnitude), alignment: .center, insets: UIEdgeInsets()))
+ contentHeight += 10.0 + decryptTextLayout.size.height + 10.0
+ }
+
let difference = contentHeight - maxHeight
if difference < 0.0 {
resultHeight = contentHeight
@@ -329,7 +398,7 @@ private let fractionalFont = Font.medium(24.0)
private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate {
private let context: WalletContext
private var presentationData: WalletPresentationData
- private let walletTransaction: WalletInfoTransaction
+ private var walletTransaction: WalletInfoTransaction
private let incoming: Bool
private let titleNode: ImmediateTextNode
@@ -345,12 +414,15 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
private let commentBackgroundNode: ASImageNode
private let commentTextNode: ImmediateTextNode
private let commentSeparatorNode: ASDisplayNode
+ private let commentDecryptButtonTitle: ImmediateTextNode
+ private let commentDecryptButton: HighlightableButtonNode
private let addressTextNode: ImmediateTextNode
private let buttonNode: SolidRoundedButtonNode
private var validLayout: (ContainerViewLayout, CGFloat)?
var send: ((String) -> Void)?
+ var requestDecryption: (() -> Void)?
var displayFeesTooltip: ((ASDisplayNode, CGRect) -> Void)?
var displayCopyContextMenu: ((ASDisplayNode, CGRect, String) -> Void)?
@@ -401,6 +473,15 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
self.commentSeparatorNode = ASDisplayNode()
self.commentSeparatorNode.backgroundColor = self.presentationData.theme.list.itemPlainSeparatorColor
+ self.commentDecryptButtonTitle = ImmediateTextNode()
+ self.commentDecryptButtonTitle.attributedText = NSAttributedString(string: "Decrypt", font: Font.regular(17.0), textColor: presentationData.theme.list.itemAccentColor)
+ self.commentDecryptButtonTitle.textAlignment = .natural
+ self.commentDecryptButtonTitle.maximumNumberOfLines = 0
+ self.commentDecryptButtonTitle.isUserInteractionEnabled = false
+
+ self.commentDecryptButton = HighlightableButtonNode()
+ self.commentDecryptButton.hitTestSlop = UIEdgeInsets(top: -10.0, left: -10.0, bottom: -10.0, right: -10.0)
+
self.addressTextNode = ImmediateTextNode()
self.addressTextNode.maximumNumberOfLines = 4
self.addressTextNode.textAlignment = .justified
@@ -438,8 +519,12 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
self.addSubnode(self.timeNode)
self.addSubnode(self.amountNode)
self.addSubnode(self.commentSeparatorNode)
+ self.commentDecryptButton.addSubnode(self.commentDecryptButtonTitle)
+ self.scrollNode.addSubnode(self.commentDecryptButton)
self.addSubnode(self.addressTextNode)
self.addSubnode(self.buttonNode)
+
+ self.commentDecryptButton.isHidden = !walletTransaction.isEncrypted
let titleFont = Font.semibold(17.0)
let subtitleFont = Font.regular(13.0)
@@ -485,7 +570,8 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
commentBackgroundColor = UIColor(rgb: 0xf1f1f4)
}
self.commentBackgroundNode.image = messageBubbleImage(incoming: transferredValue > 0, fillColor: commentBackgroundColor, strokeColor: presentationData.theme.transaction.descriptionBackgroundColor)
- self.commentTextNode.attributedText = NSAttributedString(string: extractDescription(walletTransaction), font: Font.regular(17.0), textColor: presentationData.theme.transaction.descriptionTextColor)
+ let (plainText, textIsEncrypted) = extractDescription(walletTransaction)
+ self.commentTextNode.attributedText = NSAttributedString(string: plainText, font: textIsEncrypted ? Font.monospace(17.0) : Font.regular(17.0), textColor: presentationData.theme.transaction.descriptionTextColor)
let address = extractAddress(walletTransaction)
var singleAddress: String?
@@ -501,6 +587,21 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
self?.send?(address)
}
}
+
+ self.commentDecryptButton.addTarget(self, action: #selector(self.decryptCommentPressed), forControlEvents: .touchUpInside)
+ }
+
+ @objc private func decryptCommentPressed() {
+ self.requestDecryption?()
+ }
+
+ func updateTransaction(_ walletTransaction: WalletInfoTransaction) {
+ self.walletTransaction = walletTransaction
+
+ let (plainText, textIsEncrypted) = extractDescription(walletTransaction)
+ self.commentTextNode.attributedText = NSAttributedString(string: plainText, font: textIsEncrypted ? Font.monospace(17.0) : Font.regular(17.0), textColor: presentationData.theme.transaction.descriptionTextColor)
+
+ self.commentDecryptButton.isHidden = !walletTransaction.isEncrypted
}
override func didLoad() {
@@ -509,15 +610,17 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
self.scrollNode.view.delegate = self
self.scrollNode.view.alwaysBounceVertical = true
self.scrollNode.view.showsVerticalScrollIndicator = false
+ self.scrollNode.view.delaysContentTouches = false
+ self.scrollNode.view.canCancelContentTouches = true
let commentGestureRecognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapCommentGesture(_:)))
- commentGestureRecognizer.tapActionAtPoint = { [weak self] point in
+ commentGestureRecognizer.tapActionAtPoint = { point in
return .waitForSingleTap
}
self.commentBackgroundNode.view.addGestureRecognizer(commentGestureRecognizer)
let addressGestureRecognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapAddressGesture(_:)))
- addressGestureRecognizer.tapActionAtPoint = { [weak self] point in
+ addressGestureRecognizer.tapActionAtPoint = { point in
return .waitForSingleTap
}
self.addressTextNode.view.addGestureRecognizer(addressGestureRecognizer)
@@ -526,10 +629,10 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
@objc func tapLongTapOrDoubleTapCommentGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
switch recognizer.state {
case .ended:
- if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
+ if let (gesture, _) = recognizer.lastRecognizedGestureAndLocation {
switch gesture {
case .longTap:
- let description = extractDescription(self.walletTransaction)
+ let (description, _) = extractDescription(self.walletTransaction)
if !description.isEmpty {
self.displayCopyContextMenu?(self, self.commentBackgroundNode.convert(self.commentBackgroundNode.bounds, to: self), description)
}
@@ -545,7 +648,7 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
@objc func tapLongTapOrDoubleTapAddressGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
switch recognizer.state {
case .ended:
- if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {
+ if let (gesture, _) = recognizer.lastRecognizedGestureAndLocation {
switch gesture {
case .longTap:
let address = extractAddress(self.walletTransaction)
@@ -668,7 +771,7 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
let buttonHeight: CGFloat = 50.0
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: layout.size.height - bottomInset - buttonHeight), size: CGSize(width: buttonWidth, height: buttonHeight))
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
- self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
+ let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
let addressSize = self.addressTextNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: CGFloat.greatestFiniteMagnitude))
let addressFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - addressSize.width) / 2.0), y: buttonFrame.minY - addressSize.height - 34.0), size: addressSize)
@@ -695,7 +798,18 @@ private final class WalletTransactionInfoScreenNode: ViewControllerTracingNode,
}
transition.updateFrame(node: self.commentBackgroundNode, frame: commentBackgroundFrame)
- let contentHeight = commentOrigin.y + commentBackgroundFrame.height
+ var commentMaxY = commentOrigin.y + commentBackgroundFrame.height
+
+ let decryptSize = self.commentDecryptButtonTitle.updateLayout(CGSize(width: layout.size.width - 40.0, height: .greatestFiniteMagnitude))
+ let decryptButtonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - decryptSize.width) / 2.0), y: commentMaxY + 10.0), size: decryptSize)
+ transition.updateFrame(node: self.commentDecryptButton, frame: decryptButtonFrame)
+ transition.updateFrame(node: self.commentDecryptButtonTitle, frame: CGRect(origin: CGPoint(), size: decryptSize))
+
+ if self.walletTransaction.isEncrypted {
+ commentMaxY = decryptButtonFrame.maxY + 10.0
+ }
+
+ let contentHeight = commentMaxY
self.scrollNode.view.contentSize = CGSize(width: layout.size.width, height: contentHeight)
let isScrollEnabled = contentHeight - scrollFrame.height > 20.0
diff --git a/submodules/WalletUI/Sources/WalletUtils.swift b/submodules/WalletUI/Sources/WalletUtils.swift
index 357bba47a5..2b55bffe44 100644
--- a/submodules/WalletUI/Sources/WalletUtils.swift
+++ b/submodules/WalletUI/Sources/WalletUtils.swift
@@ -82,7 +82,6 @@ func isValidAmount(_ amount: String) -> Bool {
return false
}
var hasDecimalSeparator = false
- var hasLeadingZero = false
var index = 0
for c in amount {
if c == "." || c == "," {
diff --git a/submodules/WalletUI/Sources/WalletWordDisplayScreen.swift b/submodules/WalletUI/Sources/WalletWordDisplayScreen.swift
index bbc72168fc..34cb938aa6 100644
--- a/submodules/WalletUI/Sources/WalletWordDisplayScreen.swift
+++ b/submodules/WalletUI/Sources/WalletWordDisplayScreen.swift
@@ -321,11 +321,8 @@ private final class WalletWordDisplayScreenNode: ViewControllerTracingNode, UISc
contentHeight = textFrame.maxY + textSpacing
- let rowWidth = layout.size.width - buttonSideInset * 2.0
let rowCount = self.wordNodes.count / 2
- let indexWidth: CGFloat = 16.0
-
var wordSizes: [(CGSize, CGSize)] = []
var columnIndexWidth: [CGFloat] = [0.0, 0.0]
var columnWordWidth: [CGFloat] = [0.0, 0.0]
@@ -371,16 +368,14 @@ private final class WalletWordDisplayScreenNode: ViewControllerTracingNode, UISc
}
}
- let minimalFullscreenBottomInset: CGFloat = 74.0
let minimalScrollBottomInset: CGFloat = 30.0
- let fullscreenBottomInset = layout.intrinsicInsets.bottom + minimalFullscreenBottomInset
let scrollBottomInset = layout.intrinsicInsets.bottom + minimalScrollBottomInset
let buttonWidth = layout.size.width - buttonSideInset * 2.0
let buttonFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - buttonWidth) / 2.0), y: max(contentHeight + buttonSpacing, layout.size.height - scrollBottomInset - buttonHeight)), size: CGSize(width: buttonWidth, height: buttonHeight))
transition.updateFrame(node: self.buttonNode, frame: buttonFrame)
- self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
+ let _ = self.buttonNode.updateLayout(width: buttonFrame.width, transition: transition)
self.scrollNode.view.contentSize = CGSize(width: layout.size.width, height: max(layout.size.height, buttonFrame.maxY + scrollBottomInset))
@@ -395,7 +390,7 @@ private final class WalletWordDisplayScreenNode: ViewControllerTracingNode, UISc
if let path = getAppBundle().path(forResource: "WalletApologiesAccepted", ofType: "tgs") {
let toastNode = ToastNode(theme: self.presentationData.theme, animationPath: path, text: self.presentationData.strings.Wallet_Words_NotDoneResponse)
self.toastNode = toastNode
- if let (layout, navigationHeight) = self.validLayout {
+ if let (layout, _) = self.validLayout {
toastNode.update(layout: layout, transition: .immediate)
}
self.addSubnode(toastNode)
diff --git a/submodules/lottie-ios/BUILD b/submodules/lottie-ios/BUILD
index 9d59ea6e57..1e431e1a40 100644
--- a/submodules/lottie-ios/BUILD
+++ b/submodules/lottie-ios/BUILD
@@ -1,4 +1,4 @@
-load("//build-system:unique_directories.bzl", "unique_directories")
+load("//build-system/bazel-utils:unique_directories.bzl", "unique_directories")
private_headers = glob([
"lottie-ios/**/*.h",
diff --git a/submodules/ton/tonlib-src/crypto/CMakeLists.txt b/submodules/ton/tonlib-src/crypto/CMakeLists.txt
index 37f427cae2..7be5475bcd 100644
--- a/submodules/ton/tonlib-src/crypto/CMakeLists.txt
+++ b/submodules/ton/tonlib-src/crypto/CMakeLists.txt
@@ -48,6 +48,7 @@ set(TON_CRYPTO_SOURCE
common/refint.h
common/bigexp.h
common/util.h
+ common/linalloc.hpp
ellcurve/Ed25519.h
ellcurve/Fp25519.h
@@ -390,7 +391,7 @@ endif()
add_executable(create-state block/create-state.cpp)
target_include_directories(create-state PUBLIC $
$)
-target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block)
+target_link_libraries(create-state PUBLIC ton_crypto fift-lib ton_block tonlib)
if (WINGETOPT_FOUND)
target_link_libraries_system(create-state wingetopt)
endif()
diff --git a/submodules/ton/tonlib-src/crypto/Ed25519.cpp b/submodules/ton/tonlib-src/crypto/Ed25519.cpp
index 6a21f83f66..11e20f66e6 100644
--- a/submodules/ton/tonlib-src/crypto/Ed25519.cpp
+++ b/submodules/ton/tonlib-src/crypto/Ed25519.cpp
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public License
along with TON Blockchain Library. If not, see .
- Copyright 2017-2019 Telegram Systems LLP
+ Copyright 2017-2020 Telegram Systems LLP
*/
#include "crypto/Ed25519.h"
@@ -310,6 +310,10 @@ Result Ed25519::compute_shared_secret(const PublicKey &public_key,
return std::move(result);
}
+int Ed25519::version() {
+ return OPENSSL_VERSION_NUMBER;
+}
+
#else
Result Ed25519::generate_private_key() {
@@ -387,6 +391,10 @@ Result Ed25519::compute_shared_secret(const PublicKey &public_key,
return std::move(shared_secret);
}
+int Ed25519::version() {
+ return 0;
+}
+
#endif
} // namespace td
diff --git a/submodules/ton/tonlib-src/crypto/Ed25519.h b/submodules/ton/tonlib-src/crypto/Ed25519.h
index 21dcf7dd37..a3340d2eca 100644
--- a/submodules/ton/tonlib-src/crypto/Ed25519.h
+++ b/submodules/ton/tonlib-src/crypto/Ed25519.h
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public License
along with TON Blockchain Library. If not, see .
- Copyright 2017-2019 Telegram Systems LLP
+ Copyright 2017-2020 Telegram Systems LLP
*/
#pragma once
@@ -65,6 +65,8 @@ class Ed25519 {
static Result generate_private_key();
static Result compute_shared_secret(const PublicKey &public_key, const PrivateKey &private_key);
+
+ static int version();
};
} // namespace td
diff --git a/submodules/ton/tonlib-src/crypto/block/block-auto.cpp b/submodules/ton/tonlib-src/crypto/block/block-auto.cpp
index d2bf8aea89..ba3817074a 100644
--- a/submodules/ton/tonlib-src/crypto/block/block-auto.cpp
+++ b/submodules/ton/tonlib-src/crypto/block/block-auto.cpp
@@ -14,6 +14,7 @@
// uses built-in type `uint`
// uses built-in type `bits`
// uses built-in type `int8`
+// uses built-in type `uint8`
// uses built-in type `uint13`
// uses built-in type `uint15`
// uses built-in type `int16`
@@ -23,6 +24,7 @@
// uses built-in type `uint63`
// uses built-in type `int64`
// uses built-in type `uint64`
+// uses built-in type `uint256`
// uses built-in type `int257`
// uses built-in type `bits256`
@@ -10686,38 +10688,42 @@ int BlockInfo::check_tag(const vm::CellSlice& cs) const {
}
bool BlockInfo::skip(vm::CellSlice& cs) const {
- int not_master, after_merge, vert_seqno_incr, seq_no, vert_seq_no, prev_seq_no;
+ int not_master, after_merge, vert_seqno_incr, flags, seq_no, vert_seq_no, prev_seq_no;
return cs.advance(64)
&& cs.fetch_bool_to(not_master)
&& cs.fetch_bool_to(after_merge)
&& cs.advance(5)
&& cs.fetch_bool_to(vert_seqno_incr)
- && cs.advance(8)
+ && cs.fetch_uint_to(8, flags)
+ && flags <= 1
&& cs.fetch_uint_to(32, seq_no)
&& cs.fetch_uint_to(32, vert_seq_no)
&& vert_seqno_incr <= vert_seq_no
&& add_r1(prev_seq_no, 1, seq_no)
&& cs.advance(392)
+ && (!(flags & 1) || cs.advance(104))
&& (!not_master || cs.advance_refs(1))
&& cs.advance_refs(1)
&& (!vert_seqno_incr || cs.advance_refs(1));
}
bool BlockInfo::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
- int not_master, after_merge, vert_seqno_incr, seq_no, vert_seq_no, prev_seq_no;
+ int not_master, after_merge, vert_seqno_incr, flags, seq_no, vert_seq_no, prev_seq_no;
return cs.fetch_ulong(32) == 0x9bc7a987U
&& cs.advance(32)
&& cs.fetch_bool_to(not_master)
&& cs.fetch_bool_to(after_merge)
&& cs.advance(5)
&& cs.fetch_bool_to(vert_seqno_incr)
- && cs.advance(8)
+ && cs.fetch_uint_to(8, flags)
+ && flags <= 1
&& cs.fetch_uint_to(32, seq_no)
&& cs.fetch_uint_to(32, vert_seq_no)
&& vert_seqno_incr <= vert_seq_no
&& add_r1(prev_seq_no, 1, seq_no)
&& t_ShardIdent.validate_skip(ops, cs, weak)
&& cs.advance(288)
+ && (!(flags & 1) || t_GlobalVersion.validate_skip(ops, cs, weak))
&& (!not_master || t_BlkMasterInfo.validate_skip_ref(ops, cs, weak))
&& BlkPrevInfo{after_merge}.validate_skip_ref(ops, cs, weak)
&& (!vert_seqno_incr || t_BlkPrevInfo_0.validate_skip_ref(ops, cs, weak));
@@ -10736,6 +10742,7 @@ bool BlockInfo::unpack(vm::CellSlice& cs, BlockInfo::Record& data) const {
&& cs.fetch_bool_to(data.key_block)
&& cs.fetch_bool_to(data.vert_seqno_incr)
&& cs.fetch_uint_to(8, data.flags)
+ && data.flags <= 1
&& cs.fetch_uint_to(32, data.seq_no)
&& cs.fetch_uint_to(32, data.vert_seq_no)
&& data.vert_seqno_incr <= data.vert_seq_no
@@ -10748,6 +10755,7 @@ bool BlockInfo::unpack(vm::CellSlice& cs, BlockInfo::Record& data) const {
&& cs.fetch_uint_to(32, data.gen_catchain_seqno)
&& cs.fetch_uint_to(32, data.min_ref_mc_seqno)
&& cs.fetch_uint_to(32, data.prev_key_block_seqno)
+ && (!(data.flags & 1) || cs.fetch_subslice_to(104, data.gen_software))
&& (!data.not_master || cs.fetch_ref_to(data.master_ref))
&& cs.fetch_ref_to(data.prev_ref)
&& (!data.vert_seqno_incr || cs.fetch_ref_to(data.prev_vert_ref));
@@ -10772,6 +10780,7 @@ bool BlockInfo::pack(vm::CellBuilder& cb, const BlockInfo::Record& data) const {
&& cb.store_ulong_rchk_bool(data.key_block, 1)
&& cb.store_ulong_rchk_bool(data.vert_seqno_incr, 1)
&& cb.store_ulong_rchk_bool(data.flags, 8)
+ && data.flags <= 1
&& cb.store_ulong_rchk_bool(data.seq_no, 32)
&& cb.store_ulong_rchk_bool(data.vert_seq_no, 32)
&& data.vert_seqno_incr <= data.vert_seq_no
@@ -10784,6 +10793,7 @@ bool BlockInfo::pack(vm::CellBuilder& cb, const BlockInfo::Record& data) const {
&& cb.store_ulong_rchk_bool(data.gen_catchain_seqno, 32)
&& cb.store_ulong_rchk_bool(data.min_ref_mc_seqno, 32)
&& cb.store_ulong_rchk_bool(data.prev_key_block_seqno, 32)
+ && (!(data.flags & 1) || cb.append_cellslice_chk(data.gen_software, 104))
&& (!data.not_master || cb.store_ref_bool(data.master_ref))
&& cb.store_ref_bool(data.prev_ref)
&& (!data.vert_seqno_incr || cb.store_ref_bool(data.prev_vert_ref));
@@ -10814,6 +10824,7 @@ bool BlockInfo::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
&& pp.field_int(vert_seqno_incr, "vert_seqno_incr")
&& cs.fetch_uint_to(8, flags)
&& pp.field_int(flags, "flags")
+ && flags <= 1
&& cs.fetch_uint_to(32, seq_no)
&& pp.field_int(seq_no, "seq_no")
&& cs.fetch_uint_to(32, vert_seq_no)
@@ -10829,6 +10840,7 @@ bool BlockInfo::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
&& pp.fetch_uint_field(cs, 32, "gen_catchain_seqno")
&& pp.fetch_uint_field(cs, 32, "min_ref_mc_seqno")
&& pp.fetch_uint_field(cs, 32, "prev_key_block_seqno")
+ && (!(flags & 1) || (pp.field("gen_software") && t_GlobalVersion.print_skip(pp, cs)))
&& (!not_master || (pp.field("master_ref") && t_BlkMasterInfo.print_ref(pp, cs.fetch_ref())))
&& pp.field("prev_ref")
&& BlkPrevInfo{after_merge}.print_ref(pp, cs.fetch_ref())
@@ -14057,6 +14069,309 @@ bool GlobalVersion::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
const GlobalVersion t_GlobalVersion;
+//
+// code for type `ConfigProposalSetup`
+//
+constexpr unsigned char ConfigProposalSetup::cons_tag[1];
+
+int ConfigProposalSetup::check_tag(const vm::CellSlice& cs) const {
+ return cs.prefetch_ulong(8) == 0x36 ? cfg_vote_cfg : -1;
+}
+
+bool ConfigProposalSetup::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
+ return cs.fetch_ulong(8) == 0x36
+ && cs.advance(160);
+}
+
+bool ConfigProposalSetup::unpack(vm::CellSlice& cs, ConfigProposalSetup::Record& data) const {
+ return cs.fetch_ulong(8) == 0x36
+ && cs.fetch_uint_to(8, data.min_tot_rounds)
+ && cs.fetch_uint_to(8, data.max_tot_rounds)
+ && cs.fetch_uint_to(8, data.min_wins)
+ && cs.fetch_uint_to(8, data.max_losses)
+ && cs.fetch_uint_to(32, data.min_store_sec)
+ && cs.fetch_uint_to(32, data.max_store_sec)
+ && cs.fetch_uint_to(32, data.bit_price)
+ && cs.fetch_uint_to(32, data.cell_price);
+}
+
+bool ConfigProposalSetup::cell_unpack(Ref cell_ref, ConfigProposalSetup::Record& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigProposalSetup::pack(vm::CellBuilder& cb, const ConfigProposalSetup::Record& data) const {
+ return cb.store_long_bool(0x36, 8)
+ && cb.store_ulong_rchk_bool(data.min_tot_rounds, 8)
+ && cb.store_ulong_rchk_bool(data.max_tot_rounds, 8)
+ && cb.store_ulong_rchk_bool(data.min_wins, 8)
+ && cb.store_ulong_rchk_bool(data.max_losses, 8)
+ && cb.store_ulong_rchk_bool(data.min_store_sec, 32)
+ && cb.store_ulong_rchk_bool(data.max_store_sec, 32)
+ && cb.store_ulong_rchk_bool(data.bit_price, 32)
+ && cb.store_ulong_rchk_bool(data.cell_price, 32);
+}
+
+bool ConfigProposalSetup::cell_pack(Ref& cell_ref, const ConfigProposalSetup::Record& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigProposalSetup::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
+ return cs.fetch_ulong(8) == 0x36
+ && pp.open("cfg_vote_cfg")
+ && pp.fetch_uint_field(cs, 8, "min_tot_rounds")
+ && pp.fetch_uint_field(cs, 8, "max_tot_rounds")
+ && pp.fetch_uint_field(cs, 8, "min_wins")
+ && pp.fetch_uint_field(cs, 8, "max_losses")
+ && pp.fetch_uint_field(cs, 32, "min_store_sec")
+ && pp.fetch_uint_field(cs, 32, "max_store_sec")
+ && pp.fetch_uint_field(cs, 32, "bit_price")
+ && pp.fetch_uint_field(cs, 32, "cell_price")
+ && pp.close();
+}
+
+const ConfigProposalSetup t_ConfigProposalSetup;
+
+//
+// code for type `ConfigVotingSetup`
+//
+constexpr unsigned char ConfigVotingSetup::cons_tag[1];
+
+int ConfigVotingSetup::check_tag(const vm::CellSlice& cs) const {
+ return cs.prefetch_ulong(8) == 0x91 ? cfg_vote_setup : -1;
+}
+
+bool ConfigVotingSetup::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
+ return cs.fetch_ulong(8) == 0x91
+ && t_ConfigProposalSetup.validate_skip_ref(ops, cs, weak)
+ && t_ConfigProposalSetup.validate_skip_ref(ops, cs, weak);
+}
+
+bool ConfigVotingSetup::unpack(vm::CellSlice& cs, ConfigVotingSetup::Record& data) const {
+ return cs.fetch_ulong(8) == 0x91
+ && cs.fetch_ref_to(data.normal_params)
+ && cs.fetch_ref_to(data.critical_params);
+}
+
+bool ConfigVotingSetup::unpack_cfg_vote_setup(vm::CellSlice& cs, Ref& normal_params, Ref& critical_params) const {
+ return cs.fetch_ulong(8) == 0x91
+ && cs.fetch_ref_to(normal_params)
+ && cs.fetch_ref_to(critical_params);
+}
+
+bool ConfigVotingSetup::cell_unpack(Ref cell_ref, ConfigVotingSetup::Record& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigVotingSetup::cell_unpack_cfg_vote_setup(Ref cell_ref, Ref& normal_params, Ref& critical_params) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack_cfg_vote_setup(cs, normal_params, critical_params) && cs.empty_ext();
+}
+
+bool ConfigVotingSetup::pack(vm::CellBuilder& cb, const ConfigVotingSetup::Record& data) const {
+ return cb.store_long_bool(0x91, 8)
+ && cb.store_ref_bool(data.normal_params)
+ && cb.store_ref_bool(data.critical_params);
+}
+
+bool ConfigVotingSetup::pack_cfg_vote_setup(vm::CellBuilder& cb, Ref normal_params, Ref critical_params) const {
+ return cb.store_long_bool(0x91, 8)
+ && cb.store_ref_bool(normal_params)
+ && cb.store_ref_bool(critical_params);
+}
+
+bool ConfigVotingSetup::cell_pack(Ref& cell_ref, const ConfigVotingSetup::Record& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigVotingSetup::cell_pack_cfg_vote_setup(Ref& cell_ref, Ref normal_params, Ref critical_params) const {
+ vm::CellBuilder cb;
+ return pack_cfg_vote_setup(cb, std::move(normal_params), std::move(critical_params)) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigVotingSetup::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
+ return cs.fetch_ulong(8) == 0x91
+ && pp.open("cfg_vote_setup")
+ && pp.field("normal_params")
+ && t_ConfigProposalSetup.print_ref(pp, cs.fetch_ref())
+ && pp.field("critical_params")
+ && t_ConfigProposalSetup.print_ref(pp, cs.fetch_ref())
+ && pp.close();
+}
+
+const ConfigVotingSetup t_ConfigVotingSetup;
+
+//
+// code for type `ConfigProposal`
+//
+constexpr unsigned char ConfigProposal::cons_tag[1];
+
+int ConfigProposal::check_tag(const vm::CellSlice& cs) const {
+ return cs.prefetch_ulong(8) == 0xf3 ? cfg_proposal : -1;
+}
+
+bool ConfigProposal::skip(vm::CellSlice& cs) const {
+ return cs.advance(40)
+ && t_Maybe_Ref_Cell.skip(cs)
+ && t_Maybe_uint256.skip(cs);
+}
+
+bool ConfigProposal::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
+ return cs.fetch_ulong(8) == 0xf3
+ && cs.advance(32)
+ && t_Maybe_Ref_Cell.validate_skip(ops, cs, weak)
+ && t_Maybe_uint256.validate_skip(ops, cs, weak);
+}
+
+bool ConfigProposal::unpack(vm::CellSlice& cs, ConfigProposal::Record& data) const {
+ return cs.fetch_ulong(8) == 0xf3
+ && cs.fetch_int_to(32, data.param_id)
+ && t_Maybe_Ref_Cell.fetch_to(cs, data.param_value)
+ && t_Maybe_uint256.fetch_to(cs, data.if_hash_equal);
+}
+
+bool ConfigProposal::unpack_cfg_proposal(vm::CellSlice& cs, int& param_id, Ref& param_value, Ref& if_hash_equal) const {
+ return cs.fetch_ulong(8) == 0xf3
+ && cs.fetch_int_to(32, param_id)
+ && t_Maybe_Ref_Cell.fetch_to(cs, param_value)
+ && t_Maybe_uint256.fetch_to(cs, if_hash_equal);
+}
+
+bool ConfigProposal::cell_unpack(Ref cell_ref, ConfigProposal::Record& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigProposal::cell_unpack_cfg_proposal(Ref cell_ref, int& param_id, Ref& param_value, Ref& if_hash_equal) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack_cfg_proposal(cs, param_id, param_value, if_hash_equal) && cs.empty_ext();
+}
+
+bool ConfigProposal::pack(vm::CellBuilder& cb, const ConfigProposal::Record& data) const {
+ return cb.store_long_bool(0xf3, 8)
+ && cb.store_long_rchk_bool(data.param_id, 32)
+ && t_Maybe_Ref_Cell.store_from(cb, data.param_value)
+ && t_Maybe_uint256.store_from(cb, data.if_hash_equal);
+}
+
+bool ConfigProposal::pack_cfg_proposal(vm::CellBuilder& cb, int param_id, Ref param_value, Ref if_hash_equal) const {
+ return cb.store_long_bool(0xf3, 8)
+ && cb.store_long_rchk_bool(param_id, 32)
+ && t_Maybe_Ref_Cell.store_from(cb, param_value)
+ && t_Maybe_uint256.store_from(cb, if_hash_equal);
+}
+
+bool ConfigProposal::cell_pack(Ref& cell_ref, const ConfigProposal::Record& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigProposal::cell_pack_cfg_proposal(Ref& cell_ref, int param_id, Ref param_value, Ref if_hash_equal) const {
+ vm::CellBuilder cb;
+ return pack_cfg_proposal(cb, param_id, std::move(param_value), std::move(if_hash_equal)) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigProposal::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
+ return cs.fetch_ulong(8) == 0xf3
+ && pp.open("cfg_proposal")
+ && pp.fetch_int_field(cs, 32, "param_id")
+ && pp.field("param_value")
+ && t_Maybe_Ref_Cell.print_skip(pp, cs)
+ && pp.field("if_hash_equal")
+ && t_Maybe_uint256.print_skip(pp, cs)
+ && pp.close();
+}
+
+const ConfigProposal t_ConfigProposal;
+
+//
+// code for type `ConfigProposalStatus`
+//
+constexpr unsigned char ConfigProposalStatus::cons_tag[1];
+
+int ConfigProposalStatus::check_tag(const vm::CellSlice& cs) const {
+ return cs.prefetch_ulong(8) == 0xce ? cfg_proposal_status : -1;
+}
+
+bool ConfigProposalStatus::skip(vm::CellSlice& cs) const {
+ return cs.advance_ext(0x10029)
+ && t_HashmapE_16_True.skip(cs)
+ && cs.advance(344);
+}
+
+bool ConfigProposalStatus::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
+ return cs.fetch_ulong(8) == 0xce
+ && cs.advance(32)
+ && t_ConfigProposal.validate_skip_ref(ops, cs, weak)
+ && cs.advance(1)
+ && t_HashmapE_16_True.validate_skip(ops, cs, weak)
+ && cs.advance(344);
+}
+
+bool ConfigProposalStatus::unpack(vm::CellSlice& cs, ConfigProposalStatus::Record& data) const {
+ return cs.fetch_ulong(8) == 0xce
+ && cs.fetch_uint_to(32, data.expires)
+ && cs.fetch_ref_to(data.proposal)
+ && cs.fetch_bool_to(data.is_critical)
+ && t_HashmapE_16_True.fetch_to(cs, data.voters)
+ && cs.fetch_int_to(64, data.remaining_weight)
+ && cs.fetch_uint256_to(256, data.validator_set_id)
+ && cs.fetch_uint_to(8, data.rounds_remaining)
+ && cs.fetch_uint_to(8, data.wins)
+ && cs.fetch_uint_to(8, data.losses);
+}
+
+bool ConfigProposalStatus::cell_unpack(Ref cell_ref, ConfigProposalStatus::Record& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigProposalStatus::pack(vm::CellBuilder& cb, const ConfigProposalStatus::Record& data) const {
+ return cb.store_long_bool(0xce, 8)
+ && cb.store_ulong_rchk_bool(data.expires, 32)
+ && cb.store_ref_bool(data.proposal)
+ && cb.store_ulong_rchk_bool(data.is_critical, 1)
+ && t_HashmapE_16_True.store_from(cb, data.voters)
+ && cb.store_long_rchk_bool(data.remaining_weight, 64)
+ && cb.store_int256_bool(data.validator_set_id, 256, false)
+ && cb.store_ulong_rchk_bool(data.rounds_remaining, 8)
+ && cb.store_ulong_rchk_bool(data.wins, 8)
+ && cb.store_ulong_rchk_bool(data.losses, 8);
+}
+
+bool ConfigProposalStatus::cell_pack(Ref& cell_ref, const ConfigProposalStatus::Record& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigProposalStatus::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
+ return cs.fetch_ulong(8) == 0xce
+ && pp.open("cfg_proposal_status")
+ && pp.fetch_uint_field(cs, 32, "expires")
+ && pp.field("proposal")
+ && t_ConfigProposal.print_ref(pp, cs.fetch_ref())
+ && pp.fetch_uint_field(cs, 1, "is_critical")
+ && pp.field("voters")
+ && t_HashmapE_16_True.print_skip(pp, cs)
+ && pp.fetch_int_field(cs, 64, "remaining_weight")
+ && pp.fetch_uint256_field(cs, 256, "validator_set_id")
+ && pp.fetch_uint_field(cs, 8, "rounds_remaining")
+ && pp.fetch_uint_field(cs, 8, "wins")
+ && pp.fetch_uint_field(cs, 8, "losses")
+ && pp.close();
+}
+
+const ConfigProposalStatus t_ConfigProposalStatus;
+
//
// code for type `WorkchainFormat`
//
@@ -15219,6 +15534,10 @@ int ConfigParam::get_tag(const vm::CellSlice& cs) const {
return cons8;
case 9:
return cons9;
+ case 10:
+ return cons10;
+ case 11:
+ return cons11;
case 12:
return cons12;
case 14:
@@ -15288,6 +15607,10 @@ int ConfigParam::check_tag(const vm::CellSlice& cs) const {
return cons8;
case cons9:
return cons9;
+ case cons10:
+ return cons10;
+ case cons11:
+ return cons11;
case cons12:
return cons12;
case cons14:
@@ -15366,6 +15689,12 @@ bool ConfigParam::skip(vm::CellSlice& cs) const {
case cons9:
return t_Hashmap_32_True.skip(cs)
&& m_ == 9;
+ case cons10:
+ return t_Hashmap_32_True.skip(cs)
+ && m_ == 10;
+ case cons11:
+ return cs.advance_ext(0x20008)
+ && m_ == 11;
case cons12:
return t_HashmapE_32_WorkchainDescr.skip(cs)
&& m_ == 12;
@@ -15476,6 +15805,12 @@ bool ConfigParam::validate_skip(int* ops, vm::CellSlice& cs, bool weak) const {
case cons9:
return t_Hashmap_32_True.validate_skip(ops, cs, weak)
&& m_ == 9;
+ case cons10:
+ return t_Hashmap_32_True.validate_skip(ops, cs, weak)
+ && m_ == 10;
+ case cons11:
+ return t_ConfigVotingSetup.validate_skip(ops, cs, weak)
+ && m_ == 11;
case cons12:
return t_HashmapE_32_WorkchainDescr.validate_skip(ops, cs, weak)
&& m_ == 12;
@@ -15756,6 +16091,50 @@ bool ConfigParam::cell_unpack_cons9(Ref cell_ref, Ref& mand
return unpack_cons9(cs, mandatory_params) && cs.empty_ext();
}
+bool ConfigParam::unpack(vm::CellSlice& cs, ConfigParam::Record_cons10& data) const {
+ return t_Hashmap_32_True.fetch_to(cs, data.critical_params)
+ && m_ == 10;
+}
+
+bool ConfigParam::unpack_cons10(vm::CellSlice& cs, Ref& critical_params) const {
+ return t_Hashmap_32_True.fetch_to(cs, critical_params)
+ && m_ == 10;
+}
+
+bool ConfigParam::cell_unpack(Ref cell_ref, ConfigParam::Record_cons10& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigParam::cell_unpack_cons10(Ref cell_ref, Ref& critical_params) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack_cons10(cs, critical_params) && cs.empty_ext();
+}
+
+bool ConfigParam::unpack(vm::CellSlice& cs, ConfigParam::Record_cons11& data) const {
+ return cs.fetch_subslice_ext_to(0x20008, data.x)
+ && m_ == 11;
+}
+
+bool ConfigParam::unpack_cons11(vm::CellSlice& cs, Ref& x) const {
+ return cs.fetch_subslice_ext_to(0x20008, x)
+ && m_ == 11;
+}
+
+bool ConfigParam::cell_unpack(Ref cell_ref, ConfigParam::Record_cons11& data) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack(cs, data) && cs.empty_ext();
+}
+
+bool ConfigParam::cell_unpack_cons11(Ref cell_ref, Ref& x) const {
+ if (cell_ref.is_null()) { return false; }
+ auto cs = load_cell_slice(std::move(cell_ref));
+ return unpack_cons11(cs, x) && cs.empty_ext();
+}
+
bool ConfigParam::unpack(vm::CellSlice& cs, ConfigParam::Record_cons12& data) const {
return t_HashmapE_32_WorkchainDescr.fetch_to(cs, data.workchains)
&& m_ == 12;
@@ -16416,6 +16795,46 @@ bool ConfigParam::cell_pack_cons9(Ref& cell_ref, Ref mandat
return pack_cons9(cb, std::move(mandatory_params)) && std::move(cb).finalize_to(cell_ref);
}
+bool ConfigParam::pack(vm::CellBuilder& cb, const ConfigParam::Record_cons10& data) const {
+ return t_Hashmap_32_True.store_from(cb, data.critical_params)
+ && m_ == 10;
+}
+
+bool ConfigParam::pack_cons10(vm::CellBuilder& cb, Ref critical_params) const {
+ return t_Hashmap_32_True.store_from(cb, critical_params)
+ && m_ == 10;
+}
+
+bool ConfigParam::cell_pack(Ref& cell_ref, const ConfigParam::Record_cons10& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigParam::cell_pack_cons10(Ref& cell_ref, Ref critical_params) const {
+ vm::CellBuilder cb;
+ return pack_cons10(cb, std::move(critical_params)) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigParam::pack(vm::CellBuilder& cb, const ConfigParam::Record_cons11& data) const {
+ return cb.append_cellslice_chk(data.x, 0x20008)
+ && m_ == 11;
+}
+
+bool ConfigParam::pack_cons11(vm::CellBuilder& cb, Ref x) const {
+ return cb.append_cellslice_chk(x, 0x20008)
+ && m_ == 11;
+}
+
+bool ConfigParam::cell_pack(Ref& cell_ref, const ConfigParam::Record_cons11& data) const {
+ vm::CellBuilder cb;
+ return pack(cb, data) && std::move(cb).finalize_to(cell_ref);
+}
+
+bool ConfigParam::cell_pack_cons11(Ref& cell_ref, Ref x) const {
+ vm::CellBuilder cb;
+ return pack_cons11(cb, std::move(x)) && std::move(cb).finalize_to(cell_ref);
+}
+
bool ConfigParam::pack(vm::CellBuilder& cb, const ConfigParam::Record_cons12& data) const {
return t_HashmapE_32_WorkchainDescr.store_from(cb, data.workchains)
&& m_ == 12;
@@ -16905,6 +17324,18 @@ bool ConfigParam::print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const {
&& t_Hashmap_32_True.print_skip(pp, cs)
&& m_ == 9
&& pp.close();
+ case cons10:
+ return pp.open()
+ && pp.field("critical_params")
+ && t_Hashmap_32_True.print_skip(pp, cs)
+ && m_ == 10
+ && pp.close();
+ case cons11:
+ return pp.open()
+ && pp.field()
+ && t_ConfigVotingSetup.print_skip(pp, cs)
+ && m_ == 11
+ && pp.close();
case cons12:
return pp.open()
&& pp.field("workchains")
@@ -21128,8 +21559,8 @@ const RefT t_Ref_OutMsgDescr{t_OutMsgDescr};
const RefT t_Ref_ShardAccountBlocks{t_ShardAccountBlocks};
const RefT t_Ref_McBlockExtra{t_McBlockExtra};
const Maybe t_Maybe_Ref_McBlockExtra{t_Ref_McBlockExtra};
-const RefT t_Ref_TYPE_1648{t_ValueFlow_aux};
-const RefT t_Ref_TYPE_1649{t_ValueFlow_aux1};
+const RefT t_Ref_TYPE_1649{t_ValueFlow_aux};
+const RefT t_Ref_TYPE_1650{t_ValueFlow_aux1};
const NatWidth t_natwidth_3{3};
const BinTree t_BinTree_ShardDescr{t_ShardDescr};
const RefT t_Ref_BinTree_ShardDescr{t_BinTree_ShardDescr};
@@ -21142,14 +21573,21 @@ const HashmapE t_HashmapE_256_CreatorStats{256, t_CreatorStats};
const HashmapAugE t_HashmapAugE_256_CreatorStats_uint32{256, t_CreatorStats, t_uint32};
const NatWidth t_natwidth_16{16};
const Maybe t_Maybe_ExtBlkRef{t_ExtBlkRef};
-const RefT t_Ref_TYPE_1666{t_McStateExtra_aux};
+const RefT t_Ref_TYPE_1667{t_McStateExtra_aux};
const RefT t_Ref_SignedCertificate{t_SignedCertificate};
const HashmapE t_HashmapE_16_CryptoSignaturePair{16, t_CryptoSignaturePair};
const Maybe t_Maybe_Ref_InMsg{t_Ref_InMsg};
-const RefT t_Ref_TYPE_1674{t_McBlockExtra_aux};
+const RefT t_Ref_TYPE_1675{t_McBlockExtra_aux};
const Hashmap t_Hashmap_16_ValidatorDescr{16, t_ValidatorDescr};
const HashmapE t_HashmapE_16_ValidatorDescr{16, t_ValidatorDescr};
const Hashmap t_Hashmap_32_True{32, t_True};
+const UInt t_uint8{8};
+const RefT t_Ref_ConfigProposalSetup{t_ConfigProposalSetup};
+const UInt t_uint256{256};
+const Maybe t_Maybe_uint256{t_uint256};
+const RefT t_Ref_ConfigProposal{t_ConfigProposal};
+const HashmapE t_HashmapE_16_True{16, t_True};
+const Int t_int64{64};
const NatWidth t_natwidth_12{12};
const NatWidth t_natwidth_32{32};
const NatWidth t_natwidth_13{13};
@@ -21162,14 +21600,13 @@ const RefT t_Ref_BlockSignatures{t_BlockSignatures};
const Maybe t_Maybe_Ref_BlockSignatures{t_Ref_BlockSignatures};
const RefT t_Ref_TopBlockDescr{t_TopBlockDescr};
const HashmapE t_HashmapE_96_Ref_TopBlockDescr{96, t_Ref_TopBlockDescr};
-const Int t_int64{64};
const Int t_int257{257};
const NatWidth t_natwidth_10{10};
const NatLeq t_natleq_4{4};
const RefT t_Ref_VmStackValue{t_VmStackValue};
const NatWidth t_natwidth_24{24};
const HashmapE t_HashmapE_4_VmStackValue{4, t_VmStackValue};
-const RefT t_Ref_TYPE_1705{t_VmGasLimits_aux};
+const RefT t_Ref_TYPE_1709{t_VmGasLimits_aux};
const HashmapE t_HashmapE_256_Ref_Cell{256, t_RefCell};
const UInt t_uint13{13};
const Maybe t_Maybe_uint13{t_uint13};
@@ -21250,6 +21687,7 @@ bool register_simple_types(std::function func) {
&& func("McStateExtra", &t_McStateExtra)
&& func("ShardStateUnsplit", &t_ShardStateUnsplit)
&& func("ShardState", &t_ShardState)
+ && func("GlobalVersion", &t_GlobalVersion)
&& func("BlockInfo", &t_BlockInfo)
&& func("ValueFlow", &t_ValueFlow)
&& func("BlockExtra", &t_BlockExtra)
@@ -21278,7 +21716,10 @@ bool register_simple_types(std::function func) {
&& func("SignedCertificate", &t_SignedCertificate)
&& func("ValidatorDescr", &t_ValidatorDescr)
&& func("ValidatorSet", &t_ValidatorSet)
- && func("GlobalVersion", &t_GlobalVersion)
+ && func("ConfigProposalSetup", &t_ConfigProposalSetup)
+ && func("ConfigVotingSetup", &t_ConfigVotingSetup)
+ && func("ConfigProposal", &t_ConfigProposal)
+ && func("ConfigProposalStatus", &t_ConfigProposalStatus)
&& func("WorkchainDescr", &t_WorkchainDescr)
&& func("BlockCreateFees", &t_BlockCreateFees)
&& func("StoragePrices", &t_StoragePrices)
diff --git a/submodules/ton/tonlib-src/crypto/block/block-auto.h b/submodules/ton/tonlib-src/crypto/block/block-auto.h
index ac0bf542b8..e9ed5d3947 100644
--- a/submodules/ton/tonlib-src/crypto/block/block-auto.h
+++ b/submodules/ton/tonlib-src/crypto/block/block-auto.h
@@ -15,6 +15,7 @@
// uses built-in type `uint`
// uses built-in type `bits`
// uses built-in type `int8`
+// uses built-in type `uint8`
// uses built-in type `uint13`
// uses built-in type `uint15`
// uses built-in type `int16`
@@ -24,6 +25,7 @@
// uses built-in type `uint63`
// uses built-in type `int64`
// uses built-in type `uint64`
+// uses built-in type `uint256`
// uses built-in type `int257`
// uses built-in type `bits256`
@@ -4533,11 +4535,12 @@ struct BlockInfo::Record {
unsigned gen_catchain_seqno; // gen_catchain_seqno : uint32
unsigned min_ref_mc_seqno; // min_ref_mc_seqno : uint32
unsigned prev_key_block_seqno; // prev_key_block_seqno : uint32
+ Ref gen_software; // gen_software : flags.0?GlobalVersion
Ref master_ref; // master_ref : not_master?^BlkMasterInfo
Ref prev_ref; // prev_ref : ^(BlkPrevInfo after_merge)
Ref prev_vert_ref; // prev_vert_ref : vert_seqno_incr?^(BlkPrevInfo 0)
Record() = default;
- Record(unsigned _version, bool _not_master, bool _after_merge, bool _before_split, bool _after_split, bool _want_split, bool _want_merge, bool _key_block, bool _vert_seqno_incr, int _flags, int _seq_no, int _vert_seq_no, Ref _shard, unsigned _gen_utime, unsigned long long _start_lt, unsigned long long _end_lt, unsigned _gen_validator_list_hash_short, unsigned _gen_catchain_seqno, unsigned _min_ref_mc_seqno, unsigned _prev_key_block_seqno, Ref _master_ref, Ref _prev_ref, Ref _prev_vert_ref) : version(_version), not_master(_not_master), after_merge(_after_merge), before_split(_before_split), after_split(_after_split), want_split(_want_split), want_merge(_want_merge), key_block(_key_block), vert_seqno_incr(_vert_seqno_incr), flags(_flags), seq_no(_seq_no), vert_seq_no(_vert_seq_no), shard(std::move(_shard)), gen_utime(_gen_utime), start_lt(_start_lt), end_lt(_end_lt), gen_validator_list_hash_short(_gen_validator_list_hash_short), gen_catchain_seqno(_gen_catchain_seqno), min_ref_mc_seqno(_min_ref_mc_seqno), prev_key_block_seqno(_prev_key_block_seqno), master_ref(std::move(_master_ref)), prev_ref(std::move(_prev_ref)), prev_vert_ref(std::move(_prev_vert_ref)) {}
+ Record(unsigned _version, bool _not_master, bool _after_merge, bool _before_split, bool _after_split, bool _want_split, bool _want_merge, bool _key_block, bool _vert_seqno_incr, int _flags, int _seq_no, int _vert_seq_no, Ref _shard, unsigned _gen_utime, unsigned long long _start_lt, unsigned long long _end_lt, unsigned _gen_validator_list_hash_short, unsigned _gen_catchain_seqno, unsigned _min_ref_mc_seqno, unsigned _prev_key_block_seqno, Ref _gen_software, Ref _master_ref, Ref _prev_ref, Ref _prev_vert_ref) : version(_version), not_master(_not_master), after_merge(_after_merge), before_split(_before_split), after_split(_after_split), want_split(_want_split), want_merge(_want_merge), key_block(_key_block), vert_seqno_incr(_vert_seqno_incr), flags(_flags), seq_no(_seq_no), vert_seq_no(_vert_seq_no), shard(std::move(_shard)), gen_utime(_gen_utime), start_lt(_start_lt), end_lt(_end_lt), gen_validator_list_hash_short(_gen_validator_list_hash_short), gen_catchain_seqno(_gen_catchain_seqno), min_ref_mc_seqno(_min_ref_mc_seqno), prev_key_block_seqno(_prev_key_block_seqno), gen_software(std::move(_gen_software)), master_ref(std::move(_master_ref)), prev_ref(std::move(_prev_ref)), prev_vert_ref(std::move(_prev_vert_ref)) {}
};
extern const BlockInfo t_BlockInfo;
@@ -6085,6 +6088,176 @@ struct GlobalVersion final : TLB_Complex {
extern const GlobalVersion t_GlobalVersion;
+//
+// headers for type `ConfigProposalSetup`
+//
+
+struct ConfigProposalSetup final : TLB_Complex {
+ enum { cfg_vote_cfg };
+ static constexpr int cons_len_exact = 8;
+ static constexpr unsigned char cons_tag[1] = { 0x36 };
+ struct Record;
+ int get_size(const vm::CellSlice& cs) const override {
+ return 168;
+ }
+ bool skip(vm::CellSlice& cs) const override {
+ return cs.advance(168);
+ }
+ bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
+ bool unpack(vm::CellSlice& cs, Record& data) const;
+ bool cell_unpack(Ref cell_ref, Record& data) const;
+ bool pack(vm::CellBuilder& cb, const Record& data) const;
+ bool cell_pack(Ref& cell_ref, const Record& data) const;
+ bool print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "ConfigProposalSetup";
+ }
+ int check_tag(const vm::CellSlice& cs) const override;
+ int get_tag(const vm::CellSlice& cs) const override {
+ return 0;
+ }
+};
+
+struct ConfigProposalSetup::Record {
+ typedef ConfigProposalSetup type_class;
+ int min_tot_rounds; // min_tot_rounds : uint8
+ int max_tot_rounds; // max_tot_rounds : uint8
+ int min_wins; // min_wins : uint8
+ int max_losses; // max_losses : uint8
+ unsigned min_store_sec; // min_store_sec : uint32
+ unsigned max_store_sec; // max_store_sec : uint32
+ unsigned bit_price; // bit_price : uint32
+ unsigned cell_price; // cell_price : uint32
+ Record() = default;
+ Record(int _min_tot_rounds, int _max_tot_rounds, int _min_wins, int _max_losses, unsigned _min_store_sec, unsigned _max_store_sec, unsigned _bit_price, unsigned _cell_price) : min_tot_rounds(_min_tot_rounds), max_tot_rounds(_max_tot_rounds), min_wins(_min_wins), max_losses(_max_losses), min_store_sec(_min_store_sec), max_store_sec(_max_store_sec), bit_price(_bit_price), cell_price(_cell_price) {}
+};
+
+extern const ConfigProposalSetup t_ConfigProposalSetup;
+
+//
+// headers for type `ConfigVotingSetup`
+//
+
+struct ConfigVotingSetup final : TLB_Complex {
+ enum { cfg_vote_setup };
+ static constexpr int cons_len_exact = 8;
+ static constexpr unsigned char cons_tag[1] = { 0x91 };
+ struct Record {
+ typedef ConfigVotingSetup type_class;
+ Ref normal_params; // normal_params : ^ConfigProposalSetup
+ Ref critical_params; // critical_params : ^ConfigProposalSetup
+ Record() = default;
+ Record(Ref _normal_params, Ref _critical_params) : normal_params(std::move(_normal_params)), critical_params(std::move(_critical_params)) {}
+ };
+ int get_size(const vm::CellSlice& cs) const override {
+ return 0x20008;
+ }
+ bool skip(vm::CellSlice& cs) const override {
+ return cs.advance_ext(0x20008);
+ }
+ bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
+ bool unpack(vm::CellSlice& cs, Record& data) const;
+ bool unpack_cfg_vote_setup(vm::CellSlice& cs, Ref& normal_params, Ref& critical_params) const;
+ bool cell_unpack(Ref cell_ref, Record& data) const;
+ bool cell_unpack_cfg_vote_setup(Ref cell_ref, Ref& normal_params, Ref& critical_params) const;
+ bool pack(vm::CellBuilder& cb, const Record& data) const;
+ bool pack_cfg_vote_setup(vm::CellBuilder& cb, Ref normal_params, Ref critical_params) const;
+ bool cell_pack(Ref& cell_ref, const Record& data) const;
+ bool cell_pack_cfg_vote_setup(Ref& cell_ref, Ref normal_params, Ref critical_params) const;
+ bool print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "ConfigVotingSetup";
+ }
+ int check_tag(const vm::CellSlice& cs) const override;
+ int get_tag(const vm::CellSlice& cs) const override {
+ return 0;
+ }
+};
+
+extern const ConfigVotingSetup t_ConfigVotingSetup;
+
+//
+// headers for type `ConfigProposal`
+//
+
+struct ConfigProposal final : TLB_Complex {
+ enum { cfg_proposal };
+ static constexpr int cons_len_exact = 8;
+ static constexpr unsigned char cons_tag[1] = { 0xf3 };
+ struct Record;
+ bool skip(vm::CellSlice& cs) const override;
+ bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
+ bool unpack(vm::CellSlice& cs, Record& data) const;
+ bool unpack_cfg_proposal(vm::CellSlice& cs, int& param_id, Ref& param_value, Ref& if_hash_equal) const;
+ bool cell_unpack(Ref cell_ref, Record& data) const;
+ bool cell_unpack_cfg_proposal(Ref cell_ref, int& param_id, Ref& param_value, Ref& if_hash_equal) const;
+ bool pack(vm::CellBuilder& cb, const Record& data) const;
+ bool pack_cfg_proposal(vm::CellBuilder& cb, int param_id, Ref param_value, Ref if_hash_equal) const;
+ bool cell_pack(Ref& cell_ref, const Record& data) const;
+ bool cell_pack_cfg_proposal(Ref& cell_ref, int param_id, Ref param_value, Ref if_hash_equal) const;
+ bool print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "ConfigProposal";
+ }
+ int check_tag(const vm::CellSlice& cs) const override;
+ int get_tag(const vm::CellSlice& cs) const override {
+ return 0;
+ }
+};
+
+struct ConfigProposal::Record {
+ typedef ConfigProposal type_class;
+ int param_id; // param_id : int32
+ Ref param_value; // param_value : Maybe ^Cell
+ Ref if_hash_equal; // if_hash_equal : Maybe uint256
+ Record() = default;
+ Record(int _param_id, Ref _param_value, Ref _if_hash_equal) : param_id(_param_id), param_value(std::move(_param_value)), if_hash_equal(std::move(_if_hash_equal)) {}
+};
+
+extern const ConfigProposal t_ConfigProposal;
+
+//
+// headers for type `ConfigProposalStatus`
+//
+
+struct ConfigProposalStatus final : TLB_Complex {
+ enum { cfg_proposal_status };
+ static constexpr int cons_len_exact = 8;
+ static constexpr unsigned char cons_tag[1] = { 0xce };
+ struct Record;
+ bool skip(vm::CellSlice& cs) const override;
+ bool validate_skip(int* ops, vm::CellSlice& cs, bool weak = false) const override;
+ bool unpack(vm::CellSlice& cs, Record& data) const;
+ bool cell_unpack(Ref cell_ref, Record& data) const;
+ bool pack(vm::CellBuilder& cb, const Record& data) const;
+ bool cell_pack(Ref& cell_ref, const Record& data) const;
+ bool print_skip(PrettyPrinter& pp, vm::CellSlice& cs) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "ConfigProposalStatus";
+ }
+ int check_tag(const vm::CellSlice& cs) const override;
+ int get_tag(const vm::CellSlice& cs) const override {
+ return 0;
+ }
+};
+
+struct ConfigProposalStatus::Record {
+ typedef ConfigProposalStatus type_class;
+ unsigned expires; // expires : uint32
+ Ref proposal; // proposal : ^ConfigProposal
+ bool is_critical; // is_critical : Bool
+ Ref voters; // voters : HashmapE 16 True
+ long long remaining_weight; // remaining_weight : int64
+ RefInt256 validator_set_id; // validator_set_id : uint256
+ int rounds_remaining; // rounds_remaining : uint8
+ int wins; // wins : uint8
+ int losses; // losses : uint8
+ Record() = default;
+ Record(unsigned _expires, Ref _proposal, bool _is_critical, Ref _voters, long long _remaining_weight, RefInt256 _validator_set_id, int _rounds_remaining, int _wins, int _losses) : expires(_expires), proposal(std::move(_proposal)), is_critical(_is_critical), voters(std::move(_voters)), remaining_weight(_remaining_weight), validator_set_id(std::move(_validator_set_id)), rounds_remaining(_rounds_remaining), wins(_wins), losses(_losses) {}
+};
+
+extern const ConfigProposalStatus t_ConfigProposalStatus;
+
//
// headers for type `WorkchainFormat`
//
@@ -6640,7 +6813,7 @@ extern const ValidatorSignedTempKey t_ValidatorSignedTempKey;
//
struct ConfigParam final : TLB_Complex {
- enum { cons32, cons33, cons34, cons35, cons36, cons37, config_mc_block_limits, config_block_limits, cons14, cons0, cons1, cons2, cons3, cons4, cons6, cons7, cons9, cons12, cons15, cons16, cons17, cons18, cons31, cons39, cons28, cons8, config_mc_gas_prices, config_gas_prices, cons29, config_mc_fwd_prices, config_fwd_prices };
+ enum { cons32, cons33, cons34, cons35, cons36, cons37, config_mc_block_limits, config_block_limits, cons14, cons0, cons1, cons2, cons3, cons4, cons6, cons7, cons9, cons10, cons12, cons15, cons16, cons17, cons18, cons31, cons39, cons11, cons28, cons8, config_mc_gas_prices, config_gas_prices, cons29, config_mc_fwd_prices, config_fwd_prices };
static constexpr int cons_len_exact = 0;
int m_;
ConfigParam(int m) : m_(m) {}
@@ -6699,6 +6872,18 @@ struct ConfigParam final : TLB_Complex {
Record_cons9() = default;
Record_cons9(Ref _mandatory_params) : mandatory_params(std::move(_mandatory_params)) {}
};
+ struct Record_cons10 {
+ typedef ConfigParam type_class;
+ Ref critical_params; // critical_params : Hashmap 32 True
+ Record_cons10() = default;
+ Record_cons10(Ref _critical_params) : critical_params(std::move(_critical_params)) {}
+ };
+ struct Record_cons11 {
+ typedef ConfigParam type_class;
+ Ref x; // ConfigVotingSetup
+ Record_cons11() = default;
+ Record_cons11(Ref _x) : x(std::move(_x)) {}
+ };
struct Record_cons12 {
typedef ConfigParam type_class;
Ref workchains; // workchains : HashmapE 32 WorkchainDescr
@@ -6890,6 +7075,22 @@ struct ConfigParam final : TLB_Complex {
bool pack_cons9(vm::CellBuilder& cb, Ref mandatory_params) const;
bool cell_pack(Ref& cell_ref, const Record_cons9& data) const;
bool cell_pack_cons9(Ref& cell_ref, Ref mandatory_params) const;
+ bool unpack(vm::CellSlice& cs, Record_cons10& data) const;
+ bool unpack_cons10(vm::CellSlice& cs, Ref& critical_params) const;
+ bool cell_unpack(Ref cell_ref, Record_cons10& data) const;
+ bool cell_unpack_cons10(Ref cell_ref, Ref& critical_params) const;
+ bool pack(vm::CellBuilder& cb, const Record_cons10& data) const;
+ bool pack_cons10(vm::CellBuilder& cb, Ref critical_params) const;
+ bool cell_pack(Ref& cell_ref, const Record_cons10& data) const;
+ bool cell_pack_cons10(Ref& cell_ref, Ref critical_params) const;
+ bool unpack(vm::CellSlice& cs, Record_cons11& data) const;
+ bool unpack_cons11(vm::CellSlice& cs, Ref& x) const;
+ bool cell_unpack(Ref cell_ref, Record_cons11& data) const;
+ bool cell_unpack_cons11(Ref cell_ref, Ref& x) const;
+ bool pack(vm::CellBuilder& cb, const Record_cons11& data) const;
+ bool pack_cons11(vm::CellBuilder& cb, Ref x) const;
+ bool cell_pack(Ref& cell_ref, const Record_cons11& data) const;
+ bool cell_pack_cons11(Ref& cell_ref, Ref x) const;
bool unpack(vm::CellSlice& cs, Record_cons12& data) const;
bool unpack_cons12(vm::CellSlice& cs, Ref& workchains) const;
bool cell_unpack(Ref cell_ref, Record_cons12& data) const;
@@ -8689,9 +8890,9 @@ extern const RefT t_Ref_McBlockExtra;
// Maybe ^McBlockExtra
extern const Maybe t_Maybe_Ref_McBlockExtra;
// ^[$_ from_prev_blk:CurrencyCollection to_next_blk:CurrencyCollection imported:CurrencyCollection exported:CurrencyCollection ]
-extern const RefT t_Ref_TYPE_1648;
-// ^[$_ fees_imported:CurrencyCollection recovered:CurrencyCollection created:CurrencyCollection minted:CurrencyCollection ]
extern const RefT t_Ref_TYPE_1649;
+// ^[$_ fees_imported:CurrencyCollection recovered:CurrencyCollection created:CurrencyCollection minted:CurrencyCollection ]
+extern const RefT t_Ref_TYPE_1650;
// ## 3
extern const NatWidth t_natwidth_3;
// BinTree ShardDescr
@@ -8717,7 +8918,7 @@ extern const NatWidth t_natwidth_16;
// Maybe ExtBlkRef
extern const Maybe t_Maybe_ExtBlkRef;
// ^[$_ flags:(## 16) {<= flags 1} validator_info:ValidatorInfo prev_blocks:OldMcBlocksInfo after_key_block:Bool last_key_block:(Maybe ExtBlkRef) block_create_stats:flags.0?BlockCreateStats ]
-extern const RefT t_Ref_TYPE_1666;
+extern const RefT t_Ref_TYPE_1667;
// ^SignedCertificate
extern const RefT t_Ref_SignedCertificate;
// HashmapE 16 CryptoSignaturePair
@@ -8725,13 +8926,27 @@ extern const HashmapE t_HashmapE_16_CryptoSignaturePair;
// Maybe ^InMsg
extern const Maybe t_Maybe_Ref_InMsg;
// ^[$_ prev_blk_signatures:(HashmapE 16 CryptoSignaturePair) recover_create_msg:(Maybe ^InMsg) mint_msg:(Maybe ^InMsg) ]
-extern const RefT t_Ref_TYPE_1674;
+extern const RefT t_Ref_TYPE_1675;
// Hashmap 16 ValidatorDescr
extern const Hashmap t_Hashmap_16_ValidatorDescr;
// HashmapE 16 ValidatorDescr
extern const HashmapE t_HashmapE_16_ValidatorDescr;
// Hashmap 32 True
extern const Hashmap t_Hashmap_32_True;
+// uint8
+extern const UInt t_uint8;
+// ^ConfigProposalSetup
+extern const RefT t_Ref_ConfigProposalSetup;
+// uint256
+extern const UInt t_uint256;
+// Maybe uint256
+extern const Maybe t_Maybe_uint256;
+// ^ConfigProposal
+extern const RefT t_Ref_ConfigProposal;
+// HashmapE 16 True
+extern const HashmapE t_HashmapE_16_True;
+// int64
+extern const Int t_int64;
// ## 12
extern const NatWidth t_natwidth_12;
// ## 32
@@ -8756,8 +8971,6 @@ extern const Maybe t_Maybe_Ref_BlockSignatures;
extern const RefT t_Ref_TopBlockDescr;
// HashmapE 96 ^TopBlockDescr
extern const HashmapE t_HashmapE_96_Ref_TopBlockDescr;
-// int64
-extern const Int t_int64;
// int257
extern const Int t_int257;
// ## 10
@@ -8771,7 +8984,7 @@ extern const NatWidth t_natwidth_24;
// HashmapE 4 VmStackValue
extern const HashmapE t_HashmapE_4_VmStackValue;
// ^[$_ max_limit:int64 cur_limit:int64 credit:int64 ]
-extern const RefT t_Ref_TYPE_1705;
+extern const RefT t_Ref_TYPE_1709;
// HashmapE 256 ^Cell
extern const HashmapE t_HashmapE_256_Ref_Cell;
// uint13
diff --git a/submodules/ton/tonlib-src/crypto/block/block-parse.cpp b/submodules/ton/tonlib-src/crypto/block/block-parse.cpp
index a032236608..22ac1b18cb 100644
--- a/submodules/ton/tonlib-src/crypto/block/block-parse.cpp
+++ b/submodules/ton/tonlib-src/crypto/block/block-parse.cpp
@@ -344,11 +344,11 @@ unsigned long long VarUIntegerPos::as_uint(const vm::CellSlice& cs) const {
bool VarUIntegerPos::store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const {
int k = value.bit_size(false);
- return k <= (n - 1) * 8 && value.sgn() > 0 && cb.store_long_bool((k + 7) >> 3, ln) &&
+ return k <= (n - 1) * 8 && value.sgn() >= (int)store_pos_only && cb.store_long_bool((k + 7) >> 3, ln) &&
cb.store_int256_bool(value, (k + 7) & -8, false);
}
-const VarUIntegerPos t_VarUIntegerPos_16{16}, t_VarUIntegerPos_32{32};
+const VarUIntegerPos t_VarUIntegerPos_16{16}, t_VarUIntegerPos_32{32}, t_VarUIntegerPosRelaxed_32{32, true};
static inline bool redundant_int(const vm::CellSlice& cs) {
int t = (int)cs.prefetch_long(9);
@@ -500,8 +500,8 @@ bool HashmapE::add_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice
int n = root_type.n;
vm::Dictionary dict1{vm::DictAdvance(), cs1, n}, dict2{vm::DictAdvance(), cs2, n};
const TLB& vt = root_type.value_type;
- vm::Dictionary::simple_combine_func_t combine = [vt](vm::CellBuilder& cb, Ref cs1_ref,
- Ref cs2_ref) -> bool {
+ vm::Dictionary::simple_combine_func_t combine = [&vt](vm::CellBuilder& cb, Ref cs1_ref,
+ Ref cs2_ref) -> bool {
if (!vt.add_values(cb, cs1_ref.write(), cs2_ref.write())) {
throw CombineError{};
}
@@ -514,8 +514,8 @@ bool HashmapE::add_values_ref(Ref& res, Ref arg1, Ref cs1_ref,
- Ref cs2_ref) -> bool {
+ vm::Dictionary::simple_combine_func_t combine = [&vt](vm::CellBuilder& cb, Ref cs1_ref,
+ Ref cs2_ref) -> bool {
if (!vt.add_values(cb, cs1_ref.write(), cs2_ref.write())) {
throw CombineError{};
}
@@ -535,8 +535,8 @@ int HashmapE::sub_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice&
int n = root_type.n;
vm::Dictionary dict1{vm::DictAdvance(), cs1, n}, dict2{vm::DictAdvance(), cs2, n};
const TLB& vt = root_type.value_type;
- vm::Dictionary::simple_combine_func_t combine = [vt](vm::CellBuilder& cb, Ref cs1_ref,
- Ref cs2_ref) -> bool {
+ vm::Dictionary::simple_combine_func_t combine = [&vt](vm::CellBuilder& cb, Ref cs1_ref,
+ Ref cs2_ref) -> bool {
int r = vt.sub_values(cb, cs1_ref.write(), cs2_ref.write());
if (r < 0) {
throw CombineError{};
@@ -555,8 +555,8 @@ int HashmapE::sub_values_ref(Ref& res, Ref arg1, Ref cs1_ref,
- Ref cs2_ref) -> bool {
+ vm::Dictionary::simple_combine_func_t combine = [&vt](vm::CellBuilder& cb, Ref cs1_ref,
+ Ref cs2_ref) -> bool {
int r = vt.sub_values(cb, cs1_ref.write(), cs2_ref.write());
if (r < 0) {
throw CombineError{};
diff --git a/submodules/ton/tonlib-src/crypto/block/block-parse.h b/submodules/ton/tonlib-src/crypto/block/block-parse.h
index 9590631132..e1578df0c0 100644
--- a/submodules/ton/tonlib-src/crypto/block/block-parse.h
+++ b/submodules/ton/tonlib-src/crypto/block/block-parse.h
@@ -68,13 +68,17 @@ struct VarUInteger final : TLB_Complex {
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
unsigned precompute_integer_size(const td::BigInt256& value) const;
unsigned precompute_integer_size(td::RefInt256 value) const;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "(VarUInteger " << n << ")";
+ }
};
extern const VarUInteger t_VarUInteger_3, t_VarUInteger_7, t_VarUInteger_16, t_VarUInteger_32;
struct VarUIntegerPos final : TLB_Complex {
int n, ln;
- VarUIntegerPos(int _n) : n(_n) {
+ bool store_pos_only;
+ VarUIntegerPos(int _n, bool relaxed = false) : n(_n), store_pos_only(!relaxed) {
ln = 32 - td::count_leading_zeroes32(n - 1);
}
bool skip(vm::CellSlice& cs) const override;
@@ -82,9 +86,12 @@ struct VarUIntegerPos final : TLB_Complex {
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
unsigned long long as_uint(const vm::CellSlice& cs) const override;
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "(VarUIntegerPos " << n << ")";
+ }
};
-extern const VarUIntegerPos t_VarUIntegerPos_16, t_VarUIntegerPos_32;
+extern const VarUIntegerPos t_VarUIntegerPos_16, t_VarUIntegerPos_32, t_VarUIntegerPosRelaxed_32;
struct VarInteger final : TLB_Complex {
int n, ln;
@@ -99,6 +106,9 @@ struct VarInteger final : TLB_Complex {
return cb.store_zeroes_bool(ln);
}
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "(VarInteger " << n << ")";
+ }
};
struct VarIntegerNz final : TLB_Complex {
@@ -111,6 +121,9 @@ struct VarIntegerNz final : TLB_Complex {
td::RefInt256 as_integer_skip(vm::CellSlice& cs) const override;
long long as_int(const vm::CellSlice& cs) const override;
bool store_integer_value(vm::CellBuilder& cb, const td::BigInt256& value) const override;
+ std::ostream& print_type(std::ostream& os) const override {
+ return os << "(VarIntegerNz " << n << ")";
+ }
};
struct Unary final : TLB {
@@ -312,8 +325,8 @@ struct MsgAddress final : TLB_Complex {
extern const MsgAddress t_MsgAddress;
struct ExtraCurrencyCollection final : TLB {
- HashmapE dict_type;
- ExtraCurrencyCollection() : dict_type(32, t_VarUIntegerPos_32) {
+ HashmapE dict_type, dict_type2;
+ ExtraCurrencyCollection() : dict_type(32, t_VarUIntegerPos_32), dict_type2(32, t_VarUIntegerPosRelaxed_32) {
}
int get_size(const vm::CellSlice& cs) const override {
return dict_type.get_size(cs);
@@ -328,13 +341,13 @@ struct ExtraCurrencyCollection final : TLB {
return dict_type.add_values(cb, cs1, cs2);
}
int sub_values(vm::CellBuilder& cb, vm::CellSlice& cs1, vm::CellSlice& cs2) const override {
- return dict_type.sub_values(cb, cs1, cs2);
+ return dict_type2.sub_values(cb, cs1, cs2);
}
bool add_values_ref(Ref& res, Ref arg1, Ref arg2) const {
return dict_type.add_values_ref(res, std::move(arg1), std::move(arg2));
}
int sub_values_ref(Ref& res, Ref arg1, Ref arg2) const {
- return dict_type.sub_values_ref(res, std::move(arg1), std::move(arg2));
+ return dict_type2.sub_values_ref(res, std::move(arg1), std::move(arg2));
}
bool store_ref(vm::CellBuilder& cb, Ref arg) const {
return dict_type.store_ref(cb, std::move(arg));
diff --git a/submodules/ton/tonlib-src/crypto/block/block.cpp b/submodules/ton/tonlib-src/crypto/block/block.cpp
index d9d3c26726..b160de6fbc 100644
--- a/submodules/ton/tonlib-src/crypto/block/block.cpp
+++ b/submodules/ton/tonlib-src/crypto/block/block.cpp
@@ -20,6 +20,7 @@
#include "block/block.h"
#include "block/block-auto.h"
#include "block/block-parse.h"
+#include "block/mc-config.h"
#include "ton/ton-shard.h"
#include "common/bigexp.h"
#include "common/util.h"
@@ -1602,33 +1603,50 @@ bool check_one_config_param(Ref cs_ref, td::ConstBitPtr key, td::
const int mandatory_config_params[] = {18, 20, 21, 22, 23, 24, 25, 28, 34};
-bool valid_config_data(Ref cell, const td::BitArray<256>& addr, bool catch_errors, bool relax_par0) {
+bool valid_config_data(Ref cell, const td::BitArray<256>& addr, bool catch_errors, bool relax_par0,
+ Ref old_mparams) {
using namespace std::placeholders;
if (cell.is_null()) {
return false;
}
- if (!catch_errors) {
- vm::Dictionary dict{std::move(cell), 32};
- for (int x : mandatory_config_params) {
- if (!dict.int_key_exists(x)) {
- LOG(ERROR) << "mandatory configuration parameter #" << x << " is missing";
- return false;
- }
+ if (catch_errors) {
+ try {
+ return valid_config_data(std::move(cell), addr, false, relax_par0, std::move(old_mparams));
+ } catch (vm::VmError&) {
+ return false;
}
- return dict.check_for_each(std::bind(check_one_config_param, _1, _2, addr.cbits(), relax_par0));
}
- try {
- vm::Dictionary dict{std::move(cell), 32};
- for (int x : mandatory_config_params) {
- if (!dict.int_key_exists(x)) {
- LOG(ERROR) << "mandatory configuration parameter #" << x << " is missing";
- return false;
- }
- }
- return dict.check_for_each(std::bind(check_one_config_param, _1, _2, addr.cbits(), relax_par0));
- } catch (vm::VmError&) {
+ vm::Dictionary dict{std::move(cell), 32};
+ if (!dict.check_for_each(std::bind(check_one_config_param, _1, _2, addr.cbits(), relax_par0))) {
return false;
}
+ for (int x : mandatory_config_params) {
+ if (!dict.int_key_exists(x)) {
+ LOG(ERROR) << "mandatory configuration parameter #" << x << " is missing";
+ return false;
+ }
+ }
+ return config_params_present(dict, dict.lookup_ref(td::BitArray<32>{9})) &&
+ config_params_present(dict, std::move(old_mparams));
+}
+
+bool config_params_present(vm::Dictionary& dict, Ref param_dict_root) {
+ auto res = block::Config::unpack_param_dict(std::move(param_dict_root));
+ if (res.is_error()) {
+ LOG(ERROR)
+ << "invalid mandatory parameters dictionary while checking existence of all mandatory configuration parameters";
+ return false;
+ }
+ for (int x : res.move_as_ok()) {
+ // LOG(DEBUG) << "checking whether mandatory configuration parameter #" << x << " exists";
+ if (!dict.int_key_exists(x)) {
+ LOG(ERROR) << "configuration parameter #" << x
+ << " (declared as mandatory in configuration parameter #9) is missing";
+ return false;
+ }
+ }
+ // LOG(DEBUG) << "all mandatory configuration parameters present";
+ return true;
}
bool add_extra_currency(Ref extra1, Ref extra2, Ref& res) {
@@ -1651,7 +1669,7 @@ bool sub_extra_currency(Ref extra1, Ref extra2, Ref= 0;
}
}
diff --git a/submodules/ton/tonlib-src/crypto/block/block.h b/submodules/ton/tonlib-src/crypto/block/block.h
index 0d961320bd..8b93caf761 100644
--- a/submodules/ton/tonlib-src/crypto/block/block.h
+++ b/submodules/ton/tonlib-src/crypto/block/block.h
@@ -606,7 +606,8 @@ bool unpack_CurrencyCollection(Ref csr, td::RefInt256& value, Ref
bool valid_library_collection(Ref cell, bool catch_errors = true);
bool valid_config_data(Ref cell, const td::BitArray<256>& addr, bool catch_errors = true,
- bool relax_par0 = false);
+ bool relax_par0 = false, Ref old_mparams = {});
+bool config_params_present(vm::Dictionary& dict, Ref param_dict_root);
bool add_extra_currency(Ref extra1, Ref extra2, Ref& res);
bool sub_extra_currency(Ref extra1, Ref extra2, Ref& res);
diff --git a/submodules/ton/tonlib-src/crypto/block/block.tlb b/submodules/ton/tonlib-src/crypto/block/block.tlb
index a30cd89a87..e9af709bec 100644
--- a/submodules/ton/tonlib-src/crypto/block/block.tlb
+++ b/submodules/ton/tonlib-src/crypto/block/block.tlb
@@ -414,7 +414,7 @@ block_info#9bc7a987 version:uint32
after_split:(## 1)
want_split:Bool want_merge:Bool
key_block:Bool vert_seqno_incr:(## 1)
- flags:(## 8)
+ flags:(## 8) { flags <= 1 }
seq_no:# vert_seq_no:# { vert_seq_no >= vert_seqno_incr }
{ prev_seq_no:# } { ~prev_seq_no + 1 = seq_no }
shard:ShardIdent gen_utime:uint32
@@ -423,6 +423,7 @@ block_info#9bc7a987 version:uint32
gen_catchain_seqno:uint32
min_ref_mc_seqno:uint32
prev_key_block_seqno:uint32
+ gen_software:flags . 0?GlobalVersion
master_ref:not_master?^BlkMasterInfo
prev_ref:^(BlkPrevInfo after_merge)
prev_vert_ref:vert_seqno_incr?^(BlkPrevInfo 0)
@@ -572,6 +573,17 @@ _ to_mint:ExtraCurrencyCollection = ConfigParam 7;
capabilities#c4 version:uint32 capabilities:uint64 = GlobalVersion;
_ GlobalVersion = ConfigParam 8; // all zero if absent
_ mandatory_params:(Hashmap 32 True) = ConfigParam 9;
+_ critical_params:(Hashmap 32 True) = ConfigParam 10;
+
+cfg_vote_cfg#36 min_tot_rounds:uint8 max_tot_rounds:uint8 min_wins:uint8 max_losses:uint8 min_store_sec:uint32 max_store_sec:uint32 bit_price:uint32 cell_price:uint32 = ConfigProposalSetup;
+cfg_vote_setup#91 normal_params:^ConfigProposalSetup critical_params:^ConfigProposalSetup = ConfigVotingSetup;
+_ ConfigVotingSetup = ConfigParam 11;
+
+cfg_proposal#f3 param_id:int32 param_value:(Maybe ^Cell) if_hash_equal:(Maybe uint256)
+ = ConfigProposal;
+cfg_proposal_status#ce expires:uint32 proposal:^ConfigProposal is_critical:Bool
+ voters:(HashmapE 16 True) remaining_weight:int64 validator_set_id:uint256
+ rounds_remaining:uint8 wins:uint8 losses:uint8 = ConfigProposalStatus;
wfmt_basic#1 vm_version:int32 vm_mode:uint64 = WorkchainFormat 1;
wfmt_ext#0 min_addr_len:(## 12) max_addr_len:(## 12) addr_len_step:(## 12)
diff --git a/submodules/ton/tonlib-src/crypto/block/create-state.cpp b/submodules/ton/tonlib-src/crypto/block/create-state.cpp
index 5eb14528c9..e850603f34 100644
--- a/submodules/ton/tonlib-src/crypto/block/create-state.cpp
+++ b/submodules/ton/tonlib-src/crypto/block/create-state.cpp
@@ -55,6 +55,8 @@
#include "td/utils/port/path.h"
#include "td/utils/port/signals.h"
+#include "tonlib/keys/Mnemonic.h"
+
#include "block.h"
#include "block-parse.h"
#include "block-auto.h"
@@ -616,7 +618,43 @@ void interpret_is_workchain_descr(vm::Stack& stack) {
stack.push_bool(block::gen::t_WorkchainDescr.validate_ref(std::move(cell)));
}
+void interpret_add_extra_currencies(vm::Stack& stack) {
+ Ref y = stack.pop_maybe_cell(), x = stack.pop_maybe_cell(), res;
+ bool ok = block::add_extra_currency(std::move(x), std::move(y), res);
+ if (ok) {
+ stack.push_maybe_cell(std::move(res));
+ }
+ stack.push_bool(ok);
+}
+
+void interpret_sub_extra_currencies(vm::Stack& stack) {
+ Ref y = stack.pop_maybe_cell(), x = stack.pop_maybe_cell(), res;
+ bool ok = block::sub_extra_currency(std::move(x), std::move(y), res);
+ if (ok) {
+ stack.push_maybe_cell(std::move(res));
+ }
+ stack.push_bool(ok);
+}
+
+void interpret_mnemonic_to_privkey(vm::Stack& stack, int mode) {
+ td::SecureString str{td::Slice{stack.pop_string()}};
+ auto res = tonlib::Mnemonic::create(std::move(str), td::SecureString());
+ if (res.is_error()) {
+ throw fift::IntError{res.move_as_error().to_string()};
+ }
+ auto privkey = res.move_as_ok().to_private_key();
+ td::SecureString key;
+ if (mode & 1) {
+ auto pub = privkey.get_public_key();
+ key = pub.move_as_ok().as_octet_string();
+ } else {
+ key = privkey.as_octet_string();
+ }
+ stack.push_bytes(key.as_slice());
+}
+
void init_words_custom(fift::Dictionary& d) {
+ using namespace std::placeholders;
d.def_stack_word("verb@ ", interpret_get_verbosity);
d.def_stack_word("verb! ", interpret_set_verbosity);
d.def_stack_word("wcid@ ", interpret_get_workchain);
@@ -631,6 +669,10 @@ void init_words_custom(fift::Dictionary& d) {
d.def_stack_word("create_state ", interpret_create_state);
d.def_stack_word("isShardState? ", interpret_is_shard_state);
d.def_stack_word("isWorkchainDescr? ", interpret_is_workchain_descr);
+ d.def_stack_word("CC+? ", interpret_add_extra_currencies);
+ d.def_stack_word("CC-? ", interpret_sub_extra_currencies);
+ d.def_stack_word("mnemo>priv ", std::bind(interpret_mnemonic_to_privkey, _1, 0));
+ d.def_stack_word("mnemo>pub ", std::bind(interpret_mnemonic_to_privkey, _1, 1));
}
tlb::TypenameLookup tlb_dict;
@@ -704,7 +746,12 @@ void interpret_tlb_validate_skip(vm::Stack& stack) {
stack.push_bool(ok);
}
+void interpret_tlb_type_const(vm::Stack& stack, const tlb::TLB* ptr) {
+ stack.push_make_object(ptr);
+}
+
void init_words_tlb(fift::Dictionary& d) {
+ using namespace std::placeholders;
tlb_dict.register_types(block::gen::register_simple_types);
d.def_stack_word("tlb-type-lookup ", interpret_tlb_type_lookup);
d.def_stack_word("tlb-type-name ", interpret_tlb_type_name);
@@ -713,6 +760,8 @@ void init_words_tlb(fift::Dictionary& d) {
d.def_stack_word("(tlb-dump-str?) ", interpret_tlb_dump_to_str);
d.def_stack_word("tlb-skip ", interpret_tlb_skip);
d.def_stack_word("tlb-validate-skip ", interpret_tlb_validate_skip);
+ d.def_stack_word("ExtraCurrencyCollection",
+ std::bind(interpret_tlb_type_const, _1, &block::tlb::t_ExtraCurrencyCollection));
}
void usage(const char* progname) {
diff --git a/submodules/ton/tonlib-src/crypto/block/mc-config.cpp b/submodules/ton/tonlib-src/crypto/block/mc-config.cpp
index 555b26033e..d2774797c0 100644
--- a/submodules/ton/tonlib-src/crypto/block/mc-config.cpp
+++ b/submodules/ton/tonlib-src/crypto/block/mc-config.cpp
@@ -40,6 +40,7 @@
#include
namespace block {
+using namespace std::literals::string_literals;
using td::Ref;
Config::Config(Ref config_root, const td::Bits256& config_addr, int _mode)
@@ -335,6 +336,59 @@ std::unique_ptr ShardConfig::extract_shard_hashes_dict(Ref> Config::unpack_param_dict(vm::Dictionary& dict) {
+ try {
+ std::vector vect;
+ if (dict.check_for_each(
+ [&vect](Ref value, td::ConstBitPtr key, int key_len) {
+ bool ok = (key_len == 32 && value->empty_ext());
+ if (ok) {
+ vect.push_back((int)key.get_int(32));
+ }
+ return ok;
+ },
+ true)) {
+ return std::move(vect);
+ } else {
+ return td::Status::Error("invalid parameter list dictionary");
+ }
+ } catch (vm::VmError& vme) {
+ return td::Status::Error("error unpacking parameter list dictionary: "s + vme.get_msg());
+ }
+}
+
+td::Result> Config::unpack_param_dict(Ref dict_root) {
+ vm::Dictionary dict{std::move(dict_root), 32};
+ return unpack_param_dict(dict);
+}
+
+std::unique_ptr Config::get_param_dict(int idx) const {
+ return std::make_unique(get_config_param(idx), 32);
+}
+
+td::Result> Config::unpack_param_list(int idx) const {
+ return unpack_param_dict(*get_param_dict(idx));
+}
+
+bool Config::all_mandatory_params_defined(int* bad_idx_ptr) const {
+ auto res = get_mandatory_param_list();
+ if (res.is_error()) {
+ if (bad_idx_ptr) {
+ *bad_idx_ptr = -1;
+ }
+ return false;
+ }
+ for (int x : res.move_as_ok()) {
+ if (get_config_param(x).is_null()) {
+ if (bad_idx_ptr) {
+ *bad_idx_ptr = x;
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
std::unique_ptr ConfigInfo::create_accounts_dict() const {
if (mode & needAccountsRoot) {
return std::make_unique(accounts_root, 256, block::tlb::aug_ShardAccounts);
diff --git a/submodules/ton/tonlib-src/crypto/block/mc-config.h b/submodules/ton/tonlib-src/crypto/block/mc-config.h
index 8541110ffe..467b7c8a39 100644
--- a/submodules/ton/tonlib-src/crypto/block/mc-config.h
+++ b/submodules/ton/tonlib-src/crypto/block/mc-config.h
@@ -534,6 +534,21 @@ class Config {
bool create_stats_enabled() const {
return has_capability(ton::capCreateStatsEnabled);
}
+ std::unique_ptr get_param_dict(int idx) const;
+ td::Result> unpack_param_list(int idx) const;
+ std::unique_ptr get_mandatory_param_dict() const {
+ return get_param_dict(9);
+ }
+ std::unique_ptr get_critical_param_dict() const {
+ return get_param_dict(10);
+ }
+ td::Result | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |