Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
37 changes: 22 additions & 15 deletions Example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.576.0)
aws-sdk-core (3.130.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.55.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.113.0)
aws-sdk-core (~> 3, >= 3.127.0)
aws-eventstream (1.4.0)
aws-partitions (1.1196.0)
aws-sdk-core (3.240.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.118.0)
aws-sdk-core (~> 3, >= 3.239.1)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.208.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.4.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.3.0)
bigdecimal (4.0.1)
claide (1.1.0)
colored (1.2)
colored2 (3.1.2)
Expand Down Expand Up @@ -148,9 +153,10 @@ GEM
http-cookie (1.0.4)
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.1)
jmespath (1.6.2)
json (2.6.1)
jwt (2.3.0)
logger (1.7.0)
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.2)
Expand Down Expand Up @@ -211,6 +217,7 @@ GEM
PLATFORMS
arm64-darwin-21
x86_64-darwin-20
x86_64-linux

DEPENDENCIES
fastlane
Expand Down
70 changes: 0 additions & 70 deletions Package.resolved

This file was deleted.

104 changes: 8 additions & 96 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
// swift-tools-version:5.5
// swift-tools-version:5.9

import PackageDescription

// Determine if Yttrium should be used in debug (local) mode
let yttriumDebug = false


// Define dependencies array
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"),
.package(url: "https://github.com/WalletConnect/QRCode", from: "14.3.1"),
.package(name: "CoinbaseWalletSDK", url: "https://github.com/MobileWalletProtocol/wallet-mobile-sdk", .upToNextMinor(from: "1.0.0")),
// .package(url: "https://github.com/pointfreeco/swift-snapshot-testing", .upToNextMinor(from: "1.10.0")),
]


let yttriumTarget = buildYttriumWrapperTarget()

func buildYttriumWrapperTarget() -> Target {
// Conditionally add Yttrium dependency
if yttriumDebug {
dependencies.append(.package(path: "../yttrium"))
return .target(
name: "YttriumWrapper",
dependencies: [.product(name: "Yttrium", package: "yttrium")],
path: "Sources/YttriumWrapper"
)
} else {
dependencies.append(.package(url: "https://github.com/reown-com/yttrium", .exact("0.9.0")))
return .target(
name: "YttriumWrapper",
dependencies: [.product(name: "Yttrium", package: "yttrium")],
path: "Sources/YttriumWrapper"
)
}
}

let package = Package(
name: "reown",
platforms: [
Expand Down Expand Up @@ -71,26 +37,18 @@ let package = Package(
.library(
name: "WalletConnectIdentity",
targets: ["WalletConnectIdentity"]),
.library(
name: "ReownAppKit",
targets: ["ReownAppKit"]),
.library(
name: "ReownAppKitUI",
targets: ["ReownAppKitUI"]),
.library(
name: "YttriumWrapper",
targets: ["YttriumWrapper"])
],
dependencies: dependencies,
dependencies: [
],
targets: [
.target(
name: "WalletConnectSign",
dependencies: ["WalletConnectPairing", "WalletConnectVerify", "WalletConnectSigner", "Events", "YttriumWrapper"],
dependencies: ["WalletConnectPairing", "WalletConnectVerify", "WalletConnectSigner", "Events"],
path: "Sources/WalletConnectSign",
resources: [.process("Resources/PrivacyInfo.xcprivacy")]),
.target(
name: "ReownWalletKit",
dependencies: ["WalletConnectSign", "WalletConnectPush", "WalletConnectVerify", "YttriumWrapper"],
dependencies: ["WalletConnectSign", "WalletConnectPush", "WalletConnectVerify"],
path: "Sources/ReownWalletKit",
resources: [.process("Resources/PrivacyInfo.xcprivacy")]),
.target(
Expand Down Expand Up @@ -159,36 +117,6 @@ let package = Package(
.target(
name: "Events",
dependencies: ["WalletConnectUtils", "WalletConnectNetworking"]),
.target(
name: "ReownAppKit",
dependencies: [
"QRCode",
"WalletConnectSign",
"ReownAppKitUI",
"ReownAppKitBackport",
"CoinbaseWalletSDK"
],
path: "Sources/ReownAppKit",
resources: [
.process("Resources/Assets.xcassets"),
.copy("PackageConfig.json")
]
),
.target(
name: "ReownAppKitUI",
dependencies: [
"ReownAppKitBackport"
],
path: "Sources/ReownAppKitUI",
resources: [
.process("Resources/Assets.xcassets")
]
),
.target(
name: "ReownAppKitBackport",
path: "Sources/ReownAppKitBackport"
),
yttriumTarget,
.testTarget(
name: "WalletConnectSignTests",
dependencies: ["WalletConnectSign", "WalletConnectUtils", "TestingUtils", "WalletConnectVerify"]),
Expand All @@ -197,7 +125,7 @@ let package = Package(
dependencies: ["WalletConnectPairing", "TestingUtils"]),
.testTarget(
name: "NotifyTests",
dependencies: ["WalletConnectNotify", "TestingUtils", "YttriumWrapper"]),
dependencies: ["WalletConnectNotify", "TestingUtils"]),
.testTarget(
name: "RelayerTests",
dependencies: ["WalletConnectRelay", "WalletConnectUtils", "TestingUtils"]),
Expand All @@ -222,22 +150,6 @@ let package = Package(
dependencies: ["Commons", "TestingUtils"]),
.testTarget(
name: "EventsTests",
dependencies: ["Events"]),
// .testTarget(
// name: "ReownAppKitTests",
// dependencies: [
// "ReownAppKit",
// .product(name: "SnapshotTesting", package: "swift-snapshot-testing")
// ]
// ),
// .testTarget(
// name: "ReownAppKitUITests",
// dependencies: [
// "ReownAppKitUI",
// .product(name: "SnapshotTesting", package: "swift-snapshot-testing")
// ]
// )
dependencies: ["Events"])
],
swiftLanguageVersions: [.v5]
)

swiftLanguageVersions: [.v5])
20 changes: 0 additions & 20 deletions Sources/ReownWalletKit/ChainAbstractionNamespace.swift

