Skip to content

Commit 86a44f7

Browse files
authored
Merge pull request #82 from dojoengine/update-clause-list
feat: update bindings for clauses List in clauses
2 parents 3f0e22d + 4c85e1a commit 86a44f7

20 files changed

+38497
-35088
lines changed
102 KB
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:815232333d0563e55606f9ef57f13b2b1e25fa82edc41961f7d54710c5e300de
3-
size 47939364
2+
oid sha256:07d344aa96857382b958069ddb669210977d9366fe6bbe429997532617f47a01
3+
size 48081474

Assets/Dojo/Plugins/iOS/libdojo_c.a

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:cd1c451df54a0297a05a27f05207e963ee0b9aa912c5c104ab8c20be0b2eb45d
3-
size 141855640
2+
oid sha256:57a7a105a1ac06ca97f104f5d3f1b21f6d38c38998be4ece27852053f14f55d7
3+
size 142048488
252 KB
Binary file not shown.

Assets/Dojo/Runtime/Torii/Query.cs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,48 @@ public dojo.CompositeClause ToNative()
254254
[Serializable]
255255
public struct MemberValue
256256
{
257+
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
258+
public Primitive? Primitive;
257259
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
258260
public string? String;
259261
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
260-
public Primitive? Primitive;
262+
public MemberValue[]? List;
261263

262264
public MemberValue(string value)
263265
{
264266
String = value;
265267
Primitive = null;
268+
List = null;
269+
266270
}
267271

268272
public MemberValue(Primitive primitive)
269273
{
270274
Primitive = primitive;
271275
String = null;
276+
List = null;
277+
}
278+
279+
public MemberValue(MemberValue[] list)
280+
{
281+
List = list;
282+
Primitive = null;
283+
String = null;
284+
}
285+
286+
public static implicit operator MemberValue(string value)
287+
{
288+
return new MemberValue(value);
289+
}
290+
291+
public static implicit operator MemberValue(Primitive primitive)
292+
{
293+
return new MemberValue(primitive);
294+
}
295+
296+
public static implicit operator MemberValue(MemberValue[] list)
297+
{
298+
return new MemberValue(list);
272299
}
273300

274301
public dojo.MemberValue ToNative()
@@ -277,6 +304,8 @@ public dojo.MemberValue ToNative()
277304
return new dojo.MemberValue { tag = dojo.MemberValue_Tag.String, @string = String };
278305
if (Primitive.HasValue)
279306
return new dojo.MemberValue { tag = dojo.MemberValue_Tag.Primitive, primitive = Primitive.Value.ToNative() };
307+
if (List != null)
308+
return new dojo.MemberValue { tag = dojo.MemberValue_Tag.List, list = List.Select(l => l.ToNative()).ToArray() };
280309

281310
throw new InvalidOperationException("MemberValue must have one non-null value");
282311
}

Assets/Dojo/Runtime/bindings/client/AssemblyAttributes.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// To disable generating this file set `isEnabledGenerateAssemblyAttributes` to `false` in the config file for generating C# code.
22
// <auto-generated>
3-
// This code was generated by the following tool on 2024-12-20 10:37:35 GMT+07:00:
3+
// This code was generated by the following tool on 2024-12-27 13:52:58 GMT+07:00:
44
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
55
//
66
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.

Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// To disable generating this file set `isEnabledGeneratingRuntimeCode` to `false` in the config file for generating C# code.
33

44
// <auto-generated>
5-
// This code was generated by the following tool on 2024-12-20 10:37:35 GMT+07:00:
5+
// This code was generated by the following tool on 2024-12-27 13:52:58 GMT+07:00:
66
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
77
//
88
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.

Assets/Dojo/Runtime/bindings/client/dojo.gen.cs

