Skip to content

Commit

Permalink
Merge pull request #72 from NEARBuilders/keypom-support
Browse files Browse the repository at this point in the history
Working keypom support
  • Loading branch information
elliotBraem authored Jan 19, 2024
2 parents d8ccc35 + 7343cff commit 4681ba4
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"dependencies": {
"@monaco-editor/react": "^4.4.6",
"@keypom/selector": "1.2.3",
"@near-wallet-selector/core": "^8.5.0",
"@near-wallet-selector/here-wallet": "^8.5.0",
"@near-wallet-selector/meteor-wallet": "^8.5.0",
Expand Down
15 changes: 14 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupNeth } from "@near-wallet-selector/neth";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupSender } from "@near-wallet-selector/sender";
import { setupKeypom } from "@keypom/selector";
import { KEYPOM_OPTIONS } from "./utils/keypom-options";
import "App.scss";
import Big from "big.js";
import "bootstrap-icons/font/bootstrap-icons.css";
Expand Down Expand Up @@ -78,6 +80,17 @@ function App() {
bundle: false,
}),
setupNightly(),
setupKeypom({
networkId: NetworkId,
signInContractId: NetworkId == "testnet" ? "v1.social08.testnet" : "social.near",
trialAccountSpecs: {
url: NetworkId == "testnet" ? "https://test.nearbuilders.org/#trial-url/ACCOUNT_ID/SECRET_KEY" : "https://nearbuilders.org/#trial-url/ACCOUNT_ID/SECRET_KEY",
modalOptions: KEYPOM_OPTIONS(NetworkId)
},
instantSignInSpecs: {
url: NetworkId == 'testnet' ? 'https://test.nearbuilders.org/#instant-url/ACCOUNT_ID/SECRET_KEY/MODULE_ID' : 'https://nearbuilders.org/#instant-url/ACCOUNT_ID/SECRET_KEY/MODULE_ID',
},
}),
],
}),
customElements: {
Expand Down Expand Up @@ -218,4 +231,4 @@ function App() {
);
}

export default App;
export default App;
2 changes: 0 additions & 2 deletions src/pages/EditorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
StorageType,
toPath,
} from "../components/Editor/FileTab";
import { useHashRouterLegacy } from "../hooks/useHashRouterLegacy";
import vmTypesDeclaration from "raw-loader!near-social-vm-types";
import styled from "styled-components";
import { useBosLoaderStore } from "../stores/bos-loader";
Expand Down Expand Up @@ -105,7 +104,6 @@ const Layout = {
};

export default function EditorPage(props) {
useHashRouterLegacy();
const { widgetSrc } = useParams();
const history = useHistory();
const redirectMapStore = useBosLoaderStore();
Expand Down
2 changes: 0 additions & 2 deletions src/pages/FeedPage.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Widget } from "near-social-vm";
import React, { useEffect, useState } from "react";
import { useQuery } from "../hooks/useQuery";
import { useHashRouterLegacy } from "../hooks/useHashRouterLegacy";
import { useBosLoaderStore } from "../stores/bos-loader";

export default function FeedPage(props) {
useHashRouterLegacy();
const redirectMapStore = useBosLoaderStore();

const src = props.widgets.feed;
Expand Down
2 changes: 0 additions & 2 deletions src/pages/ResourcesPage.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Widget } from "near-social-vm";
import React from "react";
import { useHashRouterLegacy } from "../hooks/useHashRouterLegacy";
import { useBosLoaderStore } from "../stores/bos-loader";

