@directcryptopay/sdk 0.2.3 → 0.3.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.
- package/README.md +51 -87
- package/dist/core/config.d.ts +9 -46
- package/dist/core/iframe.d.ts +16 -0
- package/dist/dcp-sdk.umd.js +1 -12811
- package/dist/dcp.d.ts +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -2
- package/dist/types.d.ts +26 -164
- package/package.json +3 -13
- package/dist/ExchangeController-CPMQq6Q-.js +0 -217
- package/dist/HelpersUtil-DfMFC7Bf.js +0 -120
- package/dist/NavigationUtil-kj9LEOOd.js +0 -8
- package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
- package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
- package/dist/PhArrowDown-C9AkNvLs.js +0 -73
- package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
- package/dist/PhArrowRight-DM1tna0G.js +0 -73
- package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
- package/dist/PhArrowUp-DmktzOWy.js +0 -73
- package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
- package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
- package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
- package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
- package/dist/PhBank-4_9QzqIB.js +0 -73
- package/dist/PhBrowser-B-JSznId.js +0 -73
- package/dist/PhCaretDown-vV5oHMNi.js +0 -73
- package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
- package/dist/PhCaretRight-CqQN4TT3.js +0 -73
- package/dist/PhCaretUp-Df7UCAHy.js +0 -73
- package/dist/PhCheck-gtpfK4ed.js +0 -73
- package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
- package/dist/PhClock-SDCW-NmF.js +0 -73
- package/dist/PhCompass-B7hgtdx-.js +0 -73
- package/dist/PhCopy-BcnhyXCy.js +0 -73
- package/dist/PhCreditCard-BJjByVgu.js +0 -73
- package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
- package/dist/PhDesktop-B3VKPuJx.js +0 -73
- package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
- package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
- package/dist/PhEnvelope-67uzHbI9.js +0 -73
- package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
- package/dist/PhGlobe-TMm_6qGk.js +0 -73
- package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
- package/dist/PhImage-gY96WtHR.js +0 -73
- package/dist/PhInfo-DRQM_ZDP.js +0 -73
- package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
- package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
- package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
- package/dist/PhPlus-BfTsQnUz.js +0 -73
- package/dist/PhPower-CxYUGOWn.js +0 -73
- package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
- package/dist/PhQrCode-BuJ97NYJ.js +0 -73
- package/dist/PhQuestion-kJoP8Mja.js +0 -73
- package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
- package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
- package/dist/PhSignOut-jk97OSVt.js +0 -73
- package/dist/PhSpinner-CiYOhwMg.js +0 -73
- package/dist/PhTrash-pxerMqzd.js +0 -73
- package/dist/PhUser-BMg0VV4A.js +0 -73
- package/dist/PhVault-DYQvx5A-.js +0 -73
- package/dist/PhWarning-NLC5Mj87.js +0 -73
- package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
- package/dist/PhX-Bx4wpwm3.js +0 -73
- package/dist/SwapController-Cti0Cyxa.js +0 -457
- package/dist/ccip-CKZd2XJ7.js +0 -150
- package/dist/core/api.d.ts +0 -39
- package/dist/core/logic.d.ts +0 -2
- package/dist/core/wallet.d.ts +0 -55
- package/dist/data-capture-7D5CL385.js +0 -490
- package/dist/email-AmK0INbZ.js +0 -344
- package/dist/embedded-wallet-Pn0I_XLn.js +0 -820
- package/dist/features-x8XNprEe.js +0 -274
- package/dist/hashTypedData-B50-z0AA.js +0 -197
- package/dist/if-defined-CdZSZ6UL.js +0 -10
- package/dist/index-4ewUtPPp.js +0 -7981
- package/dist/index-51l86yqx.js +0 -276
- package/dist/index-B6K56LF_.js +0 -85
- package/dist/index-BAmv9PxJ.js +0 -257
- package/dist/index-BEswjY9r.js +0 -117
- package/dist/index-BSKRq56S.js +0 -355
- package/dist/index-BaygXQxx.js +0 -172
- package/dist/index-BcPxaHr5.js +0 -118
- package/dist/index-Bjt7nGaJ.js +0 -199
- package/dist/index-BkTSyAJb.js +0 -21991
- package/dist/index-Bmnl7l2U.js +0 -555
- package/dist/index-BvPvouSq.js +0 -56
- package/dist/index-C-6iznUO.js +0 -174
- package/dist/index-C1QEJL-2.js +0 -572
- package/dist/index-C4M5s_AM.js +0 -228
- package/dist/index-CEqcN8QP.js +0 -1175
- package/dist/index-CM3YaYca.js +0 -8189
- package/dist/index-CclBLA5r.js +0 -517
- package/dist/index-ChTxJOiF.js +0 -46
- package/dist/index-CmAv0Tzr.js +0 -86
- package/dist/index-CmvoKY4x.js +0 -125
- package/dist/index-D7PmdQ9B.js +0 -1750
- package/dist/index-D7k2Pc4e.js +0 -1083
- package/dist/index-D7lmgqUR.js +0 -153
- package/dist/index-DG_-qYze.js +0 -107
- package/dist/index-DHot9Fdb.js +0 -218
- package/dist/index-DV2LrPtU.js +0 -123
- package/dist/index-DYBaJQ2W.js +0 -65
- package/dist/index-D_8VUmn1.js +0 -41543
- package/dist/index-D_gLn3rT.js +0 -100
- package/dist/index-DqcVUSC9.js +0 -62
- package/dist/index-I7VDqINw.js +0 -128
- package/dist/index-Oz72I9VP.js +0 -209
- package/dist/index-UclsHkJ0.js +0 -118
- package/dist/index-X8zir_1j.js +0 -110
- package/dist/index-XvlWKGCu.js +0 -1281
- package/dist/index-dO97xPlt.js +0 -171
- package/dist/index-uBeF6OAB.js +0 -387
- package/dist/index-zeA_RiCV.js +0 -159
- package/dist/localBatchGatewayRequest-BUZHGdjw.js +0 -91
- package/dist/onramp-CdnBuF0r.js +0 -855
- package/dist/parseSignature-CcyTNGr4.js +0 -3304
- package/dist/pay-with-exchange-CSM6WCOV.js +0 -525
- package/dist/property-Bd8U3_QP.js +0 -618
- package/dist/receive-DooMu4Dx.js +0 -232
- package/dist/ref-CpgjXAw7.js +0 -107
- package/dist/send-3T7CyYic.js +0 -1166
- package/dist/socials-Dt-iHL17.js +0 -620
- package/dist/swaps-CjA9Es42.js +0 -1760
- package/dist/transactions-nRm9DVzn.js +0 -37
- package/dist/ui/Modal.d.ts +0 -9
- package/dist/ui/index.d.ts +0 -6
- package/dist/w3m-modal-NV25AXhM.js +0 -1706
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ Official SDK for DirectCryptoPay — accept crypto payments directly to your wal
|
|
|
6
6
|
|
|
7
7
|
- **Non-custodial** — Funds go directly from customer wallet to yours
|
|
8
8
|
- **Multi-chain** — Ethereum, Polygon, BNB Chain, Base, Arbitrum, Optimism (mainnet + testnet)
|
|
9
|
-
- **
|
|
10
|
-
- **WalletConnect support** — MetaMask, Rabby, WalletConnect, and 300+ wallets
|
|
9
|
+
- **Lightweight** — ~5 KB bundle, opens checkout in an iframe overlay (like Stripe Checkout)
|
|
10
|
+
- **WalletConnect support** — MetaMask, Rabby, WalletConnect, and 300+ wallets
|
|
11
11
|
- **Two payment modes** — Tool-based (pre-configured) or Integration-based (dynamic amounts)
|
|
12
12
|
- **TypeScript-first** — Full type safety with exported types
|
|
13
13
|
|
|
@@ -25,13 +25,14 @@ yarn add @directcryptopay/sdk
|
|
|
25
25
|
|
|
26
26
|
### 1. Initialize the SDK
|
|
27
27
|
|
|
28
|
-
Call `DCP.init()` once when your app loads.
|
|
28
|
+
Call `DCP.init()` once when your app loads.
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
31
|
import { DCP } from '@directcryptopay/sdk';
|
|
32
32
|
|
|
33
33
|
DCP.init({
|
|
34
|
-
|
|
34
|
+
// Optional: defaults to 'https://directcryptopay.com'
|
|
35
|
+
// checkoutUrl: 'https://preview.directcryptopay.com',
|
|
35
36
|
});
|
|
36
37
|
```
|
|
37
38
|
|
|
@@ -44,7 +45,7 @@ DCP.pay({
|
|
|
44
45
|
toolId: 'your-tool-id', // From Dashboard > Payment Tools > Get Code
|
|
45
46
|
callbacks: {
|
|
46
47
|
onSuccess: (data) => {
|
|
47
|
-
console.log('Payment confirmed:', data);
|
|
48
|
+
console.log('Payment confirmed:', data.txHash);
|
|
48
49
|
},
|
|
49
50
|
onError: (error) => {
|
|
50
51
|
console.error('Payment failed:', error);
|
|
@@ -75,87 +76,61 @@ Initialize the SDK. Must be called once before `pay()` or `Payment()`.
|
|
|
75
76
|
|
|
76
77
|
```typescript
|
|
77
78
|
DCP.init({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
gasWarningThreshold?: number; // Gas warning % threshold (default: 15)
|
|
82
|
-
env?: 'test' | 'prod'; // Environment hint
|
|
79
|
+
checkoutUrl?: string; // Default: 'https://directcryptopay.com'
|
|
80
|
+
projectId?: string; // Deprecated — no longer needed
|
|
81
|
+
env?: 'test' | 'prod';
|
|
83
82
|
});
|
|
84
83
|
```
|
|
85
84
|
|
|
86
85
|
### `DCP.pay(options)`
|
|
87
86
|
|
|
88
|
-
Open the
|
|
87
|
+
Open the checkout iframe for a pre-configured Payment Tool.
|
|
89
88
|
|
|
90
89
|
```typescript
|
|
91
90
|
DCP.pay({
|
|
92
|
-
toolId: string;
|
|
93
|
-
amountUsd?: number;
|
|
94
|
-
|
|
95
|
-
chainId?: number; // Pre-select chain
|
|
96
|
-
metadata?: Record<string, string>; // Custom metadata
|
|
97
|
-
callbacks?: PaymentCallbacks; // Event handlers
|
|
91
|
+
toolId: string; // Required — Payment Tool ID
|
|
92
|
+
amountUsd?: number; // Override USD amount (for donations)
|
|
93
|
+
callbacks?: PaymentCallbacks;
|
|
98
94
|
});
|
|
99
95
|
```
|
|
100
96
|
|
|
101
97
|
### `DCP.Payment(options)`
|
|
102
98
|
|
|
103
|
-
Open the
|
|
99
|
+
Open the checkout iframe for an Integration-based payment.
|
|
104
100
|
|
|
105
101
|
```typescript
|
|
106
102
|
DCP.Payment({
|
|
107
103
|
integrationId: string; // Required — Integration public ID
|
|
108
104
|
amount_usd?: string; // Amount in USD (e.g., '49.99')
|
|
109
105
|
amount?: string | number; // OR amount in token units (not both)
|
|
110
|
-
currency?: string; // Pre-select token (skips selector
|
|
106
|
+
currency?: string; // Pre-select token (skips selector)
|
|
111
107
|
chainId?: number; // Pre-select chain
|
|
112
108
|
metadata?: Record<string, any>; // Custom metadata
|
|
113
|
-
callbacks?: PaymentCallbacks;
|
|
109
|
+
callbacks?: PaymentCallbacks;
|
|
114
110
|
});
|
|
115
111
|
```
|
|
116
112
|
|
|
117
113
|
> **Note:** Provide either `amount_usd` or `amount`, not both.
|
|
118
114
|
|
|
115
|
+
### `DCP.close()`
|
|
116
|
+
|
|
117
|
+
Programmatically close the checkout iframe.
|
|
118
|
+
|
|
119
119
|
### Callbacks
|
|
120
120
|
|
|
121
121
|
All callbacks are optional.
|
|
122
122
|
|
|
123
123
|
```typescript
|
|
124
124
|
interface PaymentCallbacks {
|
|
125
|
-
onOpen?: () => void;
|
|
126
|
-
onClose?: () => void;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
onError?: (error: Error) => void; // Error occurred
|
|
125
|
+
onOpen?: () => void; // Iframe opened
|
|
126
|
+
onClose?: () => void; // Iframe closed
|
|
127
|
+
onTxSubmitted?: (txHash: string) => void; // Transaction sent
|
|
128
|
+
onSuccess?: (data: { txHash: string; intentId?: string }) => void; // Payment confirmed
|
|
129
|
+
onCancel?: () => void; // User cancelled
|
|
130
|
+
onError?: (error: Error) => void; // Error occurred
|
|
132
131
|
}
|
|
133
132
|
```
|
|
134
133
|
|
|
135
|
-
### Payment Status
|
|
136
|
-
|
|
137
|
-
Real-time status updates via `onStatus`:
|
|
138
|
-
|
|
139
|
-
```typescript
|
|
140
|
-
type PaymentStatus =
|
|
141
|
-
| { type: 'fetching_tool_data' }
|
|
142
|
-
| { type: 'fetching_token_balances' }
|
|
143
|
-
| { type: 'awaiting_token_selection' }
|
|
144
|
-
| { type: 'creating_payment_intent' }
|
|
145
|
-
| { type: 'estimating_gas' }
|
|
146
|
-
| { type: 'gas_estimated'; estimate: GasEstimate }
|
|
147
|
-
| { type: 'awaiting_wallet_connection' }
|
|
148
|
-
| { type: 'wallet_connected'; address: string }
|
|
149
|
-
| { type: 'awaiting_signature' }
|
|
150
|
-
| { type: 'transaction_submitted'; txHash: string }
|
|
151
|
-
| { type: 'confirming'; txHash: string; confirmations: number }
|
|
152
|
-
| { type: 'verifying'; txHash: string; paymentId: string }
|
|
153
|
-
| { type: 'confirmed'; txHash: string; paymentId?: string }
|
|
154
|
-
| { type: 'failed'; error: Error }
|
|
155
|
-
| { type: 'rejected' }
|
|
156
|
-
| { type: 'cancelled' };
|
|
157
|
-
```
|
|
158
|
-
|
|
159
134
|
## Framework Examples
|
|
160
135
|
|
|
161
136
|
### Next.js (App Router)
|
|
@@ -167,12 +142,11 @@ type PaymentStatus =
|
|
|
167
142
|
'use client';
|
|
168
143
|
|
|
169
144
|
import { useEffect } from 'react';
|
|
170
|
-
import { DCP } from '@directcryptopay/sdk';
|
|
171
145
|
|
|
172
146
|
export function DCPProvider({ children }: { children: React.ReactNode }) {
|
|
173
147
|
useEffect(() => {
|
|
174
|
-
|
|
175
|
-
|
|
148
|
+
import('@directcryptopay/sdk').then(({ DCP }) => {
|
|
149
|
+
DCP.init({});
|
|
176
150
|
});
|
|
177
151
|
}, []);
|
|
178
152
|
|
|
@@ -204,7 +178,6 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
204
178
|
'use client';
|
|
205
179
|
|
|
206
180
|
import { useState } from 'react';
|
|
207
|
-
import { DCP } from '@directcryptopay/sdk';
|
|
208
181
|
|
|
209
182
|
export function PayButton({ toolId, label = 'Pay with Crypto' }: {
|
|
210
183
|
toolId: string;
|
|
@@ -212,19 +185,14 @@ export function PayButton({ toolId, label = 'Pay with Crypto' }: {
|
|
|
212
185
|
}) {
|
|
213
186
|
const [status, setStatus] = useState<string | null>(null);
|
|
214
187
|
|
|
215
|
-
const handlePay = () => {
|
|
188
|
+
const handlePay = async () => {
|
|
216
189
|
setStatus('pending');
|
|
190
|
+
const { DCP } = await import('@directcryptopay/sdk');
|
|
217
191
|
DCP.pay({
|
|
218
192
|
toolId,
|
|
219
193
|
callbacks: {
|
|
220
|
-
onSuccess: (
|
|
221
|
-
|
|
222
|
-
console.log('Payment confirmed:', data);
|
|
223
|
-
},
|
|
224
|
-
onError: (error) => {
|
|
225
|
-
setStatus('failed');
|
|
226
|
-
console.error('Payment failed:', error);
|
|
227
|
-
},
|
|
194
|
+
onSuccess: () => setStatus('confirmed'),
|
|
195
|
+
onError: () => setStatus('failed'),
|
|
228
196
|
onClose: () => setStatus(null),
|
|
229
197
|
}
|
|
230
198
|
});
|
|
@@ -245,7 +213,7 @@ export function PayButton({ toolId, label = 'Pay with Crypto' }: {
|
|
|
245
213
|
<script type="module">
|
|
246
214
|
import { DCP } from 'https://unpkg.com/@directcryptopay/sdk/dist/index.js';
|
|
247
215
|
|
|
248
|
-
DCP.init({
|
|
216
|
+
DCP.init({});
|
|
249
217
|
|
|
250
218
|
document.getElementById('pay-btn').addEventListener('click', () => {
|
|
251
219
|
DCP.pay({
|
|
@@ -259,35 +227,32 @@ export function PayButton({ toolId, label = 'Pay with Crypto' }: {
|
|
|
259
227
|
</script>
|
|
260
228
|
```
|
|
261
229
|
|
|
262
|
-
##
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
| Polygon Amoy | 80002 | Testnet |
|
|
274
|
-
| BNB Testnet | 97 | Testnet |
|
|
275
|
-
| Base Sepolia | 84532 | Testnet |
|
|
276
|
-
| Arbitrum Sepolia | 421614 | Testnet |
|
|
277
|
-
| Optimism Sepolia | 11155420 | Testnet |
|
|
230
|
+
## How It Works
|
|
231
|
+
|
|
232
|
+
When `DCP.pay()` or `DCP.Payment()` is called, the SDK opens an iframe overlay pointing to the DirectCryptoPay checkout page. The checkout page handles:
|
|
233
|
+
|
|
234
|
+
1. Wallet connection (MetaMask, Rabby, WalletConnect, etc.)
|
|
235
|
+
2. Smart token detection and balance display
|
|
236
|
+
3. Network switching
|
|
237
|
+
4. Transaction signing and submission
|
|
238
|
+
5. On-chain verification
|
|
239
|
+
|
|
240
|
+
The SDK communicates with the iframe via `postMessage` and maps events to your callbacks. This architecture keeps the SDK lightweight (~5 KB) while providing the full checkout experience.
|
|
278
241
|
|
|
279
242
|
## Security
|
|
280
243
|
|
|
281
|
-
The frontend callbacks (`onSuccess`, `onError`) are for **UX purposes only
|
|
244
|
+
The frontend callbacks (`onSuccess`, `onError`) are for **UX purposes only**. For production apps, always verify payments server-side using [webhooks](https://docs.directcryptopay.com).
|
|
282
245
|
|
|
283
246
|
DirectCryptoPay is non-custodial: transactions go directly from the customer's wallet to your wallet address. No funds are held by DirectCryptoPay at any point.
|
|
284
247
|
|
|
285
|
-
##
|
|
248
|
+
## Migrating from v0.2.x
|
|
286
249
|
|
|
287
|
-
|
|
250
|
+
v0.3.0 is a major refactor. The public API is the same, but:
|
|
288
251
|
|
|
289
|
-
-
|
|
290
|
-
-
|
|
252
|
+
- `DCP.init({ projectId })` — `projectId` is no longer required (can be omitted)
|
|
253
|
+
- `DCP.init({ checkoutUrl })` — new option to customize checkout URL
|
|
254
|
+
- `onStatus` callback removed — use `onTxSubmitted` and `onSuccess` instead
|
|
255
|
+
- Bundle size reduced from ~3 MB to ~5 KB
|
|
291
256
|
|
|
292
257
|
## Links
|
|
293
258
|
|
|
@@ -295,7 +260,6 @@ Both testnet and mainnet are available on every account from day one. Test with:
|
|
|
295
260
|
- **Dashboard:** [directcryptopay.com/dashboard](https://directcryptopay.com/dashboard)
|
|
296
261
|
- **Documentation:** [docs.directcryptopay.com](https://docs.directcryptopay.com)
|
|
297
262
|
- **API Docs:** [api.directcryptopay.com/api/docs](https://api.directcryptopay.com/api/docs)
|
|
298
|
-
- **Discord:** [discord.com/invite/PPdJNkXh](https://discord.com/invite/PPdJNkXh)
|
|
299
263
|
- **GitHub:** [github.com/directcryptopay](https://github.com/directcryptopay)
|
|
300
264
|
|
|
301
265
|
## License
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,59 +1,22 @@
|
|
|
1
|
-
export interface NetworkConfig {
|
|
2
|
-
chainId: number;
|
|
3
|
-
name: string;
|
|
4
|
-
currency: string;
|
|
5
|
-
isTestnet: boolean;
|
|
6
|
-
rpcUrl: string;
|
|
7
|
-
explorerUrl: string;
|
|
8
|
-
}
|
|
9
1
|
export interface DCPInitConfig {
|
|
2
|
+
/** Checkout page base URL. Default: 'https://directcryptopay.com' */
|
|
3
|
+
checkoutUrl?: string;
|
|
4
|
+
/** @deprecated No longer needed — wallet connection happens inside iframe */
|
|
5
|
+
projectId?: string;
|
|
6
|
+
/** @deprecated Use checkoutUrl instead */
|
|
10
7
|
apiUrl?: string;
|
|
8
|
+
/** @deprecated Use checkoutUrl instead */
|
|
11
9
|
widgetUrl?: string;
|
|
12
|
-
projectId: string;
|
|
13
10
|
env?: 'test' | 'prod';
|
|
14
|
-
defaultChainId?: number;
|
|
15
|
-
gasWarningThreshold?: number;
|
|
16
11
|
}
|
|
17
|
-
export interface DCPConfig
|
|
18
|
-
|
|
19
|
-
widgetUrl: string;
|
|
20
|
-
gasWarningThreshold: number;
|
|
12
|
+
export interface DCPConfig {
|
|
13
|
+
checkoutUrl: string;
|
|
21
14
|
}
|
|
22
15
|
declare class Config {
|
|
23
16
|
private config;
|
|
24
|
-
init(
|
|
17
|
+
init(userConfig: DCPInitConfig): void;
|
|
25
18
|
get(): DCPConfig;
|
|
26
19
|
isInitialized(): boolean;
|
|
27
20
|
}
|
|
28
21
|
export declare const config: Config;
|
|
29
|
-
export declare const NETWORKS: Record<number, NetworkConfig>;
|
|
30
|
-
export declare function getNetwork(chainId: number): NetworkConfig;
|
|
31
|
-
export declare const ERC20_ABI: readonly [{
|
|
32
|
-
readonly constant: false;
|
|
33
|
-
readonly inputs: readonly [{
|
|
34
|
-
readonly name: "_to";
|
|
35
|
-
readonly type: "address";
|
|
36
|
-
}, {
|
|
37
|
-
readonly name: "_value";
|
|
38
|
-
readonly type: "uint256";
|
|
39
|
-
}];
|
|
40
|
-
readonly name: "transfer";
|
|
41
|
-
readonly outputs: readonly [{
|
|
42
|
-
readonly name: "";
|
|
43
|
-
readonly type: "bool";
|
|
44
|
-
}];
|
|
45
|
-
readonly type: "function";
|
|
46
|
-
}, {
|
|
47
|
-
readonly constant: true;
|
|
48
|
-
readonly inputs: readonly [{
|
|
49
|
-
readonly name: "_owner";
|
|
50
|
-
readonly type: "address";
|
|
51
|
-
}];
|
|
52
|
-
readonly name: "balanceOf";
|
|
53
|
-
readonly outputs: readonly [{
|
|
54
|
-
readonly name: "balance";
|
|
55
|
-
readonly type: "uint256";
|
|
56
|
-
}];
|
|
57
|
-
readonly type: "function";
|
|
58
|
-
}];
|
|
59
22
|
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface IframeCallbacks {
|
|
2
|
+
onReady?: () => void;
|
|
3
|
+
onTxSubmitted?: (txHash: string) => void;
|
|
4
|
+
onSuccess?: (data: {
|
|
5
|
+
txHash: string;
|
|
6
|
+
intentId?: string;
|
|
7
|
+
}) => void;
|
|
8
|
+
onError?: (error: string) => void;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
onCancel?: () => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Opens the DirectCryptoPay checkout page in an iframe overlay.
|
|
14
|
+
* Returns a cleanup function to programmatically close the overlay.
|
|
15
|
+
*/
|
|
16
|
+
export declare function openCheckoutIframe(url: string, callbacks?: IframeCallbacks): () => void;
|