Open gsong opened 2 months ago
Hi @gsong
It suggests that the function will soon require an object with a payload
property instead of just the payload
itself.
Current (soon-to-be-deprecated) usage:
await signAndSubmitTransaction(payload);
Updated usage (as per the warning):
await signAndSubmitTransaction({ payload });
However, since you mentioned that using the recommended function signature doesn't work:
Check for Typographical Errors:
Ensure that you are correctly passing the payload
as an object property. It should be { payload }
and not {payload}
or any other variation.
Verify the Payload Structure:
Ensure that the payload
you are passing is correctly structured and contains all necessary fields required by the function.
Check for Package Updates:
Sometimes, packages may release updates that fix issues or add clarity. Ensure that you have the latest version of @aptos-labs/wallet-adapter-react
by running:
npm install @aptos-labs/wallet-adapter-react@latest
example
import { useWallet } from '@aptos-labs/wallet-adapter-react';
const { signAndSubmitTransaction } = useWallet();
const payload = {
type: "entry_function_payload",
function: "0x1::ModuleName::functionName",
arguments: ["arg1", "arg2"],
type_arguments: ["u8", "u64"]
};
try {
const response = await signAndSubmitTransaction({ payload });
console.log('Success:', response);
} catch (error) {
console.error('Failed', error);
}
When using the latest
@aptos-labs/wallet-adapter-react@3.5.9
, this message appears in the console:However, using the recommended function signature doesn't work.