Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHANGE] Restructure Swift Package #376

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ jobs:

runs-on: ubuntu-latest

container:
image: swift:5.9-jammy
container: swift:5.10

env:
TESTS_PRIVATEKEY: ${{ secrets.TESTS_PRIVATEKEY }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ fastlane/screenshots
fastlane/test_output

scripts/bin/*
TestConfig_private.swift
TestConfigPrivate.swift
195 changes: 128 additions & 67 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,70 +1,131 @@
{
"object": {
"pins": [
{
"package": "BigInt",
"repositoryURL": "https://github.com/attaswift/BigInt",
"state": {
"branch": null,
"revision": "0ed110f7555c34ff468e72e1686e59721f2b0da6",
"version": "5.3.0"
}
},
{
"package": "GenericJSON",
"repositoryURL": "https://github.com/iwill/generic-json-swift",
"state": {
"branch": null,
"revision": "0a06575f4038b504e78ac330913d920f1630f510",
"version": "2.0.2"
}
},
{
"package": "secp256k1",
"repositoryURL": "https://github.com/GigaBitcoin/secp256k1.swift.git",
"state": {
"branch": null,
"revision": "1a14e189def5eaa92f839afdd2faad8e43b61a6e",
"version": "0.12.2"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version": "1.4.2"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "124119f0bb12384cef35aa041d7c3a686108722d",
"version": "2.40.0"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "1750873bce84b4129b5303655cce2c3d35b9ed3a",
"version": "2.19.0"
}
},
{
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "e32033ad3c68ebec1b761bc961be7bd56bad02f8",
"version": "2.3.1"
}
"pins" : [
{
"identity" : "bigint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/attaswift/BigInt",
"state" : {
"revision" : "0ed110f7555c34ff468e72e1686e59721f2b0da6",
"version" : "5.3.0"
}
]
},
"version": 1
},
{
"identity" : "generic-json-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/iwill/generic-json-swift",
"state" : {
"revision" : "0a06575f4038b504e78ac330913d920f1630f510",
"version" : "2.0.2"
}
},
{
"identity" : "secp256k1.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/GigaBitcoin/secp256k1.swift.git",
"state" : {
"revision" : "9683e8e311c76d8114cd308b697dad2f9fc58fed",
"version" : "0.17.0"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "3d2dc41a01f9e49d84f0a3925fb858bed64f702d",
"version" : "1.1.2"
}
},
{
"identity" : "swift-http-types",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "ae67c8178eb46944fd85e4dc6dd970e1f3ed6ccd",
"version" : "1.3.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
"identity" : "swift-nio",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio.git",
"state" : {
"revision" : "4c4453b489cf76e6b3b0f300aba663eb78182fad",
"version" : "2.70.0"
}
},
{
"identity" : "swift-nio-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-extras.git",
"state" : {
"revision" : "d1ead62745cc3269e482f1c51f27608057174379",
"version" : "1.24.0"
}
},
{
"identity" : "swift-nio-http2",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-http2.git",
"state" : {
"revision" : "b5f7062b60e4add1e8c343ba4eb8da2e324b3a94",
"version" : "1.34.0"
}
},
{
"identity" : "swift-nio-ssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-ssl.git",
"state" : {
"revision" : "a9fa5efd86e7ce2e5c1b6de113262e58035ca251",
"version" : "2.27.1"
}
},
{
"identity" : "swift-nio-transport-services",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-nio-transport-services.git",
"state" : {
"revision" : "38ac8221dd20674682148d6451367f89c2652980",
"version" : "1.21.0"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system.git",
"state" : {
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
"version" : "1.3.2"
}
},
{
"identity" : "websocket-kit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/vapor/websocket-kit.git",
"state" : {
"revision" : "4232d34efa49f633ba61afde365d3896fc7f8740",
"version" : "2.15.0"
}
}
],
"version" : 2
}
49 changes: 24 additions & 25 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.6
import PackageDescription

let package = Package(
Expand All @@ -13,58 +13,57 @@ let package = Package(
.library(name: "web3-zksync.swift", targets: ["web3-zksync"])
],
dependencies: [
.package(name: "BigInt", url: "https://github.com/attaswift/BigInt", from: "5.3.0"),
.package(name: "GenericJSON", url: "https://github.com/iwill/generic-json-swift", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", .upToNextMajor(from: "0.6.0")),
.package(url: "https://github.com/attaswift/BigInt", exact: "5.3.0"),
.package(url: "https://github.com/iwill/generic-json-swift", from: "2.0.0"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XCTAssertEqual(BigInt(hex: "")!, 0)

when updating to latest BigInt that assert fails

.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", from: "0.6.0"),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0")
],
targets: [
.target(
name: "web3",
dependencies:
[
.target(name: "keccaktiny"),
.target(name: "aes"),
.target(name: "Internal_CryptoSwift_PBDKF2"),
"BigInt",
"GenericJSON",
.product(name: "secp256k1", package: "secp256k1.swift"),
.product(name: "WebSocketKit", package: "websocket-kit"),
.product(name: "Logging", package: "swift-log")
],
path: "web3swift/src",
exclude: ["ZKSync"]
[
.target(name: "keccaktiny"),
.target(name: "aes"),
.target(name: "Internal_CryptoSwift_PBDKF2"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "GenericJSON", package: "generic-json-swift"),
.product(name: "secp256k1", package: "secp256k1.swift"),
.product(name: "WebSocketKit", package: "websocket-kit"),
.product(name: "Logging", package: "swift-log")
],
path: "Sources/Web3Swift"
),
.target(
.target(
name: "web3-zksync",
dependencies:
[
.target(name: "web3")
],
path: "web3swift/src/ZKSync"
[
.target(name: "web3")
],
path: "Sources/Web3ZKSync"
),
.target(
name: "keccaktiny",
dependencies: [],
path: "web3swift/lib/keccak-tiny",
path: "libs/keccak-tiny",
exclude: ["module.map"]
),
.target(
name: "aes",
dependencies: [],
path: "web3swift/lib/aes",
path: "libs/aes",
exclude: ["module.map"]
),
.target(
name: "Internal_CryptoSwift_PBDKF2",
dependencies: [],
path: "web3swift/lib/CryptoSwift"
path: "libs/CryptoSwift"
),
.testTarget(
name: "web3swiftTests",
dependencies: ["web3", "web3-zksync"],
path: "web3sTests",
path: "Tests/Web3SwiftTests",
resources: [
.copy("Resources/rlptests.json"),
.copy("Account/cryptofights_712.json"),
Expand Down
89 changes: 89 additions & 0 deletions Package@swift-5.10.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// swift-tools-version:5.10
import PackageDescription

let package = Package(
name: "web3.swift",
platforms: [
.iOS(SupportedPlatform.IOSVersion.v13),
.macOS(SupportedPlatform.MacOSVersion.v11),
.watchOS(.v7)
],
products: [
.library(name: "web3.swift", targets: ["web3"]),
.library(name: "web3-zksync.swift", targets: ["web3-zksync"])
],
dependencies: [
.package(url: "https://github.com/attaswift/BigInt", exact: "5.3.0"),
.package(url: "https://github.com/iwill/generic-json-swift", from: "2.0.0"),
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", from: "0.6.0"),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0")
],
targets: [
.target(
name: "web3",
dependencies:
[
.target(name: "keccaktiny"),
.target(name: "aes"),
.target(name: "Internal_CryptoSwift_PBDKF2"),
.product(name: "BigInt", package: "BigInt"),
.product(name: "GenericJSON", package: "generic-json-swift"),
.product(name: "secp256k1", package: "secp256k1.swift"),
.product(name: "WebSocketKit", package: "websocket-kit"),
.product(name: "Logging", package: "swift-log")
],
path: "Sources/Web3Swift",
swiftSettings: [
// .concurrencyChecking
]
),
.target(
name: "web3-zksync",
dependencies:
[
.target(name: "web3")
],
path: "Sources/Web3ZKSync",
swiftSettings: [
// .concurrencyChecking
]
),
.target(
name: "keccaktiny",
dependencies: [],
path: "libs/keccak-tiny",
exclude: ["module.map"]
),
.target(
name: "aes",
dependencies: [],
path: "libs/aes",
exclude: ["module.map"]
),
.target(
name: "Internal_CryptoSwift_PBDKF2",
dependencies: [],
path: "libs/CryptoSwift"
),
.testTarget(
name: "web3swiftTests",
dependencies: ["web3", "web3-zksync"],
path: "Tests/Web3SwiftTests",
resources: [
.copy("Resources/rlptests.json"),
.copy("Account/cryptofights_712.json"),
.copy("Account/ethermail_signTypedDataV4.json"),
.copy("Account/real_word_opensea_signTypedDataV4.json"),
]
)
]
)

extension SwiftSetting {
/// Enable complete concurrency checking for a target in a Swift package using Swift 5.9 or Swift 5.10
/// [Swift Concurrency Documentation](https://www.swift.org/documentation/concurrency/)
static var concurrencyChecking: SwiftSetting {
.enableExperimentalFeature("StrictConcurrency=complete")
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// web3.swift
// EthereumAccount+SignTransaction.swift
// Copyright © 2022 Argent Labs Limited. All rights reserved.
//

Expand Down
Loading
Loading