@zkp2p/sdk 0.0.4 → 0.0.6

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 { AccessList, AuthorizationList, WalletClient, Hash, Address, PublicClient } from 'viem';
1
+ import { Address, Hex, AccessList, AuthorizationList, WalletClient, Hash, PublicClient } from 'viem';
2
2
  import { Abi } from 'abitype';
3
3
 
4
4
  /**
@@ -523,6 +523,38 @@ type FulfillmentAndPaymentResponse = {
523
523
  };
524
524
  declare function fetchFulfillmentAndPayment(client: IndexerClient, intentHash: string): Promise<FulfillmentAndPaymentResponse>;
525
525
 
526
+ /**
527
+ * A prepared transaction ready for submission.
528
+ * Contains all data needed to submit via wallet or relayer.
529
+ */
530
+ type PreparedTransaction = {
531
+ /** Target contract address */
532
+ to: Address;
533
+ /** Encoded calldata (includes ERC-8021 attribution) */
534
+ data: Hex;
535
+ /** ETH value to send (usually 0n for ZKP2P) */
536
+ value: bigint;
537
+ /** Chain ID for the transaction */
538
+ chainId: number;
539
+ };
540
+ /**
541
+ * A method that can be called directly or via .prepare()
542
+ *
543
+ * @example
544
+ * ```typescript
545
+ * // Execute directly (current behavior)
546
+ * const hash = await client.signalIntent(params);
547
+ *
548
+ * // Prepare for relayer submission
549
+ * const prepared = await client.signalIntent.prepare(params);
550
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
551
+ * ```
552
+ */
553
+ type PrepareableMethod<TParams, TResult> = {
554
+ (params: TParams): Promise<TResult>;
555
+ prepare(params: TParams): Promise<PreparedTransaction>;
556
+ };
557
+
526
558
  /**
527
559
  * Timeout configuration for different operation types
528
560
  */
@@ -1077,6 +1109,76 @@ type Zkp2pNextOptions = {
1077
1109
  api?: number;
1078
1110
  };
1079
1111
  };
1112
+ /**
1113
+ * Parameters for signalIntent method.
1114
+ * Used by both the direct call and .prepare() variants.
1115
+ */
1116
+ type SignalIntentMethodParams = {
1117
+ /** The deposit ID to use */
1118
+ depositId: bigint | string;
1119
+ /** Amount of tokens to claim (in token units) */
1120
+ amount: bigint | string;
1121
+ /** Address to receive the tokens when fulfilled */
1122
+ toAddress: Address;
1123
+ /** Payment platform name (e.g., 'wise', 'revolut') */
1124
+ processorName: string;
1125
+ /** Hashed payee details (from deposit) */
1126
+ payeeDetails: string;
1127
+ /** Fiat currency code (e.g., 'USD', 'EUR') */
1128
+ fiatCurrencyCode: string;
1129
+ /** Agreed conversion rate (18 decimals) */
1130
+ conversionRate: bigint | string;
1131
+ /** Optional referrer address for fee sharing */
1132
+ referrer?: Address;
1133
+ /** Optional referrer fee amount */
1134
+ referrerFee?: bigint | string;
1135
+ /** Optional hook contract to call after signaling */
1136
+ postIntentHook?: Address;
1137
+ /** Optional data to pass to the hook */
1138
+ data?: `0x${string}`;
1139
+ /** Pre-obtained signature (if not auto-fetching) */
1140
+ gatingServiceSignature?: `0x${string}`;
1141
+ /** Signature expiration timestamp */
1142
+ signatureExpiration?: bigint | string;
1143
+ /** Optional viem transaction overrides */
1144
+ txOverrides?: TxOverrides;
1145
+ };
1146
+ /**
1147
+ * Parameters for cancelIntent method.
1148
+ * Used by both the direct call and .prepare() variants.
1149
+ */
1150
+ type CancelIntentMethodParams = {
1151
+ /** The intent hash to cancel (0x-prefixed, 32 bytes) */
1152
+ intentHash: `0x${string}`;
1153
+ /** Optional viem transaction overrides */
1154
+ txOverrides?: TxOverrides;
1155
+ };
1156
+ /**
1157
+ * Parameters for fulfillIntent method.
1158
+ * Used by both the direct call and .prepare() variants.
1159
+ */
1160
+ type FulfillIntentMethodParams = {
1161
+ /** The intent hash to fulfill (0x-prefixed, 32 bytes) */
1162
+ intentHash: `0x${string}`;
1163
+ /** Payment proof from Reclaim (object or JSON string) */
1164
+ proof: Record<string, unknown> | string;
1165
+ /** Allowed timestamp variance in ms (default: 300000ms) */
1166
+ timestampBufferMs?: string;
1167
+ /** Override attestation service URL */
1168
+ attestationServiceUrl?: string;
1169
+ /** Override verifier contract address */
1170
+ verifyingContract?: Address;
1171
+ /** Data to pass to post-intent hook */
1172
+ postIntentHookData?: `0x${string}`;
1173
+ /** Optional viem transaction overrides */
1174
+ txOverrides?: TxOverrides;
1175
+ /** Lifecycle callbacks for UI updates */
1176
+ callbacks?: {
1177
+ onAttestationStart?: () => void;
1178
+ onTxSent?: (hash: Hash) => void;
1179
+ onTxMined?: (hash: Hash) => void;
1180
+ };
1181
+ };
1080
1182
  /**
1081
1183
  * SDK client for ZKP2P liquidity providers (offramp peers).
1082
1184
  *
@@ -1192,6 +1294,11 @@ declare class Zkp2pClient {
1192
1294
  * Referrer codes are stripped from overrides for simulation and appended to calldata.
1193
1295
  */
