Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

fix: config the interactive tutorial to use Verida mainnet #227

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 13 additions & 6 deletions docs/tutorial/SSO.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ VeridaLoginExample = () => {
const [veridaContext, setVeridaContext] = useState(undefined);
const [walletAddress, setWalletAddress] = useState(null);
const [message, setMessage] = useState(null);
this.CONTEXT_NAME = 'Verida Tutorial';
const contextName = 'Verida Tutorial';
const veridaNetwork = 'mainnet';
// It can be any Polygon mainnet public RPC
const rpcUrl = 'https://polygon-rpc.com';

React.useEffect(async () => {
// Runs after the first render() lifecycle
Expand All @@ -42,7 +45,7 @@ VeridaLoginExample = () => {
// Check if we have a stored session
// hasSession is from the package "@verida/account-web-vault"
// see below fod links to documentation
if (hasSession(this.CONTEXT_NAME)) {
if (hasSession(contextName)) {
// we know we have a session already
login(); // when logged in this will just setup a Verida Context
}
Expand All @@ -60,11 +63,15 @@ VeridaLoginExample = () => {

const context = await Network.connect({
client: {
environment: 'testnet'
environment: veridaNetwork,
didClientConfig: {
network: veridaNetwork,
rpcURL: rpcUrl,
}
},
account: account,
context: {
name: this.CONTEXT_NAME
name: contextName
}
});

Expand All @@ -76,7 +83,7 @@ VeridaLoginExample = () => {

logout = async function () {
// disconnect the Verida session
await veridaContext.account.disconnect(this.CONTEXT_NAME);
await veridaContext.account.disconnect(contextName);
// reset the internal state
setVeridaContext(undefined);
};
Expand All @@ -90,7 +97,7 @@ VeridaLoginExample = () => {
return (
<div>
<h3>
Logged in! Your <a href='/docs/concepts/accounts-and-identity'>DID</a>
Logged in! Your <a href='/docs/concepts/accounts-and-identity'>DID</a>
is: <pre>{veridaContext.account.accountDid}</pre>
</h3>
<button onClick={this.logout}>Logout</button>
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"@docusaurus/theme-search-algolia": "^2.4.3",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
"@verida/account-web-vault": "^2.3.9",
"@verida/client-ts": "^2.3.9",
"@verida/types": "^2.3.1",
"@verida/verifiable-credentials": "^2.3.9",
"@verida/account-web-vault": "^3.0.2",
"@verida/client-ts": "^3.0.3",
"@verida/types": "^3.0.1",
"@verida/verifiable-credentials": "^3.0.3",
"@walletconnect/client": "^1.8.0",
"clsx": "^1.1.1",
"crypto-browserify": "^3.12.0",
Expand Down
2 changes: 1 addition & 1 deletion src/theme/ReactLiveScope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if (ExecutionEnvironment.canUseDOM) {

const context = await Network.connect({
client: {
environment: "testnet",
environment: "mainnet",
},
account: globalAccount,
context: {
Expand Down
Loading
Loading