Skip to content

Commit

Permalink
bug fix: re-include the approval amount extraction passing through to…
Browse files Browse the repository at this point in the history
… higher levels
  • Loading branch information
simonmcl committed Mar 20, 2024
1 parent 44b54b8 commit 70ef707
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/KukaiCoreSwift/Factories/OperationFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ public class OperationFactory {
switch entrypoint {
case OperationTransaction.StandardEntrypoint.approve.rawValue:
if let approveResponse = tokenIdAndAmountFromApproveMichelson(michelson: michelsonDict["value"] ?? [:]) {
return (rpcAmount: "0", tokenId: approveResponse.tokenId, destination: approveResponse.destination)
return (rpcAmount: approveResponse.rpcAmount, tokenId: approveResponse.tokenId, destination: approveResponse.destination)
} else {
return nil
}
Expand Down Expand Up @@ -667,15 +667,14 @@ public class OperationFactory {
for op in operations {
if let opTrans = op as? OperationTransaction, let details = tokenIdAndAmountFromMichelson(michelson: opTrans.parameters ?? [:]), let entrypoint = (opTrans.parameters?["entrypoint"] as? String) {

if details.rpcAmount == "0", (entrypoint == OperationTransaction.StandardEntrypoint.approve.rawValue || entrypoint == OperationTransaction.StandardEntrypoint.updateOperators.rawValue) {
if entrypoint == OperationTransaction.StandardEntrypoint.approve.rawValue || entrypoint == OperationTransaction.StandardEntrypoint.updateOperators.rawValue {

// If its an `approve` oepration or an `update_operators` hold onto the details for the next run
lastTokenIdAndAmountResults = details
lastTokenAddress = opTrans.destination

} else if let lastDetails = lastTokenIdAndAmountResults,
let lastTokenAddress = lastTokenAddress,
lastDetails.rpcAmount == "0",
(entrypoint != OperationTransaction.StandardEntrypoint.approve.rawValue && entrypoint != OperationTransaction.StandardEntrypoint.updateOperators.rawValue),
let knownOpDetails = tokenIdAndAmountFromMichelson(michelson: opTrans.parameters ?? [:]) {

Expand Down

0 comments on commit 70ef707

Please sign in to comment.