GlassEaters / hydra

Collective account pooling, fan out wallet, dao treasury
hydra-dox.vercel.app
GNU General Public License v3.0
68 stars 29 forks source link

distributeformint gives error 6012 #15

Open krishnawinit opened 2 years ago

krishnawinit commented 2 years ago

Hi technical geeks, I need help in calling hydra SDK. I am able to sucessfully send airdrop of SOL but when I try using sending SPl20 token with the below given reference code I get error: {InstructionError: Array(2)}InstructionError: Array(2)0: 11: {Custom: 6012}length: 2[[Prototype]]: Array(0)[[Prototype]]: Object

austbot commented 2 years ago

@krishnawinit can you please send in your code or a transaction example

krishnawinit commented 2 years ago
async function airdropToken() {
        let i= 0;
        let instr = [];
        let mint = {publicKey: new PublicKey("8LBhhVDsAWbH4WN11Qg2DMc9GTFszLyTbpVEZnCGGi5F")};
        await connection.requestAirdrop(distributionBot.publicKey,2*LAMPORTS_PER_SOL);
        while(i<5) {
            let distributeToMember1 = await fanoutSdk.distributeWalletMemberInstructions(
                {
                    distributeForMint: true,
                    member: wallets[i],
                    fanout: initvar.fanout, // From initialization
                    payer: authority.publicKey,
                    fanoutMint: mint.publicKey,
                },
            );
            instr.push(...distributeToMember1.instructions);
            i++;
        }
        const tx = await fanoutSdk.sendInstructions(
            instr,
            [authority],
            authority.publicKey
        );
        const txdetails = await connection.confirmTransaction(tx.TransactionSignature)
        console.log(txdetails, tx.RpcResponseAndContext.value.err);
        setBalance(await connection.getBalance(distributionBot.publicKey)/LAMPORTS_PER_SOL);
}
krishnawinit commented 2 years ago

Here is the code thanks for reply

staccDOTsol commented 2 years ago

I don't think either devnet or testnet allows you to airdrop anything >1, haven't for awhile

which line errors?

krishnawinit commented 2 years ago
const tx = await fanoutSdk.sendInstructions(
            instr,
            [authority],
            authority.publicKey
        );
krishnawinit commented 2 years ago

it is giving error 6012

staccDOTsol commented 2 years ago

are you in cli pr browser? I forget what the error I had earlier was but if you're in browser

        [authority],

not need this, it'll inject signature if you do

[],

instead

staccDOTsol commented 2 years ago

6012 13th error

IncorrectOwner,

dunno that doesn't help all that much

krishnawinit commented 2 years ago

didnt get you with authority still getting incorrect owner

krishnawinit commented 2 years ago

array of 1 one instruction

austbot commented 2 years ago

sorry for the delay here looking into this

austbot commented 2 years ago

you are airdropping to the distrobution bot not the authority check to make sure these things are true about your code

what is your membership model?

    assert_owned_by(&fanout_for_mint, &crate::ID)?;
    assert_owned_by(&fanout_mint_member_token_account_info, &Token::id())?;
    assert_owned_by(holding_account, &anchor_spl::token::Token::id())?;