Skip to content

Commit 75b9b83

Browse files
committed
Remove unused types
1 parent f8dac9a commit 75b9b83

File tree

2 files changed

+124
-310
lines changed

2 files changed

+124
-310
lines changed

src/plugins/ramps/infinite/infiniteApi.ts

Lines changed: 16 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
207207
.substring(7)}`
208208
const dummyResponse: InfiniteChallengeResponse = {
209209
nonce,
210-
message: `Sign this message to authenticate with Infinite Agents.\n\nPublicKey: ${publicKey}\nNonce: ${nonce}\nTimestamp: ${timestamp}`,
211-
domain: null,
212-
expires_at: timestamp + 300,
213-
expires_at_iso: new Date((timestamp + 300) * 1000).toISOString()
210+
message: `Sign this message to authenticate with Infinite Agents.\n\nPublicKey: ${publicKey}\nNonce: ${nonce}\nTimestamp: ${timestamp}`
214211
}
215212
return dummyResponse
216213
},
@@ -245,11 +242,9 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
245242
// Dummy response
246243
const dummyAuthResponse: InfiniteAuthResponse = {
247244
access_token: `dummy_token_${Date.now()}`,
248-
token_type: 'Bearer',
249245
expires_in: 3600,
250246
customer_id: `cust_${Math.random().toString(36).substring(7)}`,
251247
session_id: `sess_${Math.random().toString(36).substring(7)}`,
252-
platform: params.platform,
253248
onboarded: true
254249
}
255250

@@ -301,29 +296,13 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
301296
)
302297
}
303298

304-
const fee = Math.abs(sourceAmount - targetAmount)
305-
306299
const dummyResponse: InfiniteQuoteResponse = {
307-
quoteId: `quote_hls_${Date.now()}_${Math.random()
308-
.toString(36)
309-
.substring(7)}`,
310-
flow: params.flow,
311300
source: {
312-
asset: params.source.asset,
313-
amount: sourceAmount,
314-
network: params.source.network
301+
amount: sourceAmount
315302
},
316303
target: {
317-
asset: params.target.asset,
318-
amount: targetAmount,
319-
network: params.target.network
304+
amount: targetAmount
320305
},
321-
infiniteFee: fee * 0.5,
322-
edgeFee: fee * 0.5,
323-
// Headless quotes have simpler format
324-
fee: undefined,
325-
totalReceived: undefined,
326-
rate: undefined,
327306
expiresAt: undefined
328307
}
329308

@@ -359,56 +338,24 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
359338
// Dummy response - New format
360339
const dummyResponse: InfiniteTransferResponse = {
361340
id: `transfer_${params.type.toLowerCase()}_${Date.now()}`,
362-
type: params.type,
363-
status: 'AWAITING_FUNDS',
364-
stage: params.type === 'ONRAMP' ? 'awaiting_funds' : 'awaiting_funds',
365-
amount: params.amount,
366-
currency:
367-
params.type === 'ONRAMP'
368-
? 'USD'
369-
: params.destination.currency.toUpperCase(),
370-
source: {
371-
currency: params.source.currency,
372-
network: params.source.network,
373-
accountId: params.source.accountId ?? null,
374-
fromAddress: params.source.fromAddress ?? null
375-
},
376-
destination: {
377-
currency: params.destination.currency,
378-
network: params.destination.network,
379-
accountId: params.destination.accountId ?? null,
380-
toAddress: params.destination.toAddress ?? null
381-
},
382341
sourceDepositInstructions:
383342
params.type === 'ONRAMP'
384343
? {
385-
network: 'wire',
386-
currency: 'usd',
387344
amount: params.amount,
388-
depositMessage: `Your reference code is ${Date.now()}. Please include this code in your wire transfer.`,
389345
bankAccountNumber: '8312008517',
390346
bankRoutingNumber: '021000021',
391-
bankBeneficiaryName: 'Customer Bank Account',
392347
bankName: 'JPMorgan Chase Bank',
393-
toAddress: null,
394-
fromAddress: null
348+
toAddress: null
395349
}
396350
: {
397-
network: params.source.network,
398-
currency: params.source.currency,
399351
amount: params.amount,
400-
depositMessage: null,
401352
bankAccountNumber: null,
402353
bankRoutingNumber: null,
403-
bankBeneficiaryName: null,
404354
bankName: null,
405355
toAddress: `0xdeadbeef2${params.source.currency}${
406356
params.source.network
407-
}${Date.now().toString(16)}`,
408-
fromAddress: params.source.fromAddress ?? null
409-
},
410-
createdAt: new Date().toISOString(),
411-
updatedAt: new Date().toISOString()
357+
}${Date.now().toString(16)}`
358+
}
412359
}
413360

