Skip to content

Commit

Permalink
Merge pull request #82 from dojoengine/update-clause-list
Browse files Browse the repository at this point in the history
feat: update bindings for clauses List in clauses
  • Loading branch information
Larkooo authored Dec 30, 2024
2 parents 3f0e22d + 4c85e1a commit 86a44f7
Show file tree
Hide file tree
Showing 20 changed files with 38,497 additions and 35,088 deletions.
Binary file modified Assets/Dojo/Plugins/Linux/libdojo_c.so
Binary file not shown.
4 changes: 2 additions & 2 deletions Assets/Dojo/Plugins/Windows/libdojo_c.dll
Git LFS file not shown
4 changes: 2 additions & 2 deletions Assets/Dojo/Plugins/iOS/libdojo_c.a
Git LFS file not shown
Binary file modified Assets/Dojo/Plugins/macOS/libdojo_c.bundle
Binary file not shown.
31 changes: 30 additions & 1 deletion Assets/Dojo/Runtime/Torii/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,21 +254,48 @@ public dojo.CompositeClause ToNative()
[Serializable]
public struct MemberValue
{
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public Primitive? Primitive;
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public string? String;
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public Primitive? Primitive;
public MemberValue[]? List;

public MemberValue(string value)
{
String = value;
Primitive = null;
List = null;

}

public MemberValue(Primitive primitive)
{
Primitive = primitive;
String = null;
List = null;
}

public MemberValue(MemberValue[] list)
{
List = list;
Primitive = null;
String = null;
}

public static implicit operator MemberValue(string value)
{
return new MemberValue(value);
}

public static implicit operator MemberValue(Primitive primitive)
{
return new MemberValue(primitive);
}

public static implicit operator MemberValue(MemberValue[] list)
{
return new MemberValue(list);
}

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

throw new InvalidOperationException("MemberValue must have one non-null value");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// To disable generating this file set `isEnabledGenerateAssemblyAttributes` to `false` in the config file for generating C# code.
// <auto-generated>
// This code was generated by the following tool on 2024-12-20 10:37:35 GMT+07:00:
// This code was generated by the following tool on 2024-12-27 13:52:58 GMT+07:00:
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
2 changes: 1 addition & 1 deletion Assets/Dojo/Runtime/bindings/client/Runtime.gen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// To disable generating this file set `isEnabledGeneratingRuntimeCode` to `false` in the config file for generating C# code.

// <auto-generated>
// This code was generated by the following tool on 2024-12-20 10:37:35 GMT+07:00:
// This code was generated by the following tool on 2024-12-27 13:52:58 GMT+07:00:
// https://github.com/bottlenoselabs/c2cs (v0.0.0.0)
//
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
Expand Down
131 changes: 127 additions & 4 deletions Assets/Dojo/Runtime/bindings/client/dojo.gen.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

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

[CNode(Kind = "Function")]
[DllImport(LibraryName, EntryPoint = "client_on_token_balance_update", CallingConvention = CallingConvention.Cdecl)]
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);

[CNode(Kind = "Function")]
[DllImport(LibraryName, EntryPoint = "client_publish_message", CallingConvention = CallingConvention.Cdecl)]
public static extern ResultCArrayu8 client_publish_message(ToriiClient* client, CString message, FieldElement* signature_felts, UIntPtr signature_felts_len);
Expand All @@ -119,7 +123,7 @@ public static unsafe partial class dojo

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

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

[CNode(Kind = "Function")]
[DllImport(LibraryName, EntryPoint = "client_update_token_balance_subscription", CallingConvention = CallingConvention.Cdecl)]
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);

[CNode(Kind = "Function")]
[DllImport(LibraryName, EntryPoint = "entity_free", CallingConvention = CallingConvention.Cdecl)]
public static extern void entity_free(Entity* entity);
Expand Down Expand Up @@ -289,6 +297,21 @@ public FnPtr_IndexerUpdate_Void(@delegate d)
}
}

[CNode(Kind = "FunctionPointer")]
[StructLayout(LayoutKind.Sequential)]
public struct FnPtr_TokenBalance_Void
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate void @delegate(TokenBalance param);

public IntPtr Pointer;

public FnPtr_TokenBalance_Void(@delegate d)
{
Pointer = Marshal.GetFunctionPointerForDelegate(d);
}
}

[CNode(Kind = "Struct")]
[StructLayout(LayoutKind.Explicit, Size = 40, Pack = 8)]
public struct BlockId
Expand Down Expand Up @@ -421,6 +444,17 @@ public struct CArrayMember
public UIntPtr data_len;
}

[CNode(Kind = "Struct")]
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
public struct CArrayMemberValue
{
[FieldOffset(0)] // size = 8
public MemberValue* data;

[FieldOffset(8)] // size = 8
public UIntPtr data_len;
}

[CNode(Kind = "Struct")]
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
public struct CArrayOrderBy
Expand Down Expand Up @@ -1218,6 +1252,33 @@ public string @string
@string_ = CString.FromString(value);
}
}

[FieldOffset(8)] // size = 16
public CArrayMemberValue _list;

public Span<MemberValue> list
{
get
{
fixed (MemberValue* @this = &this)
{
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
return span;
}
}

set
{

_list = new CArrayMemberValue();
_list.data_len = (UIntPtr)value.Length;
fixed (MemberValue* ptr = value)
{
_list.data = ptr;
}
}
}

}

[CNode(Kind = "Union")]
Expand All @@ -1241,6 +1302,33 @@ public string @string
@string_ = CString.FromString(value);
}
}

[FieldOffset(0)] // size = 16
public CArrayMemberValue _list;

public Span<MemberValue> list
{
get
{
fixed (MemberValue_ANONYMOUS_FIELD1* @this = &this)
{
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
return span;
}
}

set
{

_list = new CArrayMemberValue();
_list.data_len = (UIntPtr)value.Length;
fixed (MemberValue* ptr = value)
{
_list.data = ptr;
}
}
}

}

[CNode(Kind = "Struct")]
Expand Down Expand Up @@ -1271,6 +1359,38 @@ public string @string
}
}

[CNode(Kind = "Struct")]
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)]
public struct MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2
{
[FieldOffset(0)] // size = 16
public CArrayMemberValue _list;

public Span<MemberValue> list
{
get
{
fixed (MemberValue_ANONYMOUS_FIELD1_ANONYMOUS_FIELD2* @this = &this)
{
var span = new Span<MemberValue>(@this->_list.data, (int)@this->_list.data_len);
return span;
}
}

set
{

_list = new CArrayMemberValue();
_list.data_len = (UIntPtr)value.Length;
fixed (MemberValue* ptr = value)
{
_list.data = ptr;
}
}
}

}

[CNode(Kind = "Struct")]
[StructLayout(LayoutKind.Explicit, Size = 152, Pack = 8)]
public struct ModelMetadata
Expand Down Expand Up @@ -3425,7 +3545,9 @@ public enum ComparisonOperator : int
Gt = 2,
Gte = 3,
Lt = 4,
Lte = 5
Lte = 5,
In = 6,
NotIn = 7
}

[CNode(Kind = "Enum")]
Expand All @@ -3446,7 +3568,8 @@ public enum LogicalOperator : int
public enum MemberValue_Tag : int
{
Primitive = 0,
String = 1
String = 1,
List = 2
}

[CNode(Kind = "Enum")]
Expand Down
Loading

0 comments on commit 86a44f7

Please sign in to comment.