@portal-hq/utils 4.1.5 → 4.1.7

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.
@@ -21,6 +21,7 @@ var Events;
21
21
  Events["GetTransactions"] = "Get Transactions";
22
22
  Events["PrepareClientEject"] = "Prepare Client Eject";
23
23
  Events["SimulateTransaction"] = "Simulate Transaction";
24
+ Events["EvaluateTransaction"] = "Evaluate Transaction";
24
25
  Events["StoreClientCipherText"] = "Store Client Cipher Text";
25
26
  Events["StoredClientBackupShare"] = "Stored Client Backup Share";
26
27
  Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.HttpRequester = exports.PortalRequests = exports.HttpRequest = exports.parseRequest = exports.numberToHexString = exports.getClientPlatformVersion = exports.Events = exports.RpcErrorCodes = exports.ProviderRpcError = exports.PortalMpcError = exports.PortalErrorCodeTypes = exports.PortalErrorCodes = exports.NoAddressError = exports.MpcSigningError = exports.MissingOptionError = exports.InvalidGatewayConfigError = exports.InvalidChainIdError = exports.InvalidApiKeyError = exports.HttpError = exports.CloudStorageReadError = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = exports.convert = exports.convertCryptoToLocal = exports.convertLocalToCrypto = exports.getChainNameForId = exports.getChainIdForName = exports.chainNameToId = exports.chainIdToName = void 0;
6
+ exports.EvaluateTransactionOperationType = exports.HttpRequester = exports.PortalRequests = exports.HttpRequest = exports.parseRequest = exports.numberToHexString = exports.getClientPlatformVersion = exports.Events = exports.RpcErrorCodes = exports.ProviderRpcError = exports.PortalMpcError = exports.PortalErrorCodeTypes = exports.PortalErrorCodes = exports.NoAddressError = exports.MpcSigningError = exports.MissingOptionError = exports.InvalidGatewayConfigError = exports.InvalidChainIdError = exports.InvalidApiKeyError = exports.HttpError = exports.CloudStorageReadError = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = exports.convert = exports.convertCryptoToLocal = exports.convertLocalToCrypto = exports.getChainNameForId = exports.getChainIdForName = exports.chainNameToId = exports.chainIdToName = void 0;
7
7
  var chains_1 = require("./chains");
8
8
  Object.defineProperty(exports, "chainIdToName", { enumerable: true, get: function () { return chains_1.chainIdToName; } });
9
9
  Object.defineProperty(exports, "chainNameToId", { enumerable: true, get: function () { return chains_1.chainNameToId; } });
@@ -44,3 +44,5 @@ var PortalRequests_1 = require("./PortalRequests");
44
44
  Object.defineProperty(exports, "PortalRequests", { enumerable: true, get: function () { return __importDefault(PortalRequests_1).default; } });
45
45
  var requesters_1 = require("./requesters");
46
46
  Object.defineProperty(exports, "HttpRequester", { enumerable: true, get: function () { return requesters_1.HttpRequester; } });
47
+ var types_1 = require("./types");
48
+ Object.defineProperty(exports, "EvaluateTransactionOperationType", { enumerable: true, get: function () { return types_1.EvaluateTransactionOperationType; } });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Runtime types that need to be exported as JavaScript
3
+ // (Interfaces and type aliases are handled in ../types.d.ts)
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.EvaluateTransactionOperationType = void 0;
6
+ var EvaluateTransactionOperationType;
7
+ (function (EvaluateTransactionOperationType) {
8
+ EvaluateTransactionOperationType["VALIDATION"] = "validation";
9
+ EvaluateTransactionOperationType["SIMULATION"] = "simulation";
10
+ EvaluateTransactionOperationType["ALL"] = "all";
11
+ })(EvaluateTransactionOperationType = exports.EvaluateTransactionOperationType || (exports.EvaluateTransactionOperationType = {}));
@@ -1 +1 @@
1
- { "version": "4.1.5" }
1
+ { "version": "4.1.7" }
@@ -19,6 +19,7 @@ var Events;
19
19
  Events["GetTransactions"] = "Get Transactions";
