Class

MuxedAccount

MuxedAccount(account, id)

Represents a muxed account for transactions and operations.

A muxed (or multiplexed) account (defined rigorously in CAP-27 and briefly in SEP-23) is one that resolves a single Stellar `G...`` account to many different underlying IDs.

For example, you may have a single Stellar address for accounting purposes: GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ

Yet would like to use it for 4 different family members: 1: MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAAGZFQ 2: MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAALIWQ 3: MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAAPYHQ 4: MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAAQLQQ

This object makes it easy to create muxed accounts from regular accounts, duplicate them, get/set the underlying IDs, etc. without mucking around with the raw XDR.

Because muxed accounts are purely an off-chain convention, they all share the sequence number tied to their underlying G... account. Thus, this object requires an Account instance to be passed in, so that muxed instances of an account can collectively modify the sequence number whenever a muxed account is used as the source of a @{link Transaction} with TransactionBuilder.

Constructor

# new MuxedAccount(account, id)

Parameters:
Name Type Description
account Account

the @{link Account} instance representing the underlying G... address

id string

a stringified uint64 value that represents the ID of the muxed account

View Source js-stellar-base/src/muxed_account.js, line 48

Classes

MuxedAccount

Methods

# accountId() → {string}

View Source js-stellar-base/src/muxed_account.js, line 91

the M-address representing this account's (G-address, ID)

string

# baseAccount() → {Account}

View Source js-stellar-base/src/muxed_account.js, line 84

the underlying account object shared among all muxed accounts with this Stellar address

Account

# incrementSequenceNumber() → {void}

Increments the underlying account's sequence number by one.

View Source js-stellar-base/src/muxed_account.js, line 122

void

# sequenceNumber() → {string}

Accesses the underlying account's sequence number.

View Source js-stellar-base/src/muxed_account.js, line 114

strigified sequence number for the underlying account

string

# toXDRObject() → {xdr.MuxedAccount}

View Source js-stellar-base/src/muxed_account.js, line 130

the XDR object representing this muxed account's G-address and uint64 ID

xdr.MuxedAccount

# static fromAddress(mAddress, sequenceNum) → {MuxedAccount}

Parses an M-address into a MuxedAccount object.

Parameters:
Name Type Description
mAddress string

an M-address to transform

sequenceNum string

the sequence number of the underlying Account, to use for the underlying base account (@link MuxedAccount.baseAccount). If you're using the SDK, you can use server.loadAccount to fetch this if you don't know it.

View Source js-stellar-base/src/muxed_account.js, line 72

MuxedAccount