Skip to content

Commit 6a45d41

Browse files
committed
Remove unused types
1 parent 1f400a0 commit 6a45d41

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
@@ -231,10 +231,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
231231
.substring(7)}`
232232
const dummyResponse: InfiniteChallengeResponse = {
233233
nonce,
234-
message: `Sign this message to authenticate with Infinite Agents.\n\nPublicKey: ${publicKey}\nNonce: ${nonce}\nTimestamp: ${timestamp}`,
235-
domain: null,
236-
expires_at: timestamp + 300,
237-
expires_at_iso: new Date((timestamp + 300) * 1000).toISOString()
234+
message: `Sign this message to authenticate with Infinite Agents.\n\nPublicKey: ${publicKey}\nNonce: ${nonce}\nTimestamp: ${timestamp}`
238235
}
239236
return dummyResponse
240237
},
@@ -269,11 +266,9 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
269266
// Dummy response
270267
const dummyAuthResponse: InfiniteAuthResponse = {
271268
access_token: `dummy_token_${Date.now()}`,
272-
token_type: 'Bearer',
273269
expires_in: 3600,
274270
customer_id: `cust_${Math.random().toString(36).substring(7)}`,
275271
session_id: `sess_${Math.random().toString(36).substring(7)}`,
276-
platform: params.platform,
277272
onboarded: true
278273
}
279274

@@ -325,29 +320,13 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
325320
)
326321
}
327322

328-
const fee = Math.abs(sourceAmount - targetAmount)
329-
330323
const dummyResponse: InfiniteQuoteResponse = {
331-
quoteId: `quote_hls_${Date.now()}_${Math.random()
332-
.toString(36)
333-
.substring(7)}`,
334-
flow: params.flow,
335324
source: {
336-
asset: params.source.asset,
337-
amount: sourceAmount,
338-
network: params.source.network
325+
amount: sourceAmount
339326
},
340327
target: {
341-
asset: params.target.asset,
342-
amount: targetAmount,
343-
network: params.target.network
328+
amount: targetAmount
344329
},
345-
infiniteFee: fee * 0.5,
346-
edgeFee: fee * 0.5,
347-
// Headless quotes have simpler format
348-
fee: undefined,
349-
totalReceived: undefined,
350-
rate: undefined,
351330
expiresAt: undefined
352331
}
353332

@@ -383,56 +362,24 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
383362
// Dummy response - New format
384363
const dummyResponse: InfiniteTransferResponse = {
385364
id: `transfer_${params.type.toLowerCase()}_${Date.now()}`,
386-
type: params.type,
387-
status: 'AWAITING_FUNDS',
388-
stage: params.type === 'ONRAMP' ? 'awaiting_funds' : 'awaiting_funds',
389-
amount: params.amount,
390-
currency:
391-
params.type === 'ONRAMP'
392-
? 'USD'
393-
: params.destination.currency.toUpperCase(),
394-
source: {
395-
currency: params.source.currency,
396-
network: params.source.network,
397-
accountId: params.source.accountId ?? null,
398-
fromAddress: params.source.fromAddress ?? null
399-
},
400-
destination: {
401-
currency: params.destination.currency,
402-
network: params.destination.network,
403-
accountId: params.destination.accountId ?? null,
404-
toAddress: params.destination.toAddress ?? null
405-
},
406365
sourceDepositInstructions:
407366
params.type === 'ONRAMP'
408367
? {
409-
network: 'wire',
410-
currency: 'usd',
411368
amount: params.amount,
412-
depositMessage: `Your reference code is ${Date.now()}. Please include this code in your wire transfer.`,
413369
bankAccountNumber: '8312008517',
414370
bankRoutingNumber: '021000021',
415-
bankBeneficiaryName: 'Customer Bank Account',
416371
bankName: 'JPMorgan Chase Bank',
417-
toAddress: null,
418-
fromAddress: null
372+
toAddress: null
419373
}
420374
: {
421-
network: params.source.network,
422-
currency: params.source.currency,
423375
amount: params.amount,
424-
depositMessage: null,
425376
bankAccountNumber: null,
426377
bankRoutingNumber: null,
427-
bankBeneficiaryName: null,
428378
bankName: null,
429379
toAddress: `0xdeadbeef2${params.source.currency}${
430380
params.source.network
431-
}${Date.now().toString(16)}`,
432-
fromAddress: params.source.fromAddress ?? null
433-
},
434-
createdAt: new Date().toISOString(),
435-
updatedAt: new Date().toISOString()
381+
}${Date.now().toString(16)}`
382+
}
436383
}
437384

