-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add derives for transfer #6799
base: master
Are you sure you want to change the base?
add derives for transfer #6799
Conversation
This pull request introduces 1 alert when merging 203ce60 into 2eea385 - view on LGTM.com new alerts:
|
Signed-off-by: Gregory Hill <[email protected]>
203ce60
to
75fa6ce
Compare
This pull request introduces 1 alert when merging 75fa6ce into 2eea385 - view on LGTM.com new alerts:
|
if (!api) { | ||
return; | ||
} |
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.
Even though there is a check for the api
not to be undefined before calling this function, unless this if
is added the app crashes
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.
The signature for all derives are -
// ReturnType is here for illustrative purposes
type ReturnType = string;
function myDerive (instanceId: string, api: ApiInterfaceRx): Observable<ReturnType> {
return memo(instanceId, (): Observable<ReturnType> => {
// we work with observables here
return api.rpc.chain.getHeader().pipe(
switchMap((header) => of(header.toString()))
);
});
}
So in your case you received 2 params, not 3 (and not an ApiPromise instance, they don't exist in derives)
: !!api && isFunction((api.derive.balances as any).transferAll) | ||
? transferBalance | ||
: isProtected | ||
? transferBalance | ||
: transferBalance |
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.
Although the derive
is defined in the apps-config
for interBtc
, it's empty when used here. transferBalance
is what the derive is supposed to be, and it works this way. How can this be correctly implemented using the derive?
@jacogr sorry for the tag, not sure if you get notifications from the comments above and I can't mark the PR from 'draft' to 'ready' myself. Do you have any tips for fixing those two problems? |
@jacogr would be great to get your feedback on the two questions above. We'd like to resolve those to make it possible to transfer tokens that are implemented via orml-tokens. |
I did comment above, the TL;DR is that you need to use a derive interface with an |
Thank you! I'll take a look as soon as I get a chance |
Signed-off-by: Gregory Hill [email protected]