aptos-labs / aptos-wallet-adapter

A monorepo modular wallet adapter for Aptos applications
https://aptos-labs.github.io/aptos-wallet-adapter/
Apache License 2.0
88 stars 97 forks source link

Fix example sponsor transaction error #413

Closed 0xRichBot closed 1 month ago

0xRichBot commented 1 month ago

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.

Hope u enjoy my code :)

0xmaayan commented 1 month ago

@0xRichBot Please revert pnpm-lock.yaml - it shouldn't have any changes or be included in the PR.