438385
return dummyResponse
@@ -459,26 +406,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
459406
// Dummy response - simulate a completed transfer
460407
const dummyResponse: InfiniteTransferResponse = {
461408
id: transferId,
462-
type: 'ONRAMP',
463-
status: 'COMPLETED',
464-
stage: 'completed',
465-
amount: 100.0,
466-
currency: 'USD',
467-
source: {
468-
currency: 'usd',
469-
network: 'wire',
470-
accountId: 'da4d1f78-7cdb-47a9-b577-8b4623901f03',
471-
fromAddress: null
472-
},
473-
destination: {
474-
currency: 'usdc',
475-
network: 'ethereum',
476-
accountId: null,
477-
toAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
478-
},
479-
sourceDepositInstructions: undefined,
480-
createdAt: new Date(Date.now() - 3600000).toISOString(),
481-
updatedAt: new Date().toISOString()
409+
sourceDepositInstructions: undefined
482410
}
483411

484412
return dummyResponse
@@ -513,11 +441,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
513441
id: `9b0d801f-41ac-4269-abec-${Date.now()
514442
.toString(16)
515443
.padStart(12, '0')
516-
.substring(0, 12)}`,
517-
type: params.type === 'individual' ? 'INDIVIDUAL' : 'BUSINESS',
518-
status: 'PENDING',
519-
countryCode: params.countryCode,
520-
createdAt: new Date().toISOString()
444+
.substring(0, 12)}`
521445
}
522446
}
523447

@@ -547,11 +471,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
547471
id: `9b0d801f-41ac-4269-abec-${Date.now()
548472
.toString(16)
549473
.padStart(12, '0')
550-
.substring(0, 12)}`,
551-
type: 'INDIVIDUAL',
552-
status: 'PENDING',
553-
countryCode: 'US',
554-
createdAt: new Date().toISOString()
474+
.substring(0, 12)}`
555475
}
556476
}
557477

@@ -594,11 +514,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
594514
}
595515

596516
const dummyResponse: InfiniteKycStatusResponse = {
597-
customerId,
598-
kycStatus,
599-
sessionStatus: kycStatus === 'ACTIVE' ? 'COMPLETED' : 'IN_PROGRESS',
600-
kycCompletedAt:
601-
kycStatus === 'ACTIVE' ? new Date().toISOString() : undefined
517+
kycStatus
602518
}
603519

