Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scry methods and playground app #9

Draft
wants to merge 23 commits into
base: near-handler
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/near/node_modules
/.pnp
.pnp.js

Expand All @@ -10,6 +10,7 @@

# production
/build
/near/dist

# misc
.DS_Store
Expand Down
2 changes: 0 additions & 2 deletions near/dist/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions near/dist/index.js.LICENSE.txt

This file was deleted.

12 changes: 6 additions & 6 deletions near/package-lock.json

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

18 changes: 12 additions & 6 deletions near/src/lib/vm/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import jsx from "acorn-jsx";
import { ethers } from "ethers";
import { Web3ConnectButton } from "../components/ethers";
import { isValidAttribute } from "dompurify";
import UrbitApi from "@urbit/http-api";
import Urbit from "@urbit/http-api";

// Radix:
import * as Accordion from "@radix-ui/react-accordion";
Expand Down Expand Up @@ -1491,8 +1491,8 @@ export default class VM {
widgetConfigs.findLast((config) => config && config.networkId)
?.networkId || near.config.networkId;

this.urbitApi = new UrbitApi('');
this.urbitApi.ship = window.ship;
this.UrbitApi = new Urbit('');
this.UrbitApi.ship = window.ship;

this.globalFunctions = this.initGlobalFunctions();
}
Expand Down Expand Up @@ -1836,15 +1836,15 @@ export default class VM {
const Urbit = {
aribtraryPoke: async (app, mark, json) => {
try {
if (!this.urbitApi) {
if (!this.UrbitApi) {
throw new Error("Urbit HTTP API not properly initialized");
}

if (!window.ship) {
throw new Error("No Urbit server connected");
}

const response = await this.urbitApi.poke({
const response = await this.UrbitApi.poke({
app: app,
mark: mark,
json: json,
Expand All @@ -1859,7 +1859,13 @@ export default class VM {
}
},
pokeNearHandler: (json) => {
return aribtraryPoke("near-handler", "action", json)
return aribtraryPoke("near-handler", "action", json);
bonbud-macryg marked this conversation as resolved.
Show resolved Hide resolved
},
scryUrbit: (app, path) => {
return UrbitApi.scry(app, path);
},
scryNearHandler: (path) => {
return scryUrbit("near-handler", path);
},
};

Expand Down
Loading