-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,26 +4,39 @@ title: 'Greenfield Client' | |
sidebar_position: 1 | ||
--- | ||
|
||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
# Create Greenfield Client | ||
|
||
| params | description | | ||
| -------------- | ------------------- | | ||
| GRPC_URL | Greenfield grpc url | | ||
| GREEN_CHAIN_ID | Greenfield chain id | | ||
|
||
<Tabs groupId="example"> | ||
<TabItem value="Browser" label="Browser"> | ||
|
||
```js | ||
import { Client } from '@bnb-chain/greenfield-js-sdk'; | ||
|
||
// Node.js | ||
const client = Client.create(GRPC_URL, GREEN_CHAIN_ID); | ||
|
||
// Browser | ||
const client = Client.create(GRPC_URL, String(GREEN_CHAIN_ID), { | ||
zkCryptoUrl: | ||
'https://unpkg.com/@bnb-chain/[email protected]/dist/node/zk-crypto.wasm', | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="Nodejs" label="Nodejs"> | ||
|
||
```js | ||
const { Client } = require('@bnb-chain/greenfield-js-sdk'); | ||
const client = Client.create(GRPC_URL, GREEN_CHAIN_ID); | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
:::tip | ||
|
||
The browser needs to load wasm manually. | ||
|