Skip to content

Commit 10ad5ef

Browse files
🔄 synced file(s) with circlefin/modularwallets-ios-sdk-internal (#10)
synced local file(s) with [circlefin/modularwallets-ios-sdk-internal](https://github.com/circlefin/modularwallets-ios-sdk-internal). <details> <summary>Changed files</summary> <ul> <li>synced local directory <code>CircleModularWalletsCore/</code> with remote directory <code>CircleModularWalletsCore/</code></li> </ul> </details> --- This PR was created automatically by the [repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action) workflow run [#12769049706](https://github.com/circlefin/modularwallets-ios-sdk-internal/actions/runs/12769049706)
1 parent 4a697fb commit 10ad5ef

27 files changed

+172
-181
lines changed

‎CircleModularWalletsCore/Resources/Info.plist‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleShortVersionString</key>
6-
<string>1.0.7</string>
6+
<string>1.0.8</string>
77
<key>CFBundleIdentifier</key>
88
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
99
<key>CFBundleName</key>

‎CircleModularWalletsCore/Sources/APIs/Bundler/BundlerRpcReqResp.swift‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import BigInt
2121

2222
/// Result for ``BundlerClient/estimateUserOperationGas(userOp:entryPoint:)``
2323
public struct EstimateUserOperationGasResult: Codable {
24-
let preVerificationGas: BigInt?
25-
let verificationGasLimit: BigInt?
26-
let callGasLimit: BigInt?
27-
let paymasterVerificationGasLimit: BigInt?
28-
let paymasterPostOpGasLimit: BigInt?
24+
public let preVerificationGas: BigInt?
25+
public let verificationGasLimit: BigInt?
26+
public let callGasLimit: BigInt?
27+
public let paymasterVerificationGasLimit: BigInt?
28+
public let paymasterPostOpGasLimit: BigInt?
2929

3030
init(preVerificationGas: BigInt?, verificationGasLimit: BigInt?, callGasLimit: BigInt?, paymasterVerificationGasLimit: BigInt?, paymasterPostOpGasLimit: BigInt?) {
3131
self.preVerificationGas = preVerificationGas
@@ -64,11 +64,11 @@ public struct EstimateUserOperationGasResult: Codable {
6464

6565
/// Result for ``BundlerClient/getUserOperation(userOpHash:)``
6666
public struct GetUserOperationResult: Codable {
67-
let blockHash: String?
68-
let blockNumber: BigInt?
69-
let transactionHash: String?
70-
let entryPoint: String?
71-
let userOperation: UserOperationType?
67+
public let blockHash: String?
68+
public let blockNumber: BigInt?
69+
public let transactionHash: String?
70+
public let entryPoint: String?
71+
public let userOperation: UserOperationType?
7272

7373
enum CodingKeys: String, CodingKey {
7474
case userOperation
@@ -157,30 +157,30 @@ public struct GetUserOperationReceiptResult: Codable {
157157

158158
// https://github.com/wevm/viem/blob/e7431e88b0e8b83719c91f5a6a57da1a10076a1c/src/account-abstraction/types/userOperation.ts#L167
159159
public struct UserOperationReceipt: Codable {
160-
let transactionHash: String?
161-
let transactionIndex: String?
162-
let blockHash: String?
163-
let blockNumber: String?
164-
let from: String?
165-
let to: String?
166-
let cumulativeGasUsed: String?
167-
let gasUsed: String?
168-
let logs: [Log]?
169-
let logsBloom: String?
170-
let status: String?
171-
let effectiveGasPrice: String?
160+
public let transactionHash: String?
161+
public let transactionIndex: String?
162+
public let blockHash: String?
163+
public let blockNumber: String?
164+
public let from: String?
165+
public let to: String?
166+
public let cumulativeGasUsed: String?
167+
public let gasUsed: String?
168+
public let logs: [Log]?
169+
public let logsBloom: String?
170+
public let status: String?
171+
public let effectiveGasPrice: String?
172172
}
173173

174174
// https://github.com/wevm/viem/blob/e7431e88b0e8b83719c91f5a6a57da1a10076a1c/src/types/log.ts#L15
175175
public struct Log: Codable {
176-
let removed: Bool?
177-
let logIndex: String?
178-
let transactionIndex: String?
179-
let transactionHash: String?
180-
let blockHash: String?
181-
let blockNumber: String?
182-
let address: String?
183-
let data: String?
184-
let topics: [String]?
176+
public let removed: Bool?
177+
public let logIndex: String?
178+
public let transactionIndex: String?
179+
public let transactionHash: String?
180+
public let blockHash: String?
181+
public let blockNumber: String?
182+
public let address: String?
183+
public let data: String?
184+
public let topics: [String]?
185185
}
186186
}

‎CircleModularWalletsCore/Sources/APIs/Modular/ModularRpcApi.swift‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,15 @@
1919
import Foundation
2020

2121
protocol ModularRpcApi {
22-
23-
func circleGetAddress(
24-
transport: Transport,
25-
req: CreateWalletRequest
26-
) async throws -> Wallet
22+
23+
func getAddress(transport: Transport, req: GetAddressReq) async throws -> ModularWallet
2724
}
2825

2926
extension ModularRpcApi {
3027

31-
func circleGetAddress(
32-
transport: Transport,
33-
req: CreateWalletRequest
34-
) async throws -> Wallet {
28+
func getAddress(transport: Transport, req: GetAddressReq) async throws -> ModularWallet {
3529
let req = RpcRequest(method: "circle_getAddress", params: [req])
36-
let response = try await transport.request(req) as RpcResponse<Wallet>
30+
let response = try await transport.request(req) as RpcResponse<ModularWallet>
3731
return response.result
3832
}
3933
}

‎CircleModularWalletsCore/Sources/APIs/Modular/ModularRpcReqResp.swift‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,12 @@
1818

1919
import Foundation
2020

21-
public struct CreateWalletRequest: Encodable {
21+
struct GetAddressReq: Encodable {
2222
let scaConfiguration: ScaConfiguration
2323
let metadata: Metadata
2424
}
2525

26-
public struct CreateWalletResponse: Decodable {
27-
var data: Data
28-
29-
struct Data: Codable {
30-
var wallets: [Wallet]
31-
}
32-
}
33-
34-
public struct Wallet: Codable {
26+
struct ModularWallet: Codable, Sendable {
3527
var id: String?
3628
var address: String?
3729
var blockchain: String?

‎CircleModularWalletsCore/Sources/APIs/Public/PublicRpcReqResp.swift‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ struct EthCallParams: Encodable {
4545

4646
/// Result for ``PublicRpcApi/estimateFeesPerGas(transport:feeValuesType:)``
4747
public struct EstimateFeesPerGasResult: Encodable {
48-
49-
let maxFeePerGas: BigInt? // eip1559
50-
let maxPriorityFeePerGas: BigInt? // eip1559
51-
let gasPrice: BigInt? // legacy
48+
public let maxFeePerGas: BigInt? // eip1559
49+
public let maxPriorityFeePerGas: BigInt? // eip1559
50+
public let gasPrice: BigInt? // legacy
5251

5352
init(maxFeePerGas: BigInt?, maxPriorityFeePerGas: BigInt?, gasPrice: BigInt? = nil) {
5453
self.maxFeePerGas = maxFeePerGas

‎CircleModularWalletsCore/Sources/Accounts/CircleSmartAccount.swift‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public func toCircleSmartAccount<A: Account>(
4343
return try await .init(client: client, owner: owner, version: version, name: name)
4444
}
4545

46-
public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResult {
46+
public class CircleSmartAccount<A: Account>: SmartAccount, @unchecked Sendable where A.T == SignResult {
4747
public let client: Client
4848
public let entryPoint: EntryPoint
4949
let owner: A
50-
let wallet: Wallet
50+
let wallet: ModularWallet
5151
private var deployed: Bool = false
5252
private let nonceManager = NonceManager(source: NonceManagerSourceImpl())
5353

54-
init(client: Client, owner: A, wallet: Wallet, entryPoint: EntryPoint = .v07) {
54+
init(client: Client, owner: A, wallet: ModularWallet, entryPoint: EntryPoint = .v07) {
5555
self.client = client
5656
self.owner = owner
5757
self.wallet = wallet
@@ -98,11 +98,6 @@ public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResul
9898
}
9999
}
100100

101-
// static func create(url: String, apiKey: String, client: Client, owner: A) -> CircleSmartAccount {
102-
// let account = CircleSmartAccount(client: client, owner: owner, wallet: Wallet())
103-
// return account
104-
// }
105-
106101
public func getAddress() -> String {
107102
return wallet.address ?? ""
108103
}
@@ -270,9 +265,9 @@ extension CircleSmartAccount: PublicRpcApi {
270265
hexPublicKey: String,
271266
version: String,
272267
name: String? = nil
273-
) async throws -> Wallet {
268+
) async throws -> ModularWallet {
274269
let (publicKeyX, publicKeyY) = Self.extractXYFromCOSE(hexPublicKey)
275-
let request = CreateWalletRequest(
270+
let request = GetAddressReq(
276271
scaConfiguration: ScaConfiguration(
277272
initialOwnershipConfiguration: .init(
278273
ownershipContractAddress: nil,
@@ -288,7 +283,7 @@ extension CircleSmartAccount: PublicRpcApi {
288283
metadata: .init(name: name)
289284
)
290285

291-
let wallet = try await transport.circleGetAddress(transport: transport, req: request)
286+
let wallet = try await transport.getAddress(transport: transport, req: request)
292287

293288
return wallet
294289
}
@@ -530,13 +525,14 @@ extension CircleSmartAccount: PublicRpcApi {
530525
}
531526

532527
let slicedValue = "0x" + cleanValue[startIndex..<endIndex]
533-
534-
if strict {
535-
guard slicedValue.range(of: "^0x[0-9a-fA-F]*$", options: .regularExpression) != nil else {
536-
logger.passkeyAccount.notice("Invalid hexadecimal string")
537-
return "0x"
538-
}
539-
}
528+
529+
// This block is never executed because the `strict` parameter is always set to its default value (`false`).
530+
// if strict {
531+
// guard slicedValue.range(of: "^0x[0-9a-fA-F]*$", options: .regularExpression) != nil else {
532+
// logger.passkeyAccount.notice("Invalid hexadecimal string")
533+
// return "0x"
534+
// }
535+
// }
540536

541537
return slicedValue
542538
}

‎CircleModularWalletsCore/Sources/Accounts/WebAuthnCredential.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public func toWebAuthnCredential(
5353
}
5454
}
5555

56-
public struct WebAuthnCredential: RpRpcApi {
56+
public struct WebAuthnCredential: RpRpcApi, Sendable {
5757

5858
/// Credential ID property
5959
public let id: String

‎CircleModularWalletsCore/Sources/Chains/Arbitrum.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919
import Foundation
2020

21-
let Arbitrum = _Arbitrum()
21+
public let Arbitrum = _Arbitrum()
2222

23-
struct _Arbitrum: Chain {
23+
public struct _Arbitrum: Chain {
2424

25-
let chainId: Int = 42161
25+
public let chainId: Int = 42161
2626

27-
let blockchain: String = "ARB"
27+
public let blockchain: String = "ARB"
2828

2929
}

‎CircleModularWalletsCore/Sources/Chains/ArbitrumSepolia.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919
import Foundation
2020

21-
let ArbitrumSepolia = _ArbitrumSepolia()
21+
public let ArbitrumSepolia = _ArbitrumSepolia()
2222

23-
struct _ArbitrumSepolia: Chain {
23+
public struct _ArbitrumSepolia: Chain {
2424

25-
let chainId: Int = 421614
25+
public let chainId: Int = 421614
2626

27-
let blockchain: String = "ARB-SEPOLIA"
27+
public let blockchain: String = "ARB-SEPOLIA"
2828

2929
}

‎CircleModularWalletsCore/Sources/Chains/Chain.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818

1919
import Foundation
2020

21-
public protocol Chain {
21+
public protocol Chain: Sendable {
2222

2323
var chainId: Int { get }
2424

25+
var blockchain: String { get }
26+
2527
}

0 commit comments

Comments
 (0)