@supanovaapp/sdk 0.2.35 → 0.2.37

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 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,
@@ -68,6 +68,8 @@ export interface CantonMeResponseDto {
68
68
  partyId: string;
69
69
  /** User email (can be null if not set) */
70
70
  email: string | null;
71
+ /** Public key used in Canton (base64, 32 bytes Ed25519) */
72
+ publicKey?: string | null;
71
73
  /** Indicates whether the transfer preapproval is set and NOT EXPIRED for the party */
72
74
  transferPreapprovalSet: boolean;
73
75
  /** Transfer preapproval expiration date (ISO 8601, can be null) */
@@ -239,7 +241,52 @@ export interface CantonWalletBalancesResponseDto {
239
241
  /** Timestamp when balances were fetched (ISO 8601) */
240
242
  fetchedAt: string;
241
243
  }
242
- /** Request for preparing Amulet (Canton Coin) transfer */
244
+ /** Request for preparing a Canton transfer (Amulet or CIP-56 token) */
245
+ export interface CantonPrepareTransferRequestDto {
246
+ /** Canton party ID of the receiver wallet */
247
+ receiverPartyId: string;
248
+ /** Amount to transfer (decimal string with max 10 decimal places) */
249
+ amount: string;
250
+ /** Instrument ID (e.g., "Amulet" for CC, "USDC" for CIP-56 tokens) */
251
+ instrumentId: string;
252
+ /**
253
+ * Instrument admin party ID.
254
+ * Optional for Amulet (resolved by backend), required for CIP-56 tokens.
255
+ */
256
+ instrumentAdmin?: string;
257
+ /** Optional memo for the transfer */
258
+ memo?: string;
259
+ }
260
+ /** Response for preparing a Canton transfer (Amulet or CIP-56 token) */
261
+ export interface CantonPrepareTransferResponseDto extends CantonPrepareTransactionResponseDto {
262
+ /** Canton party ID of the receiver wallet */
263
+ receiverPartyId: string;
264
+ /** Amount to transfer (decimal string with max 10 decimal places) */
265
+ amount: string;
266
+ /** Instrument ID (e.g., "Amulet" for CC, "USDC" for CIP-56 tokens) */
267
+ instrumentId: string;
268
+ /** Optional instrument admin party ID */
269
+ instrumentAdmin?: string;
270
+ /** Optional memo for the transfer */
271
+ memo?: string;
272
+ }
273
+ /** Request params for transfer fee calculation */
274
+ export interface CantonCalculateTransferFeeRequestDto {
275
+ /** Sender party ID */
276
+ partyId: string;
277
+ /** Instrument ID of the transferred token */
278
+ instrumentId: string;
279
+ /** Optional instrument admin party ID */
280
+ instrumentAdmin?: string;
281
+ }
282
+ /**
283
+ * Transfer fee in CC.
284
+ * Backend returns a numeric amount in Canton Coin units.
285
+ */
286
+ export type CantonCalculateTransferFeeResponseDto = number;
287
+ /**
288
+ * @deprecated Use `CantonPrepareTransferRequestDto` with `instrumentId: "Amulet"`.
289
+ */
243
290
  export interface CantonPrepareAmuletTransferRequestDto {
244
291
  /** Canton party ID of the receiver wallet */
245
292
  receiverPartyId: string;
@@ -248,7 +295,9 @@ export interface CantonPrepareAmuletTransferRequestDto {
248
295
  /** Optional memo for the transfer */
249
296
  memo?: string;
250
297
  }
251
- /** Response for preparing Amulet (Canton Coin) transfer */
298
+ /**
299
+ * @deprecated Use `CantonPrepareTransferResponseDto` with `instrumentId: "Amulet"`.
300
+ */
252
301
  export interface CantonPrepareAmuletTransferResponseDto extends CantonPrepareTransactionResponseDto {
253
302
  /** Canton party ID of the receiver wallet */
254
303
  receiverPartyId: string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared helpers for hash-signing flows.
3
+ */
4
+ export type SigningChainType = 'stellar' | 'solana';
5
+ export declare const resolveRequestedChainType: (chainType: string, withExportFallback: boolean) => SigningChainType;
6
+ export declare const hexToBytes: (hex: string) => Uint8Array;
7
+ export declare const bytesToHex: (bytes: Uint8Array) => string;
@@ -2,7 +2,7 @@
2
2
  * Wrapper over Privy's signing with automatic confirmation modals
3
3
  *
4
4
  * Shows a confirmation modal before every signing operation
5
- * Supports both Stellar (rawSign) and Solana (signMessage) based on withExport config
5
+ * Supports both Stellar (rawSign) and Solana (signMessage) based on requested chainType
6
6
  */
7
7
  export interface SignRawHashModalOptions {
8
8
  skipModal?: boolean;