@lydianpay/sdk-web 3.4.0 → 3.6.0

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,18 +1,25 @@
1
1
  import { DisplayAsset } from '../types';
2
2
  import { CheckoutNamespace } from '../constants';
3
- export type BuiltSend = {
3
+ export type WalletRequest = {
4
4
  method: string;
5
5
  params: unknown;
6
6
  };
7
- export type BuildSendArgs = {
7
+ export type BuildTransferRequestArgs = {
8
8
  asset: DisplayAsset;
9
9
  to: string;
10
10
  from: string;
11
11
  amount: string;
12
12
  tokenContract?: string;
13
13
  };
14
+ export type BuildBalanceRequestArgs = {
15
+ account: string;
16
+ tokenContract?: string;
17
+ };
14
18
  export interface ChainAdapter {
15
- buildSend(args: BuildSendArgs): BuiltSend | null;
19
+ buildTransferRequest(args: BuildTransferRequestArgs): WalletRequest | null;
20
+ buildBalanceRequest(args: BuildBalanceRequestArgs): WalletRequest | null;
21
+ /** Base units from a balance result, or null when unreadable. */
22
+ parseBalanceResult(result: unknown): bigint | null;
16
23
  }
17
- export declare const evmAdapter: ChainAdapter;
18
- export declare function adapterFor(namespace: CheckoutNamespace): ChainAdapter | undefined;
24
+ export declare const evmChainAdapter: ChainAdapter;
25
+ export declare function getChainAdapter(namespace: CheckoutNamespace): ChainAdapter | undefined;
@@ -0,0 +1,23 @@
1
+ import { type WalletRequest } from './adapters';
2
+ export type BalanceRequest = {
3
+ assetCode: string;
4
+ request: WalletRequest;
5
+ };
6
+ export type AssetAffordability = 'unknown' | 'zero' | 'insufficient' | 'sufficient';
7
+ export declare function buildBalanceRequests({ networkCode, account, assetCodes, }: {
8
+ networkCode: string;
9
+ account: string;
10
+ assetCodes: string[];
11
+ }): BalanceRequest[];
12
+ export declare function readAssetBalances({ request, networkCode, account, assetCodes, timeoutMs, }: {
13
+ request: (args: WalletRequest) => Promise<unknown>;
14
+ networkCode: string;
15
+ account: string;
16
+ assetCodes: string[];
17
+ timeoutMs?: number;
18
+ }): Promise<Record<string, bigint>>;
19
+ export declare function classifyAssetAffordability({ balance, estimate, decimals, }: {
20
+ balance: bigint | undefined;
21
+ estimate: number | null;
22
+ decimals: number;
23
+ }): AssetAffordability;
@@ -1,4 +1,4 @@
1
- import { type Connection } from '@lydianpay/lydianconnect';
1
+ import { type ConnectInput, type Connection } from '@lydianpay/lydianconnect';
2
2
  export type WalletEventHandlers = {
3
3
  onDisplayUri?: (uri: string, deepLink: boolean) => void;
4
4
  onDisconnect?: (walletId: string) => void;
@@ -15,10 +15,10 @@ export declare class LydianConnectService {
15
15
  private handlers;
16
16
  init(walletConnectProjectId: string, handlers: WalletEventHandlers): Promise<void>;
17
17
  private dispatch;
18
- connect(walletId: string, chainId: string, signal?: AbortSignal): Promise<Connection>;
18
+ connect(input: ConnectInput): Promise<Connection>;
19
19
  openWallet(walletId: string, uri?: string, via?: 'scheme' | 'universal'): boolean;
20
20
  disconnect(walletId?: string): Promise<void>;
21
21
  reset(): Promise<void>;
22
22
  destroy(): void;
23
23
  }
24
- export type { Connection };
24
+ export type { ConnectInput, Connection };
@@ -0,0 +1,2 @@
1
+ export declare const appStoreBadgeSvg = "<svg aria-hidden=\"true\" focusable=\"false\" version=\"1.1\" id=\"US_UK_Download_on_the\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n\t x=\"0px\" y=\"0px\" width=\"135px\" height=\"40px\" viewBox=\"0 0 135 40\" enable-background=\"new 0 0 135 40\" xml:space=\"preserve\">\n<g>\n\t<path fill=\"#A6A6A6\" d=\"M130.197,40H4.729C2.122,40,0,37.872,0,35.267V4.726C0,2.12,2.122,0,4.729,0h125.468\n\t\tC132.803,0,135,2.12,135,4.726v30.541C135,37.872,132.803,40,130.197,40L130.197,40z\"/>\n\t<path d=\"M134.032,35.268c0,2.116-1.714,3.83-3.834,3.83H4.729c-2.119,0-3.839-1.714-3.839-3.83V4.725\n\t\tc0-2.115,1.72-3.835,3.839-3.835h125.468c2.121,0,3.834,1.72,3.834,3.835L134.032,35.268L134.032,35.268z\"/>\n\t<g>\n\t\t<g>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M30.128,19.784c-0.029-3.223,2.639-4.791,2.761-4.864c-1.511-2.203-3.853-2.504-4.676-2.528\n\t\t\t\tc-1.967-0.207-3.875,1.177-4.877,1.177c-1.022,0-2.565-1.157-4.228-1.123c-2.14,0.033-4.142,1.272-5.24,3.196\n\t\t\t\tc-2.266,3.923-0.576,9.688,1.595,12.859c1.086,1.553,2.355,3.287,4.016,3.226c1.625-0.067,2.232-1.036,4.193-1.036\n\t\t\t\tc1.943,0,2.513,1.036,4.207,0.997c1.744-0.028,2.842-1.56,3.89-3.127c1.255-1.78,1.759-3.533,1.779-3.623\n\t\t\t\tC33.507,24.924,30.161,23.647,30.128,19.784z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M26.928,10.306c0.874-1.093,1.472-2.58,1.306-4.089c-1.265,0.056-2.847,0.875-3.758,1.944\n\t\t\t\tc-0.806,0.942-1.526,2.486-1.34,3.938C24.557,12.205,26.016,11.382,26.928,10.306z\"/>\n\t\t</g>\n\t</g>\n\t<g>\n\t\t<path fill=\"#FFFFFF\" d=\"M53.645,31.504h-2.271l-1.244-3.909h-4.324l-1.185,3.909h-2.211l4.284-13.308h2.646L53.645,31.504z\n\t\t\t M49.755,25.955L48.63,22.48c-0.119-0.355-0.342-1.191-0.671-2.507h-0.04c-0.131,0.566-0.342,1.402-0.632,2.507l-1.105,3.475\n\t\t\tH49.755z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M64.662,26.588c0,1.632-0.441,2.922-1.323,3.869c-0.79,0.843-1.771,1.264-2.942,1.264\n\t\t\tc-1.264,0-2.172-0.454-2.725-1.362h-0.04v5.055h-2.132V25.067c0-1.026-0.027-2.079-0.079-3.159h1.875l0.119,1.521h0.04\n\t\t\tc0.711-1.146,1.79-1.718,3.238-1.718c1.132,0,2.077,0.447,2.833,1.342C64.284,23.949,64.662,25.127,64.662,26.588z M62.49,26.666\n\t\t\tc0-0.934-0.21-1.704-0.632-2.31c-0.461-0.632-1.08-0.948-1.856-0.948c-0.526,0-1.004,0.176-1.431,0.523\n\t\t\tc-0.428,0.35-0.708,0.807-0.839,1.373c-0.066,0.264-0.099,0.48-0.099,0.65v1.6c0,0.698,0.214,1.287,0.642,1.768\n\t\t\ts0.984,0.721,1.668,0.721c0.803,0,1.428-0.31,1.875-0.928C62.266,28.496,62.49,27.68,62.49,26.666z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M75.699,26.588c0,1.632-0.441,2.922-1.324,3.869c-0.789,0.843-1.77,1.264-2.941,1.264\n\t\t\tc-1.264,0-2.172-0.454-2.724-1.362H68.67v5.055h-2.132V25.067c0-1.026-0.027-2.079-0.079-3.159h1.875l0.119,1.521h0.04\n\t\t\tc0.71-1.146,1.789-1.718,3.238-1.718c1.131,0,2.076,0.447,2.834,1.342C75.32,23.949,75.699,25.127,75.699,26.588z M73.527,26.666\n\t\t\tc0-0.934-0.211-1.704-0.633-2.31c-0.461-0.632-1.078-0.948-1.855-0.948c-0.527,0-1.004,0.176-1.432,0.523\n\t\t\tc-0.428,0.35-0.707,0.807-0.838,1.373c-0.065,0.264-0.099,0.48-0.099,0.65v1.6c0,0.698,0.214,1.287,0.64,1.768\n\t\t\tc0.428,0.48,0.984,0.721,1.67,0.721c0.803,0,1.428-0.31,1.875-0.928C73.303,28.496,73.527,27.68,73.527,26.666z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M88.039,27.772c0,1.132-0.393,2.053-1.182,2.764c-0.867,0.777-2.074,1.165-3.625,1.165\n\t\t\tc-1.432,0-2.58-0.276-3.449-0.829l0.494-1.777c0.936,0.566,1.963,0.85,3.082,0.85c0.803,0,1.428-0.182,1.877-0.544\n\t\t\tc0.447-0.362,0.67-0.848,0.67-1.454c0-0.54-0.184-0.995-0.553-1.364c-0.367-0.369-0.98-0.712-1.836-1.029\n\t\t\tc-2.33-0.869-3.494-2.142-3.494-3.816c0-1.094,0.408-1.991,1.225-2.689c0.814-0.699,1.9-1.048,3.258-1.048\n\t\t\tc1.211,0,2.217,0.211,3.02,0.632l-0.533,1.738c-0.75-0.408-1.598-0.612-2.547-0.612c-0.75,0-1.336,0.185-1.756,0.553\n\t\t\tc-0.355,0.329-0.533,0.73-0.533,1.205c0,0.526,0.203,0.961,0.611,1.303c0.355,0.316,1,0.658,1.936,1.027\n\t\t\tc1.145,0.461,1.986,1,2.527,1.618C87.77,26.081,88.039,26.852,88.039,27.772z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M95.088,23.508h-2.35v4.659c0,1.185,0.414,1.777,1.244,1.777c0.381,0,0.697-0.033,0.947-0.099l0.059,1.619\n\t\t\tc-0.42,0.157-0.973,0.236-1.658,0.236c-0.842,0-1.5-0.257-1.975-0.77c-0.473-0.514-0.711-1.376-0.711-2.587v-4.837h-1.4v-1.6h1.4\n\t\t\tv-1.757l2.094-0.632v2.389h2.35V23.508z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M105.691,26.627c0,1.475-0.422,2.686-1.264,3.633c-0.883,0.975-2.055,1.461-3.516,1.461\n\t\t\tc-1.408,0-2.529-0.467-3.365-1.401s-1.254-2.113-1.254-3.534c0-1.487,0.43-2.705,1.293-3.652c0.861-0.948,2.023-1.422,3.484-1.422\n\t\t\tc1.408,0,2.541,0.467,3.396,1.402C105.283,24.021,105.691,25.192,105.691,26.627z M103.479,26.696\n\t\t\tc0-0.885-0.189-1.644-0.572-2.277c-0.447-0.766-1.086-1.148-1.914-1.148c-0.857,0-1.508,0.383-1.955,1.148\n\t\t\tc-0.383,0.634-0.572,1.405-0.572,2.317c0,0.885,0.189,1.644,0.572,2.276c0.461,0.766,1.105,1.148,1.936,1.148\n\t\t\tc0.814,0,1.453-0.39,1.914-1.168C103.281,28.347,103.479,27.58,103.479,26.696z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M112.621,23.783c-0.211-0.039-0.436-0.059-0.672-0.059c-0.75,0-1.33,0.283-1.738,0.85\n\t\t\tc-0.355,0.5-0.533,1.132-0.533,1.895v5.035h-2.131l0.02-6.574c0-1.106-0.027-2.113-0.08-3.021h1.857l0.078,1.836h0.059\n\t\t\tc0.225-0.631,0.58-1.139,1.066-1.52c0.475-0.343,0.988-0.514,1.541-0.514c0.197,0,0.375,0.014,0.533,0.039V23.783z\"/>\n\t\t<path fill=\"#FFFFFF\" d=\"M122.156,26.252c0,0.382-0.025,0.704-0.078,0.967h-6.396c0.025,0.948,0.334,1.673,0.928,2.173\n\t\t\tc0.539,0.447,1.236,0.671,2.092,0.671c0.947,0,1.811-0.151,2.588-0.454l0.334,1.48c-0.908,0.396-1.98,0.593-3.217,0.593\n\t\t\tc-1.488,0-2.656-0.438-3.506-1.313c-0.848-0.875-1.273-2.05-1.273-3.524c0-1.447,0.395-2.652,1.186-3.613\n\t\t\tc0.828-1.026,1.947-1.539,3.355-1.539c1.383,0,2.43,0.513,3.141,1.539C121.873,24.047,122.156,25.055,122.156,26.252z\n\t\t\t M120.123,25.699c0.014-0.632-0.125-1.178-0.414-1.639c-0.369-0.593-0.936-0.889-1.699-0.889c-0.697,0-1.264,0.289-1.697,0.869\n\t\t\tc-0.355,0.461-0.566,1.014-0.631,1.658H120.123z\"/>\n\t</g>\n\t<g>\n\t\t<g>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M49.05,10.009c0,1.177-0.353,2.063-1.058,2.658c-0.653,0.549-1.581,0.824-2.783,0.824\n\t\t\t\tc-0.596,0-1.106-0.026-1.533-0.078V6.982c0.557-0.09,1.157-0.136,1.805-0.136c1.145,0,2.008,0.249,2.59,0.747\n\t\t\t\tC48.723,8.156,49.05,8.961,49.05,10.009z M47.945,10.038c0-0.763-0.202-1.348-0.606-1.756c-0.404-0.407-0.994-0.611-1.771-0.611\n\t\t\t\tc-0.33,0-0.611,0.022-0.844,0.068v4.889c0.129,0.02,0.365,0.029,0.708,0.029c0.802,0,1.421-0.223,1.857-0.669\n\t\t\t\tS47.945,10.892,47.945,10.038z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M54.909,11.037c0,0.725-0.207,1.319-0.621,1.785c-0.434,0.479-1.009,0.718-1.727,0.718\n\t\t\t\tc-0.692,0-1.243-0.229-1.654-0.689c-0.41-0.459-0.615-1.038-0.615-1.736c0-0.73,0.211-1.329,0.635-1.794s0.994-0.698,1.712-0.698\n\t\t\t\tc0.692,0,1.248,0.229,1.669,0.688C54.708,9.757,54.909,10.333,54.909,11.037z M53.822,11.071c0-0.435-0.094-0.808-0.281-1.119\n\t\t\t\tc-0.22-0.376-0.533-0.564-0.94-0.564c-0.421,0-0.741,0.188-0.961,0.564c-0.188,0.311-0.281,0.69-0.281,1.138\n\t\t\t\tc0,0.435,0.094,0.808,0.281,1.119c0.227,0.376,0.543,0.564,0.951,0.564c0.4,0,0.714-0.191,0.94-0.574\n\t\t\t\tC53.725,11.882,53.822,11.506,53.822,11.071z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M62.765,8.719l-1.475,4.714h-0.96l-0.611-2.047c-0.155-0.511-0.281-1.019-0.379-1.523h-0.019\n\t\t\t\tc-0.091,0.518-0.217,1.025-0.379,1.523l-0.649,2.047h-0.971l-1.387-4.714h1.077l0.533,2.241c0.129,0.53,0.235,1.035,0.32,1.513\n\t\t\t\th0.019c0.078-0.394,0.207-0.896,0.389-1.503l0.669-2.25h0.854l0.641,2.202c0.155,0.537,0.281,1.054,0.378,1.552h0.029\n\t\t\t\tc0.071-0.485,0.178-1.002,0.32-1.552l0.572-2.202H62.765z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M68.198,13.433H67.15v-2.7c0-0.832-0.316-1.248-0.95-1.248c-0.311,0-0.562,0.114-0.757,0.343\n\t\t\t\tc-0.193,0.229-0.291,0.499-0.291,0.808v2.796h-1.048v-3.366c0-0.414-0.013-0.863-0.038-1.349h0.921l0.049,0.737h0.029\n\t\t\t\tc0.122-0.229,0.304-0.418,0.543-0.569c0.284-0.176,0.602-0.265,0.95-0.265c0.44,0,0.806,0.142,1.097,0.427\n\t\t\t\tc0.362,0.349,0.543,0.87,0.543,1.562V13.433z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M71.088,13.433h-1.047V6.556h1.047V13.433z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M77.258,11.037c0,0.725-0.207,1.319-0.621,1.785c-0.434,0.479-1.01,0.718-1.727,0.718\n\t\t\t\tc-0.693,0-1.244-0.229-1.654-0.689c-0.41-0.459-0.615-1.038-0.615-1.736c0-0.73,0.211-1.329,0.635-1.794s0.994-0.698,1.711-0.698\n\t\t\t\tc0.693,0,1.248,0.229,1.67,0.688C77.057,9.757,77.258,10.333,77.258,11.037z M76.17,11.071c0-0.435-0.094-0.808-0.281-1.119\n\t\t\t\tc-0.219-0.376-0.533-0.564-0.939-0.564c-0.422,0-0.742,0.188-0.961,0.564c-0.188,0.311-0.281,0.69-0.281,1.138\n\t\t\t\tc0,0.435,0.094,0.808,0.281,1.119c0.227,0.376,0.543,0.564,0.951,0.564c0.4,0,0.713-0.191,0.939-0.574\n\t\t\t\tC76.074,11.882,76.17,11.506,76.17,11.071z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M82.33,13.433h-0.941l-0.078-0.543h-0.029c-0.322,0.433-0.781,0.65-1.377,0.65\n\t\t\t\tc-0.445,0-0.805-0.143-1.076-0.427c-0.246-0.258-0.369-0.579-0.369-0.96c0-0.576,0.24-1.015,0.723-1.319\n\t\t\t\tc0.482-0.304,1.16-0.453,2.033-0.446V10.3c0-0.621-0.326-0.931-0.979-0.931c-0.465,0-0.875,0.117-1.229,0.349l-0.213-0.688\n\t\t\t\tc0.438-0.271,0.979-0.407,1.617-0.407c1.232,0,1.85,0.65,1.85,1.95v1.736C82.262,12.78,82.285,13.155,82.33,13.433z\n\t\t\t\t M81.242,11.813v-0.727c-1.156-0.02-1.734,0.297-1.734,0.95c0,0.246,0.066,0.43,0.201,0.553c0.135,0.123,0.307,0.184,0.512,0.184\n\t\t\t\tc0.23,0,0.445-0.073,0.641-0.218c0.197-0.146,0.318-0.331,0.363-0.558C81.236,11.946,81.242,11.884,81.242,11.813z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M88.285,13.433h-0.93l-0.049-0.757h-0.029c-0.297,0.576-0.803,0.864-1.514,0.864\n\t\t\t\tc-0.568,0-1.041-0.223-1.416-0.669s-0.562-1.025-0.562-1.736c0-0.763,0.203-1.381,0.611-1.853c0.395-0.44,0.879-0.66,1.455-0.66\n\t\t\t\tc0.633,0,1.076,0.213,1.328,0.64h0.02V6.556h1.049v5.607C88.248,12.622,88.26,13.045,88.285,13.433z M87.199,11.445v-0.786\n\t\t\t\tc0-0.136-0.01-0.246-0.029-0.33c-0.059-0.252-0.186-0.464-0.379-0.635c-0.195-0.171-0.43-0.257-0.701-0.257\n\t\t\t\tc-0.391,0-0.697,0.155-0.922,0.466c-0.223,0.311-0.336,0.708-0.336,1.193c0,0.466,0.107,0.844,0.322,1.135\n\t\t\t\tc0.227,0.31,0.533,0.465,0.916,0.465c0.344,0,0.619-0.129,0.828-0.388C87.1,12.069,87.199,11.781,87.199,11.445z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M97.248,11.037c0,0.725-0.207,1.319-0.621,1.785c-0.434,0.479-1.008,0.718-1.727,0.718\n\t\t\t\tc-0.691,0-1.242-0.229-1.654-0.689c-0.41-0.459-0.615-1.038-0.615-1.736c0-0.73,0.211-1.329,0.635-1.794s0.994-0.698,1.713-0.698\n\t\t\t\tc0.691,0,1.248,0.229,1.668,0.688C97.047,9.757,97.248,10.333,97.248,11.037z M96.162,11.071c0-0.435-0.094-0.808-0.281-1.119\n\t\t\t\tc-0.221-0.376-0.533-0.564-0.941-0.564c-0.42,0-0.74,0.188-0.961,0.564c-0.188,0.311-0.281,0.69-0.281,1.138\n\t\t\t\tc0,0.435,0.094,0.808,0.281,1.119c0.227,0.376,0.543,0.564,0.951,0.564c0.4,0,0.715-0.191,0.941-0.574\n\t\t\t\tC96.064,11.882,96.162,11.506,96.162,11.071z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M102.883,13.433h-1.047v-2.7c0-0.832-0.316-1.248-0.951-1.248c-0.311,0-0.562,0.114-0.756,0.343\n\t\t\t\ts-0.291,0.499-0.291,0.808v2.796h-1.049v-3.366c0-0.414-0.012-0.863-0.037-1.349h0.92l0.049,0.737h0.029\n\t\t\t\tc0.123-0.229,0.305-0.418,0.543-0.569c0.285-0.176,0.602-0.265,0.951-0.265c0.439,0,0.805,0.142,1.096,0.427\n\t\t\t\tc0.363,0.349,0.543,0.87,0.543,1.562V13.433z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M109.936,9.504h-1.154v2.29c0,0.582,0.205,0.873,0.611,0.873c0.188,0,0.344-0.016,0.467-0.049\n\t\t\t\tl0.027,0.795c-0.207,0.078-0.479,0.117-0.814,0.117c-0.414,0-0.736-0.126-0.969-0.378c-0.234-0.252-0.35-0.676-0.35-1.271V9.504\n\t\t\t\th-0.689V8.719h0.689V7.855l1.027-0.31v1.173h1.154V9.504z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M115.484,13.433h-1.049v-2.68c0-0.845-0.316-1.268-0.949-1.268c-0.486,0-0.818,0.245-1,0.735\n\t\t\t\tc-0.031,0.103-0.049,0.229-0.049,0.377v2.835h-1.047V6.556h1.047v2.841h0.02c0.33-0.517,0.803-0.775,1.416-0.775\n\t\t\t\tc0.434,0,0.793,0.142,1.078,0.427c0.355,0.355,0.533,0.883,0.533,1.581V13.433z\"/>\n\t\t\t<path fill=\"#FFFFFF\" d=\"M121.207,10.853c0,0.188-0.014,0.346-0.039,0.475h-3.143c0.014,0.466,0.164,0.821,0.455,1.067\n\t\t\t\tc0.266,0.22,0.609,0.33,1.029,0.33c0.465,0,0.889-0.074,1.271-0.223l0.164,0.728c-0.447,0.194-0.973,0.291-1.582,0.291\n\t\t\t\tc-0.73,0-1.305-0.215-1.721-0.645c-0.418-0.43-0.625-1.007-0.625-1.731c0-0.711,0.193-1.303,0.582-1.775\n\t\t\t\tc0.406-0.504,0.955-0.756,1.648-0.756c0.678,0,1.193,0.252,1.541,0.756C121.068,9.77,121.207,10.265,121.207,10.853z\n\t\t\t\t M120.207,10.582c0.008-0.311-0.061-0.579-0.203-0.805c-0.182-0.291-0.459-0.437-0.834-0.437c-0.342,0-0.621,0.142-0.834,0.427\n\t\t\t\tc-0.174,0.227-0.277,0.498-0.311,0.815H120.207z\"/>\n\t\t</g>\n\t</g>\n</g>\n</svg>";
2
+ export declare const googlePlayBadgeSvg = "<svg aria-hidden=\"true\" focusable=\"false\" id=\"svg51\" width=\"180\" height=\"53.333\" version=\"1.1\" viewBox=\"0 0 180 53.333\" xml:space=\"preserve\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><path id=\"path11\" d=\"m173.33 53.333h-166.66c-3.6666 0-6.6665-2.9999-6.6665-6.6665v-39.999c0-3.6666 2.9999-6.6665 6.6665-6.6665h166.66c3.6666 0 6.6665 2.9999 6.6665 6.6665v39.999c0 3.6666-2.9999 6.6665-6.6665 6.6665\" fill=\"#100f0d\" stroke-width=\".13333\"/><path id=\"path13\" d=\"m173.33 1e-3h-166.66c-3.6666 0-6.6665 2.9999-6.6665 6.6665v39.999c0 3.6666 2.9999 6.6665 6.6665 6.6665h166.66c3.6666 0 6.6665-2.9999 6.6665-6.6665v-39.999c0-3.6666-2.9999-6.6665-6.6665-6.6665zm0 1.0661c3.0879 0 5.5999 2.5125 5.5999 5.6004v39.999c0 3.0879-2.5119 5.6004-5.5999 5.6004h-166.66c-3.0879 0-5.5993-2.5125-5.5993-5.6004v-39.999c0-3.0879 2.5114-5.6004 5.5993-5.6004h166.66\" fill=\"#a2a2a1\" stroke-width=\".13333\"/><path id=\"path35\" d=\"m142.58 40h2.4879v-16.669h-2.4879zm22.409-10.664-2.8519 7.2264h-0.0853l-2.9599-7.2264h-2.6799l4.4399 10.1-2.5319 5.6185h2.5946l6.8412-15.718zm-14.11 8.7706c-0.81331 0-1.9506-0.40786-1.9506-1.4156 0-1.2865 1.416-1.7797 2.6373-1.7797 1.0933 0 1.6093 0.23546 2.2733 0.55732-0.19333 1.5442-1.5226 2.6379-2.9599 2.6379zm0.30133-9.1352c-1.8013 0-3.6666 0.79371-4.4386 2.5521l2.208 0.92184c0.47198-0.92184 1.3506-1.2218 2.2733-1.2218 1.2866 0 2.5946 0.77131 2.6159 2.1442v0.17133c-0.45066-0.25733-1.416-0.64318-2.5946-0.64318-2.3813 0-4.8039 1.3077-4.8039 3.7524 0 2.2302 1.952 3.6671 4.1386 3.6671 1.672 0 2.5959-0.75054 3.1732-1.6301h0.0867v1.2874h2.4026v-6.391c0-2.9593-2.2106-4.6103-5.0612-4.6103zm-15.376 2.3937h-3.5386v-5.7133h3.5386c1.86 0 2.9159 1.5396 2.9159 2.8566 0 1.2917-1.056 2.8567-2.9159 2.8567zm-0.064-8.0337h-5.9614v16.669h2.4869v-6.3149h3.4746c2.7573 0 5.4679-1.9958 5.4679-5.1765 0-3.1801-2.7106-5.1769-5.4679-5.1769zm-32.507 14.778c-1.7188 0-3.1573-1.4396-3.1573-3.415 0-1.9984 1.4385-3.4583 3.1573-3.4583 1.6969 0 3.0286 1.46 3.0286 3.4583 0 1.9754-1.3317 3.415-3.0286 3.415zm2.8567-7.8403h-0.086c-0.55826-0.66572-1.6328-1.2672-2.9853-1.2672-2.8359 0-5.4348 2.4921-5.4348 5.6925 0 3.1786 2.5989 5.6488 5.4348 5.6488 1.3525 0 2.427-0.6016 2.9853-1.2885h0.086v0.81558c0 2.1703-1.1598 3.3296-3.0286 3.3296-1.5245 0-2.4697-1.0953-2.8567-2.0188l-2.1691 0.90206c0.62238 1.503 2.2759 3.351 5.0259 3.351 2.9218 0 5.392-1.7188 5.392-5.9077v-10.181h-2.3634zm4.0822 9.7304h2.4906v-16.669h-2.4906zm6.164-5.4988c-0.0641-2.1911 1.6978-3.3078 2.9645-3.3078 0.98851 0 1.8254 0.49425 2.1057 1.2026zm7.7326-1.8906c-0.47238-1.2666-1.9114-3.6082-4.8541-3.6082-2.9218 0-5.3488 2.2983-5.3488 5.6707 0 3.1791 2.4062 5.6707 5.6275 5.6707 2.5989 0 4.1031-1.589 4.7264-2.513l-1.9333-1.289c-0.64465 0.94531-1.5249 1.5682-2.7931 1.5682-1.2666 0-2.1692-0.58012-2.7483-1.7186l7.5815-3.1359zm-60.409-1.8682v2.4057h5.7565c-0.17186 1.3532-0.62292 2.3411-1.3104 3.0286-0.83798 0.83745-2.1483 1.7614-4.4462 1.7614-3.5443 0-6.315-2.8567-6.315-6.4009s2.7707-6.4013 6.315-6.4013c1.9118 0 3.3077 0.75198 4.3388 1.7186l1.6974-1.6973c-1.4396-1.3745-3.351-2.427-6.0362-2.427-4.8552 0-8.9363 3.9524-8.9363 8.807 0 4.8541 4.0811 8.8066 8.9363 8.8066 2.6202 0 4.5967-0.85932 6.143-2.4702 1.5896-1.5896 2.0838-3.8234 2.0838-5.628 0-0.55785-0.04333-1.0734-0.1292-1.5032zm14.772 7.3675c-1.7188 0-3.201-1.4177-3.201-3.4368 0-2.0406 1.4822-3.4364 3.201-3.4364 1.7181 0 3.2003 1.3958 3.2003 3.4364 0 2.0191-1.4822 3.4368-3.2003 3.4368zm0-9.1075c-3.137 0-5.6927 2.3842-5.6927 5.6707 0 3.265 2.5557 5.6707 5.6927 5.6707 3.1358 0 5.692-2.4057 5.692-5.6707 0-3.2865-2.5562-5.6707-5.692-5.6707zm12.417 9.1075c-1.7176 0-3.2003-1.4177-3.2003-3.4368 0-2.0406 1.4828-3.4364 3.2003-3.4364 1.7188 0 3.2005 1.3958 3.2005 3.4364 0 2.0191-1.4817 3.4368-3.2005 3.4368zm0-9.1075c-3.1358 0-5.6915 2.3842-5.6915 5.6707 0 3.265 2.5557 5.6707 5.6915 5.6707 3.137 0 5.6927-2.4057 5.6927-5.6707 0-3.2865-2.5557-5.6707-5.6927-5.6707\" fill=\"#fff\" stroke-width=\".13333\"/><path id=\"path37\" d=\"m27.622 25.899-14.194 15.066c5.34e-4 0.0031 0.0016 0.0057 0.0021 0.0089 0.43532 1.636 1.9296 2.8406 3.703 2.8406 0.70892 0 1.3745-0.19166 1.9453-0.52812l0.04533-0.02656 15.978-9.22-7.479-8.141\" fill=\"#eb3131\" stroke-width=\".13333\"/><path id=\"path39\" d=\"m41.983 23.334-0.0136-0.0093-6.8982-3.999-7.7717 6.9156 7.7987 7.7977 6.8618-3.9592c1.203-0.64945 2.0197-1.9177 2.0197-3.3802 0-1.452-0.80571-2.7139-1.9968-3.3655\" fill=\"#f6b60b\" stroke-width=\".13333\"/><path id=\"path41\" d=\"m13.426 12.37c-0.08533 0.31466-0.13018 0.64425-0.13018 0.98651v26.623c0 0.34162 0.04432 0.67233 0.13072 0.98587l14.684-14.681-14.684-13.914\" fill=\"#5778c5\" stroke-width=\".13333\"/><path id=\"path43\" d=\"m27.727 26.668 7.3473-7.3451-15.96-9.2534c-0.58012-0.34746-1.2572-0.54799-1.9817-0.54799-1.7734 0-3.2697 1.2068-3.7051 2.8447-5.34e-4 0.0016-5.34e-4 0.0027-5.34e-4 0.0041l14.3 14.298\" fill=\"#3bad49\" stroke-width=\".13333\"/><path id=\"path33\" d=\"m63.193 13.042h-3.8895v0.96251h2.9146c-0.0792 0.78545-0.39172 1.4021-0.91878 1.85-0.52705 0.44799-1.2 0.67292-1.9958 0.67292-0.87291 0-1.6125-0.30413-2.2186-0.90824-0.59385-0.61665-0.89584-1.3792-0.89584-2.2979 0-0.91864 0.30199-1.6812 0.89584-2.2978 0.60612-0.60412 1.3457-0.90624 2.2186-0.90624 0.44799 0 0.87504 0.07707 1.2666 0.24586 0.39172 0.16866 0.70625 0.40412 0.95211 0.70625l0.73958-0.73958c-0.33546-0.38132-0.76038-0.67292-1.2876-0.88544-0.52705-0.21253-1.077-0.31453-1.6708-0.31453-1.1645 0-2.1519 0.40412-2.9582 1.2104-0.80625 0.80825-1.2104 1.8041-1.2104 2.9811 0 1.177 0.40412 2.175 1.2104 2.9813 0.80625 0.80611 1.7937 1.2104 2.9582 1.2104 1.2229 0 2.1979-0.39172 2.9479-1.1876 0.66038-0.66238 0.99784-1.5582 0.99784-2.679 0-0.1896-0.02293-0.39172-0.05627-0.60425zm1.5068-3.7332v8.0249h4.6852v-0.98544h-3.654v-2.5457h3.2958v-0.96251h-3.2958v-2.5437h3.654v-0.98758zm11.255 0.98758v-0.98758h-5.5145v0.98758h2.2417v7.0373h1.0312v-7.0373zm4.9925-0.98758h-1.0312v8.0249h1.0312zm6.8066 0.98758v-0.98758h-5.5144v0.98758h2.2415v7.0373h1.0312v-7.0373zm10.406 0.05626c-0.79585-0.81877-1.7708-1.2229-2.9354-1.2229-1.1666 0-2.1415 0.40412-2.9374 1.2104-0.79585 0.79585-1.1874 1.7937-1.1874 2.9811s0.39159 2.1854 1.1874 2.9813c0.79585 0.80611 1.7708 1.2104 2.9374 1.2104 1.1541 0 2.1395-0.40426 2.9354-1.2104 0.79585-0.79585 1.1874-1.7938 1.1874-2.9813 0-1.177-0.39159-2.1729-1.1874-2.9686zm-5.1332 0.67078c0.59372-0.60412 1.3229-0.90624 2.1978-0.90624 0.87291 0 1.6021 0.30213 2.1854 0.90624 0.59372 0.59372 0.88531 1.3686 0.88531 2.2978 0 0.93131-0.29159 1.7041-0.88531 2.2979-0.58332 0.60412-1.3125 0.90824-2.1854 0.90824-0.87491 0-1.6041-0.30413-2.1978-0.90824-0.58132-0.60625-0.87291-1.3666-0.87291-2.2979 0-0.92918 0.29159-1.6916 0.87291-2.2978zm8.7706 1.3125-0.0437-1.548h0.0437l4.0791 6.5457h1.077v-8.0249h-1.0312v4.6957l0.0437 1.548h-0.0437l-3.8999-6.2437h-1.2562v8.0249h1.0312z\" fill=\"#fff\" stroke=\"#fff\" stroke-miterlimit=\"10\" stroke-width=\".26666\"/></svg>";
@@ -1,4 +1,5 @@
1
1
  import { AllowedWalletConfig, Asset, GetSessionResponse, SessionAllowedAsset } from '../types';
2
+ import { type AssetAffordability } from '../chains/balanceReads';
2
3
  export declare function resolveAllowedAssets(allowedAssets: SessionAllowedAsset[] | null | undefined): Asset[];
3
4
  export declare function collectNetworksFromAssets(allowedAssets: Asset[]): string[];
4
5
  export declare function hoistRecommendedNetwork({ networks, recommendedNetwork, }: {
@@ -7,6 +8,13 @@ export declare function hoistRecommendedNetwork({ networks, recommendedNetwork,
7
8
  }): string[];
8
9
  export declare function filterAssetsByNetwork(allowedAssets: Asset[], networkCode: string): Asset[];
9
10
  export declare function filterNetworksByAsset(allowedAssets: Asset[], assetCode: string): string[];
11
+ export declare function offeredAssetCodes(session: Pick<GetSessionResponse, 'allowedAssets'> | null | undefined, networkCode: string | null): string[];
12
+ export declare function getAssetAffordabilityByCode({ assetCodes, balances, session, network, }: {
13
+ assetCodes: string[];
14
+ balances: Record<string, bigint> | null;
15
+ session: Pick<GetSessionResponse, 'calculatedCryptoTotals' | 'calculatedCryptoTotalsPerNetwork'> | undefined;
16
+ network: string | null;
17
+ }): Map<string, AssetAffordability>;
10
18
  type NetworkFeeSource = Pick<GetSessionResponse, 'customFlatFeePerNetwork' | 'customFeePercentagePerNetwork'>;
11
19
  type CryptoTotalSource = Pick<GetSessionResponse, 'calculatedCryptoTotals' | 'calculatedCryptoTotalsPerNetwork'>;
12
20
  export declare function getNetworkFeeLabel(session: NetworkFeeSource | undefined, networkName: string): string | null;
@@ -21,6 +29,22 @@ export declare function filterNetworksByWalletSupport({ networkCodes, walletId,
21
29
  networkCodes: string[];
22
30
  isWalletSupportKnown: boolean;
23
31
  };
32
+ export declare function filterNetworksByApprovedChains({ networkCodes, approvedChains, }: {
33
+ networkCodes: string[];
34
+ approvedChains: readonly string[] | undefined;
35
+ }): string[];
36
+ export declare function intersectWalletNetworks({ networkCodes, walletId, approvedChains, }: {
37
+ networkCodes: string[];
38
+ walletId: string | null;
39
+ approvedChains: readonly string[] | undefined;
40
+ }): {
41
+ networkCodes: string[];
42
+ isWalletSupportKnown: boolean;
43
+ };
44
+ export declare function collectConnectableChainIds({ walletId, allowedAssets, }: {
45
+ walletId: string;
46
+ allowedAssets: SessionAllowedAsset[] | null | undefined;
47
+ }): string[];
24
48
  export declare function matchesExpectedChain(reported: string, expected: readonly string[]): boolean;
25
49
  export declare function shouldWarnWrongChain({ connected, reported, expected, }: {
26
50
  connected: boolean;
@@ -6,7 +6,7 @@ import type { ScreenNavigator } from './screenNavigator';
6
6
  import type { SessionLifecycle } from './sessionLifecycle';
7
7
  import type { SessionQuoteWatcher } from './sessionQuoteWatcher';
8
8
  import type { TransactionPoller } from './transactionPoller';
9
- import type { BuiltSend } from '../chains/adapters';
9
+ import type { WalletRequest } from '../chains/adapters';
10
10
  import type { CheckoutEventName, CheckoutInitOptions, GetTransactionResponse, PaymentFailureReason } from '../types';
11
11
  export interface PaymentFlow {
12
12
  begin(): Promise<void>;
@@ -28,9 +28,9 @@ export interface PaymentFlowSeams {
28
28
  transactionID?: string;
29
29
  }): void;
30
30
  showKycScreen(): void;
31
- buildConnectedWalletSend(): BuiltSend | null;
32
- signAndSubmit(built: BuiltSend): Promise<void>;
33
- setPendingWalletSend(built: BuiltSend | null): void;
31
+ buildConnectedWalletSend(): WalletRequest | null;
32
+ signAndSubmit(built: WalletRequest): Promise<void>;
33
+ setPendingWalletSend(built: WalletRequest | null): void;
34
34
  hasPendingWalletSend(): boolean;
35
35
  resetCheckout(): void;
36
36
  }
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ import type { GetSessionResponse } from '../../types';
3
+ export default function AssetSelectOption({ assetCode, session, priceNetwork, insufficient, onSelect, }: {
4
+ assetCode: string;
5
+ session: GetSessionResponse | undefined;
6
+ priceNetwork: string | null;
7
+ insufficient: boolean;
8
+ onSelect: (assetCode: string) => void;
9
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import type { MobilePlatform } from '../walletInstallLink';
3
+ export default function GetAppPromo({ platform }: {
4
+ platform: MobilePlatform | undefined;
5
+ }): React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export type OptionButtonVariant = 'network' | 'asset';
3
- export default function OptionButton({ id, imageUrl, imageAlt, label, secondaryLabel, secondaryValue, trailingNote, badgeLabel, variant, onClick, }: {
3
+ export default function OptionButton({ id, imageUrl, imageAlt, label, secondaryLabel, secondaryValue, trailingNote, badgeLabel, warningLabel, highlighted, variant, onClick, }: {
4
4
  id: string;
5
5
  imageUrl: string;
6
6
  imageAlt: string;
@@ -9,6 +9,8 @@ export default function OptionButton({ id, imageUrl, imageAlt, label, secondaryL
9
9
  secondaryValue?: string;
10
10
  trailingNote?: string;
11
11
  badgeLabel?: string;
12
+ warningLabel?: string;
13
+ highlighted?: boolean;
12
14
  variant?: OptionButtonVariant;
13
15
  onClick: () => void;
14
16
  }): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { ActiveScreen, CloseDialogVariant, KycDraft } from './checkoutStore';
1
+ import type { ActiveScreen, CloseDialogVariant, KycDraft, WalletBalances } from './checkoutStore';
2
2
  import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, WalletConnectWallet } from '../../types';
3
3
  import type { RestoreContext } from '../sessionHelpers';
4
4
  export type CheckoutAction = {
@@ -83,9 +83,17 @@ export type CheckoutAction = {
83
83
  } | {
84
84
  type: 'connect/openFailed';
85
85
  installHref: string | null;
86
+ } | {
87
+ type: 'connect/discoveryFailed';
86
88
  } | {
87
89
  type: 'connect/canSign';
88
90
  canSign: boolean;
91
+ } | {
92
+ type: 'connect/approvedChains';
93
+ approvedChains: readonly string[] | undefined;
94
+ } | {
95
+ type: 'connect/balances';
96
+ balances: WalletBalances | null;
89
97
  } | {
90
98
  type: 'kyc/show';
91
99
  } | {
@@ -45,8 +45,12 @@ export interface CheckoutState {
45
45
  countdownExpiry: number | null;
46
46
  underpaidTransaction: GetTransactionResponse | null;
47
47
  canSignWithConnectedWallet: boolean;
48
+ walletBalances: WalletBalances | null;
48
49
  connectOpenWalletVisible: boolean;
49
50
  connectOpenFailed: boolean;
51
+ didDiscoveryFail: boolean;
52
+ /** CAIP-2 chains granted by the wallet session; undefined means no grant is available. */
53
+ approvedChains: readonly string[] | undefined;
50
54
  connectPairingUri: string | null;
51
55
  connectInstallHref: string | null;
52
56
  termNoticeHtml: string;
@@ -70,6 +74,11 @@ export interface CheckoutState {
70
74
  restoreDialogSession: number;
71
75
  closeDialogVariant: CloseDialogVariant;
72
76
  }
77
+ export type WalletBalances = {
78
+ network: string;
79
+ account: string;
80
+ balances: Record<string, bigint>;
81
+ };
73
82
  export type KycTextFields = Omit<KycFieldValues, 'documentType' | 'hasDocumentFront' | 'hasDocumentBack'>;
74
83
  export interface KycDraft {
75
84
  text: KycTextFields;
@@ -96,7 +105,10 @@ export interface CheckoutCallbacks {
96
105
  onSelectAsset(assetCode: string): void;
97
106
  onSelectWallet(wallet: CheckoutWallet): void;
98
107
  onDoneSuccess(): void;
108
+ /** Cancels the active wallet connection attempt. */
99
109
  onCancelConnect(): void;
110
+ /** Retries discovery for the selected wallet. */
111
+ onRetryDiscovery(): void;
100
112
  onOpenWalletApp(): void;
101
113
  onOpenWalletUniversal(): void;
102
114
  onOpenInWallet(event: IslandClickEvent): void;
@@ -1,4 +1,4 @@
1
- import { type BuiltSend } from '../chains/adapters';
1
+ import { type WalletRequest } from '../chains/adapters';
2
2
  import { type CheckoutWallet } from '../constants';
3
3
  import { type CheckoutStore } from './react/checkoutStore';
4
4
  import type { CheckoutPresentation } from './checkoutPresentation';
@@ -12,16 +12,19 @@ export interface WalletConnection {
12
12
  choose(wallet: CheckoutWallet): void;
13
13
  /** Whether the picked wallet is one checkout can actually connect to. */
14
14
  hasConnectable(): boolean;
15
+ /** Establishes the wallet session used to filter supported networks. */
16
+ discoverSupportedNetworks(): Promise<void>;
17
+ /** Pins the wallet connection to the selected payment network. */
15
18
  connect(networkCode: string): Promise<void>;
16
19
  cancelConnect(): void;
17
20
  /** Null unless a connected wallet can sign for the live transaction. */
18
- buildSend(): BuiltSend | null;
21
+ buildSend(): WalletRequest | null;
19
22
  /** The send to sign — the one held for the confirmation screen, or a fresh build. */
20
- sendForSigning(): BuiltSend | null;
23
+ sendForSigning(): WalletRequest | null;
21
24
  /** Held while the customer looks at the confirmation screen. */
22
- setPendingSend(built: BuiltSend | null): void;
25
+ setPendingSend(built: WalletRequest | null): void;
23
26
  hasPendingSend(): boolean;
24
- signAndSubmit(built: BuiltSend): Promise<void>;
27
+ signAndSubmit(built: WalletRequest): Promise<void>;
25
28
  openWallet(link?: 'universal'): void;
26
29
  showConnectWithQr(): void;
27
30
  teardown(): void;
@@ -2,4 +2,6 @@ export type WalletStoreLinks = {
2
2
  ios?: string;
3
3
  android?: string;
4
4
  };
5
+ export type MobilePlatform = 'ios' | 'android';
6
+ export declare function detectMobilePlatform(userAgent?: string): MobilePlatform | undefined;
5
7
  export declare function resolveInstallHref(store?: WalletStoreLinks, userAgent?: string): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function isUserRejection(error: unknown): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
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": {
@@ -83,7 +83,7 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@lydianpay/frontend-shared-helpers": "1.1.0",
86
- "@lydianpay/lydianconnect": "^1.4.0",
86
+ "@lydianpay/lydianconnect": "^1.5.0",
87
87
  "@lydianpay/lydianconnect-catalog": "^1.3.1",
88
88
  "@solana/qr-code-styling": "^1.6.0",
89
89
  "dompurify": "^3.4.12",