Skip to content
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-7779 Add TransactionBuilder #817

Merged

Conversation

amuraveinik
Copy link
Contributor

@amuraveinik amuraveinik commented Aug 29, 2024

@amuraveinik amuraveinik requested review from tureck1y, dbaturin and a team as code owners August 29, 2024 16:30
@amuraveinik amuraveinik requested review from skibinalexander and Balashov152 and removed request for a team August 29, 2024 16:31
@amuraveinik amuraveinik marked this pull request as draft August 29, 2024 16:31
@amuraveinik amuraveinik marked this pull request as ready for review August 30, 2024 10:03
@amuraveinik amuraveinik changed the title IOS-7718 Add TransactionBuilder IOS-7779 Add TransactionBuilder Aug 30, 2024

func buildForSign(transaction: Transaction, nonce: UInt64) throws -> Data {
guard let feeParameters = transaction.fee.parameters as? FilecoinFeeParameters else {
throw WalletError.failedToBuildTx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прикольно еще было бы поменять FilecoinTransactionBuilderError.filecoinFeeParametersNotFound что бы если что проще искать было, в чем проблема, а то WalletError.failedToBuildTx много где используется

throw WalletError.failedToBuildTx
}

return try JSONDecoder().decode(FilecoinSignedTransactionBody.self, from: jsonData)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А там в API прям json будет уходить? обычно просто длинная hex строка

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feeParameters: FilecoinFeeParameters
) throws -> FilecoinSigningInput {
guard let value = transaction.amount.bigUIntValue else {
throw WalletError.failedToBuildTx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и тут тоже, ну во всех местах лучше бы FilecoinTransactionBuilderError юзать)

siblockchaina
siblockchaina previously approved these changes Aug 30, 2024
Base automatically changed from feature/IOS-7718_filecoin_network_provider to blockchains/filecoin August 30, 2024 12:02
@amuraveinik amuraveinik dismissed siblockchaina’s stale review August 30, 2024 12:02

The base branch was changed.

struct FilecoinFeeParameters: FeeParameters {
let gasUnitPrice: BigUInt
let gasLimit: Int64
let gasPremium: BigUInt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По поводу типов данных - я провалидирую корректность в следующем PRе (про WalletManager)

@amuraveinik
Copy link
Contributor Author

@tureck1y @skibinalexander Влить бы задачку.

input.gasLimit = feeParameters.gasLimit
input.gasPremium = feeParameters.gasPremium.serialize()

input.publicKey = try Secp256k1Key(with: wallet.publicKey.blockchainKey).decompress()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Лучше декомпресснуть один раз и положить в параметры класса

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил в следующем PR
#818 (comment)

import XCTest
@testable import BlockchainSdk

final class FilecoinTransactionBuilderTests: XCTestCase {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не увидел теста на размер транзакции, хоть и секп все равно его надо делать

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Пофиксил в следующем PR
#818 (comment)

@amuraveinik
Copy link
Contributor Author

@siblockchaina Поставь повторно пожалуйста аппрув, слетел после допушиваний

@amuraveinik amuraveinik merged commit d656558 into blockchains/filecoin Sep 3, 2024
1 check passed
@amuraveinik amuraveinik deleted the feature/IOS-7718_filecoin_transaction_builder branch September 3, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants