@supanovaapp/sdk 0.2.12 → 0.2.14
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 +81 -0
- package/dist/components/ConfirmationModal.d.ts +43 -0
- package/dist/core/client.d.ts +23 -0
- package/dist/core/types.d.ts +533 -0
- package/dist/hooks/useAPI.d.ts +142 -0
- package/dist/hooks/useAuth.d.ts +45 -0
- package/dist/hooks/useCanton.d.ts +19 -0
- package/dist/hooks/useConfirmModal.d.ts +15 -0
- package/dist/hooks/useSendTransaction.d.ts +27 -0
- package/dist/hooks/useSignMessage.d.ts +25 -0
- package/dist/hooks/useSignRawHashWithModal.d.ts +22 -0
- package/dist/hooks/useSmartWallets.d.ts +16 -0
- package/dist/hooks/useStellarWallet.d.ts +6 -0
- package/dist/hooks/useSupa.d.ts +61 -0
- package/dist/index.d.ts +149 -0
- package/dist/providers/CantonProvider.d.ts +64 -0
- package/dist/providers/SupaProvider.d.ts +82 -0
- package/dist/services/apiService.d.ts +163 -0
- package/dist/services/cantonService.d.ts +156 -0
- package/dist/utils/converters.d.ts +67 -0
- package/dist/utils/stellar.d.ts +90 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,6 +165,87 @@ function App() {
|
|
|
165
165
|
- `nodeIdentifier` - Canton node identifier
|
|
166
166
|
- `appearance` - Theme and styling options
|
|
167
167
|
- `loginMethods` - Array of enabled authentication methods
|
|
168
|
+
- `autoOnboarding` - Enable automatic wallet creation and Canton registration on login (default: `true`)
|
|
169
|
+
|
|
170
|
+
### Disabling Auto-Onboarding (Paywall Implementation)
|
|
171
|
+
|
|
172
|
+
By default, the SDK automatically creates a Stellar wallet and registers Canton when a user logs in (`autoOnboarding: true`). For applications with paywalls or invite-only access, you can disable this:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
<SupaProvider
|
|
176
|
+
config={{
|
|
177
|
+
privyAppId: 'your-privy-app-id',
|
|
178
|
+
nodeIdentifier: 'nodeId',
|
|
179
|
+
autoOnboarding: false, // Disable automatic wallet creation and Canton registration
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
<YourApp />
|
|
183
|
+
</SupaProvider>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
With `autoOnboarding: false`:
|
|
187
|
+
- Users can authenticate via Privy, but won't automatically get a Canton wallet
|
|
188
|
+
- You control when to call `registerCanton()` (e.g., after payment or invite code verification)
|
|
189
|
+
- Enables implementation of paywalls, invite systems, or conditional access
|
|
190
|
+
|
|
191
|
+
**Example: Paywall Flow**
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
function PaywallApp() {
|
|
195
|
+
const { authenticated } = useAuth();
|
|
196
|
+
const { isRegistered, registerCanton } = useCanton();
|
|
197
|
+
const [hasPaid, setHasPaid] = useState(false);
|
|
198
|
+
|
|
199
|
+
if (!authenticated) {
|
|
200
|
+
return <LoginScreen />;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!hasPaid) {
|
|
204
|
+
return <PaywallScreen onPaymentComplete={() => setHasPaid(true)} />;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (!isRegistered) {
|
|
208
|
+
return (
|
|
209
|
+
<button onClick={() => registerCanton()}>
|
|
210
|
+
Create Canton Wallet
|
|
211
|
+
</button>
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return <MainApp />;
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Example: Invite Code Flow**
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
function InviteOnlyApp() {
|
|
223
|
+
const { authenticated } = useAuth();
|
|
224
|
+
const { isRegistered, registerCanton } = useCanton();
|
|
225
|
+
const [inviteCode, setInviteCode] = useState('');
|
|
226
|
+
|
|
227
|
+
if (!authenticated) {
|
|
228
|
+
return <LoginScreen />;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!isRegistered) {
|
|
232
|
+
return (
|
|
233
|
+
<div>
|
|
234
|
+
<input
|
|
235
|
+
value={inviteCode}
|
|
236
|
+
onChange={(e) => setInviteCode(e.target.value)}
|
|
237
|
+
placeholder="Enter invite code"
|
|
238
|
+
/>
|
|
239
|
+
<button onClick={() => registerCanton(inviteCode)}>
|
|
240
|
+
Register with Invite
|
|
241
|
+
</button>
|
|
242
|
+
</div>
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return <MainApp />;
|
|
247
|
+
}
|
|
248
|
+
```
|
|
168
249
|
|
|
169
250
|
---
|
|
170
251
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ConfirmationModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onConfirm: () => void;
|
|
6
|
+
onReject: () => void;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
message: string;
|
|
9
|
+
confirmText?: string;
|
|
10
|
+
rejectText?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
infoText?: string;
|
|
13
|
+
icon?: ReactNode;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function ConfirmationModal({ open, onClose, onConfirm, onReject, title, message, confirmText, rejectText, description, infoText, icon, loading, }: ConfirmationModalProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export interface SignMessageModalProps {
|
|
18
|
+
open: boolean;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
onConfirm: () => void;
|
|
21
|
+
onReject: () => void;
|
|
22
|
+
message: string;
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
title?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
confirmText?: string;
|
|
27
|
+
rejectText?: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function SignMessageModal({ open, onClose, onConfirm, onReject, message, loading, title, description, confirmText, rejectText, }: SignMessageModalProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export interface SignTransactionModalProps {
|
|
31
|
+
open: boolean;
|
|
32
|
+
onClose: () => void;
|
|
33
|
+
onConfirm: () => void;
|
|
34
|
+
onReject: () => void;
|
|
35
|
+
transaction: string;
|
|
36
|
+
loading?: boolean;
|
|
37
|
+
title?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
confirmText?: string;
|
|
40
|
+
rejectText?: string;
|
|
41
|
+
infoText?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function SignTransactionModal({ open, onClose, onConfirm, onReject, transaction, loading, title, description, confirmText, rejectText, infoText, }: SignTransactionModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
baseURL?: string;
|
|
4
|
+
nodeIdentifier: string;
|
|
5
|
+
getAccessToken?: () => Promise<string | null>;
|
|
6
|
+
}
|
|
7
|
+
export declare class ApiClient {
|
|
8
|
+
private client;
|
|
9
|
+
private getAccessToken?;
|
|
10
|
+
private nodeIdentifier;
|
|
11
|
+
private cache;
|
|
12
|
+
private cacheTTL;
|
|
13
|
+
constructor(config?: ClientConfig);
|
|
14
|
+
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
15
|
+
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
16
|
+
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
17
|
+
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
18
|
+
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
19
|
+
setAccessTokenGetter(getter: () => Promise<string | null>): void;
|
|
20
|
+
getBaseURL(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function createApiClient(config?: ClientConfig): ApiClient;
|
|
23
|
+
export declare function getApiClient(): ApiClient;
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types generated from Supa Backend API Swagger
|
|
3
|
+
* Based on OpenAPI 3.0.0 specification
|
|
4
|
+
*/
|
|
5
|
+
export type Order = 'ASC' | 'DESC';
|
|
6
|
+
export type AlchemyNetwork = 'eth-mainnet' | 'arb-mainnet' | 'opt-mainnet' | 'polygon-mainnet';
|
|
7
|
+
export type TimeInterval = 'ONE_HOUR' | 'ONE_DAY' | 'ONE_MONTH' | 'ONE_YEAR' | 'ALL_TIME';
|
|
8
|
+
export interface CantonPrepareRegisterRequestDto {
|
|
9
|
+
/** Base64 stellar public key from privy */
|
|
10
|
+
publicKey: string;
|
|
11
|
+
/** Optional invite code */
|
|
12
|
+
inviteCode?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Cost estimation for Canton transaction */
|
|
15
|
+
export interface CantonCostEstimationDto {
|
|
16
|
+
/** Timestamp when the estimation was calculated (ISO 8601) */
|
|
17
|
+
estimationTimestamp: string;
|
|
18
|
+
/** Confirmation request traffic cost estimation in micro-units */
|
|
19
|
+
confirmationRequestTrafficCostEstimation: number;
|
|
20
|
+
/** Confirmation response traffic cost estimation in micro-units */
|
|
21
|
+
confirmationResponseTrafficCostEstimation: number;
|
|
22
|
+
/** Total traffic cost estimation in micro-units */
|
|
23
|
+
totalTrafficCostEstimation: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CantonPrepareTransactionResponseDto {
|
|
26
|
+
/** Base64 hash to be signed by the user */
|
|
27
|
+
hash: string;
|
|
28
|
+
/** Estimated cost of the transaction (optional) */
|
|
29
|
+
costEstimation?: CantonCostEstimationDto;
|
|
30
|
+
}
|
|
31
|
+
export interface CantonSubmitRegisterRequestDto {
|
|
32
|
+
/** Base64 hash provided for signing */
|
|
33
|
+
hash: string;
|
|
34
|
+
/** Base64 signature for provided hash */
|
|
35
|
+
signature: string;
|
|
36
|
+
}
|
|
37
|
+
export interface CantonSubmitTransactionResponseDto {
|
|
38
|
+
/** Submission ID for tracking completion */
|
|
39
|
+
submissionId: string;
|
|
40
|
+
}
|
|
41
|
+
export type CantonQueryCompletionStatus = 'completed' | 'unknown';
|
|
42
|
+
export interface CantonQueryCompletionResponseDto {
|
|
43
|
+
/** Status of the completion query */
|
|
44
|
+
status: CantonQueryCompletionStatus;
|
|
45
|
+
/** Completion data (nullable, present when status is 'completed') */
|
|
46
|
+
data: Record<string, unknown> | null;
|
|
47
|
+
/** Message explaining the status */
|
|
48
|
+
message: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CantonPrepareTapRequestDto {
|
|
51
|
+
/** Positive integer amount of how many canton coins to receive */
|
|
52
|
+
amount: string;
|
|
53
|
+
}
|
|
54
|
+
export interface CantonMeResponseDto {
|
|
55
|
+
/** Canton party ID */
|
|
56
|
+
partyId: string;
|
|
57
|
+
/** User email (can be null if not set) */
|
|
58
|
+
email: string | null;
|
|
59
|
+
/** Indicates whether the transfer preapproval is set and NOT EXPIRED for the party */
|
|
60
|
+
transferPreapprovalSet: boolean;
|
|
61
|
+
/** Transfer preapproval expiration date (ISO 8601, can be null) */
|
|
62
|
+
transferPreapprovalExpiresAt: string | null;
|
|
63
|
+
}
|
|
64
|
+
/** Amount with rate decay for Canton Amulet */
|
|
65
|
+
export interface CantonAmuletAmount {
|
|
66
|
+
/** Initial amount as decimal string */
|
|
67
|
+
initialAmount: string;
|
|
68
|
+
/** Round number when created */
|
|
69
|
+
createdAt: {
|
|
70
|
+
number: string;
|
|
71
|
+
};
|
|
72
|
+
/** Rate per round for decay */
|
|
73
|
+
ratePerRound: {
|
|
74
|
+
rate: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Create argument for Canton Amulet contract */
|
|
78
|
+
export interface CantonAmuletCreateArgument {
|
|
79
|
+
/** DSO party ID */
|
|
80
|
+
dso: string;
|
|
81
|
+
/** Owner party ID */
|
|
82
|
+
owner: string;
|
|
83
|
+
/** Amount with rate */
|
|
84
|
+
amount: CantonAmuletAmount;
|
|
85
|
+
}
|
|
86
|
+
/** Created event for Canton contract */
|
|
87
|
+
export interface CantonCreatedEvent {
|
|
88
|
+
/** Offset in ledger */
|
|
89
|
+
offset: number;
|
|
90
|
+
/** Node ID */
|
|
91
|
+
nodeId: number;
|
|
92
|
+
/** Contract ID */
|
|
93
|
+
contractId: string;
|
|
94
|
+
/** Template ID in format packageId:module:entity */
|
|
95
|
+
templateId: string;
|
|
96
|
+
/** Contract key (can be null) */
|
|
97
|
+
contractKey: unknown | null;
|
|
98
|
+
/** Create argument data */
|
|
99
|
+
createArgument: CantonAmuletCreateArgument | Record<string, unknown>;
|
|
100
|
+
/** Created event blob (base64) */
|
|
101
|
+
createdEventBlob: string;
|
|
102
|
+
/** Interface views */
|
|
103
|
+
interfaceViews: unknown[];
|
|
104
|
+
/** Witness parties */
|
|
105
|
+
witnessParties: string[];
|
|
106
|
+
/** Signatories */
|
|
107
|
+
signatories: string[];
|
|
108
|
+
/** Observers */
|
|
109
|
+
observers: string[];
|
|
110
|
+
/** Created timestamp (ISO 8601) */
|
|
111
|
+
createdAt: string;
|
|
112
|
+
/** Package name */
|
|
113
|
+
packageName: string;
|
|
114
|
+
/** Representative package ID */
|
|
115
|
+
representativePackageId: string;
|
|
116
|
+
/** ACS delta flag */
|
|
117
|
+
acsDelta: boolean;
|
|
118
|
+
}
|
|
119
|
+
/** Active contract in Canton */
|
|
120
|
+
export interface CantonJsActiveContract {
|
|
121
|
+
/** Created event with all contract details */
|
|
122
|
+
createdEvent: CantonCreatedEvent;
|
|
123
|
+
/** Synchronizer ID */
|
|
124
|
+
synchronizerId: string;
|
|
125
|
+
/** Reassignment counter */
|
|
126
|
+
reassignmentCounter: number;
|
|
127
|
+
}
|
|
128
|
+
/** Contract entry wrapper */
|
|
129
|
+
export interface CantonContractEntry {
|
|
130
|
+
JsActiveContract: CantonJsActiveContract;
|
|
131
|
+
}
|
|
132
|
+
/** Active contract response item from API */
|
|
133
|
+
export interface CantonActiveContractItem {
|
|
134
|
+
/** Workflow ID (can be empty) */
|
|
135
|
+
workflowId: string;
|
|
136
|
+
/** Contract entry containing the active contract */
|
|
137
|
+
contractEntry: CantonContractEntry;
|
|
138
|
+
}
|
|
139
|
+
/** Response from /canton/api/active_contracts */
|
|
140
|
+
export type CantonActiveContractsResponseDto = CantonActiveContractItem[];
|
|
141
|
+
export interface CantonActiveContract {
|
|
142
|
+
/** Contract ID */
|
|
143
|
+
contractId: string;
|
|
144
|
+
/** Template ID */
|
|
145
|
+
templateId: string;
|
|
146
|
+
/** Contract blob data (untyped) */
|
|
147
|
+
blob: unknown;
|
|
148
|
+
}
|
|
149
|
+
export interface CantonPrepareTransactionRequestDto {
|
|
150
|
+
/** Command or array of commands */
|
|
151
|
+
commands: unknown;
|
|
152
|
+
/** Optional disclosed contracts */
|
|
153
|
+
disclosedContracts?: unknown;
|
|
154
|
+
}
|
|
155
|
+
/** Canton instrument/token identifier */
|
|
156
|
+
export interface CantonInstrumentIdDto {
|
|
157
|
+
/** DSO party ID (instrument administrator) */
|
|
158
|
+
admin: string;
|
|
159
|
+
/** Token identifier (e.g., "Amulet" for Canton Coin) */
|
|
160
|
+
id: string;
|
|
161
|
+
}
|
|
162
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
163
|
+
export interface CantonUtxoMetadataDto {
|
|
164
|
+
/** Round number when the UTXO was created */
|
|
165
|
+
createdInRound: string;
|
|
166
|
+
/** Demurrage rate per round (balance decrease rate for Canton Coin) */
|
|
167
|
+
demurrageRate: string;
|
|
168
|
+
}
|
|
169
|
+
/** Unlocked UTXO */
|
|
170
|
+
export interface CantonUnlockedUtxoDto {
|
|
171
|
+
/** Contract ID of the UTXO */
|
|
172
|
+
contractId: string;
|
|
173
|
+
/** Amount as decimal string */
|
|
174
|
+
amount: string;
|
|
175
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
176
|
+
metadata: CantonUtxoMetadataDto;
|
|
177
|
+
}
|
|
178
|
+
/** Lock information for locked UTXO */
|
|
179
|
+
export interface CantonHoldingLockDto {
|
|
180
|
+
/** Party IDs holding the lock */
|
|
181
|
+
holders: string[];
|
|
182
|
+
/** Lock expiration timestamp (ISO 8601, can be null) */
|
|
183
|
+
expiresAt: string | null;
|
|
184
|
+
/** Relative expiration duration (can be null) */
|
|
185
|
+
expiresAfter: Record<string, unknown> | null;
|
|
186
|
+
/** Context describing why the UTXO is locked (can be null) */
|
|
187
|
+
context: string | null;
|
|
188
|
+
}
|
|
189
|
+
/** Locked UTXO with lock information */
|
|
190
|
+
export interface CantonLockedUtxoDto {
|
|
191
|
+
/** Contract ID of the locked UTXO */
|
|
192
|
+
contractId: string;
|
|
193
|
+
/** Locked amount as decimal string */
|
|
194
|
+
amount: string;
|
|
195
|
+
/** Lock information including holders, expiration, and context */
|
|
196
|
+
lock: CantonHoldingLockDto;
|
|
197
|
+
/** UTXO metadata including creation info and demurrage rate */
|
|
198
|
+
metadata: CantonUtxoMetadataDto;
|
|
199
|
+
}
|
|
200
|
+
/** Token balance with unlocked and locked UTXOs */
|
|
201
|
+
export interface CantonTokenBalanceDto {
|
|
202
|
+
/** Unique identifier for this token type */
|
|
203
|
+
instrumentId: CantonInstrumentIdDto;
|
|
204
|
+
/** Total unlocked balance as decimal string */
|
|
205
|
+
totalUnlockedBalance: string;
|
|
206
|
+
/** Total locked balance as decimal string */
|
|
207
|
+
totalLockedBalance: string;
|
|
208
|
+
/** Total balance (unlocked + locked) as decimal string */
|
|
209
|
+
totalBalance: string;
|
|
210
|
+
/** Number of unlocked UTXOs */
|
|
211
|
+
unlockedUtxoCount: number;
|
|
212
|
+
/** Number of locked UTXOs */
|
|
213
|
+
lockedUtxoCount: number;
|
|
214
|
+
/** List of unlocked UTXOs */
|
|
215
|
+
unlockedUtxos: CantonUnlockedUtxoDto[];
|
|
216
|
+
/** List of locked UTXOs */
|
|
217
|
+
lockedUtxos: CantonLockedUtxoDto[];
|
|
218
|
+
}
|
|
219
|
+
/** Canton wallet balances response */
|
|
220
|
+
export interface CantonWalletBalancesResponseDto {
|
|
221
|
+
/** Party ID of the wallet owner */
|
|
222
|
+
partyId: string;
|
|
223
|
+
/** Token balances grouped by instrument ID */
|
|
224
|
+
tokens: CantonTokenBalanceDto[];
|
|
225
|
+
/** Timestamp when balances were fetched (ISO 8601) */
|
|
226
|
+
fetchedAt: string;
|
|
227
|
+
}
|
|
228
|
+
/** Request for preparing Amulet (Canton Coin) transfer */
|
|
229
|
+
export interface CantonPrepareAmuletTransferRequestDto {
|
|
230
|
+
/** Canton party ID of the receiver wallet */
|
|
231
|
+
receiverPartyId: string;
|
|
232
|
+
/** Amount of Amulet to transfer (decimal string with max 10 decimal places) */
|
|
233
|
+
amount: string;
|
|
234
|
+
/** Optional memo for the transfer */
|
|
235
|
+
memo?: string;
|
|
236
|
+
}
|
|
237
|
+
/** Canton instrument/token info for incoming transfers */
|
|
238
|
+
export interface CantonInstrumentDto {
|
|
239
|
+
/** Admin party ID of the instrument */
|
|
240
|
+
admin: string;
|
|
241
|
+
/** Token identifier (e.g., "Amulet" for Canton Coin, "CBTC" for wrapped BTC) */
|
|
242
|
+
id: string;
|
|
243
|
+
}
|
|
244
|
+
/** Incoming transfer information */
|
|
245
|
+
export interface CantonIncomingTransferDto {
|
|
246
|
+
/** Instrument details (token info) */
|
|
247
|
+
instrument: CantonInstrumentDto;
|
|
248
|
+
/** Contract ID of the transfer instruction (use this to approve or reject) */
|
|
249
|
+
contractId: string;
|
|
250
|
+
/** Sender party ID */
|
|
251
|
+
sender: string;
|
|
252
|
+
/** Receiver party ID */
|
|
253
|
+
receiver: string;
|
|
254
|
+
/** Amount to be transferred as a string */
|
|
255
|
+
amount: string;
|
|
256
|
+
/** Date when the transfer was sent/requested (ISO 8601) */
|
|
257
|
+
requestedAt: string;
|
|
258
|
+
/** Date before which the transfer must be executed (ISO 8601) */
|
|
259
|
+
executeBefore: string;
|
|
260
|
+
}
|
|
261
|
+
/** Request for preparing response to incoming transfer */
|
|
262
|
+
export interface CantonPrepareResponseIncomingTransferRequestDto {
|
|
263
|
+
/** Contract ID received from fetching incoming transfers */
|
|
264
|
+
contractId: string;
|
|
265
|
+
/** Whether to accept (approve) or reject the incoming transfer */
|
|
266
|
+
accept: boolean;
|
|
267
|
+
}
|
|
268
|
+
/** Token operation in a transaction */
|
|
269
|
+
export interface CantonTokenOperationDto {
|
|
270
|
+
/** Amount as decimal string */
|
|
271
|
+
amount: string;
|
|
272
|
+
/** Operation description (e.g., "Subscription fee (from locked)") */
|
|
273
|
+
description?: string;
|
|
274
|
+
/** Direction: "in", "out", "lock", "unlock" */
|
|
275
|
+
direction: 'in' | 'out' | 'lock' | 'unlock';
|
|
276
|
+
/** Token symbol (e.g., "CC" for Canton Coin) */
|
|
277
|
+
token: string;
|
|
278
|
+
/** Counterparty party ID (for transfers) */
|
|
279
|
+
counterparty?: string;
|
|
280
|
+
}
|
|
281
|
+
/** Canton transaction from history */
|
|
282
|
+
export interface CantonTransactionDto {
|
|
283
|
+
/** Balance change (positive for incoming, negative for outgoing) */
|
|
284
|
+
balanceChange: number;
|
|
285
|
+
/** Transaction date (ISO 8601) */
|
|
286
|
+
date: string;
|
|
287
|
+
/** Additional transaction details (varies by type) */
|
|
288
|
+
details: Record<string, unknown>;
|
|
289
|
+
/** Ledger offset for pagination */
|
|
290
|
+
ledgerOffset: number;
|
|
291
|
+
/** Locked balance change */
|
|
292
|
+
lockedChange: number;
|
|
293
|
+
/** List of token operations in this transaction */
|
|
294
|
+
tokenOperations: CantonTokenOperationDto[];
|
|
295
|
+
/** Transaction type identifier */
|
|
296
|
+
type: string;
|
|
297
|
+
/** Human-readable transaction type label */
|
|
298
|
+
typeLabel: string;
|
|
299
|
+
/** Unique update ID */
|
|
300
|
+
updateId: string;
|
|
301
|
+
}
|
|
302
|
+
/** Parameters for fetching transactions */
|
|
303
|
+
export interface CantonTransactionsParams {
|
|
304
|
+
/** Maximum number of transactions to return (1-100, default: 20) */
|
|
305
|
+
limit?: number;
|
|
306
|
+
/** Offset for pagination (exclusive). Pass oldest transaction offset from previous response */
|
|
307
|
+
beforeOffsetExclusive?: number;
|
|
308
|
+
}
|
|
309
|
+
/** Time interval for price history */
|
|
310
|
+
export type CantonPriceInterval = '1h' | '1d' | '1w' | '1M';
|
|
311
|
+
/** Price candle data point */
|
|
312
|
+
export interface CantonPriceCandleDto {
|
|
313
|
+
/** Opening price */
|
|
314
|
+
open: string;
|
|
315
|
+
/** Closing price */
|
|
316
|
+
close: string;
|
|
317
|
+
/** Minimum price in the interval */
|
|
318
|
+
min: string;
|
|
319
|
+
/** Maximum price in the interval */
|
|
320
|
+
max: string;
|
|
321
|
+
/** Interval start timestamp (ISO 8601) */
|
|
322
|
+
start: string;
|
|
323
|
+
/** Interval end timestamp (ISO 8601) */
|
|
324
|
+
end: string;
|
|
325
|
+
}
|
|
326
|
+
export interface UserResponseDto {
|
|
327
|
+
[key: string]: any;
|
|
328
|
+
}
|
|
329
|
+
export interface UserBalanceEntryDto {
|
|
330
|
+
/** Token contract address */
|
|
331
|
+
contractAddress: string;
|
|
332
|
+
/** Token balance as a big integer string */
|
|
333
|
+
tokenBalance: string;
|
|
334
|
+
/** Token balance as a human-readable decimal string */
|
|
335
|
+
tokenBalanceDecimal: string;
|
|
336
|
+
/** Token decimals */
|
|
337
|
+
decimals: number;
|
|
338
|
+
/** Token logo URL */
|
|
339
|
+
logoUrl: string;
|
|
340
|
+
/** Token name */
|
|
341
|
+
name: string;
|
|
342
|
+
/** Token symbol */
|
|
343
|
+
symbol: string;
|
|
344
|
+
/** Network name */
|
|
345
|
+
network: string;
|
|
346
|
+
}
|
|
347
|
+
export interface UserBalanceResponseDto {
|
|
348
|
+
/** Wallet address */
|
|
349
|
+
address: string;
|
|
350
|
+
/** List of token balances */
|
|
351
|
+
balances: UserBalanceEntryDto[];
|
|
352
|
+
/** Total USD balance. Decimal string */
|
|
353
|
+
totalUsdBalance: string;
|
|
354
|
+
}
|
|
355
|
+
export interface NewDialogRequestDto {
|
|
356
|
+
text: string;
|
|
357
|
+
}
|
|
358
|
+
export interface MessageResponseDto {
|
|
359
|
+
id: number;
|
|
360
|
+
dialogId: number;
|
|
361
|
+
text: string;
|
|
362
|
+
isReply: boolean;
|
|
363
|
+
date: string;
|
|
364
|
+
command?: any | null;
|
|
365
|
+
payload?: any | null;
|
|
366
|
+
actionSuggestions?: any | null;
|
|
367
|
+
}
|
|
368
|
+
export interface DialogWithMessagesResponseDto {
|
|
369
|
+
id: number;
|
|
370
|
+
createdAt: string;
|
|
371
|
+
updatedAt: string;
|
|
372
|
+
isProcessingNow: boolean;
|
|
373
|
+
messages: MessageResponseDto[];
|
|
374
|
+
}
|
|
375
|
+
export interface DialogListResponseDto {
|
|
376
|
+
id: number;
|
|
377
|
+
createdAt: string;
|
|
378
|
+
updatedAt: string;
|
|
379
|
+
isProcessingNow: boolean;
|
|
380
|
+
firstMessage: string;
|
|
381
|
+
}
|
|
382
|
+
export interface NewMessageRequestDto {
|
|
383
|
+
/** Message text content */
|
|
384
|
+
text: string;
|
|
385
|
+
}
|
|
386
|
+
export interface OffsetPaginationDto {
|
|
387
|
+
limit: number;
|
|
388
|
+
currentPage: number;
|
|
389
|
+
}
|
|
390
|
+
export interface OffsetPaginatedDto<T = any> {
|
|
391
|
+
data: T[];
|
|
392
|
+
pagination: OffsetPaginationDto;
|
|
393
|
+
}
|
|
394
|
+
export interface PaginationParams {
|
|
395
|
+
limit?: number;
|
|
396
|
+
page?: number;
|
|
397
|
+
order?: Order;
|
|
398
|
+
}
|
|
399
|
+
export interface GetPricesByAddressesBodyDto {
|
|
400
|
+
/** Array of pairs of alchemy network and contract address */
|
|
401
|
+
addresses: Array<{
|
|
402
|
+
network: AlchemyNetwork;
|
|
403
|
+
contractAddress: string;
|
|
404
|
+
}>;
|
|
405
|
+
}
|
|
406
|
+
export interface NetworkAddressAndPriceDto {
|
|
407
|
+
/** Alchemy network */
|
|
408
|
+
network: string;
|
|
409
|
+
/** Contract address */
|
|
410
|
+
contractAddress: string;
|
|
411
|
+
/** USD price */
|
|
412
|
+
price: number;
|
|
413
|
+
}
|
|
414
|
+
export interface GetTokens24hrPriceChangeParams {
|
|
415
|
+
/** Array of pairs of alchemy network and contract address */
|
|
416
|
+
tokens: Array<{
|
|
417
|
+
network: AlchemyNetwork;
|
|
418
|
+
contractAddress: string;
|
|
419
|
+
}>;
|
|
420
|
+
}
|
|
421
|
+
export interface TokenPriceChange {
|
|
422
|
+
currentPrice: number;
|
|
423
|
+
oldPrice: number;
|
|
424
|
+
priceChangeAbsolute: number;
|
|
425
|
+
priceChangePercentage: number;
|
|
426
|
+
}
|
|
427
|
+
export interface TokenInfoWithPriceChangeDto {
|
|
428
|
+
/** Token name */
|
|
429
|
+
name: string;
|
|
430
|
+
/** Token symbol */
|
|
431
|
+
symbol: string;
|
|
432
|
+
/** Token logo */
|
|
433
|
+
logo: string;
|
|
434
|
+
/** Token description */
|
|
435
|
+
description?: string | null;
|
|
436
|
+
/** Decimals */
|
|
437
|
+
decimals: number;
|
|
438
|
+
/** Contract address */
|
|
439
|
+
contractAddress: string;
|
|
440
|
+
/** Network */
|
|
441
|
+
network: string;
|
|
442
|
+
/** Native token flag */
|
|
443
|
+
native: boolean;
|
|
444
|
+
/** Price change */
|
|
445
|
+
priceChange: TokenPriceChange;
|
|
446
|
+
}
|
|
447
|
+
export interface TokenInfo {
|
|
448
|
+
network: string;
|
|
449
|
+
logo: string;
|
|
450
|
+
name: string;
|
|
451
|
+
website: string;
|
|
452
|
+
description: string;
|
|
453
|
+
explorer: string;
|
|
454
|
+
type: string;
|
|
455
|
+
symbol: string;
|
|
456
|
+
decimals: number;
|
|
457
|
+
status: string;
|
|
458
|
+
tags: string[];
|
|
459
|
+
id: string;
|
|
460
|
+
links: any[];
|
|
461
|
+
}
|
|
462
|
+
export interface TokenPriceHistoryParams {
|
|
463
|
+
contractAddress: string;
|
|
464
|
+
network: AlchemyNetwork;
|
|
465
|
+
interval?: TimeInterval;
|
|
466
|
+
limit?: number;
|
|
467
|
+
page?: number;
|
|
468
|
+
order?: Order;
|
|
469
|
+
}
|
|
470
|
+
export interface TokenPriceHistoryDataPoint {
|
|
471
|
+
value: string;
|
|
472
|
+
timestamp: string;
|
|
473
|
+
}
|
|
474
|
+
export interface TokenPriceHistoryResponse {
|
|
475
|
+
symbol: string;
|
|
476
|
+
currency: string;
|
|
477
|
+
data: TokenPriceHistoryDataPoint[];
|
|
478
|
+
}
|
|
479
|
+
export interface AccountTokenBalance {
|
|
480
|
+
contractAddress: string;
|
|
481
|
+
tokenBalance: string;
|
|
482
|
+
error?: any | null;
|
|
483
|
+
}
|
|
484
|
+
export interface AccountTokensBalancesResponse {
|
|
485
|
+
address: string;
|
|
486
|
+
tokenBalances: AccountTokenBalance[];
|
|
487
|
+
}
|
|
488
|
+
export interface SupaPointsBalanceResponseDto {
|
|
489
|
+
/** Current SupaPoints balance */
|
|
490
|
+
balance: number;
|
|
491
|
+
}
|
|
492
|
+
export interface DailyLoginResponseDto {
|
|
493
|
+
/** Current SupaPoints balance */
|
|
494
|
+
balance: number;
|
|
495
|
+
/** SupaPoints balance change */
|
|
496
|
+
add: number;
|
|
497
|
+
}
|
|
498
|
+
export interface SupaPointsHistoryParams extends PaginationParams {
|
|
499
|
+
startDate?: string;
|
|
500
|
+
endDate?: string;
|
|
501
|
+
action?: string;
|
|
502
|
+
}
|
|
503
|
+
export interface PaymasterRequestDataDto {
|
|
504
|
+
/** User operation hex-string */
|
|
505
|
+
userOperation: string;
|
|
506
|
+
/** Entrypoint address */
|
|
507
|
+
entryPoint: string;
|
|
508
|
+
/** Network ID */
|
|
509
|
+
chainId: number;
|
|
510
|
+
/** Sponsorship policy ID */
|
|
511
|
+
sponsorshipPolicyId: string;
|
|
512
|
+
}
|
|
513
|
+
export interface PaymasterRequestDto {
|
|
514
|
+
/** Request type */
|
|
515
|
+
type: 'sponsorshipPolicy.webhook';
|
|
516
|
+
/** Request data */
|
|
517
|
+
data: PaymasterRequestDataDto;
|
|
518
|
+
}
|
|
519
|
+
export interface PaymasterResponseDto {
|
|
520
|
+
sponsor: boolean;
|
|
521
|
+
}
|
|
522
|
+
export interface TransactionQueryParams {
|
|
523
|
+
withScam?: boolean;
|
|
524
|
+
}
|
|
525
|
+
export interface ApiError {
|
|
526
|
+
statusCode: number;
|
|
527
|
+
message: string;
|
|
528
|
+
error?: string;
|
|
529
|
+
}
|
|
530
|
+
export interface ApiResponse<T = any> {
|
|
531
|
+
data?: T;
|
|
532
|
+
error?: ApiError;
|
|
533
|
+
}
|