Skip to content

Commit

Permalink
docs: 📝 Shorten left nav, touch up a few spots
Browse files Browse the repository at this point in the history
  • Loading branch information
cif committed Dec 12, 2022
1 parent fd16fc5 commit 8610f1d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ The new library currently consists of the following packages and features:
In order to use mintbase JS functions, often environment variables will need to be supplied via `process.env`, [dotenv](https://www.npmjs.com/package/dotenv) etc.

```
# api key
MINTBASE_API_KEY=<your-api-key>
# default testnet
NEAR_NETWORK = mainnet | testnet
# default sandbox
NEAR_DATA_ENV = mainnet | testnet | sandbox
```


Expand Down
2 changes: 1 addition & 1 deletion docs/migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ for (const line of lines) {
if (currentSection.name.indexOf('Developer') > -1 && line.indexOf('mintbase-sdk-ref') > -1 && !hasInjectedContent) {

// inject all the content
currentSection.items.push('* [📚 MintbaseJS Reference](mintbase-sdk-ref/README.md)');
currentSection.items.push('* [📚 Mintbase JS](mintbase-sdk-ref/README.md)');

// sort pages
pages.sort((a, b) => {
Expand Down
54 changes: 24 additions & 30 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @mintbase-js/react


This package contains React helpers for interacting with Mintbase SDKs.
This package contains React helpers for interacting with Mintbase JS.

# Hooks

Expand All @@ -25,14 +25,11 @@ The WalletContext provides methods for:
2. Interacting with @mintbase-js/sdk




The following props are provided to consumers of the `WalletContext.Provider`:



```ts

{% code title="NearWalletConnector.ts" overflow="wrap" lineNumbers="true" %}
```typescript
export type WalletContext = {

// a reference to the near wallet selector
Expand Down Expand Up @@ -68,16 +65,14 @@ signMessage: (params: VerifyOwnerParams) => Promise<VerifiedOwner>;
}

```
{% endcode %}

Example usage:

Example usage in React components:


```tsx
{% code title="NearWalletConnector.ts" overflow="wrap" lineNumbers="true" %}
```typescript
import { useWallet } from '@mintbase-js/react'



const NearWalletConnector = () => {
const {
connect,
Expand All @@ -88,25 +83,23 @@ const NearWalletConnector = () => {
errorMessage,
} = useWallet();

const signTxn = async () => {
const wallet = await selector.wallet();
// ... call mintbase SDK methods with wallet as signingOption arg
}

const signTxn = async () => {
const wallet = await selector.wallet();
// ... call mintbase SDK methods with wallet as signingOption arg
}

if (errorMessage) {
return (
<div>
<p>Major bummer! Could not connect to NEAR {errorMessage}</p>
<button onClick={connect}>Try Again</button>
</div>
)
}

if (errorMessage) {
return (
<div>
<p>Major bummer! Could not connect to NEAR {errorMessage}</p>
<button onClick={connect}>Try Again</button>
</div>
)
}

if (!isConnected) {
return <button onClick={connect}>Connect To NEAR</button>
}
if (!isConnected) {
return <button onClick={connect}>Connect To NEAR</button>
}

return (
<div>
Expand All @@ -117,4 +110,5 @@ if (!isConnected) {
)
}

```
```
{% endcode %}

0 comments on commit 8610f1d

Please sign in to comment.