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 the Account type. So it's useless to call signTransaction 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 use signAsFeePayer to sign transaction.
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 :)