I was working on integrating albedo in my dapp using the albedo intent library.
But when I create signature using the Albedo Intent tx , it fails due to bad AUTH but when done using the stellar sdk signing using secret keypair , it works fine.
Attaching my code snippet for reference for the functions that I am using -
`// src/services/staking.ts
import { AlbedoWallet } from '@/services/wallets/AlbedoWallet';
import { nativeToScVal, Horizon, rpc, TransactionBuilder, Networks, Contract, Transaction } from 'stellar-sdk';
const STAKING_CONTRACT_ADDRESS = 'CD4NK6ZV6MGJBQZA66LJPTM5NMDFLHYLBUCDMTG5KK223D2DLVULXJ5H';
export const stakeAssets = async (amount: string, wallet: AlbedoWallet) => {
try {
// Ensure the wallet is connected
const address = await wallet.getPublicKey();
if (!address) {
throw new Error("Wallet is not connected");
}
// Create a Stellar SDK server instance
const server = new rpc.Server('https://soroban-testnet.stellar.org:443');
// Load the account
const account = await server.getAccount(address);
console.log("Loaded account:", account);
const contract = new Contract(STAKING_CONTRACT_ADDRESS);
// Create a transaction
const transaction = new TransactionBuilder(account, {
fee: '100',
networkPassphrase: Networks.TESTNET,
})
.addOperation(contract.call("stake_eth", ...[
nativeToScVal(address, { type: "address" }),
nativeToScVal(amount, { type: "i128" }),
]))
.setTimeout(500)
.build();
console.log("Built transaction:", transaction);
let preparedTransaction = await server.prepareTransaction(transaction);
console.log("Prepared transaction:", preparedTransaction);
const data = await wallet.signTransaction(preparedTransaction);
console.log("Signed transaction:", data);
// Submit the transaction
const result = await server.sendTransaction(preparedTransaction);
console.log("Transaction successful:", result);
return result;
} catch (error) {
console.error("Staking transaction failed:", error);
throw error;
}
};
`
Albedo Sign Transaction -
`async signTransaction(transaction: Transaction): Promise {
if (!this.publicKey) {
throw new Error('Wallet not connected');
}
try {
const result = await albedo.tx({
xdr: transaction.toXDR(),
network:'testnet'
});
return result.signed_envelope_xdr;
} catch (error) {
console.log(error);
throw new Error('Failed to sign transaction');
}
}`
Any help would be appreciated.

I was working on integrating albedo in my dapp using the albedo intent library.
But when I create signature using the Albedo Intent tx , it fails due to bad AUTH but when done using the stellar sdk signing using secret keypair , it works fine.
Attaching my code snippet for reference for the functions that I am using -
`// src/services/staking.ts
import { AlbedoWallet } from '@/services/wallets/AlbedoWallet';
import { nativeToScVal, Horizon, rpc, TransactionBuilder, Networks, Contract, Transaction } from 'stellar-sdk';
const STAKING_CONTRACT_ADDRESS = 'CD4NK6ZV6MGJBQZA66LJPTM5NMDFLHYLBUCDMTG5KK223D2DLVULXJ5H';
export const stakeAssets = async (amount: string, wallet: AlbedoWallet) => {
try {
// Ensure the wallet is connected
const address = await wallet.getPublicKey();
if (!address) {
throw new Error("Wallet is not connected");
}
};
`
Albedo Sign Transaction -
`async signTransaction(transaction: Transaction): Promise {
if (!this.publicKey) {
throw new Error('Wallet not connected');
}
}`
Any help would be appreciated.