@portal-hq/utils 5.0.0 → 5.2.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/src/index.ts CHANGED
@@ -71,11 +71,27 @@ export {
71
71
  PortalErrorCodes,
72
72
  PortalErrorCodeTypes,
73
73
  PortalMpcError,
74
+ PortalIdempotencyError,
75
+ type PortalIdempotencyErrorReason,
76
+ PortalIdempotencyErrorId,
77
+ isIdempotencyKeyReused,
78
+ isIdempotencyRejection,
79
+ PortalPolicyError,
80
+ POLICY_ERROR_ID_PREFIX,
81
+ PolicyErrorId,
74
82
  isMpcAuthFailure,
83
+ isPolicyViolation,
84
+ mpcErrorFrom,
75
85
  ProviderRpcError,
76
86
  RpcErrorCodes,
77
87
  } from './errors'
78
88
 
89
+ export {
90
+ generateIdempotencyKey,
91
+ PORTAL_IDEMPOTENCY_KEY_HEADER,
92
+ validateIdempotencyKey,
93
+ } from './idempotency'
94
+
79
95
  export { default as Events } from './events'
80
96
 
81
97
  export { getClientPlatformVersion } from './version'
@@ -1 +1 @@
1
- { "version": "5.0.0" }
1
+ { "version": "5.2.0" }
package/types.d.ts CHANGED
@@ -62,6 +62,7 @@ interface ClientResponseMetadataNamespaces {
62
62
  bip122?: ClientResponseNamespaceMetadataItem
63
63
  stellar?: ClientResponseNamespaceMetadataItem
64
64
  tron?: ClientResponseNamespaceMetadataItem
65
+ xrpl?: ClientResponseNamespaceMetadataItem
65
66
  }
66
67
 
67
68
  interface ClientResponseNamespaceMetadataItem {
@@ -157,6 +158,7 @@ export interface AddressesByNamespace {
157
158
  solana?: string
158
159
  stellar?: string
159
160
  tron?: string
161
+ xrpl?: string
160
162
  /**
161
163
  * Bitcoin has no single canonical address: the encoding is per-network and
162
164
  * per-script-type, so addresses are keyed by script type and network rather
@@ -219,6 +221,17 @@ export interface Presignature {
219
221
  data: string
220
222
  }
221
223
 
224
+ /** Any value a JSON document can hold. */
225
+ export type JsonValue =
226
+ | string
227
+ | number
228
+ | boolean
229
+ | null
230
+ | JsonValue[]
231
+ | { [key: string]: JsonValue }
232
+
233
+ export type JsonObject = { [key: string]: JsonValue }
234
+
222
235
  export interface HttpErrorOptions {
223
236
  message: string
224
237
  status: number
@@ -302,6 +315,7 @@ export interface SigningRequestArguments {
302
315
  readonly sponsorGas?: boolean
303
316
  readonly signatureApprovalMemo?: string
304
317
  readonly traceId?: string
318
+ readonly idempotencyKey?: string
305
319
  }
306
320
 
307
321
  export interface SigningResponse {
@@ -597,16 +611,17 @@ export interface BlockaidValidationFeature {
597
611
  type: string
598
612
  featureId: string
599
613
  description: string
600
- address?: string
614
+ address?: string | null
601
615
  }
602
616
 
603
617
  export interface BlockaidValidation {
604
- classification?: string
605
- description?: string
618
+ classification?: string | null
619
+ description?: string | null
606
620
  features: BlockaidValidationFeature[]
607
- reason?: string
608
- resultType: string
621
+ reason?: string | null
622
+ resultType: 'Benign' | 'Warning' | 'Malicious' | 'Error'
609
623
  status: string
624
+ error?: string | null
610
625
  }
611
626
 
612
627
  export interface BlockaidAssetDiff {
@@ -617,15 +632,16 @@ export interface BlockaidAssetDiff {
617
632
 
618
633
  export interface BlockaidSimulation {
619
634
  accountAddress?: string
620
- accountSummary: Record<string, any>
621
- addressDetails: Record<string, any>
622
- assetsDiffs: Record<string, BlockaidAssetDiff[]>
635
+ accountSummary?: Record<string, any>
636
+ addressDetails?: Record<string, any>
637
+ assetsDiffs?: Record<string, BlockaidAssetDiff[]>
623
638
  block?: number
624
639
  chain?: string
625
- exposures: Record<string, any>
640
+ exposures?: Record<string, any>
626
641
  status: string
627
- totalUsdDiff: Record<string, any>
628
- totalUsdExposure: Record<string, any>
642
+ totalUsdDiff?: Record<string, any>
643
+ totalUsdExposure?: Record<string, any>
644
+ error?: string
629
645
  }
630
646
 
631
647
  export interface BlockaidValidateTrxRes {