@supanovaapp/sdk 0.2.34 → 0.2.36
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 +22 -3
- package/dist/core/types.d.ts +50 -5
- package/dist/hooks/useSendMultipleTransactions.d.ts +1 -3
- package/dist/index.cjs.js +303 -303
- package/dist/index.esm.js +11683 -11640
- package/dist/providers/CantonProvider.d.ts +14 -2
- package/dist/services/cantonService.d.ts +23 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -456,9 +456,9 @@ if (cantonBalances) {
|
|
|
456
456
|
}
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
-
#### Send Canton Coin
|
|
459
|
+
#### Send Canton Coin / Token
|
|
460
460
|
|
|
461
|
-
Send Canton Coin with cost estimation support:
|
|
461
|
+
Send Canton Coin (default) or CIP-56 token with cost estimation support:
|
|
462
462
|
|
|
463
463
|
```tsx
|
|
464
464
|
const { sendCantonCoin } = useCanton();
|
|
@@ -470,6 +470,8 @@ try {
|
|
|
470
470
|
'100.5', // Amount (max 10 decimal places)
|
|
471
471
|
'Payment for services', // Optional memo
|
|
472
472
|
{
|
|
473
|
+
instrumentId: 'Amulet', // optional, default 'Amulet'
|
|
474
|
+
// instrumentAdmin: 'token-admin::1220abc...', // optional for Amulet, required for many CIP-56 tokens
|
|
473
475
|
timeout: 30000, // completion timeout (ms)
|
|
474
476
|
pollInterval: 1000, // polling interval (ms)
|
|
475
477
|
onCostEstimation: (cost) => {
|
|
@@ -504,6 +506,19 @@ interface CantonCostEstimationDto {
|
|
|
504
506
|
}
|
|
505
507
|
```
|
|
506
508
|
|
|
509
|
+
#### Calculate Transfer Fee (in CC)
|
|
510
|
+
|
|
511
|
+
```tsx
|
|
512
|
+
const { calculateTransferFee } = useCanton();
|
|
513
|
+
|
|
514
|
+
const feeCc = await calculateTransferFee(
|
|
515
|
+
'USDC', // instrumentId (optional, defaults to Amulet)
|
|
516
|
+
'token-admin::1220abc123...' // optional instrumentAdmin
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
console.log('Transfer fee (CC):', feeCc);
|
|
520
|
+
```
|
|
521
|
+
|
|
507
522
|
**Note**: The amount cannot have more than 10 decimal places. Transfers are only supported to wallets with preapproved transfers enabled.
|
|
508
523
|
|
|
509
524
|
#### Submit a Transaction
|
|
@@ -744,7 +759,7 @@ await sendTransaction(command, contracts, {
|
|
|
744
759
|
|------|---------|-------------|
|
|
745
760
|
| `useSupa` | Main SDK hook | `auth`, `canton`, `api`, `onboard`, `logout` (recommended for complete cleanup) |
|
|
746
761
|
| `useAuth` | Authentication | `login`, `logout`, `authenticated`, `user` |
|
|
747
|
-
| `useCanton` | Canton Network | `registerCanton`, `getBalances`, `sendCantonCoin`, `signMessage`, `sendTransaction`, `getActiveContracts`, `tapDevnet`, `getPendingIncomingTransfers`, `respondToIncomingTransfer`, `resetState` |
|
|
762
|
+
| `useCanton` | Canton Network | `registerCanton`, `getBalances`, `sendCantonCoin`, `calculateTransferFee`, `signMessage`, `sendTransaction`, `getActiveContracts`, `tapDevnet`, `getPendingIncomingTransfers`, `respondToIncomingTransfer`, `resetState` |
|
|
748
763
|
| `useSignMessage` | Enhanced message signing | `signMessage` with custom modals |
|
|
749
764
|
| `useSendTransaction` | Enhanced transactions | `sendTransaction` with custom modals |
|
|
750
765
|
| `useConfirmModal` | Generic modals | `confirm`, `signMessageConfirm`, `signTransactionConfirm` |
|
|
@@ -771,6 +786,10 @@ import type {
|
|
|
771
786
|
CantonInstrumentIdDto,
|
|
772
787
|
CantonLockedUtxoDto,
|
|
773
788
|
CantonUnlockedUtxoDto,
|
|
789
|
+
CantonPrepareTransferRequestDto,
|
|
790
|
+
CantonPrepareTransferResponseDto,
|
|
791
|
+
CantonCalculateTransferFeeRequestDto,
|
|
792
|
+
CantonCalculateTransferFeeResponseDto,
|
|
774
793
|
CantonPrepareAmuletTransferRequestDto,
|
|
775
794
|
CantonCostEstimationDto,
|
|
776
795
|
CantonIncomingTransferDto,
|
package/dist/core/types.d.ts
CHANGED
|
@@ -34,9 +34,7 @@ export interface CantonSubmitRegisterRequestDto {
|
|
|
34
34
|
/** Base64 signature for provided hash */
|
|
35
35
|
signature: string;
|
|
36
36
|
/** Optional deduplication period */
|
|
37
|
-
deduplicationPeriod?:
|
|
38
|
-
value: string;
|
|
39
|
-
};
|
|
37
|
+
deduplicationPeriod?: any;
|
|
40
38
|
}
|
|
41
39
|
export interface CantonSubmitTransactionResponseDto {
|
|
42
40
|
/** Submission ID for tracking completion */
|
|
@@ -241,7 +239,52 @@ export interface CantonWalletBalancesResponseDto {
|
|
|
241
239
|
/** Timestamp when balances were fetched (ISO 8601) */
|
|
242
240
|
fetchedAt: string;
|
|
243
241
|
}
|
|
244
|
-
/** Request for preparing
|
|
242
|
+
/** Request for preparing a Canton transfer (Amulet or CIP-56 token) */
|
|
243
|
+
export interface CantonPrepareTransferRequestDto {
|
|
244
|
+
/** Canton party ID of the receiver wallet */
|
|
245
|
+
receiverPartyId: string;
|
|
246
|
+
/** Amount to transfer (decimal string with max 10 decimal places) */
|
|
247
|
+
amount: string;
|
|
248
|
+
/** Instrument ID (e.g., "Amulet" for CC, "USDC" for CIP-56 tokens) */
|
|
249
|
+
instrumentId: string;
|
|
250
|
+
/**
|
|
251
|
+
* Instrument admin party ID.
|
|
252
|
+
* Optional for Amulet (resolved by backend), required for CIP-56 tokens.
|
|
253
|
+
*/
|
|
254
|
+
instrumentAdmin?: string;
|
|
255
|
+
/** Optional memo for the transfer */
|
|
256
|
+
memo?: string;
|
|
257
|
+
}
|
|
258
|
+
/** Response for preparing a Canton transfer (Amulet or CIP-56 token) */
|
|
259
|
+
export interface CantonPrepareTransferResponseDto extends CantonPrepareTransactionResponseDto {
|
|
260
|
+
/** Canton party ID of the receiver wallet */
|
|
261
|
+
receiverPartyId: string;
|
|
262
|
+
/** Amount to transfer (decimal string with max 10 decimal places) */
|
|
263
|
+
amount: string;
|
|
264
|
+
/** Instrument ID (e.g., "Amulet" for CC, "USDC" for CIP-56 tokens) */
|
|
265
|
+
instrumentId: string;
|
|
266
|
+
/** Optional instrument admin party ID */
|
|
267
|
+
instrumentAdmin?: string;
|
|
268
|
+
/** Optional memo for the transfer */
|
|
269
|
+
memo?: string;
|
|
270
|
+
}
|
|
271
|
+
/** Request params for transfer fee calculation */
|
|
272
|
+
export interface CantonCalculateTransferFeeRequestDto {
|
|
273
|
+
/** Sender party ID */
|
|
274
|
+
partyId: string;
|
|
275
|
+
/** Instrument ID of the transferred token */
|
|
276
|
+
instrumentId: string;
|
|
277
|
+
/** Optional instrument admin party ID */
|
|
278
|
+
instrumentAdmin?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Transfer fee in CC.
|
|
282
|
+
* Backend returns a numeric amount in Canton Coin units.
|
|
283
|
+
*/
|
|
284
|
+
export type CantonCalculateTransferFeeResponseDto = number;
|
|
285
|
+
/**
|
|
286
|
+
* @deprecated Use `CantonPrepareTransferRequestDto` with `instrumentId: "Amulet"`.
|
|
287
|
+
*/
|
|
245
288
|
export interface CantonPrepareAmuletTransferRequestDto {
|
|
246
289
|
/** Canton party ID of the receiver wallet */
|
|
247
290
|
receiverPartyId: string;
|
|
@@ -250,7 +293,9 @@ export interface CantonPrepareAmuletTransferRequestDto {
|
|
|
250
293
|
/** Optional memo for the transfer */
|
|
251
294
|
memo?: string;
|
|
252
295
|
}
|
|
253
|
-
/**
|
|
296
|
+
/**
|
|
297
|
+
* @deprecated Use `CantonPrepareTransferResponseDto` with `instrumentId: "Amulet"`.
|
|
298
|
+
*/
|
|
254
299
|
export interface CantonPrepareAmuletTransferResponseDto extends CantonPrepareTransactionResponseDto {
|
|
255
300
|
/** Canton party ID of the receiver wallet */
|
|
256
301
|
receiverPartyId: string;
|
|
@@ -19,9 +19,7 @@ export interface SendMultipleTransactionsOptions {
|
|
|
19
19
|
/** Show technical transaction details (commands, disclosedContracts, hash) as JSON. Default: false */
|
|
20
20
|
showTechnicalDetails?: boolean;
|
|
21
21
|
/** Optional deduplication period (shared across all transactions in the batch) */
|
|
22
|
-
deduplicationPeriod?:
|
|
23
|
-
value: string;
|
|
24
|
-
};
|
|
22
|
+
deduplicationPeriod?: any;
|
|
25
23
|
submitOptions?: CantonSubmitPreparedOptions;
|
|
26
24
|
}
|
|
27
25
|
export interface UseSendMultipleTransactionsReturn {
|