@supanovaapp/sdk 0.2.35 → 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 +49 -2
- 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 +21 -4
- package/package.json +1 -1
|
@@ -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
|
|
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;
|
|
@@ -35,12 +35,17 @@ export declare class CantonService {
|
|
|
35
35
|
private meCacheTimestamp;
|
|
36
36
|
private mePendingPromise;
|
|
37
37
|
private readonly CACHE_TTL;
|
|
38
|
+
private static readonly AMULET_INSTRUMENT_ID;
|
|
38
39
|
constructor(client: ApiClient);
|
|
39
40
|
/**
|
|
40
41
|
* Invalidate /me cache
|
|
41
42
|
* Called after registration/user modification operations
|
|
42
43
|
*/
|
|
43
44
|
private invalidateMeCache;
|
|
45
|
+
/**
|
|
46
|
+
* Validate decimal places for transfer amount (max 10)
|
|
47
|
+
*/
|
|
48
|
+
private validateTransferAmount;
|
|
44
49
|
/**
|
|
45
50
|
* Register Canton wallet
|
|
46
51
|
* Flow:
|
|
@@ -137,11 +142,23 @@ export declare class CantonService {
|
|
|
137
142
|
*/
|
|
138
143
|
getBalances(): Promise<CantonWalletBalancesResponseDto>;
|
|
139
144
|
/**
|
|
140
|
-
* Prepare
|
|
141
|
-
* @param params Transfer parameters
|
|
145
|
+
* Prepare Canton transfer (Amulet or CIP-56 token)
|
|
146
|
+
* @param params Transfer parameters
|
|
142
147
|
* @throws Error if amount has more than 10 decimal places
|
|
143
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
|
+
*/
|
|
144
157
|
prepareAmuletTransfer(params: CantonPrepareAmuletTransferRequestDto): Promise<CantonPrepareAmuletTransferResponseDto>;
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated Typo alias. Use `prepareAmuletTransfer`.
|
|
160
|
+
*/
|
|
161
|
+
prepareAmuletTranafer(params: CantonPrepareAmuletTransferRequestDto): Promise<CantonPrepareAmuletTransferResponseDto>;
|
|
145
162
|
/**
|
|
146
163
|
* Get pending incoming transfers for the current user
|
|
147
164
|
* Returns a list of transfer offers that can be accepted or rejected
|
package/package.json
CHANGED