@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.
@@ -1,10 +1,20 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { CantonWallet } from '../utils/wallet';
3
3
  import { CantonService, CantonSubmitPreparedOptions } from '../services/cantonService';
4
- import { CantonMeResponseDto, CantonActiveContractsResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonIncomingTransferDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto } from '../core/types';
4
+ import { CantonMeResponseDto, CantonActiveContractsResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonIncomingTransferDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto, CantonPrepareTransferRequestDto, CantonCalculateTransferFeeResponseDto } from '../core/types';
5
5
  export interface CantonSendCoinOptions extends CantonSubmitPreparedOptions {
6
6
  /** Skip confirmation modal. Default: false */
7
7
  skipModal?: boolean;
8
+ /**
9
+ * Instrument ID to transfer.
10
+ * Defaults to "Amulet" (CC).
11
+ */
12
+ instrumentId?: CantonPrepareTransferRequestDto['instrumentId'];
13
+ /**
14
+ * Optional instrument admin party ID.
15
+ * Useful for CIP-56 tokens.
16
+ */
17
+ instrumentAdmin?: CantonPrepareTransferRequestDto['instrumentAdmin'];
8
18
  }
9
19
  export interface CantonContextValue {
10
20
  /** First Stellar wallet (primary) */
@@ -35,8 +45,10 @@ export interface CantonContextValue {
35
45
  signMessage: (message: string) => Promise<string>;
36
46
  /** Prepare and submit transaction with polling for completion */
37
47
  sendTransaction: (commands: unknown, disclosedContracts?: unknown, options?: CantonSubmitPreparedOptions) => Promise<CantonQueryCompletionResponseDto>;
38
- /** Send Canton Coin (Amulet) to another party */
48
+ /** Send transfer to another party (defaults to Canton Coin / Amulet) */
39
49
  sendCantonCoin: (receiverPartyId: string, amount: string, memo?: string, options?: CantonSendCoinOptions) => Promise<CantonQueryCompletionResponseDto>;
50
+ /** Calculate transfer fee in CC for current user party */
51
+ calculateTransferFee: (instrumentId?: string, instrumentAdmin?: string) => Promise<CantonCalculateTransferFeeResponseDto>;
40
52
  /** Setup transfer preapproval (internal, called automatically) */
41
53
  setupTransferPreapproval: () => Promise<void>;
42
54
  /** Get pending incoming transfers */
@@ -1,6 +1,6 @@
1
1
  import { ApiClient } from '../core/client';
2
- import { CantonPrepareTransactionResponseDto, CantonSubmitRegisterRequestDto, CantonSubmitTransactionResponseDto, CantonMeResponseDto, CantonActiveContractsResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonPrepareAmuletTransferRequestDto, CantonPrepareAmuletTransferResponseDto, CantonIncomingTransferDto, CantonPrepareResponseIncomingTransferRequestDto, CantonCostEstimationDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto, CantonSubmitMultipleResultDto } from '../core/types';
3
- export type { CantonMeResponseDto, CantonActiveContractsResponseDto, CantonPrepareTransactionResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonPrepareAmuletTransferRequestDto, CantonPrepareAmuletTransferResponseDto, CantonIncomingTransferDto, CantonPrepareResponseIncomingTransferRequestDto, CantonCostEstimationDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto, CantonSubmitMultipleResultDto, };
2
+ import { CantonPrepareTransactionResponseDto, CantonSubmitRegisterRequestDto, CantonSubmitTransactionResponseDto, CantonMeResponseDto, CantonActiveContractsResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonPrepareTransferRequestDto, CantonPrepareTransferResponseDto, CantonCalculateTransferFeeRequestDto, CantonCalculateTransferFeeResponseDto, CantonPrepareAmuletTransferRequestDto, CantonPrepareAmuletTransferResponseDto, CantonIncomingTransferDto, CantonPrepareResponseIncomingTransferRequestDto, CantonCostEstimationDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto, CantonSubmitMultipleResultDto } from '../core/types';
3
+ export type { CantonMeResponseDto, CantonActiveContractsResponseDto, CantonPrepareTransactionResponseDto, CantonQueryCompletionResponseDto, CantonWalletBalancesResponseDto, CantonPrepareTransferRequestDto, CantonPrepareTransferResponseDto, CantonCalculateTransferFeeRequestDto, CantonCalculateTransferFeeResponseDto, CantonPrepareAmuletTransferRequestDto, CantonPrepareAmuletTransferResponseDto, CantonIncomingTransferDto, CantonPrepareResponseIncomingTransferRequestDto, CantonCostEstimationDto, CantonTransactionDto, CantonTransactionsParams, CantonPriceInterval, CantonPriceCandleDto, CantonSubmitMultipleResultDto, };
4
4
  export interface CantonRegisterParams {
5
5
  /** Base64 public key from Stellar wallet */
6
6
  publicKey: string;
@@ -27,9 +27,7 @@ export interface CantonSubmitPreparedOptions {
27
27
  /** Optional command ID for idempotency (passed to prepareTransaction) */
28
28
  commandId?: string;
29
29
  /** Optional deduplication period (passed to submitPrepared) */
30
- deduplicationPeriod?: {
31
- value: string;
32
- };
30
+ deduplicationPeriod?: any;
33
31
  }
34
32
  export declare class CantonService {
35
33
  private client;
@@ -37,12 +35,17 @@ export declare class CantonService {
37
35
  private meCacheTimestamp;
38
36
  private mePendingPromise;
39
37
  private readonly CACHE_TTL;
38
+ private static readonly AMULET_INSTRUMENT_ID;
40
39
  constructor(client: ApiClient);
41
40
  /**
42
41
  * Invalidate /me cache
43
42
  * Called after registration/user modification operations
44
43
  */
45
44
  private invalidateMeCache;
45
+ /**
46
+ * Validate decimal places for transfer amount (max 10)
47
+ */
48
+ private validateTransferAmount;
46
49
  /**
47
50
  * Register Canton wallet
48
51
  * Flow:
@@ -70,9 +73,7 @@ export declare class CantonService {
70
73
  * @param hash Base64 hash
71
74
  * @param signature Base64 signature
72
75
  */
73
- submitPrepared(hash: string, signature: string, deduplicationPeriod?: {
74
- value: string;
75
- }): Promise<CantonSubmitTransactionResponseDto>;
76
+ submitPrepared(hash: string, signature: string, deduplicationPeriod?: any): Promise<CantonSubmitTransactionResponseDto>;
76
77
  /**
77
78
  * Submit multiple signed Canton transactions in a single request
78
79
  * @param txs Array of { hash, signature } (base64)
@@ -141,11 +142,23 @@ export declare class CantonService {
141
142
  */
142
143
  getBalances(): Promise<CantonWalletBalancesResponseDto>;
143
144
  /**
144
- * Prepare Amulet (Canton Coin) transfer
145
- * @param params Transfer parameters (receiverPartyId, amount, memo)
145
+ * Prepare Canton transfer (Amulet or CIP-56 token)
146
+ * @param params Transfer parameters
146
147
  * @throws Error if amount has more than 10 decimal places
147
148
  */
149
+ prepareTransfer(params: CantonPrepareTransferRequestDto): Promise<CantonPrepareTransferResponseDto>;
150
+ /**
151
+ * Calculate transfer fee (always returned in CC)
152
+ */
153
+ calculateTransferFee(params: CantonCalculateTransferFeeRequestDto): Promise<CantonCalculateTransferFeeResponseDto>;
154
+ /**
155
+ * @deprecated Use `prepareTransfer` with `instrumentId: "Amulet"`.
156
+ */
148
157
  prepareAmuletTransfer(params: CantonPrepareAmuletTransferRequestDto): Promise<CantonPrepareAmuletTransferResponseDto>;
158
+ /**
159
+ * @deprecated Typo alias. Use `prepareAmuletTransfer`.
160
+ */
161
+ prepareAmuletTranafer(params: CantonPrepareAmuletTransferRequestDto): Promise<CantonPrepareAmuletTransferResponseDto>;
149
162
  /**
150
163
  * Get pending incoming transfers for the current user
151
164
  * Returns a list of transfer offers that can be accepted or rejected
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supanovaapp/sdk",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "React SDK for Supa Backend + Privy.io integration with Canton Network and EVM Smart Wallets support",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",