-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move evm logic to evm utils #521
Merged
Merged
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a4b42f9
refactor: move evm logic to evm-utils package
ErnoW 49b0320
style: fix naming of setupEvmApi
ErnoW 17fb78c
fix: fix eslint config
ErnoW 5ce7ad3
ci: cache format in nx
ErnoW 461f927
ci: fix versioning of packages
ErnoW 3e4e4b9
fix: remove debug function
ErnoW 34bd860
fix: import path
ErnoW 7d95435
fix: build of test-node typescript build
ErnoW da281bc
ci: fix prettier version
ErnoW 39599d2
chore: update changeset
ErnoW cb78f30
fix: allow errors when registering key
ErnoW beaae52
chore: rename of setupEvmUtils
ErnoW File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,16 @@ | |
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": ["@changesets/changelog-github", { "repo": "MoralisWeb3/Moralis-JS-SDK" }], | ||
"commit": false, | ||
"fixed": [["@moralisweb3/core", "@moralisweb3/evm-api"]], | ||
"fixed": [ | ||
[ | ||
"@moralisweb3/core", | ||
"@moralisweb3/auth", | ||
"@moralisweb3/api", | ||
"@moralisweb3/evm-utils", | ||
"@moralisweb3/evm-api", | ||
"@moralisweb3/sol-api" | ||
] | ||
], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "alpha", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
'test-node': patch | ||
'@moralisweb3/api': patch | ||
'@moralisweb3/auth': patch | ||
'@moralisweb3/core': patch | ||
'@moralisweb3/evm-api': patch | ||
'@moralisweb3/evm-utils': patch | ||
'@moralisweb3/integration': patch | ||
'moralis': patch | ||
--- | ||
|
||
Moved all Evm logic to @moralisweb3/evm-utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
{ | ||
"extends": "../../tsconfig.package.json", | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es2017", | ||
"outDir": "build", | ||
"outDir": "./build/", | ||
"declarationDir": "./build/", | ||
"rootDir": "./src", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "node", | ||
"lib": ["es2017"] | ||
"lib": ["es2017"], | ||
"composite": false | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { MoralisCoreProvider } from '@moralisweb3/core'; | ||
import { MoralisEvmUtils } from '@moralisweb3/evm-utils'; | ||
import { MoralisApi } from '@moralisweb3/api'; | ||
|
||
export const setupApi = () => { | ||
const core = MoralisCoreProvider.getDefault(); | ||
const api = MoralisApi.create(); | ||
const evmUtils = MoralisEvmUtils.create(); | ||
|
||
core.registerModules([api, evmUtils]); | ||
|
||
return core; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import { Config } from './Config'; | ||
import { CoreConfig } from './CoreConfig'; | ||
import { CoreConfigValidator } from './CoreConfigValidator'; | ||
|
||
export class CoreConfigSetup { | ||
public static register(config: Config) { | ||
config.registerKey(CoreConfig.logLevel); | ||
config.registerKey(CoreConfig.buidEnvironment); | ||
|
||
config.registerKey(CoreConfig.defaultNetwork); | ||
config.registerKey(CoreConfig.defaultEvmApiChain, (v) => CoreConfigValidator.requireValidChain(v)); | ||
|
||
config.registerKey(CoreConfig.formatEvmChainId); | ||
config.registerKey(CoreConfig.formatEvmAddress); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
import { SolNetworkish } from '../dataTypes'; | ||
import { CoreConfig } from './CoreConfig'; | ||
import { CoreConfig, EvmAddressFormat, EvmChainIdFormat } from './CoreConfig'; | ||
import { EvmChainish } from './interfaces/EvmChainish'; | ||
|
||
// @moralisweb3/core | ||
type CoreConfigType = typeof CoreConfig; | ||
type CoreConfigValues = { [Key in keyof CoreConfigType]: CoreConfigType[Key]['defaultValue'] }; | ||
|
||
// @moralisweb3/evm-utils | ||
interface EvmUtilsConfigValues { | ||
formatEvmAddress: EvmAddressFormat; | ||
formatEvmChainId: EvmChainIdFormat; | ||
} | ||
|
||
// @moralisweb3/api | ||
interface ApiConfigValues { | ||
apiKey: string; | ||
} | ||
|
||
// @moralisweb3/evm-api | ||
interface EvmApiConfigValues { | ||
defaultEvmApiChain: EvmChainish; | ||
} | ||
|
||
// @moralisweb3/sol-api | ||
interface SolApiConfigValues { | ||
defaultSolNetwork: SolNetworkish; | ||
} | ||
|
||
export type MoralisConfigValues = | ||
| CoreConfigValues | ||
| EvmUtilsConfigValues | ||
| ApiConfigValues | ||
| EvmApiConfigValues | ||
| SolApiConfigValues | ||
| { [key: string]: string | number }; // Other, not strong typed values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './Config'; | ||
export * from './CoreConfig'; | ||
export * from './MoralisConfig'; | ||
export * from './interfaces'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Note this is just an interface, used in the core config. | ||
* The implementations are located in the @moralisweb3/evm-utils package. | ||
*/ | ||
|
||
export interface EvmChainable { | ||
decimal: number; | ||
hex: string; | ||
apiHex: string; | ||
} | ||
|
||
export type EvmChainish = EvmChainable | string | number; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './EvmChainish'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
export * from './EvmChain'; | ||
export * from './EvmChainish'; | ||
export * from './EvmAddress'; | ||
export * from './EvmNative'; | ||
export * from './EvmTransaction'; | ||
export * from './EvmTransactionLog'; | ||
export * from './SolNetwork'; | ||
export * from './SolAddress'; | ||
export * from './SolNative'; | ||
export * from './tokens'; | ||
export * from './abstract'; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these dependencies here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only as long as it is being used by the Sol datatypes in core.