@exodus/web3-ethereum-utils 1.8.0 → 1.10.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,3 @@
1
+ import type { EthSimulateTransactionParams } from './types.js';
2
+ import type { AggregatedTransactionSimulationResult, CreateSimulateTransactionParams } from '@exodus/web3-types';
3
+ export declare const createSimulateTransaction: ({ serviceProvider, apiEndpoint, }: CreateSimulateTransactionParams) => ({ transaction, asset, shouldCallPreviewApi, }: EthSimulateTransactionParams) => Promise<AggregatedTransactionSimulationResult>;
@@ -0,0 +1,11 @@
1
+ import { createEmptySimulationResult } from '@exodus/web3-utils';
2
+ const SIMULATION_API_DEFAULT = 'https://simulation.a.exodus.io/simulate';
3
+ const SERVICE_PROVIDER_DEFAULT = 'blowfish';
4
+ /* eslint-disable @typescript-eslint/no-unused-vars */
5
+ export const createSimulateTransaction = ({ serviceProvider = SERVICE_PROVIDER_DEFAULT, apiEndpoint = SIMULATION_API_DEFAULT, }) => async ({ transaction, asset, shouldCallPreviewApi = true, }) => {
6
+ if (!transaction.to) {
7
+ return createEmptySimulationResult({ asset });
8
+ }
9
+ // ToDo: finish with an actual simulation attempt
10
+ return createEmptySimulationResult({ asset });
11
+ };
package/lib/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { SimulateTransactionParams } from '@exodus/web3-types';
1
2
  export interface EthChainParam {
2
3
  chainId: string;
3
4
  }
@@ -40,3 +41,7 @@ export interface EthWalletWatchAsset {
40
41
  type: string;
41
42
  options: EthWalletWatchAssetOptions;
42
43
  }
44
+ export interface EthSimulateTransactionParams extends SimulateTransactionParams {
45
+ transaction: EthTransaction;
46
+ shouldCallPreviewApi: boolean;
47
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@exodus/web3-ethereum-utils",
3
3
  "description": "Web3 Ethereum utils.",
4
- "version": "1.8.0",
4
+ "version": "1.10.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "module": "lib/index.js",
@@ -25,10 +25,14 @@
25
25
  "clean": "rimraf lib",
26
26
  "build": "yarn clean && tsc"
27
27
  },
28
+ "devDependencies": {
29
+ "@exodus/web3-types": "^1.16.0"
30
+ },
28
31
  "dependencies": {
29
32
  "@exodus/ethereumjs-common": "^2.4.0-exodus.6",
30
33
  "@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
34
+ "@exodus/web3-utils": "^1.5.0",
31
35
  "@metamask/eth-sig-util": "^4.0.1"
32
36
  },
33
- "gitHead": "4d705ac22b258fc6290d9a643dfab3880605be48"
37
+ "gitHead": "88c28467495b5524e3d0d0080e58ea9d5fbe7b11"
34
38
  }