1194
1296
  private simulateAndSendWithAttribution;
1297
+ /**
1298
+ * Execute a prepared transaction (simulation + send).
1299
+ * Used internally by prepareable methods after preparation.
1300
+ */
1301
+ private executePreparedTransaction;
1195
1302
  /**
1196
1303
  * Fetches all deposits owned by the connected wallet from on-chain.
1197
1304
  *
@@ -1729,6 +1836,13 @@ declare class Zkp2pClient {
1729
1836
  * If `gatingServiceSignature` is not provided, the SDK will automatically
1730
1837
  * fetch one from the API (requires `apiKey` or `authorizationToken`).
1731
1838
  *
1839
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1840
+ * ```typescript
1841
+ * const prepared = await client.signalIntent.prepare(params);
1842
+ * // Submit via relayer or inspect calldata
1843
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1844
+ * ```
1845
+ *
1732
1846
  * @param params.depositId - The deposit to use
1733
1847
  * @param params.amount - Amount of tokens to claim (in token units)
1734
1848
  * @param params.toAddress - Address to receive the tokens when fulfilled
@@ -1747,6 +1861,7 @@ declare class Zkp2pClient {
1747
1861
  *
1748
1862
  * @example
1749
1863
  * ```typescript
1864
+ * // Execute directly
1750
1865
  * const hash = await client.signalIntent({
1751
1866
  * depositId: 42n,
1752
1867
  * amount: 100_000000n, // 100 USDC
@@ -1756,37 +1871,55 @@ declare class Zkp2pClient {
1756
1871
  * fiatCurrencyCode: 'USD',
1757
1872
  * conversionRate: 1_020000000000000000n, // 1.02
1758
1873
  * });
1874
+ *
1875
+ * // Or prepare for relayer submission
1876
+ * const prepared = await client.signalIntent.prepare({
1877
+ * depositId: 42n,
1878
+ * amount: 100_000000n,
1879
+ * toAddress: '0x...',
1880
+ * processorName: 'wise',
1881
+ * payeeDetails: '0x...',
1882
+ * fiatCurrencyCode: 'USD',
1883
+ * conversionRate: 1_020000000000000000n,
1884
+ * });
1885
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1759
1886
  * ```
1760
1887
  */
1761
- signalIntent(params: {
1762
- depositId: bigint | string;
1763
- amount: bigint | string;
1764
- toAddress: Address;
1765
- processorName: string;
1766
- payeeDetails: string;
1767
- fiatCurrencyCode: string;
1768
- conversionRate: bigint | string;
1769
- referrer?: Address;
1770
- referrerFee?: bigint | string;
1771
- postIntentHook?: Address;
1772
- data?: `0x${string}`;
1773
- gatingServiceSignature?: `0x${string}`;
1774
- signatureExpiration?: bigint | string;
1775
- txOverrides?: TxOverrides;
1776
- }): Promise<Hash>;
1888
+ readonly signalIntent: PrepareableMethod<SignalIntentMethodParams, Hash>;
1889
+ /**
1890
+ * Prepare signalIntent transaction (all logic except simulation/send).
1891
+ * Returns the prepared transaction with encoded calldata.
1892
+ */
1893
+ private prepareSignalIntent;
1777
1894
  /**
1778
1895
  * **Supporting Method** - Cancels a signaled intent before fulfillment.
1779
1896
  *
1780
1897
  * Only the intent owner can cancel. Releases reserved funds back to the deposit.
1781
1898
  *
1899
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1900
+ * ```typescript
1901
+ * const prepared = await client.cancelIntent.prepare({ intentHash });
1902
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1903
+ * ```
1904
+ *
1782
1905
  * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
1783
1906
  * @param params.txOverrides - Optional viem transaction overrides
1784
1907
  * @returns Transaction hash
1908
+ *
1909
+ * @example
1910
+ * ```typescript
1911
+ * // Execute directly
1912
+ * const hash = await client.cancelIntent({ intentHash: '0x...' });
1913
+ *
1914
+ * // Or prepare for relayer submission
1915
+ * const prepared = await client.cancelIntent.prepare({ intentHash: '0x...' });
1916
+ * ```
1785
1917
  */
