You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not complete, but gives a general overview of sending a token and the process of swap proofs for new proofs needed to send.
The process of sending a Cashu token involves swapping proofs from a user's balance for the correct denomination, then encoding them as a token.
User chooses the account to send from and how much.
Validate send amount: make sure the selected account has a sufficient balance.
Coin selection: select proofs where the sum of the proof amounts is >= the amount to send
If the proof amount does not exactly match the send amount, then we must swap with the mint to get the exact send amount (see swap to send below)
Put these proofs to send in a pending state so that the user can reclaim them or resend the token
Once we have the correct amount of proofs, encode them into a token
const token = getEncodedToken({ proofs, mint, unit, memo })
Display the token to copy or scan
Swap to Send
Select the proofs to swap.
Determine the output amounts where there should be amounts that sum to the send amount exactly, and then amounts that sum to the remaining difference of the total proof amount and the send amount. For example:
Total proof amount: 8
Send amount: 7
send output amounts: [1,2,4]
change/keep output amounts: [1]
Create deterministic output data for the output amounts
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Send Cashu Token
This is not complete, but gives a general overview of sending a token and the process of swap proofs for new proofs needed to send.
The process of sending a Cashu token involves swapping proofs from a user's balance for the correct denomination, then encoding them as a token.
const token = getEncodedToken({ proofs, mint, unit, memo })Swap to Send
swap_cashu_proofs_draftin our DB:POST /v1/swapwith a payload of{ "inputs": <Array[Proof]>, "outputs": <Array[BlindedMessage]>, }Beta Was this translation helpful? Give feedback.
All reactions