Show / Hide Table of Contents

Class PermissionValueConverter

Converts a Delegate permission entry, whose only field is PermissionValue. rippled returns that value as a name string in JSON responses (a transaction type name or a granular permission name) but accepts both forms on input; the binary codec always uses the numeric form. Transaction-type permissions have value = transaction type code + 1.

The converter works on the whole entry rather than the value alone because a name this version cannot map has no number to fall back to: it is kept in PermissionValueName instead, which a converter bound to the numeric property could not reach. A node gains permission names with every amendment, so an unmapped name is ordinary data from an up-to-date node, not malformed input.

Inheritance
object
JsonConverter
JsonConverter<PermissionEntry>
PermissionValueConverter
Namespace: Xrpl.Client.Json.Converters
Assembly: Xrpl.dll
Syntax
public sealed class PermissionValueConverter : JsonConverter<PermissionEntry>

Fields

| Edit this page View Source

UnknownPermissionValue

The value stored for a name this version cannot map. rippled treats 0 as no permission at all, so it can never collide with a real one.

Declaration
public const uint UnknownPermissionValue = 0
Field Value
Type Description
uint

Methods

| Edit this page View Source

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type PermissionEntry.

Declaration
public override PermissionEntry Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
Type Name Description
Utf8JsonReader reader

The reader.

Type typeToConvert

The type to convert.

JsonSerializerOptions options

An object that specifies serialization options to use.

Returns
Type Description
PermissionEntry

The converted value.

Overrides
System.Text.Json.Serialization.JsonConverter<Xrpl.Models.Common.PermissionEntry>.Read(ref System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions)
| Edit this page View Source

TryGetPermissionName(uint, out string)

Maps a numeric permission value back to the name rippled uses for it.

Declaration
public static bool TryGetPermissionName(uint value, out string name)
Parameters
Type Name Description
uint value

The numeric permission value.

string name

The permission name, when the value is known to this version.

Returns
Type Description
bool

True when the value was mapped.

| Edit this page View Source

TryGetPermissionValue(string, out uint)

Maps a permission name to its numeric value.

Declaration
public static bool TryGetPermissionValue(string name, out uint value)
Parameters
Type Name Description
string name

A granular permission name or a transaction type name.

uint value

The numeric value, when the name is known to this version.

Returns
Type Description
bool

True when the name was mapped.

| Edit this page View Source

Write(Utf8JsonWriter, PermissionEntry, JsonSerializerOptions)

Writes a specified value as JSON.

Declaration
public override void Write(Utf8JsonWriter writer, PermissionEntry value, JsonSerializerOptions options)
Parameters
Type Name Description
Utf8JsonWriter writer

The writer to write to.

PermissionEntry value

The value to convert to JSON.

JsonSerializerOptions options

An object that specifies serialization options to use.

Overrides
JsonConverter<PermissionEntry>.Write(Utf8JsonWriter, PermissionEntry, JsonSerializerOptions)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX