@zkp2p/sdk 0.0.5 → 0.0.7
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 +80 -1
- package/dist/{Zkp2pClient-CIMGTCFg.d.mts → Zkp2pClient-w5Pzlea6.d.mts} +285 -71
- package/dist/{Zkp2pClient-CIMGTCFg.d.ts → Zkp2pClient-w5Pzlea6.d.ts} +285 -71
- package/dist/chunk-3QS3WKRC.mjs +29 -0
- package/dist/chunk-3QS3WKRC.mjs.map +1 -0
- package/dist/{chunk-P3NOBRQB.mjs → chunk-GYYD6SSA.mjs} +2 -2
- package/dist/chunk-GYYD6SSA.mjs.map +1 -0
- package/dist/{chunk-CM3RH5VZ.mjs → chunk-NZ53KYLT.mjs} +42 -2
- package/dist/chunk-NZ53KYLT.mjs.map +1 -0
- package/dist/{chunk-PYEJ4L76.mjs → chunk-W247BDNW.mjs} +3 -3
- package/dist/{chunk-PYEJ4L76.mjs.map → chunk-W247BDNW.mjs.map} +1 -1
- package/dist/constants-ZICRSYZM.mjs +5 -0
- package/dist/{constants-Y2IWTA6H.mjs.map → constants-ZICRSYZM.mjs.map} +1 -1
- package/dist/{currency-RSSHQOM3.mjs → currency-UVK4OKUR.mjs} +4 -3
- package/dist/{currency-RSSHQOM3.mjs.map → currency-UVK4OKUR.mjs.map} +1 -1
- package/dist/index.cjs +1169 -440
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +92 -4
- package/dist/index.d.ts +92 -4
- package/dist/index.mjs +916 -442
- package/dist/index.mjs.map +1 -1
- package/dist/{paymentResolution-4AAJVIIC.mjs → paymentResolution-2FP3NLM3.mjs} +3 -2
- package/dist/{paymentResolution-4AAJVIIC.mjs.map → paymentResolution-2FP3NLM3.mjs.map} +1 -1
- package/dist/protocolViewerParsers-EH5DGVSU.mjs +6 -0
- package/dist/{protocolViewerParsers-3QIR3XMT.mjs.map → protocolViewerParsers-EH5DGVSU.mjs.map} +1 -1
- package/dist/react.cjs +62 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.mts +58 -4
- package/dist/react.d.ts +58 -4
- package/dist/react.mjs +63 -3
- package/dist/react.mjs.map +1 -1
- package/dist/{timeout-QB7K5SOB.mjs → timeout-7HCFGU6P.mjs} +3 -2
- package/dist/timeout-7HCFGU6P.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/chunk-CM3RH5VZ.mjs.map +0 -1
- package/dist/chunk-P3NOBRQB.mjs.map +0 -1
- package/dist/constants-Y2IWTA6H.mjs +0 -4
- package/dist/protocolViewerParsers-3QIR3XMT.mjs +0 -5
- package/dist/timeout-QB7K5SOB.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessList, AuthorizationList, WalletClient, Hash,
|
|
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
|
*/
|
|
@@ -709,6 +741,8 @@ type TokenResponse = {
|
|
|
709
741
|
type QuoteIntentResponse = {
|
|
710
742
|
/** Deposit ID */
|
|
711
743
|
depositId: string;
|
|
744
|
+
/** Escrow contract address */
|
|
745
|
+
escrowAddress: string;
|
|
712
746
|
/** Payment processor name */
|
|
713
747
|
processorName: string;
|
|
714
748
|
/** Amount to transfer */
|
|
@@ -848,6 +882,12 @@ type CreateDepositParams = {
|
|
|
848
882
|
depositData: {
|
|
849
883
|
[key: string]: string;
|
|
850
884
|
}[];
|
|
885
|
+
paymentMethodsOverride?: `0x${string}`[];
|
|
886
|
+
paymentMethodDataOverride?: DepositVerifierData[];
|
|
887
|
+
currenciesOverride?: {
|
|
888
|
+
code: `0x${string}`;
|
|
889
|
+
minConversionRate: bigint;
|
|
890
|
+
}[][];
|
|
851
891
|
onSuccess?: ActionCallback;
|
|
852
892
|
onError?: (error: Error) => void;
|
|
853
893
|
onMined?: ActionCallback;
|
|
@@ -1039,7 +1079,7 @@ type GetTakerTierResponse = {
|
|
|
1039
1079
|
};
|
|
1040
1080
|
|
|
1041
1081
|
declare const PAYMENT_PLATFORMS: readonly ["wise", "venmo", "revolut", "cashapp", "mercadopago", "zelle", "paypal", "monzo"];
|
|
1042
|
-
type PaymentPlatformType = typeof PAYMENT_PLATFORMS[number];
|
|
1082
|
+
type PaymentPlatformType = (typeof PAYMENT_PLATFORMS)[number];
|
|
1043
1083
|
|
|
1044
1084
|
/**
|
|
1045
1085
|
* Configuration options for creating a Zkp2pClient instance.
|
|
@@ -1077,6 +1117,76 @@ type Zkp2pNextOptions = {
|
|
|
1077
1117
|
api?: number;
|
|
1078
1118
|
};
|
|
1079
1119
|
};
|
|
1120
|
+
/**
|
|
1121
|
+
* Parameters for signalIntent method.
|
|
1122
|
+
* Used by both the direct call and .prepare() variants.
|
|
1123
|
+
*/
|
|
1124
|
+
type SignalIntentMethodParams = {
|
|
1125
|
+
/** The deposit ID to use */
|
|
1126
|
+
depositId: bigint | string;
|
|
1127
|
+
/** Amount of tokens to claim (in token units) */
|
|
1128
|
+
amount: bigint | string;
|
|
1129
|
+
/** Address to receive the tokens when fulfilled */
|
|
1130
|
+
toAddress: Address;
|
|
1131
|
+
/** Payment platform name (e.g., 'wise', 'revolut') */
|
|
1132
|
+
processorName: string;
|
|
1133
|
+
/** Hashed payee details (from deposit) */
|
|
1134
|
+
payeeDetails: string;
|
|
1135
|
+
/** Fiat currency code (e.g., 'USD', 'EUR') */
|
|
1136
|
+
fiatCurrencyCode: string;
|
|
1137
|
+
/** Agreed conversion rate (18 decimals) */
|
|
1138
|
+
conversionRate: bigint | string;
|
|
1139
|
+
/** Optional referrer address for fee sharing */
|
|
1140
|
+
referrer?: Address;
|
|
1141
|
+
/** Optional referrer fee amount */
|
|
1142
|
+
referrerFee?: bigint | string;
|
|
1143
|
+
/** Optional hook contract to call after signaling */
|
|
1144
|
+
postIntentHook?: Address;
|
|
1145
|
+
/** Optional data to pass to the hook */
|
|
1146
|
+
data?: `0x${string}`;
|
|
1147
|
+
/** Pre-obtained signature (if not auto-fetching) */
|
|
1148
|
+
gatingServiceSignature?: `0x${string}`;
|
|
1149
|
+
/** Signature expiration timestamp */
|
|
1150
|
+
signatureExpiration?: bigint | string;
|
|
1151
|
+
/** Optional viem transaction overrides */
|
|
1152
|
+
txOverrides?: TxOverrides;
|
|
1153
|
+
};
|
|
1154
|
+
/**
|
|
1155
|
+
* Parameters for cancelIntent method.
|
|
1156
|
+
* Used by both the direct call and .prepare() variants.
|
|
1157
|
+
*/
|
|
1158
|
+
type CancelIntentMethodParams = {
|
|
1159
|
+
/** The intent hash to cancel (0x-prefixed, 32 bytes) */
|
|
1160
|
+
intentHash: `0x${string}`;
|
|
1161
|
+
/** Optional viem transaction overrides */
|
|
1162
|
+
txOverrides?: TxOverrides;
|
|
1163
|
+
};
|
|
1164
|
+
/**
|
|
1165
|
+
* Parameters for fulfillIntent method.
|
|
1166
|
+
* Used by both the direct call and .prepare() variants.
|
|
1167
|
+
*/
|
|
1168
|
+
type FulfillIntentMethodParams = {
|
|
1169
|
+
/** The intent hash to fulfill (0x-prefixed, 32 bytes) */
|
|
1170
|
+
intentHash: `0x${string}`;
|
|
1171
|
+
/** Payment proof from Reclaim (object or JSON string) */
|
|
1172
|
+
proof: Record<string, unknown> | string;
|
|
1173
|
+
/** Allowed timestamp variance in ms (default: 300000ms) */
|
|
1174
|
+
timestampBufferMs?: string;
|
|
1175
|
+
/** Override attestation service URL */
|
|
1176
|
+
attestationServiceUrl?: string;
|
|
1177
|
+
/** Override verifier contract address */
|
|
1178
|
+
verifyingContract?: Address;
|
|
1179
|
+
/** Data to pass to post-intent hook */
|
|
1180
|
+
postIntentHookData?: `0x${string}`;
|
|
1181
|
+
/** Optional viem transaction overrides */
|
|
1182
|
+
txOverrides?: TxOverrides;
|
|
1183
|
+
/** Lifecycle callbacks for UI updates */
|
|
1184
|
+
callbacks?: {
|
|
1185
|
+
onAttestationStart?: () => void;
|
|
1186
|
+
onTxSent?: (hash: Hash) => void;
|
|
1187
|
+
onTxMined?: (hash: Hash) => void;
|
|
1188
|
+
};
|
|
1189
|
+
};
|
|
1080
1190
|
/**
|
|
1081
1191
|
* SDK client for ZKP2P liquidity providers (offramp peers).
|
|
1082
1192
|
*
|
|
@@ -1192,6 +1302,15 @@ declare class Zkp2pClient {
|
|
|
1192
1302
|
* Referrer codes are stripped from overrides for simulation and appended to calldata.
|
|
1193
1303
|
*/
|
|
1194
1304
|
private simulateAndSendWithAttribution;
|
|
1305
|
+
/**
|
|
1306
|
+
* Execute a prepared transaction (simulation + send).
|
|
1307
|
+
* Used internally by prepareable methods after preparation.
|
|
1308
|
+
*/
|
|
1309
|
+
private executePreparedTransaction;
|
|
1310
|
+
private prepareEscrowTransaction;
|
|
1311
|
+
private prepareOrchestratorTransaction;
|
|
1312
|
+
private buildEscrowMethod;
|
|
1313
|
+
private buildOrchestratorMethod;
|
|
1195
1314
|
/**
|
|
1196
1315
|
* Fetches all deposits owned by the connected wallet from on-chain.
|
|
1197
1316
|
*
|
|
@@ -1477,6 +1596,16 @@ declare class Zkp2pClient {
|
|
|
1477
1596
|
currency: string;
|
|
1478
1597
|
conversionRate: string;
|
|
1479
1598
|
}[][];
|
|
1599
|
+
paymentMethodsOverride?: `0x${string}`[];
|
|
1600
|
+
paymentMethodDataOverride?: {
|
|
1601
|
+
intentGatingService: Address;
|
|
1602
|
+
payeeDetails: string;
|
|
1603
|
+
data: `0x${string}`;
|
|
1604
|
+
}[];
|
|
1605
|
+
currenciesOverride?: {
|
|
1606
|
+
code: `0x${string}`;
|
|
1607
|
+
minConversionRate: bigint;
|
|
1608
|
+
}[][];
|
|
1480
1609
|
delegate?: Address;
|
|
1481
1610
|
intentGuardian?: Address;
|
|
1482
1611
|
retainOnEmpty?: boolean;
|
|
@@ -1485,6 +1614,46 @@ declare class Zkp2pClient {
|
|
|
1485
1614
|
depositDetails: PostDepositDetailsRequest[];
|
|
1486
1615
|
hash: Hash;
|
|
1487
1616
|
}>;
|
|
1617
|
+
/**
|
|
1618
|
+
* Prepares a createDeposit transaction without sending it.
|
|
1619
|
+
*
|
|
1620
|
+
* Returns both the prepared transaction calldata and the posted deposit details
|
|
1621
|
+
* (including hashed on-chain IDs) needed for tracking.
|
|
1622
|
+
*/
|
|
1623
|
+
prepareCreateDeposit(params: {
|
|
1624
|
+
token: Address;
|
|
1625
|
+
amount: bigint;
|
|
1626
|
+
intentAmountRange: {
|
|
1627
|
+
min: bigint;
|
|
1628
|
+
max: bigint;
|
|
1629
|
+
};
|
|
1630
|
+
processorNames: string[];
|
|
1631
|
+
depositData: {
|
|
1632
|
+
[key: string]: string;
|
|
1633
|
+
}[];
|
|
1634
|
+
conversionRates: {
|
|
1635
|
+
currency: string;
|
|
1636
|
+
conversionRate: string;
|
|
1637
|
+
}[][];
|
|
1638
|
+
paymentMethodsOverride?: `0x${string}`[];
|
|
1639
|
+
paymentMethodDataOverride?: {
|
|
1640
|
+
intentGatingService: Address;
|
|
1641
|
+
payeeDetails: string;
|
|
1642
|
+
data: `0x${string}`;
|
|
1643
|
+
}[];
|
|
1644
|
+
currenciesOverride?: {
|
|
1645
|
+
code: `0x${string}`;
|
|
1646
|
+
minConversionRate: bigint;
|
|
1647
|
+
}[][];
|
|
1648
|
+
delegate?: Address;
|
|
1649
|
+
intentGuardian?: Address;
|
|
1650
|
+
retainOnEmpty?: boolean;
|
|
1651
|
+
txOverrides?: TxOverrides;
|
|
1652
|
+
}): Promise<{
|
|
1653
|
+
depositDetails: PostDepositDetailsRequest[];
|
|
1654
|
+
prepared: PreparedTransaction;
|
|
1655
|
+
}>;
|
|
1656
|
+
private prepareCreateDepositInternal;
|
|
1488
1657
|
/**
|
|
1489
1658
|
* Enables or disables a deposit from accepting new intents.
|
|
1490
1659
|
*
|
|
@@ -1493,11 +1662,11 @@ declare class Zkp2pClient {
|
|
|
1493
1662
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1494
1663
|
* @returns Transaction hash
|
|
1495
1664
|
*/
|
|
1496
|
-
setAcceptingIntents
|
|
1665
|
+
readonly setAcceptingIntents: PrepareableMethod<{
|
|
1497
1666
|
depositId: bigint;
|
|
1498
1667
|
accepting: boolean;
|
|
1499
1668
|
txOverrides?: TxOverrides;
|
|
1500
|
-
}
|
|
1669
|
+
}, `0x${string}`>;
|
|
1501
1670
|
/**
|
|
1502
1671
|
* Updates the min/max intent amount range for a deposit.
|
|
1503
1672
|
*
|
|
@@ -1507,12 +1676,12 @@ declare class Zkp2pClient {
|
|
|
1507
1676
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1508
1677
|
* @returns Transaction hash
|
|
1509
1678
|
*/
|
|
1510
|
-
setIntentRange
|
|
1679
|
+
readonly setIntentRange: PrepareableMethod<{
|
|
1511
1680
|
depositId: bigint;
|
|
1512
1681
|
min: bigint;
|
|
1513
1682
|
max: bigint;
|
|
1514
1683
|
txOverrides?: TxOverrides;
|
|
1515
|
-
}
|
|
1684
|
+
}, `0x${string}`>;
|
|
1516
1685
|
/**
|
|
1517
1686
|
* Updates the minimum conversion rate for a specific currency on a payment method.
|
|
1518
1687
|
*
|
|
@@ -1523,13 +1692,13 @@ declare class Zkp2pClient {
|
|
|
1523
1692
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1524
1693
|
* @returns Transaction hash
|
|
1525
1694
|
*/
|
|
1526
|
-
setCurrencyMinRate
|
|
1695
|
+
readonly setCurrencyMinRate: PrepareableMethod<{
|
|
1527
1696
|
depositId: bigint;
|
|
1528
1697
|
paymentMethod: `0x${string}`;
|
|
1529
1698
|
fiatCurrency: `0x${string}`;
|
|
1530
1699
|
minConversionRate: bigint;
|
|
1531
1700
|
txOverrides?: TxOverrides;
|
|
1532
|
-
}
|
|
1701
|
+
}, `0x${string}`>;
|
|
1533
1702
|
/**
|
|
1534
1703
|
* Adds additional funds to an existing deposit.
|
|
1535
1704
|
* Requires prior approval of the token amount.
|
|
@@ -1539,11 +1708,11 @@ declare class Zkp2pClient {
|
|
|
1539
1708
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1540
1709
|
* @returns Transaction hash
|
|
1541
1710
|
*/
|
|
1542
|
-
addFunds
|
|
1711
|
+
readonly addFunds: PrepareableMethod<{
|
|
1543
1712
|
depositId: bigint;
|
|
1544
1713
|
amount: bigint;
|
|
1545
1714
|
txOverrides?: TxOverrides;
|
|
1546
|
-
}
|
|
1715
|
+
}, `0x${string}`>;
|
|
1547
1716
|
/**
|
|
1548
1717
|
* Removes funds from a deposit (partial withdrawal).
|
|
1549
1718
|
* Can only withdraw available (non-locked) funds.
|
|
@@ -1553,11 +1722,11 @@ declare class Zkp2pClient {
|
|
|
1553
1722
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1554
1723
|
* @returns Transaction hash
|
|
1555
1724
|
*/
|
|
1556
|
-
removeFunds
|
|
1725
|
+
readonly removeFunds: PrepareableMethod<{
|
|
1557
1726
|
depositId: bigint;
|
|
1558
1727
|
amount: bigint;
|
|
1559
1728
|
txOverrides?: TxOverrides;
|
|
1560
|
-
}
|
|
1729
|
+
}, `0x${string}`>;
|
|
1561
1730
|
/**
|
|
1562
1731
|
* Fully withdraws a deposit, returning all available funds to the owner.
|
|
1563
1732
|
* The deposit must have no active intents.
|
|
@@ -1566,10 +1735,10 @@ declare class Zkp2pClient {
|
|
|
1566
1735
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1567
1736
|
* @returns Transaction hash
|
|
1568
1737
|
*/
|
|
1569
|
-
withdrawDeposit
|
|
1738
|
+
readonly withdrawDeposit: PrepareableMethod<{
|
|
1570
1739
|
depositId: bigint;
|
|
1571
1740
|
txOverrides?: TxOverrides;
|
|
1572
|
-
}
|
|
1741
|
+
}, `0x${string}`>;
|
|
1573
1742
|
/**
|
|
1574
1743
|
* Sets whether a deposit should remain active when its balance reaches zero.
|
|
1575
1744
|
*
|
|
@@ -1578,11 +1747,11 @@ declare class Zkp2pClient {
|
|
|
1578
1747
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1579
1748
|
* @returns Transaction hash
|
|
1580
1749
|
*/
|
|
1581
|
-
setRetainOnEmpty
|
|
1750
|
+
readonly setRetainOnEmpty: PrepareableMethod<{
|
|
1582
1751
|
depositId: bigint;
|
|
1583
1752
|
retain: boolean;
|
|
1584
1753
|
txOverrides?: TxOverrides;
|
|
1585
|
-
}
|
|
1754
|
+
}, `0x${string}`>;
|
|
1586
1755
|
/**
|
|
1587
1756
|
* Assigns a delegate address that can manage the deposit on behalf of the owner.
|
|
1588
1757
|
*
|
|
@@ -1591,11 +1760,11 @@ declare class Zkp2pClient {
|
|
|
1591
1760
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1592
1761
|
* @returns Transaction hash
|
|
1593
1762
|
*/
|
|
1594
|
-
setDelegate
|
|
1763
|
+
readonly setDelegate: PrepareableMethod<{
|
|
1595
1764
|
depositId: bigint;
|
|
1596
1765
|
delegate: Address;
|
|
1597
1766
|
txOverrides?: TxOverrides;
|
|
1598
|
-
}
|
|
1767
|
+
}, `0x${string}`>;
|
|
1599
1768
|
/**
|
|
1600
1769
|
* Removes the delegate from a deposit.
|
|
1601
1770
|
*
|
|
@@ -1603,10 +1772,10 @@ declare class Zkp2pClient {
|
|
|
1603
1772
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1604
1773
|
* @returns Transaction hash
|
|
1605
1774
|
*/
|
|
1606
|
-
removeDelegate
|
|
1775
|
+
readonly removeDelegate: PrepareableMethod<{
|
|
1607
1776
|
depositId: bigint;
|
|
1608
1777
|
txOverrides?: TxOverrides;
|
|
1609
|
-
}
|
|
1778
|
+
}, `0x${string}`>;
|
|
1610
1779
|
/**
|
|
1611
1780
|
* Adds new payment methods to an existing deposit.
|
|
1612
1781
|
*
|
|
@@ -1616,7 +1785,7 @@ declare class Zkp2pClient {
|
|
|
1616
1785
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1617
1786
|
* @returns Transaction hash
|
|
1618
1787
|
*/
|
|
1619
|
-
addPaymentMethods
|
|
1788
|
+
readonly addPaymentMethods: PrepareableMethod<{
|
|
1620
1789
|
depositId: bigint;
|
|
1621
1790
|
paymentMethods: `0x${string}`[];
|
|
1622
1791
|
paymentMethodData: {
|
|
@@ -1624,8 +1793,12 @@ declare class Zkp2pClient {
|
|
|
1624
1793
|
payeeDetails: string;
|
|
1625
1794
|
data: `0x${string}`;
|
|
1626
1795
|
}[];
|
|
1796
|
+
currencies: {
|
|
1797
|
+
code: `0x${string}`;
|
|
1798
|
+
minConversionRate: bigint;
|
|
1799
|
+
}[][];
|
|
1627
1800
|
txOverrides?: TxOverrides;
|
|
1628
|
-
}
|
|
1801
|
+
}, `0x${string}`>;
|
|
1629
1802
|
/**
|
|
1630
1803
|
* Activates or deactivates a payment method on a deposit.
|
|
1631
1804
|
*
|
|
@@ -1635,12 +1808,12 @@ declare class Zkp2pClient {
|
|
|
1635
1808
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1636
1809
|
* @returns Transaction hash
|
|
1637
1810
|
*/
|
|
1638
|
-
setPaymentMethodActive
|
|
1811
|
+
readonly setPaymentMethodActive: PrepareableMethod<{
|
|
1639
1812
|
depositId: bigint;
|
|
1640
1813
|
paymentMethod: `0x${string}`;
|
|
1641
1814
|
isActive: boolean;
|
|
1642
1815
|
txOverrides?: TxOverrides;
|
|
1643
|
-
}
|
|
1816
|
+
}, `0x${string}`>;
|
|
1644
1817
|
/**
|
|
1645
1818
|
* Deactivates a payment method on a deposit (convenience alias for setPaymentMethodActive).
|
|
1646
1819
|
*
|
|
@@ -1649,11 +1822,11 @@ declare class Zkp2pClient {
|
|
|
1649
1822
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1650
1823
|
* @returns Transaction hash
|
|
1651
1824
|
*/
|
|
1652
|
-
removePaymentMethod
|
|
1825
|
+
readonly removePaymentMethod: PrepareableMethod<{
|
|
1653
1826
|
depositId: bigint;
|
|
1654
1827
|
paymentMethod: `0x${string}`;
|
|
1655
1828
|
txOverrides?: TxOverrides;
|
|
1656
|
-
}
|
|
1829
|
+
}, `0x${string}`>;
|
|
1657
1830
|
/**
|
|
1658
1831
|
* Adds new currencies to a payment method on a deposit.
|
|
1659
1832
|
*
|
|
@@ -1663,7 +1836,7 @@ declare class Zkp2pClient {
|
|
|
1663
1836
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1664
1837
|
* @returns Transaction hash
|
|
1665
1838
|
*/
|
|
1666
|
-
addCurrencies
|
|
1839
|
+
readonly addCurrencies: PrepareableMethod<{
|
|
1667
1840
|
depositId: bigint;
|
|
1668
1841
|
paymentMethod: `0x${string}`;
|
|
1669
1842
|
currencies: {
|
|
@@ -1671,7 +1844,7 @@ declare class Zkp2pClient {
|
|
|
1671
1844
|
minConversionRate: bigint;
|
|
1672
1845
|
}[];
|
|
1673
1846
|
txOverrides?: TxOverrides;
|
|
1674
|
-
}
|
|
1847
|
+
}, `0x${string}`>;
|
|
1675
1848
|
/**
|
|
1676
1849
|
* Deactivates a currency for a payment method on a deposit.
|
|
1677
1850
|
*
|
|
@@ -1681,12 +1854,12 @@ declare class Zkp2pClient {
|
|
|
1681
1854
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1682
1855
|
* @returns Transaction hash
|
|
1683
1856
|
*/
|
|
1684
|
-
deactivateCurrency
|
|
1857
|
+
readonly deactivateCurrency: PrepareableMethod<{
|
|
1685
1858
|
depositId: bigint;
|
|
1686
1859
|
paymentMethod: `0x${string}`;
|
|
1687
1860
|
currencyCode: `0x${string}`;
|
|
1688
1861
|
txOverrides?: TxOverrides;
|
|
1689
|
-
}
|
|
1862
|
+
}, `0x${string}`>;
|
|
1690
1863
|
/**
|
|
1691
1864
|
* Removes (deactivates) a currency from a payment method.
|
|
1692
1865
|
* Alias for deactivateCurrency.
|
|
@@ -1697,12 +1870,12 @@ declare class Zkp2pClient {
|
|
|
1697
1870
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1698
1871
|
* @returns Transaction hash
|
|
1699
1872
|
*/
|
|
1700
|
-
removeCurrency
|
|
1873
|
+
readonly removeCurrency: PrepareableMethod<{
|
|
1701
1874
|
depositId: bigint;
|
|
1702
1875
|
paymentMethod: `0x${string}`;
|
|
1703
1876
|
currencyCode: `0x${string}`;
|
|
1704
1877
|
txOverrides?: TxOverrides;
|
|
1705
|
-
}
|
|
1878
|
+
}, `0x${string}`>;
|
|
1706
1879
|
/**
|
|
1707
1880
|
* Removes expired intents from a deposit, freeing up locked funds.
|
|
1708
1881
|
* Can be called by anyone (permissionless cleanup).
|
|
@@ -1711,10 +1884,10 @@ declare class Zkp2pClient {
|
|
|
1711
1884
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1712
1885
|
* @returns Transaction hash
|
|
1713
1886
|
*/
|
|
1714
|
-
pruneExpiredIntents
|
|
1887
|
+
readonly pruneExpiredIntents: PrepareableMethod<{
|
|
1715
1888
|
depositId: bigint;
|
|
1716
1889
|
txOverrides?: TxOverrides;
|
|
1717
|
-
}
|
|
1890
|
+
}, `0x${string}`>;
|
|
1718
1891
|
/**
|
|
1719
1892
|
* **Supporting Method** - Signals intent to use a deposit.
|
|
1720
1893
|
*
|
|
@@ -1729,6 +1902,13 @@ declare class Zkp2pClient {
|
|
|
1729
1902
|
* If `gatingServiceSignature` is not provided, the SDK will automatically
|
|
1730
1903
|
* fetch one from the API (requires `apiKey` or `authorizationToken`).
|
|
1731
1904
|
*
|
|
1905
|
+
* **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
|
|
1906
|
+
* ```typescript
|
|
1907
|
+
* const prepared = await client.signalIntent.prepare(params);
|
|
1908
|
+
* // Submit via relayer or inspect calldata
|
|
1909
|
+
* await relayer.submit({ to: prepared.to, data: prepared.data });
|
|
1910
|
+
* ```
|
|
1911
|
+
*
|
|
1732
1912
|
* @param params.depositId - The deposit to use
|
|
1733
1913
|
* @param params.amount - Amount of tokens to claim (in token units)
|
|
1734
1914
|
* @param params.toAddress - Address to receive the tokens when fulfilled
|
|
@@ -1747,6 +1927,7 @@ declare class Zkp2pClient {
|
|
|
1747
1927
|
*
|
|
1748
1928
|
* @example
|
|
1749
1929
|
* ```typescript
|
|
1930
|
+
* // Execute directly
|
|
1750
1931
|
* const hash = await client.signalIntent({
|
|
1751
1932
|
* depositId: 42n,
|
|
1752
1933
|
* amount: 100_000000n, // 100 USDC
|
|
@@ -1756,37 +1937,55 @@ declare class Zkp2pClient {
|
|
|
1756
1937
|
* fiatCurrencyCode: 'USD',
|
|
1757
1938
|
* conversionRate: 1_020000000000000000n, // 1.02
|
|
1758
1939
|
* });
|
|
1940
|
+
*
|
|
1941
|
+
* // Or prepare for relayer submission
|
|
1942
|
+
* const prepared = await client.signalIntent.prepare({
|
|
1943
|
+
* depositId: 42n,
|
|
1944
|
+
* amount: 100_000000n,
|
|
1945
|
+
* toAddress: '0x...',
|
|
1946
|
+
* processorName: 'wise',
|
|
1947
|
+
* payeeDetails: '0x...',
|
|
1948
|
+
* fiatCurrencyCode: 'USD',
|
|
1949
|
+
* conversionRate: 1_020000000000000000n,
|
|
1950
|
+
* });
|
|
1951
|
+
* // prepared.to, prepared.data, prepared.value, prepared.chainId
|
|
1759
1952
|
* ```
|
|
1760
1953
|
*/
|
|
1761
|
-
signalIntent
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
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>;
|
|
1954
|
+
readonly signalIntent: PrepareableMethod<SignalIntentMethodParams, Hash>;
|
|
1955
|
+
/**
|
|
1956
|
+
* Prepare signalIntent transaction (all logic except simulation/send).
|
|
1957
|
+
* Returns the prepared transaction with encoded calldata.
|
|
1958
|
+
*/
|
|
1959
|
+
private prepareSignalIntent;
|
|
1777
1960
|
/**
|
|
1778
1961
|
* **Supporting Method** - Cancels a signaled intent before fulfillment.
|
|
1779
1962
|
*
|
|
1780
1963
|
* Only the intent owner can cancel. Releases reserved funds back to the deposit.
|
|
1781
1964
|
*
|
|
1965
|
+
* **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
|
|
1966
|
+
* ```typescript
|
|
1967
|
+
* const prepared = await client.cancelIntent.prepare({ intentHash });
|
|
1968
|
+
* await relayer.submit({ to: prepared.to, data: prepared.data });
|
|
1969
|
+
* ```
|
|
1970
|
+
*
|
|
1782
1971
|
* @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
|
|
1783
1972
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1784
1973
|
* @returns Transaction hash
|
|
1974
|
+
*
|
|
1975
|
+
* @example
|
|
1976
|
+
* ```typescript
|
|
1977
|
+
* // Execute directly
|
|
1978
|
+
* const hash = await client.cancelIntent({ intentHash: '0x...' });
|
|
1979
|
+
*
|
|
1980
|
+
* // Or prepare for relayer submission
|
|
1981
|
+
* const prepared = await client.cancelIntent.prepare({ intentHash: '0x...' });
|
|
1982
|
+
* ```
|
|
1785
1983
|
*/
|
|
1786
|
-
cancelIntent
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1984
|
+
readonly cancelIntent: PrepareableMethod<CancelIntentMethodParams, Hash>;
|
|
1985
|
+
/**
|
|
1986
|
+
* Prepare cancelIntent transaction (all logic except simulation/send).
|
|
1987
|
+
*/
|
|
1988
|
+
private prepareCancelIntent;
|
|
1790
1989
|
/**
|
|
1791
1990
|
* **Supporting Method** - Releases funds back to the deposit owner.
|
|
1792
1991
|
*
|
|
@@ -1797,10 +1996,10 @@ declare class Zkp2pClient {
|
|
|
1797
1996
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1798
1997
|
* @returns Transaction hash
|
|
1799
1998
|
*/
|
|
1800
|
-
releaseFundsToPayer
|
|
1999
|
+
readonly releaseFundsToPayer: PrepareableMethod<{
|
|
1801
2000
|
intentHash: `0x${string}`;
|
|
1802
2001
|
txOverrides?: TxOverrides;
|
|
1803
|
-
}
|
|
2002
|
+
}, `0x${string}`>;
|
|
1804
2003
|
/**
|
|
1805
2004
|
* **Supporting Method** - Fulfills an intent by submitting a payment proof.
|
|
1806
2005
|
*
|
|
@@ -1817,6 +2016,13 @@ declare class Zkp2pClient {
|
|
|
1817
2016
|
* 3. Attestation response is encoded and submitted on-chain
|
|
1818
2017
|
* 4. Funds are released to the intent's `toAddress`
|
|
1819
2018
|
*
|
|
2019
|
+
* **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
|
|
2020
|
+
* ```typescript
|
|
2021
|
+
* const prepared = await client.fulfillIntent.prepare(params);
|
|
2022
|
+
* // Submit via relayer or inspect calldata
|
|
2023
|
+
* await relayer.submit({ to: prepared.to, data: prepared.data });
|
|
2024
|
+
* ```
|
|
2025
|
+
*
|
|
1820
2026
|
* @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
|
|
1821
2027
|
* @param params.proof - Payment proof from Reclaim (object or JSON string)
|
|
1822
2028
|
* @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
|
|
@@ -1826,21 +2032,29 @@ declare class Zkp2pClient {
|
|
|
1826
2032
|
* @param params.txOverrides - Optional viem transaction overrides
|
|
1827
2033
|
* @param params.callbacks - Lifecycle callbacks for UI updates
|
|
1828
2034
|
* @returns Transaction hash
|
|
2035
|
+
*
|
|
2036
|
+
* @example
|
|
2037
|
+
* ```typescript
|
|
2038
|
+
* // Execute directly
|
|
2039
|
+
* const hash = await client.fulfillIntent({
|
|
2040
|
+
* intentHash: '0x...',
|
|
2041
|
+
* proof: proofFromExtension,
|
|
2042
|
+
* });
|
|
2043
|
+
*
|
|
2044
|
+
* // Or prepare for relayer submission
|
|
2045
|
+
* const prepared = await client.fulfillIntent.prepare({
|
|
2046
|
+
* intentHash: '0x...',
|
|
2047
|
+
* proof: proofFromExtension,
|
|
2048
|
+
* });
|
|
2049
|
+
* // prepared.to, prepared.data, prepared.value, prepared.chainId
|
|
2050
|
+
* ```
|
|
1829
2051
|
*/
|
|
1830
|
-
fulfillIntent
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
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>;
|
|
2052
|
+
readonly fulfillIntent: PrepareableMethod<FulfillIntentMethodParams, Hash>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Prepare fulfillIntent transaction (all logic except simulation/send).
|
|
2055
|
+
* Includes fetching intent inputs and calling attestation service.
|
|
2056
|
+
*/
|
|
2057
|
+
private prepareFulfillIntent;
|
|
1844
2058
|
private defaultAttestationService;
|
|
1845
2059
|
/**
|
|
1846
2060
|
* **Supporting Method** - Fetches quotes for available liquidity.
|
|
@@ -1979,4 +2193,4 @@ declare class Zkp2pClient {
|
|
|
1979
2193
|
}>;
|
|
1980
2194
|
}
|
|
1981
2195
|
|
|
1982
|
-
export { type
|
|
2196
|
+
export { type RegisterPayeeDetailsRequest as $, type ActionCallback as A, type DepositVerifierCurrency as B, type CancelIntentMethodParams as C, type DepositWithRelations as D, type DepositStatus 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 GetOwnerDepositsRequest as d, type GetOwnerDepositsResponse as e, type GetTakerTierRequest as f, type GetTakerTierResponse as g, type PaymentMethodCatalog as h, type Zkp2pClientOptions as i, type TimeoutConfig as j, type CreateDepositParams as k, type CreateDepositConversionRate as l, type SignalIntentParams as m, type FulfillIntentParams as n, type ReleaseFundsToPayerParams as o, type CancelIntentParams as p, type QuoteResponse as q, type QuoteResponseObject as r, type QuoteSingleResponse as s, type QuoteIntentResponse as t, type QuoteFeesResponse as u, type FiatResponse as v, type TokenResponse as w, type NearbySuggestions as x, type ApiDeposit as y, type DepositVerifier as z };
|