diff --git a/Sources/KukaiCoreSwift/Factories/OperationFactory.swift b/Sources/KukaiCoreSwift/Factories/OperationFactory.swift index 72b2307f..410e281b 100644 --- a/Sources/KukaiCoreSwift/Factories/OperationFactory.swift +++ b/Sources/KukaiCoreSwift/Factories/OperationFactory.swift @@ -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 diff --git a/Tests/KukaiCoreSwiftTests/Factories/OperationFactoryTests.swift b/Tests/KukaiCoreSwiftTests/Factories/OperationFactoryTests.swift index 7a9c19bb..915c4bd6 100644 --- a/Tests/KukaiCoreSwiftTests/Factories/OperationFactoryTests.swift +++ b/Tests/KukaiCoreSwiftTests/Factories/OperationFactoryTests.swift @@ -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 ?? "-") } @@ -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 ?? "-") }