604520
authState.kycStatus = dummyResponse.kycStatus
@@ -630,14 +546,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
630546
const dummyResponse: InfiniteKycLinkResponse = {
631547
url: `https://infinite.dev/kyc?session=kyc_sess_${Date.now()}&redirect=${encodeURIComponent(
632548
redirectUrl
633-
)}`,
634-
organizationName: 'Test Organization',
635-
branding: {
636-
primaryColor: '#8B9388',
637-
secondaryColor: '#2C2E2A',
638-
logoUrl: 'https://example.com/logo.png',
639-
companyName: 'Test Company'
640-
}
549+
)}`
641550
}
642551

643552
return dummyResponse
@@ -666,23 +575,8 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
666575
// Dummy response - transform cached bank accounts to new format
667576
const dummyResponse: InfiniteCustomerAccountsResponse = {
668577
accounts: bankAccountCache.map(account => ({
669-
id: account.id,
670-
type: 'EXTERNAL_BANK_ACCOUNT',
671-
status:
672-
account.verificationStatus === 'pending' ? 'PENDING' : 'ACTIVE',
673-
currency: 'USD',
674-
bankName: account.bankName,
675-
accountNumber: `****${account.last4}`,
676-
routingNumber: '****0021',
677-
accountType: 'checking',
678-
holderName: account.accountName,
679-
createdAt: new Date().toISOString(),
680-
metadata: {
681-
externalAccountId: `ext_acct_${Date.now()}`,
682-
verificationStatus: account.verificationStatus
683-
}
684-
})),
685-
totalCount: bankAccountCache.length
578+
id: account.id
579+
}))
686580
}
687581

688582
return dummyResponse
@@ -707,14 +601,7 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
707601

708602
// Dummy response
709603
const dummyResponse: InfiniteBankAccountResponse = {
710-
id: `acct_bank_${Date.now()}_${Math.random()
711-
.toString(36)
712-
.substring(7)}`,
713-
type: 'bank_account',
714-
bankName: params.bankName,
715-
accountName: params.accountName,
716-
last4: params.accountNumber.slice(-4),
717-
verificationStatus: 'pending'
604+
id: `acct_bank_${Date.now()}_${Math.random().toString(36).substring(7)}`
718605
}
719606

720607
// Add to cache
@@ -738,7 +625,6 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
738625
countries: [
739626
{
740627
code: 'US',
741-
name: 'United States',
742628
isAllowed: true,
743629
supportedFiatCurrencies: ['USD'],
744630
supportedPaymentMethods: {
@@ -774,40 +660,8 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
774660
networkCode: 'ETH',
775661
contractAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
776662
confirmationsRequired: 12
777-
},
778-
{
779-
network: 'polygon',
780-
networkCode: 'POLYGON',
781-
contractAddress: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
782-
confirmationsRequired: 30
783-
},
784-
{
785-
network: 'arbitrum',
786-
networkCode: 'ARB',
787-
contractAddress: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
788-
confirmationsRequired: 1
789-
},
790-
{
791-
network: 'optimism',
792-
networkCode: 'OP',
793-
contractAddress: '0x7F5c764cBc14f9669B88837ca1490cCa17c31607',
794-
confirmationsRequired: 1
795-
},
796-
{
797-
network: 'base',
798-
networkCode: 'BASE',
799-
contractAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
800-
confirmationsRequired: 1
801-
},
802-
{
803-
network: 'solana',
804-
networkCode: 'SOL',
805-
contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
806-
confirmationsRequired: 1
807663
}
808664
],
809-
supportedPaymentRails: undefined,
810-
countryCode: undefined,
811665
supportsOnRamp: true,
812666
supportsOffRamp: true,
813667
onRampCountries: ['US'],
@@ -821,15 +675,13 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
821675
name: 'US Dollar',
822676
type: 'fiat' as const,
823677
supportedNetworks: undefined,
824-
supportedPaymentRails: ['ach', 'wire'],
825-
countryCode: 'US',
826678
supportsOnRamp: undefined,
827679
supportsOffRamp: undefined,
828680
onRampCountries: undefined,
829681
offRampCountries: undefined,
830-
precision: 2,
831682
minAmount: '50',
832-
maxAmount: '50000'
683+
maxAmount: '50000',
684+
precision: 2
833685
},
834686
{
835687
code: 'BTC',
@@ -843,8 +695,6 @@ export const makeInfiniteApi = (config: InfiniteApiConfig): InfiniteApi => {
843695
confirmationsRequired: 6
844696
}
845697
],
846-
supportedPaymentRails: undefined,
847-
countryCode: undefined,
848698
supportsOnRamp: true,
849699
supportsOffRamp: true,
850700
onRampCountries: ['US'],

0 commit comments

Comments
 (0)