1786
- cancelIntent(params: {
1787
- intentHash: `0x${string}`;
1788
- txOverrides?: TxOverrides;
1789
- }): Promise<Hash>;
1918
+ readonly cancelIntent: PrepareableMethod<CancelIntentMethodParams, Hash>;
1919
+ /**
1920
+ * Prepare cancelIntent transaction (all logic except simulation/send).
1921
+ */
1922
+ private prepareCancelIntent;
1790
1923
  /**
1791
1924
  * **Supporting Method** - Releases funds back to the deposit owner.
1792
1925
  *
@@ -1817,6 +1950,13 @@ declare class Zkp2pClient {
1817
1950
  * 3. Attestation response is encoded and submitted on-chain
1818
1951
  * 4. Funds are released to the intent's `toAddress`
1819
1952
  *
1953
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1954
+ * ```typescript
1955
+ * const prepared = await client.fulfillIntent.prepare(params);
1956
+ * // Submit via relayer or inspect calldata
1957
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1958
+ * ```
1959
+ *
1820
1960
  * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
1821
1961
  * @param params.proof - Payment proof from Reclaim (object or JSON string)
1822
1962
  * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
@@ -1826,21 +1966,29 @@ declare class Zkp2pClient {
1826
1966
  * @param params.txOverrides - Optional viem transaction overrides
1827
1967
  * @param params.callbacks - Lifecycle callbacks for UI updates
1828
1968
  * @returns Transaction hash
1969
+ *
1970
+ * @example
1971
+ * ```typescript
1972
+ * // Execute directly
1973
+ * const hash = await client.fulfillIntent({
1974
+ * intentHash: '0x...',
1975
+ * proof: proofFromExtension,
1976
+ * });
1977
+ *
1978
+ * // Or prepare for relayer submission
1979
+ * const prepared = await client.fulfillIntent.prepare({
1980
+ * intentHash: '0x...',
1981
+ * proof: proofFromExtension,
1982
+ * });
1983
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1984
+ * ```
1829
1985
  */
1830
- fulfillIntent(params: {
1831
- intentHash: `0x${string}`;
1832
- proof: Record<string, unknown> | string;
1833
- timestampBufferMs?: string;
1834
- attestationServiceUrl?: string;
1835
- verifyingContract?: Address;
1836
- postIntentHookData?: `0x${string}`;
1837
- txOverrides?: TxOverrides;
1838
- callbacks?: {
1839
- onAttestationStart?: () => void;
1840
- onTxSent?: (hash: Hash) => void;
1841
- onTxMined?: (hash: Hash) => void;
1842
- };
1843
- }): Promise<Hash>;
1986
+ readonly fulfillIntent: PrepareableMethod<FulfillIntentMethodParams, Hash>;
1987
+ /**
1988
+ * Prepare fulfillIntent transaction (all logic except simulation/send).
1989
+ * Includes fetching intent inputs and calling attestation service.
1990
+ */
1991
+ private prepareFulfillIntent;
1844
1992
  private defaultAttestationService;
