Module: EverSdk::Abi
- Defined in:
- lib/ever_sdk_client/abi.rb
Defined Under Namespace
Modules: ErrorCode Classes: Abi, AbiContract, AbiData, AbiEvent, AbiFunction, AbiParam, DecodedMessageBody, Signer
Constant Summary collapse
- FunctionHeader =
KwStruct.new(:expire, :time, :pubkey)
- CallSet =
KwStruct.new(:function_name, :header, :input) do def initialize(function_name:, header: nil, input: nil) super end def to_h { function_name: function_name, header: header.to_h, input: input } end end
- DeploySet =
KwStruct.new(:tvc, :workchain_id, :initial_data, :initial_pubkey) do def initialize(tvc:, workchain_id: nil, initial_data: nil, initial_pubkey: nil) super end end
- STATIC_INIT_SOURCE_TYPES =
[:message, :state_init, :tvc]
- StateInitSource =
TODO: Refactor with subclasses?
KwStruct.new( :type, :source, :code, :data, :library, :tvc, :public_key, :init_params ) do def initialize( type:, source: nil, code: nil, data: nil, library: nil, tvc: nil, public_key: nil, init_params: nil ) unless STATIC_INIT_SOURCE_TYPES.include?(type) raise ArgumentError.new("unknown type: #{type}; known types: #{STATIC_INIT_SOURCE_TYPES}") end super end def to_h h1 = { type: Helper.sym_to_capitalized_case_str(type) } h2 = case type when :message { source: source.to_h } when :state_init { code: code, data: data, library: library } when :tvc { public_key: public_key, init_params: init_params.to_h } else raise ArgumentError.new("unknown type: #{type}; known types: #{STATIC_INIT_SOURCE_TYPES}") end h1.merge(h2) end end
- StateInitParams =
KwStruct.new(:abi, :value) do def initialize(abi:, value:) super end end
- MESSAGE_SOURCE_TYPES =
[:encoded, :encoding_params]
- MessageSource =
KwStruct.new( :type, :message, :abi, :address, :deploy_set, :call_set, :signer, :processing_try_index ) do def initialize( type:, message: nil, abi: nil, address: nil, deploy_set: nil, call_set: nil, signer: nil, processing_try_index: 0 ) unless MESSAGE_SOURCE_TYPES.include?(type) raise ArgumentError.new("unknown type: #{type}; known types: #{MESSAGE_SOURCE_TYPES}") end super end def to_h h1 = { type: Helper.sym_to_capitalized_case_str(type) } h2 = case type when :encoded { message: , abi: abi&.to_h } when :encoding_params { abi: abi.to_h, address: address, deploy_set: deploy_set&.to_h, call_set: call_set&.to_h, signer: signer&.to_h, processing_try_index: processing_try_index } end h1.merge(h2) end end
- ParamsOfEncodeMessageBody =
KwStruct.new( :abi, :call_set, :is_internal, :signer, :processing_try_index, :address ) do def to_h { abi: abi.to_h, call_set: call_set.to_h, is_internal: is_internal, signer: signer.to_h, processing_try_index: processing_try_index, address: address } end end
- ResultOfEncodeMessageBody =
KwStruct.new(:body, :data_to_sign) do def initialize(body:, data_to_sign: nil) super end end
- ParamsOfAttachSignatureToMessageBody =
KwStruct.new(:abi, :public_key, :message, :signature) do def to_h { abi: abi.to_h, public_key: public_key, message: , signature: signature } end end
- ResultOfAttachSignatureToMessageBody =
KwStruct.new(:body)
- ParamsOfEncodeMessage =
KwStruct.new( :abi, :address, :deploy_set, :call_set, :signer, :processing_try_index ) do def initialize( abi:, address: nil, deploy_set: nil, call_set: nil, signer:, processing_try_index: 0 ) super end def to_h { abi: abi.to_h, address: address, deploy_set: deploy_set&.to_h, call_set: call_set&.to_h, signer: signer.to_h, processing_try_index: processing_try_index } end end
- ResultOfEncodeMessage =
KwStruct.new(:message, :data_to_sign, :address, :message_id) do def initialize(message:, data_to_sign: nil, address:, message_id:) super end end
- ParamsOfAttachSignature =
KwStruct.new(:abi, :public_key, :message, :signature) do def initialize(abi:, public_key:, message:, signature:) super end def to_h { abi: abi&.to_h, public_key: public_key, message: , signature: signature } end end
- ResultOfAttachSignature =
KwStruct.new(:message, :message_id) do def initialize(message:, message_id:) super end end
- ParamsOfDecodeMessage =
KwStruct.new(:abi, :message, :allow_partial) do def initialize(abi:, message:, allow_partial: false) super end def to_h { abi: abi&.to_h, message: , allow_partial: allow_partial } end end
- ParamsOfDecodeMessageBody =
KwStruct.new(:abi, :body, :is_internal, :allow_partial) do def initialize(abi:, body:, is_internal:, allow_partial: false) super end def to_h { abi: abi&.to_h, body: body, is_internal: is_internal, allow_partial: allow_partial } end end
- ParamsOfEncodeAccount =
KwStruct.new( :state_init, :balance, :last_trans_lt, :last_paid, :boc_cache ) do def to_h { state_init: state_init.to_h, balance: balance, last_trans_lt: last_trans_lt, last_paid: last_paid, boc_cache: boc_cache&.to_h } end end
- ResultOfEncodeAccount =
KwStruct.new(:account, :id_) do def initialize(account:, id_:) super end end
- ParamsOfEncodeInternalMessage =
KwStruct.new( :abi, :address, :src_address, :deploy_set, :call_set, :value, :bounce, :enable_ihr ) do def initialize( abi: nil, address: nil, src_address: nil, deploy_set: nil, call_set: nil, value:, bounce: nil, enable_ihr: nil ) super end end
- ResultOfEncodeInternalMessage =
KwStruct.new( :message, :address, :message_id ) do def initialize(message:, address:, message_id:) super end end
- ParamsOfDecodeAccountData =
KwStruct.new(:abi, :data, :allow_partial) do def initialize(abi:, data:, allow_partial: false) super end def to_h { abi: abi&.to_h, data: data, allow_partial: allow_partial } end end
- ResultOfDecodeAccountData =
KwStruct.new(:data)
- ParamsOfUpdateInitialData =
KwStruct.new( :data, :abi, :initial_data, :initial_pubkey, :boc_cache ) do def to_h { data: data, abi: abi&.to_h, initial_data: initial_data, initial_pubkey: initial_pubkey, boc_cache: boc_cache&.to_h } end end
- ResultOfUpdateInitialData =
KwStruct.new(:data)
- ParamsOfEncodeInitialData =
KwStruct.new(:abi, :initial_data, :initial_pubkey, :boc_cache) do def to_h { abi: abi&.to_h, initial_data: initial_data, initial_pubkey: initial_pubkey, boc_cache: boc_cache&.to_h } end end
- ResultOfEncodeInitialData =
KwStruct.new(:data)
- ParamsOfDecodeInitialData =
KwStruct.new(:data, :abi, :allow_partial) do def initialize(data:, abi:, allow_partial: false) super end def to_h { data: data, abi: abi&.to_h, allow_partial: allow_partial } end end
- ResultOfDecodeInitialData =
KwStruct.new(:initial_pubkey, :initial_data)
- ParamsOfDecodeBoc =
KwStruct.new(:params, :boc, :allow_partial) do def to_h { params: params&.map(&:to_h), boc: boc, allow_partial: allow_partial } end end
- ResultOfDecodeBoc =
KwStruct.new(:data)
- ParamsOfAbiEncodeBoc =
KwStruct.new(:params, :data, :boc_cache) do def to_h { params: params&.map(&:to_h), data: data, boc_cache: boc_cache&.to_h } end end
- ResultOfAbiEncodeBoc =
KwStruct.new(:boc)
- ParamsOfCalcFunctionId =
KwStruct.new(:abi, :function_name, :output) do def initialize(abi:, function_name:, output: false) super end def to_h { abi: abi&.to_h, function_name: function_name, output: output } end end
- ResultOfCalcFunctionId =
KwStruct.new(:function_id)
Class Method Summary collapse
- .attach_signature(ctx, params) ⇒ Object
- .attach_signature_to_message_body(ctx, params) ⇒ Object
- .calc_function_id(ctx, params) ⇒ Object
- .decode_account_data(ctx, params) ⇒ Object
- .decode_boc(ctx, params) ⇒ Object
- .decode_initial_data(ctx, params) ⇒ Object
- .decode_message(ctx, params) ⇒ Object
- .decode_message_body(ctx, params) ⇒ Object
- .encode_account(ctx, params) ⇒ Object
- .encode_boc(ctx, params) ⇒ Object
- .encode_initial_data(ctx, params) ⇒ Object
- .encode_internal_message(ctx, params) ⇒ Object
- .encode_message(ctx, params) ⇒ Object
-
.encode_message_body(ctx, params) ⇒ Object
functions.
- .update_initial_data(ctx, params) ⇒ Object
Class Method Details
.attach_signature(ctx, params) ⇒ Object
902 903 904 905 906 907 908 909 910 911 912 913 914 |
# File 'lib/ever_sdk_client/abi.rb', line 902 def self.attach_signature(ctx, params) Interop::request_to_native_lib(ctx, "abi.attach_signature", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfAttachSignature.new( message: resp.result["message"], message_id: resp.result["message_id"]) ) else yield resp end end end |
.attach_signature_to_message_body(ctx, params) ⇒ Object
873 874 875 876 877 878 879 880 881 882 883 |
# File 'lib/ever_sdk_client/abi.rb', line 873 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.attach_signature_to_message_body", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfAttachSignatureToMessageBody.new(body: resp.result["body"]) ) else yield resp end end end |
.calc_function_id(ctx, params) ⇒ Object
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 |
# File 'lib/ever_sdk_client/abi.rb', line 1056 def self.calc_function_id(ctx, params) Interop::request_to_native_lib(ctx, "abi.calc_function_id", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfCalcFunctionId.new( function_id: resp.result["function_id"] ) ) else yield resp end end end |
.decode_account_data(ctx, params) ⇒ Object
971 972 973 974 975 976 977 978 979 980 981 982 983 |
# File 'lib/ever_sdk_client/abi.rb', line 971 def self.decode_account_data(ctx, params) Interop::request_to_native_lib(ctx, "abi.decode_account_data", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfDecodeAccountData.new( data: resp.result["data"] ) ) else yield resp end end end |
.decode_boc(ctx, params) ⇒ Object
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 |
# File 'lib/ever_sdk_client/abi.rb', line 1028 def self.decode_boc(ctx, params) Interop::request_to_native_lib(ctx, "abi.decode_boc", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfDecodeBoc.new( data: resp.result["data"] ) ) else yield resp end end end |
.decode_initial_data(ctx, params) ⇒ Object
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 |
# File 'lib/ever_sdk_client/abi.rb', line 1013 def self.decode_initial_data(ctx, params) Interop::request_to_native_lib(ctx, "abi.decode_initial_data", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfDecodeInitialData.new( initial_pubkey: resp.result["initial_pubkey"], initial_data: resp.result["initial_data"] ) ) else yield resp end end end |
.decode_message(ctx, params) ⇒ Object
916 917 918 919 920 921 922 923 924 925 926 |
# File 'lib/ever_sdk_client/abi.rb', line 916 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.decode_message", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: DecodedMessageBody.from_json(resp.result) ) else yield resp end end end |
.decode_message_body(ctx, params) ⇒ Object
928 929 930 931 932 933 934 935 936 937 938 |
# File 'lib/ever_sdk_client/abi.rb', line 928 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.decode_message_body", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: DecodedMessageBody.from_json(resp.result) ) else yield resp end end end |
.encode_account(ctx, params) ⇒ Object
940 941 942 943 944 945 946 947 948 949 950 951 952 953 |
# File 'lib/ever_sdk_client/abi.rb', line 940 def self.encode_account(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_account", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfEncodeAccount.new( account: resp.result["account"], id_: resp.result["id"] ) ) else yield resp end end end |
.encode_boc(ctx, params) ⇒ Object
1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 |
# File 'lib/ever_sdk_client/abi.rb', line 1042 def self.encode_boc(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_boc", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfAbiEncodeBoc.new( boc: resp.result["boc"] ) ) else yield resp end end end |
.encode_initial_data(ctx, params) ⇒ Object
999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/ever_sdk_client/abi.rb', line 999 def self.encode_initial_data(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_initial_data", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfEncodeInitialData.new( data: resp.result["data"] ) ) else yield resp end end end |
.encode_internal_message(ctx, params) ⇒ Object
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 |
# File 'lib/ever_sdk_client/abi.rb', line 955 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_internal_message", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfEncodeInternalMessage.new( message: resp.result["message"], address: resp.result["address"], message_id: resp.result["message_id"] ) ) else yield resp end end end |
.encode_message(ctx, params) ⇒ Object
885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
# File 'lib/ever_sdk_client/abi.rb', line 885 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_message", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfEncodeMessage.new( message: resp.result["message"], data_to_sign: resp.result["data_to_sign"], address: resp.result["address"], message_id: resp.result["message_id"] ) ) else yield resp end end end |
.encode_message_body(ctx, params) ⇒ Object
functions
859 860 861 862 863 864 865 866 867 868 869 870 871 |
# File 'lib/ever_sdk_client/abi.rb', line 859 def self.(ctx, params) Interop::request_to_native_lib(ctx, "abi.encode_message_body", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfEncodeMessageBody.new( body: resp.result["body"], data_to_sign: resp.result["data_to_sign"]) ) else yield resp end end end |
.update_initial_data(ctx, params) ⇒ Object
985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File 'lib/ever_sdk_client/abi.rb', line 985 def self.update_initial_data(ctx, params) Interop::request_to_native_lib(ctx, "abi.update_initial_data", params) do |resp| if resp.success? yield NativeLibResponseResult.new( result: ResultOfUpdateInitialData.new( data: resp.result["data"] ) ) else yield resp end end end |