@portal-hq/web 3.8.0 → 3.9.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.
@@ -0,0 +1,530 @@
1
+ /**
2
+ * Blockaid integration types
3
+ *
4
+ * Types for Blockaid security scanning and validation services
5
+ */
6
+
7
+ export type BlockaidValidationResultType = 'Benign' | 'Warning' | 'Malicious'
8
+
9
+ export interface BlockaidValidation {
10
+ classification?: string | null
11
+ description?: string | null
12
+ features: {
13
+ type: 'Malicious' | 'Warning' | 'Benign' | 'Info'
14
+ feature_id: string
15
+ description: string
16
+ address?: string | null
17
+ metadata?: Record<string, any> | null
18
+ }[]
19
+ reason?: string | null
20
+ result_type: BlockaidValidationResultType
21
+ status: string
22
+ error?: string | null
23
+ }
24
+
25
+ export interface BlockaidAssetDiff {
26
+ asset: Record<string, any>
27
+ in: Record<string, any>[]
28
+ out: Record<string, any>[]
29
+ asset_type?: string | null
30
+ }
31
+
32
+ export interface BlockaidSimulation {
33
+ account_address: string
34
+ account_summary: Record<string, any>
35
+ address_details: Record<string, any>
36
+ assets_diffs: Record<string, BlockaidAssetDiff[]>
37
+ block: number
38
+ chain: string
39
+ exposures: Record<string, any>
40
+ status: string
41
+ total_usd_diff: Record<string, any>
42
+ total_usd_exposure: Record<string, any>
43
+ transaction_action: string
44
+ session_key: Record<string, any>
45
+ params?: Record<string, any> | null
46
+ contract_management?: Record<string, any> | null
47
+ missing_balances?: Record<string, any>[] | null
48
+ simulation_run_count?: number | null
49
+ }
50
+
51
+ // Validation options for the scan
52
+ export type BlockaidValidationOption =
53
+ | 'validation'
54
+ | 'simulation'
55
+ | 'gas_estimation'
56
+ | 'events'
57
+
58
+ // EIP-7702 Authorization for transaction
59
+ export interface BlockaidAuthorization {
60
+ address: string
61
+ chainId?: string
62
+ nonce?: string
63
+ yParity?: string
64
+ r?: string
65
+ s?: string
66
+ eoa?: string
67
+ }
68
+
69
+ // Transaction data object
70
+ export interface BlockaidScanEvmTxData {
71
+ from: string
72
+ to?: string
73
+ data?: string
74
+ value?: string
75
+ gas?: string
76
+ gas_price?: string
77
+ authorization_list?: BlockaidAuthorization[]
78
+ }
79
+
80
+ // Metadata when transaction is initiated by a dApp
81
+ export interface BlockaidMetadataDapp {
82
+ domain: string
83
+ }
84
+
85
+ // Metadata when transaction is not initiated by a dApp
86
+ export interface BlockaidMetadataNonDapp {
87
+ non_dapp?: boolean
88
+ }
89
+
90
+ // State override for testing purposes
91
+ export interface BlockaidAddressStateOverride {
92
+ balance?: string
93
+ nonce?: string
94
+ code?: string
95
+ state?: Record<string, string>
96
+ stateDiff?: Record<string, string>
97
+ movePrecompileToAddress?: string
98
+ }
99
+
100
+ // Main request type for scanning EVM transactions
101
+ export interface BlockaidScanEvmTxRequest {
102
+ chain: string
103
+ data: BlockaidScanEvmTxData
104
+ metadata?: BlockaidMetadataDapp | BlockaidMetadataNonDapp
105
+ account_address: string
106
+ options?: BlockaidValidationOption[]
107
+ block?: number | string
108
+ state_override?: Record<string, BlockaidAddressStateOverride>
109
+ simulate_with_estimated_gas?: boolean
110
+ }
111
+
112
+ // Event emitted during transaction scan
113
+ export interface BlockaidTransactionScanEvent {
114
+ emitter_address: string
115
+ emitter_name?: string
116
+ name?: string
117
+ params?: BlockaidTransactionScanLogParamInfo[]
118
+ topics: string[]
119
+ data: string
120
+ }
121
+
122
+ export interface BlockaidTransactionScanLogParamInfo {
123
+ type: string
124
+ value: string | Record<string, any> | any[]
125
+ internalType?: string
126
+ name?: string
127
+ }
128
+
129
+ export interface BlockaidTransactionScanGasEstimation {
130
+ status: 'Success'
131
+ used: string
132
+ estimate: string
133
+ }
134
+
135
+ export interface BlockaidTransactionScanGasEstimationError {
136
+ status: 'Error'
137
+ error: string
138
+ }
139
+
140
+ export interface BlockaidUserOperationGasEstimation {
141
+ status: 'Success'
142
+ pre_verification_gas_estimate: string
143
+ verification_gas_estimate: string
144
+ call_gas_estimate: string
145
+ paymaster_verification_gas_estimate?: string
146
+ }
147
+
148
+ // Response type for scanning EVM transactions
149
+ export interface BlockaidScanEvmTxResponse {
150
+ data: {
151
+ rawResponse: {
152
+ validation?: BlockaidValidation
153
+ simulation?: BlockaidSimulation
154
+ events?: BlockaidTransactionScanEvent[]
155
+ gas_estimation?:
156
+ | BlockaidTransactionScanGasEstimation
157
+ | BlockaidTransactionScanGasEstimationError
158
+ user_operation_gas_estimation?:
159
+ | BlockaidUserOperationGasEstimation
160
+ | BlockaidTransactionScanGasEstimationError
161
+ features?: Record<string, any>
162
+ block: string
163
+ chain: string
164
+ account_address?: string
165
+ }
166
+ }
167
+ }
168
+
169
+ export type BlockaidSolanaChain =
170
+ | 'mainnet'
171
+ | 'testnet'
172
+ | 'devnet'
173
+ | 'eclipse_mainnet'
174
+ | 'eclipse_devnet'
175
+ | 'sonic_mainnet'
176
+
177
+ export type BlockaidSolanaOptions = 'validation' | 'simulation'
178
+
179
+ export interface BlockaidSolanaRequestMetadata {
180
+ url?: string | null
181
+ }
182
+
183
+ export type BlockaidSolanaEncoding = 'base58' | 'base64'
184
+
185
+ export interface BlockaidScanSolanaTxRequest {
186
+ account_address: string
187
+ transactions: string[]
188
+ metadata?: BlockaidSolanaRequestMetadata
189
+ encoding?: BlockaidSolanaEncoding
190
+ chain: string
191
+ options?: BlockaidSolanaOptions[]
192
+ method?: string
193
+ }
194
+
195
+ export interface BlockaidSolanaAssetDiffSchema {
196
+ usd_price?: number | null
197
+ summary?: string | null
198
+ value: number
199
+ raw_value: number
200
+ }
201
+
202
+ export interface BlockaidSolanaSplFungibleAssetDetails {
203
+ type: 'TOKEN'
204
+ name: string
205
+ symbol: string
206
+ address: string
207
+ decimals: number
208
+ logo?: string | null
209
+ }
210
+
211
+ export interface BlockaidSolanaSplNonFungibleAssetDetails {
212
+ type: 'NFT'
213
+ name: string
214
+ symbol: string
215
+ address: string
216
+ decimals?: 0
217
+ logo?: string | null
218
+ }
219
+
220
+ export interface BlockaidSolanaCnftDetails {
221
+ type: 'CNFT'
222
+ name: string
223
+ symbol: string
224
+ address: string
225
+ decimals?: 0
226
+ logo?: string | null
227
+ }
228
+
229
+ export interface BlockaidSolanaTotalUsdDiff {
230
+ in: number
231
+ out: number
232
+ total?: number
233
+ }
234
+
235
+ interface BlockaidScanSolanaMessageAssetDiffMovement {
236
+ usd_price: number
237
+ summary: string
238
+ value: number
239
+ raw_value: number
240
+ }
241
+
242
+ export interface BlockaidScanSolanaMessageAssetDiff {
243
+ asset: Record<string, any>
244
+ in: BlockaidScanSolanaMessageAssetDiffMovement | null
245
+ out: BlockaidScanSolanaMessageAssetDiffMovement | null
246
+ }
247
+
248
+ export interface BlockaidScanSolanaMessageAccountDetails {
249
+ type: string
250
+ account_address: string
251
+ [k: string]: string | boolean | null
252
+ }
253
+
254
+ export interface BlockaidSolanaScanMessageCombinedValidationResult {
255
+ validation?: {
256
+ features: string[]
257
+ reason: string
258
+ result_type: BlockaidValidationResultType
259
+ }
260
+
261
+ simulation?: {
262
+ account_summary: {
263
+ account_assets_diff: BlockaidScanSolanaMessageAssetDiff[]
264
+ [k: string]: any
265
+ }
266
+ accounts_details: BlockaidScanSolanaMessageAccountDetails[]
267
+ assets_diff: Record<string, BlockaidScanSolanaMessageAssetDiff[]>
268
+ assets_ownership_diff: Record<string, Record<string, any>[]>
269
+ delegations: Record<string, Record<string, any>[]>
270
+ } | null
271
+ }
272
+
273
+ export interface BlockaidScanSolanaTxResponse {
274
+ data: {
275
+ rawResponse: {
276
+ encoding?: string
277
+ status?: string
278
+ error?: string | null
279
+ error_details?: Record<string, any> | null
280
+ request_id?: string | null
281
+ result?: BlockaidSolanaScanMessageCombinedValidationResult | null
282
+ }
283
+ }
284
+ }
285
+
286
+ export type BlockaidValidationResultTypeWithError =
287
+ | 'Malicious'
288
+ | 'Warning'
289
+ | 'Benign'
290
+ | 'Error'
291
+
292
+ export type BlockaidFeatureType = 'Benign' | 'Info' | 'Warning' | 'Malicious'
293
+
294
+ export interface BlockaidAddressFeature {
295
+ type: BlockaidFeatureType
296
+ feature_id: string
297
+ description: string
298
+ }
299
+
300
+ export interface BlockaidAddressScanResponse {
301
+ data: {
302
+ rawResponse: {
303
+ result_type: BlockaidValidationResultTypeWithError
304
+ features: BlockaidAddressFeature[] | string[]
305
+ error?: string
306
+ }
307
+ }
308
+ }
309
+
310
+ // Unified Address Scan Types
311
+ export interface BlockaidAddressScanRequest {
312
+ chain: string
313
+ address: string
314
+ metadata?: BlockaidMetadataDapp | BlockaidMetadataNonDapp
315
+ }
316
+
317
+ // URL/Site Scan Types
318
+ export interface BlockaidCatalogRequestMetadata {
319
+ type: 'catalog'
320
+ }
321
+
322
+ export interface BlockaidWalletRequestMetadata {
323
+ type: 'wallet'
324
+ walletconnect_name?: string
325
+ walletconnect_description?: string
326
+ account_address: string
327
+ }
328
+
329
+ export interface BlockaidMultipleWalletRequestMetadata {
330
+ type: 'wallet'
331
+ walletconnect_name?: string
332
+ walletconnect_description?: string
333
+ account_addresses: string[]
334
+ }
335
+
336
+ export type BlockaidSiteScanMetadata =
337
+ | BlockaidCatalogRequestMetadata
338
+ | BlockaidWalletRequestMetadata
339
+ | BlockaidMultipleWalletRequestMetadata
340
+
341
+ export interface BlockaidSiteScanRequest {
342
+ url: string
343
+ metadata?: BlockaidSiteScanMetadata
344
+ }
345
+
346
+ export interface BlockaidAttackEntry {
347
+ score: number
348
+ threshold: number
349
+ }
350
+
351
+ export interface BlockaidContractOperations {
352
+ contract_addresses: string[]
353
+ functions: Record<string, string[]>
354
+ }
355
+
356
+ export interface BlockaidSiteScanHitResponse {
357
+ status: 'hit'
358
+ url: string
359
+ scan_start_time: string
360
+ scan_end_time: string
361
+ malicious_score: number
362
+ is_reachable: boolean
363
+ is_web3_site: boolean
364
+ is_malicious: boolean
365
+ attack_types: Record<string, BlockaidAttackEntry>
366
+ network_operations: string[]
367
+ json_rpc_operations: string[]
368
+ contract_write: BlockaidContractOperations
369
+ contract_read: BlockaidContractOperations
370
+ }
371
+
372
+ export interface BlockaidSiteScanMissResponse {
373
+ status: 'miss'
374
+ }
375
+
376
+ export type BlockaidSiteScanResponse = {
377
+ data: {
378
+ rawResponse: BlockaidSiteScanHitResponse | BlockaidSiteScanMissResponse
379
+ }
380
+ }
381
+
382
+ // Token Scan Types
383
+ export interface BlockaidTokenMetadata {
384
+ domain?: string | null
385
+ }
386
+
387
+ export interface BlockaidBulkTokenScanRequest {
388
+ chain: string
389
+ tokens: string[]
390
+ metadata?: BlockaidTokenMetadata
391
+ }
392
+
393
+ export type BlockaidTokenResultType =
394
+ | 'Benign'
395
+ | 'Warning'
396
+ | 'Malicious'
397
+ | 'Spam'
398
+
399
+ export interface BlockaidAttackType {
400
+ score: string
401
+ threshold?: string
402
+ features?: Record<string, any>
403
+ }
404
+
405
+ export interface BlockaidAmount {
406
+ amount?: number | null
407
+ amount_wei?: string | null
408
+ }
409
+
410
+ export interface BlockaidFees {
411
+ transfer?: number | null
412
+ transfer_fee_max_amount?: number | null
413
+ buy?: number | null
414
+ sell?: number | null
415
+ }
416
+
417
+ export interface BlockaidFeature {
418
+ feature_id: string
419
+ type: BlockaidFeatureType
420
+ description: string
421
+ }
422
+
423
+ export interface BlockaidTradingLimits {
424
+ max_buy?: BlockaidAmount | null
425
+ max_sell?: BlockaidAmount | null
426
+ max_holding?: BlockaidAmount | null
427
+ sell_limit_per_block?: BlockaidAmount | null
428
+ }
429
+
430
+ export interface BlockaidTopHolder {
431
+ address?: string | null
432
+ holding_percentage?: number | null
433
+ }
434
+
435
+ export interface BlockaidFinancialStats {
436
+ supply?: number | null
437
+ holders_count?: number | null
438
+ usd_price_per_unit?: number | null
439
+ burned_liquidity_percentage?: number | null
440
+ locked_liquidity_percentage?: number | null
441
+ top_holders?: BlockaidTopHolder[]
442
+ total_reserve_in_usd?: number | null
443
+ dev_holding_percentage?: number | null
444
+ initial_snipers_holding_percentage?: number | null
445
+ snipers_holding_percentage?: number | null
446
+ bundlers_holding_percentage?: number | null
447
+ insiders_holding_percentage?: number | null
448
+ }
449
+
450
+ export interface BlockaidExternalLinks {
451
+ homepage?: string | null
452
+ twitter_page?: string | null
453
+ telegram_channel_id?: string | null
454
+ }
455
+
456
+ export interface BlockaidEvmMetadataToken {
457
+ type?: string | null
458
+ name?: string | null
459
+ symbol?: string | null
460
+ decimals?: number | null
461
+ image_url?: string | null
462
+ description?: string | null
463
+ deployer?: string | null
464
+ deployer_balance?: BlockaidAmount | null
465
+ contract_balance?: BlockaidAmount | null
466
+ owner_balance?: BlockaidAmount | null
467
+ owner?: string | null
468
+ creation_timestamp?: string | null
469
+ external_links?: BlockaidExternalLinks
470
+ urls?: string[] | null
471
+ malicious_urls?: string[] | null
472
+ token_creation_initiator?: string | null
473
+ }
474
+
475
+ export interface BlockaidSolanaMetadataToken {
476
+ type?: string | null
477
+ name?: string | null
478
+ symbol?: string | null
479
+ decimals?: number | null
480
+ image_url?: string | null
481
+ description?: string | null
482
+ deployer?: string | null
483
+ deployer_balance?: BlockaidAmount | null
484
+ contract_balance?: BlockaidAmount | null
485
+ owner_balance?: BlockaidAmount | null
486
+ owner?: string | null
487
+ creation_timestamp?: string | null
488
+ external_links?: BlockaidExternalLinks
489
+ urls?: string[] | null
490
+ malicious_urls?: string[] | null
491
+ token_creation_initiator?: string | null
492
+ mint_authority?: string | null
493
+ update_authority?: string | null
494
+ freeze_authority?: string | null
495
+ permanent_delegate?: string | null
496
+ }
497
+
498
+ export interface BlockaidBitcoinMetadataToken {
499
+ type?: string | null
500
+ name?: string | null
501
+ symbol?: string | null
502
+ decimals?: number | null
503
+ id?: string | null
504
+ number?: number | null
505
+ formatted_name?: string | null
506
+ }
507
+
508
+ export interface BlockaidTokenValidationResponse {
509
+ result_type: BlockaidTokenResultType
510
+ malicious_score: string
511
+ attack_types: Record<string, BlockaidAttackType>
512
+ chain: string
513
+ address: string
514
+ metadata:
515
+ | BlockaidEvmMetadataToken
516
+ | BlockaidSolanaMetadataToken
517
+ | BlockaidBitcoinMetadataToken
518
+ fees: BlockaidFees
519
+ features?: BlockaidFeature[] | null
520
+ trading_limits: BlockaidTradingLimits
521
+ financial_stats: BlockaidFinancialStats
522
+ }
523
+
524
+ export interface BlockaidBulkTokenScanResponse {
525
+ data: {
526
+ rawResponse: {
527
+ results: Record<string, BlockaidTokenValidationResponse>
528
+ }
529
+ }
530
+ }
@@ -15,3 +15,4 @@ export * from './yieldxyz'
15
15
  export * from './zero-x'
16
16
  export * from './lifi'
17
17
  export * from './hypernative'
18
+ export * from './blockaid'