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

Update to v4 of Verida SDK #237

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 8 additions & 10 deletions docs/client-sdk/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ This approach is ideal for integrating the Verida protocol into a server side No

```tsx
import { Network } from '@verida/client-ts'
import { EnvironmentType } from '@verida/types';
import { Network as VeridaNetwork } from '@verida/types';
import { AutoAccount } from '@verida/account-node'

const VERIDA_ENVIRONMENT = EnvironmentType.TESTNET
const VERIDA_ENVIRONMENT = VeridaNetwork.MYRTLE // (MYRTLE = mainnet, BANKSIA = testnet)
const CONTEXT_NAME = 'My Application: Context Name'

// Configuration for the DID client
Expand All @@ -59,18 +59,16 @@ const context = await Network.connect({
name: CONTEXT_NAME
},
client: {
environment: VERIDA_ENVIRONMENT
network: VERIDA_ENVIRONMENT
},
account: new AutoAccount({
privateKey: '0x...' // or Verida mnemonic seed phrase
environment: VERIDA_ENVIRONMENT,
network: VERIDA_ENVIRONMENT,
didClientConfig: DID_CLIENT_CONFIG
})
})
```

Note: Change `EnvironmentType.TESTNET` to `EnvironmentType.MAINNET` if connecting to Verida Mainnet.

See the [@verida/account-node package](https://github.com/verida/verida-js/tree/main/packages/account-node) for more details.

### Web3Config
Expand Down Expand Up @@ -111,10 +109,10 @@ In your application, include the dependency and create a new client network inst

```tsx
import { Client } from '@verida/client-ts'
import { EnvironmentType } from '@verida/types'
import { Network } from '@verida/types'
import { AutoAccount } from '@verida/account-node'

const VERIDA_ENVIRONMENT = EnvironmentType.TESTNET
const VERIDA_ENVIRONMENT = Network.BANKSIA
const CONTEXT_NAME = 'My Application: Context Name'

const DID_CLIENT_CONFIG = {
Expand All @@ -126,14 +124,14 @@ const DID_CLIENT_CONFIG = {

// establish a network connection
const client = new Client({
environment: VERIDA_ENVIRONMENT
network: VERIDA_ENVIRONMENT
})

// create a Verida account instance that wraps the authorized Verida DID server connection
// The `AutoAccount` instance will automatically sign any consent messages
const account = new AutoAccount({
privateKey: '0x...' // or Verida mnemonic seed phrase
environment: VERIDA_ENVIRONMENT,
network: VERIDA_ENVIRONMENT,
didClientConfig: DID_CLIENT_CONFIG
})

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"@docusaurus/theme-search-algolia": "^2.4.3",
"@mdx-js/react": "^1.6.21",
"@svgr/webpack": "^5.5.0",
"@verida/account-web-vault": "^3.0.2",
"@verida/client-ts": "^3.0.3",
"@verida/types": "^3.0.1",
"@verida/verifiable-credentials": "^3.0.3",
"@verida/account-web-vault": "^4.0.0",
"@verida/client-ts": "^4.0.0",
"@verida/types": "^4.0.0",
"@verida/verifiable-credentials": "^4.0.0",
"@walletconnect/client": "^1.8.0",
"clsx": "^1.1.1",
"crypto-browserify": "^3.12.0",
Expand Down
6 changes: 3 additions & 3 deletions src/theme/ReactLiveScope/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
import { EnvironmentType } from "@verida/types";
import { Network } from "@verida/types";
import React, { useEffect, useState } from "react";
import { store, useGlobalState } from "state-pool";

Expand Down Expand Up @@ -85,12 +85,12 @@ if (ExecutionEnvironment.canUseDOM) {
"https://developers.verida.io/img/tutorial_login_request_logo_170x170.png",
walletConnect,
},
environment: EnvironmentType.MAINNET,
environment: Network.MYRTLE,
});

const context = await Network.connect({
client: {
environment: EnvironmentType.MAINNET,
environment: Network.MYRTLE,
},
account: globalAccount,
context: {
Expand Down
Loading
Loading