Skip to content

Commit ceed32a

Browse files
authored
Merge pull request #3 from BitteProtocol/update-package
update package README and code
2 parents 9994376 + 27ea59f commit ceed32a

File tree

4 files changed

+35
-98
lines changed

4 files changed

+35
-98
lines changed

README.md

+22-85
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,72 @@
1-
21
# @bitte-ai/wallet
32

4-
53
This is the [Bitte Wallet](https://wallet.bitte.ai) SDK package.
6-
You can check a quick example of Simple Login using Next.js 14 and @bitte-ai/react
74

8-
check our [React integration](https://docs.mintbase.xyz/dev/mintbase-sdk-ref/react#mintbasewalletcontextprovider)
5+
check our [React integration](https://github.com/BitteProtocol/react/blob/main/README.md)
96

10-
Example:
11-
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
127

8+
<p align="center">
139

14-
<p align="center">
15-
<img src='https://img.shields.io/npm/dw/@mintbase-js/wallet' />
16-
<img src='https://img.shields.io/bundlephobia/min/@mintbase-js/wallet'>
17-
</p>
18-
19-
## Video tutorial
20-
21-
https://github.com/Mintbase/mintbase-js/assets/8454267/7301c178-3a34-497c-a2e7-1616d8f8b6a2
22-
10+
<img src='https://img.shields.io/npm/dw/@bitte-ai/wallet' />
2311

12+
<img src='https://img.shields.io/bundlephobia/min/@bitte-ai/wallet'>
2413

14+
</p>
2515

2616

2717
## Installation and Usage
2818

29-
30-
31-
The easiest way to use this package is to install it from the NPM registry, this package requires `near-api-js` v1.0.0 or above:
32-
19+
The easiest way to use this package is to install it from the NPM registry,
3320

3421

3522
```bash
36-
3723
# Using Yarn
38-
39-
yarn add near-api-js
40-
24+
yarn add @bitte-ai/wallet
4125

4226
# Using NPM.
43-
44-
npm install near-api-js
45-
46-
27+
npm install @bitte-ai/wallet
4728

4829
# Using PNPM.
49-
50-
51-
pnpm install near-api-js
52-
53-
54-
30+
pnpm install @bitte-ai/wallet
5531
```
5632

5733

58-
59-
```bash
60-
61-
# Using Yarn
62-
63-
yarn add @bitte-ai/wallet
64-
65-
66-
67-
# Using NPM.
68-
69-
npm install @bitte-ai/wallet
70-
71-
72-
73-
# Using PNPM.
74-
75-
pnpm install @bitte-ai/wallet
76-
77-
78-
79-
```
80-
81-
82-
8334
Then use it in your dApp:
8435

36+
```ts
8537

38+
import { setupWalletSelector } from "@near-wallet-selector/core";
8639

40+
import { setupBitteWallet } from "@bitte-ai/wallet";
8741

88-
{% code title="setup.ts" overflow="wrap" lineNumbers="true" %}
89-
90-
91-
92-
93-
```ts
94-
import { setupWalletSelector } from "@near-wallet-selector/core";
95-
import { setupBitteWallet } from " @bitte-ai/wallet";
96-
97-
const wallet = setupBitteWallet({
98-
networkId: 'mainnet',
99-
walletUrl: 'https://wallet.bitte.ai',
100-
callbackUrl: 'https://www.mywebsite.com',
101-
deprecated: false,
42+
const wallet = setupBitteWallet({
43+
network: 'mainnet',
10244
});
10345

10446
const selector = await setupWalletSelector({
105-
network: "mainnet",
106-
modules: [wallet],
47+
network: "mainnet",
48+
modules: [wallet],
10749
});
108-
```
109-
110-
{% endcode %}
111-
11250

51+
```
11352

11453

11554
## setupBitteWallet
11655

56+
- `network:` Near Networks
11757

58+
- `walletUrl:` valid wallet urls
11859

119-
- `networkId:` Near Networks
120-
- `walletUrl:` valid wallet urls
121-
- `successUrl:` If you dont have a single callback entrypoint to handle failure/success you can set successUrl.
122-
- `failureUrl:` If you dont have a single callback entrypoint to handle failure/success you can set failureUrl.
123-
- `callbackUrl:` when you have a single entrypoint to deal with transaction results.
124-
- `contractId`: the ContractId that your dapp will be using aka (receiverId)
12560

12661
## Troubleshooting
12762

12863
**Client-side only:**
64+
12965
The wallet runs only on client-side.
13066

13167
Any other questions or issues you can contact support on our [Telegram Channel](https://telegram.me/mintdev).
13268

69+
13370
## License
13471

135-
This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
72+
This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitte-ai/wallet",
3-
"version": "0.6.6-beta-prerelease.6",
3+
"version": "0.7.1",
44
"description": "Bitte Wallet",
55
"keywords": [
66
"bitte",
@@ -31,9 +31,9 @@
3131
"author": "Bitte Team",
3232
"license": "MIT",
3333
"dependencies": {
34-
"@near-wallet-selector/core": "latest",
35-
"@near-wallet-selector/wallet-utils": "latest",
36-
"near-api-js": "latest"
34+
"@near-wallet-selector/core": "^8.9.16",
35+
"@near-wallet-selector/wallet-utils": "^8.9.16",
36+
"near-api-js": "^5.0.1"
3737
},
3838
"devDependencies": {
3939
"tsup": "^8.3.5",

pnpm-lock.yaml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bitte-wallet-setup.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,22 @@ import { icon } from "./icon";
1010
import { createBitteWalletConnector } from "./bitte-wallet";
1111
import { BitteWalletExtraOptions, BitteWalletParams, BitteWalletState } from "./types";
1212

13-
14-
15-
const resolveWalletUrl = (network: Network, walletUrl?: string) => {
13+
const resolveWalletUrl = (network?: Network, walletUrl?: string) => {
1614
if (walletUrl) {
1715
return walletUrl;
1816
}
1917

18+
if(!network){
19+
return "https://wallet.bitte.ai";
20+
}
21+
2022
switch (network.networkId) {
2123
case "mainnet":
2224
return "https://wallet.bitte.ai";
2325
case "testnet":
2426
return "https://testnet.wallet.bitte.ai";
2527
default:
26-
throw new Error("Invalid wallet url");
28+
return "https://wallet.bitte.ai";
2729
}
2830
};
2931

@@ -120,8 +122,6 @@ const BitteWallet: WalletBehaviourFactory<
120122
);
121123
}
122124

123-
console.log(actions, 'actions')
124-
125125
return state.wallet.signAndSendTransaction({
126126
receiverId: receiverId || contract.contractId,
127127
actions,

0 commit comments

Comments
 (0)