1845
1993
  /**
1846
1994
  * **Supporting Method** - Fetches quotes for available liquidity.
@@ -1979,4 +2127,4 @@ declare class Zkp2pClient {
1979
2127
  }>;
1980
2128
  }
1981
2129
 
1982
- export { type DepositVerifierData as $, type ActionCallback as A, type GetDepositByIdResponse as B, type CreateDepositParams as C, type DepositWithRelations as D, type Intent as E, type FulfillIntentParams as F, type GetPayeeDetailsRequest as G, type ApiIntentStatus as H, type IntentEntity as I, type GetOwnerIntentsRequest as J, type GetOwnerIntentsResponse as K, type GetIntentsByDepositRequest as L, type GetIntentsByDepositResponse as M, type NearbyQuote as N, type GetIntentByHashRequest as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type Range as R, type SignalIntentParams as S, type TxOverrides as T, type GetIntentByHashResponse as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type RegisterPayeeDetailsRequest as X, type RegisterPayeeDetailsResponse as Y, Zkp2pClient as Z, type OnchainCurrency as _, type ValidatePayeeDetailsResponse as a, type OrderStats as a0, type DepositIntentStatistics as a1, type TakerTier as a2, type TakerTierStats as a3, type TakerTierLevel as a4, type PlatformLimit as a5, type PlatformRiskLevel as a6, IndexerClient as a7, defaultIndexerEndpoint as a8, IndexerDepositService as a9, getPaymentMethodsCatalog as aA, getGatingServiceAddress as aB, type RuntimeEnv as aC, parseDepositView as aD, parseIntentView as aE, enrichPvDepositView as aF, enrichPvIntentView as aG, type PV_DepositView as aH, type PV_Deposit as aI, type PV_PaymentMethodData as aJ, type PV_Currency as aK, type PV_IntentView as aL, type PV_Intent as aM, fetchFulfillmentAndPayment as aa, type DepositEntity as ab, type IntentFulfilledEntity as ac, type DepositPaymentMethodEntity as ad, type MethodCurrencyEntity as ae, type IntentStatus as af, type DepositFilter as ag, type PaginationOptions as ah, type DepositOrderField as ai, type OrderDirection as aj, type DeploymentEnv as ak, type FulfillmentRecord as al, type PaymentVerifiedRecord as am, type FulfillmentAndPaymentResponse as an, PAYMENT_PLATFORMS as ao, type PaymentPlatformType as ap, Currency as aq, currencyInfo as ar, getCurrencyInfoFromHash as as, getCurrencyInfoFromCountryCode as at, getCurrencyCodeFromHash as au, isSupportedCurrencyHash as av, mapConversionRatesToOnchainMinRate as aw, type CurrencyType as ax, type CurrencyData as ay, getContracts as az, type PostDepositDetailsResponse as b, type GetPayeeDetailsResponse as c, type GetTakerTierRequest as d, type GetTakerTierResponse as e, type PaymentMethodCatalog as f, type Zkp2pClientOptions as g, type TimeoutConfig as h, type CreateDepositConversionRate as i, type ReleaseFundsToPayerParams as j, type CancelIntentParams as k, type QuoteResponse as l, type QuoteResponseObject as m, type QuoteSingleResponse as n, type QuoteIntentResponse as o, type QuoteFeesResponse as p, type FiatResponse as q, type TokenResponse as r, type NearbySuggestions as s, type ApiDeposit as t, type DepositVerifier as u, type DepositVerifierCurrency as v, type DepositStatus as w, type GetOwnerDepositsRequest as x, type GetOwnerDepositsResponse as y, type GetDepositByIdRequest as z };
2130
+ export { type RegisterPayeeDetailsRequest as $, type ActionCallback as A, type GetOwnerDepositsRequest as B, type CancelIntentMethodParams as C, type DepositWithRelations as D, type GetOwnerDepositsResponse as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type GetDepositByIdRequest as H, type IntentEntity as I, type GetDepositByIdResponse as J, type Intent as K, type ApiIntentStatus as L, type GetOwnerIntentsRequest as M, type NearbyQuote as N, type GetOwnerIntentsResponse as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type Range as R, type SignalIntentMethodParams as S, type TxOverrides as T, type GetIntentsByDepositRequest as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type GetIntentsByDepositResponse as X, type GetIntentByHashRequest as Y, Zkp2pClient as Z, type GetIntentByHashResponse as _, type ValidatePayeeDetailsResponse as a, type RegisterPayeeDetailsResponse as a0, type OnchainCurrency as a1, type DepositVerifierData as a2, type PreparedTransaction as a3, type OrderStats as a4, type DepositIntentStatistics as a5, type TakerTier as a6, type TakerTierStats as a7, type TakerTierLevel as a8, type PlatformLimit as a9, mapConversionRatesToOnchainMinRate as aA, type CurrencyType as aB, type CurrencyData as aC, getContracts as aD, getPaymentMethodsCatalog as aE, getGatingServiceAddress as aF, type RuntimeEnv as aG, parseDepositView as aH, parseIntentView as aI, enrichPvDepositView as aJ, enrichPvIntentView as aK, type PV_DepositView as aL, type PV_Deposit as aM, type PV_PaymentMethodData as aN, type PV_Currency as aO, type PV_IntentView as aP, type PV_Intent as aQ, type PlatformRiskLevel as aa, IndexerClient as ab, defaultIndexerEndpoint as ac, IndexerDepositService as ad, fetchFulfillmentAndPayment as ae, type DepositEntity as af, type IntentFulfilledEntity as ag, type DepositPaymentMethodEntity as ah, type MethodCurrencyEntity as ai, type IntentStatus as aj, type DepositFilter as ak, type PaginationOptions as al, type DepositOrderField as am, type OrderDirection as an, type DeploymentEnv as ao, type FulfillmentRecord as ap, type PaymentVerifiedRecord as aq, type FulfillmentAndPaymentResponse as ar, PAYMENT_PLATFORMS as as, type PaymentPlatformType as at, Currency as au, currencyInfo as av, getCurrencyInfoFromHash as aw, getCurrencyInfoFromCountryCode as ax, getCurrencyCodeFromHash as ay, isSupportedCurrencyHash as az, type PostDepositDetailsResponse as b, type GetPayeeDetailsResponse as c, type GetTakerTierRequest as d, type GetTakerTierResponse as e, type PaymentMethodCatalog as f, type Zkp2pClientOptions as g, type TimeoutConfig as h, type CreateDepositParams as i, type CreateDepositConversionRate as j, type SignalIntentParams as k, type FulfillIntentParams as l, type ReleaseFundsToPayerParams as m, type CancelIntentParams as n, type QuoteResponse as o, type QuoteResponseObject as p, type QuoteSingleResponse as q, type QuoteIntentResponse as r, type QuoteFeesResponse as s, type FiatResponse as t, type TokenResponse as u, type NearbySuggestions as v, type ApiDeposit as w, type DepositVerifier as x, type DepositVerifierCurrency as y, type DepositStatus as z };
@@ -1,4 +1,4 @@
1
- import { AccessList, AuthorizationList, WalletClient, Hash, Address, PublicClient } from 'viem';
1
+ import { Address, Hex, AccessList, AuthorizationList, WalletClient, Hash, PublicClient } from 'viem';
2
2
  import { Abi } from 'abitype';
3
3
 
4
4
  /**
@@ -523,6 +523,38 @@ type FulfillmentAndPaymentResponse = {
523
523
  };
524
524
  declare function fetchFulfillmentAndPayment(client: IndexerClient, intentHash: string): Promise<FulfillmentAndPaymentResponse>;
525
525
 
526
+ /**
527
+ * A prepared transaction ready for submission.
528
+ * Contains all data needed to submit via wallet or relayer.
529
+ */
530
+ type PreparedTransaction = {
531
+ /** Target contract address */
532
+ to: Address;
533
+ /** Encoded calldata (includes ERC-8021 attribution) */
534
+ data: Hex;
535
+ /** ETH value to send (usually 0n for ZKP2P) */
536
+ value: bigint;
537
+ /** Chain ID for the transaction */
538
+ chainId: number;
539
+ };
540
+ /**
541
+ * A method that can be called directly or via .prepare()
542
+ *
543
+ * @example
544
+ * ```typescript
545
+ * // Execute directly (current behavior)
546
+ * const hash = await client.signalIntent(params);
547
+ *
548
+ * // Prepare for relayer submission
549
+ * const prepared = await client.signalIntent.prepare(params);
550
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
551
+ * ```
552
+ */
553
+ type PrepareableMethod<TParams, TResult> = {
554
+ (params: TParams): Promise<TResult>;
555
+ prepare(params: TParams): Promise<PreparedTransaction>;
556
+ };
557
+
526
558
  /**
527
559
  * Timeout configuration for different operation types
528
560
  */
