@dubsdotapp/expo 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @dubsdotapp/expo
|
|
2
2
|
|
|
3
3
|
React Native SDK for the [Dubs](https://dubs.fun) betting platform. Pure TypeScript — no native code.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx expo install @
|
|
8
|
+
npx expo install @dubsdotapp/expo @solana/web3.js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
For the built-in Mobile Wallet Adapter (optional):
|
|
@@ -19,7 +19,7 @@ npx expo install @solana-mobile/mobile-wallet-adapter-protocol-web3js
|
|
|
19
19
|
### 1. Set up the provider
|
|
20
20
|
|
|
21
21
|
```tsx
|
|
22
|
-
import { DubsProvider, MwaWalletAdapter } from '@
|
|
22
|
+
import { DubsProvider, MwaWalletAdapter } from '@dubsdotapp/expo';
|
|
23
23
|
|
|
24
24
|
const wallet = new MwaWalletAdapter({
|
|
25
25
|
appIdentity: { name: 'My App' },
|
|
@@ -28,8 +28,7 @@ const wallet = new MwaWalletAdapter({
|
|
|
28
28
|
export default function App() {
|
|
29
29
|
return (
|
|
30
30
|
<DubsProvider
|
|
31
|
-
apiKey="
|
|
32
|
-
rpcUrl="https://api.mainnet-beta.solana.com"
|
|
31
|
+
apiKey="your_api_key_here"
|
|
33
32
|
wallet={wallet}
|
|
34
33
|
>
|
|
35
34
|
<HomeScreen />
|
|
@@ -41,7 +40,7 @@ export default function App() {
|
|
|
41
40
|
### 2. Browse events
|
|
42
41
|
|
|
43
42
|
```tsx
|
|
44
|
-
import { useEvents } from '@
|
|
43
|
+
import { useEvents } from '@dubsdotapp/expo';
|
|
45
44
|
|
|
46
45
|
function EventsList() {
|
|
47
46
|
const { data, loading, error, refetch } = useEvents({ type: 'sports' });
|
|
@@ -63,7 +62,7 @@ function EventsList() {
|
|
|
63
62
|
### 3. Create a bet
|
|
64
63
|
|
|
65
64
|
```tsx
|
|
66
|
-
import { useCreateGame } from '@
|
|
65
|
+
import { useCreateGame } from '@dubsdotapp/expo';
|
|
67
66
|
|
|
68
67
|
function CreateBet({ eventId }: { eventId: string }) {
|
|
69
68
|
const { execute, status, error } = useCreateGame();
|
|
@@ -94,8 +93,8 @@ function CreateBet({ eventId }: { eventId: string }) {
|
|
|
94
93
|
If you're using Privy, Dynamic, or another wallet provider, implement the `WalletAdapter` interface:
|
|
95
94
|
|
|
96
95
|
```tsx
|
|
97
|
-
import { DubsProvider } from '@
|
|
98
|
-
import type { WalletAdapter } from '@
|
|
96
|
+
import { DubsProvider } from '@dubsdotapp/expo';
|
|
97
|
+
import type { WalletAdapter } from '@dubsdotapp/expo';
|
|
99
98
|
import { Transaction, PublicKey } from '@solana/web3.js';
|
|
100
99
|
|
|
101
100
|
const myAdapter: WalletAdapter = {
|
|
@@ -139,7 +138,7 @@ Mutation hooks expose granular status:
|
|
|
139
138
|
For use outside React or for custom integrations:
|
|
140
139
|
|
|
141
140
|
```ts
|
|
142
|
-
import { DubsClient } from '@
|
|
141
|
+
import { DubsClient } from '@dubsdotapp/expo';
|
|
143
142
|
|
|
144
143
|
const client = new DubsClient({ apiKey: 'dubs_live_...' });
|
|
145
144
|
|