Classes
Methods
_toXDRObject(xdrAsset) → {xdr.Asset|xdr.ChangeTrustAsset|xdr.TrustLineAsset}
Returns the xdr object for this asset.
Parameters:
Name | Type | Description |
---|---|---|
xdrAsset |
xdr.Asset
|
xdr.ChangeTrustAsset
|
The asset xdr object. |
Returns:
- Type:
-
xdr.Asset
|xdr.ChangeTrustAsset
|xdr.TrustLineAsset
XDR Asset object
contractId(networkPassphrase) → {string}
Returns the would-be contract ID (C...
format) for this asset on a given
network.
Parameters:
Name | Type | Description |
---|---|---|
networkPassphrase |
string
|
indicates which network the contract ID should refer to, since every network will have a unique ID for the same contract (see Networks for options) |
Returns:
- Type:
-
string
the strkey-encoded (C...
) contract ID for this asset
equals(asset) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
asset |
Asset
|
Asset to compare |
Returns:
- Type:
-
boolean
true if this asset equals the given asset.
getAssetType() → {string}
- Source:
- See:
Returns:
- Type:
-
string
Asset type. Can be one of following types:
native
,credit_alphanum4
,credit_alphanum12
, orunknown
as the error case (which should never occur)
getRawAssetType() → {xdr.AssetType}
Returns:
- Type:
-
xdr.AssetType
the raw XDR representation of the asset type
isNative() → {boolean}
Returns:
- Type:
-
boolean
true if this asset object is the native asset.
toChangeTrustXDRObject() → {xdr.ChangeTrustAsset}
Returns the xdr.ChangeTrustAsset object for this asset.
Returns:
- Type:
-
xdr.ChangeTrustAsset
XDR asset object
toTrustLineXDRObject() → {xdr.TrustLineAsset}
Returns the xdr.TrustLineAsset object for this asset.
Returns:
- Type:
-
xdr.TrustLineAsset
XDR asset object
toXDRObject() → {xdr.Asset}
Returns the xdr.Asset object for this asset.
Returns:
- Type:
-
xdr.Asset
XDR asset object
(static) compare(assetA, assetB) → {number}
Compares two assets according to the criteria:
- First compare the type (native < alphanum4 < alphanum12).
- If the types are equal, compare the assets codes.
- If the asset codes are equal, compare the issuers.
Parameters:
Name | Type | Description |
---|---|---|
assetA |
Asset
|
the first asset |
assetB |
Asset
|
the second asset |
Returns:
- Type:
-
number
-1
if assetA < assetB, 0
if assetA == assetB, 1
if assetA > assetB.