Skip to content

Commit

Permalink
Merge pull request #692 from nova-wallet/develop
Browse files Browse the repository at this point in the history
6.3.1 - Fix xcm to Statemine/Statemint
  • Loading branch information
ERussel authored May 31, 2023
2 parents b953867 + f77cb93 commit 53862f0
Show file tree
Hide file tree
Showing 37 changed files with 34 additions and 78 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "approve-with-pin.svg",
"filename" : "iconApproveWithPin.pdf",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "authentication.svg",
"filename" : "iconBiometricAuth.pdf",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Currency.pdf",
"filename" : "iconCurrency.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "iconPinCode.pdf",
"filename" : "iconPincode.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions novawallet/Common/Configs/ApplicationConfigs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ extension ApplicationConfig: ApplicationConfigProtocol {

var xcmTransfersURL: URL {
#if F_RELEASE
URL(string: "https://raw.githubusercontent.com/nova-wallet/nova-utils/master/xcm/v3/transfers.json")!
URL(string: "https://raw.githubusercontent.com/nova-wallet/nova-utils/master/xcm/v4/transfers.json")!
#else
URL(string: "https://raw.githubusercontent.com/nova-wallet/nova-utils/master/xcm/v3/transfers_dev.json")!
URL(string: "https://raw.githubusercontent.com/nova-wallet/nova-utils/master/xcm/v4/transfers_dev.json")!
#endif
}

Expand Down
3 changes: 2 additions & 1 deletion novawallet/Common/Ledger/SupportedLedgerApps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ extension SupportedLedgerApp {
SupportedLedgerApp(chainId: KnowChainId.nodle, coin: 1003, cla: 0x98, type: .substrate),
SupportedLedgerApp(chainId: KnowChainId.edgeware, coin: 523, cla: 0x94, type: .substrate),
SupportedLedgerApp(chainId: KnowChainId.polymesh, coin: 595, cla: 0x91, type: .substrate),
SupportedLedgerApp(chainId: KnowChainId.xxNetwork, coin: 1955, cla: 0xA3, type: .substrate)
SupportedLedgerApp(chainId: KnowChainId.xxNetwork, coin: 1955, cla: 0xA3, type: .substrate),
SupportedLedgerApp(chainId: KnowChainId.astar, coin: 810, cla: 0xA9, type: .substrate)
]
}

