Skip to content

Commit

Permalink
Merge pull request #16 from dojoengine/libp2p
Browse files Browse the repository at this point in the history
feat: libp2p, wasm ios and git lfs for libs
  • Loading branch information
Larkooo authored Jan 30, 2024
2 parents 521c008 + 05d1c94 commit 0efbc43
Show file tree
Hide file tree
Showing 136 changed files with 43,589 additions and 23,831 deletions.
Binary file modified .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
Assets/WebGLTemplates/TemplateData/* linguist-vendored
Assets/WebGLTemplates/TemplateData/* linguist-vendored
*.dll filter=lfs diff=lfs merge=lfs -text
*.a filter=lfs diff=lfs merge=lfs -text
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ crashlytics-build.properties
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

.DS_Store
.DS_Store

# builds
dojo-webgl
dojo-ios
dojo-macos
dojo-windows
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,8 @@
"temp/": true,
"Temp/": true
},
"dotnet.defaultSolution": "Dojo.sln"
"dotnet.defaultSolution": "Dojo.sln",
"rust-analyzer.linkedProjects": [
"./Bindings/dojo.c/Cargo.toml"
]
}
Binary file modified Assets/Dojo/.DS_Store
Binary file not shown.
Binary file not shown.
33 changes: 0 additions & 33 deletions Assets/Dojo/Libraries/aarch64-apple-darwin/libdojo_c.dylib.meta

This file was deleted.

Binary file not shown.
8 changes: 0 additions & 8 deletions Assets/Dojo/Libraries/x86_64-unknown-linux-gnu.meta

This file was deleted.

27 changes: 0 additions & 27 deletions Assets/Dojo/Libraries/x86_64-unknown-linux-gnu/libdojo_c.so.meta

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
82 changes: 82 additions & 0 deletions Assets/Dojo/Plugins/Linux/libdojo_c.so.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 44 additions & 5 deletions Assets/Dojo/Plugins/WebGL/torii_c.jslib
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mergeInto(LibraryManager.library, {
CreateClient: async function (
rpcUrl,
toriiUrl,
relayUrl,
worldAddress,
// callbackObjectName,
// callbackMethodName
Expand All @@ -11,6 +12,7 @@ mergeInto(LibraryManager.library, {
var client = await wasm_bindgen.createClient([], {
rpcUrl: UTF8ToString(rpcUrl),
toriiUrl: UTF8ToString(toriiUrl),
relayUrl: UTF8ToString(relayUrl),
worldAddress: UTF8ToString(worldAddress),
});

Expand Down Expand Up @@ -81,11 +83,7 @@ mergeInto(LibraryManager.library, {

dynCall_vi(cb, buffer);
},
OnEntityUpdated: function (
clientPtr,
ids,
cb
) {
OnEntityUpdated: function (clientPtr, ids, cb) {
var client = wasm_bindgen.Client.__wrap(clientPtr);
var idsString = UTF8ToString(ids);
var idsArray = JSON.parse(idsString);
Expand Down Expand Up @@ -132,4 +130,45 @@ mergeInto(LibraryManager.library, {
);
});
},
// Subscribes to a topic
SubscribeTopic: async function (clientPtr, topic, cb) {
var client = wasm_bindgen.Client.__wrap(clientPtr);
const subscribed = await client.subscribeTopic(UTF8ToString(topic));
dynCall_vi(cb, subscribed);
},
// Unsubscribes from a topic
UnsubscribeTopic: async function (clientPtr, topic, cb) {
var client = wasm_bindgen.Client.__wrap(clientPtr);
const unsubscribed = await client.unsubscribeTopic(UTF8ToString(topic));
dynCall_vi(cb, unsubscribed);
},
// Publishes a message to topic and returns the message id
PublishMessage: async function (clientPtr, topic, message, cb) {
var client = wasm_bindgen.Client.__wrap(clientPtr);
const published = await client.publishMessage(UTF8ToString(topic), JSON.parse(UTF8ToString(message)));
const publishedString = JSON.stringify(Array.from(published));
const bufferSize = lengthBytesUTF8(publishedString) + 1;
const buffer = _malloc(bufferSize);
stringToUTF8(publishedString, buffer, bufferSize);

dynCall_vi(cb, buffer);
},
OnMessage: async function (clientPtr, cb) {
var client = wasm_bindgen.Client.__wrap(clientPtr);
client.onMessage((propagationSource, source, messageId, topic, data) => {
const messageString = JSON.stringify({
propagationSource,
source,
messageId,
topic,
data: Array.from(data),
});

const bufferSize = lengthBytesUTF8(messageString) + 1;
const buffer = _malloc(bufferSize);
stringToUTF8(messageString, buffer, bufferSize);

dynCall_vi(cb, buffer);
});
},
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Dojo/Plugins/Windows/libdojo_c.dll
Git LFS file not shown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Assets/Dojo/Plugins/iOS/libdojo_c.a
Git LFS file not shown
82 changes: 82 additions & 0 deletions Assets/Dojo/Plugins/iOS/libdojo_c.a.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Loading

0 comments on commit 0efbc43

Please sign in to comment.