Fix example sponsor transaction error #413
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At now, when you try to test function Sponsor Transaction Flow - [Submit Transaction] in NextJS demo, website will come out with the
Application error
Here is the error code from console:
{"message":"Invalid transaction: Type: Validation Code: INVALID_SIGNATURE","error_code":"vm_error","vm_error_code":1}
Error Reason: When calling method
signAsFeePayer
, the function needs to pass in theAccount
type. So it's useless to callsignTransaction
when you can't have the private key for the sponsor account.Fixed Way: As noted above, I add
const sponsor = Account.generate();
to act as a sponsor. And usesignAsFeePayer
to sign transaction.Hope u enjoy my code :)