Skip to content

Muxed address support sketch for Soroban SDK, transfer_muxed edition#1447

Closed
dmkozh wants to merge 1 commit intostellar:mainfrom
dmkozh:muxed_addr_separate_fn
Closed

Muxed address support sketch for Soroban SDK, transfer_muxed edition#1447
dmkozh wants to merge 1 commit intostellar:mainfrom
dmkozh:muxed_addr_separate_fn

Conversation

@dmkozh
Copy link
Copy Markdown
Contributor

@dmkozh dmkozh commented Feb 26, 2025

This just uses a separate interface/contract function that accepts MuxedAddress and doesn't introduce any opt-ins/outs of exposing the muxed address type.

This just uses a separate interface/contract function that accepts `MuxedAddress` and doesn't introduce any opt-ins/outs of exposing the muxed address type.

This introduces the `MuxedAddress` type that maps to either `AddressObject` or `MuxedAddressObject`.
Comment on lines 150 to +156
ScSpecTypeDef::Address => quote! { soroban_sdk::Address },
ScSpecTypeDef::AddressV2(supports_muxing) => {
if *supports_muxing {
quote! { soroban_sdk::MuxedAddress }
} else {
quote! { soroban_sdk::Address }
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of AddressV2 which is configurable, vs introducing a MuxedAddress that maps directly to the MuxedAddress in the SDK?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it could be MuxedAddress, with a caveat that it would be the only spec type that's seamlessly compatible with another spec type (Address). The option here tries to convey that both are semantically the same type, but with some additional options available. Both options are a bit weird; probably support for the variant types in the spec would be more clear than either one. But for a one-off exception I think both options are ok-ish (not pretty, but ultimately not too hard to deal with when parsing the spec).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be the only spec type that's seamlessly compatible with another spec type

The spec types already have some oddities that cause them to overlap with other spec types. For example, The Option<> spec type overlaps with Void and every other value.

@leighmcculloch
Copy link
Copy Markdown
Member

I think this was superseded by:

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