2

Anyway to do something like this? like an account that can only accept txs from certain accounts?

3 Answers 3

2

If it is a normal wallet address, you cannot stop others from transferring SOL into it.

If it is an SPL token account, you can keep the account frozen, but that requires control over the freeze authority for the mint. In that case, anytime you want to transact with the account, you need to unfreeze it, perform the transfer / burn, then freeze it again.

If you're using SPL token-2022, you can use the confidential transfer extension to prevent any transfers into the account.

1
  • I'll look into the confidential transfer extension to see if that's the type of functionality I want
    – Noe Trejo
    Commented Dec 22, 2022 at 20:01
1

One approach may be to hard-code the public key string of the account you want to constrain to.

Have the account be a signer of transactions and when the instruction is invoked check the signers pubkey string with the one you stored.

1
  • I see what you're saying like a smart contract check right? I was just wondering if there was a core library way of doing this
    – Noe Trejo
    Commented Dec 22, 2022 at 19:58
0

Maybe you can create a program with a PDA as a receiver and use clockwork (https://github.com/clockwork-xyz/clockwork) to listen wen a transfer to that account is made and if the sender doesn't match your presetted one the you transfer back

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.