export default function ResourcesPage(props) {
useHashRouterLegacy();
const redirectMapStore = useBosLoaderStore();

const src = props.widgets.resources;
Expand Down
2 changes: 0 additions & 2 deletions src/pages/ViewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import React, { useEffect, useState } from "react";
import { Widget } from "near-social-vm";
import { useParams } from "react-router-dom";
import { useQuery } from "../hooks/useQuery";
import { useHashRouterLegacy } from "../hooks/useHashRouterLegacy";
import { useBosLoaderStore } from "../stores/bos-loader";

export default function ViewPage(props) {
useHashRouterLegacy();

const { widgetSrc } = useParams();
const query = useQuery();
Expand Down
54 changes: 54 additions & 0 deletions src/utils/keypom-options.js

Large diffs are not rendered by default.

38 changes: 34 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,26 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"

"@keypom/[email protected]":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@keypom/core/-/core-1.0.2.tgz#65bffdeb753baea14deb9a204582377abe90793b"
integrity sha512-FFmOwbZCj3g8IHEdnhbTMHIp53rKjcorOlyoIKk0HaoC8rB/+Cl/BP6It1HP6DxGHorccs7yB4RXBnJei60hAg==
dependencies:
"@near-wallet-selector/core" "^8.0.3"
bn.js "^5.2.1"
borsh "^0.7.0"
near-seed-phrase "^0.2.0"
util "^0.12.5"

"@keypom/[email protected]":
version "1.2.3"
resolved "https://registry.yarnpkg.com/@keypom/selector/-/selector-1.2.3.tgz#93a53129714fb69ef13dd2cfc2621888107e7e36"
integrity sha512-Z/VlZwhSt3NJ+Dv5AkgXNZ2rcFbbrd4F2sC5oTDm/TH6ocoyx5MR6ltxCWEP5/D/8Zi1MghtCtZpxrh1sHub5A==
dependencies:
"@keypom/core" "1.0.2"
bn.js "^5.2.1"
borsh "^0.7.0"

"@ledgerhq/connect-kit-loader@^1.1.0":
version "1.1.8"
resolved "https://registry.yarnpkg.com/@ledgerhq/connect-kit-loader/-/connect-kit-loader-1.1.8.tgz#6cc32191660dd9d6e8f89047af09b0f201e30190"
Expand Down Expand Up @@ -2196,6 +2216,16 @@
js-sha256 "0.9.0"
rxjs "7.8.1"

"@near-wallet-selector/core@^8.0.3":
version "8.9.2"
resolved "https://registry.yarnpkg.com/@near-wallet-selector/core/-/core-8.9.2.tgz#738583255f2a7a57a9731de503e187f6a651abfb"
integrity sha512-vCUoVOezCn5+5etHT0ejzgJ7DpnkUjLasYLYjjUh+E2BlUzrI63qMWfvdL8eoUoELXY7vtJVMEy/Td1kgrt10w==
dependencies:
borsh "0.7.0"
events "3.3.0"
js-sha256 "0.9.0"
rxjs "7.8.1"

"@near-wallet-selector/here-wallet@^8.5.0":
version "8.5.0"
resolved "https://registry.npmjs.org/@near-wallet-selector/here-wallet/-/here-wallet-8.5.0.tgz"
Expand Down Expand Up @@ -8812,9 +8842,9 @@ near-hd-key@^1.2.1:
create-hmac "1.1.7"
tweetnacl "1.0.3"

[email protected]:
[email protected], near-seed-phrase@^0.2.0:
version "0.2.0"
resolved "https://registry.npmjs.org/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz"
resolved "https://registry.yarnpkg.com/near-seed-phrase/-/near-seed-phrase-0.2.0.tgz#fb7cf89682112b1160ab68abb50dc821f49be18a"
integrity sha512-NpmrnejpY1AdlRpDZ0schJQJtfBaoUheRfiYtQpcq9TkwPgqKZCRULV5L3hHmLc0ep7KRtikbPQ9R2ztN/3cyQ==
dependencies:
bip39-light "^1.0.7"
Expand Down Expand Up @@ -11551,9 +11581,9 @@ util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1:
resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==

util@^0.12.0:
util@^0.12.0, util@^0.12.5:
version "0.12.5"
resolved "https://registry.npmjs.org/util/-/util-0.12.5.tgz"
resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc"
integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==
dependencies:
inherits "^2.0.3"
Expand Down

0 comments on commit 4681ba4

Please sign in to comment.