414361
return dummyResponse
@@ -435,26 +382,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
435382
// Dummy response - simulate a completed transfer
436383
const dummyResponse: InfiniteTransferResponse = {
437384
id: transferId,
438-
type: 'ONRAMP',
439-
status: 'COMPLETED',
440-
stage: 'completed',
441-
amount: 100.0,
442-
currency: 'USD',
443-
source: {
444-
currency: 'usd',
445-
network: 'wire',
446-
accountId: 'da4d1f78-7cdb-47a9-b577-8b4623901f03',
447-
fromAddress: null
448-
},
449-
destination: {
450-
currency: 'usdc',
451-
network: 'ethereum',
452-
accountId: null,
453-
toAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
454-
},
455-
sourceDepositInstructions: undefined,
456-
createdAt: new Date(Date.now() - 3600000).toISOString(),
457-
updatedAt: new Date().toISOString()
385+
sourceDepositInstructions: undefined
458386
}
459387

460388
return dummyResponse
@@ -489,11 +417,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
489417
id: `9b0d801f-41ac-4269-abec-${Date.now()
490418
.toString(16)
491419
.padStart(12, '0')
492-
.substring(0, 12)}`,
493-
type: params.type === 'individual' ? 'INDIVIDUAL' : 'BUSINESS',
494-
status: 'PENDING',
495-
countryCode: params.countryCode,
496-
createdAt: new Date().toISOString()
420+
.substring(0, 12)}`
497421
}
498422
}
499423

@@ -523,11 +447,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
523447
id: `9b0d801f-41ac-4269-abec-${Date.now()
524448
.toString(16)
525449
.padStart(12, '0')
526-
.substring(0, 12)}`,
527-
type: 'INDIVIDUAL',
528-
status: 'PENDING',
529-
countryCode: 'US',
530-
createdAt: new Date().toISOString()
450+
.substring(0, 12)}`
531451
}
532452
}
533453

@@ -570,11 +490,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
570490
}
571491

572492
const dummyResponse: InfiniteKycStatusResponse = {
573-
customerId,
574-
kycStatus,
575-
sessionStatus: kycStatus === 'ACTIVE' ? 'COMPLETED' : 'IN_PROGRESS',
576-
kycCompletedAt:
577-
kycStatus === 'ACTIVE' ? new Date().toISOString() : undefined
493+
kycStatus
578494
}
579495

