@1sat/react 0.0.11 → 0.0.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/react",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "React hooks and components for 1Sat wallet integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "keywords": ["1sat", "bsv", "ordinals", "wallet", "sdk", "react", "hooks"],
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@1sat/connect": "0.0.13"
22
+ "@1sat/connect": "0.0.14"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@bsv/sdk": "^2.0.0",
package/dist/context.d.ts DELETED
@@ -1,57 +0,0 @@
1
- import { type ConnectResult, type OneSatProvider as OneSatProviderInterface } from '@1sat/connect';
2
- import { type ReactNode } from 'react';
3
- export interface OneSatContextValue {
4
- /** The underlying provider instance */
5
- provider: OneSatProviderInterface | null;
6
- /** Whether the wallet is connected */
7
- isConnected: boolean;
8
- /** Whether a connection is in progress */
9
- isConnecting: boolean;
10
- /** The payment address (if connected) */
11
- paymentAddress: string | null;
12
- /** The ordinal address (if connected) */
13
- ordinalAddress: string | null;
14
- /** The identity public key (if connected) */
15
- identityPubKey: string | null;
16
- /** Connect to the wallet */
17
- connect: () => Promise<ConnectResult>;
18
- /** Disconnect from the wallet */
19
- disconnect: () => Promise<void>;
20
- /** Any connection error */
21
- error: Error | null;
22
- }
23
- export interface OneSatProviderProps {
24
- /** Name of the dApp (shown in approval popup) */
25
- appName?: string;
26
- /** Base URL for the wallet popup (default: https://1sat.market) */
27
- popupUrl?: string;
28
- /** Request timeout in milliseconds (default: 300000 = 5 minutes) */
29
- timeout?: number;
30
- /** Network to use (default: main) */
31
- network?: 'main' | 'test';
32
- /** Children to render */
33
- children: ReactNode;
34
- }
35
- /**
36
- * React provider for 1Sat wallet functionality
37
- *
38
- * @example
39
- * ```tsx
40
- * import { OneSatProvider } from '@1sat/react'
41
- *
42
- * function App() {
43
- * return (
44
- * <OneSatProvider appName="My dApp">
45
- * <MyApp />
46
- * </OneSatProvider>
47
- * )
48
- * }
49
- * ```
50
- */
51
- export declare function OneSatProvider({ appName, popupUrl, timeout, network, children, }: OneSatProviderProps): import("react/jsx-runtime").JSX.Element;
52
- /**
53
- * Hook to access the 1Sat context
54
- * @throws Error if used outside of OneSatProvider
55
- */
56
- export declare function useOneSatContext(): OneSatContextValue;
57
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAEA,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,cAAc,IAAI,uBAAuB,EAE9C,MAAM,eAAe,CAAA;AACtB,OAAO,EACN,KAAK,SAAS,EAOd,MAAM,OAAO,CAAA;AAEd,MAAM,WAAW,kBAAkB;IAClC,uCAAuC;IACvC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAAA;IACxC,sCAAsC;IACtC,WAAW,EAAE,OAAO,CAAA;IACpB,0CAA0C;IAC1C,YAAY,EAAE,OAAO,CAAA;IACrB,yCAAyC;IACzC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,yCAAyC;IACzC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,6CAA6C;IAC7C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IACrC,iCAAiC;IACjC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/B,2BAA2B;IAC3B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACnB;AAID,MAAM,WAAW,mBAAmB;IACnC,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,yBAAyB;IACzB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,GACR,EAAE,mBAAmB,2CAqGrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD"}
package/dist/hooks.d.ts DELETED
@@ -1,186 +0,0 @@
1
- import type { CancelListingRequest, CreateListingRequest, InscribeRequest, OrdinalOutput, PurchaseListingRequest, SendOrdinalsRequest, SignTransactionRequest, TokenOutput, TransferTokenRequest, Utxo } from '@1sat/connect';
2
- /**
3
- * Hook to get the wallet balance
4
- *
5
- * @example
6
- * ```tsx
7
- * function Balance() {
8
- * const { satoshis, isLoading } = useBalance()
9
- * if (isLoading) return <span>Loading...</span>
10
- * return <span>{satoshis} sats</span>
11
- * }
12
- * ```
13
- */
14
- export declare function useBalance(): {
15
- satoshis: number;
16
- usd: number;
17
- isLoading: boolean;
18
- error: Error | null;
19
- refetch: () => Promise<void>;
20
- };
21
- /**
22
- * Hook to get ordinals from the wallet
23
- *
24
- * @example
25
- * ```tsx
26
- * function Gallery() {
27
- * const { ordinals, isLoading } = useOrdinals()
28
- * if (isLoading) return <span>Loading...</span>
29
- * return ordinals.map(ord => <div key={ord.outpoint}>{ord.origin}</div>)
30
- * }
31
- * ```
32
- */
33
- export declare function useOrdinals(limit?: number, offset?: number): {
34
- ordinals: OrdinalOutput[];
35
- isLoading: boolean;
36
- error: Error | null;
37
- refetch: () => Promise<void>;
38
- };
39
- /**
40
- * Hook to get tokens from the wallet
41
- *
42
- * @example
43
- * ```tsx
44
- * function Tokens() {
45
- * const { tokens, isLoading } = useTokens()
46
- * if (isLoading) return <span>Loading...</span>
47
- * return tokens.map(t => <div key={t.outpoint}>{t.symbol}: {t.amount}</div>)
48
- * }
49
- * ```
50
- */
51
- export declare function useTokens(limit?: number, offset?: number): {
52
- tokens: TokenOutput[];
53
- isLoading: boolean;
54
- error: Error | null;
55
- refetch: () => Promise<void>;
56
- };
57
- /**
58
- * Hook to get payment UTXOs from the wallet
59
- *
60
- * @example
61
- * ```tsx
62
- * function Utxos() {
63
- * const { utxos, refetch } = useUtxos()
64
- * return <span>{utxos.length} UTXOs available</span>
65
- * }
66
- * ```
67
- */
68
- export declare function useUtxos(): {
69
- utxos: Utxo[];
70
- isLoading: boolean;
71
- error: Error | null;
72
- refetch: () => Promise<void>;
73
- };
74
- /**
75
- * Hook for signing transactions
76
- *
77
- * @example
78
- * ```tsx
79
- * const { signTransaction, isLoading } = useSignTransaction()
80
- * const result = await signTransaction({ rawtx, description: 'Send payment' })
81
- * ```
82
- */
83
- export declare function useSignTransaction(): {
84
- signTransaction: (request: SignTransactionRequest) => Promise<import("@1sat/connect").SignTransactionResult>;
85
- isLoading: boolean;
86
- error: Error | null;
87
- };
88
- /**
89
- * Hook for signing messages (BSM)
90
- *
91
- * @example
92
- * ```tsx
93
- * const { signMessage, isLoading } = useSignMessage()
94
- * const result = await signMessage('Hello, World!')
95
- * ```
96
- */
97
- export declare function useSignMessage(): {
98
- signMessage: (message: string) => Promise<import("@1sat/connect").SignMessageResult>;
99
- isLoading: boolean;
100
- error: Error | null;
101
- };
102
- /**
103
- * Hook for inscribing ordinals
104
- *
105
- * @example
106
- * ```tsx
107
- * const { inscribe, isLoading } = useInscribe()
108
- * const result = await inscribe({ dataB64, contentType: 'text/plain' })
109
- * ```
110
- */
111
- export declare function useInscribe(): {
112
- inscribe: (request: InscribeRequest) => Promise<import("@1sat/connect").InscribeResult>;
113
- isLoading: boolean;
114
- error: Error | null;
115
- };
116
- /**
117
- * Hook for sending ordinals
118
- *
119
- * @example
120
- * ```tsx
121
- * const { sendOrdinals, isLoading } = useSendOrdinals()
122
- * await sendOrdinals({ outpoints: ['txid_0'], destinationAddress: 'addr' })
123
- * ```
124
- */
125
- export declare function useSendOrdinals(): {
126
- sendOrdinals: (request: SendOrdinalsRequest) => Promise<import("@1sat/connect").SendResult>;
127
- isLoading: boolean;
128
- error: Error | null;
129
- };
130
- /**
131
- * Hook for transferring tokens (BSV20/21)
132
- *
133
- * @example
134
- * ```tsx
135
- * const { transferToken, isLoading } = useTransferToken()
136
- * await transferToken({ tokenId: 'origin_0', amount: '100', destinationAddress: 'addr' })
137
- * ```
138
- */
139
- export declare function useTransferToken(): {
140
- transferToken: (request: TransferTokenRequest) => Promise<import("@1sat/connect").SendResult>;
141
- isLoading: boolean;
142
- error: Error | null;
143
- };
144
- /**
145
- * Hook for creating marketplace listings
146
- *
147
- * @example
148
- * ```tsx
149
- * const { createListing, isLoading } = useCreateListing()
150
- * await createListing({ outpoints: ['txid_0'], priceSatoshis: 100000 })
151
- * ```
152
- */
153
- export declare function useCreateListing(): {
154
- createListing: (request: CreateListingRequest) => Promise<import("@1sat/connect").ListingResult>;
155
- isLoading: boolean;
156
- error: Error | null;
157
- };
158
- /**
159
- * Hook for purchasing a listed ordinal
160
- *
161
- * @example
162
- * ```tsx
163
- * const { purchaseListing, isLoading } = usePurchaseListing()
164
- * await purchaseListing({ listingOutpoint: 'txid_0' })
165
- * ```
166
- */
167
- export declare function usePurchaseListing(): {
168
- purchaseListing: (request: PurchaseListingRequest) => Promise<import("@1sat/connect").SendResult>;
169
- isLoading: boolean;
170
- error: Error | null;
171
- };
172
- /**
173
- * Hook for cancelling marketplace listings
174
- *
175
- * @example
176
- * ```tsx
177
- * const { cancelListing, isLoading } = useCancelListing()
178
- * await cancelListing({ listingOutpoints: ['txid_0'] })
179
- * ```
180
- */
181
- export declare function useCancelListing(): {
182
- cancelListing: (request: CancelListingRequest) => Promise<import("@1sat/connect").SendResult>;
183
- isLoading: boolean;
184
- error: Error | null;
185
- };
186
- //# sourceMappingURL=hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEX,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,IAAI,EACJ,MAAM,eAAe,CAAA;AA6CtB;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU;;;;;;EAkCzB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;;;;;EAgC1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;;;;;EAgCxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ;;;;;EA4BvB;AAID;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB;;;;EASjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc;;;;EAO7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW;;;;EAO1B;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe;;;;EAS9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB;;;;EAS/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB;;;;EAS/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB;;;;EASjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB;;;;EAS/B"}