Skip to content

Update react package #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 19, 2025
Merged
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
72 changes: 72 additions & 0 deletions .github/workflows/branch-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Branch Release

on:
push:
branches:
- '**'
- '!main'

jobs:
branch-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to get the latest tag

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
node_modules
src/playground/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build

- name: Set Version from Branch
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
BRANCH_NAME=${BRANCH_NAME//\//-} # Replace slashes with dashes
SHORT_SHA=$(git rev-parse --short HEAD)

# Get the latest version tag and increment patch
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
LATEST_VERSION=${LATEST_TAG#v} # Remove 'v' prefix

# Split version into major.minor.patch
IFS='.' read -r major minor patch <<< "$LATEST_VERSION"

# Increment patch version
patch=$((patch + 1))
BASE_VERSION="${major}.${minor}.${patch}"

VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}"
pnpm version $VERSION --no-git-tag-version

- name: Configure NPM Authentication
run: |
echo "@bitte-ai:registry=https://registry.npmjs.org/" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc

- name: Publish with npm
run: npm publish --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: NPM Publish

on:
release:
types: [created]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: https://registry.npmjs.org/

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
node_modules
src/playground/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-

- name: Install Full Project
run: pnpm install --frozen-lockfile

- name: Build Full Project
run: pnpm run build

- name: Set Package Version to Tag
run: |
VERSION=${GITHUB_REF#refs/tags/}
pnpm version $VERSION --no-git-tag-version

- name: Publish
run: |
if [[ "${GITHUB_REF#refs/tags/}" == *-* ]]; then
npm publish --access public --tag next
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
21 changes: 1 addition & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,8 @@ This package contains React helpers for interacting with Bitte Wallet.

<img src='https://img.shields.io/npm/dw/@bitte-ai/react' />

<img src='https://img.shields.io/bundlephobia/min/@bitte-ai/react'>

</p>

Example:
You can check a [quick example of Simple Login](https://github.com/Mintbase/examples/tree/main/starter) using Next.js 14 and @mintbase-js/react


[Check our Templates repository for Mintbase.js](https://github.com/Mintbase/templates)

[Live Demo](https://starter.mintbase.xyz/)

## Summary

Expand All @@ -27,8 +18,6 @@ You can check a [quick example of Simple Login](https://github.com/Mintbase/exam

# Installing

`@bitte-ai/react relies on React and React Dom version v18.2.0 due to @near-wallet-selector/modal-ui`

### NPM:

```
Expand All @@ -52,30 +41,22 @@ pnpm install @near-wallet-selector/modal-ui

# BitteWalletContextProvider

the default way of interacting with Mintbase Wallet is using the BitteWalletContextProvider
the default way of interacting with Bitte Wallet is using the BitteWalletContextProvider

{% code title="app.tsx" overflow="wrap" lineNumbers="true" %}

## properties:

**contractAddress** (optional): `If you set this it will connect the user using Limited Access Keys, set with your near contract address / your mintbase store address`

**network** : ` mainnet | testnet`

**callbackUrl** : `a valid https/http address to the user be sent after the transaction`

**onlyMbWallet** : `boolean, it sets up only MintbaseWallet or if false(default) MintbaseWallet + default wallets`

**additionalWallets** : `WalletModuleFactory[] extra wallets setup`

```typescript
import "@near-wallet-selector/modal-ui/styles.css";
import { BitteWalletContextProvider } from '@bitte-ai/react'

<BitteWalletContextProvider
contractAddress="mycontract.mintbase1.near"
network="mainnet"
callbackUrl="https://www.mywebsite.com/callback"
>
<Component {...pageProps} />
</BitteWalletContextProvider>
Expand Down
6 changes: 2 additions & 4 deletions dist/index.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import { WalletSelectorModal } from '@near-wallet-selector/modal-ui';

interface ContextProviderType {
children: React.ReactNode;
callbackUrl?: string;
network?: string;
network?: 'testnet' | 'mainnet';
onlyMbWallet?: boolean;
contractAddress?: string;
additionalWallets?: Array<WalletModuleFactory>;
successUrl?: string;
failureUrl?: string;
onlyBitteWallet?: boolean;
walletUrl?: string;
}
type BitteWalletContext = {
selector: WalletSelector;
Expand Down
6 changes: 2 additions & 4 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import { WalletSelectorModal } from '@near-wallet-selector/modal-ui';

interface ContextProviderType {
children: React.ReactNode;
callbackUrl?: string;
network?: string;
network?: 'testnet' | 'mainnet';
onlyMbWallet?: boolean;
contractAddress?: string;
additionalWallets?: Array<WalletModuleFactory>;
successUrl?: string;
failureUrl?: string;
onlyBitteWallet?: boolean;
walletUrl?: string;
}
type BitteWalletContext = {
selector: WalletSelector;
Expand Down
132 changes: 4 additions & 128 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

132 changes: 4 additions & 128 deletions dist/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.mjs.map

Large diffs are not rendered by default.

Loading