Skip to content

Commit 9956520

Browse files
authored
Merge pull request #1787 from novasamatech/fix/revert-proxy-batch-changes
Revert "Merge pull request #1778 from novasamatech/fix/proxy-batch-bu…
2 parents 486d411 + c7049d3 commit 9956520

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

novawallet/Common/Services/ExtrinsicService/Substrate/ExtrinsicSenderResolution/DelegationResolution/ProxyResolutionCallWrapper.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ class ProxyResolutionCallWrapper: DelegationResolutionCallWrapper {
1818
}
1919

2020
/*
21-
* For proxy the implementation creates batch with original calls and then wraps it with proxy.proxy.
22-
* The logic is the same for every platform.
21+
* For proxy the implementation wraps with proxy.proxy original calls and
22+
* then creates a batch of them. That is valid since all wrapped calls
23+
* share the same set of proxy types and can be dispatched from the single origin
24+
* provided by the batch call.
2325
*/
2426
override func reduceCallsIntoSingle(
2527
using solution: DelegationResolution.PathFinderResult,
@@ -47,26 +49,24 @@ class ProxyResolutionCallWrapper: DelegationResolutionCallWrapper {
4749
)
4850
}
4951

50-
let newBuilder = try builder
51-
.batchingCalls(with: coderFactory.metadata)
52-
.wrappingCalls { callJson in
53-
let call = try callJson.map(to: RuntimeCall<NoRuntimeArgs>.self, with: context.toRawContext())
54-
let callPath = CallCodingPath(moduleName: call.moduleName, callName: call.callName)
52+
let newBuilder = try builder.wrappingCalls { callJson in
53+
let call = try callJson.map(to: RuntimeCall<NoRuntimeArgs>.self, with: context.toRawContext())
54+
let callPath = CallCodingPath(moduleName: call.moduleName, callName: call.callName)
5555

56-
guard
57-
let delegatePath = solution.callToPath[callPath],
58-
let component = delegatePath.components.first else {
59-
return callJson
60-
}
61-
62-
return try component.delegationValue.wrapCall(
63-
callJson,
64-
delegatedAccountId: delegatedAccount.accountId,
65-
delegateAccountId: component.account.chainAccount.accountId,
66-
context: context
67-
)
56+
guard
57+
let delegatePath = solution.callToPath[callPath],
58+
let component = delegatePath.components.first else {
59+
return callJson
6860
}
6961

62+
return try component.delegationValue.wrapCall(
63+
callJson,
64+
delegatedAccountId: delegatedAccount.accountId,
65+
delegateAccountId: component.account.chainAccount.accountId,
66+
context: context
67+
)
68+
}.batchingCalls(with: coderFactory.metadata)
69+
7070
let remainedComponents = Array(delegatedPath.components.dropFirst(1))
7171

7272
return ReduceResult(

0 commit comments

Comments
 (0)