@@ -1077,6 +1109,76 @@ type Zkp2pNextOptions = {
1077
1109
  api?: number;
1078
1110
  };
1079
1111
  };
1112
+ /**
1113
+ * Parameters for signalIntent method.
1114
+ * Used by both the direct call and .prepare() variants.
1115
+ */
1116
+ type SignalIntentMethodParams = {
1117
+ /** The deposit ID to use */
1118
+ depositId: bigint | string;
1119
+ /** Amount of tokens to claim (in token units) */
1120
+ amount: bigint | string;
1121
+ /** Address to receive the tokens when fulfilled */
1122
+ toAddress: Address;
1123
+ /** Payment platform name (e.g., 'wise', 'revolut') */
1124
+ processorName: string;
1125
+ /** Hashed payee details (from deposit) */
1126
+ payeeDetails: string;
1127
+ /** Fiat currency code (e.g., 'USD', 'EUR') */
1128
+ fiatCurrencyCode: string;
1129
+ /** Agreed conversion rate (18 decimals) */
1130
+ conversionRate: bigint | string;
1131
+ /** Optional referrer address for fee sharing */
1132
+ referrer?: Address;
1133
+ /** Optional referrer fee amount */
1134
+ referrerFee?: bigint | string;
1135
+ /** Optional hook contract to call after signaling */
1136
+ postIntentHook?: Address;
1137
+ /** Optional data to pass to the hook */
1138
+ data?: `0x${string}`;
1139
+ /** Pre-obtained signature (if not auto-fetching) */
1140
+ gatingServiceSignature?: `0x${string}`;
1141
+ /** Signature expiration timestamp */
1142
+ signatureExpiration?: bigint | string;
1143
+ /** Optional viem transaction overrides */
1144
+ txOverrides?: TxOverrides;
1145
+ };
1146
+ /**
1147
+ * Parameters for cancelIntent method.
1148
+ * Used by both the direct call and .prepare() variants.
1149
+ */
1150
+ type CancelIntentMethodParams = {
1151
+ /** The intent hash to cancel (0x-prefixed, 32 bytes) */
1152
+ intentHash: `0x${string}`;
1153
+ /** Optional viem transaction overrides */
1154
+ txOverrides?: TxOverrides;
1155
+ };
1156
+ /**
1157
+ * Parameters for fulfillIntent method.
1158
+ * Used by both the direct call and .prepare() variants.
1159
+ */
1160
+ type FulfillIntentMethodParams = {
1161
+ /** The intent hash to fulfill (0x-prefixed, 32 bytes) */
1162
+ intentHash: `0x${string}`;
1163
+ /** Payment proof from Reclaim (object or JSON string) */
1164
+ proof: Record<string, unknown> | string;
1165
+ /** Allowed timestamp variance in ms (default: 300000ms) */
1166
+ timestampBufferMs?: string;
1167
+ /** Override attestation service URL */
1168
+ attestationServiceUrl?: string;
1169
+ /** Override verifier contract address */
1170
+ verifyingContract?: Address;
1171
+ /** Data to pass to post-intent hook */
1172
+ postIntentHookData?: `0x${string}`;
1173
+ /** Optional viem transaction overrides */
1174
+ txOverrides?: TxOverrides;
1175
+ /** Lifecycle callbacks for UI updates */
1176
+ callbacks?: {
1177
+ onAttestationStart?: () => void;
1178
+ onTxSent?: (hash: Hash) => void;
1179
+ onTxMined?: (hash: Hash) => void;
1180
+ };
1181
+ };
1080
1182
  /**
1081
1183
  * SDK client for ZKP2P liquidity providers (offramp peers).
1082
1184
  *
@@ -1192,6 +1294,11 @@ declare class Zkp2pClient {
1192
1294
  * Referrer codes are stripped from overrides for simulation and appended to calldata.
1193
1295
  */
