@lydianpay/sdk-web 3.14.0 → 3.15.1

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,4 +1,4 @@
1
- import { DisplayAsset } from '../types';
1
+ import { BuildTransferResponse, DisplayAsset } from '../types';
2
2
  import { CheckoutNamespace } from '../constants';
3
3
  export type WalletRequest = {
4
4
  method: string;
@@ -10,16 +10,18 @@ export type BuildTransferRequestArgs = {
10
10
  from: string;
11
11
  amount: string;
12
12
  tokenContract?: string;
13
+ backendTransfer?: () => Promise<BuildTransferResponse>;
13
14
  };
14
15
  export type BuildBalanceRequestArgs = {
15
16
  account: string;
16
17
  tokenContract?: string;
17
18
  };
18
19
  export interface ChainAdapter {
19
- buildTransferRequest(args: BuildTransferRequestArgs): WalletRequest | null;
20
+ buildTransferRequest(args: BuildTransferRequestArgs): Promise<WalletRequest | null>;
20
21
  buildBalanceRequest(args: BuildBalanceRequestArgs): WalletRequest | null;
21
22
  /** Base units from a balance result, or null when unreadable. */
22
23
  parseBalanceResult(result: unknown): bigint | null;
23
24
  }
24
25
  export declare const evmChainAdapter: ChainAdapter;
26
+ export declare const solanaChainAdapter: ChainAdapter;
25
27
  export declare function getChainAdapter(namespace: CheckoutNamespace): ChainAdapter | undefined;
@@ -1,8 +1,9 @@
1
1
  import { Base } from '../base.js';
2
- import { CancelTransactionRequest, CreatePaymentRequest, CreateTransactionResponse, GetTransactionResponse, KYCVerificationRequest } from '../../types';
2
+ import { BuildTransferRequest, BuildTransferResponse, CancelTransactionRequest, CreatePaymentRequest, CreateTransactionResponse, GetTransactionResponse, KYCVerificationRequest } from '../../types';
3
3
  export declare class CryptoTransactions extends Base {
4
4
  getCryptoTransaction(transactionID: string): Promise<GetTransactionResponse>;
5
5
  createPaymentRequest(transactionID: string, paymentRequest: CreatePaymentRequest): Promise<CreateTransactionResponse>;
6
+ buildTransfer(transactionID: string, paymentRequestID: string, request: BuildTransferRequest): Promise<BuildTransferResponse>;
6
7
  cancelCryptoTransaction(transactionID: string, cancelTransaction: CancelTransactionRequest): Promise<CreateTransactionResponse>;
7
8
  kycVerification(transactionID: string, kycVerificationRequest: KYCVerificationRequest): Promise<CreateTransactionResponse>;
8
9
  }
@@ -215,6 +215,13 @@ export type CreateTransactionResponse = {
215
215
  calculatedTotals?: CalculatedTotals;
216
216
  cryptoFXRate?: number;
217
217
  };
218
+ export type BuildTransferRequest = {
219
+ fromAddress: string;
220
+ };
221
+ export type BuildTransferResponse = {
222
+ unsignedTransfer: string;
223
+ lastValidBlockHeight: number;
224
+ };
218
225
  export type KYCVerificationRequest = {
219
226
  asset: string;
220
227
  network: string;
@@ -15,6 +15,7 @@ export interface CheckoutPresentation {
15
15
  hideQRCode(): void;
16
16
  showSuccess(transaction: GetTransactionResponse | undefined, overpaidUSD: number): void;
17
17
  showUnderpaid(transaction: GetTransactionResponse): void;
18
+ showWalletPaymentProgress(transaction: GetTransactionResponse): void;
18
19
  showFailure(message: string): void;
19
20
  /** Terminal screen for a cancellation with nowhere to redirect to. */
20
21
  showCanceled(): void;
@@ -12,3 +12,4 @@ export declare function getLdkCheckoutSessionProperties({ isLDKEnabled, walletId
12
12
  hasTransaction: boolean;
13
13
  }): Record<string, string> | undefined;
14
14
  export declare function isLdkHandoff(checkout: Parameters<typeof getLdkCheckoutSessionProperties>[0]): boolean;
15
+ export declare function isLdkCheckoutSupported(approvedSessionProperties: Readonly<Record<string, string>> | undefined): boolean;
@@ -27,3 +27,8 @@ export declare function adoptWalletPayment({ transaction, store, paymentFlow, se
27
27
  presentation: Pick<CheckoutPresentation, 'clearErrorBanner'>;
28
28
  screenNavigator: Pick<ScreenNavigator, 'show' | 'setBack'>;
29
29
  }): void;
30
+ export declare function isWalletOwnedCheckout({ transaction, isLDKEnabled, wasHandedToWallet, }: {
31
+ transaction: GetTransactionResponse;
32
+ isLDKEnabled: boolean;
33
+ wasHandedToWallet: boolean;
34
+ }): boolean;
@@ -28,11 +28,11 @@ export interface PaymentFlowSeams {
28
28
  transactionID?: string;
29
29
  }): void;
30
30
  showKycScreen(): void;
31
- buildConnectedWalletSend(): WalletRequest | null;
31
+ buildConnectedWalletSend(): Promise<WalletRequest | null>;
32
32
  signAndSubmit(built: WalletRequest): Promise<void>;
33
- setPendingWalletSend(built: WalletRequest | null): void;
34
- hasPendingWalletSend(): boolean;
33
+ canSignWithConnectedWallet(): boolean;
35
34
  resetCheckout(): void;
35
+ walletOwnsCheckout(): boolean;
36
36
  }
37
37
  export declare function createPaymentFlow({ store, presentation, screenNavigator, sessionLifecycle, hostCallbacks, poller, quoteWatcher, getApi, getOptions, emit, seams, }: {
38
38
  store: CheckoutStore;
@@ -0,0 +1,9 @@
1
+ export declare const clearWalletCheckoutRecord: ({ sessionId }: {
2
+ sessionId: string | null | undefined;
3
+ }) => void;
4
+ export declare function writeWalletCheckoutRecord({ sessionId, }: {
5
+ sessionId: string | null | undefined;
6
+ }): void;
7
+ export declare function wasCheckoutHandedToWallet({ sessionId, }: {
8
+ sessionId: string | null | undefined;
9
+ }): boolean;
@@ -1,6 +1,7 @@
1
1
  import { type WalletRequest } from '../chains/adapters';
2
2
  import { type CheckoutWallet } from '../constants';
3
3
  import { type CheckoutStore } from './react/checkoutStore';
4
+ import type { API } from '../network';
4
5
  import type { CheckoutPresentation } from './checkoutPresentation';
5
6
  import type { DialogController } from './dialogController';
6
7
  import type { PaymentFlow } from './paymentFlow';
@@ -32,12 +33,9 @@ export interface WalletConnection {
32
33
  /** No navigation or failure report; a late result is ignored. */
33
34
  abortPendingConnection(): void;
34
35
  /** Null unless a connected wallet can sign for the live transaction. */
35
- buildSend(): WalletRequest | null;
36
- /** The send to sign — the one held for the confirmation screen, or a fresh build. */
37
- sendForSigning(): WalletRequest | null;
38
- /** Held while the customer looks at the confirmation screen. */
39
- setPendingSend(built: WalletRequest | null): void;
40
- hasPendingSend(): boolean;
36
+ buildSend(): Promise<WalletRequest | null>;
37
+ sendForSigning(): Promise<WalletRequest | null>;
38
+ canSign(): boolean;
41
39
  signAndSubmit(built: WalletRequest): Promise<void>;
42
40
  openWallet(link?: 'universal'): void;
43
41
  showConnectWithQr(): void;
@@ -57,13 +55,14 @@ export interface WalletConnectionSeams {
57
55
  watchForHandoff(): void;
58
56
  abandonHandoff(): void;
59
57
  }
60
- export declare function createWalletConnection({ store, presentation, screenNavigator, paymentFlow, getDialogs, getOptions, emit, seams, }: {
58
+ export declare function createWalletConnection({ store, presentation, screenNavigator, paymentFlow, getDialogs, getOptions, getApi, emit, seams, }: {
61
59
  store: CheckoutStore;
62
60
  presentation: CheckoutPresentation;
63
61
  screenNavigator: ScreenNavigator;
64
62
  paymentFlow: PaymentFlow;
65
63
  getDialogs: () => DialogController | null;
66
64
  getOptions: () => CheckoutInitOptions | null;
65
+ getApi: () => API | null;
67
66
  emit: (name: CheckoutEventName, data?: Record<string, unknown>) => void;
68
67
  seams: WalletConnectionSeams;
69
68
  }): WalletConnection;
@@ -0,0 +1 @@
1
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.14.0",
3
+ "version": "3.15.1",
4
4
  "description": "Drop-in crypto payment checkout for the web — a <lydian-checkout> web component and window.Lydian API across 20+ chains and major stablecoins.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@lydianpay/frontend-shared-helpers": "1.2.0",
91
- "@lydianpay/lydianconnect": "^1.9.0",
91
+ "@lydianpay/lydianconnect": "^1.10.1",
92
92
  "@lydianpay/lydianconnect-catalog": "^1.4.1",
93
93
  "@solana/qr-code-styling": "^1.6.0",
94
94
  "dompurify": "^3.4.12",