Skip to content

Commit 4e68915

Browse files
🔄 synced file(s) with circlefin/modularwallets-ios-sdk-internal (#7)
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><li>synced local <code>./LICENSE</code> with remote <code>./LICENSE</code></li><li>synced local <code>./Package.swift</code> with remote <code>./Package.swift</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 [#12643658441](https://github.com/circlefin/modularwallets-ios-sdk-internal/actions/runs/12643658441)
1 parent 9f5eeab commit 4e68915

21 files changed

+567
-222
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.4</string>
6+
<string>1.0.5</string>
77
<key>CFBundleIdentifier</key>
88
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
99
<key>CFBundleName</key>

‎CircleModularWalletsCore/Sources/Accounts/CircleSmartAccount.swift‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@ import BigInt
2121
import Web3Core
2222
import web3swift
2323

24+
/// Creates a Circle smart account.
25+
///
26+
/// - Parameters:
27+
/// - client: The client used to interact with the blockchain.
28+
/// - owner: The owner account associated with the Circle smart account.
29+
/// - version: The version of the Circle smart account. Default is "circle_6900_v1".
30+
/// - name: The wallet name assigned to the newly registered account defaults to the format "passkey-yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
31+
///
32+
/// - Throws: BaseError if there are any problems during the wallet creation process.
33+
///
34+
/// - Returns: The created Circle smart account.
2435
public func toCircleSmartAccount<A: Account>(
2536
client: Client,
2637
owner: A,
27-
version: String = "circle_6900_v1"
38+
version: String = "circle_6900_v1",
39+
name: String? = nil
2840
) async throws -> CircleSmartAccount<A> where A.T == SignResult {
29-
try await .init(client: client, owner: owner, version: version)
41+
let name = name ?? "passkey-\(Utils.getCurrentDateTime())"
42+
return try await .init(client: client, owner: owner, version: version, name: name)
3043
}
3144

3245
public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResult {
@@ -44,7 +57,7 @@ public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResul
4457
self.entryPoint = entryPoint
4558
}
4659

47-
convenience init(client: Client, owner: A, version: String) async throws {
60+
convenience init(client: Client, owner: A, version: String, name: String?) async throws {
4861
guard let buidlTransport = client.transport as? ModularTransport else {
4962
throw BaseError(shortMessage: "The property client.transport is not the ModularTransport")
5063
}
@@ -56,7 +69,7 @@ public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResul
5669
transport: buidlTransport,
5770
hexPublicKey: webAuthnAccount.credential.publicKey,
5871
version: version,
59-
name: webAuthnAccount.credential.userName
72+
name: name
6073
)
6174

6275
self.init(client: client, owner: owner, wallet: wallet)
@@ -84,10 +97,10 @@ public class CircleSmartAccount<A: Account>: SmartAccount where A.T == SignResul
8497
}
8598
}
8699

87-
static func create(url: String, apiKey: String, client: Client, owner: A) -> CircleSmartAccount {
88-
let account = CircleSmartAccount(client: client, owner: owner, wallet: Wallet())
89-
return account
90-
}
100+
// static func create(url: String, apiKey: String, client: Client, owner: A) -> CircleSmartAccount {
101+
// let account = CircleSmartAccount(client: client, owner: owner, wallet: Wallet())
102+
// return account
103+
// }
91104

92105
public func getAddress() -> String {
93106
return wallet.address ?? ""

‎CircleModularWalletsCore/Sources/Accounts/WebAuthnCredential.swift‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ public struct WebAuthnCredential: RpRpcApi {
6767
/// Relying party identifier
6868
public let rpId: String
6969

70-
/// User name
71-
public var userName: String? = nil
72-
7370
static func register(transport: Transport,
7471
userName: String) async throws -> WebAuthnCredential {
7572
do {
@@ -99,13 +96,12 @@ public struct WebAuthnCredential: RpRpcApi {
9996
}
10097

10198
/// After the server verifies the registration and creates the user account, sign in the user with the new account.
102-
/// Step 4. parse and serialized public key
99+
/// Step 4. Parse and serialized public key
103100
let serializedPublicKey = HexUtils.bytesToHex(publicKey.decodedBytes)
104101
return WebAuthnCredential(id: credential.id,
105102
publicKey: serializedPublicKey,
106103
raw: credential,
107-
rpId: option.relyingParty.id,
108-
userName: userName)
104+
rpId: option.relyingParty.id)
109105
} catch let error as BaseError {
110106
throw error
111107
} catch {
@@ -135,7 +131,7 @@ public struct WebAuthnCredential: RpRpcApi {
135131
)
136132

137133
/// After the server verifies the assertion, sign in the user.
138-
/// Step 4. parse and serialized public key
134+
/// Step 4. Parse and serialized public key
139135
let coseKey = try Utils.pemToCOSE(pemKey: loginResult.publicKey)
140136
let serializedPublicKey = HexUtils.bytesToHex(coseKey)
141137
return WebAuthnCredential(id: credential.id,
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright (c) 2025, Circle Internet Group, Inc. All rights reserved.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import Foundation
20+
21+
let Arbitrum = _Arbitrum()
22+
23+
struct _Arbitrum: Chain {
24+
25+
let chainId: Int = 42161
26+
27+
let blockchain: String = "ARB"
28+
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright (c) 2025, Circle Internet Group, Inc. All rights reserved.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import Foundation
20+
21+
let ArbitrumSepolia = _ArbitrumSepolia()
22+
23+
struct _ArbitrumSepolia: Chain {
24+
25+
let chainId: Int = 421614
26+
27+
let blockchain: String = "ARB-SEPOLIA"
28+
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright (c) 2025, Circle Internet Group, Inc. All rights reserved.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import Foundation
20+
21+
let Polygon = _Polygon()
22+
23+
struct _Polygon: Chain {
24+
25+
let chainId: Int = 137
26+
27+
let blockchain: String = "MATIC"
28+
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright (c) 2025, Circle Internet Group, Inc. All rights reserved.
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
import Foundation
20+
21+
let PolygonAmoy = _PolygonAmoy()
22+
23+
struct _PolygonAmoy: Chain {
24+
25+
let chainId: Int = 80_002
26+
27+
let blockchain: String = "MATIC-AMOY"
28+
29+
}

‎CircleModularWalletsCore/Sources/Helpers/Constants.swift‎

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,73 @@ public let CIRCLE_BASE_URL = "https://modular-sdk.circle.com/v1/rpc/w3s/buidl"
2222
public let ENTRYPOINT_V07_ADDRESS = "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
2323

2424
let CONTRACT_ADDRESS: [String: String] = [
25-
"token_1": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
26-
"token_2": "0xdac17f958d2ee523a2206206994597c13d831ec7",
27-
"token_3": "0xb8c77482e45f1f44de1745f52c74426c631bdd52"
25+
MainnetToken.USDT.name: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
26+
MainnetToken.BNB.name: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52",
27+
MainnetToken.USDC.name: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
28+
MainnetToken.stETH.name: "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
29+
MainnetToken.TONCOIN.name: "0x582d872A1B094FC48F5DE31D3B73F2D9bE47def1",
30+
MainnetToken.LINK.name: "0x514910771AF9Ca656af840dff83E8264EcF986CA",
31+
MainnetToken.wstETH.name: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
32+
MainnetToken.SHIB.name: "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
33+
MainnetToken.WBTC.name: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
34+
MainnetToken.WETH.name: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
35+
MainnetToken.DOT.name: "0x21c2c96Dbfa137E23946143c71AC8330F9B44001",
36+
MainnetToken.BlurPool.name: "0x0000000000A39bb272e79075ade125fd351887Ac",
37+
MainnetToken.BGB.name: "0x54D2252757e1672EEaD234D27B1270728fF90581",
38+
MainnetToken.LEO.name: "0x2AF5D2aD76741191D15Dfe7bF6aC92d4Bd912Ca3",
39+
MainnetToken.UNI.name: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984",
40+
MainnetToken.PEPE.name: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
41+
MainnetToken.weETH.name: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
42+
MainnetToken.NEAR.name: "0x85F17Cf997934a597031b2E18a9aB6ebD4B9f6a4",
43+
MainnetToken.USDe.name: "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3",
44+
MainnetToken.USDS.name: "0xdC035D45d973E3EC169d2276DDab16f1e407384F",
45+
46+
PolygonToken.WETH.name: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
47+
PolygonToken.USDT.name: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
48+
PolygonToken.BNB.name: "0x3BA4c387f786bFEE076A58914F5Bd38d668B42c3",
49+
PolygonToken.SOL.name: "0xd93f7E271cB87c23AaA73edC008A79646d1F9912",
50+
PolygonToken.USDC.name: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
51+
PolygonToken.USDC_e.name: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
52+
PolygonToken.BUSD.name: "0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7",
53+
PolygonToken.AVAX.name: "0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b",
54+
PolygonToken.LINK.name: "0xb0897686c545045aFc77CF20eC7A532E3120E0F1",
55+
PolygonToken.SHIB.name: "0x6f8a06447Ff6FcF75d803135a7de15CE88C1d4ec",
56+
PolygonToken.WBTC.name: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
57+
PolygonToken.LEO.name: "0x06D02e9D62A13fC76BB229373FB3BBBD1101D2fC",
58+
PolygonToken.UNI.name: "0xb33EaAd8d922B1083446DC23f610c2567fB5180f",
59+
PolygonToken.AAVE.name: "0xD6DF932A45C0f255f85145f286eA0b292B21C90B",
60+
PolygonToken.CRO.name: "0xAdA58DF0F643D959C2A47c9D4d4c1a4deFe3F11C",
61+
PolygonToken.RNDR.name: "0x61299774020dA444Af134c82fa83E3810b309991",
62+
PolygonToken.DAI.name: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
63+
PolygonToken.OM.name: "0xC3Ec80343D2bae2F8E680FDADDe7C17E71E114ea",
64+
PolygonToken.FET.name: "0x7583FEDDbceFA813dc18259940F76a02710A8905",
65+
66+
ArbitrumToken.USDT.name: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
67+
ArbitrumToken.USDC_e.name: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",
68+
ArbitrumToken.USDC.name: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
69+
ArbitrumToken.LINK.name: "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
70+
ArbitrumToken.wstETH.name: "0x0fBcbaEA96Ce0cF7Ee00A8c19c3ab6f5Dc8E1921",
71+
ArbitrumToken.WBTC.name: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
72+
ArbitrumToken.WETH.name: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
73+
ArbitrumToken.UNI.name: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0",
74+
ArbitrumToken.PEPE.name: "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00",
75+
ArbitrumToken.USDe.name: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
76+
ArbitrumToken.DAI.name: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
77+
ArbitrumToken.ARB.name: "0x912CE59144191C1204E64559FE8253a0e49E6548",
78+
ArbitrumToken.ENA.name: "0x58538e6A46E07434d7E7375Bc268D3cb839C0133",
79+
ArbitrumToken.cbBTC.name: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
80+
ArbitrumToken.GRT.name: "0x9623063377AD1B27544C965cCd7342f7EA7e88C7",
81+
ArbitrumToken.USD0.name: "0x35f1C5cB7Fb977E669fD244C567Da99d8a3a6850",
82+
ArbitrumToken.LDO.name: "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60",
83+
ArbitrumToken.PYTH.name: "0xE4D5c6aE46ADFAF04313081e8C0052A30b6Dd724",
84+
ArbitrumToken.ezETH.name: "0x2416092f143378750bb29b79eD961ab195CcEea5",
85+
ArbitrumToken.CRV.name: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978",
86+
87+
SepoliaToken.USDC.name: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
88+
89+
PolygonAmoyToken.USDC.name: "0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",
90+
91+
ArbitrumSepoliaToken.USDC.name: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
2892
]
2993

3094
let STUB_SIGNATURE = "0x0000be58786f7ae825e097256fc83a4749b95189e03e9963348373e9c595b15200000000000000000000000000000000000000000000000000000000000000412200000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006091077742edaf8be2fa866827236532ec2a5547fe2721e606ba591d1ffae7a15c022e5f8fe5614bbf65ea23ad3781910eb04a1a60fae88190001ecf46e5f5680a00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a224b6d62474d316a4d554b57794d6352414c6774553953537144384841744867486178564b6547516b503541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000"

‎CircleModularWalletsCore/Sources/Helpers/Extensions/Bundle+Extension.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Foundation
2121
#if SWIFT_PACKAGE
2222
extension Bundle {
2323
public enum SDK {
24-
public static let version = "1.0.4"
24+
public static let version = "1.0.5"
2525
}
2626
}
2727
#else

‎CircleModularWalletsCore/Sources/Helpers/Extensions/KeyedDecodingContainer+Extension.swift‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@ extension KeyedDecodingContainer {
2626
return HexUtils.hexToBigInt(hex: hexString)
2727
}
2828

29-
func decodeBytesFromURLEncodedBase64(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8] {
30-
guard let bytes = try decode(
31-
URLEncodedBase64.self,
32-
forKey: key
33-
).decodedBytes else {
34-
throw DecodingError.dataCorruptedError(
35-
forKey: key,
36-
in: self,
37-
debugDescription: "Failed to decode base64url encoded string at \(key) into bytes"
38-
)
39-
}
40-
return bytes
41-
}
42-
43-
func decodeBytesFromURLEncodedBase64IfPresent(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8]? {
44-
guard let bytes = try decodeIfPresent(
45-
URLEncodedBase64.self,
46-
forKey: key
47-
) else { return nil }
29+
// func decodeBytesFromURLEncodedBase64(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8] {
30+
// guard let bytes = try decode(
31+
// URLEncodedBase64.self,
32+
// forKey: key
33+
// ).decodedBytes else {
34+
// throw DecodingError.dataCorruptedError(
35+
// forKey: key,
36+
// in: self,
37+
// debugDescription: "Failed to decode base64url encoded string at \(key) into bytes"
38+
// )
39+
// }
40+
// return bytes
41+
// }
4842

49-
guard let decodedBytes = bytes.decodedBytes else {
50-
throw DecodingError.dataCorruptedError(
51-
forKey: key,
52-
in: self,
53-
debugDescription: "Failed to decode base64url encoded string at \(key) into bytes"
54-
)
55-
}
56-
return decodedBytes
57-
}
43+
// func decodeBytesFromURLEncodedBase64IfPresent(forKey key: KeyedDecodingContainer.Key) throws -> [UInt8]? {
44+
// guard let bytes = try decodeIfPresent(
45+
// URLEncodedBase64.self,
46+
// forKey: key
47+
// ) else { return nil }
48+
//
49+
// guard let decodedBytes = bytes.decodedBytes else {
50+
// throw DecodingError.dataCorruptedError(
51+
// forKey: key,
52+
// in: self,
53+
// debugDescription: "Failed to decode base64url encoded string at \(key) into bytes"
54+
// )
55+
// }
56+
// return decodedBytes
57+
// }
5858
}

0 commit comments

Comments
 (0)