Skip to content

Commit 9b04656

Browse files
committed
Added EthereumParameters struct
1 parent 09ed07f commit 9b04656

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Package: web3swift
2+
// Created by Alex Vlasov.
3+
// Copyright © 2018 Alex Vlasov. All rights reserved.
4+
//
5+
// Additions for new transaction types by Mark Loit 2022
6+
7+
import Foundation
8+
import BigInt
9+
10+
/// Structure capable of carying the parameters for any transaction type.
11+
/// while all fields in this struct are optional, they are not necessarily
12+
/// optional for the type of transaction they apply to.
13+
public struct EthereumParameters {
14+
15+
/// signifies the transaction type that this payload is for
16+
/// indicates what fields should be populated.
17+
/// this should always be set to give an idea of what other fields to expect
18+
public var type: TransactionType?
19+
20+
/// the destination, or contract, address for the transaction
21+
public var to: EthereumAddress?
22+
23+
/// the nonce for the transaction
24+
public var nonce: BigUInt?
25+
26+
/// the chainId that transaction is targeted for
27+
/// should be set for all types, except some Legacy transactions (Pre EIP-155)
28+
/// will not have this set
29+
public var chainID: BigUInt?
30+
31+
/// the native value of the transaction
32+
public var value: BigUInt?
33+
34+
/// any additional data for the transaction
35+
public var data: Data?
36+
37+
/// the max number of gas units allowed to process this transaction
38+
public var gasLimit: BigUInt?
39+
40+
/// the price per gas unit for the tranaction (Legacy and EIP-2930 only)
41+
public var gasPrice: BigUInt?
42+
43+
/// the max base fee per gas unit (EIP-1559 only)
44+
/// this value must be >= baseFee + maxPriorityFeePerGas
45+
public var maxFeePerGas: BigUInt?
46+
47+
/// the maximum tip to pay the miner (EIP-1559 only)
48+
public var maxPriorityFeePerGas: BigUInt?
49+
50+
/// access list for contract execution (EIP-2930 and EIP-1559 only)
51+
public var accessList: [AccessListEntry]?
52+
}

web3swift.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@
189189
5CF7E8BA276B79380009900F /* web3swiftGanacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF7E8B5276B79380009900F /* web3swiftGanacheTests.swift */; };
190190
5CF7E8BB276B79380009900F /* web3swiftENSTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF7E8B6276B79380009900F /* web3swiftENSTests.swift */; };
191191
5CF7E8BC276B79380009900F /* web3swiftWebsocketTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF7E8B7276B79380009900F /* web3swiftWebsocketTests.swift */; };
192+
6038B36427FE0B3500E4E22E /* EthereumParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6038B36327FE0B3500E4E22E /* EthereumParameters.swift */; };
192193
604FA4FF27ECBDC80021108F /* DataConversionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 604FA4FE27ECBDC80021108F /* DataConversionTests.swift */; };
193194
60FFB09D27F6455000DBC22B /* EIP1559Envelope.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09627F6455000DBC22B /* EIP1559Envelope.swift */; };
194195
60FFB09E27F6455000DBC22B /* Web3+Options.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60FFB09727F6455000DBC22B /* Web3+Options.swift */; };
@@ -417,6 +418,7 @@
417418
5CF7E8B5276B79380009900F /* web3swiftGanacheTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = web3swiftGanacheTests.swift; sourceTree = "<group>"; };
418419
5CF7E8B6276B79380009900F /* web3swiftENSTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = web3swiftENSTests.swift; sourceTree = "<group>"; };
419420
5CF7E8B7276B79380009900F /* web3swiftWebsocketTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = web3swiftWebsocketTests.swift; sourceTree = "<group>"; };
421+
6038B36327FE0B3500E4E22E /* EthereumParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthereumParameters.swift; sourceTree = "<group>"; };
420422
604FA4FE27ECBDC80021108F /* DataConversionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataConversionTests.swift; sourceTree = "<group>"; };
421423
60FFB09627F6455000DBC22B /* EIP1559Envelope.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EIP1559Envelope.swift; sourceTree = "<group>"; };
422424
60FFB09727F6455000DBC22B /* Web3+Options.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Web3+Options.swift"; sourceTree = "<group>"; };
@@ -713,6 +715,7 @@
713715
60FFB09C27F6455000DBC22B /* LegacyEnvelope.swift */,
714716
3AA8153D2276E44100F5DB52 /* BloomFilter.swift */,
715717
3AA8153F2276E44100F5DB52 /* EthereumTransaction.swift */,
718+
6038B36327FE0B3500E4E22E /* EthereumParameters.swift */,
716719
);
717720
path = Transaction;
718721
sourceTree = "<group>";
@@ -1283,6 +1286,7 @@
12831286
isa = PBXSourcesBuildPhase;
12841287
buildActionMask = 2147483647;
12851288
files = (
1289+
6038B36427FE0B3500E4E22E /* EthereumParameters.swift in Sources */,
12861290
3AA815CF2276E44100F5DB52 /* Web3+Eth+Websocket.swift in Sources */,
12871291
3A7EA35E2280EA9A005120C2 /* Encodable+Extensions.swift in Sources */,
12881292
3AA815D22276E44100F5DB52 /* Web3+JSONRPC.swift in Sources */,

0 commit comments

Comments
 (0)