File tree Expand file tree Collapse file tree 5 files changed +38
-4
lines changed
Expand file tree Collapse file tree 5 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class Input
99 public string Name { get ; set ; }
1010 public string Type { get ; set ; }
1111
12- [ JsonProperty ( "multi_arg" ) ]
12+ [ JsonProperty ( "multi_arg" ) ]
1313 public bool MultiArg { get ; set ; }
1414 }
1515
@@ -40,11 +40,17 @@ public class Endpoint
4040 public string [ ] PayableInTokens { get ; set ; }
4141 }
4242
43+ public class Event
44+ {
45+ public string Identifier { get ; set ; }
46+ public Input [ ] Inputs { get ; set ; }
47+ }
48+
4349 public class Output
4450 {
4551 public string Type { get ; set ; }
4652
47- [ JsonProperty ( "multi_result" ) ]
53+ [ JsonProperty ( "multi_result" ) ]
4854 public bool MultiResult { get ; set ; }
4955 }
5056 }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ public class AbiDefinition
1212 {
1313 public string Name { get ; set ; }
1414 public Abi . Endpoint [ ] Endpoints { get ; set ; }
15+ public Abi . Event [ ] Events { get ; set ; }
1516 public Dictionary < string , Abi . CustomTypes > Types { get ; set ; }
1617
1718 public EndpointDefinition GetEndpointDefinition ( string endpoint )
@@ -28,6 +29,17 @@ public EndpointDefinition GetEndpointDefinition(string endpoint)
2829 return new EndpointDefinition ( endpoint , inputs . ToArray ( ) , outputs . ToArray ( ) ) ;
2930 }
3031
32+ public EventDefinition GetEventDefinition ( string identifier )
33+ {
34+ var data = Events . ToList ( ) . SingleOrDefault ( s => s . Identifier == identifier ) ?? throw new Exception ( "Event is not defined in ABI" ) ;
35+
36+ var inputs = data . Inputs is null ?
37+ new List < FieldDefinition > ( ) :
38+ data . Inputs . Select ( i => new FieldDefinition ( i . Name , "" , GetTypeValue ( i . Type ) ) ) . ToList ( ) ;
39+
40+ return new EventDefinition ( identifier , inputs . ToArray ( ) ) ;
41+ }
42+
3143 private TypeValue GetTypeValue ( string rustType )
3244 {
3345 var optional = new Regex ( "^optional<(.*)>$" ) ;
Original file line number Diff line number Diff line change 1+ using Mx . NET . SDK . Core . Domain . Values ;
2+
3+ namespace Mx . NET . SDK . Core . Domain . Abi
4+ {
5+ public class EventDefinition
6+ {
7+ public string Identifier { get ; }
8+ public FieldDefinition [ ] Input { get ; }
9+
10+ public EventDefinition ( string identifier , FieldDefinition [ ] input )
11+ {
12+ Identifier = identifier ;
13+ Input = input ;
14+ }
15+ }
16+ }
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public class NumericBinaryCodec : IBinaryCodec
2626 var payload = data . Slice ( BytesSizeOfU32 , BytesSizeOfU32 + sizeInBytes ) ;
2727 var bigNumber = Converter . ToBigInteger ( payload , ! type . HasSign ( ) , isBigEndian : true ) ;
2828
29- return ( new NumericValue ( type , bigNumber ) , sizeInBytes + payload . Length ) ;
29+ return ( new NumericValue ( type , bigNumber ) , BytesSizeOfU32 + payload . Length ) ;
3030 }
3131 }
3232
Original file line number Diff line number Diff line change 1111 <RepositoryUrl >https://github.com/RemarkableTools/Mx.NET.SDK</RepositoryUrl >
1212 <RepositoryType >GitHub</RepositoryType >
1313 <Company >Remarkable Tools</Company >
14- <Version >2.0.1 </Version >
14+ <Version >2.0.2 </Version >
1515 <AutoGenerateBindingRedirects >true</AutoGenerateBindingRedirects >
1616 <Title >RemarkableTools.Mx</Title >
1717 <PackageReadmeFile >README.md</PackageReadmeFile >
You can’t perform that action at this time.
0 commit comments