Skip to content

Commit 7813a10

Browse files
authored
Merge pull request #1 from BitteProtocol/update-react-package
Update react package
2 parents 1b23bfa + 0483b10 commit 7813a10

File tree

15 files changed

+2992
-5530
lines changed

15 files changed

+2992
-5530
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Branch Release
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
- '!main'
8+
9+
jobs:
10+
branch-release:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Fetch all history to get the latest tag
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v2
24+
with:
25+
version: latest
26+
27+
- name: Cache pnpm modules
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.pnpm-store
32+
node_modules
33+
src/playground/node_modules
34+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
35+
restore-keys: |
36+
${{ runner.os }}-pnpm-
37+
38+
- name: Install Dependencies
39+
run: pnpm install --frozen-lockfile
40+
41+
- name: Build
42+
run: pnpm run build
43+
44+
- name: Set Version from Branch
45+
run: |
46+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
47+
BRANCH_NAME=${BRANCH_NAME//\//-} # Replace slashes with dashes
48+
SHORT_SHA=$(git rev-parse --short HEAD)
49+
50+
# Get the latest version tag and increment patch
51+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
52+
LATEST_VERSION=${LATEST_TAG#v} # Remove 'v' prefix
53+
54+
# Split version into major.minor.patch
55+
IFS='.' read -r major minor patch <<< "$LATEST_VERSION"
56+
57+
# Increment patch version
58+
patch=$((patch + 1))
59+
BASE_VERSION="${major}.${minor}.${patch}"
60+
61+
VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}"
62+
pnpm version $VERSION --no-git-tag-version
63+
64+
- name: Configure NPM Authentication
65+
run: |
66+
echo "@bitte-ai:registry=https://registry.npmjs.org/" > ~/.npmrc
67+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
68+
69+
- name: Publish with npm
70+
run: npm publish --access public --tag beta
71+
env:
72+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: NPM Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish-npm:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Set up Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: "20"
17+
registry-url: https://registry.npmjs.org/
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
with:
22+
version: latest
23+
24+
- name: Cache pnpm modules
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.pnpm-store
29+
node_modules
30+
src/playground/node_modules
31+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
32+
restore-keys: |
33+
${{ runner.os }}-pnpm-
34+
35+
- name: Install Full Project
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Build Full Project
39+
run: pnpm run build
40+
41+
- name: Set Package Version to Tag
42+
run: |
43+
VERSION=${GITHUB_REF#refs/tags/}
44+
pnpm version $VERSION --no-git-tag-version
45+
46+
- name: Publish
47+
run: |
48+
if [[ "${GITHUB_REF#refs/tags/}" == *-* ]]; then
49+
npm publish --access public --tag next
50+
else
51+
npm publish --access public
52+
fi
53+
env:
54+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@ This package contains React helpers for interacting with Bitte Wallet.
66

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

9-
<img src='https://img.shields.io/bundlephobia/min/@bitte-ai/react'>
10-
119
</p>
1210

13-
Example:
14-
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
15-
16-
17-
[Check our Templates repository for Mintbase.js](https://github.com/Mintbase/templates)
18-
19-
[Live Demo](https://starter.mintbase.xyz/)
2011

2112
## Summary
2213

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

2819
# Installing
2920

30-
`@bitte-ai/react relies on React and React Dom version v18.2.0 due to @near-wallet-selector/modal-ui`
31-
3221
### NPM:
3322

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

5342
# BitteWalletContextProvider
5443

55-
the default way of interacting with Mintbase Wallet is using the BitteWalletContextProvider
44+
the default way of interacting with Bitte Wallet is using the BitteWalletContextProvider
5645

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

5948
## properties:
6049

61-
**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`
62-
6350
**network** : ` mainnet | testnet`
6451

65-
**callbackUrl** : `a valid https/http address to the user be sent after the transaction`
66-
67-
**onlyMbWallet** : `boolean, it sets up only MintbaseWallet or if false(default) MintbaseWallet + default wallets`
68-
6952
**additionalWallets** : `WalletModuleFactory[] extra wallets setup`
7053

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

7558
<BitteWalletContextProvider
76-
contractAddress="mycontract.mintbase1.near"
7759
network="mainnet"
78-
callbackUrl="https://www.mywebsite.com/callback"
7960
>
8061
<Component {...pageProps} />
8162
</BitteWalletContextProvider>

dist/index.d.mts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import { WalletSelectorModal } from '@near-wallet-selector/modal-ui';
55

66
interface ContextProviderType {
77
children: React.ReactNode;
8-
callbackUrl?: string;
9-
network?: string;
8+
network?: 'testnet' | 'mainnet';
109
onlyMbWallet?: boolean;
1110
contractAddress?: string;
1211
additionalWallets?: Array<WalletModuleFactory>;
13-
successUrl?: string;
14-
failureUrl?: string;
1512
onlyBitteWallet?: boolean;
13+
walletUrl?: string;
1614
}
1715
type BitteWalletContext = {
1816
selector: WalletSelector;

dist/index.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import { WalletSelectorModal } from '@near-wallet-selector/modal-ui';
55

66
interface ContextProviderType {
77
children: React.ReactNode;
8-
callbackUrl?: string;
9-
network?: string;
8+
network?: 'testnet' | 'mainnet';
109
onlyMbWallet?: boolean;
1110
contractAddress?: string;
1211
additionalWallets?: Array<WalletModuleFactory>;
13-
successUrl?: string;
14-
failureUrl?: string;
1512
onlyBitteWallet?: boolean;
13+
walletUrl?: string;
1614
}
1715
type BitteWalletContext = {
1816
selector: WalletSelector;

dist/index.js

Lines changed: 4 additions & 128 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.mjs

Lines changed: 4 additions & 128 deletions
Large diffs are not rendered by default.

dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)