Skip to content

Commit a632e2e

Browse files
committed
move TransactionOptions and rename to Web3+Options (restore original name and location)
1 parent 39ea368 commit a632e2e

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

Sources/web3swift/Transaction/TransactionOptions.swift renamed to Sources/web3swift/Web3/Web3+Options.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Foundation
88
import BigInt
99

1010
public protocol TransactionOptionsInheritable {
11-
var transactionOptions: TransactionOptions {get}
11+
var transactionOptions: TransactionOptions { get }
1212
}
1313

1414
/// Options for sending or calling a particular Ethereum transaction
@@ -86,8 +86,6 @@ public struct TransactionOptions {
8686

8787
public var accessList: [AccessListEntry]?
8888

89-
// default options
90-
// used by all routines here that fall back to defaults
9189
public static var defaultOptions: TransactionOptions {
9290
var opts = TransactionOptions()
9391
opts.type = .legacy
@@ -113,12 +111,10 @@ public struct TransactionOptions {
113111
public func resolveGasPrice(_ suggestedByNode: BigUInt) -> BigUInt {
114112
guard let gasPricePolicy = self.gasPrice else { return suggestedByNode }
115113
switch gasPricePolicy {
116-
case .automatic:
114+
case .automatic, .withMargin:
117115
return suggestedByNode
118116
case .manual(let value):
119117
return value
120-
case .withMargin:
121-
return suggestedByNode
122118
}
123119
}
124120

@@ -158,7 +154,6 @@ public struct TransactionOptions {
158154
}
159155
}
160156

161-
// Merges new options with the current set
162157
public func merge(_ otherOptions: TransactionOptions?) -> TransactionOptions {
163158
guard let other = otherOptions else { return self }
164159
var opts = TransactionOptions()
@@ -178,7 +173,7 @@ public struct TransactionOptions {
178173
/// Merges two sets of options by overriding the parameters from the first set by parameters from the second
179174
/// set if those are not nil.
180175
///
181-
/// Returns default option if both parameters are nil.
176+
/// Returns default options if both parameters are nil.
182177
public static func merge(_ options: TransactionOptions?, with other: TransactionOptions?) -> TransactionOptions? {
183178
var newOptions = TransactionOptions.defaultOptions // default has lowest priority
184179
newOptions = newOptions.merge(options)

web3swift.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
5CF7E8BC276B79380009900F /* web3swiftWebsocketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF7E8B7276B79380009900F /* web3swiftWebsocketTests.swift */; };
192192
604FA4FF27ECBDC80021108F /* DataConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 604FA4FE27ECBDC80021108F /* DataConversionTests.swift */; };
193193
60FFB09D27F6455000DBC22B /* EIP1559Envelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09627F6455000DBC22B /* EIP1559Envelope.swift */; };
194-
60FFB09E27F6455000DBC22B /* TransactionOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09727F6455000DBC22B /* TransactionOptions.swift */; };
194+
60FFB09E27F6455000DBC22B /* Web3+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09727F6455000DBC22B /* Web3+Options.swift */; };
195195
60FFB09F27F6455000DBC22B /* EnvelopeFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09827F6455000DBC22B /* EnvelopeFactory.swift */; };
196196
60FFB0A027F6455000DBC22B /* EIP2718Envelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09927F6455000DBC22B /* EIP2718Envelope.swift */; };
197197
60FFB0A127F6455000DBC22B /* AbstractEnvelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09A27F6455000DBC22B /* AbstractEnvelope.swift */; };
@@ -418,7 +418,7 @@
418418
5CF7E8B7276B79380009900F /* web3swiftWebsocketTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = web3swiftWebsocketTests.swift; sourceTree = "<group>"; };
419419
604FA4FE27ECBDC80021108F /* DataConversionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataConversionTests.swift; sourceTree = "<group>"; };
420420
60FFB09627F6455000DBC22B /* EIP1559Envelope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EIP1559Envelope.swift; sourceTree = "<group>"; };
421-
60FFB09727F6455000DBC22B /* TransactionOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionOptions.swift; sourceTree = "<group>"; };
421+
60FFB09727F6455000DBC22B /* Web3+Options.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+Options.swift"; sourceTree = "<group>"; };
422422
60FFB09827F6455000DBC22B /* EnvelopeFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EnvelopeFactory.swift; sourceTree = "<group>"; };
423423
60FFB09927F6455000DBC22B /* EIP2718Envelope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EIP2718Envelope.swift; sourceTree = "<group>"; };
424424
60FFB09A27F6455000DBC22B /* AbstractEnvelope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AbstractEnvelope.swift; sourceTree = "<group>"; };
@@ -709,7 +709,6 @@
709709
60FFB09B27F6455000DBC22B /* EIP2930Envelope.swift */,
710710
60FFB09827F6455000DBC22B /* EnvelopeFactory.swift */,
711711
60FFB09C27F6455000DBC22B /* LegacyEnvelope.swift */,
712-
60FFB09727F6455000DBC22B /* TransactionOptions.swift */,
713712
3AA8153D2276E44100F5DB52 /* BloomFilter.swift */,
714713
3AA8153F2276E44100F5DB52 /* EthereumTransaction.swift */,
715714
);
@@ -772,6 +771,7 @@
772771
3AA8155D2276E44100F5DB52 /* Web3+Methods.swift */,
773772
3AA8155E2276E44100F5DB52 /* Web3+Eth.swift */,
774773
3AA8155F2276E44100F5DB52 /* Web3+TxPool.swift */,
774+
60FFB09727F6455000DBC22B /* Web3+Options.swift */,
775775
3AA815602276E44100F5DB52 /* Web3+Structures.swift */,
776776
);
777777
path = Web3;
@@ -1349,7 +1349,7 @@
13491349
3AA815E92276E44100F5DB52 /* EthereumAddress.swift in Sources */,
13501350
3AA816072276E44100F5DB52 /* Web3+ERC1643.swift in Sources */,
13511351
3AA815DA2276E44100F5DB52 /* Web3+Eth.swift in Sources */,
1352-
60FFB09E27F6455000DBC22B /* TransactionOptions.swift in Sources */,
1352+
60FFB09E27F6455000DBC22B /* Web3+Options.swift in Sources */,
13531353
3AA816082276E44100F5DB52 /* Web3+ERC1644.swift in Sources */,
13541354
3AA815AB2276E44100F5DB52 /* ETHRegistrarController.swift in Sources */,
13551355
3A7EA3602280EB27005120C2 /* Decodable+Extensions.swift in Sources */,

0 commit comments

Comments
 (0)