Skip to content
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

Created prepareDelegateAuthorizationExtrinsic() and modified dispatchDelegateAuthorization() function #240

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

YASH-YADAV-dynamo
Copy link

Description

Separate Delegate Authorization preparation and dispatch of extrinsic to chain. This would help when bulk transaction takes place so we just prepare all the required extrinsics and then execute these transaction in batches by dumping them into a promise using
a batch sign & submit utility ex, authorizeBatch which can take array of extrinsics, instead of just one. (#201 )

Goals:

  • Create a new function prepareDelegateAuthorizationExtrinsic(): This function consolidates the dispatchDelegateAuthorizationTx and Did.authorizeTx() logic.
  • Refactor the dispatchDelegateAuthorization(): The existing function now integrates the new preparation function and handles extrinsics dispatch separately.

This change will improve the process when dealing with multiple transactions by enabling batch signing and submission.

Changes made:

  • Created a new prepareDelegateAuthorizationExtrinsic() function that handles both extrinsic preparation and authorization.
  • Refactored dispatchDelegateAuthorization() to utilize the new function for better separation of concerns.
  • Added support for bulk transaction handling by preparing extrinsics and submitting them in batches.

@YASH-YADAV-dynamo
Copy link
Author

@vatsa287 , @gamemaker1 Please review it and let me know if any changes are required.

.gitpod.yml Outdated
@@ -0,0 +1,10 @@
# This configuration file was automatically generated by Gitpod.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not required for the PR.

* @returns A promise resolving to the prepared extrinsic.
* @throws {SDKErrors.CordQueryError} - Thrown on error during preparation.
*/
export async function prepareDelegateAuthorizationExtrinsic(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function also requires did.authorizeTx() to be implemented for prepare....

Refer dispatchUpdateTxCapacityToChain().
The idea of prepare and dispatch is to separate authorisingfrom did and signing from account.

throw new SDKErrors.CordDispatchError(
`Error dispatching delegate authorization: ${error}`
)
if (error instanceof Error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Single error is enough as both mean the same.

@YASH-YADAV-dynamo
Copy link
Author

@vatsa287 I have made suggested changes, please review them and regarding "DID" I have a minor confusion..we have used import "* as Did" and the code doesn't have DID class so, if I use Did.DID is fine? And if not , how should I Pass the DID object for authorization.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants