Top Level Namespace
Defined Under Namespace
Modules: Boolean, CLValueBytesParsers, Casper, CasperNetworkSDK, Utils Classes: AsymmetricKey, CLAccountHash, CLAccountHashType, CLAny, CLAnyType, CLBool, CLBoolType, CLByteArray, CLByteArrayType, CLI32Type, CLI64Type, CLKey, CLKeyType, CLList, CLListType, CLMap, CLMapType, CLOption, CLOptionType, CLPublicKey, CLPublicKeyType, CLResult, CLResultType, CLString, CLStringType, CLTuple, CLTuple1, CLTuple1Type, CLTuple2, CLTuple2Type, CLTuple3, CLTuple3Type, CLTupleType, CLType, CLTypeSerizalizer, CLTypeTag, CLU128Type, CLU256Type, CLU32Type, CLU512Type, CLU64Type, CLU8Type, CLURef, CLURefType, CLUnit, CLUnitType, CLValue, CLValueSerializer, CLi32, CLi64, CLu128, CLu256, CLu32, CLu512, CLu64, CLu8, DeployApprovalSerializer, DeployExecutableSerializer, DeployHeaderSerializer, DeployNamedArgSerializer, DeploySerializer, Ed25519Key, Error, FalseClass, TrueClass
Constant Summary collapse
- SignatureAlgorithm =
{ Ed25519: 'ed25519', Secp256K1: 'secp256k1' }
- KEY_TYPE_ACCOUNT =
0
- KEY_TYPE_HASH =
1
- KEY_TYPE_UREF =
2
- ACCOUNT_HASH_LENGTH =
ACCOUNT_HASH_ID = ‘AccountHash’
32
- MIN_I32 =
-2147483648
- MAX_I32 =
2147483647
- MIN_I64 =
-9223372036854775808
- MAX_I64 =
9223372036854775807
- MIN_U8 =
0
- MAX_U8 =
255
- MIN_U32 =
0
- MAX_U32 =
2.pow(32) - 1
- MIN_U64 =
0
- MAX_U64 =
2.pow(64) - 1
- MIN_U128 =
0
- MAX_U128 =
2.pow(128) - 1
- MIN_U256 =
0
- MAX_U256 =
2.pow(256) - 1
- MIN_U512 =
0
- MAX_U512 =
2.pow(512) - 1
- BOOL_ID =
'Bool'
- KEY_ID =
'Key'
- PUBLIC_KEY_ID =
'PublicKey'
- STRING_ID =
'String'
- UREF_ID =
'URef'
- UNIT_ID =
'Unit'
- I32_ID =
'I32'
- I64_ID =
'I64'
- U8_ID =
'U8'
- U32_ID =
'U32'
- U64_ID =
'U64'
- U128_ID =
'U128'
- U256_ID =
'U256'
- U512_ID =
'U512'
- BYTE_ARRAY_ID =
'ByteArray'
- LIST_ID =
'List'
- MAP_ID =
'Map'
- OPTION_ID =
'Option'
- RESULT_ID =
'Result'
- TUPLE1_ID =
'Tuple1'
- TUPLE2_ID =
'Tuple2'
- TUPLE3_ID =
'Tuple3'
- ACCOUNT_HASH_ID =
'AccountHash'
- PRIVATE_KEY_LENGTH =
ED25519 private key length in bytes
32
- AccessRights =
{ # No permissions None: 0b00000000, # Permission to read the value under the associated [[URef]]. READ: 0b00000001, # Permission to write a value under the associated [[URef]]. WRITE: 0b00000010, # Permission to read or write the value under the associated [[URef]]. READ_WRITE: 0b00000011, # Permission to add to the value under the associated [[URef]]. ADD: 0b00000100, # # Permission to read or add to the value under the associated [[URef]]. READ_ADD: 0b00000101, # # Permission to add to, or write the value under the associated [[URef]]. ADD_WRITE: 0b00000110, # # Permission to read, add to, or write the value under the associated [[URef]]. READ_ADD_WRITE: 0b00000111 }
- ED25519_LENGTH =
PublicKey serializes as a single byte tag representing the algorithm followed by 32 bytes of the PublicKey itself: If the PublicKey is an Ed25519 key, the single tag byte is 1 followed by the individual bytes of the serialized key. If the PublicKey is a Secp256k1 key, the single tag byte is a 2 followed by the individual bytes of the serialized key.
32
- SECP256K1_LENGTH =
33
- CLPublicKeyTag =
{ ED25519: 1, SECP256K1: 2 }
Instance Method Summary collapse
- #convert_from_bytes(type, byte_array) ⇒ Object
- #convert_to_bytes(type, value) ⇒ Object
- #find_byte_parser_by_cl_type(type, value) ⇒ Object
Instance Method Details
#convert_from_bytes(type, byte_array) ⇒ Object
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
# File 'lib/serialization/cl_value_bytes_parsers.rb', line 458 def convert_from_bytes(type, byte_array) # p type case type when "Bool" CLValueBytesParsers::CLBoolBytesParser.from_bytes(byte_array) when "I32" CLValueBytesParsers::CLI32BytesParser.from_bytes(byte_array) when "I64" CLValueBytesParsers::CLI64BytesParser.to_bytes(value) when "U8" CLValueBytesParsers::CLU8BytesParser.to_bytes(value) when "U32" CLValueBytesParsers::CLU32BytesParser.to_bytes(value) when "U64" CLValueBytesParsers::CLU64BytesParser.to_bytes(value) when "U128" CLValueBytesParsers::CLU128BytesParser.to_bytes(value) when "U256" CLValueBytesParsers::CLU256BytesParser.to_bytes(value) when "U512" CLValueBytesParsers::CLU512BytesParser.to_bytes(value) when "Unit" CLValueBytesParsers::CLUnitBytesParser.to_bytes(value) when "String" CLValueBytesParsers::CLUnitBytesParser.to_bytes(value) # when "Key" # when "URef" # when "Option" # when "List" # when "ByteArray" # when "Result" # when "Map" # when "Tuple1" # when "Tuple2" # when "Tuple3" # when "Any" # when "PublicKey" else "Unknown" end end |
#convert_to_bytes(type, value) ⇒ Object
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/serialization/cl_value_bytes_parsers.rb', line 417 def convert_to_bytes(type, value) case type when "Bool" CLValueBytesParsers::CLBoolBytesParser.to_bytes(value) when "I32" CLValueBytesParsers::CLI32BytesParser.to_bytes(value) when "I64" CLValueBytesParsers::CLI64BytesParser.to_bytes(value) when "U8" CLValueBytesParsers::CLU8BytesParser.to_bytes(value) when "U32" CLValueBytesParsers::CLU32BytesParser.to_bytes(value) when "U64" CLValueBytesParsers::CLU64BytesParser.to_bytes(value) when "U128" CLValueBytesParsers::CLU128BytesParser.to_bytes(value) when "U256" CLValueBytesParsers::CLU256BytesParser.to_bytes(value) when "U512" CLValueBytesParsers::CLU512BytesParser.to_bytes(value) when "Unit" CLValueBytesParsers::CLUnitBytesParser.to_bytes(value) when "String" CLValueBytesParsers::CLStringBytesParser.to_bytes(value) # when "Key" # when "URef" # when "Option" # when "List" # when "ByteArray" # when "Result" # when "Map" # when "Tuple1" # when "Tuple2" # when "Tuple3" # when "Any" # when "PublicKey" else "Unknown" end end |
#find_byte_parser_by_cl_type(type, value) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/utils/find_byte_parser_by_cl_type.rb', line 3 def find_byte_parser_by_cl_type(type, value) if type == "Bool" CLValueBytesParsers::CLBoolBytesParser.to_bytes(value) elsif type == "I32" CLValueBytesParsers::CLI32BytesParser.to_bytes(value) elsif type == "I64" CLValueBytesParsers::CLI64BytesParser.to_bytes(value) elsif type == "U8" CLValueBytesParsers::CLU8BytesParser.to_bytes(value) elsif type == "U32" CLValueBytesParsers::CLU32BytesParser.to_bytes(value) elsif type == "U64" CLValueBytesParsers::CLU64BytesParser.to_bytes(value) elsif type == "U128" CLValueBytesParsers::CLU128BytesParser.to_bytes(value) elsif type == "U256" CLValueBytesParsers::CLU256BytesParser.to_bytes(value) elsif type == "U512" CLValueBytesParsers::CLU512BytesParser.to_bytes(value) elsif type == "Unit" CLValueBytesParsers::CLUnitBytesParser.to_bytes(value) elsif type == "String" CLValueBytesParsers::CLStringBytesParser.to_bytes(value) elsif type == "Key" CLValueBytesParsers::CLKeyBytesParser.to_bytes(value) elsif type == "URef" CLValueBytesParsers::CLURefBytesParser.to_bytes(value) elsif type == "Option" CLValueBytesParsers::CLOptionBytesParser.to_bytes(value) elsif type == "List" CLValueBytesParsers::CLListBytesParser.to_bytes(value) elsif type == "ByteArray" CLValueBytesParsers::CLByteArrayBytesParser.to_bytes(value) elsif type == "Result" CLValueBytesParsers::CLResultBytesParser.to_bytes(value) elsif type == "Map" CLValueBytesParsers::CLMapBytesParser.to_bytes(value) elsif type == "Tuple1" CLValueBytesParsers::CLTupleBytesParser.to_bytes(value) elsif type == "Tuple2" CLValueBytesParsers::CLTupleBytesParser.to_bytes(value) elsif type == "Tuple3" CLValueBytesParsers::CLTupleBytesParser.to_bytes(value) elsif type == "Any" CLValueBytesParsers::CLAnyBytesParser.to_bytes(value) elsif type == "PublicKey" CLValueBytesParsers::CLPublicKeyBytesParser.to_bytes(value) else "Undefined type" end end |