1194
1296
  private simulateAndSendWithAttribution;
1297
+ /**
1298
+ * Execute a prepared transaction (simulation + send).
1299
+ * Used internally by prepareable methods after preparation.
1300
+ */
1301
+ private executePreparedTransaction;
1195
1302
  /**
1196
1303
  * Fetches all deposits owned by the connected wallet from on-chain.
1197
1304
  *
@@ -1729,6 +1836,13 @@ declare class Zkp2pClient {
1729
1836
  * If `gatingServiceSignature` is not provided, the SDK will automatically
1730
1837
  * fetch one from the API (requires `apiKey` or `authorizationToken`).
1731
1838
  *
1839
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1840
+ * ```typescript
1841
+ * const prepared = await client.signalIntent.prepare(params);
1842
+ * // Submit via relayer or inspect calldata
1843
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1844
+ * ```
1845
+ *
1732
1846
  * @param params.depositId - The deposit to use
1733
1847
  * @param params.amount - Amount of tokens to claim (in token units)
1734
1848
  * @param params.toAddress - Address to receive the tokens when fulfilled
@@ -1747,6 +1861,7 @@ declare class Zkp2pClient {
1747
1861
  *
1748
1862
  * @example
1749
1863
  * ```typescript
1864
+ * // Execute directly
1750
1865
  * const hash = await client.signalIntent({
1751
1866
  * depositId: 42n,
1752
1867
  * amount: 100_000000n, // 100 USDC
@@ -1756,37 +1871,55 @@ declare class Zkp2pClient {
1756
1871
  * fiatCurrencyCode: 'USD',
1757
1872
  * conversionRate: 1_020000000000000000n, // 1.02
1758
1873
  * });
1874
+ *
1875
+ * // Or prepare for relayer submission
1876
+ * const prepared = await client.signalIntent.prepare({
1877
+ * depositId: 42n,
1878
+ * amount: 100_000000n,
1879
+ * toAddress: '0x...',
1880
+ * processorName: 'wise',
1881
+ * payeeDetails: '0x...',
1882
+ * fiatCurrencyCode: 'USD',
1883
+ * conversionRate: 1_020000000000000000n,
1884
+ * });
1885
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1759
1886
  * ```
1760
1887
  */
1761
- signalIntent(params: {
1762
- depositId: bigint | string;
1763
- amount: bigint | string;
1764
- toAddress: Address;
1765
- processorName: string;
1766
- payeeDetails: string;
1767
- fiatCurrencyCode: string;
1768
- conversionRate: bigint | string;
1769
- referrer?: Address;
1770
- referrerFee?: bigint | string;
1771
- postIntentHook?: Address;
1772
- data?: `0x${string}`;
1773
- gatingServiceSignature?: `0x${string}`;
1774
- signatureExpiration?: bigint | string;
1775
- txOverrides?: TxOverrides;
1776
- }): Promise<Hash>;
1888
+ readonly signalIntent: PrepareableMethod<SignalIntentMethodParams, Hash>;
1889
+ /**
1890
+ * Prepare signalIntent transaction (all logic except simulation/send).
1891
+ * Returns the prepared transaction with encoded calldata.
1892
+ */
1893
+ private prepareSignalIntent;
1777
1894
  /**
1778
1895
  * **Supporting Method** - Cancels a signaled intent before fulfillment.
1779
1896
  *
1780
1897
  * Only the intent owner can cancel. Releases reserved funds back to the deposit.
1781
1898
  *
1899
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1900
+ * ```typescript
1901
+ * const prepared = await client.cancelIntent.prepare({ intentHash });
1902
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1903
+ * ```
1904
+ *
1782
1905
  * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
1783
1906
  * @param params.txOverrides - Optional viem transaction overrides
1784
1907
  * @returns Transaction hash
1908
+ *
1909
+ * @example
1910
+ * ```typescript
1911
+ * // Execute directly
1912
+ * const hash = await client.cancelIntent({ intentHash: '0x...' });
1913
+ *
1914
+ * // Or prepare for relayer submission
1915
+ * const prepared = await client.cancelIntent.prepare({ intentHash: '0x...' });
1916
+ * ```
1785
1917
  */
