Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Commit 38a0aeb

Browse files
authored
Merge pull request #10 from magiclabs/jerryliu-sc-62139-deprecation-of-testnet-in-mobile-sdks
* Deprecation of rinkeby, ropsten, kovan
2 parents f5a156a + f64980b commit 38a0aeb

File tree

3 files changed

+16
-26
lines changed

3 files changed

+16
-26
lines changed

Sources/MagicSDK/Core/Magic.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ public class Magic: NSObject {
3030
/// - apiKey: Your client ID. From https://dashboard.Magic.com
3131
/// - ethNetwork: Network setting
3232
public convenience init(apiKey: String, network: EthNetwork, locale: String = Locale.current.identifier) {
33-
self.init(urlBuilder: URLBuilder(apiKey: apiKey, network: EthNetworkConfiguration(network: network), locale: locale))
33+
self.init(urlBuilder: URLBuilder(apiKey: apiKey, network: network, locale: locale))
3434
}
3535

3636
public convenience init(apiKey: String, customNode: CustomNodeConfiguration, locale: String = Locale.current.identifier) {
3737
self.init(urlBuilder: URLBuilder(apiKey: apiKey, customNode: customNode, locale: locale))
3838
}
3939

4040
public convenience init(apiKey: String, locale: String = Locale.current.identifier) {
41-
self.init(urlBuilder: URLBuilder(apiKey: apiKey, network: EthNetworkConfiguration(network: apiKey.contains("live") ? EthNetwork.mainnet: EthNetwork.rinkeby), locale: locale))
41+
self.init(urlBuilder: URLBuilder(apiKey: apiKey, network: EthNetwork.mainnet, locale: locale))
4242
}
4343

4444
private init(urlBuilder: URLBuilder) {

Sources/MagicSDK/Core/Relayer/URLBuilder.swift

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public struct URLBuilder {
2727
self.init(data: data, host: URLBuilder.host, apiKey: apiKey)
2828
}
2929

30-
init(apiKey: String, network: EthNetworkConfiguration, locale: String) {
30+
init(apiKey: String, network: EthNetwork, locale: String) {
3131
let options = EthNetworkOptions(apiKey: apiKey, network: network, locale: locale)
3232
let data = try! JSONEncoder().encode(options)
3333
self.init(data: data, host: URLBuilder.host, apiKey: apiKey)
@@ -50,11 +50,11 @@ public struct URLBuilder {
5050
let API_KEY: String
5151
let host = URLBuilder.host
5252
let sdk = "magic-sdk-ios"
53-
let ETH_NETWORK: EthNetworkConfiguration
53+
let ETH_NETWORK: String
5454
let locale: String
5555
let bundleId = Bundle.main.bundleIdentifier
56-
init(apiKey: String, network: EthNetworkConfiguration, locale: String) {
57-
self.ETH_NETWORK = network
56+
init(apiKey: String, network: EthNetwork, locale: String) {
57+
self.ETH_NETWORK = network.rawValue
5858
self.API_KEY = apiKey
5959
self.locale = locale
6060
}
@@ -84,11 +84,3 @@ public struct CustomNodeConfiguration: Encodable {
8484
self.chainId = chainId
8585
}
8686
}
87-
88-
internal struct EthNetworkConfiguration: Encodable {
89-
let network: String
90-
91-
init (network: EthNetwork) {
92-
self.network = network.rawValue
93-
}
94-
}

Sources/MagicSDK/Modules/Web3/Web3Extension.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PromiseKit
1212

1313
// MARK: - web3 extension with closure
1414
public extension Web3.Eth {
15-
15+
1616
func getCoinbase(response: @escaping Web3.Web3ResponseCompletion<EthereumAddress>) {
1717
let req = BasicRPCRequest(
1818
id: properties.rpcId,
@@ -22,7 +22,7 @@ public extension Web3.Eth {
2222
)
2323
properties.provider.send(request: req, response: response)
2424
}
25-
25+
2626
func sign(from: EthereumAddress, message: EthereumData, response: @escaping Web3.Web3ResponseCompletion<EthereumData>) {
2727
let req = RPCRequest<EthereumValue>(
2828
id: properties.rpcId,
@@ -32,7 +32,7 @@ public extension Web3.Eth {
3232
)
3333
properties.provider.send(request: req, response: response)
3434
}
35-
35+
3636
func signTypedDataV1(
3737
data: [EIP712TypedDataLegacyFields],
3838
account: EthereumAddress,
@@ -48,7 +48,7 @@ public extension Web3.Eth {
4848
)
4949
properties.provider.send(request: req, response: response)
5050
}
51-
51+
5252
func signTypedDataV3(
5353
account: EthereumAddress,
5454
data: EIP712TypedData,
@@ -69,26 +69,26 @@ public extension Web3.Eth {
6969
// MARK: - web3 extension Promises
7070
///
7171
public extension Web3.Eth {
72-
72+
7373
func getCoinbase() -> Promise<EthereumAddress> {
7474
return Promise { resolver in
7575
getCoinbase(response: promiseResolver(resolver))
7676
}
7777
}
78-
78+
7979
func sign(from: EthereumAddress, message: EthereumData) -> Promise<EthereumData> {
8080
return Promise { resolver in
8181
sign(from: from, message: message, response: promiseResolver(resolver))
8282
}
8383
}
84-
84+
8585
func signTypedDataLegacy(
8686
account: EthereumAddress, data: [EIP712TypedDataLegacyFields]) -> Promise<EthereumData> {
8787
return Promise { resolver in
8888
signTypedDataV1(data: data, account: account, response: promiseResolver(resolver))
8989
}
9090
}
91-
91+
9292
func signTypedData(
9393
account: EthereumAddress, data: EIP712TypedData) -> Promise<EthereumData> {
9494
return Promise { resolver in
@@ -98,7 +98,7 @@ public extension Web3.Eth {
9898
}
9999

100100
public extension RPCRequest {
101-
101+
102102
init(method: String, params: Params) {
103103
self = RPCRequest(id: generateRandomId(), jsonrpc: "2.0", method: method, params: params)
104104
}
@@ -109,7 +109,5 @@ public extension RPCRequest {
109109
/// Note: Conforms to Hashable so that we can use these as a Dictionary key
110110
public enum EthNetwork: String {
111111
case mainnet
112-
case kovan
113-
case rinkeby
114-
case ropsten
112+
case goerli
115113
}

0 commit comments

Comments
 (0)