Stellar PHP SDK API Documentation

XdrSCAddress extends XdrSCAddressBase
in package

SCAddress union, with the factory methods that take an id in the spelling the SDK's callers use and the strkey rendering that gives one back.

The generated base holds the contract id and the liquidity pool id as hexadecimal and accepts their strkey spelling as well; every reader resolves those two fields through XdrSCAddressBase::getCanonicalContractIdHex() and XdrSCAddressBase::getCanonicalLiquidityPoolIdHex(), so no reader takes what another refuses.

Table of Contents

Properties

$accountId  : XdrAccountID|null
$claimableBalanceId  : XdrClaimableBalanceID|null
$contractId  : string|null
$liquidityPoolId  : string|null
$muxedAccount  : XdrMuxedAccountMed25519|null
$type  : XdrSCAddressType

Methods

__construct()  : mixed
decode()  : static
encode()  : string
forAccountId()  : XdrSCAddress
Accepts ed25519 "G..." and muxed ("M...") account ids.
forClaimableBalanceId()  : XdrSCAddress
Accepts strkey ("B...") and hex values. The hexadecimal form is the balance hash on its own, or the hash behind its type discriminant, as the SDK's getPaddedBalanceIdHex() and Horizon spell it.
forContractId()  : XdrSCAddress
Accepts hex or strkey values ("C...")
forLiquidityPoolId()  : XdrSCAddress
Accepts strkey ("L...") and hex values.
fromBase64Xdr()  : static
fromJson()  : static
fromJsonValue()  : static
fromTxRep()  : static
getAccountId()  : XdrAccountID|null
getCanonicalContractIdHex()  : string
Returns the 32-byte contract id as 64 lower case hexadecimal characters, whichever of the accepted spellings the field holds.
getCanonicalLiquidityPoolIdHex()  : string
Returns the 32-byte liquidity pool id as 64 lower case hexadecimal characters, whichever of the accepted spellings the field holds.
getClaimableBalanceId()  : XdrClaimableBalanceID|null
getContractId()  : string|null
getLiquidityPoolId()  : string|null
getMuxedAccount()  : XdrMuxedAccountMed25519|null
getType()  : XdrSCAddressType
setAccountId()  : void
setClaimableBalanceId()  : void
setContractId()  : void
setLiquidityPoolId()  : void
setMuxedAccount()  : void
setType()  : void
toBase64Xdr()  : string
toJson()  : string
toJsonValue()  : string
toStrKey()  : string
Returns the StrKey representation of the address.
toTxRep()  : void

Properties

Methods

forAccountId()

Accepts ed25519 "G..." and muxed ("M...") account ids.

public static forAccountId(string $accountId) : XdrSCAddress
Parameters
$accountId : string

"G..." or "M..."

Return values
XdrSCAddress

forClaimableBalanceId()

Accepts strkey ("B...") and hex values. The hexadecimal form is the balance hash on its own, or the hash behind its type discriminant, as the SDK's getPaddedBalanceIdHex() and Horizon spell it.

public static forClaimableBalanceId(string $claimableBalanceId) : XdrSCAddress
Parameters
$claimableBalanceId : string

"B..." or hex string

Return values
XdrSCAddress

forContractId()

Accepts hex or strkey values ("C...")

public static forContractId(string $contractId) : XdrSCAddress
Parameters
$contractId : string

hex or "C..."

Return values
XdrSCAddress

forLiquidityPoolId()

Accepts strkey ("L...") and hex values.

public static forLiquidityPoolId(string $liquidityPoolId) : XdrSCAddress
Parameters
$liquidityPoolId : string

"L..." or the pool hash as 64 hex characters

Return values
XdrSCAddress

fromBase64Xdr()

public static fromBase64Xdr(string $xdr) : static
Parameters
$xdr : string
Return values
static

fromJson()

public static fromJson(string $json) : static
Parameters
$json : string
Tags
throws
JsonException

If $json is not syntactically valid JSON.

InvalidArgumentException

If an object in $json repeats a key, or if the JSON shape does not match this type.

Return values
static

fromJsonValue()

public static fromJsonValue(mixed $value) : static
Parameters
$value : mixed
Return values
static

fromTxRep()

public static fromTxRep(array<string|int, mixed> $map, string $prefix) : static
Parameters
$map : array<string|int, mixed>
$prefix : string
Return values
static

getCanonicalContractIdHex()

Returns the 32-byte contract id as 64 lower case hexadecimal characters, whichever of the accepted spellings the field holds.

public getCanonicalContractIdHex() : string

A contract id is accepted as its strkey form "C..." or as the bare hash in hexadecimal. Every reader of the field resolves it through here, so none takes what another refuses.

Tags
throws
InvalidArgumentException

when the field is unset, holds a string that is neither a "C..." strkey nor hexadecimal, or has a length matching neither shape

Return values
string

the contract id as 64 lower case hexadecimal characters

getCanonicalLiquidityPoolIdHex()

Returns the 32-byte liquidity pool id as 64 lower case hexadecimal characters, whichever of the accepted spellings the field holds.

public getCanonicalLiquidityPoolIdHex() : string

A pool id is accepted as its strkey form "L..." or as the bare hash in hexadecimal. PoolID is a plain 32-byte hash on the wire with no discriminant ahead of it, so there is no prefixed spelling to accept. Every reader of the field resolves it through here, so none takes what another refuses.

Tags
throws
InvalidArgumentException

when the field is unset, holds a string that is neither an "L..." strkey nor hexadecimal, or has a length matching neither shape

Return values
string

the pool id as 64 lower case hexadecimal characters

getContractId()

public getContractId() : string|null
Return values
string|null

getLiquidityPoolId()

public getLiquidityPoolId() : string|null
Return values
string|null

setContractId()

public setContractId(string|null $contractId) : void
Parameters
$contractId : string|null

setLiquidityPoolId()

public setLiquidityPoolId(string|null $liquidityPoolId) : void
Parameters
$liquidityPoolId : string|null

toJson()

public toJson() : string
Tags
throws
JsonException

If the value contains structures that cannot be encoded as JSON.

Return values
string

toStrKey()

Returns the StrKey representation of the address.

public toStrKey() : string
Tags
throws
InvalidArgumentException

when the address holds an id that has no strkey representation

Exception

when the address type is unknown

Return values
string

toTxRep()

public toTxRep(string $prefix, array<string|int, mixed> &$lines) : void
Parameters
$prefix : string
$lines : array<string|int, mixed>
On this page

Search results