580496
authState.kycStatus = dummyResponse.kycStatus
@@ -606,14 +522,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
606522
const dummyResponse: InfiniteKycLinkResponse = {
607523
url: `https://infinite.dev/kyc?session=kyc_sess_${Date.now()}&redirect=${encodeURIComponent(
608524
redirectUrl
609-
)}`,
610-
organizationName: 'Test Organization',
611-
branding: {
612-
primaryColor: '#8B9388',
613-
secondaryColor: '#2C2E2A',
614-
logoUrl: 'https://example.com/logo.png',
615-
companyName: 'Test Company'
616-
}
525+
)}`
617526
}
618527

619528
return dummyResponse
@@ -642,23 +551,8 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
642551
// Dummy response - transform cached bank accounts to new format
643552
const dummyResponse: InfiniteCustomerAccountsResponse = {
644553
accounts: bankAccountCache.map(account => ({
645-
id: account.id,
646-
type: 'EXTERNAL_BANK_ACCOUNT',
647-
status:
648-
account.verificationStatus === 'pending' ? 'PENDING' : 'ACTIVE',
649-
currency: 'USD',
650-
bankName: account.bankName,
651-
accountNumber: `****${account.last4}`,
652-
routingNumber: '****0021',
653-
accountType: 'checking',
654-
holderName: account.accountName,
655-
createdAt: new Date().toISOString(),
656-
metadata: {
657-
externalAccountId: `ext_acct_${Date.now()}`,
658-
verificationStatus: account.verificationStatus
659-
}
660-
})),
661-
totalCount: bankAccountCache.length
554+
id: account.id
555+
}))
662556
}
663557

664558
return dummyResponse
@@ -683,14 +577,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
683577

684578
// Dummy response
685579
const dummyResponse: InfiniteBankAccountResponse = {
686-
id: `acct_bank_${Date.now()}_${Math.random()
687-
.toString(36)
688-
.substring(7)}`,
689-
type: 'bank_account',
690-
bankName: params.bankName,
691-
accountName: params.accountName,
692-
last4: params.accountNumber.slice(-4),
693-
verificationStatus: 'pending'
580+
id: `acct_bank_${Date.now()}_${Math.random().toString(36).substring(7)}`
694581
}
695582

696583
// Add to cache
@@ -714,7 +601,6 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
714601
countries: [
715602
{
716603
code: 'US',
717-
name: 'United States',
718604
isAllowed: true,
719605
supportedFiatCurrencies: ['USD'],
720606
supportedPaymentMethods: {
@@ -750,40 +636,8 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
750636
networkCode: 'ETH',
751637
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
752638
confirmationsRequired: 12
753-
},
754-
{
755-
network: 'polygon',
756-
networkCode: 'POLYGON',
757-
contractAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
758-
confirmationsRequired: 30
759-
},
760-
{
761-
network: 'arbitrum',
762-
networkCode: 'ARB',
763-
contractAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
764-
confirmationsRequired: 1
765-
},
766-
{
767-
network: 'optimism',
768-
networkCode: 'OP',
769-
contractAddress: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
770-
confirmationsRequired: 1
771-
},
772-
{
773-
network: 'base',
774-
networkCode: 'BASE',
775-
contractAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
776-
confirmationsRequired: 1
777-
},
778-
{
779-
network: 'solana',
780-
networkCode: 'SOL',
781-
contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
782-
confirmationsRequired: 1
783639
}
784640
],
785-
supportedPaymentRails: undefined,
786-
countryCode: undefined,
787641
supportsOnRamp: true,
788642
supportsOffRamp: true,
789643
onRampCountries: ['US'],
@@ -797,15 +651,13 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
797651
name: 'US Dollar',
798652
type: 'fiat' as const,
799653
supportedNetworks: undefined,
800-
supportedPaymentRails: ['ach', 'wire'],
801-
countryCode: 'US',
802654
supportsOnRamp: undefined,
803655
supportsOffRamp: undefined,
804656
onRampCountries: undefined,
805657
offRampCountries: undefined,
806-
precision: 2,
807658
minAmount: '50',
808-
maxAmount: '50000'
659+
maxAmount: '50000',
660+
precision: 2
809661
},
810662
{
811663
code: 'BTC',
@@ -819,8 +671,6 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
819671
confirmationsRequired: 6
820672
}
821673
],
822-
supportedPaymentRails: undefined,
823-
countryCode: undefined,
824674
supportsOnRamp: true,
825675
supportsOffRamp: true,
826676
onRampCountries: ['US'],

0 commit comments

Comments
 (0)