@lydianpay/sdk-web 3.15.0 → 3.15.2

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,8 +1,9 @@
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;
5
5
  params: unknown;
6
+ broadcast?: (signed: unknown) => Promise<void>;
6
7
  };
7
8
  export type BuildTransferRequestArgs = {
8
9
  asset: DisplayAsset;
@@ -10,16 +11,23 @@ export type BuildTransferRequestArgs = {
10
11
  from: string;
11
12
  amount: string;
12
13
  tokenContract?: string;
14
+ backendTransfer?: () => Promise<BuildTransferResponse>;
15
+ approvedMethods?: readonly string[];
16
+ broadcastTransfer?: (signed: {
17
+ unsignedTransfer: string;
18
+ signature: string;
19
+ }) => Promise<unknown>;
13
20
  };
14
21
  export type BuildBalanceRequestArgs = {
15
22
  account: string;
16
23
  tokenContract?: string;
17
24
  };
18
25
  export interface ChainAdapter {
19
- buildTransferRequest(args: BuildTransferRequestArgs): WalletRequest | null;
26
+ buildTransferRequest(args: BuildTransferRequestArgs): Promise<WalletRequest | null>;
20
27
  buildBalanceRequest(args: BuildBalanceRequestArgs): WalletRequest | null;
21
28
  /** Base units from a balance result, or null when unreadable. */
22
29
  parseBalanceResult(result: unknown): bigint | null;
23
30
  }
24
31
  export declare const evmChainAdapter: ChainAdapter;
32
+ export declare const solanaChainAdapter: ChainAdapter;
25
33
  export declare function getChainAdapter(namespace: CheckoutNamespace): ChainAdapter | undefined;
@@ -1,8 +1,10 @@
1
1
  import { Base } from '../base.js';
2
- import { CancelTransactionRequest, CreatePaymentRequest, CreateTransactionResponse, GetTransactionResponse, KYCVerificationRequest } from '../../types';
2
+ import { BroadcastTransferRequest, BroadcastTransferResponse, 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>;
7
+ broadcastTransfer(transactionID: string, paymentRequestID: string, request: BroadcastTransferRequest): Promise<BroadcastTransferResponse>;
6
8
  cancelCryptoTransaction(transactionID: string, cancelTransaction: CancelTransactionRequest): Promise<CreateTransactionResponse>;
7
9
  kycVerification(transactionID: string, kycVerificationRequest: KYCVerificationRequest): Promise<CreateTransactionResponse>;
8
10
  }
@@ -215,6 +215,21 @@ 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
+ };
225
+ export type BroadcastTransferRequest = {
226
+ fromAddress: string;
227
+ unsignedTransfer: string;
228
+ signature: string;
229
+ };
230
+ export type BroadcastTransferResponse = {
231
+ txHash: string;
232
+ };
218
233
  export type KYCVerificationRequest = {
219
234
  asset: string;
220
235
  network: string;
@@ -28,10 +28,9 @@ 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;
36
35
  walletOwnsCheckout(): boolean;
37
36
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.15.0",
3
+ "version": "3.15.2",
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.10.0",
91
+ "@lydianpay/lydianconnect": "^1.10.2",
92
92
  "@lydianpay/lydianconnect-catalog": "^1.4.1",
93
93
  "@solana/qr-code-styling": "^1.6.0",
94
94
  "dompurify": "^3.4.12",