-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOS-7738 Add WalletManager #818
IOS-7738 Add WalletManager #818
Conversation
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ansaction_builder
…ture/IOS-7738_filecoin_wallet_manager
/// However, in Filecoin, message IDs (which are used to identify transactions) are not derived from transaction hashes. | ||
/// Therefore, constructing a URL in the format `"\(baseExplorerUrl)/message/\(hash)"` is not applicable. | ||
nil | ||
URL(string: "\(baseExplorerUrl)/message/\(hash)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По этому пункту поступила обновленная информация от андроида
let gasLimit: Int64 | ||
let gasFeeCap: BigUInt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Просто переименование, чтобы матчилось с тем что приходит с апишки
// // https://github.com/tangem/wallet-core/blob/996bd5ab37f27e7f6e240a4ec9d0788dfb124e89/src/PublicKey.h#L35 | ||
let v = BigUInt(unmarshal.v) - 27 | ||
let encodedV = v == .zero ? Data([UInt8.zero]) : v.serialize() | ||
let signature = unmarshal.r + unmarshal.s + encodedV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
здесь скорее всего просто unmarshal
должно хватить, так как EIP-155
как будто не валиден для Filecoin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно так как сейчас, иначе не проходит валидация подписи
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил ниже по комментам Андрея Ф
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BlockchainSdk/Blockchains/Filecoin/FilecoinTransactionBuilder.swift
Outdated
Show resolved
Hide resolved
let message = FilecoinMessage( | ||
from: wallet.address, | ||
to: destination, | ||
value: bigUIntValue.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А у biguint нет какого-нибудь метода для перегона в строку?
description
все-таки для другого и его формат недедтерминирован
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По моему эта проперти специально для этого и предназначена
extension BigUInt: CustomStringConvertible {
/// Return the decimal representation of this integer.
public var description: String {
return String(self, radix: 10)
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вообще сериализация использовалась, а тут надо именно строку в десятичном формате?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В десятичном виде нужна
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Явно вызывать String(self, radix: 10)
выглядит корректней, на этот конструктор наверняка написаны тесты и т.д.
А description
нужен по сути только для того, чтобы в логах распечатать и его реализация не гарантируется
Ну и оффдока:
Accessing a type’s description property directly or using CustomStringConvertible as a generic constraint is discouraged.
Впрочем не крит
BlockchainSdk/Blockchains/Filecoin/Network/DTO/FilecoinResponse.swift
Outdated
Show resolved
Hide resolved
Не в полной мере актуальны комменты здесь
Возвращается тип - строка. В FilecoinAccountInfo (это там где balance: Decimal) значение из апишики сразу не парсится, оно как раз маппится в нетворк сервисе. Отдельно заводить маппер на однострочную операцию показалось оверкиллом
Самого этого запроса больше нет, поменял на другой. Из апишки возвращается строка, паршу ее в Decimal. attoFIL да |
@m3g0byt3 Про пендинг. Почему то не получилось к тому сообщение прилинковать ответ. Вообще в доке есть метод MpoolCheckPendingMessages, и он идеально бы подошел Но апишка на запрос всегда возвращает ошибку the method Filecoin.MpoolCheckPendingMessages does not exist/is not available Предлагаю пока что оставить как есть до момента пока явно не будет сказано для файлкоина сделать возможность параллельной отправки |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно QA попросить сделать смоук вичейна
FilecoinMessage( | ||
from: address, | ||
to: destination, | ||
value: bigUIntValue.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
точно description
? не надо там serialized()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Выше про это
#818 (comment)
/// VeChain is a fork of `Geth Classic`, so it expects the secp256k1's `recid` to have values in the 0...3 range. | ||
/// Therefore we have to convert value of the standard secp256k1's `recid` to match this expectation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: теперь этот коммент и объяснения в нем скорее к самой утилите SignatureUtils относится, офк без упоминания там VeChain
А просто что есть некоторые такие блокчейны, для которых нужно делать SignatureUtils.unmarshalledSignature
walletManager.wallet.addPendingTransaction(record) | ||
return TransactionSendResult(hash: txId) | ||
} | ||
.eraseSendError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кажется tx_id нужен в SendError
, а тут он теряется
В остальных блокчейнах же не случайно делалась эта доработка, чтобы SendError
содержал хеш транзы
Я приложил в прошлом комменте оба метода в экстеншене, другие сети сначала маппят в SendError
с сохранением tx_id через mapSendError
А уже затем эрайзят через eraseSendError
@skibinalexander @tureck1y должны быть в контексте, зачем в SendError
кладется хэш
let message = FilecoinMessage( | ||
from: wallet.address, | ||
to: destination, | ||
value: bigUIntValue.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Явно вызывать String(self, radix: 10)
выглядит корректней, на этот конструктор наверняка написаны тесты и т.д.
А description
нужен по сути только для того, чтобы в логах распечатать и его реализация не гарантируется
Ну и оффдока:
Accessing a type’s description property directly or using CustomStringConvertible as a generic constraint is discouraged.
Впрочем не крит
81e9368
.flatMap { walletManager, message in | ||
walletManager.networkService | ||
.submitTransaction(signedMessage: message) | ||
.mapSendError(tx: try? JSONEncoder().encode(message).utf8String) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут именно так, потому что в апишку отправляем json объект, а не любого иного рода строку
@@ -9,6 +9,24 @@ | |||
import TangemSdk | |||
|
|||
enum SignatureUtils { | |||
/// Unmarshals a signature using the provided original signature, public key, and hash. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это все будет полностью переделано в будущем и перенесено в TangemSdk
IOS-7738
TODO: Учесть комменты отсюда ✅