1786
- cancelIntent(params: {
1787
- intentHash: `0x${string}`;
1788
- txOverrides?: TxOverrides;
1789
- }): Promise<Hash>;
1918
+ readonly cancelIntent: PrepareableMethod<CancelIntentMethodParams, Hash>;
1919
+ /**
1920
+ * Prepare cancelIntent transaction (all logic except simulation/send).
1921
+ */
1922
+ private prepareCancelIntent;
1790
1923
  /**
1791
1924
  * **Supporting Method** - Releases funds back to the deposit owner.
1792
1925
  *
@@ -1817,6 +1950,13 @@ declare class Zkp2pClient {
1817
1950
  * 3. Attestation response is encoded and submitted on-chain
1818
1951
  * 4. Funds are released to the intent's `toAddress`
1819
1952
  *
1953
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1954
+ * ```typescript
1955
+ * const prepared = await client.fulfillIntent.prepare(params);
1956
+ * // Submit via relayer or inspect calldata
1957
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1958
+ * ```
1959
+ *
1820
1960
  * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
1821
1961
  * @param params.proof - Payment proof from Reclaim (object or JSON string)
1822
1962
  * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
@@ -1826,21 +1966,29 @@ declare class Zkp2pClient {
1826
1966
  * @param params.txOverrides - Optional viem transaction overrides
1827
1967
  * @param params.callbacks - Lifecycle callbacks for UI updates
1828
1968
  * @returns Transaction hash
1969
+ *
1970
+ * @example
1971
+ * ```typescript
1972
+ * // Execute directly
1973
+ * const hash = await client.fulfillIntent({
1974
+ * intentHash: '0x...',
1975
+ * proof: proofFromExtension,
1976
+ * });
1977
+ *
1978
+ * // Or prepare for relayer submission
1979
+ * const prepared = await client.fulfillIntent.prepare({
1980
+ * intentHash: '0x...',
1981
+ * proof: proofFromExtension,
1982
+ * });
1983
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1984
+ * ```
1829
1985
  */
1830
- fulfillIntent(params: {
1831
- intentHash: `0x${string}`;
1832
- proof: Record<string, unknown> | string;
1833
- timestampBufferMs?: string;
1834
- attestationServiceUrl?: string;
1835
- verifyingContract?: Address;
1836
- postIntentHookData?: `0x${string}`;
1837
- txOverrides?: TxOverrides;
1838
- callbacks?: {
1839
- onAttestationStart?: () => void;
1840
- onTxSent?: (hash: Hash) => void;
1841
- onTxMined?: (hash: Hash) => void;
1842
- };
1843
- }): Promise<Hash>;
1986
+ readonly fulfillIntent: PrepareableMethod<FulfillIntentMethodParams, Hash>;
1987
+ /**
1988
+ * Prepare fulfillIntent transaction (all logic except simulation/send).
1989
+ * Includes fetching intent inputs and calling attestation service.
1990
+ */
1991
+ private prepareFulfillIntent;
1844
1992
  private defaultAttestationService;
