Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Commit 0c759e5

Browse files
authored
Merge pull request #234 from zeriontech/feature/addEthContractCallConstructor
Add EthContractCallBytes constructor, which accepts custom gasPrice
2 parents 2e6fbec + 8a57972 commit 0c759e5

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

Web3Swift/TransactionBytes/EthContractCallBytes.swift

+34-5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,40 @@ public final class EthContractCallBytes: BytesScalar {
6666
contractAddress: BytesScalar,
6767
weiAmount: BytesScalar,
6868
functionCall: BytesScalar
69+
) {
70+
let gasPrice = CachedBytes(
71+
origin: EthGasPrice(
72+
network: network
73+
)
74+
)
75+
self.init(
76+
network: network,
77+
gasPrice: gasPrice,
78+
senderKey: senderKey,
79+
contractAddress: contractAddress,
80+
weiAmount: weiAmount,
81+
functionCall: functionCall
82+
)
83+
}
84+
85+
/**
86+
Ctor
87+
88+
- parameters:
89+
- network: network where transaction is to be deployed
90+
- gasPrice: gas price in Wei
91+
- senderKey: private key of a sender
92+
- contractAddress: address of the recipient contract
93+
- weiAmount: amount to be sent in wei
94+
- functionCall: encoded function call
95+
*/
96+
public convenience init(
97+
network: Network,
98+
gasPrice: BytesScalar,
99+
senderKey: PrivateKey,
100+
contractAddress: BytesScalar,
101+
weiAmount: BytesScalar,
102+
functionCall: BytesScalar
69103
) {
70104
let senderAddress = CachedBytes(
71105
origin: SimpleBytes{
@@ -75,11 +109,6 @@ public final class EthContractCallBytes: BytesScalar {
75109
let contractAddress = CachedBytes(
76110
origin: contractAddress
77111
)
78-
let gasPrice = CachedBytes(
79-
origin: EthGasPrice(
80-
network: network
81-
)
82-
)
83112
let functionCall = CachedBytes(
84113
origin: functionCall
85114
)

0 commit comments

Comments
 (0)