20
20
  Events["PrepareClientEject"] = "Prepare Client Eject";
21
21
  Events["SimulateTransaction"] = "Simulate Transaction";
22
+ Events["EvaluateTransaction"] = "Evaluate Transaction";
22
23
  Events["StoreClientCipherText"] = "Store Client Cipher Text";
23
24
  Events["StoredClientBackupShare"] = "Stored Client Backup Share";
24
25
  Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
package/lib/esm/index.js CHANGED
@@ -8,3 +8,4 @@ export { numberToHexString, parseRequest } from './eth-requests';
8
8
  export { default as HttpRequest } from './http-request';
9
9
  export { default as PortalRequests } from './PortalRequests';
10
10
  export { HttpRequester } from './requesters';
11
+ export { EvaluateTransactionOperationType } from './types';
@@ -0,0 +1,8 @@
1
+ // Runtime types that need to be exported as JavaScript
2
+ // (Interfaces and type aliases are handled in ../types.d.ts)
3
+ export var EvaluateTransactionOperationType;
4
+ (function (EvaluateTransactionOperationType) {
5
+ EvaluateTransactionOperationType["VALIDATION"] = "validation";
6
+ EvaluateTransactionOperationType["SIMULATION"] = "simulation";
7
+ EvaluateTransactionOperationType["ALL"] = "all";
8
+ })(EvaluateTransactionOperationType || (EvaluateTransactionOperationType = {}));
@@ -1 +1 @@
1
- { "version": "4.1.5" }
1
+ { "version": "4.1.7" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portal-hq/utils",
3
- "version": "4.1.5",
3
+ "version": "4.1.7",
4
4
  "main": "lib/commonjs/index",
5
5
  "module": "lib/esm/index",
6
6
  "source": "src/index",
@@ -26,5 +26,5 @@
26
26
  "ts-jest": "^29.0.3",
27
27
  "typescript": "^4.8.4"
28
28
  },
29
- "gitHead": "5ba19390f12935fc74b6235a4b2655a1e1c7a07f"
29
+ "gitHead": "d8be728d9b04f0c3e2577fd98b1e38282cc950ba"
30
30
  }
@@ -6,12 +6,15 @@ import {
6
6
  FundResponse,
7
7
  } from '@portal-hq/core/types'
8
8
 
