Skip to content

tonConnectUI.sendTransaction #63

Open
@lv-xiaobu

Description

@lv-xiaobu

`import { useTonConnectUI } from '@tonconnect/ui-react';
import { Sender, SenderArguments } from '@ton/core';

export function useTonConnect(): { sender: Sender; connected: boolean } {
const [tonConnectUI] = useTonConnectUI();

return {
sender: {
send: async (args: SenderArguments) => {
tonConnectUI.sendTransaction({
messages: [
{
address: args.to.toString(),
amount: args.value.toString(),
payload: args.body?.toBoc().toString('base64'),
},
],
validUntil: Date.now() + 5 * 60 * 1000, // 5 minutes for user to approve
});
},
},
connected: tonConnectUI.connected,
};
}`
tonConnectUI.sendTransaction has a return value,
It seems that it cannot be returned if written like this
How should I modify

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions