-
Notifications
You must be signed in to change notification settings - Fork 29
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
enable sending a token or a SAC payment to a C address #1424
Conversation
@@ -46,7 +46,7 @@ export const ChooseAsset = ({ balances }: ChooseAssetProps) => { | |||
const isSwap = useIsSwap(); | |||
const isSoroswapEnabled = useIsSoroswapEnabled(); | |||
|
|||
const managingAssets = assetSelect.type === AssetSelectType.MANAGE; | |||
const isManagingAssets = assetSelect.type === AssetSelectType.MANAGE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a var name issue that was bugging me , so fixing it here
@@ -85,6 +88,24 @@ export const Settings = ({ | |||
// dont show memo for regular sends to Muxed, or for swaps | |||
const showMemo = !isSwap && !isMuxedAccount(destination); | |||
const showSlippage = (isPathPayment || isSwap) && !isSoroswap; | |||
const isSendSacToContract = | |||
isContractId(destination) && | |||
!isContractId(getAssetFromCanonical(asset).issuer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here is basically:
If you're sending to a C address, but you're trying to send a classic asset, grab the C address of the SAC
@@ -109,8 +130,10 @@ export const Settings = ({ | |||
return; | |||
} | |||
|
|||
if (isToken) { | |||
const assetAddress = asset.split(":")[1]; | |||
if (isToken || isSendSacToContract) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending a token to a C address generally worked "out of the box" once I allowed a user to enter a C address as a destination 🎉
@@ -106,7 +107,7 @@ export const SendTo = ({ previous }: { previous: ROUTES }) => { | |||
); | |||
|
|||
const [recentAddresses, setRecentAddresses] = useState<string[]>([]); | |||
const [validatedPubKey, setValidatedPubKey] = useState(""); | |||
const [validatedAddress, setValidatedAddress] = useState(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var rename to reflect we can send to either a public key or a C address
#1414
Allowing user to send a payment to a C address using either a token or a SAC