This file was deleted.

25 changes: 1 addition & 24 deletions Sources/ReownWalletKit/WalletKitClient.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import Combine
import YttriumWrapper

/// Web3 Wallet Client
///
Expand Down Expand Up @@ -103,25 +102,17 @@ public class WalletKitClient {
private let signClient: SignClientProtocol
private let pairingClient: PairingClientProtocol
private let pushClient: PushClientProtocol
private let chainAbstractionClient: ChainAbstractionClient

private var account: Account?

// Namespaces
public let ChainAbstraction: ChainAbstractionNamespace

init(
signClient: SignClientProtocol,
pairingClient: PairingClientProtocol,
pushClient: PushClientProtocol,
chainAbstractionClient: ChainAbstractionClient,
ChainAbstractionNamespace: ChainAbstractionNamespace
pushClient: PushClientProtocol
) {
self.signClient = signClient
self.pairingClient = pairingClient
self.pushClient = pushClient
self.chainAbstractionClient = chainAbstractionClient
self.ChainAbstraction = ChainAbstractionNamespace
}

/// For a wallet to approve a session proposal.
Expand Down Expand Up @@ -274,20 +265,6 @@ public class WalletKitClient {
public func getPairings() -> [Pairing] {
return pairingClient.getPairings()
}

public func prepareERC20TransferCall(
erc20Address: String,
to: String,
amount: String
) -> Call {
return chainAbstractionClient.prepareErc20TransferCall(
erc20Address: erc20Address, to: to, amount: amount)
}

@available(*, message: "This method is experimental. Use with caution.")
public func erc20Balance(chainId: String, token: String, owner: String) async throws -> Ffiu256 {
return try await chainAbstractionClient.erc20TokenBalance(chainId: chainId, token: token, owner: owner)
}
}


Expand Down
17 changes: 2 additions & 15 deletions Sources/ReownWalletKit/WalletKitClientFactory.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import Foundation
import YttriumWrapper

struct WalletKitClientFactory {
static func create(
signClient: SignClientProtocol,
pairingClient: PairingClientProtocol,
pushClient: PushClientProtocol,
config: WalletKit.Config,
projectId: String? = nil
projectId: String? = nil
) -> WalletKitClient {
let metadata = PulseMetadata(
url: nil,
bundleId: Bundle.main.bundleIdentifier,
sdkVersion: EnvironmentInfo.sdkName,
sdkPlatform: "mobile"
)

// In debug builds, use the injected projectId if provided.
// In release builds, always use Networking.projectId.
let usedProjectId: String = {
Expand All @@ -26,15 +18,10 @@ struct WalletKitClientFactory {
#endif
}()

let chainAbstractionClient = ChainAbstractionClient(projectId: usedProjectId, pulseMetadata: metadata)
let ChainAbstractionNamespace = ChainAbstractionNamespace(chainAbstractionClient: chainAbstractionClient)

return WalletKitClient(
signClient: signClient,
pairingClient: pairingClient,
pushClient: pushClient,
chainAbstractionClient: chainAbstractionClient,
ChainAbstractionNamespace: ChainAbstractionNamespace
pushClient: pushClient
)
}
}
Loading
Loading