Expand Down
1 change: 1 addition & 0 deletions novawallet/Common/Model/KnownChainIds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum KnowChainId {
static let polymesh = "6fbd74e5e1d0a61d52ccfe9d4adaed16dd3a7caa37c6bc4d0c2fa12e8b2f4063"
static let centrifuge = "b3db41421702df9a7fcac62b53ffeac85f7853cc4e689e0b93aeb3db18c09d82"
static let xxNetwork = "50dd5d206917bf10502c68fb4d18a59fc8aa31586f4e8856b493e43544aa82aa"
static let astar = "9eb76c5184c4ab8679d2d5d819fdf90b9c001403e9e17da2e14b6d8aec4029c6"
static let kiltPelegrine = "a0c6e3bac382b316a68bca7141af1fba507207594c761076847ce358aeedcc21"
static let kiltSpiritnet = "411f057b9107718c9624d6aa4a3f23c1653898297f3d4d529d9bb6511a39dd21"
static let moonbeam = "fe58ea77779b7abda7da4ec526d14db9b1e9cd40a217c34892af80a9b332b76d"
Expand Down
2 changes: 1 addition & 1 deletion novawallet/Common/Model/Xcm/XcmTransferFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ final class XcmTransferFactory {
case Xcm.Instruction.fieldReserveAssetDeposited:
return .reserveAssetDeposited([asset])
case Xcm.Instruction.fieldBuyExecution:
let value = Xcm.BuyExecutionValue(fees: asset, weightLimit: .limited(weight: .init(value: 0)))
let value = Xcm.BuyExecutionValue(fees: asset, weightLimit: .unlimited)
return .buyExecution(value)
case Xcm.Instruction.fieldDepositAsset:
let value = Xcm.DepositAssetValue(assets: .wild(.all), maxAssets: 1, beneficiary: destination)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,46 +160,30 @@ extension XcmTransferService {
dependingOn moduleResolutionOperation: BaseOperation<String>,
callPathFactory: @escaping (String) -> CallCodingPath,
destinationAssetOperation: BaseOperation<XcmMultilocationAsset>,
maxWeight: BigUInt,
runtimeProvider: RuntimeProviderProtocol
maxWeight _: BigUInt,
runtimeProvider _: RuntimeProviderProtocol
) -> CompoundOperationWrapper<(ExtrinsicBuilderClosure, CallCodingPath)> {
let coderFactoryOperation = runtimeProvider.fetchCoderFactoryOperation()

let mapOperation = ClosureOperation<(ExtrinsicBuilderClosure, CallCodingPath)> {
let module = try moduleResolutionOperation.extractNoCancellableResultData()
let codingFactory = try coderFactoryOperation.extractNoCancellableResultData()
let destinationAsset = try destinationAssetOperation.extractNoCancellableResultData()

let (destination, beneficiary) = destinationAsset.location.separatingDestinationBenifiary()
let assets = Xcm.VersionedMultiassets(versionedMultiasset: destinationAsset.asset)

let callPath = callPathFactory(module)

let argName = Xcm.PalletTransferCall.CodingKeys.weightLimit.rawValue
let optWeight = try BlockchainWeightFactory.convertCallVersionedWeightInWeightLimitToJson(
for: .init(path: callPath, argName: argName),
codingFactory: codingFactory,
weight: UInt64(maxWeight)
)

guard let weight = optWeight else {
throw XcmTransferServiceError.noArgumentFound(argName)
}

let call = Xcm.PalletTransferCall(
destination: destination,
beneficiary: beneficiary,
assets: assets,
feeAssetItem: 0,
weightLimit: .limited(weight: weight)
weightLimit: .unlimited
)

return ({ try $0.adding(call: call.runtimeCall(for: callPath)) }, callPath)
}

mapOperation.addDependency(coderFactoryOperation)

return CompoundOperationWrapper(targetOperation: mapOperation, dependencies: [coderFactoryOperation])
return CompoundOperationWrapper(targetOperation: mapOperation)
}

private func createOrmlTransferMapping(
Expand Down
14 changes: 1 addition & 13 deletions novawallet/Common/Substrate/Calls/Xcm/XcmOrmlTransfer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,10 @@ extension Xcm {

return ({ try $0.adding(call: call.runtimeCall(for: module)) }, path)
} else {
let paramNameV2 = OrmlTransferCallV2.CodingKeys.destinationWeightLimit.rawValue

let optWeightJson = try BlockchainWeightFactory.convertCallVersionedWeightInWeightLimitToJson(
for: .init(path: path, argName: paramNameV2),
codingFactory: codingFactory,
weight: UInt64(weight)
)

guard let weightJson = optWeightJson else {
throw XcmTransferServiceError.noArgumentFound(paramNameV2)
}

let call = OrmlTransferCallV2(
asset: asset,
destination: destination,
destinationWeightLimit: .limited(weight: weightJson)
destinationWeightLimit: .unlimited
)

return ({ try $0.adding(call: call.runtimeCall(for: module)) }, path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension Xcm {
switch self {
case .unlimited:
try container.encode(WeightLimitFields.unlimited)
try container.encode(JSON.null)
case let .limited(weight):
try container.encode(WeightLimitFields.limited)
try container.encode(weight)
Expand Down
2 changes: 1 addition & 1 deletion novawallet/Modules/Settings/ViewModel/SettingsRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ extension SettingsRow {
case .approveWithPin:
return R.image.iconApproveWithPin()
case .changePin:
return R.image.iconPinCode()
return R.image.iconPincode()
case .telegram:
return R.image.iconTelegram()
case .youtube:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ extension ControllerAccountInteractor: StakingLocalStorageSubscriber, StakingLoc

if let stashId = maybeStashId, let controllerId = maybeControllerId {
balanceProvider = subscribeToAssetBalanceProvider(
for: controllerId,
for: stashId,
chainId: chainAsset.chain.chainId,
assetId: chainAsset.asset.assetId
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ final class CrowdloanContributionConfirmViewLayout: UIView {
}

let view = TitleValueView()
view.titleLabel.apply(style: .footnotePrimary)
view.valueLabel.apply(style: .footnotePrimary)
view.titleLabel.text = R.string.localizable.crowdloanReward(preferredLanguages: locale.rLanguages)

contentView.stackView.insertArrangedSubview(view, at: leasingPeriodIndex + 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ class CrowdloanContributionSetupViewLayout: UIView {

private(set) var rewardDestinationAccountView: CrowdloanRewardDestinationView?

let networkFeeView = NetworkFeeView()
let networkFeeView: NetworkFeeView = .create { view in
view.style = .init(
titleColor: R.color.colorTextPrimary()!,
titleFont: .regularFootnote,
tokenColor: R.color.colorTextPrimary()!,
tokenFont: .regularFootnote,
fiatColor: R.color.colorTextSecondary()!,
fiatFont: .regularFootnote
)
}

private(set) var estimatedRewardView: TitleValueView?

Expand Down Expand Up @@ -229,6 +238,8 @@ class CrowdloanContributionSetupViewLayout: UIView {
}

let view = TitleValueView()
view.titleLabel.apply(style: .footnotePrimary)
view.valueLabel.apply(style: .footnotePrimary)
view.titleLabel.text = R.string.localizable.crowdloanReward(preferredLanguages: locale.rLanguages)

contentView.stackView.insertArrangedSubview(view, at: leasingPeriodIndex + 1)
Expand Down
4 changes: 2 additions & 2 deletions novawallet/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@
"with.yield.boost" = "with Yield Boost";
"without.yield.boost" = "without Yield Boost";
"common.no.changes" = "No changes";
"common.not.enough.fee.message_v3.8.0" = "You don’t have enough balance to pay the network fee of %@.\nAvailable balance to pay fee after operation: %@";
"common.not.enough.fee.message_v3.8.0" = "You don’t have enough balance to pay the network fee of %@.\nAvailable balance to pay fee after operation: %@";
"yield.boost.not.enough.execution.fee.message" = "You don’t have enough balance to pay the network fee of %@ and the yield boost execution fee of %@.\nAvailable balance to pay the fee: %@";
"yield.boost.not.enough.execution.fee.title" = "Not enough tokens to pay first execution fee";
"yield.boost.not.enough.threshold.message" = "You don’t have enough balance to pay the network fee of %@ and not drop below the threshold %@.\nAvailable balance to pay the fee: %@";
Expand Down Expand Up @@ -1240,4 +1240,4 @@
"governance.referendums.search.empty" = "No referenda with entered title or ID\nwere found";
"governance.referendums.settings.title" = "Referenda";
"wallet.send.recipient.blocked.title" = "Recipient cannot accept transfer";
"wallet.send.recipient.blocked.message" = "Recipient has been blocked by token owner and cannot currently accept incoming transfers";
"wallet.send.recipient.blocked.message" = "Recipient has been blocked by token owner and cannot currently accept incoming transfers";

0 comments on commit 53862f0

Please sign in to comment.