9
+ import { EvaluateTransactionOperationType } from '../types'
9
10
  import type {
10
11
  AddressesByNamespace,
11
12
  BackupSharePairMetadata,
12
13
  Balance,
14
+ BlockaidValidateTrxRes,
13
15
  ClientResponse,
14
16
  Dapp,
17
+ EvaluateTransactionParam,
15
18
  GenerateResponse,
16
19
  GetTransactionsOrder,
17
20
  NFT,
@@ -96,6 +99,11 @@ export interface IPortalApi {
96
99
  params: SimulateTransactionParam,
97
100
  chainId?: string,
98
101
  ): Promise<SimulatedTransaction>
102
+ evaluateTransaction(
103
+ params: EvaluateTransactionParam,
104
+ chainId: string,
105
+ operationType?: EvaluateTransactionOperationType,
106
+ ): Promise<BlockaidValidateTrxRes>
99
107
  storeClientCipherText(
100
108
  backupSharePairId: string,
101
109
  cipherText: string,
@@ -19,6 +19,7 @@ enum Events {
19
19
  GetTransactions = 'Get Transactions',
20
20
  PrepareClientEject = 'Prepare Client Eject',
21
21
  SimulateTransaction = 'Simulate Transaction',
22
+ EvaluateTransaction = 'Evaluate Transaction',
22
23
  StoreClientCipherText = 'Store Client Cipher Text',
23
24
  StoredClientBackupShare = 'Stored Client Backup Share',
24
25
  StoredClientBackupShareKey = 'Stored Client Backup Share Key',
package/src/index.ts CHANGED
@@ -45,28 +45,36 @@ export { default as HttpRequest } from './http-request'
45
45
  export { default as PortalRequests } from './PortalRequests'
46
46
  export { HttpRequester } from './requesters'
47
47
 
48
- export {
49
- type Address,
50
- type Balance,
51
- type ClientWithCustodianData,
52
- type Dapp,
53
- type DappImage,
54
- type DappOnNetwork,
55
- type DkgData,
56
- type GetTransactionsOrder,
57
- type HttpOptions,
58
- type HttpRequestOptions,
59
- type HttpRequesterOptions,
60
- type MessageData,
61
- type MpcStatus,
62
- type NFT,
63
- type Network,
64
- type OutgoingRequest,
65
- type OutgoingRequestData,
66
- type ProgressCallback,
67
- type SignableTransactionData,
68
- type SigningRequestArguments,
69
- type SigningResponse,
70
- type Transaction,
71
- type Shares,
48
+ export { EvaluateTransactionOperationType } from './types'
49
+
50
+ export type {
51
+ Address,
52
+ Balance,
53
+ BlockaidAssetDiff,
54
+ BlockaidSimulation,
55
+ BlockaidValidateTrxRes,
56
+ BlockaidValidation,
57
+ BlockaidValidationFeature,
58
+ ClientWithCustodianData,
59
+ Dapp,
60
+ DappImage,
61
+ DappOnNetwork,
62
+ DkgData,
63
+ EvaluateTransactionParam,
64
+ GetTransactionsOrder,
65
+ HttpOptions,
66
+ HttpRequestOptions,
67
+ HttpRequesterOptions,
68
+ MessageData,
69
+ MpcStatus,
70
+ NFT,
71
+ Network,
72
+ OutgoingRequest,
73
+ OutgoingRequestData,
74
+ ProgressCallback,
75
+ SignableTransactionData,
76
+ SigningRequestArguments,
77
+ SigningResponse,
78
+ Transaction,
79
+ Shares,
72
80
  } from '../types'
package/src/types.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Runtime types that need to be exported as JavaScript
2
+ // (Interfaces and type aliases are handled in ../types.d.ts)
3
+
4
+ export enum EvaluateTransactionOperationType {
5
+ VALIDATION = 'validation',
6
+ SIMULATION = 'simulation',
7
+ ALL = 'all',
8
+ }
@@ -1 +1 @@
1
- { "version": "4.1.5" }
1
+ { "version": "4.1.7" }
package/types.d.ts CHANGED
@@ -368,6 +368,58 @@ export interface SimulatedTransaction {
368
368
  requestError?: SimulatedTransactionError
369
369
  }
370
370
 
371
+ export interface EvaluateTransactionParam {
372
+ to: string
373
+ value?: string
374
+ data?: string
375
+ maxFeePerGas?: string
376
+ maxPriorityFeePerGas?: string
377
+ gas?: string
378
+ gasPrice?: string
379
+ }
380
+
381
+ export interface BlockaidValidationFeature {
382
+ type: string
383
+ featureId: string
384
+ description: string
385
+ address?: string
386
+ }
387
+
388
+ export interface BlockaidValidation {
389
+ classification?: string
390
+ description?: string
391
+ features: BlockaidValidationFeature[]
392
+ reason?: string
393
+ resultType: string
394
+ status: string
395
+ }
396
+
397
+ export interface BlockaidAssetDiff {
398
+ asset: Record<string, any>
399
+ in: Record<string, any>[]
400
+ out: Record<string, any>[]
401
+ }
402
+
403
+ export interface BlockaidSimulation {
404
+ accountAddress?: string
405
+ accountSummary: Record<string, any>
406
+ addressDetails: Record<string, any>
407
+ assetsDiffs: Record<string, BlockaidAssetDiff[]>
408
+ block?: number
409
+ chain?: string
410
+ exposures: Record<string, any>
411
+ status: string
412
+ totalUsdDiff: Record<string, any>
413
+ totalUsdExposure: Record<string, any>
414
+ }
415
+
416
+ export interface BlockaidValidateTrxRes {
417
+ validation?: BlockaidValidation
418
+ simulation?: BlockaidSimulation
419
+ block?: number
420
+ chain: string
421
+ }
422
+
371
423
  export interface SigningSharePairMetadata {
372
424
  createdAt: string
373
425
  id: string