@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/lib/commonjs/config/index.js +1 -0
- package/lib/commonjs/credentials/index.js +4 -2
- package/lib/commonjs/errors/http-error.js +27 -0
- package/lib/commonjs/errors/index.js +12 -1
- package/lib/commonjs/errors/portal-idempotency-error.js +74 -0
- package/lib/commonjs/errors/portal-policy-error.js +83 -0
- package/lib/commonjs/events/index.js +29 -0
- package/lib/commonjs/idempotency/index.js +74 -0
- package/lib/commonjs/index.js +14 -1
- package/lib/commonjs/version/version.json +1 -1
- package/lib/esm/config/index.js +1 -0
- package/lib/esm/credentials/index.js +5 -3
- package/lib/esm/errors/http-error.js +27 -0
- package/lib/esm/errors/index.js +2 -0
- package/lib/esm/errors/portal-idempotency-error.js +69 -0
- package/lib/esm/errors/portal-policy-error.js +77 -0
- package/lib/esm/events/index.js +29 -0
- package/lib/esm/idempotency/index.js +66 -0
- package/lib/esm/index.js +2 -1
- package/lib/esm/version/version.json +1 -1
- package/package.json +2 -2
- package/src/config/index.ts +1 -0
- package/src/credentials/index.ts +5 -3
- package/src/definitions/index.ts +48 -0
- package/src/errors/http-error.ts +40 -1
- package/src/errors/index.ts +14 -0
- package/src/errors/portal-idempotency-error.ts +91 -0
- package/src/errors/portal-policy-error.ts +97 -0
- package/src/events/index.ts +30 -0
- package/src/idempotency/index.ts +97 -0
- package/src/index.ts +16 -0
- package/src/version/version.json +1 -1
- package/types.d.ts +27 -11
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'
|
package/src/version/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "5.
|
|
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:
|
|
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
|
|
621
|
-
addressDetails
|
|
622
|
-
assetsDiffs
|
|
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
|
|
640
|
+
exposures?: Record<string, any>
|
|
626
641
|
status: string
|
|
627
|
-
totalUsdDiff
|
|
628
|
-
totalUsdExposure
|
|
642
|
+
totalUsdDiff?: Record<string, any>
|
|
643
|
+
totalUsdExposure?: Record<string, any>
|
|
644
|
+
error?: string
|
|
629
645
|
}
|
|
630
646
|
|
|
631
647
|
export interface BlockaidValidateTrxRes {
|