Lines changed: 127 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
// <auto-generated>
3-
// This code was generated by the following tool on 2024-12-20 10:37:35 GMT+07:00:
3+
// This code was generated by the following tool on 2024-12-27 13:52:58 GMT+07:00:
44
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
55
//
66
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
@@ -109,6 +109,10 @@ public static unsafe partial class dojo
109109
[DllImport(LibraryName, EntryPoint = "client_on_starknet_event", CallingConvention = CallingConvention.Cdecl)]
110110
public static extern ResultSubscription client_on_starknet_event(ToriiClient* client, EntityKeysClause* clauses, UIntPtr clauses_len, FnPtr_Event_Void callback);
111111

112+
[CNode(Kind = "Function")]
113+
[DllImport(LibraryName, EntryPoint = "client_on_token_balance_update", CallingConvention = CallingConvention.Cdecl)]
114+
public static extern ResultSubscription client_on_token_balance_update(ToriiClient* client, FieldElement* contract_addresses, UIntPtr contract_addresses_len, FieldElement* account_addresses, UIntPtr account_addresses_len, FnPtr_TokenBalance_Void callback);
115+
112116
[CNode(Kind = "Function")]
113117
[DllImport(LibraryName, EntryPoint = "client_publish_message", CallingConvention = CallingConvention.Cdecl)]
114118
public static extern ResultCArrayu8 client_publish_message(ToriiClient* client, CString message, FieldElement* signature_felts, UIntPtr signature_felts_len);
@@ -119,7 +123,7 @@ public static unsafe partial class dojo
119123

120124
[CNode(Kind = "Function")]
121125
[DllImport(LibraryName, EntryPoint = "client_token_balances", CallingConvention = CallingConvention.Cdecl)]
122-
public static extern ResultCArrayTokenBalance client_token_balances(ToriiClient* client, FieldElement* account_addresses, UIntPtr account_addresses_len, FieldElement* contract_addresses, UIntPtr contract_addresses_len);
126+
public static extern ResultCArrayTokenBalance client_token_balances(ToriiClient* client, FieldElement* contract_addresses, UIntPtr contract_addresses_len, FieldElement* account_addresses, UIntPtr account_addresses_len);
123127

124128
[CNode(Kind = "Function")]
125129
[DllImport(LibraryName, EntryPoint = "client_tokens", CallingConvention = CallingConvention.Cdecl)]
@@ -133,6 +137,10 @@ public static unsafe partial class dojo
133137
[DllImport(LibraryName, EntryPoint = "client_update_event_message_subscription", CallingConvention = CallingConvention.Cdecl)]
134138
public static extern Resultbool client_update_event_message_subscription(ToriiClient* client, Subscription* subscription, EntityKeysClause* clauses, UIntPtr clauses_len, CBool historical);
135139

140+
[CNode(Kind = "Function")]
141+
[DllImport(LibraryName, EntryPoint = "client_update_token_balance_subscription", CallingConvention = CallingConvention.Cdecl)]
142+
public static extern Resultbool client_update_token_balance_subscription(ToriiClient* client, Subscription* subscription, FieldElement* contract_addresses, UIntPtr contract_addresses_len, FieldElement* account_addresses, UIntPtr account_addresses_len);
143+
136144
[CNode(Kind = "Function")]
137145
[DllImport(LibraryName, EntryPoint = "entity_free", CallingConvention = CallingConvention.Cdecl)]
138146
public static extern void entity_free(Entity* entity);
@@ -289,6 +297,21 @@ public FnPtr_IndexerUpdate_Void(@delegate d)
289297
}
290298
}
291299

300+
[CNode(Kind = "FunctionPointer")]
301+
[StructLayout(LayoutKind.Sequential)]
302+
public struct FnPtr_TokenBalance_Void
303+
{
304+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
305+
public unsafe delegate void @delegate(TokenBalance param);
306+
307+
public IntPtr Pointer;
308+
309+
public FnPtr_TokenBalance_Void(@delegate d)
310+
{
311+
Pointer = Marshal.GetFunctionPointerForDelegate(d);
312+
}
313+
}
314+
292315
[CNode(Kind = "Struct")]
293316
[StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)]
294317
public struct BlockId
@@ -421,6 +444,17 @@ public struct CArrayMember
421444
public UIntPtr data_len;
422445
}
423446

