MuxedContract

A contract with an optional 64-bit multiplexing id (CAP-0084, protocol 30 and higher).

A muxed contract address pairs a contract with an id the way a muxed account address pairs an account with one. It consists of two parts:

  • The contract id, which starts with the letter "C"

  • An optional multiplexing id, a 64-bit unsigned integer

When the multiplexing id is set, the address starts with "W" instead of "C". The Stellar Asset Contract accepts a muxed contract address as the recipient of a transfer; it is never an authorization target.

Usage

val muxed = MuxedContract("CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE", 123456UL)
println(muxed.address) // WA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAAAAAAAAAPCIA6IG

val parsed = MuxedContract("WA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAAAAAAAAAPCIA6IG")
println(parsed.contractId) // CA3D5KRY...
println(parsed.id) // 123456

See also

Constructors

Link copied to clipboard
constructor(contractId: String, id: ULong)

Creates a muxed contract from a contract id and a multiplexing id.

constructor(address: String)

Creates a muxed contract from a contract address (C...), which leaves id null, or a muxed contract address (W...).

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The address of this muxed contract: the muxed contract address (W...) if the multiplexing id is set, or the contract address (C...) if it is not.

Link copied to clipboard

The contract id. It starts with the letter "C".

Link copied to clipboard
val id: ULong?

The optional multiplexing id, a 64-bit unsigned integer. Null for a plain contract address.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Converts this muxed contract to an Address of type Address.AddressType.MUXED_CONTRACT if the multiplexing id is set, or Address.AddressType.CONTRACT if it is not.

Link copied to clipboard

Converts this muxed contract to its XDR address: the muxed contract arm if the multiplexing id is set, or the contract arm if it is not.

Link copied to clipboard
open override fun toString(): String