Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc2df7e

Browse files
committed
Add Sendable conformance to various structs and enums
- Updated `EthereumAddress` and its nested `AddressType` enum to conform to `Sendable`. - Modified `BlockNumber` enum to conform to `Sendable`. - Added `Sendable` conformance to `CodableTransaction` struct. - Updated `TransactionType` enum and `AbstractEnvelope` protocol to conform to `Sendable`. - Added `Sendable` conformance to `AccessListEntry` struct. - Modified `TransactionMetadata` struct to conform to `Sendable`.
1 parent 11f9c4a commit cc2df7e

File tree

9 files changed

+12
-11
lines changed

9 files changed

+12
-11
lines changed

‎Sources/Web3Core/EthereumAddress/EthereumAddress.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import Foundation
1010
import CryptoSwift
1111

12-
public struct EthereumAddress: Equatable {
13-
public enum AddressType {
12+
public struct EthereumAddress: Equatable,Sendable {
13+
public enum AddressType:Sendable {
1414
case normal
1515
case contractDeployment
1616
}

‎Sources/Web3Core/KeystoreManager/BIP32Keystore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class BIP32Keystore: AbstractKeystore {
6262

6363
private static let KeystoreParamsBIP32Version = 4
6464

65-
public private(set) var addressStorage: PathAddressStorage
65+
public private(set) var addressStorage: PathAddressStorage
6666

6767
public convenience init?(_ jsonString: String) {
6868
let lowercaseJSON = jsonString.lowercased()

‎Sources/Web3Core/Structure/Block/BlockNumber.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import BigInt
1010

11-
public enum BlockNumber: CustomStringConvertible {
11+
public enum BlockNumber: CustomStringConvertible,Sendable {
1212

1313
case pending
1414
/// Latest block of a chain

‎Sources/Web3Core/Transaction/CodableTransaction.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import BigInt
1010
/// Structure capable of carying the parameters for any transaction type.
1111
/// While most fields in this struct are optional, they are not necessarily
1212
/// optional for the type of transaction they apply to.
13-
public struct CodableTransaction {
13+
public struct CodableTransaction:Sendable {
1414
/// internal access only. The transaction envelope object itself that contains all the transaction data
1515
/// and type specific implementation
1616
internal var envelope: AbstractEnvelope

‎Sources/Web3Core/Transaction/Envelope/AbstractEnvelope.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import BigInt
2121
*/
2222

2323
/// Enumeration for supported transaction types
24-
public enum TransactionType: UInt, CustomStringConvertible, CaseIterable {
24+
public enum TransactionType: UInt, CustomStringConvertible, CaseIterable,Sendable {
2525

2626
/// For untyped and type 0 transactions EIP155 and older
2727
case legacy
@@ -62,7 +62,7 @@ public enum EncodeType {
6262
/// All envelopes must conform to this protocol to work with `CodableTransaction`
6363
/// each implementation holds all the type specific data
6464
/// and implements the type specific encoding/decoding
65-
protocol AbstractEnvelope: CustomStringConvertible { // possibly add Codable?
65+
protocol AbstractEnvelope: CustomStringConvertible,Sendable { // possibly add Codable?
6666

6767
/// The type of transaction this envelope represents
6868
var type: TransactionType { get }

‎Sources/Web3Core/Transaction/Envelope/EIP2930Envelope.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Foundation
88
import BigInt
99

1010
public struct EIP2930Envelope: EIP2718Envelope, EIP2930Compatible {
11+
1112
public let type: TransactionType = .eip2930
1213

1314
// common parameters for any transaction
@@ -221,7 +222,7 @@ extension EIP2930Envelope {
221222
}
222223
}
223224

224-
public struct AccessListEntry: CustomStringConvertible, Codable {
225+
public struct AccessListEntry: CustomStringConvertible, Codable,Sendable {
225226
var address: EthereumAddress
226227
var storageKeys: [BigUInt]
227228

‎Sources/Web3Core/Transaction/TransactionMetadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import BigInt
1111
/// returned by nodes when reading a transaction
1212
/// from the blockchain. The data here is not
1313
/// part of the transaction itself
14-
public struct TransactionMetadata {
14+
public struct TransactionMetadata:Sendable {
1515

1616
/// hash for the block that contains this transaction on chain
1717
public var blockHash: Data?

‎Sources/web3swift/Tokens/ERC20/ERC20BasePropertiesProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public final class ERC20BasePropertiesProvider {
1515
var decimals: UInt8?
1616

1717
private let contract: Web3.Contract
18-
private(set) var hasReadProperties: Bool = false
18+
private(set) var hasReadProperties: Bool = false
1919
init(contract: Web3.Contract) {
2020
self.contract = contract
2121
}

‎Tests/web3swiftTests/localTests/EventloopTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EventloopTests: XCTestCase {
1515
let expectation = self.expectation(description: "Waiting")
1616
func getBlockNumber(_ web3: Web3) async {
1717
do {
18-
letblockNumber = try await web3.eth.blockNumber()
18+
_ = try await web3.eth.blockNumber()
1919
ticksToWait = ticksToWait - 1
2020
if ticksToWait == 0 {
2121
expectation.fulfill()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /