You can use any Stacks library to construct these transaction. See examples using helpers from the @stacks/transactions
package
import {
makeUnsignedContractCall,
makeUnsignedContractDeploy,
makeUnsignedSTXTokenTransfer,
uintCV,
} from "@stacks/transactions";
import { request } from "sats-connect";
//contract call transaction
const transaction = await makeUnsignedContractCall({
fee: 3000,
anchorMode: "onChainOnly",
contractAddress: "SP21YTSM60CAY6D011EZVEVNKXVW8FVZE198XEFFP",
contractName: "pox-fast-pool-v2",
functionName: "set-stx-buffer",
functionArgs: [uintCV(1)],
publicKey: props.publicKey,
});
try {
const response = await request("stx_signTransaction", {
transaction: uint8ArrayToHex(transaction.serialize()),
});
if (response.status === "success") {
console.log(response.result.transaction);
} else {
alert(errorMessage);
console.error(response.error);
}
} catch (error) {
alert(errorMessage);
console.error(error);
//token transfer transaction
const transaction = await makeUnsignedSTXTokenTransfer({
anchorMode: "any",
fee: 3000,
recipient: "SP2FFKDKR122BZWS7GDPFWC0J0FK4WMW5NPQ0Z21M", // account 4
amount: 1000,
publicKey: props.publicKey,
});
try {
const response = await request("stx_signTransaction", {
transaction: uint8ArrayToHex(transaction.serialize()),
});
if (response.status === "success") {
console.log(response.result.transaction);
} else {
alert(errorMessage);
console.error(response.error);
}
} catch (error) {
alert(errorMessage);
console.error(error);
}
//contract deployment transaction
const transaction = await makeUnsignedContractDeploy({
anchorMode: "any",
contractName: "my-contract",
codeBody: code,
fee: 3000,
publicKey: props.publicKey,
});
try {
const response = await request("stx_signTransaction", {
transaction: uint8ArrayToHex(transaction.serialize()),
});
if (response.status === "success") {
console.log(response.result.transaction);
} else {
alert(errorMessage);
console.error(response.error);
}
} catch (error) {
alert(errorMessage);
console.error(error);
}
The transaction will be signed and broadcasted upon user approval.