@supanovaapp/sdk 0.2.16 → 0.2.17
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 +15 -15
- package/dist/core/client.d.ts +3 -2
- package/dist/core/types.d.ts +10 -0
- package/dist/hooks/useInitializationTransactions.d.ts +10 -0
- package/dist/index.cjs.js +385 -385
- package/dist/index.d.ts +7 -1
- package/dist/index.esm.js +9288 -9203
- package/dist/providers/CantonProvider.d.ts +6 -1
- package/dist/providers/SupaProvider.d.ts +10 -0
- package/dist/services/apiService.d.ts +0 -9
- package/dist/services/cantonService.d.ts +12 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,11 +25,11 @@ For a quick overview of the code, check out the demo application in the `/demo`
|
|
|
25
25
|
### From npm (when published)
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install @
|
|
28
|
+
npm install @supanovaapp/sdk
|
|
29
29
|
# or
|
|
30
|
-
yarn add @
|
|
30
|
+
yarn add @supanovaapp/sdk
|
|
31
31
|
# or
|
|
32
|
-
pnpm add @
|
|
32
|
+
pnpm add @supanovaapp/sdk
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
#### Optional: For Smart Wallets support
|
|
@@ -67,7 +67,7 @@ npm link
|
|
|
67
67
|
|
|
68
68
|
In your project directory:
|
|
69
69
|
```bash
|
|
70
|
-
npm link @
|
|
70
|
+
npm link @supanovaapp/sdk
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
**Option B: Using local path**
|
|
@@ -76,7 +76,7 @@ In your project's `package.json`, add:
|
|
|
76
76
|
```json
|
|
77
77
|
{
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@
|
|
79
|
+
"@supanovaapp/sdk": "file:../path/to/supa-sdk"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
```
|
|
@@ -101,7 +101,7 @@ npm install ../path/to/supa-sdk/supa-sdk-0.1.0.tgz
|
|
|
101
101
|
## Quick Start
|
|
102
102
|
|
|
103
103
|
```tsx
|
|
104
|
-
import { SupaProvider, useAuth, useCanton } from '@
|
|
104
|
+
import { SupaProvider, useAuth, useCanton } from '@supanovaapp/sdk';
|
|
105
105
|
|
|
106
106
|
function App() {
|
|
107
107
|
return (
|
|
@@ -138,7 +138,7 @@ function MyApp() {
|
|
|
138
138
|
Wrap your application with `SupaProvider`:
|
|
139
139
|
|
|
140
140
|
```tsx
|
|
141
|
-
import { SupaProvider } from '@
|
|
141
|
+
import { SupaProvider } from '@supanovaapp/sdk';
|
|
142
142
|
|
|
143
143
|
function App() {
|
|
144
144
|
return (
|
|
@@ -255,7 +255,7 @@ function InviteOnlyApp() {
|
|
|
255
255
|
Use the `useAuth` hook to manage authentication:
|
|
256
256
|
|
|
257
257
|
```tsx
|
|
258
|
-
import { useAuth } from '@
|
|
258
|
+
import { useAuth } from '@supanovaapp/sdk';
|
|
259
259
|
|
|
260
260
|
function LoginButton() {
|
|
261
261
|
const { login, logout, authenticated, user } = useAuth();
|
|
@@ -282,7 +282,7 @@ After successful authentication, `authenticated` becomes `true` and `user` objec
|
|
|
282
282
|
Export your wallet's private key to use it with other wallet clients like Phantom:
|
|
283
283
|
|
|
284
284
|
```tsx
|
|
285
|
-
import { useAuth, useCantonWallet } from '@
|
|
285
|
+
import { useAuth, useCantonWallet } from '@supanovaapp/sdk';
|
|
286
286
|
|
|
287
287
|
function ExportWalletButton() {
|
|
288
288
|
const { exportWallet, authenticated } = useAuth();
|
|
@@ -322,7 +322,7 @@ function ExportWalletButton() {
|
|
|
322
322
|
For a complete logout that clears all SDK state (Canton balances, registration, etc.), use the `useSupa` hook:
|
|
323
323
|
|
|
324
324
|
```tsx
|
|
325
|
-
import { useSupa } from '@
|
|
325
|
+
import { useSupa } from '@supanovaapp/sdk';
|
|
326
326
|
|
|
327
327
|
function App() {
|
|
328
328
|
const { auth, canton, logout } = useSupa();
|
|
@@ -356,7 +356,7 @@ function App() {
|
|
|
356
356
|
Register your Canton wallet with optional invite code support:
|
|
357
357
|
|
|
358
358
|
```tsx
|
|
359
|
-
import { useCanton } from '@
|
|
359
|
+
import { useCanton } from '@supanovaapp/sdk';
|
|
360
360
|
|
|
361
361
|
function CantonWallet() {
|
|
362
362
|
const { registerCanton, isRegistered, cantonUser, loading } = useCanton();
|
|
@@ -696,7 +696,7 @@ try {
|
|
|
696
696
|
#### Custom Modal Options
|
|
697
697
|
|
|
698
698
|
```tsx
|
|
699
|
-
import { useSignMessage } from '@
|
|
699
|
+
import { useSignMessage } from '@supanovaapp/sdk';
|
|
700
700
|
|
|
701
701
|
const { signMessage } = useSignMessage();
|
|
702
702
|
|
|
@@ -713,7 +713,7 @@ await signMessage('Hello', {
|
|
|
713
713
|
#### Custom Transaction Modals
|
|
714
714
|
|
|
715
715
|
```tsx
|
|
716
|
-
import { useSendTransaction } from '@
|
|
716
|
+
import { useSendTransaction } from '@supanovaapp/sdk';
|
|
717
717
|
|
|
718
718
|
const { sendTransaction } = useSendTransaction();
|
|
719
719
|
|
|
@@ -770,7 +770,7 @@ import type {
|
|
|
770
770
|
SendTransactionOptions,
|
|
771
771
|
ConfirmModalOptions,
|
|
772
772
|
CantonSubmitPreparedOptions,
|
|
773
|
-
} from '@
|
|
773
|
+
} from '@supanovaapp/sdk';
|
|
774
774
|
```
|
|
775
775
|
|
|
776
776
|
## How to run demo
|
|
@@ -832,7 +832,7 @@ npm run build
|
|
|
832
832
|
|
|
833
833
|
### Development Workflow
|
|
834
834
|
|
|
835
|
-
The demo application in `/demo` folder is already configured to use the local SDK version via `"@
|
|
835
|
+
The demo application in `/demo` folder is already configured to use the local SDK version via `"@supanovaapp/sdk": "file:.."` dependency.
|
|
836
836
|
|
|
837
837
|
#### Recommended Workflow
|
|
838
838
|
|
package/dist/core/client.d.ts
CHANGED
|
@@ -2,14 +2,15 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
export interface ClientConfig {
|
|
3
3
|
baseURL?: string;
|
|
4
4
|
nodeIdentifier: string;
|
|
5
|
+
/** Optional app identifier for app-specific backend rules */
|
|
6
|
+
supaAppId?: string;
|
|
5
7
|
getAccessToken?: () => Promise<string | null>;
|
|
6
8
|
}
|
|
7
9
|
export declare class ApiClient {
|
|
8
10
|
private client;
|
|
9
11
|
private getAccessToken?;
|
|
10
12
|
private nodeIdentifier;
|
|
11
|
-
private
|
|
12
|
-
private cacheTTL;
|
|
13
|
+
private supaAppId?;
|
|
13
14
|
constructor(config?: ClientConfig);
|
|
14
15
|
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
15
16
|
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
package/dist/core/types.d.ts
CHANGED
|
@@ -38,6 +38,16 @@ export interface CantonSubmitTransactionResponseDto {
|
|
|
38
38
|
/** Submission ID for tracking completion */
|
|
39
39
|
submissionId: string;
|
|
40
40
|
}
|
|
41
|
+
export interface CantonSubmitMultipleResultDto {
|
|
42
|
+
/** Hash of the transaction that was submitted */
|
|
43
|
+
hash: string;
|
|
44
|
+
/** Whether the submission succeeded */
|
|
45
|
+
success: boolean;
|
|
46
|
+
/** Submission ID if successful */
|
|
47
|
+
submissionId?: string;
|
|
48
|
+
/** Error message if failed */
|
|
49
|
+
error?: string;
|
|
50
|
+
}
|
|
41
51
|
export type CantonQueryCompletionStatus = 'completed' | 'unknown';
|
|
42
52
|
export interface CantonQueryCompletionResponseDto {
|
|
43
53
|
/** Status of the completion query */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CantonSubmitMultipleResultDto } from '../core/types';
|
|
2
|
+
export interface UseInitializationTransactionsReturn {
|
|
3
|
+
runInitializationTransactions: () => Promise<CantonSubmitMultipleResultDto[]>;
|
|
4
|
+
/** Внутренний лоадер хука; приложения могут его игнорировать, чтобы не блокировать UI */
|
|
5
|
+
loading: boolean;
|
|
6
|
+
/** Последняя ошибка хука; приложения могут игнорировать и обрабатывать ошибку на уровне вызова */
|
|
7
|
+
error: Error | null;
|
|
8
|
+
clearError: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useInitializationTransactions(): UseInitializationTransactionsReturn;
|