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

SignerError: not enough signers #426

Open
rust-master opened this issue May 2, 2024 · 0 comments
Open

SignerError: not enough signers #426

rust-master opened this issue May 2, 2024 · 0 comments

Comments

@rust-master
Copy link

async with AsyncClient('https://api.mainnet-beta.solana.com') as client:
    connected = await client.is_connected()
    token_client = AsyncToken(conn=client, pubkey=token_mint_address, program_id=TOKEN_PROGRAM_ID, payer=wallet_keypair)
    token_account_address = get_associated_token_address(
        wallet_keypair.pubkey(),
        token_mint_address
    )

    blockhash = await client.get_latest_blockhash()

    create_account_ix = spl_token.initialize_account( InitializeAccountParams(
        mint=token_mint_address,
        program_id=TOKEN_PROGRAM_ID,
        owner=wallet_pubkey,
        account=token_account_address
    )
    )
    txn = Transaction(fee_payer=wallet_pubkey, recent_blockhash=blockhash.value.blockhash)
    txn.add(
        sp.create_account(
            sp.CreateAccountParams(
                from_pubkey=wallet_pubkey,
                to_pubkey=token_account_address,
                lamports= await token_client.get_min_balance_rent_for_exempt_for_account(
                    client
                ),
                space=2*ACCOUNT_LAYOUT.sizeof(),
                owner=wallet_pubkey,
            ),
        )
    )
    txn.add(create_account_ix)
    txn.sign(wallet_keypair)
    await client.send_transaction(txn)

SignerError Traceback (most recent call last)
in <cell line: 108>()
106 print("Swap transaction signatures:", swap_tx_signatures)
107
--> 108 await execute_swap()

2 frames
/usr/local/lib/python3.10/dist-packages/solana/transaction.py in sign(self, *signers)
237 The Transaction must be assigned a valid recent_blockhash before invoking this method.
238 """
--> 239 self._solders.sign(signers, self._solders.message.recent_blockhash)
240
241 def add_signature(self, pubkey: Pubkey, signature: Signature) -> None:

SignerError: not enough signers

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

1 participant