Skip to content

Commit 0efbc43

Browse files
authored
Merge pull request #16 from dojoengine/libp2p
feat: libp2p, wasm ios and git lfs for libs
2 parents 521c008 + 05d1c94 commit 0efbc43

File tree

136 files changed

+43589
-23831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+43589
-23831
lines changed

.DS_Store

2 KB
Binary file not shown.

.gitattributes

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
Assets/WebGLTemplates/TemplateData/* linguist-vendored
1+
Assets/WebGLTemplates/TemplateData/* linguist-vendored
2+
*.dll filter=lfs diff=lfs merge=lfs -text
3+
*.a filter=lfs diff=lfs merge=lfs -text

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,10 @@ crashlytics-build.properties
7171
/[Aa]ssets/[Ss]treamingAssets/aa.meta
7272
/[Aa]ssets/[Ss]treamingAssets/aa/*
7373

74-
.DS_Store
74+
.DS_Store
75+
76+
# builds
77+
dojo-webgl
78+
dojo-ios
79+
dojo-macos
80+
dojo-windows

.vscode/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,8 @@
5151
"temp/": true,
5252
"Temp/": true
5353
},
54-
"dotnet.defaultSolution": "Dojo.sln"
54+
"dotnet.defaultSolution": "Dojo.sln",
55+
"rust-analyzer.linkedProjects": [
56+
"./Bindings/dojo.c/Cargo.toml"
57+
]
5558
}

Assets/Dojo/.DS_Store

0 Bytes
Binary file not shown.
Binary file not shown.

Assets/Dojo/Libraries/aarch64-apple-darwin/libdojo_c.dylib.meta

-33
This file was deleted.
Binary file not shown.

Assets/Dojo/Libraries/x86_64-unknown-linux-gnu.meta

-8
This file was deleted.

Assets/Dojo/Libraries/x86_64-unknown-linux-gnu/libdojo_c.so.meta

-27
This file was deleted.

Assets/Dojo/Libraries.meta renamed to Assets/Dojo/Plugins/Linux.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Dojo/Plugins/Linux/libdojo_c.so.meta

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Dojo/Plugins/WebGL/torii_c.jslib

+44-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mergeInto(LibraryManager.library, {
33
CreateClient: async function (
44
rpcUrl,
55
toriiUrl,
6+
relayUrl,
67
worldAddress,
78
// callbackObjectName,
89
// callbackMethodName
@@ -11,6 +12,7 @@ mergeInto(LibraryManager.library, {
1112
var client = await wasm_bindgen.createClient([], {
1213
rpcUrl: UTF8ToString(rpcUrl),
1314
toriiUrl: UTF8ToString(toriiUrl),
15+
relayUrl: UTF8ToString(relayUrl),
1416
worldAddress: UTF8ToString(worldAddress),
1517
});
1618

@@ -81,11 +83,7 @@ mergeInto(LibraryManager.library, {
8183

8284
dynCall_vi(cb, buffer);
8385
},
84-
OnEntityUpdated: function (
85-
clientPtr,
86-
ids,
87-
cb
88-
) {
86+
OnEntityUpdated: function (clientPtr, ids, cb) {
8987
var client = wasm_bindgen.Client.__wrap(clientPtr);
9088
var idsString = UTF8ToString(ids);
9189
var idsArray = JSON.parse(idsString);
@@ -132,4 +130,45 @@ mergeInto(LibraryManager.library, {
132130
);
133131
});
134132
},
133+
// Subscribes to a topic
134+
SubscribeTopic: async function (clientPtr, topic, cb) {
135+
var client = wasm_bindgen.Client.__wrap(clientPtr);
136+
const subscribed = await client.subscribeTopic(UTF8ToString(topic));
137+
dynCall_vi(cb, subscribed);
138+
},
139+
// Unsubscribes from a topic
140+
UnsubscribeTopic: async function (clientPtr, topic, cb) {
141+
var client = wasm_bindgen.Client.__wrap(clientPtr);
142+
const unsubscribed = await client.unsubscribeTopic(UTF8ToString(topic));
143+
dynCall_vi(cb, unsubscribed);
144+
},
145+
// Publishes a message to topic and returns the message id
146+
PublishMessage: async function (clientPtr, topic, message, cb) {
147+
var client = wasm_bindgen.Client.__wrap(clientPtr);
148+
const published = await client.publishMessage(UTF8ToString(topic), JSON.parse(UTF8ToString(message)));
149+
const publishedString = JSON.stringify(Array.from(published));
150+
const bufferSize = lengthBytesUTF8(publishedString) + 1;
151+
const buffer = _malloc(bufferSize);
152+
stringToUTF8(publishedString, buffer, bufferSize);
153+
154+
dynCall_vi(cb, buffer);
155+
},
156+
OnMessage: async function (clientPtr, cb) {
157+
var client = wasm_bindgen.Client.__wrap(clientPtr);
158+
client.onMessage((propagationSource, source, messageId, topic, data) => {
159+
const messageString = JSON.stringify({
160+
propagationSource,
161+
source,
162+
messageId,
163+
topic,
164+
data: Array.from(data),
165+
});
166+
167+
const bufferSize = lengthBytesUTF8(messageString) + 1;
168+
const buffer = _malloc(bufferSize);
169+
stringToUTF8(messageString, buffer, bufferSize);
170+
171+
dynCall_vi(cb, buffer);
172+
});
173+
},
135174
});

Assets/Dojo/Libraries/aarch64-apple-darwin.meta renamed to Assets/Dojo/Plugins/Windows.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:bf4909b49de33770a91fbfca0d15964fa57bad6e11beafe701942b5d3e09f086
3+
size 56602246

Assets/Dojo/Libraries/x86_64-pc-windows-gnu/libdojo_c.dll.meta renamed to Assets/Dojo/Plugins/Windows/libdojo_c.dll.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Dojo/Libraries/x86_64-apple-darwin.meta renamed to Assets/Dojo/Plugins/iOS.meta

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Dojo/Plugins/iOS/libdojo_c.a

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7d564f40c15bf64fbdca07a8653cf4b6e79f133c539293a4f51fffe4fa1f32b3
3+
size 286646408

Assets/Dojo/Plugins/iOS/libdojo_c.a.meta

+82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)