-
Notifications
You must be signed in to change notification settings - Fork 39
fix: request type in getNftTransfers and missing await in send
#49
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,7 +110,7 @@ export class AnkrProvider { | |
| * @param params A GetNftTransfersRequest object. | ||
| * @returns Promise<GetNftTransfersReply> | ||
| */ | ||
| async getNftTransfers(params: GetTransfersRequest): Promise<GetNftTransfersReply> { | ||
| async getNftTransfers(params: GetNftTransfersRequest): Promise<GetNftTransfersReply> { | ||
| return this.send<GetNftTransfersReply>("ankr_getNftTransfers", params) | ||
| } | ||
|
|
||
|
|
@@ -253,7 +253,7 @@ export class AnkrProvider { | |
| private async send<TReply>(method: string, params: any): Promise<TReply> { | ||
| const request = {method, params, id: (this._nextId++), jsonrpc: "2.0"}; | ||
| const response = await axios.post<JsonRPCPayload>(this.url, JSON.stringify(request), this.requestConfig); | ||
| return AnkrProvider.getResult(response.data) as TReply | ||
| return await AnkrProvider.getResult(response.data) as TReply; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @mdqst, thank you for the contribution! Could you please elaborate a bit on this line? To the best of my understanding, getResult is a synchronous one, so no need in the await. PS: I'm not a js/ts expert, so I can be wrong here.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks for feedback, jovfer! You’re right to double-check this. The reason for using
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @mdqst, thanks for the explanation.
Sorry, I'd disagree here.
So I'd request to remove it from the PR. Please also see the comment from @memekas regarding types. |
||
| } | ||
|
|
||
| private static getResult(payload: JsonRPCPayload): any { | ||
|
|
@@ -265,4 +265,4 @@ export class AnkrProvider { | |
| } | ||
| return payload.result; | ||
| } | ||
| } | ||
| } | ||
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.
GetTransfersRequestis used for thegetTokenTransfersand for thegetNftTransfers. Therefore, the interface has a name without specifics. Let's change the@paramsdescriptionThere 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.
@memekas wdyt on GetTransfersRequest as main type + 2 type aliases like GetTokenTransfersRequest and GetNftTransfersRequest ?
Like