I'm using the JS SDK and trying to create a transaction that transfers out a POAP of a Safe... the tx goes through and I can see it in the UI, but not sure why it doesn't transfer the asset out here's the safe's history with the txs that I've submitted to try and transfer the POAP out https://gnosis-safe.io/app/gno:0x166fe3B49E82c0514689Ff0527Cd7C76261A9D07/transactions/history
here's the code:
const transferPOAP = async (safeAddress: string, toAddress: string) => {
// NOTE :: Get POAPs in wallet
const poaps = await getWalletPOAPs(safeAddress);
// NOTE :: Get array of POAP Token IDs
const tokenIds = poaps.map((el) => el.tokenId);
// NOTE :: Create Gnosis Safe Factory
const safeSDK: Safe = await Safe.create({
ethAdapter: new EthersAdapter({
ethers,
signer: owner_wallet, // NOTE :: Owner of safe
}),
safeAddress,
});
// NOTE :: ABI encoded transaction data
const data = web3.eth.abi.encodeFunctionCall(
{
name: "safeTransferFrom",
type: "function",
inputs: [
{ type: "address", name: "from" },
{ type: "address", name: "to" },
{ type: "uint256", name: "tokenId" },
],
},
[safeAddress, toAddress, tokenIds[0]]
);
// NOTE :: Create transaction
const safeTransaction = await safeSDK.createTransaction({
safeTransactionData : {
to: toAddress,
value: "0",
data,
},
});
// NOTE :: Get transaction hash
const txHash = await safeSDK.getTransactionHash(safeTransaction);
// NOTE :: Sign + Execute transaction
const executeTxResponse = await safeSDK.executeTransaction(
safeTransaction
);
// NOTE :: Get final confirmation of successful transaction
const res = await executeTxResponse.transactionResponse?.wait();
console.log(res?.transactionHash);
}