Signatures & Submissions
In certain specific scenarios, you may need to manually sign or submit a transaction. However, in the majority of cases, this part is automatically handled by the SDK.
Other relevant functions can be found in the Wallet Extended section:
signTx()
This function initiates a request for the user to sign the unsigned sections of the provided transaction. The wallet is responsible for seeking the user's permission, and upon consent, attempts to sign the given transaction body, returning a signed transaction as a result.
import { anvil } from "@ada-anvil/sdk-client";
try {
await anvil.wallet.connect("eternl");
await anvil.wallet.signTx(your_tx, true); // Output: "a10081825..."
} catch {
console.log("YOUR ERROR HANDLING");
}
signData()
This functionality enables the wallet to prompt the user for signing a payload that adheres to the cip8 specification. The app will seek the user's consent and display what needs to be signed.
import { anvil } from "@ada-anvil/sdk-client";
try {
await anvil.wallet.connect("eternl");
await anvil.wallet.signData(your_tx, true); // Output: "a10081825..."
} catch {
console.log("YOUR ERROR HANDLING");
}
submitTx()
In the event that the wallet approves the transaction and proceeds with the sending process, it will return a trackable transaction ID.
import { anvil } from "@ada-anvil/sdk-client";
try {
await anvil.wallet.connect("eternl");
await anvil.wallet.submitTx(your_tx); // Output: "06b380ea6..."
} catch {
console.log("YOUR ERROR HANDLING");
}