Skip to content

Commit 54dcc0b

Browse files
authored
fix crash abi parsing
key payable is nil and not defined for any functions
1 parent c6f072e commit 54dcc0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/web3swift/EthereumABI/ABIParsing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fileprivate func parseFunction(abiRecord:ABI.Record) throws -> ABI.Element.Funct
7575
let abiOutputs = outputs != nil ? outputs! : [ABI.Element.InOut]()
7676
let name = abiRecord.name != nil ? abiRecord.name! : ""
7777
let payable = abiRecord.stateMutability != nil ?
78-
(abiRecord.stateMutability == "payable" || abiRecord.payable!) : false
78+
(abiRecord.stateMutability == "payable" || abiRecord.payable ?? false) : false
7979
let constant = (abiRecord.constant == true || abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure")
8080
let functionElement = ABI.Element.Function(name: name, inputs: abiInputs, outputs: abiOutputs, constant: constant, payable: payable)
8181
return functionElement

0 commit comments

Comments
 (0)