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

enable sending a token or a SAC payment to a C address #1424

Merged
merged 4 commits into from
Aug 21, 2024

Conversation

piyalbasu
Copy link
Contributor

#1414

Allowing user to send a payment to a C address using either a token or a SAC

@@ -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;
Copy link
Contributor Author

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);
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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("");
Copy link
Contributor Author

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

@piyalbasu piyalbasu marked this pull request as ready for review August 20, 2024 02:37
@piyalbasu piyalbasu changed the base branch from master to release/5.23.1 August 20, 2024 14:33
@piyalbasu piyalbasu merged commit d56456d into release/5.23.1 Aug 21, 2024
9 checks passed
@piyalbasu piyalbasu deleted the feature/send-to-contract branch August 21, 2024 15:00
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

Successfully merging this pull request may close these issues.

2 participants