Class Hashes
Inheritance
Namespace: Xrpl.Utils.Hashes
Assembly: Xrpl.dll
Syntax
public static class Hashes
Methods
| Edit this page View SourceAddressToHex(string)
Declaration
public static string AddressToHex(this string address)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address |
Returns
| Type | Description |
|---|---|
| string |
CurrencyToHex(string)
checks and generates a token code for transmission to the network
Declaration
public static string CurrencyToHex(this string currency)
Parameters
| Type | Name | Description |
|---|---|---|
| string | currency | Currency code |
Returns
| Type | Description |
|---|---|
| string |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | If Currency code length more than 40 characters |
GetNFTokenPageOwner(string)
Get the owner of an NFTokenPage ledger entry from the page's ledger index.
Mirrors rippled's keylet::nftpage_min(owner) and keylet::nftpage_max(owner): the high
160 bits of a page index are the owner's AccountID and the low 96 bits (nft::kPageMask) come from
an NFTokenID. An NFTokenPage carries no Owner field, so this is the only way to tell whose page it is
without asking the ledger.
Declaration
public static string GetNFTokenPageOwner(string pageIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | pageIndex | The 64-character hexadecimal ledger index of the page, e.g. the |
Returns
| Type | Description |
|---|---|
| string | The classic address of the account that owns the page. |
Remarks
The result only means something for the index of an NFTokenPage: any other 256-bit ledger index
(an offer, a trust line) is a hash and its first 20 bytes are not an account.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
HashAccountRoot(string)
Declaration
public static string HashAccountRoot(this string address)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address |
Returns
| Type | Description |
|---|---|
| string |
HashCredential(string, string, string)
Compute the ledger object index (object ID) for an XLS-70 Credential ledger entry.
Mirrors rippled's keylet::credential(subject, issuer, credentialType):
sha512Half(uint16(LedgerNameSpace::CREDENTIAL) || subject(20) || issuer(20) || credentialType).
Declaration
public static string HashCredential(string subject, string issuer, string credentialTypeHex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | subject | Classic XRPL address of the credential subject. |
| string | issuer | Classic XRPL address of the credential issuer. |
| string | credentialTypeHex | Credential type as an uppercase hexadecimal string (1..64 bytes -> 2..128 hex chars). |
Returns
| Type | Description |
|---|---|
| string | The 64-character (32-byte) hexadecimal object ID of the credential ledger entry. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when arguments are missing or malformed. |
HashEscrow(string, int)
Declaration
public static string HashEscrow(string address, int sequence)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | |
| int | sequence |
Returns
| Type | Description |
|---|---|
| string |
HashOfferId(string, int)
Compute the ledger object index of an Offer entry.
Mirrors rippled's keylet::offer(account, sequence):
sha512Half(uint16(LedgerNameSpace::OFFER) || account(20) || uint32(sequence)).
Declaration
public static string HashOfferId(string address, int sequence)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | Classic address of the account that placed the offer. |
| int | sequence | Sequence (or ticket sequence) of the |
Returns
| Type | Description |
|---|---|
| string | The 64-character hexadecimal object ID of the offer. |
Remarks
A sequence above int.MaxValue is taken as its two's-complement bit pattern.
HashOfferId(string, uint)
Compute the ledger object index of an Offer entry.
Mirrors rippled's keylet::offer(account, sequence):
sha512Half(uint16(LedgerNameSpace::OFFER) || account(20) || uint32(sequence)).
Declaration
public static string HashOfferId(string address, uint sequence)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | Classic address of the account that placed the offer. |
| uint | sequence | Sequence (or ticket sequence) of the |
Returns
| Type | Description |
|---|---|
| string | The 64-character hexadecimal object ID of the offer. |
HashPaymentChannel(string, string, int)
Declaration
public static string HashPaymentChannel(string address, string dstAddress, int sequence)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | |
| string | dstAddress | |
| int | sequence |
Returns
| Type | Description |
|---|---|
| string |
HashSignerListId(string)
Declaration
public static string HashSignerListId(this string address)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address |
Returns
| Type | Description |
|---|---|
| string |
HashTX(string)
Duplicate of HashTx(string): the single-signing hash, not the transaction ID.
Declaration
[Obsolete("Use HashTx for the single-signing hash, or HashLedger.HashSignedTx for the transaction ID.")]
public static string HashTX(this string txBlobHex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | txBlobHex |
Returns
| Type | Description |
|---|---|
| string |
HashTrustline(string, string, string)
Compute the ledger object index of a RippleState (trust line) entry.
Mirrors rippled's keylet::line(a, b, currency):
sha512Half(uint16(LedgerNameSpace::TRUST_LINE) || low(20) || high(20) || currency(20)),
where low/high order the two AccountIDs as unsigned byte strings.
Declaration
public static string HashTrustline(string address1, string address2, string currency)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address1 | Classic address of one side of the trust line. |
| string | address2 | Classic address of the other side; the order of the two does not matter. |
| string | currency | A 3-character ISO code, a 40-character hex code, or a longer name encoded the way CurrencyToHex(string) does. |
Returns
| Type | Description |
|---|---|
| string | The 64-character hexadecimal object ID of the trust line. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when |
HashTx(string)
Hash the given binary transaction data with the single-signing prefix (STX\0).
See Serialization Format.
Declaration
public static string HashTx(this string txBlobHex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | txBlobHex | The transaction blob for signing, as a hexadecimal string. |
Returns
| Type | Description |
|---|---|
| string | The hash to sign. |
Remarks
This is the hash a single signer signs, as xrpl.js hashTx computes it - not the
transaction ID. The ID of a signed transaction is HashSignedTx(string).
IsHexCurrencyCode(string)
check currency code for HEX
Declaration
public static bool IsHexCurrencyCode(this string code)
Parameters
| Type | Name | Description |
|---|---|---|
| string | code | currency code |
Returns
| Type | Description |
|---|---|
| bool |
LedgerSpaceHex(string)
Declaration
public static string LedgerSpaceHex(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Returns
| Type | Description |
|---|---|
| string |
LedgerSpaceHex(LedgerSpace)
Declaration
public static string LedgerSpaceHex(this LedgerSpace name)
Parameters
| Type | Name | Description |
|---|---|---|
| LedgerSpace | name |
Returns
| Type | Description |
|---|---|
| string |