Skip to content

Commit

Permalink
bug fix extractor for objkt bid
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Mar 20, 2024
1 parent 8611ceb commit 6e6256e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/KukaiCoreSwift/Factories/OperationFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public class OperationFactory {
*/
public static func tokenAmountFromBidMichelson(michelson: Any) -> Decimal? {
if let michelsonDict = michelson as? [String: Any] {
let tokenAmount = michelsonDict.michelsonArgsArray()?.michelsonInt(atIndex: 0)
let tokenAmount = michelsonDict.michelsonArgsArray()?.michelsonPair(atIndex: 1)?.michelsonArgsArray()?.michelsonInt(atIndex: 0)

return Decimal(string: tokenAmount ?? "0") ?? 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ class OperationFactoryTests: XCTestCase {

let details1 = OperationFactory.Extractor.firstNonZeroTokenTransferAmount(operations: jsonOperations)
XCTAssert(details1?.tokenContract == "KT1TjnZYs5CGLbmV6yuW169P8Pnr9BiVwwjz", details1?.tokenContract ?? "-")
XCTAssert(details1?.rpcAmount == "2004532", details1?.rpcAmount ?? "-")
XCTAssert(details1?.rpcAmount == "201000000", details1?.rpcAmount ?? "-")
XCTAssert(details1?.tokenId == nil, details1?.tokenId?.description ?? "-")
XCTAssert(details1?.destination == "KT18iSHoRW1iogamADWwQSDoZa3QkN4izkqj", details1?.destination ?? "-")
}
Expand All @@ -714,7 +714,7 @@ class OperationFactoryTests: XCTestCase {

let details1 = OperationFactory.Extractor.firstNonZeroTokenTransferAmount(operations: jsonOperations)
XCTAssert(details1?.tokenContract == "KT1TjnZYs5CGLbmV6yuW169P8Pnr9BiVwwjz", details1?.tokenContract ?? "-")
XCTAssert(details1?.rpcAmount == "2004532", details1?.rpcAmount ?? "-")
XCTAssert(details1?.rpcAmount == "201000000", details1?.rpcAmount ?? "-")
XCTAssert(details1?.tokenId == nil, details1?.tokenId?.description ?? "-")
XCTAssert(details1?.destination == "KT18iSHoRW1iogamADWwQSDoZa3QkN4izkqj", details1?.destination ?? "-")
}
Expand Down

0 comments on commit 6e6256e

Please sign in to comment.