-
Notifications
You must be signed in to change notification settings - Fork 33
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-7349 [Staking] Send input token and public key in several requests #3666
Conversation
@@ -64,13 +64,17 @@ struct CommonWalletModelsFactory { | |||
) | |||
} | |||
|
|||
func makeStakingManager(tokenItem: TokenItem, address: String) -> StakingManager? { | |||
func makeStakingManager(publicKey: Data, tokenItem: TokenItem, address: String) -> StakingManager? { |
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.
publicKey кладется в additionalAddresses -> cosmosPubKey
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.
в интерфейсах запросов стало слишком много параметров, вынес в отдельную сущность
@@ -9,15 +9,15 @@ | |||
import Foundation | |||
|
|||
public struct StakingBalanceInfo: Hashable { | |||
public let item: StakingTokenItem | |||
public let item: StakingToken |
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.
разбил сущность StakingTokenItem на StakingToken (парсится из yield модельки) и StakingTokenItem (может быть создан локально, например в TokenItem+StakingTokenItem.swift), а то была путаница
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.
А вот думаю надо ли? По факту мы спокойно можем создать StakingToken
из TokenItem
в TokenItem+StakingTokenItem.swift
да и все
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.
вроде получилось
guard let network = StakeKitNetworkType(rawValue: token.network) else { | ||
throw StakeKitMapperError.noData("StakeKitNetworkType not found") | ||
} | ||
|
||
return StakingTokenItem(network: network, contractAddress: token.address) | ||
return StakingToken( |
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.
парсим всю модельку чтобы отправить в estimate-gas или exit/enter
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.
я так сделал сначала но потом запнулся на TokenItem+StakingTokenItem.swift, там не понятно как создавать
func additionalAddresses() -> AdditionalAddresses? { | ||
switch wallet.item.network { | ||
case .cosmos: | ||
guard let publicKey = wallet.publicKey, |
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.
нужно конвертнуть в base64
network: tokenItem.network.rawValue, | ||
name: tokenItem.name, | ||
decimals: tokenItem.decimals, | ||
address: tokenItem.contractAddress, | ||
symbol: tokenItem.symbol, | ||
logoURI: nil |
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.
А stake kit прям все параметры нужны? Может там без name и без decimals можно?
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.
окей)
|
||
public init(item: StakingTokenItem, address: String) { | ||
public init(item: StakingTokenItem, address: String, publicKey: Data? = nil) { |
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.
убрал
validator: String, | ||
integrationId: String | ||
) async throws -> Decimal { | ||
func estimateStakeFee(params: StakingActionRequestParams) async throws -> Decimal { |
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.
У нас тут конфликты будут конечно, но я думаю мой пулл после будет, подолью
StakingTokenItem(network: .solana, contractAddress: nil, name: "Solana", decimals: 9, symbol: "SOL"), | ||
StakingTokenItem(network: .cosmos, contractAddress: nil, name: "Cosmos", decimals: 6, symbol: "ATOM"), | ||
StakingTokenItem(network: .ethereum, contractAddress: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", name: "Ethereum", decimals: 18, symbol: "ETH"), |
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.
блин, тут конечно не очень красиво получилось, ну ок
Добавил параметры inputToken и publicKey в запросы на action и estimate gas, оказались обязательными для cosmos.
Пр по космосу в бсдк: