Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account is frozen, custom program error: 0x11 #32

Open
zhongchunfengyyds opened this issue May 15, 2024 · 1 comment
Open

Account is frozen, custom program error: 0x11 #32

zhongchunfengyyds opened this issue May 15, 2024 · 1 comment

Comments

@zhongchunfengyyds
Copy link

import { clusterApiUrl, Connection, Keypair, VersionedTransaction } from '@solana/web3.js'
import { Wallet } from '@project-serum/anchor'
import bs58 from 'bs58'
import * as dotenv from 'dotenv'
import axios from 'axios'

dotenv.config()

async function main() {
    try {
        const SOLANA_CLUSTER = clusterApiUrl('mainnet-beta');
        const connection = new Connection(SOLANA_CLUSTER, 'confirmed');

        const wallet = new Wallet(Keypair.fromSecretKey(bs58.decode(process.env.PRIVATE_KEY || '')))

        const quoteResponse = await axios.get('https://quote-api.jup.ag/v6/quote', {
            params: {
                inputMint: 'So11111111111111111111111111111111111111112',
                outputMint: '21rweMLGYeMNonHW7H3xa5py17X6ZFRcHirCp9inRBQA',
                amount: 100000000,
                slippageBps: 50,
                swapMode: 'ExactOut',
                onlyDirectRoutes: true,
                asLegacyTransaction: false,
            },
        })

        console.dir(quoteResponse.data, { depth: null })
        const swapResponse = await axios.post('https://quote-api.jup.ag/v6/swap', {
            quoteResponse: quoteResponse.data,
            userPublicKey: wallet.publicKey.toString(),
            wrapAndUnwrapSol: true,
            prioritizationFeeLamports: 'auto',
        })

        console.log('Swap Response:', swapResponse.data)

        // Deserialize the transaction
        const swapTransactionBuf = Buffer.from(swapResponse.data.swapTransaction, 'base64')
        const transaction = VersionedTransaction.deserialize(swapTransactionBuf)

        // Sign the transaction
        transaction.sign([wallet.payer])

        // We first simulate whether the transaction would be successful
        const { value: simulatedTransactionResponse } = await connection.simulateTransaction(transaction, {
            replaceRecentBlockhash: true,
            commitment: 'processed',
        })
        const { err, logs } = simulatedTransactionResponse

        if (err) {
            // Simulation error, we can check the logs for more details
            // If you are getting an invalid account error, make sure that you have the input mint account to actually swap from.
            console.error('Simulation Error:')
            console.error({ err, logs })
            return
        }

        // Execute the transaction
        const rawTransaction = transaction.serialize()
        const txid = await connection.sendRawTransaction(rawTransaction, {
            skipPreflight: true,
        })

        console.log(`Transaction initiated. Txid: ${txid}`)
        try {
            await connection.confirmTransaction(txid)
        } catch (error) {
            console.error('Confirmation error:', error)
        }
        console.log(`View transaction on Solscan: https://solscan.io/tx/${txid}`)
    } catch (error) {
        console.error('Error:', error)
    }
}

main()

When I perform a transaction when the outputMint is 21rweMLGYeMNonHW7H3xa5py17X6ZFRcHirCp9inRBQA, it will prompt Program log: Error: Account is frozen, custom program error: 0x11. But I can conduct transactions on the front-end page of Jupiter Aggregator. Other coins do not have this situation and can be successfully traded.

@jkllx
Copy link

jkllx commented Jun 15, 2024

sir, same issue, Did you solve the problem? thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants