Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/core-ts/src/muxed/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ const { Account, MuxedAccount, StrKey } = StellarSdk;

const MAX_UINT64 = 18446744073709551615n;

/**
* Encodes a muxed Stellar address using a base G address and numeric ID.
*
* @param baseG - The base G address (Ed25519 public key) to mux with
* @param id - The numeric ID to append to the base address (must be uint64)
* @returns The encoded muxed address string
* @throws {TypeError} When the ID parameter is not a bigint
* @throws {RangeError} When the ID is outside the uint64 range (0 to 18446744073709551615)
* @throws {Error} When the base G address is not a valid Ed25519 public key
*/
export function encodeMuxed(baseG: string, id: bigint): string {
if (typeof id !== "bigint") {
throw new TypeError(`ID must be a bigint, received ${typeof id}`);
Expand Down
Loading