Skip to content

Commit 82ba58c

Browse files
authored
hash modifier (#27)
* add hash modifier argument to WalletContract for Tetra L2 * update action * update action * fix demo * fix action * fix action * fix tests
1 parent 1d528ce commit 82ba58c

File tree

7 files changed

+37
-18
lines changed

7 files changed

+37
-18
lines changed

.github/workflows/swift.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: macos-latest
1010
steps:
1111
- uses: actions/checkout@v2
12-
- uses: actions/cache@v2
12+
- uses: actions/cache@v4
1313
with:
1414
path: Pods
1515
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
@@ -18,6 +18,6 @@ jobs:
1818
- name: CocoaPod Install
1919
run: cd Example; pod install
2020
- name: Build
21-
run: cd Example; xcodebuild -workspace ton-swift-example.xcworkspace -scheme ton-swift-example -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14'
21+
run: cd Example; xcodebuild -workspace ton-swift-example.xcworkspace -scheme ton-swift-example -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 17'
2222
- name: Test
23-
run: cd Example; xcodebuild -workspace ton-swift-example.xcworkspace -scheme TonSwift-Unit-Tests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' test
23+
run: cd Example; xcodebuild -workspace ton-swift-example.xcworkspace -scheme TonSwift-Unit-Tests -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 17' test

Example/Podfile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ end
1212
post_install do |installer|
1313
installer.pods_project.targets.each do |target|
1414
target.build_configurations.each do |config|
15-
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "11.0"
15+
config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "15.0"
16+
17+
# Fix for CTweetNacl module error with Pusher on Xcode 26.0
18+
# Disable explicit module builds for Pusher and TweetNacl pods
19+
if ['PusherSwift', 'PusherSwiftWithEncryption', 'TweetNacl'].include?(target.name)
20+
config.build_settings['SWIFT_ENABLE_EXPLICIT_MODULES'] = 'NO'
21+
# Additional settings to resolve module dependencies
22+
config.build_settings['SWIFT_ENABLE_INCREMENTAL_COMPILATION'] = 'NO'
23+
config.build_settings['SWIFT_COMPILATION_MODE'] = 'wholemodule'
24+
end
1625
end
1726
end
27+
# Additional project-level settings for all targets
28+
installer.pods_project.build_configurations.each do |config|
29+
config.build_settings['SWIFT_ENABLE_EXPLICIT_MODULES'] = 'NO'
30+
end
1831
end

Example/Podfile.lock

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
PODS:
22
- BigInt (5.2.0)
3-
- TonSwift (1.0.3):
3+
- Sodium (0.9.1)
4+
- TonSwift (1.0.18):
45
- BigInt
6+
- Sodium
57
- TweetNacl
6-
- TonSwift/Tests (1.0.3):
8+
- TonSwift/Tests (1.0.18):
79
- BigInt
10+
- Sodium
811
- TweetNacl
912
- TweetNacl (1.0.2)
1013

@@ -15,6 +18,7 @@ DEPENDENCIES:
1518
SPEC REPOS:
1619
trunk:
1720
- BigInt
21+
- Sodium
1822
- TweetNacl
1923

2024
EXTERNAL SOURCES:
@@ -23,9 +27,10 @@ EXTERNAL SOURCES:
2327

2428
SPEC CHECKSUMS:
2529
BigInt: f668a80089607f521586bbe29513d708491ef2f7
26-
TonSwift: 8263886e6a34c81a721cde1674cc70229a1d0d44
30+
Sodium: 23d11554ecd556196d313cf6130d406dfe7ac6da
31+
TonSwift: 772c4cf09140c087ce6a82253ad0b9ab0f7444ed
2732
TweetNacl: 3abf4d1d2082b0114e7a67410e300892448951e6
2833

29-
PODFILE CHECKSUM: adb693e82e588cc090eb72c366a3aff89a95e709
34+
PODFILE CHECKSUM: 2346665ec6fa725b886bf775946ddbfd1a195f90
3035

31-
COCOAPODS: 1.15.2
36+
COCOAPODS: 1.16.2

Source/TonSwift/NFT/NFTTransferData.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ public struct NFTTransferData: CellCodable {
3232
let responseAddress: Address = try slice.loadType()
3333
try slice.skip(1)
3434
let forwardAmount = try slice.loadCoins().amount
35-
let hasPayloadCell = try slice.loadBoolean()
36-
var forwardPayload: Cell?
37-
if hasPayloadCell, let payloadCell = try slice.loadMaybeRef() {
38-
forwardPayload = payloadCell
39-
}
35+
let forwardPayload = try slice.loadMaybeRef()
4036
return NFTTransferData(
4137
queryId: queryId,
4238
newOwnerAddress: newOwnerAddress,

Source/TonSwift/Wallets/WalletContract.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ public struct WalletTransfer {
5050
self.signaturePosition = signaturePosition
5151
}
5252

53-
public func signMessage(signer: WalletTransferSigner) throws -> Data {
54-
return try signer.signMessage(signingMessage.endCell().hash())
53+
public func signMessage(signer: WalletTransferSigner, hashModifier: ((Data) -> Data)? = nil) throws -> Data {
54+
var hash = try signingMessage.endCell().hash()
55+
if let hashModifier {
56+
hash = hashModifier(hash)
57+
}
58+
return try signer.signMessage(hash)
5559
}
5660
}

Tests/TonSwiftTests/NFT/NFTTransferDataTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class NFTTransferDataTests: XCTestCase {
5454

5555
XCTAssertEqual(try nftTransferDataCell.toString(),
5656
"""
57-
x{5FCC3D14000000000000021F8006E2451A5FF8C5BEA1DC8505A789427312E714E1783A8DEBF2573D06BADDAD571001AAD4BD6DAA342C7D03C496083C01AEC31F1A457B8C993C62823E3713E11FD8186989681C_}
57+
x{5FCC3D14000000000000021F8006E2451A5FF8C5BEA1DC8505A789427312E714E1783A8DEBF2573D06BADDAD571001AAD4BD6DAA342C7D03C496083C01AEC31F1A457B8C993C62823E3713E11FD8186989681}
5858
x{0000000048656C6C6F2C2074686973206973206120636F6D6D656E74}
5959
""")
6060
}

TonSwift.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'TonSwift'
3-
s.version = '1.0.3'
3+
s.version = '1.0.18'
44
s.homepage = 'https://github.com/tonkeeper/ton-swift'
55
s.source = { :git => 'https://github.com/tonkeeper/ton-swift.git', :tag => s.version.to_s }
66
s.license = { :type => 'MIT', :file => 'LICENSE' }
@@ -15,6 +15,7 @@ Pod::Spec.new do |s|
1515

1616
s.dependency 'BigInt'
1717
s.dependency 'TweetNacl'
18+
s.dependency 'Sodium'
1819

1920
s.test_spec 'Tests' do |test_spec|
2021
test_spec.source_files = ["Tests/*.{swift,h}", "Tests/**/*.{swift,c,h}", "Tests/**/**/*.{swift,c,h}"]

0 commit comments

Comments
 (0)