1845
1993
  /**
1846
1994
  * **Supporting Method** - Fetches quotes for available liquidity.
@@ -1979,4 +2127,4 @@ declare class Zkp2pClient {
1979
2127
  }>;
1980
2128
  }
1981
2129
 
1982
- export { type DepositVerifierData as $, type ActionCallback as A, type GetDepositByIdResponse as B, type CreateDepositParams as C, type DepositWithRelations as D, type Intent as E, type FulfillIntentParams as F, type GetPayeeDetailsRequest as G, type ApiIntentStatus as H, type IntentEntity as I, type GetOwnerIntentsRequest as J, type GetOwnerIntentsResponse as K, type GetIntentsByDepositRequest as L, type GetIntentsByDepositResponse as M, type NearbyQuote as N, type GetIntentByHashRequest as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type Range as R, type SignalIntentParams as S, type TxOverrides as T, type GetIntentByHashResponse as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type RegisterPayeeDetailsRequest as X, type RegisterPayeeDetailsResponse as Y, Zkp2pClient as Z, type OnchainCurrency as _, type ValidatePayeeDetailsResponse as a, type OrderStats as a0, type DepositIntentStatistics as a1, type TakerTier as a2, type TakerTierStats as a3, type TakerTierLevel as a4, type PlatformLimit as a5, type PlatformRiskLevel as a6, IndexerClient as a7, defaultIndexerEndpoint as a8, IndexerDepositService as a9, getPaymentMethodsCatalog as aA, getGatingServiceAddress as aB, type RuntimeEnv as aC, parseDepositView as aD, parseIntentView as aE, enrichPvDepositView as aF, enrichPvIntentView as aG, type PV_DepositView as aH, type PV_Deposit as aI, type PV_PaymentMethodData as aJ, type PV_Currency as aK, type PV_IntentView as aL, type PV_Intent as aM, fetchFulfillmentAndPayment as aa, type DepositEntity as ab, type IntentFulfilledEntity as ac, type DepositPaymentMethodEntity as ad, type MethodCurrencyEntity as ae, type IntentStatus as af, type DepositFilter as ag, type PaginationOptions as ah, type DepositOrderField as ai, type OrderDirection as aj, type DeploymentEnv as ak, type FulfillmentRecord as al, type PaymentVerifiedRecord as am, type FulfillmentAndPaymentResponse as an, PAYMENT_PLATFORMS as ao, type PaymentPlatformType as ap, Currency as aq, currencyInfo as ar, getCurrencyInfoFromHash as as, getCurrencyInfoFromCountryCode as at, getCurrencyCodeFromHash as au, isSupportedCurrencyHash as av, mapConversionRatesToOnchainMinRate as aw, type CurrencyType as ax, type CurrencyData as ay, getContracts as az, type PostDepositDetailsResponse as b, type GetPayeeDetailsResponse as c, type GetTakerTierRequest as d, type GetTakerTierResponse as e, type PaymentMethodCatalog as f, type Zkp2pClientOptions as g, type TimeoutConfig as h, type CreateDepositConversionRate as i, type ReleaseFundsToPayerParams as j, type CancelIntentParams as k, type QuoteResponse as l, type QuoteResponseObject as m, type QuoteSingleResponse as n, type QuoteIntentResponse as o, type QuoteFeesResponse as p, type FiatResponse as q, type TokenResponse as r, type NearbySuggestions as s, type ApiDeposit as t, type DepositVerifier as u, type DepositVerifierCurrency as v, type DepositStatus as w, type GetOwnerDepositsRequest as x, type GetOwnerDepositsResponse as y, type GetDepositByIdRequest as z };
2130
+ export { type RegisterPayeeDetailsRequest as $, type ActionCallback as A, type GetOwnerDepositsRequest as B, type CancelIntentMethodParams as C, type DepositWithRelations as D, type GetOwnerDepositsResponse as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type GetDepositByIdRequest as H, type IntentEntity as I, type GetDepositByIdResponse as J, type Intent as K, type ApiIntentStatus as L, type GetOwnerIntentsRequest as M, type NearbyQuote as N, type GetOwnerIntentsResponse as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type Range as R, type SignalIntentMethodParams as S, type TxOverrides as T, type GetIntentsByDepositRequest as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type GetIntentsByDepositResponse as X, type GetIntentByHashRequest as Y, Zkp2pClient as Z, type GetIntentByHashResponse as _, type ValidatePayeeDetailsResponse as a, type RegisterPayeeDetailsResponse as a0, type OnchainCurrency as a1, type DepositVerifierData as a2, type PreparedTransaction as a3, type OrderStats as a4, type DepositIntentStatistics as a5, type TakerTier as a6, type TakerTierStats as a7, type TakerTierLevel as a8, type PlatformLimit as a9, mapConversionRatesToOnchainMinRate as aA, type CurrencyType as aB, type CurrencyData as aC, getContracts as aD, getPaymentMethodsCatalog as aE, getGatingServiceAddress as aF, type RuntimeEnv as aG, parseDepositView as aH, parseIntentView as aI, enrichPvDepositView as aJ, enrichPvIntentView as aK, type PV_DepositView as aL, type PV_Deposit as aM, type PV_PaymentMethodData as aN, type PV_Currency as aO, type PV_IntentView as aP, type PV_Intent as aQ, type PlatformRiskLevel as aa, IndexerClient as ab, defaultIndexerEndpoint as ac, IndexerDepositService as ad, fetchFulfillmentAndPayment as ae, type DepositEntity as af, type IntentFulfilledEntity as ag, type DepositPaymentMethodEntity as ah, type MethodCurrencyEntity as ai, type IntentStatus as aj, type DepositFilter as ak, type PaginationOptions as al, type DepositOrderField as am, type OrderDirection as an, type DeploymentEnv as ao, type FulfillmentRecord as ap, type PaymentVerifiedRecord as aq, type FulfillmentAndPaymentResponse as ar, PAYMENT_PLATFORMS as as, type PaymentPlatformType as at, Currency as au, currencyInfo as av, getCurrencyInfoFromHash as aw, getCurrencyInfoFromCountryCode as ax, getCurrencyCodeFromHash as ay, isSupportedCurrencyHash as az, type PostDepositDetailsResponse as b, type GetPayeeDetailsResponse as c, type GetTakerTierRequest as d, type GetTakerTierResponse as e, type PaymentMethodCatalog as f, type Zkp2pClientOptions as g, type TimeoutConfig as h, type CreateDepositParams as i, type CreateDepositConversionRate as j, type SignalIntentParams as k, type FulfillIntentParams as l, type ReleaseFundsToPayerParams as m, type CancelIntentParams as n, type QuoteResponse as o, type QuoteResponseObject as p, type QuoteSingleResponse as q, type QuoteIntentResponse as r, type QuoteFeesResponse as s, type FiatResponse as t, type TokenResponse as u, type NearbySuggestions as v, type ApiDeposit as w, type DepositVerifier as x, type DepositVerifierCurrency as y, type DepositStatus as z };
@@ -174,5 +174,5 @@ function resolvePlatformAttestationConfig(platformName) {
174
174
  }
175
175
 
176
176
  export { DEFAULT_BASE_API_URL, DEFAULT_WITNESS_URL, DEPLOYED_ADDRESSES, PAYMENT_PLATFORMS, PLATFORM_ATTESTATION_CONFIG, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, resolvePlatformAttestationConfig };
177
- //# sourceMappingURL=chunk-P3NOBRQB.mjs.map
178
- //# sourceMappingURL=chunk-P3NOBRQB.mjs.map
177
+ //# sourceMappingURL=chunk-ARFGMPYS.mjs.map
178
+ //# sourceMappingURL=chunk-ARFGMPYS.mjs.map