447+
[CNode(Kind = "Struct")]
448+
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
449+
public struct CArrayMemberValue
450+
{
451+
[FieldOffset(0)] // size = 8
452+
public MemberValue* data;
453+
454+
[FieldOffset(8)] // size = 8
455+
public UIntPtr data_len;
456+
}
457+
424458
[CNode(Kind = "Struct")]
425459
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
426460
public struct CArrayOrderBy
@@ -1218,6 +1252,33 @@ public string @string
12181252
@string_ = CString.FromString(value);
12191253
}
12201254
}
1255+
1256+
[FieldOffset(8)] // size = 16
1257+
public CArrayMemberValue _list;
1258+
1259+
public Span<MemberValue> list
1260+
{
1261+
get
1262+
{
1263+
fixed (MemberValue* @this = &this)
1264+
{
1265+
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
1266+
return span;
1267+
}
1268+
}
1269+
1270+
set
1271+
{
1272+
1273+
_list = new CArrayMemberValue();
1274+
_list.data_len = (UIntPtr)value.Length;
1275+
fixed (MemberValue* ptr = value)
1276+
{
1277+
_list.data = ptr;
1278+
}
1279+
}
1280+
}
1281+
12211282
}
12221283

12231284
[CNode(Kind = "Union")]
@@ -1241,6 +1302,33 @@ public string @string
12411302
@string_ = CString.FromString(value);
12421303
}
12431304
}
1305+
1306+
[FieldOffset(0)] // size = 16
1307+
public CArrayMemberValue _list;
1308+
1309+
public Span<MemberValue> list
1310+
{
1311+
get
1312+
{
1313+
fixed (MemberValue_ANONYMOUS_FIELD1* @this = &this)
1314+
{
1315+
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
1316+
return span;
1317+
}
1318+
}
1319+
1320+
set
1321+
{
1322+
1323+
_list = new CArrayMemberValue();
1324+
_list.data_len = (UIntPtr)value.Length;
1325+
fixed (MemberValue* ptr = value)
1326+
{
1327+
_list.data = ptr;
1328+
}
1329+
}
1330+
}
1331+
12441332
}
12451333

12461334
[CNode(Kind = "Struct")]
@@ -1271,6 +1359,38 @@ public string @string
12711359
}
12721360
}
12731361

1362+
[CNode(Kind = "Struct")]
1363+
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
1364+
public struct MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2
1365+
{
1366+
[FieldOffset(0)] // size = 16
1367+
public CArrayMemberValue _list;
1368+
1369+
public Span<MemberValue> list
1370+
{
1371+
get
1372+
{
1373+
fixed (MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2* @this = &this)
1374+
{
1375+
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
1376+
return span;
1377+
}
1378+
}
1379+
1380+
set
1381+
{
1382+
1383+
_list = new CArrayMemberValue();
1384+
_list.data_len = (UIntPtr)value.Length;
1385+
fixed (MemberValue* ptr = value)
1386+
{
1387+
_list.data = ptr;
1388+
}
1389+
}
1390+
}
1391+
1392+
}
1393+
12741394
[CNode(Kind = "Struct")]
12751395
[StructLayout(LayoutKind.Explicit, Size = 152, Pack = 8)]
12761396
public struct ModelMetadata
@@ -3425,7 +3545,9 @@ public enum ComparisonOperator : int
34253545
Gt = 2,
34263546
Gte = 3,
34273547
Lt = 4,
3428-
Lte = 5
3548+
Lte = 5,
3549+
In = 6,
3550+
NotIn = 7
34293551
}
34303552

34313553
[CNode(Kind = "Enum")]
@@ -3446,7 +3568,8 @@ public enum LogicalOperator : int
34463568
public enum MemberValue_Tag : int
34473569
{
34483570
Primitive = 0,
3449-
String = 1
3571+
String = 1,
3572+
List = 2
34503573
}
34513574

34523575
[CNode(Kind = "Enum")]

0 commit comments

Comments
 (0)