0

I would like to write a program that can be used to exchange a token against sol (like buying action for an nft). I have a working example for a token A against token B. But i would like to replace token B by SOL. This example use anchor & escrow account (to store the token A, waiting for a call to execute the exchange).

My question is : Let's say i have a buyer, a seller and the escrow account. The token is held by the escrow account. It can be sent from the escrow account to the buyer, that part is okay. But then, how do i send the sol from the buyer to the seller ? I don't know what is the flow :

  • Should the sol go directly from the buyer to the seller ? (buy it seems that a program can not execute that kind of transfer because it doesn't own the buyer main account)
  • Should the sol be sent from the buyer to an account owned by the program, and then sent by the program to the buyer ?

Thanks for you help, because i can't manage to find any example of that on internet !! (as basic as it seems...)

Herohtar
  • 5,347
  • 4
  • 31
  • 41

1 Answers1

-1

I finally found my answer : yes the SOL can go directly from the buyer to the seller, no need to go through an account owned by the program, as long as the buyer is signing the transaction (I guess, at least).

CrackerKSR
  • 1,380
  • 1
  • 11
  • 29