I have implemented the sdk for signing and sending custom tokens to other users from the gnosis treasury wallet. However, I am receiving the 422 api transaction error. Currently I am getting the prompt to sign the proposedTransaction, but after that I am getting the error.

// code snippet used for signing and creating a transaction
    const safeOwner = this.walletAddress
    const ethAdapter = new Web3Adapter({
      web3: this.web3,
      signerAddress: safeOwner,
    const txServiceUrl = "https://safe-transaction.polygon.gnosis.io"
    const safeService = new SafeServiceClient({ txServiceUrl, ethAdapter })
    const web = new Web3(window.web3)
    const usdcContract = new web.eth.Contract(
    const safeSdk = await Safe.create({
      ethAdapter: ethAdapter,
      safeAddress: tresuryAddress,
    const number = new web3.utils.BN(amount[0])
    const sendAmount = web3.utils.toWei(number, "ether")
    const transaction = {
      data: usdcContract.methods.transfer(address[0], sendAmount).encodeABI(),
      value: "0",
    const options = {
      safeTxGas: 0, // Optional
      baseGas: 0, // Optional
      gasPrice: 0, // Optional
      gasToken: "0x0000000000000000000000000000000000000000", // Optional
      refundReceiver: "0x0000000000000000000000000000000000000000", // Optional
      nonce: 4 // Optional
    const safeTransaction = await safeSdk.createTransaction(transaction, options)
    await safeSdk.signTransaction(safeTransaction)
    const safeTxHash = await safeSdk.getTransactionHash(safeTransaction)
    await safeService.proposeTransaction({
      safeAddress: tresuryAddress,
      safeTransaction: safeTransaction,
      safeTxHash: safeTxHash,
      senderAddress: this.walletAddress,
    const tx = await safeService.getTransaction(safeTxHash)
    const safeTransactionData = {
      to: tx.to,
      value: tx.value,
      operation: tx.operation,
      safeTxGas: tx.safeTxGas,
      baseGas: tx.baseGas,
      gasPrice: tx.gasPrice,
      gasToken: tx.gasToken,
      refundReceiver: tx.refundReceiver,
      nonce: tx.nonce,
      data: tx.data,
    const safeTransaction2 = await safeSdk.createTransaction(
    for (let i = 0; i < tx.confirmations.length; i++) {
      const signature = new EthSignSignature(
    const executeTxResponse = await safeSdk.executeTransaction(safeTransaction2)
    const receipt =
      executeTxResponse.transactionResponse &&
      (await executeTxResponse.transactionResponse.wait())
    return executeTxResponse

request payload from sdk Error message from sdk


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.