Skip to content

Commit

Permalink
Add support for Contract Deploy action in Ton blockchain
Browse files Browse the repository at this point in the history
  • Loading branch information
ealymbaev committed Sep 6, 2024
1 parent 17d7405 commit d52a604
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TonEventConverter {
case let .jettonMint(action):
return .unsupported(type: "Jetton Mint")
case let .contractDeploy(action):
return .unsupported(type: "Contract Deploy")
return .contractDeploy(interfaces: action.interfaces)
case let .jettonSwap(action):
return .unsupported(type: "Jetton Swap")
case let .smartContract(action):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TonTransactionRecord: TransactionRecord {
switch action.type {
case let .send(value, _, _, _): return value
case let .receive(value, _, _): return value
case .unsupported: return nil
default: return nil
}
}

Expand All @@ -52,6 +52,7 @@ extension TonTransactionRecord {
enum `Type` {
case send(value: TransactionValue, to: String, sentToSelf: Bool, comment: String?)
case receive(value: TransactionValue, from: String, comment: String?)
case contractDeploy(interfaces: [String])
case unsupported(type: String)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TransactionInfoService {
switch action.type {
case let .send(value, _, _, _): tokens.append(value.token)
case let .receive(value, _, _): tokens.append(value.token)
case .unsupported: ()
default: ()
}
}
tokens.append(tx.fee?.token)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ class TransactionInfoViewItemFactory {
}
case let .receive(value, from, comment):
sections.append(.init(receiveSection(source: record.source, transactionValue: value, from: from, rates: item.rates, memo: comment, status: action.status, balanceHidden: balanceHidden)))
case let .contractDeploy(interfaces):
sections.append(.init([
.actionTitle(iconName: nil, iconDimmed: false, title: "transactions.contract_deploy".localized, subTitle: interfaces.joined(separator: ", "))
]))
case let .unsupported(type):
sections.append(.init([.fee(title: "Action", value: type)]))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,10 @@ class TransactionsViewItemFactory {
if let currencyValue = item.currencyValue {
secondaryValue = BaseTransactionsViewModel.Value(text: currencyString(from: currencyValue), type: .secondary)
}
case let .contractDeploy(interfaces):
iconType = .localIcon(imageName: item.record.source.blockchainType.iconPlain32)
title = "transactions.contract_deploy".localized
subTitle = interfaces.joined(separator: ", ")
case let .unsupported(type):
iconType = .localIcon(imageName: item.record.source.blockchainType.iconPlain32)
title = "transactions.ton_transaction.title".localized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@
"transactions.contract_call" = "Contract Call";
"transactions.contract_creation" = "Contract Creation";
"transactions.external_call" = "External Call";
"transactions.contract_deploy" = "Contract Deploy";

"transactions.to" = "To %@";
"transactions.from" = "From %@";
Expand Down

0 comments on commit d52a604

Please sign in to comment.